1
1
/* ========================================================================== */
2
/* === klu_solve ============================================================ */
2
/* === KLU_solve ============================================================ */
3
3
/* ========================================================================== */
5
/* Solve Ax=b using the symbolic and numeric objects from klu_analyze
6
* (or klu_analyze_given) and klu_factor. Note that no iterative refinement is
5
/* Solve Ax=b using the symbolic and numeric objects from KLU_analyze
6
* (or KLU_analyze_given) and KLU_factor. Note that no iterative refinement is
7
7
* performed. Uses Numeric->Xwork as workspace (undefined on input and output),
8
8
* of size 4n Entry's (note that columns 2 to 4 of Xwork overlap with
12
12
#include "klu_internal.h"
16
16
/* inputs, not modified */
17
klu_symbolic *Symbolic,
19
int d, /* leading dimension of B */
20
int nrhs, /* number of right-hand-sides */
17
KLU_symbolic *Symbolic,
19
Int d, /* leading dimension of B */
20
Int nrhs, /* number of right-hand-sides */
22
22
/* right-hand-side on input, overwritten with solution to Ax=b on output */
23
23
double B [ ], /* size n*nrhs, in column-oriented form, with
24
24
* leading dimension d. */
25
25
/* --------------- */
29
29
Entry x [4], offik, s ;
31
Entry *Singleton, *Offx, *X, *Bz ;
32
int *Q, *R, *Pnum, *Offp, *Offi ;
33
int **Lbip, **Ubip, **Lblen, **Ublen ;
34
Unit **LUbx, **Udiag ;
35
int k1, k2, nk, k, block, pend, n, p, nblocks, chunk, nr, i ;
31
Entry *Offx, *X, *Bz, *Udiag ;
32
Int *Q, *R, *Pnum, *Offp, *Offi, *Lip, *Uip, *Llen, *Ulen ;
34
Int k1, k2, nk, k, block, pend, n, p, nblocks, chunk, nr, i ;
36
/* ---------------------------------------------------------------------- */
38
/* ---------------------------------------------------------------------- */
37
40
if (Common == NULL)
44
if (Numeric == NULL || Symbolic == NULL || d < Symbolic->n || nrhs < 0 ||
47
Common->status = KLU_INVALID ;
41
50
Common->status = KLU_OK ;
45
/* invalid Numeric object */
46
Common->status = KLU_INVALID ;
52
/* ---------------------------------------------------------------------- */
53
/* get the contents of the Symbolic object */
54
/* ---------------------------------------------------------------------- */
52
/* ---------------------------------------------------------------------- */
53
/* get the contents of the Symbolic object */
54
/* ---------------------------------------------------------------------- */
57
58
nblocks = Symbolic->nblocks ;
252
KLU_lsolve (nk, Lbip [block], Lblen [block], LUbx [block], nr,
252
KLU_lsolve (nk, Lip + k1, Llen + k1, LUbx [block], nr,
254
KLU_usolve (nk, Ubip [block], Ublen [block], LUbx [block],
255
Udiag [block], nr, X + nr*k1) ;
254
KLU_usolve (nk, Uip + k1, Ulen + k1, LUbx [block],
255
Udiag + k1, nr, X + nr*k1) ;
258
258
/* -------------------------------------------------------------- */