#pragma once #include #include //#include #include #include namespace MbD { template class Array : public std::vector { public: Array() {} Array(std::vector vec) : std::vector(vec) {} Array(int count) : std::vector(count) {} Array(int count, const T& value) : std::vector(count, value) {} Array(std::vector::iterator begin, std::vector::iterator end) : std::vector(begin, end) {} Array(std::initializer_list list) : std::vector{ list } {} void copyFrom(std::shared_ptr> x); virtual void zeroSelf() = 0; virtual double sumOfSquares() = 0; double rootMeanSquare(); virtual int numberOfElements() = 0; void swapRows(int i, int ii); }; template inline void Array::copyFrom(std::shared_ptr> x) { for (int i = 0; i < x->size(); i++) { this->at(i) = x->at(i); } } template inline double Array::rootMeanSquare() { return std::sqrt(this->sumOfSquares() / this->numberOfElements()); } template inline void Array::swapRows(int i, int ii) { auto temp = this->at(i); this->at(i) = this->at(ii); this->at(ii) = temp; } using ListD = std::initializer_list; using ListListD = std::initializer_list>; using ListListPairD = std::initializer_list>>; }