# Symmetric Second Rank Tensor Multiply

Kris Zygmunt
2012-05-29
BUG: SymmetricSecondRankTensor Pre and PostMultiply return wrong type SymmetricSecondRankTensor&apos;s PreMultiply and PostMultiply methods return a tensor instead of a matrix, but multiplying a tensor by a matrix is not guaranteed to produce a symmetric tensor as a result. Thus this method has been throwing away valuable information in the lower triangle of the matrix and producing incorrect answers as a result.

The solution is to return a Matrix instead of a tensor from both methods.

typedef itk::SymmetricSecondRankTensor<double,3> Double3DTensorType; typedef itk::Matrix<double, 3, 3> Double3DMatrixType; Double3DTensorType tensor3D; Double3DMatrixType matrix3D; Double3DTensorType result1 = tensor3D.PreMultiply( matrix3D );
typedef itk::SymmetricSecondRankTensor<double,3> Double3DTensorType; typedef itk::Matrix<double, 3, 3> Double3DMatrixType; Double3DTensorType tensor3D; Double3DMatrixType matrix3D; Double3DMatrixType result1 = tensor3D.PreMultiply( matrix3D );
typedef itk::SymmetricSecondRankTensor<double,3> Double3DTensorType; typedef itk::Matrix<double, 3, 3> Double3DMatrixType; Double3DTensorType tensor3D; Double3DMatrixType matrix3D; Double3DTensorType result1 = tensor3D.PreMultiply( matrix3D ).PostMultiply( matrix3D.GetTranspose() );
typedef itk::SymmetricSecondRankTensor<double,3> Double3DTensorType; typedef itk::Matrix<double, 3, 3> Double3DMatrixType; Double3DTensorType tensor3D; Double3DMatrixType matrix3D; Double3DTensorType result1 = tensor3D.Rotate( matrix3D );
Id67b52af2f78a4c56336e00680d4f2fdfaec408d
Modules/Core/Common/include/itkSymmetricSecondRankTensor.h Modules/Core/Common/include/itkSymmetricSecondRankTensor.hxx Modules/Core/Common/test/itkSymmetricSecondRankTensorTest.cxx
PreMultiply
PostMultiply