From 3110c11bc6f133a69109b8c396ceac7e39ebdd5c Mon Sep 17 00:00:00 2001 From: Julien Malik <julien.malik@c-s.fr> Date: Sun, 21 Nov 2010 19:15:43 +0100 Subject: [PATCH] ENG: use vnl_svd instead of sparse system solver --- Code/Radiometry/otbSarParametricMapFunction.txx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Code/Radiometry/otbSarParametricMapFunction.txx b/Code/Radiometry/otbSarParametricMapFunction.txx index 98d391ea0b..a962a3c4bd 100644 --- a/Code/Radiometry/otbSarParametricMapFunction.txx +++ b/Code/Radiometry/otbSarParametricMapFunction.txx @@ -28,9 +28,7 @@ #include "otbImageKeywordlist.h" #include "base/ossimKeywordlist.h" -#include <vnl/algo/vnl_lsqr.h> -#include <vnl/vnl_sparse_matrix_linear_system.h> -#include <vnl/vnl_least_squares_function.h> +#include <vnl/algo/vnl_svd.h> namespace otb { @@ -150,8 +148,9 @@ SarParametricMapFunction<TInputImage, TCoordRep> unsigned int nbRecords = pointSet->GetNumberOfPoints(); unsigned int nbCoef = m_Coeff.Rows() * m_Coeff.Cols(); - vnl_sparse_matrix<double> a(nbRecords, nbCoef); + vnl_matrix<double> a(nbRecords, nbCoef); vnl_vector<double> b(nbRecords), bestParams(nbCoef); + a.fill(0); b.fill(0); bestParams.fill(0); @@ -176,12 +175,9 @@ SarParametricMapFunction<TInputImage, TCoordRep> } } - // Create the linear system - vnl_sparse_matrix_linear_system<double> linearSystem(a, b); - - // And solve it - vnl_lsqr linearSystemSolver(linearSystem); - linearSystemSolver.minimize(bestParams); + // Solve linear system with SVD decomposition + vnl_svd<double> svd(a); + bestParams = svd.solve(b); for (unsigned int xcoeff = 0; xcoeff < m_Coeff.Cols(); ++xcoeff) { -- GitLab