libgenua Basic Geometry, Numerical Algorithms and Interfaces
LsqrSolver< Scalar > Class Template Reference

## Detailed Description

### template<typename Scalar> class LsqrSolver< Scalar >

LSQR: Iterative solver for least-squares problems.

The operator 'A' passed to solve() needs to provide the interface

```  void muladd(const DVector<Scalar> &x, DVector<Scalar> &y);
void muladdTransposed(const DVector<Scalar> &x, DVector<Scalar> &y);
```

which compute y = A*x and y = transpose(A)*x.

This implementation differs from the LSQR paper in that it includes an additional termination criterion based on the scaled length of x. In trust- region methods for least-squares problems, a solution |s*x| < delta is often needed, and in that case, it may be advantageous to truncate LSQR early based on the scaled radius criterion.

CraigSolver, LsmrSolver

`#include <lsqr.h>`

Inheritance diagram for LsqrSolver< Scalar >:
[legend]
Collaboration diagram for LsqrSolver< Scalar >:
[legend]

## Public Member Functions

void maxRadius (const DVector< Scalar > &s, Scalar r)
optional termination: stop if |s*x| >= r

optional termination: stop if |x| >= r

template<class Operator >
ExitCode solve (const Operator &A, const DVector< Scalar > &b, DVector< Scalar > &x, Scalar lambda=0)
minimize |Ax - b|^2 + lambda |x|^2

Public Member Functions inherited from SolIterativeSolver
void tolerance (int maxiter, double atoler, double btoler, double conlim=1e8)
set convergence tolerances and maximum number of iterations

## Private Member Functions

bool radiusExceeded (const DVector< Scalar > &x) const

void steihaugPoint (const DVector< Scalar > &xp, DVector< Scalar > &x)
blend xp and x such that |x| = delta

## Private Attributes

DVector< Scalar > m_work [3]
work space, to avoid re-allocation when solve() is called often

DVector< Scalar > m_xscale
scaling vector used to constrain |s*x|^2 < m_xrsq

Scalar m_xrsq = 0
permitted squared length of x (0 means no constraint)

Static Public Member Functions inherited from SolIterativeSolver
static const char * statusMessage (int code)
access text corresponding to error code

static bool success (int code)
does exit code indicate succes (in some sense, at least)?

Protected Attributes inherited from SolIterativeSolver
double m_atol = 1e-6
convergence criteria

double m_btol = 1e-6
convergence criteria

double m_conlim = 1e8
condition number limit (actually, limit for the estimated condition)

size_t m_maxiter = 128
permitted number of iteration

The documentation for this class was generated from the following file: