MatrixSetSubmatrix

Trait MatrixSetSubmatrix 

Source
pub trait MatrixSetSubmatrix{
    // Required method
    unsafe fn set_submatrix_unchecked(
        &mut self,
        row_self_start: i64,
        col_self_start: i64,
        row_self_end: i64,
        col_self_end: i64,
        other: &Self,
        row_other_start: i64,
        col_other_start: i64,
        row_other_end: i64,
        col_other_end: i64,
    );

    // Provided methods
    fn set_row(
        &mut self,
        row_0: impl TryInto<i64> + Display,
        other: &Self,
        row_1: impl TryInto<i64> + Display,
    ) -> Result<(), MathError> { ... }
    unsafe fn set_row_unchecked(&mut self, row_0: i64, other: &Self, row_1: i64) { ... }
    fn set_column(
        &mut self,
        col_0: impl TryInto<i64> + Display,
        other: &Self,
        col_1: impl TryInto<i64> + Display,
    ) -> Result<(), MathError> { ... }
    unsafe fn set_column_unchecked(
        &mut self,
        col_0: i64,
        other: &Self,
        col_1: i64,
    ) { ... }
    fn set_submatrix(
        &mut self,
        row_self_start: impl TryInto<i64> + Display,
        col_self_start: impl TryInto<i64> + Display,
        other: &Self,
        row_other_start: impl TryInto<i64> + Display,
        col_other_start: impl TryInto<i64> + Display,
        row_other_end: impl TryInto<i64> + Display,
        col_other_end: impl TryInto<i64> + Display,
    ) -> Result<(), MathError> { ... }
}
Expand description

Is implemented by matrices to set more than a single entry of the matrix.

Required Methods§

Source

unsafe fn set_submatrix_unchecked( &mut self, row_self_start: i64, col_self_start: i64, row_self_end: i64, col_self_end: i64, other: &Self, row_other_start: i64, col_other_start: i64, row_other_end: i64, col_other_end: i64, )

Sets the matrix entries in self to entries defined in other. The entries in self starting from (row_self_start, col_self_start) up to (row_self_end, col_self_end)are set to be the entries from the submatrix from other defined by (row_other_start, col_other_start) to (row_other_end, col_other_end) (exclusively).

Parameters: row_self_start: the starting row of the matrix in which to set a submatrix col_self_start: the starting column of the matrix in which to set a submatrix other: the matrix from where to take the submatrix to set row_other_start: the starting row of the specified submatrix col_other_start: the starting column of the specified submatrix row_other_end: the ending row of the specified submatrix col_other_end:the ending column of the specified submatrix

§Safety

To use this function safely, make sure that the selected submatrices are part of the matrices, the submatrices are of the same dimensions and the base types are the same. If not, memory leaks, unexpected panics, etc. might occur.

Provided Methods§

Source

fn set_row( &mut self, row_0: impl TryInto<i64> + Display, other: &Self, row_1: impl TryInto<i64> + Display, ) -> Result<(), MathError>

Sets a row of the given matrix to the provided row of other.

Parameters:

  • row_0: specifies the row of self that should be modified
  • other: specifies the matrix providing the row replacing the row in self
  • row_1: specifies the row of other providing the values replacing the original row in self

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.

Returns an empty Ok if the action could be performed successfully. Otherwise, a MathError is returned if one of the specified rows is not part of its matrix or if the number of columns differs.

§Errors and Failures
Source

unsafe fn set_row_unchecked(&mut self, row_0: i64, other: &Self, row_1: i64)

Sets a row of the given matrix to the provided row of other.

Parameters:

  • row_0: specifies the row of self that should be modified
  • other: specifies the matrix providing the row replacing the row in self
  • row_1: specifies the row of other providing the values replacing the original row in self
§Safety

To use this function safely, make sure that the selected rows are part of the matrices, the columns are of the same length and the base types are the same. If not, memory leaks, unexpected panics, etc. might occur.

Source

fn set_column( &mut self, col_0: impl TryInto<i64> + Display, other: &Self, col_1: impl TryInto<i64> + Display, ) -> Result<(), MathError>

Sets a column of the given matrix to the provided column of other.

Parameters:

  • col_0: specifies the column of self that should be modified
  • other: specifies the matrix providing the column replacing the column in self
  • col_1: specifies the column of other providing the values replacing the original column in self

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.

Returns an empty Ok if the action could be performed successfully. Otherwise, a MathError is returned if one of the specified columns is not part of its matrix or if the number of rows differs.

§Errors and Failures
Source

unsafe fn set_column_unchecked(&mut self, col_0: i64, other: &Self, col_1: i64)

Sets a column of the given matrix to the provided column of other.

Parameters:

  • col_0: specifies the column of self that should be modified
  • other: specifies the matrix providing the column replacing the column in self
  • col_1: specifies the column of other providing the values replacing the original column in self
§Safety

To use this function safely, make sure that the selected columns are part of the matrices, the columns are of the same length and the base types are the same. If not, memory leaks, unexpected panics, etc. might occur.

Source

fn set_submatrix( &mut self, row_self_start: impl TryInto<i64> + Display, col_self_start: impl TryInto<i64> + Display, other: &Self, row_other_start: impl TryInto<i64> + Display, col_other_start: impl TryInto<i64> + Display, row_other_end: impl TryInto<i64> + Display, col_other_end: impl TryInto<i64> + Display, ) -> Result<(), MathError>

Sets the matrix entries in self to entries defined in other. The entries in self starting from (row_self_start, col_self_start) are set to be the entries from the submatrix from other defined by (row_other_start, col_other_start) to (row_other_end, col_other_end) (inclusively). The original matrix must have sufficiently many entries to contain the defined submatrix.

Parameters: row_self_start: the starting row of the matrix in which to set a submatrix col_self_start: the starting column of the matrix in which to set a submatrix other: the matrix from where to take the submatrix to set row_other_start: the starting row of the specified submatrix col_other_start: the starting column of the specified submatrix row_other_end: the ending row of the specified submatrix col_other_end:the ending column of the specified submatrix

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.

Sets the submatrix of self, starting from the specified starting row and column to the submatrix defined in other by the provided indices (inclusively). Errors can occur if the provided indices are not within the dimensions of the provided matrices, the bases of the matrices are not compatible, e.g. different modulus or if the self can not contain the specified submatrix from other.

§Errors and Failures
  • Returns a MathError of type MathError::OutOfBounds if any provided row or column is larger than the matrix or if entries of self would have to be set that are not within self.
  • Returns a MathError of type MismatchingModulus if the base types are not compatible. This can only happen if the base types themselves can mismatch.
§Panics …
  • if row_other_start > row_other_end or col_other_start > col_other_end.

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.

Implementors§