Skip to content

Commit 35866b5

Browse files
author
lebesgue
committed
factor uploaded
1 parent c5ebfb1 commit 35866b5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

SGLP/factor.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
function [L U] = factor(A, rho)
2+
[m, n] = size(A);
3+
if ( m >= n ) % if skinny
4+
L = chol( A'*A + rho*speye(n), 'lower' );
5+
else % if fat
6+
L = chol( speye(m) + 1/rho*(A*A'), 'lower' );
7+
end
8+
9+
% force matlab to recognize the upper / lower triangular structure
10+
L = sparse(L);
11+
U = sparse(L');
12+
end

0 commit comments

Comments
 (0)