Пример #1
0
 def __lt__(self, other):
     return self._rc(less(self.array, other))
Пример #2
0
            object.__setattr__(self, attr, value)

    # Only called after other approaches fail.
    def __getattr__(self, attr):
        if (attr == 'array'):
            return object.__getattribute__(self, attr)
        return self.array.__getattribute__(attr)


#############################################################
# Test of class container
#############################################################
if __name__ == '__main__':
    temp = reshape(arange(10000), (100, 100))

    ua = container(temp)
    # new object created begin test
    print dir(ua)
    print shape(ua), ua.shape  # I have changed Numeric.py

    ua_small = ua[:3, :5]
    print ua_small
    ua_small[
        0, 0] = 10  # this did not change ua[0,0], which is not normal behavior
    print ua_small[0, 0], ua[0, 0]
    print sin(ua_small) / 3. * 6. + sqrt(ua_small**2)
    print less(ua_small, 103), type(less(ua_small, 103))
    print type(ua_small * reshape(arange(15), shape(ua_small)))
    print reshape(ua_small, (5, 3))
    print transpose(ua_small)
Пример #3
0
            self.array.__setattr__(attr, value)
        except AttributeError:
            object.__setattr__(self, attr, value)

    # Only called after other approaches fail.
    def __getattr__(self,attr):
        if (attr == 'array'):
            return object.__getattribute__(self, attr)
        return self.array.__getattribute__(attr)

#############################################################
# Test of class container
#############################################################
if __name__ == '__main__':
    temp=reshape(arange(10000),(100,100))

    ua=container(temp)
    # new object created begin test
    print dir(ua)
    print shape(ua),ua.shape # I have changed Numeric.py

    ua_small=ua[:3,:5]
    print ua_small
    ua_small[0,0]=10  # this did not change ua[0,0], which is not normal behavior
    print ua_small[0,0],ua[0,0]
    print sin(ua_small)/3.*6.+sqrt(ua_small**2)
    print less(ua_small,103),type(less(ua_small,103))
    print type(ua_small*reshape(arange(15),shape(ua_small)))
    print reshape(ua_small,(5,3))
    print transpose(ua_small)
Пример #4
0
 def __lt__(self,other): return self._rc(less(self.array,other))
 def __le__(self,other): return self._rc(less_equal(self.array,other))
Пример #5
0
 def __lt__(self, other):
     return self._rc(less(self.array, other))