Title: MatrixVector Computation
1Matrix-Vector Computation
http//www.math.iastate.edu/wu/math597.html
- Math/BCB/ComS597
- Zhijun Wu
- Department of Mathematics
2The position of an atom can be represented by a
vector.
3The positions of the atoms in a molecule can be
represented by a matrix formed by a group of
vectors.
4Vectors
x2
x2
(x1, x2)
r
x1
x1
a
A vector is a line segment with a given length
and direction.
A vector can also be defined by the particular
point it points to.
5Vectors
x2
A vector can be defined as a list of numbers.
Geometrically, it corresponds to a vector with
the numbers in the list being the coordinates of
the point the vector points to.
(x1, x2)
x1
A vector can be one-dimensional, two-dimensional,
three-dimensional, and n-dimensional, where n is
an arbitrary integer.
A Row Vector (x1, x2, , xn)
A Column Vector
x1 x2 . . . xn
An n-dimensional vector has n elements.
A vector can also be a row or column vector.
6Matrices
A matrix is a set of numbers arranged in rows and
columns. A matrix of m rows and n columns is
called an m by n matrix.
An m by n Matrix
a11, a12, , a1n a21, a22, , a2n . . . am1, am2,
, amn
A
A matrix can be considered as formed by a group
of vectors. An m by n matrix can be considered as
a matrix of m row vectors of length n or n column
vectors of length m.
aij
A row vector is equivalent to a 1 by n matrix.
Row index
A column vector is just an n by 1 matrix.
Column index
7x11, x12, x13 x21, x22, x23 . . . xm1, xm2, xm3
Coordinates ?
X
Example Matrices
d11, d12, , d1m d21, d22, , d2m . . . dm1, dm2,
, dmm
in
D
Distances ?
Structural Computing
h0, h-1, , h-m h1, h0, , h2-m . . . hm, hm-1,
, h0
H
Structure Factors ?
8Geometry
Analysis
Theory
Physics
Matrix-Vector Computation
Solution
Experiments
Results
9Vector-Vector Operations
V (v1, v2, , vn) V U (v1u1,
v2u2, , vnun) U (u1, u2, , un)
V - U (v1- u1, v2- u2, , vn- un)
v1 u1
V v2 U u2
. .
. . .
. vn
un v1 u1
V U v2 u2
. .
. vn un
v1 - u1 V - U
v2 - u2 .
.
. vn - un
V U v1
u1, v2 u2, , vn un
V (v1, v2, , vn)
v1 VT v2 .
. .
vn
v1 V v2
. .
. vn VT (v1, v2,
, vn)
V (v1, v2, , vn) U (u1, u2, ,
un) Vector Inner-Product VU v1u1 v2u2
vnun
10Matrix-Matrix Operations
a11, a12, , a1n a21,
a22, , a2n A . .
. am1, am2, , amn
b11, b12, , b1n b21,
b22, , b2n B . .
. bm1, bm2, , bmn
a11, a12, , a1l a21,
a22, , a2l A . .
. am1, am2, , aml
b11, b12, , b1n b21,
b22, , b2n B . .
. bl1, bl2, , bln
a11b11, a12b12,
, a1nb1n a21b21,
a22b22, , a2nb2n A B .
.
. am1bm1,
am2bm2, , amnbmn
A m l, B l n, C m n, C AB
c11, c12, , c1n c21,
c22, , c2n C . .
. cm1, cm2, , cmn
a11- b11, a12- b12,
, a1n- b1n a21-
b21, a22- b22, , a2n- b2n A - B
. .
. am1-
bm1, am2- bm2, , amn- bmn
cij ai1 b1j ai2 b2j ail blj
11 a11, a12, , a1n a21,
a22, , a2n A . .
. am1, am2, , amn
v1
v2 v . .
. vn
u1 u2 u .
. . um
Matrix-Vector Operations
u1 u2 u .
. . un
v1
v2 v . .
. vn
A m n, v n 1, u m 1, u Av
ui ai1 v1 ai2 v2 ain vn
v (v1 , v2, , vm)
a11, a12, , a1n a21,
a22, , a2n A . .
. am1, am2, , amn
uv ?, uTv ?, uvT ?
uTv u1 v1 u2 v2 un vn
u (u1 , u2, , un)
v 1 m, A m n, u 1 n, u vA
Inner-Product u v uT v
uj v1 a1j v2 a2j vm amj
12Geometry of Matrix-Vector Operations
Translation
x2
vu
x11, x12, x13 x21, x22, x23 . . . xm1, xm2, xm3
u1, u2, u3 u1, u2, u3 . . . u1, u2, u3
u
v
x1
v1 v v2
u1 u u2
Rotation
x11, x12, x13 x21, x22, x23 . . . xm1, xm2, xm3
q11, q12, q13 q21, q22, q23 q31, q32, q33
v1 u1 v u
v2 u2
13 l11, 0, , 0 l21,
l22, , 0 L . .
. ln1, ln2, , lnn
a11, a12, , a1n a21,
a22, , a2n A . .
. an1, an2, , ann
Square Matrix rows cols
Lower Triangular Matrix
Identity Matrix 1, i j aij
0, i j
u11, u12, , u1n 0,
u22, , u2n U . .
. 0, 0, , unn
1, 0, , 0 0,
1, , 0 I . .
. 0, 0, , 1
Upper Triangular Matrix
d11, 0, , 0 0,
d22, , 0 D . .
. 0, 0, , dnn
A matrix A is nonsingular if and only if there is
a matrix B such that BA AB I. B is called the
inverse of A and denoted A-1.
Diagonal Matrix
14Vector Norm
v1
v2 v . v
( v12 v22 vn2 ) 1/2 .
. vn
x2
v
v - u
l2-norm / Euclidean norm
x1
u
v1
v2 v . .
. vn
u1 u2 u .
. . un
v1 v v2
u1 u u2
Euclidean distance
v u (v1 u1)2 (v2 u2)21/2
v u ( v1 - u1)2 (v2 - u2)2 (vn -
un)2 1/2
15Matrix Frobenius Norm
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
The matrix Frobenius norm can be used to measure
the difference between two molecular structures.
It is equivalent to the root-mean-square
deviation (RMSD) of the structures.