# Revision history [back]

I can not reproduce your problem with ipython %timeit nor sage timeit:

sage: import numpy as np
sage: N = 768
sage: P = 1024
sage: A = np.random.random((P, N))
sage: %timeit A.T.dot(A)
10 loops, best of 3: 90.8 ms per loop
sage: timeit('A.T.dot(A)')
5 loops, best of 3: 90.2 ms per loop


I do not know the details of Python timeit.repeat, but it seems that number=10 cumulates the time of 10 runs. If you try with number=1, you get about 100ms as expected:

sage: import timeit
sage: setup = """
...
... import numpy as np
...
... N = 768
... P = 1024
...
... A = np.random.random((P, N))
... """
sage: timeit.repeat('A.T.dot(A)', setup=setup, number=1, repeat=3)
[0.0931999683380127, 0.08932089805603027, 0.09101414680480957]


For what it worth, I can not reproduce your problem within Sage, neither with ipython %timeit nor sage timeit:

sage: import numpy as np
sage: N = 768
sage: P = 1024
sage: A = np.random.random((P, N))
sage: %timeit A.T.dot(A)
10 loops, best of 3: 90.8 ms per loop
sage: timeit('A.T.dot(A)')
5 loops, best of 3: 90.2 ms per loop


I do not know the details of Python timeit.repeat, but it seems that number=10 cumulates the time of 10 runs. If you i try with number=1, you i also get about 100ms as expected:

sage: import timeit
sage: setup = """
...
... import numpy as np
...
... N = 768
... P = 1024
...
... A = np.random.random((P, N))
... """
sage: timeit.repeat('A.T.dot(A)', setup=setup, number=1, repeat=3)
[0.0931999683380127, 0.08932089805603027, 0.09101414680480957]


For what it worth, I can not reproduce your problem within Sage, neither with ipython %timeit nor sage timeit:

sage: import numpy as np
sage: N = 768
sage: P = 1024
sage: A = np.random.random((P, N))
sage: %timeit A.T.dot(A)
10 loops, best of 3: 90.8 ms per loop
sage: timeit('A.T.dot(A)')
5 loops, best of 3: 90.2 ms per loop


I do not know the details of Python timeit.repeat, but it seems that number=10 cumulates the time of 10 runs. If i try with number=1, i also get about 100ms as expected:

sage: import timeit
sage: setup = """
...
... import numpy as np
...
... N = 768
... P = 1024
...
... A = np.random.random((P, N))
... """
sage: timeit.repeat('A.T.dot(A)', setup=setup, number=1, repeat=3)
[0.0931999683380127, 0.08932089805603027, 0.09101414680480957]


Note that i did not compile ATLAS specifically for my hardware since i am using SAGE_ATLAS_ARCH='fast' preselected configuration.

For what it worth, I can not reproduce your problem within Sage, neither with ipython %timeit nor sage timeit:

sage: import numpy as np
sage: N = 768
sage: P = 1024
sage: A = np.random.random((P, N))
sage: %timeit A.T.dot(A)
10 loops, best of 3: 90.8 ms per loop
sage: timeit('A.T.dot(A)')
5 loops, best of 3: 90.2 ms per loop


I do not know the details of Python timeit.repeat, but it seems that number=10 cumulates the time of 10 runs. If i try with number=1, i also get about 100ms as expected:

sage: import timeit
sage: setup = """
...
... import numpy as np
...
... N = 768
... P = 1024
...
... A = np.random.random((P, N))
... """
sage: timeit.repeat('A.T.dot(A)', setup=setup, number=1, repeat=3)
[0.0931999683380127, 0.08932089805603027, 0.09101414680480957]


Note that i did not compile ATLAS specifically for my hardware since i am using SAGE_ATLAS_ARCH='fast' preselected configuration.configuration. Which version of Sage are you using ? Which binaries did you use ? Which hardware ? Which distribution ?

For what it worth, I can not reproduce your problem within Sage, neither with ipython %timeit nor sage timeit:

sage: import numpy as np
sage: N = 768
sage: P = 1024
sage: A = np.random.random((P, N))
sage: %timeit A.T.dot(A)
10 loops, best of 3: 90.8 ms per loop
sage: timeit('A.T.dot(A)')
5 loops, best of 3: 90.2 ms per loop


I do not know the details of Python timeit.repeat, but it seems that number=10 cumulates the time of 10 runs. If i try with number=1, i also get about 100ms as expected:

sage: import timeit
sage: setup = """
...
... import numpy as np
...
... N = 768
... P = 1024
...
... A = np.random.random((P, N))
... """
sage: timeit.repeat('A.T.dot(A)', setup=setup, number=1, repeat=3)
[0.0931999683380127, 0.08932089805603027, 0.09101414680480957]


Note that i did not compile ATLAS specifically for my hardware since i am using SAGE_ATLAS_ARCH='fast' preselected configuration. Which version of Sage are you using ? Which binaries did you use ? Which hardware ? Which distribution ?

EDIT: i tried on my laptop with a version of Sage that was compiled on Pentium 3 (in particular without SSE2 set of instructions), and the timing is about 380 ms, which is still below your timings.