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

scipy-svn@scip... scipy-svn@scip...
Tue Jan 8 18:54:02 CST 2008


Author: wnbell
Date: 2008-01-08 18:53:59 -0600 (Tue, 08 Jan 2008)
New Revision: 3806

Modified:
   trunk/scipy/sandbox/multigrid/multilevel.py
   trunk/scipy/sandbox/multigrid/sa.py
Log:
small change to SA


Modified: trunk/scipy/sandbox/multigrid/multilevel.py
===================================================================
--- trunk/scipy/sandbox/multigrid/multilevel.py	2008-01-08 23:50:11 UTC (rev 3805)
+++ trunk/scipy/sandbox/multigrid/multilevel.py	2008-01-09 00:53:59 UTC (rev 3806)
@@ -88,7 +88,7 @@
     *Parameters*:
 
         A : {csr_matrix}
-            NxN matrix in CSR format
+            NxN matrix in CSR or BSR format
         B : {None, array_like} : optional
             Near-nullspace candidates stored in the columns of an NxK array.
             The default value B=None is equivalent to B=ones((N,1))
@@ -129,10 +129,12 @@
 
     """
 
+    A = A.asfptype()
+
     if B is None:
         B = ones((A.shape[0],1),dtype=A.dtype) # use constant vector
     else:
-        B = asarray(B)
+        B = asarray(B,dtype=A.dtype)
 
     pre,post = None,None   #preprocess/postprocess
 

Modified: trunk/scipy/sandbox/multigrid/sa.py
===================================================================
--- trunk/scipy/sandbox/multigrid/sa.py	2008-01-08 23:50:11 UTC (rev 3805)
+++ trunk/scipy/sandbox/multigrid/sa.py	2008-01-09 00:53:59 UTC (rev 3806)
@@ -103,8 +103,8 @@
 
 
 def sa_fit_candidates(AggOp,candidates,tol=1e-10):
-    #TODO handle non-floating point candidates better
-    candidates = candidates.astype('float64')
+    if candidates.dtype != 'float32':
+        candidates = asarray(candidates,dtype='float64')
 
     K = candidates.shape[1] # num candidates
 



More information about the Scipy-svn mailing list