Skip to main content

AxisLift

Struct AxisLift 

Source
pub struct AxisLift<C, F: SemiflowFloat = f64> {
    pub inner: C,
    pub axis: Axis,
    /* private fields */
}
Expand description

Generic adapter that lifts a 1D Chernoff function C to act on GridFn2D<F> along a single axis.

Implements ChernoffFunction<F><S = GridFn2D<F>> so that crate::Strang2D can compose two AxisLifts. Per-axis order and growth are inherited from the inner C.

§Generic-over-Float (ADR-0025, v0.9.0 Block D Wave 4)

AxisLift<C, F: SemiflowFloat = f64> — the = f64 default keeps all existing call-sites compiling unchanged.

§Example

use semiflow::{
    chernoff::ApplyChernoffExt, Grid1D, Grid2D, GridFn2D, DiffusionChernoff, AxisLift, Axis,
};
let gx = Grid1D::new(-3.0, 3.0, 16).unwrap();
let gy = Grid1D::new(-3.0, 3.0, 16).unwrap();
let diff = DiffusionChernoff::new(|_| 0.5, |_| 0.0, |_| 0.0, 0.5, gx);
let lift = AxisLift::new(diff, Axis::X);
let grid2 = Grid2D::new(gx, gy);
let u0 = GridFn2D::from_fn(grid2, |x, y| (-(x * x + y * y)).exp());
let u1 = lift.apply_chernoff(0.01, &u0).unwrap();
assert_eq!(u1.values.len(), 16 * 16);

See contracts/semiflow-core.tensor.yaml §3 AxisLift, invariant I-T4, and math.md §10 Lemma 10.2.

Fields§

§inner: C

The 1D Chernoff function being lifted. Must implement ChernoffFunction<F, S = GridFn1D<F>>.

§axis: Axis

Which axis the lift acts on (X or Y).

Implementations§

Source§

impl<C, F: SemiflowFloat> AxisLift<C, F>
where C: ChernoffFunction<F, S = GridFn1D<F>>,

Source

pub fn new(inner: C, axis: Axis) -> Self

Construct an AxisLift.

No validation — inner is already a valid ChernoffFunction<F>.

See contracts/semiflow-core.tensor.yaml §3 AxisLift::new.

Trait Implementations§

Source§

impl<C, F: SemiflowFloat> ChernoffFunction<F> for AxisLift<C, F>
where C: ChernoffFunction<F, S = GridFn1D<F>>,

Source§

fn apply_into( &self, tau: F, src: &GridFn2D<F>, dst: &mut GridFn2D<F>, scratch: &mut ScratchPool<F>, ) -> Result<(), SemiflowError>

In-place allocation-free override (Wave 2, ADR-0042).

Applies the lifted kernel per-pencil (row or column), reusing pool buffers from scratch. Zero heap allocations per call in steady state (after the pool warms up).

  • X-pass: contiguous row slices via pencil::row_2d_mut.
  • Y-pass: strided gather/scatter per column; core::mem::take reclaim.
§Errors

Same conditions as AxisLift apply_into.

Source§

fn order(&self) -> u32

Per-axis lift preserves the lifted axis’s consistency order.

See contracts/semiflow-core.tensor.yaml §3 AxisLift::order.

Source§

fn growth(&self) -> Growth<F>

Per-axis lift preserves the 1D growth bound (orthogonal axis is identity).

See contracts/semiflow-core.tensor.yaml §3 AxisLift::growth.

Source§

type S = GridFn2D<F>

The state space type on which S(tau) acts. Read more
Source§

fn apply_adjoint_into( &self, tau: F, src: &Self::S, dst: &mut Self::S, scratch: &mut ScratchPool<F>, ) -> Result<(), SemiflowError>

Apply the TRANSPOSE (adjoint) semigroup exp(τ Aᵀ) src into dst. Read more
Source§

fn plan_len(&self, tau: F, proto: &Self::S) -> Option<(usize, usize)>

Sizes (data, work) of a τ-keyed step plan for states shaped like proto (ADR-0215), or None (default) when the engine has no plan. Read more
Source§

fn fill_plan( &self, tau: F, proto: &Self::S, data: &mut [F], ) -> Result<(), SemiflowError>

Fill data (length plan_len(..).0) for (τ, proto). Read more
Source§

fn apply_planned_into( &self, tau: F, data: &[F], work: &mut [F], src: &Self::S, dst: &mut Self::S, scratch: &mut ScratchPool<F>, ) -> Result<(), SemiflowError>

dst := S(τ) src with a plan data filled by THIS engine for τ, and a work area of length plan_len(..).1. A plan that does not match — another τ, sampling grid, length or engine state, or a truncated buffer — falls back to apply_into. Default: apply_into. Read more
Source§

impl<C: Clone, F: Clone + SemiflowFloat> Clone for AxisLift<C, F>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<C: Debug, F: Debug + SemiflowFloat> Debug for AxisLift<C, F>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<C, F> Freeze for AxisLift<C, F>
where C: Freeze, PhantomData<F>: Freeze,

§

impl<C, F> RefUnwindSafe for AxisLift<C, F>

§

impl<C, F> Send for AxisLift<C, F>
where C: Send, PhantomData<F>: Send,

§

impl<C, F> Sync for AxisLift<C, F>
where C: Sync, PhantomData<F>: Sync,

§

impl<C, F> Unpin for AxisLift<C, F>
where C: Unpin, PhantomData<F>: Unpin,

§

impl<C, F> UnsafeUnpin for AxisLift<C, F>

§

impl<C, F> UnwindSafe for AxisLift<C, F>

Blanket Implementations§

Source§

impl<C, F> Adjointable<F, 1> for C

Source§

fn apply_adjoint_into( &self, tau: F, a: F, b: F, c: F, src: &MeasureState<F, 1>, dst: &mut MeasureState<F, 1>, ) -> Result<(), SemiflowError>

Push-forward one Chernoff step on the measure side (Lemma A.1, §38.3). Read more
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<C, F> ApplyChernoffExt<F> for C
where C: ChernoffFunction<F>, <C as ChernoffFunction<F>>::S: Clone, F: SemiflowFloat,

Source§

fn apply_chernoff( &self, tau: F, src: &Self::S, ) -> Result<Self::S, SemiflowError>

Allocating single-step apply: returns S(tau) src as a fresh state. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.