C Library Functions  - union (3)

NAME

union(3f) - [M_sets] Join two sets and removes duplicates of values

CONTENTS

Synopsis
Description
Options
Examples
Authors
License

SYNOPSIS

union(A,B, setOrder)

DESCRIPTION

The two sets are combined and repetitions are removed.

OPTIONS

A input array
B input array
setOrder
  May be "sort" or "stable". If "stable" the values are returned in the order discovered. The default is "sorted", which returns the data in ascending order.

EXAMPLES

sample program:

   program demo_union
   use M_sets, only: union
   character(len=*),parameter :: g=’(*(g0,1x))’
   integer,allocatable        :: A(:)
   integer,allocatable        :: B(:)

write(*,g) ’UNION’, ’Find the union of vectors A and B.’ A=[5, 7, 1] B=[3, 1, 1] write(*,g) ’A=’, A write(*,g) ’B=’, B write(*,g) union(A,B)

A=[5, 5, 3] B=[1, 2, 5] write(*,g) ’A=’, A write(*,g) ’B=’, B write(*,g) union(A, B, ’sorted’) write(*,g) union(A, B, ’stable’)

end program demo_union

‘‘‘ Results:

 > UNION Find the union of vectors A and B.
 > A= 5 7 1
 > B= 3 1 1
 > 1 3 5 7
 > A= 5 5 3
 > B= 1 2 5
 > 1 2 3 5
 > 5 3 1 2

AUTHORS

John S. Urban, 2023-07-20

LICENSE

CC0-1.0


Nemo Release 3.1 union (3) August 28, 2026
Generated by manServer 1.08 from a9e426f4-a096-4a87-80d5-86b074d1a36c using man macros.