ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation. |
Return the remaining parts of the input array as a sequence after removing the input pattern
at the requested occurrences.
More...
Return the remaining parts of the input array as a sequence after removing the input pattern
at the requested occurrences.
If an input vector of instance
is specified, containing the indices of the specific instances of pattern
that must be removed, then only those instances will be removed from the array.
[in,out] | array | : The input/output allocatable array of rank 1 of either
pattern is to be removed.On output, array is reallocated to contain the input array with the requested instances of pattern removed from it. |
[in] | pattern | : The input contiguous array of rank 1 or scalar of the same type and kind as the input array containing the pattern that must be removed from the input array . |
iseq | : The external user-specified function that takes two input explicit-shape arguments of the same type and kind as the input array and possibly, also the length of the arguments as the third argument.It returns a scalar logical of default kind LK that is .true. if all elements of the two input arguments are equivalent (e.g., equal) according to the user-defined criterion, otherwise, it is .false. .If pattern is an array of rank 1 , then the last argument to iseq is the length of the input pattern , preceded by a segment of array and pattern as the first and second arguments whose lengths are given by the third argument lenPattern .The following illustrates the generic interface of iseq where pattern is array-valued, function iseq(Segment, pattern, lenPattern) result(equivalent)
integer(IK) , intent(in) :: lenPattern
TYPE(KIND) , intent(in) :: Segment(lenPattern), pattern(lenPattern)
logical(LK) :: equivalent
end function
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar... Definition: pm_kind.F90:268 integer, parameter LK The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(.... Definition: pm_kind.F90:541 integer, parameter IK The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper... Definition: pm_kind.F90:540 TYPE(KIND) represents the type and kind of the input argument array , which can be one of the following, character(*, SK), intent(in) :: Segment(lenPattern), pattern(lenPattern)
integer(IK) , intent(in) :: Segment(lenPattern), pattern(lenPattern)
logical(LK) , intent(in) :: Segment(lenPattern), pattern(lenPattern)
complex(CK) , intent(in) :: Segment(lenPattern), pattern(lenPattern)
real(RK) , intent(in) :: Segment(lenPattern), pattern(lenPattern)
integer, parameter RK The default real kind in the ParaMonte library: real64 in Fortran, c_double in C-Fortran Interoperati... Definition: pm_kind.F90:543 integer, parameter CK The default complex kind in the ParaMonte library: real64 in Fortran, c_double_complex in C-Fortran I... Definition: pm_kind.F90:542 integer, parameter SK The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero... Definition: pm_kind.F90:539 SK , IK , LK , CK , RK , can refer to any kind type parameter that is supported by the processor.The following illustrates the generic interface of iseq where pattern is scalar-valued (including Fortran scalar strings), function iseq(segment, pattern) result(equivalent)
TYPE(KIND) , intent(in) :: segment, pattern
logical(LK) :: equivalent
end function
TYPE(KIND) represents the type and kind of the input argument array , which can be one of the following, character(*, SK), intent(in) :: segment, pattern
integer(IK) , intent(in) :: segment, pattern
logical(LK) , intent(in) :: segment, pattern
complex(CK) , intent(in) :: segment, pattern
real(RK) , intent(in) :: segment, pattern
SK , IK , LK , CK , RK , can refer to any kind type parameter that is supported by the processor.This user-defined equivalence check is extremely useful where a user-defined equivalence test other than exact equality or identity is needed, for example, when the array segments should match the input pattern only within a given threshold or, when the case-sensitivity in character comparisons do not matter.In such cases, user can define a custom equivalence criterion within the user-defined external function iseq to achieve the goal.(optional, the default equivalence operator is .eqv. if the input array is logical , otherwise == ) | |
[in] | instance | : The input contiguous array of rank 1 of type integer of default kind IK, containing the instances of the input pattern in the input array that should be removed.Any element of instance that points to an out-of-scope instance of pattern in the input array will be ignored.Any element of instance that is negatively valued will be counted from end of the input array .For example, instance = [2,-1] requests removing the second instance of pattern in array from the beginning and removing the first instance of pattern starting from the end of array .(optional, the default value corresponds to removing all instances of pattern in array ) |
[in] | sorted | : The input logical of default kind LK indicating whether the elements of the specified input instance are all in ascending-order.This includes the negative elements of instance after they are translated to the corresponding positive instances from the beginning of the input array .Setting sorted = .true. will lead to faster runtime of the procedure.However, the onus will be strictly on the user to ensure all elements of instance are in ascending-order.This is generally not an easy guarantee to make if there are negative elements in instance .Therefore, set sorted = .true. only if you can guarantee the validity of the condition.(optional, default = .false. . It can be present as input argument only if the input argument instance is present.) |
[in] | unique | : The input logical of default kind LK indicating whether the elements of the specified input instance are all unique.This includes the negative elements of instance after they are translated to the corresponding positive instances from the beginning of the input array .Setting unique = .true. will lead to faster runtime of the procedure.However, the onus will be strictly on the user to ensure all elements of instance are unique.This is generally not an easy guarantee to make if there are negative elements in instance .Therefore, set unique = .true. only if you can guarantee the validity of the condition.(optional, default = .false. . It can be present as input argument only if the input argument instance is present.) |
Possible calling interfaces ⛓
pure
procedure(s) documented herein become impure
when the ParaMonte library is compiled with preprocessor macro CHECK_ENABLED=1
.pure
in release
build and impure
in debug
and testing
builds.impure
when the user-specified external
procedure iseq
is specified as input argument."Fortran" == "Fortran "
yields .true.
.array
is guaranteed to have the same lower bound as before, but its upper bound will likely be different.
Example usage ⛓
ifort
compiler ⛓ ifort
compiler ⛓ gfortran
compiler ⛓
Final Remarks ⛓
If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.
This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.
Definition at line 3756 of file pm_arrayRemove.F90.