1function [V,beta,p,R,q] = cs_qr (A)                                         %#ok
2%CS_QR sparse QR factorization (Householder-based).
3%   [V,beta,p,R] = cs_qr(A) computes the QR factorization of A(p,:).
4%   [V,beta,p,R,q] = cs_qr(A) computes the QR factorization of A(p,q).
5%   The V, beta, and p terms represent the Householder vectors and coefficients.
6%   The fill-reducing ordering q is found via q = cs_amd(A,3).
7%   The orthogonal factor Q can be obtained via
8%   Q = cs_qright(V,beta,p,speye(size(V,1))), in which case Q*R=A(:,q) is the
9%   resulting factorization (the permutation p is folded into Q).  A must be
10%   m-by-n with m >= n.  If A is structurally rank deficient, additional empty
11%   rows may have been added to V and R.  Note that V is typically much sparser
12%   than Q.
13%
14%   Example:
15%
16%       Prob = ssget ('HB/well1033') ; A = Prob.A ; [m n] = size (A) ;
17%       b = rand (m,1) ;
18%       [V,beta,p,R,q] = cs_qr (A) ; % QR factorization of A(p,q)
19%       b1 = cs_qleft (V, beta, p, b) ;
20%       x1 = R (1:n,1:n) \ b1 (1:n) ;
21%       x1 (q) = x1 ;
22%       x2 = A\b ;
23%       norm (x1-x2)
24%       Q = cs_qright(V,beta,p,speye(size(V,1))) ;  % Note: p accounted for in Q
25%       norm (Q*R-A(:,q),1)
26%       fprintf ('nnz(R) %d, nnz(V) %d, nnz(Q) %d\n', nnz(R), nnz(V), nnz(Q)) ;
27%
28%   See also CS_AMD, CS_QRIGHT, CS_QR, CS_DMPERM, QR, COLAMD.
29
30% Copyright 2006-2012, Timothy A. Davis, http://www.suitesparse.com
31
32error ('cs_qr mexFunction not found') ;
33