Example: bachelor of science

Guide to NumPy - MIT

Guide to NumPyTravis E. Oliphant, PhDDec 7, 2006 This book is under restricted distribution using a Market-Determined, Tempo-rary, Distribution-Restriction (MDTDR) system (see ) untilOctober 31, 2010 at the latest. If you receive this book, you are asked not to copy itin any form (electronic or paper) until the temporary distribution-restriction you have multiple users at an institution, you should either share a single copyusing some form of digital library check-out, or buy multiple copies. The morecopies purchased, the sooner the documentation can be released from this incon-venient distribution restriction. After October 31, 2010 this book may be freelycopied in any format and used as source material for other books as long as ac-knowledgement of the original author is given. Your supportof thistemporarydistribution restriction plays an essential role in allowing the author and others likehim to produce more quality books and NumPy from Python121 Origins of NumPy132 Object Data-Type Descriptors.

13.3.1.1 Data access . . . . . . . . . . . . . . . . . . . . . . . 235 13.3.2 Creating arrays . . . . . . . . . . . . . . . . . . . . . . . . . . 236

Tags:

  Guide, Numpy, Guide to numpy

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of Guide to NumPy - MIT

1 Guide to NumPyTravis E. Oliphant, PhDDec 7, 2006 This book is under restricted distribution using a Market-Determined, Tempo-rary, Distribution-Restriction (MDTDR) system (see ) untilOctober 31, 2010 at the latest. If you receive this book, you are asked not to copy itin any form (electronic or paper) until the temporary distribution-restriction you have multiple users at an institution, you should either share a single copyusing some form of digital library check-out, or buy multiple copies. The morecopies purchased, the sooner the documentation can be released from this incon-venient distribution restriction. After October 31, 2010 this book may be freelycopied in any format and used as source material for other books as long as ac-knowledgement of the original author is given. Your supportof thistemporarydistribution restriction plays an essential role in allowing the author and others likehim to produce more quality books and NumPy from Python121 Origins of NumPy132 Object Data-Type Descriptors.

2 Basic indexing (slicing).. Memory Layout ofndarray.. Contiguous Memory Layout.. Non-contiguous memory layout.. Universal Functions for arrays.. Summary of new features.. Summary of differences with Numeric.. First-step changes.. Second-step changes.. Updating code that uses Numeric using altercodeN.. Changes to think about.. Summary of differences with Numarray.. First-step changes.. Import changes.. Attribute and method changes.. Second-step changes.. Additional Extension modules.. 433 The Array .. Memory Layout attributes.. Data Type attributes.. Other attributes.. Array Interface attributes.. Array conversion.. Array shape manipulation.. Array item selection and manipulation.. Array calculation.. Array Special Methods.. Methods for standard library functions.. Basic customization.. Container customization.

3 Arithmetic customization.. Binary.. In-place.. Unary operations.. Array indexing.. Basic Slicing.. Advanced selection.. Integer.. Boolean.. Flat Iterator indexing.. 844 Basic Creating arrays.. Operations on two or more arrays.. Printing arrays.. Functions redundant with methods.. Dealing with data types.. 945 Additional Convenience Shape functions.. Basic functions.. Polynomial functions.. Set Operations.. Array construction using index tricks.. Other indexing devices.. Two-dimensional functions.. More data type functions.. Functions that behave like ufuncs.. Miscellaneous Functions.. Utility functions.. 1246 Scalar Attributes of array scalars.. Methods of array scalars.. Defining New Types.. 1307 Data-type (dtype) Attributes.. Construction.. Methods.. 1378 Standard Special attributes and methods recognized by NumPy .

4 Matrix Objects.. Memory-mapped-file arrays.. Character arrays ( ).. Record Arrays ( ).. Masked Arrays ( ).. Standard container class.. Array Iterators.. Default iteration.. Flat iteration.. N-dimensional enumeration.. Iterator for broadcasting.. 1519 Universal Description.. Broadcasting.. Output type determination.. Use of internal buffers.. Error handling.. Optional keyword arguments.. Attributes.. Casting Rules.. Methods.. Reduce.. Accumulate.. Reduceat.. Outer.. Available ufuncs.. Math operations.. Trigonometric functions.. Bit-twiddling functions.. Comparison functions.. Floating functions.. 17110 Basic Linear Algebra (linalg).. Discrete Fourier Transforms (fft).. Random Numbers (random).. Discrete Distributions.. Continuous Distributions.. Miscellaneous utilities.. Matrix-specific functions (matlib).. Ctypes utiltity functions (ctypeslib).

5 19111 Testing and Testing.. NumPy Distutils.. miscutil.. Other modules.. Conversion of .src files.. Fortran files.. Named repeat rule.. Short repeat rule.. Pre-defined names.. Other files.. 205II C-API20612 New Python Types and New Python Types Defined.. PyArrayType.. PyArrayDescrType.. PyUFuncType.. PyArrayIterType.. PyArrayMultiIterType.. PyArrayFlagsType.. ScalarArrayTypes.. Other C-Structures.. PyArrayDims.. PyArrayChunk.. PyArrayInterface.. Internally used structures.. PyUFuncLoopObject.. PyUFuncReduceObject.. PyUFuncLoop1d.. PyArrayMapIterType.. 22713 Complete Configuration defines.. Guaranteed to be defined.. Possible defines.. Array Data Types.. Enumerated Types.. Defines.. Max and min values for integers.. Number of bits in data types.. Bit-width references to enumerated typenums.. Integer that can hold a pointer.. C-type names.. Boolean.

6 (Un)Signed Integer.. (Complex) Floating point.. Bit-width names.. Printf Formatting.. Array API.. Array structure and data access.. Data access.. Creating arrays.. From scratch.. From other objects.. Dealing with types.. General check of Python Type.. Data-type checking.. Converting data types.. New data types.. Special functions for PyArrayOBJECT.. Array flags.. Basic Array Flags.. Combinations of array flags.. Flag-like constants.. Flag checking.. Array method alternative API.. Conversion.. Shape Manipulation.. Item selection and manipulation.. Calculation.. Functions.. Array Functions.. Other functions.. Array Iterators.. Broadcasting (multi-iterators).. Array Scalars.. descriptors.. Utilities.. For use withPyArgParseTuple.. Other conversions.. Importing the API.. Internal Flexibility.. Memory management.. Threading support.. Priority.

7 Default buffers.. Other constants.. Miscellaneous Macros.. Enumerated Types.. UFunc API.. Constants.. Macros.. Functions.. Generic functions.. Importing the API.. 29014 How to extend Writing an extension module.. Required subroutine.. Defining functions.. Functions without keyword arguments.. Functions with keyword arguments.. Reference counting.. Dealing with array objects.. Converting an arbitrary sequence object.. Creating a brand-new ndarray.. Getting at ndarray memory and accessing elements of thendarray.. Example.. 30315 Beyond the Iterating over elements in the array.. Basic Iteration.. Iterating over all but one axis.. Iterating over multiple arrays.. Broadcasting over multiple arrays.. Creating a new universal function.. User-defined data-types.. Adding the new data-type.. Registering a casting function.. Registering coercion rules.. Registering a ufunc loop.

8 Subtyping the ndarray in C.. Creating sub-types.. Specific features of ndarray sub-typing.. Thearrayfinalizemethod.. Thearraypriorityattribute.. Thearraywrapmethod.. 31816 Using Python as Calling other compiled libraries from Python.. Hand-generated wrappers.. f2py.. Creating source for a basic extension module.. Creating a compiled extension module.. Improving the basic interface.. Inserting directives in Fortran source.. A filtering example.. Calling f2py from Python.. Automatic extension module generation.. Conclusion.. weave.. Speed up code involving arrays (also see ).. Inline C-code.. Simplify creation of an extension module.. Conclusion.. Pyrex.. Pyrex-add.. Pyrex-filter.. Conclusion.. ctypes.. Having a shared library.. Loading the shared library.. Converting arguments.. Calling the function.. Complete example.. Conclusion.. Additional tools you may find useful.

9 SWIG.. SIP.. Boost Python.. Instant.. PyInline.. PyFort.. 35017 Code Memory model.. Data-type encapsulation.. N-D Iterators.. Broadcasting.. Array Scalars.. Advanced ( Fancy ) Indexing.. Fancy-indexing check.. Fancy-indexing implementation.. Creating the mapping object.. Binding the mapping object.. Getting (or Setting).. Universal Functions.. Setup.. Function call.. One Loop.. Strided Loop.. Buffered Loop.. Final output manipulation.. Methods.. Setup.. Reduce.. Accumulate.. Reduceat.. 36310 List of Built-in array-scalar types corresponding to data-types for an ndar-ray. The bold-face types correspond to standard Python types. Theobjecttype is special because arrays with dtype= O do not returnan array scalar on item access but instead return the actual objectreferenced in the .. Attributes of .. Array conversion methods.. Array item selection and shape manipulation methods.

10 Ifaxis is anargument, then the calculation is performed along that axis. An axisvalue of None means the array is flattened before Array object calculation methods. If axis is an argument, then thecalculation is performed along that axis. An axis value of None meansthe array is flattened before calculation proceeds. All of these meth-ods can take an optional out= argument which can specify the outputarray to write the results .. Array scalar types that inherit from basic Python intcarray data type might also inherit from the IntType if it has the samenumber of bits as the intarray data type on your .. Universal function (ufunc) .. Functions in (both in NumPy and SciPy).. 17411 Part INumPy from Python12 Chapter 1 Origins of NumPyNumPy builds on (and is a successor to) the successful Numeric array object. Itsgoal is to create the corner-stone for a useful environment for scientific order to better understand the people surrounding NumPy and (its library-package) SciPy, I will explain a little about how SciPy and (current) NumPy orig-inated.


Related search queries