1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-09 23:45:36 +00:00

Take over additional group tests from Alessandro

This commit is contained in:
Julian Lenz 2023-05-03 13:54:01 +01:00
parent ac6c7cb8d6
commit c7fba9aace

View File

@ -41,22 +41,30 @@ bool has_correct_group_block_structure(const T& U) {
};
template <typename T>
bool is_element_of_sp2n_group(T U) {
// does explicitly take a copy in order to not spoil the matrix for further
// use
bool is_element_of_sp2n_group(const T& U) {
LatticeColourMatrixD aux(U.Grid());
LatticeColourMatrixD identity(U.Grid());
identity = 1.0;
LatticeColourMatrixD Omega(U.Grid());
Sp<Nc>::Omega(Omega);
std::cout << GridLogMessage << "Check matrix is non-zero " << std::endl;
assert(norm2(U) > 1e-8);
std::cout << GridLogMessage << "Unitary check" << std::endl;
aux = U * adj(U) - identity;
std::cout << GridLogMessage << "U adjU - 1 = " << norm2(aux) << std::endl;
assert(norm2(aux) < 1e-8);
std::cout << GridLogMessage << "Checking Omega invariance" << std::endl;
Sp<Nc>::OmegaInvariance(U); // no assertion here, but the next check will
// kill us if we are not simplectic
aux = Omega - (U * Omega * transpose(U));
std::cout << GridLogMessage << "Omega - U Omega transpose(U) = " << norm2(aux)
<< std::endl;
assert(norm2(aux) < 1e-8);
std::cout << GridLogMessage
<< "|Det| = " << norm2(Determinant(U)) / U.Grid()->gSites()
<< std::endl;
assert(norm2(Determinant(U)) / U.Grid()->gSites() - 1 < 1e-8);
return has_correct_group_block_structure(U);
}