[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to create a permutation matrix
From: |
c. |
Subject: |
Re: how to create a permutation matrix |
Date: |
Mon, 26 Jan 2015 18:58:47 +0100 |
On 26 Jan 2015, at 18:35, Jordi Gutiérrez Hermoso <address@hidden> wrote:
> On Mon, 2015-01-26 at 17:57 +0100, c. wrote:
>>>> [l, u, p] = lu (a' * a);
>>>> typeinfo (p)
>> ans = permutation matrix
>>
>> is there a way to create an object of his type in an m-file?
>
>
> https://www.gnu.org/software/octave/doc/interpreter/Creating-Permutation-Matrices.html
>
> HTH,
> - Jordi G. H.
Thanks,
That was exactly what I was looking for, I knew it was somewhere but I forgot
where ;)
Is it expected that :
>> P = eye (4);
>> P = P([2 1 3 4], :);
>> typeinfo (P)
ans = permutation matrix
but
>> P = eye (4);
>> P ([1 2], :) = P([2 1], :);
>> typeinfo (P)
ans = matrix
BTW the reason I was asking is that I was trying to implement this algorithm
[1] in
an m-file (see attachment).
Does anyone else need this? If so maybe I could commit it to the linear-algebra
package?
c.
[1]
http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatReorderForNonzeroDiagonal.html
reorder_for_nonzero_diagonal.m
Description: Binary data