.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_build/auto_examples/benchmarks/EFTsum_bench.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr__build_auto_examples_benchmarks_EFTsum_bench.py: Benchmark of Error-Free Transforms for summation ================================================ .. GENERATED FROM PYTHON SOURCE LINES 7-8 This benchmark compares accuracy and efficiency of several summation algorithms in floating point arithmetics .. GENERATED FROM PYTHON SOURCE LINES 8-42 .. code-block:: Python def naive_sum(x): return choreo.scipy_plus.cython.eft_lib.FastSumK(x,0) def builtin_sum(x): return sum(x) def np_sum(x): return np.sum(x) def m_fsum(x): return m.fsum(x) def SumK_1(x): return choreo.scipy_plus.cython.eft_lib.SumK(x,1) def SumK_2(x): return choreo.scipy_plus.cython.eft_lib.SumK(x,2) def SumK_3(x): return choreo.scipy_plus.cython.eft_lib.SumK(x,3) def FastSumK_1(x): return choreo.scipy_plus.cython.eft_lib.FastSumK(x,1) def FastSumK_2(x): return choreo.scipy_plus.cython.eft_lib.FastSumK(x,2) def FastSumK_3(x): return choreo.scipy_plus.cython.eft_lib.FastSumK(x,3) .. image-sg:: /_build/auto_examples/benchmarks/images/sphx_glr_EFTsum_bench_001.png :alt: Relative error for increasing conditionning :srcset: /_build/auto_examples/benchmarks/images/sphx_glr_EFTsum_bench_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 176-181 .. code-block:: Python def prepare_x(n): x = np.random.random(n) return [(x, 'x')] .. image-sg:: /_build/auto_examples/benchmarks/images/sphx_glr_EFTsum_bench_002.png :alt: Time (s) as a function of array size :srcset: /_build/auto_examples/benchmarks/images/sphx_glr_EFTsum_bench_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.049 seconds) .. _sphx_glr_download__build_auto_examples_benchmarks_EFTsum_bench.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: EFTsum_bench.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: EFTsum_bench.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_