pub trait MatrixSetEntry<T>{
// Required method
unsafe fn set_entry_unchecked(&mut self, row: i64, column: i64, value: T);
// Provided method
fn set_entry(
&mut self,
row: impl TryInto<i64> + Display,
column: impl TryInto<i64> + Display,
value: T,
) -> Result<(), MathError> { ... }
}Expand description
Is implemented by matrices to set entries.
Required Methods§
Sourceunsafe fn set_entry_unchecked(&mut self, row: i64, column: i64, value: T)
unsafe fn set_entry_unchecked(&mut self, row: i64, column: i64, value: T)
Sets the value of a specific matrix entry according to a given value without performing any checks, e.g. checking whether the entry is part of the matrix or if the moduli of the matrices match.
Parameters:
row: specifies the row in which the entry is located.column: specifies the column in which the entry is located.value: specifies the value to which the entry is set.
§Safety
To use this function safely, make sure that the selected entry is part of the matrix. If it is not, memory leaks, unexpected panics, etc. might occur.
Provided Methods§
Sourcefn set_entry(
&mut self,
row: impl TryInto<i64> + Display,
column: impl TryInto<i64> + Display,
value: T,
) -> Result<(), MathError>
fn set_entry( &mut self, row: impl TryInto<i64> + Display, column: impl TryInto<i64> + Display, value: T, ) -> Result<(), MathError>
Sets the value of a specific matrix entry according to a given value.
Parameters:
row: specifies the row in which the entry is located.column: specifies the column in which the entry is located.value: specifies the value to which the entry is set.
Negative indices can be used to index from the back, e.g., -1 for
the last element, but after conversion they must be within the matrix dimensions.
Errors can occur if the provided indices are not within the dimensions of the provided matrices, the bases of the matrix and value are not compatible, e.g. different modulus.
§Errors and Failures
- Returns a
MathErrorof typeMathError::OutOfBoundsifroworcolumndo not define an entry in the mtrix - Returns a
MathErrorof typeMathError::MismatchingModulusif the moduli are different.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.