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
1
vote
4 answers

What's the equivalent of R's ifelse in Perl PDL

I am new to PDL. R's ifelse() method can do conditonal element selection. For example, x <- c(1,2,3,4) ifelse(x%%2, x, x*2) # [1] 1 4 3 8 Anyone knows how to do this in PDL? I know you can do it like below, but is there any better ways? pdl(map {…
1
vote
1 answer

How to perform cartesian product in PDL

I want to take an arbitrary 1D vector a = [k] and b = [m] and form the matrix of ordered pairs c = [2 x k x m] such that $c->(:,(i),(j)) = [ $a->(i), $b->(j) ]. I.e. the set of all ordered pairs of the elements in a and b a.k.a the cartesian…
cms
  • 257
  • 1
  • 11
1
vote
2 answers

PDL matrix confusion

I have a simple but large data file. It's output from a neural network simulation. The first column is a time step, 1..200. The second is the target word (for the current simulation, 1..212). Then there are 212 columns, one for each word. That is,…
user20412
  • 193
  • 7
1
vote
1 answer

Can't locate PDL/Graphics/Simple.pm

I'm new to using PDL and after installing it under Ubuntu (12.04 LTS running on a Intel® Core™ i7-3630QM CPU @ 2.40GHz × 8 as dual-boot with Windows 8.1) I tried the first example given on First Steps with PDL but get an error message regarding…
1
vote
3 answers

Perl - Returning the maximum value in a data set

I have never delved into the world of Perl before and I find it pretty confusing and could use some help. In the code below the calc() section returns a running average of an'input' over 'count' samples. I would like to modify that so the calc()…
Primiano19
  • 21
  • 4
1
vote
1 answer

Using cov() function in PDL module

I want to compute covariance using PDL, but the problem is that it always shows an error: Undefined subroutine &main::cov called at line 12. Can anyone tell me where I'm making a mistake? #! usr/bin/perl use strict; use warnings; use PDL; my $a…
Jordan
  • 311
  • 1
  • 4
  • 11
0
votes
2 answers

export pdl() only from perl PDL

I want to export only the pdl() function from PDL to avoid namespace collision with other automatically exported functions such as max, median, sum, intersect etc. However, when I tried use PDL qw(pdl); it doesn't work as the aforementioned…
Zhang18
  • 4,800
  • 10
  • 50
  • 67
0
votes
2 answers

PDL pairwise row comparison

I have created a PDL matrix. I need to do a pairwise comparison between each row. Currently I am using the 'where' and 'cov' command to return the pairwise comparison for two slices (generated in a perl loop). My question: How can I use…
0
votes
1 answer

Perldl failing to plot. Gnuplot fails to deploy with cpan

Started separated topic with clean new install as suggested by Håkon Hægland. For those who are interested in solution, skip to end. Gnuplot failing to install. Problem described here Now removed all perl and started from clean install. Using…
armagedescu
  • 1,758
  • 2
  • 20
  • 31
0
votes
2 answers

Rounding towards zero on a PDL

I have a PDL (type double) of mixed values (both positive and negative). I want to round each entry towards zero. So +1.2 becomes +1, +1.7 becomes +1, -1.2 becomes -1, and -1.7 becomes -1, I thought of using int(), but it doesn't work on PDL…
CinCout
  • 9,486
  • 12
  • 49
  • 67
0
votes
1 answer

Installing Perl and PDL

I am currently trying - unsuccessfully to install perl PDL as I would like to automate some of my data analysis and graphics generation. Unfortunately I seem unable to even install the necessary modules without issue, let alone create a small script…
NzFrancis
  • 13
  • 7
0
votes
1 answer

Perl PDL -> GnuPlot -> AutoScale => 95% WhiteSpace?

3 XY datasets to plot: A) Function plot XY B) Polynomial, shares X with function, Y is poly_eval(x) C) Polynomial_error; X, Y=poly(x) - fct(x) Range X: ]0.0 .. 1.0[ (full range 0->1 plus some extra, both sides Range Y: ]0.0 .. 1.0[ Wanted: All…
0
votes
1 answer

Importing matrix from text file to PDL

Rather than creating the matrix using PDL, I would like to know ways to use existing matrix in TAB delimited file in PDL. I wish to perform math operations on that matrix. I tried math operations on randomly created matrix in situ but I have no idea…
BioDeveloper
  • 618
  • 3
  • 8
  • 25
0
votes
2 answers

Large Matrix Multiplication using PDL - Perl

I need to generate (40000 x 20000) matrix via SQL and perform matrix operation like A'A. Then I need to obtain Eigen value and Eigen Vectors. Can you suggest me ways to implement this in Perl. (Maybe via PDL) How can I multiply large matrix stored…
Ronak Agrawal
  • 438
  • 3
  • 13
0
votes
6 answers

cryptic perl expression

I find the following statement in a perl (actually PDL) program: /\/([\w]+)$/i; Can someone decode this for me, an apprentice in perl programming?
BoomerTN
  • 3
  • 2