本文整理汇总了Python中sympy.physics.quantum.matrixutils.matrix_zeros函数的典型用法代码示例。如果您正苦于以下问题:Python matrix_zeros函数的具体用法?Python matrix_zeros怎么用?Python matrix_zeros使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了matrix_zeros函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_matrix_zeros_scipy
def test_matrix_zeros_scipy():
if not np:
skip("numpy not installed or Python too old.")
if not scipy:
skip("scipy not installed.")
sci = matrix_zeros(4, 4, format='scipy.sparse')
assert isinstance(sci, scipy_sparse_matrix)
示例2: _represent_NumberOp
def _represent_NumberOp(self, basis, **options):
ndim_info = options.get('ndim', 4)
format = options.get('format', 'sympy')
spmatrix = options.get('spmatrix', 'csr')
matrix = matrix_zeros(ndim_info, ndim_info, **options)
for i in range(ndim_info):
value = i + Integer(1)/Integer(2)
if format == 'scipy.sparse':
value = float(value)
matrix[i,i] = value
if format == 'scipy.sparse':
matrix = matrix.tocsr()
return hbar*omega*matrix
示例3: test_matrix_zeros_numpy
def test_matrix_zeros_numpy():
if not np:
skip("numpy not installed or Python too old.")
num = matrix_zeros(4, 4, format='numpy')
assert isinstance(num, numpy_ndarray)
示例4: test_matrix_zeros_sympy
def test_matrix_zeros_sympy():
sym = matrix_zeros(4, 4, format='sympy')
assert isinstance(sym, Matrix)