You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, now if I define a 4th-order array, something wrong happens:
julia> B=rand(4,4,4,4);
julia> @reduce _[]:=sum(i) B[i,i,i,i,]
ERROR: LoadError: index i repeated in [i, i, i, i]
julia> @reduce _[]:=sum(i,j) B[i,j,i,j]
ERROR: LoadError: index i repeated in [i, j, i, j]
The text was updated successfully, but these errors were encountered:
What's going on is that there is special handling for the diagonal elements of a matrix, but nothing is written for repeated indices in higher dimensional arrays. There's no built-in analog of Diagonal here which does more dimensions:
julia>let v =randn(3)
@pretty@cast _[i,i] := v[i]
endbegin@boundscheck v isa Tuple || (ndims(v) ==1||throw(ArgumentError("expected a vector or tuple v[i]")))
wolf =Diagonal(v)
end
The extent of the documentation is this, maybe it should say more:
There are some issues when using
@reduce
as summation. Here, when define a martrx, TensorCast works well.However, now if I define a 4th-order array, something wrong happens:
The text was updated successfully, but these errors were encountered: