C Library Functions  - unique (3)

NAME

unique(3f) - [M_sets] return unique values in array A

CONTENTS

Synopsis
Description
Options
Returns
Example
Authors
License

SYNOPSIS

unique(A,setOrder)

DESCRIPTION

Return unique values in array.
  C = unique(A) returns the same data as in A, but with no repetitions. C is in sorted order by defaul.t

OPTIONS

A input array to extract unique values from
setOrder
  May be "sort" or "stable"

RETURNS

EXAMPLE

sample program:

   program demo_unique
   use M_sets, only: unique
   character(len=*),parameter :: g=’(*(g0,1x))’
   integer, allocatable      :: A(:)

write(*,g) ’UNIQUE’,’Find the unique elements of vector A.’ A = [10, -10, 0, 1, 2, 3, 3, 2, 1, -10] write(*,g) ’A=’, A write(*,g) unique(A) write(*,g) unique(A, setOrder=’stable’)

end program demo_unique

Results:

 > UNIQUE Find the unique elements of vector A.
 > A= 10 -10 0 1 2 3 3 2 1 -10
 > -10 0 1 2 3 10
 > 10 -10 0 1 2 3

AUTHORS

John S. Urban, 2023-07-20

LICENSE

CC0-1.0


Nemo Release 3.1 unique (3) July 22, 2023
Generated by manServer 1.08 from a5b28f9a-8201-463b-b8ae-396050c30e06 using man macros.