JuliaArrays / JuliaArrays/StaticArrays.jl

question about outer constructors

Open
#721 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cleanup question
Dominant language
Julia
Stars
844
Forks
159
Avg merge
3d 21h
Merged PRs (30d)
3

Description

https://github.com/JuliaArrays/StaticArrays.jl/blob/3a9291df5407230ac8cce5aec025abaa068fd5d4/src/SArray.jl#L32

in above I see the use of generated function for outer constructors.

what is the difference (and disadvantage) using the following instead?

SArray{S, T, N}(x::Tuple) where {S<:Tuple, T, N} = SArray{S, T, N, tuple_prod(S) }(x)

also, in https://github.com/JuliaArrays/StaticArrays.jl/blob/3a9291df5407230ac8cce5aec025abaa068fd5d4/src/SDiagonal.jl#L11

why don't we define the following?

@inline SDiagonal{N,T}(a::Tuple) where {N,T} = Diagonal(SVector{N,T}(a))

thanks.

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

Read src/SArray.jl around line 32 and src/SDiagonal.jl around line 11, then trace the referenced constructor definitions and their tests or call sites. Compare the generated and proposed outer constructors and determine whether the SDiagonal alternative preserves the intended API and behavior; done means documenting the differences and any disadvantages clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.