Loading...
Searching...
No Matches
csr.cc
Go to the documentation of this file.
#include "rheolef/linalg.h"
namespace rheolef {
// ----------------------------------------------------------------------------
// build from diag
// ----------------------------------------------------------------------------
template<class T>
template<class A>
void
csr_rep<T,sequential>::build_from_diag (const disarray_rep<T,sequential,A>& d)
{
resize (d.ownership(), d.ownership(), d.ownership().size());
iterator ia = begin();
for (size_type i = 0, n = d.size(); i < n; i++) {
data_iterator q = ia[i];
(*q).first = i;
(*q).second = d[i];
ia[i+1] = ia[i] + 1;
}
}
#ifdef _RHEOLEF_HAVE_MPI
template<class T>
template<class A>
void
csr_rep<T,distributed>::build_from_diag (const disarray_rep<T,distributed,A>& d)
{
base::build_from_diag (d);
_ext.resize (d.ownership(), d.ownership(), 0);
_jext2dis_j.resize(0);
_dis_nnz = d.dis_size();
_scatter_initialized = false;
}
#endif // _RHEOLEF_HAVE_MPI
template<class T, class M>
csr<T,M>
diag (const vec<T,M>& d)
{
csr<T,M> a;
a.data().build_from_diag (d.data());
return a;
}
// ----------------------------------------------------------------------------
// instanciation in library
// ----------------------------------------------------------------------------
#define _RHEOLEF_instanciation_a(T,M,A) \
template void csr_rep<T,M>::build_from_diag (const disarray_rep<T,M,A>&);
#define _RHEOLEF_instanciation(T,M) \
template csr<T,M> diag (const vec<T,M>&); \
_RHEOLEF_instanciation_a(T,M,std::allocator<T>)
_RHEOLEF_instanciation(Float,sequential)
#ifdef _RHEOLEF_HAVE_MPI
_RHEOLEF_instanciation(Float,distributed)
#endif // _RHEOLEF_HAVE_MPI
} // namespace rheolef
_RHEOLEF_instanciation
#define _RHEOLEF_instanciation(T, M, A)
Definition asr.cc:223
Float
see the Float page for the full documentation
rheolef::csr_rep< T, sequential >::iterator
vector_of_iterator< pair_type >::iterator iterator
Definition csr.h:90
rheolef::csr_rep< T, sequential >::size_type
std::vector< T >::size_type size_type
Definition csr.h:86
rheolef::csr_rep< T, sequential >::data_iterator
vector_of_iterator< pair_type >::value_type data_iterator
Definition csr.h:93
rheolef::csr_rep
Definition csr.h:81
rheolef::csr
see the csr page for the full documentation
Definition csr.h:317
rheolef::disarray_rep
Definition disarray.h:214
rheolef::vec
see the vec page for the full documentation
Definition vec.h:79
rheolef
This file is part of Rheolef.
Definition compiler_eigen.h:39
rheolef::diag
csr< T, M > diag(const vec< T, M > &d)
Definition csr.cc:56
d
size_t d
Definition neumann-laplace-lambda.cc:28
rheolef::distributed
Definition communicator.h:128
rheolef::sequential
Definition communicator.h:62