C Library Functions  - union (3)

NAME

union(3f) - [M_sets] return union values in array A

CONTENTS

Synopsis
Description
Options
Example
Authors
License

SYNOPSIS

union(A,B, setOrder)

DESCRIPTION

Set union of two arrays.
  C = union(A,B) returns the combined data from A and B with no repetitions. C is in sorted order.

OPTIONS

A input array
B input array
setOrder
  May be "sort" or "stable"

EXAMPLE

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) July 22, 2023
Generated by manServer 1.08 from 994593b4-6e6a-466a-b4e4-0875d464b336 using man macros.