BUG DESCRIPTION:
----------------
A) Error with 2D matrices
----------------------
--> s = int(sprand(10,20,0.05)*10)
s =
( 10, 20) sparse matrix
( 2, 5) 9.
( 2, 13) 3.
( 2, 20) 6.
( 3, 2) 8.
( 5, 5) 5.
( 5, 18) 2.
( 5, 20) 6.
( 7, 20) 3.
( 8, 7) 7.
( 8, 14) 8.
( 8, 18) 9.
( 9, 5) 6.
--> unique(s)
at line 31 of function %sp_gsort ( SCI\modules\elementary_functions\macros\%sp_gsort.sci line 44 )
in builtin gsort
at line 15 of function unique ( SCI\modules\elementary_functions\macros\unique.sci line 27 )
gsort: Wrong size for input argument #1: sparse vectors expected.
Workaround: serialize the input. But
--> [sv,k] = unique(s(:)')
k =
175. 122. 45. 49. 68. 13. 42.
sv =
( 1, 8) sparse matrix
( 1, 2) 2.
( 1, 3) 3.
( 1, 4) 5.
( 1, 5) 6.
( 1, 6) 7.
( 1, 7) 8.
( 1, 8) 9.
while
--> [sv,k] = unique(full(s(:)'))
k =
1. 175. 122. 45. 49. 68. 13. 42.
sv =
0. 2. 3. 5. 6. 7. 8. 9.
==> in the general mode (not in "r" or "c"),
- The output should be dense. Indeed, all duplicated zeros are removed, making the result very light.
- The output should not miss 0
ERROR LOG:
----------
See here above
HOW TO REPRODUCE THE BUG:
-------------------------
s = int(sprand(10,20,0.05)*10)
unique(s)
[sv, k] = unique(s(:)')
issparse(sv)
or(k==find(s==0,1))
OTHER INFORMATION:
------------------
Also in Scilab 6.0.1