Provided by: librheolef-dev_5.93-2_amd64 bug


       basic_diag - diagonal matrix


        The class implements a diagonal matrix.
        A declaration whithout any parametrers correspond to a null size matrix:

               basic_diag<Float> d;

        The constructor can be invocated whith a size parameter:

               basic_diag<Float> d(n);

        or an initialiser, either a vector (see vec(3)):

               basic_diag<Float> d = basic_diag(v);

        or a csr matrix see csr(3):

               basic_diag<Float> d = basic_diag(a);

        The conversion from basic_diag to
        vec or csr is explicit.

        When a diagonal matrix is constructed from a csr matrix,
        the definition of the diagonal of matrix is @emph{always} a vector of size
        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.


        Since the basic_diag class derives from the
        vec,  the basic_diag class
        present also a STL-like interface.


       template<class T>
       class basic_diag : public vec<T> {

       // typedefs:

           typedef typename vec<T>::element_type element_type;
           typedef typename vec<T>::size_type    size_type;
           typedef typename vec<T>::iterator     iterator;

       // allocators/deallocators:

           explicit basic_diag (size_type sz = 0);
           explicit basic_diag (const vec<T>& u);
           explicit basic_diag (const csr<T>& a);

       // assignment:

           basic_diag<T> operator = (const T& lambda);

       // accessors:

           size_type nrow () const { return vec<T>::size(); }
           size_type ncol () const { return vec<T>::size(); }

       // basic_diag as a preconditionner: solves D.x=b

           vec<T> solve (const vec<T>& b) const;
           vec<T> trans_solve (const vec<T>& b) const;
       template <class T>
       basic_diag<T> dcat (const basic_diag<T>& a1, const basic_diag<T>& a2);

       template <class T>
       basic_diag<T> operator / (const T& lambda, const basic_diag<T>& d);

       template <class T>
       operator * (const basic_diag<T>& d, const vec<T>& x);

       template<class T>
       vec<T> left_div (const vec<T>& x, const basic_diag<T>& d);


       vec(3), csr(3)