/src/igraph/vendor/cs/cs_lsolve.c
Line | Count | Source (jump to first uncovered line) |
1 | | #include "cs.h" |
2 | | /* solve Lx=b where x and b are dense. x=b on input, solution on output. */ |
3 | | CS_INT cs_lsolve (const cs *L, CS_ENTRY *x) |
4 | 0 | { |
5 | 0 | CS_INT p, j, n, *Lp, *Li ; |
6 | 0 | CS_ENTRY *Lx ; |
7 | 0 | if (!CS_CSC (L) || !x) return (0) ; /* check inputs */ |
8 | 0 | n = L->n ; Lp = L->p ; Li = L->i ; Lx = L->x ; |
9 | 0 | for (j = 0 ; j < n ; j++) |
10 | 0 | { |
11 | 0 | x [j] /= Lx [Lp [j]] ; |
12 | 0 | for (p = Lp [j]+1 ; p < Lp [j+1] ; p++) |
13 | 0 | { |
14 | 0 | x [Li [p]] -= Lx [p] * x [j] ; |
15 | 0 | } |
16 | 0 | } |
17 | 0 | return (1) ; |
18 | 0 | } |