-
-
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
Fix #13130 - concatenation of dense and sparse should be sparse. #15172
Conversation
It couldn't build, as I had added the |
31f0b7d
to
5247a72
Compare
Test failure seems to be due to #15285. I havn't done anything about the fact that |
Could this be done without having to build up and save temporary |
Do you mean like we do when cat'ing sparse matrices? |
I tried to address your concern @tkelman . However, my I would appreciate pointers as to what I am doing wrong here. |
Seems like we could have a go at defining that conversion method? |
Ah, now I get it! Obviously, this is going to fail if an entire row is dense. Thanks :) |
So I pushed another version, which simply does tmp_rows[i] = sparse(hcat(X[(1 : rows[i]) + k]...)) I figured that would be fine, as I thought sparse(S::SparseMatrixCSC) = S but apparently sparse(S::SparseMatrixCSC) = copy(S) I just can't quite figure out how to define the
Would work, but apparently not. |
You need |
Of course, thanks. |
travis-ci timed out on osx For what it is worth, |
This time around it was the (thanks) |
Doing the |
What happened in AppVeyor? |
whatever it was, it's not good:
though I'd be surprised if it were due to your changes, likely a preexisting bug somewhere |
@tkelman any chance I could get you to restart the two failing runs? (mac on travis and 64bit on AV) |
Done. |
Thanks. I see travis succeeded, but AV didn't run. |
Ah, now it says the PR has conflicts and thus cannot run. |
Oh, so I should rebase and push? Edit: Some tests had been added to sparse.jl. Rebased. |
CI, a love-hate relationship One was the |
OS X failure is expected at the moment, I've restarted the other. |
If there are any comments at this stage, I'd gladly take them. |
Sorry to bother the subscribed people, I'm just curious. Is this waiting for a decision or something similar? I'd just prefer not to rebase again before I know what going on, as I've rebased a few times just for the sake of rebasing :) |
I think we just keep forgetting to merge before new conflicts happen, sorry. I don't see anything objectionable here and agree with the change myself. |
No worries! I know these are busy times. |
# Sparse/dense concatenation | ||
|
||
function hcat(Xin::Union{Matrix, SparseMatrixCSC}...) | ||
X = SparseMatrixCSC[issparse(x) ? x : sparse(x) for x in Xin] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yeah I guess we could technically use a generator here now, though I'm not sure if it would make a noticeable difference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not quite sure I know what you mean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generators are new syntax that's like comprehensions but creating an iterator instead of an array. Though it looks like hcat'ing a comprehension generator without a splat doesn't behave quite like I thought it would.
Fixes #13130 .
I had to add
hcat
,vcat
, andhvcat
forMatrix
. If I didn't, it would fall back to theUnion{Matrix, SparseMatrixCSC
method for[rand(10,10) rand(10, 10)]
. There may be cleaner ways to do all of this.Also, currently
[sprand(10, 0.1) sprand(10, 10, 0.1)]
returns a dense matrix. Surely, that should be sparse. I havn't implemented[rand(10) sprand(10, 10, 0.1)]
yet either.I guess it is still to be decided if this is the wanted behaviour, but I just wanted to make a PR to mirror my issue.
By the way, I am unsure what happened with the first two commits mentioned at the issue. They were supposed to be to my fork, but it doesn't say "to pkofod/julia". Is that because I've deleted that fork since?