我正在做一些性能分析,我想知道,当数据类型已知(双精度)时,numpy是否会对其标准数组操作进行矢量化.

a, b = (some numpy arrays)
c = a + b #Is this vectorized?

编辑:

推荐答案

是的.

/*
 * This file is for the definitions of simd vectorized operations.
 *
 * Currently contains sse2 functions that are built on amd64, x32 or
 * non-generic builds (CFLAGS=-march=...)
 * In future it may contain other instruction sets like AVX or NEON     detected
 * at runtime in which case it needs to be included indirectly via a file
 * compiled with special options (or use gcc target attributes) so the binary
 * stays portable.
 */

链接:Numpy simd.inc.src on github.

Python-3.x相关问答推荐

在Python中从mySQL获取多行

Paramiko SFTPClient get()和put()函数的通过/失败结果?

如何定义既允许固定单词又允许模式的pydanti.BaseModel?

requests.exceptions.InvalidSchema:未找到连接适配器.我试图遍历一个列表

在 pytest 中,如何测试 sys.exit('some error message')?

如何使用复选按钮更改 Pyplot 轴的属性?

考虑到Pandas 系列中的不同索引,如何正确估计两列的百分比变化? Python相关

有没有办法使用重采样矢量化添加缺失的月份?

如何在 on_ready 事件中使用 change_presence? (discord.py)

如何在数据['column']中的'string'等条件下应用pandas

python用户输入5个偶数并打印最大的

在气流中运行 DAG 时出现处理信号:ttou消息

命名元组内命名元组的 Python 语法

如何使用pandas python获取数据框中每列的最大长度

Python中的依赖倒置

如何使用 asyncio 添加连接超时?

Python 3.5:async with导致 SyntaxError.为什么?

根据条件过滤元组列表

Pyodbc:登录超时错误

Python 3中星型导入的函数形式是什么