Mathematical Road-python Calculation (5)-Initial knowledge numpy and PyPy execution numpy

Source: Internet
Author: User

N

NumPysystem isPythonAn open-source digital extension. Such a tool can be used to store and process large matrices,Pythona nested list of its own (nested list structure)structures are much more efficient (the structure can also be used to represent matrices (Matrix)). is saidNumPywill bePythonthe equivalent of becoming a free, more powerfulMatLabSystem.
a Usepythonimplementation of the scientific computing package. Includes:1, a powerfulNDimension Array ObjectArray;2, a relatively mature (broadcast) function library;3, for IntegrationC + +and theFortranCode of the toolkit;4, useful linear algebra, Fourier transform, and random number generation functions. NumPyand sparse matrix operations packagesscipyIt is more convenient to use together.
NumPy(Numeric Pythonprovides a number of advanced numerical programming tools, such as: Matrix data type, vector processing. And a sophisticated computing base.

Designed for rigorous digital processing. It is used by very many large financial companies. As well as core scientific computing organizations such as:lawrencelivermore,NASA uses it to deal with some of the original C + +. tasks such as Fortran or Matlab .

Git clonehttps://bitbucket.org/pypy/numpy.git

CD NumPy

PyPy Setup.pyinstall

[Email protected]:~ $pypy
Python 2.7.6 (32F35069A16D819B58C1B6EFB17C44E3E53397B2, June 26 2014, 21:49:19)
[PyPy 2.3.1 with GCC 4.6.3] on linux2
Type "Help", "copyright", "credits" or "license" for more information.
>>>> Import NumPy as NP
>>>>

the whole content of this blog is original. If reproduced please indicate the sourcehttp://blog.csdn.net/myhaspl/

More convenient than the Python standard library. NumPy provides an n-dimensional array type Ndarray, which is a container type. Data items of the same type and size are stored. Ndarray can be sliced, have an integer index, each data item occupies the same memory space, and the number of dimensions of an array object is defined by the shape attribute. This is a tuple, and the type of the data item is defined by Dtype.

>>>> Myx=np.array ([[11,22,33],[44,55,66]])
>>>>myy=np.array ([Myx,myx])
>>>> Myy
Array ([[[[11], 22,33],
[44, 55, 66]],


[[11, 22, 33],
[44, 55, 66]])

>>>>MYX[0]=[111,222,333]
>>>> Myy
Array ([[[[11], 22,33],
[44, 55, 66]],


[[11, 22, 33],
[44, 55, 66]])
>>>>myx.dtype

Dtype (' int32 ')

>>>>myy.dtype

Dtype (' int32 ')

>>>>myy.shape

(2, 2, 3)

>>>>myx.shape

(2, 3)

>>>>

The above code demonstrates basic use. The Ndarray object itself can be a data item that also has a Ndarray object, generating a copy, so the changes to the inline object do not have side effects.


Mathematical Road-python Calculation (5)-Initial knowledge numpy and PyPy execution numpy

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.