COPASI API  4.16.103
Functions
CSparseMatrix.cpp File Reference
#include <algorithm>
#include <cmath>
#include <limits>
#include "copasi.h"
#include "CSparseMatrix.h"
#include "CMatrix.h"
#include "lapack/blaswrap.h"
#include "lapack/lapackwrap.h"
Include dependency graph for CSparseMatrix.cpp:

Go to the source code of this file.

Functions

std::ostream & operator<< (std::ostream &os, const CSparseMatrix &A)
 

Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const CSparseMatrix A 
)

Definition at line 355 of file CSparseMatrix.cpp.

References CSparseMatrix::mNumCols, CSparseMatrix::mNumRows, and CSparseMatrix::mRows.

356 {
357  os << "Matrix(" << A.mNumRows << "x" << A.mNumCols << ")" << std::endl;
358 
359  size_t i;
360 
361  std::vector< std::vector< CSparseMatrixElement * > >::const_iterator itRow;
362  std::vector< std::vector< CSparseMatrixElement * > >::const_iterator endRow;
363 
364  std::vector< CSparseMatrixElement * >::const_iterator itElement;
365  std::vector< CSparseMatrixElement * >::const_iterator endElement;
366 
367  for (itRow = A.mRows.begin(), endRow = A.mRows.end(); itRow != endRow; ++itRow)
368  {
369  for (i = 0, itElement = itRow->begin(), endElement = itRow->end();
370  itElement != endElement; ++itElement, i++)
371  {
372  for (; i < (*itElement)->col(); i++)
373  os << "\t" << 0.0;
374 
375  os << "\t" << **itElement;
376  }
377 
378  for (; i < A.mNumCols; i++)
379  os << "\t" << 0.0;
380 
381  os << std::endl;
382  }
383 
384  return os;
385 }
std::vector< std::vector< CSparseMatrixElement * > > mRows