help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 0-1 sparse representations?


From: Carlo de Falco
Subject: Re: 0-1 sparse representations?
Date: Sun, 20 Nov 2011 08:53:31 +0100

On 20 Nov 2011, at 08:42, c. wrote:

> 
> On 19 Nov 2011, at 21:49, E R wrote:
> 
>> 
>> Does Octave has a special representation for a 0-1 matrix where there
>> is only one 1 per row, and, if so, how does one go about building it?
> 
> I think you are trying to build a permutation matrix? 
> Yes, Octave does have a special representation for this:
> 
> http://www.gnu.org/software/octave/doc/interpreter/Creating-Permutation-Matrices.html#Creating-Permutation-Matrices
> 
> notice that this only works if the matrix you want to build is square
> c.

Sorry, I hit send too soon ...

This was recently discussed in this thread:
http://octave.1599824.n4.nabble.com/remove-for-loop-from-following-code-tp3995149p3995149.html

Essentially it seems you can represent your matrix as a sprse matrix of 
logicals:

b = sparse ([1 2 3]', [1 3 3]', true(3, 1))

c.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]