This implements #32, which speeds up very small tensor contractions a little bit by using Base.ReshapedArray instead of the reshape function in the Dense contract! function. It is only noticeable for contractions of matrices with dimensions of less than 20, i.e. running:
using ITensors
d = 5
a = randn(d, d)
b = randn(d, d)
c = randn(d, d)
i = Index(d)
A = itensor(a, i, i')
B = itensor(b, i', i'')
C = itensor(c, i, i'')
it = @belapsed $C .= $A .* $B
mm = @belapsed mul!($c, $a, $b)
@show it / mm
on the latest version of NDTensors gives:
it / mm = 3.7810970267495194
while on this branch it gives:
it / mm = 3.143474129969966
Nothing amazing, but also a good sign that something like that even shows up in the timings.
This implements #32, which speeds up very small tensor contractions a little bit by using
Base.ReshapedArray
instead of thereshape
function in the Densecontract!
function. It is only noticeable for contractions of matrices with dimensions of less than 20, i.e. running:on the latest version of NDTensors gives:
while on this branch it gives:
Nothing amazing, but also a good sign that something like that even shows up in the timings.