34#ifndef EIGEN_LLT_LAPACKE_H
35#define EIGEN_LLT_LAPACKE_H
38#include "./InternalHeaderCheck.h"
44namespace lapacke_helpers {
49template <UpLoType Mode>
53struct rank_update<
Lower> {
54 template <
typename MatrixType,
typename VectorType>
55 static Index run(MatrixType &mat,
const VectorType &vec,
const typename MatrixType::RealScalar &sigma) {
56 return Eigen::internal::llt_rank_update_lower(mat, vec, sigma);
61struct rank_update<
Upper> {
62 template <
typename MatrixType,
typename VectorType>
63 static Index run(MatrixType &mat,
const VectorType &vec,
const typename MatrixType::RealScalar &sigma) {
64 Transpose<MatrixType> matt(mat);
65 return Eigen::internal::llt_rank_update_lower(matt, vec.conjugate(), sigma);
73template <
typename Scalar, UpLoType Mode>
75 EIGEN_STATIC_ASSERT(((Mode ==
Lower) || (Mode ==
Upper)), MODE_MUST_BE_UPPER_OR_LOWER)
76 template <
typename MatrixType>
77 static Index blocked(MatrixType &m) {
78 eigen_assert(m.rows() == m.cols());
83 lapack_int size = to_lapack(m.rows());
84 lapack_int matrix_order = lapack_storage_of(m);
85 constexpr char uplo = Mode ==
Upper ?
'U' :
'L';
86 Scalar *a = &m.coeffRef(0, 0);
87 lapack_int lda = to_lapack(m.outerStride());
89 lapack_int info = potrf(matrix_order, uplo, size, to_lapack(a), lda);
90 info = (info == 0) ? -1 : info > 0 ? info - 1 : size;
94 template <
typename MatrixType,
typename VectorType>
95 static Index rankUpdate(MatrixType &mat,
const VectorType &vec,
const typename MatrixType::RealScalar &sigma) {
96 return rank_update<Mode>::run(mat, vec, sigma);
107#define EIGEN_LAPACKE_LLT(EIGTYPE) \
109 struct llt_inplace<EIGTYPE, Lower> : public lapacke_helpers::lapacke_llt<EIGTYPE, Lower> {}; \
111 struct llt_inplace<EIGTYPE, Upper> : public lapacke_helpers::lapacke_llt<EIGTYPE, Upper> {};
113EIGEN_LAPACKE_LLT(
double)
114EIGEN_LAPACKE_LLT(
float)
115EIGEN_LAPACKE_LLT(std::complex<double>)
116EIGEN_LAPACKE_LLT(std::complex<float>)
118#undef EIGEN_LAPACKE_LLT
@ Lower
Definition Constants.h:212
@ Upper
Definition Constants.h:214