imate
C++/CUDA Reference
lapack_api.cpp File Reference
#include "./lapack_api.h"
#include <cstddef>
Include dependency graph for lapack_api.cpp:

Go to the source code of this file.

Functions

template<>
void lapack_xstev< float > (char *jobz, int *n, float *d, float *e, float *z, int *ldz, float *work, int *info)
 Overlodng wrapper for both lapack_sstev (a float function) and lapack_dstev (a double function). xstev overloads both sstev and dstev with the same function signature. More...
 
template<>
void lapack_xstev< double > (char *jobz, int *n, double *d, double *e, double *z, int *ldz, double *work, int *info)
 Overlodng wrapper for both lapack_sstev (a float function) and lapack_dstev (a double function). xstev overloads both sstev and dstev with the same function signature. More...
 
template<>
void lapack_xstev< long double > (char *jobz, int *n, long double *d, long double *e, long double *z, int *ldz, long double *work, int *info)
 Overlodng wrapper for both lapack_sstev (a float function) and lapack_dstev (a double function). xstev overloads both sstev and dstev with the same function signature. This function casts long double type to double and uses dstev subroutine. More...
 
template<>
void lapack_xbdsdc< float > (char *uplo, char *compq, int *n, float *d, float *e, float *u, int *ldu, float *vt, int *ldvt, float *q, int *iq, float *work, int *iwork, int *info)
 Overlodng wrapper for both lapack_sbdsdc (a float function) and lapack_dbdsdc (a double function). xbdsdc overloads both sbdsdc and dbdsdc with the same function signature. More...
 
template<>
void lapack_xbdsdc< double > (char *uplo, char *compq, int *n, double *d, double *e, double *u, int *ldu, double *vt, int *ldvt, double *q, int *iq, double *work, int *iwork, int *info)
 Overlodng wrapper for both lapack_sbdsdc (a double function) and lapack_dbdsdc (a double function). xbdsdc overloads both sbdsdc and dbdsdc with the same function signature. More...
 
template<>
void lapack_xbdsdc< long double > (char *uplo, char *compq, int *n, long double *d, long double *e, long double *u, int *ldu, long double *vt, int *ldvt, long double *q, int *iq, long double *work, int *iwork, int *info)
 Overlodng wrapper for both lapack_sbdsdc (a double function) and lapack_dbdsdc (a double function). xbdsdc overloads both sstev and dstev with the same function signature. This function casts long double type to double and uses dstev subroutine. More...
 

Function Documentation

◆ lapack_xbdsdc< double >()

template<>
void lapack_xbdsdc< double > ( char *  uplo,
char *  compq,
int *  n,
double *  d,
double *  e,
double *  u,
int *  ldu,
double *  vt,
int *  ldvt,
double *  q,
int *  iq,
double *  work,
int *  iwork,
int *  info 
)

Overlodng wrapper for both lapack_sbdsdc (a double function) and lapack_dbdsdc (a double function). xbdsdc overloads both sbdsdc and dbdsdc with the same function signature.

Definition at line 142 of file lapack_api.cpp.

146 {
147  lapack_dbdsdc(uplo, compq, n, d, e, u, ldu, vt, ldvt, q, iq, work, iwork,
148  info);
149 }
void lapack_dbdsdc(char *uplo, char *compq, int *n, double *d, double *e, double *u, int *ldu, double *vt, int *ldvt, double *q, int *iq, double *work, int *iwork, int *info)

References lapack_dbdsdc().

Here is the call graph for this function:

◆ lapack_xbdsdc< float >()

template<>
void lapack_xbdsdc< float > ( char *  uplo,
char *  compq,
int *  n,
float *  d,
float *  e,
float *  u,
int *  ldu,
float *  vt,
int *  ldvt,
float *  q,
int *  iq,
float *  work,
int *  iwork,
int *  info 
)

Overlodng wrapper for both lapack_sbdsdc (a float function) and lapack_dbdsdc (a double function). xbdsdc overloads both sbdsdc and dbdsdc with the same function signature.

Definition at line 124 of file lapack_api.cpp.

127 {
128  lapack_sbdsdc(uplo, compq, n, d, e, u, ldu, vt, ldvt, q, iq, work, iwork,
129  info);
130 }
void lapack_sbdsdc(char *uplo, char *compq, int *n, float *d, float *e, float *u, int *ldu, float *vt, int *ldvt, float *q, int *iq, float *work, int *iwork, int *info)

References lapack_sbdsdc().

Here is the call graph for this function:

◆ lapack_xbdsdc< long double >()

template<>
void lapack_xbdsdc< long double > ( char *  uplo,
char *  compq,
int *  n,
long double *  d,
long double *  e,
long double *  u,
int *  ldu,
long double *  vt,
int *  ldvt,
long double *  q,
int *  iq,
long double *  work,
int *  iwork,
int *  info 
)

Overlodng wrapper for both lapack_sbdsdc (a double function) and lapack_dbdsdc (a double function). xbdsdc overloads both sstev and dstev with the same function signature. This function casts long double type to double and uses dstev subroutine.

The variables with leading undescore are double counterparts of the long double variables.

Definition at line 166 of file lapack_api.cpp.

171 {
172  // Mark unused variables to avoid compiler warnings (-Wno-unused-parameter)
173  (void) q;
174  (void) work;
175 
176  // Deep copy long double diagonal array to double
177  double *d_ = new double[(*n)];
178  for (int i=0; i < (*n); ++i)
179  {
180  d_[i] = static_cast<double>(d[i]);
181  }
182 
183  // Deep copy long double supdiagonal array to double
184  double *e_ = new double[(*n)-1];
185  for (int i=0; i < (*n)-1; ++i)
186  {
187  e_[i] = static_cast<double>(e[i]);
188  }
189 
190  // Declare left and right eigenvectors arrays
191  double *u_ = new double[(*ldu)*(*n)];
192  double *vt_ = new double[(*ldvt)*(*n)];
193 
194  // Declare work variables
195  double* q_ = NULL;
196  double *work_ = new double[3*(*n)*(*n) + 4*(*n)];
197 
198  // Call lapack
199  lapack_dbdsdc(uplo, compq, n, d_, e_, u_, ldu, vt_, ldvt, q_, iq, work_,
200  iwork, info);
201 
202  // Copy back eigenvectors from double to long double
203  for (int i=0; i < (*n); ++i)
204  {
205  d[i] = static_cast<long double>(d_[i]);
206  }
207 
208  // Copy left and right eigenvectors fom double to long double
209  for (int i=0; i < (*ldu)*(*n); ++i)
210  {
211  u[i] = static_cast<long double>(u_[i]);
212  }
213 
214  for (int i=0; i < (*ldvt)*(*n); ++i)
215  {
216  vt[i] = static_cast<long double>(vt_[i]);
217  }
218 
219  // Deallocate memory
220  delete[] d_;
221  delete[] e_;
222  delete[] u_;
223  delete[] vt_;
224  delete[] work_;
225 }

References lapack_dbdsdc().

Here is the call graph for this function:

◆ lapack_xstev< double >()

template<>
void lapack_xstev< double > ( char *  jobz,
int *  n,
double *  d,
double *  e,
double *  z,
int *  ldz,
double *  work,
int *  info 
)

Overlodng wrapper for both lapack_sstev (a float function) and lapack_dstev (a double function). xstev overloads both sstev and dstev with the same function signature.

Definition at line 46 of file lapack_api.cpp.

48 {
49  // Calling double method
50  lapack_dstev(jobz, n, d, e, z, ldz, work, info);
51 }
void lapack_dstev(char *jobz, int *n, double *d, double *e, double *z, int *ldz, double *work, int *info)

References lapack_dstev().

Here is the call graph for this function:

◆ lapack_xstev< float >()

template<>
void lapack_xstev< float > ( char *  jobz,
int *  n,
float *  d,
float *  e,
float *  z,
int *  ldz,
float *  work,
int *  info 
)

Overlodng wrapper for both lapack_sstev (a float function) and lapack_dstev (a double function). xstev overloads both sstev and dstev with the same function signature.

Definition at line 29 of file lapack_api.cpp.

31 {
32  // Calling float method
33  lapack_sstev(jobz, n, d, e, z, ldz, work, info);
34 }

◆ lapack_xstev< long double >()

template<>
void lapack_xstev< long double > ( char *  jobz,
int *  n,
long double *  d,
long double *  e,
long double *  z,
int *  ldz,
long double *  work,
int *  info 
)

Overlodng wrapper for both lapack_sstev (a float function) and lapack_dstev (a double function). xstev overloads both sstev and dstev with the same function signature. This function casts long double type to double and uses dstev subroutine.

The variables with leading undescore are double counterparts of the long double variables.

Definition at line 67 of file lapack_api.cpp.

70 {
71  // Mark unused variables to avoid compiler warnings (-Wno-unused-parameter)
72  (void) work;
73 
74  // Deep copy long double diagonal array to double
75  double *d_ = new double[(*n)];
76  for (int i=0; i < (*n); ++i)
77  {
78  d_[i] = static_cast<double>(d[i]);
79  }
80 
81  // Deep copy long double supdiagonal array to double
82  double *e_ = new double[(*n)-1];
83  for (int i=0; i < (*n)-1; ++i)
84  {
85  e_[i] = static_cast<double>(e[i]);
86  }
87 
88  // Declare eigenvectors and work arrays as double
89  double *z_ = new double[(*ldz)*(*n)];
90  double *work_ = new double[2*(*n)-2];
91 
92  // Calling double method
93  lapack_dstev(jobz, n, d_, e_, z_, ldz, work_, info);
94 
95  // Copy eigenvalues from double to long double
96  for (int i=0; i < (*n); ++i)
97  {
98  d[i] = static_cast<long double>(d_[i]);
99  }
100 
101  // Copy eigenvectors from double to long double
102  for (int i=0; i < (*ldz)*(*n); ++i)
103  {
104  z[i] = static_cast<long double>(z_[i]);
105  }
106 
107  // Deallocate memory
108  delete[] d_;
109  delete[] e_;
110  delete[] z_;
111  delete[] work_;
112 }

References lapack_dstev().

Here is the call graph for this function: