help-octave
[Top][All Lists]
Advanced

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

Re: 0-1 sparse representations?


From: Jordi Gutiérrez Hermoso
Subject: Re: 0-1 sparse representations?
Date: Sun, 20 Nov 2011 02:52:21 -0500

On 20 November 2011 02:20, E R <address@hidden> wrote:
> 2011/11/19 Jordi Gutiérrez Hermoso <address@hidden>:
>> On 19 November 2011 15:49, E R <address@hidden> wrote:
>>> I'm interested if Octave has the ability to represent a 0-1 sparse
>>> matrix where there is only one 1 per row.
>>
>> No. Sparse matrices must be of float types.
>
> But it is clear that octave represents permutation matrices by just
> the permutation (an array of 4-byte integers).

Yes, permutation matrices are a special type, but they're supposed to
be a transparent optimisation and they are not the same as sparse
matrices (in fact, we've had some bugs were permutation matrices
weren't casting correctly to sparse matrices but into full).

>> But why not just represent
>> it as a vector of indices?
>
> I could, but then I'd have to write my own matrix multiplication
> routine. And I wouldn't be able to use it in other octave routines
> which expect a matrix.

Why would you want to perform matrix multiplication of an index
vector? Why represent the same data using more space? What is the
goal?

> Since octave has a compact representation for permutation matrices,
> perhaps it also has a special internal representation for the slightly
> more general class of 0-1 matrices with only one 1 per row.

The type doesn't exist. I'm not trying to hide it from you. Perhaps it
should; it's not the first time a request for it comes up. However, if
you use ordinary sparse matrices, you only end up using 8 times as
much memory as the same hypothetical type using bona-fide zero-one
values.

Why do you want such a type?

- Jordi G. H.


reply via email to

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