我无法理解 Julia 中看似不一致的行为。
X = reshape(1:100, 10, 10) b = [1 5 9] X[2, :][b] # returns the correct array X[2, :][1 5 9] # throws an error
有人可以解释为什么使用变量b可以索引数组,但当我自己编写索引时却不行?
b
arrays indexing julia
arrays ×1
indexing ×1
julia ×1