1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-09-20 01:05:38 +01:00

prettiest tests

This commit is contained in:
Alessandro Lupo 2023-07-02 13:25:57 +01:00
parent 559257bbe9
commit 34b11864b6
3 changed files with 129 additions and 104 deletions

View File

@ -300,3 +300,18 @@ static void Omega(LatticeColourMatrixD &in) {
OmegaLatt = OmegaLatt + (identity * Omega);
in = OmegaLatt;
}
template <ONLY_IF_Sp, class vtype, int N>
static void Omega(iScalar<iScalar<iMatrix<vtype, N> > > &in) {
const int nsp=ncolour/2;
iScalar<iScalar<iMatrix<vtype, N> > > Omega;
Omega = Zero();
for (int i = 0; i < nsp; i++) {
Omega()()(i, nsp + i) = 1.;
Omega()()(nsp + i, i) = -1;
}
in = Omega;
}

View File

@ -20,36 +20,14 @@ static void check_dimensions() {
}
template<int this_nc, TwoIndexSymmetry S>
static void S_checks() {
std::cout << S << std::endl;
std::cout << 1 + S * 3 << std::endl;
}
template<int this_nc, TwoIndexSymmetry S>
static void run_base_checks() {
std::cout << GridLogMessage << " ****** " << std::endl;
std::cout << GridLogMessage << "Running checks for Nc = " << this_nc << " TwoIndex Symmetry = " << S << std::endl;
static void run_symmetry_checks() {
typedef typename Sp_TwoIndex<this_nc, S>::template iGroupMatrix<Complex> Matrix;
const int this_n = this_nc/2;
const int this_irrep_dim = Sp_TwoIndex<this_nc, S>::Dimension;
const int this_algebra_dim = Sp<this_nc>::AlgebraDimension;
typedef typename Sp_TwoIndex<this_nc, S>::template iGroupMatrix<Complex> Matrix;
typedef typename Sp_TwoIndex<this_nc, S>::template iGroupTwoIndexMatrix<Complex> ASMatrix;
RealD realS = S;
Matrix Omega;
Matrix eij_a;
Matrix eij_b;
Matrix eij_c;
Matrix e_sum;
Omega = Zero();
for (int i = 0; i < this_n; i++)
{
Omega()()(i, this_n + i) = 1.;
Omega()()(this_n + i, i) = -1;
}
RealD realA;
RealD realS = S;
std::cout << GridLogMessage << "checking base has symmetry " << S << std::endl;
for (int a=0; a < this_irrep_dim; a++)
@ -60,6 +38,21 @@ static void run_base_checks() {
assert(norm2(e_sum) < 1e-8);
}
}
template<int this_nc, TwoIndexSymmetry S>
static void run_traces_checks() {
typedef typename Sp_TwoIndex<this_nc, S>::template iGroupMatrix<Complex> Matrix;
const int this_n = this_nc/2;
const int this_irrep_dim = Sp_TwoIndex<this_nc, S>::Dimension;
const int this_algebra_dim = Sp<this_nc>::AlgebraDimension;
Matrix eij_a;
Matrix eij_b;
Matrix Omega;
Sp<this_nc>::Omega(Omega);
RealD realS = S;
RealD realA;
std::cout << GridLogMessage << "Checking Tr (e^(ab) Omega ) = 0 and Tr (e^(ab) e^(cd) = delta^((ab)(cd)) ) " << std::endl;
for (int a=0; a < Sp_TwoIndex<this_nc, S>::Dimension; a++) {
Sp_TwoIndex<this_nc, S>::base(a, eij_a);
@ -84,6 +77,14 @@ static void run_base_checks() {
}
}
}
template<int this_nc, TwoIndexSymmetry S>
static void run_generators_checks() {
const int this_n = this_nc/2;
const int this_irrep_dim = Sp_TwoIndex<this_nc, S>::Dimension;
const int this_algebra_dim = Sp<this_nc>::AlgebraDimension;
typedef typename Sp_TwoIndex<this_nc, S>::template iGroupMatrix<Complex> Matrix;
int sum = 0;
int sum_im = 0;
Vector<Matrix> ta_fund(this_algebra_dim);
@ -120,6 +121,16 @@ static void run_base_checks() {
assert ( sum < 1e-8) ;
assert ( sum_im < 1e-8) ;
}
}
template<int this_nc, TwoIndexSymmetry S>
static void run_base_checks() {
std::cout << GridLogMessage << " ****** " << std::endl;
std::cout << GridLogMessage << "Running checks for Nc = " << this_nc << " TwoIndex Symmetry = " << S << std::endl;
run_symmetry_checks<this_nc, S>();
run_traces_checks<this_nc, S>();
run_generators_checks<this_nc, S>();
}
int main(int argc, char** argv) {
@ -136,4 +147,3 @@ int main(int argc, char** argv) {
run_base_checks<8, Symmetric>();
run_base_checks<8, AntiSymmetric>();
}