本文整理汇总了Python中scipy._lib.six.iteritems函数的典型用法代码示例。如果您正苦于以下问题:Python iteritems函数的具体用法?Python iteritems怎么用?Python iteritems使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了iteritems函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __truediv__
def __truediv__(self, other):
if isscalarlike(other):
res_dtype = upcast_scalar(self.dtype, other)
new = dok_matrix(self.shape, dtype=res_dtype)
dict.update(new, ((k, v / other) for k, v in iteritems(self)))
return new
return self.tocsr() / other
开发者ID:BranYang,项目名称:scipy,代码行数:7,代码来源:dok.py
示例2: conjtransp
def conjtransp(self):
"""Return the conjugate transpose."""
M, N = self.shape
new = dok_matrix((N, M), dtype=self.dtype)
dict.update(new, (((right, left), np.conj(val))
for (left, right), val in iteritems(self)))
return new
开发者ID:BranYang,项目名称:scipy,代码行数:7,代码来源:dok.py
示例3: _mul_scalar
def _mul_scalar(self, other):
res_dtype = upcast_scalar(self.dtype, other)
# Multiply this scalar by every element.
new = dok_matrix(self.shape, dtype=res_dtype)
for (key, val) in iteritems(self):
new[key] = val * other
return new
开发者ID:7924102,项目名称:scipy,代码行数:7,代码来源:dok.py
示例4: _mul_multivector
def _mul_multivector(self, other):
# matrix * multivector
result_shape = (self.shape[0], other.shape[1])
result_dtype = upcast(self.dtype, other.dtype)
result = np.zeros(result_shape, dtype=result_dtype)
for (i, j), v in iteritems(self):
result[i,:] += v * other[j,:]
return result
开发者ID:BranYang,项目名称:scipy,代码行数:8,代码来源:dok.py
示例5: conjtransp
def conjtransp(self):
""" Return the conjugate transpose
"""
M, N = self.shape
new = dok_matrix((N, M), dtype=self.dtype)
for key, value in iteritems(self):
new[key[1], key[0]] = np.conj(value)
return new
开发者ID:7924102,项目名称:scipy,代码行数:8,代码来源:dok.py
示例6: transpose
def transpose(self):
""" Return the transpose
"""
M, N = self.shape
new = dok_matrix((N, M), dtype=self.dtype)
for key, value in iteritems(self):
new[key[1], key[0]] = value
return new
开发者ID:7924102,项目名称:scipy,代码行数:8,代码来源:dok.py
示例7: __itruediv__
def __itruediv__(self, other):
if isscalarlike(other):
# Multiply this scalar by every element.
for (key, val) in iteritems(self):
self[key] = val / other
return self
else:
return NotImplemented
开发者ID:7924102,项目名称:scipy,代码行数:8,代码来源:dok.py
示例8: _mul_multivector
def _mul_multivector(self, other):
# matrix * multivector
M,N = self.shape
n_vecs = other.shape[1] # number of column vectors
result = np.zeros((M,n_vecs), dtype=upcast(self.dtype,other.dtype))
for (i,j),v in iteritems(self):
result[i,:] += v * other[j,:]
return result
开发者ID:7924102,项目名称:scipy,代码行数:8,代码来源:dok.py
示例9: __imul__
def __imul__(self, other):
if isscalarlike(other):
# Multiply this scalar by every element.
for (key, val) in iteritems(self):
self[key] = val * other
# new.dtype.char = self.dtype.char
return self
else:
return NotImplemented
开发者ID:7924102,项目名称:scipy,代码行数:9,代码来源:dok.py
示例10: transpose
def transpose(self, axes=None, copy=False):
if axes is not None:
raise ValueError("Sparse matrices do not support "
"an 'axes' parameter because swapping "
"dimensions is the only logical permutation.")
M, N = self.shape
new = dok_matrix((N, M), dtype=self.dtype, copy=copy)
dict.update(new, (((right, left), val)
for (left, right), val in iteritems(self)))
return new
开发者ID:BranYang,项目名称:scipy,代码行数:11,代码来源:dok.py
示例11: __truediv__
def __truediv__(self, other):
if isscalarlike(other):
res_dtype = upcast_scalar(self.dtype, other)
new = dok_matrix(self.shape, dtype=res_dtype)
# Multiply this scalar by every element.
for (key, val) in iteritems(self):
new[key] = val / other
# new.dtype.char = self.dtype.char
return new
else:
return self.tocsr() / other
开发者ID:7924102,项目名称:scipy,代码行数:11,代码来源:dok.py
示例12: transpose
def transpose(self, axes=None, copy=False):
if axes is not None:
raise ValueError(("Sparse matrices do not support "
"an 'axes' parameter because swapping "
"dimensions is the only logical permutation."))
M, N = self.shape
new = dok_matrix((N, M), dtype=self.dtype, copy=copy)
for key, value in iteritems(self):
new[key[1], key[0]] = value
return new
开发者ID:Brucechen13,项目名称:scipy,代码行数:13,代码来源:dok.py
示例13: __itruediv__
def __itruediv__(self, other):
if isscalarlike(other):
dict.update(self, ((k, v / other) for k, v in iteritems(self)))
return self
return NotImplemented
开发者ID:BranYang,项目名称:scipy,代码行数:5,代码来源:dok.py
示例14: _mul_vector
def _mul_vector(self, other):
# matrix * vector
result = np.zeros(self.shape[0], dtype=upcast(self.dtype, other.dtype))
for (i, j), v in iteritems(self):
result[i] += v * other[j]
return result
开发者ID:BranYang,项目名称:scipy,代码行数:6,代码来源:dok.py
示例15: _mul_scalar
def _mul_scalar(self, other):
res_dtype = upcast_scalar(self.dtype, other)
# Multiply this scalar by every element.
new = dok_matrix(self.shape, dtype=res_dtype)
dict.update(new, ((k, v * other) for k, v in iteritems(self)))
return new
开发者ID:BranYang,项目名称:scipy,代码行数:6,代码来源:dok.py
注:本文中的scipy._lib.six.iteritems函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论