/*************************************************************************** * Copyright (c) 2023 Ondsel, Inc. * * * * This file is part of OndselSolver. * * * * See LICENSE file for details about copyright. * ***************************************************************************/ #include "FullRow.h" #include "FullMatrix.h" namespace MbD { template<> std::shared_ptr FullRow::transposeTimesFullRow(FRowsptr fullRow) { //"a*b = a(i)b(j)" auto nrow = (int)this->size(); auto answer = std::make_shared(nrow); for (int i = 0; i < nrow; i++) { answer->atiput(i, fullRow->times(this->at(i))); } return answer; } //template //inline FMatDsptr FullRow::transposeTimesFullRow(FRowDsptr fullRow) //{ // //"a*b = a(i)b(j)" // auto nrow = (int)this->size(); // auto answer = std::make_shared(nrow); // for (int i = 0; i < nrow; i++) // { // answer->atiput(i, fullRow->times(this->at(i))); // } // return answer; //} template<> FRowsptr FullRow::timesTransposeFullMatrix(std::shared_ptr fullMat) { //"a*bT = a(1,j)b(k,j)" int ncol = fullMat->nrow(); auto answer = std::make_shared>(ncol); for (int k = 0; k < ncol; k++) { answer->at(k) = this->dot(fullMat->at(k)); } return answer; } // TODO: can't get the following to work, but CLion says the routine that calls it in FullMatrixFullMatrixDouble is also // never called. // template<> // FRowsptr> FullRow>::timesTransposeFullMatrixForFMFMDsptr( // std::shared_ptr fullMat) // { // //"a*bT = a(1,j)b(k,j)" // int ncol = fullMat->nrow(); // auto answer = std::make_shared>>(ncol); // for (int k = 0; k < ncol; k++) { // answer->at(k) = this->dot(fullMat->at(k)); // } // return answer; // } template<> FRowsptr FullRow::timesFullMatrix(std::shared_ptr fullMat) { FRowsptr answer = fullMat->at(0)->times(this->at(0)); for (int j = 1; j < (int) this->size(); j++) { answer->equalSelfPlusFullRowTimes(fullMat->at(j), this->at(j)); } return answer; } }