1 /*
2 ARPACK++ v1.2 2/20/2000
3 c++ interface to ARPACK code.
4
5 MODULE SuperLUc.h.
6 Interface to SuperLU routines.
7
8 ARPACK Authors
9 Richard Lehoucq
10 Danny Sorensen
11 Chao Yang
12 Dept. of Computational & Applied Mathematics
13 Rice University
14 Houston, Texas
15 */
16
17 #ifndef SUPERLUC_H
18 #define SUPERLUC_H
19
20 #include "arch.h"
21 #include "arlspdef.h"
22 #include "arlsupm.h"
23 #include "arlcomp.h"
24
25 // gstrf.
26
gstrf(superlu_options_t * options,SuperMatrix * A,int relax,int panel_size,int * etree,void * work,int lwork,int * perm_c,int * perm_r,SuperMatrix * L,SuperMatrix * U,SuperLUStat_t * stat,int * info)27 inline void gstrf(superlu_options_t *options, SuperMatrix *A,
28 int relax, int panel_size, int *etree, void *work, int lwork,
29 int *perm_c, int *perm_r, SuperMatrix *L, SuperMatrix *U,
30 SuperLUStat_t *stat, int *info)
31 {
32 if (A->Dtype == SLU_D) { // calling the double precision routine.
33 dGlobalLU_t Glu;
34 dgstrf(options,A,relax,
35 panel_size,etree,work,lwork,perm_c,perm_r,L,U,&Glu,stat,info);
36 }
37 else if (A->Dtype == SLU_S) { // calling the single precision routine.
38 sGlobalLU_t Glu;
39 sgstrf(options,A,relax,
40 panel_size,etree,work,lwork,perm_c,perm_r,L,U,&Glu,stat,info);
41 }
42 else if (A->Dtype == SLU_Z) { // calling the double precision complex routine.
43 #ifdef ARCOMP_H
44 zGlobalLU_t Glu;
45 zgstrf(options,A,relax,
46 panel_size,etree,work,lwork,perm_c,perm_r,L,U,&Glu,stat,info);
47 #endif
48 }
49 else { // calling the single precision complex routine.
50 #ifdef ARCOMP_H
51 cGlobalLU_t Glu;
52 cgstrf(options,A,relax,
53 panel_size,etree,work,lwork,perm_c,perm_r,L,U,&Glu,stat,info);
54 #endif
55 }
56
57 } // gstrf.
58
59
gstrs(trans_t trans,SuperMatrix * L,SuperMatrix * U,int * perm_c,int * perm_r,SuperMatrix * B,SuperLUStat_t * stat,int * info)60 inline void gstrs(trans_t trans, SuperMatrix *L, SuperMatrix *U,
61 int *perm_c, int *perm_r, SuperMatrix *B, SuperLUStat_t* stat, int *info)
62 {
63
64 if (L->Dtype == SLU_D) { // calling the double precision routine.
65 dgstrs(trans,L,U,perm_c,perm_r,B,stat,info);
66 }
67 else if (L->Dtype == SLU_S) { // calling the single precision routine.
68 sgstrs(trans,L,U,perm_c,perm_r,B,stat,info);
69 }
70 else if (L->Dtype == SLU_Z) { // calling the double precision complex routine.
71 #ifdef ARCOMP_H
72 zgstrs(trans,L,U,perm_c,perm_r,B,stat,info);
73 #endif
74 }
75 else { // calling the single precision complex routine.
76 #ifdef ARCOMP_H
77 cgstrs(trans,L,U,perm_c,perm_r,B,stat,info);
78 #endif
79 }
80
81 } // gstrs.
82
83
84 // Create_CompCol_Matrix.
85
Create_CompCol_Matrix(SuperMatrix * A,int m,int n,int nnz,double * a,int * irow,int * pcol,Stype_t S,Mtype_t M)86 inline void Create_CompCol_Matrix(SuperMatrix* A, int m, int n, int nnz,
87 double* a, int* irow, int* pcol,
88 Stype_t S, Mtype_t M)
89 {
90
91 dCreate_CompCol_Matrix(A,m,n,nnz,a,irow,pcol,S,SLU_D,M);
92
93 } // Create_CompCol_Matrix (double).
94
Create_CompCol_Matrix(SuperMatrix * A,int m,int n,int nnz,float * a,int * irow,int * pcol,Stype_t S,Mtype_t M)95 inline void Create_CompCol_Matrix(SuperMatrix* A, int m, int n, int nnz,
96 float* a, int* irow, int* pcol,
97 Stype_t S, Mtype_t M)
98 {
99
100 sCreate_CompCol_Matrix(A,m,n,nnz,a,irow,pcol,S,SLU_S,M);
101
102 } // Create_CompCol_Matrix (float).
103
104 #ifdef ARCOMP_H
105
Create_CompCol_Matrix(SuperMatrix * A,int m,int n,int nnz,arcomplex<double> * a,int * irow,int * pcol,Stype_t S,Mtype_t M)106 inline void Create_CompCol_Matrix(SuperMatrix* A, int m, int n, int nnz,
107 arcomplex<double>* a, int* irow, int* pcol,
108 Stype_t S, Mtype_t M)
109 {
110
111 zCreate_CompCol_Matrix(A,m,n,nnz,(ldcomplex*)a,irow,pcol,S,SLU_Z,M);
112
113 } // Create_CompCol_Matrix (complex<double>).
114
Create_CompCol_Matrix(SuperMatrix * A,int m,int n,int nnz,arcomplex<float> * a,int * irow,int * pcol,Stype_t S,Mtype_t M)115 inline void Create_CompCol_Matrix(SuperMatrix* A, int m, int n, int nnz,
116 arcomplex<float>* a, int* irow, int* pcol,
117 Stype_t S, Mtype_t M)
118 {
119
120 cCreate_CompCol_Matrix(A,m,n,nnz,(lscomplex*)a,irow,pcol,S,SLU_C,M);
121
122 } // Create_CompCol_Matrix (complex<float>).
123
124 #endif // ARCOMP_H.
125
126
127 // Create_Dense_Matrix.
128
Create_Dense_Matrix(SuperMatrix * A,int m,int n,double * x,int ldx,Stype_t S,Mtype_t M)129 inline void Create_Dense_Matrix(SuperMatrix* A, int m, int n, double* x,
130 int ldx, Stype_t S, Mtype_t M)
131 {
132
133 dCreate_Dense_Matrix(A,m,n,x,ldx,S,SLU_D,M);
134
135 } // Create_Dense_Matrix (double).
136
Create_Dense_Matrix(SuperMatrix * A,int m,int n,float * x,int ldx,Stype_t S,Mtype_t M)137 inline void Create_Dense_Matrix(SuperMatrix* A, int m, int n, float* x,
138 int ldx, Stype_t S, Mtype_t M)
139 {
140
141 sCreate_Dense_Matrix(A,m,n,x,ldx,S,SLU_S,M);
142
143 } // Create_Dense_Matrix (float).
144
145 #ifdef ARCOMP_H
146
Create_Dense_Matrix(SuperMatrix * A,int m,int n,arcomplex<double> * x,int ldx,Stype_t S,Mtype_t M)147 inline void Create_Dense_Matrix(SuperMatrix* A, int m, int n, arcomplex<double>* x,
148 int ldx, Stype_t S, Mtype_t M)
149 {
150
151 zCreate_Dense_Matrix(A,m,n,(ldcomplex*)x,ldx,S,SLU_Z,M);
152
153 } // Create_Dense_Matrix (complex<double>).
154
Create_Dense_Matrix(SuperMatrix * A,int m,int n,arcomplex<float> * x,int ldx,Stype_t S,Mtype_t M)155 inline void Create_Dense_Matrix(SuperMatrix* A, int m, int n, arcomplex<float>* x,
156 int ldx, Stype_t S, Mtype_t M)
157 {
158
159 cCreate_Dense_Matrix(A,m,n,(lscomplex*)x,ldx,S,SLU_C,M);
160
161 } // Create_Dense_Matrix (complex<float>).
162
163 #endif // ARCOMP_H.
164
165 #endif // SUPERLUC_H
166