15 #ifndef itkMatrixLinearCombinationFunctions_h
16 #define itkMatrixLinearCombinationFunctions_h
23 template <
typename TVnlMatrixFixed>
32 TVnlMatrixFixed X =
matrix;
36 while (fabs((X*X - matrix).array_inf_norm()) > tolerance)
38 TVnlMatrixFixed iX = vnl_matrix_inverse<typename TVnlMatrixFixed::element_type>(X).inverse();
39 TVnlMatrixFixed iY = vnl_matrix_inverse<typename TVnlMatrixFixed::element_type>(Y).inverse();
53 double j = std::max(0.0, 1.0+floor(log(matrix.array_inf_norm())/log(2.0)));
54 TVnlMatrixFixed A = matrix*pow(2.0, -j);
64 for (
int k = 1; k <=
q; k++)
66 c = c*(q-k+1.0)/(k*(2.0*q-k+1.0));
69 D = D + X*(pow(-1.0, k)*
c);
72 X = vnl_matrix_inverse<typename TVnlMatrixFixed::element_type>(D).inverse()*N;
88 TVnlMatrixFixed A =
matrix;
92 while (fabs((A-I).array_inf_norm()) > 0.5)
98 TVnlMatrixFixed Z = A;
99 TVnlMatrixFixed X = A;
101 while (Z.array_inf_norm() > tolerance)
108 X = -X * pow(2.0, k);
116 #ifndef ITK_MANUAL_INSTANTIATION
117 #include "itkMatrixLinearCombinationFunctions.txx"
static TVnlMatrixFixed ComputeMatrixLogarithm(const TVnlMatrixFixed &matrix, typename TVnlMatrixFixed::element_type tolerance)
Compute the matrix logarithm according to "Linear combination of transformations", Marc Alex, Volume 21, Issue 3, ACM SIGGRAPH 2002.
Definition: itkMatrixLinearCombinationFunctions.h:85
const GLfloat * c
Definition: glew.h:14144
Definition: niftkITKAffineResampleImage.cxx:74
static TVnlMatrixFixed ComputeMatrixSquareRoot(const TVnlMatrixFixed &matrix, typename TVnlMatrixFixed::element_type tolerance)
Compute the square root of a matrix according to "Linear combination of transformations", Marc Alex, Volume 21, Issue 3, ACM SIGGRAPH 2002.
Definition: itkMatrixLinearCombinationFunctions.h:30
GLdouble GLdouble GLdouble GLdouble q
Definition: glew.h:1398
static TVnlMatrixFixed ComputeMatrixExponential(const TVnlMatrixFixed &matrix)
Compute the matrix exponential according to "Linear combination of transformations", Marc Alex, Volume 21, Issue 3, ACM SIGGRAPH 2002.
Definition: itkMatrixLinearCombinationFunctions.h:51
int Round(double d)
Definition: niftkConversionUtils.cxx:160
GLuint GLenum matrix
Definition: glew.h:12775
GLuint index
Definition: glew.h:1798
Definition: itkMatrixLinearCombinationFunctions.h:24