[SciPy-user] CPU-time in Ipython
Fernando Perez
fperez at colorado.edu
Thu May 29 13:02:26 EDT 2003
Nils Wagner wrote:
> Hi all,
>
> Finally, I have installed IPython via cvs.
>
> Again, the question comes up, how to measure the CPU-time which is
> required to solve the
> eigenvalue problem.
>
> A small example is appreciated
>
> from scipy import *
>
>
> w, vr = linalg.eig(A,B)
In [10]: size=100
In [11]: A=RA.random((size,size))
In [12]: B=RA.random((size,size))
In [13]: timing(1,linalg.eig,A,B)
Out[13]: 0.10742200000000002
In [14]: size=500
In [15]: A=RA.random((size,size))
In [16]: B=RA.random((size,size))
In [17]: timing(1,linalg.eig,A,B)
Out[17]: 23.265625
From the docstring:
In [18]: timing?
Type: function
Base Class: <type 'function'>
String Form: <function timing at 0x81c37d4>
Namespace: Interactive
File: /usr/local/home/fperez/code/python/IPython/genutils.py
Definition: timing(reps, func, *args, **kw)
Docstring:
timing(reps,func,*args,**kw) -> t_total
Execute a function reps times, the elapsed total CPU time in seconds. This
is just the first value in timings_out().
You'll need to import timing and friends first, they live in IPython.genutils.
Best,
f.
More information about the SciPy-User
mailing list