annotate scripts/general/private/__isequal__.m @ 10549:95c3e38098bf

Untabify .m scripts
author Rik <code@nomad.inbox5.com>
date Fri, 23 Apr 2010 11:28:50 -0700
parents ba373aea03d9
children f0dc41c824ce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8920
eb63fbe60fab update copyright notices
John W. Eaton <jwe@octave.org>
parents: 8812
diff changeset
1 ## Copyright (C) 2000, 2005, 2006, 2007, 2009 Paul Kienzle
5549
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
2 ##
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
3 ## This file is part of Octave.
5549
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
4 ##
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
6 ## under the terms of the GNU General Public License as published by
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
8 ## your option) any later version.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
9 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
13 ## General Public License for more details.
5549
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
14 ##
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
17 ## <http://www.gnu.org/licenses/>.
5549
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
18
6945
6bbf56a9718a [project @ 2007-10-02 20:47:22 by jwe]
jwe
parents: 6609
diff changeset
19 ## Undocumented internal function.
6bbf56a9718a [project @ 2007-10-02 20:47:22 by jwe]
jwe
parents: 6609
diff changeset
20
5549
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
21 ## -*- texinfo -*-
5550
815926a781f6 [project @ 2005-11-30 03:22:53 by jwe]
jwe
parents: 5549
diff changeset
22 ## @deftypefn {Function File} {} __isequal__ (@var{nans_compare_equal}, @var{x1}, @var{x2}, @dots{})
8812
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
23 ## Undocumented internal function.
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
24 ## @end deftypefn
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
25
5550
815926a781f6 [project @ 2005-11-30 03:22:53 by jwe]
jwe
parents: 5549
diff changeset
26 ## Return true if @var{x1}, @var{x2}, @dots{} are all equal and
5549
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
27 ## @var{nans_compare_equal} evaluates to false.
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
28 ##
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
29 ## If @var{nans_compare_equal} evaluates to true, then assume NaN == NaN.
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
30
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
31 ## Modified by: William Poetra Yoga Hadisoeseno
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
32
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
33 ## Algorithm:
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
34 ##
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
35 ## 1. Determine the class of x
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
36 ## 2. If x is of the struct, cell, list or char class, for each
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
37 ## argument after x, determine whether it has the same class
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
38 ## and size as x.
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
39 ## Otherwise, for each argument after x, verify that it is not
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
40 ## of the struct, cell, list or char class, and that it has
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
41 ## the same size as x.
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
42 ## 3. For each argument after x, compare it for equality with x:
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
43 ## a. struct compare each member by name, not by order (recursive)
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
44 ## b. cell/list compare each member by order (recursive)
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
45 ## c. char compare each member with strcmp
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
46 ## d. <other> compare each nonzero member, and assume NaN == NaN
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
47 ## if nans_compare_equal is nonzero.
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
48
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
49 function t = __isequal__ (nans_compare_equal, x, varargin)
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
50
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
51 if (nargin < 3)
6046
34f96dd5441b [project @ 2006-10-10 16:10:25 by jwe]
jwe
parents: 6023
diff changeset
52 print_usage ();
5549
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
53 endif
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
54
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
55 l_v = nargin - 2;
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
56
6130
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
57 ## Generic tests.
5549
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
58
6609
30891d1d0c86 [project @ 2007-05-09 02:12:04 by jwe]
jwe
parents: 6157
diff changeset
59 ## All arguments must either be of the same class or they must be
30891d1d0c86 [project @ 2007-05-09 02:12:04 by jwe]
jwe
parents: 6157
diff changeset
60 ## numeric values.
30891d1d0c86 [project @ 2007-05-09 02:12:04 by jwe]
jwe
parents: 6157
diff changeset
61 t = (all (strcmp (class(x),
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
62 cellfun (@class, varargin, "UniformOutput", false)))
9841
6f1ea8241c99 make isnumeric yield false on logicals
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
63 || ((isnumeric (x) || islogical (x))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
64 && all ((cellfun (@isnumeric, varargin) | cellfun (@islogical, varargin)))));
6609
30891d1d0c86 [project @ 2007-05-09 02:12:04 by jwe]
jwe
parents: 6157
diff changeset
65
6130
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
66 if (t)
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
67 ## Test that everything has the same number of dimensions.
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
68 s_x = size (x);
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
69 s_v = cellfun (@size, varargin, "UniformOutput", false);
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
70 t = all (length (s_x) == cellfun (@length, s_v));
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
71 endif
5549
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
72
6130
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
73 if (t)
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
74 ## Test that everything is the same size since it has the same
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
75 ## dimensionality.
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
76 l_x = length (s_x);
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
77 s_v = reshape ([s_v{:}], length (s_x), []);
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
78 idx = 0;
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
79 while (t && idx < l_x)
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
80 idx++;
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
81 t = all (s_x(idx) == s_v(idx, :));
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
82 endwhile
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
83 endif
5549
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
84
6130
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
85 if (t)
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
86 ## Check individual classes.
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
87 if (isstruct (x))
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
88 ## Test the number of fields.
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
89 fn_x = fieldnames (x);
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
90 l_fn_x = length (fn_x);
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
91 fn_v = cellfun (@fieldnames, varargin, "UniformOutput", false);
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
92 t = all (l_fn_x == cellfun (@length, fn_v));
5549
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
93
6130
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
94 ## Test that all the names are equal.
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
95 idx = 0;
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
96 s_fn_x = sort (fn_x);
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
97 while (t && idx < l_v)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
98 idx++;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
99 ## We'll allow the fieldnames to be in a different order.
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
100 t = all (strcmp (s_fn_x, sort (fn_v{idx})));
6130
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
101 endwhile
5549
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
102
6130
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
103 idx = 0;
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
104 while (t && idx < l_fn_x)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
105 ## Test that all field values are equal.
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
106 idx++;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
107 args = {nans_compare_equal, {x.(fn_x{idx})}};
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
108 for argn = 1:l_v
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
109 args{argn+2} = {varargin{argn}.(fn_x{idx})};
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
110 endfor
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
111 ## Minimize function calls by calling for all the arguments at
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
112 ## once.
6130
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
113 t = __isequal__ (args{:});
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
114 endwhile
5549
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
115
6130
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
116 elseif (iscell (x))
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
117 ## Check that each element of a cell is equal.
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
118 l_x = numel (x);
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
119 idx = 0;
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
120 while (t && idx < l_x)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
121 idx++;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
122 args = {nans_compare_equal, x{idx}};
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
123 for p = 1:l_v
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
124 args{p+2} = varargin{p}{idx};
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
125 endfor
6130
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
126 t = __isequal__ (args{:});
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
127 endwhile
5549
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
128
6130
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
129 elseif (ischar (x))
5549
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
130
6130
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
131 ## Sizes are equal already, so we can just make everything into a
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
132 ## row and test the rows.
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
133 for i = 1:l_v
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
134 strings{i} = reshape (varargin{i}, 1, []);
6130
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
135 endfor
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
136 t = all (strcmp (reshape (x, 1, []), strings));
5549
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
137
10260
14d5fee02b3b basic support for comparing function handles
Jaroslav Hajek <highegg@gmail.com>
parents: 9899
diff changeset
138 elseif (isa (x, "function_handle"))
14d5fee02b3b basic support for comparing function handles
Jaroslav Hajek <highegg@gmail.com>
parents: 9899
diff changeset
139
14d5fee02b3b basic support for comparing function handles
Jaroslav Hajek <highegg@gmail.com>
parents: 9899
diff changeset
140 ## The == operator is overloaded for handles.
14d5fee02b3b basic support for comparing function handles
Jaroslav Hajek <highegg@gmail.com>
parents: 9899
diff changeset
141 t = all (cellfun (@eq, {x}, varargin));
14d5fee02b3b basic support for comparing function handles
Jaroslav Hajek <highegg@gmail.com>
parents: 9899
diff changeset
142
5549
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
143 else
6130
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
144 ## Check the numeric types.
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
145
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
146 if (issparse (x))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
147 f_x = spfind (x);
5549
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
148 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
149 f_x = find (x);
5549
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
150 endif
6130
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
151 l_f_x = length (f_x);
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
152 x = x(f_x);
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
153 for argn = 1:l_v
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
154 y = varargin{argn};
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
155 if (issparse (y))
6130
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
156 f_y = spfind (y);
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
157 else
6130
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
158 f_y = find (y);
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
159 endif
5549
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
160
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
161 t = (l_f_x == length (f_y)) && all (f_x == f_y);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
162 if (!t)
6130
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
163 return;
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
164 endif
5549
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
165
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
166 y = y(f_y);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
167 m = (x == y);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
168 t = all (m);
5549
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
169
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
170 if (!t)
6130
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
171 if (nans_compare_equal)
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
172 t = isnan (x(!m)) && isnan (y(!m));
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
173 else
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
174 return;
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
175 endif
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10293
diff changeset
176 endif
6130
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
177 endfor
5549
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
178
6130
6eba20084f8f [project @ 2006-11-01 16:54:04 by jwe]
jwe
parents: 6046
diff changeset
179 endif
5549
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
180 endif
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
181
6db3a5df1eab [project @ 2005-11-30 03:15:19 by jwe]
jwe
parents:
diff changeset
182 endfunction