1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-14 09:45:36 +00:00
Grid/tests/sp2n/Test_sp2n_lie_gen.cc

66 lines
1.7 KiB
C++
Raw Normal View History

2021-10-12 09:06:15 +01:00
#include <Grid/Grid.h>
2023-06-16 16:27:49 +01:00
#include <iostream>
2021-10-12 09:06:15 +01:00
using namespace Grid;
2023-06-16 16:27:49 +01:00
template <int ngroup>
std::ostream& operator<<(std::ostream& o, Sp<ngroup> g) {
return o << "Sp(" << ngroup << ") Fundamental";
}
template <int ngroup, TwoIndexSymmetry S>
std::ostream& operator<<(std::ostream& o, Sp_TwoIndex<ngroup, S> g) {
return o << "Sp(" << ngroup << ") TwoIndex "
<< (S == Symmetric ? "Symmetric" : "AntiSymmetric");
}
template <class Group>
void run_check_on(bool print_generators = false) {
2023-06-16 15:58:23 +01:00
std::cout << GridLogMessage << "*********************************************"
<< std::endl;
2023-06-16 16:27:49 +01:00
std::cout << GridLogMessage << "* Generators for " << Group() << std::endl;
2023-06-16 15:58:23 +01:00
std::cout << GridLogMessage << "*********************************************"
<< std::endl;
if (print_generators) {
2023-06-16 16:27:49 +01:00
Group::printGenerators();
2023-06-16 15:58:23 +01:00
}
2023-06-16 16:27:49 +01:00
Group::testGenerators();
}
2023-06-16 15:58:23 +01:00
2023-06-16 16:27:49 +01:00
template <int ngroup>
void run_checks() {
run_check_on<Sp<ngroup>>();
run_check_on<Sp_TwoIndex<ngroup, Symmetric>>();
run_check_on<Sp_TwoIndex<ngroup, AntiSymmetric>>();
}
template <>
void run_checks<2>() {
// Print generators because they are small enough to be actually helpful.
run_check_on<Sp<2>>(true);
run_check_on<Sp_TwoIndex<2, Symmetric>>(true);
// The AntiSymmetric representation is 0 dimensional. This makes problems in
// device code.
}
template <>
void run_checks<4>() {
// Print generators because they are small enough to be actually helpful.
run_check_on<Sp<4>>(true);
run_check_on<Sp_TwoIndex<4, Symmetric>>(true);
run_check_on<Sp_TwoIndex<4, AntiSymmetric>>(true);
2023-05-26 16:55:30 +01:00
}
2023-06-16 15:58:23 +01:00
2021-10-12 09:06:15 +01:00
int main(int argc, char** argv) {
Grid_init(&argc, &argv);
2023-06-16 15:58:23 +01:00
2023-06-16 16:27:49 +01:00
run_checks<2>();
run_checks<4>();
run_checks<6>();
run_checks<8>();
2023-05-16 14:10:39 +01:00
2021-10-12 09:06:15 +01:00
Grid_finalize();
}