I have tried writing a function which takes a ColXpr
value as input:
typedef Eigen::Array Signal2D;
vo
To add to the answer above:
Eigen return expressions are temporaries. E.g. ColXpr
is just a small copyable object that gives you access to the array data. It is returned by value, ColXpr col(...)
. You can capture the ColXpr temporary with const reference but not otherwise.
However you can write:
void Threshold(Matrix::ColXpr col);
Generally, it is frowned upon to modify Eigen expression in functions. The preferred way is to write unary/binary functors/lambdas eg:
array.col(i) = array.col(i).unaryExpr(
[](const float &value) {
return float(value >= 0);
}
);
Btw, if you intend to write generic Eigen functions, use Eigen::EigenBase
as arguments to capture any eigen expression, see http://eigen.tuxfamily.org/dox/TopicFunctionTakingEigenTypes.html
Boost serialization requires non-temporary reference as well, even the operand is being written to an archive.