From c50aaeddc826066389c889034c667757855c2101 Mon Sep 17 00:00:00 2001 From: Jonathan Leto Date: Tue, 17 Jun 2008 05:57:28 -0700 Subject: [PATCH] Fixed the Linalg test. The only problem was that the gsl_permutation header file was not included in the interface file. Some other headerss may be needed for other functions in Linalg. --- Linalg.i | 2 ++ lib/Math/GSL/Linalg/Test.pm | 18 +++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Linalg.i b/Linalg.i index 6687856..cd6c0ec 100644 --- a/Linalg.i +++ b/Linalg.i @@ -3,9 +3,11 @@ %{ #include "/usr/local/include/gsl/gsl_linalg.h" + #include "/usr/local/include/gsl/gsl_permutation.h" %} %include "/usr/local/include/gsl/gsl_linalg.h" +%include "/usr/local/include/gsl/gsl_permutation.h" %perlcode %{ @EXPORT_OK = qw/$GSL_LINALG_MOD_NONE $GSL_LINALG_MOD_TRANSPOSE $GSL_LINALG_MOD_CONJUGATE diff --git a/lib/Math/GSL/Linalg/Test.pm b/lib/Math/GSL/Linalg/Test.pm index 2ca3257..a2774a5 100644 --- a/lib/Math/GSL/Linalg/Test.pm +++ b/lib/Math/GSL/Linalg/Test.pm @@ -20,15 +20,15 @@ sub teardown : Test(teardown) { sub GSL_LINALG_LU_DECOMP : Tests { my $self = shift; - my $line; - for ($line=0; $line<5; $line++){ - map { gsl_matrix_set($self->{matrix}, $line, $_, $_) } (0..4); } - my $p->{permutation} = gsl_permutation_alloc(5); - gsl_permutation_init($p->{permutation}); - print Dumper [ $p->{permutation} ]; - my ($result, $signum) = gsl_linalg_LU_decomp($self->{matrix}, $p->{permutation}); - is ($result, 0); - is ($signum, 1); + + for my $row (0..4) { + map { gsl_matrix_set($self->{matrix}, $row, $_, $_) } (0..4); + } + + my $permutation = gsl_permutation_alloc(5); + gsl_permutation_init($permutation); + my ($result, $signum) = gsl_linalg_LU_decomp($self->{matrix}, $permutation); + is_deeply( [ $result, $signum ], [ 0, 1] ); } 1; -- 2.11.4.GIT