.. 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-35 .. code-block:: Python def naive_sum(x): return choreo.segm.cython.eft_lib.SumK(x,0) def np_sum(x): return np.sum(x) def m_fsum(x): return m.fsum(x) def SumK_1(x): return choreo.segm.cython.eft_lib.SumK(x,1) def SumK_2(x): return choreo.segm.cython.eft_lib.SumK(x,2) def SumK_3(x): return choreo.segm.cython.eft_lib.SumK(x,3) def SumK_4(x): return choreo.segm.cython.eft_lib.SumK(x,4) def SumK_5(x): return choreo.segm.cython.eft_lib.SumK(x,5) .. 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 .. image-sg:: /_build/auto_examples/benchmarks/videos/3D2k.mp4 :alt: :srcset: /_build/auto_examples/benchmarks/videos/3D2k.mp4 :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 132-146 .. code-block:: Python def prepare_x(n): x = np.random.random(n) return {'x': x} pyquickbench.plot_benchmark( all_times , all_sizes , all_funs , show = True , title = "Measured CPU time" , ) .. image-sg:: /_build/auto_examples/benchmarks/images/sphx_glr_EFTsum_bench_002.png :alt: Measured CPU time :srcset: /_build/auto_examples/benchmarks/images/sphx_glr_EFTsum_bench_002.png :class: sphx-glr-single-img .. image-sg:: /_build/auto_examples/benchmarks/videos/3D2k.mp4 :alt: :srcset: /_build/auto_examples/benchmarks/videos/3D2k.mp4 :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 167-176 .. code-block:: Python pyquickbench.plot_benchmark( all_times , all_sizes , all_funs , show = True , relative_to_val = {pyquickbench.fun_ax_name: "naive_sum"}, title = "Relative measured CPU time compared to naive_sum" , ) .. image-sg:: /_build/auto_examples/benchmarks/images/sphx_glr_EFTsum_bench_003.png :alt: Relative measured CPU time compared to naive_sum :srcset: /_build/auto_examples/benchmarks/images/sphx_glr_EFTsum_bench_003.png :class: sphx-glr-single-img .. image-sg:: /_build/auto_examples/benchmarks/videos/3D2k.mp4 :alt: :srcset: /_build/auto_examples/benchmarks/videos/3D2k.mp4 :class: sphx-glr-single-img .. _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 ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: EFTsum_bench.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_