41 # define HAVE_LAPACK_CONFIG_H 1
43 #elif defined(HAVE_LAPACKE_LAPACKE_H)
44 # define HAVE_LAPACK_CONFIG_H 1
45 # include <lapacke/lapacke.h>
46 #elif defined(HAVE_ACCELERATE_ACCELERATE_H)
47 # include <Accelerate/Accelerate.h>
48 #elif defined(HAVE___CLPK_INTEGER)
55 # ifdef HAVE_CLAPACK_H
56 # define complex TLapackComplexFloat
57 # define doublecomplex TLapackComplexDouble
58 # define integer TLapackInt
59 # define logical TLapackLogical
70 #if defined(LAPACK_malloc)
75 #elif defined(HAVE___CLPK_INTEGER)
84 #if !defined(LAPACK_COL_MAJOR) && !defined(__CLAPACK_H)
98 static unsigned int s_Min(
unsigned int x,
unsigned int y)
100 return x < y ? x : y;
105 double*
a,
unsigned int lda_in,
double* w)
107 double optimal_work_size;
108 char jobz = jobz_in, uplo = uplo_in;
110 dsyev_(&jobz, &uplo, &
n,
a, &lda, w, &optimal_work_size, &lwork, &
info);
113 lwork = optimal_work_size;
114 work =
malloc(lwork *
sizeof(
double));
118 dsyev_(&jobz, &uplo, &
n,
a, &lda, w, work, &lwork, &
info);
125 unsigned int r,
unsigned int c,
unsigned int nrhs_in,
126 double*
a,
unsigned int lda_in,
127 double*
b,
unsigned int ldb_in)
130 char trans = trans_in;
131 TLapackInt m =
r,
n = c, nrhs = nrhs_in, lda = lda_in, ldb = ldb_in,
132 lwork = -1,
info = 0;
133 dgels_(&trans, &m, &
n, &nrhs,
a, &lda,
b, &ldb, &ows, &lwork, &
info);
137 work =
malloc(lwork *
sizeof(
double));
141 dgels_(&trans, &m, &
n, &nrhs,
a, &lda,
b, &ldb, work, &lwork, &
info);
149 unsigned int r,
unsigned int c,
150 double*
a,
unsigned int lda_in,
double* s,
151 double* u,
unsigned int ldu_in,
152 double* vt,
unsigned int ldvt_in,
155 double optimal_work_size;
156 char jobu = jobu_in, jobvt = jobvt_in;
157 TLapackInt m =
r,
n = c, lda = lda_in, ldu = ldu_in, ldvt = ldvt_in,
158 lwork = -1,
info = 0;
159 dgesvd_(&jobu, &jobvt, &m, &
n,
a, &lda, s, u, &ldu, vt, &ldvt,
160 &optimal_work_size, &lwork, &
info);
163 lwork = optimal_work_size;
164 work =
malloc(lwork *
sizeof(
double));
168 dgesvd_(&jobu, &jobvt, &m, &
n,
a, &lda, s, u, &ldu, vt, &ldvt,
169 work, &lwork, &
info);
170 if (superb !=
NULL ) {
171 memcpy(superb, work + 1, (
s_Min(
r, c) - 1) *
sizeof(
double));
static const int kNcbiLapackMemoryError
int NCBI_SymmetricEigens(enum EEigensWanted jobz_in, enum EMatrixTriangle uplo_in, unsigned int n_in, double *a, unsigned int lda_in, double *w)
Compute the eigenvalues, and optionally also the eigenvectors, of a symmetric matrix.
ESingularVectorDetailsWanted
int NCBI_SingularValueDecomposition(enum ESingularVectorDetailsWanted jobu_in, enum ESingularVectorDetailsWanted jobvt_in, unsigned int r, unsigned int c, double *a, unsigned int lda_in, double *s, double *u, unsigned int ldu_in, double *vt, unsigned int ldvt_in, double *superb)
Compute the singular value decomposition of a matrix.
int NCBI_LinearSolution(enum EMaybeTransposed trans_in, unsigned int r, unsigned int c, unsigned int nrhs_in, double *a, unsigned int lda_in, double *b, unsigned int ldb_in)
Find the least-squares solution of an overdetermined linear system, or the minimum-norm solution of a...
TLapackInt dgels_(char *trans, TLapackInt *m, TLapackInt *n, TLapackInt *nrhs, double *a, TLapackInt *lda, double *b, TLapackInt *ldb, double *work, TLapackInt *lwork, TLapackInt *info)
TLapackInt dsyev_(char *jobz, char *uplo, TLapackInt *n, double *a, TLapackInt *lda, double *w, double *work, TLapackInt *lwork, TLapackInt *info)
static unsigned int s_Min(unsigned int x, unsigned int y)
TLapackInt dgesvd_(char *jobu, char *jobvt, TLapackInt *m, TLapackInt *n, double *a, TLapackInt *lda, double *s, double *u, TLapackInt *ldu, double *vt, TLapackInt *ldvt, double *work, TLapackInt *lwork, TLapackInt *info)
Front end for a platform-specific configuration summary.
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)