develooper Front page | perl.perl6.language.data | Postings from August 2000

Some PDL issues (was Re: Test)

From:
c.soeller
Date:
August 25, 2000 03:10
Subject:
Some PDL issues (was Re: Test)
Message ID:
m13SGmz-002IK6C@csnote.mph.auckland.ac.nz
> I'm here because:
>  * I think the PDL folks have valid needs
>  * I think a lot of people are having trouble making suggestions for
>    language changes that mesh well with other constructs in the
>    language.
>  * I'm not able to tell you want you need, but I will try to help
>    you come up with language changes that are tasteful.
> 
> Nat

These are some of the current issues that we have identified:

(1) The current

   $pdl->slice("0:$n,(0)");

syntax sucks. We want something that is much shorter (no ->slice
required).
Why? *Because a module like PDL is often used for interactive
explorartory
data analysis at the (perldl) command line*. Every extra letter is
annoying.
And, honestly, the extra typing is an issue ($pdl[0:$n][0][:] is not an
acceptable possibility).

Our current suggestion: allow us to overload (), [], {} so that we can
say (RFC 115)

   $pdl[0:$n,(0)]

or

   $pdl(0:$n,(0))

Additionally, allow us to use expressions like

   0:$n:3

without raising syntax errors. Our current suggestion is in RFC 117
(which is closely related to RFC 81).

(2) We see the need for a multidimensional, packed and typed array.
Currently this is represented by PDL objects. It needs to be typed and
packed
to allow efficient interfacing to existing libraries (LinAlg, image
processing, etc) and fast dealing with data on the order of 100s of MB
in size.
The need to represent matrices and other higher dim objects of
numerical/
scientific analysis requires a multidim approach (see also RFC 116).

The question is: should such an array type be part of perl6 or should it
be left to a module to implement such types?

A possible approach would be a 1D packed and typed array for perl6 that
a piddle would use as its underlying data array on which it imposes a
multidim structure:

  @arr = complex packed 0:10000; # some arbitrary syntax suggestion
  $pdl = pdlwrap [10,10,100], @arr; # wrap this packed array to make a
[10,10,100] piddle
  $arr[100] = 0;
  print $pdl[0,0,1]; # print that same element

(3) if we get better support for doing operations between arrays a la

    @mult = @a * @b;
    @zipped = zip @a, @b;

etc we should strive to make things feel very similar when using arrays
vs
piddles. My feeling is that there will still be the distinction between
piddles and perl arrays since I don't expect all the packed multidim
stuff to make it into the perl6 core.

(4) Get access to the parsers output from perl so that we can do our own
(PDL) optimizations on certain subroutines (the PP equivalent, see RFC
116). I think Damian Conway has mentioned this capability on the wish
list for perl6 already.

So if somebody has good perlish ideas on how to get us these things in
the nicest possible way (that go beyond/against the current RFCs) we'd
love to hear it.

  Christian



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About