diff scripts/set/union.m @ 559:4e826edfbc56

[project @ 1994-07-25 22:18:28 by jwe] Initial revision
author jwe
date Mon, 25 Jul 1994 22:19:05 +0000
parents
children 3470f1e25a79
line wrap: on
line diff
new file mode 100644
--- /dev/null
+++ b/scripts/set/union.m
@@ -0,0 +1,25 @@
+function y = union(a,b)
+
+# usage: union(a,b)
+#
+# Returns the union of sets a and b.
+#
+# See - create_set, intersection, complement
+
+  if (nargin != 2)
+    error("usage: union(a,b)");
+  endif
+
+  if(isempty(a))
+    y = create_set(b);
+  elseif(isempty(b))
+    y = create_set(a);
+  else
+    [nra, nca] = size(a);
+    a = reshape(a,1,nra*nca);
+    [nrb, ncb] = size(b);
+    b = reshape(b,1,nrb*ncb);
+    y = create_set([a, b]);
+  endif
+
+endfunction