Questions tagged [pdl]

PDL ("Perl Data Language") gives standard Perl the ability to compactly store and speedily manipulate the large N-dimensional data arrays which are the bread and butter of scientific computing.

PDL turns Perl in to a free, array-oriented, numerical language similar to (but, we believe, better than) such commerical packages as IDL and MatLab. One can write simple perl expressions to manipulate entire numerical arrays all at once. Simple interactive shells, pdl2 and perldl, are provided for use from the command line along with the PDL module for use in Perl scripts.

61 questions
3
votes
3 answers

Can I retrieve the full history of commands from a Perl pdl2 shell (like history in bash)?

I am using pdl2 shell, how can I list all my commands history?
Pablo Marin-Garcia
  • 4,151
  • 2
  • 32
  • 50
3
votes
4 answers

operating on AoAs stored in hash. PDL vs no PDL

I have a hash of AoAs: $hash{$key} = [ [0.0,1.0,2.0], 10.0, [1.5,9.5,5.5], ]; that I need to crunch as follows: $err += (($hash{$key}[0][$_]-$hash{key}[2][$_])*$hash{$key}[1])**2 foreach…
Demian
  • 215
  • 2
  • 9
3
votes
1 answer

Is there a symbolic implementation of the PDL API?

To test a matrix algorithm, I would like to be able to calculate with variables instead of numbers only but not change the algorithm itself. The direction in which I assume there is a solution (but probably there are others equally welcome) would be…
3
votes
1 answer

use PDL::Constants without "Subroutine redefined"

To be able to use the constant PI of Perl Data Language, I run with perl -w the lines: use strict; use warnings; use PDL::Constants qw( PI ); However, Perl warns me: Subroutine PDL::Constants::piddle redefined at…
3
votes
4 answers

Perl PDL : Search if a vector is in an array or in a matrix

I try to make a grep like on a PDL matrix or array of Vector : my @toto; push(@toto, pdl(1,2,3)); push(@toto, pdl(4,5,6)); my $titi=pdl(1,2,3); print("OK") if (grep { $_ eq $titi} @toto); I also tried my @toto; push(@toto, pdl(1,2,3)); push(@toto,…
Alexglvr
  • 427
  • 5
  • 18
3
votes
2 answers

How do I extract specific rows from a PDL matrix?

Suppose I have: $a = [ [1, 0, 1] [0, 1, 0] [0, 1, 1] ] and I want to extract all rows where $row[2] == 1. My resulting piddle would look like: $b = [ [1, 0, 1] [0, 1, 1] ] Is this possible with PDL?
marcantonio
  • 958
  • 10
  • 24
3
votes
1 answer

How to convert PDL image to GdkPixbuf

I'm trying to display a graph generated by PDL (using PLplot) inside a Gtk3 app. When I try the following code, I see two problems: $pdlImg isn't a GdkPixbuf so new_from_pixbuf() doesn't work. $pdlImg appears to be empty as because the error…
TheAmigo
  • 1,032
  • 1
  • 10
  • 29
3
votes
3 answers

Undefined subroutine &PDL::divide

I'm trying Perl's PDL in the following code: #!/usr/bin/perl -w use strict; use PDL::Core qw(pdl); use PDL::Math qw(isfinite); use PDL::Primitive qw(statsover); my $div = 4; my @array1 = (0..10); my $pdl_array =…
dannyjmh
  • 31
  • 4
3
votes
1 answer

Splitting a PDL in half

I have a one-dimensional PDL that I'd like to perform calculations on each half of; i.e. split it, then do calculations on the first half, and the same calculations on the second half. Is there an easier/nicer/elegant way to simply split the PDL in…
user1451035
3
votes
1 answer

How can I fix this PDL installation?

I have installed PDL on a Mac OS X (10.7.3) machine. Evidently the SciPDL installer places PDL.pm in /Library/Perl/5.12/darwin-thread-multi-2level, so I added use lib '/Library/Perl/5.12/darwin-thread-multi-2level'; at the top of my test script. I…
ArgentoSapiens
  • 428
  • 3
  • 15
2
votes
1 answer

Perl PDL glue not working?

I am new to PDL and please forgive my rudimentary question: I have two simple pdl objects pdl> p $a [ [1 2 3] [4 5 6] ] pdl> p…
2
votes
0 answers

Perl pdl graphics, fails to show image as specified in documentation

For those interested in solution please skip to continuation and solution. So, I am using Strawberry Perl 5.32.1.1-64, from zip, no msi, under Windows 11. Want to use pdl. The information on the internet over that issue is very poor and the support…
armagedescu
  • 1,758
  • 2
  • 20
  • 31
2
votes
1 answer

Does Perl PDL have a way to clamp a vector by min/max values given in another vector without iterating?

Does PDL already have a way to "clamp" vector elements to min/max values given in another vector? I've looked through the PDL::Math documentation but didn't see a good candidate option. I could unpdl/re-pdl but that seems like too much overhead. Is…
KJ7LNW
  • 1,437
  • 5
  • 11
2
votes
2 answers

Does Perl PDL have an equivalent of Math::Round::nearest()?

Does PDL already have a way to apply a "rounding" to the vector elements by some precision in the way that Math::Round::nearest() does? I've looked through the PDL::Math documentation but didn't see a good candidate option. I could unpdl/re-pdl but…
KJ7LNW
  • 1,437
  • 5
  • 11
2
votes
1 answer

Is there a map() equivalent for PDL without doing pdl( map {} unpdl)?

I would like to do something like this to call myfunc() on each element in-place on an existing PDL: $pdl = pdl [1,2,3]; $pdl = pdl [ map { myfunc($_) } @{ unpdl($pdl) } ]; I've searched through the documentation, but nothing yet: Is there a way to…
KJ7LNW
  • 1,437
  • 5
  • 11