Python numpy.infi() Examples
The following are 30
code examples of numpy.infi().
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
, or try the search function
.
Example #1
Source File: test_umath_complex.py From pySINDy with MIT License | 5 votes |
def test_special_values(self): # carg(-np.inf +- yi) returns +-pi for finite y > 0 check_real_value(ncu._arg, -np.inf, 1, np.pi, False) check_real_value(ncu._arg, -np.inf, -1, -np.pi, False) # carg(np.inf +- yi) returns +-0 for finite y > 0 check_real_value(ncu._arg, np.inf, 1, np.PZERO, False) check_real_value(ncu._arg, np.inf, -1, np.NZERO, False) # carg(x +- np.infi) returns +-pi/2 for finite x check_real_value(ncu._arg, 1, np.inf, 0.5 * np.pi, False) check_real_value(ncu._arg, 1, -np.inf, -0.5 * np.pi, False) # carg(-np.inf +- np.infi) returns +-3pi/4 check_real_value(ncu._arg, -np.inf, np.inf, 0.75 * np.pi, False) check_real_value(ncu._arg, -np.inf, -np.inf, -0.75 * np.pi, False) # carg(np.inf +- np.infi) returns +-pi/4 check_real_value(ncu._arg, np.inf, np.inf, 0.25 * np.pi, False) check_real_value(ncu._arg, np.inf, -np.inf, -0.25 * np.pi, False) # carg(x + yi) returns np.nan if x or y is nan check_real_value(ncu._arg, np.nan, 0, np.nan, False) check_real_value(ncu._arg, 0, np.nan, np.nan, False) check_real_value(ncu._arg, np.nan, np.inf, np.nan, False) check_real_value(ncu._arg, np.inf, np.nan, np.nan, False)
Example #2
Source File: test_umath_complex.py From keras-lambda with MIT License | 5 votes |
def test_special_values(self): # carg(-np.inf +- yi) returns +-pi for finite y > 0 yield check_real_value, ncu._arg, -np.inf, 1, np.pi, False yield check_real_value, ncu._arg, -np.inf, -1, -np.pi, False # carg(np.inf +- yi) returns +-0 for finite y > 0 yield check_real_value, ncu._arg, np.inf, 1, np.PZERO, False yield check_real_value, ncu._arg, np.inf, -1, np.NZERO, False # carg(x +- np.infi) returns +-pi/2 for finite x yield check_real_value, ncu._arg, 1, np.inf, 0.5 * np.pi, False yield check_real_value, ncu._arg, 1, -np.inf, -0.5 * np.pi, False # carg(-np.inf +- np.infi) returns +-3pi/4 yield check_real_value, ncu._arg, -np.inf, np.inf, 0.75 * np.pi, False yield check_real_value, ncu._arg, -np.inf, -np.inf, -0.75 * np.pi, False # carg(np.inf +- np.infi) returns +-pi/4 yield check_real_value, ncu._arg, np.inf, np.inf, 0.25 * np.pi, False yield check_real_value, ncu._arg, np.inf, -np.inf, -0.25 * np.pi, False # carg(x + yi) returns np.nan if x or y is nan yield check_real_value, ncu._arg, np.nan, 0, np.nan, False yield check_real_value, ncu._arg, 0, np.nan, np.nan, False yield check_real_value, ncu._arg, np.nan, np.inf, np.nan, False yield check_real_value, ncu._arg, np.inf, np.nan, np.nan, False
Example #3
Source File: test_umath_complex.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_special_values(self): # carg(-np.inf +- yi) returns +-pi for finite y > 0 check_real_value(ncu._arg, -np.inf, 1, np.pi, False) check_real_value(ncu._arg, -np.inf, -1, -np.pi, False) # carg(np.inf +- yi) returns +-0 for finite y > 0 check_real_value(ncu._arg, np.inf, 1, np.PZERO, False) check_real_value(ncu._arg, np.inf, -1, np.NZERO, False) # carg(x +- np.infi) returns +-pi/2 for finite x check_real_value(ncu._arg, 1, np.inf, 0.5 * np.pi, False) check_real_value(ncu._arg, 1, -np.inf, -0.5 * np.pi, False) # carg(-np.inf +- np.infi) returns +-3pi/4 check_real_value(ncu._arg, -np.inf, np.inf, 0.75 * np.pi, False) check_real_value(ncu._arg, -np.inf, -np.inf, -0.75 * np.pi, False) # carg(np.inf +- np.infi) returns +-pi/4 check_real_value(ncu._arg, np.inf, np.inf, 0.25 * np.pi, False) check_real_value(ncu._arg, np.inf, -np.inf, -0.25 * np.pi, False) # carg(x + yi) returns np.nan if x or y is nan check_real_value(ncu._arg, np.nan, 0, np.nan, False) check_real_value(ncu._arg, 0, np.nan, np.nan, False) check_real_value(ncu._arg, np.nan, np.inf, np.nan, False) check_real_value(ncu._arg, np.inf, np.nan, np.nan, False)
Example #4
Source File: test_umath_complex.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 5 votes |
def test_special_values(self): # carg(-np.inf +- yi) returns +-pi for finite y > 0 check_real_value(ncu._arg, -np.inf, 1, np.pi, False) check_real_value(ncu._arg, -np.inf, -1, -np.pi, False) # carg(np.inf +- yi) returns +-0 for finite y > 0 check_real_value(ncu._arg, np.inf, 1, np.PZERO, False) check_real_value(ncu._arg, np.inf, -1, np.NZERO, False) # carg(x +- np.infi) returns +-pi/2 for finite x check_real_value(ncu._arg, 1, np.inf, 0.5 * np.pi, False) check_real_value(ncu._arg, 1, -np.inf, -0.5 * np.pi, False) # carg(-np.inf +- np.infi) returns +-3pi/4 check_real_value(ncu._arg, -np.inf, np.inf, 0.75 * np.pi, False) check_real_value(ncu._arg, -np.inf, -np.inf, -0.75 * np.pi, False) # carg(np.inf +- np.infi) returns +-pi/4 check_real_value(ncu._arg, np.inf, np.inf, 0.25 * np.pi, False) check_real_value(ncu._arg, np.inf, -np.inf, -0.25 * np.pi, False) # carg(x + yi) returns np.nan if x or y is nan check_real_value(ncu._arg, np.nan, 0, np.nan, False) check_real_value(ncu._arg, 0, np.nan, np.nan, False) check_real_value(ncu._arg, np.nan, np.inf, np.nan, False) check_real_value(ncu._arg, np.inf, np.nan, np.nan, False)
Example #5
Source File: test_umath_complex.py From coffeegrindsize with MIT License | 5 votes |
def test_special_values(self): # carg(-np.inf +- yi) returns +-pi for finite y > 0 check_real_value(ncu._arg, -np.inf, 1, np.pi, False) check_real_value(ncu._arg, -np.inf, -1, -np.pi, False) # carg(np.inf +- yi) returns +-0 for finite y > 0 check_real_value(ncu._arg, np.inf, 1, np.PZERO, False) check_real_value(ncu._arg, np.inf, -1, np.NZERO, False) # carg(x +- np.infi) returns +-pi/2 for finite x check_real_value(ncu._arg, 1, np.inf, 0.5 * np.pi, False) check_real_value(ncu._arg, 1, -np.inf, -0.5 * np.pi, False) # carg(-np.inf +- np.infi) returns +-3pi/4 check_real_value(ncu._arg, -np.inf, np.inf, 0.75 * np.pi, False) check_real_value(ncu._arg, -np.inf, -np.inf, -0.75 * np.pi, False) # carg(np.inf +- np.infi) returns +-pi/4 check_real_value(ncu._arg, np.inf, np.inf, 0.25 * np.pi, False) check_real_value(ncu._arg, np.inf, -np.inf, -0.25 * np.pi, False) # carg(x + yi) returns np.nan if x or y is nan check_real_value(ncu._arg, np.nan, 0, np.nan, False) check_real_value(ncu._arg, 0, np.nan, np.nan, False) check_real_value(ncu._arg, np.nan, np.inf, np.nan, False) check_real_value(ncu._arg, np.inf, np.nan, np.nan, False)
Example #6
Source File: test_umath_complex.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def test_special_values(self): # carg(-np.inf +- yi) returns +-pi for finite y > 0 yield check_real_value, ncu._arg, -np.inf, 1, np.pi, False yield check_real_value, ncu._arg, -np.inf, -1, -np.pi, False # carg(np.inf +- yi) returns +-0 for finite y > 0 yield check_real_value, ncu._arg, np.inf, 1, np.PZERO, False yield check_real_value, ncu._arg, np.inf, -1, np.NZERO, False # carg(x +- np.infi) returns +-pi/2 for finite x yield check_real_value, ncu._arg, 1, np.inf, 0.5 * np.pi, False yield check_real_value, ncu._arg, 1, -np.inf, -0.5 * np.pi, False # carg(-np.inf +- np.infi) returns +-3pi/4 yield check_real_value, ncu._arg, -np.inf, np.inf, 0.75 * np.pi, False yield check_real_value, ncu._arg, -np.inf, -np.inf, -0.75 * np.pi, False # carg(np.inf +- np.infi) returns +-pi/4 yield check_real_value, ncu._arg, np.inf, np.inf, 0.25 * np.pi, False yield check_real_value, ncu._arg, np.inf, -np.inf, -0.25 * np.pi, False # carg(x + yi) returns np.nan if x or y is nan yield check_real_value, ncu._arg, np.nan, 0, np.nan, False yield check_real_value, ncu._arg, 0, np.nan, np.nan, False yield check_real_value, ncu._arg, np.nan, np.inf, np.nan, False yield check_real_value, ncu._arg, np.inf, np.nan, np.nan, False
Example #7
Source File: test_umath_complex.py From ImageFusion with MIT License | 5 votes |
def test_special_values(self): # carg(-np.inf +- yi) returns +-pi for finite y > 0 yield check_real_value, ncu._arg, -np.inf, 1, np.pi, False yield check_real_value, ncu._arg, -np.inf, -1, -np.pi, False # carg(np.inf +- yi) returns +-0 for finite y > 0 yield check_real_value, ncu._arg, np.inf, 1, np.PZERO, False yield check_real_value, ncu._arg, np.inf, -1, np.NZERO, False # carg(x +- np.infi) returns +-pi/2 for finite x yield check_real_value, ncu._arg, 1, np.inf, 0.5 * np.pi, False yield check_real_value, ncu._arg, 1, -np.inf, -0.5 * np.pi, False # carg(-np.inf +- np.infi) returns +-3pi/4 yield check_real_value, ncu._arg, -np.inf, np.inf, 0.75 * np.pi, False yield check_real_value, ncu._arg, -np.inf, -np.inf, -0.75 * np.pi, False # carg(np.inf +- np.infi) returns +-pi/4 yield check_real_value, ncu._arg, np.inf, np.inf, 0.25 * np.pi, False yield check_real_value, ncu._arg, np.inf, -np.inf, -0.25 * np.pi, False # carg(x + yi) returns np.nan if x or y is nan yield check_real_value, ncu._arg, np.nan, 0, np.nan, False yield check_real_value, ncu._arg, 0, np.nan, np.nan, False yield check_real_value, ncu._arg, np.nan, np.inf, np.nan, False yield check_real_value, ncu._arg, np.inf, np.nan, np.nan, False
Example #8
Source File: test_umath_complex.py From mxnet-lambda with Apache License 2.0 | 5 votes |
def test_special_values(self): # carg(-np.inf +- yi) returns +-pi for finite y > 0 yield check_real_value, ncu._arg, -np.inf, 1, np.pi, False yield check_real_value, ncu._arg, -np.inf, -1, -np.pi, False # carg(np.inf +- yi) returns +-0 for finite y > 0 yield check_real_value, ncu._arg, np.inf, 1, np.PZERO, False yield check_real_value, ncu._arg, np.inf, -1, np.NZERO, False # carg(x +- np.infi) returns +-pi/2 for finite x yield check_real_value, ncu._arg, 1, np.inf, 0.5 * np.pi, False yield check_real_value, ncu._arg, 1, -np.inf, -0.5 * np.pi, False # carg(-np.inf +- np.infi) returns +-3pi/4 yield check_real_value, ncu._arg, -np.inf, np.inf, 0.75 * np.pi, False yield check_real_value, ncu._arg, -np.inf, -np.inf, -0.75 * np.pi, False # carg(np.inf +- np.infi) returns +-pi/4 yield check_real_value, ncu._arg, np.inf, np.inf, 0.25 * np.pi, False yield check_real_value, ncu._arg, np.inf, -np.inf, -0.25 * np.pi, False # carg(x + yi) returns np.nan if x or y is nan yield check_real_value, ncu._arg, np.nan, 0, np.nan, False yield check_real_value, ncu._arg, 0, np.nan, np.nan, False yield check_real_value, ncu._arg, np.nan, np.inf, np.nan, False yield check_real_value, ncu._arg, np.inf, np.nan, np.nan, False
Example #9
Source File: test_umath_complex.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def test_special_values(self): # carg(-np.inf +- yi) returns +-pi for finite y > 0 check_real_value(ncu._arg, -np.inf, 1, np.pi, False) check_real_value(ncu._arg, -np.inf, -1, -np.pi, False) # carg(np.inf +- yi) returns +-0 for finite y > 0 check_real_value(ncu._arg, np.inf, 1, np.PZERO, False) check_real_value(ncu._arg, np.inf, -1, np.NZERO, False) # carg(x +- np.infi) returns +-pi/2 for finite x check_real_value(ncu._arg, 1, np.inf, 0.5 * np.pi, False) check_real_value(ncu._arg, 1, -np.inf, -0.5 * np.pi, False) # carg(-np.inf +- np.infi) returns +-3pi/4 check_real_value(ncu._arg, -np.inf, np.inf, 0.75 * np.pi, False) check_real_value(ncu._arg, -np.inf, -np.inf, -0.75 * np.pi, False) # carg(np.inf +- np.infi) returns +-pi/4 check_real_value(ncu._arg, np.inf, np.inf, 0.25 * np.pi, False) check_real_value(ncu._arg, np.inf, -np.inf, -0.25 * np.pi, False) # carg(x + yi) returns np.nan if x or y is nan check_real_value(ncu._arg, np.nan, 0, np.nan, False) check_real_value(ncu._arg, 0, np.nan, np.nan, False) check_real_value(ncu._arg, np.nan, np.inf, np.nan, False) check_real_value(ncu._arg, np.inf, np.nan, np.nan, False)
Example #10
Source File: test_umath_complex.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def test_special_values(self): # carg(-np.inf +- yi) returns +-pi for finite y > 0 check_real_value(ncu._arg, -np.inf, 1, np.pi, False) check_real_value(ncu._arg, -np.inf, -1, -np.pi, False) # carg(np.inf +- yi) returns +-0 for finite y > 0 check_real_value(ncu._arg, np.inf, 1, np.PZERO, False) check_real_value(ncu._arg, np.inf, -1, np.NZERO, False) # carg(x +- np.infi) returns +-pi/2 for finite x check_real_value(ncu._arg, 1, np.inf, 0.5 * np.pi, False) check_real_value(ncu._arg, 1, -np.inf, -0.5 * np.pi, False) # carg(-np.inf +- np.infi) returns +-3pi/4 check_real_value(ncu._arg, -np.inf, np.inf, 0.75 * np.pi, False) check_real_value(ncu._arg, -np.inf, -np.inf, -0.75 * np.pi, False) # carg(np.inf +- np.infi) returns +-pi/4 check_real_value(ncu._arg, np.inf, np.inf, 0.25 * np.pi, False) check_real_value(ncu._arg, np.inf, -np.inf, -0.25 * np.pi, False) # carg(x + yi) returns np.nan if x or y is nan check_real_value(ncu._arg, np.nan, 0, np.nan, False) check_real_value(ncu._arg, 0, np.nan, np.nan, False) check_real_value(ncu._arg, np.nan, np.inf, np.nan, False) check_real_value(ncu._arg, np.inf, np.nan, np.nan, False)
Example #11
Source File: test_umath_complex.py From Mastering-Elasticsearch-7.0 with MIT License | 5 votes |
def test_special_values(self): # carg(-np.inf +- yi) returns +-pi for finite y > 0 check_real_value(ncu._arg, -np.inf, 1, np.pi, False) check_real_value(ncu._arg, -np.inf, -1, -np.pi, False) # carg(np.inf +- yi) returns +-0 for finite y > 0 check_real_value(ncu._arg, np.inf, 1, np.PZERO, False) check_real_value(ncu._arg, np.inf, -1, np.NZERO, False) # carg(x +- np.infi) returns +-pi/2 for finite x check_real_value(ncu._arg, 1, np.inf, 0.5 * np.pi, False) check_real_value(ncu._arg, 1, -np.inf, -0.5 * np.pi, False) # carg(-np.inf +- np.infi) returns +-3pi/4 check_real_value(ncu._arg, -np.inf, np.inf, 0.75 * np.pi, False) check_real_value(ncu._arg, -np.inf, -np.inf, -0.75 * np.pi, False) # carg(np.inf +- np.infi) returns +-pi/4 check_real_value(ncu._arg, np.inf, np.inf, 0.25 * np.pi, False) check_real_value(ncu._arg, np.inf, -np.inf, -0.25 * np.pi, False) # carg(x + yi) returns np.nan if x or y is nan check_real_value(ncu._arg, np.nan, 0, np.nan, False) check_real_value(ncu._arg, 0, np.nan, np.nan, False) check_real_value(ncu._arg, np.nan, np.inf, np.nan, False) check_real_value(ncu._arg, np.inf, np.nan, np.nan, False)
Example #12
Source File: test_umath_complex.py From recruit with Apache License 2.0 | 5 votes |
def test_special_values(self): # carg(-np.inf +- yi) returns +-pi for finite y > 0 check_real_value(ncu._arg, -np.inf, 1, np.pi, False) check_real_value(ncu._arg, -np.inf, -1, -np.pi, False) # carg(np.inf +- yi) returns +-0 for finite y > 0 check_real_value(ncu._arg, np.inf, 1, np.PZERO, False) check_real_value(ncu._arg, np.inf, -1, np.NZERO, False) # carg(x +- np.infi) returns +-pi/2 for finite x check_real_value(ncu._arg, 1, np.inf, 0.5 * np.pi, False) check_real_value(ncu._arg, 1, -np.inf, -0.5 * np.pi, False) # carg(-np.inf +- np.infi) returns +-3pi/4 check_real_value(ncu._arg, -np.inf, np.inf, 0.75 * np.pi, False) check_real_value(ncu._arg, -np.inf, -np.inf, -0.75 * np.pi, False) # carg(np.inf +- np.infi) returns +-pi/4 check_real_value(ncu._arg, np.inf, np.inf, 0.25 * np.pi, False) check_real_value(ncu._arg, np.inf, -np.inf, -0.25 * np.pi, False) # carg(x + yi) returns np.nan if x or y is nan check_real_value(ncu._arg, np.nan, 0, np.nan, False) check_real_value(ncu._arg, 0, np.nan, np.nan, False) check_real_value(ncu._arg, np.nan, np.inf, np.nan, False) check_real_value(ncu._arg, np.inf, np.nan, np.nan, False)
Example #13
Source File: test_umath_complex.py From auto-alt-text-lambda-api with MIT License | 5 votes |
def test_special_values(self): # carg(-np.inf +- yi) returns +-pi for finite y > 0 yield check_real_value, ncu._arg, -np.inf, 1, np.pi, False yield check_real_value, ncu._arg, -np.inf, -1, -np.pi, False # carg(np.inf +- yi) returns +-0 for finite y > 0 yield check_real_value, ncu._arg, np.inf, 1, np.PZERO, False yield check_real_value, ncu._arg, np.inf, -1, np.NZERO, False # carg(x +- np.infi) returns +-pi/2 for finite x yield check_real_value, ncu._arg, 1, np.inf, 0.5 * np.pi, False yield check_real_value, ncu._arg, 1, -np.inf, -0.5 * np.pi, False # carg(-np.inf +- np.infi) returns +-3pi/4 yield check_real_value, ncu._arg, -np.inf, np.inf, 0.75 * np.pi, False yield check_real_value, ncu._arg, -np.inf, -np.inf, -0.75 * np.pi, False # carg(np.inf +- np.infi) returns +-pi/4 yield check_real_value, ncu._arg, np.inf, np.inf, 0.25 * np.pi, False yield check_real_value, ncu._arg, np.inf, -np.inf, -0.25 * np.pi, False # carg(x + yi) returns np.nan if x or y is nan yield check_real_value, ncu._arg, np.nan, 0, np.nan, False yield check_real_value, ncu._arg, 0, np.nan, np.nan, False yield check_real_value, ncu._arg, np.nan, np.inf, np.nan, False yield check_real_value, ncu._arg, np.inf, np.nan, np.nan, False
Example #14
Source File: test_umath_complex.py From vnpy_crypto with MIT License | 5 votes |
def test_special_values(self): # carg(-np.inf +- yi) returns +-pi for finite y > 0 yield check_real_value, ncu._arg, -np.inf, 1, np.pi, False yield check_real_value, ncu._arg, -np.inf, -1, -np.pi, False # carg(np.inf +- yi) returns +-0 for finite y > 0 yield check_real_value, ncu._arg, np.inf, 1, np.PZERO, False yield check_real_value, ncu._arg, np.inf, -1, np.NZERO, False # carg(x +- np.infi) returns +-pi/2 for finite x yield check_real_value, ncu._arg, 1, np.inf, 0.5 * np.pi, False yield check_real_value, ncu._arg, 1, -np.inf, -0.5 * np.pi, False # carg(-np.inf +- np.infi) returns +-3pi/4 yield check_real_value, ncu._arg, -np.inf, np.inf, 0.75 * np.pi, False yield check_real_value, ncu._arg, -np.inf, -np.inf, -0.75 * np.pi, False # carg(np.inf +- np.infi) returns +-pi/4 yield check_real_value, ncu._arg, np.inf, np.inf, 0.25 * np.pi, False yield check_real_value, ncu._arg, np.inf, -np.inf, -0.25 * np.pi, False # carg(x + yi) returns np.nan if x or y is nan yield check_real_value, ncu._arg, np.nan, 0, np.nan, False yield check_real_value, ncu._arg, 0, np.nan, np.nan, False yield check_real_value, ncu._arg, np.nan, np.inf, np.nan, False yield check_real_value, ncu._arg, np.inf, np.nan, np.nan, False
Example #15
Source File: test_umath_complex.py From Computable with MIT License | 5 votes |
def test_special_values(self): # carg(-np.inf +- yi) returns +-pi for finite y > 0 yield check_real_value, ncu._arg, -np.inf, 1, np.pi, False yield check_real_value, ncu._arg, -np.inf, -1, -np.pi, False # carg(np.inf +- yi) returns +-0 for finite y > 0 yield check_real_value, ncu._arg, np.inf, 1, np.PZERO, False yield check_real_value, ncu._arg, np.inf, -1, np.NZERO, False # carg(x +- np.infi) returns +-pi/2 for finite x yield check_real_value, ncu._arg, 1, np.inf, 0.5 * np.pi, False yield check_real_value, ncu._arg, 1, -np.inf, -0.5 * np.pi, False # carg(-np.inf +- np.infi) returns +-3pi/4 yield check_real_value, ncu._arg, -np.inf, np.inf, 0.75 * np.pi, False yield check_real_value, ncu._arg, -np.inf, -np.inf, -0.75 * np.pi, False # carg(np.inf +- np.infi) returns +-pi/4 yield check_real_value, ncu._arg, np.inf, np.inf, 0.25 * np.pi, False yield check_real_value, ncu._arg, np.inf, -np.inf, -0.25 * np.pi, False # carg(x + yi) returns np.nan if x or y is nan yield check_real_value, ncu._arg, np.nan, 0, np.nan, False yield check_real_value, ncu._arg, 0, np.nan, np.nan, False yield check_real_value, ncu._arg, np.nan, np.inf, np.nan, False yield check_real_value, ncu._arg, np.inf, np.nan, np.nan, False
Example #16
Source File: test_umath_complex.py From recruit with Apache License 2.0 | 4 votes |
def test_special_values(self): # C99: Sec G 6.4.2 check = check_complex_value f = np.sqrt # csqrt(+-0 + 0i) is 0 + 0i check(f, np.PZERO, 0, 0, 0) check(f, np.NZERO, 0, 0, 0) # csqrt(x + infi) is inf + infi for any x (including NaN) check(f, 1, np.inf, np.inf, np.inf) check(f, -1, np.inf, np.inf, np.inf) check(f, np.PZERO, np.inf, np.inf, np.inf) check(f, np.NZERO, np.inf, np.inf, np.inf) check(f, np.inf, np.inf, np.inf, np.inf) check(f, -np.inf, np.inf, np.inf, np.inf) check(f, -np.nan, np.inf, np.inf, np.inf) # csqrt(x + nani) is nan + nani for any finite x check(f, 1, np.nan, np.nan, np.nan) check(f, -1, np.nan, np.nan, np.nan) check(f, 0, np.nan, np.nan, np.nan) # csqrt(-inf + yi) is +0 + infi for any finite y > 0 check(f, -np.inf, 1, np.PZERO, np.inf) # csqrt(inf + yi) is +inf + 0i for any finite y > 0 check(f, np.inf, 1, np.inf, np.PZERO) # csqrt(-inf + nani) is nan +- infi (both +i infi are valid) def _check_ninf_nan(dummy): msgform = "csqrt(-inf, nan) is (%f, %f), expected (nan, +-inf)" z = np.sqrt(np.array(complex(-np.inf, np.nan))) #Fixme: ugly workaround for isinf bug. with np.errstate(invalid='ignore'): if not (np.isnan(z.real) and np.isinf(z.imag)): raise AssertionError(msgform % (z.real, z.imag)) _check_ninf_nan(None) # csqrt(+inf + nani) is inf + nani check(f, np.inf, np.nan, np.inf, np.nan) # csqrt(nan + yi) is nan + nani for any finite y (infinite handled in x # + nani) check(f, np.nan, 0, np.nan, np.nan) check(f, np.nan, 1, np.nan, np.nan) check(f, np.nan, np.nan, np.nan, np.nan) # XXX: check for conj(csqrt(z)) == csqrt(conj(z)) (need to fix branch # cuts first)
Example #17
Source File: test_umath_complex.py From mxnet-lambda with Apache License 2.0 | 4 votes |
def test_special_values(self): # C99: Sec G 6.4.2 check = check_complex_value f = np.sqrt # csqrt(+-0 + 0i) is 0 + 0i yield check, f, np.PZERO, 0, 0, 0 yield check, f, np.NZERO, 0, 0, 0 # csqrt(x + infi) is inf + infi for any x (including NaN) yield check, f, 1, np.inf, np.inf, np.inf yield check, f, -1, np.inf, np.inf, np.inf yield check, f, np.PZERO, np.inf, np.inf, np.inf yield check, f, np.NZERO, np.inf, np.inf, np.inf yield check, f, np.inf, np.inf, np.inf, np.inf yield check, f, -np.inf, np.inf, np.inf, np.inf yield check, f, -np.nan, np.inf, np.inf, np.inf # csqrt(x + nani) is nan + nani for any finite x yield check, f, 1, np.nan, np.nan, np.nan yield check, f, -1, np.nan, np.nan, np.nan yield check, f, 0, np.nan, np.nan, np.nan # csqrt(-inf + yi) is +0 + infi for any finite y > 0 yield check, f, -np.inf, 1, np.PZERO, np.inf # csqrt(inf + yi) is +inf + 0i for any finite y > 0 yield check, f, np.inf, 1, np.inf, np.PZERO # csqrt(-inf + nani) is nan +- infi (both +i infi are valid) def _check_ninf_nan(dummy): msgform = "csqrt(-inf, nan) is (%f, %f), expected (nan, +-inf)" z = np.sqrt(np.array(np.complex(-np.inf, np.nan))) #Fixme: ugly workaround for isinf bug. with np.errstate(invalid='ignore'): if not (np.isnan(z.real) and np.isinf(z.imag)): raise AssertionError(msgform % (z.real, z.imag)) yield _check_ninf_nan, None # csqrt(+inf + nani) is inf + nani yield check, f, np.inf, np.nan, np.inf, np.nan # csqrt(nan + yi) is nan + nani for any finite y (infinite handled in x # + nani) yield check, f, np.nan, 0, np.nan, np.nan yield check, f, np.nan, 1, np.nan, np.nan yield check, f, np.nan, np.nan, np.nan, np.nan # XXX: check for conj(csqrt(z)) == csqrt(conj(z)) (need to fix branch # cuts first)
Example #18
Source File: test_umath_complex.py From pySINDy with MIT License | 4 votes |
def test_special_values(self): # C99: Sec G 6.4.2 check = check_complex_value f = np.sqrt # csqrt(+-0 + 0i) is 0 + 0i check(f, np.PZERO, 0, 0, 0) check(f, np.NZERO, 0, 0, 0) # csqrt(x + infi) is inf + infi for any x (including NaN) check(f, 1, np.inf, np.inf, np.inf) check(f, -1, np.inf, np.inf, np.inf) check(f, np.PZERO, np.inf, np.inf, np.inf) check(f, np.NZERO, np.inf, np.inf, np.inf) check(f, np.inf, np.inf, np.inf, np.inf) check(f, -np.inf, np.inf, np.inf, np.inf) check(f, -np.nan, np.inf, np.inf, np.inf) # csqrt(x + nani) is nan + nani for any finite x check(f, 1, np.nan, np.nan, np.nan) check(f, -1, np.nan, np.nan, np.nan) check(f, 0, np.nan, np.nan, np.nan) # csqrt(-inf + yi) is +0 + infi for any finite y > 0 check(f, -np.inf, 1, np.PZERO, np.inf) # csqrt(inf + yi) is +inf + 0i for any finite y > 0 check(f, np.inf, 1, np.inf, np.PZERO) # csqrt(-inf + nani) is nan +- infi (both +i infi are valid) def _check_ninf_nan(dummy): msgform = "csqrt(-inf, nan) is (%f, %f), expected (nan, +-inf)" z = np.sqrt(np.array(complex(-np.inf, np.nan))) #Fixme: ugly workaround for isinf bug. with np.errstate(invalid='ignore'): if not (np.isnan(z.real) and np.isinf(z.imag)): raise AssertionError(msgform % (z.real, z.imag)) _check_ninf_nan(None) # csqrt(+inf + nani) is inf + nani check(f, np.inf, np.nan, np.inf, np.nan) # csqrt(nan + yi) is nan + nani for any finite y (infinite handled in x # + nani) check(f, np.nan, 0, np.nan, np.nan) check(f, np.nan, 1, np.nan, np.nan) check(f, np.nan, np.nan, np.nan, np.nan) # XXX: check for conj(csqrt(z)) == csqrt(conj(z)) (need to fix branch # cuts first)
Example #19
Source File: test_umath_complex.py From ImageFusion with MIT License | 4 votes |
def test_special_values(self): check = check_complex_value f = np.sqrt # C99: Sec G 6.4.2 x, y = [], [] # csqrt(+-0 + 0i) is 0 + 0i yield check, f, np.PZERO, 0, 0, 0 yield check, f, np.NZERO, 0, 0, 0 # csqrt(x + infi) is inf + infi for any x (including NaN) yield check, f, 1, np.inf, np.inf, np.inf yield check, f, -1, np.inf, np.inf, np.inf yield check, f, np.PZERO, np.inf, np.inf, np.inf yield check, f, np.NZERO, np.inf, np.inf, np.inf yield check, f, np.inf, np.inf, np.inf, np.inf yield check, f, -np.inf, np.inf, np.inf, np.inf yield check, f, -np.nan, np.inf, np.inf, np.inf # csqrt(x + nani) is nan + nani for any finite x yield check, f, 1, np.nan, np.nan, np.nan yield check, f, -1, np.nan, np.nan, np.nan yield check, f, 0, np.nan, np.nan, np.nan # csqrt(-inf + yi) is +0 + infi for any finite y > 0 yield check, f, -np.inf, 1, np.PZERO, np.inf # csqrt(inf + yi) is +inf + 0i for any finite y > 0 yield check, f, np.inf, 1, np.inf, np.PZERO # csqrt(-inf + nani) is nan +- infi (both +i infi are valid) def _check_ninf_nan(dummy): msgform = "csqrt(-inf, nan) is (%f, %f), expected (nan, +-inf)" z = np.sqrt(np.array(np.complex(-np.inf, np.nan))) #Fixme: ugly workaround for isinf bug. with np.errstate(invalid='ignore'): if not (np.isnan(z.real) and np.isinf(z.imag)): raise AssertionError(msgform % (z.real, z.imag)) yield _check_ninf_nan, None # csqrt(+inf + nani) is inf + nani yield check, f, np.inf, np.nan, np.inf, np.nan # csqrt(nan + yi) is nan + nani for any finite y (infinite handled in x # + nani) yield check, f, np.nan, 0, np.nan, np.nan yield check, f, np.nan, 1, np.nan, np.nan yield check, f, np.nan, np.nan, np.nan, np.nan # XXX: check for conj(csqrt(z)) == csqrt(conj(z)) (need to fix branch # cuts first)
Example #20
Source File: test_umath_complex.py From Computable with MIT License | 4 votes |
def test_special_values(self): check = check_complex_value f = np.sqrt # C99: Sec G 6.4.2 x, y = [], [] # csqrt(+-0 + 0i) is 0 + 0i yield check, f, np.PZERO, 0, 0, 0 yield check, f, np.NZERO, 0, 0, 0 # csqrt(x + infi) is inf + infi for any x (including NaN) yield check, f, 1, np.inf, np.inf, np.inf yield check, f, -1, np.inf, np.inf, np.inf yield check, f, np.PZERO, np.inf, np.inf, np.inf yield check, f, np.NZERO, np.inf, np.inf, np.inf yield check, f, np.inf, np.inf, np.inf, np.inf yield check, f, -np.inf, np.inf, np.inf, np.inf yield check, f, -np.nan, np.inf, np.inf, np.inf # csqrt(x + nani) is nan + nani for any finite x yield check, f, 1, np.nan, np.nan, np.nan yield check, f, -1, np.nan, np.nan, np.nan yield check, f, 0, np.nan, np.nan, np.nan # csqrt(-inf + yi) is +0 + infi for any finite y > 0 yield check, f, -np.inf, 1, np.PZERO, np.inf # csqrt(inf + yi) is +inf + 0i for any finite y > 0 yield check, f, np.inf, 1, np.inf, np.PZERO # csqrt(-inf + nani) is nan +- infi (both +i infi are valid) def _check_ninf_nan(dummy): msgform = "csqrt(-inf, nan) is (%f, %f), expected (nan, +-inf)" z = np.sqrt(np.array(np.complex(-np.inf, np.nan))) #Fixme: ugly workaround for isinf bug. with np.errstate(invalid='ignore'): if not (np.isnan(z.real) and np.isinf(z.imag)): raise AssertionError(msgform % (z.real, z.imag)) yield _check_ninf_nan, None # csqrt(+inf + nani) is inf + nani yield check, f, np.inf, np.nan, np.inf, np.nan # csqrt(nan + yi) is nan + nani for any finite y (infinite handled in x # + nani) yield check, f, np.nan, 0, np.nan, np.nan yield check, f, np.nan, 1, np.nan, np.nan yield check, f, np.nan, np.nan, np.nan, np.nan # XXX: check for conj(csqrt(z)) == csqrt(conj(z)) (need to fix branch # cuts first)
Example #21
Source File: test_umath_complex.py From elasticintel with GNU General Public License v3.0 | 4 votes |
def test_special_values(self): # C99: Sec G 6.4.2 check = check_complex_value f = np.sqrt # csqrt(+-0 + 0i) is 0 + 0i yield check, f, np.PZERO, 0, 0, 0 yield check, f, np.NZERO, 0, 0, 0 # csqrt(x + infi) is inf + infi for any x (including NaN) yield check, f, 1, np.inf, np.inf, np.inf yield check, f, -1, np.inf, np.inf, np.inf yield check, f, np.PZERO, np.inf, np.inf, np.inf yield check, f, np.NZERO, np.inf, np.inf, np.inf yield check, f, np.inf, np.inf, np.inf, np.inf yield check, f, -np.inf, np.inf, np.inf, np.inf yield check, f, -np.nan, np.inf, np.inf, np.inf # csqrt(x + nani) is nan + nani for any finite x yield check, f, 1, np.nan, np.nan, np.nan yield check, f, -1, np.nan, np.nan, np.nan yield check, f, 0, np.nan, np.nan, np.nan # csqrt(-inf + yi) is +0 + infi for any finite y > 0 yield check, f, -np.inf, 1, np.PZERO, np.inf # csqrt(inf + yi) is +inf + 0i for any finite y > 0 yield check, f, np.inf, 1, np.inf, np.PZERO # csqrt(-inf + nani) is nan +- infi (both +i infi are valid) def _check_ninf_nan(dummy): msgform = "csqrt(-inf, nan) is (%f, %f), expected (nan, +-inf)" z = np.sqrt(np.array(np.complex(-np.inf, np.nan))) #Fixme: ugly workaround for isinf bug. with np.errstate(invalid='ignore'): if not (np.isnan(z.real) and np.isinf(z.imag)): raise AssertionError(msgform % (z.real, z.imag)) yield _check_ninf_nan, None # csqrt(+inf + nani) is inf + nani yield check, f, np.inf, np.nan, np.inf, np.nan # csqrt(nan + yi) is nan + nani for any finite y (infinite handled in x # + nani) yield check, f, np.nan, 0, np.nan, np.nan yield check, f, np.nan, 1, np.nan, np.nan yield check, f, np.nan, np.nan, np.nan, np.nan # XXX: check for conj(csqrt(z)) == csqrt(conj(z)) (need to fix branch # cuts first)
Example #22
Source File: test_umath_complex.py From Mastering-Elasticsearch-7.0 with MIT License | 4 votes |
def test_special_values(self): # C99: Sec G 6.4.2 check = check_complex_value f = np.sqrt # csqrt(+-0 + 0i) is 0 + 0i check(f, np.PZERO, 0, 0, 0) check(f, np.NZERO, 0, 0, 0) # csqrt(x + infi) is inf + infi for any x (including NaN) check(f, 1, np.inf, np.inf, np.inf) check(f, -1, np.inf, np.inf, np.inf) check(f, np.PZERO, np.inf, np.inf, np.inf) check(f, np.NZERO, np.inf, np.inf, np.inf) check(f, np.inf, np.inf, np.inf, np.inf) check(f, -np.inf, np.inf, np.inf, np.inf) check(f, -np.nan, np.inf, np.inf, np.inf) # csqrt(x + nani) is nan + nani for any finite x check(f, 1, np.nan, np.nan, np.nan) check(f, -1, np.nan, np.nan, np.nan) check(f, 0, np.nan, np.nan, np.nan) # csqrt(-inf + yi) is +0 + infi for any finite y > 0 check(f, -np.inf, 1, np.PZERO, np.inf) # csqrt(inf + yi) is +inf + 0i for any finite y > 0 check(f, np.inf, 1, np.inf, np.PZERO) # csqrt(-inf + nani) is nan +- infi (both +i infi are valid) def _check_ninf_nan(dummy): msgform = "csqrt(-inf, nan) is (%f, %f), expected (nan, +-inf)" z = np.sqrt(np.array(complex(-np.inf, np.nan))) #Fixme: ugly workaround for isinf bug. with np.errstate(invalid='ignore'): if not (np.isnan(z.real) and np.isinf(z.imag)): raise AssertionError(msgform % (z.real, z.imag)) _check_ninf_nan(None) # csqrt(+inf + nani) is inf + nani check(f, np.inf, np.nan, np.inf, np.nan) # csqrt(nan + yi) is nan + nani for any finite y (infinite handled in x # + nani) check(f, np.nan, 0, np.nan, np.nan) check(f, np.nan, 1, np.nan, np.nan) check(f, np.nan, np.nan, np.nan, np.nan) # XXX: check for conj(csqrt(z)) == csqrt(conj(z)) (need to fix branch # cuts first)
Example #23
Source File: test_umath_complex.py From coffeegrindsize with MIT License | 4 votes |
def test_special_values(self): # C99: Sec G 6.4.2 check = check_complex_value f = np.sqrt # csqrt(+-0 + 0i) is 0 + 0i check(f, np.PZERO, 0, 0, 0) check(f, np.NZERO, 0, 0, 0) # csqrt(x + infi) is inf + infi for any x (including NaN) check(f, 1, np.inf, np.inf, np.inf) check(f, -1, np.inf, np.inf, np.inf) check(f, np.PZERO, np.inf, np.inf, np.inf) check(f, np.NZERO, np.inf, np.inf, np.inf) check(f, np.inf, np.inf, np.inf, np.inf) check(f, -np.inf, np.inf, np.inf, np.inf) check(f, -np.nan, np.inf, np.inf, np.inf) # csqrt(x + nani) is nan + nani for any finite x check(f, 1, np.nan, np.nan, np.nan) check(f, -1, np.nan, np.nan, np.nan) check(f, 0, np.nan, np.nan, np.nan) # csqrt(-inf + yi) is +0 + infi for any finite y > 0 check(f, -np.inf, 1, np.PZERO, np.inf) # csqrt(inf + yi) is +inf + 0i for any finite y > 0 check(f, np.inf, 1, np.inf, np.PZERO) # csqrt(-inf + nani) is nan +- infi (both +i infi are valid) def _check_ninf_nan(dummy): msgform = "csqrt(-inf, nan) is (%f, %f), expected (nan, +-inf)" z = np.sqrt(np.array(complex(-np.inf, np.nan))) #Fixme: ugly workaround for isinf bug. with np.errstate(invalid='ignore'): if not (np.isnan(z.real) and np.isinf(z.imag)): raise AssertionError(msgform % (z.real, z.imag)) _check_ninf_nan(None) # csqrt(+inf + nani) is inf + nani check(f, np.inf, np.nan, np.inf, np.nan) # csqrt(nan + yi) is nan + nani for any finite y (infinite handled in x # + nani) check(f, np.nan, 0, np.nan, np.nan) check(f, np.nan, 1, np.nan, np.nan) check(f, np.nan, np.nan, np.nan, np.nan) # XXX: check for conj(csqrt(z)) == csqrt(conj(z)) (need to fix branch # cuts first)
Example #24
Source File: test_umath_complex.py From vnpy_crypto with MIT License | 4 votes |
def test_special_values(self): # C99: Sec G 6.4.2 check = check_complex_value f = np.sqrt # csqrt(+-0 + 0i) is 0 + 0i yield check, f, np.PZERO, 0, 0, 0 yield check, f, np.NZERO, 0, 0, 0 # csqrt(x + infi) is inf + infi for any x (including NaN) yield check, f, 1, np.inf, np.inf, np.inf yield check, f, -1, np.inf, np.inf, np.inf yield check, f, np.PZERO, np.inf, np.inf, np.inf yield check, f, np.NZERO, np.inf, np.inf, np.inf yield check, f, np.inf, np.inf, np.inf, np.inf yield check, f, -np.inf, np.inf, np.inf, np.inf yield check, f, -np.nan, np.inf, np.inf, np.inf # csqrt(x + nani) is nan + nani for any finite x yield check, f, 1, np.nan, np.nan, np.nan yield check, f, -1, np.nan, np.nan, np.nan yield check, f, 0, np.nan, np.nan, np.nan # csqrt(-inf + yi) is +0 + infi for any finite y > 0 yield check, f, -np.inf, 1, np.PZERO, np.inf # csqrt(inf + yi) is +inf + 0i for any finite y > 0 yield check, f, np.inf, 1, np.inf, np.PZERO # csqrt(-inf + nani) is nan +- infi (both +i infi are valid) def _check_ninf_nan(dummy): msgform = "csqrt(-inf, nan) is (%f, %f), expected (nan, +-inf)" z = np.sqrt(np.array(complex(-np.inf, np.nan))) #Fixme: ugly workaround for isinf bug. with np.errstate(invalid='ignore'): if not (np.isnan(z.real) and np.isinf(z.imag)): raise AssertionError(msgform % (z.real, z.imag)) yield _check_ninf_nan, None # csqrt(+inf + nani) is inf + nani yield check, f, np.inf, np.nan, np.inf, np.nan # csqrt(nan + yi) is nan + nani for any finite y (infinite handled in x # + nani) yield check, f, np.nan, 0, np.nan, np.nan yield check, f, np.nan, 1, np.nan, np.nan yield check, f, np.nan, np.nan, np.nan, np.nan # XXX: check for conj(csqrt(z)) == csqrt(conj(z)) (need to fix branch # cuts first)
Example #25
Source File: test_umath_complex.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 4 votes |
def test_special_values(self): # C99: Sec G 6.4.2 check = check_complex_value f = np.sqrt # csqrt(+-0 + 0i) is 0 + 0i check(f, np.PZERO, 0, 0, 0) check(f, np.NZERO, 0, 0, 0) # csqrt(x + infi) is inf + infi for any x (including NaN) check(f, 1, np.inf, np.inf, np.inf) check(f, -1, np.inf, np.inf, np.inf) check(f, np.PZERO, np.inf, np.inf, np.inf) check(f, np.NZERO, np.inf, np.inf, np.inf) check(f, np.inf, np.inf, np.inf, np.inf) check(f, -np.inf, np.inf, np.inf, np.inf) check(f, -np.nan, np.inf, np.inf, np.inf) # csqrt(x + nani) is nan + nani for any finite x check(f, 1, np.nan, np.nan, np.nan) check(f, -1, np.nan, np.nan, np.nan) check(f, 0, np.nan, np.nan, np.nan) # csqrt(-inf + yi) is +0 + infi for any finite y > 0 check(f, -np.inf, 1, np.PZERO, np.inf) # csqrt(inf + yi) is +inf + 0i for any finite y > 0 check(f, np.inf, 1, np.inf, np.PZERO) # csqrt(-inf + nani) is nan +- infi (both +i infi are valid) def _check_ninf_nan(dummy): msgform = "csqrt(-inf, nan) is (%f, %f), expected (nan, +-inf)" z = np.sqrt(np.array(complex(-np.inf, np.nan))) #Fixme: ugly workaround for isinf bug. with np.errstate(invalid='ignore'): if not (np.isnan(z.real) and np.isinf(z.imag)): raise AssertionError(msgform % (z.real, z.imag)) _check_ninf_nan(None) # csqrt(+inf + nani) is inf + nani check(f, np.inf, np.nan, np.inf, np.nan) # csqrt(nan + yi) is nan + nani for any finite y (infinite handled in x # + nani) check(f, np.nan, 0, np.nan, np.nan) check(f, np.nan, 1, np.nan, np.nan) check(f, np.nan, np.nan, np.nan, np.nan) # XXX: check for conj(csqrt(z)) == csqrt(conj(z)) (need to fix branch # cuts first)
Example #26
Source File: test_umath_complex.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 4 votes |
def test_special_values(self): # C99: Sec G 6.4.2 check = check_complex_value f = np.sqrt # csqrt(+-0 + 0i) is 0 + 0i check(f, np.PZERO, 0, 0, 0) check(f, np.NZERO, 0, 0, 0) # csqrt(x + infi) is inf + infi for any x (including NaN) check(f, 1, np.inf, np.inf, np.inf) check(f, -1, np.inf, np.inf, np.inf) check(f, np.PZERO, np.inf, np.inf, np.inf) check(f, np.NZERO, np.inf, np.inf, np.inf) check(f, np.inf, np.inf, np.inf, np.inf) check(f, -np.inf, np.inf, np.inf, np.inf) check(f, -np.nan, np.inf, np.inf, np.inf) # csqrt(x + nani) is nan + nani for any finite x check(f, 1, np.nan, np.nan, np.nan) check(f, -1, np.nan, np.nan, np.nan) check(f, 0, np.nan, np.nan, np.nan) # csqrt(-inf + yi) is +0 + infi for any finite y > 0 check(f, -np.inf, 1, np.PZERO, np.inf) # csqrt(inf + yi) is +inf + 0i for any finite y > 0 check(f, np.inf, 1, np.inf, np.PZERO) # csqrt(-inf + nani) is nan +- infi (both +i infi are valid) def _check_ninf_nan(dummy): msgform = "csqrt(-inf, nan) is (%f, %f), expected (nan, +-inf)" z = np.sqrt(np.array(complex(-np.inf, np.nan))) #Fixme: ugly workaround for isinf bug. with np.errstate(invalid='ignore'): if not (np.isnan(z.real) and np.isinf(z.imag)): raise AssertionError(msgform % (z.real, z.imag)) _check_ninf_nan(None) # csqrt(+inf + nani) is inf + nani check(f, np.inf, np.nan, np.inf, np.nan) # csqrt(nan + yi) is nan + nani for any finite y (infinite handled in x # + nani) check(f, np.nan, 0, np.nan, np.nan) check(f, np.nan, 1, np.nan, np.nan) check(f, np.nan, np.nan, np.nan, np.nan) # XXX: check for conj(csqrt(z)) == csqrt(conj(z)) (need to fix branch # cuts first)
Example #27
Source File: test_umath_complex.py From twitter-stock-recommendation with MIT License | 4 votes |
def test_special_values(self): # C99: Sec G 6.4.2 check = check_complex_value f = np.sqrt # csqrt(+-0 + 0i) is 0 + 0i check(f, np.PZERO, 0, 0, 0) check(f, np.NZERO, 0, 0, 0) # csqrt(x + infi) is inf + infi for any x (including NaN) check(f, 1, np.inf, np.inf, np.inf) check(f, -1, np.inf, np.inf, np.inf) check(f, np.PZERO, np.inf, np.inf, np.inf) check(f, np.NZERO, np.inf, np.inf, np.inf) check(f, np.inf, np.inf, np.inf, np.inf) check(f, -np.inf, np.inf, np.inf, np.inf) check(f, -np.nan, np.inf, np.inf, np.inf) # csqrt(x + nani) is nan + nani for any finite x check(f, 1, np.nan, np.nan, np.nan) check(f, -1, np.nan, np.nan, np.nan) check(f, 0, np.nan, np.nan, np.nan) # csqrt(-inf + yi) is +0 + infi for any finite y > 0 check(f, -np.inf, 1, np.PZERO, np.inf) # csqrt(inf + yi) is +inf + 0i for any finite y > 0 check(f, np.inf, 1, np.inf, np.PZERO) # csqrt(-inf + nani) is nan +- infi (both +i infi are valid) def _check_ninf_nan(dummy): msgform = "csqrt(-inf, nan) is (%f, %f), expected (nan, +-inf)" z = np.sqrt(np.array(complex(-np.inf, np.nan))) #Fixme: ugly workaround for isinf bug. with np.errstate(invalid='ignore'): if not (np.isnan(z.real) and np.isinf(z.imag)): raise AssertionError(msgform % (z.real, z.imag)) _check_ninf_nan(None) # csqrt(+inf + nani) is inf + nani check(f, np.inf, np.nan, np.inf, np.nan) # csqrt(nan + yi) is nan + nani for any finite y (infinite handled in x # + nani) check(f, np.nan, 0, np.nan, np.nan) check(f, np.nan, 1, np.nan, np.nan) check(f, np.nan, np.nan, np.nan, np.nan) # XXX: check for conj(csqrt(z)) == csqrt(conj(z)) (need to fix branch # cuts first)
Example #28
Source File: test_umath_complex.py From auto-alt-text-lambda-api with MIT License | 4 votes |
def test_special_values(self): # C99: Sec G 6.4.2 check = check_complex_value f = np.sqrt # csqrt(+-0 + 0i) is 0 + 0i yield check, f, np.PZERO, 0, 0, 0 yield check, f, np.NZERO, 0, 0, 0 # csqrt(x + infi) is inf + infi for any x (including NaN) yield check, f, 1, np.inf, np.inf, np.inf yield check, f, -1, np.inf, np.inf, np.inf yield check, f, np.PZERO, np.inf, np.inf, np.inf yield check, f, np.NZERO, np.inf, np.inf, np.inf yield check, f, np.inf, np.inf, np.inf, np.inf yield check, f, -np.inf, np.inf, np.inf, np.inf yield check, f, -np.nan, np.inf, np.inf, np.inf # csqrt(x + nani) is nan + nani for any finite x yield check, f, 1, np.nan, np.nan, np.nan yield check, f, -1, np.nan, np.nan, np.nan yield check, f, 0, np.nan, np.nan, np.nan # csqrt(-inf + yi) is +0 + infi for any finite y > 0 yield check, f, -np.inf, 1, np.PZERO, np.inf # csqrt(inf + yi) is +inf + 0i for any finite y > 0 yield check, f, np.inf, 1, np.inf, np.PZERO # csqrt(-inf + nani) is nan +- infi (both +i infi are valid) def _check_ninf_nan(dummy): msgform = "csqrt(-inf, nan) is (%f, %f), expected (nan, +-inf)" z = np.sqrt(np.array(np.complex(-np.inf, np.nan))) #Fixme: ugly workaround for isinf bug. with np.errstate(invalid='ignore'): if not (np.isnan(z.real) and np.isinf(z.imag)): raise AssertionError(msgform % (z.real, z.imag)) yield _check_ninf_nan, None # csqrt(+inf + nani) is inf + nani yield check, f, np.inf, np.nan, np.inf, np.nan # csqrt(nan + yi) is nan + nani for any finite y (infinite handled in x # + nani) yield check, f, np.nan, 0, np.nan, np.nan yield check, f, np.nan, 1, np.nan, np.nan yield check, f, np.nan, np.nan, np.nan, np.nan # XXX: check for conj(csqrt(z)) == csqrt(conj(z)) (need to fix branch # cuts first)
Example #29
Source File: test_umath_complex.py From keras-lambda with MIT License | 4 votes |
def test_special_values(self): # C99: Sec G 6.4.2 check = check_complex_value f = np.sqrt # csqrt(+-0 + 0i) is 0 + 0i yield check, f, np.PZERO, 0, 0, 0 yield check, f, np.NZERO, 0, 0, 0 # csqrt(x + infi) is inf + infi for any x (including NaN) yield check, f, 1, np.inf, np.inf, np.inf yield check, f, -1, np.inf, np.inf, np.inf yield check, f, np.PZERO, np.inf, np.inf, np.inf yield check, f, np.NZERO, np.inf, np.inf, np.inf yield check, f, np.inf, np.inf, np.inf, np.inf yield check, f, -np.inf, np.inf, np.inf, np.inf yield check, f, -np.nan, np.inf, np.inf, np.inf # csqrt(x + nani) is nan + nani for any finite x yield check, f, 1, np.nan, np.nan, np.nan yield check, f, -1, np.nan, np.nan, np.nan yield check, f, 0, np.nan, np.nan, np.nan # csqrt(-inf + yi) is +0 + infi for any finite y > 0 yield check, f, -np.inf, 1, np.PZERO, np.inf # csqrt(inf + yi) is +inf + 0i for any finite y > 0 yield check, f, np.inf, 1, np.inf, np.PZERO # csqrt(-inf + nani) is nan +- infi (both +i infi are valid) def _check_ninf_nan(dummy): msgform = "csqrt(-inf, nan) is (%f, %f), expected (nan, +-inf)" z = np.sqrt(np.array(np.complex(-np.inf, np.nan))) #Fixme: ugly workaround for isinf bug. with np.errstate(invalid='ignore'): if not (np.isnan(z.real) and np.isinf(z.imag)): raise AssertionError(msgform % (z.real, z.imag)) yield _check_ninf_nan, None # csqrt(+inf + nani) is inf + nani yield check, f, np.inf, np.nan, np.inf, np.nan # csqrt(nan + yi) is nan + nani for any finite y (infinite handled in x # + nani) yield check, f, np.nan, 0, np.nan, np.nan yield check, f, np.nan, 1, np.nan, np.nan yield check, f, np.nan, np.nan, np.nan, np.nan # XXX: check for conj(csqrt(z)) == csqrt(conj(z)) (need to fix branch # cuts first)
Example #30
Source File: test_umath_complex.py From GraphicDesignPatternByPython with MIT License | 4 votes |
def test_special_values(self): # C99: Sec G 6.4.2 check = check_complex_value f = np.sqrt # csqrt(+-0 + 0i) is 0 + 0i check(f, np.PZERO, 0, 0, 0) check(f, np.NZERO, 0, 0, 0) # csqrt(x + infi) is inf + infi for any x (including NaN) check(f, 1, np.inf, np.inf, np.inf) check(f, -1, np.inf, np.inf, np.inf) check(f, np.PZERO, np.inf, np.inf, np.inf) check(f, np.NZERO, np.inf, np.inf, np.inf) check(f, np.inf, np.inf, np.inf, np.inf) check(f, -np.inf, np.inf, np.inf, np.inf) check(f, -np.nan, np.inf, np.inf, np.inf) # csqrt(x + nani) is nan + nani for any finite x check(f, 1, np.nan, np.nan, np.nan) check(f, -1, np.nan, np.nan, np.nan) check(f, 0, np.nan, np.nan, np.nan) # csqrt(-inf + yi) is +0 + infi for any finite y > 0 check(f, -np.inf, 1, np.PZERO, np.inf) # csqrt(inf + yi) is +inf + 0i for any finite y > 0 check(f, np.inf, 1, np.inf, np.PZERO) # csqrt(-inf + nani) is nan +- infi (both +i infi are valid) def _check_ninf_nan(dummy): msgform = "csqrt(-inf, nan) is (%f, %f), expected (nan, +-inf)" z = np.sqrt(np.array(complex(-np.inf, np.nan))) #Fixme: ugly workaround for isinf bug. with np.errstate(invalid='ignore'): if not (np.isnan(z.real) and np.isinf(z.imag)): raise AssertionError(msgform % (z.real, z.imag)) _check_ninf_nan(None) # csqrt(+inf + nani) is inf + nani check(f, np.inf, np.nan, np.inf, np.nan) # csqrt(nan + yi) is nan + nani for any finite y (infinite handled in x # + nani) check(f, np.nan, 0, np.nan, np.nan) check(f, np.nan, 1, np.nan, np.nan) check(f, np.nan, np.nan, np.nan, np.nan) # XXX: check for conj(csqrt(z)) == csqrt(conj(z)) (need to fix branch # cuts first)