On 8/5/10 12:10 AM, Rajeev wrote:
Hi,

I was very surprised to find that sage is much slower than ipython for
doing the same numerical task (monte carlo simulation using numpy
arrays). Following is summary of the time taken -

In [1]: from layered_ising_mc import layered_ising_mc

In [2]: a = layered_ising_mc(n=16, J_p=20, h=19.94, beta=0.5)

In [3]: a.set_initial_condition()

In [4]: time data = a.monte_carlo(1000); a.check_consistency()
CPU times: user 16.89 s, sys: 0.03 s, total: 16.93 s
Wall time: 17.43 s


sage: from layered_ising_mc import layered_ising_mc
sage: a = layered_ising_mc(n=16, J_p=20, h=19.94, beta=0.5)
sage: a.set_initial_condition()
sage: time data = a.monte_carlo(1000); a.check_consistency()
CPU times: user 191.94 s, sys: 0.11 s, total: 192.04 s
Wall time: 194.03 s

I was surprised that the difference is a factor of 10. I hope I am not
comparing apples to oranges.


Can you try doing

sage: preparser(False)

and then rerunning the Sage test? My guess is that the slowness has to do with using Sage's more correct, but slower integers and real numbers.

Jason

--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to