2 #include <itkTimeProbe.h> 10 itk::TimeProbe tmpTime;
13 OptimizerType::Pointer optTest = OptimizerType::New();
15 unsigned int dimX = 72;
16 unsigned int dimY = 2;
17 OptimizerType::MatrixType testData (dimX,dimY);
18 std::ifstream dataMat(
"/Users/ocommowi/Documents/Tmp2/dataMatrix.txt");
20 for (
unsigned int i = 0;i < dimX;++i)
22 for (
unsigned int j = 0;j < dimY;++j)
23 dataMat >> testData(i,j);
26 std::cout <<
"Test data " << testData << std::endl;
28 OptimizerType::ParametersType testPoints(dimX);
29 std::ifstream bVector(
"/Users/ocommowi/Documents/Tmp2/bVector.txt");
31 for (
unsigned int i = 0;i < dimX;++i)
32 bVector >> testPoints[i];
34 std::cout <<
"Test points " << testPoints << std::endl;
36 optTest->SetDataMatrix(testData);
37 optTest->SetPoints(testPoints);
38 optTest->SetSquaredProblem(
false);
40 optTest->StartOptimization();
44 std::cout <<
"Computation time: " << tmpTime.GetTotal() << std::endl;
45 std::cout << optTest->GetCurrentPosition() << std::endl;
Non negative least squares optimizer. Implements Lawson et al method, of squared problem is activated...