pub trait FeynmanDiagramTensorExt {
// Required methods
fn tensor_reduce(
&self,
dimension: Atom,
) -> Result<TensorReduction, TensorReductionError>;
fn tensor_reduce_of(
&self,
subgraph: &SuBitGraph,
dimension: Atom,
projector: &SymbolicTensor<PartialStructure>,
expression: Option<&SymbolicTensor<PartialStructure>>,
) -> Result<TensorReduction, TensorReductionError>;
fn reduce_tensor_numerator(
&self,
reducer: &TensorReducer,
) -> Result<TensorReduction, TensorReductionError>;
fn reduce_tensor_graphs(
&self,
reducer: &TensorReducer,
) -> Result<Vec<FeynmanDiagram>, TensorReductionError>;
}Expand description
Tensor-reduction methods added to FeynKit diagrams without wrapping them.
§Examples
Reduce the numerator already stored on a generated diagram while keeping FeynKit’s native graph type.
use feynkit_graph::FeynmanDiagram;
use feynkit_tensor::{FeynmanDiagramTensorExt, TensorReducer, TensorReductionError};
use symbolica::{atom::Atom, parse};
fn scalar_numerator(diagram: &FeynmanDiagram) -> Result<Atom, TensorReductionError> {
diagram
.reduce_tensor_numerator(&TensorReducer::feynkit(parse!("4")))
.and_then(|reduction| reduction.into_expression())
.map(idenso::tensor::SymbolicTensor::into_expression)
}
fn scalar_graphs(
diagram: &FeynmanDiagram,
) -> Result<Vec<FeynmanDiagram>, TensorReductionError> {
diagram.reduce_tensor_graphs(&TensorReducer::feynkit(parse!("4")))
}Required Methods§
Sourcefn tensor_reduce(
&self,
dimension: Atom,
) -> Result<TensorReduction, TensorReductionError>
fn tensor_reduce( &self, dimension: Atom, ) -> Result<TensorReduction, TensorReductionError>
Reduce the numerator and projector, selecting exactly the graph’s internal edge momenta.
Four-dimensional Lorentz slots are promoted to dimension before reduction.
External momenta remain projector vectors; the scalar numerator prefactor is separate.
As with TensorReducer, reduction requires at least one integrated vector.
Sourcefn tensor_reduce_of(
&self,
subgraph: &SuBitGraph,
dimension: Atom,
projector: &SymbolicTensor<PartialStructure>,
expression: Option<&SymbolicTensor<PartialStructure>>,
) -> Result<TensorReduction, TensorReductionError>
fn tensor_reduce_of( &self, subgraph: &SuBitGraph, dimension: Atom, projector: &SymbolicTensor<PartialStructure>, expression: Option<&SymbolicTensor<PartialStructure>>, ) -> Result<TensorReduction, TensorReductionError>
Reduce a selected region using an explicitly supplied projector and its paired internal momenta; boundary and external-state momenta stay fixed. A supplied expression replaces the selected numerator and projector, allowing reduction after tensor contractions or a UV expansion.
Sourcefn reduce_tensor_numerator(
&self,
reducer: &TensorReducer,
) -> Result<TensorReduction, TensorReductionError>
fn reduce_tensor_numerator( &self, reducer: &TensorReducer, ) -> Result<TensorReduction, TensorReductionError>
Reduce the finalized diagram numerator and external-state projector.
The request-wide numerator prefactor is intentionally kept separate from the returned tensor reduction.
Sourcefn reduce_tensor_graphs(
&self,
reducer: &TensorReducer,
) -> Result<Vec<FeynmanDiagram>, TensorReductionError>
fn reduce_tensor_graphs( &self, reducer: &TensorReducer, ) -> Result<Vec<FeynmanDiagram>, TensorReductionError>
Split a fully contracted tensor numerator into scalar contributions.
Every nonzero compact reduction term becomes one cloned diagram whose
numerator contains both the exact tensor-projector coefficient and its
scalar invariant. The external-state projector is consumed and reset to
one, while the scalar numerator prefactor is retained. Topology IDs are
deliberately preserved. Derived names are deterministic and distinct:
name.tensor[0], name.tensor[1], and so on. Interaction and particle
assignments remain available as provenance; the original numerator
fragments are replaced by the scalar contribution. A numerator with
residual free indices is rejected; use
Self::reduce_tensor_numerator to retain its metric-tensor output.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".