当前位置:网站首页>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 .
边栏推荐
- Aardio - 自己构造的getIconHandle的方法
- 源代码加密的意义和措施
- 【入门】提取不重复的整数
- Soft keyboard height error
- Anddroid text to speech TTS implementation
- Li Kou daily question - day 31 -1502 Judge whether an arithmetic sequence can be formed
- Transaction method call @transactional
- [question brushing] character statistics [0]
- Deep learning systematic learning
- Erreur de hauteur du clavier souple
猜你喜欢

SQL number injection and character injection

On several key issues of digital transformation
![[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

Aardio - 阴影渐变文字

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

【无标题】

Five combination boxing, solving six difficult problems on campus and escorting the construction of educational informatization

Android screen adaptation (using constraintlayout), kotlin array sorting

seaborn clustermap矩阵添加颜色块

源代码加密的意义和措施
随机推荐
Provincial selection + noi Part II string
数字转excel的字符串坐标
Learn the knowledge you need to know about the communication protocol I2C bus
如何使用layui将数据库中的数据以表格的形式展现出来
How to use layui to display the data in the database in the form of tables
Provincial election + noi Part VII computational geometry
Microsoft stream - how to modify video subtitles
【批处理DOS-CMD命令-汇总和小结】-Cmd窗口中常用操作符(<、<<、&<、>、>>、&>、&、&&、||、|、()、;、@)
Source code analysis of open source API gateway APIs IX
OJ input and output exercise
empirical study and case study
Cmake I two ways to compile source files
Scala语言学习-07-构造器
Book of quantitative trading - reading notes of the man who conquers the market
Aardio - Method of self constructed geticonhandle
2022.6.30 省赛+蓝桥国赛记录
On June 30, 2022, the record of provincial competition + national competition of Bluebridge
Provincial election + noi Part VI skills and ideas
Contenttype comparison of all types
使用beef劫持用戶瀏覽器
