resize_matrix(mat, [0 0]) returns mat instead of []. resize_matrix() keeping newSizes<0 is not documented.
Reported by Samuel GOUGEON (@sgougeon)
BUG DESCRIPTION:
----------------
a) When a new size==0 is provided to resize_matrix(), it is not taken into account, while returning [] is expected:
--> resize_matrix(rand(2,4), [0 3])
ans =
0.1121355 0.1531217 0.8415518
0.6856896 0.6970851 0.4062025
--> resize_matrix(rand(2,4), [1 0])
ans =
0.113836 0.5618661 0.685398 0.5042213
--> resize_matrix(rand(2,4), [0 0])
ans =
0.3873779 0.9488184 0.3760119 0.2615761
0.9222899 0.3435337 0.7340941 0.4993494
b) Specifying some new sizes<0 can be used to keep the related dimensions as they are, without having to explicitly provide their current sizes. This feature is very handy, but it is not documented.
ERROR LOG:
----------
none. Wrong behavior, and missing information.
HOW TO REPRODUCE THE BUG:
-------------------------
resize_matrix(rand(2,4), [1 0])==[]
resize_matrix(rand(2,4), [0 3])==[]
resize_matrix(rand(2,4), [0 0])==[]
help resize_matrix // https://help.scilab.org/docs/5.5.2/en_US/resize_matrix.html