Re: Upcoming RFC's...

[email protected] (Christian Soeller) Fri, 01 Sep 2000 08:23:02 +1200
Newsgroups perl.perl6.language.data
Organization University of Auckland
Message-ID <[email protected]>
Buddha Buck wrote:

> RFC X+2: Retrieving Matrix dimensions
>     Present @#matrix as analogous to $#array
>     Discuss what $#matrix should return, as well as @#array
>     What is @matrix in scaler context?  (undef, anyone?)

Number of elements? For sparse matrices number of non-zero elements?

> A new proposal:
> 
> RFC X+3: Flattening Matrices
>     Present @array = flatten(@matrix), which returns the elements of @matrix
>         as a 1-dimensional (sparse) array.

Good idea (compare also PDL->clump).

>     Discuss the efficiency of this
>     How to undo?

I'd suggest go along the route of PDL smart refs. The flattened array is
linked to the source array. Working on the flattened array updates
(lazily) the original nD source. If it is sparse enough save array of
indices + values internally, allows reconstruction (that might be the
way the sparse original matrix is stored anyway).

  Christian