.\" .de Id .. .de Sp .if n .sp .if t .sp 0.4 .. .TH dia 2rheolef "rheolef-6.7" "rheolef-6.7" "rheolef-6.7" .\" label: /*Class:dia .SH NAME \fBdia\fP - diagonal matrix .\" skip: @clindex dia .\" skip: @clindex vec .\" skip: @cindex diagonal matrix .SH DESCRIPTION The class implements a diagonal matrix. A declaration whithout any parametrers correspond to a null size matrix: .\" begin_example .Sp .nf dia d; .Sp .fi .\" end_example The constructor can be invocated whith a \fBownership\fP parameter (see distributor(2)): .\" begin_example .Sp .nf dia d(ownership); .Sp .fi .\" end_example or an initialiser, either a vector (see vec(2)): .\" begin_example .Sp .nf dia d(v); .Sp .fi .\" end_example or a csr matrix (see csr(2)): .\" begin_example .Sp .nf dia d(a); .Sp .fi .\" end_example The conversion from \fBdia\fP to \fBvec\fP or \fBcsr\fP is explicit. .PP When a diagonal matrix is constructed from a \fBcsr\fP matrix, the definition of the diagonal of matrix is \fIalways\fP a vector of size \fIrow_ownership\fP which contains the elements in rows 1 to \fInrow\fP of the matrix that are contained in the diagonal. If the diagonal element falls outside the matrix, i.e. \fIncol\fP < \fInrow\fP then it is defined as a zero entry. .SH PRECONDITIONER INTERFACE 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)). .\" END .SH IMPLEMENTATION .\" begin_example .Sp .nf template class dia : public vec { public: // typedefs: typedef typename vec::size_type size_type; typedef typename vec::iterator iterator; typedef typename vec::const_iterator const_iterator; // allocators/deallocators: explicit dia (const distributor& ownership = distributor(), const T& init_val = std::numeric_limits::max()); explicit dia (const vec& u); explicit dia (const csr& a); dia& operator= (const T& lambda); // preconditionner interface: solves d*x=b vec solve (const vec& b) const; vec trans_solve (const vec& b) const; }; template dia operator/ (const T& lambda, const dia& d); template vec operator* (const dia& d, const vec& x); .Sp .fi .\" end_example .\" LENGTH = 5 .SH SEE ALSO distributor(2), vec(2), csr(2), solver(2), pcg(4)