Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add some random scripts found on an old server

  • Loading branch information...
commit f1fdfedf009fd9b75e9574f0ea378e847475503a 1 parent 222e944
@leto authored
Showing with 70 additions and 0 deletions.
  1. +28 −0 misc/bench.pl
  2. +29 −0 misc/log_stuff.c
  3. +13 −0 misc/push_gsl_docs
View
28 misc/bench.pl
@@ -0,0 +1,28 @@
+#!/usr/bin/perl -w
+
+use Math::MatrixReal;
+use Benchmark;
+do 'funcs.pl';
+my $matrix1 = Math::MatrixReal->new_random(10);
+my $matrix2 = $matrix1->new_random(5);
+
+my @matrices = map { Math::MatrixReal->new_random($_) } qw(5 10 15 20);
+
+my $iter = 1000;
+
+for my $matrix ( @matrices ) {
+ my ($r,$c) = $matrix->dim;
+ print "Benchmarking $r x $c matrix\n";
+
+ timethese($iter,
+ {
+ 'matrix_squared ' => sub { $matrix ** 2 },
+ 'matrix_times_itself' => sub { $matrix * $matrix },
+ 'det ' => sub { $matrix->det },
+ 'det_LR ' => sub { $matrix->decompose_LR->det_LR },
+ 'inverse ' => sub { $matrix->inverse() },
+ 'to_negative_one ' => sub { $matrix ** -1 },
+ 'invert_LR ' => sub { $matrix->decompose_LR->invert_LR },
+ });
+
+}
View
29 misc/log_stuff.c
@@ -0,0 +1,29 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+/* Ref. a.o. http://www.ansic.net/showlog.php?id=31&res=log%20function */
+
+int
+main(int argc, char **argv)
+{
+ double a, b;
+
+ a = INFINITY;
+ b = log(a);
+ printf("log(%3f)\t\t= %5f errno=%2d (expected: inf / %d)\n", a, b, errno, 0);
+
+ a = -INFINITY;
+ b = log(a);
+ printf("log(%3f)\t\t= %5f errno=%2d (expected: nan / %d)\n", a, b, errno, EDOM);
+
+ a = -1;
+ b = log(a);
+ printf("log(%3f)\t\t= %5f errno=%2d (expected: nan / %d)\n", a, b, errno, EDOM);
+
+ a = NAN;
+ b = log(a);
+ printf("log(%3f)\t\t= %5f errno=%2d (expected: nan / %d)\n", a, b, errno, EDOM);
+
+ return 0;
+}
View
13 misc/push_gsl_docs
@@ -0,0 +1,13 @@
+#!/usr/bin/perl5.10.0 -w
+
+use strict;
+use warnings;
+use 5.010;
+
+my $pod_dir = q{blib/libhtml/site/lib};
+my $html_dir = q{/export/domains/leto.net/htdocs/code/Math-GSL/htmldocs};
+my $host = shift || q{leto.net};
+my $cmd = qq[./Build html && scp -prv $pod_dir/* ${host}:$html_dir];
+
+say " Running => $cmd" && qx{ $cmd };
+say "!!!";
Please sign in to comment.
Something went wrong with that request. Please try again.