Man pages sections > man2 > dia

dia - diagonal matrix

dia(2rheolef) rheolef-6.7 dia(2rheolef)


dia - diagonal matrix


The class implements a diagonal matrix. A declaration whithout any parametrers correspond to a null size matrix:
        dia<Float> d;
The constructor can be invocated whith a ownership parameter (see distributor(2)):
        dia<Float> d(ownership);
or an initialiser, either a vector (see vec(2)):
        dia<Float> d(v);
or a csr matrix (see csr(2)):
        dia<Float> d(a);
The conversion from dia to vec or csr is explicit.
When a diagonal matrix is constructed from a csr matrix, the definition of the diagonal of matrix is always a vector of size row_ownership which contains the elements in rows 1 to nrow of the matrix that are contained in the diagonal. If the diagonal element falls outside the matrix, i.e. ncol < nrow then it is defined as a zero entry.


The class presents a preconditioner interface, as the solver(2), so that it can be used as preconditioner to the iterative solvers suite (see pcg(4)).


template<class T, class M = rheo_default_memory_model>
class dia : public vec<T,M> {
// typedefs:
typedef typename vec<T,M>::size_type size_type; typedef typename vec<T,M>::iterator iterator; typedef typename vec<T,M>::const_iterator const_iterator;
// allocators/deallocators:
explicit dia (const distributor& ownership = distributor(), const T& init_val = std::numeric_limits<T>::max());
explicit dia (const vec<T,M>& u); explicit dia (const csr<T,M>& a); dia<T,M>& operator= (const T& lambda);
// preconditionner interface: solves d*x=b
vec<T,M> solve (const vec<T,M>& b) const; vec<T,M> trans_solve (const vec<T,M>& b) const; }; template <class T, class M> dia<T,M> operator/ (const T& lambda, const dia<T,M>& d);
template <class T, class M> vec<T,M> operator* (const dia<T,M>& d, const vec<T,M>& x);


distributor(2), vec(2), csr(2), solver(2), pcg(4)
rheolef-6.7 rheolef-6.7