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
impl KhatriRaoConeConstraints
pub fn new( factor: Arc<Array2<f64>>, coupled_rows: Vec<usize>, p_left: usize, ) -> Result<Self, String>
pub fn factor(&self) -> &Array2<f64>
pub fn coupled_rows(&self) -> &[usize]
pub fn p_left(&self) -> usize
Sourcepub fn single_coupled_slot(&self, slot: usize) -> Result<Self, String>
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.
pub fn nrows(&self) -> usize
pub fn ncols(&self) -> usize
Sourcepub fn values(&self, beta: ArrayView1<'_, f64>) -> Result<Array1<f64>, String>
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.
Sourcepub fn row_norm(&self, row: usize) -> Result<f64, String>
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.
Sourcepub fn row_column_support(&self, row: usize) -> Result<Vec<usize>, String>
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.
Sourcepub fn bound(&self, row: usize) -> Result<f64, String>
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).
Sourcepub fn gather_rows(
&self,
rows: &[usize],
) -> Result<LinearInequalityConstraints, String>
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.
Sourcepub fn to_dense(&self) -> Result<LinearInequalityConstraints, String>
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
impl Clone for KhatriRaoConeConstraints
Source§fn clone(&self) -> KhatriRaoConeConstraints
fn clone(&self) -> KhatriRaoConeConstraints
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for KhatriRaoConeConstraints
impl RefUnwindSafe for KhatriRaoConeConstraints
impl Send for KhatriRaoConeConstraints
impl Sync for KhatriRaoConeConstraints
impl Unpin for KhatriRaoConeConstraints
impl UnsafeUnpin for KhatriRaoConeConstraints
impl UnwindSafe for KhatriRaoConeConstraints
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
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.