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

ClangFormat

This commit is contained in:
Julian Lenz 2023-05-03 02:39:36 +01:00
parent ac0a74be0d
commit c5924833a1

View File

@ -13,8 +13,7 @@ bool has_correct_group_block_structure(const T& U){
Complex i(0., 1.);
for (int c1 = 0; c1 < nsp; c1++) // check on W
{
for (int c2 = 0; c2 < nsp; c2++)
{
for (int c2 = 0; c2 < nsp; c2++) {
auto W = PeekIndex<ColourIndex>(U, c1, c2);
auto Wstar = PeekIndex<ColourIndex>(U, c1 + nsp, c2 + nsp);
auto Ww = conjugate(Wstar);
@ -24,13 +23,10 @@ bool has_correct_group_block_structure(const T& U){
amizeroo *= i;
assert(amizeroo.real() < 10e-6);
}
}
for (int c1 = 0; c1 < nsp ; c1++)
{
for (int c2 = 0; c2 < nsp; c2++)
{
for (int c1 = 0; c1 < nsp; c1++) {
for (int c2 = 0; c2 < nsp; c2++) {
auto X = PeekIndex<ColourIndex>(U, c1, c2 + nsp);
auto minusXstar = PeekIndex<ColourIndex>(U, c1 + nsp, c2);
auto minusXx = conjugate(minusXstar);
@ -45,7 +41,9 @@ 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(T U) {
// does explicitly take a copy in order to not spoil the matrix for further
// use
LatticeColourMatrixD aux(U.Grid());
LatticeColourMatrixD identity(U.Grid());
@ -57,7 +55,8 @@ bool is_element_of_sp2n_group(T U) {// does explicitly take a copy in order to n
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
Sp<Nc>::OmegaInvariance(U); // no assertion here, but the next check will
// kill us if we are not simplectic
return has_correct_group_block_structure(U);
}
@ -108,8 +107,7 @@ bool has_correct_algebra_block_structure(const T& U) {
std::cout << GridLogMessage << std::endl;
for (int c1 = 0; c1 < nsp; c1++) // check on W
{
for (int c2 = 0; c2 < nsp; c2++)
{
for (int c2 = 0; c2 < nsp; c2++) {
auto W = PeekIndex<ColourIndex>(U, c1, c2);
auto Wstar = PeekIndex<ColourIndex>(U, c1 + nsp, c2 + nsp);
auto Ww = conjugate(Wstar);
@ -119,13 +117,10 @@ bool has_correct_algebra_block_structure(const T& U) {
amizeroo *= i;
assert(amizeroo.real() < 10e-6);
}
}
for (int c1 = 0; c1 < nsp ; c1++)
{
for (int c2 = 0; c2 < nsp; c2++)
{
for (int c1 = 0; c1 < nsp; c1++) {
for (int c2 = 0; c2 < nsp; c2++) {
auto X = PeekIndex<ColourIndex>(U, c1, c2 + nsp);
auto minusXstar = PeekIndex<ColourIndex>(U, c1 + nsp, c2);
auto minusXx = conjugate(minusXstar);
@ -141,7 +136,8 @@ bool has_correct_algebra_block_structure(const T& U) {
template <typename T>
bool is_element_of_sp2n_algebra(T U) {
// does explicitly take a copy in order to not spoil the matrix for further
// use
LatticeColourMatrixD aux(U.Grid());
LatticeColourMatrixD identity(U.Grid());
identity = 1.0;
@ -153,18 +149,19 @@ bool is_element_of_sp2n_algebra(T U) {
std::cout << GridLogMessage << "T + Tda = " << norm2(aux) << std::endl;
assert(norm2(aux) < 1e-8);
std::cout << GridLogMessage << "Check that Omega U Omega = conj(U)" << std::endl;
std::cout << GridLogMessage << "Check that Omega U Omega = conj(U)"
<< std::endl;
LatticeColourMatrixD Omega(U.Grid());
Sp<Nc>::Omega(Omega);
aux = Omega * U * Omega - conjugate(U);
std::cout << GridLogMessage << "Omega U Omega - conj(U) = " << norm2(aux) << std::endl;
std::cout << GridLogMessage << "Omega U Omega - conj(U) = " << norm2(aux)
<< std::endl;
assert(norm2(aux) < 1e-8);
return has_correct_algebra_block_structure(U);
}
template <typename T>
void test_algebra_projections(T U) {
RealD Delta = 666.;
@ -195,42 +192,28 @@ name="TaProj";
assert(is_element_of_sp2n_algebra(U));
}
int main (int argc, char **argv)
{
int main(int argc, char** argv) {
Grid_init(&argc, &argv);
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(Nd, vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
GridCartesian Grid(latt_size, simd_layout, mpi_layout);
LatticeGaugeField Umu(&Grid);
LatticeColourMatrixD U(&Grid);
LatticeColourMatrixD Up(&Grid);
LatticeColourMatrixD aux(&Grid);
LatticeColourMatrixD identity(&Grid);
// Will test resimplectification-related functionalities (from ProjectOnGaugeGroup, ProjectOnSpGroup, ProjectGn) and projection on the algebra (from ProjectSp2nAlgebra)
// we work with matrices with positive determinant so detU = 1 even if in principle ProjectOnGaugeGroup and ProjectOnSpGroup allow for detU=-1
// so the checks will be the same for the three functions
// NB only ProjectGn is the proper simplectification function
const int nsp = Nc / 2;
identity = 1.0;
RealD epsilon = 0.01;
RealD Delta = 666.;
Complex i(0., 1.);
RealD u = 0.;
double vol = Umu.Grid()->gSites();
// Will test resimplectification-related functionalities (from
// ProjectOnGaugeGroup, ProjectOnSpGroup, ProjectGn) and projection on the
// algebra (from ProjectSp2nAlgebra) we work with matrices with positive
// determinant so detU = 1 even if in principle ProjectOnGaugeGroup and
// ProjectOnSpGroup allow for detU=-1 so the checks will be the same for the
// three functions NB only ProjectGn is the proper simplectification function
std::vector<int> pseeds({1, 2, 3, 4, 5});
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(pseeds);
GridParallelRNG pRNG(&Grid);
pRNG.SeedFixedIntegers(pseeds);
SU<Nc>::HotConfiguration(pRNG, Umu);
U = PeekIndex<LorentzIndex>(Umu, 0);
@ -239,5 +222,4 @@ int main (int argc, char **argv)
test_algebra_projections(U);
Grid_finalize();
}