Quoting Gabor Szabo <[email protected]>:
> 1) How can I extend a pdl vector?
> The perl code looks like this:
> push @all, @new;
>
> Using pdl those are both PDL vectors. $all and $new I just don't know
> how to append the new list?
You want the append function here:
If $all is a piddle and you want to add $new:
$all->append($new)
>
> 2) sorting element, I have this perl code:
> my @sorted_ids = sort { $x->{distance}{$a} <=> $x->{distance}{$b} } @ids;
> but now instead of @ids I have $ids, a PDL.
Here you want the qsort function which sorts a piddle, and qsorti
which gives the indices of the sorted piddle.
perldl> $x = pdl([1, 5, -3])
perldl> p $x->qsort()
[-3 1 5]
perldl> p $x->qsorti()
[2 0 1]
Cheers,
Jarle.
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl