I want to apply a unary operator, particualrly abs(), elementwise to a dense_vector< double>.
Is there a native variant to do this (rather than building manually a loop)? If so, I would need a brief explanation of the concept.
I browsed in the MTL4 Entire Manual and couldn't figure out, how to do it. It seems that I, somehow, have to define a corresponding functor. Is it mtl::sfunctor::abs? If so, how do I apply it to a vector?
After a quick glance through source of
dense_vector
, it seems like a standard conformant container. Therefore, this should work: