哇,Python比MatLab快得多 [英] Wow, Python much faster than MatLab

查看:151
本文介绍了哇,Python比MatLab快得多的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


而不是问题,

我的第一个成功故事:


我转换了我的第一个MatLab算法进入Python(使用SciPy),

它不仅运行完美,而且运行速度更快:


MatLab:14毫秒

Python:2毫秒


完成Python的第一步后,

各种小你已经知道的问题,

从MatLab转换成Python似乎是件小事。

(MatLab和Python的最终程序几乎只能是

由评论字符区分;-)

特别是我喜欢:

- 更放松的行为超出了a的上限( 1维)

数组

- 可用的功能更多,比如简单的平均值

- 减少数据类型如果是允许(1字节的布尔值)


感谢所有的帮助,

可能需要一些更多未来,

欢呼,

Stef Mientki

hi All,

instead of questions,
my first success story:

I converted my first MatLab algorithm into Python (using SciPy),
and it not only works perfectly,
but also runs much faster:

MatLab: 14 msec
Python: 2 msec

After taking the first difficult steps into Python,
all kind of small problems as you already know,
it nows seems a piece of cake to convert from MatLab to Python.
(the final programs of MatLab and Python can almost only be
distinguished by the comment character ;-)

Especially I like:
- more relaxed behavior of exceeded the upper limit of a (1-dimensional)
array
- much more functions available, like a simple "mean"
- reducing datatype if it''s allowed (booleans of 1 byte)

thanks for all your help,
probably need some more in the future,
cheers,
Stef Mientki

推荐答案



Stef Mientki写道:

Stef Mientki wrote:

hi全部,


而不是问题,

我的第一个成功故事:


我将我的第一个MatLab算法转换为Python(使用SciPy),

并且它不仅运行完美,

但运行得更快:


MatLab:14毫秒

Python:2毫秒
hi All,

instead of questions,
my first success story:

I converted my first MatLab algorithm into Python (using SciPy),
and it not only works perfectly,
but also runs much faster:

MatLab: 14 msec
Python: 2 msec



对于这么小的时间,我想知道时序比较是否有效。我这样做是不会认为SciPy通常比Matlab要快一个数量级,因为通常使用Matlab进行的任务通常比Matlab要快一些。

For times this small, I wonder if timing comparisons are valid. I do
NOT think SciPy is in general an order of magnitude faster than Matlab
for the task typically performed with Matlab.


>

在迈出第一步困难之后,

你已经知道所有小问题,

它似乎是从MatLab转换为Python的一块蛋糕。

(MatLab和Python的最终程序几乎只能通过评论字符来区分
;-)


特别喜欢:

- 更放松的行为超出了(1维)的上限

阵列
>
After taking the first difficult steps into Python,
all kind of small problems as you already know,
it nows seems a piece of cake to convert from MatLab to Python.
(the final programs of MatLab and Python can almost only be
distinguished by the comment character ;-)

Especially I like:
- more relaxed behavior of exceeded the upper limit of a (1-dimensional)
array



你能解释一下这意味着什么吗?一般来说,我不希望

编程语言放松。关于超出阵列界限。

Could you explain what this means? In general, I don''t want a
programming language to be "relaxed" about exceeding array bounds.


星期五,2006年12月29日19:35:22 -0800,Beliavsky写道:
On Fri, 29 Dec 2006 19:35:22 -0800, Beliavsky wrote:

>特别是我喜欢:
- 更放松的行为超出了(1维)
数组的上限
>Especially I like:
- more relaxed behavior of exceeded the upper limit of a (1-dimensional)
array



你能解释一下这意味着什么吗?一般来说,我不希望

编程语言放松。关于超出数组边界。


Could you explain what this means? In general, I don''t want a
programming language to be "relaxed" about exceeding array bounds.



我不确定SciPy,但标准Python中的列表允许这样:

I''m not sure about SciPy, but lists in standard Python allow this:


>> array = [1,2,3,4]
array [2:50000]
>>array = [1, 2, 3, 4]
array[2:50000]



[3,4]


这通常是一件好事。



-

史蒂文。

[3, 4]

That''s generally a good thing.


--
Steven.



> MatLab:14毫秒
Python:2毫秒
>MatLab: 14 msec
Python: 2 msec



对于这么小的时间,我想知道时序比较是否有效。我这样做是不会认为SciPy通常比Matlab快一个数量级,对于通常使用Matlab执行的任务来说要快得多。


For times this small, I wonder if timing comparisons are valid. I do
NOT think SciPy is in general an order of magnitude faster than Matlab
for the task typically performed with Matlab.



该算法用于实时分析,

这些差异非常重要。

我也是一个典型的表面程序员

(不需要/想知道里面会发生什么),

只是想要完成我的分析,

以及Python有更多可用功能的事实,

意味着我要编写远不那么明确或隐含的循环,

因此我希望它看起来对我来说总是更快。

The algorithm is meant for real-time analysis,
where these kind of differences counts a lot.
I''m also a typical "surface programmer"
(don''t need/want to know what''s going inside),
just want to get my analysis done,
and the fact that Python has much more functions available,
means I''ve to write far less explicit or implicit for loops,
and thus I expect it to "look" faster for me always.


>
>

>在将第一个困难的步骤带入Python之后,
你已经知道的各种小问题,
它现在似乎是一块将MatLab转换为Python的蛋糕。
(MatLab和Python的最终程序几乎只能通过评论字符区分;-)

特别喜欢:
- 更放松的行为超出了(1维)
阵列的上限
>After taking the first difficult steps into Python,
all kind of small problems as you already know,
it nows seems a piece of cake to convert from MatLab to Python.
(the final programs of MatLab and Python can almost only be
distinguished by the comment character ;-)

Especially I like:
- more relaxed behavior of exceeded the upper limit of a (1-dimensional)
array



你能解释一下这意味着什么吗?一般来说,我不希望

编程语言放松。关于超出阵列界限。


Could you explain what this means? In general, I don''t want a
programming language to be "relaxed" about exceeding array bounds.



嗯,我不得不承认,这不是一个非常策略性的评论,噪音。仍是

软件中不需要的问题。

但同时我已经进一步阅读了,我应该用
替换其他一些伟大的事情:

- 非常有效的方式,评论被转化为帮助信息

- (乍一看)非常简单,但却放弃了强大的OOP实现。 />

欢呼,

Stef Mientki

Well, I''ve to admit, that wasn''t a very tactic remark, "noise" is still
an unwanted issue in software.
But in the meanwhile I''ve reading further and I should replace that by
some other great things:
- the very efficient way, comment is turned into help information
- the (at first sight) very easy, but yet quit powerfull OOPs implemetation.

cheers,
Stef Mientki


这篇关于哇,Python比MatLab快得多的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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