Python numpy.core.umath.e() Examples
The following are 30
code examples of numpy.core.umath.e().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
numpy.core.umath
, or try the search function
.
Example #1
Source File: test_umath.py From pySINDy with MIT License | 6 votes |
def test_ignore_object_identity_in_not_equal(self): # Check error raised when comparing identical objects whose comparison # is not a simple boolean, e.g., arrays that are compared elementwise. a = np.array([np.array([1, 2, 3]), None], dtype=object) assert_raises(ValueError, np.not_equal, a, a) # Check error raised when comparing identical non-comparable objects. class FunkyType(object): def __ne__(self, other): raise TypeError("I won't compare") a = np.array([FunkyType()]) assert_raises(TypeError, np.not_equal, a, a) # Check identity doesn't override comparison mismatch. a = np.array([np.nan], dtype=object) assert_equal(np.not_equal(a, a), [True])
Example #2
Source File: test_umath.py From vnpy_crypto with MIT License | 6 votes |
def test_ignore_object_identity_in_equal(self): # Check error raised when comparing identical objects whose comparison # is not a simple boolean, e.g., arrays that are compared elementwise. a = np.array([np.array([1, 2, 3]), None], dtype=object) assert_raises(ValueError, np.equal, a, a) # Check error raised when comparing identical non-comparable objects. class FunkyType(object): def __eq__(self, other): raise TypeError("I won't compare") a = np.array([FunkyType()]) assert_raises(TypeError, np.equal, a, a) # Check identity doesn't override comparison mismatch. a = np.array([np.nan], dtype=object) assert_equal(np.equal(a, a), [False])
Example #3
Source File: test_umath.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 6 votes |
def test_ignore_object_identity_in_equal(self): # Check error raised when comparing identical objects whose comparison # is not a simple boolean, e.g., arrays that are compared elementwise. a = np.array([np.array([1, 2, 3]), None], dtype=object) assert_raises(ValueError, np.equal, a, a) # Check error raised when comparing identical non-comparable objects. class FunkyType(object): def __eq__(self, other): raise TypeError("I won't compare") a = np.array([FunkyType()]) assert_raises(TypeError, np.equal, a, a) # Check identity doesn't override comparison mismatch. a = np.array([np.nan], dtype=object) assert_equal(np.equal(a, a), [False])
Example #4
Source File: test_umath.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 6 votes |
def test_ignore_object_identity_in_not_equal(self): # Check error raised when comparing identical objects whose comparison # is not a simple boolean, e.g., arrays that are compared elementwise. a = np.array([np.array([1, 2, 3]), None], dtype=object) assert_raises(ValueError, np.not_equal, a, a) # Check error raised when comparing identical non-comparable objects. class FunkyType(object): def __ne__(self, other): raise TypeError("I won't compare") a = np.array([FunkyType()]) assert_raises(TypeError, np.not_equal, a, a) # Check identity doesn't override comparison mismatch. a = np.array([np.nan], dtype=object) assert_equal(np.not_equal(a, a), [True])
Example #5
Source File: test_umath.py From recruit with Apache License 2.0 | 6 votes |
def test_ignore_object_identity_in_not_equal(self): # Check error raised when comparing identical objects whose comparison # is not a simple boolean, e.g., arrays that are compared elementwise. a = np.array([np.array([1, 2, 3]), None], dtype=object) assert_raises(ValueError, np.not_equal, a, a) # Check error raised when comparing identical non-comparable objects. class FunkyType(object): def __ne__(self, other): raise TypeError("I won't compare") a = np.array([FunkyType()]) assert_raises(TypeError, np.not_equal, a, a) # Check identity doesn't override comparison mismatch. a = np.array([np.nan], dtype=object) assert_equal(np.not_equal(a, a), [True])
Example #6
Source File: test_umath.py From recruit with Apache License 2.0 | 6 votes |
def test_ignore_object_identity_in_equal(self): # Check error raised when comparing identical objects whose comparison # is not a simple boolean, e.g., arrays that are compared elementwise. a = np.array([np.array([1, 2, 3]), None], dtype=object) assert_raises(ValueError, np.equal, a, a) # Check error raised when comparing identical non-comparable objects. class FunkyType(object): def __eq__(self, other): raise TypeError("I won't compare") a = np.array([FunkyType()]) assert_raises(TypeError, np.equal, a, a) # Check identity doesn't override comparison mismatch. a = np.array([np.nan], dtype=object) assert_equal(np.equal(a, a), [False])
Example #7
Source File: test_umath.py From coffeegrindsize with MIT License | 6 votes |
def test_ignore_object_identity_in_not_equal(self): # Check error raised when comparing identical objects whose comparison # is not a simple boolean, e.g., arrays that are compared elementwise. a = np.array([np.array([1, 2, 3]), None], dtype=object) assert_raises(ValueError, np.not_equal, a, a) # Check error raised when comparing identical non-comparable objects. class FunkyType(object): def __ne__(self, other): raise TypeError("I won't compare") a = np.array([FunkyType()]) assert_raises(TypeError, np.not_equal, a, a) # Check identity doesn't override comparison mismatch. a = np.array([np.nan], dtype=object) assert_equal(np.not_equal(a, a), [True])
Example #8
Source File: test_umath.py From vnpy_crypto with MIT License | 6 votes |
def test_ignore_object_identity_in_not_equal(self): # Check error raised when comparing identical objects whose comparison # is not a simple boolean, e.g., arrays that are compared elementwise. a = np.array([np.array([1, 2, 3]), None], dtype=object) assert_raises(ValueError, np.not_equal, a, a) # Check error raised when comparing identical non-comparable objects. class FunkyType(object): def __ne__(self, other): raise TypeError("I won't compare") a = np.array([FunkyType()]) assert_raises(TypeError, np.not_equal, a, a) # Check identity doesn't override comparison mismatch. a = np.array([np.nan], dtype=object) assert_equal(np.not_equal(a, a), [True])
Example #9
Source File: test_umath.py From coffeegrindsize with MIT License | 6 votes |
def test_ignore_object_identity_in_equal(self): # Check error raised when comparing identical objects whose comparison # is not a simple boolean, e.g., arrays that are compared elementwise. a = np.array([np.array([1, 2, 3]), None], dtype=object) assert_raises(ValueError, np.equal, a, a) # Check error raised when comparing identical non-comparable objects. class FunkyType(object): def __eq__(self, other): raise TypeError("I won't compare") a = np.array([FunkyType()]) assert_raises(TypeError, np.equal, a, a) # Check identity doesn't override comparison mismatch. a = np.array([np.nan], dtype=object) assert_equal(np.equal(a, a), [False])
Example #10
Source File: test_umath.py From elasticintel with GNU General Public License v3.0 | 6 votes |
def test_ignore_object_identity_in_not_equal(self): # Check error raised when comparing identical objects whose comparison # is not a simple boolean, e.g., arrays that are compared elementwise. a = np.array([np.array([1, 2, 3]), None], dtype=object) assert_raises(ValueError, np.not_equal, a, a) # Check error raised when comparing identical non-comparable objects. class FunkyType(object): def __ne__(self, other): raise TypeError("I won't compare") a = np.array([FunkyType()]) assert_raises(TypeError, np.not_equal, a, a) # Check identity doesn't override comparison mismatch. a = np.array([np.nan], dtype=object) assert_equal(np.not_equal(a, a), [True])
Example #11
Source File: test_umath.py From Mastering-Elasticsearch-7.0 with MIT License | 6 votes |
def test_ignore_object_identity_in_not_equal(self): # Check error raised when comparing identical objects whose comparison # is not a simple boolean, e.g., arrays that are compared elementwise. a = np.array([np.array([1, 2, 3]), None], dtype=object) assert_raises(ValueError, np.not_equal, a, a) # Check error raised when comparing identical non-comparable objects. class FunkyType(object): def __ne__(self, other): raise TypeError("I won't compare") a = np.array([FunkyType()]) assert_raises(TypeError, np.not_equal, a, a) # Check identity doesn't override comparison mismatch. a = np.array([np.nan], dtype=object) assert_equal(np.not_equal(a, a), [True])
Example #12
Source File: test_umath.py From Mastering-Elasticsearch-7.0 with MIT License | 6 votes |
def test_ignore_object_identity_in_equal(self): # Check error raised when comparing identical objects whose comparison # is not a simple boolean, e.g., arrays that are compared elementwise. a = np.array([np.array([1, 2, 3]), None], dtype=object) assert_raises(ValueError, np.equal, a, a) # Check error raised when comparing identical non-comparable objects. class FunkyType(object): def __eq__(self, other): raise TypeError("I won't compare") a = np.array([FunkyType()]) assert_raises(TypeError, np.equal, a, a) # Check identity doesn't override comparison mismatch. a = np.array([np.nan], dtype=object) assert_equal(np.equal(a, a), [False])
Example #13
Source File: test_umath.py From pySINDy with MIT License | 6 votes |
def test_ignore_object_identity_in_equal(self): # Check error raised when comparing identical objects whose comparison # is not a simple boolean, e.g., arrays that are compared elementwise. a = np.array([np.array([1, 2, 3]), None], dtype=object) assert_raises(ValueError, np.equal, a, a) # Check error raised when comparing identical non-comparable objects. class FunkyType(object): def __eq__(self, other): raise TypeError("I won't compare") a = np.array([FunkyType()]) assert_raises(TypeError, np.equal, a, a) # Check identity doesn't override comparison mismatch. a = np.array([np.nan], dtype=object) assert_equal(np.equal(a, a), [False])
Example #14
Source File: test_umath.py From mxnet-lambda with Apache License 2.0 | 6 votes |
def test_ignore_object_identity_in_equal(self): # Check error raised when comparing identical objects whose comparison # is not a simple boolean, e.g., arrays that are compared elementwise. a = np.array([np.array([1, 2, 3]), None], dtype=object) assert_raises(ValueError, np.equal, a, a) # Check error raised when comparing identical non-comparable objects. class FunkyType(object): def __eq__(self, other): raise TypeError("I won't compare") a = np.array([FunkyType()]) assert_raises(TypeError, np.equal, a, a) # Check identity doesn't override comparison mismatch. a = np.array([np.nan], dtype=object) assert_equal(np.equal(a, a), [False])
Example #15
Source File: test_umath.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 6 votes |
def test_ignore_object_identity_in_not_equal(self): # Check error raised when comparing identical objects whose comparison # is not a simple boolean, e.g., arrays that are compared elementwise. a = np.array([np.array([1, 2, 3]), None], dtype=object) assert_raises(ValueError, np.not_equal, a, a) # Check error raised when comparing identical non-comparable objects. class FunkyType(object): def __ne__(self, other): raise TypeError("I won't compare") a = np.array([FunkyType()]) assert_raises(TypeError, np.not_equal, a, a) # Check identity doesn't override comparison mismatch. a = np.array([np.nan], dtype=object) assert_equal(np.not_equal(a, a), [True])
Example #16
Source File: test_umath.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 6 votes |
def test_ignore_object_identity_in_equal(self): # Check error raised when comparing identical objects whose comparison # is not a simple boolean, e.g., arrays that are compared elementwise. a = np.array([np.array([1, 2, 3]), None], dtype=object) assert_raises(ValueError, np.equal, a, a) # Check error raised when comparing identical non-comparable objects. class FunkyType(object): def __eq__(self, other): raise TypeError("I won't compare") a = np.array([FunkyType()]) assert_raises(TypeError, np.equal, a, a) # Check identity doesn't override comparison mismatch. a = np.array([np.nan], dtype=object) assert_equal(np.equal(a, a), [False])
Example #17
Source File: test_umath.py From mxnet-lambda with Apache License 2.0 | 6 votes |
def test_ignore_object_identity_in_not_equal(self): # Check error raised when comparing identical objects whose comparison # is not a simple boolean, e.g., arrays that are compared elementwise. a = np.array([np.array([1, 2, 3]), None], dtype=object) assert_raises(ValueError, np.not_equal, a, a) # Check error raised when comparing identical non-comparable objects. class FunkyType(object): def __ne__(self, other): raise TypeError("I won't compare") a = np.array([FunkyType()]) assert_raises(TypeError, np.not_equal, a, a) # Check identity doesn't override comparison mismatch. a = np.array([np.nan], dtype=object) assert_equal(np.not_equal(a, a), [True])
Example #18
Source File: test_umath.py From GraphicDesignPatternByPython with MIT License | 6 votes |
def test_ignore_object_identity_in_not_equal(self): # Check error raised when comparing identical objects whose comparison # is not a simple boolean, e.g., arrays that are compared elementwise. a = np.array([np.array([1, 2, 3]), None], dtype=object) assert_raises(ValueError, np.not_equal, a, a) # Check error raised when comparing identical non-comparable objects. class FunkyType(object): def __ne__(self, other): raise TypeError("I won't compare") a = np.array([FunkyType()]) assert_raises(TypeError, np.not_equal, a, a) # Check identity doesn't override comparison mismatch. a = np.array([np.nan], dtype=object) assert_equal(np.not_equal(a, a), [True])
Example #19
Source File: test_umath.py From GraphicDesignPatternByPython with MIT License | 6 votes |
def test_ignore_object_identity_in_equal(self): # Check error raised when comparing identical objects whose comparison # is not a simple boolean, e.g., arrays that are compared elementwise. a = np.array([np.array([1, 2, 3]), None], dtype=object) assert_raises(ValueError, np.equal, a, a) # Check error raised when comparing identical non-comparable objects. class FunkyType(object): def __eq__(self, other): raise TypeError("I won't compare") a = np.array([FunkyType()]) assert_raises(TypeError, np.equal, a, a) # Check identity doesn't override comparison mismatch. a = np.array([np.nan], dtype=object) assert_equal(np.equal(a, a), [False])
Example #20
Source File: test_umath.py From elasticintel with GNU General Public License v3.0 | 6 votes |
def test_ignore_object_identity_in_equal(self): # Check error raised when comparing identical objects whose comparison # is not a simple boolean, e.g., arrays that are compared elementwise. a = np.array([np.array([1, 2, 3]), None], dtype=object) assert_raises(ValueError, np.equal, a, a) # Check error raised when comparing identical non-comparable objects. class FunkyType(object): def __eq__(self, other): raise TypeError("I won't compare") a = np.array([FunkyType()]) assert_raises(TypeError, np.equal, a, a) # Check identity doesn't override comparison mismatch. a = np.array([np.nan], dtype=object) assert_equal(np.equal(a, a), [False])
Example #21
Source File: test_umath.py From mxnet-lambda with Apache License 2.0 | 5 votes |
def test_floor_division_complex(self): # check that implementation is correct msg = "Complex floor division implementation check" x = np.array([.9 + 1j, -.1 + 1j, .9 + .5*1j, .9 + 2.*1j], dtype=np.complex128) y = np.array([0., -1., 0., 0.], dtype=np.complex128) assert_equal(np.floor_divide(x**2, x), y, err_msg=msg) # check overflow, underflow msg = "Complex floor division overflow/underflow check" x = np.array([1.e+110, 1.e-110], dtype=np.complex128) y = np.floor_divide(x**2, x) assert_equal(y, [1.e+110, 0], err_msg=msg)
Example #22
Source File: test_umath.py From mxnet-lambda with Apache License 2.0 | 5 votes |
def test_lower_align(self): # check data that is not aligned to element size # i.e doubles are aligned to 4 bytes on i386 d = np.zeros(23 * 8, dtype=np.int8)[4:-4].view(np.float64) assert_equal(np.abs(d), d) assert_equal(np.negative(d), -d) np.negative(d, out=d) np.negative(np.ones_like(d), out=d) np.abs(d, out=d) np.abs(np.ones_like(d), out=d)
Example #23
Source File: test_umath.py From mxnet-lambda with Apache License 2.0 | 5 votes |
def test_division_complex(self): # check that implementation is correct msg = "Complex division implementation check" x = np.array([1. + 1.*1j, 1. + .5*1j, 1. + 2.*1j], dtype=np.complex128) assert_almost_equal(x**2/x, x, err_msg=msg) # check overflow, underflow msg = "Complex division overflow/underflow check" x = np.array([1.e+110, 1.e-110], dtype=np.complex128) y = x**2/x assert_almost_equal(y/x, [1, 1], err_msg=msg)
Example #24
Source File: test_umath.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def test_lower_align(self): # check data that is not aligned to element size # i.e doubles are aligned to 4 bytes on i386 d = np.zeros(23 * 8, dtype=np.int8)[4:-4].view(np.float64) assert_equal(np.abs(d), d) assert_equal(np.negative(d), -d) np.negative(d, out=d) np.negative(np.ones_like(d), out=d) np.abs(d, out=d) np.abs(np.ones_like(d), out=d)
Example #25
Source File: test_umath.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 5 votes |
def test_division_complex(self): # check that implementation is correct msg = "Complex division implementation check" x = np.array([1. + 1.*1j, 1. + .5*1j, 1. + 2.*1j], dtype=np.complex128) assert_almost_equal(x**2/x, x, err_msg=msg) # check overflow, underflow msg = "Complex division overflow/underflow check" x = np.array([1.e+110, 1.e-110], dtype=np.complex128) y = x**2/x assert_almost_equal(y/x, [1, 1], err_msg=msg)
Example #26
Source File: test_umath.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 5 votes |
def test_floor_division_complex(self): # check that implementation is correct msg = "Complex floor division implementation check" x = np.array([.9 + 1j, -.1 + 1j, .9 + .5*1j, .9 + 2.*1j], dtype=np.complex128) y = np.array([0., -1., 0., 0.], dtype=np.complex128) assert_equal(np.floor_divide(x**2, x), y, err_msg=msg) # check overflow, underflow msg = "Complex floor division overflow/underflow check" x = np.array([1.e+110, 1.e-110], dtype=np.complex128) y = np.floor_divide(x**2, x) assert_equal(y, [1.e+110, 0], err_msg=msg)
Example #27
Source File: test_umath.py From pySINDy with MIT License | 5 votes |
def test_floor_division_complex(self): # check that implementation is correct msg = "Complex floor division implementation check" x = np.array([.9 + 1j, -.1 + 1j, .9 + .5*1j, .9 + 2.*1j], dtype=np.complex128) y = np.array([0., -1., 0., 0.], dtype=np.complex128) assert_equal(np.floor_divide(x**2, x), y, err_msg=msg) # check overflow, underflow msg = "Complex floor division overflow/underflow check" x = np.array([1.e+110, 1.e-110], dtype=np.complex128) y = np.floor_divide(x**2, x) assert_equal(y, [1.e+110, 0], err_msg=msg)
Example #28
Source File: test_umath.py From coffeegrindsize with MIT License | 5 votes |
def test_e(self): assert_allclose(ncu.e, 2.718281828459045, 1e-15)
Example #29
Source File: test_umath.py From pySINDy with MIT License | 5 votes |
def test_division_complex(self): # check that implementation is correct msg = "Complex division implementation check" x = np.array([1. + 1.*1j, 1. + .5*1j, 1. + 2.*1j], dtype=np.complex128) assert_almost_equal(x**2/x, x, err_msg=msg) # check overflow, underflow msg = "Complex division overflow/underflow check" x = np.array([1.e+110, 1.e-110], dtype=np.complex128) y = x**2/x assert_almost_equal(y/x, [1, 1], err_msg=msg)
Example #30
Source File: test_umath.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 5 votes |
def test_lower_align(self): # check data that is not aligned to element size # i.e doubles are aligned to 4 bytes on i386 d = np.zeros(23 * 8, dtype=np.int8)[4:-4].view(np.float64) assert_equal(np.abs(d), d) assert_equal(np.negative(d), -d) np.negative(d, out=d) np.negative(np.ones_like(d), out=d) np.abs(d, out=d) np.abs(np.ones_like(d), out=d)