示例#1
0
 def promote_arrays(self, type1, type2):
     "Promote two array types in an expression to a new array type"
     equal_ndim = type1.ndim == type2.ndim
     return ArrayType(
         self.promote_types(type1.dtype, type2.dtype),
         ndim=miniutils.max((type1.ndim, type2.ndim)),
         is_c_contig=(equal_ndim and type1.is_c_contig and type2.is_c_contig),
         is_f_contig=(equal_ndim and type1.is_f_contig and type2.is_f_contig),
     )
示例#2
0
 def promote_arrays(self, type1, type2):
     "Promote two array types in an expression to a new array type"
     equal_ndim = type1.ndim == type2.ndim
     return ArrayType(self.promote_types(type1.dtype, type2.dtype),
                      ndim=miniutils.max((type1.ndim, type2.ndim)),
                      is_c_contig=(equal_ndim and type1.is_c_contig
                                   and type2.is_c_contig),
                      is_f_contig=(equal_ndim and type1.is_f_contig
                                   and type2.is_f_contig))
示例#3
0
文件: minitypes.py 项目: hfeeki/numba
    def promote_numeric(self, type1, type2):
        "Promote two numeric types"
        type = miniutils.max([type1, type2], key=lambda type: type.rank)
        if type1.kind != type2.kind:
            def itemsize(type):
                return type.itemsize // 2 if type.is_complex else type.itemsize

            size = max(itemsize(type1), itemsize(type2))
            if type.is_complex:
                type = find_type_of_size(size * 2, complextypes)
            elif type.is_float:
                type = find_type_of_size(size, floating)
            else:
                assert type.is_int
                type = find_type_of_size(size, integral)

        return type
示例#4
0
 def promote_numeric(self, type1, type2):
     "Promote two numeric types"
     return miniutils.max([type1, type2], key=lambda type: type.rank)
示例#5
0
 def promote_numeric(self, type1, type2):
     "Promote two numeric types"
     return miniutils.max([type1, type2], key=lambda type: type.rank)