OMEinsum.jl
This package provides
- The einsum notation, which is similar to the einsum function in
numpy, although some details are different. - Highly optimized algorithms to optimize the contraction of tensors.
The source code is available at OMEinsum.jl.
Quick start
You can find a set up guide in the README. To get started, open a Julia REPL and type the following code.
julia> using OMEinsumjulia> code = ein"ij,jk,kl,lm->im" # define the einsum operationij, jk, kl, lm -> imjulia> optcode = optimize_code(code, uniformsize(code, 100), TreeSA()) # optimize the contraction ordermk, ik -> im ├─ lm, kl -> mk │ ├─ lm │ └─ kl └─ ij, jk -> ik ├─ ij └─ jkjulia> optcode(randn(100, 100), randn(100, 100), randn(100, 100), randn(100, 100)) # compute the result100×100 Matrix{Float64}: 151.512 2103.93 -2214.4 … -285.673 275.653 441.982 439.348 573.14 -1859.41 1553.26 249.342 2137.6 1457.67 -502.481 419.077 -384.421 1471.96 -214.815 -318.705 2137.72 1281.19 679.203 -21.0916 -1319.04 577.902 -612.43 2378.37 783.074 274.311 -210.546 -805.414 616.457 -1068.59 … -2045.74 330.723 474.063 -147.947 -1.97531 -256.96 -558.785 -592.616 550.787 670.388 47.4396 653.086 186.745 524.375 255.19 -2218.99 355.199 -513.5 153.449 -13.7413 -920.403 222.407 206.364 284.386 -926.037 -1.1118 -795.344 ⋮ ⋱ 617.991 415.75 1770.55 1079.34 -320.741 -1806.99 -1215.92 1204.16 -184.121 -627.257 -189.33 415.793 -693.861 1301.42 -1333.86 74.9894 -750.022 -386.86 -341.376 -95.1462 998.508 1649.11 533.217 194.88 -1155.49 -1232.2 884.039 … 635.235 -516.53 127.896 -346.221 -259.517 13.9123 811.065 -1072.15 52.6132 583.526 1154.87 1409.93 -1881.99 943.825 -1922.72 -955.509 1855.08 167.713 542.434 47.6894 -286.298 -171.148 1107.24 -550.19 1261.72 -680.209 1058.93