mcabbott / mcabbott/Tullio.jl

Unexpected results with variable LHS indices

Open
#136 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

parsing
Dominant language
Julia
Stars
668
Forks
30
PR merge metrics
No merged PRs in 30d

Description

Why these two are different?

using Tullio
w = collect(1.0:2.0);
h = collect(1.0:3.0);
I = zeros(4);
@tullio I[j+k-1] = w[j] * h[k];
# I = [1.0, 2.0, 3.0, 6.0]

vs.

I .= 0
for j ∈ 1:length(w), k in 1:length(h)
    I[j+k-1] += w[j] * h[k]
end
# I = [1.0, 4.0, 7.0, 6.0]

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the two Julia snippets from the issue and comparing the generated behavior for the variable left-hand index in @tullio. Trace the macro's handling of indexed assignments and reductions; done means the behavior is explained and the @tullio result is consistent with the explicit loop or the intended semantics are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.