ScalES-PPM
Loading...
Searching...
No Matches
Data Types | Functions/Subroutines | Variables
ppm_combinatorics Module Reference

gathers some base routines for combinatorial problems More...

Data Types

interface  combination
 produce random selection and its complement More...
 
interface  is_permutation
 establish whether an array is a permutation of another array or a range More...
 
interface  permute
 randomly permute a given array More...
 
interface  prime_factorization
 compute list of prime factors (sorted, but duplicates included) More...
 
interface  selection
 produce random selection More...
 

Functions/Subroutines

subroutine permute_randomly_i4 (a)
 randomly permute a given array
 
subroutine permute_randomly_i8 (a)
 randomly permute a given array
 
pure logical function is_permutation_of_range_i4 (a, r)
 establish whether one array of integers is a permutation of a range
 
pure logical function is_permutation_of_array_i4 (a, b)
 establish whether one array of integers is a permutation of another
 
subroutine random_selection_i4 (selected, range)
 produce random selection from range
 
subroutine random_combination_i4 (selected, not_selected, range)
 produce random selection and its complement from range
 
pure subroutine prime_factorization_i4 (n, factors)
 compute list of prime factors (sorted, but duplicates included)
 

Variables

character(len= *), parameter filename = 'ppm_combinatorics.f90'
 

Detailed Description

gathers some base routines for combinatorial problems

Function/Subroutine Documentation

◆ is_permutation_of_array_i4()

pure logical function ppm_combinatorics::is_permutation_of_array_i4 ( integer(i4), dimension(:), intent(in) a,
integer(i4), dimension(:), intent(in) b )
private

establish whether one array of integers is a permutation of another

Parameters
afirst array
bsecond array
Returns
.TRUE. if a is permutation of b

◆ is_permutation_of_range_i4()

pure logical function ppm_combinatorics::is_permutation_of_range_i4 ( integer(i4), dimension(:), intent(in) a,
type(iinterval), intent(in) r )
private

establish whether one array of integers is a permutation of a range

Parameters
aarray
rrange
Returns
.TRUE. if a is permutation of r, .FALSE. if not

◆ permute_randomly_i4()

subroutine ppm_combinatorics::permute_randomly_i4 ( integer(i4), dimension(:), intent(inout) a)
private

randomly permute a given array

Parameters
aarray to permute

◆ permute_randomly_i8()

subroutine ppm_combinatorics::permute_randomly_i8 ( integer(i8), dimension(:), intent(inout) a)
private

randomly permute a given array

Parameters
aarray to permute

◆ prime_factorization_i4()

pure subroutine ppm_combinatorics::prime_factorization_i4 ( integer(i4), intent(in) n,
integer(i4), dimension(:), intent(out), allocatable factors )
private

compute list of prime factors (sorted, but duplicates included)

Parameters
ninteger to factor
factorsintegers, where factor(i) is prime and PRODUCT(factors)==n, factors is allocated to the necessary size

◆ random_combination_i4()

subroutine ppm_combinatorics::random_combination_i4 ( integer(i4), dimension(:), intent(out) selected,
integer(i4), dimension(:), intent(out) not_selected,
type(iinterval), intent(in) range )
private

produce random selection and its complement from range

Parameters
rangerange to select from
[out]selectedarray where a random selection of integers from range are written to
[out]not_selectedintegers from range not written to selected are stored here

◆ random_selection_i4()

subroutine ppm_combinatorics::random_selection_i4 ( integer(i4), dimension(:), intent(out) selected,
type(iinterval), intent(in) range )
private

produce random selection from range

normally this procedure is only efficient when SIZE(selected) is significantly smaller than extent_size(range), when SIZE(selected) approaches extent_size(range) it's cheaper to produce a permutation and use the first SIZE(selected) elements

Parameters
[out]selectedarray to fill with random selection from range, where SIZE(selected) <= extent_size(range)
rangeset of integers to selected from

Das diesem Bericht zugrundeliegende Vorhaben wurde mit Mitteln des Bundesministeriums für Bildung, und Forschung unter dem Förderkennzeichen 01IH08004E gefördert. Die Verantwortung für den Inhalt dieser Veröffentlichung liegt beim Autor.