7018
|
1 @c Copyright (C) 1996, 1997, 1999, 2000, 2002, 2007 John W. Eaton |
|
2 @c |
|
3 @c This file is part of Octave. |
|
4 @c |
|
5 @c Octave is free software; you can redistribute it and/or modify it |
|
6 @c under the terms of the GNU General Public License as published by the |
|
7 @c Free Software Foundation; either version 3 of the License, or (at |
|
8 @c your option) any later version. |
|
9 @c |
|
10 @c Octave is distributed in the hope that it will be useful, but WITHOUT |
|
11 @c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 @c for more details. |
|
14 @c |
|
15 @c You should have received a copy of the GNU General Public License |
|
16 @c along with Octave; see the file COPYING. If not, see |
|
17 @c <http://www.gnu.org/licenses/>. |
3294
|
18 |
4167
|
19 @node Sets |
3294
|
20 @chapter Sets |
|
21 |
|
22 Octave has a limited set of functions for managing sets of data, where a |
7001
|
23 set is defined as a collection of unique elements. In Octave a set is |
6741
|
24 represented as a vector of numbers. |
3294
|
25 |
3368
|
26 @DOCSTRING(create_set) |
3294
|
27 |
6741
|
28 @DOCSTRING(unique) |
|
29 |
|
30 @menu |
|
31 * Set Operations:: |
|
32 @end menu |
|
33 |
|
34 @node Set Operations |
|
35 @section Set Operations |
6550
|
36 |
6741
|
37 Octave supports the basic set operations. That is, Octave can compute |
|
38 the union, intersection, complement, and difference of two sets. |
|
39 Octave can also supports the @emph{Exclusive Or} set operation, and |
|
40 membership determination. The functions for set operations all work in |
|
41 pretty much the same way. As an example, assume that @code{x} and |
|
42 @code{y} contains two sets, then |
|
43 |
|
44 @example |
|
45 union(x, y) |
|
46 @end example |
|
47 |
|
48 @noindent |
|
49 computes the union of the two sets. |
|
50 |
|
51 @DOCSTRING(ismember) |
6502
|
52 |
3368
|
53 @DOCSTRING(union) |
3294
|
54 |
6502
|
55 @DOCSTRING(intersect) |
3294
|
56 |
3368
|
57 @DOCSTRING(complement) |
6502
|
58 |
|
59 @DOCSTRING(setdiff) |
|
60 |
|
61 @DOCSTRING(setxor) |