setdiff(3f) - [M_sets] return setdiff values in array A
Synopsis
Description
Options
Example
Authors
License
setdiff(A,B, setOrder)
Set difference of two arrays. C = setdiff(A,B) returns the data in A that is not in 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_setdiff use M_sets, only: setdiff character(len=*),parameter :: g=(*(g0,1x)) integer, allocatable :: A(:) integer, allocatable :: B(:)Results:write(*,g) SETDIFF,Find the values in A that are not in B. A=[3, 6, 2, 1, 5, 1, 1] B=[2, 4, 6] write(*,g) A=, A write(*,g) B=, B write(*,g) setdiff(A, B) write(*,g) setdiff([4, 1, 3, 2, 5], [2, 1], sorted) write(*,g) setdiff([4, 1, 3, 2, 5], [2, 1], stable)
end program demo_setdiff
> SETDIFF Find the values in A that are not in B. > A= 3 6 2 1 5 1 1 > B= 2 4 6 > 1 3 5 > 3 4 5 > 4 3 5
John S. Urban, 2023-07-20
CC0-1.0
Nemo Release 3.1 | setdiff (3) | July 22, 2023 |