Пример #1
0
 /**
  * @brief print operator
  * @out the ostream
  * @toPrint the matrix
  */
 friend std::ostream& operator<<(std::ostream &out, const Matrix<T> &toPrint)
 {
     for (index_t row = 0; row < toPrint._rows; row++)
     {
         for (index_t col = 0; col < toPrint._columns; col++)
         {
             out << toPrint(row, col) << MATRIX_PRINT_SEP;
         }
         out << std::endl;
     }
     return out;
 }
Пример #2
0
void BlockSparseMatrix::PrintMatlabMatrix() const
{
	ofstream toPrint("matlabMatrix.m");
	toPrint << "A = [";
	for (int i = 0; i < mMatrix.rows(); ++i)
	{
		for (int j = 0; j < mMatrix.cols(); ++j)
		{
			toPrint << mMatrix(j, i) << " ";
		}
		toPrint << ";\n";
	}
	toPrint << "];";
	toPrint.flush();
}