Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Use static arrays #46

Merged
merged 1 commit into from
Oct 26, 2017
Merged

[WIP] Use static arrays #46

merged 1 commit into from
Oct 26, 2017

Conversation

giordano
Copy link
Member

@giordano giordano commented Oct 12, 2017

Fix #45.

This is marked as work-in-progress because I'm not sure I made all possible changes. Feel free to report any missing array to change.

@codecov-io
Copy link

codecov-io commented Oct 13, 2017

Codecov Report

Merging #46 into master will increase coverage by 0.06%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #46      +/-   ##
==========================================
+ Coverage   99.81%   99.87%   +0.06%     
==========================================
  Files          76       76              
  Lines        1581     1554      -27     
==========================================
- Hits         1578     1552      -26     
+ Misses          3        2       -1
Impacted Files Coverage Δ
src/common.jl 100% <ø> (ø) ⬆️
src/gal_uvw.jl 100% <ø> (ø) ⬆️
src/precess_cd.jl 100% <100%> (ø) ⬆️
src/helio.jl 100% <100%> (ø) ⬆️
src/moonpos.jl 100% <100%> (ø) ⬆️
src/nutate.jl 100% <100%> (ø) ⬆️
src/premat.jl 100% <100%> (ø) ⬆️
src/mag2geo.jl 100% <100%> (ø) ⬆️
src/baryvel.jl 100% <100%> (ø) ⬆️
src/sixty.jl 100% <100%> (ø) ⬆️
... and 22 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c8358fc...170d785. Read the comment docs.

@TestSubjector
Copy link
Contributor

TestSubjector commented Oct 16, 2017

Perhaps the following changes?

In bprecess.jl, change line 42 to

s = Vector{T}(s1)

Additionally, since premat() returns an array; either convert it to static or convert the variable that receives the return value of premat (in precess.jl and baryvel.jl) to static?

Small question :- Does StaticArrays give a significant boost to the performance of the code?

@giordano
Copy link
Member Author

Thanks for looking into it!

In bprecess.jl, change line 42 to

s = Vector{T}(s1)

s will be changed, doing what you suggest would change s1 as well, this is what I wanted to avoid with the copy. See this example:

julia> s = randn(3)
3-element Array{Float64,1}:
  0.593006
 -1.79782 
  0.592398

julia> s1 = Vector{Float64}(s)
3-element Array{Float64,1}:
  0.593006
 -1.79782 
  0.592398

julia> s1[1] = -5
-5

julia> s
3-element Array{Float64,1}:
 -5.0     
 -1.79782 
  0.592398

Additionally, since premat() returns an array; either convert it to static or convert the variable that receives the return value of premat (in precess.jl and baryvel.jl) to static?

Not sure what you refer to, the PR already makes the array returned by premat static: https://github.com/JuliaAstro/AstroLib.jl/pull/46/files#diff-3466cd565556cdaaf4ea10f869aa4961

@TestSubjector
Copy link
Contributor

Not sure what you refer to, the PR already makes the array returned by premat static: https://github.com/JuliaAstro/AstroLib.jl/pull/46/files#diff-3466cd565556cdaaf4ea10f869aa4961

Ah, didn't notice that. I was referring to the same.

I think almost everything is covered by the PR then.

@giordano
Copy link
Member Author

I think almost everything is covered by the PR then.

I don't expect to have covered everything, but almost everything is a good result :-) Thanks!

@giordano
Copy link
Member Author

giordano commented Oct 16, 2017

Holding back the PR because of JuliaArrays/StaticArrays.jl#321 which makes nutate type-unstable on Julia master JuliaArrays/StaticArrays.jl#322 JuliaLang/julia#24286

Edit: all issues resolved.

@giordano giordano merged commit 3e3ea0f into master Oct 26, 2017
@giordano giordano deleted the staticarrays branch October 26, 2017 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants