What is the reverse function of dmperm()?

I'm trying to solve Ax = b using Jacobi iterations.
The function dmperm() is used to permute the rows of A so that the diagonal has no zeros. b is also permuted by the same order of row permutation of A. Then I get x with rows permuted. How can I "unpermute" x to get the original order?
Thanks a lot!

 Akzeptierte Antwort

Roger Stafford
Roger Stafford am 11 Dez. 2013

0 Stimmen

As long as you use the single-output version of 'dmperm'
p = dmperm(A);
and only permute the rows of matrix A, getting A(p,:), then the elements of x are not permuted.
A permutation of both the rows and columns of A, A(p,q), will permute the elements of x by q. To get x back to the original order is accomplished by
x(q) = x;
which amounts to the inverse permutation of q.

1 Kommentar

Elena
Elena am 11 Dez. 2013
Thank you very much!!!
x(q) = x; is exactly what I want!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Sparse Matrices finden Sie in Hilfe-Center und File Exchange

Produkte

Gefragt:

am 10 Dez. 2013

Kommentiert:

am 11 Dez. 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by