/*********************************************************************** * * Class : AbstractMatrix * * Abstract root class for matrix hierarchy. * Since it's abstract, you can't instanciate this class directly ; * always use the Matrix class instead. * * This class manages the MemBlock data member (remember that it * is shared). So every time you have to modify (write to) the matrix, * call the touch() member function, which duplicates the MemBlock if * it is already shared by other matrices (touch() is inline, * see header AbsMatrix.h). * * Shai, 07/05/93 * 06/09/93 * **************************************************************************/ #include "absmatrx.h" //----- static data member #ifdef MAT_DEBUG unsigned AbsMatrix::instances = 0; #endif /*** non-member operators ***/ //----- overloaded stream operators working on a matrix ostream& operator << (ostream &os, const AbsMatrix &m) { register Index i(m); register int j; for (i = 0 ; i < m.rows ; ++i) { os << endl; for (j = 0 ; j < m.columns ; ++j) os << m[i,j] << '\t'; } return os; } istream& operator >> (istream &is, AbsMatrix &m) { register Index i(m); register int j; for (i = 0 ; i < m.rows ; ++i) for (j = 0 ; j < m.columns ; ++j) is >> m[i,j]; return is; }