Skip to content

Error in summation within @reduce #71

@zxm403089989

Description

@zxm403089989

There are some issues when using @reduce as summation. Here, when define a martrx, TensorCast works well.

julia> using TensorCast

julia> A=rand(4,4);

julia> @reduce _[]:=sum(i,j) A[i,j]
0-dimensional Array{Float64, 0}:
8.519131257815888

julia> @reduce _[]:=sum(i) A[i,i]
0-dimensional Array{Float64, 0}:
1.6983845333674332

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions