File: bench_zeros.py

package info (click to toggle)
python-scipy 0.14.0-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 52,228 kB
  • ctags: 63,719
  • sloc: python: 112,726; fortran: 88,685; cpp: 86,979; ansic: 85,860; makefile: 530; sh: 236
file content (38 lines) | stat: -rw-r--r-- 1,031 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from __future__ import division, print_function, absolute_import

from math import sqrt

from numpy.testing import *

from scipy.optimize import zeros as cc

# Import testing parameters
from scipy.optimize._tstutils import methods, mstrings, functions, \
     fstrings, description


class BenchZeros(TestCase):
    def bench_run(self):
        a = .5
        b = sqrt(3)
        repeat = 2000

        print(description)

        print('TESTING SPEED\n')
        print('times in seconds for %d iterations \n' % repeat)
        for i in range(len(functions)):
            print('function %s\n' % fstrings[i])
            func = functions[i]
            for j in range(len(methods)):
                meth = methods[j]
                try:
                    t = measure("meth(func,a,b)",repeat)
                except:
                    print('%s : failed' % mstrings[j])
                else:
                    print('%s : %5.3f' % (mstrings[j],t))
            print('\n\n')

if __name__ == '__main__':
    run_module_suite()