Mercurial > octave
annotate test/logical-index.tst @ 31225:3eab70385569
sparse-xpow.cc: Use faster multiplication technique, this time for complex
author | Arun Giridhar <arungiridhar@gmail.com> |
---|---|
date | Sun, 11 Sep 2022 13:53:38 -0400 |
parents | 796f54d4ddbf |
children | 597f3ee61a48 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 ## |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
3 ## Copyright (C) 2006-2022 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
7016 | 7 ## |
8 ## This file is part of Octave. | |
9 ## | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
7016 | 11 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
13 ## (at your option) any later version. |
7016 | 14 ## |
15 ## Octave is distributed in the hope that it will be useful, but | |
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
18 ## GNU General Public License for more details. |
7016 | 19 ## |
20 ## You should have received a copy of the GNU General Public License | |
21 ## along with Octave; see the file COPYING. If not, see | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
7016 | 25 |
5590 | 26 %!test |
27 %! a = []; | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
28 %! fail ("a(0);"); |
5590 | 29 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
30 %!shared a |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
31 %! a = 2; |
21317
a4faec57f4c8
maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
32 %!assert (a(1), 2) |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
33 %!error id=Octave:index-out-of-bounds a(logical ([1,1])) |
5590 | 34 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
35 %!shared a |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
36 %! a = [9,8,7,6]; |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
37 %!assert (isempty (a(logical ([0,0,0,0])))) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
38 %!assert (a(logical ([1,1,1,1])), [9,8,7,6]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
39 %!assert (a(logical ([0,1,1,0])), [8,7]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
40 %!assert (a(logical ([1,1])), [9,8]) |
5590 | 41 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
42 %!shared a |
5590 | 43 %! a = [9,8;7,6]; |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
44 %!assert (isempty (a(logical ([0,0,0,0])))) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
45 %!assert (a(logical ([1,1,1,1])), [9,7,8,6]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
46 %!assert (a(logical ([0,1,1,0])), [7,8]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
47 %!assert (a(logical (0:1),logical (0:1)), 6) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
48 %!assert (a(logical (0:1),2:-1:1), [6,7]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
49 %!assert (a(logical (0:1),logical ([0,1])), 6) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
50 %!assert (a(logical (0:1),[2,1]), [6,7]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
51 %!assert (a(logical (0:1),:), [7,6]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
52 %!assert (a(logical (0:1),1), 7) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
53 %!assert (a(logical (0:1),logical ([1,1])), [7,6]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
54 %!assert (a(2:-1:1,logical (0:1)), [6;8]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
55 %!assert (a(2:-1:1,logical ([0,1])), [6;8]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
56 %!assert (a(2:-1:1,logical ([1,1])), [7,6;9,8]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
57 %!assert (a(logical ([0,1]),logical (0:1)), 6) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
58 %!assert (a(logical ([0,1]),2:-1:1), [6,7]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
59 %!assert (a(logical ([0,1]),logical ([0,1])), 6) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
60 %!assert (a(logical ([0,1]),[2,1]), [6,7]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
61 %!assert (a(logical ([0,1]),:), [7,6]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
62 %!assert (a(logical ([0,1]),1), 7) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
63 %!assert (a(logical ([0,1]),logical ([1,1])), [7,6]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
64 %!assert (a([2,1],logical (0:1)), [6;8]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
65 %!assert (a([2,1],logical ([0,1])), [6;8]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
66 %!assert (a([2,1],logical ([1,1])), [7,6;9,8]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
67 %!assert (a(:,logical (0:1)), [8;6]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
68 %!assert (a(:,logical ([0,1])), [8;6]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
69 %!assert (a(:,logical ([1,1])), [9,8;7,6]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
70 %!assert (a(1,logical (0:1)), 8) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
71 %!assert (a(1,logical ([0,1])), 8) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
72 %!assert (a(1,logical ([1,1])), [9,8]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
73 %!assert (a(logical ([1,1]),logical (0:1)), [8;6]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
74 %!assert (a(logical ([1,1]),2:-1:1), [8,9;6,7]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
75 %!assert (a(logical ([1,1]),logical ([0,1])), [8;6]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
76 %!assert (a(logical ([1,1]),[2,1]), [8,9;6,7]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
77 %!assert (a(logical ([1,1]),:), [9,8;7,6]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
78 %!assert (a(logical ([1,1]),1), [9;7]) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
14125
diff
changeset
|
79 %!assert (a(logical ([1,1]),logical ([1,1])), [9,8;7,6]) |