Changeset 3850 for anuga_core/source/anuga/utilities
- Timestamp:
- Oct 24, 2006, 4:56:49 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/utilities/numerical_tools.py
r3849 r3850 10 10 #(this should move to somewhere central) 11 11 #try: 12 # from scipy import ArrayType, array, sum, innerproduct, ravel, sqrt, searchsorted, sort, concatenate, Float, arange 12 # from scipy import ArrayType, array, sum, innerproduct, ravel, sqrt, 13 # searchsorted, sort, concatenate, Float, arange 13 14 #except: 14 15 # #print 'Could not find scipy - using Numeric' 15 # from Numeric import ArrayType, array, sum, innerproduct, ravel, sqrt, searchsorted, sort, concatenate, Float, arange 16 from Numeric import ArrayType, array, sum, innerproduct, ravel, sqrt, searchsorted, sort, concatenate, Float, arange 16 # from Numeric import ArrayType, array, sum, innerproduct, ravel, sqrt, 17 #searchsorted, sort, concatenate, Float, arange 18 19 from Numeric import ArrayType, array, sum, innerproduct, ravel, sqrt,\ 20 searchsorted, sort, concatenate, Float, arange 17 21 18 22 # Getting an infinite number to use when using Numeric … … 31 35 """ 32 36 33 error_msg = 'Input to acos is outside allowed domain [-1.0, 1.0]. I got %.12f' %x 37 error_msg = 'Input to acos is outside allowed domain [-1.0, 1.0].'+\ 38 'I got %.12f' %x 34 39 warning_msg = 'Changing argument to acos from %.18f to %.1f' %(x, sign(x)) 35 40 36 # FIXME(Ole): Need function to compute machine precision as this is also 37 # used in fit_interpolate/search_functions.py 38 39 40 eps = 1.0e-15 # Machine precision 41 eps = get_machine_precision() # Machine precision 41 42 if x < -1.0: 42 43 if x < -1.0 - eps: … … 50 51 raise ValueError, errmsg 51 52 else: 52 print 'NOTE: changing argument to acos from %.18f to 1.0' %x 53 print 'NOTE: changing argument to acos from %.18f to 1.0' %x 53 54 x = 1.0 54 55 … … 148 149 y = x 149 150 151 x = ensure_numeric(x) 152 y = ensure_numeric(y) 150 153 assert(len(x)==len(y)) 151 N = len(x) 152 154 155 N = len(x) 153 156 cx = x - mean(x) 154 157 cy = y - mean(y)
Note: See TracChangeset
for help on using the changeset viewer.