File: dGetDiagU.c

package info (click to toggle)
python-scipy 0.10.1%2Bdfsg2-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 42,232 kB
  • sloc: cpp: 224,773; ansic: 103,496; python: 85,210; fortran: 79,130; makefile: 272; sh: 43
file content (58 lines) | stat: -rw-r--r-- 1,428 bytes parent folder | download | duplicates (6)
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
49
50
51
52
53
54
55
56
57
58
/*! @file dGetDiagU.c
 * \brief Extracts main diagonal of matrix
 *
 * <pre> 
 * -- Auxiliary routine in SuperLU (version 2.0) --
 * Lawrence Berkeley National Lab, Univ. of California Berkeley.
 * Xiaoye S. Li
 * September 11, 2003
 *
 *  Purpose
 * =======
 *
 * GetDiagU extracts the main diagonal of matrix U of the LU factorization.
 *  
 * Arguments
 * =========
 *
 * L      (input) SuperMatrix*
 *        The factor L from the factorization Pr*A*Pc=L*U as computed by
 *        dgstrf(). Use compressed row subscripts storage for supernodes,
 *        i.e., L has types: Stype = SLU_SC, Dtype = SLU_D, Mtype = SLU_TRLU.
 *
 * diagU  (output) double*, dimension (n)
 *        The main diagonal of matrix U.
 *
 * Note
 * ====
 * The diagonal blocks of the L and U matrices are stored in the L
 * data structures.
 * </pre> 
*/
#include "slu_ddefs.h"

void dGetDiagU(SuperMatrix *L, double *diagU)
{
    int_t i, k, nsupers;
    int_t fsupc, nsupr, nsupc, luptr;
    double *dblock, *Lval;
    SCformat *Lstore;

    Lstore = L->Store;
    Lval = Lstore->nzval;
    nsupers = Lstore->nsuper + 1;

    for (k = 0; k < nsupers; ++k) {
      fsupc = L_FST_SUPC(k);
      nsupc = L_FST_SUPC(k+1) - fsupc;
      nsupr = L_SUB_START(fsupc+1) - L_SUB_START(fsupc);
      luptr = L_NZ_START(fsupc);

      dblock = &diagU[fsupc];
      for (i = 0; i < nsupc; ++i) {
	dblock[i] = Lval[luptr];
	luptr += nsupr + 1;
      }
    }
}