pub struct Contour<F: ComplexScalar> { /* private fields */ }Expand description
Ordered integration contour.
A Contour stores a sequence of ContourSegments. The integrator
evaluates each segment independently and sums the resulting contributions.
The current concrete contour type is designed for complex-valued contours and supports heterogeneous built-in pieces such as line segments and circular arcs.
Implementations§
Source§impl<F> Contour<F>where
F: ComplexScalar + FromPrimitive,
impl<F> Contour<F>where
F: ComplexScalar + FromPrimitive,
pub fn indent( self, pole: F::Complex, radius: F, side: IndentSide, tolerance: F, ) -> Self
Source§impl<F: ComplexScalar> Contour<F>
impl<F: ComplexScalar> Contour<F>
Sourcepub fn from_pieces(pieces: Vec<ContourSegment<F>>) -> Self
pub fn from_pieces(pieces: Vec<ContourSegment<F>>) -> Self
pub fn pieces(&self) -> &[ContourSegment<F>]
pub fn into_pieces(self) -> Vec<ContourSegment<F>>
pub fn reverse(self) -> Self
pub fn close(self) -> Self
pub fn with_principal_value(
self,
pole: F::Complex,
radius: F,
side: IndentSide,
tolerance: F,
) -> Selfwhere
F: ComplexScalar + FromPrimitive,
pub fn indent_many(
self,
singularities: impl IntoIterator<Item = (F::Complex, F, IndentSide)>,
tolerance: F,
) -> Selfwhere
F: ComplexScalar + FromPrimitive,
Source§impl<F> Contour<F>where
F: ComplexScalar,
impl<F> Contour<F>where
F: ComplexScalar,
Sourcepub fn piecewise_linear(points: Vec<F::Complex>) -> Self
pub fn piecewise_linear(points: Vec<F::Complex>) -> Self
Creates a piecewise-linear contour through the supplied points.
Consecutive points are joined by line segments.
§Panics
Panics if fewer than two points are supplied.
Sourcepub fn upper_half_disk_centered(center: F::Complex, radius: F) -> Selfwhere
F: FromPrimitive,
pub fn upper_half_disk_centered(center: F::Complex, radius: F) -> Selfwhere
F: FromPrimitive,
Counter-clockwise upper half-disk contour.
Path:
center - R → center + R
center + R → center - R through the upper half-planeSourcepub fn lower_half_disk_centered(center: F::Complex, radius: F) -> Selfwhere
F: FromPrimitive,
pub fn lower_half_disk_centered(center: F::Complex, radius: F) -> Selfwhere
F: FromPrimitive,
Clockwise lower half-disk contour.
Path:
center - R → center + R
center + R → center - R through the lower half-planeSourcepub fn real_axis(radius: F) -> Selfwhere
F: FromPrimitive,
pub fn real_axis(radius: F) -> Selfwhere
F: FromPrimitive,
Constructs a contour following the real axis from -radius to radius.
This is the canonical finite approximation to the real line used when
numerically evaluating improper integrals over (-∞, ∞).
The contour consists of a single straight line segment.
§Orientation
The contour is traversed from left to right.
§Notes
The infinite real axis is recovered in the limit radius → ∞.
Sourcepub fn real_axis_offset(radius: F, imaginary_offset: F) -> Selfwhere
F: FromPrimitive,
pub fn real_axis_offset(radius: F, imaginary_offset: F) -> Selfwhere
F: FromPrimitive,
Constructs a straight contour parallel to the real axis.
The contour runs from
-radius + i·offsetto
radius + i·offset.§Orientation
The contour is traversed from left to right.
§Applications
Offset contours occur frequently in physics and applied mathematics, including:
- causal Green’s functions (
i0⁺prescriptions), - Laplace and Fourier inversion,
- contour deformation to avoid poles,
- regularisation of principal-value integrals.
Sourcepub fn upper_half_disk(radius: F) -> Selfwhere
F: FromPrimitive,
pub fn upper_half_disk(radius: F) -> Selfwhere
F: FromPrimitive,
Constructs a counter-clockwise upper half-disk.
The contour consists of
- a straight line along the real axis from
-radiustoradius, - a circular arc returning through the upper half-plane.
●
.-' '-.
.' '.
-R-----------R§Orientation
The resulting contour is positively oriented (counter-clockwise).
§Applications
This contour is commonly used with:
- the residue theorem,
- Jordan’s lemma,
- Fourier transform evaluation,
- contour integration in wave propagation.
§Notes
The infinite upper-half-plane contour is recovered by taking
radius → ∞.
Sourcepub fn lower_half_disk(radius: F) -> Selfwhere
F: FromPrimitive,
pub fn lower_half_disk(radius: F) -> Selfwhere
F: FromPrimitive,
Constructs a clockwise lower half-disk.
The contour consists of
- a straight line along the real axis from
-radiustoradius, - a circular arc returning through the lower half-plane.
-R-----------R
'. .'
'-._.-'§Orientation
The resulting contour is negatively oriented (clockwise).
§Applications
Useful when applying the residue theorem to integrands that decay in the lower half-plane, such as Fourier integrals with negative arguments.
§Notes
The infinite lower-half-plane contour is recovered by taking
radius → ∞.
Sourcepub fn upper_half_disk_offset(radius: F, imaginary_offset: F) -> Selfwhere
F: FromPrimitive,
pub fn upper_half_disk_offset(radius: F, imaginary_offset: F) -> Selfwhere
F: FromPrimitive,
Constructs an upper half-disk translated vertically.
The contour is identical to upper_half_disk
except that it is centred at
i · imaginary_offset.Consequently, the straight segment lies along
Im(z) = imaginary_offset.§Applications
Shifted contours are useful when implementing
i0⁺prescriptions,- contour regularisation,
- displaced Bromwich contours,
- Green’s function calculations.
Sourcepub fn lower_half_disk_offset(radius: F, imaginary_offset: F) -> Selfwhere
F: FromPrimitive,
pub fn lower_half_disk_offset(radius: F, imaginary_offset: F) -> Selfwhere
F: FromPrimitive,
Constructs a lower half-disk translated vertically.
The contour is identical to lower_half_disk
except that it is centred at
i · imaginary_offset.The straight segment therefore lies on
Im(z) = imaginary_offset.This contour is frequently used when closing contours below the real axis while avoiding nearby singularities.
Trait Implementations§
Auto Trait Implementations§
impl<F> Freeze for Contour<F>
impl<F> RefUnwindSafe for Contour<F>
impl<F> Send for Contour<F>
impl<F> Sync for Contour<F>
impl<F> Unpin for Contour<F>
impl<F> UnsafeUnpin for Contour<F>
impl<F> UnwindSafe for Contour<F>
Blanket Implementations§
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Proc> GenerateBuilder for Proc
impl<Proc> GenerateBuilder for Proc
Source§impl<Proc> GenerateBuilderFallible for Proc
impl<Proc> GenerateBuilderFallible for Proc
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§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).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.