union(3f) - [M_sets] Join two sets and removes duplicates of values
Synopsis
Description
Options
Examples
Authors
License
union(A,B, setOrder)
The two sets are combined and repetitions are removed.
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.
sample program:
program demo_union use M_sets, only: union character(len=*),parameter :: g=(*(g0,1x)) integer,allocatable :: A(:) integer,allocatable :: B(:) Results: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
> 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
John S. Urban, 2023-07-20
CC0-1.0
Nemo Release 3.1 | union (3) | February 23, 2025 |