run += 1

    # Print Problem Description
    print "\nAMG Scalability Study for Ax = 0, x_init = rand\n"
    print "Emphasis on Robustness of Evolution Strength "
    print "Measure and Root-Node Solver\n"
    print "Rotated Anisotropic Diffusion in 2D"
    print "Anisotropic Coefficient = %1.3e" % epsilon
    print "Rotation Angle = %1.3f" % theta

    # Print Tables
    print_scalability(
        factors_classic,
        complexity_classic,
        nnz_classic,
        sizelist_classic,
        plotting=False,
        title='Classic SA\nClassic Strength Measure DropTol = %1.2f' %
        classic_theta)
    print_scalability(
        factors_ode,
        complexity_ode,
        nnz_ode,
        sizelist_ode,
        plotting=False,
        title='Classic SA\nEvolution Strength Measure DropTol = %1.2f' %
        evolution_theta)
    print_scalability(
        factors_ode_root,
        complexity_ode_root,
        nnz_ode_root,
        run += 1

    # Print Problem Description
    print "\nAMG Scalability Study for Ax = 0, x_init = rand\n"
    print "Emphasis on Robustness of Evolution Strength "
    print "Measure and Root-Node Solver\n"
    print "Rotated Anisotropic Diffusion in 2D"
    print "Anisotropic Coefficient = %1.3e" % epsilon
    print "Rotation Angle = %1.3f" % theta

    # Print Tables
    print_scalability(
        factors_classic,
        complexity_classic,
        nnz_classic,
        sizelist_classic,
        plotting=False,
        title="Classic SA\nClassic Strength Measure DropTol = %1.2f" % classic_theta,
    )
    print_scalability(
        factors_ode,
        complexity_ode,
        nnz_ode,
        sizelist_ode,
        plotting=False,
        title="Classic SA\nEvolution Strength Measure DropTol = %1.2f" % evolution_theta,
    )
    print_scalability(
        factors_ode_root,
        complexity_ode_root,
        nnz_ode_root,
Esempio n. 3
0
    for n in nlist:
        nx = n
        ny = n
        print "n = %-10d of %-10d" % (n, nlist[-1])

        # Rotated Anisotropic Diffusion
        stencil = diffusion_stencil_2d(type='FE',
                                       epsilon=0.001,
                                       theta=scipy.pi / 3)

        A = stencil_grid(stencil, (nx, ny), format='csr')

        S = classical_strength_of_connection(A, 0.0)

        numpy.random.seed(625)
        x = scipy.rand(A.shape[0])
        b = A * scipy.rand(A.shape[0])

        ml = ruge_stuben_solver(A, max_coarse=10)

        resvec = []
        x = ml.solve(b, x0=x, maxiter=200, tol=1e-8, residuals=resvec)
        factors[run] = (resvec[-1] / resvec[0])**(1.0 / len(resvec))
        complexity[run] = ml.operator_complexity()
        nnz[run] = A.nnz
        sizelist[run] = A.shape[0]
        run += 1

    print_scalability(factors, complexity, nnz, sizelist, plotting=True)
    sizelist=numpy.zeros((len(nlist),1)).ravel()
    run=0

    for n in nlist:
        nx = n
        ny = n
        print "n = %-10d of %-10d"%(n,nlist[-1])

        # Rotated Anisotropic Diffusion
        stencil = diffusion_stencil_2d(type='FE',epsilon=0.001,theta=scipy.pi/3)

        A = stencil_grid(stencil, (nx,ny), format='csr')

        S = classical_strength_of_connection(A, 0.0)

        numpy.random.seed(625)
        x = scipy.rand(A.shape[0])
        b = A*scipy.rand(A.shape[0])

        ml = ruge_stuben_solver(A, max_coarse=10)

        resvec = []
        x = ml.solve(b, x0=x, maxiter=200, tol=1e-8, residuals=resvec)
        factors[run] = (resvec[-1]/resvec[0])**(1.0/len(resvec))
        complexity[run] = ml.operator_complexity()
        nnz[run] = A.nnz
        sizelist[run]=A.shape[0]
        run +=1

    print_scalability(factors, complexity, nnz, sizelist, plotting=True)