xtensor-stack / xtensor-blas

BLAS extension to xtensor
BSD 3-Clause "New" or "Revised" License
155 stars 54 forks source link

[WIP] xt::linalg::kron: support arguments of arbitrary number of dimensions #198

Open lsix opened 3 years ago

lsix commented 3 years ago

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.

The current implementation is a performance step back compared to the previous one. Until a better generic implementation is found, keeping a couple of specialized implementations for the most used scenarios makes sense.

Tested with ./test/test_xtensor_blas --gtest_filter=xlinalg.kron*.

lsix commented 3 years ago

I have pushed a revised implementation that has significantly better performances compared to the first one. However, it still is an order of magnitude slower than the original one for the 2D scenario.

I intend to spend more time on this to improve things further and hopefully come up with a solution that is general and offers acceptable performances.