Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: sparse matrix reordering
Date: Fri, 12 Dec 2008 16:28:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 26
Message-ID: <ghu3ei$nl7$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1229099282 24231 172.30.248.37 (12 Dec 2008 16:28:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 12 Dec 2008 16:28:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1337510
Xref: news.mathworks.com comp.soft-sys.matlab:506607


Hi,

I'm having a symmetric sparse matrix and I want to reorder it, which I am doing
with:

A = sparse(row,col,val);
p=symamd(A);

That of course works fine...

Now, as I often change the values of the matrix A, but not it's structure I wanted to keep the three vectors, row, col, val and just reorder in the vectors row and col. That way I only have to work with the vector val and not perform operations on a sparse matrix.

So I did:
reorder_row = p(row);
reorder_col = p(col);

However the matrices

A1 = sparse(reorder_row,reorder_col,val);
A2 = A(p,p)

don't have the same structure. Obviously, A2's structure is as expected, but A1 is completly wrong.

I just got some knot in my brain and don't see the reason for this. Can anyone help me and explain me why it's different and how I would properly do it.

Thank you very very much