ParaMonte Fortran 2.0.0 Parallel Monte Carlo and Machine Learning LibrarySee the latest version documentation.
pm_arrayComplement Module Reference

This module contains procedures and generic interfaces for computing the absolute or relative complement of one set in another set. More...

## Data Types

interface  getComplement
Generate and return an array of elements of setB that are not in setA. More...

interface  getComplementRange
Generate and return the complement of the input set setA with respect to an array of elements of the sorted set comprised of a range of integer values constructed by the triple start, stop, step. More...

## Variables

character(*, SK), parameter MODULE_NAME = "@pm_arrayComplement"

## Detailed Description

This module contains procedures and generic interfaces for computing the absolute or relative complement of one set in another set.

In mathematical terminology, the complement of set $$A$$ in set $$B$$ is denoted by $$B \backslash A$$, or $$B \cap A^{C}$$, or less frequently by $$B - A$$.
Read $$B \backslash A$$ as the set of elements in B that do not appear in A.

1. If the set $$B$$ contains all elements of the set $$A$$, then $$B \backslash A$$ is the absolute complement of $$A$$.
2. If the set $$B$$ does not contain all elements of the set $$A$$, then $$B \backslash A$$ is the relative complement of $$A$$ (with respect to $$B$$).

An example Venn diagram illustration of $$B \backslash A$$ is the red region in the following graph,

Note
This module contains two generic interfaces for computing the difference of two unsorted or two similarly-sorted sets.
If the sets are similarly sorted, use getComplement with sorted = .true. input argument.
Computing the difference of two sorted sets is significantly faster than computing the difference of two similarly-sorted sets.
Developer Remark:
The two generic interfaces of this module getComplement and getComplementRange are intentionally kept separately from each other under different names.
Test:
test_pm_arrayComplement
Todo:
High Priority: The two function interfaces of this module can be merged into a single generic interface.

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.

1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

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.

Author:
Fatemeh Bagheri, Wednesday 12:24 PM, August 11, 2021, Dallas, TX

## ◆ MODULE_NAME

 character(*, SK), parameter pm_arrayComplement::MODULE_NAME = "@pm_arrayComplement"

Definition at line 69 of file pm_arrayComplement.F90.