mirror of
https://github.com/Visualize-ML/Book4_Power-of-Matrix.git
synced 2026-02-03 02:24:03 +08:00
23 lines
439 B
Python
23 lines
439 B
Python
|
|
###############
|
|
# Authored by Weisheng Jiang
|
|
# Book 4 | From Basic Arithmetic to Machine Learning
|
|
# Published and copyrighted by Tsinghua University Press
|
|
# Beijing, China, 2022
|
|
###############
|
|
|
|
# Bk4_Ch14_01.py
|
|
|
|
import numpy as np
|
|
|
|
A = np.matrix([[1.25, -0.75],
|
|
[-0.75, 1.25]])
|
|
|
|
LAMBDA, V = np.linalg.eig(A)
|
|
|
|
B = V@np.diag(np.sqrt(LAMBDA))@np.linalg.inv(V)
|
|
|
|
A_reproduced = B@B
|
|
|
|
print(A_reproduced)
|