Skip to main content

ReducedObjective

Struct ReducedObjective 

Source
pub struct ReducedObjective<O: Objective<f64>> { /* private fields */ }
Expand description

Affine dimension-collapse of an inner objective onto a k-dimensional box.

Given a full-space origin x0 in R^n and a basis W in R^{n x k} whose columns span the retained subspace (for example the dominant eigenvectors of the pilot gradient covariance, an active subspace), the reduced coordinate r in R^k decodes to x = clip(x0 + W r) in the inner box. The reduced objective evaluates the inner objective at the decoded point, so a sampler searches in R^k while every value is the true objective.

Implementations§

Source§

impl<O: Objective<f64>> ReducedObjective<O>

Source

pub fn new( inner: O, origin: Array1<f64>, basis: Array2<f64>, bounds: Bounds<f64>, ) -> Self

Builds a reduced objective from an inner objective, a full-space origin, an n x k basis, and the reduced box bounds in R^k.

Panics when the shapes disagree: origin.len() and basis.nrows() must equal inner.dim(), and basis.ncols() must equal bounds.dims.

Source

pub fn decode(&self, r: ArrayView1<'_, f64>) -> Array1<f64>

Decodes a reduced coordinate r in R^k to a full point x in R^n, clipped to the inner objective’s box.

Source

pub fn inner(&self) -> &O

Borrows the wrapped full-dimensional objective.

Trait Implementations§

Source§

impl<O: Objective<f64> + Gradient<f64>> DifferentiableObjective<f64> for ReducedObjective<O>

Source§

fn value_and_gradient(&self, x: ArrayView1<'_, T>) -> (T, Array1<T>)

Returns (f(x), ∇f(x)). Default calls the two methods separately; analytic implementations should override for efficiency.
Source§

impl<O: Objective<f64> + Gradient<f64>> Gradient<f64> for ReducedObjective<O>

Source§

fn grad(&self, r: ArrayView1<'_, f64>) -> Array1<f64>

Gradient of the underlying scalar field at x.
Source§

fn dim(&self) -> usize

Number of input dimensions (must match the paired Objective::dim).
Source§

impl<O: Objective<f64>> Objective<f64> for ReducedObjective<O>

Source§

fn dim(&self) -> usize

Number of input dimensions; matches bounds().dims.
Source§

fn bounds(&self) -> &Bounds<f64>

The feasible domain (typically a box).
Source§

fn eval(&self, r: ArrayView1<'_, f64>) -> f64

Evaluates the objective at a single point.
Source§

fn eval_batch(&self, x: ArrayView2<'_, T>) -> Array1<T>

Evaluates a batch of points (rows of x). Read more
Source§

fn global_min(&self) -> Option<&FPair<T>>

Optional known global minimum, used for benchmarking and convergence checks. Default returns None.

Auto Trait Implementations§

§

impl<O> Forget for ReducedObjective<O>

§

impl<O> Freeze for ReducedObjective<O>
where O: Freeze,

§

impl<O> RefUnwindSafe for ReducedObjective<O>
where O: RefUnwindSafe,

§

impl<O> Send for ReducedObjective<O>

§

impl<O> Sync for ReducedObjective<O>

§

impl<O> Unpin for ReducedObjective<O>
where O: Unpin,

§

impl<O> UnsafeUnpin for ReducedObjective<O>
where O: UnsafeUnpin,

§

impl<O> UnwindSafe for ReducedObjective<O>
where O: UnwindSafe,

Blanket Implementations§

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<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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V