[Scipy-svn] r3809 - in branches/testing_cleanup: . scipy/sandbox/multigrid scipy/sandbox/timeseries

scipy-svn at scipy.org scipy-svn at scipy.org
Wed Jan 9 01:42:40 EST 2008


Author: matthew.brett at gmail.com
Date: 2008-01-09 00:42:31 -0600 (Wed, 09 Jan 2008)
New Revision: 3809

Modified:
   branches/testing_cleanup/
   branches/testing_cleanup/scipy/sandbox/multigrid/multilevel.py
   branches/testing_cleanup/scipy/sandbox/multigrid/sa.py
   branches/testing_cleanup/scipy/sandbox/timeseries/dates.py
Log:
Merged revisions 3806,3808 via svnmerge from 
http://svn.scipy.org/svn/scipy/trunk

........
  r3806 | wnbell | 2008-01-08 16:53:59 -0800 (Tue, 08 Jan 2008) | 2 lines
  
  small change to SA
........
  r3808 | mattknox_ca | 2008-01-08 19:31:57 -0800 (Tue, 08 Jan 2008) | 1 line
  
  converted tabs to spaces
........



Property changes on: branches/testing_cleanup
___________________________________________________________________
Name: svnmerge-integrated
   - /branches/scipy.scons:1-3533 /trunk:1-3662,3667-3672,3674-3675,3684,3723-3735,3738,3744,3749,3754-3755,3759,3761,3764,3769,3774,3778-3803
   + /branches/scipy.scons:1-3533 /trunk:1-3662,3667-3672,3674-3675,3684,3723-3735,3738,3744,3749,3754-3755,3759,3761,3764,3769,3774,3778-3808

Modified: branches/testing_cleanup/scipy/sandbox/multigrid/multilevel.py
===================================================================
--- branches/testing_cleanup/scipy/sandbox/multigrid/multilevel.py	2008-01-09 03:31:57 UTC (rev 3808)
+++ branches/testing_cleanup/scipy/sandbox/multigrid/multilevel.py	2008-01-09 06:42:31 UTC (rev 3809)
@@ -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: branches/testing_cleanup/scipy/sandbox/multigrid/sa.py
===================================================================
--- branches/testing_cleanup/scipy/sandbox/multigrid/sa.py	2008-01-09 03:31:57 UTC (rev 3808)
+++ branches/testing_cleanup/scipy/sandbox/multigrid/sa.py	2008-01-09 06:42:31 UTC (rev 3809)
@@ -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
 

Modified: branches/testing_cleanup/scipy/sandbox/timeseries/dates.py
===================================================================
--- branches/testing_cleanup/scipy/sandbox/timeseries/dates.py	2008-01-09 03:31:57 UTC (rev 3808)
+++ branches/testing_cleanup/scipy/sandbox/timeseries/dates.py	2008-01-09 06:42:31 UTC (rev 3809)
@@ -563,39 +563,39 @@
     return fcode
 
 def guess_freq_date(dates):
-	"""Tries to estimate the frequency of a sequence of datetime objects."""
-	if not type(dates[0]) is dt.datetime:
-		raise AttributeError, "dates not a sequence of datetime objects."
+    """Tries to estimate the frequency of a sequence of datetime objects."""
+    if not type(dates[0]) is dt.datetime:
+        raise AttributeError, "dates not a sequence of datetime objects."
 
-	sorted_dates = numpy.sort(dates)
-	ddif = numpy.diff(sorted_dates)
-	dset = set(ddif)
-	try:
-		dset.remove(dt.timedelta(0))
-	except:
-		pass
-	res = min(dset)
-	if getattr(res, 'seconds', 0) >= 1:
-		fcode = _c.FR_SEC
-	elif getattr(res, 'seconds', 0) >= 60:
-		fcode = _c.FR_MIN
-	elif getattr(res, 'seconds', 0) >= 60*60:
-		fcode = _c.FR_HR
-	elif getattr(res, 'day', 0) >= 1:
-		fcode = _c.FR_DAY			
-	elif getattr(res, 'day', 0) >= 7:
-		fcode = _c.FR_WK
-	elif getattr(res, 'month', 0) >= 1:
-		fcode = _c.FR_MTH
-	elif getattr(res, 'month', 0) >= 3:
-		fcode = _c.FR_QTR
-	elif getattr(res, 'year', 0) >= 1:
-		fcode = _c.FR_ANN
-	else:
-		warnings.warn("Unable to estimate the frequency! %s" % res.__str__())
-		fcode = _c.FR_UND
-	return fcode
-	
+    sorted_dates = numpy.sort(dates)
+    ddif = numpy.diff(sorted_dates)
+    dset = set(ddif)
+    try:
+        dset.remove(dt.timedelta(0))
+    except:
+        pass
+    res = min(dset)
+    if getattr(res, 'seconds', 0) >= 1:
+        fcode = _c.FR_SEC
+    elif getattr(res, 'seconds', 0) >= 60:
+        fcode = _c.FR_MIN
+    elif getattr(res, 'seconds', 0) >= 60*60:
+        fcode = _c.FR_HR
+    elif getattr(res, 'day', 0) >= 1:
+        fcode = _c.FR_DAY           
+    elif getattr(res, 'day', 0) >= 7:
+        fcode = _c.FR_WK
+    elif getattr(res, 'month', 0) >= 1:
+        fcode = _c.FR_MTH
+    elif getattr(res, 'month', 0) >= 3:
+        fcode = _c.FR_QTR
+    elif getattr(res, 'year', 0) >= 1:
+        fcode = _c.FR_ANN
+    else:
+        warnings.warn("Unable to estimate the frequency! %s" % res.__str__())
+        fcode = _c.FR_UND
+    return fcode
+    
 
 def _listparser(dlist, freq=None):
     "Constructs a DateArray from a list."
@@ -614,8 +614,8 @@
         if freq is None or freq == _c.FR_UND:
             freq = guess_freq(ords)
         if freq == _c.FR_UND:
-        	dtobj = [DateTimeFromString(s) for s in dlist]
-        	freq = guess_freq_date(dtobj)
+            dtobj = [DateTimeFromString(s) for s in dlist]
+            freq = guess_freq_date(dtobj)
         #...construct a list of dates
         for s in dlist:
             x = Date(freq, string=s)




More information about the Scipy-svn mailing list