我是靠谱客的博主 霸气酒窝,这篇文章主要介绍python integer_Python numpy.integer() 使用实例,现在分享给大家,希望可以做个参考。

The following are code examples for showing how to use . They are extracted from open source Python projects. You can vote up the examples you like or vote down the exmaples you don’t like. You can also save this page to your account.

Example 1

def pack_samples(self, samples, dtype=None):

"""Pack samples into one integer per sample

Store one sample in a single integer instead of a list of

integers with length `len(self.nsoutdims)`. Example:

>>> p = pauli_mpp(nr_sites=2, local_dim=2)

>>> p.outdims

(6, 6)

>>> p.pack_samples(np.array([[0, 1], [1, 0], [1, 2], [5, 5]]))

array([ 1, 6, 8, 35])

"""

assert samples.ndim == 2

assert samples.shape[1] == len(self.nsoutdims)

samples = np.ravel_multi_index(samples.T, self.nsoutdims)

if dtyp

最后

以上就是霸气酒窝最近收集整理的关于python integer_Python numpy.integer() 使用实例的全部内容,更多相关python内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(47)

评论列表共有 0 条评论

立即
投稿
返回
顶部