Changeset 2531 for inundation/utilities/numerical_tools.py
- Timestamp:
- Mar 13, 2006, 11:57:44 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/utilities/numerical_tools.py
r2526 r2531 4 4 """ 5 5 6 import Numeric 7 8 6 7 #Establish which Numeric package to use 8 #(this should move to somewhere central) 9 try: 10 from scipy import ArrayType, array, sum, innerproduct, ravel, sqrt 11 except: 12 print 'Could not find scipy - using Numeric' 13 from Numeric import ArrayType, array, sum, innerproduct, ravel, sqrt 14 9 15 10 16 def angle(v): … … 14 20 15 21 from math import acos, pi, sqrt 16 from Numeric import sum, array17 22 18 23 l = sqrt( sum (array(v)**2)) … … 72 77 """Mean value of a vector 73 78 """ 74 return(float( Numeric.sum(x))/len(x))79 return(float(sum(x))/len(x)) 75 80 76 81 … … 90 95 cy = y - mean(y) 91 96 92 p = Numeric.innerproduct(cx,cy)/N97 p = innerproduct(cx,cy)/N 93 98 return(p) 94 99 … … 130 135 """ 131 136 132 y = Numeric.ravel(x)133 p = Numeric.sqrt(Numeric.innerproduct(y,y))137 y = ravel(x) 138 p = sqrt(innerproduct(y,y)) 134 139 return p 135 140 … … 168 173 This function is necessary as array(A) can cause memory overflow. 169 174 """ 170 171 from Numeric import ArrayType, array172 175 173 176 if typecode is None:
Note: See TracChangeset
for help on using the changeset viewer.