>>> psi[idx_blk].T
array([[1., 1., 1., 1., 1.]])
Notice the double brackets [[
, compared to
>>> psi[idx_blk].T[0]
array([1., 1., 1., 1., 1.])
so the [0]
is pulling out the first array from an “array-of-arrays” (a type of matrix?).
To get the same result in Julia you can do this:
using LinearAlgebra
psi = ones(10, 1)
idx_blk = 1:5
x = diagm(1.0./psi[idx_blk])
Note I’ve reduced the numbers. You don’t need to use transpose
either.