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

#include <CSparseMatrix.h>

Classes

class  const_row_iterator
 

Public Member Functions

const_row_iterator beginRow (const size_t &row) const
 
 CCompressedColumnFormat (const size_t &rows, const size_t &columns, const size_t &nonZeros)
 
 CCompressedColumnFormat (const CSparseMatrix &matrix)
 
const_row_iterator endRow (const size_t &row) const
 
const size_t * getColumnStart () const
 
size_t * getColumnStart ()
 
const size_t * getRowIndex () const
 
size_t * getRowIndex ()
 
const C_FLOAT64getValues () const
 
C_FLOAT64getValues ()
 
size_t numCols () const
 
size_t numNonZeros () const
 
size_t numRows () const
 
CCompressedColumnFormatoperator= (const CSparseMatrix &ccf)
 
 ~CCompressedColumnFormat ()
 

Private Member Functions

 CCompressedColumnFormat ()
 

Private Attributes

size_t mNumCols
 
size_t mNumRows
 
size_t * mpColumnStart
 
size_t * mpRowIndex
 
C_FLOAT64mpValue
 

Detailed Description

Definition at line 128 of file CSparseMatrix.h.

Constructor & Destructor Documentation

CCompressedColumnFormat::CCompressedColumnFormat ( )
private

Definition at line 468 of file CSparseMatrix.cpp.

References mNumCols, and mpColumnStart.

468  :
469  mNumRows(0),
470  mNumCols(0),
471  mpColumnStart(new size_t[1]),
472  mpRowIndex(NULL),
473  mpValue(NULL)
474 {mpColumnStart[mNumCols] = 0;}
CCompressedColumnFormat::CCompressedColumnFormat ( const size_t &  rows,
const size_t &  columns,
const size_t &  nonZeros 
)

Definition at line 476 of file CSparseMatrix.cpp.

References mNumCols, and mpColumnStart.

478  :
479  mNumRows(rows),
480  mNumCols(columns),
481  mpColumnStart(new size_t[columns + 1]),
482  mpRowIndex(nonZeros ? new size_t[nonZeros] : NULL),
483  mpValue(nonZeros ? new C_FLOAT64[nonZeros] : NULL)
484 {mpColumnStart[mNumCols] = nonZeros;}
#define C_FLOAT64
Definition: copasi.h:92
CCompressedColumnFormat::CCompressedColumnFormat ( const CSparseMatrix matrix)

Definition at line 486 of file CSparseMatrix.cpp.

486  :
487  mNumRows(0),
488  mNumCols(0),
489  mpColumnStart(NULL),
490  mpRowIndex(NULL),
491  mpValue(NULL)
492 {*this = matrix;}
CCompressedColumnFormat::~CCompressedColumnFormat ( )

Definition at line 494 of file CSparseMatrix.cpp.

References mpColumnStart, mpRowIndex, mpValue, and pdelete.

495 {
496  pdelete(mpValue);
499 }
#define pdelete(p)
Definition: copasi.h:215

Member Function Documentation

CCompressedColumnFormat::const_row_iterator CCompressedColumnFormat::beginRow ( const size_t &  row) const

Definition at line 579 of file CSparseMatrix.cpp.

580 {return const_row_iterator(this, row);}
CCompressedColumnFormat::const_row_iterator CCompressedColumnFormat::endRow ( const size_t &  row) const

Definition at line 581 of file CSparseMatrix.cpp.

582 {return const_row_iterator(this);}
const size_t * CCompressedColumnFormat::getColumnStart ( ) const
size_t * CCompressedColumnFormat::getColumnStart ( )

Definition at line 525 of file CSparseMatrix.cpp.

References mpColumnStart.

526 {return mpColumnStart;}
const size_t * CCompressedColumnFormat::getRowIndex ( ) const
size_t * CCompressedColumnFormat::getRowIndex ( )

Definition at line 519 of file CSparseMatrix.cpp.

References mpRowIndex.

520 {return mpRowIndex;}
const C_FLOAT64 * CCompressedColumnFormat::getValues ( ) const

Definition at line 510 of file CSparseMatrix.cpp.

References mpValue.

Referenced by CSparseMatrix::operator=().

511 {return mpValue;}
C_FLOAT64 * CCompressedColumnFormat::getValues ( )

Definition at line 513 of file CSparseMatrix.cpp.

References mpValue.

514 {return mpValue;}
size_t CCompressedColumnFormat::numCols ( ) const

Definition at line 504 of file CSparseMatrix.cpp.

References mNumCols.

Referenced by CSparseMatrix::operator=().

505 {return mNumCols;}
size_t CCompressedColumnFormat::numNonZeros ( ) const

Definition at line 507 of file CSparseMatrix.cpp.

References mNumCols, and mpColumnStart.

size_t CCompressedColumnFormat::numRows ( ) const
CCompressedColumnFormat & CCompressedColumnFormat::operator= ( const CSparseMatrix ccf)

Definition at line 528 of file CSparseMatrix.cpp.

References C_FLOAT64, CSparseMatrix::getColumns(), mNumCols, mNumRows, mpColumnStart, mpRowIndex, mpValue, CSparseMatrix::numCols(), CSparseMatrix::numNonZeros(), CSparseMatrix::numRows(), and pdelete.

529 {
530  pdelete(mpValue);
533 
534  mNumRows = matrix.numRows();
535  mNumCols = matrix.numCols();
536 
537  mpColumnStart = new size_t[mNumCols + 1];
538  mpColumnStart[mNumCols] = matrix.numNonZeros();
539 
540  if (mpColumnStart[mNumCols])
541  {
542  mpRowIndex = new size_t[mpColumnStart[mNumCols]];
543  mpValue = new C_FLOAT64[mpColumnStart[mNumCols]];
544  }
545  else
546  {
547  mpRowIndex = NULL;
548  mpValue = NULL;
549  }
550 
551  size_t k = 0;
552  size_t i;
553 
554  std::vector< std::vector< CSparseMatrixElement * > >::const_iterator itCol;
555  std::vector< std::vector< CSparseMatrixElement * > >::const_iterator endCol;
556 
557  std::vector< CSparseMatrixElement * >::const_iterator itElement;
558  std::vector< CSparseMatrixElement * >::const_iterator endElement;
559 
560  size_t * pRowIndex = mpRowIndex;
561  C_FLOAT64 * pValue = mpValue;
562 
563  for (i = 0, itCol = matrix.getColumns().begin(), endCol = matrix.getColumns().end();
564  itCol != endCol; ++itCol, i++)
565  {
566  mpColumnStart[i] = k;
567 
568  for (itElement = itCol->begin(), endElement = itCol->end();
569  itElement != endElement; ++itElement, k++, pRowIndex++, pValue++)
570  {
571  *pRowIndex = (*itElement)->row();
572  *pValue = **itElement;
573  }
574  }
575 
576  return *this;
577 }
#define pdelete(p)
Definition: copasi.h:215
#define C_FLOAT64
Definition: copasi.h:92

Member Data Documentation

size_t CCompressedColumnFormat::mNumCols
private

Definition at line 133 of file CSparseMatrix.h.

Referenced by CCompressedColumnFormat(), numCols(), numNonZeros(), and operator=().

size_t CCompressedColumnFormat::mNumRows
private

Definition at line 132 of file CSparseMatrix.h.

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

size_t* CCompressedColumnFormat::mpColumnStart
private
size_t* CCompressedColumnFormat::mpRowIndex
private
C_FLOAT64* CCompressedColumnFormat::mpValue
private

Definition at line 136 of file CSparseMatrix.h.

Referenced by getValues(), operator=(), and ~CCompressedColumnFormat().


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