CodeTools · MakeKernel#

3 symbols, auto-generated from package ::usage strings.

GetStandardKernelDefinitions#

GetStandardKernelDefinitions[] returns a list of standard kernel definitions used in DiFfRG.

MakeKernel#

MakeKernel[kernel_Association, parameterList_List,integrandFlow_,constantFlow_:0., integrandDefinitions_String:"", constantDefinitions_String:""]

Make a kernel from a given flow equation, parmeter list and kernel. The kernel must be a valid specification of an integration kernel. This Function creates an integrator that evaluates (constantFlow + ∫integrandFlow). One can prepend additional c++ definitions to the flow equation by using the integrandDefinitions and constantDefinitions parameters. These are prepended to the respective methods of the integration kernel, allowing one to e.g. define specific angles one needs for the flow code.

The options “KernelReturnTransform” and “ConstantReturnTransform” (default Identity) accept a Mathematica function applied to the optimized expression before code generation, which lets you wrap the return value, e.g. “KernelReturnTransform” -> Re renders the kernel return as real(…). The option “ComputeType” (default “double”) is the value type the kernel is evaluated and integrated in: “double”, “float”, “DiFfRG::complex” or “DiFfRG::complex”. With a float type the kernel, its literals and the integrator run in single precision, while map()/get() still write double results. The option “MapPoints” (default False) additionally emits map_points(dest, args…), which evaluates the integral at dest.size() points in one launch (dest is a DiFfRG::PointSpan); every argument is a DiFfRG::PointArg, i.e. a single value or one value per point (a DiFfRG::PointSpan or std::vector). A model’s evaluate_batch calls this. Supported by the vacuum and finite-temperature integrators, not by the lattice ones. The lattice integrator “Integrator” -> “DiFfRG::IntegratorLat” with “d” -> 1..4 sums over the momenta of a periodic lattice; its “IntegrationVariables” are the momentum components {q0, …, q(d-1)}, and the kernel must be even in every spatial component (and in q0 if q0_symmetric is set). It reads /integration/lattice/{N_t, N_s, a_t, a_s} and the optional q0_symmetric (default false) from the parameter file; d = 1 reads only N_t and a_t. The option “SharedGrids” lists groups of interpolator parameters that live on one coordinate grid, e.g. “SharedGrids” -> {{ZA, ZA3, ZA4}}. Lookups of a group with identical arguments then share the coordinate transform (one index(), then at() per interpolator). map() and map_points() check at run time that the group really shares one grid, in builds without NDEBUG or with DIFFRG_CHECK_SHARED_GRIDS. The option “KernelTraits” declares integrator traits on the emitted kernel class, as a list of names or name -> Boolean rules, e.g. “KernelTraits” -> {“matsubara_finite_extent”} or {“matsubara_split” -> True}. Each becomes a static constexpr bool <name> = <value>; member. “MatsubaraEven” stays a separate option because it carries a symbolic evenness check that a generic mechanism cannot.

MakeKernelGroup#

MakeKernelGroup[{{kernelExpr1, constExpr1, "output1"}, {kernelExpr2, constExpr2, "output2"}, ...}, opts]

Make one kernel that computes several integrals of the same loop at once, e.g. several projections of one diagram onto different tensor structures. The outputs share everything that is common to their integrands (lookups, propagators, subexpressions), which makes the group substantially cheaper than separate kernels. A member may also be given as {kernelExpr, “output”} (no constant). Takes the options of MakeKernel; all outputs share the parameters, integrator, coordinates and “ComputeType”. “KernelReturnTransform” and “ConstantReturnTransform” may also be lists with one function per output. The generated _integrator returns a DiFfRG::MultiValue: map() takes one destination per output, e.g. flows..map({&res[i], &res[j]}, coordinates, args…), get() a DiFfRG::MultiValue<double, N>&, and map_points() an array of PointSpans. The member output_names lists the outputs in order. Not available with “AD” -> True, the lattice integrators, “SplitKernel” or “SeparateLookups”.