Skip to content

Commit

Permalink
Arith: Clean up in tensor symmetries
Browse files Browse the repository at this point in the history
  • Loading branch information
eschnett committed Jul 3, 2023
1 parent 6acb777 commit 8dfd637
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Arith/src/mat.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ template <typename T, int D, symm_t symm> struct gmat {
constexpr static int Nfull = D * D;
constexpr static int Nsymm = D * (D + 1) / 2;
constexpr static int Nanti = D * (D - 1) / 2;
constexpr static int N = if_symm(symm, Nfull, Nsymm, Nanti);
constexpr static int N = if_symm<symm>(Nfull, Nsymm, Nanti);
vect<T, N> elts;

public:
Expand Down
2 changes: 1 addition & 1 deletion Arith/src/ten3.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ template <typename T, int D, symm_t symm> struct gten3 {
constexpr static int Nfull = D * D * D;
constexpr static int Nsymm = D * (D + 1) * (D + 2) / 6;
constexpr static int Nanti = D * (D - 1) * (D - 2) / 6;
constexpr static int N = if_symm(symm, Nfull, Nsymm, Nanti);
constexpr static int N = if_symm<symm>(Nfull, Nsymm, Nanti);
vect<T, N> elts;

public:
Expand Down
8 changes: 5 additions & 3 deletions Arith/src/vec.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ constexpr auto if_symm(const T1 &if_full, const T2 &if_symm,
template <typename T1, typename T2, typename T3>
constexpr auto if_symm(symm_t symm, const T1 &if_full, const T2 &if_symm,
const T3 &if_anti) {
if (symm == FULL)
switch (symm) {
case FULL:
return if_full;
if (symm == SYMM)
case SYMM:
return if_symm;
if (symm == ANTI)
case ANTI:
return if_anti;
}
abort();
}
inline ostream &operator<<(ostream &os, const symm_t symm) {
Expand Down

0 comments on commit 8dfd637

Please sign in to comment.