Jonathan "Duke" Leto
13 years ago
3 changed files with 70 additions and 0 deletions
@ -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 }, |
|||
}); |
|||
|
|||
} |
@ -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; |
|||
} |
@ -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 "!!!"; |
Loading…
Reference in new issue