16 #ifndef dealii__lapack_full_matrix_h 17 #define dealii__lapack_full_matrix_h 20 #include <deal.II/base/config.h> 21 #include <deal.II/base/smartpointer.h> 22 #include <deal.II/base/table.h> 23 #include <deal.II/lac/lapack_support.h> 24 #include <deal.II/lac/vector_memory.h> 26 #include <deal.II/base/std_cxx11/shared_ptr.h> 30 DEAL_II_NAMESPACE_OPEN
33 template<
typename number>
class Vector;
51 template <
typename number>
103 template <
typename number2>
113 template <
typename number2>
142 template <
typename MatrixType>
165 unsigned int m ()
const;
172 unsigned int n ()
const;
187 template<
typename MatrixType>
188 void fill (
const MatrixType &src,
193 const number factor = 1.,
194 const bool transpose =
false);
225 template <
typename number2>
228 const bool adding =
false)
const;
235 const bool adding =
false)
const;
242 template <
typename number2>
264 template <
typename number2>
267 const bool adding=
false)
const;
274 const bool adding=
false)
const;
282 template <
typename number2>
310 const bool adding=
false)
const;
318 const bool adding=
false)
const;
337 const bool adding=
false)
const;
345 const bool adding=
false)
const;
364 const bool adding=
false)
const;
372 const bool adding=
false)
const;
392 const bool adding=
false)
const;
400 const bool adding=
false)
const;
422 const bool transposed)
const;
434 const bool transposed)
const;
455 const bool left_eigenvectors =
false);
476 const number upper_bound,
477 const number abs_accuracy,
503 const number lower_bound,
504 const number upper_bound,
505 const number abs_accuracy,
508 const int itype = 1);
528 const int itype = 1);
601 const unsigned int precision = 3,
602 const bool scientific =
true,
603 const unsigned int width = 0,
604 const char *zero_string =
" ",
605 const double denominator = 1.,
606 const double threshold = 0.)
const;
625 mutable std::vector<number>
work;
644 std::vector<number>
wr;
649 std::vector<number>
wi;
654 std::vector<number>
vl;
659 std::vector<number>
vr;
665 std_cxx11::shared_ptr<LAPACKFullMatrix<number> >
svd_u;
671 std_cxx11::shared_ptr<LAPACKFullMatrix<number> >
svd_vt;
682 template <
typename number>
704 template <
typename number>
709 return this->n_rows ();
712 template <
typename number>
717 return this->n_cols ();
720 template <
typename number>
721 template <
typename MatrixType>
725 this->reinit (M.m(), M.n());
730 for (
size_type row = 0; row < M.m(); ++row)
732 const typename MatrixType::const_iterator end_row = M.end(row);
733 for (
typename MatrixType::const_iterator entry = M.begin(row);
734 entry != end_row; ++entry)
735 this->el(row, entry->column()) = entry->value();
738 state = LAPACKSupport::matrix;
743 template <
typename number>
744 template <
typename MatrixType>
756 for (
size_type row = src_offset_i; row < M.m(); ++row)
758 const typename MatrixType::const_iterator end_row = M.end(row);
759 for (
typename MatrixType::const_iterator entry = M.begin(row);
760 entry != end_row; ++entry)
765 const size_type dst_i=dst_offset_i+i-src_offset_i;
766 const size_type dst_j=dst_offset_j+j-src_offset_j;
767 if (dst_i<this->n_rows() && dst_j<this->n_cols())
768 (*this)(dst_i, dst_j) = factor * entry->value();
772 state = LAPACKSupport::matrix;
776 template <
typename number>
777 template <
typename number2>
784 ExcMessage(
"LAPACKFullMatrix<number>::vmult must be called with a " 785 "matching Vector<double> vector type."));
789 template <
typename number>
790 template <
typename number2>
796 ExcMessage(
"LAPACKFullMatrix<number>::vmult_add must be called with a " 797 "matching Vector<double> vector type."));
801 template <
typename number>
802 template <
typename number2>
809 ExcMessage(
"LAPACKFullMatrix<number>::Tvmult must be called with a " 810 "matching Vector<double> vector type."));
814 template <
typename number>
815 template <
typename number2>
821 ExcMessage(
"LAPACKFullMatrix<number>::Tvmult_add must be called with a " 822 "matching Vector<double> vector type."));
826 template <
typename number>
827 inline std::complex<number>
835 return std::complex<number>(wr[i], wi[i]);
839 template <
typename number>
851 DEAL_II_NAMESPACE_CLOSE
LAPACKFullMatrix(const size_type size=0)
std_cxx11::shared_ptr< LAPACKFullMatrix< number > > svd_u
std::vector< number > work
void TmTmult(LAPACKFullMatrix< number > &C, const LAPACKFullMatrix< number > &B, const bool adding=false) const
LAPACKFullMatrix< number > & operator/=(const number factor)
void Tvmult(Vector< number2 > &w, const Vector< number2 > &v, const bool adding=false) const
LAPACKSupport::State state
const TableIndices< N > & size() const
std::complex< number > eigenvalue(const size_type i) const
#define AssertIndexRange(index, range)
LAPACKSupport::Properties properties
void compute_eigenvalues_symmetric(const number lower_bound, const number upper_bound, const number abs_accuracy, Vector< number > &eigenvalues, FullMatrix< number > &eigenvectors)
void reinit(const size_type size)
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
void Tmmult(LAPACKFullMatrix< number > &C, const LAPACKFullMatrix< number > &B, const bool adding=false) const
types::global_dof_index size_type
static ::ExceptionBase & ExcState(State arg1)
static ::ExceptionBase & ExcInvalidState()
static ::ExceptionBase & ExcMessage(std::string arg1)
void mTmult(LAPACKFullMatrix< number > &C, const LAPACKFullMatrix< number > &B, const bool adding=false) const
TableBase< 2, T >::size_type size_type
unsigned int global_dof_index
std_cxx11::shared_ptr< LAPACKFullMatrix< number > > svd_vt
#define Assert(cond, exc)
void copy_from(const MatrixType &)
std::vector< number > inv_work
void compute_lu_factorization()
void vmult(Vector< number2 > &w, const Vector< number2 > &v, const bool adding=false) const
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 int itype=1)
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
number singular_value(const size_type i) const
LAPACKFullMatrix< number > & operator*=(const number factor)
void compute_inverse_svd(const double threshold=0.)
LAPACKFullMatrix< number > & operator=(const LAPACKFullMatrix< number > &)
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 Tvmult_add(Vector< number2 > &w, const Vector< number2 > &v) const
void compute_eigenvalues(const bool right_eigenvectors=false, const bool left_eigenvectors=false)
void apply_lu_factorization(Vector< number > &v, const bool transposed) const
void vmult_add(Vector< number2 > &w, const Vector< number2 > &v) const
void mmult(LAPACKFullMatrix< number > &C, const LAPACKFullMatrix< number > &B, const bool adding=false) const
static ::ExceptionBase & ExcInternalError()