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 full(X) where X is a factorization #18938

Merged
merged 1 commit into from
Oct 24, 2016
Merged

Conversation

Sacha0
Copy link
Member

@Sacha0 Sacha0 commented Oct 15, 2016

In #18850 (comment), @tkelman noticed that full(X) where X is a factorization has been incorrectly calling convert(Array, X) rather than convert(AbstractArray, X) since #17066. This PR fixes that bug, restoring full's former semantics. (Not certain whether tests for this behavior would be useful given the plan to deprecate full. Perhaps making the tests in #18850 more strict [check some return types] would be the equivalent in spirit?) Best!

@tkelman
Copy link
Contributor

tkelman commented Oct 15, 2016

hope this is all of them? yes, checking return types more strictly would be a good idea. thanks!

@Sacha0
Copy link
Member Author

Sacha0 commented Oct 15, 2016

hope this is all of them?

Hope so :). (grep'd.)

yes, checking return types more strictly would be a good idea.

Is that to say that adding appropriate return type checks to #18850 as it evolves, rather than here, strikes you as a reasonable plan? Or would you prefer to add tests to full here, full's forthcoming deprecation aside? Thanks!

@Sacha0
Copy link
Member Author

Sacha0 commented Oct 15, 2016

The errors indicate that I relaxed too many full methods from convert(Array, ...) to convert(AbstractArray, ...). In other words, full's semantics were not consistent even among the factorization types. (The breadth and number of ambiguities we've encountered in the process of migrating away from full evidences the argument for replacing full with better defined operations.)

@andreasnoack
Copy link
Member

The errors indicate that I relaxed too many full methods from convert(Array, ...) to convert(AbstractArray, ...). In other words, full's semantics were not consistent even among the factorization types.

Some of the errors are because the Q types are not Factorizations. There is probably still inconsistencies among the old full methods were defined and your work will definately help to eliminate them. However, I still don't see that the semantics of full(T<:Factorization/Symmetric/Triangular etc) should be ill defined. At least not with my preffered definition: full(A)=mattype(A)(A) with e.g. mattype{T,S}(LU{T,S})=S. As I see it, the problem is that we decided to use explicit type conversion instead of a generic function.

… some factorizations F, restoring full's former semantics for factorizations.
@Sacha0
Copy link
Member Author

Sacha0 commented Oct 15, 2016

Corrected version pushed. Passing linalg and sparse tests locally now.

Some of the errors are because the Q types are not Factorizations.

Yes, I shouldn't write PRs when half asleep :). Best!

@Sacha0
Copy link
Member Author

Sacha0 commented Oct 15, 2016

However, I still don't see that the semantics of full(T<:Factorization/Symmetric/Triangular etc) should be ill defined. At least not with my preffered definition: full(A)=mattype(A)(A) with e.g. mattype{T,S}(LU{T,S})=S. As I see it, the problem is that we decided to use explicit type conversion instead of a generic function.

@andreasnoack, please see my response in #18850 (#18850 (comment)). Best!

@Sacha0
Copy link
Member Author

Sacha0 commented Oct 16, 2016

Apart from the few factorizations with specializations for structured matrix types (LDLt for SymTridiagonal, LU for Tridiagonal), how to test that full calls convert(AbstractArray, X) rather than convert(Array, X) is not clear. The trouble is that (for matrix types in base for which the factorizations succeed) the outputs of convert(Array, X) and convert(AbstractArray, X) are usually identical. @andreasnoack, thoughts/suggestions? Thanks!

@kshyatt kshyatt added the linear algebra Linear algebra label Oct 17, 2016
@kshyatt
Copy link
Contributor

kshyatt commented Oct 17, 2016

Bumping.

@tkelman
Copy link
Contributor

tkelman commented Oct 24, 2016

It looks like you're working towards deprecating full pretty soon. This will be a more correct deprecation. How to best test it is an open question, but may as well not hold up this fix.

@tkelman tkelman added the needs tests Unit tests are required for this change label Oct 24, 2016
@tkelman tkelman merged commit 5515eda into JuliaLang:master Oct 24, 2016
@Sacha0 Sacha0 deleted the fixfactfull branch October 25, 2016 01:15
@Sacha0
Copy link
Member Author

Sacha0 commented Oct 26, 2016

It looks like you're working towards deprecating full pretty soon.

Hopefully, but further work is blocked on this decision, so completion timescale is indeterminate. Best!

fcard pushed a commit to fcard/julia that referenced this pull request Feb 28, 2017
… some factorizations F, restoring full's former semantics for factorizations. (JuliaLang#18938)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linear algebra Linear algebra needs tests Unit tests are required for this change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants