* @brief Solves the linear system \f$ A X = B \f$ and returns \f$ X \f$ in the least-squares sense.
* Iterative method for large sparse matrices.
* @param A MatrixD
* @param B VectorD
* @param A MatrixD.
* @param B VectorD.
* @return VectorD Solution X.
*/
VectorDsolve(constMatrixD&A,constVectorD&B);
// ##### GETTERS & SETTERS #####
doublegetToleranceA()const;
voidsetToleranceA(doubleatol);
doublegetToleranceB()const;
voidsetToleranceB(doublebtol);
doublegetConditionNumberLimit()const;
voidsetConditionNumberLimit(doubleconlim);
doublegetDamping()const;
voidsetDamping(doubledamp);
size_tgetMaximumIerations()const;
voidsetMaximumIerations(size_tmaxiter);
doublegetToleranceA()const;///< Stopping tolerance. LSMR continues iterations until a certain backward error estimate is smaller than some quantity depending on atol and btol.
voidsetToleranceA(doubleatol);///< Stopping tolerance. LSMR continues iterations until a certain backward error estimate is smaller than some quantity depending on atol and btol.
doublegetToleranceB()const;///< Stopping tolerance. LSMR continues iterations until a certain backward error estimate is smaller than some quantity depending on atol and btol.
voidsetToleranceB(doublebtol);///< Stopping tolerance. LSMR continues iterations until a certain backward error estimate is smaller than some quantity depending on atol and btol.
doublegetConditionNumberLimit()const;///< LSMR terminates if an estimate of `cond(A)` exceeds conlim.
voidsetConditionNumberLimit(doubleconlim);///< LSMR terminates if an estimate of `cond(A)` exceeds conlim.
doublegetDamping()const;///< Damping factor for regularized least-squares.
voidsetDamping(doubledamp);///< Damping factor for regularized least-squares.
size_tgetMaximumIerations()const;///< LSMR terminates if the number of iterations reaches maxiter.
voidsetMaximumIerations(size_tmaxiter);///< LSMR terminates if the number of iterations reaches maxiter.
/**
*
* @return Reference to the stream where the output is written.
*/
ElemUtils::Formatter&getOutput()const;
/**
*
* @param output Reference to the stream where the output is written.
*/
voidsetOutput(ElemUtils::Formatter&output);
doublegetConditionNumber()const;
unsignedintgetStoppingCase()const;
size_tgetNumberIterations()const;
unsignedintgetStoppingCase()const;///< Reason for stopping the iterations.
size_tgetNumberIterations()const;///< Number of iterations.
doublegetNormA()const;
doublegetNormAr()const;
doublegetNormr()const;
doublegetNormX()const;
conststd::string&getStoppingMessage()const;
conststd::string&getStoppingMessage()const;///< Reason for stopping the iterations.
private:
// ##### Parameters of the solver #####
doublem_damp;
doublem_atol;
doublem_btol;
doublem_conlim;
size_tm_maxiter;
ElemUtils::Formatter*m_output;
doublem_damp;///< Damping factor for regularized least-squares.
doublem_atol;///< Stopping tolerance. LSMR continues iterations until a certain backward error estimate is smaller than some quantity depending on atol and btol.
doublem_btol;///< Stopping tolerance. LSMR continues iterations until a certain backward error estimate is smaller than some quantity depending on atol and btol.
doublem_conlim;///< LSMR terminates if an estimate of `cond(A)` exceeds conlim.
size_tm_maxiter;///< LSMR terminates if the number of iterations reaches maxiter.
ElemUtils::Formatter*m_output;///< Pointer to the stream where to write the output.
// ##### Results of the solver #####
unsignedintm_istop;
size_tm_itn;
unsignedintm_istop;///< Reason for stopping the iterations.
size_tm_itn;///< Number of iterations.
doublem_normr,m_normar,m_normA,m_condA,m_normx;
std::stringm_stopMessage;
std::stringm_stopMessage;///< Reason for stopping the iterations.