Thank you Bryan and Chris,
i am sorry i did not make it clear in my first message how i want to sort.

I want to sort 2 times. First by columns 0 and 1(numerically) and after by column 2(lexicographically).

As i understood qsort sorts only by first column(0).

Regards
Dimitar


Quoting [email protected]:

Send Perldl mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Perldl digest..."


Today's Topics:

   1. question about sort ([email protected])
   2. Re: question about sort (Bryan Jurish)
   3. Re: question about sort (Chris Marshall)
   4. Perl 5.20 (fwd) (Doug Hunt)


----------------------------------------------------------------------

Message: 1
Date: Fri, 30 May 2014 15:20:01 +0800
From: [email protected]
To: [email protected]
Subject: [Perldl] question about sort
Message-ID:
        
<20140530152001.horde.cjoupf6xpvftidehqogr...@webmailintern.bii.a-star.edu.sg>

Content-Type: text/plain; charset=UTF-8; format=flowed; DelSp=Yes

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





------------------------------

Message: 2
Date: Fri, 30 May 2014 10:23:44 +0200
From: Bryan Jurish <[email protected]>
To: [email protected]
Cc: "[email protected]" <[email protected]>
Subject: Re: [Perldl] question about sort
Message-ID:
        <camg255w+ryfdqxrtao9ykjsqz-hffhwy51qdq+hsmoy7g5u...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

moin Dimitar,

I don't use PDL::Char, but I think you ought to be able to do what you want
using qsortveci(); something like:

  $p = pdl(byte, [map {[map {ord $_} @$_]}
[1,2,'c',3],[4,5,'a',6],[7,8,'b',9]]);  # use a "vanilla" piddle ...
  $keys         = $p->slice("1:2,");
  $p_sorted = $p->dice_axis(1, $keys->qsortveci);

... PDL::Char seems to behave a bit strangely here; but maybe this can get
you on your way...

marmosets,
  Bryan



On Fri, May 30, 2014 at 9: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




--
Bryan Jurish                           "There is *always* one more bug."
[email protected]         -Lubarsky's Law of Cybernetic Entomology
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.jach.hawaii.edu/pipermail/perldl/attachments/20140530/8ab7e2e9/attachment-0001.html>

------------------------------

Message: 3
Date: Fri, 30 May 2014 08:44:48 -0400
From: Chris Marshall <[email protected]>
To: [email protected]
Cc: "[email protected]" <[email protected]>
Subject: Re: [Perldl] question about sort
Message-ID:
        <capttexldnftj6hj7rdr4wtlexnuw+xzvv+kapot-xixaovp...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.jach.hawaii.edu/pipermail/perldl/attachments/20140530/afdb4c56/attachment-0001.html>

------------------------------

Message: 4
Date: Fri, 30 May 2014 09:43:49 -0600 (MDT)
From: Doug Hunt <[email protected]>
To: [email protected]
Cc: Jason Lin <[email protected]>
Subject: [Perldl] Perl 5.20 (fwd)
Message-ID:
        <[email protected]>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

Hi PDL folks:  Has anyone got PDL to work yet with perl 5.20?

We are having some trouble getting dependencies to compile, the problem
seems to be the Devel::REPL dependency Data::Dump::Streamer (see below).

Any ideas?

Thanks!

--Doug Hunt

[email protected]
Software Engineer
UCAR - COSMIC, Tel. (303) 497-2611

---------- Forwarded message ----------
Date: Thu, 29 May 2014 17:26:09 -0600
From: Jason Lin <[email protected]>
To: douglas hunt <[email protected]>
Subject: Perl 5.20

Hi Doug,

While I was able to get the information out of CPAN and create a new RPM for
Devel::REPL and try to build it under Perl 5.20, I encountered following error
while building Data::Dump::Streamer (one of the dependencies):

----------------------8<-------------------------
+ ./Build test
t/as.t .............. ok
t/blessed.t ......... ok
t/dogpound.t ........ ok
t/dump.t ............ 1/49
#   Failed test 'Many Refs ( $x, $y ) No declare 2'
#   at t/test_helper.pl line 341.

#   Failed test 'Many Refs Declare ( $x, $y ) 2'
#   at t/test_helper.pl line 341.

#   Failed test 'Many Refs Declare ( $y, $x ) 2'
#   at t/test_helper.pl line 341.

#   Failed test 'Many Refs ( $y, $x ) No Declare 2'
#   at t/test_helper.pl line 341.

#   Failed test 'Many Refs ( $x, $y ) No declare 3'
#   at t/test_helper.pl line 341.

#   Failed test 'Many Refs Declare ( $x, $y ) 3'
#   at t/test_helper.pl line 341.

#   Failed test 'Many Refs Declare ( $y, $x ) 3'
#   at t/test_helper.pl line 341.

#   Failed test 'Many Refs ( $y, $x ) No Declare 3'
#   at t/test_helper.pl line 341.
# Looks like you failed 8 tests of 49.
t/dump.t ............ Dubious, test returned 8 (wstat 2048, 0x800)
Failed 8/49 subtests
t/filter.t .......... ok
t/globtest.t ........ 1/19
#   Failed test 'data slots (empty FORMAT)'
#   at t/test_helper.pl line 114.
# Looks like you failed 1 test of 19.
t/globtest.t ........ Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/19 subtests
t/hardrefs.t ........ ok
t/impure_madness.t .. ok
t/lexicals.t ........ #
# PadWalker 1.98 is installed
t/lexicals.t ........ ok
t/locked.t .......... ok
t/madness.t ......... 1/7
#   Failed test 'Total Madness'
#   at t/test_helper.pl line 341.
# Looks like you failed 1 test of 7.
t/madness.t ......... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/7 subtests
t/madness_json.t .... 1/7
#   Failed test 'Total Madness'
#   at t/test_helper.pl line 341.
# Looks like you failed 1 test of 7.
t/madness_json.t .... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/7 subtests
t/madness_w.t ....... 1/6
#   Failed test 'Total Madness'
#   at t/test_helper.pl line 341.
# Looks like you failed 1 test of 6.
t/madness_w.t ....... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/6 subtests
t/names.t ........... ok
t/overload.t ........ ok
t/readonly.t ........ ok
t/refaddr.t ......... ok
t/refcount.t ........ ok
t/refelem.t ......... ok
t/reftype.t ......... ok
t/sortkeys.t ........ ok
t/tree.t ............ ok
t/usage.t ........... ok
t/xs_subs.t ......... ok

Test Summary Report
-------------------
t/dump.t          (Wstat: 2048 Tests: 49 Failed: 8)
   Failed tests:  12-19
   Non-zero exit status: 8
t/globtest.t      (Wstat: 256 Tests: 19 Failed: 1)
   Failed test:  8
   Non-zero exit status: 1
t/madness.t       (Wstat: 256 Tests: 7 Failed: 1)
   Failed test:  4
   Non-zero exit status: 1
t/madness_json.t  (Wstat: 256 Tests: 7 Failed: 1)
   Failed test:  4
   Non-zero exit status: 1
t/madness_w.t     (Wstat: 256 Tests: 6 Failed: 1)
   Failed test:  4
   Non-zero exit status: 1
Files=24, Tests=369, 3 wallclock secs ( 0.13 usr 0.03 sys + 2.55 cusr 0.31
csys =  3.02 CPU)
Result: FAIL
Failed 5/24 test programs. 12/369 subtests failed.

--------------------8<---------------------


To make long story short, some tests of data-dump-streamer failed.

Note that I was using the latest release (2.37) of data-dump-streamer, which,
according to this link:

http://www.nntp.perl.org/group/perl.perl5.porters/2014/03/msg214101.html

is broken by PERL 5.20, and the author has yet to release a fix for it...

So, I think unless the package is updated within a week from now, we probably
should wait a bit longer...



Jason



------------------------------

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl


End of Perldl Digest, Vol 108, Issue 9
**************************************




_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to