**ACTION:**- From a given vector and the SVD of a matrix (as obtained from
the sla_SVD routine), obtain the solution vector.
This routine solves the equation:

where:**A****x**=**b**

by means of the**A**is a given*m*(rows) (columns) matrix, where**x**is the*n*-vector we wish to find, and**b**is a given*m*-vector*Singular Value Decomposition*method (SVD). **CALL:**`CALL sla_SVDSOL (M, N, MP, NP, B, U, W, V, WORK, X)`

**GIVEN:**-

*M,N***I***m*,*n*, the numbers of rows and columns in matrix**A***MP,NP***I**physical dimensions of array containing matrix **A***B***D(M)**known vector **b***U***D(MP,NP)**array containing matrix **U***W***D(N)**diagonal matrix **W**(diagonal elements only)*V***D(NP,NP)**array containing orthogonal matrix **V**

**RETURNED:**-

*WORK***D(N)**workspace *X***D(N)**unknown vector **x**

**NOTES:**- 1.
- In the Singular Value Decomposition method (SVD),
the matrix
**A**is first factorized (for example by the routine sla_SVD) into the following components:

where:**A**=**U****W****V**^{T}

Note that**A**is any*m*(rows) (columns) matrix, where*m*>*n***U**is an column-orthogonal matrix**W**is an diagonal matrix with**V**^{T}is the transpose of an orthogonal matrix*m*and*n*are the*logical*dimensions of the matrices and vectors concerned, which can be located in arrays of larger*physical*dimensions MP and NP. The solution is then found from the expression:**x**=**V****W****U****b**) - 2.
- If matrix
**A**is square, and if the diagonal matrix**W**is not altered, the method is equivalent to conventional solution of simultaneous equations. - 3.
- If
*m*>*n*, the result is a least-squares fit. - 4.
- If the solution is poorly determined, this shows up in the
SVD factorization as very small or zero
**W**_{j}values. Where a**W**_{j}value is small but non-zero it can be set to zero to avoid ill effects. The present routine detects such zero**W**_{j}values and produces a sensible solution, with highly correlated terms kept under control rather than being allowed to elope to infinity, and with meaningful values for the other terms.

**REFERENCE:***Numerical Recipes*, section 2.9.

Starlink User Note 67

P. T. Wallace

12 October 1999

E-mail:ptw@star.rl.ac.uk