Skip to main content

KhatriRaoConeConstraints

Struct KhatriRaoConeConstraints 

Source
pub struct KhatriRaoConeConstraints { /* private fields */ }
Expand description

Nonnegativity cone (e_k ⊗ ψ_i)ᵀ β ≥ 0 for a row-major Khatri-Rao block.

The coefficient block is β = vec(A) with A reshaped row-major as p_left × p_cov (coefficient A[k, j] = β[k · p_cov + j]). The cone constrains the factored linear functionals α_k(x_i) = ψ_iᵀ A_{k,:} to be non-negative for every observation row i of factor and every k ∈ coupled_rows.

Row identifiers are stable and dense: row r = s · n + i where s indexes into coupled_rows and i is the observation row. Active-set warm starts therefore survive across iterations exactly as with the dense system.

Implementations§

Source§

impl KhatriRaoConeConstraints

Source

pub fn new( factor: Arc<Array2<f64>>, coupled_rows: Vec<usize>, p_left: usize, ) -> Result<Self, String>

Source

pub fn factor(&self) -> &Array2<f64>

Source

pub fn coupled_rows(&self) -> &[usize]

Source

pub fn p_left(&self) -> usize

Source

pub fn single_coupled_slot(&self, slot: usize) -> Result<Self, String>

One coupled response-row slot as a standalone cone over a single p_cov coefficient block. The covariate factor remains shared by Arc; only the small row-norm vector and this slot’s optional bounds are copied. This is the exact block decomposition of an identity-Hessian projection, not a reduced-data approximation.

Source

pub fn nrows(&self) -> usize

Source

pub fn ncols(&self) -> usize

Source

pub fn values(&self, beta: ArrayView1<'_, f64>) -> Result<Array1<f64>, String>

Raw (un-normalized) constraint values A β for the full row set, laid out slot-major (r = s·n + i).

Cost: one n × p_cov · p_cov product per coupled row — never the nrows × ncols dense system.

Source

pub fn row_norm(&self, row: usize) -> Result<f64, String>

Unit-normalization denominator of one row (‖ψ_i‖, shared across coupled slots). Zero rows are vacuous (0ᵀβ ≥ 0 always holds) exactly like the canonicalized dense system keeps them inert.

Source

pub fn row_column_support(&self, row: usize) -> Result<Vec<usize>, String>

The coefficient columns row row acts on, ascending.

Row (slot, i) has normal e_k ⊗ ψ_i with k = coupled_rows[slot], and Self::values reads exactly the block β[k·p_cov .. (k+1)·p_cov], so the support is k·p_cov + j over the columns j where ψ_{i,j} ≠ 0. Every other coefficient has a structurally zero coefficient in this row.

Source

pub fn bound(&self, row: usize) -> Result<f64, String>

Per-row right-hand side (0 for the homogeneous cone, shifted values after ConstraintSet::shifted_to_delta).

Source

pub fn gather_rows( &self, rows: &[usize], ) -> Result<LinearInequalityConstraints, String>

Materialize the requested rows as a dense system (active-set KKT use; the id order of rows is preserved). Rows come out RAW (un-normalized), matching the raw dense construction path; callers that need geometric tolerances canonicalize the gathered system.

Source

pub fn to_dense(&self) -> Result<LinearInequalityConstraints, String>

Exact dense equivalent of the ENTIRE cone. Test/oracle use only — this is the materialization the carrier exists to avoid.

Trait Implementations§

Source§

impl Clone for KhatriRaoConeConstraints

Source§

fn clone(&self) -> KhatriRaoConeConstraints

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 Debug for KhatriRaoConeConstraints

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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

Source§

fn by_ref(&self) -> &T

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> 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> DistributionExt for T
where T: ?Sized,

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

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

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.
Source§

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

Source§

fn vzip(self) -> V