[Insight-developers] ICE VS 6.0 : Adding SymmetricSecondRankTensor interactions with Matrix & Transform classes

Luis Ibanez luis.ibanez at kitware.com
Wed Mar 12 15:06:09 EDT 2008


Hi Steve,

I agree with your points about the drawbacks of using the operator*()
for implementing the Matrix x Tensor multiplication.

Our beloved friend, the Visual Studio 6.0 compiler, also agrees to
the point that it crashes when trying to compile the operator*()    :-)

http://www.itk.org/Testing/Sites/dash13.kitware/Win32-vs60/20080310-2159-Continuous/BuildError.html

So,
we opted for following your suggestion and created
two explicit methods:


         Self PreMultiply(  const MatrixType & m ) const;
         Self PostMultiply( const MatrixType & m ) const;


http://www.itk.org/cgi-bin/viewcvs.cgi/Code/Common/itkSymmetricSecondRankTensor.h?root=Insight&r1=1.24&r2=1.25&sortby=date
http://www.itk.org/cgi-bin/viewcvs.cgi/Code/Common/itkSymmetricSecondRankTensor.txx?root=Insight&r1=1.13&r2=1.14&sortby=date


We plan now to use them as support for performing the double
matrix product in the TransformMatrixOffsetBase class.


    Regards,


       Luis


-----------------------
Steve M. Robbins wrote:
> Hi Luis,
> 
> Your description of the Motivation, Math, and Implementation
> is very clear.
> 
> 
> On Mon, Mar 10, 2008 at 01:56:26PM -0400, Luis Ibanez wrote:
> 
> 
>>Please let us know if you find any flaws in the concepts
>>or in the implementation plans.
>>
>>
>>We look forward to your suggestions on how to implement
>>this functionality in a better way.
> 
> 
> I don't see any flaws in what you propose.  It makes perfect sense to
> create a function that multiplies a matrix by the matrix
> representation of a second rank tensor.  However, I have misgivings
> about using operator* for this.  I'm having a hard time explaining my
> misgivings; I hope what follows makes some sense.
> 
> I generally subscribe to the view that the C++ type should be faithful
> to its real-world counterpart.  For example: even though a Point is
> often implemented as an array of coordinate values, you should not be
> able to use a Point and coordinate array interchangeably.  One reason
> for this is type safety: a Vector is also implemented as an array of
> values but you don't want "vector - point" to compile.  The expression
> "point - vector", on the other hand, is perfectly legitimate.
> 
> In a similar way, multiplication of a matrix by a tensor doesn't seem
> to fit the real world concepts.  At least, not to me at first glance.
> I guess the test is this: can you document the new operator*() without
> treating the tensor as a matrix?  If not, perhaps the function could
> be named PremultiplyAsMatrix() or similar?
> 
> Regards,
> -Steve


More information about the Insight-developers mailing list