From f7b60627481e061036f9609211d0f9986a36edda Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Thu, 27 Nov 2008 01:37:59 -0800 Subject: [PATCH] Various VectorComplex tidbits --- Changes | 1 + pod/VectorComplex.pod | 7 ++++--- t/VectorComplex.t | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Changes b/Changes index dd6bc89..e18d1a7 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ =head1 Math::GSL Changes =head1 v0.16 - November ?? 2008 + - New subsytems: VectorComplex and MatrixComplex - Operator overloading for addition and subtraction with vectors - Added copy() method to vectors - Improved Vector docs diff --git a/pod/VectorComplex.pod b/pod/VectorComplex.pod index 8ee77f3..a5a9f83 100644 --- a/pod/VectorComplex.pod +++ b/pod/VectorComplex.pod @@ -214,7 +214,7 @@ Returns a copy of the vector, which has the same length and values but resides a sub copy { my $self = shift; my $copy = Math::GSL::VectorComplex->new( $self->length ); - if ( gsl_vector_memcpy($copy->raw, $self->raw) != $GSL_SUCCESS ) { + if ( gsl_vector_complex_memcpy($copy->raw, $self->raw) != $GSL_SUCCESS ) { croak "Math::GSL - error copying memory, aborting"; } return $copy; @@ -224,10 +224,11 @@ sub _multiplication { my ($left,$right) = @_; my $lcopy = $left->copy; - if ( blessed $right && $right->isa('Math::GSL::Vector') ) { + if ( blessed $right && $right->isa(__PACKAGE__) ) { return $lcopy->dot_product($right); } else { - gsl_vector_scale($lcopy->raw, $right); + # will be in upcoming gsl 1.12 + # gsl_vector_complex_scale($lcopy->raw, $right); } return $lcopy; } diff --git a/t/VectorComplex.t b/t/VectorComplex.t index bdd70f2..8a2d788 100755 --- a/t/VectorComplex.t +++ b/t/VectorComplex.t @@ -9,6 +9,7 @@ use Math::GSL::Errno qw/:all/; use Math::GSL::Const qw/:all/; use Test::Exception; use Data::Dumper; +use Math::Complex; use strict; BEGIN{ gsl_set_error_handler_off(); } @@ -21,7 +22,7 @@ sub teardown : Test(teardown) { unlink 'vector' if -f 'vectorcomplex'; } -sub GSL_VECTOR_COMPLEX_NEW : Tests { +sub GSL_VECTOR_COMPLEX_NEW : Tests(7) { my $u = Math::GSL::VectorComplex->new(10); isa_ok($u, 'Math::GSL::VectorComplex'); ok( $u->length == 10, 'length'); @@ -38,4 +39,5 @@ sub GSL_VECTOR_COMPLEX_NEW : Tests { ok_similar( gsl_complex_abs($e1), 4, '2nd element: new get abs correct'); ok_similar( gsl_complex_arg($e1), $M_PI, '2nd element: new get arg correct'); } + Test::Class->runtests; -- 2.11.4.GIT