Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
finding specific elements of inverse matrix

Subject: finding specific elements of inverse matrix

From: Nick

Date: 13 Nov, 2012 07:18:11

Message: 1 of 3

I have a large sparse (symmetric positive definite) NxN matrix A, I would like to compute a few select elements of inv(A) without computing the full inverse.

Obviously we can compute the ith column of inv(A) with the backslash operator which is a much better solution than forming inv(A) explicitly:
ei = zeros(N,1);
e(i) = 1;
ans = A \ e;

I can extract the jth element of that to get inv(A)(j,i)

My question is this: can I extract element (i,j) of the inverse without needing to compute the full column i?

In matrix notation, I am trying to compute this rapidly:
ej' * inv(A) * ei
(where ej = zeros(N,1); ej(j) = 1;)

Subject: finding specific elements of inverse matrix

From: Torsten

Date: 13 Nov, 2012 08:02:15

Message: 2 of 3

"Nick" wrote in message <k7ss7j$h04$1@newscl01ah.mathworks.com>...
> I have a large sparse (symmetric positive definite) NxN matrix A, I would like to compute a few select elements of inv(A) without computing the full inverse.
>
> Obviously we can compute the ith column of inv(A) with the backslash operator which is a much better solution than forming inv(A) explicitly:
> ei = zeros(N,1);

I guess you mean
e = zeros(N,1);

> e(i) = 1;
> ans = A \ e;
>
> I can extract the jth element of that to get inv(A)(j,i)
>
> My question is this: can I extract element (i,j) of the inverse without needing to compute the full column i?
>

No.
Element (i,j) of the inverse matrix is involved in the calculation of all N elements
of the j'th column of the identity matrix.
Thus the full j'th column of the inverse matrix needs to be determined to extract
a single element of this column.

> In matrix notation, I am trying to compute this rapidly:
> ej' * inv(A) * ei
> (where ej = zeros(N,1); ej(j) = 1;)

Best wishes
Torsten.

Subject: finding specific elements of inverse matrix

From: James Tursa

Date: 13 Nov, 2012 20:17:23

Message: 3 of 3

"Nick" wrote in message <k7ss7j$h04$1@newscl01ah.mathworks.com>...
> I have a large sparse (symmetric positive definite) NxN matrix A, I would like to compute a few select elements of inv(A) without computing the full inverse.
>
> Obviously we can compute the ith column of inv(A) with the backslash operator which is a much better solution than forming inv(A) explicitly:
> ei = zeros(N,1);
> e(i) = 1;
> ans = A \ e;
>
> I can extract the jth element of that to get inv(A)(j,i)
>
> My question is this: can I extract element (i,j) of the inverse without needing to compute the full column i?
>
> In matrix notation, I am trying to compute this rapidly:
> ej' * inv(A) * ei
> (where ej = zeros(N,1); ej(j) = 1;)

I don't know how rapid the calculation will be, but you can use cofactors and the matrix determinant to calculate individual inv(A) elements without computing the entire matrix inverse. E.g., see this and scroll down to the inverse discussion:

http://en.wikipedia.org/wiki/Cofactor_%28linear_algebra%29

That being said, even if this does turn out to be fast enough for you I would expect the accuracy of the result to suffer. Determinant based solutions like this (e.g., Cramer's Rule) are notorious for being inaccurate.

James Tursa

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us