// FullMatrix.cpp // // Template class for normal matrices. // A size_t is used for indexing. Indexing starts at 1. // // 2002-4-8 DD Another possibility FArray >; Use or redundant values nr, nc // // (C) Datasim Component Technology 1999 #ifndef DSFullMatrix_cpp #define DSFullMatrix_cpp #include "FullMatrix.hpp" // Constructors & destructor template FullMatrix::FullMatrix(): MatrixStructure() { // Default constructor m_structure=FullArray, std::allocator > >(); nr = nc = 1; } template FullMatrix::FullMatrix(size_t rows, size_t columns): MatrixStructure() { // Constructor with size // Create the rows m_structure=FullArray, std::allocator > >(rows); // Add the colums to the rows for (size_t i=1; i<=m_structure.Size(); i++) m_structure[i]=FullArray(columns); nr = rows; nc = columns; } template FullMatrix::FullMatrix(const FullMatrix& source): MatrixStructure(source) { // Copy constructor m_structure=source.m_structure; nr = sopurce.nr; nc = source.nc; } template FullMatrix::~FullMatrix() { // Destructor } // Selectors template size_t FullMatrix::Rows() const { // Number of rows return nr; } template size_t FullMatrix::Columns() const { // Number of columns return nc; } // Modifiers // Operators template ArrayStructure& FullMatrix::operator[] (size_t row) { // Subscripting operator return m_structure[row]; } template const ArrayStructure& FullMatrix::operator[] (size_t row) const { // Subscripting operator return m_structure[row]; } template FullMatrix& FullMatrix::operator = (const FullMatrix& source) { // Assignment operator // Exit if same object if (this==&source) return *this; // Call base class assignment MatrixStructure::operator = (source); m_structure=source.m_structure; nr = source.nr; nc = source.nc; return *this; } #endif // DSFullMatrix_cpp