0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 function [L,AAt] = DSA_BD_cholAAt(blk,At,m)
0012 AAt = sparse(m,m);
0013 for p = 1:size(blk,1)
0014 AAt = AAt + At{p,1}'*At{p,1};
0015 end
0016 pertdiag = 1e-13*ones(m,1);
0017 AAt = AAt + spdiags(pertdiag,0,m,m);
0018
0019 if (nnz(AAt) < 0.2*m*m); use_spchol=1; else; use_spchol=0; end
0020 if (use_spchol)
0021 [L.Rt,L.p,L.S] = chol(AAt,'lower');
0022 L.R = L.Rt';
0023 L.St = L.S';
0024 L.matfct_options = 'spcholmatlab';
0025 else
0026 if issparse(AAt); AAt = full(AAt); end;
0027 L.matfct_options = 'chol';
0028 L.S = eye(m);
0029 L.St = L.S;
0030 [L.Rt,L.p] = chol(AAt,'lower');
0031 L.R = L.Rt';
0032 end
0033 end