intersect(3f) - [M_sets] Find the values common to both sets A and B
Synopsis
Description
Options
Examples
Authors
License
intersect(A,B, setOrder)
The values that occur at least once in each set are returned.
That is, intersect(3f) returns the data common to both A and B, with no repetitions.
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_intersect use M_sets, only: unique, intersect, union, setdiff, ismember, setxor character(len=*),parameter :: g=(*(g0,1x)) integer, allocatable :: A(:) integer, allocatable :: B(:)Results:write(*,g) INTERSECT, Find the values common to both A and B. A=[7, 1, 7, 7, 4] B=[7, 0, 4, 4, 0] write(*,g) A=, A write(*,g) B=, B write(*,g) intersect(A, B) write(*,g) intersect(A, B, setOrder=stable) end program demo_intersect
> INTERSECT Find the values common to both A and B. > A= 7 1 7 7 4 > B= 7 0 4 4 0 > 4 7 > 7 4
John S. Urban, 2023-07-20
CC0-1.0
Nemo Release 3.1 | intersect (3) | February 23, 2025 |