Ask Your Question
0

Computing the time of execution

asked 2024-06-27 21:08:39 +0100

hamouda gravatar image

updated 2024-06-27 21:09:49 +0100

In the following Sage's code

x=2^15467
M=random_matrix(ZZ,101)
N=M.LLL()
P=random_matrix(ZZ,50)
Q=P.LLL()

I want to compute the time of execution from the first line up to the third, and the time from the line 4 to line 5, and finally the time of the whole code.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2024-06-28 07:19:11 +0100

Max Alekseyev gravatar image

You can use time module for that purpose - like this:

import time

start_time = time.time()
# ...whatever code...
end_time = time.time()
print('Elapsed:', end_time - start_time)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2024-06-27 21:08:39 +0100

Seen: 146 times

Last updated: Jun 28