是否有一个相当于在python MATLAB函数bsxfun? [英] Is there an equivalent to the MATLAB function bsxfun in python?

查看:2175
本文介绍了是否有一个相当于在python MATLAB函数bsxfun?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想一些端口从MATLAB我的code到蟒蛇,和它的一些使用bsxfun()函数的虚拟复制其次是乘除(我还用它进行逻辑运算)。我希望能够做到这一点没有乘以或除以以节省内存和时间之前实际复制的载体(无论是与函数或具有某种对角矩阵的)。

I'm trying to port some of my code from matlab to python, and some of it uses the bsxfun() function for virtual replication followed by multiplication or division (I also use it for logical operations). I'd like to be able to do this without actually replicating the vector (either with a function or with some kind of diagonal matrix) before multiplying or dividing to save on memory and time.

如果有一个在某种形式的C库bsxfun的等效,这将当然也工作。

If there's an equivalent of bsxfun in a C library of some kind, that would of course also work.

推荐答案

要明确地回答这个问题:使用 numpy的看看教程通过DSM建议。

To explicitly answer the question: use numpy and look at the tutorial suggested by DSM.

这篇关于是否有一个相当于在python MATLAB函数bsxfun?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆