intersect(3f) - [M_sets] return intersect values in array A
Synopsis
Description
Options
Example
Authors
License
intersect(A,B, setOrder)
Set intersection of two arrays. C = intersect(A,B) returns the data common to both A and B, with no repetitions. C is in sorted order by default.
A input array B input array setOrder May be "sort" or "stable"
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) | July 22, 2023 |