16 #ifndef dealii_scalapack_h 17 #define dealii_scalapack_h 19 #include <deal.II/base/config.h> 21 #ifdef DEAL_II_WITH_SCALAPACK 23 # include <deal.II/base/exceptions.h> 24 # include <deal.II/base/mpi.h> 25 # include <deal.II/base/process_grid.h> 26 # include <deal.II/base/thread_management.h> 28 # include <deal.II/lac/full_matrix.h> 29 # include <deal.II/lac/lapack_full_matrix.h> 30 # include <deal.II/lac/lapack_support.h> 36 DEAL_II_NAMESPACE_OPEN
76 template <
typename NumberType>
96 const std::shared_ptr<const Utilities::MPI::ProcessGrid> &process_grid,
112 const std::shared_ptr<const Utilities::MPI::ProcessGrid> &process_grid,
115 LAPACKSupport::Property::symmetric);
130 const std::string & filename,
131 const std::shared_ptr<const Utilities::MPI::ProcessGrid> &process_grid,
152 const std::shared_ptr<const Utilities::MPI::ProcessGrid> &process_grid,
166 const std::shared_ptr<const Utilities::MPI::ProcessGrid> &process_grid,
169 LAPACKSupport::Property::symmetric);
209 const unsigned int rank);
266 const std::pair<unsigned int, unsigned int> &offset_A,
267 const std::pair<unsigned int, unsigned int> &offset_B,
268 const std::pair<unsigned int, unsigned int> &submatrix_size)
const;
294 const NumberType a = 0.,
295 const NumberType b = 1.,
296 const bool transpose_B =
false);
343 mult(
const NumberType b,
347 const bool transpose_A =
false,
348 const bool transpose_B =
false)
const;
370 const bool adding =
false)
const;
392 const bool adding =
false)
const;
414 const bool adding =
false)
const;
437 const bool adding =
false)
const;
460 save(
const std::string & filename,
461 const std::pair<unsigned int, unsigned int> &chunk_size =
477 load(
const std::string &filename);
525 std::vector<NumberType>
527 const std::pair<unsigned int, unsigned int> &index_limits,
528 const bool compute_eigenvectors);
538 std::vector<NumberType>
540 const std::pair<NumberType, NumberType> &value_limits,
541 const bool compute_eigenvectors);
559 std::vector<NumberType>
561 const std::pair<unsigned int, unsigned int> &index_limits,
562 const bool compute_eigenvectors);
574 std::vector<NumberType>
576 const std::pair<NumberType, NumberType> &value_limits,
577 const bool compute_eigenvectors);
607 std::vector<NumberType>
755 local_el(
const unsigned int loc_row,
const unsigned int loc_column)
const;
761 local_el(
const unsigned int loc_row,
const unsigned int loc_column);
773 template <
class InputVector>
787 template <
class InputVector>
816 std::vector<NumberType>
818 const bool compute_eigenvectors,
819 const std::pair<unsigned int, unsigned int> &index_limits =
822 const std::pair<NumberType, NumberType> &value_limits =
823 std::make_pair(std::numeric_limits<NumberType>::quiet_NaN(),
824 std::numeric_limits<NumberType>::quiet_NaN()));
845 std::vector<NumberType>
847 const bool compute_eigenvectors,
848 const std::pair<unsigned int, unsigned int> &index_limits =
851 const std::pair<NumberType, NumberType> &value_limits =
852 std::make_pair(std::numeric_limits<NumberType>::quiet_NaN(),
853 std::numeric_limits<NumberType>::quiet_NaN()));
860 save_serial(
const std::string & filename,
861 const std::pair<unsigned int, unsigned int> &chunk_size)
const;
868 load_serial(
const std::string &filename);
875 save_parallel(
const std::string & filename,
876 const std::pair<unsigned int, unsigned int> &chunk_size)
const;
883 load_parallel(
const std::string &filename);
902 std::shared_ptr<const Utilities::MPI::ProcessGrid>
grid;
942 mutable std::vector<NumberType>
work;
995 template <
typename NumberType>
998 const unsigned int loc_column)
const 1000 return (*
this)(loc_row, loc_column);
1005 template <
typename NumberType>
1008 const unsigned int loc_column)
1010 return (*
this)(loc_row, loc_column);
1014 template <
typename NumberType>
1023 template <
typename NumberType>
1032 template <
typename NumberType>
1036 return n_local_rows;
1041 template <
typename NumberType>
1045 return n_local_columns;
1051 DEAL_II_NAMESPACE_CLOSE
1053 #endif // DEAL_II_WITH_SCALAPACK std::vector< NumberType > eigenpairs_symmetric_by_index_MRRR(const std::pair< unsigned int, unsigned int > &index_limits, const bool compute_eigenvectors)
void copy_transposed(const ScaLAPACKMatrix< NumberType > &B)
ScaLAPACKMatrix(const size_type n_rows, const size_type n_columns, const std::shared_ptr< const Utilities::MPI::ProcessGrid > &process_grid, const size_type row_block_size=32, const size_type column_block_size=32, const LAPACKSupport::Property property=LAPACKSupport::Property::general)
std::vector< NumberType > eigenpairs_symmetric_by_value_MRRR(const std::pair< NumberType, NumberType > &value_limits, const bool compute_eigenvectors)
void mmult(ScaLAPACKMatrix< NumberType > &C, const ScaLAPACKMatrix< NumberType > &B, const bool adding=false) const
static const unsigned int invalid_unsigned_int
LAPACKSupport::State state
unsigned int global_row(const unsigned int loc_row) const
NumberType l1_norm() const
void Tmmult(ScaLAPACKMatrix< NumberType > &C, const ScaLAPACKMatrix< NumberType > &B, const bool adding=false) const
ScaLAPACKMatrix< NumberType > & operator=(const FullMatrix< NumberType > &)
unsigned int pseudoinverse(const NumberType ratio)
const TableIndices< N > & size() const
std::vector< NumberType > eigenpairs_symmetric(const bool compute_eigenvectors, const std::pair< unsigned int, unsigned int > &index_limits=std::make_pair(numbers::invalid_unsigned_int, numbers::invalid_unsigned_int), const std::pair< NumberType, NumberType > &value_limits=std::make_pair(std::numeric_limits< NumberType >::quiet_NaN(), std::numeric_limits< NumberType >::quiet_NaN()))
std::vector< NumberType > eigenpairs_symmetric_by_index(const std::pair< unsigned int, unsigned int > &index_limits, const bool compute_eigenvectors)
void scale_columns(const InputVector &factors)
std::shared_ptr< const Utilities::MPI::ProcessGrid > grid
void load(const std::string &filename)
const int submatrix_column
void reinit(const size_type n_rows, const size_type n_columns, const std::shared_ptr< const Utilities::MPI::ProcessGrid > &process_grid, const size_type row_block_size=32, const size_type column_block_size=32, const LAPACKSupport::Property property=LAPACKSupport::Property::general)
void TmTmult(ScaLAPACKMatrix< NumberType > &C, const ScaLAPACKMatrix< NumberType > &B, const bool adding=false) const
void least_squares(ScaLAPACKMatrix< NumberType > &B, const bool transpose=false)
void mTmult(ScaLAPACKMatrix< NumberType > &C, const ScaLAPACKMatrix< NumberType > &B, const bool adding=false) const
void scale_rows(const InputVector &factors)
NumberType norm_symmetric(const char type) const
void set_property(const LAPACKSupport::Property property)
const int first_process_row
LAPACKSupport::State get_state() const
unsigned int global_column(const unsigned int loc_column) const
void add(const ScaLAPACKMatrix< NumberType > &B, const NumberType a=0., const NumberType b=1., const bool transpose_B=false)
std::vector< NumberType > eigenpairs_symmetric_by_value(const std::pair< NumberType, NumberType > &value_limits, const bool compute_eigenvectors)
NumberType norm_general(const char type) const
SymmetricTensor< rank_, dim, Number > transpose(const SymmetricTensor< rank_, dim, Number > &t)
unsigned int local_m() const
std::vector< NumberType > eigenpairs_symmetric_MRRR(const bool compute_eigenvectors, const std::pair< unsigned int, unsigned int > &index_limits=std::make_pair(numbers::invalid_unsigned_int, numbers::invalid_unsigned_int), const std::pair< NumberType, NumberType > &value_limits=std::make_pair(std::numeric_limits< NumberType >::quiet_NaN(), std::numeric_limits< NumberType >::quiet_NaN()))
std::vector< NumberType > compute_SVD(ScaLAPACKMatrix< NumberType > *U=nullptr, ScaLAPACKMatrix< NumberType > *VT=nullptr)
std::vector< NumberType > work
void mult(const NumberType b, const ScaLAPACKMatrix< NumberType > &B, const NumberType c, ScaLAPACKMatrix< NumberType > &C, const bool transpose_A=false, const bool transpose_B=false) const
void copy_to(FullMatrix< NumberType > &matrix) const
void save(const std::string &filename, const std::pair< unsigned int, unsigned int > &chunk_size=std::make_pair(numbers::invalid_unsigned_int, numbers::invalid_unsigned_int)) const
unsigned int local_n() const
const int first_process_column
LAPACKSupport::Property property
void Tadd(const NumberType b, const ScaLAPACKMatrix< NumberType > &B)
NumberType local_el(const unsigned int loc_row, const unsigned int loc_column) const
NumberType reciprocal_condition_number(const NumberType a_norm) const
NumberType linfty_norm() const
~ScaLAPACKMatrix() override=default
void compute_cholesky_factorization()
NumberType frobenius_norm() const
void copy_from(const LAPACKFullMatrix< NumberType > &matrix, const unsigned int rank)
LAPACKSupport::Property get_property() const
void compute_lu_factorization()