Пример #1
0
def allclose(a, b, rtol=1e-05, atol=1e-08, axis=None):
    '''Return true if all items are equal within given tolerances
    
    Parameters:
    rtol - relative tolerance
    atol - absolute tolerance
    '''
    if axis:
        return _cmps.allTrue(_cmps.almostEqualTo(a, b, rtol, atol), axis)
    else:
        return _cmps.allTrue(_cmps.almostEqualTo(a, b, rtol, atol))
Пример #2
0
def where(condition, x=None, y=None):
    '''Return items from x or y depending on condition'''
    if x and y:
        return _dsutils.select(condition, x, y)
    elif not x and not y:
        return _cmps.nonZero(condition)
    else:
        raise ValueError, "Both x and y must be specified"
Пример #3
0
def logical_and(a, b):
    '''Return true if a != 0 && b != 0, itemwise'''
    return _cmps.logicalAnd(a, b)
Пример #4
0
def less_equal(a, b):
    '''Return true if a <= b, itemwise'''
    return _cmps.lessThanOrEqualTo(a, b)
Пример #5
0
def not_equal(a, b):
    '''Return true if a != b, itemwise'''
    return _cmps.logicalNot(_cmps.equalTo(a, b))
Пример #6
0
def any(a, axis=None): #@ReservedAssignment
    '''Return true if any items are true'''
    if axis:
        return _cmps.anyTrue(a, axis)
    else:
        return _cmps.anyTrue(a)
Пример #7
0
def greater_equal(a, b):
    '''Return true if a >= b, itemwise'''
    return _cmps.greaterThanOrEqualTo(a, b)
Пример #8
0
def isinf(a):
    '''Return true if a is infinite, itemwise'''
    return _cmps.isInfinite(a)
Пример #9
0
def isneginf(a):
    '''Return true if a is negative infinite, itemwise'''
    return _cmps.isNegativeInfinite(a)
Пример #10
0
def logical_and(a, b, out=None):
    '''Return true if a != 0 && b != 0, itemwise'''
    return _cmps.logicalAnd(a, b, out)
Пример #11
0
def logical_or(a, b, out=None):
    '''Return true if a != 0 || b != 0, itemwise'''
    return _cmps.logicalOr(a, b, out)
Пример #12
0
def not_equal(a, b):
    '''Return true if a != b, itemwise'''
    return _cmps.logicalNot(_cmps.equalTo(a, b))
Пример #13
0
def logical_not(a):
    '''Return true if a == 0, itemwise'''
    return _cmps.logicalNot(a)
Пример #14
0
def equal(a, b):
    '''Return true if a == b, itemwise'''
    if a is None or b is None:
        return False
    return _cmps.equalTo(a, b)
Пример #15
0
def less_equal(a, b):
    '''Return true if a <= b, itemwise'''
    return _cmps.lessThanOrEqualTo(a, b)
Пример #16
0
def less(a, b):
    '''Return true if a < b, itemwise'''
    return _cmps.lessThan(a, b)
Пример #17
0
def logical_xor(a, b):
    '''Return true if a != 0 ^ b != 0, itemwise'''
    return _cmps.logicalXor(a, b)
Пример #18
0
def logical_xor(a, b, out=None):
    '''Return true if a != 0 ^ b != 0, itemwise'''
    return _cmps.logicalXor(a, b, out)
Пример #19
0
def greater_equal(a, b):
    '''Return true if a >= b, itemwise'''
    return _cmps.greaterThanOrEqualTo(a, b)
Пример #20
0
def nonzero(a):
    '''Return the indices for items that are non-zero'''
    return _cmps.nonZero(a)
Пример #21
0
def isposinf(a):
    '''Return true if a is positive infinite, itemwise'''
    return _cmps.isPositiveInfinite(a)
Пример #22
0
def isnan(a):
    '''Return true if a is a NaN, itemwise'''
    return _cmps.isNaN(a)
Пример #23
0
def isfinite(a):
    '''Return true if a is not infinite and not a NaN, itemwise'''
    return _cmps.isFinite(a)
Пример #24
0
def isinf(a):
    '''Return true if a is infinite, itemwise'''
    return _cmps.isInfinite(a)
Пример #25
0
def greater(a, b):
    '''Return true if a > b, itemwise'''
    return _cmps.greaterThan(a, b)
Пример #26
0
def isposinf(a):
    '''Return true if a is positive infinite, itemwise'''
    return _cmps.isPositiveInfinite(a)
Пример #27
0
def less(a, b):
    '''Return true if a < b, itemwise'''
    return _cmps.lessThan(a, b)
Пример #28
0
def isneginf(a):
    '''Return true if a is negative infinite, itemwise'''
    return _cmps.isNegativeInfinite(a)
Пример #29
0
def equal(a, b):
    '''Return true if a == b, itemwise'''
    if a is None or b is None:
        return False
    return _cmps.equalTo(a, b)
Пример #30
0
def nonzero(a):
    '''Return the indices for items that are non-zero'''
    return _cmps.nonZero(a)
Пример #31
0
def logical_not(a):
    '''Return true if a == 0, itemwise'''
    return _cmps.logicalNot(a)
Пример #32
0
def any(a, axis=None): #@ReservedAssignment
    '''Return true if any items are true'''
    if axis:
        return _cmps.anyTrue(a, axis)
    else:
        return _cmps.anyTrue(a)
Пример #33
0
def logical_or(a, b):
    '''Return true if a != 0 || b != 0, itemwise'''
    return _cmps.logicalOr(a, b)
Пример #34
0
def isnan(a):
    '''Return true if a is a NaN, itemwise'''
    return _cmps.isNaN(a)
Пример #35
0
def isfinite(a):
    '''Return true if a is not infinite and not a NaN, itemwise'''
    return _cmps.isFinite(a)
Пример #36
0
def greater(a, b):
    '''Return true if a > b, itemwise'''
    return _cmps.greaterThan(a, b)