Skip to content

code for mean_wt assignment for LW_Matrix case is wrong #13

@wStockhausen

Description

@wStockhausen

OLD Version:
case LW_MATRIX:
for ( int h = 1; h <= nsex; h++ )
for ( int i = syr; i <= nyrRetro+1; i++ )
for ( int l = 1; l <= nclass; l++ )
mean_wt(h,i,l) = mean_wt_in(i-syr+1,l);
break;
PROBLEM: the row indexing is wrong in mean_wt_in (it does not depend on "h", so you get values from rows corresponding to h=1 for any h)

SOLUTION:
case LW_MATRIX:
int ctr = 0;
for ( int h = 1; h <= nsex; h++ )
for ( int i = syr; i <= nyrRetro+1; i++ ){
ctr++;
for ( int l = 1; l <= nclass; l++ )
// mean_wt(h,i,l) = mean_wt_in(i-syr+1,l); //TODO (wts): indexing in mean_wt_in is wrong for row index
mean_wt(h,i,l) = mean_wt_in(ctr,l); //corrected indexing
}//--i and h
break;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions