[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #53198] nnz could be improved for diagonal mat
From: |
Dan Sebald |
Subject: |
[Octave-bug-tracker] [bug #53198] nnz could be improved for diagonal matrices |
Date: |
Mon, 18 Jun 2018 14:29:48 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0 |
Follow-up Comment #7, bug #53198 (project octave):
I'll give it a try. I'm a bit busy this summer, so it may take a while even
though it's not that big of a changeset.
I'm a little confused with the current issorted() for full matrices. The
following all looks fine:
octave:20> I = [1 1 2]; J = [1 1 2]; SV = [3 4 5];
octave:21> X = sparse (I, J, SV, 3, 4, "unique")
X =
Compressed Column Sparse (rows = 3, cols = 4, nnz = 2 [17%])
(1, 1) -> 4
(2, 2) -> 5
octave:22> full(X)
ans =
4 0 0 0
0 5 0 0
0 0 0 0
octave:23> sort(full(X))
ans =
0 0 0 0
0 0 0 0
4 5 0 0
octave:24> sort(full(X),2)
ans =
0 0 0 4
0 0 0 5
0 0 0 0
But why can't issorted() act on a matrix?
octave:25> issorted(sort(full(X)))
I would think that issorted() is a counterpart to sort(), so it should be able
to act on something output by sort().
Furthermore, there is this "rows" option, which refers to sortrows(). Now, I
understand the idea of a sortrows(). It's a vector-based sort that maintains
order across rows; a bit like a spreadsheet sort, if you follow. But it seems
to me that in order to test whether this is a valid output of sortrows(), one
needs to know how the sorting of sortrows() was done, i.e., the "C" of
sortrows() documentation. Also, note that this works
octave:30> issorted(sort(full(X)),"rows")
ans = 1
yet without the "rows" it's the error above. And what about a "cols"
counterpart? Why should vector-sorting be allowed only in the "rows"
dimension?
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?53198>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/