Python numpy.core.umath.hypot() Examples

The following are code examples for showing how to use numpy.core.umath.hypot(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: LaserTOF   Author: kyleuckert   File: test_umath.py    MIT License 5 votes vote down vote up
def test_simple(self):
        assert_almost_equal(ncu.hypot(1, 1), ncu.sqrt(2))
        assert_almost_equal(ncu.hypot(0, 0), 0) 
Example 2
Project: LaserTOF   Author: kyleuckert   File: test_umath.py    MIT License 5 votes vote down vote up
def assert_hypot_isnan(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isnan(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not nan" % (x, y, ncu.hypot(x, y))) 
Example 3
Project: LaserTOF   Author: kyleuckert   File: test_umath.py    MIT License 5 votes vote down vote up
def assert_hypot_isinf(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isinf(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not inf" % (x, y, ncu.hypot(x, y))) 
Example 4
Project: LaserTOF   Author: kyleuckert   File: test_umath.py    MIT License 5 votes vote down vote up
def test_no_fpe(self):
        assert_no_warnings(ncu.hypot, np.inf, 0) 
Example 5
Project: FX-RER-Value-Extraction   Author: tsKenneth   File: test_umath.py    MIT License 5 votes vote down vote up
def test_simple(self):
        assert_almost_equal(ncu.hypot(1, 1), ncu.sqrt(2))
        assert_almost_equal(ncu.hypot(0, 0), 0) 
Example 6
Project: FX-RER-Value-Extraction   Author: tsKenneth   File: test_umath.py    MIT License 5 votes vote down vote up
def test_reduce(self):
        assert_almost_equal(ncu.hypot.reduce([3.0, 4.0]), 5.0)
        assert_almost_equal(ncu.hypot.reduce([3.0, 4.0, 0]), 5.0)
        assert_almost_equal(ncu.hypot.reduce([9.0, 12.0, 20.0]), 25.0)
        assert_equal(ncu.hypot.reduce([]), 0.0) 
Example 7
Project: FX-RER-Value-Extraction   Author: tsKenneth   File: test_umath.py    MIT License 5 votes vote down vote up
def assert_hypot_isnan(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isnan(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not nan" % (x, y, ncu.hypot(x, y))) 
Example 8
Project: FX-RER-Value-Extraction   Author: tsKenneth   File: test_umath.py    MIT License 5 votes vote down vote up
def assert_hypot_isinf(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isinf(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not inf" % (x, y, ncu.hypot(x, y))) 
Example 9
Project: FX-RER-Value-Extraction   Author: tsKenneth   File: test_umath.py    MIT License 5 votes vote down vote up
def test_no_fpe(self):
        assert_no_warnings(ncu.hypot, np.inf, 0) 
Example 10
Project: recruit   Author: Frank-qlu   File: test_umath.py    Apache License 2.0 5 votes vote down vote up
def test_simple(self):
        assert_almost_equal(ncu.hypot(1, 1), ncu.sqrt(2))
        assert_almost_equal(ncu.hypot(0, 0), 0) 
Example 11
Project: recruit   Author: Frank-qlu   File: test_umath.py    Apache License 2.0 5 votes vote down vote up
def test_reduce(self):
        assert_almost_equal(ncu.hypot.reduce([3.0, 4.0]), 5.0)
        assert_almost_equal(ncu.hypot.reduce([3.0, 4.0, 0]), 5.0)
        assert_almost_equal(ncu.hypot.reduce([9.0, 12.0, 20.0]), 25.0)
        assert_equal(ncu.hypot.reduce([]), 0.0) 
Example 12
Project: recruit   Author: Frank-qlu   File: test_umath.py    Apache License 2.0 5 votes vote down vote up
def assert_hypot_isnan(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isnan(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not nan" % (x, y, ncu.hypot(x, y))) 
Example 13
Project: recruit   Author: Frank-qlu   File: test_umath.py    Apache License 2.0 5 votes vote down vote up
def assert_hypot_isinf(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isinf(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not inf" % (x, y, ncu.hypot(x, y))) 
Example 14
Project: recruit   Author: Frank-qlu   File: test_umath.py    Apache License 2.0 5 votes vote down vote up
def test_no_fpe(self):
        assert_no_warnings(ncu.hypot, np.inf, 0) 
Example 15
Project: att   Author: Centre-Alt-Rendiment-Esportiu   File: test_umath.py    GNU General Public License v3.0 5 votes vote down vote up
def test_simple(self):
        assert_almost_equal(ncu.hypot(1, 1), ncu.sqrt(2))
        assert_almost_equal(ncu.hypot(0, 0), 0) 
Example 16
Project: att   Author: Centre-Alt-Rendiment-Esportiu   File: test_umath.py    GNU General Public License v3.0 5 votes vote down vote up
def assert_hypot_isnan(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isnan(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not nan" % (x, y, ncu.hypot(x, y))) 
Example 17
Project: att   Author: Centre-Alt-Rendiment-Esportiu   File: test_umath.py    GNU General Public License v3.0 5 votes vote down vote up
def assert_hypot_isinf(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isinf(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not inf" % (x, y, ncu.hypot(x, y))) 
Example 18
Project: att   Author: Centre-Alt-Rendiment-Esportiu   File: test_umath.py    GNU General Public License v3.0 5 votes vote down vote up
def test_no_fpe(self):
        assert_no_warnings(ncu.hypot, np.inf, 0) 
Example 19
Project: FUTU_Stop_Loss   Author: BigtoC   File: test_umath.py    MIT License 5 votes vote down vote up
def test_simple(self):
        assert_almost_equal(ncu.hypot(1, 1), ncu.sqrt(2))
        assert_almost_equal(ncu.hypot(0, 0), 0) 
Example 20
Project: FUTU_Stop_Loss   Author: BigtoC   File: test_umath.py    MIT License 5 votes vote down vote up
def test_reduce(self):
        assert_almost_equal(ncu.hypot.reduce([3.0, 4.0]), 5.0)
        assert_almost_equal(ncu.hypot.reduce([3.0, 4.0, 0]), 5.0)
        assert_almost_equal(ncu.hypot.reduce([9.0, 12.0, 20.0]), 25.0)
        assert_equal(ncu.hypot.reduce([]), 0.0) 
Example 21
Project: FUTU_Stop_Loss   Author: BigtoC   File: test_umath.py    MIT License 5 votes vote down vote up
def assert_hypot_isnan(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isnan(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not nan" % (x, y, ncu.hypot(x, y))) 
Example 22
Project: FUTU_Stop_Loss   Author: BigtoC   File: test_umath.py    MIT License 5 votes vote down vote up
def assert_hypot_isinf(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isinf(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not inf" % (x, y, ncu.hypot(x, y))) 
Example 23
Project: FUTU_Stop_Loss   Author: BigtoC   File: test_umath.py    MIT License 5 votes vote down vote up
def test_no_fpe(self):
        assert_no_warnings(ncu.hypot, np.inf, 0) 
Example 24
Project: MARRtino-2.0   Author: DaniAffCH   File: test_umath.py    GNU General Public License v3.0 5 votes vote down vote up
def test_simple(self):
        assert_almost_equal(ncu.hypot(1, 1), ncu.sqrt(2))
        assert_almost_equal(ncu.hypot(0, 0), 0) 
Example 25
Project: MARRtino-2.0   Author: DaniAffCH   File: test_umath.py    GNU General Public License v3.0 5 votes vote down vote up
def test_reduce(self):
        assert_almost_equal(ncu.hypot.reduce([3.0, 4.0]), 5.0)
        assert_almost_equal(ncu.hypot.reduce([3.0, 4.0, 0]), 5.0)
        assert_almost_equal(ncu.hypot.reduce([9.0, 12.0, 20.0]), 25.0)
        assert_equal(ncu.hypot.reduce([]), 0.0) 
Example 26
Project: MARRtino-2.0   Author: DaniAffCH   File: test_umath.py    GNU General Public License v3.0 5 votes vote down vote up
def assert_hypot_isnan(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isnan(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not nan" % (x, y, ncu.hypot(x, y))) 
Example 27
Project: MARRtino-2.0   Author: DaniAffCH   File: test_umath.py    GNU General Public License v3.0 5 votes vote down vote up
def assert_hypot_isinf(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isinf(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not inf" % (x, y, ncu.hypot(x, y))) 
Example 28
Project: MARRtino-2.0   Author: DaniAffCH   File: test_umath.py    GNU General Public License v3.0 5 votes vote down vote up
def test_no_fpe(self):
        assert_no_warnings(ncu.hypot, np.inf, 0) 
Example 29
Project: auto-alt-text-lambda-api   Author: abhisuri97   File: test_umath.py    MIT License 5 votes vote down vote up
def test_simple(self):
        assert_almost_equal(ncu.hypot(1, 1), ncu.sqrt(2))
        assert_almost_equal(ncu.hypot(0, 0), 0) 
Example 30
Project: auto-alt-text-lambda-api   Author: abhisuri97   File: test_umath.py    MIT License 5 votes vote down vote up
def assert_hypot_isnan(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isnan(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not nan" % (x, y, ncu.hypot(x, y))) 
Example 31
Project: auto-alt-text-lambda-api   Author: abhisuri97   File: test_umath.py    MIT License 5 votes vote down vote up
def assert_hypot_isinf(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isinf(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not inf" % (x, y, ncu.hypot(x, y))) 
Example 32
Project: auto-alt-text-lambda-api   Author: abhisuri97   File: test_umath.py    MIT License 5 votes vote down vote up
def test_no_fpe(self):
        assert_no_warnings(ncu.hypot, np.inf, 0) 
Example 33
Project: vnpy_crypto   Author: birforce   File: test_umath.py    MIT License 5 votes vote down vote up
def test_simple(self):
        assert_almost_equal(ncu.hypot(1, 1), ncu.sqrt(2))
        assert_almost_equal(ncu.hypot(0, 0), 0) 
Example 34
Project: vnpy_crypto   Author: birforce   File: test_umath.py    MIT License 5 votes vote down vote up
def test_reduce(self):
        assert_almost_equal(ncu.hypot.reduce([3.0, 4.0]), 5.0)
        assert_almost_equal(ncu.hypot.reduce([3.0, 4.0, 0]), 5.0)
        assert_almost_equal(ncu.hypot.reduce([9.0, 12.0, 20.0]), 25.0)
        assert_equal(ncu.hypot.reduce([]), 0.0) 
Example 35
Project: vnpy_crypto   Author: birforce   File: test_umath.py    MIT License 5 votes vote down vote up
def assert_hypot_isnan(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isnan(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not nan" % (x, y, ncu.hypot(x, y))) 
Example 36
Project: vnpy_crypto   Author: birforce   File: test_umath.py    MIT License 5 votes vote down vote up
def assert_hypot_isinf(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isinf(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not inf" % (x, y, ncu.hypot(x, y))) 
Example 37
Project: vnpy_crypto   Author: birforce   File: test_umath.py    MIT License 5 votes vote down vote up
def test_no_fpe(self):
        assert_no_warnings(ncu.hypot, np.inf, 0) 
Example 38
Project: ble5-nrf52-mac   Author: tomasero   File: test_umath.py    MIT License 5 votes vote down vote up
def test_simple(self):
        assert_almost_equal(ncu.hypot(1, 1), ncu.sqrt(2))
        assert_almost_equal(ncu.hypot(0, 0), 0) 
Example 39
Project: ble5-nrf52-mac   Author: tomasero   File: test_umath.py    MIT License 5 votes vote down vote up
def test_reduce(self):
        assert_almost_equal(ncu.hypot.reduce([3.0, 4.0]), 5.0)
        assert_almost_equal(ncu.hypot.reduce([3.0, 4.0, 0]), 5.0)
        assert_almost_equal(ncu.hypot.reduce([9.0, 12.0, 20.0]), 25.0)
        assert_equal(ncu.hypot.reduce([]), 0.0) 
Example 40
Project: ble5-nrf52-mac   Author: tomasero   File: test_umath.py    MIT License 5 votes vote down vote up
def assert_hypot_isnan(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isnan(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not nan" % (x, y, ncu.hypot(x, y))) 
Example 41
Project: ble5-nrf52-mac   Author: tomasero   File: test_umath.py    MIT License 5 votes vote down vote up
def assert_hypot_isinf(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isinf(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not inf" % (x, y, ncu.hypot(x, y))) 
Example 42
Project: ble5-nrf52-mac   Author: tomasero   File: test_umath.py    MIT License 5 votes vote down vote up
def test_no_fpe(self):
        assert_no_warnings(ncu.hypot, np.inf, 0) 
Example 43
Project: Computable   Author: ktraunmueller   File: test_umath.py    MIT License 5 votes vote down vote up
def test_simple(self):
        assert_almost_equal(ncu.hypot(1, 1), ncu.sqrt(2))
        assert_almost_equal(ncu.hypot(0, 0), 0) 
Example 44
Project: Computable   Author: ktraunmueller   File: test_umath.py    MIT License 5 votes vote down vote up
def assert_hypot_isnan(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isnan(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not nan" % (x, y, ncu.hypot(x, y))) 
Example 45
Project: Computable   Author: ktraunmueller   File: test_umath.py    MIT License 5 votes vote down vote up
def assert_hypot_isinf(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isinf(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not inf" % (x, y, ncu.hypot(x, y))) 
Example 46
Project: poker   Author: surgebiswas   File: test_umath.py    MIT License 5 votes vote down vote up
def test_simple(self):
        assert_almost_equal(ncu.hypot(1, 1), ncu.sqrt(2))
        assert_almost_equal(ncu.hypot(0, 0), 0) 
Example 47
Project: poker   Author: surgebiswas   File: test_umath.py    MIT License 5 votes vote down vote up
def assert_hypot_isnan(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isnan(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not nan" % (x, y, ncu.hypot(x, y))) 
Example 48
Project: poker   Author: surgebiswas   File: test_umath.py    MIT License 5 votes vote down vote up
def assert_hypot_isinf(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isinf(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not inf" % (x, y, ncu.hypot(x, y))) 
Example 49
Project: poker   Author: surgebiswas   File: test_umath.py    MIT License 5 votes vote down vote up
def test_no_fpe(self):
        assert_no_warnings(ncu.hypot, np.inf, 0) 
Example 50
Project: P3_image_processing   Author: latedude2   File: test_umath.py    MIT License 5 votes vote down vote up
def test_simple(self):
        assert_almost_equal(ncu.hypot(1, 1), ncu.sqrt(2))
        assert_almost_equal(ncu.hypot(0, 0), 0) 
Example 51
Project: P3_image_processing   Author: latedude2   File: test_umath.py    MIT License 5 votes vote down vote up
def test_reduce(self):
        assert_almost_equal(ncu.hypot.reduce([3.0, 4.0]), 5.0)
        assert_almost_equal(ncu.hypot.reduce([3.0, 4.0, 0]), 5.0)
        assert_almost_equal(ncu.hypot.reduce([9.0, 12.0, 20.0]), 25.0)
        assert_equal(ncu.hypot.reduce([]), 0.0) 
Example 52
Project: P3_image_processing   Author: latedude2   File: test_umath.py    MIT License 5 votes vote down vote up
def assert_hypot_isnan(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isnan(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not nan" % (x, y, ncu.hypot(x, y))) 
Example 53
Project: P3_image_processing   Author: latedude2   File: test_umath.py    MIT License 5 votes vote down vote up
def assert_hypot_isinf(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isinf(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not inf" % (x, y, ncu.hypot(x, y))) 
Example 54
Project: P3_image_processing   Author: latedude2   File: test_umath.py    MIT License 5 votes vote down vote up
def test_no_fpe(self):
        assert_no_warnings(ncu.hypot, np.inf, 0) 
Example 55
Project: GraphicDesignPatternByPython   Author: Relph1119   File: test_umath.py    MIT License 5 votes vote down vote up
def test_simple(self):
        assert_almost_equal(ncu.hypot(1, 1), ncu.sqrt(2))
        assert_almost_equal(ncu.hypot(0, 0), 0) 
Example 56
Project: GraphicDesignPatternByPython   Author: Relph1119   File: test_umath.py    MIT License 5 votes vote down vote up
def test_reduce(self):
        assert_almost_equal(ncu.hypot.reduce([3.0, 4.0]), 5.0)
        assert_almost_equal(ncu.hypot.reduce([3.0, 4.0, 0]), 5.0)
        assert_almost_equal(ncu.hypot.reduce([9.0, 12.0, 20.0]), 25.0)
        assert_equal(ncu.hypot.reduce([]), 0.0) 
Example 57
Project: GraphicDesignPatternByPython   Author: Relph1119   File: test_umath.py    MIT License 5 votes vote down vote up
def assert_hypot_isnan(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isnan(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not nan" % (x, y, ncu.hypot(x, y))) 
Example 58
Project: GraphicDesignPatternByPython   Author: Relph1119   File: test_umath.py    MIT License 5 votes vote down vote up
def assert_hypot_isinf(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isinf(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not inf" % (x, y, ncu.hypot(x, y))) 
Example 59
Project: GraphicDesignPatternByPython   Author: Relph1119   File: test_umath.py    MIT License 5 votes vote down vote up
def test_no_fpe(self):
        assert_no_warnings(ncu.hypot, np.inf, 0) 
Example 60
Project: 3dprinteros-client   Author: panasevychol   File: test_umath.py    GNU Affero General Public License v3.0 5 votes vote down vote up
def test_simple(self):
        assert_almost_equal(ncu.hypot(1, 1), ncu.sqrt(2))
        assert_almost_equal(ncu.hypot(0, 0), 0) 
Example 61
Project: 3dprinteros-client   Author: panasevychol   File: test_umath.py    GNU Affero General Public License v3.0 5 votes vote down vote up
def assert_hypot_isnan(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isnan(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not nan" % (x, y, ncu.hypot(x, y))) 
Example 62
Project: 3dprinteros-client   Author: panasevychol   File: test_umath.py    GNU Affero General Public License v3.0 5 votes vote down vote up
def assert_hypot_isinf(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isinf(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not inf" % (x, y, ncu.hypot(x, y))) 
Example 63
Project: 3dprinteros-client   Author: panasevychol   File: test_umath.py    GNU Affero General Public License v3.0 5 votes vote down vote up
def test_no_fpe(self):
        assert_no_warnings(ncu.hypot, np.inf, 0) 
Example 64
Project: 3dprinteros-client   Author: panasevychol   File: test_umath.py    GNU Affero General Public License v3.0 5 votes vote down vote up
def test_simple(self):
        assert_almost_equal(ncu.hypot(1, 1), ncu.sqrt(2))
        assert_almost_equal(ncu.hypot(0, 0), 0) 
Example 65
Project: 3dprinteros-client   Author: panasevychol   File: test_umath.py    GNU Affero General Public License v3.0 5 votes vote down vote up
def assert_hypot_isinf(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isinf(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not inf" % (x, y, ncu.hypot(x, y))) 
Example 66
Project: 3dprinteros-client   Author: panasevychol   File: test_umath.py    GNU Affero General Public License v3.0 5 votes vote down vote up
def test_no_fpe(self):
        assert_no_warnings(ncu.hypot, np.inf, 0) 
Example 67
Project: predictive-maintenance-using-machine-learning   Author: awslabs   File: test_umath.py    Apache License 2.0 5 votes vote down vote up
def test_simple(self):
        assert_almost_equal(ncu.hypot(1, 1), ncu.sqrt(2))
        assert_almost_equal(ncu.hypot(0, 0), 0) 
Example 68
Project: predictive-maintenance-using-machine-learning   Author: awslabs   File: test_umath.py    Apache License 2.0 5 votes vote down vote up
def test_reduce(self):
        assert_almost_equal(ncu.hypot.reduce([3.0, 4.0]), 5.0)
        assert_almost_equal(ncu.hypot.reduce([3.0, 4.0, 0]), 5.0)
        assert_almost_equal(ncu.hypot.reduce([9.0, 12.0, 20.0]), 25.0)
        assert_equal(ncu.hypot.reduce([]), 0.0) 
Example 69
Project: predictive-maintenance-using-machine-learning   Author: awslabs   File: test_umath.py    Apache License 2.0 5 votes vote down vote up
def assert_hypot_isnan(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isnan(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not nan" % (x, y, ncu.hypot(x, y))) 
Example 70
Project: predictive-maintenance-using-machine-learning   Author: awslabs   File: test_umath.py    Apache License 2.0 5 votes vote down vote up
def assert_hypot_isinf(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isinf(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not inf" % (x, y, ncu.hypot(x, y))) 
Example 71
Project: predictive-maintenance-using-machine-learning   Author: awslabs   File: test_umath.py    Apache License 2.0 5 votes vote down vote up
def test_no_fpe(self):
        assert_no_warnings(ncu.hypot, np.inf, 0) 
Example 72
Project: fund   Author: Frank-qlu   File: test_umath.py    Apache License 2.0 5 votes vote down vote up
def test_simple(self):
        assert_almost_equal(ncu.hypot(1, 1), ncu.sqrt(2))
        assert_almost_equal(ncu.hypot(0, 0), 0) 
Example 73
Project: fund   Author: Frank-qlu   File: test_umath.py    Apache License 2.0 5 votes vote down vote up
def test_reduce(self):
        assert_almost_equal(ncu.hypot.reduce([3.0, 4.0]), 5.0)
        assert_almost_equal(ncu.hypot.reduce([3.0, 4.0, 0]), 5.0)
        assert_almost_equal(ncu.hypot.reduce([9.0, 12.0, 20.0]), 25.0)
        assert_equal(ncu.hypot.reduce([]), 0.0) 
Example 74
Project: fund   Author: Frank-qlu   File: test_umath.py    Apache License 2.0 5 votes vote down vote up
def assert_hypot_isnan(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isnan(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not nan" % (x, y, ncu.hypot(x, y))) 
Example 75
Project: fund   Author: Frank-qlu   File: test_umath.py    Apache License 2.0 5 votes vote down vote up
def assert_hypot_isinf(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isinf(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not inf" % (x, y, ncu.hypot(x, y))) 
Example 76
Project: fund   Author: Frank-qlu   File: test_umath.py    Apache License 2.0 5 votes vote down vote up
def test_no_fpe(self):
        assert_no_warnings(ncu.hypot, np.inf, 0) 
Example 77
Project: pySINDy   Author: luckystarufo   File: test_umath.py    MIT License 5 votes vote down vote up
def test_simple(self):
        assert_almost_equal(ncu.hypot(1, 1), ncu.sqrt(2))
        assert_almost_equal(ncu.hypot(0, 0), 0) 
Example 78
Project: pySINDy   Author: luckystarufo   File: test_umath.py    MIT License 5 votes vote down vote up
def test_reduce(self):
        assert_almost_equal(ncu.hypot.reduce([3.0, 4.0]), 5.0)
        assert_almost_equal(ncu.hypot.reduce([3.0, 4.0, 0]), 5.0)
        assert_almost_equal(ncu.hypot.reduce([9.0, 12.0, 20.0]), 25.0)
        assert_equal(ncu.hypot.reduce([]), 0.0) 
Example 79
Project: pySINDy   Author: luckystarufo   File: test_umath.py    MIT License 5 votes vote down vote up
def assert_hypot_isnan(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isnan(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not nan" % (x, y, ncu.hypot(x, y))) 
Example 80
Project: pySINDy   Author: luckystarufo   File: test_umath.py    MIT License 5 votes vote down vote up
def assert_hypot_isinf(x, y):
    with np.errstate(invalid='ignore'):
        assert_(np.isinf(ncu.hypot(x, y)),
                "hypot(%s, %s) is %s, not inf" % (x, y, ncu.hypot(x, y)))