我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用numba.boolean()。
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