SparseView Class Reference

The implementation of a sparse matrix. More...

#include <matpackII.h>

Inheritance diagram for SparseView:

Sparse

List of all members.

Public Member Functions

Index nrows () const
 Returns the number of rows.
Index ncols () const
 Returns the number of columns.
Index nnz () const
 Returns the number of nonzero elements.
Numericrw (Index r, Index c)
 Plain index operator.
Numeric ro (Index r, Index c) const
 Plain const index operator.

Protected Member Functions

 SparseView ()
 Default constructor.
 SparseView (std::vector< Numeric > *data, std::vector< Index > *rowind, std::vector< Index > *colptr, const Range &rr, const Range &cr)
 Explicit constructor.

Protected Attributes

std::vector< Numeric > * mdata
 The actual data values.
std::vector< Index > * mrowind
 Row indices.
std::vector< Index > * mcolptr
 Pointers to first data element for each column.
Index mnr
 Number of rows.

Friends

std::ostream & operator<< (std::ostream &os, const SparseView &v)


Detailed Description

The implementation of a sparse matrix.

Class Sparse is derived from this one. It also allocates storage.

The chosen storage format is the `compressed column' format. This is the same format used by Matlab. See Matlab User Guide for a description.

Definition at line 41 of file matpackII.h.


Constructor & Destructor Documentation

SparseView::SparseView (  )  [inline, protected]

Default constructor.

This is necessary, so that we can have a default constructor for the derived class Sparse.

Definition at line 209 of file matpackII.h.

SparseView::SparseView ( std::vector< Numeric > *  data,
std::vector< Index > *  rowind,
std::vector< Index > *  colptr,
const Range rr,
const Range cr 
) [inline, protected]

Explicit constructor.

This one is used by Matrix to initialize its own SubMatrix part. The row range rr must have a stride to account for the length of one row.

Definition at line 222 of file matpackII.h.


Member Function Documentation

Index SparseView::nrows (  )  const [inline]

Returns the number of rows.

Definition at line 96 of file matpackII.h.

Index SparseView::ncols (  )  const [inline]

Returns the number of columns.

Definition at line 102 of file matpackII.h.

Index SparseView::nnz (  )  const [inline]

Returns the number of nonzero elements.

Definition at line 108 of file matpackII.h.

Numeric & SparseView::rw ( Index  r,
Index  c 
) [inline]

Plain index operator.

This has to correctly handle two cases:

1. The data element exists. In this case the operator acts similar to the const index operator in that the element is returned.

2. The element does not exist. In this case it is created.

Definition at line 120 of file matpackII.h.

Numeric SparseView::ro ( Index  r,
Index  c 
) const [inline]

Plain const index operator.

Definition at line 173 of file matpackII.h.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const SparseView v 
) [friend]

Definition at line 294 of file matpackII.h.


Member Data Documentation

std::vector<Numeric>* SparseView::mdata [protected]

The actual data values.

Definition at line 66 of file matpackII.h.

std::vector<Index>* SparseView::mrowind [protected]

Row indices.

Definition at line 68 of file matpackII.h.

std::vector<Index>* SparseView::mcolptr [protected]

Pointers to first data element for each column.

Definition at line 70 of file matpackII.h.

Index SparseView::mnr [protected]

Number of rows.

Definition at line 72 of file matpackII.h.


The documentation for this class was generated from the following file:

Generated on Wed Feb 4 08:17:37 2009 for ARTS by  doxygen 1.5.6