Matrix transformation

The basic matrix operations

Matrix addition

矩阵的加法满足下列运算律(A,B,C都是同型矩阵):

A + B = B + A
(A + B) + C = A + (B + C)

应该注意的是只有同型矩阵之间才可以进行加法

Matrix subtraction

29866996300c71eacf9fcc9ce431d54d.png

Matrix multiplication

51d9aec131091a9ae609f2a75f4456ea.png

Multiplication operations to meet the law

0f2def2c8812ee7c6cd14639e1a9331a.png
29e85fb07d671511cc146aed35cfa8f7.png
31f744ef7611a1a0e8f6a0254f98aa4b.png
96ceaf2f2dc955e0d370051a59e58773.png

Matrix transpose

2685844974934b6df11d96fb6aee18b2.png

Transpose operation law satisfies

0678abfccd945f6e2b14bd3680a1b6b5.png
e0af29f89d77bb021030e2e70acf8d05.png
67b0dba9aff2c62aed6a91674e766f19.png

Conjugated

Conjugated matrix is defined:  2c17e8b4a0b7cd78b6ef18c4e2a65616.png
 . A conjugate complex matrix of 2 × 2 (constant real part, imaginary part neg)

6d1966a03d3e5bce9ff45b3e0905ad84.png
ff25aee1cd49bbc5e9cc08eb1e8e01a8.png

Conjugate transpose

The conjugate transpose matrix is defined as:  239f502a3b857997211ed525da2dcc87.png
 can be written as:  da0e955cfa276eb747d253a552c6e403.png
 or written  047027e330df927ea79530406a866b1b.png
 . A 2 × 2 conjugated complex transposed matrix as follows:

6d1966a03d3e5bce9ff45b3e0905ad84.png
993bf5b07b399ca5841aeff06e97c5bc.png

Matrix Multiplication

Multiplication of two matrices can be defined only if the number of rows equal to the number of columns of a first matrix A and matrix B of another. As A is an m × n matrix and B is an n × p matrix, and their product is a C m × p matrix  78fad0b6eda148d59f07c1c4dd23d951.png
 whose elements a

46c2f2f94f11fcf165b6ea7adcaca6c6.png

This product will be written as: c1143fad2d8864643f3f20e8b397d29c.png

Matrix multiplication law

Associative law: 2d1366f55bed3bd7ba644ba4d84c1c22.png

Left distributive law: c5910d32c863ebdb97dc142bd0801883.png

Right distributive law: 615eec03eea818dff0c8542d7862007a.png

Matrix multiplication is not commutative.

Matrix transformation

Displacement

import matplotlib.pyplot as plt
import numpy as np

points = np.array([
    [0,0],
    [0,5],
    [3,5],
    [3,4],
    [1,4],
    [1,3],
    [2,3],
    [2,2],
    [1,2],
    [1,0],
    [0,0]
])

matrix = np.array([2,0])
newpoints = points + matrix

plt.plot(points[:,0],points[:,1])
plt.plot(newpoints[:,0],newpoints[:,1])
plt.xlim(-10,10)
plt.ylim(-10,10)
plt.show()

Rotation

import matplotlib.pyplot as plt
import numpy as np

points = np.array([
    [0,0],
    [0,5],
    [3,5],
    [3,4],
    [1,4],
    [1,3],
    [2,3],
    [2,2],
    [1,2],
    [1,0],
    [0,0]
])

matrix = np.array([
    [1,0],
    [0,-1]
])

newpoints = np.dot(points,matrix.T)
plt.plot(points[:,0],points[:,1])
plt.plot(newpoints[:,0],newpoints[:,1])
plt.xlim(-10,10)
plt.ylim(-10,10)
plt.show()

Scaling

import matplotlib.pyplot as plt
import numpy as np

points = np.array([
    [0,0],
    [0,5],
    [3,5],
    [3,4],
    [1,4],
    [1,3],
    [2,3],
    [2,2],
    [1,2],
    [1,0],
    [0,0]
])

matrix = np.array([
    [2,0],
    [0,1]
])

newpoints = np.dot(points,matrix.T)
plt.plot(points[:,0],points[:,1])
plt.plot(newpoints[:,0],newpoints[:,1])
plt.xlim(-10,10)
plt.ylim(-10,10)
plt.show()

Guess you like

Origin www.cnblogs.com/pluslius/p/11273073.html