ITensor / NDTensors.jl

A Julia package for n-dimensional sparse tensors.
Apache License 2.0
27 stars 7 forks source link

Change `permutedims!!` interface #7

Open mtfishman opened 4 years ago

mtfishman commented 4 years ago

Currently, permutedims!!(R::Tensor, T::Tensor, perm, f::Function) accepts only a 2-argument function that applies pairwise to the elements of R and permutedims(T, perm).

This could be replaced by a more general function map_permutedims!!(f::Function, R::Tensor, T1::Tensor, perm1, T2::Tensor, perm2, ...), where f is an n-argument function for inputs (T1, perm1, T2, perm2, ..., Tn, permn). This could act as a useful backend for more general ITensor broadcasting, and could directly be written in terms of Strided.jl broadcast calls like:

@strided R .= f.(permutedims(T1, perm1), permutedims(T2, perm2), ...)