QR decomposition in python needs to be understood

spyder
win10
python3

from numpy.linalg import inv,qr

generate a random matrix of 5 to 5

X = np.random.randn(5,5)

first find the transpose of the matrix (.T), and then find the dot product (.dot)

mat = X.T.dot(X)

find the inverse of the matrix

inv(mat)

get the unit matrix

mat.dot(inv(mat))

use QR decomposition to assign values to QMagi R

respectively.
q,r = qr(mat)

get orthogonal matrix
orthogonal matrix, and the product of matrix and its transpose matrix is E

.
q

get the upper triangular matrix

r
In order to understand the QR factorization, I multiply the orthogonal matrix and its inverted matrix. Theoretically, I should get the unit matrix E1, but my output is not a matrix with diagonal 1 and other elements 0? May I ask what is wrong and what is the problem?

E1 = q*(q.T)
E1
Jun.09,2022
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ef43-4f0bb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ef43-4f0bb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?