Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable code to compile with arbitrary Nc and Nd. #52

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 47 additions & 65 deletions lib/meas/glue/mesplq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace Chroma


template<typename Q>
void MesPlq_t(const multi1d<Q>& u,
void MesPlq(const multi1d<Q>& u,
multi2d<Double>& plane_plaq, Double& link)
{
START_CODE();
Expand All @@ -41,10 +41,10 @@ namespace Chroma
// This is the the longer way to write the 1-liner in the else clause

/* tmp_0 = u(x+mu,nu)*u_dag(x+nu,mu) */
LatticeColorMatrix tmp_0 = shift(u[nu],FORWARD,mu) * adj(shift(u[mu],FORWARD,nu));
Q tmp_0 = shift(u[nu],FORWARD,mu) * adj(shift(u[mu],FORWARD,nu));

/* tmp_1 = tmp_0*u_dag(x,nu)=u(x+mu,nu)*u_dag(x+nu,mu)*u_dag(x,nu) */
LatticeColorMatrix tmp_1 = tmp_0 * adj(u[nu]);
Q tmp_1 = tmp_0 * adj(u[nu]);

/* tmp = sum(tr(u(x,mu)*tmp_1=u(x,mu)*u(x+mu,nu)*u_dag(x+nu,mu)*u_dag(x,nu))) */
Double tmp = sum(real(trace(u[mu]*tmp_1)));
Expand Down Expand Up @@ -80,17 +80,6 @@ namespace Chroma
END_CODE();
}

void MesPlq(const multi1d<LatticeColorMatrixF3>& u,
multi2d<Double>& plane_plaq, Double& link)
{
MesPlq_t(u,plane_plaq, link);
}

void MesPlq(const multi1d<LatticeColorMatrixD3>& u,
multi2d<Double>& plane_plaq, Double& link)
{
MesPlq_t(u,plane_plaq, link);
}

//! Return the value of the average plaquette normalized to 1
/*!
Expand All @@ -104,7 +93,7 @@ namespace Chroma
* \param link space-time average link (Write)
*/
template<typename Q>
void MesPlq_t(const multi1d<Q>& u,
void MesPlq(const multi1d<Q>& u,
Double& w_plaq, Double& s_plaq, Double& t_plaq,
multi2d<Double>& plane_plaq,
Double& link)
Expand Down Expand Up @@ -143,21 +132,6 @@ namespace Chroma
END_CODE();
}

void MesPlq(const multi1d<LatticeColorMatrixF3>& u,
Double& w_plaq, Double& s_plaq, Double& t_plaq,
multi2d<Double>& plane_plaq,
Double& link)
{
MesPlq_t(u,w_plaq,s_plaq,t_plaq, plane_plaq, link);
}

void MesPlq(const multi1d<LatticeColorMatrixD3>& u,
Double& w_plaq, Double& s_plaq, Double& t_plaq,
multi2d<Double>& plane_plaq,
Double& link)
{
MesPlq_t(u,w_plaq,s_plaq,t_plaq, plane_plaq, link);
}

//! Return the value of the average plaquette normalized to 1
/*!
Expand All @@ -170,29 +144,6 @@ namespace Chroma
* \param link space-time average link (Write)
*/

void MesPlq(const multi1d<LatticeColorMatrixF3>& u,
Double& w_plaq, Double& s_plaq, Double& t_plaq, Double& link)
{
START_CODE();

multi2d<Double> plane_plaq;

MesPlq(u, w_plaq, s_plaq, t_plaq, plane_plaq, link);

END_CODE();
}

void MesPlq(const multi1d<LatticeColorMatrixD3>& u,
Double& w_plaq, Double& s_plaq, Double& t_plaq, Double& link)
{
START_CODE();

multi2d<Double> plane_plaq;

MesPlq(u, w_plaq, s_plaq, t_plaq, plane_plaq, link);

END_CODE();
}

//! Print the value of the average plaquette normalized to 1
/*!
Expand All @@ -203,7 +154,7 @@ namespace Chroma
* \param u gauge field (Read)
*/
template<typename Q>
void MesPlq_t(XMLWriter& xml,
void MesPlq(XMLWriter& xml,
const std::string& xml_group,
const multi1d<Q>& u)
{
Expand Down Expand Up @@ -264,18 +215,49 @@ namespace Chroma
END_CODE();
}

void MesPlq(XMLWriter& xml,
const std::string& xml_group,
const multi1d<LatticeColorMatrixF3>& u)
{
MesPlq_t(xml, xml_group, u);
}
// ***** Instantiate templates for needed types *******

void MesPlq(XMLWriter& xml,
template void MesPlq(const multi1d<LatticeColorMatrix>& u,
multi2d<Double>& plane_plaq, Double& link);
#if DEFAULT_PRECISION!=64 && QDP_NC==3
template void MesPlq(const multi1d<LatticeColorMatrixD3>& u,
multi2d<Double>& plane_plaq, Double& link);
#endif

template void MesPlq(const multi1d<LatticeColorMatrix>& u,
Double& w_plaq, Double& s_plaq, Double& t_plaq,
multi2d<Double>& plane_plaq,
Double& link);
#if DEFAULT_PRECISION!=64 && QDP_NC==3
template void MesPlq(const multi1d<LatticeColorMatrixD3>& u,
Double& w_plaq, Double& s_plaq, Double& t_plaq,
multi2d<Double>& plane_plaq,
Double& link);
#endif

template<typename Q>
void MesPlq(const multi1d<Q>& u,
Double& w_plaq, Double& s_plaq, Double& t_plaq, Double& link)
{
START_CODE();
multi2d<Double> plane_plaq;
MesPlq(u, w_plaq, s_plaq, t_plaq, plane_plaq, link);
END_CODE();
}
template void MesPlq(const multi1d<LatticeColorMatrix>& u,
Double& w_plaq, Double& s_plaq, Double& t_plaq, Double& link);
#if DEFAULT_PRECISION!=64 && QDP_NC==3
template void MesPlq(const multi1d<LatticeColorMatrixD3>& u,
Double& w_plaq, Double& s_plaq, Double& t_plaq, Double& link);
#endif

template void MesPlq(XMLWriter& xml,
const std::string& xml_group,
const multi1d<LatticeColorMatrix>& u);
#if DEFAULT_PRECISION!=64 && QDP_NC==3
template void MesPlq(XMLWriter& xml,
const std::string& xml_group,
const multi1d<LatticeColorMatrixD3>& u)
{
MesPlq_t(xml, xml_group, u);
}
const multi1d<LatticeColorMatrixD3>& u);
#endif

} // end namespace Chroma
38 changes: 11 additions & 27 deletions lib/meas/glue/mesplq.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,9 @@
namespace Chroma
{

//! Return the value of the average plaquette normalized to 1
/*!
* \ingroup glue
*
* \param u gauge field (Read)
* \param w_plaq plaquette average (Write)
* \param s_plaq space-like plaquette average (Write)
* \param t_plaq time-like plaquette average (Write)
* \param link space-time average link (Write)
*/
void MesPlq(const multi1d<LatticeColorMatrixF3>& u,
Double& w_plaq, Double& s_plaq, Double& t_plaq, Double& link);

void MesPlq(const multi1d<LatticeColorMatrixD3>& u,
Double& w_plaq, Double& s_plaq, Double& t_plaq, Double& link);
template<typename Q>
void MesPlq(const multi1d<Q>& u,
multi2d<Double>& plane_plaq, Double& link);

//! Return the value of the average plaquette normalized to 1
/*!
Expand All @@ -34,15 +22,14 @@ namespace Chroma
* \param link space-time average link (Write)
*/

void MesPlq(const multi1d<LatticeColorMatrixF3>& u,
Double& w_plaq, Double& s_plaq, Double& t_plaq,
multi2d<Double>& plane_plaq,
Double& link);

void MesPlq(const multi1d<LatticeColorMatrixD3>& u,
template<typename Q>
void MesPlq(const multi1d<Q>& u,
Double& w_plaq, Double& s_plaq, Double& t_plaq,
multi2d<Double>& plane_plaq,
Double& link);
template<typename Q>
void MesPlq(const multi1d<Q>& u,
Double& w_plaq, Double& s_plaq, Double& t_plaq, Double& link);

//! Print the value of the average plaquette normalized to 1
/*!
Expand All @@ -51,13 +38,10 @@ namespace Chroma
* \param xml plaquette average (Write)
* \param u gauge field (Read)
*/
void MesPlq(XMLWriter& xml,
const std::string& xml_group,
const multi1d<LatticeColorMatrixF3>& u);

void MesPlq(XMLWriter& xml,
template<typename Q>
void MesPlq(XMLWriter& xml,
const std::string& xml_group,
const multi1d<LatticeColorMatrixD3>& u);
const multi1d<Q>& u);

} // end namespace Chroma

Expand Down
38 changes: 15 additions & 23 deletions lib/meas/glue/polylp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ namespace Chroma
* \param mu direction of Polyakov loop (Read)
*/
template<typename Q>
void polylp_t(const multi1d<Q>& u, DComplex& poly_loop, int mu)
void polylp(const multi1d<Q>& u, DComplex& poly_loop, int mu)
{
START_CODE();

// Initial Polyakov loop
LatticeColorMatrix poly = u[mu];
Q poly = u[mu];

for(int n = 1; n < Layout::lattSize()[mu]; ++n) // run over all links in mu dir
{
LatticeColorMatrix tmp = shift(poly, FORWARD, mu);
Q tmp = shift(poly, FORWARD, mu);
poly = u[mu] * tmp;
}

Expand All @@ -36,17 +36,6 @@ namespace Chroma
END_CODE();
}


void polylp(const multi1d<LatticeColorMatrixF3>& u, DComplex& poly_loop, int mu)
{
polylp_t( u, poly_loop, mu);
}

void polylp(const multi1d<LatticeColorMatrixD3>& u, DComplex& poly_loop, int mu)
{
polylp_t(u, poly_loop, mu);
}

//! Compute Polyakov loop
/*!
* \ingroup glue
Expand All @@ -55,7 +44,7 @@ namespace Chroma
* \param poly_loop Polyakov loop average (Write)
*/
template<typename Q>
void polylp_t(const multi1d<Q>& u, multi1d<DComplex>& poly_loop)
void polylp(const multi1d<Q>& u, multi1d<DComplex>& poly_loop)
{
START_CODE();

Expand All @@ -68,13 +57,16 @@ namespace Chroma
}


void polylp(const multi1d<LatticeColorMatrixF3>& u, multi1d<DComplex>& poly_loop)
{
polylp_t(u,poly_loop);
}
// ***** Instantiate templates for needed types *******

template void polylp(const multi1d<LatticeColorMatrix>& u, DComplex& poly_loop, int mu);
#if DEFAULT_PRECISION!=64 && QDP_NC==3
template void polylp(const multi1d<LatticeColorMatrixD3>& u, DComplex& poly_loop, int mu);
#endif

template void polylp(const multi1d<LatticeColorMatrix>& u, multi1d<DComplex>& poly_loop);
#if DEFAULT_PRECISION!=64 && QDP_NC==3
template void polylp(const multi1d<LatticeColorMatrixD3>& u, multi1d<DComplex>& poly_loop);
#endif

void polylp(const multi1d<LatticeColorMatrixD3>& u, multi1d<DComplex>& poly_loop)
{
polylp_t(u,poly_loop);
}
} // end namespace Chroma
9 changes: 4 additions & 5 deletions lib/meas/glue/polylp.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ namespace Chroma
* \param mu direction of Polyakov loop (Read)
*/

void polylp(const multi1d<LatticeColorMatrixF3>& u, DComplex& poly_loop, int mu);

void polylp(const multi1d<LatticeColorMatrixD3>& u, DComplex& poly_loop, int mu);
template<typename Q>
void polylp(const multi1d<Q>& u, DComplex& poly_loop, int mu);

//! Compute Polyakov loop
/*!
Expand All @@ -30,8 +29,8 @@ namespace Chroma
* \param poly_loop Polyakov loop average (Write)
*/

void polylp(const multi1d<LatticeColorMatrixF3>& u, multi1d<DComplex>& poly_loop);
void polylp(const multi1d<LatticeColorMatrixD3>& u, multi1d<DComplex>& poly_loop);
template<typename Q>
void polylp(const multi1d<Q>& u, multi1d<DComplex>& poly_loop);

} // end namespace Chroma

Expand Down
Loading