当前位置:网站首页>01 numpy introduction
01 numpy introduction
2022-07-01 08:14:00 【Lazy smile】
What is? NumPy(Numerical Python)
NumPy yes Python The basic package of scientific computing in , It's a Python library , Provide multidimensional array objects , Various derived objects ( Such as mask array and matrix ), And various methods for fast array operation API, Include mathematics 、 Logic 、 Shape operation 、 Sort 、 choice 、 Input and output 、 Discrete Fourier transform 、 Basic linear algebra , Basic statistical operations and stochastic simulation etc. .NumPy Fully support object-oriented Methods .
NumPy The forerunner of Numeric The first is the Jim Hugunin Developed with other collaborators ,2005 year ,Travis Oliphant stay Numeric Another library of the same nature is combined in Numarray The characteristics of , And added other extensions and developed NumPy.NumPy Developed for open source and maintained by many collaborators .
NumPy The history of can be traced back to 90 The mid - , Its predecessor is Numeric( use C Language writing , It is mainly used to fetch C++ Application in ) and Numarray( Used to process high-dimensional arrays , Flexible indexing 、 Data type transformation 、 Radio, etc ),2005 Years of NumPy As a successor , Absorbed Numeric Rich in C API And Numarray High dimensional array processing power , Become Python Scientific computing is the foundation of ecosystem
NumPy The core of the package is ndarray object . It encapsulates the python Of the same data type n Dimension group , In order to ensure its excellent performance , Many of these operations are performed after the code is compiled locally .
NumPy It's a very fast math library , Mainly used for array calculation , contain :
- A powerful N Dimensional array object ndarray
- Broadcast function
- Integrate C/C++/Fortran Code tools
- linear algebra 、 The Fourier transform 、 Random number generation and other functions
Why? NumPy So fast
1, The bottom is C, Part of it is Fortran
2, In addition to using C outside ,numpy Has its own set of instructions . It can improve the running speed .
3, stay R There is a thing called vectorization programming . Speed is directly based on embedded data structures 100 About times .
Vectorization describes that there are no explicit loops in the code , Index, etc. . These are precompiled C In the code “ Behind the scenes ” Results of optimization . Without vectorization , Our code will be unreadable and inefficient for Troubled by the cycle . Vectorization code has many advantages , These include :
- Vectorization code is more concise , Easier to read
- Fewer lines of code usually means fewer errors
- The code is closer to the standard mathematical notation ( Usually , It is easier to correctly code the mathematical structure )
- Vectorization leads to more “Pythonic” Code .
Generally speaking , stay NumPy in , All operations , Not just arithmetic , It is Logic , position , function etc. , In this implicit element by element way , That is, they broadcast .
边栏推荐
- 力扣每日一题-第31天-202.快乐数
- Source code analysis of open source API gateway APIs IX
- 防“活化”照片蒙混过关,数据宝“活体检测+人脸识别”让刷脸更安全
- Uni hot update
- 源代码加密的意义和措施
- STM32 uses esp01s to go to the cloud, mqtt FX debugging
- 事务方法调用@Transactional
- Embedded-c language-10-enumeration / (function) pointer (function) / multi-level pointer /malloc dynamic allocation / file operation
- [introduction] approximate value
- 图扑软件通过 CMMI5 级认证!| 国际软件领域高权威高等级认证
猜你喜欢

Conception et mise en service du processeur - chapitre 4 tâches pratiques

Significance and measures of source code encryption

CPU設計實戰-第四章實踐任務一簡單CPU參考設計調試

CPU设计实战-第四章实践任务一简单CPU参考设计调试

web254

Instead of houses, another kind of capital in China is rising

【入门】提取不重复的整数

Gdip - hatchbrush pattern table
![[batch DOS CMD summary] extension variables - delay variables CMD /v:on, CMD /v:off, SETLOCAL enabledelayedexpansion, disabledelayedexpansion](/img/ce/6c9e4f2c54710610e8b1f68d6d8088.png)
[batch DOS CMD summary] extension variables - delay variables CMD /v:on, CMD /v:off, SETLOCAL enabledelayedexpansion, disabledelayedexpansion

谈谈数字化转型的几个关键问题
随机推荐
Why are some Wills made by husband and wife invalid
力扣每日一题-第31天-202.快乐数
Using settoolkit to forge sites to steal user information
【入门】输入n个整数,输出其中最小的k个
Provincial election + noi Part III tree problems
Anddroid text to speech TTS implementation
Contenttype comparison of all types
Five combination boxing, solving six difficult problems on campus and escorting the construction of educational informatization
Two expressions of string
Li Kou daily question - day 31 -202 Happy number
Stack implementation calculator
[website architecture] solve 90% of distributed transactions in one move, and introduce the working principles and application scenarios of database transactions and distributed transactions
Day5: scanner object, next() and nextline(), sequential structure, selection structure, circular structure
7-26 word length (input and output in the loop)
事务方法调用@Transactional
程序员养生宝典
Latex table
Provincial election + noi Part VI skills and ideas
【力扣10天SQL入门】Day9 控制流
【无标题】
