pub fn compute_image(&self, last_target_col: usize, first_source_col: usize) -> Subspace {
        let p = self.prime();
        let first_kernel_row = self.find_first_row_in_block(first_source_col);
        let mut image_matrix = Matrix::new(p, first_kernel_row, last_target_col);
        for i in 0..first_kernel_row {
            image_matrix[i]
                .as_slice_mut()
                .assign(self[i].slice(0, last_target_col));
        }
        image_matrix.pivots = self.pivots()[..last_target_col].to_vec();
        Subspace {
            matrix: image_matrix,
        }
    }
/// Computes the quasi-inverse of a matrix given a rref of [A|0|I], where 0 is the zero padding
/// as usual.
///
/// # Arguments
///  * `last_target_col` - the last column of A
///  * `first_source_col` - the first column of I
///
/// # Example
/// ```
/// # use fp::prime::ValidPrime;
/// let p = ValidPrime::new(3);
/// # use fp::matrix::Matrix;
/// # use fp::vector::FpVector;
/// let input  = [vec![1, 2, 1, 1, 0],
///               vec![1, 0, 2, 1, 1],
///               vec![2, 2, 0, 2, 1]];
///
/// let (padded_cols, mut m) = Matrix::augmented_from_vec(p, &input);
/// m.row_reduce();
///
/// let computed_image = m.compute_image(input[0].len(), padded_cols);
///
/// let image = [vec![1, 0, 2, 1, 1],
///              vec![0, 1, 1, 0, 1]];
/// assert_eq!(computed_image.matrix, Matrix::from_vec(p, &image));
/// assert_eq!(computed_image.pivots(), &vec![0, 1, -1, -1, -1]);
/// ```
Computes the quasi-inverse of a matrix given a rref of [A|0|I], where 0 is the zero padding
as usual.
Computes the quasi - inverse of a matrix given a rref of [ A|0|I ] where 0 is the zero padding as usual .
pub fn compute_image(&self, last_target_col: usize, first_source_col: usize) -> Subspace {
        let p = self.prime();
        let first_kernel_row = self.find_first_row_in_block(first_source_col);
        let mut image_matrix = Matrix::new(p, first_kernel_row, last_target_col);
        for i in 0..first_kernel_row {
            image_matrix[i]
                .as_slice_mut()
                .assign(self[i].slice(0, last_target_col));
        }
        image_matrix.pivots = self.pivots()[..last_target_col].to_vec();
        Subspace {
            matrix: image_matrix,
        }
    }
pub fn compute_image ( & self , last_target_col : usize , first_source_col : usize ) -> Subspace { let p = self . prime ( ) ; let first_kernel_row = self . find_first_row_in_block ( first_source_col ) ; let mut image_matrix = Matrix :: new ( p , first_kernel_row , last_target_col ) ; for i in 0 .. first_kernel_row { image_matrix [ i ] . as_slice_mut ( ) . assign ( self [ i ] . slice ( 0 , last_target_col ) ) ; } image_matrix . pivots = self . pivots ( ) [ .. last_target_col ] . to_vec ( ) ; Subspace { matrix : image_matrix , } }
Computes the quasi-inverse of a matrix given a rref of [A|0|I], where 0 is the zero padding
as usual.
Computes the quasi - inverse of a matrix given a rref of [ A|0|I ] where 0 is the zero padding as usual .
&self
last_target_col
usize
first_source_col
usize
&self
last_target_col
usize
first_source_col
usize
example
None
use fp::prime::validprime;
let p = ValidPrime::new(3).
let p = ValidPrime :: new ( 3 ) .
use fp::matrix::matrix;
None
use fp::vector::fpvector;


let (padded_cols, mut m) = Matrix::augmented_from_vec(p, &input);
m.row_reduce().

let computed_image = m.compute_image(input[0].len(), padded_cols).


let ( padded_cols mut m ) = Matrix :: augmented_from_vec ( p &input ) ; m . row_reduce () . let computed_image = m . compute_image ( input [ 0 ] . len () padded_cols ) .