178 |
kaklik |
1 |
#include "linalg.h" |
|
|
2 |
|
|
|
3 |
namespace mimas { |
|
|
4 |
|
|
|
5 |
template<> |
|
|
6 |
int getrf_< double >::operator()( integer *m, integer *n, double *a, |
|
|
7 |
integer *lda, integer *ipiv, integer *info ) |
|
|
8 |
const |
|
|
9 |
{ |
|
|
10 |
return dgetrf_( m, n, a, lda, ipiv, info ); |
|
|
11 |
} |
|
|
12 |
|
|
|
13 |
template<> |
|
|
14 |
int getrf_< float >::operator()( integer *m, integer *n, float *a, |
|
|
15 |
integer *lda, integer *ipiv, integer *info ) |
|
|
16 |
const |
|
|
17 |
{ |
|
|
18 |
return sgetrf_( m, n, a, lda, ipiv, info ); |
|
|
19 |
} |
|
|
20 |
|
|
|
21 |
template<> |
|
|
22 |
int getri_< double >::operator()( integer *n, double *a, integer *lda, |
|
|
23 |
integer *ipiv, double *work, |
|
|
24 |
integer *lwork, integer *info ) const |
|
|
25 |
{ |
|
|
26 |
return dgetri_( n, a, lda, ipiv, work, lwork, info ); |
|
|
27 |
} |
|
|
28 |
|
|
|
29 |
template<> |
|
|
30 |
int getri_< float >::operator()( integer *n, float *a, integer *lda, |
|
|
31 |
integer *ipiv, float *work, |
|
|
32 |
integer *lwork, integer *info ) const |
|
|
33 |
{ |
|
|
34 |
return sgetri_( n, a, lda, ipiv, work, lwork, info ); |
|
|
35 |
} |
|
|
36 |
|
|
|
37 |
template<> |
|
|
38 |
int gglse_< double >::operator()( integer *m, integer *n, integer *p, |
|
|
39 |
double *a, integer *lda, double *b, |
|
|
40 |
integer *ldb, double *c__, double *d__, |
|
|
41 |
double *x, double *work, integer *lwork, |
|
|
42 |
integer *info ) |
|
|
43 |
{ |
|
|
44 |
return dgglse_( m, n, p, a, lda, b, ldb, c__, d__, x, work, lwork, info ); |
|
|
45 |
} |
|
|
46 |
|
|
|
47 |
template<> |
|
|
48 |
int gglse_< float >::operator()( integer *m, integer *n, integer *p, |
|
|
49 |
float *a, integer *lda, float *b, |
|
|
50 |
integer *ldb, float *c__, float *d__, |
|
|
51 |
float *x, float *work, integer *lwork, |
|
|
52 |
integer *info ) |
|
|
53 |
{ |
|
|
54 |
return sgglse_( m, n, p, a, lda, b, ldb, c__, d__, x, work, lwork, info ); |
|
|
55 |
} |
|
|
56 |
|
|
|
57 |
template<> |
|
|
58 |
int gels_< double >::operator()( char *trans, integer *m, integer *n, |
|
|
59 |
integer *nrhs, double *a, integer *lda, |
|
|
60 |
double *b, integer *ldb, double *work, |
|
|
61 |
integer *lwork, integer *info ) const |
|
|
62 |
{ |
|
|
63 |
return dgels_( trans, m, n, nrhs, a, lda, b, ldb, work, lwork, info ); |
|
|
64 |
} |
|
|
65 |
|
|
|
66 |
template<> |
|
|
67 |
int gels_< float >::operator()( char *trans, integer *m, integer *n, |
|
|
68 |
integer *nrhs, float *a, integer *lda, |
|
|
69 |
float *b, integer *ldb, float *work, |
|
|
70 |
integer *lwork, integer *info ) const |
|
|
71 |
{ |
|
|
72 |
return sgels_( trans, m, n, nrhs, a, lda, b, ldb, work, lwork, info ); |
|
|
73 |
} |
|
|
74 |
|
|
|
75 |
template<> |
|
|
76 |
int gesvd_< double >::operator()( char *jobu, char *jobvt, integer *m, |
|
|
77 |
integer *n, double *a, integer *lda, |
|
|
78 |
double *s, double *u, integer *ldu, |
|
|
79 |
double *vt, integer *ldvt, double *work, |
|
|
80 |
integer *lwork, integer *info) const |
|
|
81 |
{ |
|
|
82 |
return dgesvd_( jobu, jobvt, m, n, a, lda, s, u, ldu, vt, ldvt, work, lwork, |
|
|
83 |
info ); |
|
|
84 |
} |
|
|
85 |
|
|
|
86 |
template<> |
|
|
87 |
int gesvd_< float >::operator()( char *jobu, char *jobvt, integer *m, |
|
|
88 |
integer *n, float *a, integer *lda, |
|
|
89 |
float *s, float *u, integer *ldu, |
|
|
90 |
float *vt, integer *ldvt, float *work, |
|
|
91 |
integer *lwork, integer *info) const |
|
|
92 |
{ |
|
|
93 |
return sgesvd_( jobu, jobvt, m, n, a, lda, s, u, ldu, vt, ldvt, work, lwork, |
|
|
94 |
info ); |
|
|
95 |
} |
|
|
96 |
|
|
|
97 |
template<> |
|
|
98 |
int gesdd_< double >::operator()( char *jobz, integer *m, integer *n, |
|
|
99 |
double *a, integer *lda, double *s, |
|
|
100 |
double *u, integer *ldu, double *vt, |
|
|
101 |
integer *ldvt, double *work, integer *lwork, |
|
|
102 |
integer *iwork, integer *info ) |
|
|
103 |
{ |
|
|
104 |
return dgesdd_( jobz, m, n, a, lda, s, u, ldu, vt, ldvt, work, lwork, |
|
|
105 |
iwork, info ); |
|
|
106 |
} |
|
|
107 |
|
|
|
108 |
template<> |
|
|
109 |
int gesdd_< float >::operator()( char *jobz, integer *m, integer *n, |
|
|
110 |
float *a, integer *lda, float *s, |
|
|
111 |
float *u, integer *ldu, float *vt, |
|
|
112 |
integer *ldvt, float *work, integer *lwork, |
|
|
113 |
integer *iwork, integer *info ) |
|
|
114 |
{ |
|
|
115 |
return sgesdd_( jobz, m, n, a, lda, s, u, ldu, vt, ldvt, work, lwork, |
|
|
116 |
iwork, info ); |
|
|
117 |
} |
|
|
118 |
|
|
|
119 |
template<> |
|
|
120 |
int syev_< double >::operator()( char *jobz, char *uplo, integer *n, |
|
|
121 |
double *a, integer *lda, double *w, |
|
|
122 |
double *work, integer *lwork, |
|
|
123 |
integer *info) |
|
|
124 |
const |
|
|
125 |
{ |
|
|
126 |
return dsyev_( jobz, uplo, n, a, lda, w, work, lwork, info ); |
|
|
127 |
} |
|
|
128 |
|
|
|
129 |
template<> |
|
|
130 |
int syev_< float >::operator()( char *jobz, char *uplo, integer *n, |
|
|
131 |
float *a, integer *lda, float *w, |
|
|
132 |
float *work, integer *lwork, |
|
|
133 |
integer *info ) |
|
|
134 |
const |
|
|
135 |
{ |
|
|
136 |
return ssyev_( jobz, uplo, n, a, lda, w, work, lwork, info ); |
|
|
137 |
} |
|
|
138 |
|
|
|
139 |
template<> |
|
|
140 |
int pptrf_< double >::operator()( char *uplo, integer *n, double *ap, |
|
|
141 |
integer *info) const |
|
|
142 |
{ |
|
|
143 |
return dpptrf_( uplo, n, ap, info ); |
|
|
144 |
} |
|
|
145 |
|
|
|
146 |
template<> |
|
|
147 |
int pptrf_< float >::operator()( char *uplo, integer *n, float *ap, |
|
|
148 |
integer *info) const |
|
|
149 |
{ |
|
|
150 |
return spptrf_( uplo, n, ap, info ); |
|
|
151 |
} |
|
|
152 |
|
|
|
153 |
}; |