Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to express the vector multiplication of Java matrix

Shulou Source: shulou.com Published: 2022-05-31 11:02:35 09月30日 Update

Most people don't understand the knowledge points of this article "How to express Java matrix vector multiplication", so Xiaobian summarizes the following contents for everyone. The contents are detailed, the steps are clear, and they have certain reference value. I hope everyone can gain something after reading this article. Let's take a look at this article "How to express Java matrix vector multiplication".

vector

point multiplication

Formula: a ·b =| a| * |b| * cosθ dot product, also known as the inner product or quantity product of vectors, is the product of one vector and the length of its projection on another vector; is a scalar. The dot product reflects the "similarity" of two vectors. The more "similar" two vectors are, the larger their dot product is.

Example: If vector a=(a1,b1,c1), vector b=(a2,b2,c2)

Vector a·Vector b=a1a2+b1b2+c1c2

cross-product

Formula: a × b =| a| * |b| * Sinθ cross multiplication is also called outer product of vectors and vector product. And the result is a vector.

Module length:| vector C| =| Vector a× vector b| =| a|| b| sin

Direction: The vector product of vector a and vector b is oriented perpendicular to the plane of the two vectors and obeys the right-hand rule.

cases

Vector a× vector b=

| i j k|

|a1 b1 c1|

|a2 b2 c2|

=(b1c2-b2c1,c1a2-a1c2,a1b2-a2b1)(main diagonal is positive)

(i, j, k are unit vectors of three coordinate axes perpendicular to each other in space)

matrix

Multiplication: np.multiply(a,b)

Matrix multiplication: np.dot(a,b) or np.matmul(a,b) or a.dot (b) or directly with a @ b !

Only note: *, overloaded for element multiplication in np.array, matrix multiplication in np.matrix!

Very good link.

import numpy as npa=np.array ([[1,2],[3,4]])#Generate array matrix b=np.array ([[2,2],[1,3]])print(np.dot(a,b))>>[[ 4 8] [10 18]] The above is about the content of "Java matrix vector multiplication" This article, I believe everyone has a certain understanding, I hope the content shared by Xiaobian is helpful to everyone, if you want to know more related knowledge content, please pay attention to the industry information channel.

Tags: Vector multiplication matrix content two similarity element formula article direction knowledge article product value inner product unit right hand coordinate axis most Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Xiaomi Redmi Shulou Information MySQL