Matrix multiplication, P1.1.1 Golub/Van Loan-Matrix Computations 3rd

Click For Summary
SUMMARY

The discussion centers on the saxpy algorithm for computing the first column of the matrix product \( M = (A - x_1 I) \cdots (A - x_r I) \), as outlined in "Matrix Computations" (3rd edition) by Golub and Van Loan. The user presents a solution involving matrix multiplication and iterative updates to compute the first column efficiently. The provided Octave code implements this algorithm, utilizing saxpy operations within nested loops. The user seeks a faster method for calculating \( c_1 \) in the context of this matrix product.

PREREQUISITES
  • Understanding of linear algebra concepts, particularly matrix multiplication.
  • Familiarity with the saxpy operation in numerical computing.
  • Basic knowledge of Octave programming for algorithm implementation.
  • Experience with eigenvalue problems and matrix perturbations.
NEXT STEPS
  • Research optimizations for matrix multiplication, such as Strassen's algorithm.
  • Explore advanced techniques in numerical linear algebra, focusing on eigenvalue perturbation theory.
  • Learn about efficient implementations of the saxpy operation in high-performance computing.
  • Investigate alternative programming languages or libraries for matrix computations, such as NumPy in Python.
USEFUL FOR

Students and professionals in applied mathematics, computer science, and engineering who are studying linear algebra and matrix computations, particularly those interested in algorithm optimization and numerical methods.

nanoship
Messages
2
Reaction score
0
Hi,
I am studying linear algebra from Golub G.H., Van Loan C.F.- Matrix Computations 3rd edition. This book is somewhat old now, but I find it rather comprehensive. I want to study all chapters and answer all problems appear at the end of each section. Here is the first problem from the first section. I found a solution but I am not sure if that is the right one.

Homework Statement


Suppose A \in \mathbb{R}^{n\times n} and x \in \mathbb{R}^{r} are given. Give a saxpy algorithm for computing the first column of M=(A-x_{1}I) \dots (A-x_{r}I).

Homework Equations


saxpy operation updates a vector ##y## by a scalar-vector multiplication. It is the shorthand for "scalar a x plus y". If x,y \in \mathbb{R}^{n} and a \in \mathbb{R}, then saxpy algorithm can be written as below.

Code:
for i=1:n
  y(i) = a x(i) + y(i)
end

The Attempt at a Solution


For this problem I propose a generalized solution. I suppose ##M## is multiplication of ##r## arbitrary matrices.

Consider matrix multiplication ##C=AB##.
Any column of ##C## can be written as a linear combination of the columns of ##A##. For example, if
A=\begin{bmatrix}<br /> 1 &amp; 2 \\<br /> 3 &amp; 4<br /> \end{bmatrix},<br /> \;<br /> B=\begin{bmatrix}<br /> 5 &amp; 6 \\<br /> 7 &amp; 8<br /> \end{bmatrix}<br />
then fırst column of C=\begin{bmatrix} c_1 &amp; c_2 \end{bmatrix} (column partitioned) is
<br /> c_1=\begin{bmatrix}<br /> 1 \\<br /> 3<br /> \end{bmatrix}5 +<br /> \begin{bmatrix}<br /> 2 \\<br /> 4<br /> \end{bmatrix}7<br />
Note that calculation of ##c_1## involves ##A## as a whole but only the first column of ##B##.
Taking A^i=(A-x_iI), ##M## can be written as follows.

M=A^1*A^2 \cdots A^{r-1}*A^r,\quad A^r=\begin{bmatrix} c_1^r &amp; c_2^r &amp; \cdots &amp; c_n^r \end{bmatrix}

We can find the first column of ##M## by calculating the first column of the rightmost multiplication at each step. Below I made a list of calculations. Note that first column of the left matrix of the rightmost multiplication is updated at each step.

1.step: ##m_1=A^1*A^2 \cdots A^{r-1}*c_1^r,\quad c_1^{r-1}=A^{r-1}c_1^r##
2.step: ##m_2=A^1*A^2 \cdots A^{r-2}*c_1^{r-1},\quad c_1^{r-2}=A^{r-2}c_1^{r-1}##
##\vdots##
r-1.step: ##M=A^1*c_1^2##

I provide the octave code I have written for this algorithm below. Here, saxpy operations occupy the inner loop.
Code:
function c1 = pr111(n,r)

A = magic(n)
x = round(rand(r,1)*100) # r-vector of elements in the range [0 100] integers
Ar = cell(r,1);

for i=1:r
  Ar{i} = A-eye(n)*x(i);
end

for i=r:-1:2
  y=zeros(n,1);
  # calculate the first column of rightmost multiplication
  for j=1:n
    y = Ar{i-1}(:,j)*Ar{i}(j,1) + y;
  end
  # update the first column of left matrix
  Ar{i-1}(:,1) = y;
end

c1 = Ar{1}(:,1);

My question is: Is there a faster way of calculating ##c_1## for the \prod^{r}_{i=1}{(A-x_{i}I)} case?
 
Physics news on Phys.org
Hi,

did you do chapter 2?

Best wishes.
 
Hi,

Unfortunately I didn't. I switched to a book with a solution manual as I don't like solving problems without knowing if they are true or not.
 

Similar threads

  • · Replies 14 ·
Replies
14
Views
3K
Replies
10
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 10 ·
Replies
10
Views
3K
Replies
1
Views
1K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K