3. 向量和矩阵

2020-08-15  本文已影响0人  玄语梨落

Matrix and Vector

What is Matrix and Vector

Matrix: Rectangular array of numbers.

R^{2\times3}:一个2乘3的矩阵
Dimension of matrix: number of rows x number of clumns.
Matrix Elements(entries of matrix):A_{ij}= "i,j\ entry"\ in\ the\ i^{th}\ row, j^{th}\ column.

Vector: An n x 1 matrix.
n dimension vector

R^4
1-indexed vs 0-indexed
一般使用1-indexed 在机器学习中会使用0-indexed 。

Addition and Scalar Multiplication

Matrix Addition(or Subtration)

只有相同维度的矩阵可以相加。新的矩阵与原来维度相同,仅仅是对应部分的相加。

Scalar(real nmuber) Multiplication(or division)

实数和矩阵对应位置的数相乘得到新的矩阵。

Matrix-vector multiplication

m\timesn matrix multiply n\times1 matrix equals a m-dimensional vector

To get y_i, multiply A's i^{th} row with elemets of vector x, and add them up.

We can use matrix and vector to calculate prediction at the same time or with only one line code.

Matrix-Matrix multiplication

m\timesn matrix multiply n\timeso equals a m\timeso matrix.

The i^{th} column of the matrixC is obtained by multiplying A with the i^{th} column of B.

Matrix multiplication properties

Identity Matrix:
Denoted I(or I_{n\times n}).
I\times T = T\times I = T
Informally:
对角线上都是1,其他位置都是0
For any matrix A:A\times I=I\times A=A

Inverse and Transpose

Not all number have an inverse.

Matrix inverse: If A is an m\timesm matrix, and if it has an inverse, AA^{-1}=A^{-1}A=I

Square matrix: m\timesm matrix.
A matirx which have inverse must be a square matrix.
Matrix that don't have an inverse are "singular"(奇异矩阵) or "degenerate"(退化矩阵).

Matrix Transpose:Let A be an m\times n matrix, and let B=A^T. Then B is an n\times m matrix, and B_{ij}=A_{ji}.

上一篇下一篇

猜你喜欢

热点阅读