5 int n, p, f, j, *Lp, *Li, *
Cp, *Ci ;
6 double *Lx, *Cx, alpha, beta = 1, delta, gammaa, w1, w2, *w, beta2 = 1 ;
8 Lp = L->
p ; Li = L->
i ; Lx = L->
x ; n = L->
n ;
9 Cp = C->
p ; Ci = C->
i ; Cx = C->
x ;
10 if ((p = Cp [0]) >= Cp [1])
return (1) ;
11 w = (
double*)
cs_malloc (n,
sizeof (
double)) ;
14 for ( ; p < Cp [1] ; p++) f =
CS_MIN (f, Ci [p]) ;
15 for (j = f ; j != -1 ; j = parent [j]) w [j] = 0 ;
16 for (p = Cp [0] ; p < Cp [1] ; p++) w [Ci [p]] = Cx [p] ;
17 for (j = f ; j != -1 ; j = parent [j])
20 alpha = w [j] / Lx [p] ;
21 beta2 = beta*beta + sigma*alpha*alpha ;
22 if (beta2 <= 0) break ;
23 beta2 =
sqrt (beta2) ;
24 delta = (sigma > 0) ? (beta / beta2) : (beta2 / beta) ;
25 gammaa = sigma * alpha / (beta2 * beta) ;
26 Lx [p] = delta * Lx [p] + ((sigma > 0) ? (gammaa * w [j]) : 0) ;
28 for (p++ ; p < Lp [j+1] ; p++)
31 w [Li [p]] = w2 = w1 - alpha * Lx [p] ;
32 Lx [p] = delta * Lx [p] + gammaa * ((sigma > 0) ? w1 : w2) ;
IntermediateState sqrt(const Expression &arg)
int cs_updown(cs *L, int sigma, const cs *C, const int *parent)
void * cs_malloc(int n, size_t size)