GMACS-project/GMACS_Assessment_code

code for mean_wt assignment for LW_Matrix case is wrong

Opened this issue · 0 comments

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;