How to use numpy array and matrix multiplication

php中世界最好的语言
Release: 2018-04-09 15:54:52
Original
4065 people have browsed it

This time I will show you how to use numpyarray and matrix multiplication, what are the precautions when using numpy array and matrix multiplication, the following is a practical case, let's take a look one time.

1, When it is array, the default d*f is the product of the corresponding elements, multiply is also the product of the corresponding elements, dot (d, f) will be converted into the product of matrices. dot dot multiplication means addition, while multiply only multiplies the corresponding elements and does not add.

2, When it is mat, the default d*f is the product of the matrix, multiply is converted into the product of the corresponding elements, dot (d, f) is the product of the matrix

3. When mixing, generally do not mix.

When mixing, the default is matrix multiplication. , multiply is converted into the product of the corresponding elements, dot (d, f) is the product of the matrix

Summary: The default for array multiplication is dot multiplication, and the default for matrix It is matrix multiplication. When mixed together, the default is matrix multiplication. multiply is converted into the product of the corresponding elements, and dot (d, f) will be converted into the product of the matrix. Note that when multiply does not satisfy the corresponding element, it is performed in the broadcast manner.

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

How to solve the greatest common divisor in Python

How to merge numpy arrays in Python

The above is the detailed content of How to use numpy array and matrix multiplication. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template