/*************************************************************************** * Copyright (c) 2023 Ondsel, Inc. * * * * This file is part of OndselSolver. * * * * See LICENSE file for details about copyright. * ***************************************************************************/ #pragma once #include "Array.h" #include "FullRow.ref.h" namespace MbD { template class RowTypeMatrix : public Array { public: RowTypeMatrix() {} RowTypeMatrix(int m) : Array(m) {} RowTypeMatrix(std::initializer_list list) : Array{ list } {} void copyFrom(std::shared_ptr> x); virtual void zeroSelf() override = 0; //double maxMagnitude() override; int numberOfElements() override; int nrow(); int ncol(); }; template inline void RowTypeMatrix::copyFrom(std::shared_ptr> x) { for (int i = 0; i < x->size(); i++) { this->at(i)->copyFrom(x->at(i)); } } //template //inline double RowTypeMatrix::maxMagnitude() //{ // double max = 0.0; // for (int i = 0; i < this->size(); i++) // { // double element = this->at(i)->maxMagnitude(); // if (max < element) max = element; // } // return max; //} template inline int RowTypeMatrix::numberOfElements() { return this->nrow() * this->ncol(); } }