pub struct GfMatrix {
pub rows: usize,
pub cols: usize,
pub data: Vec<u16>,
}Expand description
A matrix over GF(2^16), stored in row-major order.
Fields§
§rows: usize§cols: usize§data: Vec<u16>Row-major data: element at (r, c) is data[r * cols + c].
Implementations§
Source§impl GfMatrix
impl GfMatrix
Sourcepub fn par2_encoding_matrix(
input_count: usize,
recovery_exponents: &[u32],
) -> Self
pub fn par2_encoding_matrix( input_count: usize, recovery_exponents: &[u32], ) -> Self
Build the PAR2 encoding matrix.
PAR2 recovery blocks use: recovery[e] = Σ (input[i] * c[i]^e)
where c[i] are per-input-slice constants assigned by the PAR2 spec.
The encoding matrix has input_count columns (one per data block).
Row i for i < input_count is the identity (data blocks are passed through).
Row input_count + r is the recovery row for exponent recovery_exponents[r]:
[c[0]^exp, c[1]^exp, c[2]^exp, ..., c[k-1]^exp]
Sourcepub fn select_rows(&self, row_indices: &[usize]) -> Self
pub fn select_rows(&self, row_indices: &[usize]) -> Self
Select specific rows from this matrix, returning a new matrix.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GfMatrix
impl RefUnwindSafe for GfMatrix
impl Send for GfMatrix
impl Sync for GfMatrix
impl Unpin for GfMatrix
impl UnsafeUnpin for GfMatrix
impl UnwindSafe for GfMatrix
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> 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