auto_contractor.runtime — Runtime for Compiled Expression Evaluation¶
Source: qlat/auto_contractor/runtime.py
Note: Update this document when updating the source file.
Outline¶
Overview¶
runtime re-exports the symbols needed at runtime by compiled auto-contractor
expressions (CExpr). When a CExpr is evaluated, it uses functions and types
from this module to load propagators, perform matrix arithmetic, and compute
traces. Importing this module ensures all required runtime dependencies are
available.
Exported Names¶
NumPy and Timers¶
Name |
Source |
Description |
|---|---|---|
|
|
NumPy array library |
|
|
Scope-based timer decorator |
|
|
Timer with FLOPS counting |
AMA Utilities¶
Name |
Source |
Description |
|---|---|---|
|
|
Accumulate multi-shift solver results |
|
|
Apply AMA correction to a single result |
|
|
Count AMA samples |
|
|
Extract corrected value from AMA list |
Matrix Types¶
Name |
Source |
Description |
|---|---|---|
|
|
\(4\times3\) spin-color matrix (propagator element) |
|
|
\(4\times4\) spin matrix (gamma matrices) |
|
|
\(3\times3\) color matrix (gauge links) |
Matrix Operations¶
All mat_* functions are low-level C++ routines exposed via qlat_utils:
Trace operations:
Function |
Description |
|---|---|
|
Trace of SpinMatrix |
|
Trace of ColorMatrix |
|
Trace of WilsonMatrix |
|
Trace of product \(\mathrm{tr}(A \cdot B)\), both WilsonMatrix |
|
Trace of WilsonMatrix times SpinMatrix |
|
Trace of SpinMatrix times WilsonMatrix |
|
Trace of SpinMatrix times SpinMatrix |
|
Trace of WilsonMatrix times ColorMatrix |
|
Trace of ColorMatrix times WilsonMatrix |
|
Trace of ColorMatrix times ColorMatrix |
Multiplication operations:
Function |
Description |
|---|---|
|
Scalar times WilsonMatrix |
|
Scalar times SpinMatrix |
|
Scalar times ColorMatrix |
|
WilsonMatrix times WilsonMatrix |
|
WilsonMatrix times SpinMatrix |
|
SpinMatrix times WilsonMatrix |
|
SpinMatrix times SpinMatrix |
|
WilsonMatrix times ColorMatrix |
|
ColorMatrix times WilsonMatrix |
|
ColorMatrix times ColorMatrix |
Addition operations:
Function |
Description |
|---|---|
|
WilsonMatrix + WilsonMatrix |
|
SpinMatrix + SpinMatrix |
|
ColorMatrix + ColorMatrix |
Special operations:
Function |
Description |
|---|---|
|
\(\epsilon_{ijk}\) contraction of three WilsonMatrix objects |
Gamma and Propagator Utilities¶
Function |
Description |
|---|---|
|
Load a propagator from disk |
|
Get gamma matrix by tag (0–3, 5) |
|
Compute \(\gamma_5 m^\dagger \gamma_5\) |
Auto-contractor Functions¶
Name |
Description |
|---|---|
|
|
Usage¶
The runtime module is typically imported by compiled expression code, not directly by users:
from qlat.auto_contractor.runtime import *
Examples¶
import qlat as q
q.begin_with_mpi([[1, 1, 1, 4]])
from qlat.auto_contractor.runtime import (
WilsonMatrix, SpinMatrix, get_gamma_matrix,
mat_tr_wm_wm, mat_mul_wm_sm,
)
# Create a WilsonMatrix and multiply by gamma_5
wm = WilsonMatrix()
g5 = get_gamma_matrix(5)
result = mat_mul_wm_sm(wm, g5)
trace = mat_tr_wm_wm(result, wm)
q.end_with_mpi()