예제 #1
0
파일: test_dtypes.py 프로젝트: charred/pypy
    def test_int32(self):
        import sys
        import numpypy as numpy

        x = numpy.int32(23)
        assert x == 23
        assert numpy.int32(2147483647) == 2147483647
        assert numpy.int32('2147483647') == 2147483647
        if sys.maxint > 2 ** 31 - 1:
            assert numpy.int32(2147483648) == -2147483648
            assert numpy.int32('2147483648') == -2147483648
        else:
            raises(OverflowError, numpy.int32, 2147483648)
            raises(OverflowError, numpy.int32, '2147483648')
        assert numpy.dtype('int32') is numpy.dtype(numpy.int32)
예제 #2
0
파일: tsp.py 프로젝트: M4573R/algo2
def get_value(s):
    v = np.int32(0)
    for i in s:
        if i == 0: continue
        v = v | 1 << (i-1)
    return v
예제 #3
0
파일: tsp.py 프로젝트: M4573R/algo2
def get_value_without_v(s,skip):
    v = np.int32(0)
    for i in s:
        if i ==0 or i == skip:continue
        v = v | 1 << (i-1)
    return v