Changes in sasmodels/generate.py [cd3dba0:e1ace4d] in sasmodels
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/generate.py
rcd3dba0 re1ace4d 197 197 # TODO: identify model files which have changed since loading and reload them. 198 198 199 __all__ = ["make", "doc", "sources", "use_single" ]199 __all__ = ["make", "doc", "sources", "use_single", "use_long_double"] 200 200 201 201 import sys … … 206 206 C_KERNEL_TEMPLATE_PATH = joinpath(dirname(__file__), 'kernel_template.c') 207 207 208 F32 = np.dtype('float32') 208 209 F64 = np.dtype('float64') 209 F32 = np.dtype('float32') 210 try: # CRUFT: older numpy does not support float128 211 F128 = np.dtype('float128') 212 except TypeError: 213 F128 = None 214 210 215 211 216 # Scale and background, which are parameters common to every form factor … … 322 327 source = re.sub(r'[^a-zA-Z_](\d*[.]\d+|\d+[.]\d*)([eE][+-]?\d+)?', 323 328 r'\g<0>f', source) 329 return source 330 331 def use_long_double(source): 332 """ 333 Convert code from double precision to long double precision. 334 """ 335 # Convert double keyword to float. Accept an 'n' parameter for vector 336 # values, where n is 2, 4, 8 or 16. Assume complex numbers are represented 337 # as cdouble which is typedef'd to double2. 338 source = re.sub(r'(^|[^a-zA-Z0-9_]c?)double(([248]|16)?($|[^a-zA-Z0-9_]))', 339 r'\1long double\2', source) 340 # Convert floating point constants to single by adding 'f' to the end. 341 # OS/X driver complains if you don't do this. 342 source = re.sub(r'[^a-zA-Z_](\d*[.]\d+|\d+[.]\d*)([eE][+-]?\d+)?', 343 r'\g<0>L', source) 324 344 return source 325 345
Note: See TracChangeset
for help on using the changeset viewer.