mcabbott / mcabbott/TensorCast.jl
@cast on functions with tuples as lvalues
Open
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 142
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
is there a way to use tensor cast for functions that return tuples? e.g.,
function axis_to_random_rotation3(x::AbstractVector)
x′ = similar(x)
x′ .= rand(eltype(x),3)
y = cross(x,x′)
z = cross(x,y)
R = [x y z]
R .= R./norm.(eachcol(R))'
return R
end
renorm!(n) = n ./= norm(n)
@views function plane_to_random_pose(Π)
renorm!(Π)
R = axis_to_random_rotation3(Π[1:3])
t = -Π[4].*Π[1:3]
return R, t
end
Here I want to use tensor cast to shape the returned pose from a set of planes e.g.
Π = rand(4,100)
@cast something something := plane_to_random_pose(Π[:,j])[i]
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 at the @cast macro's handling of function calls, tuple returns, and indexed lvalues; the issue does not name specific files or tests. Determine the intended syntax and semantics for applying plane_to_random_pose(Π[:,j])[i], then add coverage showing that tuple-returning functions can be used in the requested cast expression.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100