annotate test/bug-31371.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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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: 30110
diff changeset
3 ## Copyright (C) 2012-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/>.
22799
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 21580
diff changeset
7 ##
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 21580
diff changeset
8 ## This file is part of Octave.
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 21580
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23221
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
22799
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 21580
diff changeset
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: 23221
diff changeset
12 ## the Free Software Foundation, either version 3 of the License, or
22799
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 21580
diff changeset
13 ## (at your option) any later version.
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 21580
diff changeset
14 ##
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 21580
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 21580
diff changeset
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 21580
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 21580
diff changeset
18 ## GNU General Public License for more details.
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 21580
diff changeset
19 ##
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 21580
diff changeset
20 ## You should have received a copy of the GNU General Public License
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 21580
diff changeset
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: 23221
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 ########################################################################
22799
592fa741e0aa add missing copyright notices (bug #49624)
John W. Eaton <jwe@octave.org>
parents: 21580
diff changeset
25
30110
9080316864bf update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 30109
diff changeset
26 %!test <*31371>
14331
9a276049f18b maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 %! % Work around MATLAB bug where f(x)(y) is invalid syntax
9a276049f18b maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28 %! % (This bug does not apply to Octave)
14344
4687ecec0586 make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents: 14332
diff changeset
29 %!
4687ecec0586 make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents: 14332
diff changeset
30 %! C = @(fcn,x) fcn(x);
4687ecec0586 make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents: 14332
diff changeset
31 %! C2 = @(fcn,x,y) fcn(x,y);
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16030
diff changeset
32 %!
14331
9a276049f18b maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33 %! % Church Booleans
9a276049f18b maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34 %! T = @(t,f) t;
9a276049f18b maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35 %! F = @(t,f) f;
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16030
diff changeset
36 %!
14332
affda9a8f7d0 maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents: 14331
diff changeset
37 %! % Church Numerals
14344
4687ecec0586 make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents: 14332
diff changeset
38 %! Zero = @(fcn,x) x;
4687ecec0586 make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents: 14332
diff changeset
39 %! One = @(fcn,x) fcn(x);
4687ecec0586 make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents: 14332
diff changeset
40 %! Two = @(fcn,x) fcn(fcn(x));
4687ecec0586 make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents: 14332
diff changeset
41 %! Three = @(fcn,x) fcn(fcn(fcn(x)));
4687ecec0586 make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents: 14332
diff changeset
42 %! Four = @(fcn,x) fcn(fcn(fcn(fcn(x))));
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16030
diff changeset
43 %!
14331
9a276049f18b maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff changeset
44 %! % Arithmetic Operations
9a276049f18b maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45 %! Inc = @(a) @(f,x) f(a(f,x)); % Increment
9a276049f18b maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff changeset
46 %! Add = @(a,b) @(f,x) a(f,b(f,x));
9a276049f18b maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff changeset
47 %! Mult = @(a,b) @(f,x) a(@(x) b(f,x),x);
9a276049f18b maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff changeset
48 %! Dec = @(a) @(f,x) C(a(@(g) @(h) h(g(f)), @(u) x), @(u) u); % Decrement
9a276049f18b maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff changeset
49 %! Sub = @(a,b) b(Dec, a);
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16030
diff changeset
50 %!
14331
9a276049f18b maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff changeset
51 %! % Renderer - Convert church numeral to "real" number
14344
4687ecec0586 make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents: 14332
diff changeset
52 %! Render = @(n) n(@(n) n+1,0);
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16030
diff changeset
53 %!
14331
9a276049f18b maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54 %! % Predicates
14344
4687ecec0586 make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents: 14332
diff changeset
55 %! Iszero = @(n) n(@(x) F, T);
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16030
diff changeset
56 %!
14331
9a276049f18b maint: add file omitted from last commit
John W. Eaton <jwe@octave.org>
parents:
diff changeset
57 %! % Y combinator implements recursion
14344
4687ecec0586 make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents: 14332
diff changeset
58 %! Ycomb = @(f) C(@(g) f(@(x) C(g(g), x)), ...
4687ecec0586 make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents: 14332
diff changeset
59 %! @(g) f(@(x) C(g(g), x)));
4687ecec0586 make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents: 14332
diff changeset
60 %!
4687ecec0586 make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents: 14332
diff changeset
61 %! Factorial = Ycomb(@(f) @(n) C(C2(Iszero(n), ...
4687ecec0586 make test for bug 31371 work
John W. Eaton <jwe@octave.org>
parents: 14332
diff changeset
62 %! @(d) One, @(d) Mult(n, f(Dec(n)))),0));
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16030
diff changeset
63 %!
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 16215
diff changeset
64 %! assert (Render (Factorial (Two)), 2);
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 16215
diff changeset
65 %! assert (Render (Factorial (Three)), 6);
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 16215
diff changeset
66 %! assert (Render (Factorial (Four)), 24);