summaryrefslogtreecommitdiff
path: root/numpy/array_api/_array_object.py
diff options
context:
space:
mode:
authorChristopher Sidebottom <chris.sidebottom@arm.com>2023-04-25 17:56:37 +0100
committerGitHub <noreply@github.com>2023-04-25 18:56:37 +0200
commitfe5472fa4eae131ff9646d7c980c6c4081c10386 (patch)
tree331e693bf328e72be9355be837a1aed00d896a50 /numpy/array_api/_array_object.py
parent54e4dbe4d07294bbf32f3fca2425faf180bed289 (diff)
downloadnumpy-fe5472fa4eae131ff9646d7c980c6c4081c10386.tar.gz
ENH: float64 sin/cos using Numpy intrinsics (#23399)
This takes the [sin](https://github.com/ARM-software/optimized-routines/blob/master/math/v_sin.c) and [cos](https://github.com/ARM-software/optimized-routines/blob/master/math/v_cos.c) algorithms from Optimized Routines under MIT license, and converts them to Numpy intrinsics. The routines are within the ULP boundaries of other vectorised math routines (<4ULP). The routines reduce performance in some special cases but improves normal cases. Comparing to the SVML implementation, these routines are more performant in special cases, we're therefore safe to assume the performance is acceptable for AArch64 as well. | performance ratio (lower is better) | benchmark | | ---- | ---- | | 1.8 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'cos'> 4 2 'd') | | 1.79 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'cos'> 4 4 'd') | | 1.77 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'cos'> 4 1 'd') | | 1.74 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'cos'> 2 2 'd') | | 1.74 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'cos'> 2 4 'd') | | 1.72 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'cos'> 2 1 'd') | | 1.6 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'cos'> 1 2 'd') | | 1.6 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'cos'> 1 4 'd') | | 1.56 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'cos'> 1 1 'd') | | 1.42 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'sin'> 2 2 'd') | | 1.41 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'sin'> 2 4 'd') | | 1.37 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'sin'> 2 1 'd') | | 1.26 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'sin'> 4 2 'd') | | 1.26 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'sin'> 4 4 'd') | | 1.2 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'sin'> 4 1 'd') | | 1.18 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'sin'> 1 2 'd') | | 1.18 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'sin'> 1 4 'd') | | 1.12 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'sin'> 1 1 'd') | | 0.65 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'cos'> 4 2 'd') | | 0.64 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'cos'> 2 4 'd') | | 0.64 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'cos'> 4 4 'd') | | 0.64 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'cos'> 2 2 'd') | | 0.61 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'cos'> 1 4 'd') | | 0.61 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'cos'> 1 2 'd') | | 0.6 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'cos'> 2 1 'd') | | 0.6 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'cos'> 4 1 'd') | | 0.56 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'cos'> 1 1 'd') | | 0.52 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'sin'> 4 2 'd') | | 0.52 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'sin'> 4 4 'd') | | 0.52 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'sin'> 2 4 'd') | | 0.52 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'sin'> 2 2 'd') | | 0.47 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'sin'> 1 4 'd') | | 0.47 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'sin'> 1 2 'd') | | 0.46 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'sin'> 4 1 'd') | | 0.46 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'sin'> 2 1 'd') | | 0.42 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'sin'> 1 1 'd') | Co-authored-by: Pierre Blanchard <Pierre.Blanchard@arm.com>
Diffstat (limited to 'numpy/array_api/_array_object.py')
0 files changed, 0 insertions, 0 deletions