optim/onn/float.py
Connor Olding 7161f983ab fix __name__ being incorrect due to extra __all__
this fixes tracebacks and checks for __main__,
among other things.
2018-03-17 14:09:15 +01:00

19 lines
283 B
Python

import numpy as np
_f = np.float32
def _check(a):
assert isinstance(a, np.ndarray) or type(a) == _f, type(a)
assert a.dtype == _f, a.dtype
return a
_0 = _f(0)
_1 = _f(1)
_2 = _f(2)
_inv2 = _f(1/2)
_sqrt2 = _f(np.sqrt(2))
_invsqrt2 = _f(1/np.sqrt(2))
_pi = _f(np.pi)