We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent efc49c2 commit 5a7f5ceCopy full SHA for 5a7f5ce
1.Setting-up/What_is_NumPy.md
@@ -1,8 +1,9 @@
1
<!-- TOC -->
2
3
-- [NumPy 是什么?](#numpy-%E6%98%AF%E4%BB%80%E4%B9%88%EF%BC%9F)
+- [NumPy 是什么?](#numpy-%E6%98%AF%E4%BB%80%E4%B9%88)
4
5
<!-- /TOC -->
6
+
7
# NumPy 是什么?
8
9
> 原文:[What is NumPy?](http://docs.scipy.org/doc/numpy-dev/user/whatisnumpy.html)
@@ -26,15 +27,15 @@ for i in range(len(a)):
26
27
28
这就产生了正确的答案,但如果 a 和 b 都含有数以百万计的数字,我们将为Python的低效循环付出代价。我们可以这样以C语言编写代码来完成同样的任务(为清楚起见我们忽略变量声明和初始化、内存分配等):
29
-```python
30
+```C
31
for (i = 0; i < rows; i++): {
32
c[i] = a[i]*b[i];
33
}
34
```
35
36
这节省了所有涉及解释Python代码和操作Python对象的开销,但没有了使用Python编码的优势。此外,编码所需的工作量随数据维数的增加而增加。例如对于一个二维数组,C代码(像上面一样简写)会扩展为:
37
38
39
40
for (j = 0; j < columns; j++): {
41
c[i][j] = a[i][j]*b[i][j];
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments