Commit ca4cc18
committed
xt::linalg::kron: support arguments of arbitrary number of dimensions
Before this commit, `xt::linalg::kron` only supports 2D arguments. This
commit proposes to add support for argument with any number of
dimensions. This change of behavior is coherent with what `numpy.kron`
does.
Given the implementation, it would probably make sense to return a
xexpression instead of a xarray and allow lazy evaluation. This might be
done in a separate commit. It could also be possible to have a dynamic
check of the number of dimensions and use specialized implementation for
the more common cases (i.e. 2D) at runtime, which should be more
efficient.
Tested with `./test/test_xtensor_blas --gtest_filter=xlinalg.kron*`.1 parent 7ceb791 commit ca4cc18
2 files changed
+50
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
1460 | 1461 | | |
1461 | 1462 | | |
1462 | 1463 | | |
1463 | | - | |
| 1464 | + | |
1464 | 1465 | | |
1465 | 1466 | | |
1466 | 1467 | | |
| |||
1470 | 1471 | | |
1471 | 1472 | | |
1472 | 1473 | | |
1473 | | - | |
1474 | | - | |
| 1474 | + | |
1475 | 1475 | | |
1476 | | - | |
1477 | | - | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
1478 | 1485 | | |
1479 | | - | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
1480 | 1493 | | |
1481 | | - | |
| 1494 | + | |
1482 | 1495 | | |
1483 | | - | |
1484 | | - | |
1485 | | - | |
1486 | | - | |
1487 | | - | |
1488 | | - | |
1489 | | - | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
1490 | 1510 | | |
1491 | 1511 | | |
1492 | 1512 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
369 | 385 | | |
370 | 386 | | |
371 | 387 | | |
| |||
0 commit comments