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

Fix #356, Performance of SMatrix(::StaticMatrix) #357

Closed
wants to merge 2 commits into from

Conversation

tkoolen
Copy link
Contributor

@tkoolen tkoolen commented Jan 13, 2018

Fixes #356.

@codecov-io
Copy link

Codecov Report

Merging #357 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #357   +/-   ##
=======================================
  Coverage   93.36%   93.36%           
=======================================
  Files          37       37           
  Lines        2713     2713           
=======================================
  Hits         2533     2533           
  Misses        180      180
Impacted Files Coverage Δ
src/SMatrix.jl 94.78% <100%> (ø) ⬆️

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 9044eb2...1e323f9. Read the comment docs.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 93.365% when pulling 1e323f9 on tkoolen:tk/fix-356 into 9044eb2 on JuliaArrays:master.

@c42f
Copy link
Member

c42f commented Jan 14, 2018

This fix looks functional, but perhaps we should just be deleting this method entirely, and fixing the equivalent SArray constructor instead?

(This has the feeling of a lot of other issues we've had in StaticArrays ever since SMatrix became a simple type alias of SArray.)

@tkoolen
Copy link
Contributor Author

tkoolen commented Apr 15, 2018

I finally got around to this again. What do you think of the new approach?

It currently requires defining a convert_similar_type method for each StaticArray subtype that needs to work with these generic StaticArray constructor methods. I wanted to just use similar_type, but for this purpose it's too inconsistent in whether it returns an MArray or SArray type. Unfortunately, it's not possible to define convert_similar_type generically for all possible subtypes of StaticArray, because in general it isn't even known how many type parameters any given concrete StaticArray subtype has.

@andyferris
Copy link
Member

OK, interesting approach. I can see that we need something like this. (I wonder if Julia v0.7 includes any implementation for controlling eltypes for AbstractArray?)

Unfortunately, it's not possible to define convert_similar_type generically for all possible subtypes of StaticArray, because in general it isn't even known how many type parameters any given concrete StaticArray subtype has.

We used to have a hilarious implementation for exactly this, that would analyze the type tree to the point where it could replace exactly the correct type parameters as necessary. :)

@tkoolen tkoolen changed the title Fix #356. Fix #356, Performance of SMatrix(::StaticMatrix) Jul 18, 2018
@c42f
Copy link
Member

c42f commented Jul 17, 2019

It looks like #356 was closed by taking a much more minimal approach in #358. Should we close this issue?

@tkoolen
Copy link
Contributor Author

tkoolen commented Jul 17, 2019

Sure.

@tkoolen tkoolen closed this Jul 17, 2019
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.

Performance of SMatrix(::StaticMatrix)
5 participants