module tools.math_helper
#
Short summary#
module deeponnxcustom.tools.math_helper
Mathemical functions.
Functions#
function |
truncated documentation |
---|---|
Applies a list of transitions (permutations of two elements) on the first n integers. |
|
Decomposes a permutation into transitions. |
Documentation#
Mathemical functions.
- deeponnxcustom.tools.math_helper.apply_transitions(n, transitions)#
Applies a list of transitions (permutations of two elements) on the first n integers.
- Parameters
n – number of elements in the permutation
transitions – list of transitions
- Returns
permuted ensemble
- deeponnxcustom.tools.math_helper.decompose_permutation(perm)#
Decomposes a permutation into transitions.
- Parameters
perm – permutation (integers)
- Returns
list of tuples
Note
The function does not check perm is a permutation. If the input value is wrong, the execution could end up in an infinite loop.
<<<
import pprint from deeponnxcustom.tools.math_helper import decompose_permutation pprint.pprint(decompose_permutation((1, 0))) pprint.pprint(decompose_permutation((2, 0, 1))) pprint.pprint(decompose_permutation((1, 4, 2, 3, 0)))
>>>
[(1, 0)] [(1, 0), (2, 0)] [(4, 0), (1, 0)]
Function
apply_transitions
applies this series of transitions.