Docsity

Math 571 Homework 6: Matrix Multiplication and Transformations, Assignments of Mathematics

Toggle sidebar
bg1
Math 571 (Winter 2009): Homework 6
Due Date: See web page
[i] Save all the files in the directory pre-09-03-matrixmult in a directory of the same name in
your nyx-login home directory. YOU HAVE TO make a single change to the file pbs.sh
before you do anything. Run the following commands to begin with:
module load pgi
module load acml
Compile the timing code for matrix-matrix multiplication using the command
make -f makefile.nyx.mak Time
To run the compiled code, submit the job using
qsub pbs.sh
To check the status of your job, use
qstat -u yourname
Look at the output in /home/yourname/out.txt. What do you learn from the output? Run
the program with different inputs by modifying pbs.sh. By different inputs I refer to different
dimensions for the matrices.
Time the matrix-matrix multiplys for matrices of dimension 3, 4, and 5. To do that you
have to change all the 1000s in TimeMatrixMult.cpp to 10000000.
Why is the BLAS matrix-matrix multiply so much faster for 200 ×200 matrices, but
slower for much smaller matrices?
[ii]As explained in class, the Lorentz transformation
x0=x−ut
(1 −u2/c2)1/2t0=t−ux/c2
(1 −u2/c2)1/2,
where cis the velocity of light, is a matrix transformation. Here (x0, t0) give the velocity in
frame of reference that is moving with speed uwith respect to the (x, t) frame of reference.
Find the eigenvalues and eigenvectors of the matrix. One of the eigenvalues is
s1−u/c
1 + u/c.
What is the physical interpretation of the eigenvectors?
Suppose the (x00, t00 ) frame is moving with a speed u0with respect to the (x0, t0) frame.
What are the eigenvalues and eigenvectors of the transformation from (x, t) to (x00, t00)? Write
down the answer without doing calculations.
pf3

Partial preview of the text

Download Math 571 Homework 6: Matrix Multiplication and Transformations and more Assignments Mathematics in PDF only on Docsity!

Math 571 (Winter 2009): Homework 6

Due Date: See web page

[i] Save all the files in the directory pre-09-03-matrixmult in a directory of the same name in your nyx-login home directory. YOU HAVE TO make a single change to the file pbs.sh before you do anything. Run the following commands to begin with:

module load pgi module load acml

Compile the timing code for matrix-matrix multiplication using the command

make -f makefile.nyx.mak Time

To run the compiled code, submit the job using

qsub pbs.sh

To check the status of your job, use

qstat -u yourname

Look at the output in /home/yourname/out.txt. What do you learn from the output? Run the program with different inputs by modifying pbs.sh. By different inputs I refer to different dimensions for the matrices. Time the matrix-matrix multiplys for matrices of dimension 3, 4, and 5. To do that you have to change all the 1000s in TimeMatrixMult.cpp to 10000000. Why is the BLAS matrix-matrix multiply so much faster for 200 × 200 matrices, but slower for much smaller matrices?

[ii]As explained in class, the Lorentz transformation

x′^ =

x − ut (1 − u^2 /c^2 )^1 /^2

t′^ =

t − ux/c^2 (1 − u^2 /c^2 )^1 /^2

where c is the velocity of light, is a matrix transformation. Here (x′, t′) give the velocity in frame of reference that is moving with speed u with respect to the (x, t) frame of reference. Find the eigenvalues and eigenvectors of the matrix. One of the eigenvalues is √ 1 − u/c 1 + u/c

What is the physical interpretation of the eigenvectors? Suppose the (x′′, t′′) frame is moving with a speed u′^ with respect to the (x′, t′) frame. What are the eigenvalues and eigenvectors of the transformation from (x, t) to (x′′, t′′)? Write down the answer without doing calculations.

Express one of the eigenvalues in the form √ 1 − U/c 1 + U/c

for a suitable U , and thus derive the relativistic law for addition of speeds.

[iii] Suppose the orientation of a moving rigid body about its center of mass is given by Q(t), where Q(t) is a function of time t that is a 3 × 3 orthogonal matrix with determinant

  1. Suppose that Q(0) = I. Show that dQ/dt at t = 0 is an anti-symmetric matrix. (A real matrix A is anti-symmetric if A∗^ + A = 0.) If A is an anti-symmetric matrix as above, show that all its eigenvalues are pure imaginary. (Hint: what kind of a matrix is iA?) If A is an anti-symmetric matrix as above show that all its diagonal entries must be zero. Show that dQ/dt at t = 0 must have an eigenvalue equal to 0. The corresponding eigenvector is the instantaneous axis of rotation.

[iv] Write a matlab function

[dd0, dd1] = qrtridiag(d0, d1, shift) %% d0 = row vector of length m %% d1 = row vector of length m- %% dd0 = row vector of length m %% dd1 = row vector of length m-

that works as follows. For a tridiagonal matrix A, d0 gives the main diagonal of a real symmetric matrix and dd0 gives the subdiagonal. For instance, for

A =

d0 = [1, 1 , 1 , 1 , 1] and d1 = [1, 2 , 3 , 4]. Your matlab function must do a qr factorization of A and then return rq, with a shift. More specifically, if

QR = A − shif t ∗ eye(m) B = RQ + shif t ∗ eye(m),

dd0 and dd1 must correspond to the tridiagonal matrix B. You can implement this step using Matlab’s qr, although you are welcome to do a more efficient implementation using Given’s rotations. Do two implementations of the QR algorithm, the first with no shifts and the second using the last entry of d0 as the shift at each iteration. The second implementation must