functions in matrix.i - S
SVdec
s= SVdec(a, u, vt) or s= SVdec(a, u, vt, full=1) performs the singular value decomposition of the m-by-n matrix A: A = (U(,+) * SIGMA(+,))(,+) * VT(+,) where U is an m-by-m orthogonal matrix, VT is an n-by-n orthogonal matrix, and SIGMA is an m-by-n matrix which is zero except for its min(m,n) diagonal elements. These diagonal elements are the return value of the function, S. The returned S is always arranged in order of descending absolute value. U(,1:min(m,n)) are the left singular vectors corresponding to the min(m,n) elements of S; VT(1:min(m,n),) are the right singular vectors. (The original A matrix maps a right singular vector onto the corresponding left singular vector, stretched by a factor of the singular value.) Note that U and VT are strictly outputs; if you don't need them, they need not be present in the calling sequence. By default, U will be an m-by-min(m,n) matrix, and V will be a min(m,n)-by-n matrix (i.e.- only the singular vextors are returned, not the full orthogonal matrices). Set the FULL keyword to a non-zero value to get the full m-by-m and n-by-n matrices. On rare occasions, the routine may fail; if it does, the first SVinfo values of the returned S are incorrect. Hence, the external variable SVinfo will be 0 after a successful call to SVdec. If SVinfo>0, then external SVe contains the superdiagonal elements of the bidiagonal matrix whose diagonal is the returned S, and that bidiagonal matrix is equal to (U(+,)*A(+,))(,+) * V(+,). Numerical Recipes (Press, et. al. Cambridge University Press 1988) has a good discussion of how to use the SVD -- see section 2.9. Interpreted function, defined at i0/matrix.i line 435SEE ALSO: SVsolve, LUsolve, QRsolve, TDsolve
SVsolve
SVsolve(a, b) or SVsolve(a, b, rcond) or SVsolve(a, b, rcond, which=which) returns the solution x (in a least squares sense described below) of the matrix equation: A(,+)*x(+) = B If A is an m-by-n matrix (i.e.- m equations in n unknowns), then B must have length m, and the returned x will have length n. If nSEE ALSO: SVdec, LUsolve, QRsolve, TDsolvem, the system is underdetermined -- many solutions are possible -- the returned x has minimum L2 norm among all solutions SVsolve works by singular value decomposition, therefore it is immune to failure due to singularity of the A matrix. The optional RCOND argument defaults to 1.0e-9; singular values less than RCOND times the largest singular value (absolute value) will be set to 0.0. If RCOND<=0.0, machine precision is used. The effective rank of the matrix is returned as the external variable SVrank. You can examine the details of the SVD by calling the SVdec routine, which returns the singular vectors as well as the singular values. Numerical Recipes (Press, et. al. Cambridge University Press 1988) has a good discussion of how to use the SVD -- see section 2.9. B may have additional dimensions, in which case the returned x will have the same additional dimensions. The WHICH argument (default 1) controls which dimension of B takes part in the matrix solve. See QRsolve or LUsolve for a complete discussion. Interpreted function, defined at i0/matrix.i line 370