Title: DME and RMSD Calculations
1DME and RMSD Calculations
http//www.math.iastate.edu/wu/math597.html
- Math/BCB/ComS597
- Zhijun Wu
- Department of Mathematics
2 a11, a12, , a1n a21,
a22, , a2n A . .
. an1, an2, , ann
b11, b12, , b1n b21,
b22, , b2n B . .
. bn1, bn2, , bnn
Matrix-Matrix Operations
Pseudo Code n integers A, B, C
two-dimensional arrays for i 1, , n for
j 1, , n C (i, j) 0 for
k 1, , n C (i, j) C (i, j)
A (i, k) B (k, j) end end end
A n n, B n n, C n n, C AB
c11, c12, , c1n c21,
c22, , c2n C . .
. cn1, cn2, , cnn
2n3 Floating Point Operations
cij ai1 b1j ai2 b2j ain bnj
3 a11, a12, , a1n a21,
a22, , a2n A . .
. an1, an2, , ann
v1
v2 v . .
. vn
Matrix-Vector Operations
Pseudo Code n integer u, v one-dimensional
arrays A two-dimensional array for i 1, ,
n u (i) 0 for j 1, , n
u (i) u (i) A (i, j) v (j) end end
A n n, v n 1, u Av n 1
ui ai1 v1 ai2 v2 ain vn
u1 a11v1 a12v2 a1nvn
u2 a21v1 a22v2 a2nvn
. . .
un an1v1 an2v2 annvn
2n2 Floating Point Operations
4 l11, 0, , 0 l21,
l22, , 0 L . .
. ln1, ln2, , lnn
v1
v2 v . .
. vn
Lower Triangular Matrix
Pseudo Code n integer u, v one-dimensional
arrays L two-dimensional array for i 1, ,
n u (i) 0 for j 1, , i
u (i) u (i) L (i, j) v (j) end end
L n n, v n 1, u Lv n 1
ui li1 v1 li2 v2 lin vn
u1 l11v1 l12v2 l1nvn
u2 l21v1 l22v2 l2nvn
. . .
un ln1v1 ln2v2 lnnvn
n2n Floating Point Operations
5 Homework Assignment 2 Due 6pm, Friday, September
16th
- Let X and Y be two n by n lower triangular
matrices. Let Z XY. Then based on the
definition for matrix multiplication, explain why
Z must also be a triangular matrix. - Write an efficient pseudo code to compute Z XY
by using the fact that zij xi1 y1j xi2 y2j
xin ynj, but xik 0 and ykj 0 whenever k gt
i or j gt k. - What is the total number of floating point
operations of your code. Compare it with a
regular matrix multiplication code.
6Matrix Factorization
Integers
Matrices
Multiplication LU A Factorization A
LU A QR A USVT
Multiplication 3 4 12 Factorization 12
3 4 12 2 6 12 2 3 2
7LU Factorization
L
U
A
8QR Factorization
Q
R
A
Orthogonal Matrix
9Singular Value Decomposition
A
U
VT
S
Orthogonal
Diagonal
Orthogonal
10Applications
LU Factorization Solving Linear Systems, Ax
b QR Factorization Solving Linear
Least-Squares, minx b Ax Singular Value
Decomposition Computing RMSD
11Distance Matrix Error (DME)
a11, a12, , a1n a21,
a22, , a2n A . .
. am1, am2, , amn
c11, c12, , c1m c21,
c22, , c2m C . .
. cm1, cm2, , cmm
d11, d12, , d1m d21,
d22, , d2m D . .
. dm1, dm2, , dmm
12Root-Mean-Square Deviation (RMSD)
a11, a12, , a1n a21,
a22, , a2n A . .
. am1, am2, , amn
x11, x12, x13 x21, x22, x23 . . . xm1, xm2, xm3
y11, y12, y13 y21, y22, y23 . . . ym1, ym2, ym3
X
Y
13Translation
x11, x12, x13 x21, x22, x23 . . . xm1, xm2, xm3
x11, x12, x13 x21, x22, x23 . . . xm1, xm2, xm3
xc1, xc2, xc3 xc1, xc2, xc3 . . . xc1, xc2, xc3
X
X
-
y11, y12, y13 y21, y22, y23 . . . ym1, ym2, ym3
y11, y12, y13 y21, y22, y23 . . . ym1, ym2, ym3
yc1, yc2, yc3 yc1, yc2, yc3 . . . yc1, yc2, yc3
Y
Y
-
14Rotation
q11, q12, q13 q21, q22, q23 q31, q32, q33
Q
C YT X, C U S VT, Q U VT
15 Further Reading
- Linear Algebra by S. Lipschutz, 1968
- Matrix Computations by G. Golub and C. Van
Loan, 1989 - Numerical Analysis by D. Kincaid and W. Cheney,
1991