|
10 | 10 | },
|
11 | 11 | {
|
12 | 12 | "cell_type": "code",
|
13 |
| - "execution_count": 15, |
| 13 | + "execution_count": 1, |
14 | 14 | "id": "c5430b2b-a033-4d85-a76a-eb9c958eb66d",
|
15 | 15 | "metadata": {},
|
16 | 16 | "outputs": [],
|
|
67 | 67 | "name": "stdout",
|
68 | 68 | "output_type": "stream",
|
69 | 69 | "text": [
|
70 |
| - "CPU times: user 975 ms, sys: 1.03 s, total: 2.01 s\n", |
71 |
| - "Wall time: 127 ms\n" |
| 70 | + "CPU times: user 1.93 s, sys: 211 ms, total: 2.14 s\n", |
| 71 | + "Wall time: 136 ms\n" |
72 | 72 | ]
|
73 | 73 | }
|
74 | 74 | ],
|
|
87 | 87 | "name": "stdout",
|
88 | 88 | "output_type": "stream",
|
89 | 89 | "text": [
|
90 |
| - "CPU times: user 427 ms, sys: 2.04 s, total: 2.47 s\n", |
91 |
| - "Wall time: 1.26 s\n" |
| 90 | + "CPU times: user 1.55 s, sys: 293 ms, total: 1.84 s\n", |
| 91 | + "Wall time: 1.79 s\n" |
92 | 92 | ]
|
93 | 93 | }
|
94 | 94 | ],
|
|
116 | 116 | "name": "stdout",
|
117 | 117 | "output_type": "stream",
|
118 | 118 | "text": [
|
119 |
| - "CPU times: user 964 ms, sys: 2.58 s, total: 3.55 s\n", |
120 |
| - "Wall time: 3.67 s\n" |
| 119 | + "CPU times: user 113 ms, sys: 79.7 ms, total: 193 ms\n", |
| 120 | + "Wall time: 195 ms\n" |
121 | 121 | ]
|
122 | 122 | }
|
123 | 123 | ],
|
|
136 | 136 | "name": "stdout",
|
137 | 137 | "output_type": "stream",
|
138 | 138 | "text": [
|
139 |
| - "CPU times: user 2.44 ms, sys: 37 µs, total: 2.48 ms\n", |
140 |
| - "Wall time: 2.05 ms\n" |
| 139 | + "CPU times: user 3.14 ms, sys: 400 μs, total: 3.54 ms\n", |
| 140 | + "Wall time: 2.58 ms\n" |
141 | 141 | ]
|
142 | 142 | }
|
143 | 143 | ],
|
|
164 | 164 | "name": "stdout",
|
165 | 165 | "output_type": "stream",
|
166 | 166 | "text": [
|
167 |
| - "CPU times: user 360 ms, sys: 15 ms, total: 375 ms\n", |
168 |
| - "Wall time: 378 ms\n" |
| 167 | + "CPU times: user 197 ms, sys: 29.6 ms, total: 227 ms\n", |
| 168 | + "Wall time: 227 ms\n" |
169 | 169 | ]
|
170 | 170 | }
|
171 | 171 | ],
|
|
185 | 185 | "name": "stdout",
|
186 | 186 | "output_type": "stream",
|
187 | 187 | "text": [
|
188 |
| - "CPU times: user 432 µs, sys: 1.49 ms, total: 1.92 ms\n", |
189 |
| - "Wall time: 1.08 ms\n" |
| 188 | + "CPU times: user 2.03 ms, sys: 259 μs, total: 2.29 ms\n", |
| 189 | + "Wall time: 1.72 ms\n" |
190 | 190 | ]
|
191 | 191 | }
|
192 | 192 | ],
|
|
203 | 203 | "## Matrix power"
|
204 | 204 | ]
|
205 | 205 | },
|
| 206 | + { |
| 207 | + "cell_type": "markdown", |
| 208 | + "id": "8f38d6ea-b522-4eb6-930b-0f577c3a4277", |
| 209 | + "metadata": {}, |
| 210 | + "source": [ |
| 211 | + "Since there seems to be an issue with `%%timeit` in combination with `cp.linalg.matrix_power` `%%time` is used in this section." |
| 212 | + ] |
| 213 | + }, |
206 | 214 | {
|
207 | 215 | "cell_type": "code",
|
208 | 216 | "execution_count": 10,
|
|
223 | 231 | "name": "stdout",
|
224 | 232 | "output_type": "stream",
|
225 | 233 | "text": [
|
226 |
| - "30.3 ms ± 5.26 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)\n" |
| 234 | + "CPU times: user 1.5 s, sys: 424 ms, total: 1.93 s\n", |
| 235 | + "Wall time: 130 ms\n" |
227 | 236 | ]
|
228 | 237 | }
|
229 | 238 | ],
|
230 | 239 | "source": [
|
231 |
| - "%timeit np.linalg.matrix_power(D, 10)" |
| 240 | + "%%time\n", |
| 241 | + "p = np.linalg.matrix_power(D, 10);" |
232 | 242 | ]
|
233 | 243 | },
|
234 | 244 | {
|
235 | 245 | "cell_type": "code",
|
236 |
| - "execution_count": 21, |
| 246 | + "execution_count": 12, |
237 | 247 | "id": "2cca5817-c795-4240-8a56-6361aade49cf",
|
238 | 248 | "metadata": {},
|
239 | 249 | "outputs": [],
|
|
251 | 261 | "name": "stdout",
|
252 | 262 | "output_type": "stream",
|
253 | 263 | "text": [
|
254 |
| - "43.7 ms ± 2.55 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)\n" |
| 264 | + "CPU times: user 143 ms, sys: 10.6 ms, total: 153 ms\n", |
| 265 | + "Wall time: 7.04 ms\n" |
255 | 266 | ]
|
256 | 267 | }
|
257 | 268 | ],
|
258 | 269 | "source": [
|
259 |
| - "%timeit cp.linalg.matrix_power(D_dev, 10)" |
| 270 | + "%%time\n", |
| 271 | + "p_dev = cp.linalg.matrix_power(D_dev, 10);" |
260 | 272 | ]
|
261 | 273 | },
|
262 | 274 | {
|
|
269 | 281 | },
|
270 | 282 | {
|
271 | 283 | "cell_type": "code",
|
272 |
| - "execution_count": 16, |
| 284 | + "execution_count": 14, |
273 | 285 | "id": "dbae0849-7d44-4d8e-8a2a-104d08e63016",
|
274 | 286 | "metadata": {},
|
275 | 287 | "outputs": [
|
276 | 288 | {
|
277 | 289 | "name": "stdout",
|
278 | 290 | "output_type": "stream",
|
279 | 291 | "text": [
|
280 |
| - "261 ms ± 81.5 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" |
| 292 | + "497 ms ± 89.1 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" |
281 | 293 | ]
|
282 | 294 | }
|
283 | 295 | ],
|
|
288 | 300 | },
|
289 | 301 | {
|
290 | 302 | "cell_type": "code",
|
291 |
| - "execution_count": 22, |
| 303 | + "execution_count": 15, |
292 | 304 | "id": "33e09563-e5a0-47ca-b860-7b0581d7a11d",
|
293 | 305 | "metadata": {},
|
294 | 306 | "outputs": [
|
295 | 307 | {
|
296 | 308 | "name": "stdout",
|
297 | 309 | "output_type": "stream",
|
298 | 310 | "text": [
|
299 |
| - "728 ms ± 16.7 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" |
| 311 | + "554 ms ± 18.3 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" |
300 | 312 | ]
|
301 | 313 | }
|
302 | 314 | ],
|
|
307 | 319 | },
|
308 | 320 | {
|
309 | 321 | "cell_type": "code",
|
310 |
| - "execution_count": 17, |
| 322 | + "execution_count": 16, |
311 | 323 | "id": "2552a033-b7b0-423f-a162-ad559d696821",
|
312 | 324 | "metadata": {},
|
313 | 325 | "outputs": [
|
314 | 326 | {
|
315 | 327 | "name": "stdout",
|
316 | 328 | "output_type": "stream",
|
317 | 329 | "text": [
|
318 |
| - "49.8 ms ± 4.96 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)\n" |
| 330 | + "132 ms ± 22.4 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)\n" |
319 | 331 | ]
|
320 | 332 | }
|
321 | 333 | ],
|
|
326 | 338 | },
|
327 | 339 | {
|
328 | 340 | "cell_type": "code",
|
329 |
| - "execution_count": 23, |
| 341 | + "execution_count": 17, |
330 | 342 | "id": "b74986ef-b699-40db-ae50-c759b5c5a9f7",
|
331 | 343 | "metadata": {},
|
332 | 344 | "outputs": [
|
333 | 345 | {
|
334 | 346 | "name": "stdout",
|
335 | 347 | "output_type": "stream",
|
336 | 348 | "text": [
|
337 |
| - "34 ms ± 36.5 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n" |
| 349 | + "The slowest run took 16.34 times longer than the fastest. This could mean that an intermediate result is being cached.\n", |
| 350 | + "14.5 ms ± 16 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" |
338 | 351 | ]
|
339 | 352 | }
|
340 | 353 | ],
|
|
360 | 373 | "name": "python",
|
361 | 374 | "nbconvert_exporter": "python",
|
362 | 375 | "pygments_lexer": "ipython3",
|
363 |
| - "version": "3.11.6" |
| 376 | + "version": "3.12.8" |
364 | 377 | }
|
365 | 378 | },
|
366 | 379 | "nbformat": 4,
|
|
0 commit comments