Mercurial > octave
annotate scripts/linear-algebra/issymmetric.m @ 33632:fed0dc6fd44c default tip @
remove unused variable from libgui/module.mk
* libgui/module.mk: remove empty variable OCTAVE_GUI_EDITOR_MOC
author | Torsten Lilge <ttl-octave@mailbox.org> |
---|---|
date | Mon, 27 May 2024 19:42:05 +0200 |
parents | 0b8f3470d1fb |
children |
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 ## |
32632
2e484f9f1f18
maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
31706
diff
changeset
|
3 ## Copyright (C) 1996-2024 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26592
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/>. |
4026 | 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 |
4026 | 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. |
4026 | 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. |
4026 | 19 ## |
20 ## You should have received a copy of the GNU General Public License | |
7016 | 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 ######################################################################## |
4026 | 25 |
26 ## -*- texinfo -*- | |
30558
83aeaba707d8
doc: Use TF for output variable in documentation for isXXX functions in scripts/ directory.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
27 ## @deftypefn {} {@var{tf} =} issymmetric (@var{A}) |
83aeaba707d8
doc: Use TF for output variable in documentation for isXXX functions in scripts/ directory.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
28 ## @deftypefnx {} {@var{tf} =} issymmetric (@var{A}, @var{tol}) |
83aeaba707d8
doc: Use TF for output variable in documentation for isXXX functions in scripts/ directory.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
29 ## @deftypefnx {} {@var{tf} =} issymmetric (@var{A}, @qcode{"skew"}) |
83aeaba707d8
doc: Use TF for output variable in documentation for isXXX functions in scripts/ directory.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
30 ## @deftypefnx {} {@var{tf} =} issymmetric (@var{A}, @qcode{"skew"}, @var{tol}) |
33029
0b8f3470d1fb
doc: Clarify object types for isX functions (bug #48088)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents:
32632
diff
changeset
|
31 ## Return true if @var{A} is a symmetric or skew-symmetric numeric matrix |
0b8f3470d1fb
doc: Clarify object types for isX functions (bug #48088)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents:
32632
diff
changeset
|
32 ## within the tolerance specified by @var{tol}. |
18921
d0d0858cfab1
doc: Match docstring variable names to function variable names for linear-algebra m-files.
Rik <rik@octave.org>
parents:
18799
diff
changeset
|
33 ## |
d0d0858cfab1
doc: Match docstring variable names to function variable names for linear-algebra m-files.
Rik <rik@octave.org>
parents:
18799
diff
changeset
|
34 ## The default tolerance is zero (uses faster code). |
20160
03b9d17a2d95
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
35 ## |
25223
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
36 ## The type of symmetry to check may be specified with the additional input |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
37 ## @qcode{"nonskew"} (default) for regular symmetry or @qcode{"skew"} for |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
38 ## skew-symmetry. |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
39 ## |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
40 ## Background: A matrix is symmetric if the transpose of the matrix is equal |
25228
581d3a13d7e2
ishermitian.m, issymmetric.m: Use @tcode macro in docstring (bug #53556).
Rik <rik@octave.org>
parents:
25227
diff
changeset
|
41 ## to the original matrix: @w{@tcode{@var{A} == @var{A}.'}}. If a tolerance |
25223
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
42 ## is given then symmetry is determined by |
18921
d0d0858cfab1
doc: Match docstring variable names to function variable names for linear-algebra m-files.
Rik <rik@octave.org>
parents:
18799
diff
changeset
|
43 ## @code{norm (@var{A} - @var{A}.', Inf) / norm (@var{A}, Inf) < @var{tol}}. |
25223
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
44 ## |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
45 ## A matrix is skew-symmetric if the transpose of the matrix is equal to the |
25228
581d3a13d7e2
ishermitian.m, issymmetric.m: Use @tcode macro in docstring (bug #53556).
Rik <rik@octave.org>
parents:
25227
diff
changeset
|
46 ## negative of the original matrix: @w{@tcode{@var{A} == -@var{A}.'}}. If a |
25223
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
47 ## tolerance is given then skew-symmetry is determined by |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
48 ## @code{norm (@var{A} + @var{A}.', Inf) / norm (@var{A}, Inf) < @var{tol}}. |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
10711
diff
changeset
|
49 ## @seealso{ishermitian, isdefinite} |
4026 | 50 ## @end deftypefn |
51 | |
30558
83aeaba707d8
doc: Use TF for output variable in documentation for isXXX functions in scripts/ directory.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
52 function tf = issymmetric (A, skewopt = "nonskew", tol = 0) |
9869
ecd750d1eabd
move issymmetric & isdefinite to linear-algebra, create ishermitian
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
53 |
28789
28de41192f3c
Eliminate unneeded verification of nargin, nargout in m-files.
Rik <rik@octave.org>
parents:
27985
diff
changeset
|
54 if (nargin < 1) |
9869
ecd750d1eabd
move issymmetric & isdefinite to linear-algebra, create ishermitian
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
55 print_usage (); |
ecd750d1eabd
move issymmetric & isdefinite to linear-algebra, create ishermitian
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
56 endif |
4026 | 57 |
25223
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
58 if (nargin == 2) |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
59 ## Decode whether second argument is skewopt or tol |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
60 if (isnumeric (skewopt)) |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
61 tol = skewopt; |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
62 skewopt = "nonskew"; |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
63 elseif (! ischar (skewopt)) |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
64 error ("issymmetric: second argument must be a non-negative scalar TOL, or one of the strings: 'skew' / 'nonskew'"); |
25227
a937ffe7dfd9
fix typo in previous change
John W. Eaton <jwe@octave.org>
parents:
25224
diff
changeset
|
65 endif |
25223
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
66 endif |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
67 |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
68 ## Validate inputs |
28908
1572a4329015
issymmetric.m: Extend functionality to character matrices (bug #59264).
Rik <rik@octave.org>
parents:
28886
diff
changeset
|
69 if (! (isnumeric (A) || islogical (A) || ischar (A))) |
1572a4329015
issymmetric.m: Extend functionality to character matrices (bug #59264).
Rik <rik@octave.org>
parents:
28886
diff
changeset
|
70 error ("issymmetric: A must be a numeric, logical, or character matrix"); |
25223
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
71 endif |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
72 |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
73 if (! (strcmp (skewopt, "skew") || strcmp (skewopt, "nonskew"))) |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
74 error ("issymmetric: SKEWOPT must be 'skew' or 'nonskew'"); |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
75 endif |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
76 |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
77 if (! (isnumeric (tol) && isscalar (tol) && tol >= 0)) |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
78 error ("issymmetric: TOL must be a scalar >= 0"); |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
79 endif |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
80 |
28908
1572a4329015
issymmetric.m: Extend functionality to character matrices (bug #59264).
Rik <rik@octave.org>
parents:
28886
diff
changeset
|
81 if (! issquare (A)) |
30558
83aeaba707d8
doc: Use TF for output variable in documentation for isXXX functions in scripts/ directory.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
82 tf = false; |
28908
1572a4329015
issymmetric.m: Extend functionality to character matrices (bug #59264).
Rik <rik@octave.org>
parents:
28886
diff
changeset
|
83 return; |
1572a4329015
issymmetric.m: Extend functionality to character matrices (bug #59264).
Rik <rik@octave.org>
parents:
28886
diff
changeset
|
84 endif |
1572a4329015
issymmetric.m: Extend functionality to character matrices (bug #59264).
Rik <rik@octave.org>
parents:
28886
diff
changeset
|
85 |
25223
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
86 ## Calculate symmetry |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
87 if (strcmp (skewopt, "nonskew")) |
9869
ecd750d1eabd
move issymmetric & isdefinite to linear-algebra, create ishermitian
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
88 if (tol == 0) |
25223
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
89 ## check for exact symmetry |
30558
83aeaba707d8
doc: Use TF for output variable in documentation for isXXX functions in scripts/ directory.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
90 tf = full (! any ((A != A.')(:))); |
9869
ecd750d1eabd
move issymmetric & isdefinite to linear-algebra, create ishermitian
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
91 else |
28908
1572a4329015
issymmetric.m: Extend functionality to character matrices (bug #59264).
Rik <rik@octave.org>
parents:
28886
diff
changeset
|
92 if (! isnumeric (A)) |
26289
0d755097d73f
issymetric.m, ishermitian.m: Don't error on logical matrices (bug #42487).
Rik <rik@octave.org>
parents:
25228
diff
changeset
|
93 ## Hack to allow norm to work. Choose single to minimize memory. |
0d755097d73f
issymetric.m, ishermitian.m: Don't error on logical matrices (bug #42487).
Rik <rik@octave.org>
parents:
25228
diff
changeset
|
94 A = single (A); |
0d755097d73f
issymetric.m, ishermitian.m: Don't error on logical matrices (bug #42487).
Rik <rik@octave.org>
parents:
25228
diff
changeset
|
95 endif |
25223
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
96 norm_x = norm (A, Inf); |
30558
83aeaba707d8
doc: Use TF for output variable in documentation for isXXX functions in scripts/ directory.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
97 tf = norm_x == 0 || norm (A - A.', Inf) / norm_x <= tol; |
25223
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
98 endif |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
99 else |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
100 ## skew symmetry |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
101 if (tol == 0) |
30558
83aeaba707d8
doc: Use TF for output variable in documentation for isXXX functions in scripts/ directory.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
102 tf = full (! any ((A != -A.')(:))); |
25223
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
103 else |
28908
1572a4329015
issymmetric.m: Extend functionality to character matrices (bug #59264).
Rik <rik@octave.org>
parents:
28886
diff
changeset
|
104 if (! isnumeric (A)) |
26289
0d755097d73f
issymetric.m, ishermitian.m: Don't error on logical matrices (bug #42487).
Rik <rik@octave.org>
parents:
25228
diff
changeset
|
105 ## Hack to allow norm to work. Choose single to minimize memory. |
0d755097d73f
issymetric.m, ishermitian.m: Don't error on logical matrices (bug #42487).
Rik <rik@octave.org>
parents:
25228
diff
changeset
|
106 A = single (A); |
0d755097d73f
issymetric.m, ishermitian.m: Don't error on logical matrices (bug #42487).
Rik <rik@octave.org>
parents:
25228
diff
changeset
|
107 endif |
25223
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
108 norm_x = norm (A, Inf); |
30558
83aeaba707d8
doc: Use TF for output variable in documentation for isXXX functions in scripts/ directory.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
109 tf = norm_x == 0 || norm (A + A.', Inf) / norm_x <= tol; |
4026 | 110 endif |
111 endif | |
112 | |
113 endfunction | |
7265 | 114 |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
115 |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
116 %!assert (issymmetric (1)) |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
117 %!assert (! issymmetric ([1, 2])) |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
118 %!assert (issymmetric ([])) |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
119 %!assert (issymmetric ([1, 2; 2, 1])) |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
120 %!assert (issymmetric ([1, 2.1; 2, 1.1], 0.2)) |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
121 %!assert (issymmetric ([1, 2i; 2i, 1])) |
26592
c0fa4a9eef95
Ensure boolean value when checking sparse matrices for symmetry/hermiticity.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
26376
diff
changeset
|
122 %!assert (issymmetric (speye (100)), true) # Return full logical value. |
28908
1572a4329015
issymmetric.m: Extend functionality to character matrices (bug #59264).
Rik <rik@octave.org>
parents:
28886
diff
changeset
|
123 %!assert (! issymmetric ([0, 2; -2, 0], "nonskew")) |
25223
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
124 %!assert (issymmetric ([0, 2; -2, 0], "skew")) |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
125 %!assert (! issymmetric ([0, 2; -2, eps], "skew")) |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
126 %!assert (issymmetric ([0, 2; -2, eps], "skew", eps)) |
28908
1572a4329015
issymmetric.m: Extend functionality to character matrices (bug #59264).
Rik <rik@octave.org>
parents:
28886
diff
changeset
|
127 %!assert (issymmetric (logical (eye (2)))) |
1572a4329015
issymmetric.m: Extend functionality to character matrices (bug #59264).
Rik <rik@octave.org>
parents:
28886
diff
changeset
|
128 %!assert (! issymmetric (logical ([1 1; 0 1]))) |
1572a4329015
issymmetric.m: Extend functionality to character matrices (bug #59264).
Rik <rik@octave.org>
parents:
28886
diff
changeset
|
129 %!assert (issymmetric (logical ([1 1; 0 1]), 0.5)) |
1572a4329015
issymmetric.m: Extend functionality to character matrices (bug #59264).
Rik <rik@octave.org>
parents:
28886
diff
changeset
|
130 %!assert (! issymmetric ("test")) |
1572a4329015
issymmetric.m: Extend functionality to character matrices (bug #59264).
Rik <rik@octave.org>
parents:
28886
diff
changeset
|
131 %!assert (issymmetric ("t")) |
1572a4329015
issymmetric.m: Extend functionality to character matrices (bug #59264).
Rik <rik@octave.org>
parents:
28886
diff
changeset
|
132 %!assert (issymmetric (["te"; "et"])) |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
133 |
25223
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
134 ## Test input validation |
28886
d8318c12d903
test: remove unnecessary BIST tests in m-files checking for excessive number of inputs.
Rik <rik@octave.org>
parents:
28789
diff
changeset
|
135 %!error <Invalid call> issymmetric () |
25223
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
136 %!error <second argument must be> issymmetric (1, {"skew"}) |
28908
1572a4329015
issymmetric.m: Extend functionality to character matrices (bug #59264).
Rik <rik@octave.org>
parents:
28886
diff
changeset
|
137 %!error <A must be a numeric,.* matrix> issymmetric ({1}) |
25223
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
138 %!error <SKEWOPT must be 'skew' or 'nonskew'> issymmetric (1, "foobar") |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
139 %!error <TOL must be a scalar .= 0> issymmetric (1, "skew", {1}) |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
140 %!error <TOL must be a scalar .= 0> issymmetric (1, "skew", [1 1]) |
0f98040552de
issymetric.m; Overhaul function and expand to check skew-symmetry (bug #53556).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
141 %!error <TOL must be a scalar .= 0> issymmetric (1, -1) |