hw2 - CS 140 Assignment 2 Matrix-Vector Multiplication and...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
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 powermethod 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.
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern