Averest


Global Module

Module Global contains some general definitions.

Types

Type Description

ExternalException

ExternalException is raised if the input given by the user is not valid

InternalException

InternalException is raised if the a function failed due to a bug

TodoException

TodoException is raised if a partially implemented function is called

Functions and values

Function or value Description

AverestVersion

Full Usage: AverestVersion

Returns: Version

current version of Averest consisting of Major.Minor.Build.Revision

Returns: Version

AverestVersionString

Full Usage: AverestVersionString

Returns: string

current version of Averest as string like "1.9.9.0" (see AverestVersion)

Returns: string

CheckAssert c s

Full Usage: CheckAssert c s

Parameters:
    c : bool
    s : string

CheckAssert c s raises InternalError(s) if c holds and is void otherwise.

c : bool
s : string

Combinations n k

Full Usage: Combinations n k

Parameters:
    n : int
    k : int

Returns: Set<Set<int>>

enumerate all binom(n,k) subsets of k elements chosen from set {0..n-1}

n : int
k : int
Returns: Set<Set<int>>

ExternalError s

Full Usage: ExternalError s

Parameters:
    s : string

Returns: 'a

ExternalError simply raises ExternalException with string s

s : string
Returns: 'a

ExternalErrorPrn prn

Full Usage: ExternalErrorPrn prn

Parameters:
Returns: 'a

ExternalError simply raises ExternalException with string s

prn : Printer
Returns: 'a

FoldBalanced binOp mtVal eL

Full Usage: FoldBalanced binOp mtVal eL

Parameters:
    binOp : 'a * 'a -> 'a
    mtVal : 'a
    eL : seq<'a>

Returns: 'a

arrange the elements of a sequence eL as leaf nodes of a binary tree whose nodes apply the given associative binary operation binOp; if the sequence is empty, the value mtVal is returned

binOp : 'a * 'a -> 'a
mtVal : 'a
eL : seq<'a>
Returns: 'a

HandleException fn

Full Usage: HandleException fn

Parameters:
    fn : unit -> 'a

Returns: 'a

fn : unit -> 'a
Returns: 'a

InternalError s

Full Usage: InternalError s

Parameters:
    s : string

Returns: 'a

InternalError simply raises InternalException with string s

s : string
Returns: 'a

NumCulture

Full Usage: NumCulture

Returns: NumberFormatInfo

Returns: NumberFormatInfo

ParallelPrefixBrKu binOp eL

Full Usage: ParallelPrefixBrKu binOp eL

Parameters:
    binOp : 'a * 'a -> 'a
    eL : seq<'a>

Returns: seq<'a>

Parallel prefix computation by Brent and Kung [BrKu82]: Given a sequence eL and an associative binary operation binOP, this function computes the sequence whose elements are binOP(eL[0..i]) which is done with 2n-log(n)-2 operations and depth 2log(n)-2.

binOp : 'a * 'a -> 'a
eL : seq<'a>
Returns: seq<'a>

ParallelPrefixKoSt binOp eL

Full Usage: ParallelPrefixKoSt binOp eL

Parameters:
    binOp : 'a * 'a -> 'a
    eL : seq<'a>

Returns: seq<'a>

Parallel prefix computation by Kogge and Stone [KoSt73]: Given a sequence eL and an associative binary operation binOP, this function computes the sequence whose elements are binOP(eL[0..i]) which is done with n*log(n)-n+1 operations and depth log(n).

binOp : 'a * 'a -> 'a
eL : seq<'a>
Returns: seq<'a>

ParallelPrefixLaFi k binOp eL

Full Usage: ParallelPrefixLaFi k binOp eL

Parameters:
    k : int
    binOp : 'a * 'a -> 'a
    eL : seq<'a>

Returns: seq<'a>

Parallel prefix computation by Ladner and Fischer [LaFi80]: Given a sequence eL and an associative binary operation binOP, this function computes the sequence whose elements are binOP(eL[0..i]) which is done with O(n*log(n)) operations and depth log(n). The idea of Ladner and Fischer is to combine the divide-and-conquer approach of Sklansky with the Brent-Kung construction. Sklansky's prefix tree has a depth of only log(n) while Brent-Kung has size 2*log(n)-2. The parameter k provided to the Ladner-Fischer prefix tree denotes the number of additional steps on top of the minimal number log(n) to reduce the size down to the minimal size of Brent-Kung. For k>=log(n), we obtain the Brent-Kung prefix tree, otherwise, it is a k+log(n) depth prefix tree with size O(n*log(n)) for small k, in particular, for k=0,and is of size O(n) for larger k, in particular for k=log(n)-2 which is Brent-Kung.

k : int
binOp : 'a * 'a -> 'a
eL : seq<'a>
Returns: seq<'a>

ParallelPrefixSkla binOp eL

Full Usage: ParallelPrefixSkla binOp eL

Parameters:
    binOp : 'a * 'a -> 'a
    eL : seq<'a>

Returns: seq<'a>

Parallel prefix computation by Sklansky (1960): Given a sequence eL and an associative binary operation binOP, this function computes the sequence whose elements are binOP(eL[0..i]) which is done with O(n*log(n)) operations and depth log(n).

binOp : 'a * 'a -> 'a
eL : seq<'a>
Returns: seq<'a>

PartialPermutations n

Full Usage: PartialPermutations n

Parameters:
    n : int

Returns: int option[][]

enumerate all partial permutations on n objects: Note that the number of partial permutations of n objects is given as sum_{i=0}^{n} i!*binom(n,i)^2: If i is the number of non-hole entries, we first choose i of the n objects (binom(n,i) choices), then we choose i of the n indices in the vector for these objects (again binom(n,i) choices), and finally consider the i! permutations of these objects in these indices (see function Global.PartialPermutations).

n : int
Returns: int option[][]

Permutations n

Full Usage: Permutations n

Parameters:
    n : int

Returns: int[][]

enumerate all permutations of n objects as an array of arrays on {0..n-1}

n : int
Returns: int[][]

TODO s

Full Usage: TODO s

Parameters:
    s : string

Returns: 'a

TODO simply raises TodoException with string s

s : string
Returns: 'a

Tupels n k

Full Usage: Tupels n k

Parameters:
    n : int
    k : int

Returns: int list list

enumerate all n^k tuples of elements [0..n-1]

n : int
k : int
Returns: int list list