5 CS_INT n, p, f, j, *Lp, *Li, *Cp, *Ci ;
6 CS_ENTRY *Lx, *Cx, alpha, gamma, w1, w2, *w ;
7 double beta = 1, beta2 = 1, delta ;
12 Lp = L->p ; Li = L->i ; Lx = L->x ; n = L->n ;
13 Cp = C->p ; Ci = C->i ; Cx = C->x ;
14 if ((p = Cp [0]) >= Cp [1])
return (1) ;
18 for ( ; p < Cp [1] ; p++) f =
CS_MIN (f, Ci [p]) ;
19 for (j = f ; j != -1 ; j = parent [j]) w [j] = 0 ;
20 for (p = Cp [0] ; p < Cp [1] ; p++) w [Ci [p]] = Cx [p] ;
21 for (j = f ; j != -1 ; j = parent [j])
24 alpha = w [j] / Lx [p] ;
25 beta2 = beta*beta + sigma*alpha*
CS_CONJ(alpha) ;
26 if (beta2 <= 0) break ;
27 beta2 = sqrt (beta2) ;
28 delta = (sigma > 0) ? (beta / beta2) : (beta2 / beta) ;
29 gamma = sigma *
CS_CONJ(alpha) / (beta2 * beta) ;
30 Lx [p] = delta * Lx [p] + ((sigma > 0) ? (gamma * w [j]) : 0) ;
33 phase =
CS_ABS (Lx [p]) / Lx [p] ;
36 for (p++ ; p < Lp [j+1] ; p++)
39 w [Li [p]] = w2 = w1 - alpha * Lx [p] ;
40 Lx [p] = delta * Lx [p] + gamma * ((sigma > 0) ? w1 : w2) ;
void * cs_malloc(CS_INT n, size_t size)
CS_INT cs_updown(cs *L, CS_INT sigma, const cs *C, const CS_INT *parent)