Can the Diagonal Property of a Matrix be Used to Speed Up Inversion?

  • Thread starter Thread starter codenamev
  • Start date Start date
  • Tags Tags
    Inversion Matrix
AI Thread Summary
The discussion centers on using the diagonal property of a large matrix (4096x4096) to expedite its inversion in MATLAB. The matrix can be divided into 64 blocks of diagonal submatrices, allowing for significant computational reductions. By leveraging the properties of diagonal matrices, such as their simple inversion and the ease of performing operations like addition and multiplication, the inversion process can be simplified. The proposed method involves solving equations in block form, which maintains the diagonal structure throughout, eliminating the need for extensive matrix multiplications. This approach offers a more efficient solution to the matrix inversion problem.
codenamev
Messages
2
Reaction score
0

Homework Statement



Hi, I'm trying to calculate the inverse of a really big matrix (4096x4096) using matlab. The inversion process takes too long on my pc, so i want to find a faster way.
The matrix has a strange property that i think could be useful to solve the problem:
splitting it in 64 blocks (8 rows and 8 columns of 256x256 submatrices), each submatrice is diagonal. Inverting a diagonal matrix is really simple, so i am asking you if this property can be used to calculate the inversion in a faster way.


Homework Equations





The Attempt at a Solution



i found something about block diagonal matrix inversion, but my matrix is a bit different from a block diagonal matrix, because i have no zero submatrices... each block is diagonal...
i'm trying to use the matrix inversion in block form but i feel that there must be a smarter solution...
thanks
 
Physics news on Phys.org
codenamev said:

Homework Statement



Hi, I'm trying to calculate the inverse of a really big matrix (4096x4096) using matlab. The inversion process takes too long on my pc, so i want to find a faster way.
The matrix has a strange property that i think could be useful to solve the problem:
splitting it in 64 blocks (8 rows and 8 columns of 256x256 submatrices), each submatrice is diagonal. Inverting a diagonal matrix is really simple, so i am asking you if this property can be used to calculate the inversion in a faster way.

Homework Equations


The Attempt at a Solution



i found something about block diagonal matrix inversion, but my matrix is a bit different from a block diagonal matrix, because i have no zero submatrices... each block is diagonal...
i'm trying to use the matrix inversion in block form but i feel that there must be a smarter solution...
thanks

You are correct: the special structure allow you to reduce the computations from many billions of multiplications and additions, to a few hundred thousand. It gets complicated (but straightforward in principle), so I will just illustrate it for two cases: (I) the 2n x 2n case (4 nxn diagonal blocks); and (II) the 3n x 3n case (9 nxn diagonal blocks).
(I) M = \pmatrix{A&B\\D&E}, \text{ where } A = \text{diag}(a_1, a_2,\ldots,a_n), \text{ etc.} We want to solve the equations MZ = R, where
R = \pmatrix{u\\v}, u, \, v = \text{given n-dimensional vectors} and
Z = \pmatrix{x\\y}, \; x,\, y = \text{unknown n-dimensional vectors.}
These become
Ax + By = u \longrightarrow x = A^{-1}u - A^{-1}B y\\<br /> Dx+Ey = v \longrightarrow D(A^{-1}u - A^{-1}B y) + Ey = v,\\<br /> \text{so } E&#039;y = v&#039;, \text{where } E&#039; = E - D A^{-1}B, \; v&#039; = v - D A^{-1} u.<br />
So, we can get y, then can get x from a previous formula.

Note: this is simplified by using the following simple facts: (1) The inverse of a diagonal matrix is diagonal (if it exists), that is: (\text{diag}(a_1,\ldots,a_n))^{-1} = \text{diag}(1/a_1, \ldots, 1/a_n). (2) The product of two diagonal matrices is diagonal; that is:
\text{diag}(a_1,\ldots,a_n) \cdot \text{diag}(b_1,\ldots,b_n)<br /> = \text{diag}(a_1 b_1, \ldots, a_n b_n)..
(3) The product of a scalar and a diagonal matrix is diagonal; that is
c\: \text{diag}(a_1,\ldots,a_n) = \text{diag}(ca_1,\ldots, ca_n), for any constant c.
(4) The sum of diagonal matrices is diagonal; that is
\text{diag}(a_1,\ldots,a_n) + \text{diag}(b_1,\ldots,n_n) <br /> = \text{diag}(a_1 + b_1, \ldots, a_n + b_n).

Therefore, the matrix E' above is diagonal, with (i,i)-element equal to
E&#039;(i,i) \equiv e&#039;_i = e_i - d_i b_i/a_i, so no actual matrix multiplications are needed. Further, solving E'y = v' for y and Ax = u-By for x is easy.

(II) Solve
\pmatrix{A&amp;B&amp;C\\D&amp;E&amp;F\\G&amp;H&amp;K} \pmatrix{x\\y\\z} = \pmatrix{u\\v\\w},
where each of the listed sub-matrices are nxn diagonal.
We can write the first two equations as
Ax + By = U, Dx + Ey = V, where U = u-Cz,\; V = v - Fz, so from above we have
E&#039; y = V&#039; = V - DA^{-1}U = v - DA^{-1}u + (DA^{-1}C -F)z,
which we can write as E&#039; y = v&#039; + F&#039; z.
We can substitute this into the equation for x to get Ax = u&#039; + C&#039;z, where we get u' and C' from messy but straightforward algebra. So now we have x and y solved in terms of z, and can substitute these expressions into the third equation
Gx + Hy + Kz = w,
to get an equation of the form K&#039; z = w&#039;. All the matrices E', F', C', K', etc., are diagonal, so all the computations are very easy.

You can extend the method to 64 blocks in the same way; it just needs lots of labels to keep track of the different matrices throughout. All of the matrices encountered are diagonal, so it is enough to store their diagonals, and no acutal matrix multiplications or inversions are needed.

RGV
 
Last edited:
Very nice post, Ray!
 
thank you very much for your help!
 
I picked up this problem from the Schaum's series book titled "College Mathematics" by Ayres/Schmidt. It is a solved problem in the book. But what surprised me was that the solution to this problem was given in one line without any explanation. I could, therefore, not understand how the given one-line solution was reached. The one-line solution in the book says: The equation is ##x \cos{\omega} +y \sin{\omega} - 5 = 0##, ##\omega## being the parameter. From my side, the only thing I could...
Essentially I just have this problem that I'm stuck on, on a sheet about complex numbers: Show that, for ##|r|<1,## $$1+r\cos(x)+r^2\cos(2x)+r^3\cos(3x)...=\frac{1-r\cos(x)}{1-2r\cos(x)+r^2}$$ My first thought was to express it as a geometric series, where the real part of the sum of the series would be the series you see above: $$1+re^{ix}+r^2e^{2ix}+r^3e^{3ix}...$$ The sum of this series is just: $$\frac{(re^{ix})^n-1}{re^{ix} - 1}$$ I'm having some trouble trying to figure out what to...

Similar threads

Back
Top