summaryrefslogtreecommitdiffstats
path: root/scilab
diff options
context:
space:
mode:
authorSamuel GOUGEON <sgougeon@free.fr>2020-07-04 02:16:19 +0200
committerCedric Delamarre <cdl@esi-group.com>2020-10-15 18:22:57 +0200
commit06d3e18eff3c252cdb7db523141bcfcc41df4536 (patch)
tree91d14ae7b956959a6855412de97615b05744a545 /scilab
parent08d8758d9d9d983a76fd693d897ecfb9295f5223 (diff)
downloadscilab-06d3e18eff3c252cdb7db523141bcfcc41df4536.zip
scilab-06d3e18eff3c252cdb7db523141bcfcc41df4536.tar.gz
* Bug 16488 fixed: [,;] of (bool,double) with sparse
http://bugzilla.scilab.org/16488 This is required for setdiff() https://codereview.scilab.org/21426 Change-Id: Ie128bad4691bae0f87cf0196fbd7b1631e3f218e
Diffstat (limited to 'scilab')
-rw-r--r--scilab/CHANGES.md7
-rw-r--r--scilab/modules/overloading/macros/%b_c_sp.sci14
-rw-r--r--scilab/modules/overloading/macros/%b_f_sp.sci14
-rw-r--r--scilab/modules/overloading/macros/%s_c_spb.sci14
-rw-r--r--scilab/modules/overloading/macros/%s_f_spb.sci14
-rw-r--r--scilab/modules/overloading/macros/%sp_c_b.sci14
-rw-r--r--scilab/modules/overloading/macros/%sp_c_spb.sci14
-rw-r--r--scilab/modules/overloading/macros/%sp_f_b.sci14
-rw-r--r--scilab/modules/overloading/macros/%sp_f_spb.sci14
-rw-r--r--scilab/modules/overloading/macros/%spb_c_s.sci14
-rw-r--r--scilab/modules/overloading/macros/%spb_c_sp.sci14
-rw-r--r--scilab/modules/overloading/macros/%spb_f_s.sci14
-rw-r--r--scilab/modules/overloading/macros/%spb_f_sp.sci14
-rw-r--r--scilab/modules/overloading/tests/unit_tests/concatenations_mixed.tst35
14 files changed, 206 insertions, 4 deletions
diff --git a/scilab/CHANGES.md b/scilab/CHANGES.md
index b093213..af6e926 100644
--- a/scilab/CHANGES.md
+++ b/scilab/CHANGES.md
@@ -291,7 +291,7 @@ Bug Fixes
291* [#14488](https://bugzilla.scilab.org/14488): The `frameflag=9` and `strf=".9."` values of these `plot2d` options were no longer accepted. Their documentation was ambiguous. 291* [#14488](https://bugzilla.scilab.org/14488): The `frameflag=9` and `strf=".9."` values of these `plot2d` options were no longer accepted. Their documentation was ambiguous.
292* [#14718](https://bugzilla.scilab.org/14718): `user` is removed for a while but was still documented. 292* [#14718](https://bugzilla.scilab.org/14718): `user` is removed for a while but was still documented.
293* [#14873](https://bugzilla.scilab.org/14873): `setfield` page: The output and the 6.0 history were documented only on the en_US version. The input was wrongly restricted to matrices, while any Scilab object is acceptable. The specific role of `setfield` for mlists was not really described nor illustrated. The example did not include any call to setfield. 293* [#14873](https://bugzilla.scilab.org/14873): `setfield` page: The output and the 6.0 history were documented only on the en_US version. The input was wrongly restricted to matrices, while any Scilab object is acceptable. The specific role of `setfield` for mlists was not really described nor illustrated. The example did not include any call to setfield.
294* [#15012](https://bugzilla.scilab.org/15012): `covStart(["isempty" ; "isscalar"])` crashed Scilab. 294* [#15012](https://bugzilla.scilab.org/15012): `covStart(["isempty" ; "isscalar"])` crashed Scilab.
295* [#15163](https://bugzilla.scilab.org/15163): `getdate` page: The time referential was obscure: a) UTC for Unix Time Convention vs Coordinated Universal Time. b) unclear influence of the time zone. 295* [#15163](https://bugzilla.scilab.org/15163): `getdate` page: The time referential was obscure: a) UTC for Unix Time Convention vs Coordinated Universal Time. b) unclear influence of the time zone.
296* [#15280](https://bugzilla.scilab.org/15280): `gsort` was unable to sort any hypermatrix along dimensions > "r"|"c". 296* [#15280](https://bugzilla.scilab.org/15280): `gsort` was unable to sort any hypermatrix along dimensions > "r"|"c".
297* [#15839](https://bugzilla.scilab.org/15839): `gsort`: the only sparse possible input were real or complex vectors, and only with the `g` method. 297* [#15839](https://bugzilla.scilab.org/15839): `gsort`: the only sparse possible input were real or complex vectors, and only with the `g` method.
@@ -301,8 +301,8 @@ Bug Fixes
301* [#16106](https://bugzilla.scilab.org/16106): Xcos sciblk4 user-defined blocks did not handle opar and odstate/oz correctly. 301* [#16106](https://bugzilla.scilab.org/16106): Xcos sciblk4 user-defined blocks did not handle opar and odstate/oz correctly.
302* [#16122](https://bugzilla.scilab.org/16122): concat polynomials with <> var did not raise an error. 302* [#16122](https://bugzilla.scilab.org/16122): concat polynomials with <> var did not raise an error.
303* [#16151](https://bugzilla.scilab.org/16151): `isequal(1:$, 2:$)` returned `%T`. 303* [#16151](https://bugzilla.scilab.org/16151): `isequal(1:$, 2:$)` returned `%T`.
304* [#16193](https://bugzilla.scilab.org/16193): `covStart()` clear previous coverage information. `profileEnable()` could be use to append a macro later on. 304* [#16193](https://bugzilla.scilab.org/16193): `covStart()` clear previous coverage information. `profileEnable()` could be use to append a macro later on.
305* [#16196](https://bugzilla.scilab.org/16196): `covStart()` help page was incomplete about the API usage. 305* [#16196](https://bugzilla.scilab.org/16196): `covStart()` help page was incomplete about the API usage.
306* [#16274](https://bugzilla.scilab.org/16274): assert_checkequal() did not considered equal matching Nan or void elements in (nested) containers. 306* [#16274](https://bugzilla.scilab.org/16274): assert_checkequal() did not considered equal matching Nan or void elements in (nested) containers.
307* [#16337](https://bugzilla.scilab.org/16337): The 3rd output of `[U,km,ku] = unique(..)` was not implemented. 307* [#16337](https://bugzilla.scilab.org/16337): The 3rd output of `[U,km,ku] = unique(..)` was not implemented.
308* [#16342](https://bugzilla.scilab.org/16342): `strcat()` was much slower in Scilab 6.0.2. 308* [#16342](https://bugzilla.scilab.org/16342): `strcat()` was much slower in Scilab 6.0.2.
@@ -329,6 +329,7 @@ Bug Fixes
329* [#16465](https://bugzilla.scilab.org/16465): Scinotes OpenRecent menu was not updated when it should. 329* [#16465](https://bugzilla.scilab.org/16465): Scinotes OpenRecent menu was not updated when it should.
330* [#16473](https://bugzilla.scilab.org/16473): Deleting rows in a sparse squared the matrix with padding zeros (Scilab 6 regression). 330* [#16473](https://bugzilla.scilab.org/16473): Deleting rows in a sparse squared the matrix with padding zeros (Scilab 6 regression).
331* [#16474](https://bugzilla.scilab.org/16474): `imult(%z)` crashed Scilab. 331* [#16474](https://bugzilla.scilab.org/16474): `imult(%z)` crashed Scilab.
332* [#16488](https://bugzilla.scilab.org/16488): Concatenations mixing boolean and double with at least one operand being sparse were not supported.
332* [#16496](https://bugzilla.scilab.org/16496): The `getdate` page should be rewritten: a) `getdate("s")` does NOT take leap seconds into account. b) `D=getdate(X)` is vectorized, accepts fractional seconds and returns them in `[0,1)` in D(10) instead of milliseconds. Moreover, the time referential of the result was unclear (time zone, daylight saving offset). 333* [#16496](https://bugzilla.scilab.org/16496): The `getdate` page should be rewritten: a) `getdate("s")` does NOT take leap seconds into account. b) `D=getdate(X)` is vectorized, accepts fractional seconds and returns them in `[0,1)` in D(10) instead of milliseconds. Moreover, the time referential of the result was unclear (time zone, daylight saving offset).
333* [#16512](https://bugzilla.scilab.org/16512): 1 ./ uint8(0) crashes Scilab (idem with int8, uint16, int16, uint32, int32, uint64, int64). 334* [#16512](https://bugzilla.scilab.org/16512): 1 ./ uint8(0) crashes Scilab (idem with int8, uint16, int16, uint32, int32, uint64, int64).
334* [#16517](https://bugzilla.scilab.org/16517): `getdate("s")` truncated the actual time to integer seconds. `getdate(u)(10)` returned fractional seconds instead of milliseconds as `getdate()`. 335* [#16517](https://bugzilla.scilab.org/16517): `getdate("s")` truncated the actual time to integer seconds. `getdate(u)(10)` returned fractional seconds instead of milliseconds as `getdate()`.
diff --git a/scilab/modules/overloading/macros/%b_c_sp.sci b/scilab/modules/overloading/macros/%b_c_sp.sci
new file mode 100644
index 0000000..a86956a
--- /dev/null
+++ b/scilab/modules/overloading/macros/%b_c_sp.sci
@@ -0,0 +1,14 @@
1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) Samuel GOUGEON - Le Mans Université
3//
4// This file is hereby licensed under the terms of the GNU GPL v2.0,
5// pursuant to article 5.3.4 of the CeCILL v.2.1.
6// This file was originally licensed under the terms of the CeCILL v2.1,
7// and continues to be available under such terms.
8// For more information, see the COPYING file which you should have received
9// along with this program.
10
11function r = %b_c_sp(a, b)
12 // [boolean , sparse]
13 r = [sparse(bool2s(a)) , b]
14endfunction
diff --git a/scilab/modules/overloading/macros/%b_f_sp.sci b/scilab/modules/overloading/macros/%b_f_sp.sci
new file mode 100644
index 0000000..a6e5a8f
--- /dev/null
+++ b/scilab/modules/overloading/macros/%b_f_sp.sci
@@ -0,0 +1,14 @@
1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) Samuel GOUGEON - Le Mans Université
3//
4// This file is hereby licensed under the terms of the GNU GPL v2.0,
5// pursuant to article 5.3.4 of the CeCILL v.2.1.
6// This file was originally licensed under the terms of the CeCILL v2.1,
7// and continues to be available under such terms.
8// For more information, see the COPYING file which you should have received
9// along with this program.
10
11function r = %b_f_sp(a, b)
12 // [boolean ; sparse]
13 r = [sparse(bool2s(a)) ; b]
14endfunction
diff --git a/scilab/modules/overloading/macros/%s_c_spb.sci b/scilab/modules/overloading/macros/%s_c_spb.sci
new file mode 100644
index 0000000..f0f07cc
--- /dev/null
+++ b/scilab/modules/overloading/macros/%s_c_spb.sci
@@ -0,0 +1,14 @@
1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) Samuel GOUGEON - Le Mans Université
3//
4// This file is hereby licensed under the terms of the GNU GPL v2.0,
5// pursuant to article 5.3.4 of the CeCILL v.2.1.
6// This file was originally licensed under the terms of the CeCILL v2.1,
7// and continues to be available under such terms.
8// For more information, see the COPYING file which you should have received
9// along with this program.
10
11function r = %s_c_spb(a, b)
12 // [double , sparse bool]
13 r = [sparse(a) , bool2s(b)]
14endfunction
diff --git a/scilab/modules/overloading/macros/%s_f_spb.sci b/scilab/modules/overloading/macros/%s_f_spb.sci
new file mode 100644
index 0000000..669b873
--- /dev/null
+++ b/scilab/modules/overloading/macros/%s_f_spb.sci
@@ -0,0 +1,14 @@
1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) Samuel GOUGEON - Le Mans Université
3//
4// This file is hereby licensed under the terms of the GNU GPL v2.0,
5// pursuant to article 5.3.4 of the CeCILL v.2.1.
6// This file was originally licensed under the terms of the CeCILL v2.1,
7// and continues to be available under such terms.
8// For more information, see the COPYING file which you should have received
9// along with this program.
10
11function r = %s_f_spb(a, b)
12 // [double ; sparse bool]
13 r = [sparse(a) ; bool2s(b)]
14endfunction
diff --git a/scilab/modules/overloading/macros/%sp_c_b.sci b/scilab/modules/overloading/macros/%sp_c_b.sci
new file mode 100644
index 0000000..1b3bf9a
--- /dev/null
+++ b/scilab/modules/overloading/macros/%sp_c_b.sci
@@ -0,0 +1,14 @@
1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) Samuel GOUGEON - Le Mans Université
3//
4// This file is hereby licensed under the terms of the GNU GPL v2.0,
5// pursuant to article 5.3.4 of the CeCILL v.2.1.
6// This file was originally licensed under the terms of the CeCILL v2.1,
7// and continues to be available under such terms.
8// For more information, see the COPYING file which you should have received
9// along with this program.
10
11function r = %sp_c_b(a, b)
12 // [sparse , boolean]
13 r = [a , sparse(bool2s(b))]
14endfunction
diff --git a/scilab/modules/overloading/macros/%sp_c_spb.sci b/scilab/modules/overloading/macros/%sp_c_spb.sci
new file mode 100644
index 0000000..d183d6a
--- /dev/null
+++ b/scilab/modules/overloading/macros/%sp_c_spb.sci
@@ -0,0 +1,14 @@
1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) Samuel GOUGEON - Le Mans Université
3//
4// This file is hereby licensed under the terms of the GNU GPL v2.0,
5// pursuant to article 5.3.4 of the CeCILL v.2.1.
6// This file was originally licensed under the terms of the CeCILL v2.1,
7// and continues to be available under such terms.
8// For more information, see the COPYING file which you should have received
9// along with this program.
10
11function r = %sp_c_spb(a, b)
12 // [sparse , sparse boolean]
13 r = [a , bool2s(b)]
14endfunction
diff --git a/scilab/modules/overloading/macros/%sp_f_b.sci b/scilab/modules/overloading/macros/%sp_f_b.sci
new file mode 100644
index 0000000..68e7fbe
--- /dev/null
+++ b/scilab/modules/overloading/macros/%sp_f_b.sci
@@ -0,0 +1,14 @@
1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) Samuel GOUGEON - Le Mans Université
3//
4// This file is hereby licensed under the terms of the GNU GPL v2.0,
5// pursuant to article 5.3.4 of the CeCILL v.2.1.
6// This file was originally licensed under the terms of the CeCILL v2.1,
7// and continues to be available under such terms.
8// For more information, see the COPYING file which you should have received
9// along with this program.
10
11function r = %sp_f_b(a, b)
12 // [sparse ; boolean]
13 r = [a ; sparse(bool2s(b))]
14endfunction
diff --git a/scilab/modules/overloading/macros/%sp_f_spb.sci b/scilab/modules/overloading/macros/%sp_f_spb.sci
new file mode 100644
index 0000000..afad430
--- /dev/null
+++ b/scilab/modules/overloading/macros/%sp_f_spb.sci
@@ -0,0 +1,14 @@
1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) Samuel GOUGEON - Le Mans Université
3//
4// This file is hereby licensed under the terms of the GNU GPL v2.0,
5// pursuant to article 5.3.4 of the CeCILL v.2.1.
6// This file was originally licensed under the terms of the CeCILL v2.1,
7// and continues to be available under such terms.
8// For more information, see the COPYING file which you should have received
9// along with this program.
10
11function r = %sp_f_spb(a, b)
12 // [sparse ; sparse bool]
13 r = [a ; bool2s(b)]
14endfunction
diff --git a/scilab/modules/overloading/macros/%spb_c_s.sci b/scilab/modules/overloading/macros/%spb_c_s.sci
new file mode 100644
index 0000000..f73b1df
--- /dev/null
+++ b/scilab/modules/overloading/macros/%spb_c_s.sci
@@ -0,0 +1,14 @@
1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) Samuel GOUGEON - Le Mans Université
3//
4// This file is hereby licensed under the terms of the GNU GPL v2.0,
5// pursuant to article 5.3.4 of the CeCILL v.2.1.
6// This file was originally licensed under the terms of the CeCILL v2.1,
7// and continues to be available under such terms.
8// For more information, see the COPYING file which you should have received
9// along with this program.
10
11function r = %spb_c_s(a, b)
12 // [sparse bool, double]
13 r = [bool2s(a) , sparse(b)]
14endfunction
diff --git a/scilab/modules/overloading/macros/%spb_c_sp.sci b/scilab/modules/overloading/macros/%spb_c_sp.sci
new file mode 100644
index 0000000..2567141
--- /dev/null
+++ b/scilab/modules/overloading/macros/%spb_c_sp.sci
@@ -0,0 +1,14 @@
1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) Samuel GOUGEON - Le Mans Université
3//
4// This file is hereby licensed under the terms of the GNU GPL v2.0,
5// pursuant to article 5.3.4 of the CeCILL v.2.1.
6// This file was originally licensed under the terms of the CeCILL v2.1,
7// and continues to be available under such terms.
8// For more information, see the COPYING file which you should have received
9// along with this program.
10
11function r = %spb_c_sp(a, b)
12 // [sparse bool, sparse]
13 r = [bool2s(a) , b]
14endfunction
diff --git a/scilab/modules/overloading/macros/%spb_f_s.sci b/scilab/modules/overloading/macros/%spb_f_s.sci
new file mode 100644
index 0000000..2372106
--- /dev/null
+++ b/scilab/modules/overloading/macros/%spb_f_s.sci
@@ -0,0 +1,14 @@
1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) Samuel GOUGEON - Le Mans Université
3//
4// This file is hereby licensed under the terms of the GNU GPL v2.0,
5// pursuant to article 5.3.4 of the CeCILL v.2.1.
6// This file was originally licensed under the terms of the CeCILL v2.1,
7// and continues to be available under such terms.
8// For more information, see the COPYING file which you should have received
9// along with this program.
10
11function r = %spb_f_s(a, b)
12 // [sparse bool ; double]
13 r = [ bool2s(a) ; sparse(b) ]
14endfunction
diff --git a/scilab/modules/overloading/macros/%spb_f_sp.sci b/scilab/modules/overloading/macros/%spb_f_sp.sci
new file mode 100644
index 0000000..4549cf3
--- /dev/null
+++ b/scilab/modules/overloading/macros/%spb_f_sp.sci
@@ -0,0 +1,14 @@
1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) Samuel GOUGEON - Le Mans Université
3//
4// This file is hereby licensed under the terms of the GNU GPL v2.0,
5// pursuant to article 5.3.4 of the CeCILL v.2.1.
6// This file was originally licensed under the terms of the CeCILL v2.1,
7// and continues to be available under such terms.
8// For more information, see the COPYING file which you should have received
9// along with this program.
10
11function r = %spb_f_sp(a, b)
12 // [sparse bool ; sparse]
13 r = [bool2s(a) ; b]
14endfunction
diff --git a/scilab/modules/overloading/tests/unit_tests/concatenations_mixed.tst b/scilab/modules/overloading/tests/unit_tests/concatenations_mixed.tst
index 5dc34dd..29af0de 100644
--- a/scilab/modules/overloading/tests/unit_tests/concatenations_mixed.tst
+++ b/scilab/modules/overloading/tests/unit_tests/concatenations_mixed.tst
@@ -1,6 +1,6 @@
1// ============================================================================= 1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2018 - 2020 - Samuel GOUGEON 3// Copyright (C) 2018-2020 - Samuel GOUGEON - Le Mans Université
4// 4//
5// This file is distributed under the same license as the Scilab package. 5// This file is distributed under the same license as the Scilab package.
6// ============================================================================= 6// =============================================================================
@@ -39,3 +39,36 @@ for it = [1 2 4 8 11 12 14 18] // Loop on integer types
39 assert_checkequal([iconvert(d,it) ; d], [d ; d]); 39 assert_checkequal([iconvert(d,it) ; d], [d ; d]);
40 end 40 end
41end 41end
42
43// -------------------------------------------------
44// A boolean and a double, at least one being sparse
45// -------------------------------------------------
46s = [2 -1 3 ; 4 0 2];
47sp = sparse(s);
48b = [%T %F %F ; %F %T %T];
49spb = sparse(b);
50objects = list(s, sp, b, spb);
51for a = objects
52 for b = objects
53 if (or(type(a)==[1 5]) & or(type(b)==[1 5])) | ..
54 (or(type(a)==[4 6]) & or(type(b)==[4 6])) | ..
55 (~issparse(a) & ~issparse(b))
56 continue
57 end
58 c = [a b];
59 if or(type(a)==[1 5]) | or(type(b)==[1 5])
60 assert_checkequal(type(c), 5);
61 else
62 assert_checkequal(type(c), 6);
63 end
64 assert_checkequal(size(c), [2 6]);
65
66 c = [a ; b];
67 if or(type(a)==[1 5]) | or(type(b)==[1 5])
68 assert_checkequal(type(c), 5);
69 else
70 assert_checkequal(type(c), 6);
71 end
72 assert_checkequal(size(c), [4 3]);
73 end
74end