FC U长凳套餐…

fc-bench的Python项目详细描述


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

python包允许对函数进行基准测试,甚至更多。

简介:

更多文档可在fc_bench Python package专用网页上找到,其中包含User’s Guide(pdf)。

此软件包的测试条件是:

安装:

python包索引中提供了fc_benchpython包,因此要安装/升级,只需键入

pip install fc_bench -U

测试:

There are demos functions in the ^{tt1}$ module named ^{tt2}$. For example, run the following code under Python:

fromfc_benchimportdemosdemos.bench_Lagrange()

The output of this code is:

#---------------------------------------------------------------------------
# Benchmarking functions:
#  fun[0],            Lag: fc_bench.demos.Lagrange
#  fun[1],         lagint: fc_bench.demos.lagint
# cmpErr[i], error between fun[0] and fun[i] outputs computed with function
#    lambda o1,o2: np.linalg.norm(o1-o2,np.inf)
# where
#    - 1st input parameter is the output of fun[0]
#    - 2nd input parameter is the output of fun[i]
#---------------------------------------------------------------------------
# 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)
#---------------------------------------------------------------------------
#date:2018/05/03 10:16:55
#nbruns:5
#numpy:      i4     i4        f4          f4           f4          f4           f4
#format:  {:>5}  {:>5}   {:8.3f}    {:10.3e}     {:11.3f}    {:10.3e}     {:11.3e}
#labels:      m      n    Lag(s)    Error[0]    lagint(s)    Error[1]    cmpErr[1]
            100      5     0.012   1.163e-05        0.014   1.163e-05    3.331e-16
            100      9     0.020   2.859e-10        0.023   2.859e-10    8.882e-16
            100     15     0.036   2.143e-14        0.038   2.143e-14    2.565e-14
            500      5     0.056   1.162e-05        0.071   1.162e-05    5.551e-16
            500      9     0.102   2.901e-10        0.118   2.901e-10    1.443e-15
            500     15     0.178   2.232e-14        0.188   2.232e-14    2.287e-14
           1000      5     0.111   1.163e-05        0.146   1.163e-05    5.551e-16
           1000      9     0.202   2.902e-10        0.235   2.902e-10    1.554e-15
           1000     15     0.361   2.576e-14        0.377   2.576e-14    2.620e-14

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何在Gomoku javafx游戏中启用回合转换   java Akka ask onComplete呼叫两次   类实现可序列化时的java NotSerializableException   java在不同情况下使用不同的Hibernate用户类型   使用Jena库从Java中的RDF网页提取URI的xml解析   即使在将github证书添加到%java_HOME%之后,java SSLHandshakeException仍然存在异常   Android Studio Java TelephonyManager错误:非静态方法   java树的23个节点浪费了什么信息?   java如何使用JAXB读取XML文件?   java Jdbc列索引超出范围   java如何在Spring忽略基本包的情况下扫描整个类路径中的组件?   用于动态创建Swing组件的java侦听器   Java方法在嵌套类中不起作用   java在JSF中使用POST而不是GET重定向异地页面   文本向txt文件添加单词列表   java如何将复选框信息从视图发送到Thymeleaf中的控制器?   用于用户提示的java字符串输入   性能java编译器能否优化循环以尽早返回?   java为什么位集不可编辑?