File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88e = 2.7182818284590452353602874713527
99
10+
1011def sinh (x ):
1112 return (1 - (e ** (- 2 * x ))) / (2 * (e ** - x ))
1213
14+
1315def cosh (x ):
1416 return (1 + (e ** (- 2 * x ))) / (2 * (e ** - x ))
1517
18+
1619def tanh (x ):
1720 tanh_x = sinh (x ) / cosh (x )
1821 return tanh_x
1922
23+
2024def test (fn , name ):
25+
2126 start = perf_counter ()
2227 result = fn (DATA )
2328 duration = perf_counter () - start
@@ -26,6 +31,7 @@ def test(fn, name):
2631 for d in result :
2732 assert - 1 <= d <= 1 , " incorrect values"
2833
34+
2935if __name__ == "__main__" :
3036 print ('Running benchmarks with COUNT = {}' .format (COUNT ))
3137
Original file line number Diff line number Diff line change 1- from distutils .core import setup , Extension , DEBUG
1+ from distutils .core import setup , Extension
22
3- sfc_module = Extension ('superfastcode' , sources = ['module.cpp' ])
43
5- setup (name = 'superfastcode' , version = '1.0' ,
6- description = 'Python Package with superfastcode C++ extension' ,
7- ext_modules = [sfc_module ]
8- )
4+ sfc_module = Extension ('superfastcode' , sources = ['module.cpp' ])
5+
6+ setup (name = 'superfastcode' , version = '1.0' ,
7+ description = 'Python Package with superfastcode C++ extension' ,
8+ ext_modules = [sfc_module ]
9+ )
Original file line number Diff line number Diff line change 66cpp_args = ['-std=c++11' , '-stdlib=libc++' , '-mmacosx-version-min=10.7' ]
77
88sfc_module = Extension (
9- 'superfastcode2' , sources = ['module.cpp' ],
9+ 'superfastcode2' , sources = ['module.cpp' ],
1010 include_dirs = ['pybind11/include' ],
1111 language = 'c++' ,
12- extra_compile_args = cpp_args ,
12+ extra_compile_args = cpp_args ,
1313 )
1414
1515setup (
16- name = 'superfastcode2' ,
17- version = '1.0' ,
18- description = 'Python package with superfastcode2 C++ extension (PyBind11)' ,
19- ext_modules = [sfc_module ],
20- )
16+ name = 'superfastcode2' ,
17+ version = '1.0' ,
18+ description = 'Python package with superfastcode2 C++ extension (PyBind11)' ,
19+ ext_modules = [sfc_module ],
20+ )
You can’t perform that action at this time.
0 commit comments