21 #ifndef RFFGEN_LINEAR_ALGEBRA_UNIT_MATRIX_HH
22 #define RFFGEN_LINEAR_ALGEBRA_UNIT_MATRIX_HH
24 #include "../Util/at.hh"
25 #include "../Util/voider.hh"
26 #include "../Util/zero.hh"
27 #include "dimension.hh"
28 #include "extractRowsAndCols.hh"
32 namespace LinearAlgebra
38 template <
class Matrix,
class = std::enable_if_t<Checks::isConstantSizeMatrix<Matrix>()> >
41 Matrix A = zero<Matrix>();
42 for(
int i=0; i<dimension<Matrix>(); ++i) at(A,i,i) = 1;
50 template <
class Matrix,
class = std::enable_if_t<!Checks::isConstantSizeMatrix<Matrix>()> >
53 Matrix A = zero<Matrix>(rows,rows);
54 for(
int i=0; i<rows; ++i) at(A,i,i) = 1;
60 #endif // RFFGEN_LINEAR_ALGEBRA_UNIT_MATRIX_HH
Matrix unitMatrix(int rows)
Compute unit matrix for the specified dynamic size matrix type. This requires that a corresponding sp...
Definition: unitMatrix.hh:51