[ITK-users] VariableLengthVector and multiplication
Cyril Mory
cyril.mory at creatis.insa-lyon.fr
Wed Nov 22 04:41:35 EST 2017
Dear ITK users,
I am using itk::VectorImage in some of my code, which uses
itk::VariableLengthVector as pixel type. And I am wondering why
itk::VariableLengthVector has so little support for multiplication.
Currently, the * operator only supports multiplication by a scalar.
It probably isn't simple, but I would need three additional kinds of
multiplication:
- dot product with another VariableLengthVector (that has the same
length, although it is probably a waste of time to perform the check
every time), returning a scalar
- component-wise multiplication, returning a VariableLengthVector of the
same length
- left or right multiplication with a matrix (possibly an
itk::VariableSizeMatrix) that has the correct size, but I understand
that this is probably the most complex one, and since it only occurs
rarely in my code, I can handle it with conversions to vnl::vector and
vnl::matrix
Are there constraints that prevent at least the dot product and
component-wise multiplication operators from being implemented ? If not,
then I'd be happy to give it a try. Since both differ only by the return
type, two different operators would have to be used (I guess). Do you
have suggestions (which one should use *, and what should be the other
operator) ? In itk::Vector and itk::CovariantVector, the * operator is
used for dot product.
Regards,
Cyril
More information about the Insight-users
mailing list