当前位置:网站首页>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 .
边栏推荐
- Android screen adaptation (using constraintlayout), kotlin array sorting
- php laravel微信支付
- [redis] it takes you through redis installation and connection at one go
- 使用threejs简单Web3D效果
- XX攻击——反射型 XSS 攻击劫持用户浏览器
- [introduction] approximate value
- Precautions and skills in using regular expressions in golang
- How to get a SharePoint online site created using the office365 group template
- 【入门】提取不重复的整数
- 力扣每日一题-第32天-1822.数组元素积的符号
猜你喜欢

Gdip - hatchBrush图案表

使用beef劫持用戶瀏覽器

Soft keyboard height error

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

How to check ad user information?

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

window c盘满了

【Redis】一气呵成,带你了解Redis安装与连接

Day5: scanner object, next() and nextline(), sequential structure, selection structure, circular structure

Tupu software has passed CMMI5 certification| High authority and high-level certification in the international software field
随机推荐
程序员养生宝典
go通用动态重试机制解决方案的实现与封装
数字转excel的字符串坐标
web254
Day5: scanner object, next() and nextline(), sequential structure, selection structure, circular structure
Adding color blocks to Seaborn clustermap matrix
Five combination boxing, solving six difficult problems on campus and escorting the construction of educational informatization
5大组合拳,解决校园6大难题,护航教育信息化建设
Differential: definition of total differential, partial derivative, gradient
How to use layui to display the data in the database in the form of tables
【力扣10天SQL入门】Day10 控制流
Deep learning systematic learning
OJ输入输出练习
事务方法调用@Transactional
初学者如何正确理解google官方建议架构原则(疑问?)
Utiliser Beef pour détourner le navigateur utilisateur
使用 setoolkit 伪造站点窃取用户信息
【入门】截取字符串
2022.6.30 省赛+蓝桥国赛记录
Principle and process of embossing
