- class discretize.utils.Zero¶
Carries out arithmetic operations between 0 and arbitrary quantities.
This class was designed to manage basic arithmetic operations between 0 and
numpy.ndarrayof any shape. It is a short circuiting evaluation that will return the expected values.
>>> 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 Zero
Returns the Zero class as an operator
Returns the dimension of Zero class, i.e. None.
Returns the shape Zero class, i.e. None.
Returns the transpose of the Zero class, i.e. itself.