setdiff(3f) - [M_sets] Find the values in A that are not in B
Synopsis
Description
Options
Examples
Authors
License
setdiff(A,B, setOrder)
setdiff(3f) returns the data in A that is not in 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_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) | February 23, 2025 |