pub fn compute_quasi_inverse(
        &self,
        last_target_col: usize,
        first_source_col: usize,
    ) -> QuasiInverse {
        let p = self.prime();
        let columns = self.columns();
        let source_columns = columns - first_source_col;
        let first_kernel_row = self.find_first_row_in_block(first_source_col);
        let mut preimage = Matrix::new(p, first_kernel_row, source_columns);
        for i in 0..first_kernel_row {
            preimage[i]
                .as_slice_mut()
                .assign(self[i].slice(first_source_col, columns));
        }
        QuasiInverse::new(Some(self.pivots()[..last_target_col].to_vec()), preimage)
    }
/// 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 qi = m.compute_quasi_inverse(input[0].len(), padded_cols);
///
/// let preimage = [vec![0, 1, 0],
///                 vec![0, 2, 2]];
/// assert_eq!(qi.preimage(), &Matrix::from_vec(p, &preimage));
/// ```
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_quasi_inverse(
        &self,
        last_target_col: usize,
        first_source_col: usize,
    ) -> QuasiInverse {
        let p = self.prime();
        let columns = self.columns();
        let source_columns = columns - first_source_col;
        let first_kernel_row = self.find_first_row_in_block(first_source_col);
        let mut preimage = Matrix::new(p, first_kernel_row, source_columns);
        for i in 0..first_kernel_row {
            preimage[i]
                .as_slice_mut()
                .assign(self[i].slice(first_source_col, columns));
        }
        QuasiInverse::new(Some(self.pivots()[..last_target_col].to_vec()), preimage)
    }
pub fn compute_quasi_inverse ( & self , last_target_col : usize , first_source_col : usize , ) -> QuasiInverse { let p = self . prime ( ) ; let columns = self . columns ( ) ; let source_columns = columns - first_source_col ; let first_kernel_row = self . find_first_row_in_block ( first_source_col ) ; let mut preimage = Matrix :: new ( p , first_kernel_row , source_columns ) ; for i in 0 .. first_kernel_row { preimage [ i ] . as_slice_mut ( ) . assign ( self [ i ] . slice ( first_source_col , columns ) ) ; } QuasiInverse :: new ( Some ( self . pivots ( ) [ .. last_target_col ] . to_vec ( ) ) , preimage ) }
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 qi = m.compute_quasi_inverse(input[0].len(), padded_cols).


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