<div dir="ltr"><div>Hi.<br><br></div>I've been debugging one test that was showing different results on VS2012 and MinGW and found out that ImageMomentsCalculator gives different results (Compute() method). Do I have wrongly built ITK or it really gives different results? First difference is very small, but later it becomes bigger and bigger (up to 4th decimal in double).<br>
<br>#include <itkMatrix.h><br>#include <fstream><br>#include <vnl/algo/vnl_symmetric_eigensystem.h><br><br>int main()<br> {<br> typedef itk::Matrix<double, 3, 3> MatrixType;<br> MatrixType matrix;<br>
matrix(0, 0) = 0.45000000000000018;<br> matrix(0, 1) = -0.15000000000000036;<br> matrix(0, 2) = -0.15000000000000036;<br> matrix(1, 0) = -0.15000000000000036;<br> matrix(1, 1) = 0.44999999999999929;<br> matrix(1, 2) = -0.14999999999999858;<br>
matrix(2, 0) = -0.15000000000000036;<br> matrix(2, 1) = -0.14999999999999858;<br> matrix(2, 2) = 0.44999999999999929;<br> <br> vnl_symmetric_eigensystem<double> eigen(matrix.GetVnlMatrix());<br> vnl_diag_matrix<double> diagonal_matrix = eigen.D;<br>
<br>#ifdef _MSC_VER<br> std::ofstream output_file("C:/temp/result_vs.txt");<br>#else<br> std::ofstream output_file("C:/temp/result_mingw.txt");<br>#endif<br> output_file.precision(std::numeric_limits<double>::digits10 + 2);<br>
for (auto i = 0; i < 3; ++i)<br> output_file << diagonal_matrix(i, i) << " ";<br> return 0;<br> }<br><br><br><br><br><br><br></div>