21 #ifndef RFFGEN_UTIL_ADDTRANSPOSEDMATRIX_HH
22 #define RFFGEN_UTIL_ADDTRANSPOSEDMATRIX_HH
25 #include <type_traits>
26 #include "../LinearAlgebra/dimension.hh"
27 #include "../Util/staticChecks.hh"
35 template <
class Matrix ,
36 class = std::enable_if_t<Checks::isConstantSizeMatrix<Matrix>()> >
39 using Index = decltype(LinearAlgebra::dimension<Matrix>());
40 for(Index i=0; i<LinearAlgebra::dimension<Matrix>(); ++i)
41 for(Index j=i+1; j<LinearAlgebra::dimension<Matrix>(); ++j)
42 at(A,j,i) = at(A,i,j) = at(A,i,j) + at(A,j,i);
43 for(Index i=0; i<LinearAlgebra::dimension<Matrix>(); ++i) at(A,i,i) *= 2;
51 template <
class Matrix ,
52 class = std::enable_if_t<!Checks::isConstantSizeMatrix<Matrix>()> ,
53 class = std::enable_if_t<Checks::isDynamicMatrix<Matrix>()> >
56 assert( LinearAlgebra::rows(A) == LinearAlgebra::cols(A) );
57 using Index = decltype(LinearAlgebra::rows(std::declval<Matrix>()));
58 for(Index i=0; i<LinearAlgebra::rows(A); ++i)
59 for(Index j=i+1; j<LinearAlgebra::cols(A); ++j)
60 at(A,j,i) = at(A,i,j) = at(A,i,j) + at(A,j,i);
61 for(Index i=0; i<LinearAlgebra::rows(A); ++i) at(A,i,i) *= 2;
66 #endif // RFFGEN_UTIL_ADDTRANSPOSEDMATRIX_HH
Matrix addTransposed(Matrix &A)
Overwrites with .
Definition: addTransposedMatrix.hh:37