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;
925 norm(
const char type)
const;
942 mutable std::vector<number>
work;
947 mutable std::vector<types::blas_int>
iwork;
955 std::vector<types::blas_int>
ipiv;
966 std::vector<typename numbers::NumberTraits<number>::real_type>
wr;
972 std::vector<number>
wi;
977 std::vector<number>
vl;
982 std::vector<number>
vr;
988 std::unique_ptr<LAPACKFullMatrix<number>>
svd_u;
994 std::unique_ptr<LAPACKFullMatrix<number>>
svd_vt;
1009template <
typename number>
1033template <
typename number>
1039 (*this)(i, j) = value;
1044template <
typename number>
1048 return static_cast<size_type>(this->n_rows());
1053template <
typename number>
1057 return static_cast<size_type>(this->n_cols());
1062template <
typename number>
1063template <
typename MatrixType>
1067 this->reinit(M.m(), M.n());
1072 for (
size_type row = 0; row < M.m(); ++row)
1074 const typename MatrixType::const_iterator end_row = M.end(row);
1075 for (
typename MatrixType::const_iterator entry = M.begin(row);
1078 this->el(row, entry->column()) = entry->value();
1086template <
typename number>
1087template <
typename MatrixType>
1094 const number factor,
1099 for (
size_type row = src_offset_i; row < M.m(); ++row)
1101 const typename MatrixType::const_iterator end_row = M.end(row);
1102 for (
typename MatrixType::const_iterator entry = M.begin(row);
1109 const size_type dst_i = dst_offset_i + i - src_offset_i;
1110 const size_type dst_j = dst_offset_j + j - src_offset_j;
1111 if (dst_i < this->n_rows() && dst_j < this->n_cols())
1112 (*
this)(dst_i, dst_j) = factor * entry->value();
1121template <
typename number>
1122template <
typename number2>
1129 ExcMessage(
"LAPACKFullMatrix<number>::vmult must be called with a "
1130 "matching Vector<double> vector type."));
1135template <
typename number>
1136template <
typename number2>
1142 ExcMessage(
"LAPACKFullMatrix<number>::vmult_add must be called with a "
1143 "matching Vector<double> vector type."));
1148template <
typename number>
1149template <
typename number2>
1156 ExcMessage(
"LAPACKFullMatrix<number>::Tvmult must be called with a "
1157 "matching Vector<double> vector type."));
1162template <
typename number>
1163template <
typename number2>
1169 ExcMessage(
"LAPACKFullMatrix<number>::Tvmult_add must be called "
1170 "with a matching Vector<double> vector type."));
1177 namespace LAPACKFullMatrixImplementation
1179 template <
typename RealNumber>
1180 std::complex<RealNumber>
1181 pack_complex(
const RealNumber &real_part,
const RealNumber &imaginary_part)
1183 return std::complex<RealNumber>(real_part, imaginary_part);
1188 template <
typename Number>
1189 std::complex<Number>
1192 return complex_number;
1199template <
typename number>
1200inline std::complex<typename numbers::NumberTraits<number>::real_type>
1213template <
typename number>
1226template <
typename number>
1238template <
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
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
LAPACKFullMatrix(const size_type size=0)
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
SmartPointer< VectorMemory< Vector< number > >, PreconditionLU< number > > mem
void initialize(const LAPACKFullMatrix< number > &)
SmartPointer< const LAPACKFullMatrix< number >, PreconditionLU< number > > matrix
void Tvmult(Vector< number > &, const Vector< number > &) const
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 > >, std::integral_constant< int, dim >::value > eigenvectors(const SymmetricTensor< 2, dim, Number > &T, const SymmetricTensorEigenvectorMethod method=SymmetricTensorEigenvectorMethod::ql_implicit_shifts)