(U, B, BtBinv)
return U
U is the prolongator update.  Project out components of U such that U*B = 0.

    Parameters
    ----------
    U : bsr_matrix
        m x n sparse bsr matrix
        Update to the prolongator
    B : array
        n x k array of the coarse grid near nullspace vectors
    BtBinv : array
        Local inv(B_i.H*B_i) matrices for each supernode, i
        B_i is B restricted to the sparsity pattern of supernode i in U

    Returns
    -------
    Updated U, so that U*B = 0.
    Update is computed by orthogonally (in 2-norm) projecting
    out the components of span(B) in U in a row-wise fashion.

    See Also
    --------
    The principal calling routine,
    pyamg.aggregation.smooth.energy_prolongation_smoother
U is the prolongator update.  Project out components of U such that U*B = 0.
U is the prolongator update . Project out components of U such that U * B = 0 .
def satisfy_constraints(U, B, BtBinv):
    """U is the prolongator update.  Project out components of U such that U*B = 0.

    Parameters
    ----------
    U : bsr_matrix
        m x n sparse bsr matrix
        Update to the prolongator
    B : array
        n x k array of the coarse grid near nullspace vectors
    BtBinv : array
        Local inv(B_i.H*B_i) matrices for each supernode, i
        B_i is B restricted to the sparsity pattern of supernode i in U

    Returns
    -------
    Updated U, so that U*B = 0.
    Update is computed by orthogonally (in 2-norm) projecting
    out the components of span(B) in U in a row-wise fashion.

    See Also
    --------
    The principal calling routine,
    pyamg.aggregation.smooth.energy_prolongation_smoother

    """
    rows_per_block = U.blocksize[0]
    cols_per_block = U.blocksize[1]
    num_block_rows = int(U.shape[0]/rows_per_block)

    UB = np.ravel(U*B)

    # Apply constraints, noting that we need the conjugate of B
    # for use as Bi.H in local projection
    amg_core.satisfy_constraints_helper(rows_per_block, cols_per_block,
                                        num_block_rows, B.shape[1],
                                        np.conjugate(np.ravel(B)),
                                        UB, np.ravel(BtBinv),
                                        U.indptr, U.indices,
                                        np.ravel(U.data))

    return U
def satisfy_constraints ( U , B , BtBinv ) : rows_per_block = U . blocksize [ 0 ] cols_per_block = U . blocksize [ 1 ] num_block_rows = int ( U . shape [ 0 ] / rows_per_block ) UB = np . ravel ( U * B ) # Apply constraints, noting that we need the conjugate of B # for use as Bi.H in local projection amg_core . satisfy_constraints_helper ( rows_per_block , cols_per_block , num_block_rows , B . shape [ 1 ] , np . conjugate ( np . ravel ( B ) ) , UB , np . ravel ( BtBinv ) , U . indptr , U . indices , np . ravel ( U . data ) ) return U