cwise Operations
Submitted by Timo Sachsenberg
Assigned to Nobody
Link to original bugzilla bug (#1487)
Version: 3.3 (current stable)
Description
Hi,
I love the tables that show what/how operations can be performed on matrices and vectors. Unfortunately, documentation falls a bit short for sparse matrices and sparse vectors. Assuming that most of you guys probably spend their precious time working on other topics I think it would still make a great difference to provide such a table on e.g.: https://eigen.tuxfamily.org/dox/group__TutorialSparse.html
I had some troubles (and still don't fully understand) why:
(sv1 - sv2).cwiseAbs() or sv1.sum() works but e.g.:
sv1.cwiseMin(1.0) doesn't (requires sv1.coeffs().cwiseMin(1.0))
I also quite often run into errors like:
error: ‘const CwiseAbsReturnType’ has no member named ‘coeffs’
float sum = (sv1 - sv2).cwiseAbs().coeffs().cwiseMax(0).sum();
or error: ‘Constant’ is not a member of ‘Eigen::CwiseUnaryOp<Eigen::internal::scalar_abs_op<float>, const Eigen::SparseVector<float> >’
float sum = sv1.cwiseAbs().cwiseMax(0).sum();
while: float sum = sv1.coeffs().cwiseMax(0).sum(); compiles
I guess these are probably newbie errors but I thought it might be worth to give feedback and some hints where the documentation could be improved,
Timo