You don't say what type of comparison function you want for the sort.  The
qsort, qsortvec and qsortveci all use the numeric value to sort.  Looking
at the PDL::Char source it seems there is an undocumented method to return
the PDL::Char piddle as a standard PDL piddle.  This may be of use.


pdl> use PDL::Char
>
> pdl>  $p=PDL::Char->new(@a=([1,2,'c',3],[4,5,'a',6],[7,8,'b',9]));
>
> pdl> p $p
> [
>  [ '1' '2' 'c' '3'  ]
>  [ '4' '5' 'a' '6'  ]
>  [ '7' '8' 'b' '9'  ]
> ]
>
>
> pdl> p $p->numeric
>
> [
>  [
>   [49]
>   [50]
>   [99]
>   [51]
>  ]
>  [
>   [52]
>   [53]
>   [97]
>   [54]
>  ]
>  [
>   [55]
>   [56]
>   [98]
>   [57]
>  ]
> ]
>
>
>
Hope this helps.  --Chris



On Fri, May 30, 2014 at 3:20 AM, <[email protected]> wrote:

> hi guys,
> just a brief question about sorting a piddle.
>
> i have a piddle of this kind:
>    $p=PDL::Char->new(@a=([1,2,'c',3],[4,5,'a',6],[7,8,'b',9]));
>
> And i would like to sort it by columns for example columns 2 and 3. But
> the only sorting i found in PDL was qsort and qsortvec but they dont do
> what i want. I searched the net but could not find any info on this matter.
>
> I was thinking to convert it to regular perl array so i can sort as i want
> but this is not very effective cos my actual piddle is large.
>
> Can you please help me in this matter? Any tips of info is appreciated
>
> Thank you
> Dimitar
>
>
>
> _______________________________________________
> Perldl mailing list
> [email protected]
> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
>
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to