Skip to main content

The fc_bench package ...

Project description

http://www.math.univ-paris13.fr/~cuvelier/software/codes/Python/fc-bench/pyfc-bench_400.png

The fc_bench Python package allows to benchmark functions and much more

Introduction:

More documentation is available on fc_bench Python package dedicated web page with an User’s Guide (pdf).

Installation:

The fc_bench Python package is available from the Python Package Index, so to install/upgrade simply type

pip install fc_bench -U

Testing :

There are demos functions in the fc_bench.demos module named bench_*. For example, run the following code under Python:

from fc_bench import demos
demos.bench_Lagrange()

The output of this code is:

#---------------------------------------------------------------------------
# Setting inputs of Lagrange polynomial functions: y=LAGRANGE(X,Y,x)
# where X is numpy.linspace(a,b,n+1), Y=fun(X) and x is random values on [a,b]
#   n is the order of the Lagrange polynomial
#   fun function is: lambda x: np.sin(x)
#   [a,b]=[-1,1]
#   X: (n+1,) numpy array
#   Y: (n+1,) numpy array
#   x: (m,)   numpy array
#   Error[i] computed with fun[i] output:
#     lambda y: np.linalg.norm(y-fun(x),np.inf)
#---------------------------------------------------------------------------
# Benchmarking functions:
#   fun[0],            Lag: fc_bench.demos.Lagrange
#   fun[1],         lagint: fc_bench.demos.lagint
#---------------------------------------------------------------------------
# Comparative functions:
#   comp[i-1,0], compares outputs of fun[0] and fun[i]
#       lambda o1,o2: np.linalg.norm(o1-o2,np.inf)
#    For each comparative function:
#      - 1st input parameter is the output of fun[0]
#      - 2nd input parameter is the output of fun[i]
#---------------------------------------------------------------------------
#date:2019-12-21_16-56-34
#nbruns:5
#numpy:     <i8    <i8       f8           f8          f8           f8          f8
#format:  {:>5}  {:>5}  {:6.3f}     {:10.3e}     {:9.3f}     {:10.3e}     {:9.3e}
#labels:      m      n   Lag(s)     Error[0]   lagint(s)     Error[1]     comp[0]
            100      3    0.014    1.218e-03       0.019    1.218e-03   2.220e-16
            100      5    0.021    1.162e-05       0.028    1.162e-05   4.441e-16
            100      7    0.030    6.999e-08       0.037    6.999e-08   3.331e-16
            100     11    0.048    8.699e-13       0.056    8.689e-13   2.554e-15
            500      3    0.068    1.218e-03       0.095    1.218e-03   3.331e-16
            500      5    0.108    1.163e-05       0.144    1.163e-05   6.661e-16
            500      7    0.152    7.004e-08       0.190    7.004e-08   8.882e-16
            500     11    0.244    8.766e-13       0.282    8.766e-13   2.887e-15

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fc_bench-0.2.0.tar.gz (11.3 kB view details)

Uploaded Source

File details

Details for the file fc_bench-0.2.0.tar.gz.

File metadata

  • Download URL: fc_bench-0.2.0.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.6.9

File hashes

Hashes for fc_bench-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4eb490d370b72e1e3f88e7b369f00bf23148d604c6287ccba84f5b42a7b473c8
MD5 704b964ab95d4b338f7637b1a4d6a770
BLAKE2b-256 a82d8d0ab764f0bacd6daccf3390a2221e803bc1015cd2c8b631da2404e4c709

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page