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: CThe 1D Chernoff function being lifted. Must implement
ChernoffFunction<F, S = GridFn1D<F>>.
axis: AxisWhich axis the lift acts on (X or Y).
Implementations§
Source§impl<C, F: SemiflowFloat> AxisLift<C, F>where
C: ChernoffFunction<F, S = GridFn1D<F>>,
impl<C, F: SemiflowFloat> AxisLift<C, F>where
C: ChernoffFunction<F, S = GridFn1D<F>>,
Sourcepub fn new(inner: C, axis: Axis) -> Self
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>>,
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>
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::takereclaim.
§Errors
Same conditions as AxisLift apply_into.
Source§fn order(&self) -> u32
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>
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§fn apply_adjoint_into(
&self,
tau: F,
src: &Self::S,
dst: &mut Self::S,
scratch: &mut ScratchPool<F>,
) -> Result<(), SemiflowError>
fn apply_adjoint_into( &self, tau: F, src: &Self::S, dst: &mut Self::S, scratch: &mut ScratchPool<F>, ) -> Result<(), SemiflowError>
Source§fn plan_len(&self, tau: F, proto: &Self::S) -> Option<(usize, usize)>
fn plan_len(&self, tau: F, proto: &Self::S) -> Option<(usize, usize)>
(data, work) of a τ-keyed step plan for states shaped like proto
(ADR-0215), or None (default) when the engine has no plan. Read moreSource§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>
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 moreAuto Trait Implementations§
impl<C, F> Freeze for AxisLift<C, F>
impl<C, F> RefUnwindSafe for AxisLift<C, F>
impl<C, F> Send for AxisLift<C, F>
impl<C, F> Sync for AxisLift<C, F>
impl<C, F> Unpin for AxisLift<C, F>
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 Cwhere
C: ChernoffFunction<F>,
F: SemiflowFloat,
impl<C, F> Adjointable<F, 1> for Cwhere
C: ChernoffFunction<F>,
F: SemiflowFloat,
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>
fn apply_adjoint_into( &self, tau: F, a: F, b: F, c: F, src: &MeasureState<F, 1>, dst: &mut MeasureState<F, 1>, ) -> Result<(), SemiflowError>
Source§impl<C, F> ApplyChernoffExt<F> for C
impl<C, F> ApplyChernoffExt<F> for C
Source§fn apply_chernoff(
&self,
tau: F,
src: &Self::S,
) -> Result<Self::S, SemiflowError>
fn apply_chernoff( &self, tau: F, src: &Self::S, ) -> Result<Self::S, SemiflowError>
S(tau) src as a fresh state. Read more