isequal(3f) - [M_sets] Report if vector A is equal to vector B
Synopsis
Description
Options
Returns
Examples
Authors
License
isequal(A,B,TOLERANCE)
character(len=:)intent(in) :: A,B or integer|real|complex(in) :: A,B real,optional :: TOLERANCE
Report if A is equal to B. Equality is defined as the same element values in the same order.
A 1 (true) is returned when the elements of A have a one-to-one correspondence to the elements of B with the same values in the
same order. 0 (false) is returned otherwise.
A,B and TOLERANCE are of the same type and kind.
A input array to compare against B input array to compare to A TOLERANCE for numeric values consider the corresponding elements of A and B equal if they are equal within the specified tolerance.
1 if input array A is to array B, 0 otherwise
sample program:
program demo_isequal use M_sets, only: isequal character(len=*),parameter :: g=(*(g0,1x)) integer,allocatable :: A(:) integer,allocatable :: B(:)Results:write(*,g) isequal,Find if A is equal to B. A = [10, -10, 0, 1, 2, 3, 3, 2, 1,-10] B = [10, -10, 0, 1, 2, 3, 3, 2, 1, 10] write(*,g) A=, A write(*,g) B=, B write(*,g) isequal(A,B) write(*,g) isequal,Find if A is equal to A. write(*,g) isequal(A,A)
end program demo_isequal
> isequal Find the isequal elements of vector A. > A= 10 -10 0 1 2 3 3 2 1 -10 > 0 > A= -10 10 100 201 > 1
John S. Urban, 2023-07-20
CC0-1.0