MSVC++ 7.0
warns about the static_cast doing a conversion from
double to float in the following code snippet found in
sepKernel::separate() with T=complex<float>:
matrix<double> basis,factors;
matrix<T> rows,cols;
separator.apply(mtxNot0,basis,factors);
// fill with 0-cols and 0-rows (transpose of basis
+ 0-cols)
rows.resize(basis.columns(),basis.rows()+zeroCols.size(),
T(),false,false);
cols.resize(factors.columns(),factors.rows()+zeroRows.size(),
T(),false,false);
// fill the rows
for (y=0;y<rows.rows();++y) {
for
(x=0,i=0,itCols=zeroCols.begin();x<rows.columns();++x) {
if ((itCols==zeroCols.end()) || ((*itCols) != x)) {
rows.at(y,x) = static_cast<T>(basis.at(i,y));
++i;
} else {
rows.at(y,x) = T(0);
++itCols;
}
}
}
This warning is correct IMHO, as the static_cast uses
the ctor of complex<float> that takes one float
argument, defaulting the other to zero, but gets a
double from basis.
I'm not sure what the correct fix is here.
Is this just work-in-progress? Then maybe it would be
good to comment out the explicit instantiations in .cpp
for now?
Thanks, Peter