This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CS 140 Assignment 2: Matrix-Vector Multiplication and the Power Method Assigned January 10, 2011 Due by 11:59 pm Wednesday, January 19 This assignment is to write a parallel program to multiply a matrix by a vector, and to use this routine in an implementation of the power method to find the absolute value of the largest eigenvalue of the matrix. You will write separate functions to generate the matrix and to perform the power method, and you will do some timing experiments with the power method routine. 1 Mathematical background A square matrix is an n-by- n array A of numbers. The entry in row i , column j of A is written either a ij or A ( i, j ). The rows and columns are numbered from 1 to n . A vector is a one-dimensional array x whose i ’th entry is x i or x ( i ). Recall the definition of matrix-vector multiplication: The product y = Ax is a vector y whose elements are y i = n summationdisplay j =1 a ij x j . In words, each element of y is obtained from one row of A and all of x , by computing an inner product (that is, by adding up the pointwise products). Every element of x contributes to every element of y ; each element of A is used exactly once. The power method uses matrix-vector multiplication to estimate the size of the largest eigenvalue of a matrix A , which is also called the spectral radius of A . It works as follows. Start with an arbitrary vector x . Then repeat the following two steps: divide each element of x by the length (or norm ) of x ; second, replace x by the matrix-vector product Ax . The norm of the vector eventually converges to the spectral radius of A . In your code, you will repeat the matrix-vector product 1000 times. There is a sequential Matlab code for the power method on the course web page (under Home- work 2). You will write a parallel C/MPI code that does the same computation....
View Full Document
This document was uploaded on 02/22/2011.
- Spring '09