~logan/ubuntu/trusty/suitesparse/4.2.1-3ubuntu1

« back to all changes in this revision

Viewing changes to CXSparse/MATLAB/Test/chol_downdate.m

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme
  • Date: 2007-05-29 09:36:29 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070529093629-zowquo0b7slkk6nc
Tags: 3.0.0-2
* suitesparse builds properly twice in a row
* Bug fix: "suitesparse - FTBFS: Broken build depens: libgfortran1-dev",
  thanks to Bastian Blank (Closes: #426349).
* Bug fix: "suitesparse_3.0.0-1: FTBFS: build-depends on
  libgfortran1-dev", thanks to Steve Langasek (Closes: #426354).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function [L, w] = chol_downdate (L, w)
 
2
%CHOL_DOWNDATE downdate a Cholesky factorization.
 
3
% Example
 
4
%   [L, w] = chol_downdate (L, w)
 
5
% See also: cs_demo
 
6
 
 
7
%   Copyright 2006-2007, Timothy A. Davis.
 
8
%   http://www.cise.ufl.edu/research/sparse
 
9
 
 
10
beta = 1 ;
 
11
n = size (L,1) ;
 
12
for j = 1:n
 
13
    alpha = w (j) / L (j,j) ;
 
14
    beta2 = sqrt (beta^2 - alpha^2) ;
 
15
    if (~isreal (beta2))
 
16
        error ('not positive definite') ;
 
17
    end
 
18
    gamma = alpha / (beta2 * beta) ;
 
19
    delta = beta2 / beta ;
 
20
    L (j,j) = delta * L (j,j) ;
 
21
    w (j) = alpha ;
 
22
    beta = beta2 ;
 
23
    if (j == n)
 
24
        return
 
25
    end
 
26
    w (j+1:n) = w (j+1:n) - alpha * L (j+1:n,j) ;
 
27
    L (j+1:n,j) = delta * L (j+1:n,j) - gamma * w (j+1:n) ;
 
28
end