pub struct Matrix { /* private fields */ }Expand description
Represents a matrix of field elements, of arbitrary dimensions
This is in row major order, so consider processing elements in the same row first, for locality.
Implementations§
Source§impl Matrix
impl Matrix
Sourcepub fn init(rows: usize, cols: usize, data: impl Iterator<Item = F>) -> Self
pub fn init(rows: usize, cols: usize, data: impl Iterator<Item = F>) -> Self
Initialize a matrix, with dimensions, and data to pull from.
Any extra data is ignored, any data not supplied is treated as 0.
Sourcepub fn as_polynomials(
&self,
min_coefficients: usize,
) -> Option<PolynomialVector>
pub fn as_polynomials( &self, min_coefficients: usize, ) -> Option<PolynomialVector>
Interpret the columns of this matrix as polynomials, with at least min_coefficients.
This will, in fact, produce a matrix padded to the next power of 2 of that number.
This will return None if min_coefficients < self.rows, which would mean
discarding data, instead of padding it.
Sourcepub fn mul(&self, other: &Self) -> Self
pub fn mul(&self, other: &Self) -> Self
Multiply this matrix by another.
This assumes that the number of columns in this matrix match the number of rows in the other matrix.
pub const fn rows(&self) -> usize
pub const fn cols(&self) -> usize
pub fn iter(&self) -> impl Iterator<Item = &[F]>
Sourcepub fn rand(rng: impl CryptoRngCore, rows: usize, cols: usize) -> Self
pub fn rand(rng: impl CryptoRngCore, rows: usize, cols: usize) -> Self
Create a random matrix with certain dimensions.
Trait Implementations§
Source§impl EncodeSize for Matrix
impl EncodeSize for Matrix
Source§fn encode_size(&self) -> usize
fn encode_size(&self) -> usize
Returns the encoded size of this value (in bytes).
Source§impl Read for Matrix
impl Read for Matrix
impl StructuralPartialEq for Matrix
Auto Trait Implementations§
impl Freeze for Matrix
impl RefUnwindSafe for Matrix
impl Send for Matrix
impl Sync for Matrix
impl Unpin for Matrix
impl UnwindSafe for Matrix
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<T> Encode for Twhere
T: Write + EncodeSize,
impl<T> Encode for Twhere
T: Write + EncodeSize,
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