TMtx.SVDSolve Method

Overload List

#SignatureDescription
1Int32 SVDSolve(TMtx B, TMtx X, TVec S, Double Threshold)Matrix version of SVDSolve. Performs a SVDSolve for each U and V matrices columns in single pass.
2Int32 SVDSolve(TVec B, TVec X, TVec S, Double Threshold)Calculates the minimum norm solution to a real linear least squares problem.

Overload 1: Int32 SVDSolve(TMtx B, TMtx X, TVec S, Double Threshold)

Matrix version of SVDSolve. Performs a SVDSolve for each U and V matrices columns in single pass.

#NameTypeDescription
1BTMtxsource TMtx
2XTMtxsource TMtx
3STVecsource TVec
4ThresholdDoublescalar

Returns: Int32

Overload 2: Int32 SVDSolve(TVec B, TVec X, TVec S, Double Threshold)

Calculates the minimum norm solution to a real linear least squares problem.

#NameTypeDescription
1BTVecsource TVec
2XTVecsource TVec
3STVecsource TVec
4ThresholdDoublescalar

Returns: Int32

Remarks:

Calculates the minimum norm solution to a real linear least squares problem.

Minimize 2-norm(| b - A*x |).

using the singular value decomposition (SVD) of the calling matrix A. A is an Rows-by-Cols matrix which may be rank-deficient. Several right hand side vectors b and solution vectors x can be handled in a single call. The effective rank of A is determined by treating as zero those singular values which are less than Threshold times the largest singular value and is returned by the function. The S vector holds the singular values on the output.

Examples
TVec X;
TVec B;
TVec D;
TMtx V;
MtxVec.CreateIt(out X, out B, out D);
MtxVec.CreateIt(out V);
try
    {
        B.SetIt(false,new double[] {0,2,3});
        V.SetIt(3,3,false,[1,2,3,
        3,4,5,
        6,7,7]);

        V.SVDSolve(B,X,D); // matrix V can be non-quadratic
    }
finally
    {
        MtxVec.FreeIt(ref X, ref B, ref D);
        MtxVec.FreeIt(ref V);
    }
See Also: TMtx.SVD