Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of multiplying dot and multiplying multiply of corresponding components in python

Shulou Source: shulou.com Published: 2022-06-03 19:52:36 09月27日 Update

This article will explain in detail the example analysis of multiplication dot and corresponding component multiplication multiply in python. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

Vector point multiplication (dot) and corresponding component multiplication (multiply):

> aarray ([1,2,3]) > barray ([1.1,1.1,1.]) > np.multiply (arect b) array ([1.2,3.]) > np.dot (apeny b) 6.0

Matrix multiplication (dot) and corresponding component multiplication (multiply):

> cmatrix ([[1,2,3]]) > dmatrix ([1.,1.1,1]]) > np.multiply (CPHEROD) matrix ([1.1,2.3,3]]) > np.dot (CPRIND) Traceback (most recent call last): File ", line 1, in ValueError: shapes (1MULIN3) and (1MUR 3) not aligned: 3 (dim 1)! = 1 (dim 0)

When writing code, * indicates that the corresponding components are multiplied (multiply):

> a*barray ([1,2., 3.]) > c*dTraceback (most recent call last): File ", line 1, in File" C:\ ProgramData\ Anaconda3\ lib\ site-packages\ numpy\ matrixlib\ defmatrix.py ", line 343, in _ mul__ return N.dot (self) Asmatrix (other) ValueError: shapes (1Magne3) and (1Magne3) not aligned: 3 (dim 1)! = 1 (dim 0) on "sample analysis of multiplicative dot and multiplicative multiply of corresponding components in python", this article ends here. Hope that the above content can be helpful to you, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.

Tags: Components multiplication articles examples analysis more good practical code content vectors articles knowledge matrices procedures references help related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Apple MariaDB Huawei OPPO Reno