The LHPC library
The LHPC collection is installed under lhpc/ and is reachable because the library path includes that directory: require "lhpc-std" loads the common set, and every other file may be required by name. It is a production measurement library rather than part of the qlua interface — it is written against qlua the way a script is — and it is large: thirty-three files and about three hundred functions. Much of it is layered on latvec, which generalizes the field operations to nested lists of fields, and that is the file to read first.
What each file is for:
| Module | What it is |
|---|
lhpc-std | the common entry point, pulling in the rest | latvec | operations on lists of lattice fields, treated as one vector; the largest file | mdwf_eopc, mdwf_ref | even/odd preconditioned MDWF and a reference implementation | dwf, dwf_split, dwf_bcderiv_split | domain-wall helpers | madcg, madwf_sns | MADCG and MADWF solvers | arnoldi, cg-ritz, defl_util | eigensolvers and deflation-space handling | bb, bb_ml, test_bb | building blocks | hadspec, seqsource, clover-3pt | hadron spectroscopy and sequential sources | npr | non-perturbative renormalization | gaugefix | gauge fixing | fastsmear | smearing | bcderiv, wilson_bcderiv | boundary-condition derivatives | qdpc_io, headers, chroma_xmlheader | I/O and metadata | cps_util, setup_util, debug_util, latvol, split, algo_optimize | utilities | mg_param | multigrid parameters |
The files that define names of their own have a subsection below, in alphabetical order. The rest are data, tests or entry points that define nothing a script calls.
algo_optimize
One function, lifted from Numerical Recipes.
optimize_brent
optimize_brent(ax, bx, cx, f, tol, ITMAX, verbose) --> number, number, number
Brent's one-dimensional minimum search. Given a bracketing triplet — bx between ax and cx, with f(bx) below both ends — it isolates the minimum to a fractional precision of about tol and returns the abscissa, the value there, and how many times f was called.
arnoldi
The Arnoldi iteration on whatever the latvec operations can hold, which is how the deflation code builds a Krylov basis.
latvec_arnoldi
latvec_arnoldi(op, x0, eps, n_iter) --> table, table
The Arnoldi sequence of op starting from x0: the transposed Hessenberg matrix, hessT[i][j] being H[j][i], and the orthonormal vectors that go with it. It stops after n_iter steps, or when the subdiagonal element falls below eps, which defaults to 1e-6.
print_arnoldi_matr
print_arnoldi_matr(m, ndigit) --> nothing
Prints such a matrix, ndigit digits to a part, filling in the zeros that the triangular storage leaves out.
bcderiv
Derivatives with respect to the fermion boundary conditions are carried around in tables keyed by a short string: '' for the field itself, 'x' for one derivative along x, 'xz' for a second derivative, and so on. These four functions are the ones that read and check such a key.
bcderiv.dir_list
bcderiv.dir_list(dd) --> table
The axis numbers of a key: "xz" is {0, 2}. Any character other than x, y, z or t raises.
bcderiv.dir_str
bcderiv.dir_str(...) --> string
The reverse: axis numbers back into a key.
bcderiv.make_ddlist
bcderiv.make_ddlist(ddmap) --> table
The keys of such a table, sorted — the order in which the wrappers walk them, and the same order on every node.
bcderiv.check_ddlist
bcderiv.check_ddlist(ddlist) --> boolean
Whether the list is closed and in order: a key must come after every key with one of its characters taken out, because a derivative is computed from the lower ones.
cg-ritz
cg_ritz
cg_ritz(op_k, op_m, x0, eps, max_iter, do_max) --> number, vector, number
The smallest — or, with do_max, the largest — Ritz value of the pencil (x, op_k x) / (x, op_m x), by conjugate gradient on that ratio (Geradin, J. Sound Vib. 19 (1971) 319). Returns the eigenvalue, the vector that attains it and the number of iterations.
Chroma's XML records, built a piece at a time, so that a propagator written here can be read by a Chroma job. Each returns the fragment named, already indented; the ones that take a sub-record take it as a string.
chroma_xmlheader_anisoparam(t_dir, xi0, nu) --> string
The AnisoParam block. With no t_dir it gives the isotropic default.
chroma_xmlheader_displacement_none() --> string
The Displacement block that displaces nothing.
chroma_xmlheader_gauss_smearing(wup_sigma, wup_n, wup_tdir) --> string
The SmearingParam block for gauge-invariant Gaussian (Wuppertal) smearing of width wup_sigma, wup_n steps, leaving wup_tdir out.
chroma_xmlheader_linksmearing_ape(ape_alpha, ape_n, ape_tdir, ape_accu, ape_maxiter) --> string
The LinkSmearing block for APE smearing with those parameters.
chroma_xmlheader_frwprop_record_info(propsrc_xml, frwprop_xml, config_info) --> string
The record info of a forward propagator: the source record, the propagator record and the configuration's own info, wrapped together.
chroma_xmlheader_seqsource(seqsrc_type, psnk, tsnk, tdir) --> string
The SeqSource block naming the sequential source type, its sink momentum and time slice.
chroma_xmlheader_seqprop(quarkspintype, ferm_act_xml) --> string
The SequentialProp block, carrying the fermion action record inside it.
cps_util
Reading what CPS wrote. CPS stores an even/odd preconditioned field as one field on the whole lattice, with the two sublattices interleaved along the first axis, and writes eigenvectors as a flat stream of reals; these unpick both.
cps_eopc_pack
cps_eopc_pack(L, a, b, sublat) --> field
Two fields living on complementary sublattices packed into one, the way CPS holds an even/odd preconditioned vector. sublat is "even" or "odd" and says which of them a is on.
cps_eopc_unpack
cps_eopc_unpack(L, ab, sublat) --> field, field
The reverse, giving back the two fields.
cps_eopc_unpack_v2
cps_eopc_unpack_v2(L, ab, sublat) --> field, field
The same by a different route — a single shift rather than a pair of scatters — kept because the two were written to be checked against each other.
utest_cps_eopc_pack_unpack
utest_cps_eopc_pack_unpack(L, S) --> nothing
Packs and unpacks random fields from the random state S and prints the differences, which should be zero.
read_cps_evec
read_cps_evec(L, cps_evec_file, L5, nev, evec_prec, evec_sublat) --> table
nev five-dimensional eigenvectors from a CPS eigenvector file: a flat QIO record of reals, read at evec_prec and cut into fermions on the evec_sublat sublattice.
write_cps_evec
write_cps_evec(L, cps_evec_qiofile, L5, nev, evec_prec, evec_sublat, evec) --> nothing
The same set written back out in that layout.
make_coord_index_gold
make_coord_index_gold(L) --> L:Real
The lexicographic index of each site as a real field, the first axis running fastest — the numbering the file format counts in.
make_evec5d_index_gold
make_evec5d_index_gold(L, L5, nev) --> table
A set of eigenvectors whose every component is a known function of its position in the file, so that a reader can be checked against it.
test_cps_evec_print_points
test_cps_evec_print_points(index_cps, index_gold) --> nothing
Prints the two sets at a handful of neighboring points, which shows at once which index is running in the wrong order.
test_cps_evec_print_diff
test_cps_evec_print_diff(index_cps, index_gold, cnt_max) --> nothing
Walks the whole set and prints up to cnt_max places where they differ.
debug_util
Printing enough of a field to see that it is what it should be.
print_colmat_norm_det
print_colmat_norm_det(u, title) --> nothing
Prints the mean and spread of det u and of tr(u·u†) over the lattice — how far one ColorMatrix field has drifted from the group.
print_gauge_norm_det
print_gauge_norm_det(u, title) --> nothing
The same for every link of a gauge field, one line per direction.
check_gauge_norm_det
check_gauge_norm_det(u, tol) --> boolean
The same test without the printing: whether every link is unitary and unimodular to tol, which defaults to 1e-12.
print_gauge_plaquette
print_gauge_plaquette(u, title) --> nothing
Prints the average spatial and temporal plaquette of a gauge field.
print_field_1axis
print_field_1axis(x, axis, title) --> nothing
Prints the norm of a field slice by slice along axis, which is where a source or a solution that has gone wrong shows itself.
debug_mem_print
debug_mem_print(cfg_key, msg) --> nothing
Writes the job's resource usage to <cfg_key>.rusage from the master node and prints qcd.memory_usage.
defl_util
evecs_rawdump_sync
evecs_rawdump_sync(src, dst, io_stride) --> number
Copies an eigenvector raw dump from src to dst, one copier per io_stride nodes, by shelling out to mkdir -p and cp. For moving a deflation space between file systems from inside the job that will use it.
dwf
Domain wall and Mobius fermions: moving between a four-dimensional spinor and the five-dimensional one the operator acts on, and wrapping a five-dimensional solver so that a script can hand it four-dimensional sources. A five-dimensional fermion is a list of L5 DiracFermions. dwf.src_4to5 and dwf.sol_5to4 are the two the solvers use, and are dwf.z4to5 and dwf.y5to4 under other names.
dwf.y4to5
dwf.y4to5(x_4d, L5, opt) --> table
A four-dimensional spinor spread onto the two walls with the Y convention: P₋x on the first slice, P₊x on the last, zero between. opt.zero supplies the zero field, which saves allocating one per call.
dwf.y5to4
dwf.y5to4(x_5d, L5) --> field
The reverse projection: P₋x[1] + P₊x[L5].
dwf.sol_mid
dwf.sol_mid(x_5d, L5) --> field
The midpoint projection, taken from the two slices either side of the middle of the fifth direction — the pseudoscalar density that the residual mass is measured with.
dwf.z4to5
dwf.z4to5(x_4d, L5, opt) --> table
The same spreading with the Z convention, the two projectors the other way round. This is what a source is converted with.
dwf.z5to4
dwf.z5to4(x_5d, L5) --> field
Its projection back to four dimensions.
dwf.reflect_inplace
dwf.reflect_inplace(x_5d, L5) --> nothing
Reverses the order of the slices, in place. As shipped the swap loses one of the two slices it exchanges, so the result is not the reflection.
dwf.reflect
dwf.reflect(x_5d, L5) --> table
A copy reflected the same way, and with the same fault.
dwf.proj_wall
dwf.proj_wall(x, L5new, opt) --> table
The wall part of a five-dimensional fermion: the projected first and last slices kept, the rest replaced by zeros, in a vector of L5new slices. This is how a solution is cut down before it is handed to a shorter operator.
dwf.is_dirferm5d
dwf.is_dirferm5d(x, L5, lat) --> boolean
Whether x really is a list of L5 Dirac fermions, all on the same lattice.
dwf.wrapsolver_dirferm5d
dwf.wrapsolver_dirferm5d(solver_dirferm5d, L5) --> function
A five-dimensional solver wrapped so that it takes and returns four-dimensional objects: a DiracFermion, a DiracPropagator or a list of either is spread onto the walls, solved and projected back.
dwf.mdwf_g5herm_solver_OLD
dwf.mdwf_g5herm_solver_OLD(mdwf_solver, gauge_u, ferm_bc, L5, M5, b5, c5) --> function
The γ₅-Hermitian solver of an earlier generation, kept because results were produced with it. make_calc_mdwf_prop is the same function under its old name, and warns when it is called.
make_mdwf_PV_twisted
make_mdwf_PV_twisted(gauge_u, bc, L5, M5, b5, c5, opt) --> function
A Pauli–Villars solver (mf = 1) built from a Fourier transform in the fifth direction and a twisted-mass solve on each mode, which turns one badly conditioned solve into L5 easy ones. opt takes eps2, maxiter and balance_resid, the last relaxing the tolerance for modes of small norm. Real b5 and c5 only.
dwf_split
What dwf needs when the solver underneath solves several right-hand sides at once.
dwf.print_norm2_arr
dwf.print_norm2_arr(v, fmt, ...) --> nothing
Prints the norm of every member of a list under a formatted label.
dwf.wrapsolver_dirferm5d_list
dwf.wrapsolver_dirferm5d_list(nrhs_max, solver_dirferm5d_split, L5) --> function
dwf.wrapsolver_dirferm5d for a split solver: the four-dimensional objects handed in are taken apart into exactly nrhs_max five-dimensional sources — padded if there are too few — solved in one call, and put back together.
fastsmear
wuppertal_smear_fast_dp
wuppertal_smear_fast_dp(U, alpha, N, G, axis, t0) --> L:DiracPropagator
Wuppertal smearing of a propagator, done by spreading its sixteen color-matrix components along axis and smearing them all in one call. It pays only when the axis is at least sixteen sites long and t0 is given; otherwise it falls back on wuppertal_smear and says which it did.
gaugefix
Landau gauge fixing by relaxation over SU(2) subgroups, with the functional and its gradient exposed so that a different minimizer can be driven with them.
sun_gaugefix_landau
sun_gaugefix_landau(u_orig, gf_accu, gf_max_iter, aniso, or_param, verbose) --> table, L:ColorMatrix, number, number
Fixes a gauge field to Landau gauge to accuracy gf_accu, at most gf_max_iter sweeps. Returns the fixed links, the transformation that produced them, the iterations used and the final value of the functional. aniso is a per-axis weight, and or_param turns on overrelaxation; both may be nil.
sun_gaugefix_landau_relax
sun_gaugefix_landau_relax(g, u, ic, jc, lss, aniso, or_param) --> nothing
One relaxation sweep of the (ic, jc) SU(2) subgroup over the subset lss, updating the transformation g in place.
su2extract(cm, ic,jc) --> table
The four real components of the SU(2) part of a ColorMatrix in rows and columns ic and jc.
su2fill
su2fill(cm, su2, ic,jc) --> nothing
Writes those four components back into cm, in place.
sun_from_su2
sun_from_su2(su2, ic,jc) --> L:ColorMatrix
An SU(n) matrix that is the identity except in rows and columns ic and jc, where it is the given SU(2).
gaugefix_landau_func
gaugefix_landau_func(u) --> number
The Landau gauge functional, the summed real trace of the links. Unnormalized.
gaugefix_landau_grad
gaugefix_landau_grad(u) --> L:ColorMatrix
Its gradient as an algebra element: the traceless anti-Hermitian part of the links and their backward shifts. Unnormalized, so that its entries start out of order one.
hadspec
Two-point contractions, following Chroma's interpolating fields. d and u are propagators, S the diquark spin matrix and T the projector onto the state wanted.
meson_2pt
meson_2pt(d, u, S) --> L:Complex
The meson correlator of the field d̄ S u.
baryon_sigma_2pt
baryon_sigma_2pt(d, u, S, T) --> L:Complex
The sigma-like contraction of (dᵀ S u) u, which reproduces qcd.proton3 for the nucleon choice of S and T.
baryon_lambda_2pt
baryon_lambda_2pt(d, u, S, T) --> L:Complex
The lambda-like contraction, three terms rather than two.
baryon_sigma_st_2pt
baryon_sigma_st_2pt(d, u, S, T) --> L:Complex
The spin-3/2 sigma contraction, the five-term combination Chroma uses for the decuplet.
baryon_lambda_naive_2pt
baryon_lambda_naive_2pt(d, u, S, T) --> L:Complex
The single-term lambda contraction, without the exchange piece.
baryon_xi_2pt
baryon_xi_2pt(d, u, S, T) --> L:Complex
The xi contraction, which is the sigma one with the two quark flavors exchanged.
baryon_c2pt
baryon_c2pt(baryon, d, u) --> L:Complex
Any of them by name — "proton_3", "lambda_5", "sigma_2", "xi_negpar_3" and the rest of the table — with the spin matrices that go with that name supplied for you.
The XML a propagator file carries, as strings.
rbc_ddpairs_header_fermbc(ferm_bc) --> string
The boundary conditions as the letters RBC files use: P for 1 and A for −1, one per axis. Anything else raises.
rbc_ddpairs_header_proptype(mf, tol, ferm_bc, gf_string, ferm_act_string) --> string
The propagator-type record: the mass, the stopping condition, the boundary conditions and the two strings naming the gauge and fermion actions.
rbc_ddpairs_header(srctype_str, proptype_str, ens_id, ens_label, seq_number) --> string
The whole usqcdPropFile record for a DD-pairs file.
scidac_propagator_header(id) --> string
The one-element <propagator><id> record a SciDAC propagator carries.
latvec
The largest file of the collection, and the one the rest is written against. A latvec is any nesting of lists whose leaves are lattice fields — a five-dimensional fermion is a list of L5 DiracFermions, a split source is a list of those — and these functions do to the whole structure what the field operations do to one field, walking it and keeping its shape. A leaf may also be a number or a complex, so that the same arithmetic drives the coefficients of an operator.
latvec.dp2dfl
latvec.dp2dfl(dp, opt) --> table
A DiracPropagator as the list of its twelve DiracFermion columns, spin running fastest. opt.Nc and opt.Ns override the three colors and four spins assumed.
latvec.dfl2dp
latvec.dfl2dp(dfl, opt) --> L:DiracPropagator
The reverse.
latvec.dp2cml
latvec.dp2cml(dp, opt) --> table
The same propagator as sixteen ColorMatrix fields, one per pair of spin indices — the form in which a smearing or a gauge operation can be applied to all of it at once.
latvec.cml2dp
latvec.cml2dp(cml, opt) --> L:DiracPropagator
The reverse of that.
make_random_SUn_gauge
make_random_SUn_gauge(S) --> table
A gauge field of random SU(n) links, each the group projection of a Gaussian color matrix drawn from S.
make_random_dirprop_5d
make_random_dirprop_5d(S, L5) --> table
L5 Gaussian DiracPropagators.
make_random_dirferm_5d
make_random_dirferm_5d(S, L5) --> table
L5 Gaussian DiracFermions.
dw_random_latdirferm
dw_random_latdirferm(L5, rnd) --> table
The same normalized to unit norm over all L5 slices, which is what an iterative solver wants as a starting vector.
make_solver_general
make_solver_general(solver_df, ...) --> function
A DiracFermion solver turned into one that also takes a DiracPropagator, by solving its twelve columns. Each right-hand side is normalized before the solve and the answer scaled back, so that a relative tolerance means the same for every column. Extra arguments given here are passed to the solver ahead of the ones given at the call.
latvec.scal_nontable_
latvec.scal_nontable_(v, scal) --> value
A scaled copy of one leaf, whatever its type. The copy is real: a field is passed through its own constructor rather than shared. With no scal it is a plain copy, and a type that cannot be scaled — a lattice, a string, nil — is passed through.
latvec.copy
latvec.copy(obj, scal, seen, scal_nontable_func) --> value
A deep copy of a whole latvec, optionally scaled, metatables kept and shared subtables shared in the copy as they were in the original. scal_nontable_func replaces what is done to a leaf.
latvec.fromfunction
latvec.fromfunction(dim, func, arg_list) --> table
A nested list of shape dim whose element at (i₁, …, i_N) is func(arg_list…, i₁, …, i_N), the indices counted from zero.
latvec.const
latvec.const(dim, a) --> table
A nested list of that shape filled with copies of a.
make_list_const
make_list_const(a, len) --> table
latvec.const(len, a) under an older name; it says so when called.
latvec.asarray1d
latvec.asarray1d(x, x_len, opt) --> table
A list of exactly x_len elements: a list is checked and passed through, anything else is repeated x_len times. This is how a parameter that may be one number or one per slice — b5, c5 — is made uniform. opt.func is applied to each element on the way. The elements are not copied.
latvec.lattice
latvec.lattice(v, L) --> lattice
The lattice every leaf lives on, raising if they disagree. With L given it checks against that instead, which is the usual way of asserting that two arguments match.
latvec.gather
latvec.gather(gx, what, v) --> value
A gather applied to every leaf, what naming the reduction: "add", "mul", "min", "max", "or", "and" or "xor".
latvec.scatter
latvec.scatter(sx, v) --> value
A scatter applied to every leaf.
latvec.zero_nontable_
latvec.zero_nontable_(v) --> value
The zero of one leaf's type.
latvec.zero_like
latvec.zero_like(obj, seen, zero_nontable_func) --> value
A latvec of the same shape, zero throughout.
latvec.random_nontable_
latvec.random_nontable_(v, rnd) --> value
A random leaf of the same type: Gaussian for a lattice field, uniform in [−1, 1] for a number or a complex.
latvec.random_like
latvec.random_like(obj, rnd, seen) --> value
A latvec of the same shape filled with those.
latvec.norm2
latvec.norm2(v) --> number
The summed square norm of every leaf.
latvec.conj_nontable_
latvec.conj_nontable_(v) --> value
The complex conjugate of one leaf, a real number left alone.
latvec.conj
latvec.conj(v) --> value
That, throughout.
latvec.adjoin
latvec.adjoin(v) --> value
The adjoint of every leaf.
latvec.shift
latvec.shift(v, mu, dir) --> value
Every leaf shifted along mu; dir is what qcd.shift takes.
latvec.add
latvec.add(a, b) --> value
a + b, leaf by leaf; the shapes must match.
latvec.sum
latvec.sum(...) --> value
The sum of several.
latvec.sub
latvec.sub(a, b) --> value
a − b.
latvec.scal_right
latvec.scal_right(a, sc) --> value
a·sc.
latvec.scal_left
latvec.scal_left(sc, a) --> value
sc·a, which for a matrix leaf is not the same thing.
latvec.axpy
latvec.axpy(a, x, y) --> value
a·x + y.
latvec.scalsum_left
latvec.scalsum_left(...) --> value
a₀·x₀ + a₁·x₁ + … from alternating coefficients and latvecs — the workhorse, since it builds the whole combination with one pass and no temporaries beyond the running sum.
latvec.locvdot
latvec.locvdot(x, y) --> value
The site-by-site inner product x†·y of every pair of leaves, as a list of complex fields.
latvec.tocomplex
latvec.tocomplex(v) --> value
Every leaf as a Complex field.
latvec.real
latvec.real(v) --> value
The real part of every leaf.
latvec.imag
latvec.imag(v) --> value
The imaginary part.
latvec.locnorm2
latvec.locnorm2(x) --> value
The site-by-site square norm, as a list of real fields.
latvec.vdot
latvec.vdot(x, y) --> complex
The inner product summed over the whole latvec — one number.
latvec.ortho
latvec.ortho(x, y_b) --> value
x with its component along y_b taken out, normalized. y_b need not be a unit vector.
latvec.set_zero
latvec.set_zero(a) --> nothing
Sets every leaf to zero, in place.
latvec.set
latvec.set(a, b) --> nothing
Copies b into a, leaf by leaf, in place. This is the one to use inside a where.
latvec.apply
latvec.apply(func, a, ...) --> value
func applied to every leaf, with any extra arguments passed on. Most of the rest of this module is a line of this.
latvec.eq
latvec.eq(a, b) --> value
The site-by-site equality mask of every pair of leaves.
latvec.ne
latvec.ne(a, b) --> value
The inequality mask. It prints a line per leaf as it goes, which is a leftover and makes it unpleasant on a large structure.
mask_all
mask_all(a) --> boolean
Whether a mask field is true everywhere.
mask_any
mask_any(a) --> boolean
Whether it is true anywhere.
latvec.all
latvec.all(a) --> boolean
Whether every mask in a latvec of them is true everywhere.
latvec.any
latvec.any(a) --> boolean
Whether any is true anywhere.
field_close
field_close(x, y, rtol, atol) --> field
The mask of the sites where two fields agree, in the sense NumPy's isclose uses: within atol absolutely and within rtol relative to their norms. The defaults are 1e-5 and 1e-8.
field_allclose
field_allclose(x, y, rtol, atol) --> boolean
Whether that holds at every site.
latvec.close
latvec.close(x, y, rtol, atol) --> value
The same mask for every pair of leaves.
latvec.allclose
latvec.allclose(x, y, rtol, atol) --> boolean
Whether the whole latvec agrees everywhere — the usual test at the end of a check.
latvec.eopc_pair_to_single
latvec.eopc_pair_to_single(ss, ss_v1, ss_v2) --> value
Two half-lattice vectors packed into one whole-lattice field: ss_v1 where the subset ss holds and ss_v2, shifted by one site, elsewhere.
latvec.eopc_single_to_pair
latvec.eopc_single_to_pair(ss, v12) --> value, value
The reverse, giving back the two.
latvec.print_eo_norm2
latvec.print_eo_norm2(v, title) --> nothing
Prints the norm of a latvec and its even and odd parts, which is how a preconditioned vector is checked for living where it should.
latvec.cosangle
latvec.cosangle(a, b) --> complex
The normalized overlap ⟨a, b⟩ / (|a|·|b|), or nil if either is zero.
latvec.cosangle_abs
latvec.cosangle_abs(a, b) --> number
Its modulus — 1 when the two are parallel whatever their phase.
latvec.cosangle_arg
latvec.cosangle_arg(a, b) --> number
Its phase.
latvec.cosangle_cosarg
latvec.cosangle_cosarg(a, b) --> number
The cosine of that phase.
latvec.cosangle_sinarg
latvec.cosangle_sinarg(a, b) --> number
Its sine.
latvec.print_cmp
latvec.print_cmp(a, b, title) --> nothing
One line comparing two latvecs: the ratio of their norms and their overlap in polar form. The line a check prints when it wants to say these two are the same vector.
latvec.print_fpclassify
latvec.print_fpclassify(r, opt) --> boolean
Counts the zeros, NaNs and infinities of a real field, and with opt.min_abs or opt.max_abs the entries outside those bounds. Returns whether the field is clean, and with opt.verbose prints what it is not.
latvec.rdiff
latvec.rdiff(a,b) --> number
The relative difference 2|a − b| / (|a| + |b|), and zero when both vanish.
latvec.op_xwilson
latvec.op_xwilson(d, u, is_dag) --> value
The hopping part of the Wilson operator, through qcd.xwilson, applied to every leaf. Mind the sign: it is the term as it stands, not minus it.
latvec.op_xwilson_old
latvec.op_xwilson_old(d, u, is_dag) --> value
The same written out in shifts and projectors, kept to check the compiled one against.
latvec.op_x5
latvec.op_x5(d, mf, is_dag) --> table
The hopping term in the fifth direction, with the chiral projectors and the mass mf at the wrap — the part of a domain wall operator that is not four-dimensional.
latvec.op_clover
latvec.op_clover(d, g_clover, is_dag) --> value
The clover term σ_{μν}·G_{μν} applied to a fermion, g_clover[1+mu][1+nu] being the field strength.
latvec.prop_clover
latvec.prop_clover(g_clover) --> L:DiracPropagator
The same operator as a propagator, which is the matrix it is.
latvec.dslash_wilson
latvec.dslash_wilson(d, u, Mw, is_dag) --> value
The Wilson operator (4 + Mw) − hopping. It agrees with qcd.Clover's D up to the factor 2κ = 1/(4 + Mw).
latvec.dslash_wilson_bcderiv1
latvec.dslash_wilson_bcderiv1(mu, d, u, is_dag) --> value
Its first derivative with respect to the boundary condition phase on the axis mu.
latvec.dslash_wilson_bcderiv2
latvec.dslash_wilson_bcderiv2(mu, d, u, is_dag) --> value
The second derivative.
latvec.dslash_wilson_old
latvec.dslash_wilson_old(d, u, Mw, is_dag) --> value
The same operator over latvec.op_xwilson_old.
latvec.dslash_wilson_clover
latvec.dslash_wilson_clover(d, u, Mw, c_sw, g_clover, is_dag) --> value
The Wilson operator with the clover term added, weighted c_sw/4. The field strength is passed in rather than computed, so that the same one can serve several calls.
latvec.dslash_twisted
latvec.dslash_twisted(d, u, mq, mu, is_dag) --> value
The twisted-mass operator, 4 + mq + i·mu·γ₅ less the hopping term. The adjoint conjugates mq and turns the sign of mu.
latvec.op_mdwf_dminus
latvec.op_mdwf_dminus(x, gauge_u, M5, c5, is_dag) --> value
The D₋ of the Mobius definition, c5·(4 − M5) − 1 less c5 times the hopping term. c5 may be one number or one per slice.
latvec.op_mdwf_mdminus
latvec.op_mdwf_mdminus(x, gauge_u, M5, c5, is_dag) --> value
−D₋, in one qcd.xwilson call per slice rather than two passes, and with a slice whose c5 or whose norm is zero passed through untouched.
latvec.dslash_dwf
latvec.dslash_dwf(d, u, M5, mf, is_dag) --> table
The domain wall operator: (5 − M5) less the four-dimensional hopping term less the fifth-direction one. The sign convention for M5 is qlua's and CPS's, which is not the MDWF library's.
latvec.dslash_moebius
latvec.dslash_moebius(d, u, M5, mf, b5_s, c5_s, is_dag) --> table
The Mobius operator, with b5 and c5 per slice or shared.
latvec.op_mdwf_mdminus_bcderiv1
latvec.op_mdwf_mdminus_bcderiv1(mu, x, u, c5, is_dag) --> value
The first boundary-condition derivative of −D₋ along mu.
latvec.op_mdwf_mdminus_bcderiv2
latvec.op_mdwf_mdminus_bcderiv2(mu, x, u, c5, is_dag) --> value
Its second derivative.
latvec.dslash_moebius_bcderiv1
latvec.dslash_moebius_bcderiv1(mu, x, u, mf, b5_s, c5_s, is_dag) --> table
The first boundary-condition derivative of the Mobius operator along mu.
latvec.dslash_moebius_bcderiv2
latvec.dslash_moebius_bcderiv2(mu, x, u, mf, b5_s, c5_s, is_dag) --> table
Its second derivative.
latvol
Moving data between one field and a list of fields along an axis, which is how a short direction is used to carry several problems at once.
scatter_axis
scatter_axis(axis, c_axis, vlist) --> field
A list of fields packed into one: the slice c_axis of vlist[1+i] becomes the slice c_axis+i of the result, wrapping at the end of the axis. The list may not be longer than the axis.
gather_axis
gather_axis(axis, c_axis, n, v) --> table
The reverse: n fields, the i-th carrying the slice c_axis+i of v moved back to slice c_axis and zero elsewhere.
lhpc-std
The common entry point: require "lhpc-std" pulls in the rest of the collection. What it defines itself is small — sources, a couple of conversions and two things that belong to housekeeping rather than to physics.
timecall
timecall(str, func, ...) --> any
Calls func with the arguments given, prints how long it took under the label str, and passes its results back.
make_source_point
make_source_point(L, csrc) --> L:DiracPropagator
A point source at csrc: the unit color matrix on one site.
make_source
make_source(Z, csrc, wup_a, wup_n, t_axis) --> L:DiracPropagator
A Wuppertal-smeared point source — the point source at csrc smeared with wup_n steps of width wup_a in the background Z, on its own time slice only.
make_srcgrp_point
make_srcgrp_point(L, csrcgrp) --> L:DiracPropagator
One source carrying a point at every position in csrcgrp, which is how a group of sources is solved in a single inversion.
propagator_projected
propagator_projected(sign, mu, src, solver) --> L:DiracPropagator
A propagator solved in the projected basis: the source is split by qcd.right_project along mu, each half solved and halved, and the result put back together. Half the work when the source is an eigenvector of the projector.
calc_mean_squared_radius
calc_mean_squared_radius(density, csrc, t_axis) --> number
The mean square distance from csrc of a density on its time slice, distances taken the short way round the lattice. It reads the lattice from a global L rather than from its argument.
copy_table
copy_table(tab) --> table
A shallow copy. table_copy in stdlib is the one to prefer.
apply_bc
apply_bc(gauge_links, bc) --> nothing
Multiplies the last slice of each axis by bc[1+mu], in place. gauge_apply_boundary in Gauge fields is the one to prefer.
complex2colmat
complex2colmat(c) --> L:ColorMatrix
A complex field as a color matrix, the same value down the diagonal.
complex2dirprop
complex2dirprop(c) --> L:DiracPropagator
The same again as a propagator, diagonal in color and spin.
force_gc
force_gc(title) --> nothing
Runs a full garbage collection and, with a title, prints how much it freed and how long it took.
madcg
The Mobius accelerated domain wall CG of Yin and Mawhinney. Requiring the file prints a warning: it is superseded by dwf, and the action parameters are written into it rather than passed, so the three constructors take the gauge field and nothing else.
make_solver_MADCG
make_solver_MADCG(U) --> function
The MADCG solver: a cheap Mobius operator preconditioning the expensive Shamir one, in the iteration count the file fixes.
make_solver_stdCG_builtin
make_solver_stdCG_builtin(U) --> function
The plain mixed-precision CG of qcd.MDWF.Shamir, timed per call — what MADCG is to be compared against.
make_solver_stdCG
make_solver_stdCG(U) --> function
The same with the five-dimensional residual printed when asked for, which is what the comparison is read from.
mdwf_eopc
The Mobius operator written out in Lua, factor by factor, so that a preconditioner can be checked against it. The factorization is the usual one: A is the five-dimensional diagonal part, B the b5 + c5·X₅ part, F the four-dimensional Wilson hopping term and K the diagonal 2κ_b. Each takes a five-dimensional vector and the action parameters, and is_dag asks for the adjoint; b5_s and c5_s may be one number or a list of L5. None of this is fast — it is the reference the compiled solvers are measured against.
latvec_mdwf_upper
latvec_mdwf_upper(x, rho, sigma) --> table
The cyclic upper two-diagonal matrix with rho on the diagonal and sigma above it, wrapping from the last slice to the first, applied to a five-dimensional vector.
latvec_inv_mdwf_upper_v1verybadlyconditionedrunawayoverflowingwayofdoingthis
latvec_inv_mdwf_upper_v1verybadlyconditionedrunawayoverflowingwayofdoingthis(y, rho, sigma) --> table
Its inverse, by the recursion that divides by sigma — which, as the name says, overflows whenever the off-diagonal is small. Kept as the worked example of how not to do it; it prints the norms as it goes and compares its two expressions for the first slice.
latvec_inv_mdwf_upper_v2
latvec_inv_mdwf_upper_v2(y, rho, sigma) --> table
The same inverse by the recursion that divides by rho instead, which is the one that holds up.
reverse_table
reverse_table(x) --> table
A list in the opposite order, which is how the lower two-diagonal routines are built out of the upper ones.
latvec_mdwf_lower
latvec_mdwf_lower(x, rho, sigma) --> table
The cyclic lower two-diagonal matrix, sigma below the diagonal.
latvec_inv_mdwf_lower
latvec_inv_mdwf_lower(y, rho, sigma) --> table
Its inverse.
scal_conj
scal_conj(x) --> number or complex
The complex conjugate of a scalar, leaving a real number alone — so that the adjoint of an operator can be taken without asking what its coefficients are.
latvec_mdwfA
latvec_mdwfA(d, M5, mf, b5_s, c5_s, is_dag) --> table
A, the five-dimensional part of the operator: b5·(4−M5)+1 on the diagonal and c5·(4−M5)−1 on the off-diagonal, with the sign of mf at the wrap.
latvec_inv_mdwfA
latvec_inv_mdwfA(d, M5, mf, b5_s, c5_s, is_dag) --> table
A⁻¹.
latvec_mdwfB
latvec_mdwfB(d, mf, b5_s, c5_s, is_dag) --> table
B = b5 + c5·X₅, the same shape with the plain coefficients.
latvec_inv_mdwfB
latvec_inv_mdwfB(d, mf, b5_s, c5_s, is_dag) --> table
B⁻¹.
latvec_mdwfF
latvec_mdwfF(d, u, is_dag) --> table
F, minus the four-dimensional Wilson hopping term, applied slice by slice in the background u.
latvec_mdwfK
latvec_mdwfK(d, M5, b5_s, is_dag) --> table
K, multiplication by κ_b = 1/(2(b5·(4−M5)+1)), which is diagonal in the fifth direction but depends on the slice.
latvec_inv_mdwfK
latvec_inv_mdwfK(d, M5, b5_s, is_dag) --> table
K⁻¹, multiplication by 2(b5·(4−M5)+1).
mdwf_eopc_pc0
mdwf_eopc_pc0(d, u, M5, mf, b5_s, c5_s, is_dag) --> raises
The unsymmetrized preconditioned operator. Not written: it raises.
mdwf_eopc_sym2
mdwf_eopc_sym2(d, u, M5, mf, b5_s, c5_s, is_dag) --> table
The sym2 preconditioned operator, 1 − K·(F·B·A⁻¹)²·K⁻¹ — what qlua's own MDWF, Grid and BFM solve. mdwf_eopc_pc2 is the same function under another name.
mdwf_precond_sym2
mdwf_precond_sym2(y, u, M5, mf, b5_s, c5_s) --> table
The right-hand side of the preconditioned system that goes with it, from the right-hand side of the original one.
mdwf_unprecond_sym2
mdwf_unprecond_sym2(y, u, M5, mf, b5_s, c5_s) --> table
The operator of the original system expressed through the preconditioned one, for checking that the two agree.
mdwf_inflate_sym2
mdwf_inflate_sym2(t, y, u, M5, mf, b5_s, c5_s) --> table
The solution of the original system from the solution t of the preconditioned one and the original right-hand side y.
mdwf_eopc_sym2p
mdwf_eopc_sym2p(d, u, M5, mf, b5_s, c5_s, is_dag) --> table
The same preconditioner without the outer K and K⁻¹, 1 − (F·B·A⁻¹)².
mdwf_precond_sym2p
mdwf_precond_sym2p(y, u, M5, mf, b5_s, c5_s) --> table
Its right-hand side.
mdwf_unprecond_sym2p
mdwf_unprecond_sym2p(y, u, M5, mf, b5_s, c5_s) --> table
Its unpreconditioned operator, which here is the operator itself.
mdwf_inflate_sym2p
mdwf_inflate_sym2p(t, y, u, M5, mf, b5_s, c5_s) --> table
Its solution, inflated back.
mdwf_eopc_sym1
mdwf_eopc_sym1(d, u, M5, mf, b5_s, c5_s, is_dag) --> raises
The sym1 preconditioner, 1 − (A⁻¹·F·B)². Written out but left disabled: it raises before it runs.
mdwf_eopc_sym1mit
mdwf_eopc_sym1mit(d, u, M5, mf, b5_s, c5_s, is_dag) --> table
The MIT variant of sym1, 1 − (B·A⁻¹·F)².
make_mdwf_op_ref
make_mdwf_op_ref(bc_U, L5, M5, mf, b5, c5, pctype) --> table
All of the above with the gauge field and the parameters bound in, as a table of one-argument operators — op_A, op_A1, op_B, op_F, op_K, their adjoints and the composites. This is what the obsolete mdwf_ref file provides through globals, and the way to ask for it now.
mdwf_ref
The same reference operators as globals rather than as a table, with the parameters taken from the globals mdwf_M5, mdwf_mf, mdwf_b5, mdwf_c5 and bc_U. Requiring the file prints a warning: make_mdwf_op_ref in mdwf_eopc does this without the globals. A name ending x is the adjoint, 1 the inverse, and 1m in front means 1 − what follows. Each takes a five-dimensional vector and returns one.
op_A
op_A(x) --> table
A.
op_Ax
op_Ax(x) --> table
A†.
op_A1
op_A1(x) --> table
A⁻¹.
op_A1x
op_A1x(x) --> table
A⁻†.
op_B
op_B(x) --> table
B.
op_Bx
op_Bx(x) --> table
B†.
op_B1
op_B1(x) --> table
B⁻¹.
op_B1x
op_B1x(x) --> table
B⁻†.
op_F
op_F(x) --> table
F, the hopping term.
op_Fx
op_Fx(x) --> table
F†.
op_K
op_K(x) --> table
K, multiplication by κ_b.
op_Kx
op_Kx(x) --> table
K†.
op_K1
op_K1(x) --> table
K⁻¹.
op_K1x
op_K1x(x) --> table
K⁻†.
op_BA1
op_BA1(x) --> table
B·A⁻¹.
op_BA1F
op_BA1F(x) --> table
B·A⁻¹·F.
op_BA1K1
op_BA1K1(x) --> table
B·A⁻¹·K⁻¹.
op_A1xBxFx
op_A1xBxFx(x) --> table
A⁻†·B†·F†, the adjoint of F·B·A⁻¹.
op_A1xBx
op_A1xBx(x) --> table
A⁻†·B†.
op_1mBA1F
op_1mBA1F(x) --> table
1 − B·A⁻¹·F.
op_1mF
op_1mF(x) --> table
1 − F.
op_1mFx
op_1mFx(x) --> table
1 − F†.
op_1mKF
op_1mKF(x) --> table
1 − K·F.
op_1mK1xA1xBxFx
op_1mK1xA1xBxFx(x) --> table
1 − K⁻†·A⁻†·B†·F†.
mg_param
check_mg_param
check_mg_param(mg_param, opt) --> boolean
Checks a multigrid parameter table before a solver is built from it. With opt.network given it raises unless every level's lattice divides by the process grid, which is the mistake that would otherwise surface inside the solver.
qdpc_io
Opening a QDP/C file and reading or writing one record, with the error check written out. Every one of these prints the file name and calls os.exit(1) if the operation fails, so a script need not test the return. See QDP/C files (QIO) for what the arguments mean.
open_qdpc_write
open_qdpc_write(L, name, finfo, volfmt, param) --> Writer
A qcd.qdpc.Writer, or exit.
save_qdpc_dirferm
save_qdpc_dirferm(L, fields, name, finfo, rinfo, volfmt, param) --> nothing
Writes one DiracFermion record and closes the file.
save_qdpc_colmat
save_qdpc_colmat(L, fields, name, finfo, rinfo, volfmt, param) --> nothing
The same for ColorMatrix.
save_qdpc_dirprop
save_qdpc_dirprop(L, fields, name, finfo, rinfo, volfmt, param) --> nothing
The same for DiracPropagator.
save_qdpc_gauge
save_qdpc_gauge(L, fields, name, finfo, rinfo, volfmt, param) --> nothing
The same for a gauge field, which is a list of ColorMatrix fields in one record.
open_qdpc_read
open_qdpc_read(L, name, param) --> Reader, string
A qcd.qdpc.Reader and the file info, or exit.
load_qdpc_dirferm
load_qdpc_dirferm(L, name, param) --> field, string, string
One DiracFermion record, with the file and record info.
load_qdpc_colmat
load_qdpc_colmat(L, name, param) --> field, string, string
One ColorMatrix record, the same way.
load_qdpc_colmat_list
load_qdpc_colmat_list(L, name, n, param) --> table, string, table
The first n ColorMatrix records as a list, with a record info for each.
load_qdpc_gauge
load_qdpc_gauge(L, name, param) --> table, string, string
A gauge field: one record of #L ColorMatrix fields.
load_qdpc_colvec
load_qdpc_colvec(L, name, param) --> field, string, string
One ColorVector record.
load_qdpc_colvec_list
load_qdpc_colvec_list(L, name, n, param) --> table, string, table
The first n of them as a list.
setup_util
The odds and ends a measurement script does before it starts: momenta, sources, random states, boundary conditions.
mom3d_list_norm2max
mom3d_list_norm2max(mom2_max) --> table
Every three-momentum with p² at most mom2_max, as a list of {px, py, pz}.
rnd_init
rnd_init(L, x) --> L:RandomState
A lattice random state seeded with x, each site drawing from its own lexicographic index, so that the stream does not depend on how the lattice was divided between nodes.
shift_origin_field
shift_origin_field(f, v) --> field
A field shifted forward by v[1+mu] sites along each axis — the way to move the origin of a measurement.
make_mom_list
make_mom_list(mom2_max) --> table
The same list as mom3d_list_norm2max.
make_mom_list_4d
make_mom_list_4d(mom2_max, mom_t) --> table
That list with mom_t appended to each entry, for an interface that wants a four-component momentum.
range_prod
range_prod(ranges, filter) --> table
The direct product of a list of ranges, as a list of lists, the first index running fastest. filter, if given, is asked about each combination and may drop it.
gauge_set_bc
gauge_set_bc(u, bc) --> nothing
Multiplies the last slice of each axis by bc[1+mu], in place. gauge_apply_boundary in Gauge fields does the same without modifying its argument, and is the one to prefer.
make_src_grid
make_src_grid(n_src, latsize, x0, dx_c, i_c) --> table
A list of source positions on a regular grid: n_src of them along each axis, starting at x0, with each successive source displaced by dx_c in the direction i_c so that the grid is not a perfect lattice.
make_srcgrp_grid
make_srcgrp_grid(n_src, latsize, x0, dx_c, i_c, dx_it) --> table
The same as a list of source groups, each group being the positions that are solved together; dx_it displaces the members of a group.
parse_int_range
parse_int_range(sr) --> table
The integers named by a string such as "1,4-7,9", in the order written. Spaces are ignored.
split
Running a solver on several right-hand sides at once by cutting the process grid into sub-grids. These wrap a split solver so that a caller need not count its right-hand sides.
split.assert_check_split_geom
split.assert_check_split_geom(sg, L) --> true
Raises unless the split geometry has one entry per axis and divides the process grid of L.
split.nrhs_split_geom
split.nrhs_split_geom(sg) --> number
How many right-hand sides such a split carries, the product of its entries. As shipped it reads a global split_geom rather than its argument, so it works only where that global is the geometry in hand.
split.wrapsolver_list_pad
split.wrapsolver_list_pad(nrhs, solver_list) --> function
Wraps a split solver so that a short list of right-hand sides is padded up to nrhs with a repeat of the first, and the padding dropped from the answer. A list longer than nrhs is not handled.
split.wrapsolver_list_chop_pad
split.wrapsolver_list_chop_pad(nrhs, solver_list) --> function
The same for a list of any length: it is cut into pieces of nrhs, the last one padded, and the pieces solved in turn.
split.wrapsolver_fakesplit
split.wrapsolver_fakesplit(nrhs, solver) --> function
A list solver made out of an ordinary one, solving the right-hand sides one after another — for checking a split solver against what it should give. As shipped it builds its answer and then returns an undefined name, so it hands back nil.
|