-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Remove full
from similar(full(X), T, dims)
calls in generic concatenation methods
#17660
Conversation
I'd also like to point at #16740 (once I get to working on that again), see especially #16740 (comment), where |
AV i686 failure looks like #17662? |
I've updated the gists following JuliaLang/LinearAlgebra.jl#349 and #17680. Only one set of discrepancies remain: When the first argument is a |
Gists updated following JuliaLang/LinearAlgebra.jl#350. The diff is now empty, so this PR and subsequent reinstatement of #17079 should be viable now. (I will cherry pick #17079 back together if / when this clears, unless there is a better approach to reinstating #17079?). Best! |
let's keep it busy @nanosoldier |
Your benchmark job has completed - no performance regressions were detected. A full report can be found here. cc @jrevels |
Nanosoldier seems pleased. All well? Thanks! |
Absent objections or requests for time, I plan to merge this Monday (PDT). Best! |
Is this going to break DataArrays again or has it been refactored to avoid relying on this? |
Removing these |
Too bad using DataArrays
T = Float64
n = 1000
a = Array(T, n)
na = bitrand(n)
nna = sum(na)
da = DataArray(a, na)
isequal(sort(da), [DataArray(sort(dropna(da))); DataArray(T, nna)]) should be the relevant part of the test that failed last time. |
…tenation methods.
Thanks @martinholters! Results on this branch are identical to those on master. Good to merge, @tkelman @martinholters? Best! |
Absent objections or requests for time, I plan to merge this Friday (PDT). Best! |
No objections from my side. |
Towards reintroducing #17079, this pull request removes
full
fromsimilar(full(X), T, dims)
calls in the generic concatenation methods.For an explanation of those
full
calls' purpose, see the first paragraph of #17079 (comment). See the preceding comments in that thread to understand why displacing thosefull
calls is necessary to reintroduce #17079 .Contrary to the expectation I expressed in that comment, removing those
full
calls appears to improve the degree to which the generic concatenation methods preserve structure:vcat
,hcat
,hvcat
, andcat
calls, and prints the mappingscatmeth(typeA, typeB) -> typeRet
. This gist provides the output of that code on master, and this gist the same with this PR. This gist provides the diff. (Update: These gists are up to date, so the diff is now empty.)tl;dr of details To sum up the diff: When a sparse matrix or vector appears as the first argument in a concatenation call for which there exists no specialized method, on master the result is an
Array
, whereas with this PR the result remains sparse. Otherwise the results are identical.This change makes #2326 more apparent in that, for example,
hcat(SparseMatrixCSC, Bidiagonal)
would now produce a sparse matrix whereashcat(Bidiagonal, SparseMatrixCSC)
would still produce a dense matrix. Modifying theUnion
s in this and the accompanying method definitions to include special matrix types would resolve that issue for special matrix types. But the same cannot be done for the annotation types. And absent the ability to write methods withVararg
s in positions other than last, I do not immediately see a way to resolve that issue for annotation types. (Edit: Ref. #13130. Combinatorial explosion precludes extending the present strategy much?) Making the change necessary to handle special matrix types while punting to #2326 on annotation types seems attractive. Other solutions? Thanks!