当前位置: 首页>>代码示例>>Python>>正文


Python numba.boolean方法代码示例

本文整理汇总了Python中numba.boolean方法的典型用法代码示例。如果您正苦于以下问题:Python numba.boolean方法的具体用法?Python numba.boolean怎么用?Python numba.boolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在numba的用法示例。


在下文中一共展示了numba.boolean方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _jit_give_bond_array

# 需要导入模块: import numba [as 别名]
# 或者: from numba import boolean [as 别名]
def _jit_give_bond_array(pos, bond_radii, self_bonding_allowed=False):
        """Calculate a boolean array where ``A[i,j] is True`` indicates a
        bond between the i-th and j-th atom.
        """
        n = pos.shape[0]
        bond_array = np.empty((n, n), dtype=nb.boolean)

        for i in range(n):
            for j in range(i, n):
                D = 0
                for h in range(3):
                    D += (pos[i, h] - pos[j, h])**2
                B = (bond_radii[i] + bond_radii[j])**2
                bond_array[i, j] = (B - D) >= 0
                bond_array[j, i] = bond_array[i, j]
        if not self_bonding_allowed:
            for i in range(n):
                bond_array[i, i] = False
        return bond_array 
开发者ID:mcocdawc,项目名称:chemcoord,代码行数:21,代码来源:_cartesian_class_core.py

示例2: transform_lists_to_arrays

# 需要导入模块: import numba [as 别名]
# 或者: from numba import boolean [as 别名]
def transform_lists_to_arrays(module, to_change, __funcs, vec=False, cache_blacklist=set([])):
    if vec:
        conv_fun = numba.vectorize
        extra_args = extra_args_vec
    else:
        conv_fun = numba.njit
        extra_args = extra_args_std
    for s in to_change:
        func = s.split('.')[-1]
        mod = '.'.join(s.split('.')[:-1])
        fake_mod = __funcs[mod]

        try:
            real_mod = getattr(module, mod)
        except:
            real_mod = module
            for s in mod.split('.'):
                real_mod = getattr(real_mod, s)

        orig_func = getattr(real_mod, func)
        source = inspect.getsource(orig_func)
        source = remove_for_numba(source) # do before anything else
        source = return_value_numpy(source)
        source = re.sub(list_mult_expr, numpy_not_list_expr, source)
#        if 'longitude_obliquity_nutation' in s:
#        print(source)
        numba_exec_cacheable(source, fake_mod.__dict__, fake_mod.__dict__)
        new_func = fake_mod.__dict__[func]
        do_cache = caching and func not in cache_blacklist
        obj = conv_fun(cache=do_cache, **extra_args)(new_func)
        __funcs[func] = obj
        fake_mod.__dict__[func] = obj
        obj.__doc__ = ''


#set_signatures = {'Clamond': [numba.float64(numba.float64, numba.float64, numba.boolean),
#                              numba.float64(numba.float64, numba.float64, numba.optional(numba.boolean))
#                              ]
#                    } 
开发者ID:CalebBell,项目名称:fluids,代码行数:41,代码来源:numba.py


注:本文中的numba.boolean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。