(lvl, iterations=DEFAULT_NITER, omega=1.0, Dinv=None,
                       blocksize=None, withrho=True)
return smoother
Set up block Jacobi.
Set up block Jacobi.
Set up block Jacobi .
def setup_block_jacobi(lvl, iterations=DEFAULT_NITER, omega=1.0, Dinv=None,
                       blocksize=None, withrho=True):
    """Set up block Jacobi."""
    # Determine Blocksize
    if blocksize is None and Dinv is None:
        if sparse.isspmatrix_csr(lvl.A):
            blocksize = 1
        elif sparse.isspmatrix_bsr(lvl.A):
            blocksize = lvl.A.blocksize[0]
    elif blocksize is None:
        blocksize = Dinv.shape[1]

    if blocksize == 1:
        # Block Jacobi is equivalent to normal Jacobi
        return setup_jacobi(lvl, iterations=iterations, omega=omega,
                            withrho=withrho)
    # Use Block Jacobi
    if Dinv is None:
        Dinv = get_block_diag(lvl.A, blocksize=blocksize, inv_flag=True)
    if withrho:
        omega = omega/rho_block_D_inv_A(lvl.A, Dinv)

    def smoother(A, x, b):
        relaxation.block_jacobi(A, x, b, iterations=iterations,
                                omega=omega, Dinv=Dinv,
                                blocksize=blocksize)
    return smoother
def setup_block_jacobi ( lvl , iterations = DEFAULT_NITER , omega = 1.0 , Dinv = None , blocksize = None , withrho = True ) : # Determine Blocksize if blocksize is None and Dinv is None : if sparse . isspmatrix_csr ( lvl . A ) : blocksize = 1 elif sparse . isspmatrix_bsr ( lvl . A ) : blocksize = lvl . A . blocksize [ 0 ] elif blocksize is None : blocksize = Dinv . shape [ 1 ] if blocksize == 1 : # Block Jacobi is equivalent to normal Jacobi return setup_jacobi ( lvl , iterations = iterations , omega = omega , withrho = withrho ) # Use Block Jacobi if Dinv is None : Dinv = get_block_diag ( lvl . A , blocksize = blocksize , inv_flag = True ) if withrho : omega = omega / rho_block_D_inv_A ( lvl . A , Dinv ) def smoother ( A , x , b ) : relaxation . block_jacobi ( A , x , b , iterations = iterations , omega = omega , Dinv = Dinv , blocksize = blocksize ) return smoother