/*************************************************************************** * Copyright (c) 2023 Ondsel, Inc. * * * * This file is part of OndselSolver. * * * * See LICENSE file for details about copyright. * ***************************************************************************/ #pragma once #include "corecrt_math_defines.h" #include #include "FullMatrix.ref.h" #include "FullColumn.ref.h" #include "FullRow.ref.h" #include "DiagonalMatrix.ref.h" #include "EulerParameters.ref.h" #include "RowTypeMatrix.h" #include "FullRow.h" // exception to normal include pattern namespace MbD { template class FullMatrixTemplate : public RowTypeMatrix> { public: FullMatrixTemplate() = default; explicit FullMatrixTemplate(int m) : RowTypeMatrix>(m) { } FullMatrixTemplate(int m, int n) { for (int i = 0; i < m; i++) { auto row = std::make_shared>(n); this->push_back(row); } } FullMatrixTemplate(std::initializer_list> listOfRows) { for (auto& row : listOfRows) { this->push_back(row); } } FullMatrixTemplate(std::initializer_list> list2D) { for (auto& rowList : list2D) { auto row = std::make_shared>(rowList); this->push_back(row); } } // static std::shared_ptr> rotatex(T angle); // static std::shared_ptr> rotatey(T angle); // static std::shared_ptr> rotatez(T angle); // static std::shared_ptr> rotatexrotDot(T angle, T angledot); // static std::shared_ptr> rotateyrotDot(T angle, T angledot); // static std::shared_ptr> rotatezrotDot(T angle, T angledot); static std::shared_ptr> rotatexrotDotrotDDot(T angle, T angleDot, T angleDDot); static std::shared_ptr> rotateyrotDotrotDDot(T angle, T angleDot, T angleDDot); static std::shared_ptr> rotatezrotDotrotDDot(T angle, T angleDot, T angleDDot); static std::shared_ptr> identitysptr(int n); static std::shared_ptr> tildeMatrix(FColDsptr col); virtual void identity(); FColsptr column(int j); FColsptr timesFullColumn(FColsptr fullCol); FColsptr timesFullColumn(FullColumn* fullCol); // std::shared_ptr> timesFullMatrix(std::shared_ptr> fullMat); virtual std::shared_ptr> timesTransposeFullMatrix(std::shared_ptr> fullMat); std::shared_ptr> times(T a); // std::shared_ptr> transposeTimesFullMatrix(std::shared_ptr> fullMat); // std::shared_ptr> plusFullMatrix(std::shared_ptr> fullMat); std::shared_ptr> minusFullMatrix(std::shared_ptr> fullMat); // std::shared_ptr> transpose(); // std::shared_ptr> negated(); void symLowerWithUpper(); void atiput(int i, FRowsptr fullRow) override; void atijput(int i, int j, T value); void atijputFullColumn(int i, int j, FColsptr fullCol); void atijplusFullRow(int i, int j, FRowsptr fullRow); void atijplusNumber(int i, int j, T value); void atijminusNumber(int i, int j, T value); double sumOfSquares() override; void zeroSelf() override; // std::shared_ptr> copy(); FullMatrixTemplate operator+(const FullMatrixTemplate fullMat); FColsptr transposeTimesFullColumn(const FColsptr fullCol); void magnifySelf(T factor); std::shared_ptr> asEulerParameters(); T trace(); double maxMagnitude() override; FColsptr bryantAngles(); bool isDiagonal(); bool isDiagonalToWithin(double ratio); std::shared_ptr> asDiagonalMatrix(); void conditionSelfWithTol(double tol); std::ostream& printOn(std::ostream& s) const override; }; // // FULL MATRIX DOUBLE instantiation // class FullMatrixDouble : public FullMatrixTemplate { public: FullMatrixDouble() : FullMatrixTemplate() {}; explicit FullMatrixDouble(int m) : FullMatrixTemplate(m) {}; FullMatrixDouble(int m, int n) : FullMatrixTemplate(m, n) {}; FullMatrixDouble(std::initializer_list> list2D) : FullMatrixTemplate(list2D) {} FullMatrixDouble(std::initializer_list> listOfRows) : FullMatrixTemplate(listOfRows) {}; std::shared_ptr times(double a); std::shared_ptr timesTransposeFullMatrix(std::shared_ptr fullMat); void identity() override; static std::shared_ptr identitysptr(int n); double sumOfSquares(); std::shared_ptr transposeTimesFullMatrix(std::shared_ptr fullMat); std::shared_ptr timesFullMatrix(std::shared_ptr fullMat); std::shared_ptr transpose(); std::shared_ptr negated(); std::shared_ptr plusFullMatrix(std::shared_ptr fullMat); static std::shared_ptr rotatex(double angle); static std::shared_ptr rotatey(double angle); static std::shared_ptr rotatez(double angle); static std::shared_ptr rotatexrotDot(double angle, double angledot); static std::shared_ptr rotateyrotDot(double angle, double angledot); static std::shared_ptr rotatezrotDot(double angle, double angledot); std::shared_ptr copy(); }; // // FULL MATRIX FULL MATRIX DOUBLE instantiation // class FullMatrixFullMatrixDouble : public FullMatrixTemplate { public: FullMatrixFullMatrixDouble() : FullMatrixTemplate() {}; explicit FullMatrixFullMatrixDouble(int m) : FullMatrixTemplate(m) {}; FullMatrixFullMatrixDouble(int m, int n) : FullMatrixTemplate(m, n) {}; std::shared_ptr times(double a); std::shared_ptr timesTransposeFullMatrix(std::shared_ptr fullMat); double sumOfSquares() override; void identity() override; static std::shared_ptr identitysptr(int n); }; // // FULL MATRIX FULL COLUMN DOUBLE instantiation // class FullMatrixFullColumnDouble : public FullMatrixTemplate { public: FullMatrixFullColumnDouble() : FullMatrixTemplate() {}; explicit FullMatrixFullColumnDouble(int m) : FullMatrixTemplate(m) {}; FullMatrixFullColumnDouble(int m, int n) : FullMatrixTemplate(m, n) {}; std::shared_ptr times(double a); std::shared_ptr timesTransposeFullMatrix(std::shared_ptr fullMat); double sumOfSquares() override; void identity() override; static std::shared_ptr identitysptr(int n); }; }