pub struct DenseMatrix<T, V = Vec<T>> {
pub values: V,
pub width: usize,
/* private fields */
}
Expand description
A dense matrix stored in row-major form.
Fields§
§values: V
§width: usize
Implementations§
Source§impl<T: Clone + Send + Sync, S: DenseStorage<T>> DenseMatrix<T, S>
impl<T: Clone + Send + Sync, S: DenseStorage<T>> DenseMatrix<T, S>
pub fn new(values: S, width: usize) -> Self
pub fn new_row(values: S) -> Self
pub fn new_col(values: S) -> Self
pub fn as_view(&self) -> RowMajorMatrixView<'_, T>
pub fn as_view_mut(&mut self) -> RowMajorMatrixViewMut<'_, T>
pub fn copy_from<S2>(&mut self, source: &DenseMatrix<T, S2>)
pub fn flatten_to_base<F: Field>(&self) -> RowMajorMatrix<F>where
T: ExtensionField<F>,
pub fn row_slices(&self) -> impl Iterator<Item = &[T]>
pub fn par_row_slices(&self) -> impl IndexedParallelIterator<Item = &[T]>where
T: Sync,
pub fn row_mut(&mut self, r: usize) -> &mut [T]
pub fn rows_mut(&mut self) -> impl Iterator<Item = &mut [T]>
pub fn par_rows_mut<'a>( &'a mut self, ) -> impl IndexedParallelIterator<Item = &'a mut [T]>
pub fn horizontally_packed_row_mut<P>( &mut self, r: usize, ) -> (&mut [P], &mut [T])
pub fn scale_row(&mut self, r: usize, scale: T)
pub fn scale(&mut self, scale: T)
pub fn split_rows( &self, r: usize, ) -> (RowMajorMatrixView<'_, T>, RowMajorMatrixView<'_, T>)
pub fn split_rows_mut( &mut self, r: usize, ) -> (RowMajorMatrixViewMut<'_, T>, RowMajorMatrixViewMut<'_, T>)
pub fn par_row_chunks(
&self,
chunk_rows: usize,
) -> impl IndexedParallelIterator<Item = RowMajorMatrixView<'_, T>>where
T: Send,
pub fn par_row_chunks_exact(
&self,
chunk_rows: usize,
) -> impl IndexedParallelIterator<Item = RowMajorMatrixView<'_, T>>where
T: Send,
pub fn par_row_chunks_mut( &mut self, chunk_rows: usize, ) -> impl IndexedParallelIterator<Item = RowMajorMatrixViewMut<'_, T>>
pub fn row_chunks_exact_mut( &mut self, chunk_rows: usize, ) -> impl Iterator<Item = RowMajorMatrixViewMut<'_, T>>
pub fn par_row_chunks_exact_mut( &mut self, chunk_rows: usize, ) -> impl IndexedParallelIterator<Item = RowMajorMatrixViewMut<'_, T>>
pub fn row_pair_mut( &mut self, row_1: usize, row_2: usize, ) -> (&mut [T], &mut [T])
pub fn packed_row_pair_mut<P>( &mut self, row_1: usize, row_2: usize, ) -> ((&mut [P], &mut [T]), (&mut [P], &mut [T]))
Sourcepub fn bit_reversed_zero_pad(self, added_bits: usize) -> RowMajorMatrix<T>where
T: Field,
pub fn bit_reversed_zero_pad(self, added_bits: usize) -> RowMajorMatrix<T>where
T: Field,
Append zeros to the “end” of the given matrix, except that the matrix is in bit-reversed order, so in actuality we’re interleaving zero rows.
Source§impl<T: Clone + Default + Send + Sync> DenseMatrix<T, Vec<T>>
impl<T: Clone + Default + Send + Sync> DenseMatrix<T, Vec<T>>
pub fn as_cow<'a>(self) -> RowMajorMatrixCow<'a, T>
pub fn rand<R: Rng>(rng: &mut R, rows: usize, cols: usize) -> Selfwhere
Standard: Distribution<T>,
pub fn rand_nonzero<R: Rng>(rng: &mut R, rows: usize, cols: usize) -> Self
pub fn pad_to_height(&mut self, new_height: usize, fill: T)
Trait Implementations§
Source§impl<T: Clone + Send + Sync, S: DenseStorage<T>> BitReversableMatrix<T> for DenseMatrix<T, S>
impl<T: Clone + Send + Sync, S: DenseStorage<T>> BitReversableMatrix<T> for DenseMatrix<T, S>
type BitRev = RowIndexMappedView<BitReversalPerm, DenseMatrix<T, S>>
fn bit_reverse_rows(self) -> Self::BitRev
Source§impl<T: Clone, V: Clone> Clone for DenseMatrix<T, V>
impl<T: Clone, V: Clone> Clone for DenseMatrix<T, V>
Source§fn clone(&self) -> DenseMatrix<T, V>
fn clone(&self) -> DenseMatrix<T, V>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'de, T, V> Deserialize<'de> for DenseMatrix<T, V>where
V: Deserialize<'de>,
impl<'de, T, V> Deserialize<'de> for DenseMatrix<T, V>where
V: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T: Clone + Send + Sync, S: DenseStorage<T>> Matrix<T> for DenseMatrix<T, S>
impl<T: Clone + Send + Sync, S: DenseStorage<T>> Matrix<T> for DenseMatrix<T, S>
type Row<'a> = Cloned<Iter<'a, T>> where Self: 'a
fn width(&self) -> usize
fn height(&self) -> usize
fn get(&self, r: usize, c: usize) -> T
fn row(&self, r: usize) -> Self::Row<'_>
fn row_slice(&self, r: usize) -> impl Deref<Target = [T]>
fn to_row_major_matrix(self) -> RowMajorMatrix<T>
fn horizontally_packed_row<'a, P>(
&'a self,
r: usize,
) -> (impl Iterator<Item = P> + Send + Sync, impl Iterator<Item = T> + Send + Sync)where
P: PackedValue<Value = T>,
T: Clone + 'a,
Source§fn padded_horizontally_packed_row<'a, P>(
&'a self,
r: usize,
) -> impl Iterator<Item = P> + Send + Sync
fn padded_horizontally_packed_row<'a, P>( &'a self, r: usize, ) -> impl Iterator<Item = P> + Send + Sync
Zero padded.
fn dimensions(&self) -> Dimensions
fn rows(&self) -> impl Iterator<Item = Self::Row<'_>>
fn par_rows(&self) -> impl IndexedParallelIterator<Item = Self::Row<'_>>
fn first_row(&self) -> Self::Row<'_>
fn last_row(&self) -> Self::Row<'_>
fn par_horizontally_packed_rows<'a, P>(
&'a self,
) -> impl IndexedParallelIterator<Item = (impl Iterator<Item = P> + Send + Sync, impl Iterator<Item = T> + Send + Sync)>where
P: PackedValue<Value = T>,
T: Clone + 'a,
fn par_padded_horizontally_packed_rows<'a, P>( &'a self, ) -> impl IndexedParallelIterator<Item = impl Iterator<Item = P> + Send + Sync>
Source§fn vertically_packed_row<P>(&self, r: usize) -> impl Iterator<Item = P>where
T: Copy,
P: PackedValue<Value = T>,
fn vertically_packed_row<P>(&self, r: usize) -> impl Iterator<Item = P>where
T: Copy,
P: PackedValue<Value = T>,
Pack together a collection of adjacent rows from the matrix. Read more
Source§fn vertically_packed_row_pair<P>(&self, r: usize, step: usize) -> Vec<P>where
T: Copy,
P: PackedValue<Value = T>,
fn vertically_packed_row_pair<P>(&self, r: usize, step: usize) -> Vec<P>where
T: Copy,
P: PackedValue<Value = T>,
Pack together a collection of rows and “next” rows from the matrix. Read more
fn vertically_strided(
self,
stride: usize,
offset: usize,
) -> VerticallyStridedMatrixView<Self>where
Self: Sized,
Source§fn columnwise_dot_product<EF>(&self, v: &[EF]) -> Vec<EF>where
T: Field,
EF: ExtensionField<T>,
fn columnwise_dot_product<EF>(&self, v: &[EF]) -> Vec<EF>where
T: Field,
EF: ExtensionField<T>,
Compute Mᵀv, aka premultiply this matrix by the given vector,
aka scale each row by the corresponding entry in
v
and take the sum across rows.
v
can be a vector of extension elements.Source§fn dot_ext_powers<EF>(
&self,
base: EF,
) -> impl IndexedParallelIterator<Item = EF>where
T: Field,
EF: ExtensionField<T>,
fn dot_ext_powers<EF>(
&self,
base: EF,
) -> impl IndexedParallelIterator<Item = EF>where
T: Field,
EF: ExtensionField<T>,
Multiply this matrix by the vector of powers of
base
, which is an extension element.Source§impl<T, V> Serialize for DenseMatrix<T, V>where
V: Serialize,
impl<T, V> Serialize for DenseMatrix<T, V>where
V: Serialize,
impl<T: Copy, V: Copy> Copy for DenseMatrix<T, V>
impl<T: Eq, V: Eq> Eq for DenseMatrix<T, V>
impl<T, V> StructuralPartialEq for DenseMatrix<T, V>
Auto Trait Implementations§
impl<T, V> Freeze for DenseMatrix<T, V>where
V: Freeze,
impl<T, V> RefUnwindSafe for DenseMatrix<T, V>where
V: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, V> Send for DenseMatrix<T, V>
impl<T, V> Sync for DenseMatrix<T, V>
impl<T, V> Unpin for DenseMatrix<T, V>
impl<T, V> UnwindSafe for DenseMatrix<T, V>where
V: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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