ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation. |
Merge two ascending-sorted arrays such that the resulting merged array contains all elements of the two arrays in ascending order. More...
Merge two ascending-sorted arrays such that the resulting merged array contains all elements of the two arrays in ascending order.
[in] | mergedSortedArray | : The output scalar of either the output contiguous array of rank 1 of either
sortedArray1 and sortedArray2 and whose elements are the combined elements of the input sortedArray1 and sortedArray2 in ascending order. |
[in] | sortedArray1 | : The input contiguous array of the same type, kind, and rank as the output mergedSortedArray argument whose elements are already sorted in ascending order.When the type of the input argument is complex , the array must be sorted only based on the real component of the values. |
[in] | sortedArray2 | : The input contiguous array of the same type, kind, and rank as the output mergedSortedArray argument whose elements are already sorted in ascending order.When the type of the input argument is complex , the array must be sorted only based on the real component of the values. |
isSorted | : The external user-specified function that takes two input scalar arguments of the same type and kind as the input Array .It returns a scalar logical of default kind LK that is .true. if the first input scalar argument is sorted with respect to the second input argument according to the user-defined condition within isSorted , otherwise, it is .false. .If array is a scalar string (i.e., an assumed-length scalar character ), then both input arguments to isSorted() are scalar characters of length 1 of kind any supported by the processor (e.g., SK, SKA, SKD , or SKU).The following illustrates the generic interface of isSorted() , function isSorted(lhs, rhs) result(sorted)
TYPE(KIND) , intent(in) :: lhs, rhs
logical(LK) :: sorted
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 TYPE(KIND) is the same as the type and kind of the input argument Array , which can be one of the following. character(*, SK), intent(in) :: lhs, rhs
character(1, SK), intent(in) :: lhs, rhs
type(css_type) , intent(in) :: lhs, rhs
type(css_pdt) , intent(in) :: lhs, rhs
integer(IK) , intent(in) :: lhs, rhs
logical(LK) , intent(in) :: lhs, rhs
complex(CK) , intent(in) :: lhs, rhs
real(RK) , intent(in) :: lhs, rhs
This module contains the derived types for generating allocatable containers of scalar,... Definition: pm_container.F90:113 This is the css_pdt parameterized type for generating instances of container of scalar of string obje... Definition: pm_container.F90:783 This is the css_type type for generating instances of container of scalar of string objects. Definition: pm_container.F90:191 SK , IK , LK , CK , RK ) can refer to any of the supported kinds by the processor.This user-defined equivalence check is extremely useful where a user-defined sorting criterion other than simple ascending order is needed, for example, when the case-sensitivity of an input string or array of strings is irrelevant or when sorting of the absolute values matters excluding the signs of the numbers, or when descending order is desired. In such cases, user can define a custom sorting condition within the user-defined external function isSorted to achieve the goal.(optional, the default sorting condition is ascending order, that is a < b .) |
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.size(mergedSortedArray) == size(sortedArray1) + size(sortedArray2)
must hold for all interfaces with array-like arguments.len(mergedSortedArray) == len(sortedArray1) + len(sortedArray2)
must hold for all interfaces with scalar arguments of type character
.sortedArray1
and sortedArray2
must be sorted in ascending order when isSorted()
is missing, or properly sorted when isSorted()
is present.CHECK_ENABLED=1
.
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 1146 of file pm_arrayMerge.F90.