Struct rgsl::types::matrix_complex::MatrixComplexF64
source · [−]pub struct MatrixComplexF64 { /* private fields */ }
Implementations
sourceimpl MatrixComplexF64
impl MatrixComplexF64
sourcepub fn new_with_init(n1: usize, n2: usize) -> Option<Self>
pub fn new_with_init(n1: usize, n2: usize) -> Option<Self>
Creates a new MatrixF64 with all elements set to zero.
sourcepub fn get(&self, y: usize, x: usize) -> ComplexF64
pub fn get(&self, y: usize, x: usize) -> ComplexF64
This function returns the (i,j)-th element of the matrix. If y or x lie outside the allowed range of 0 to n1-1 and 0 to n2-1 then the error handler is invoked and 0 is returned.
sourcepub fn set(&mut self, y: usize, x: usize, value: &ComplexF64) -> &Self
pub fn set(&mut self, y: usize, x: usize, value: &ComplexF64) -> &Self
This function sets the value of the (i,j)-th element of the matrix to value. If y or x lies outside the allowed range of 0 to n1-1 and 0 to n2-1 then the error handler is invoked.
sourcepub fn set_all(&mut self, x: &ComplexF64) -> &Self
pub fn set_all(&mut self, x: &ComplexF64) -> &Self
This function sets all the elements of the matrix to the value x.
sourcepub fn set_identity(&mut self) -> &Self
pub fn set_identity(&mut self) -> &Self
This function sets the elements of the matrix to the corresponding elements of the identity matrix, m(i,j) = \delta(i,j), i.e. a unit diagonal with all off-diagonal elements zero. This applies to both square and rectangular matrices.
sourcepub fn copy_from(&mut self, other: &MatrixComplexF64) -> Value
pub fn copy_from(&mut self, other: &MatrixComplexF64) -> Value
This function copies the elements of the other matrix into the self matrix. The two matrices must have the same size.
sourcepub fn copy_to(&self, other: &mut MatrixComplexF64) -> Value
pub fn copy_to(&self, other: &mut MatrixComplexF64) -> Value
This function copies the elements of the self matrix into the other matrix. The two matrices must have the same size.
sourcepub fn swap(&mut self, other: &mut MatrixComplexF64) -> Value
pub fn swap(&mut self, other: &mut MatrixComplexF64) -> Value
This function exchanges the elements of the matrices self and other by copying. The two matrices must have the same size.
sourcepub fn get_row(&self, y: usize) -> Option<(Value, VectorComplexF64)>
pub fn get_row(&self, y: usize) -> Option<(Value, VectorComplexF64)>
This function copies the elements of the y-th row of the matrix into the returned vector.
sourcepub fn get_col(&self, x: usize) -> Option<(Value, VectorComplexF64)>
pub fn get_col(&self, x: usize) -> Option<(Value, VectorComplexF64)>
This function copies the elements of the x-th column of the matrix into the returned vector.
sourcepub fn set_row(&mut self, y: usize, v: &VectorComplexF64) -> Value
pub fn set_row(&mut self, y: usize, v: &VectorComplexF64) -> Value
This function copies the elements of the vector v into the y-th row of the matrix. The length of the vector must be the same as the length of the row.
sourcepub fn set_col(&mut self, x: usize, v: &VectorComplexF64) -> Value
pub fn set_col(&mut self, x: usize, v: &VectorComplexF64) -> Value
This function copies the elements of the vector v into the x-th column of the matrix. The length of the vector must be the same as the length of the column.
sourcepub fn swap_rows(&mut self, y1: usize, y2: usize) -> Value
pub fn swap_rows(&mut self, y1: usize, y2: usize) -> Value
This function exchanges the y1-th and y2-th rows of the matrix in-place.
sourcepub fn swap_columns(&mut self, x1: usize, x2: usize) -> Value
pub fn swap_columns(&mut self, x1: usize, x2: usize) -> Value
This function exchanges the x1-th and x2-th columns of the matrix in-place.
sourcepub fn swap_row_col(&mut self, i: usize, j: usize) -> Value
pub fn swap_row_col(&mut self, i: usize, j: usize) -> Value
This function exchanges the i-th row and j-th column of the matrix in-place. The matrix must be square for this operation to be possible.
sourcepub fn transpose_memcpy(&self) -> Option<(Value, MatrixComplexF64)>
pub fn transpose_memcpy(&self) -> Option<(Value, MatrixComplexF64)>
This function returns the transpose of the matrix by copying the elements into it. This function works for all matrices provided that the dimensions of the matrix dest match the transposed dimensions of the matrix.
sourcepub fn transpose(&mut self) -> Value
pub fn transpose(&mut self) -> Value
This function replaces the matrix m by its transpose by copying the elements of the matrix in-place. The matrix must be square for this operation to be possible.
sourcepub fn add(&mut self, other: &MatrixComplexF64) -> Value
pub fn add(&mut self, other: &MatrixComplexF64) -> Value
This function adds the elements of the other matrix to the elements of the self
matrix.
The result self(i,j) <- self(i,j) + other(i,j) is stored in self
and other remains
unchanged. The two matrices must have the same dimensions.
sourcepub fn sub(&mut self, other: &MatrixComplexF64) -> Value
pub fn sub(&mut self, other: &MatrixComplexF64) -> Value
This function subtracts the elements of the other matrix from the elements of the self
matrix. The result self(i,j) <- self(i,j) - other(i,j) is stored in self
and other remains
unchanged. The two matrices must have the same dimensions.
sourcepub fn mul_elements(&mut self, other: &MatrixComplexF64) -> Value
pub fn mul_elements(&mut self, other: &MatrixComplexF64) -> Value
This function multiplies the elements of the self matrix by the elements of the other matrix. The result self(i,j) <- self(i,j) * other(i,j) is stored in self and other remains unchanged. The two matrices must have the same dimensions.
sourcepub fn div_elements(&mut self, other: &MatrixComplexF64) -> Value
pub fn div_elements(&mut self, other: &MatrixComplexF64) -> Value
This function divides the elements of the self matrix by the elements of the other matrix. The result self(i,j) <- self(i,j) / other(i,j) is stored in self and other remains unchanged. The two matrices must have the same dimensions.
sourcepub fn scale(&mut self, x: &ComplexF64) -> Value
pub fn scale(&mut self, x: &ComplexF64) -> Value
This function multiplies the elements of the self matrix by the constant factor x. The result self(i,j) <- x self(i,j) is stored in self.
sourcepub fn add_constant(&mut self, x: &ComplexF64) -> Value
pub fn add_constant(&mut self, x: &ComplexF64) -> Value
This function adds the constant value x to the elements of the self matrix. The result self(i,j) <- self(i,j) + x is stored in self.
sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
This function returns true if all the elements of the self matrix are stricly zero.
sourcepub fn is_pos(&self) -> bool
pub fn is_pos(&self) -> bool
This function returns true if all the elements of the self matrix are stricly positive.
sourcepub fn is_neg(&self) -> bool
pub fn is_neg(&self) -> bool
This function returns true if all the elements of the self matrix are stricly negative.
sourcepub fn is_non_neg(&self) -> bool
pub fn is_non_neg(&self) -> bool
This function returns true if all the elements of the self matrix are stricly non-negative.
sourcepub fn equal(&self, other: &MatrixComplexF64) -> bool
pub fn equal(&self, other: &MatrixComplexF64) -> bool
This function returns true if all elements of the two matrix are equal.
pub fn row<F: FnOnce(Option<VectorComplexF64View<'_>>)>(
&mut self,
i: usize,
f: F
)
pub fn column<F: FnOnce(Option<VectorComplexF64View<'_>>)>(
&mut self,
j: usize,
f: F
)
pub fn diagonal<F: FnOnce(Option<VectorComplexF64View<'_>>)>(&mut self, f: F)
pub fn subdiagonal<F: FnOnce(Option<VectorComplexF64View<'_>>)>(
&mut self,
k: usize,
f: F
)
pub fn superdiagonal<F: FnOnce(Option<VectorComplexF64View<'_>>)>(
&mut self,
k: usize,
f: F
)
pub fn subrow<F: FnOnce(Option<VectorComplexF64View<'_>>)>(
&mut self,
i: usize,
offset: usize,
n: usize,
f: F
)
pub fn subcolumn<F: FnOnce(Option<VectorComplexF64View<'_>>)>(
&mut self,
i: usize,
offset: usize,
n: usize,
f: F
)
pub fn size1(&self) -> usize
pub fn size2(&self) -> usize
pub fn clone(&self) -> Option<Self>
Trait Implementations
sourceimpl Debug for MatrixComplexF64
impl Debug for MatrixComplexF64
Auto Trait Implementations
impl RefUnwindSafe for MatrixComplexF64
impl !Send for MatrixComplexF64
impl !Sync for MatrixComplexF64
impl Unpin for MatrixComplexF64
impl UnwindSafe for MatrixComplexF64
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more