• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python six.iteritems函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python six.izip函数代码示例发布时间:2022-05-27
下一篇:
Python six.callable函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap