File: spqr_solve.m

package info (click to toggle)
suitesparse 1%3A4.5.4-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 74,020 kB
  • ctags: 12,092
  • sloc: ansic: 146,148; cpp: 17,776; makefile: 5,777; fortran: 1,927; java: 1,846; csh: 749; ruby: 725; perl: 225; sed: 164; awk: 27; sh: 18
file content (28 lines) | stat: -rw-r--r-- 1,276 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function [X,info] = spqr_solve (A,B,opts)                                   %#ok
%SPQR_SOLVE solves a linear system or least squares problem via QR factorization.
% A is a sparse m-by-n matrix A and B is a sparse or full m-by-k matrix.
% If m == n, x = spqr_solve(A,B) solves A*X=B.  If m < n, a basic solution is
% found for the underdetermined system A*X=B.  If m > n, the least squares
% solution is found.  An optional third input argument specifies non-default
% options (see "help spqr" for details).  Only opts.tol, opts.ordering, and
% opts.solution are used; the others are implicitly set to opts.econ = 0,
% opts.Q = 'Householder', and opts.permutation = 'vector'.
%
% opts.solution:  'basic' (default) or 'min2norm'.  To obtain a minimum 2-norm
% solution to an undetermined system (m < n), use 'min2norm'.  For m >= n,
% these two options find the same solution.
%
% An optional second output provides statistics on the solution.
%
% Example: 
%   x = spqr_solve (A,B) 
%   [x,info] = spqr_solve (A,B) 
%   x = spqr_solve (A,B,opts) 
%   x = spqr_solve (A,B, struct ('solution','min2norm')) ;
%
% See also SPQR, SPQR_QMULT, QR, MLDIVIDE.

% Copyright 2008, Timothy A. Davis, http://www.suitesparse.com

type spqr_solve
error ('spqr_solve mexFunction not found') ;