scalar
Simple operation
length
vector
Simple operation
length
Other operations
matrix
Simple operation
Multiplication (matrix*vector)
Multiplication(matrix*matrix)
norm
Depends on how to measure the length of b and c
common norm
Matrix norm: the smallest value that satisfies the above formula
Frobenius norm
special matrix
Symmetry and antisymmetry
Zhengding
Orthogonal matrix
permutation matrix
Eigenvectors and eigenvalues
A vector whose direction is not changed by the matrix
Eigenvectors can always be found for symmetric matrices
Linear algebra implementation
A scalar is represented by a tensor with only one element
A vector can be thought of as a list of scalar values
Access any element by index of the tensor
Access the length of a tensor
Tensor with only one axis and shape with only one element
Create a matrix of shape m*n by specifying two components m and n
transpose of matrix
The symmetric matrix A is equal to its transpose
Data structures with more axes can be built
Given two tensors of any shape, the result of any element-wise binary operation will be a tensor of the same shape
The element-wise multiplication of two matrices is called the Hadamard product
Calculate the sum of its elements
Represents the sum of elements of a tensor of arbitrary shape
Specifies the axis on which the summed summary tensor is to be summed
The dimensions are originally (2, 5, 4), and the sum is calculated according to axis=0, that is, the sum is calculated according to the first dimension. The resulting dimension is (5, 4).
The dimensions are originally (2, 5, 4), and the sum is calculated according to axis=1, that is, the second dimension is summed. The resulting dimension is (2, 4)
You can also specify two dimensions at the same time
A quantity related to summation is the mean
Keep the number of axes constant when calculating sum or mean
Divide A by sum_A by broadcasting
Calculate the cumulative sum of the elements of A on a certain axis
The dot product is the sum of element-wise products at the same position
The dot product of two vectors can be expressed by performing element-wise multiplication followed by summation
The matrix-vector product Ax is a column vector of length m
Matrix-matrix multiplication AB can be thought of as simply performing m matrix-vector products and splicing the results together to form an n*m matrix.
norm
L1 norm
L2 norm
matrix
Note the difference whether there is keepdims=True or not