Usage in C++

The usage of HepLib is similar to other C++ library by including the proper header files in the C++ source code, compiling the program and linking with HepLib and other necessary libraries.

1. Prepare the C++ Code

#include "HepLib.h"
using namespace HepLib;
int main(int argc, char** argv) {
    Index mu("mu"), nu("nu");
    Vector p1("p1"), p2("p2");
    Symbol m("m");
    //note GAS(1) in gline, corresponds to the identity matrix
    ex gline = GAS(p1)*GAS(mu)*(GAS(p2)+m*GAS(1))*GAS(mu);
    ex trace = form(TR(gline));
    cout << trace << endl;
    return 0;
}

The above code trace.cpp shows how to perform the D-dimensional trace on a Dirac-𝛾 chain:

2. Compile and Run

  • One can compile the trace.cpp using heplib++ and run it as follows:
<INSTALL PATH>/bin/heplib++ -o trace trace.cpp
./trace
# 8*p2.p1+(-4)*D*p2.p1

results matching ""

    No results matching ""