COPASI API  4.16.103
Public Member Functions | Private Attributes | List of all members
CCompressedColumnFormat::const_row_iterator Class Reference

#include <CSparseMatrix.h>

Inheritance diagram for CCompressedColumnFormat::const_row_iterator:
Inheritance graph
[legend]
Collaboration diagram for CCompressedColumnFormat::const_row_iterator:
Collaboration graph
[legend]

Public Member Functions

 const_row_iterator (const CCompressedColumnFormat *pMatrix=NULL, const size_t &rowIndex=C_INVALID_INDEX)
 
 const_row_iterator (const const_row_iterator &src)
 
const size_t & getColumnIndex () const
 
bool operator!= (const const_row_iterator &rhs)
 
const C_FLOAT64operator* () const
 
const_row_iteratoroperator++ ()
 
const C_FLOAT64operator-> () const
 
const_row_iteratoroperator= (const const_row_iterator &rhs)
 
 ~const_row_iterator ()
 

Private Attributes

size_t mColumnIndex
 
const size_t * mpColumnIndex
 
const C_FLOAT64mpCurrent
 
const CCompressedColumnFormatmpMatrix
 
const size_t * mpRowIndex
 
size_t mRowIndex
 

Detailed Description

Definition at line 147 of file CSparseMatrix.h.

Constructor & Destructor Documentation

CCompressedColumnFormat::const_row_iterator::const_row_iterator ( const CCompressedColumnFormat pMatrix = NULL,
const size_t &  rowIndex = C_INVALID_INDEX 
)

Default constructor.

Definition at line 389 of file CSparseMatrix.cpp.

References C_INVALID_INDEX, CCompressedColumnFormat::getColumnStart(), CCompressedColumnFormat::getRowIndex(), mpColumnIndex, mpMatrix, mpRowIndex, mRowIndex, and CCompressedColumnFormat::numRows().

390  :
391  mpMatrix(pMatrix),
392  mRowIndex(rowIndex),
393  mpRowIndex(NULL),
394  mColumnIndex(0),
395  mpColumnIndex(NULL),
396  mpCurrent(NULL)
397 {
398  if (mpMatrix &&
400  mRowIndex < mpMatrix->numRows())
401  {
404 
405  ++(*this);
406  }
407 }
const CCompressedColumnFormat * mpMatrix
const size_t * getColumnStart() const
#define C_INVALID_INDEX
Definition: copasi.h:222
const size_t * getRowIndex() const
CCompressedColumnFormat::const_row_iterator::const_row_iterator ( const const_row_iterator src)

Copy constructor

Parameters
constiterator & src

Definition at line 409 of file CSparseMatrix.cpp.

409  :
410  mpMatrix(src.mpMatrix),
411  mRowIndex(src.mRowIndex),
412  mpRowIndex(src.mpRowIndex),
413  mColumnIndex(src.mColumnIndex),
414  mpColumnIndex(src.mpColumnIndex),
415  mpCurrent(src.mpCurrent)
416 {}
const CCompressedColumnFormat * mpMatrix
CCompressedColumnFormat::const_row_iterator::~const_row_iterator ( )

Destructor

Definition at line 418 of file CSparseMatrix.cpp.

419 {}

Member Function Documentation

const size_t & CCompressedColumnFormat::const_row_iterator::getColumnIndex ( ) const

Definition at line 465 of file CSparseMatrix.cpp.

bool CCompressedColumnFormat::const_row_iterator::operator!= ( const const_row_iterator rhs)

Comparison operator !=

Parameters
constconst_row_iterator & rhs
Returns
bool not-equal

Definition at line 427 of file CSparseMatrix.cpp.

References mpCurrent.

428 {return mpCurrent != rhs.mpCurrent;}
const C_FLOAT64 & CCompressedColumnFormat::const_row_iterator::operator* ( ) const

Dereference operator * returns the node the iterator points to.

Returns
C_FLOAT64 &

Definition at line 421 of file CSparseMatrix.cpp.

422 {return *mpCurrent;}
CCompressedColumnFormat::const_row_iterator & CCompressedColumnFormat::const_row_iterator::operator++ ( )

Prefix increment operator ++

Returns
iterator &

Definition at line 442 of file CSparseMatrix.cpp.

References CCompressedColumnFormat::mpRowIndex.

443 {
444  const size_t * pRowIndexEnd = mpMatrix->getRowIndex() + mpMatrix->numNonZeros();
445 
446  mpRowIndex++; // We need to make at least one step forward.
447 
448  while (mpRowIndex != pRowIndexEnd && *mpRowIndex != mRowIndex) mpRowIndex++;
449 
450  if (mpRowIndex != pRowIndexEnd)
451  {
452  size_t index = mpRowIndex - mpMatrix->getRowIndex();
453  mpCurrent = mpMatrix->getValues() + index;
454 
455  while (*mpColumnIndex <= index) mpColumnIndex++;
456 
458  }
459  else
460  mpCurrent = NULL;
461 
462  return *this;
463 }
const CCompressedColumnFormat * mpMatrix
const size_t * getColumnStart() const
const size_t * getRowIndex() const
size_t numNonZeros() const
const C_FLOAT64 * getValues() const
const C_FLOAT64 & CCompressedColumnFormat::const_row_iterator::operator-> ( ) const

Dereference operator * returns the node the iterator points to.

Returns
C_FLOAT64 &

Definition at line 424 of file CSparseMatrix.cpp.

425 {return *mpCurrent;}
CCompressedColumnFormat::const_row_iterator & CCompressedColumnFormat::const_row_iterator::operator= ( const const_row_iterator rhs)

Assignement operator from a node to an iterator

Parameters
constconst_row_iterator & rhs
Returns
iterator &

Definition at line 430 of file CSparseMatrix.cpp.

References mColumnIndex, mpColumnIndex, mpCurrent, mpMatrix, CCompressedColumnFormat::mpRowIndex, mpRowIndex, and mRowIndex.

431 {
432  mpMatrix = rhs.mpMatrix;
433  mRowIndex = rhs.mRowIndex;
434  mpRowIndex = rhs.mpRowIndex;
435  mColumnIndex = rhs.mColumnIndex;
436  mpColumnIndex = rhs.mpColumnIndex;
437  mpCurrent = rhs.mpCurrent;
438 
439  return *this;
440 }
const CCompressedColumnFormat * mpMatrix

Member Data Documentation

size_t CCompressedColumnFormat::const_row_iterator::mColumnIndex
private

Definition at line 212 of file CSparseMatrix.h.

Referenced by operator=().

const size_t* CCompressedColumnFormat::const_row_iterator::mpColumnIndex
private

Definition at line 214 of file CSparseMatrix.h.

Referenced by const_row_iterator(), and operator=().

const C_FLOAT64* CCompressedColumnFormat::const_row_iterator::mpCurrent
private

Definition at line 216 of file CSparseMatrix.h.

Referenced by operator!=(), and operator=().

const CCompressedColumnFormat* CCompressedColumnFormat::const_row_iterator::mpMatrix
private

Definition at line 206 of file CSparseMatrix.h.

Referenced by const_row_iterator(), and operator=().

const size_t* CCompressedColumnFormat::const_row_iterator::mpRowIndex
private

Definition at line 210 of file CSparseMatrix.h.

Referenced by const_row_iterator(), and operator=().

size_t CCompressedColumnFormat::const_row_iterator::mRowIndex
private

Definition at line 208 of file CSparseMatrix.h.

Referenced by const_row_iterator(), and operator=().


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