discretize.utils.Zero#
- class discretize.utils.Zero[source]#
Carries out arithmetic operations between 0 and arbitrary quantities.
This class was designed to manage basic arithmetic operations between 0 and
numpy.ndarray
of any shape. It is a short circuiting evaluation that will return the expected values.Attributes
Return the Zero class as an operator.
Return the dimension of Zero class, i.e. None.
Return the shape Zero class, i.e. None.
Methods
Return the transpose of the Zero class, i.e. itself.
Examples
>>> import numpy as np >>> from discretize.utils import Zero >>> Z = Zero() >>> Z Zero >>> x = np.arange(5) >>> x + Z array([0, 1, 2, 3, 4]) >>> Z - x array([ 0, -1, -2, -3, -4]) >>> Z * x Zero >>> Z @ x Zero >>> Z[0] Zero