pub fn extend_image(
        &mut self,
        start_column: usize,
        end_column: usize,
        desired_image: &Subspace,
        extra_column_capacity: usize,
    ) -> Vec<usize> {
        let mut added_pivots = Vec::new();
        let desired_pivots = desired_image.matrix.pivots();
        let early_end_column = std::cmp::min(end_column, desired_pivots.len() + start_column);

        let columns = self.columns();

        for i in start_column..early_end_column {
            debug_assert!(
                self.pivots()[i] < 0 || desired_pivots[i - start_column] >= 0,
                "current_pivots : {:?}, desired_pivots : {:?}",
                self.pivots(),
                desired_pivots
            );
            if self.pivots()[i] >= 0 || desired_pivots[i - start_column] < 0 {
                continue;
            }
            // Look up the cycle that we're missing and add a generator hitting it.
            let kernel_vector_row = desired_pivots[i - start_column] as usize;
            let new_image = &desired_image[kernel_vector_row];

            let mut new_row =
                FpVector::new_with_capacity(self.prime(), columns, columns + extra_column_capacity);
            new_row
                .slice_mut(start_column, start_column + desired_image.matrix.columns)
                .assign(new_image.as_slice());
            self.vectors.push(new_row);

            added_pivots.push(i);
        }
        added_pivots
    }
/// Given a matrix in rref, say [A|B|C], where B lies between columns `start_column` and
/// `end_columns`, and a subspace of the image of B, add rows to the matrix such that the image
/// of B becomes this subspace.
///
/// The rows added are basis vectors of the desired image as specified in the Subspace object.
/// The function returns the list of new pivot columns.
///
/// # Panics
/// It *may* panic if the current image is not contained in `desired_image`, but is not
/// guaranteed to do so.
Given a matrix in rref, say [A|B|C], where B lies between columns `start_column` and
`end_columns`, and a subspace of the image of B, add rows to the matrix such that the image
of B becomes this subspace.

The rows added are basis vectors of the desired image as specified in the Subspace object.
The function returns the list of new pivot columns.
Given a matrix in rref say [ A|B|C ] where B lies between columns ` start_column ` and ` end_columns ` and a subspace of the image of B add rows to the matrix such that the image of B becomes this subspace . The rows added are basis vectors of the desired image as specified in the Subspace object . The function returns the list of new pivot columns .
pub fn extend_image(
        &mut self,
        start_column: usize,
        end_column: usize,
        desired_image: &Subspace,
        extra_column_capacity: usize,
    ) -> Vec<usize> {
        let mut added_pivots = Vec::new();
        let desired_pivots = desired_image.matrix.pivots();
        let early_end_column = std::cmp::min(end_column, desired_pivots.len() + start_column);
        let columns = self.columns();
        for i in start_column..early_end_column {
            debug_assert!(
                self.pivots()[i] < 0 || desired_pivots[i - start_column] >= 0,
                "current_pivots : {:?}, desired_pivots : {:?}",
                self.pivots(),
                desired_pivots
            );
            if self.pivots()[i] >= 0 || desired_pivots[i - start_column] < 0 {
                continue;
            }
            // Look up the cycle that we're missing and add a generator hitting it.
            let kernel_vector_row = desired_pivots[i - start_column] as usize;
            let new_image = &desired_image[kernel_vector_row];
            let mut new_row =
                FpVector::new_with_capacity(self.prime(), columns, columns + extra_column_capacity);
            new_row
                .slice_mut(start_column, start_column + desired_image.matrix.columns)
                .assign(new_image.as_slice());
            self.vectors.push(new_row);
            added_pivots.push(i);
        }
        added_pivots
    }
pub fn extend_image ( & mut self , start_column : usize , end_column : usize , desired_image : & Subspace , extra_column_capacity : usize , ) -> Vec < usize > { let mut added_pivots = Vec :: new ( ) ; let desired_pivots = desired_image . matrix . pivots ( ) ; let early_end_column = std :: cmp :: min ( end_column , desired_pivots . len ( ) + start_column ) ; let columns = self . columns ( ) ; for i in start_column .. early_end_column { debug_assert ! ( self pivots ( ) [ i ] 0 desired_pivots [ i start_column ] 0 " " self pivots ( ) desired_pivots ) ; if self . pivots ( ) [ i ] >= 0 || desired_pivots [ i - start_column ] < 0 { continue ; } // Look up the cycle that we're missing and add a generator hitting it. let kernel_vector_row = desired_pivots [ i - start_column ] as usize ; let new_image = & desired_image [ kernel_vector_row ] ; let mut new_row = FpVector :: new_with_capacity ( self . prime ( ) , columns , columns + extra_column_capacity ) ; new_row . slice_mut ( start_column , start_column + desired_image . matrix . columns ) . assign ( new_image . as_slice ( ) ) ; self . vectors . push ( new_row ) ; added_pivots . push ( i ) ; } added_pivots }
Given a matrix in rref, say [A|B|C], where B lies between columns `start_column` and
`end_columns`, and a subspace of the image of B, add rows to the matrix such that the image
of B becomes this subspace.
Given a matrix in rref say [ A|B|C ] where B lies between columns ` start_column ` and ` end_columns ` and a subspace of the image of B add rows to the matrix such that the image of B becomes this subspace .
&mut self
start_column
usize
end_column
usize
desired_image
&Subspace
extra_column_capacity
usize
&mut self
start_column
usize
end_column
usize
desired_image
&Subspace
extra_column_capacity
usize
panics
It *may* panic if the current image is not contained in `desired_image`, but is not
guaranteed to do so.
It * may * panic if the current image is not contained in ` desired_image ` but is not guaranteed to do so .