12 #ifndef __DENSEMAT_HEADER__
13 #define __DENSEMAT_HEADER__
28 void dscal_(
const int* n,
const double* alpha,
double* x,
const int* incx);
31 double ddot_(
const int* n,
double* a,
const int* inca,
double* b,
const int* incb);
34 int dcopy_(
const int* n,
const double* src,
const int* incx,
double* dst,
38 int daxpy_(
const int* n,
const double* alpha,
const double* x,
const int* incx,
39 double* y,
const int* incy);
42 double dnrm2_(
const int* n,
double* x,
const int* incx);
45 double dasum_(
const int* n,
double* x,
const int* incx);
48 int idamax_(
const int* n,
double* x,
const int* incx);
51 int dgemm_(
const char* transa,
const char* transb,
const int* m,
const int* n,
52 const int* k,
const double* alpha,
const double* A,
const int* lda,
53 const double* B,
const int* ldb,
const double* beta,
double* C,
59 int dgesv_(
const int* n,
const int* nrhs,
double* A,
const int* lda,
int* ipiv,
60 double* b,
const int* ldb,
int* info);
63 int dsysv_(
const char* uplo,
const int* n,
const int* nrhs,
double* A,
const int* lda,
64 int* ipiv,
double* b,
const int* ldb,
double* work,
const int* lwork,
68 int ssyevd_(
char* jobz,
char* uplo,
const int* n,
float* A,
const int* lda,
float* w,
float* work,
const int* lwork,
69 int* iwork,
const int* liwork,
int* info);
75 void MinEigenSY(
const int& N,
float* A,
float* w,
float* work,
const int& lwork);
81 void Dcopy(
const int& N,
double* dst,
const double* src);
84 double Ddot(
int n,
double* a,
double* b);
87 double Dnorm1(
const int& N,
double* x);
90 double Dnorm2(
const int& N,
double* x);
93 void Dscalar(
const int& n,
const double& alpha,
double* x);
96 void Daxpy(
const int& n,
const double& alpha,
const double* x,
double* y);
99 void DaABpbC(
const int& m,
const int& n,
const int& k,
const double& alpha,
100 const double* A,
const double* B,
const double& beta,
double* C);
103 void myDABpC(
const int& m,
const int& n,
const int& k,
const double* A,
const double* B,
double* C);
104 void myDABpCp(
const int& m,
const int& n,
const int& k,
const double* A,
const double* B,
double* C,
const int* flag,
const int N);
105 void myDABpCp1(
const int& m,
const int& n,
const int& k,
const double* A,
const double* B,
double* C,
const int* flag,
const int N);
106 void myDABpCp2(
const int& m,
const int& n,
const int& k,
const double* A,
const double* B,
double* C,
const int* flag,
const int N);
109 void DaAxpby(
const int& m,
const int& n,
const double& a,
const double* A,
110 const double* x,
const double& b,
double* y);
113 void LUSolve(
const int& nrhs,
const int& N,
double* A,
double* b,
int* pivot);
116 void SYSSolve(
const int& nrhs,
const char* uplo,
const int& N,
double* A,
117 double* b,
int* pivot,
double* work,
const int& lwork);
121 template <
typename T>
124 for (
int i = 0; i < N; i++) {
125 cout << i <<
" " << setprecision(16) << x[i] << endl;
131 template <
typename T>
134 for (
int i = 0; i < N; i++) {
135 if (!isfinite(x[i]) || isnan(x[i])) {
void SYSSolve(const int &nrhs, const char *uplo, const int &N, double *A, double *b, int *pivot, double *work, const int &lwork)
Calls dsysy to solve the linear system for symm matrices.
double dasum_(const int *n, double *x, const int *incx)
Computes the sum of the absolute values of a vector.
int idamax_(const int *n, double *x, const int *incx)
Finds the index of element having max absolute value.
int dsysv_(const char *uplo, const int *n, const int *nrhs, double *A, const int *lda, int *ipiv, double *b, const int *ldb, double *work, const int *lwork, int *info)
Computes the solution to system of linear equations A * X = B for symm matrices.
int dgesv_(const int *n, const int *nrhs, double *A, const int *lda, int *ipiv, double *b, const int *ldb, int *info)
Computes the solution to system of linear equations A * X = B for general matrices.
double Ddot(int n, double *a, double *b)
Dot product of two double vectors stored as pointers.
void DaABpbC(const int &m, const int &n, const int &k, const double &alpha, const double *A, const double *B, const double &beta, double *C)
Computes C' = alpha B'A' + beta C', all matrices are column-major.
int ssyevd_(char *jobz, char *uplo, const int *n, float *A, const int *lda, float *w, float *work, const int *lwork, int *iwork, const int *liwork, int *info)
Computes the eigenvalues and, optionally, the leftand /or right eigenvectors for SY matrices.
int daxpy_(const int *n, const double *alpha, const double *x, const int *incx, double *y, const int *incy)
Constant times a vector plus a vector.
void Dscalar(const int &n, const double &alpha, double *x)
Scales a vector by a constant.
void DaAxpby(const int &m, const int &n, const double &a, const double *A, const double *x, const double &b, double *y)
Computes y = a A x + b y.
void LUSolve(const int &nrhs, const int &N, double *A, double *b, int *pivot)
Calls dgesv to solve the linear system for general matrices.
bool CheckNan(const int &N, const T *x)
check NaN
void Daxpy(const int &n, const double &alpha, const double *x, double *y)
Constant times a vector plus a vector.
int dcopy_(const int *n, const double *src, const int *incx, double *dst, const int *incy)
Copies a vector, src, to a vector, dst.
void MinEigenSY(const int &N, float *A, float *w, float *work, const int &lwork)
Calculate the minimal eigenvalue for sysmetric matrix with mkl lapack.
int dgemm_(const char *transa, const char *transb, const int *m, const int *n, const int *k, const double *alpha, const double *A, const int *lda, const double *B, const int *ldb, const double *beta, double *C, const int *ldc)
Performs matrix-matrix operations C : = alpha * op(A) * op(B) + beta * C.
double dnrm2_(const int *n, double *x, const int *incx)
Computes the Euclidean norm of a vector.
void dscal_(const int *n, const double *alpha, double *x, const int *incx)
Scales a vector by a constant.
double Dnorm1(const int &N, double *x)
Computes the L1-norm of a vector.
void PrintDX(const int &N, const T *x)
Prints a vector.
void Dcopy(const int &N, double *dst, const double *src)
Calculate the minimal eigenvalue for sysmetric matrix with mkl lapack.
double ddot_(const int *n, double *a, const int *inca, double *b, const int *incb)
Forms the dot product of two vectors.
double Dnorm2(const int &N, double *x)
Computes the L2-norm of a vector.