~logan/ubuntu/trusty/suitesparse/4.2.1-3ubuntu1

« back to all changes in this revision

Viewing changes to KLU/Source/klu_tsolve.c

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme
  • Date: 2007-05-29 09:36:29 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070529093629-zowquo0b7slkk6nc
Tags: 3.0.0-2
* suitesparse builds properly twice in a row
* Bug fix: "suitesparse - FTBFS: Broken build depens: libgfortran1-dev",
  thanks to Bastian Blank (Closes: #426349).
* Bug fix: "suitesparse_3.0.0-1: FTBFS: build-depends on
  libgfortran1-dev", thanks to Steve Langasek (Closes: #426354).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* ========================================================================== */
2
 
/* === klu_tsolve =========================================================== */
 
2
/* === KLU_tsolve =========================================================== */
3
3
/* ========================================================================== */
4
4
 
5
 
/* Solve A'x=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 A'x=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
9
9
 * Numeric->Iwork).
11
11
 
12
12
#include "klu_internal.h"
13
13
 
14
 
int KLU_tsolve
 
14
Int KLU_tsolve
15
15
(
16
16
    /* inputs, not modified */
17
 
    klu_symbolic *Symbolic,
18
 
    klu_numeric *Numeric,
19
 
    int d,                  /* leading dimension of B */
20
 
    int nrhs,               /* number of right-hand-sides */
 
17
    KLU_symbolic *Symbolic,
 
18
    KLU_numeric *Numeric,
 
19
    Int d,                  /* leading dimension of B */
 
20
    Int nrhs,               /* number of right-hand-sides */
21
21
 
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
#ifdef COMPLEX
26
 
    int conj_solve,         /* TRUE for conjugate transpose solve, FALSE for
 
26
    Int conj_solve,         /* TRUE for conjugate transpose solve, FALSE for
27
27
                             * array transpose solve.  Used for the complex
28
28
                             * case only. */
29
29
#endif
30
30
    /* --------------- */
31
 
    klu_common *Common
 
31
    KLU_common *Common
32
32
)
33
33
{
34
34
    Entry x [4], offik, s ;
35
35
    double rs, *Rs ;
36
 
    Entry *Singleton, *Offx, *X, *Bz ;
37
 
    int *Q, *R, *Pnum, *Offp, *Offi ;
38
 
    int **Lbip, **Ubip, **Lblen, **Ublen ;
39
 
    Unit **LUbx, **Udiag ;
40
 
    int k1, k2, nk, k, block, pend, n, p, nblocks, chunk, nr, i ;
 
36
    Entry *Offx, *X, *Bz, *Udiag ;
 
37
    Int *Q, *R, *Pnum, *Offp, *Offi, *Lip, *Uip, *Llen, *Ulen ;
 
38
    Unit **LUbx ;
 
39
    Int k1, k2, nk, k, block, pend, n, p, nblocks, chunk, nr, i ;
 
40
 
 
41
    /* ---------------------------------------------------------------------- */
 
42
    /* check inputs */
 
43
    /* ---------------------------------------------------------------------- */
41
44
 
42
45
    if (Common == NULL)
43
46
    {
44
47
        return (FALSE) ;
45
48
    }
 
49
    if (Numeric == NULL || Symbolic == NULL || d < Symbolic->n || nrhs < 0 ||
 
50
        B == NULL)
 
51
    {
 
52
        Common->status = KLU_INVALID ;
 
53
        return (FALSE) ;
 
54
    }
46
55
    Common->status = KLU_OK ;
47
56
 
48
 
    if (Numeric == NULL)
49
 
    {
50
 
        /* invalid Numeric object */
51
 
        Common->status = KLU_INVALID ;
52
 
        return (FALSE) ;
53
 
    }
 
57
    /* ---------------------------------------------------------------------- */
 
58
    /* get the contents of the Symbolic object */
 
59
    /* ---------------------------------------------------------------------- */
54
60
 
55
61
    Bz = (Entry *) B ;
56
 
 
57
 
    /* ---------------------------------------------------------------------- */
58
 
    /* get the contents of the Symbolic object */
59
 
    /* ---------------------------------------------------------------------- */
60
 
 
61
62
    n = Symbolic->n ;
62
63
    nblocks = Symbolic->nblocks ;
63
64
    Q = Symbolic->Q ;
72
73
    Offp = Numeric->Offp ;
73
74
    Offi = Numeric->Offi ;
74
75
    Offx = (Entry *) Numeric->Offx ;
75
 
    Singleton = (Entry *) Numeric->Singleton ;
76
76
 
77
 
    Lbip = Numeric->Lbip ;
78
 
    Lblen = Numeric->Lblen ;
79
 
    Ubip = Numeric->Ubip ;
80
 
    Ublen = Numeric->Ublen ;
 
77
    Lip  = Numeric->Lip ;
 
78
    Llen = Numeric->Llen ;
 
79
    Uip  = Numeric->Uip ;
 
80
    Ulen = Numeric->Ulen ;
81
81
    LUbx = (Unit **) Numeric->LUbx ;
82
 
    Udiag = (Unit **) Numeric->Udiag ;
 
82
    Udiag = Numeric->Udiag ;
83
83
 
84
84
    Rs = Numeric->Rs ;
85
85
    X = (Entry *) Numeric->Xwork ;
299
299
#ifdef COMPLEX
300
300
                if (conj_solve)
301
301
                {
302
 
                    CONJ (s, Singleton [block]) ;
 
302
                    CONJ (s, Udiag [k1]) ;
303
303
                }
304
304
                else
305
305
#endif
306
306
                {
307
 
                    s = Singleton [block] ;
 
307
                    s = Udiag [k1] ;
308
308
                }
309
309
                switch (nr)
310
310
                {
335
335
            }
336
336
            else
337
337
            {
338
 
                KLU_utsolve (nk, Ubip [block], Ublen [block], LUbx [block],
339
 
                        Udiag [block], nr,
 
338
                KLU_utsolve (nk, Uip + k1, Ulen + k1, LUbx [block],
 
339
                        Udiag + k1, nr,
340
340
#ifdef COMPLEX
341
341
                        conj_solve,
342
342
#endif
343
343
                        X + nr*k1) ;
344
 
                KLU_ltsolve (nk, Lbip [block], Lblen [block], LUbx [block], nr,
 
344
                KLU_ltsolve (nk, Lip + k1, Llen + k1, LUbx [block], nr,
345
345
#ifdef COMPLEX
346
346
                        conj_solve,
347
347
#endif