@@ -37,7 +37,7 @@ def cputime(t=0, subprocesses=False):
37
37
38
38
INPUT:
39
39
40
- - ``t`` - (optional) time in CPU seconds, if ``t`` is a result
40
+ - ``t`` -- (optional) time in CPU seconds, if ``t`` is a result
41
41
from an earlier call with ``subprocesses=True``, then
42
42
``subprocesses=True`` is assumed.
43
43
@@ -46,26 +46,26 @@ def cputime(t=0, subprocesses=False):
46
46
47
47
OUTPUT:
48
48
49
- - ``float`` - time in CPU seconds if ``subprocesses=False``
49
+ - ``float`` -- time in CPU seconds if ``subprocesses=False``
50
50
51
- - :class:`GlobalCputime` - object which holds CPU times of
51
+ - :class:`GlobalCputime` -- object which holds CPU times of
52
52
subprocesses otherwise
53
53
54
54
EXAMPLES::
55
55
56
56
sage: t = cputime()
57
- sage: F = gp.factor(2^199-1)
58
- sage: cputime(t) # somewhat random
57
+ sage: F = gp.factor(2^199-1) # optional - sage.libs.pari
58
+ sage: cputime(t) # somewhat random
59
59
0.010999000000000092
60
60
61
61
sage: t = cputime(subprocesses=True)
62
- sage: F = gp.factor(2^199-1)
63
- sage: cputime(t) # somewhat random
62
+ sage: F = gp.factor(2^199-1) # optional - sage.libs.pari
63
+ sage: cputime(t) # somewhat random
64
64
0.091999
65
65
66
66
sage: w = walltime()
67
- sage: F = gp.factor(2^199-1)
68
- sage: walltime(w) # somewhat random
67
+ sage: F = gp.factor(2^199-1) # optional - sage.libs.pari
68
+ sage: walltime(w) # somewhat random
69
69
0.58425593376159668
70
70
71
71
.. NOTE::
@@ -130,24 +130,24 @@ class GlobalCputime:
130
130
Objects of this type are returned if ``subprocesses=True`` is
131
131
passed to :func:`cputime`::
132
132
133
- sage: cputime(subprocesses=True) # indirect doctest, output random
133
+ sage: cputime(subprocesses=True) # indirect doctest, output random
134
134
0.2347431
135
135
136
136
We can use it to keep track of the CPU time spent in Singular for
137
137
example::
138
138
139
139
sage: t = cputime(subprocesses=True)
140
140
sage: P = PolynomialRing(QQ,7,'x')
141
- sage: I = sage.rings.ideal.Katsura(P)
142
- sage: gb = I.groebner_basis() # calls Singular
143
- sage: cputime(subprocesses=True) - t # output random
141
+ sage: I = sage.rings.ideal.Katsura(P) # optional - sage.libs.singular
142
+ sage: gb = I.groebner_basis() # calls Singular # optional - sage.libs.singular
143
+ sage: cputime(subprocesses=True) - t # output random
144
144
0.462987
145
145
146
146
For further processing we can then convert this container to a
147
147
float::
148
148
149
149
sage: t = cputime(subprocesses=True)
150
- sage: float(t) # output somewhat random
150
+ sage: float(t) # output somewhat random
151
151
2.1088339999999999
152
152
153
153
.. SEEALSO::
@@ -173,7 +173,7 @@ def __repr__(self):
173
173
"""
174
174
EXAMPLES::
175
175
176
- sage: cputime(subprocesses=True) # indirect doctest, output random
176
+ sage: cputime(subprocesses=True) # indirect doctest, output random
177
177
0.2347431
178
178
"""
179
179
return str (self .total )
@@ -184,8 +184,8 @@ def __add__(self, other):
184
184
185
185
sage: t = cputime(subprocesses=True)
186
186
sage: P = PolynomialRing(QQ,7,'x')
187
- sage: I = sage.rings.ideal.Katsura(P)
188
- sage: gb = I.groebner_basis() # calls Singular
187
+ sage: I = sage.rings.ideal.Katsura(P) # optional - sage.libs.singular
188
+ sage: gb = I.groebner_basis() # calls Singular # optional - sage.libs.singular
189
189
sage: cputime(subprocesses=True) + t # output random
190
190
2.798708
191
191
"""
@@ -200,8 +200,8 @@ def __sub__(self, other):
200
200
201
201
sage: t = cputime(subprocesses=True)
202
202
sage: P = PolynomialRing(QQ,7,'x')
203
- sage: I = sage.rings.ideal.Katsura(P)
204
- sage: gb = I.groebner_basis() # calls Singular
203
+ sage: I = sage.rings.ideal.Katsura(P) # optional - sage.libs.singular
204
+ sage: gb = I.groebner_basis() # calls Singular # optional - sage.libs.singular
205
205
sage: cputime(subprocesses=True) - t # output random
206
206
0.462987
207
207
"""
@@ -215,32 +215,32 @@ def __float__(self):
215
215
EXAMPLES::
216
216
217
217
sage: t = cputime(subprocesses=True)
218
- sage: float(t) # output somewhat random
218
+ sage: float(t) # output somewhat random
219
219
2.1088339999999999
220
220
"""
221
221
return float (self .total )
222
222
223
223
224
224
def walltime (t = 0 ):
225
225
"""
226
- Return the wall time in second, or with optional argument t , return
227
- the wall time since time t . "Wall time" means the time on a wall
226
+ Return the wall time in second, or with optional argument ``t`` , return
227
+ the wall time since time ``t`` . "Wall time" means the time on a wall
228
228
clock, i.e., the actual time.
229
229
230
230
INPUT:
231
231
232
232
233
- - ``t`` - (optional) float, time in CPU seconds
233
+ - ``t`` -- (optional) float, time in CPU seconds
234
234
235
235
OUTPUT:
236
236
237
- - ``float`` - time in seconds
237
+ - ``float`` -- time in seconds
238
238
239
239
240
240
EXAMPLES::
241
241
242
242
sage: w = walltime()
243
- sage: F = factor(2^199-1)
243
+ sage: F = factor(2^199-1) # optional - sage.libs.pari
244
244
sage: walltime(w) # somewhat random
245
245
0.8823847770690918
246
246
"""
0 commit comments