pub trait TransformTarget<R>{
// Required method
fn transform<S: Copy + RingStore<Type = R>>(
&mut self,
ring: S,
i: usize,
j: usize,
transform: &[R::Element; 4],
);
// Provided methods
fn subtract<S: Copy + RingStore<Type = R>>(
&mut self,
ring: S,
src: usize,
dst: usize,
factor: &R::Element,
) { ... }
fn swap<S: Copy + RingStore<Type = R>>(
&mut self,
ring: S,
i: usize,
j: usize,
) { ... }
}
Expand description
A trait for a “target” that can “consume” elementary operations on matrices.
This is mainly used during algorithms that work on matrices, since in many cases they transform matrices using elementary row or column operations, and have to accumulate data depending on these operations.
Required Methods§
Sourcefn transform<S: Copy + RingStore<Type = R>>(
&mut self,
ring: S,
i: usize,
j: usize,
transform: &[R::Element; 4],
)
fn transform<S: Copy + RingStore<Type = R>>( &mut self, ring: S, i: usize, j: usize, transform: &[R::Element; 4], )
The transformation given by the matrix A
with A[k, l]
being
1
ifk = l
andk != i, j
transform[0]
if(k, l) = (i, i)
transform[1]
if(k, l) = (i, j)
transform[2]
if(k, l) = (j, i)
transform[3]
if(k, l) = (j, j)
0
otherwise
In other words, the matrix looks like
| 1 ... 0 |
| ⋮ ⋮ |
| 0 ... 1 |
| A B | <- i-th row
| 1 ... 0 |
| ⋮ ⋮ |
| 0 ... 1 |
| C D | <- j-th row
| 1 ... 0 |
| ⋮ ⋮ |
| 0 ... 1 |
^ i-th col ^ j-th col
where transform = [A, B, C, D]
.
Provided Methods§
Sourcefn subtract<S: Copy + RingStore<Type = R>>(
&mut self,
ring: S,
src: usize,
dst: usize,
factor: &R::Element,
)
fn subtract<S: Copy + RingStore<Type = R>>( &mut self, ring: S, src: usize, dst: usize, factor: &R::Element, )
The transformation corresponding to subtracting factor
times the src
-th row
resp. col from the dst
-th row resp. col.
More precisely, the (k, l)
-th entry of the transform matrix is defined to be
1
ifk == l
-factor
ifk == dst, l == src
0
otherwise
Sourcefn swap<S: Copy + RingStore<Type = R>>(&mut self, ring: S, i: usize, j: usize)
fn swap<S: Copy + RingStore<Type = R>>(&mut self, ring: S, i: usize, j: usize)
The transformation corresponding to the permutation matrix swapping i
-th and j
-th row
resp. column.
More precisely, the (k, l)
-th entry of the transform matrix is defined to be
1
ifk == l, k != i, k != j
1
ifk == i, l == j
1
ifk == j, l == i
0
otherwise
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.