pub struct TensorReducer { /* private fields */ }Expand description
A tensor reducer configured by dimension and integrated-vector selectors.
The primary high-rank path is a fully contracted expression. For example,
selecting K as integrated in
K(mu) K(nu) p(mu) p(nu) directly produces a scalar polynomial in
dot(K,K) and dot(p,p). Internal and projector repetitions are both used
to avoid generating equivalent labeled pairings.
§Examples
Reduce a one-loop rank-two vacuum numerator in dimensional regularization. The metric is normalized automatically; no preliminary Idenso call is required.
use feynkit_tensor::TensorReducer;
use symbolica::{parse, symbol};
let _ = (spenso::vector_symbol!("k"), spenso::vector_symbol!("q"), spenso::vector_symbol!("p"));
let numerator = parse!(
"spenso::g(spenso::mink(D,mu),spenso::mink(D,nu))
*k(spenso::mink(D,mu))*k(spenso::mink(D,nu))"
);
let reduced = TensorReducer::new(parse!("D"))
.with_integrated_head(symbol!("k"))
.reduce(&idenso::tensor::SymbolicTensor::infer(numerator)?)?;
println!("{}", reduced.expression()?);Implementations§
Source§impl TensorReducer
impl TensorReducer
Sourcepub fn new(dimension: Atom) -> Self
pub fn new(dimension: Atom) -> Self
Construct a reducer in dimension with no integrated vectors selected.
dimension must exactly match the source dimension of every input
spenso::mink(dimension,index) slot, including reversibly encoded
compound dimensions. Thus generated four-dimensional
FeynKit rules use 4, while a symbolic R-operation numerator whose
slots carry D uses D. Mixed high-rank projectors should retain a
symbolic dimension until after reduction: a fixed positive integer
dimension below half the tensor rank makes the universal metric basis
singular. The all-equal isotropic fast path remains available there.
Fully contracted vacuum monomials with one repeated integrated vector additionally support even ranks through 32. General and external-basis projectors retain the rank-20 limit.
Add selectors with Self::with_integrated_head or
Self::with_integrated_vector.
Sourcepub fn feynkit(dimension: Atom) -> Self
pub fn feynkit(dimension: Atom) -> Self
Construct a reducer for every canonical diagram gammalooprs::Q vector.
This constructor stores the qualified head name without registering a bare Symbolica symbol, so FeynKit’s tensor tags remain initialization order independent.
Sourcepub fn with_integrated_head(self, head: Symbol) -> Self
pub fn with_integrated_head(self, head: Symbol) -> Self
Select every vector with this Symbolica function head.
Sourcepub fn with_integrated_head_name(self, head: impl Into<String>) -> Self
pub fn with_integrated_head_name(self, head: impl Into<String>) -> Self
Select every vector with a qualified Symbolica head name.
Sourcepub fn with_integrated_vector(
self,
vector: Atom,
) -> Result<Self, TensorReductionError>
pub fn with_integrated_vector( self, vector: Atom, ) -> Result<Self, TensorReductionError>
Admit one exact compact source vector, such as K(1,spenso::mink(D)).
Shared source admission normalizes encoded dimensions and index labels
before the selector is compared with retained native tensor expressions.
Sourcepub fn with_external_vector(
self,
vector: Atom,
) -> Result<Self, TensorReductionError>
pub fn with_external_vector( self, vector: Atom, ) -> Result<Self, TensorReductionError>
Add an independent external momentum appearing in the denominators.
Pass compact Spenso vectors such as p(spenso::mink(D)). The reducer
resolves loop vectors along this basis and averages only their
transverse components, reusing the vacuum projector in D - n
dimensions. The external Gram matrix must be invertible. Include an
auxiliary vector for a degenerate basis, such as one lightlike momentum.
The resulting scalar products are left for integral-family reduction.
External vectors take precedence over integrated-head selectors.
Sourcepub fn with_pairing_limit(self, limit: u128) -> Self
pub fn with_pairing_limit(self, limit: u128) -> Self
Bound labeled pairings generated by the generic/free-index path.
Symmetric contraction-orbit fast paths do not consume this budget.
Sourcepub fn with_pairing_product_limit(self, limit: u128) -> Self
pub fn with_pairing_product_limit(self, limit: u128) -> Self
Bound the labeled matching product in the residual-free-index path.
Sourcepub fn with_output_term_limit(self, limit: usize) -> Self
pub fn with_output_term_limit(self, limit: usize) -> Self
Bound the number of distinct materialized invariant terms.
Sourcepub fn admit(
&self,
expression: Atom,
) -> Result<SymbolicTensor<PartialStructure>, TensorReductionError>
pub fn admit( &self, expression: Atom, ) -> Result<SymbolicTensor<PartialStructure>, TensorReductionError>
Admit a newly constructed numerator at an external source boundary.
The expression must already use native Spenso representation syntax, with compound dimensions and indices encoded by their source adapter. This method does not cook source notation or reduce a tensor. Native admission remains authoritative; rejected inputs receive the reducer’s established index and power diagnostics when its parser can refine them.
Sourcepub fn reduce(
&self,
source: &SymbolicTensor<PartialStructure>,
) -> Result<TensorReduction, TensorReductionError>
pub fn reduce( &self, source: &SymbolicTensor<PartialStructure>, ) -> Result<TensorReduction, TensorReductionError>
Reduce a tensor expression to compact invariant terms.
Explicit Spenso metric contractions are normalized first with Idenso.
This contracts chains such as g(mu,nu) K(mu) K(nu) while preserving
any residual free index in its full spenso::mink(D,index) slot. Each
selected Lorentz sector is then treated independently; its scalar and
foreign-representation coefficient remains factored. Compact Spenso dots between an
integrated vector and a spectator are projected directly, including
nonnegative integer powers, without allocating dummy indices. Dots
between integrated vectors or with declared external basis vectors stay
scalar invariants. Negative or noninteger powers of spectator contractions
are not polynomial tensor numerators and are rejected.
Odd-rank vacuum tensors vanish;
already-contracted integrated pairs become Spenso dots before the
projector is built. A single index occurrence inside an otherwise
opaque tensor is retained as an external projector leg; expressions
with more than two occurrences of one Minkowski index are rejected as
ambiguous rather than silently dropping a contraction.
§Examples
use feynkit_tensor::TensorReducer;
use symbolica::{parse, symbol};
let _ = (spenso::vector_symbol!("k"), spenso::vector_symbol!("q"), spenso::vector_symbol!("p"));
let numerator = parse!(
"k(spenso::mink(D,mu))*k(spenso::mink(D,nu))
*p(spenso::mink(D,mu))*p(spenso::mink(D,nu))"
);
let reduction = TensorReducer::new(parse!("D"))
.with_integrated_head(symbol!("k"))
.reduce(&idenso::tensor::SymbolicTensor::infer(numerator)?)?;
assert!(reduction.is_fully_contracted());Trait Implementations§
Source§impl Clone for TensorReducer
impl Clone for TensorReducer
Source§fn clone(&self) -> TensorReducer
fn clone(&self) -> TensorReducer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for TensorReducer
impl RefUnwindSafe for TensorReducer
impl Send for TensorReducer
impl Sync for TensorReducer
impl Unpin for TensorReducer
impl UnsafeUnpin for TensorReducer
impl UnwindSafe for TensorReducer
Blanket Implementations§
§impl<T> AtomComponentOptimizable<()> for T
impl<T> AtomComponentOptimizable<()> for T
fn optimize_atom_components(self) -> T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Source§impl<T> StrictAs for T
impl<T> StrictAs for T
Source§fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
Source§impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
Source§fn strict_cast_from(src: Src) -> Dst
fn strict_cast_from(src: Src) -> Dst
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.