Description | MF_safeSolve is similar to MF_solve with the difference that, in case there is no unique solution of the linear system (i.e., LU decomposition fails), singular value decomposition is employed to obtain at least one solution out of the infinite solution space. Recall that the problem with singular linear systems is not that they don't have a solution, but rather that they are under-determined and have infinitely many solutions. In other words, one or more elements of the solution vector can be chosen arbitrarily. This is what MF_safeSolve does, with the additional constraint that the "smallest" solution vector in the least-squares sense is determined.
A return value of 0 indicates success via LUD, 1 signals success via SVD, and -1 is returned in the very rare case that even SVD fails.
The default threshold for the decision between LUD and SVD, as well as for the singular-value editing in the SVD branch may be changed by calling MF_SVDsetEdit. As MF_SVDsetEdit is not thread-safe, this function should not be used to set different editing thresholds for different calls to MF_safeSolve etc. Rather than repeatedly changing the default value, use the "wEdit" variant of MF_safeSolve etc., namely MF_safeSolvewEdit, MF_SVsolvewEdit and MF_solveBySVDwEdit.
|