@MattPlumlee In the file src/linalg.cpp, within the function domultgesub_(), on lines 145 and 152, it looks like there are missing scope delimiters (curly braces), possibly leading to erroneous results.
More specifically, the missing scope delimiters in the for loops may lead to the out vector and/or the outge matrix not being constructed properly. In turn, both out and outge may contain garbage values, dependent on previous runs and/or uninitialised memory.
|
for (uword l = 0; l < terms.n_cols; ++l) |
|
if(terms.at(k,l)>0) temp %= basemat.col(knotptst[l]+terms.at(k,l)); |
|
out += temp; |
|
for (uword l = 0; l < (gest.n_elem-1); ++l) { |
|
if(terms.at(k,hypmatch[l])>0){ |
|
tempalt.fill(a[k]); |
|
|
|
for (uword m = 0; m < terms.n_cols; ++m) |
|
if(terms.at(k,m)>0 && m != hypmatch[l]) |
|
tempalt %= basemat.col(knotptst[m]+terms.at(k,m)); |
|
|
|
outge.col(l) += tempalt%basematge.col(gest[l]+ |
|
terms.at(k,hypmatch[l]))-temp%basematge.col(gest[l]); |
|
} |
|
} |
g++ 12.3.1 produces these warnings:
linalg.cpp: In function ‘void domultgesub_(arma::vec&, arma::mat&, const arma::vec&, arma::vec&, arma::vec&, const arma::umat&, const arma::uvec&, const arma::mat&, const arma::mat&, const arma::uvec&, const arma::uvec&, const arma::uword&)’:
linalg.cpp:145:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
145 | for (uword l = 0; l < terms.n_cols; ++l)
| ^~~
linalg.cpp:147:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
147 | out += temp;
| ^~~
linalg.cpp:152:9: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
152 | for (uword m = 0; m < terms.n_cols; ++m)
| ^~~
linalg.cpp:156:11: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
156 | outge.col(l) += tempalt%basematge.col(gest[l]+
| ^~~~~
CC @eddelbuettel
@MattPlumlee In the file src/linalg.cpp, within the function domultgesub_(), on lines 145 and 152, it looks like there are missing scope delimiters (curly braces), possibly leading to erroneous results.
More specifically, the missing scope delimiters in the
forloops may lead to theoutvector and/or theoutgematrix not being constructed properly. In turn, bothoutandoutgemay contain garbage values, dependent on previous runs and/or uninitialised memory.outerbase/src/linalg.cpp
Lines 145 to 159 in 927cf78
g++ 12.3.1 produces these warnings:
CC @eddelbuettel