mcabbott / mcabbott/TensorCast.jl
Extra singleton dimension appears during casting
Open
Nobody has claimed this yet.
bug
- Dominant language
- Julia
- Stars
- 142
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
using TensorCast, EllipsisNotation
@views project(x) = x ./ x[[end],..]
@views project!(x) = @. x = x / x[[end],..]
euclideanize(x) = project(x)[1:end-1,..]
P = rand(3,4,100)
@cast u[i,k] := euclideanize(P[:,4,:])[i,k]
The result should be 2 dimensional but it is 3 with a singleton dimension added. Hower, this works as expected,
@cast u[i,k] := Affine.euclideanize(view(P, :, 4, :))[i,k]
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the @cast expression using euclideanize(P[:,4,:]) and compare it with the working view(P, :, 4, :) example. Trace how @cast handles the result shape and the singleton dimension, then verify that the first example produces a 2-dimensional result without changing the working case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100