Skip to content

Instantly share code, notes, and snippets.

@run4flat
run4flat / FuncND.pm.PL
Created March 13, 2013 18:45
First cut at PDL::FuncND.pm.PL for Diab
use strict;
use warnings;
# Generates FuncND.pm. Call with
# perl FuncND.pm.PL FuncND.pm
my $out_filename = $ARGV[0];
open my $out_fh, '>', $out_filename;
@run4flat
run4flat / Prima.pm
Last active December 14, 2015 20:29
First cut at PDL::Demos::Prima
use strict;
use warnings;
############################################################################
package PDL::Demos::Prima;
############################################################################
# It's a shame that PDL::Demos::Routines is in a file called
# PDL::Demos::Screen. Oh well.
use PDL::Demos::Screen;
@run4flat
run4flat / Minimal.c
Last active December 13, 2015 21:08
C code auto-generated from XS code that gives trouble when compiled with nvcc.
/*
* This file was generated automatically by ExtUtils::ParseXS version 3.18 from the
* contents of Minimal.xs. Do not edit this file, edit Minimal.xs instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
#line 1 "lib/CUDA/Minimal.xs"
#include "EXTERN.h"
@run4flat
run4flat / piddlebot.pl
Created February 14, 2013 21:55
Piddlebot, used on irc.perl.org#pdl
#!/usr/bin/perl
use warnings;
use strict;
use POE;
use POE::Component::IRC::State;
use constant CHANNEL => '#pdl';
# Load the current piddlebot functions:
use piddlebot;
my $last_modified = (stat('piddlebot.pm'))[9];
@run4flat
run4flat / matmult_pdl_thr.pl
Created February 13, 2013 03:55
Multicore matrix multiplication using PDL::Parallel::threads
#!/usr/bin/env perl
##
## Usage:
## perl matmult_pdl_thr.pl 1024 ## Default size is 512: $c = $a * $b
##
## by David Mertens
## based on code by Mario Roy
#################
@run4flat
run4flat / add-labels-via-full-plot-call.pl
Created January 21, 2013 17:54
Adding axis labels via single plot() function call.
use PDL::Graphics::Prima::Simple;
plot(
-data => ds::Pair($time, $temp,
plotType => ppair::Lines,
),
x => { label => 'Days into the Future' },
y => { label => 'Temperature (Degrees Fahrenheit)' },
);
@run4flat
run4flat / add-forecast-lables-via-method-calls.pl
Created January 21, 2013 17:48
Adding axis labels via method calls in the plot object.
use PDL::Graphics::Prima::Simple;
my ($window, $plot) = line_plot $time, $temp;
$plot->x->label('Days into the Future');
$plot->y->label('Temperature (Degrees Fahrenheit)');
$plot->title("Forecast for $zip_code");
$window->execute;
use PDL::Graphics::Prima::Simple;
line_plot $time, $temp;
@run4flat
run4flat / forecast-view-simple.pl
Last active December 11, 2015 10:29
Basic script for viewing forecasts for a specified zip-code; no axis labels or title.
#!/usr/bin/env perl
use strict;
use warnings;
#############################
# Getting the Forecast Data #
#############################
use PDL;
use Time::Piece;
sub build_state_func {
my $state_var
return sub {
# work with state here
}
}
...
*globref = build_state_func();