Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5a7f5ce

Browse files
committed
correct some mistakes
1 parent efc49c2 commit 5a7f5ce

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

‎1.Setting-up/What_is_NumPy.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<!-- TOC -->
22

3-
- [NumPy 是什么?](#numpy-%E6%98%AF%E4%BB%80%E4%B9%88%EF%BC%9F)
3+
- [NumPy 是什么?](#numpy-%E6%98%AF%E4%BB%80%E4%B9%88)
44

55
<!-- /TOC -->
6+
67
# NumPy 是什么?
78

89
> 原文:[What is NumPy?](http://docs.scipy.org/doc/numpy-dev/user/whatisnumpy.html)
@@ -26,15 +27,15 @@ for i in range(len(a)):
2627

2728
这就产生了正确的答案,但如果 a 和 b 都含有数以百万计的数字,我们将为Python的低效循环付出代价。我们可以这样以C语言编写代码来完成同样的任务(为清楚起见我们忽略变量声明和初始化、内存分配等):
2829

29-
```python
30+
```C
3031
for (i = 0; i < rows; i++): {
3132
c[i] = a[i]*b[i];
3233
}
3334
```
3435

3536
这节省了所有涉及解释Python代码和操作Python对象的开销,但没有了使用Python编码的优势。此外,编码所需的工作量随数据维数的增加而增加。例如对于一个二维数组,C代码(像上面一样简写)会扩展为:
3637

37-
```python
38+
```C
3839
for (i = 0; i < rows; i++): {
3940
for (j = 0; j < columns; j++): {
4041
c[i][j] = a[i][j]*b[i][j];

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /