struct EchelonRow<M>where
M: MIntDotProduct,{
pivot: usize,
inv: MInt<M>,
row: Vec<MInt<M>>,
}Fields§
§pivot: usize§inv: MInt<M>§row: Vec<MInt<M>>Implementations§
Source§impl<M> EchelonRow<M>where
M: MIntDotProduct,
impl<M> EchelonRow<M>where
M: MIntDotProduct,
Sourcefn reduce(&self, row: &mut [MInt<M>])
fn reduce(&self, row: &mut [MInt<M>])
Examples found in repository?
crates/competitive/src/math/mint_matrix.rs (line 184)
168fn generate_frobenius_block<M>(
169 a: &Matrix<AddMulOperation<MInt<M>>>,
170 mut v: Vec<MInt<M>>,
171 rows: &mut Vec<EchelonRow<M>>,
172 t: &mut Vec<Vec<MInt<M>>>,
173) -> Polynomial<M>
174where
175 M: MIntDotProduct,
176{
177 let n = a.shape.0;
178 loop {
179 let mut row = vec![MInt::zero(); n + rows.len() + 1];
180 let (x, c) = row.split_at_mut(n);
181 x.copy_from_slice(&v);
182 c[rows.len()] = MInt::one();
183 for r in rows.iter() {
184 r.reduce(&mut row);
185 }
186 if let Some(pivot) = row[..n].iter().position(|x| !x.is_zero()) {
187 t.push(v);
188 let u = t.last().unwrap();
189 v = a.data.iter().map(|row| MInt::dot_product(u, row)).collect();
190 rows.push(EchelonRow {
191 pivot,
192 inv: row[pivot].inv(),
193 row,
194 });
195 } else {
196 let mut p = row.split_off(n);
197 while p.last().is_some_and(|x| x.is_zero()) {
198 p.pop();
199 }
200 return Polynomial(p);
201 }
202 }
203}Auto Trait Implementations§
impl<M> Freeze for EchelonRow<M>
impl<M> RefUnwindSafe for EchelonRow<M>
impl<M> Send for EchelonRow<M>
impl<M> Sync for EchelonRow<M>
impl<M> Unpin for EchelonRow<M>
impl<M> UnsafeUnpin for EchelonRow<M>
impl<M> UnwindSafe for EchelonRow<M>
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