min(A1,A2,..) and max(A1,A2,..): mixing sparse and scalar inputs is not possible. It is not documented
Reported by Samuel GOUGEON (@sgougeon)
BUG DESCRIPTION:
----------------
In dense encoding, min and max accept to input a list of arrays mixed with scalars, as in
--> m = grand(3, 4, "uin", 0, 10)
m =
2. 4. 9. 4.
4. 1. 2. 6.
2. 3. 5. 8.
--> min(m, 5) // <<<< here
ans =
2. 4. 5. 4.
4. 1. 2. 5.
2. 3. 5. 5.
This is not the case with sparse vectors. This limitation is not documented:
--> min(sparse([1 2 3]),5)
at line 119 of function %sp_min ( SCI\modules\elementary_functions\macros\%sp_min.sci line 131 )
in builtin min
%sp_min: Wrong type for input argument #2: A sparse matrix expected.
Discussion: If the scalar is strictly negative and min() is used and applied to all elements including all implicit zeros, the resulting matrix will no longer have any zero elements and will most often become giant.
If such an operation is required, the user can convert the input in dense format before applying min().
The same will occur with max() and any strictly positive scalar mixed with some sparse matrices in input.
This is why we propose to implement this feature for sparse but just applying min() (or max()) to non-zero elements.
ERROR LOG:
----------
See above
HOW TO REPRODUCE THE BUG:
-------------------------
min(sparse([1 2 3]),5)