fn create_minus_pi_from_artificial<'a, MP: MatrixProvider>(
        basis_inverse: &BI,
        provider: &'a MP,
        basis: &[usize],
    ) -> DenseVector<F>
    where
        F: ops::Column<<MP::Column as Column>::F> + ops::Cost<MP::Cost<'a>>,
    {
        let m = basis_inverse.m();
        debug_assert_eq!(provider.nr_rows(), m);
        debug_assert_eq!(basis.len(), m);

        let b_inverse_columns = (0..m)
            .map(|i| IdentityColumnStruct((i, One)))
            .map(|column| basis_inverse.generate_column(column))
            .map(BI::ColumnComputationInfo::into_column)
            .map(SparseVector::into_iter);
        let mut b_inverse_rows = vec![Vec::new(); m];
        for (j, column) in b_inverse_columns.enumerate() {
            for (i, v) in column {
                b_inverse_rows[i].push((j, v));
            }
        }

        let mut pi = vec![F::zero(); m];
        for (i, inverse_row) in b_inverse_rows.into_iter().enumerate() {
            for (j, value) in inverse_row {
                pi[j] += value * provider.cost_value(basis[i]);
            }
        }

        let data = pi.into_iter().map(Neg::neg).collect::<Vec<_>>();
        let len = data.len();
        DenseVector::new(data, len)
    }
/// Create the `minus_pi` field from an existing basis.
///
/// # Arguments
///
/// * `basis_inverse_rows`: A basis inverse that represents a basic feasible solution.
/// * `provider`: Matrix provider.
/// * `basis`: Indices of the basis elements.
Create the `minus_pi` field from an existing basis.
Create the ` minus_pi ` field from an existing basis .
fn create_minus_pi_from_artificial<'a, MP: MatrixProvider>(
        basis_inverse: &BI,
        provider: &'a MP,
        basis: &[usize],
    ) -> DenseVector<F>
    where
        F: ops::Column<<MP::Column as Column>::F> + ops::Cost<MP::Cost<'a>>,
    {
        let m = basis_inverse.m();
        debug_assert_eq!(provider.nr_rows(), m);
        debug_assert_eq!(basis.len(), m);
        let b_inverse_columns = (0..m)
            .map(|i| IdentityColumnStruct((i, One)))
            .map(|column| basis_inverse.generate_column(column))
            .map(BI::ColumnComputationInfo::into_column)
            .map(SparseVector::into_iter);
        let mut b_inverse_rows = vec![Vec::new(); m];
        for (j, column) in b_inverse_columns.enumerate() {
            for (i, v) in column {
                b_inverse_rows[i].push((j, v));
            }
        }
        let mut pi = vec![F::zero(); m];
        for (i, inverse_row) in b_inverse_rows.into_iter().enumerate() {
            for (j, value) in inverse_row {
                pi[j] += value * provider.cost_value(basis[i]);
            }
        }
        let data = pi.into_iter().map(Neg::neg).collect::<Vec<_>>();
        let len = data.len();
        DenseVector::new(data, len)
    }
fn create_minus_pi_from_artificial < ' a , MP : MatrixProvider > ( basis_inverse : & BI , provider : & ' a MP , basis : & [ usize ] , ) -> DenseVector < F > where F : ops :: Column < < MP :: Column as Column > :: F > + ops :: Cost < MP :: Cost < ' a > > , { let m = basis_inverse . m ( ) ; debug_assert_eq ! ( provider nr_rows ( ) m ) ; debug_assert_eq ! ( basis len ( ) m ) ; let b_inverse_columns = ( 0 .. m ) . map ( | i | IdentityColumnStruct ( ( i , One ) ) ) . map ( | column | basis_inverse . generate_column ( column ) ) . map ( BI :: ColumnComputationInfo :: into_column ) . map ( SparseVector :: into_iter ) ; let mut b_inverse_rows = vec ! [ Vec new ( ) m ] ; for ( j , column ) in b_inverse_columns . enumerate ( ) { for ( i , v ) in column { b_inverse_rows [ i ] . push ( ( j , v ) ) ; } } let mut pi = vec ! [ F zero ( ) m ] ; for ( i , inverse_row ) in b_inverse_rows . into_iter ( ) . enumerate ( ) { for ( j , value ) in inverse_row { pi [ j ] += value * provider . cost_value ( basis [ i ] ) ; } } let data = pi . into_iter ( ) . map ( Neg :: neg ) . collect :: < Vec < _ > > ( ) ; let len = data . len ( ) ; DenseVector :: new ( data , len ) }
Create the `minus_pi` field from an existing basis.
Create the ` minus_pi ` field from an existing basis .
basis_inverse
&BI
provider
&'a MP
basis
&[usize]
basis_inverse
&BI
provider
&'a MP
basis
&[usize]