<commit_before>#include <math.h>
#include <complex.h>
#include <string.h>

#include <qmp.h>
#include <lhpc-aff.h>

#include <qlua.h>                                                   /* DEPS */
#include <aff_io.h>                                                 /* DEPS */
#include <extras.h>                                                 /* DEPS */

static double complex
calc_exp_iphase(const int coord[], const int c0[], 
                const int latsize[], const int mom[])
{
    double phase = 0.;
    int i;
    for (i = 0; i < 4; i++)
        phase += mom[i] * (double)(coord[i] - c0[i]) / latsize[i];
    phase *= 2 * M_PI;
    return cos(phase) + I * sin(phase) ;
}


/* gamma matrix parameterization for left multiplication:
   Gamma_n [i,j] = gamma_coeff[n][i] * \delta_{i,gamma_ind[n][i]}
            
            v[0]    a[0]*v[I[0]]
    Gamma * v[1] =  a[1]*v[I[1]]
            v[2]    a[2]*v[I[2]]
            v[3]    a[3]*v[I[3]]
    or
    (Gamma * X)_{ik} = a[i] * X[I[i],k]
 */
double complex gamma_left_coeff[16][4] = {
    { 1, 1, 1, 1 },             /* G0 = 1 */
    { I, I,-I,-I },             /* G1 = g1 */
    {-1, 1, 1,-1 },             /* G2 = g2 */
    {-I, I,-I, I },             /* G3 = g1 g2 */
    { I,-I,-I, I },             /* G4 = g3 */
    {-1, 1,-1, 1 },             /* G5 = g1 g3 */
    {-I,-I,-I,-I },             /* G6 = g2 g3 */
    { 1, 1,-1,-1 },             /* G7 = g1 g2 g3 */
    { 1, 1, 1, 1 },             /* G8 = g4 */
    { I, I,-I,-I },             /* G9 = g1 g4 */
    {-1, 1, 1,-1 },             /* G10= g2 g4 */
    {-I, I,-I, I },             /* G11= g1 g2 g4 */
    { I,-I,-I, I },             /* G12= g3 g4 */
    {-1, 1,-1, 1 },             /* G13= g1 g3 g4 */
    {-I,-I,-I,-I },             /* G14= g2 g3 g4 */
    { 1, 1,-1,-1 },             /* G15= g1 g2 g3 g4 */
};
int gamma_left_ind[16][4] = {
    { 0, 1, 2, 3 },             /* G0 = 1 */
    { 3, 2, 1, 0 },             /* G1 = g1 */
    { 3, 2, 1, 0 },             /* G2 = g2 */
    { 0, 1, 2, 3 },             /* G3 = g1 g2 */
    { 2, 3, 0, 1 },             /* G4 = g3 */
    { 1, 0, 3, 2 },             /* G5 = g1 g3 */
    { 1, 0, 3, 2 },             /* G6 = g2 g3 */
    { 2, 3, 0, 1 },             /* G7 = g1 g2 g3 */
    { 2, 3, 0, 1 },             /* G8 = g4 */
    { 1, 0, 3, 2 },             /* G9 = g1 g4 */
    { 1, 0, 3, 2 },             /* G10= g2 g4 */
    { 2, 3, 0, 1 },             /* G11= g1 g2 g4 */
    { 0, 1, 2, 3 },             /* G12= g3 g4 */
    { 3, 2, 1, 0 },             /* G13= g1 g3 g4 */
    { 3, 2, 1, 0 },             /* G14= g2 g3 g4 */
    { 0, 1, 2, 3 },             /* G15= g1 g2 g3 g4 */
};


/* optimized version of building blocks 
   compute tr(B^+ \Gamma_n F) [n=0..15] and projects on n_qext momenta
   select time interval [tsrc: tsnk] and does time reversal if time_rev==1
   save results to aff_w[aff_kpath . 'g%d/qx%d_qy%d_qz%d']
   Parameters:
    csrc = { xsrc, ysrc, zsrc, tsrc }
    tsnk
    qext[4 * i_qext + dir]  ext.mom components
    time_rev ==0 for proton_3, ==1 for proton_negpar_3
    bc_baryon_t =+/-1 boundary condition for baryon 2pt[sic!] function; =bc_quark^3
 */
const char *
save_bb(lua_State *L,
        mAffWriter *aff_w,
        const char *aff_kpath,
        QDP_DiracPropagator *F,
        QDP_DiracPropagator *B,
        const int *csrc,             /* [qRank] */
        int tsnk,
        int n_mom,
        const int *mom,             /* [n_mom][qRank] */
        int time_rev,                /* 1 to reverse, 0 to not */
        int t_axis,                  /* 0-based */
        double bc_baryon_t)
{
#define get_mom(mom_list, i_mom) ((mom_list) + 4*(i_mom))
    if (4 != QDP_ndim() || 
            4 != QDP_Ns ||
            3 != QDP_Nc ||<commit_msg>fix to build of Bugle frontend<commit_after>#include <math.h>
#include <complex.h>
#include <string.h>

#include <qmp.h>
#include <lhpc-aff.h>

#include <qlua.h>                                                   /* DEPS */
#include <aff_io.h>                                                 /* DEPS */
#include <extras.h>                                                 /* DEPS */

static double complex
calc_exp_iphase(const int coord[], const int c0[], 
                const int latsize[], const int mom[])
{
    double phase = 0.;
    int i;
    for (i = 0; i < 4; i++)
        phase += mom[i] * (double)(coord[i] - c0[i]) / latsize[i];
    phase *= 2 * M_PI;
    return cos(phase) + I * sin(phase) ;
}




/* optimized version of building blocks 
   compute tr(B^+ \Gamma_n F) [n=0..15] and projects on n_qext momenta
   select time interval [tsrc: tsnk] and does time reversal if time_rev==1
   save results to aff_w[aff_kpath . 'g%d/qx%d_qy%d_qz%d']
   Parameters:
    csrc = { xsrc, ysrc, zsrc, tsrc }
    tsnk
    qext[4 * i_qext + dir]  ext.mom components
    time_rev ==0 for proton_3, ==1 for proton_negpar_3
    bc_baryon_t =+/-1 boundary condition for baryon 2pt[sic!] function; =bc_quark^3
 */
const char *
save_bb(lua_State *L,
        mAffWriter *aff_w,
        const char *aff_kpath,
        QDP_DiracPropagator *F,
        QDP_DiracPropagator *B,
        const int *csrc,             /* [qRank] */
        int tsnk,
        int n_mom,
        const int *mom,             /* [n_mom][qRank] */
        int time_rev,                /* 1 to reverse, 0 to not */
        int t_axis,                  /* 0-based */
        double bc_baryon_t)
{
    /* gamma matrix parameterization for left multiplication:
       Gamma_n [i,j] = gamma_coeff[n][i] * \delta_{i,gamma_ind[n][i]}
                
                v[0]    a[0]*v[I[0]]
        Gamma * v[1] =  a[1]*v[I[1]]
                v[2]    a[2]*v[I[2]]
                v[3]    a[3]*v[I[3]]
        or
        (Gamma * X)_{ik} = a[i] * X[I[i],k]
     */
    double complex gamma_left_coeff[16][4] = {
        { 1, 1, 1, 1 },             /* G0 = 1 */
        { I, I,-I,-I },             /* G1 = g1 */
        {-1, 1, 1,-1 },             /* G2 = g2 */
        {-I, I,-I, I },             /* G3 = g1 g2 */
        { I,-I,-I, I },             /* G4 = g3 */
        {-1, 1,-1, 1 },             /* G5 = g1 g3 */
        {-I,-I,-I,-I },             /* G6 = g2 g3 */
        { 1, 1,-1,-1 },             /* G7 = g1 g2 g3 */
        { 1, 1, 1, 1 },             /* G8 = g4 */
        { I, I,-I,-I },             /* G9 = g1 g4 */
        {-1, 1, 1,-1 },             /* G10= g2 g4 */
        {-I, I,-I, I },             /* G11= g1 g2 g4 */
        { I,-I,-I, I },             /* G12= g3 g4 */
        {-1, 1,-1, 1 },             /* G13= g1 g3 g4 */
        {-I,-I,-I,-I },             /* G14= g2 g3 g4 */
        { 1, 1,-1,-1 },             /* G15= g1 g2 g3 g4 */
    };
    int gamma_left_ind[16][4] = {
        { 0, 1, 2, 3 },             /* G0 = 1 */
        { 3, 2, 1, 0 },             /* G1 = g1 */
        { 3, 2, 1, 0 },             /* G2 = g2 */
        { 0, 1, 2, 3 },             /* G3 = g1 g2 */
        { 2, 3, 0, 1 },             /* G4 = g3 */
        { 1, 0, 3, 2 },             /* G5 = g1 g3 */
        { 1, 0, 3, 2 },             /* G6 = g2 g3 */
        { 2, 3, 0, 1 },             /* G7 = g1 g2 g3 */
        { 2, 3, 0, 1 },             /* G8 = g4 */
        { 1, 0, 3, 2 },             /* G9 = g1 g4 */
        { 1, 0, 3, 2 },             /* G10= g2 g4 */
        { 2, 3, 0, 1 },             /* G11= g1 g2 g4 */
        { 0, 1, 2, 3 },             /* G12= g3 g4 */
        { 3, 2, 1, 0 },             /* G13= g1 g3 g4 */
        { 3, 2, 1, 0 },             /* G14= g2 g3 g4 */
        { 0, 1, 2, 3 },             /* G15= g1 g2 g3 g4 */
    };
#define get_mom(mom_list, i_mom) ((mom_list) + 4*(i_mom))
    if (4 != QDP_ndim() || 
            4 != QDP_Ns ||
            3 != QDP_Nc ||
{'fraction_non_alphanumeric': 0.18356484486563676, 'fraction_numerical': 0.06465013631052836, 'mean_word_length': 1.1164835164835165, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 13, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5475680', 'n_tokens_mistral': 3255, 'n_tokens_neox': 2952, 'n_words': 799}