File: bench_decom.py

package info (click to toggle)
python-scipy 0.7.2%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 28,500 kB
  • ctags: 36,081
  • sloc: cpp: 216,880; fortran: 76,016; python: 71,576; ansic: 62,118; makefile: 243; sh: 17
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)