| |
- binomial(n:int, k:int) -> int
- Compute binomial coefficient as integer.
- bitsize(arg:Union[Iterable[~Nr], ~Nr]) -> int
- Compute the bit size of a number or a collection of numbers.
Call:
size = bitsize(arg)
Input:
arg: number (int/np.int/float) or collection (np.array/list/...) in arbitrary nesting
Output:
size: (summed up) bit size of arg
- dt2sec(dt:datetime.timedelta) -> float
- Convert a datetime.timedelta object into seconds.
Call:
res = dt2sec(dt)
Parameters:
dt: datetime.timedelta object
Output:
res: a float, representing the seconds of dt
- flatten(l:Iterable) -> Iterable
- Flatten a list of irregular depth to a generator.
- flatten2(l:Iterable) -> Iterable
- Flatten a list of irregular depth to a list.
- gcd(...)
- gcd(x, y) -> int
greatest common divisor of x and y
- get_type(array:Iterable[Any])
- Determine common data type for given arrray.
Possible results: int, np.float, sympy.Rational, object
- is_psd(C:Iterable[Iterable[~Nr]]) -> bool
- Check whether matrix C is positive semidefinite, by checking the eigenvalues.
- lcm(denominators:Iterable[int]) -> int
- Compute the least common multiple of a list.
- linsolve(A:Iterable[Iterable[~Nr]], b:Iterable[~Nr]) -> Iterable[~Nr]
- Solve a linear equation system for a possible singular matrix.
- maximal_elements(input_list:Iterable[Iterable[~Nr]], comp:Callable[[Iterable[~Nr], Iterable[~Nr]], bool]=<function <lambda> at 0x7f33acaca510>, sort_key:Callable[[Iterable[~Nr]], ~Nr]=<function sum at 0x7f34104fd8c8>) -> Iterable[Iterable[~Nr]]
- Given a list of np.array, compute the maximal elements.
Call:
maximal = maximal_elements(input_list)
Input:
input_list: list of np.array, all need to have the same length.
Output:
maximal: list of np.array, which contains the maximal elements of input_list,
the order used is elementwise "<="
- parse(number:str) -> ~Nr
- Parse a number from string to the correct datatype.
Call:
res = parse(number)
Input:
number: string, representing a number
Output:
res: number as int/float/sympy.Rational
- reduce(...)
- reduce(function, sequence[, initial]) -> value
Apply a function of two arguments cumulatively to the items of a sequence,
from left to right, so as to reduce the sequence to a single value.
For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates
((((1+2)+3)+4)+5). If initial is present, it is placed before the items
of the sequence in the calculation, and serves as a default when the
sequence is empty.
- to_fraction(number:~Nr, eps:~Nr=1.1920928955078125e-07, bound:int=0) -> sympy.core.numbers.Rational
- Round a given number to a fraction with given accuracy.
Call:
frac = to_fraction(number[, eps][, bound])
Input:
number: float/algebraic number (any arithmetic expression that can be handled by sympy), number to be converted into a fraction
eps [optional, default: aux.EPSILON]: desired absolute accuracy
bound [optional, default: 0]: number, in which direction to round
0 : rounded down
1 : rounded up
Output:
frac: symbolic fraction, such that |frac - number| < eps
- unify_status(status:Union[str, int, Iterable[str], Iterable[int]]) -> int
- Give a uniform representation for different status flags.
The following are equivalent:
1 = Solved = optimal
0 = Inaccurate = optimal_inaccurate
-1 = no solution
|