AC_CHECK_FUNCS([daxpy_ saxpy_ dgemv_ sgemv_ dgeev_ sgeev_ dgeevx_ sgeevx_])
AC_CHECK_FUNCS([dgesvd_ sgesvd_ dgemm_ sgemm_ dgetrf_ sgetrf_ dgetri_ sgetri_])
AC_CHECK_FUNCS([dgeqrf_ sgeqrf_ dormqr_ sormqr_ dorgqr_ sorgqr_ dtrtrs_ strtrs_])
-AC_CHECK_FUNCS([dgetrs_ sgetrs_ dstev_ sstev_ dsygv_ ssygv_])
+AC_CHECK_FUNCS([dgetrs_ sgetrs_ dstev_ sstev_ dsygv_ ssygv_ dgelsd_ sgelsd_])
dnl -------------------------------------------------------------
dnl set include paths of several libraries
#include <lac/lapack_support.h>
#include <lac/vector_memory.h>
+#include <base/std_cxx1x/shared_ptr.h>
#include <vector>
#include <complex>
std::vector<number> inv_work;
/**
- * Real parts of
- * eigenvalues. Filled by
- * compute_eigenvalues.
+ * Real parts of eigenvalues or
+ * the singular values. Filled by
+ * compute_eigenvalues() or compute_svd().
*/
std::vector<number> wr;
* can be stored.
*/
std::vector<number> vr;
+
+ /**
+ * The matrix <i>U</i> in the singular value decomposition
+ * <i>USV<sup>T</sup></i>.
+ */
+ boost::shared_ptr<LAPACKFullMatrix<number> > svd_u;
+ /**
+ * The matrix <i>V<sup>T</sup></i> in the singular value decomposition
+ * <i>USV<sup>T</sup></i>.
+ */
+ boost::shared_ptr<LAPACKFullMatrix<number> > svd_vt;
};
const int* n, double* A, const int* lda, double* B,
const int* ldb, double* w, double* work,
const int* lwork, int* info);
+
// Compute singular value decomposition
void dgesvd_ (int* jobu, int* jobvt,
const int* n, const int* m, double* A, const int* lda,
double* work, const int* lwork,
int* info);
+// Solve a least squares problem using SVD
+void dgelsd_ (const int* m, const int* n, const int* nrhs,
+ const double* A, const int* lda,
+ double* B, const int* ldb,
+ double* s, const double* rcond,
+ int* rank,
+ double* work, const int* lwork, int* iwork,
+ int* info);
// Symmetric tridiagonal matrix
void dstev_ (const char* jobz, const int* n,