[Scipy-svn] r3255 - trunk/scipy/sandbox/multigrid

scipy-svn@scip... scipy-svn@scip...
Wed Aug 22 13:35:13 CDT 2007


Author: wnbell
Date: 2007-08-22 13:35:07 -0500 (Wed, 22 Aug 2007)
New Revision: 3255

Added:
   trunk/scipy/sandbox/multigrid/coarsen.py
Removed:
   trunk/scipy/sandbox/multigrid/multigrid.py
Modified:
   trunk/scipy/sandbox/multigrid/multilevel.py
Log:
moved multigrid.py to coarsen.py



Copied: trunk/scipy/sandbox/multigrid/coarsen.py (from rev 3254, trunk/scipy/sandbox/multigrid/multigrid.py)

Deleted: trunk/scipy/sandbox/multigrid/multigrid.py
===================================================================
--- trunk/scipy/sandbox/multigrid/multigrid.py	2007-08-22 18:26:02 UTC (rev 3254)
+++ trunk/scipy/sandbox/multigrid/multigrid.py	2007-08-22 18:35:07 UTC (rev 3255)
@@ -1,66 +0,0 @@
-from scipy import *
-
-import multigridtools
-import scipy
-import numpy
-    
-from pydec import diag_sparse,inf_norm
-
-
-def rs_strong_connections(A,theta):
-    if not scipy.sparse.isspmatrix_csr(A): raise TypeError('expected sparse.csr_matrix')
-
-    Sp,Sj,Sx = multigridtools.rs_strong_connections(A.shape[0],theta,A.indptr,A.indices,A.data)
-    return scipy.sparse.csr_matrix((Sx,Sj,Sp),A.shape)
-
-
-def rs_interpolation(A,theta=0.25):
-    if not scipy.sparse.isspmatrix_csr(A): raise TypeError('expected sparse.csr_matrix')
-    
-    S = rs_strong_connections(A,theta)
-
-    T = S.T.tocsr()
-
-    Ip,Ij,Ix = multigridtools.rs_interpolation(A.shape[0],\
-                                               A.indptr,A.indices,A.data,\
-                                               S.indptr,S.indices,S.data,\
-                                               T.indptr,T.indices,T.data)
-
-    return scipy.sparse.csr_matrix((Ix,Ij,Ip))
-
-
-def sa_strong_connections(A,epsilon):
-    if not scipy.sparse.isspmatrix_csr(A): raise TypeError('expected sparse.csr_matrix')
-
-    Sp,Sj,Sx = multigridtools.sa_strong_connections(A.shape[0],epsilon,A.indptr,A.indices,A.data)
-    return scipy.sparse.csr_matrix((Sx,Sj,Sp),A.shape)
-
-def sa_constant_interpolation(A,epsilon=0.08):
-    if not scipy.sparse.isspmatrix_csr(A): raise TypeError('expected sparse.csr_matrix')
-    
-    S = sa_strong_connections(A,epsilon)
-    
-    #tentative (non-smooth) interpolation operator I
-    Ij = multigridtools.sa_get_aggregates(A.shape[0],S.indptr,S.indices)
-    Ip = numpy.arange(len(Ij)+1)
-    Ix = numpy.ones(len(Ij))
-    
-    return scipy.sparse.csr_matrix((Ix,Ij,Ip))
-
-
-def sa_interpolation(A,epsilon=0.08,omega=4.0/3.0):
-    if not scipy.sparse.isspmatrix_csr(A): raise TypeError('expected sparse.csr_matrix')
-    
-    I = sa_constant_interpolation(A,epsilon)
-
-    D_inv = diag_sparse(1.0/diag_sparse(A))       
-    
-    D_inv_A  = D_inv * A
-    D_inv_A *= -omega/inf_norm(D_inv_A)
-
-    P = I + (D_inv_A*I)  #same as P=S*I, (faster?)
-        
-    return P
-
-
-

Modified: trunk/scipy/sandbox/multigrid/multilevel.py
===================================================================
--- trunk/scipy/sandbox/multigrid/multilevel.py	2007-08-22 18:26:02 UTC (rev 3254)
+++ trunk/scipy/sandbox/multigrid/multilevel.py	2007-08-22 18:35:07 UTC (rev 3255)
@@ -3,7 +3,7 @@
 import scipy
 import numpy
 
-from multigrid import sa_interpolation,rs_interpolation
+from coarsen import sa_interpolation,rs_interpolation
 from relaxation import gauss_seidel,jacobi 
 
 
@@ -149,7 +149,7 @@
 
 if __name__ == '__main__':
     from scipy import *
-    A = poisson_problem2D(100).T
+    A = poisson_problem2D(200).T
     asa = smoothed_aggregation_solver(A)
     #asa = ruge_stuben_solver(A)
     x = rand(A.shape[0])



More information about the Scipy-svn mailing list