Global Module
Module Global contains some general definitions.
Types
Type | Description |
ExternalException is raised if the input given by the user is not valid |
|
InternalException is raised if the a function failed due to a bug |
|
TeachingToolFailure is raised by teaching tools |
|
TodoException is raised if a partially implemented function is called |
Functions and values
Function or value | Description |
|
current version of Averest consisting of Major.Minor.Build.Revision
|
Full Usage:
AverestVersionString
Returns: string
|
current version of Averest as string like "1.9.9.0" (see AverestVersion)
|
Full Usage:
CheckAssert c s
Parameters:
bool
s : string
|
CheckAssert c s raises InternalError(s) if c holds and is void otherwise.
|
|
|
Full Usage:
ExternalError s
Parameters:
string
Returns: 'a
|
ExternalError simply raises ExternalException with string s
|
|
|
Full Usage:
FoldBalanced binOp mtVal eL
Parameters:
'a * 'a -> 'a
mtVal : 'a
eL : 'a seq
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
|
Full Usage:
HandleException fn
Parameters:
unit -> 'a
Returns: 'a
|
|
Full Usage:
InternalError s
Parameters:
string
Returns: 'a
|
InternalError simply raises InternalException with string s
|
|
|
Full Usage:
ParallelPrefixBrKu binOp eL
Parameters:
'a * 'a -> 'a
eL : 'a seq
Returns: 'a seq
|
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.
|
Full Usage:
ParallelPrefixKoSt binOp eL
Parameters:
'a * 'a -> 'a
eL : 'a seq
Returns: 'a seq
|
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).
|
Full Usage:
ParallelPrefixLaFi k binOp eL
Parameters:
int
binOp : 'a * 'a -> 'a
eL : 'a seq
Returns: 'a seq
|
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.
|
Full Usage:
ParallelPrefixSkla binOp eL
Parameters:
'a * 'a -> 'a
eL : 'a seq
Returns: 'a seq
|
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).
|
Full Usage:
PartialPermutations n
Parameters:
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).
|
Full Usage:
Permutations n
Parameters:
int
Returns: int[][]
|
enumerate all permutations of n objects as an array of arrays on {0..n-1}
|
Full Usage:
TODO s
Parameters:
string
Returns: 'a
|
TODO simply raises TodoException with string s
|
Full Usage:
Tupels n k
Parameters:
int
k : int
Returns: int list list
|
enumerate all n^k tuples of elements [0..n-1]
|