pub struct InteractionMatrix { /* private fields */ }Implementations§
Source§impl InteractionMatrix
impl InteractionMatrix
pub fn from_matrix( values: DenseMatrix<f64>, ) -> Result<Self, InteractionMatrixError>
pub fn from_labeled_matrix( values: DenseMatrix<f64>, label: impl Into<String>, ) -> Result<Self, InteractionMatrixError>
pub fn from_rows(rows: Vec<Vec<f64>>) -> Result<Self, InteractionMatrixError>
pub fn load_json( path: impl Into<PathBuf>, ) -> Result<Self, InteractionMatrixError>
pub fn from_generated( values: DenseMatrix<f64>, generator: GeneratorProvenance, ) -> Result<Self, InteractionMatrixError>
pub fn species(&self) -> usize
pub fn values(&self) -> &DenseMatrix<f64>
pub fn coefficient(&self, row: usize, column: usize) -> f64
pub fn mul_vector_into( &self, input: &[f64], output: &mut [f64], ) -> Result<(), MatrixError>
Sourcepub fn mul_vectors_into(
&self,
input: &[f64],
output: &mut [f64],
) -> Result<(), MatrixError>
pub fn mul_vectors_into( &self, input: &[f64], output: &mut [f64], ) -> Result<(), MatrixError>
Apply this interaction matrix to a contiguous batch of species vectors.
pub const fn provenance(&self) -> &InteractionProvenance
Sourcepub fn antisymmetrize(&self) -> Result<Self, InteractionMatrixError>
pub fn antisymmetrize(&self) -> Result<Self, InteractionMatrixError>
Return A - A^T from this exact matrix realization.
Sourcepub fn scale(&self, scalar: f64) -> Result<Self, InteractionMatrixError>
pub fn scale(&self, scalar: f64) -> Result<Self, InteractionMatrixError>
Return this matrix multiplied by a finite scalar.
Sourcepub fn abs(&self) -> Result<Self, InteractionMatrixError>
pub fn abs(&self) -> Result<Self, InteractionMatrixError>
Return the elementwise absolute value of this matrix.
Sourcepub fn clamp_min(&self, minimum: f64) -> Result<Self, InteractionMatrixError>
pub fn clamp_min(&self, minimum: f64) -> Result<Self, InteractionMatrixError>
Raise every entry below minimum to that finite lower bound.
Sourcepub fn clamp_max(&self, maximum: f64) -> Result<Self, InteractionMatrixError>
pub fn clamp_max(&self, maximum: f64) -> Result<Self, InteractionMatrixError>
Lower every entry above maximum to that finite upper bound.
Sourcepub fn ensure_max_abs_at_most(
&self,
threshold: f64,
) -> Result<(), InteractionMatrixError>
pub fn ensure_max_abs_at_most( &self, threshold: f64, ) -> Result<(), InteractionMatrixError>
Require every absolute entry to be at most threshold.
The maximum is reduced by PiP’s backend-native parallel implementation.
Sourcepub fn normalize(&self, threshold: f64) -> Result<Self, InteractionMatrixError>
pub fn normalize(&self, threshold: f64) -> Result<Self, InteractionMatrixError>
Scale down uniformly until every absolute entry is at most threshold.
A matrix already within the threshold is not enlarged.
pub fn generator_rng_record(&self) -> Result<Option<RngRecord>, RngRecordError>
Trait Implementations§
Source§impl Clone for InteractionMatrix
impl Clone for InteractionMatrix
Source§fn clone(&self) -> InteractionMatrix
fn clone(&self) -> InteractionMatrix
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for InteractionMatrix
impl RefUnwindSafe for InteractionMatrix
impl Send for InteractionMatrix
impl Sync for InteractionMatrix
impl Unpin for InteractionMatrix
impl UnsafeUnpin for InteractionMatrix
impl UnwindSafe for InteractionMatrix
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
Mutably borrows from an owned value. Read more
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> 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> ⓘ
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 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> ⓘ
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