Hi Christian,
If I understand your first question, I think what you are asking is what:
tensor(A)[1, 2, :, :]
actually returns. In fact, this operation isn't defined right now (just as an oversight on our side), but this similar slicing operation is defined:
julia> tensor(A)[1, 2, 1:end, 1:end]
Dim 1: 1
Dim 2: 1
Dim 3: 2
Dim 4: 2
Dense{Float64,Base.ReshapedArray{Float64,1,SubArray{Float64,4,Array{Float64,4},NTuple{4,UnitRange{Int64}},false},Tuple{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64}}}}
1×1×2×2
[:, :, 1, 1] =
0.0
[:, :, 2, 1] =
0.0
[:, :, 1, 2] =
0.0
[:, :, 2, 2] =
0.0
This looks complicated, but basically it is a view into the specified slice of the Tensor. However, for the operation:
tensor(A)[1, 2, :, :] = [0 0; 0 0]
it doesn't actually require creating the tensor `tensor(A)[1, 2, :, :]`, since Julia directly turns it into the function call `setindex!(tensor(A), [0 0; 0 0], 1, 2, :, :)` (this is a slightly technical detail about how Julia parses those types of expressions).
As for the Index ordering of an ITensor, at first it is ordered based on how it was defined. Afterward, in general it is ordered in such a way that data permutations are minimized (for example after a contraction). Note that you can permute the ITensor to change the ordering of the ITensor, using the function:
permute(A, l, i, k, j)
Note that this performs a permutation of the ITensor data as well, so the data matches the new index ordering.
-Matt