Skip to content

Fix accidential API breakage in one() #763

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

Merged
merged 1 commit into from
Apr 17, 2020
Merged

Conversation

c42f
Copy link
Member

@c42f c42f commented Apr 13, 2020

Fix release-blocking bug #700 .

It turns out that Rotations.jl relies on one(M) calling the constructor of M, so transitioning to use of simliar_type in #690 broke Rotations.

It's arguably a bug to call the constructor rather than calling similar_type, but let's avoid breaking compatibility for now.

I say it's arguably a bug because some sets of matrices defined by a type cannot represent the multiplicative identity, for example the set of skew-symmetric matrices. StaticArrays should likely assume that generic operations like one() must devolve to a matrix type which can represent
anything in GL(n,R).

It turns out that Rotations relies on one(M) calling the constructor of
M, so transitioning to use of simliar_type broke Rotations.

It's arguably a bug to call the constructor rather than calling
similar_type, but let's avoid breaking compatibility for now.

(It's a bug because some sets of matrices defined by a type cannot
represent the multiplicative identity, for example the set of
skew-symmetric matrices. StaticArrays should likely assume that generic
operations like one() must devolve to a matrix type which can represent
anything in GL(n,R). For example, SMatrix.)
@c42f c42f added the bugfix label Apr 13, 2020
@andyferris
Copy link
Member

Good point, Chris. Rotations are also an example where zero(M) can’t be an M.

Should we patch Rotations.jl if that is where the misunderstanding is?

@c42f
Copy link
Member Author

c42f commented Apr 14, 2020

Rotations are also an example where zero(M) can’t be an M

Yes indeed! I left a too-long comment in the code with something to that effect :-)

Rough plan was to revert this temporarily, fix Rotations to override zero and one, and eventually put this back again. Maybe in the next major version which might be 1.0.

@c42f
Copy link
Member Author

c42f commented Apr 14, 2020

@c42f c42f added this to the v0.12.2 milestone Apr 14, 2020
@c42f c42f merged commit 93ec354 into master Apr 17, 2020
@c42f c42f deleted the cjf/one-rotmatrix-compat-fix branch April 17, 2020 09:33
@c42f
Copy link
Member Author

c42f commented Apr 17, 2020

It should be uncontroversial that we need this for the next release, so I've merged it.

c42f added a commit that referenced this pull request Nov 4, 2020
Fixes one part of #765

Reverts "Fix accidential API breakage in one() (#763)"
commit 93ec354
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants