70#include "rheolef/vec.h"
71#include "rheolef/asr.h"
72#include "rheolef/vector_of_iterator.h"
73#include "rheolef/scatter_message.h"
74#include "rheolef/pair_util.h"
81template<
class T,
class M>
class csr_rep {};
86 typedef typename std::vector<T>::size_type
size_type;
120 void set_symmetry_by_check (
const T& tol = std::numeric_limits<T>::epsilon())
const;
133 void dump (
const std::string& name,
size_type istart = 0)
const;
137 template <
class BinaryOp>
152 std::vector<std::pair<typename std::vector<T>::size_type,
T> >
_data;
162 _row_ownership (a.row_ownership()),
163 _col_ownership (a.col_ownership()),
165 _is_symmetric(false),
166 _is_definite_positive(false),
167 _pattern_dimension(0)
176 typedef std::allocator<T>
A;
185#ifdef _RHEOLEF_HAVE_MPI
207 const communicator&
comm()
const {
return row_ownership().comm(); }
226 void set_symmetry (
bool is_symm)
const { base::set_symmetry(is_symm); }
227 void set_symmetry_by_check (
const T& tol = std::numeric_limits<T>::epsilon())
const;
239 void dump (
const std::string& name)
const;
243 template <
class BinaryOp>
262 void _scatter_init()
const;
264 if (_scatter_initialized)
return;
265 _scatter_initialized =
true;
271typename csr_rep<T,distributed>::size_type
274 check_macro (jext < _jext2dis_j.size(),
"jext2dis_j: jext="<<jext<<
" is out of range [0:"<<_jext2dis_j.size()<<
"[");
275 return _jext2dis_j [jext];
286 _scatter_initialized(false),
298 typedef std::allocator<T>
A;
308template <
class T,
class M>
class csr_concat_value;
309template <
class T,
class M>
class csr_concat_line;
316template <
class T,
class M = rheo_default_memory_model>
344 { base::data().resize(loc_nrow1, loc_ncol1, loc_nnz1); }
346 { base::data().resize(row_ownership, col_ownership, nnz1); }
363 void set_symmetry (
bool is_symm)
const { base::data().set_symmetry(is_symm); }
365 { base::data().set_symmetry_by_check(); }
370 T max_abs ()
const {
return base::data().max_abs(); }
402 base::data().mult (x,y);
410 base::data().trans_mult (x,y);
424 base::data().operator*= (
lambda);
429 void dump (
const std::string& name)
const { base::data().dump(name); }
458 a.data().build_transpose (b.data());
463#ifdef _RHEOLEF_HAVE_MPI
487 { base::data().resize(row_ownership, col_ownership, nnz1); }
504 void set_symmetry (
bool is_symm)
const { base::data().set_symmetry(is_symm); }
506 { base::data().set_symmetry_by_check(); }
511 T max_abs ()
const {
return base::data().max_abs(); }
543 base::data().mult (x,y);
551 base::data().trans_mult (x,y);
565 base::data().operator*= (
lambda);
570 void dump (
const std::string& name)
const { base::data().dump(name); }
597 a.data().build_transpose (b.data());
603template<
class T,
class M,
class Function>
612 if (a.ext_nnz() != 0) {
619template<
class T,
class M,
class Function>
627template<
class T,
class M>
629diag (
const vec<T,M>&);
634template <
class T,
class M>
639 return x.data().get(s);
641template <
class T,
class M>
646 return x.data().put(s);
656 c.data().assign_add (this->data(), b.data(), std::plus<T>());
664 c.data().assign_add (this->data(), b.data(), std::minus<T>());
667#ifdef _RHEOLEF_HAVE_MPI
673 c.data().assign_add (this->data(), b.data(), std::plus<T>());
681 c.data().assign_add (this->data(), b.data(), std::minus<T>());
694 c.data().assign_mult (this->data(), b.data());
697#ifdef _RHEOLEF_HAVE_MPI
703 c.data().assign_mult (this->data(), b.data());
719 val = std::max (val, abs((*iter).second));
723#ifdef _RHEOLEF_HAVE_MPI
730 val = mpi::all_reduce (comm(), val, mpi::maximum<T>());
field::size_type size_type
size_type dis_nnz() const
rep::const_data_iterator const_data_iterator
rep::element_type element_type
size_type jext2dis_j(size_type jext) const
void resize(const distributor &row_ownership, const distributor &col_ownership, size_type nnz1=0)
rep::const_iterator const_iterator
void mult(const vec< element_type, distributed > &x, vec< element_type, distributed > &y) const
size_type row_last_index() const
const_iterator begin() const
size_type pattern_dimension() const
void trans_mult(const vec< element_type, distributed > &x, vec< element_type, distributed > &y) const
bool is_definite_positive() const
size_type col_last_index() const
void set_pattern_dimension(size_type dim) const
csr_rep< T, distributed > rep
iterator ext_begin_nonconst()
iterator ext_end_nonconst()
const_iterator ext_end() const
const distributor & col_ownership() const
size_type dis_ncol() const
void set_symmetry(bool is_symm) const
void set_symmetry_by_check(const T &tol=std::numeric_limits< T >::epsilon()) const
iterator begin_nonconst()
size_type ext_nnz() const
smart_pointer< rep > base
bool is_symmetric() const
csr(const std::initializer_list< details::csr_concat_line< T, distributed > > &init_list)
vec< element_type, distributed > trans_mult(const vec< element_type, distributed > &x) const
csr(const std::initializer_list< details::csr_concat_value< T, distributed > > &init_list)
size_type row_first_index() const
size_type dis_ext_nnz() const
const distributor & row_ownership() const
rep::memory_type memory_type
void set_definite_positive(bool is_defpos) const
const_iterator end() const
int constraint_process_rank() const
csr(const asr< T, memory_type, A > &a)
rep::data_iterator data_iterator
size_type col_first_index() const
size_type dis_nrow() const
const_iterator ext_begin() const
void dump(const std::string &name) const
size_type dis_nnz() const
rep::const_data_iterator const_data_iterator
rep::element_type element_type
size_type jext2dis_j(size_type jext) const
void resize(const distributor &row_ownership, const distributor &col_ownership, size_type nnz1=0)
rep::const_iterator const_iterator
void resize(size_type loc_nrow1=0, size_type loc_ncol1=0, size_type loc_nnz1=0)
size_type row_last_index() const
const_iterator begin() const
size_type pattern_dimension() const
vec< element_type, sequential > trans_mult(const vec< element_type, sequential > &x) const
bool is_definite_positive() const
size_type col_last_index() const
void mult(const vec< element_type, sequential > &x, vec< element_type, sequential > &y) const
void set_pattern_dimension(size_type dim) const
iterator ext_begin_nonconst()
csr(const std::initializer_list< details::csr_concat_line< T, sequential > > &init_list)
iterator ext_end_nonconst()
const_iterator ext_end() const
const distributor & col_ownership() const
size_type dis_ncol() const
void set_symmetry(bool is_symm) const
void set_symmetry_by_check(const T &tol=std::numeric_limits< T >::epsilon()) const
iterator begin_nonconst()
size_type ext_nnz() const
csr(const asr< T, sequential, A > &a)
smart_pointer< rep > base
bool is_symmetric() const
csr(const std::initializer_list< details::csr_concat_value< T, sequential > > &init_list)
size_type row_first_index() const
size_type dis_ext_nnz() const
const distributor & row_ownership() const
rep::memory_type memory_type
void set_definite_positive(bool is_defpos) const
const_iterator end() const
void trans_mult(const vec< element_type, sequential > &x, vec< element_type, sequential > &y) const
int constraint_process_rank() const
rep::data_iterator data_iterator
size_type col_first_index() const
size_type dis_nrow() const
csr_rep< T, sequential > rep
const_iterator ext_begin() const
void dump(const std::string &name) const
size_type dis_nnz() const
base::data_iterator data_iterator
scatter_message< std::vector< T > > _to
size_type row_last_index() const
const_iterator begin() const
size_type pattern_dimension() const
bool is_definite_positive() const
size_type col_last_index() const
void set_pattern_dimension(size_type dim) const
csr_rep< T, sequential > base
const_iterator ext_end() const
const distributor & col_ownership() const
size_type dis_ncol() const
void _scatter_init_guard() const
void set_symmetry(bool is_symm) const
csr_rep< T, sequential > _ext
base::size_type size_type
size_type ext_nnz() const
scatter_message< std::vector< T > > _from
bool _scatter_initialized
bool is_symmetric() const
base::element_type element_type
base::const_iterator const_iterator
size_type row_first_index() const
size_type dis_ext_nnz() const
const distributor & row_ownership() const
void set_definite_positive(bool is_defpos) const
const_iterator end() const
std::vector< size_type > _jext2dis_j
size_type col_first_index() const
size_type dis_nrow() const
base::const_data_iterator const_data_iterator
const communicator & comm() const
const_iterator ext_begin() const
size_type dis_nnz() const
size_type _pattern_dimension
size_type jext2dis_j(size_type jext) const
vector_of_iterator< pair_type >::const_value_type const_data_iterator
size_type row_last_index() const
const_iterator begin() const
size_type pattern_dimension() const
bool is_definite_positive() const
size_type col_last_index() const
vector_of_iterator< pair_type >::iterator iterator
void set_pattern_dimension(size_type dim) const
const_iterator ext_end() const
std::vector< std::pair< typename std::vector< T >::size_type, T > > _data
const distributor & col_ownership() const
size_type dis_ncol() const
void set_symmetry(bool is_symm) const
distributor _row_ownership
std::pair< size_type, T > pair_type
size_type ext_nnz() const
bool is_symmetric() const
vector_of_iterator< pair_type >::difference_type difference_type
std::vector< T >::size_type size_type
vector_of_iterator< pair_type >::value_type data_iterator
size_type row_first_index() const
size_type dis_ext_nnz() const
bool _is_definite_positive
const distributor & row_ownership() const
void set_definite_positive(bool is_defpos) const
const_iterator end() const
vector_of_iterator< pair_type >::const_iterator const_iterator
distributor _col_ownership
size_type col_first_index() const
size_type dis_nrow() const
const_iterator ext_begin() const
see the csr page for the full documentation
see the distributor page for the full documentation
idiststream: see the diststream page for the full documentation
odiststream: see the diststream page for the full documentation
see the smart_pointer page for the full documentation
see the vec page for the full documentation
V::difference_type difference_type
const_value_type *const const_iterator
const T * const_value_type
const_iterator end() const
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
verbose clean transpose logscale grid shrink ball stereo iso volume skipvtk deformation fastfieldload lattice reader_on_stdin color format format format format format format format format format format format format format format format format format format dump
This file is part of Rheolef.
csr< T, sequential > operator-(const csr< T, sequential > &a)
std::ostream & operator<<(std::ostream &os, const catchmark &m)
void put(std::ostream &out, std::string name, const tiny_matrix< T > &a)
std::enable_if< details::is_rheolef_arithmetic< U >::value, ad3_basic< T > & >::type operator*=(ad3_basic< T > &a, const U &b)
csr< T, M > csr_apply(Function f, const csr< T, M > &a)
std::enable_if< details::is_rheolef_arithmetic< U >::value, ad3_basic< T > >::type operator+(const U &a, const ad3_basic< T > &b)
OutputPairIterator pair_transform_second(InputPairIterator first, InputPairIterator last, OutputPairIterator result, UnaryOperation unary_op)
std::istream & operator>>(std::istream &is, const catchmark &m)
csr< T, M > diag(const vec< T, M > &d)
csr< T, sequential > trans(const csr< T, sequential > &a)
trans(a): see the form page for the full documentation
void put_matrix_market(std::ostream &out, const Eigen::SparseMatrix< T, Eigen::RowMajor > &a)
csr< T, sequential > operator*(const T &lambda, const csr< T, sequential > &a)