当前位置:网站首页>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 .
边栏推荐
- Insufficient executors to build thread pool
- Gdip - hatchBrush图案表
- 【力扣10天SQL入门】Day9 控制流
- 【无标题】
- [introduction] approximate value
- 【入门】取近似值
- Two expressions of string
- SharePoint - modify web application authentication using PowerShell
- Book of quantitative trading - reading notes of the man who conquers the market
- Instead of houses, another kind of capital in China is rising
猜你喜欢
[staff] high and low octave mark (the notes in the high octave mark | mark range are increased by one octave as a whole | low octave mark | mark range are decreased by one octave as a whole)
Office365 - how to use stream app to watch offline files at any time
web254
【Redis】一气呵成,带你了解Redis安装与连接
Hijacking a user's browser with beef
LM08丨网格系列之网格反转(精)
SQL number injection and character injection
[staff] key number (key number identification position | key number marking list | a major key identification principle | F, C, G position marking ascending | F major key identification principle | B
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
源代码加密的意义和措施
随机推荐
Two expressions of string
Differential: definition of total differential, partial derivative, gradient
Source code analysis of open source API gateway APIs IX
Stack implementation calculator
Li Kou daily question - day 31 -1502 Judge whether an arithmetic sequence can be formed
【入门】截取字符串
【入门】提取不重复的整数
Rumtime 1200 upgrade: London upgrade support, pledge function update and more
Hijacking a user's browser with beef
Anddroid text to speech TTS implementation
How to get a SharePoint online site created using the office365 group template
empirical study and case study
Li Kou daily question - Day 32 -1822 Symbol of array element product
P4 安装bmv2 详细教程
On June 30, 2022, the record of provincial competition + national competition of Bluebridge
How can beginners correctly understand Google's official suggested architectural principles (questions?)
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
凸印的印刷原理及工艺介绍
【入门】取近似值
【网站架构】一招搞定90%的分布式事务,实打实介绍数据库事务、分布式事务的工作原理应用场景