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: usizeImplementations§
Source§impl<T> DenseMatrix<T>
impl<T> DenseMatrix<T>
Sourcepub fn default(width: usize, height: usize) -> DenseMatrix<T>
pub fn default(width: usize, height: usize) -> DenseMatrix<T>
Create a new dense matrix of the given dimensions, backed by a Vec, and filled with
default values.
Source§impl<T, S> DenseMatrix<T, S>
impl<T, S> DenseMatrix<T, S>
pub fn new(values: S, width: usize) -> DenseMatrix<T, S>
pub fn new_row(values: S) -> DenseMatrix<T, S>
pub fn new_col(values: S) -> DenseMatrix<T, S>
pub fn as_view(&self) -> DenseMatrix<T, &[T]>
pub fn as_view_mut(&mut self) -> DenseMatrix<T, &mut [T]>
pub fn flatten_to_base<F>(&self) -> DenseMatrix<F>where
F: Field,
T: ExtensionField<F>,
pub fn par_row_slices(&self) -> impl ExactSizeIteratorwhere
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 ExactSizeIterator
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, ) -> (DenseMatrix<T, &[T]>, DenseMatrix<T, &[T]>)
pub fn split_rows_mut( &mut self, r: usize, ) -> (DenseMatrix<T, &mut [T]>, DenseMatrix<T, &mut [T]>)
pub fn par_row_chunks_mut( &mut self, chunk_rows: usize, ) -> impl ExactSizeIterator
pub fn par_row_chunks_exact_mut( &mut self, chunk_rows: usize, ) -> impl ExactSizeIterator
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]))
pub fn bit_reversed_zero_pad(self, added_bits: usize) -> DenseMatrix<T>
Source§impl<T> DenseMatrix<T>
impl<T> DenseMatrix<T>
pub fn rand<R>(rng: &mut R, rows: usize, cols: usize) -> DenseMatrix<T>
pub fn rand_nonzero<R>(rng: &mut R, rows: usize, cols: usize) -> DenseMatrix<T>
pub fn transpose(self) -> DenseMatrix<T>
Trait Implementations§
Source§impl<T, S> BitReversableMatrix<T> for DenseMatrix<T, S>
impl<T, S> BitReversableMatrix<T> for DenseMatrix<T, S>
type BitRev = RowIndexMappedView<BitReversalPerm, DenseMatrix<T, S>>
fn bit_reverse_rows( self, ) -> <DenseMatrix<T, S> as BitReversableMatrix<T>>::BitRev
Source§impl<T, V> Clone for DenseMatrix<T, V>
impl<T, V> Clone for DenseMatrix<T, V>
Source§fn clone(&self) -> DenseMatrix<T, V>
fn clone(&self) -> DenseMatrix<T, V>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T, V> Debug for DenseMatrix<T, V>
impl<T, V> Debug for DenseMatrix<T, V>
Source§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<DenseMatrix<T, V>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<DenseMatrix<T, V>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T, S> Matrix<T> for DenseMatrix<T, S>
impl<T, S> Matrix<T> for DenseMatrix<T, S>
type Row<'a> = Cloned<Iter<'a, T>> where DenseMatrix<T, S>: 'a
fn width(&self) -> usize
fn height(&self) -> usize
fn get(&self, r: usize, c: usize) -> T
fn row(&self, r: usize) -> <DenseMatrix<T, S> as Matrix<T>>::Row<'_>
fn row_slice(&self, r: usize) -> impl Deref<Target = [T]>
fn to_row_major_matrix(self) -> DenseMatrix<T>
fn horizontally_packed_row<'a, P>(
&'a self,
r: usize,
) -> (impl Iterator<Item = P>, impl Iterator<Item = T>)where
P: PackedValue<Value = T>,
T: Clone + 'a,
fn dimensions(&self) -> Dimensions
fn rows(&self) -> impl Iterator<Item = Self::Row<'_>>
fn par_rows(&self) -> impl ExactSizeIterator
fn first_row(&self) -> Self::Row<'_>
fn last_row(&self) -> Self::Row<'_>
Source§fn vertically_packed_row<P>(&self, r: usize) -> impl Iterator<Item = P>where
P: PackedValue<Value = T>,
fn vertically_packed_row<P>(&self, r: usize) -> impl Iterator<Item = P>where
P: PackedValue<Value = T>,
Wraps at the end.
fn vertically_strided(
self,
stride: usize,
offset: usize,
) -> RowIndexMappedView<VerticallyStridedRowIndexMap, 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 row-wise sum.
v can be a vector of extension elements.Source§impl<T, V> PartialEq for DenseMatrix<T, V>
impl<T, V> PartialEq for DenseMatrix<T, V>
Source§fn eq(&self, other: &DenseMatrix<T, V>) -> bool
fn eq(&self, other: &DenseMatrix<T, V>) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl<T, V> Serialize for DenseMatrix<T, V>where
V: Serialize,
impl<T, V> Serialize for DenseMatrix<T, V>where
V: Serialize,
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<T, V> Copy for DenseMatrix<T, V>
impl<T, V> 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> UnsafeUnpin for DenseMatrix<T, V>where
V: UnsafeUnpin,
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§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