File: bench_decom.py

package info (click to toggle)
python-scipy 0.10.1%2Bdfsg2-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 42,232 kB
  • sloc: cpp: 224,773; ansic: 103,496; python: 85,210; fortran: 79,130; makefile: 272; sh: 43
file content (31 lines) | stat: -rw-r--r-- 804 bytes parent folder | download | duplicates (3)
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
""" Benchmark functions for linalg.decomp module

"""
import sys

from numpy import linalg
from numpy.testing import *

def random(size):
    return rand(*size)

def bench_random():
    Numeric_eigvals = linalg.eigvals
    print
    print '           Finding matrix eigenvalues'
    print '      =================================='
    print '      |    contiguous     '#'|   non-contiguous '
    print '----------------------------------------------'
    print ' size |  scipy  '#'| core |  scipy  | core '

    for size,repeat in [(20,150),(100,7),(200,2)]:
        repeat *= 1
        print '%5s' % size,
        sys.stdout.flush()

        a = random([size,size])

        print '| %6.2f ' % measure('eigvals(a)',repeat),
        sys.stdout.flush()

        print '   (secs for %s calls)' % (repeat)