#pragma once #include "Vector.h" #include "FullColumn.h" namespace MbD { template class FullMatrix; template class FullRow : public Vector { public: FullRow() {} FullRow(size_t count) : Vector(count) {} FullRow(size_t count, const T& value) : Vector(count, value) {} FullRow(std::initializer_list list) : Vector{ list } {} std::shared_ptr> times(double a); std::shared_ptr> negated(); std::shared_ptr> plusFullRow(std::shared_ptr> fullRow); std::shared_ptr> minusFullRow(std::shared_ptr> fullRow); T timesFullColumn(std::shared_ptr> fullCol); std::shared_ptr> timesFullMatrix(std::shared_ptr> fullMat); std::shared_ptr> timesTransposeFullMatrix(std::shared_ptr> fullMat); void equalSelfPlusFullRowTimes(std::shared_ptr> fullRow, double factor); }; template inline std::shared_ptr> FullRow::times(double a) { size_t n = this->size(); auto answer = std::make_shared(n); for (size_t i = 0; i < n; i++) { answer->at(i) = this->at(i) * a; } return answer; } template inline std::shared_ptr> FullRow::negated() { return this->times(-1.0); } template inline std::shared_ptr> FullRow::plusFullRow(std::shared_ptr> fullRow) { size_t n = this->size(); auto answer = std::make_shared>(n); for (size_t i = 0; i < n; i++) { answer->at(i) = this->at(i) + fullRow->at(i); } return answer; } template inline std::shared_ptr> FullRow::minusFullRow(std::shared_ptr> fullRow) { size_t n = this->size(); auto answer = std::make_shared>(n); for (size_t i = 0; i < n; i++) { answer->at(i) = this->at(i) - fullRow->at(i); } return answer; } template inline T FullRow::timesFullColumn(std::shared_ptr> fullCol) { auto answer = this->at(0) * fullCol->at(0); for (size_t i = 1; i < this->size(); i++) { answer += this->at(i) * fullCol->at(i); } return answer; } template inline std::shared_ptr> FullRow::timesTransposeFullMatrix(std::shared_ptr> fullMat) { return std::shared_ptr>(); } template inline void FullRow::equalSelfPlusFullRowTimes(std::shared_ptr> fullRow, double factor) { for (size_t i = 0; i < this->size(); i++) { this->at(i) += fullRow->at(i) * factor; } } template inline std::shared_ptr> FullRow::timesFullMatrix(std::shared_ptr> fullMat) { std::shared_ptr> answer = fullMat->at(0)->times(this->at(0)); for (size_t j = 1; j < this->size(); j++) { answer->equalSelfPlusFullRowTimes(fullMat->at(j), this->at(j)); } return answer; //return std::shared_ptr>(); } using ListFRD = std::initializer_list>>; using FRowDsptr = std::shared_ptr>; }