程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python appendix a numpy advanced application

編輯:Python

In this appendix , I will go deep into NumPy Array calculation of library . This will include ndarray More internal details , And more advanced array operations and algorithms .

This chapter includes a few messy chapters , You don't need to study it carefully .

A.1 ndarray The internal mechanism of the object

NumPy Of ndarray It provides a way to integrate homogeneous data blocks ( It can be continuous or across ) How to interpret as a multidimensional array object . As you have seen before , data type (dtype) Determines how the data is interpreted , Floating point numbers, for example 、 Integers 、 Boolean value, etc .

ndarray Part of the reason why this is so powerful is that all array objects are a spanning view of data blocks (strided view). You might want to know about array views arr[::2,::-1] Why not replicate any data . In short ,ndarray Not just a piece of memory and a dtype, It also has span information , This allows the array to move in various steps (step size) Move in memory . To be more precise ,ndarray The interior consists of :

  • A point to data ( A piece of data in a memory or memory mapped file ) The pointer to .
  • Data type or dtype, A cell that describes a fixed size value in an array .
  • An array shape (shape) tuples .
  • A span tuple (stride), The integer refers to the need to move forward to the next element of the current dimension “ Across ” Bytes of .

chart A-1 It simply explains ndarray The internal structure of .

for example , One 10×5 Array of , Its shape is (10,5):


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved