22#ifndef fixed_square_matrix_h
23#define fixed_square_matrix_h
25#include "fixed_general_matrix.h"
41 static constexpr bool isVector {
false};
42 using value_type = AT;
74 template<
class Type,
class Row,
class Col>
93 template <
class Type,
class Row,
class Col>
105 template<
class Type,
class Row,
class Col>
112 constexpr int size()
const {
return M;}
113 constexpr int rows()
const {
return M;}
114 constexpr int cols()
const {
return M;}
116 using Matrix<General,Fixed<M>,Fixed<M>,AT>::operator();
117 using Matrix<General,Fixed<M>,Fixed<M>,AT>::e;
123 explicit inline operator std::vector<std::vector<AT>>()
const;
130 explicit SquareMatrix(
const std::vector<std::vector<AT>> &m);
132 inline const SquareMatrix<Fixed<M>,AT> T()
const;
135 template <
int M,
class AT>
136 inline const SquareMatrix<Fixed<M>,AT> SquareMatrix<Fixed<M>,AT>::T()
const {
137 SquareMatrix<Fixed<M>,AT> A(NONINIT);
138 for(
int i=0; i<M; i++)
139 for(
int j=0; j<M; j++)
144 template <
int M,
class AT>
146 std::vector<std::vector<AT>> ret(rows(),std::vector<AT>(cols()));
147 for(
int r=0; r<size(); r++) {
148 for(
int c=0; c<size(); c++)
154 template <
int M,
class AT>
156 for(
int r=0; r<rows(); r++) {
157 if(
static_cast<int>(m[r].size())!=cols())
158 throw std::runtime_error(
"The rows of the input have different length.");
159 for(
int c=0; c<cols(); c++)
Shape class for general matrices.
Definition: types.h:116
This is the basic matrix class for arbitrary matrices.
Definition: matrix.h:52
SquareMatrix(const Matrix< Type, Row, Col, AT > &A)
Copy Constructor.
Definition: fixed_square_matrix.h:75
constexpr int size() const
Size.
Definition: fixed_square_matrix.h:112
SquareMatrix(const SquareMatrix< Fixed< M >, AT > &A)=default
Copy Constructor.
SquareMatrix(const SquareMatrix< Row, AT > &A)
Copy Constructor.
Definition: fixed_square_matrix.h:68
SquareMatrix< Fixed< M >, AT > & operator=(const SquareMatrix< Fixed< M >, AT > &A)=default
Assignment operator.
Dummy shape class for square matrices.
Definition: types.h:173
Namespace fmatvec.
Definition: _memory.cc:28