4

I am currently importing a Julia script that uses Tullio because of its speed. The function is

using Tullio, LoopVectorization

function testfunction_tullio(my_arr, other_arr, sec_arr, third_arr)
    new_array = Array{ComplexF64}(undef, length(my_arr))
    @tullio new_array[i] = 1 / (my_arr[i] * 1im + sec_arr[j] + other_arr[i,1]) * third_arr[j]
    return new_array
end

Is there are nice way to write this in numpy.einsum() ? These are all 1D arrays ( or the 1D component of a 2D array) but I don't know how to include inverses or anything.

Cameron Bieganek
  • 7,208
  • 1
  • 23
  • 40
Andrew Hardy
  • 232
  • 1
  • 8
  • 4
    I don't know about numpy, but you don't need to pre-allocate the `new_array`. Just write `@tullio new_array[i] := ... ` – DNF Jul 19 '21 at 19:54

0 Answers0