15#ifndef dealii_lapack_full_matrix_h
16#define dealii_lapack_full_matrix_h
36template <
typename number>
38template <
typename number>
40template <
typename number>
42template <
typename number>
57template <
typename number>
64 using size_type = std::make_unsigned_t<types::blas_int>;
106 template <
typename number2>
116 template <
typename number2>
193 const bool left =
true);
201 template <
typename MatrixType>
303 template <
typename MatrixType>
310 const number factor = 1.,
341 template <
typename number2>
345 const bool adding =
false)
const;
353 const bool adding =
false)
const;
361 template <
typename number2>
382 template <
typename number2>
386 const bool adding =
false)
const;
394 const bool adding =
false)
const;
402 template <
typename number2>
430 const bool adding =
false)
const;
439 const bool adding =
false)
const;
458 const bool adding =
false)
const;
467 const bool adding =
false)
const;
489 const bool adding =
false)
const;
508 const bool adding =
false)
const;
517 const bool adding =
false)
const;
537 const bool adding =
false)
const;
546 const bool adding =
false)
const;
694 const bool left_eigenvectors =
false);
717 const number upper_bound,
718 const number abs_accuracy,
751 const number lower_bound,
752 const number upper_bound,
753 const number abs_accuracy,
836 std::complex<typename numbers::NumberTraits<number>::real_type>
912 const unsigned int precision = 3,
913 const bool scientific =
true,
914 const unsigned int width = 0,
915 const char *zero_string =
" ",
916 const double denominator = 1.,
917 const double threshold = 0.,
918 const char *separator =
" ")
const;
931 norm(
const char type)
const;
948 mutable std::vector<number>
work;
953 mutable std::vector<types::blas_int>
iwork;
961 std::vector<types::blas_int>
ipiv;
972 std::vector<typename numbers::NumberTraits<number>::real_type>
wr;
978 std::vector<number>
wi;
983 std::vector<number>
vl;
988 std::vector<number>
vr;
994 std::unique_ptr<LAPACKFullMatrix<number>>
svd_u;
1000 std::unique_ptr<LAPACKFullMatrix<number>>
svd_vt;
1015template <
typename number>
1040template <
typename number>
1046 (*this)(i, j) = value;
1051template <
typename number>
1055 return static_cast<size_type>(this->n_rows());
1060template <
typename number>
1064 return static_cast<size_type>(this->n_cols());
1069template <
typename number>
1070template <
typename MatrixType>
1074 this->reinit(M.m(), M.n());
1079 for (
size_type row = 0; row < M.m(); ++row)
1081 const typename MatrixType::const_iterator end_row = M.end(row);
1082 for (
typename MatrixType::const_iterator entry = M.begin(row);
1085 this->el(row, entry->column()) = entry->value();
1093template <
typename number>
1094template <
typename MatrixType>
1101 const number factor,
1106 for (
size_type row = src_offset_i; row < M.m(); ++row)
1108 const typename MatrixType::const_iterator end_row = M.end(row);
1109 for (
typename MatrixType::const_iterator entry = M.begin(row);
1116 const size_type dst_i = dst_offset_i + i - src_offset_i;
1117 const size_type dst_j = dst_offset_j + j - src_offset_j;
1118 if (dst_i < this->n_rows() && dst_j < this->n_cols())
1119 (*
this)(dst_i, dst_j) = factor * entry->value();
1128template <
typename number>
1129template <
typename number2>
1136 ExcMessage(
"LAPACKFullMatrix<number>::vmult must be called with a "
1137 "matching Vector<double> vector type."));
1142template <
typename number>
1143template <
typename number2>
1149 ExcMessage(
"LAPACKFullMatrix<number>::vmult_add must be called with a "
1150 "matching Vector<double> vector type."));
1155template <
typename number>
1156template <
typename number2>
1163 ExcMessage(
"LAPACKFullMatrix<number>::Tvmult must be called with a "
1164 "matching Vector<double> vector type."));
1169template <
typename number>
1170template <
typename number2>
1176 ExcMessage(
"LAPACKFullMatrix<number>::Tvmult_add must be called "
1177 "with a matching Vector<double> vector type."));
1184 namespace LAPACKFullMatrixImplementation
1186 template <
typename RealNumber>
1187 std::complex<RealNumber>
1188 pack_complex(
const RealNumber &real_part,
const RealNumber &imaginary_part)
1190 return std::complex<RealNumber>(real_part, imaginary_part);
1195 template <
typename Number>
1196 std::complex<Number>
1199 return complex_number;
1206template <
typename number>
1207inline std::complex<typename numbers::NumberTraits<number>::real_type>
1220template <
typename number>
1233template <
typename number>
1245template <
typename number>
LAPACKFullMatrix< number > & operator*=(const number factor)
number reciprocal_condition_number() const
void Tmmult(LAPACKFullMatrix< number > &C, const LAPACKFullMatrix< number > &B, const bool adding=false) const
void copy_from(const MatrixType &)
void scale_rows(const Vector< number > &V)
FullMatrix< std::complex< typename numbers::NumberTraits< number >::real_type > > get_right_eigenvectors() const
void add(const number a, const LAPACKFullMatrix< number > &B)
void Tvmult(Vector< number2 > &w, const Vector< number2 > &v, const bool adding=false) const
void transpose(LAPACKFullMatrix< number > &B) const
void mTmult(LAPACKFullMatrix< number > &C, const LAPACKFullMatrix< number > &B, const bool adding=false) const
std::vector< typename numbers::NumberTraits< number >::real_type > wr
LAPACKSupport::State get_state() const
void compute_eigenvalues_symmetric(const number lower_bound, const number upper_bound, const number abs_accuracy, Vector< number > &eigenvalues, FullMatrix< number > &eigenvectors)
const LAPACKFullMatrix< number > & get_svd_u() const
void vmult(Vector< number2 > &w, const Vector< number2 > &v, const bool adding=false) const
void reinit(const size_type size)
void compute_cholesky_factorization()
LAPACKFullMatrix< number > & operator=(const LAPACKFullMatrix< number > &)
void compute_lu_factorization()
FullMatrix< std::complex< typename numbers::NumberTraits< number >::real_type > > get_left_eigenvectors() const
std::unique_ptr< LAPACKFullMatrix< number > > svd_vt
std::vector< number > work
void grow_or_shrink(const size_type size)
void apply_givens_rotation(const std::array< number, 3 > &csr, const size_type i, const size_type k, const bool left=true)
void set_property(const LAPACKSupport::Property property)
std::complex< typename numbers::NumberTraits< number >::real_type > eigenvalue(const size_type i) const
number norm(const char type) const
void solve(Vector< number > &v, const bool transposed=false) const
void compute_eigenvalues(const bool right_eigenvectors=false, const bool left_eigenvectors=false)
LAPACKSupport::State state
std::make_unsigned_t< types::blas_int > size_type
std::vector< number > inv_work
number frobenius_norm() const
LAPACKSupport::Property property
number singular_value(const size_type i) const
void set(const size_type i, const size_type j, const number value)
void compute_inverse_svd(const double threshold=0.)
void compute_generalized_eigenvalues_symmetric(LAPACKFullMatrix< number > &B, const number lower_bound, const number upper_bound, const number abs_accuracy, Vector< number > &eigenvalues, std::vector< Vector< number > > &eigenvectors, const types::blas_int itype=1)
void vmult_add(Vector< number2 > &w, const Vector< number2 > &v) const
number linfty_norm() const
void TmTmult(LAPACKFullMatrix< number > &C, const LAPACKFullMatrix< number > &B, const bool adding=false) const
const LAPACKFullMatrix< number > & get_svd_vt() const
std::unique_ptr< LAPACKFullMatrix< number > > svd_u
void compute_inverse_svd_with_kernel(const unsigned int kernel_size)
void Tvmult_add(Vector< number2 > &w, const Vector< number2 > &v) const
std::vector< types::blas_int > iwork
void rank1_update(const number a, const Vector< number > &v)
std::vector< types::blas_int > ipiv
void remove_row_and_column(const size_type row, const size_type col)
LAPACKFullMatrix< number > & operator/=(const number factor)
number determinant() const
void mmult(LAPACKFullMatrix< number > &C, const LAPACKFullMatrix< number > &B, const bool adding=false) const
void print_formatted(std::ostream &out, const unsigned int precision=3, const bool scientific=true, const unsigned int width=0, const char *zero_string=" ", const double denominator=1., const double threshold=0., const char *separator=" ") const
void fill(const MatrixType &src, const size_type dst_offset_i=0, const size_type dst_offset_j=0, const size_type src_offset_i=0, const size_type src_offset_j=0, const number factor=1., const bool transpose=false)
void vmult(Vector< number > &, const Vector< number > &) const
void initialize(const LAPACKFullMatrix< number > &)
void Tvmult(Vector< number > &, const Vector< number > &) const
ObserverPointer< VectorMemory< Vector< number > >, PreconditionLU< number > > mem
ObserverPointer< const LAPACKFullMatrix< number >, PreconditionLU< number > > matrix
const TableIndices< N > & size() const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcInvalidState()
static ::ExceptionBase & ExcMessage(std::string arg1)
static ::ExceptionBase & ExcState(State arg1)
@ matrix
Contents is actually a matrix.
@ svd
Matrix contains singular value decomposition,.
@ inverse_svd
Matrix is the inverse of a singular value decomposition.
@ eigenvalues
Eigenvalue vector is filled.
std::complex< RealNumber > pack_complex(const RealNumber &real_part, const RealNumber &imaginary_part)
std::array< Number, 1 > eigenvalues(const SymmetricTensor< 2, 1, Number > &T)
std::array< std::pair< Number, Tensor< 1, dim, Number > >, dim > eigenvectors(const SymmetricTensor< 2, dim, Number > &T, const SymmetricTensorEigenvectorMethod method=SymmetricTensorEigenvectorMethod::ql_implicit_shifts)