namespace lasd { template MatrixVec::MatrixVec(ulong r, ulong c){ rows = r; columns = c; size = r*c; Elements = new Data[size]{}; } template MatrixVec::MatrixVec(const MatrixVec& toCopy){ rows = toCopy.rows; columns = toCopy.columns; size = toCopy.size; Elements = new Data[size]{}; for(ulong i=0 ; i MatrixVec::MatrixVec(MatrixVec&& toMove) noexcept{ std::swap(rows, toMove.rows); std::swap(columns, toMove.columns); std::swap(size, toMove.size); std::swap(Elements, toMove.Elements); } template MatrixVec::~MatrixVec(){ Clear(); } template MatrixVec& MatrixVec::operator=(const MatrixVec& toCopy){ Clear(); rows = toCopy.rows; columns = toCopy.columns; size = toCopy.size; Elements = new Data[size]{}; for(ulong i=0 ; i MatrixVec& MatrixVec::operator=(MatrixVec&& toMove) noexcept{ Clear(); std::swap(rows, toMove.rows); std::swap(columns, toMove.columns); std::swap(size, toMove.size); std::swap(Elements, toMove.Elements); return *this; } template bool MatrixVec::operator==(const MatrixVec& toCompare) const noexcept{ if(rows == toCompare.rows && columns == toCompare.columns){ return Vector::operator==(toCompare); }else{ return false; } } template bool MatrixVec::operator!=(const MatrixVec& toCompare) const noexcept{ return !(*this == toCompare); } template void MatrixVec::RowResize(const ulong newdim){ Vector::Resize(newdim); } template void MatrixVec::ColumnResize(const ulong& new_column_dim){ if(new_column_dim == 0){ Clear(); } else if(new_column_dim != columns){ ulong limit = (new_column_dim < columns)? new_column_dim : columns; Data* tmp = new Data[rows * new_column_dim]{}; for(ulong i=0 ; i bool MatrixVec::ExistsCell(const ulong& r, const ulong& c) noexcept override{ return (r const Data& MatrixVec::operator()(const ulong& r, const ulong& c) const{ if(ExistsCell(r,c)) return Elements[(r*columns)+c]; else throw std::out_of_range("Tried to access position ["< Data& MatrixVec::operator()(const ulong& r, const ulong& c){ if(ExistsCell(r,c)) return Elements[(r*columns)+c]; else throw std::out_of_range("Tried to access position ["< void MatrixVec::Clear(){ Vector::Clear(); rows = 0; columns = 0; } }