Utilities¶
Provides common utility functions.
-
pyrr.utils.
all_parameters_as_numpy_arrays
(fn)[source]¶ Converts all of a function’s arguments to numpy arrays.
Used as a decorator to reduce duplicate code.
-
pyrr.utils.
parameters_as_numpy_arrays
(*args_to_convert)[source]¶ Converts specific arguments to numpy arrays.
Used as a decorator to reduce duplicate code.
Arguments are specified by their argument name. For example
@parameters_as_numpy_arrays('a', 'b', 'optional') def myfunc(a, b, *args, **kwargs): pass myfunc(1, [2,2], optional=[3,3,3])
-
pyrr.utils.
solve_quadratic_equation
(a, b, c)[source]¶ Quadratic equation solver. Solve function of form f(x) = ax^2 + bx + c
Parameters: Return type: Returns: List contains either two elements for two solutions, one element for one solution, or is empty if no solution for the quadratic equation exists.