1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* lu_solve_symbolic.c
*
* Copyright (C) 2016-2018 ERGO-Code
*
* Symbolic solve with triangular matrix
*
*/
#include "lu_internal.h"
/*
* lu_solve_symbolic()
*
* The pattern of the right-hand side is given in irhs[0..nrhs-1]. The
* pattern of the solution is returned in ilhs[top..m-1] in topological
* order, top is the function return value.
*
* When end is not NULL, then the pattern of column j of the matrix must be
* given in index[begin[j]..end[j]-1]. When end is NULL, then each column must
* be terminated by a negative index.
*
* The method is due to J. Gilbert and T. Peierls, "Sparse partial pivoting
* in time proportional to arithmetic operations", (1988).
*/
lu_int lu_solve_symbolic
(
const lu_int m,
const lu_int *begin,
const lu_int *end,
const lu_int *index,
const lu_int nrhs,
const lu_int *irhs,
lu_int *ilhs,
lu_int *pstack, /* size m workspace */
lu_int *marked, /* marked[i] != M on entry */
const lu_int M
)
{
lu_int i, n, top = m;
for (n = 0; n < nrhs; n++)
if (marked[i = irhs[n]] != M)
top = lu_dfs(i, begin, end, index, top, ilhs, pstack, marked, M);
return top;
}