16#ifndef dealii_lapack_full_matrix_h
17#define dealii_lapack_full_matrix_h
37template <
typename number>
39template <
typename number>
41template <
typename number>
43template <
typename number>
58template <
typename number>
65 using size_type = std::make_unsigned<types::blas_int>::type;
107 template <
typename number2>
117 template <
typename number2>
194 const bool left =
true);
202 template <
typename MatrixType>
304 template <
typename MatrixType>
311 const number factor = 1.,
342 template <
typename number2>
346 const bool adding =
false)
const;
354 const bool adding =
false)
const;
362 template <
typename number2>
383 template <
typename number2>
387 const bool adding =
false)
const;
395 const bool adding =
false)
const;
403 template <
typename number2>
431 const bool adding =
false)
const;
440 const bool adding =
false)
const;
459 const bool adding =
false)
const;
468 const bool adding =
false)
const;
490 const bool adding =
false)
const;
509 const bool adding =
false)
const;
518 const bool adding =
false)
const;
538 const bool adding =
false)
const;
547 const bool adding =
false)
const;
695 const bool left_eigenvectors =
false);
718 const number upper_bound,
719 const number abs_accuracy,
752 const number lower_bound,
753 const number upper_bound,
754 const number abs_accuracy,
837 std::complex<typename numbers::NumberTraits<number>::real_type>
911 const unsigned int precision = 3,
912 const bool scientific =
true,
913 const unsigned int width = 0,
914 const char * zero_string =
" ",
915 const double denominator = 1.,
916 const double threshold = 0.)
const;
923 norm(
const char type)
const;
940 mutable std::vector<number>
work;
945 mutable std::vector<types::blas_int>
iwork;
953 std::vector<types::blas_int>
ipiv;
964 std::vector<typename numbers::NumberTraits<number>::real_type>
wr;
970 std::vector<number>
wi;
975 std::vector<number>
vl;
980 std::vector<number>
vr;
986 std::unique_ptr<LAPACKFullMatrix<number>>
svd_u;
992 std::unique_ptr<LAPACKFullMatrix<number>>
svd_vt;
1007template <
typename number>
1031template <
typename number>
1037 (*this)(i, j) = value;
1042template <
typename number>
1046 return static_cast<size_type>(this->n_rows());
1051template <
typename number>
1055 return static_cast<size_type>(this->n_cols());
1060template <
typename number>
1061template <
typename MatrixType>
1065 this->reinit(M.m(), M.n());
1070 for (
size_type row = 0; row < M.m(); ++row)
1072 const typename MatrixType::const_iterator end_row = M.end(row);
1073 for (
typename MatrixType::const_iterator entry = M.begin(row);
1076 this->el(row, entry->column()) = entry->value();
1084template <
typename number>
1085template <
typename MatrixType>
1092 const number factor,
1097 for (
size_type row = src_offset_i; row < M.m(); ++row)
1099 const typename MatrixType::const_iterator end_row = M.end(row);
1100 for (
typename MatrixType::const_iterator entry = M.begin(row);
1107 const size_type dst_i = dst_offset_i + i - src_offset_i;
1108 const size_type dst_j = dst_offset_j + j - src_offset_j;
1109 if (dst_i < this->n_rows() && dst_j < this->n_cols())
1110 (*
this)(dst_i, dst_j) = factor * entry->value();
1119template <
typename number>
1120template <
typename number2>
1127 ExcMessage(
"LAPACKFullMatrix<number>::vmult must be called with a "
1128 "matching Vector<double> vector type."));
1133template <
typename number>
1134template <
typename number2>
1140 ExcMessage(
"LAPACKFullMatrix<number>::vmult_add must be called with a "
1141 "matching Vector<double> vector type."));
1146template <
typename number>
1147template <
typename number2>
1154 ExcMessage(
"LAPACKFullMatrix<number>::Tvmult must be called with a "
1155 "matching Vector<double> vector type."));
1160template <
typename number>
1161template <
typename number2>
1167 ExcMessage(
"LAPACKFullMatrix<number>::Tvmult_add must be called "
1168 "with a matching Vector<double> vector type."));
1175 namespace LAPACKFullMatrixImplementation
1177 template <
typename RealNumber>
1178 std::complex<RealNumber>
1179 pack_complex(
const RealNumber &real_part,
const RealNumber &imaginary_part)
1181 return std::complex<RealNumber>(real_part, imaginary_part);
1186 template <
typename Number>
1187 std::complex<Number>
1190 return complex_number;
1197template <
typename number>
1198inline std::complex<typename numbers::NumberTraits<number>::real_type>
1211template <
typename number>
1224template <
typename number>
1236template <
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)
std::make_unsigned< types::blas_int >::type size_type
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
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
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::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 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)