From 41e8d9f52a0f0393e8e96cd50435d4346b78ccff Mon Sep 17 00:00:00 2001 From: mottelet Date: Mon, 15 Jun 2020 09:05:30 +0200 Subject: [PATCH] * Bug 16473 fixed: Deleting rows in a sparse squared the matrix http://bugzilla.scilab.org/show_bug.cgi?id=16473 Change-Id: I1a240084d097ef78e2b48ee44c175d6bbeda2bb3 --- scilab/CHANGES.md | 3 ++- scilab/modules/ast/src/cpp/types/sparse.cpp | 2 +- .../modules/ast/tests/nonreg_tests/bug_16473.tst | 21 ++++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 scilab/modules/ast/tests/nonreg_tests/bug_16473.tst diff --git a/scilab/CHANGES.md b/scilab/CHANGES.md index 6742f75..3eb57ad 100644 --- a/scilab/CHANGES.md +++ b/scilab/CHANGES.md @@ -274,7 +274,7 @@ Bug Fixes * [#9909](https://bugzilla.scilab.org/9909): In the help browser, add a way to open the online version of the current page. * [#12889](https://bugzilla.scilab.org/12889): In the help browser, add a menu allowing to select the language of help pages, regardless of the language of the session. * [#15839](https://bugzilla.scilab.org/15839): `gsort`: the only sparse possible input were real or complex vectors, and only with the `g` method. -* [#15842](https://bugzilla.scilab.org/15842): `unique` could not process 2D sparse matrices. +* [#15842](https://bugzilla.scilab.org/15842): `unique` could not process 2D sparse matrices. * [#16106](https://bugzilla.scilab.org/16106): Xcos sciblk4 user-defined blocks did not handle opar and odstate/oz correctly. * [#16337](https://bugzilla.scilab.org/16337): The 3rd output of `[U,km,ku] = unique(..)` was not implemented. * [#16342](https://bugzilla.scilab.org/16342): `strcat()` was much slower in Scilab 6.0.2. @@ -295,6 +295,7 @@ Bug Fixes * [#16445](https://bugzilla.scilab.org/16445): `colorbar(..)` ignored how to guess `umin` and `umax` for a Champ object (with .colored="on"). * [#16452](https://bugzilla.scilab.org/16452): `setdiff(sparse([1 3 0 2]), sparse([3 7]))` missed returning 0, and wrongly returned 3. * [#16454](https://bugzilla.scilab.org/16454): `gsort` yielded an error when sorting any sparse vector including some NaN. +* [#16473](https://bugzilla.scilab.org/16473): Deleting rows in a sparse squared the matrix with padding zeros (Scilab 6 regression). ### Bugs fixed in 6.1.0: diff --git a/scilab/modules/ast/src/cpp/types/sparse.cpp b/scilab/modules/ast/src/cpp/types/sparse.cpp index 5e6cd64..1490750 100644 --- a/scilab/modules/ast/src/cpp/types/sparse.cpp +++ b/scilab/modules/ast/src/cpp/types/sparse.cpp @@ -1911,7 +1911,7 @@ GenericType* Sparse::remove(typed_list* _pArgs) } else { - pOut = new Sparse(piNewDims[0], piNewDims[0], isComplex()); + pOut = new Sparse(piNewDims[0], piNewDims[1], isComplex()); } delete[] piNewDims; diff --git a/scilab/modules/ast/tests/nonreg_tests/bug_16473.tst b/scilab/modules/ast/tests/nonreg_tests/bug_16473.tst new file mode 100644 index 0000000..e37244e --- /dev/null +++ b/scilab/modules/ast/tests/nonreg_tests/bug_16473.tst @@ -0,0 +1,21 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2020 - Stéphane MOTTELET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// <-- NO CHECK REF --> +// +// <-- Non-regression test for bug 16473 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/16473 +// +// <-- Short Description --> +// Deleting rows with [] insertion in a sparse squares the matrix with padding zeros (6.0.0 regression) + +m = int(sprand(10,3,0.5)*10); +m([2 5],:) = []; +assert_checkequal(size(m),[8 3]) \ No newline at end of file -- 1.7.9.5