OMEinsum.jl icon indicating copy to clipboard operation
OMEinsum.jl copied to clipboard

Support `rearrange`?

Open findmyway opened this issue 8 months ago • 3 comments

See https://einops.rocks/api/rearrange/

It would be handy if we could support this operation here.

findmyway avatar Apr 09 '25 16:04 findmyway

Rearrange does reshape and permutedims. I guess this package does only permutedims at present.

You might be interested in TensorCast.jl, which does such things. It even has tests here https://github.com/mcabbott/TensorCast.jl/pull/54/files which explicitly translate the einops examples.

mcabbott avatar Apr 09 '25 17:04 mcabbott

@mcabbott Amazing work!

findmyway avatar Apr 10 '25 02:04 findmyway

For future reference, I have created Einops.jl, having high syntax and feature parity with the original Python package.

I'm still exploring einsum integration (see https://github.com/MurrellGroup/Einops.jl/issues/3), which is why I stumbled upon this issue just now. I'd love to collaborate if anyone would like to contribute.

EDIT: einsum has been wrapped/implemented in 5 lines using OMEinsum.StaticEinCode{Symbol, left, right}, seemingly matching the einops.einsum functionality. Thanks for making it so easy! Although I'm not sure about contraction orders.

AntonOresten avatar May 13 '25 13:05 AntonOresten