mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-09 23:45:36 +00:00
implement TwoIndexSymm for sp2n
This commit is contained in:
parent
5897b93dd4
commit
be1a4f5860
@ -49,6 +49,63 @@ struct DimensionHelper<nc, AntiSymmetric, GroupName::Sp> {
|
||||
static const int Dimension = (nc / 2) * (nc - 1) - 1;
|
||||
};
|
||||
|
||||
template <class cplx, int nc, TwoIndexSymmetry S, class group_name>
|
||||
struct baseOffDiagonalSpHelper;
|
||||
|
||||
template <class cplx, int nc>
|
||||
struct baseOffDiagonalSpHelper<cplx, nc, AntiSymmetric, GroupName::Sp> {
|
||||
static const int ngroup = nc / 2;
|
||||
static void baseOffDiagonalSp(int i, int j, iScalar<iScalar<iMatrix<cplx, nc> > > &eij) {
|
||||
eij = Zero();
|
||||
RealD tmp;
|
||||
|
||||
if ((i == ngroup + j) && (1 <= j) && (j < ngroup)) {
|
||||
for (int k = 0; k < ngroup; k++) {
|
||||
if (k < j) {
|
||||
tmp = sqrt(2 * j * (j + 1));
|
||||
tmp = 1 / tmp;
|
||||
tmp *= std::sqrt(2.0);
|
||||
eij()()(k, k + ngroup) = tmp;
|
||||
eij()()(k + ngroup, k) = -tmp;
|
||||
}
|
||||
if (k == j) {
|
||||
tmp = sqrt(2 * j * (j + 1));
|
||||
tmp = -j / tmp;
|
||||
tmp *= std::sqrt(2.0);
|
||||
eij()()(k, k + ngroup) = tmp;
|
||||
eij()()(k + ngroup, k) = -tmp;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (i != ngroup + j) {
|
||||
for (int k = 0; k < nc; k++)
|
||||
for (int l = 0; l < nc; l++) {
|
||||
eij()()(l, k) =
|
||||
delta(i, k) * delta(j, l) - delta(j, k) * delta(i, l);
|
||||
}
|
||||
}
|
||||
|
||||
RealD nrm = 1. / std::sqrt(2.0);
|
||||
eij = eij * nrm;
|
||||
}
|
||||
};
|
||||
|
||||
template <class cplx, int nc>
|
||||
struct baseOffDiagonalSpHelper<cplx, nc, Symmetric, GroupName::Sp> {
|
||||
static void baseOffDiagonalSp(int i, int j, iScalar<iScalar<iMatrix<cplx, nc> > > &eij) {
|
||||
eij = Zero();
|
||||
for (int k = 0; k < nc; k++)
|
||||
for (int l = 0; l < nc; l++)
|
||||
eij()()(l, k) =
|
||||
delta(i, k) * delta(j, l) + delta(j, k) * delta(i, l);
|
||||
|
||||
RealD nrm = 1. / std::sqrt(2.0);
|
||||
eij = eij * nrm;
|
||||
}
|
||||
};
|
||||
|
||||
template <int ncolour, TwoIndexSymmetry S, class group_name>
|
||||
class GaugeGroupTwoIndex : public GaugeGroup<ncolour, group_name> {
|
||||
public:
|
||||
@ -95,6 +152,12 @@ class GaugeGroupTwoIndex : public GaugeGroup<ncolour, group_name> {
|
||||
|
||||
template <class cplx>
|
||||
static void base(int Index, iGroupMatrix<cplx> &eij) {
|
||||
// returns (e)^(ij)_{kl} necessary for change of base U_F -> U_R
|
||||
base(Index, eij, group_name());
|
||||
}
|
||||
|
||||
template <class cplx>
|
||||
static void base(int Index, iGroupMatrix<cplx> &eij, GroupName::SU) {
|
||||
// returns (e)^(ij)_{kl} necessary for change of base U_F -> U_R
|
||||
assert(Index < Dimension);
|
||||
eij = Zero();
|
||||
@ -107,10 +170,6 @@ class GaugeGroupTwoIndex : public GaugeGroup<ncolour, group_name> {
|
||||
for (int i = 1; i < ncolour; i++) {
|
||||
for (int j = 0; j < i; j++) {
|
||||
a[counter][0] = i;
|
||||
if (j==0 && ngroup == ncolour/2 && i==ngroup+j) {
|
||||
//std::cout << "skipping" << std::endl; // for Sp2n this vanishes identically.
|
||||
j = j+1;
|
||||
}
|
||||
a[counter][1] = j;
|
||||
counter++;
|
||||
}
|
||||
@ -119,11 +178,43 @@ class GaugeGroupTwoIndex : public GaugeGroup<ncolour, group_name> {
|
||||
}
|
||||
|
||||
if (Index < ncolour * (ncolour - 1) / 2) {
|
||||
baseOffDiagonal(a[Index][0], a[Index][1], eij, group_name());
|
||||
baseOffDiagonal(a[Index][0], a[Index][1], eij);
|
||||
} else {
|
||||
baseDiagonal(Index, eij);
|
||||
}
|
||||
}
|
||||
|
||||
template <class cplx>
|
||||
static void base(int Index, iGroupMatrix<cplx> &eij, GroupName::Sp) {
|
||||
// returns (e)^(ij)_{kl} necessary for change of base U_F -> U_R
|
||||
assert(Index < Dimension);
|
||||
eij = Zero();
|
||||
|
||||
// for the linearisation of the 2 indexes
|
||||
static int a[ncolour * (ncolour - 1) / 2][2]; // store the a <-> i,j
|
||||
static bool filled = false;
|
||||
if (!filled) {
|
||||
int counter = 0;
|
||||
for (int i = 1; i < ncolour; i++) {
|
||||
for (int j = 0; j < i; j++) {
|
||||
a[counter][0] = i;
|
||||
if (j==0 && i==ngroup+j && S==-1) {
|
||||
//std::cout << "skipping" << std::endl; // for Sp2n this vanishes identically.
|
||||
j = j+1;
|
||||
}
|
||||
a[counter][1] = j;
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
filled = true;
|
||||
}
|
||||
|
||||
if (Index < DimensionHelper<ncolour, AntiSymmetric, GroupName::Sp>::Dimension + 1) { // +1 the singlet
|
||||
baseOffDiagonalSp(a[Index][0], a[Index][1], eij);
|
||||
} else {
|
||||
baseDiagonal(Index, eij);
|
||||
}
|
||||
}
|
||||
|
||||
template <class cplx>
|
||||
static void baseDiagonal(int Index, iGroupMatrix<cplx> &eij) {
|
||||
@ -131,48 +222,9 @@ class GaugeGroupTwoIndex : public GaugeGroup<ncolour, group_name> {
|
||||
eij()()(Index - ncolour * (ncolour - 1) / 2,
|
||||
Index - ncolour * (ncolour - 1) / 2) = 1.0;
|
||||
}
|
||||
|
||||
|
||||
template <class cplx>
|
||||
static void baseOffDiagonal(int i, int j, iGroupMatrix<cplx> &eij,
|
||||
GroupName::Sp) {
|
||||
eij = Zero();
|
||||
RealD tmp;
|
||||
|
||||
if ((i == ngroup + j) && (1 <= j) && (j < ngroup)) {
|
||||
for (int k = 0; k < ngroup; k++) {
|
||||
if (k < j) {
|
||||
tmp = sqrt(2 * j * (j + 1));
|
||||
tmp = 1 / tmp;
|
||||
tmp *= std::sqrt(2.0);
|
||||
eij()()(k, k + ngroup) = tmp;
|
||||
eij()()(k + ngroup, k) = -tmp;
|
||||
}
|
||||
if (k == j) {
|
||||
tmp = sqrt(2 * j * (j + 1));
|
||||
tmp = -j / tmp;
|
||||
tmp *= std::sqrt(2.0);
|
||||
eij()()(k, k + ngroup) = tmp;
|
||||
eij()()(k + ngroup, k) = -tmp;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (i != ngroup + j) {
|
||||
for (int k = 0; k < ncolour; k++)
|
||||
for (int l = 0; l < ncolour; l++) {
|
||||
eij()()(l, k) =
|
||||
delta(i, k) * delta(j, l) + S * delta(j, k) * delta(i, l);
|
||||
}
|
||||
}
|
||||
|
||||
RealD nrm = 1. / std::sqrt(2.0);
|
||||
eij = eij * nrm;
|
||||
}
|
||||
|
||||
template <class cplx>
|
||||
static void baseOffDiagonal(int i, int j, iGroupMatrix<cplx> &eij,
|
||||
GroupName::SU) {
|
||||
static void baseOffDiagonal(int i, int j, iGroupMatrix<cplx> &eij) {
|
||||
eij = Zero();
|
||||
for (int k = 0; k < ncolour; k++)
|
||||
for (int l = 0; l < ncolour; l++)
|
||||
@ -182,11 +234,16 @@ class GaugeGroupTwoIndex : public GaugeGroup<ncolour, group_name> {
|
||||
RealD nrm = 1. / std::sqrt(2.0);
|
||||
eij = eij * nrm;
|
||||
}
|
||||
|
||||
template <class cplx>
|
||||
static void baseOffDiagonalSp(int i, int j, iGroupMatrix<cplx> &eij) {
|
||||
baseOffDiagonalSpHelper<cplx, ncolour, S, GroupName::Sp>::baseOffDiagonalSp(i, j, eij);
|
||||
}
|
||||
|
||||
static void printBase(void) {
|
||||
for (int gen = 0; gen < Dimension; gen++) {
|
||||
Matrix tmp;
|
||||
base(gen, tmp);
|
||||
base(gen, tmp, group_name());
|
||||
std::cout << GridLogMessage << "Nc = " << ncolour << " t_" << gen
|
||||
<< std::endl;
|
||||
std::cout << GridLogMessage << tmp << std::endl;
|
||||
@ -203,7 +260,7 @@ class GaugeGroupTwoIndex : public GaugeGroup<ncolour, group_name> {
|
||||
for (int a = 0; a < NumGenerators; a++)
|
||||
GaugeGroup<ncolour, group_name>::generator(a, ta[a]);
|
||||
|
||||
for (int a = 0; a < Dimension; a++) base(a, eij[a]);
|
||||
for (int a = 0; a < Dimension; a++) base(a, eij[a], group_name());
|
||||
|
||||
for (int a = 0; a < Dimension; a++) {
|
||||
tmp = transpose(ta[Index]) * adj(eij[a]) + adj(eij[a]) * ta[Index];
|
||||
|
@ -1,13 +1,12 @@
|
||||
#include <Grid/Grid.h>
|
||||
|
||||
#define verbose 0
|
||||
#define verbose 1
|
||||
|
||||
using namespace Grid;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
Grid_init(&argc, &argv);
|
||||
static void antisymm_base() {
|
||||
|
||||
const int this_nc = 4;
|
||||
const int this_nc = 6;
|
||||
const int this_n = this_nc/2;
|
||||
const int this_irrep_dim = Sp_TwoIndex<this_nc, AntiSymmetric>::Dimension;
|
||||
const int this_algebra_dim = Sp<this_nc>::AlgebraDimension;
|
||||
@ -25,7 +24,6 @@ int main(int argc, char** argv) {
|
||||
Omega()()(i, this_n + i) = 1.;
|
||||
Omega()()(this_n + i, i) = -1;
|
||||
}
|
||||
std::cout << "Omega " << Omega << std::endl;
|
||||
|
||||
RealD realA;
|
||||
RealD realB;
|
||||
@ -102,8 +100,113 @@ int main(int argc, char** argv) {
|
||||
std::cout << GridLogMessage << "re-evaluated trace of the generator " << gen_id << " is " << sum << " " << sum_im << std::endl;
|
||||
assert ( sum < 1e-8) ;
|
||||
assert ( sum_im < 1e-8) ;
|
||||
|
||||
}
|
||||
|
||||
Grid_finalize();
|
||||
}
|
||||
|
||||
static void symm_base() {
|
||||
|
||||
const int this_nc = 6;
|
||||
const int this_n = this_nc/2;
|
||||
const int this_irrep_dim = Sp_TwoIndex<this_nc, Symmetric>::Dimension;
|
||||
const int this_algebra_dim = Sp<this_nc>::AlgebraDimension;
|
||||
typedef Sp_TwoIndex<this_nc, Symmetric>::iGroupMatrix<Complex> Matrix;
|
||||
typedef Sp_TwoIndex<this_nc, Symmetric>::iGroupTwoIndexMatrix<Complex> SMatrix;
|
||||
|
||||
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 realB;
|
||||
std::cout << GridLogMessage << "symm dimension is " << this_irrep_dim << std::endl;
|
||||
std::cout << GridLogMessage << "algebra dimension is " << this_algebra_dim << std::endl;
|
||||
realA = Sp_TwoIndex<this_nc, AntiSymmetric>::Dimension + Sp_TwoIndex<this_nc, Symmetric>::Dimension;
|
||||
assert ( realA == this_nc * this_nc - 1); // Nc x Nc = dim(2indxS) + dim(2indxAS) + dim(singlet)
|
||||
|
||||
std::cout << GridLogMessage << "checking base is symmetric " << std::endl;
|
||||
for (int a=0; a < this_irrep_dim; a++)
|
||||
{
|
||||
Sp_TwoIndex<this_nc, Symmetric>::base(a, eij_c);
|
||||
e_sum = eij_c - transpose(eij_c);
|
||||
std::cout << GridLogMessage << "e_ab - e_ab^T " << norm2(e_sum) << std::endl;
|
||||
assert(norm2(e_sum) < 1e-8);
|
||||
}
|
||||
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, Symmetric>::Dimension; a++) {
|
||||
Sp_TwoIndex<this_nc, Symmetric>::base(a, eij_a);
|
||||
realA = norm2(trace(Omega*eij_a));
|
||||
std::cout << GridLogMessage << "Omega trace for (ab) = " << a << std::endl;
|
||||
assert(realA == 0);
|
||||
for (int b=0; b < Sp_TwoIndex<this_nc, Symmetric>::Dimension; b++) {
|
||||
Sp_TwoIndex<this_nc, Symmetric>::base(b, eij_b);
|
||||
auto d_ab = TensorRemove(trace(eij_a * eij_b));
|
||||
#if verbose
|
||||
std::cout << GridLogMessage << "Tr( e_{ab=" << a << "} e_{cd=" << b << "} ) = " << d_ab << std::endl;
|
||||
#endif
|
||||
std::cout << GridLogMessage << "Orthonormality for (ab) = " << a << std::endl;
|
||||
if (a==b) {
|
||||
assert(real(d_ab)-1 < 1e-8);
|
||||
assert(imag(d_ab) < 1e-8);
|
||||
} else {
|
||||
assert(real(d_ab) < 1e-8);
|
||||
assert(imag(d_ab) < 1e-8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int sum = 0;
|
||||
int sum_im = 0;
|
||||
Vector<Matrix> ta_fund(this_algebra_dim);
|
||||
Vector<Matrix> eij(this_irrep_dim);
|
||||
Matrix tmp_l;
|
||||
Matrix tmp_r;
|
||||
for (int n = 0; n < this_algebra_dim; n++)
|
||||
{
|
||||
Sp<this_nc>::generator(n, ta_fund[n]);
|
||||
}
|
||||
for (int a = 0; a < this_irrep_dim; a++)
|
||||
{
|
||||
Sp_TwoIndex<this_nc, Symmetric>::base(a, eij[a]);
|
||||
}
|
||||
for (int gen_id = 0; gen_id < this_algebra_dim; gen_id++)
|
||||
{
|
||||
Complex iTr;
|
||||
sum = 0;
|
||||
sum_im = 0;
|
||||
std::cout << GridLogMessage << "generator number " << gen_id << std::endl;
|
||||
for (int a = 0; a < this_irrep_dim; a++)
|
||||
{
|
||||
|
||||
tmp_l = adj(eij[a])*ta_fund[gen_id]*eij[a];
|
||||
tmp_r = adj(eij[a])*eij[a]*transpose(ta_fund[gen_id]);
|
||||
#if verbose
|
||||
std::cout << GridLogMessage << " as_indx = " << a << " eDag T_F e = " << std::endl << tmp_l << std::endl;
|
||||
std::cout << GridLogMessage << " as_indx = " << a << " eDag e T_F^T = " << std::endl << tmp_r << std::endl;
|
||||
#endif
|
||||
std::cout << GridLogMessage << " as_indx = " << a << " Tr(sum) = " << TensorRemove(trace(tmp_l+tmp_r)) << std::endl;
|
||||
sum += real(TensorRemove(trace(tmp_l+tmp_r)));
|
||||
sum_im += imag(TensorRemove(trace(tmp_l+tmp_r)));
|
||||
}
|
||||
std::cout << GridLogMessage << "re-evaluated trace of the generator " << gen_id << " is " << sum << " " << sum_im << std::endl;
|
||||
assert ( sum < 1e-8) ;
|
||||
assert ( sum_im < 1e-8) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
std::cout << GridLogMessage << "Checking AntiSymmetric base " << std::endl;
|
||||
antisymm_base();
|
||||
std::cout << GridLogMessage << "*************** " << std::endl;
|
||||
std::cout << GridLogMessage << "Checking Symmetric base " << std::endl;
|
||||
symm_base();
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ using namespace Grid;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
Grid_init(&argc, &argv);
|
||||
|
||||
|
||||
std::cout << GridLogMessage << "*********************************************"
|
||||
<< std::endl;
|
||||
std::cout << GridLogMessage << "* Generators for Sp(2) (print and test)" << std::endl;
|
||||
@ -39,6 +39,15 @@ int main(int argc, char** argv) {
|
||||
|
||||
Sp8::testGenerators();
|
||||
|
||||
std::cout << GridLogMessage << "*********************************************"
|
||||
<< std::endl;
|
||||
std::cout << GridLogMessage << "* Generators for Sp(2) TwoIndexS (print & test)" << std::endl;
|
||||
std::cout << GridLogMessage << "*********************************************"
|
||||
<< std::endl;
|
||||
|
||||
Sp_TwoIndex<2, Symmetric>::printGenerators();
|
||||
Sp_TwoIndex<2, Symmetric>::testGenerators();
|
||||
|
||||
std::cout << GridLogMessage << "*********************************************"
|
||||
<< std::endl;
|
||||
std::cout << GridLogMessage << "* Generators for Sp(4) TwoIndexAS (test)" << std::endl;
|
||||
@ -47,6 +56,14 @@ int main(int argc, char** argv) {
|
||||
|
||||
Sp_TwoIndex<4, AntiSymmetric>::testGenerators();
|
||||
|
||||
std::cout << GridLogMessage << "*********************************************"
|
||||
<< std::endl;
|
||||
std::cout << GridLogMessage << "* Generators for Sp(4) TwoIndexS (test)" << std::endl;
|
||||
std::cout << GridLogMessage << "*********************************************"
|
||||
<< std::endl;
|
||||
|
||||
Sp_TwoIndex<4, Symmetric>::testGenerators();
|
||||
|
||||
std::cout << GridLogMessage << "*********************************************"
|
||||
<< std::endl;
|
||||
std::cout << GridLogMessage << "* Generators for Sp(6) TwoIndexAS (test)" << std::endl;
|
||||
@ -54,6 +71,14 @@ int main(int argc, char** argv) {
|
||||
<< std::endl;
|
||||
|
||||
Sp_TwoIndex<6, AntiSymmetric>::testGenerators();
|
||||
|
||||
std::cout << GridLogMessage << "*********************************************"
|
||||
<< std::endl;
|
||||
std::cout << GridLogMessage << "* Generators for Sp(6) TwoIndexS (test)" << std::endl;
|
||||
std::cout << GridLogMessage << "*********************************************"
|
||||
<< std::endl;
|
||||
|
||||
Sp_TwoIndex<6, Symmetric>::testGenerators();
|
||||
|
||||
std::cout << GridLogMessage << "*********************************************"
|
||||
<< std::endl;
|
||||
@ -62,6 +87,14 @@ int main(int argc, char** argv) {
|
||||
<< std::endl;
|
||||
|
||||
Sp_TwoIndex<8, AntiSymmetric>::testGenerators();
|
||||
|
||||
std::cout << GridLogMessage << "*********************************************"
|
||||
<< std::endl;
|
||||
std::cout << GridLogMessage << "* Generators for Sp(8) TwoIndexS (test)" << std::endl;
|
||||
std::cout << GridLogMessage << "*********************************************"
|
||||
<< std::endl;
|
||||
|
||||
Sp_TwoIndex<8, Symmetric>::testGenerators();
|
||||
|
||||
Grid_finalize();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user