(lvl, iterations=DEFAULT_NITER,
                             sweep=DEFAULT_SWEEP,
                             Dinv=None, blocksize=None)
return smoother
Set up block Gauss-Seidel.
Set up block Gauss-Seidel.
Set up block Gauss - Seidel .
def setup_block_gauss_seidel(lvl, iterations=DEFAULT_NITER,
                             sweep=DEFAULT_SWEEP,
                             Dinv=None, blocksize=None):
    """Set up block Gauss-Seidel."""
    # 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 GS is equivalent to normal GS
        return setup_gauss_seidel(lvl, iterations=iterations, sweep=sweep)

    # Use Block GS
    if Dinv is None:
        Dinv = get_block_diag(lvl.A, blocksize=blocksize, inv_flag=True)

    def smoother(A, x, b):
        relaxation.block_gauss_seidel(A, x, b, iterations=iterations,
                                      Dinv=Dinv, blocksize=blocksize,
                                      sweep=sweep)

    return smoother
def setup_block_gauss_seidel ( lvl , iterations = DEFAULT_NITER , sweep = DEFAULT_SWEEP , Dinv = None , blocksize = None ) : # 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 GS is equivalent to normal GS return setup_gauss_seidel ( lvl , iterations = iterations , sweep = sweep ) # Use Block GS if Dinv is None : Dinv = get_block_diag ( lvl . A , blocksize = blocksize , inv_flag = True ) def smoother ( A , x , b ) : relaxation . block_gauss_seidel ( A , x , b , iterations = iterations , Dinv = Dinv , blocksize = blocksize , sweep = sweep ) return smoother