Mapping¶
- class madspace.Mapping(self: madspace._madspace_py.Mapping, name: str, input_types: madspace._madspace_py.NamedTypes, output_types: madspace._madspace_py.NamedTypes, condition_types: madspace._madspace_py.NamedTypes)¶
Bases:
pybind11_objectBase class for invertible phase-space mappings.
Cross-section and event-generation integrals have the form
\[I = \int_\Phi f(x)\,\mathrm{d}x,\]with \(f(x)\) the fully differential cross section over the phase-space point \(x\) [1]. Monte-Carlo integration draws \(x\) through an invertible map \(G\) from the unit hypercube, \(r \in [0,1]^d \leftrightarrow x \in \Phi\). This induces the normalized sampling density
\[g(x) = \left| \frac{\partial G^{-1}(x)}{\partial x} \right|, \qquad \int_\Phi g(x)\,\mathrm{d}x = 1,\]so that \(I = \int_U \left. f(x)/g(x) \right|_{x = G(r)}\,\mathrm{d}r\). The integration variance shrinks as \(g\) approaches \(f/I\).
A
Mappingrecords one such \(G\) as a pair of compute-graph builders.build_forwardmaps the inputs (the unit-hypercube numbers) to the outputs (momenta and invariants).build_inversemaps the outputs back to the inputs. Both also return aweight, the Jacobian \(1/g\) of the transformation. Conditions are external quantities the mapping needs but does not transform, such as masses, the collision energy or cut boundaries. They are the same for the forward and inverse direction.Random-number inputs are named after the variable they generate (
r_phi,r_theta,r_t,r_s, …). Time-like invariants are calleds_i, space-like onest_i. Entries marked with an indexiare repeated per particle.batchis the leading batch dimension of every tensor. Concrete subclasses list theirInputs,ConditionsandOutputsindividually.build_forwardandbuild_inverseeach come in two overloads. One takes aNamedVector<Value>. The other takes a positionalValueVecand attaches the names frominput_types()/output_types()andcondition_types(). Subclasses may be written in Python by deriving from this class.References
[1] T. Heimel, O. Mattelaer, R. Winterhalder, “MadSpace”, https://arxiv.org/abs/2602.06895
- Parameters:
name – Identifier used for the generated compute graph.
input_types – Types of the values consumed by the forward map (produced by the inverse map).
output_types – Types of the values produced by the forward map (consumed by the inverse map).
condition_types – Types of the pass-through conditioning values.
- build_forward(*args, **kwargs)¶
Overloaded function.
build_forward(self: madspace._madspace_py.Mapping, builder: madspace._madspace_py.FunctionBuilder, inputs: collections.abc.Sequence[madspace._madspace_py.Value], conditions: collections.abc.Sequence[madspace._madspace_py.Value]) -> madspace._madspace_py.NamedValues
Add the forward map to
fband return its named outputs.The positional overload attaches names from
input_types()andcondition_types().build_forward(self: madspace._madspace_py.Mapping, builder: madspace._madspace_py.FunctionBuilder, inputs: madspace._madspace_py.NamedValues, conditions: madspace._madspace_py.NamedValues) -> madspace._madspace_py.NamedValues
Add the forward map to
fband return its named outputs.The positional overload attaches names from
input_types()andcondition_types().
- build_inverse(*args, **kwargs)¶
Overloaded function.
build_inverse(self: madspace._madspace_py.Mapping, builder: madspace._madspace_py.FunctionBuilder, inputs: collections.abc.Sequence[madspace._madspace_py.Value], conditions: collections.abc.Sequence[madspace._madspace_py.Value]) -> madspace._madspace_py.NamedValues
Add the inverse map to
fband return the recovered inputs.The positional overload attaches names from
output_types()andcondition_types().build_inverse(self: madspace._madspace_py.Mapping, builder: madspace._madspace_py.FunctionBuilder, inputs: madspace._madspace_py.NamedValues, conditions: madspace._madspace_py.NamedValues) -> madspace._madspace_py.NamedValues
Add the inverse map to
fband return the recovered inputs.The positional overload attaches names from
output_types()andcondition_types().
- forward_function(self: madspace._madspace_py.Mapping) madspace._madspace_py.Function¶
Build a standalone
Functionfor the forward map.
- inverse_function(self: madspace._madspace_py.Mapping) madspace._madspace_py.Function¶
Build a standalone
Functionfor the inverse map.
- map_forward(inputs=[], conditions=[], **kwargs)¶
- map_inverse(inputs=[], conditions=[], **kwargs)¶
- release_inputs()¶