当前位置:网站首页>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.快乐数
- XX攻击——反射型 XSS 攻击劫持用户浏览器
- 手工挖XSS漏洞
- PostgreSQL source code learning (26) -- windows vscode remote debugging PostgreSQL on Linux
- php laravel微信支付
- Precautions and skills in using regular expressions in golang
- LM08丨网格系列之网格反转(精)
- [untitled]
- [redis] it takes you through redis installation and connection at one go
- Implementation and encapsulation of go universal dynamic retry mechanism
猜你喜欢

Office365 - how to use stream app to watch offline files at any time

Learn reptiles for a month and earn 6000 a month? Tell you the truth about the reptile, netizen: I wish I had known it earlier

STM32 uses esp01s to go to the cloud, mqtt FX debugging

Adding color blocks to Seaborn clustermap matrix

Connect timed out of database connection

seaborn clustermap矩阵添加颜色块

Teach you how to apply for domestic trademark online step by step

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

5大组合拳,解决校园6大难题,护航教育信息化建设

谈谈数字化转型的几个关键问题
随机推荐
How to prevent the other party from saying that he has no money after winning the lawsuit?
Gru of RNN
getInputStream() has already been called for this request
Android screen adaptation (using constraintlayout), kotlin array sorting
P4 安装bmv2 详细教程
window c盘满了
The difference between interceptors and filters
7-26 word length (input and output in the loop)
Aardio - Shadow Gradient Text
Two expressions of string
Day5: scanner object, next() and nextline(), sequential structure, selection structure, circular structure
OJ输入输出练习
源代码加密的意义和措施
Anddroid 文本合成语音TTS实现
LM08丨网格系列之网格反转(精)
P4 installation bmv2 detailed tutorial
sqlalchemy创建MySQL_Table
The Windows C disk is full
程序员养生宝典
力扣每日一题-第31天-1790.仅执行一次字符串交换能否使两个字符串相等
