1function [X,info] = spqr_solve (A,B,opts) %#ok 2%SPQR_SOLVE solves a linear system or least squares problem via QR factorization. 3% A is a sparse m-by-n matrix A and B is a sparse or full m-by-k matrix. 4% If m == n, x = spqr_solve(A,B) solves A*X=B. If m < n, a basic solution is 5% found for the underdetermined system A*X=B. If m > n, the least squares 6% solution is found. An optional third input argument specifies non-default 7% options (see "help spqr" for details). Only opts.tol, opts.ordering, and 8% opts.solution are used; the others are implicitly set to opts.econ = 0, 9% opts.Q = 'Householder', and opts.permutation = 'vector'. 10% 11% opts.solution: 'basic' (default) or 'min2norm'. To obtain a minimum 2-norm 12% solution to an undetermined system (m < n), use 'min2norm'. For m >= n, 13% these two options find the same solution. 14% 15% An optional second output provides statistics on the solution. 16% 17% Example: 18% x = spqr_solve (A,B) 19% [x,info] = spqr_solve (A,B) 20% x = spqr_solve (A,B,opts) 21% x = spqr_solve (A,B, struct ('solution','min2norm')) ; 22% 23% See also SPQR, SPQR_QMULT, QR, MLDIVIDE. 24 25% Copyright 2008, Timothy A. Davis, http://www.suitesparse.com 26 27type spqr_solve 28error ('spqr_solve mexFunction not found') ; 29