1function LD = ldlrowmod (LD,k,C) %#ok 2%LDLROWMOD add/delete a row from a sparse LDL' factorization. 3% 4% On input, LD contains the LDL' factorization of A (L*D*L'=A or A(q,q)). 5% The unit-diagonal of L is not stored. In its place is the diagonal matrix 6% D. LD can be computed using the CHOLMOD mexFunctions: 7% 8% LD = ldlchol (A) ; 9% or 10% [LD,p,q] = ldlchol (A) ; 11% 12% With this LD, either of the following MATLAB statements, 13% 14% Example: 15% LD = ldlrowmod (LD,k,C) add row k to an LDL' factorization 16% 17% returns the LDL' factorization of S, where S = A except for S(:,k) = C 18% and S (k,:) = C. The kth row of A is assumed to initially be equal to 19% the kth row of identity. To delete a row: 20% 21% LD = ldlrowmod (LD,k) delete row k from an LDL' factorization 22% 23% returns the LDL' factorization of S, where S = A except that S(:,k) and 24% S (k,:) become the kth column/row of speye(n), repespectively. 25% 26% LD and C must be sparse and real. LD must be square, and C must have the 27% same number of rows as LD. You must not modify LD in MATLAB (see the 28% WARNING below). 29% 30% Note that if C is sparse with few columns, most of the time spent in this 31% routine is taken by copying the input LD to the output LD. If MATLAB 32% allowed mexFunctions to safely modify its inputs, this mexFunction would 33% be much faster, since not all of LD changes. 34% 35% See also LDLCHOL, LDLSPLIT, LDLSOLVE, CHOLUPDATE, LDLUPDATE 36% 37% =========================================================================== 38% =============================== WARNING =================================== 39% =========================================================================== 40% MATLAB drops zero entries from its sparse matrices. LD can contain 41% numerically zero entries that are symbolically present in the sparse matrix 42% data structure. These are essential for ldlrowmod and ldlsolve to work 43% properly, since they exploit the graph-theoretic structure of a sparse 44% Cholesky factorization. If you modify LD in MATLAB, those zero entries may 45% get dropped and the required graph property will be destroyed. In this 46% case, ldlrowmod and ldlsolve will fail catastrophically (possibly with a 47% segmentation fault, terminating MATLAB). It takes much more time to ensure 48% this property holds than the time it takes to do the row add/delete or the 49% solve, so ldlrowmod and ldlsolve simply assume the propertly holds. 50% =========================================================================== 51 52% Copyright 2006-2007, Timothy A. Davis, http://www.suitesparse.com 53 54error ('ldlrowmod mexFunction not found') ; 55 56