pub struct Matrix { /* private fields */ }Expand description
Represents a square matrix over C of maximum size MAX_SIZE.
Each element is an instance of Complex, and we store the elements
internally in an array of size MAX_SIZE^2 * sizeof(Complex).
In practice, this means each matrix occupies around 16KiB.
Implementations§
Source§impl Matrix
impl Matrix
Sourcepub fn new(size: usize) -> Matrix
pub fn new(size: usize) -> Matrix
Construct a new zero-initialized matrix of given size.
§Panics
We panic if the given size exceeds MAX_SIZE.
Sourcepub fn new_from_elements(size: usize, elements: Vec<Complex>) -> Matrix
pub fn new_from_elements(size: usize, elements: Vec<Complex>) -> Matrix
Construct a new matrix of given size from elements.
§Panics
We panic if the given size exceeds MAX_SIZE.
Sourcepub fn embed(&mut self, other: &Matrix, i: usize, j: usize)
pub fn embed(&mut self, other: &Matrix, i: usize, j: usize)
Embed another matrix into this one, overrising elements.
Embed with top-left position at (i, j).
§Panics
We panic if this matrix isn’t large enough.
Sourcepub fn permute_rows(&self, permutation: Vec<usize>) -> Matrix
pub fn permute_rows(&self, permutation: Vec<usize>) -> Matrix
Permute the rows to generate a new matrix.
Row i goes to row perutation[i].
§Panics
We panic if set(permutation) != {0, …, self.size - 1}.
Sourcepub fn permute_columns(&self, permutation: Vec<usize>) -> Matrix
pub fn permute_columns(&self, permutation: Vec<usize>) -> Matrix
Permute the columns to generate a new matrix.
Column i goes to column perutation[i].
§Panics
We panic if set(permutation) != {0, …, self.size - 1}.