From 5a27ae73014939889b8728529c62ab1b2b13cb6b Mon Sep 17 00:00:00 2001 From: Jonathan Leto Date: Tue, 20 May 2008 18:59:33 -0400 Subject: [PATCH] set() function for Vectors, untested... --- Vector.i | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Vector.i b/Vector.i index 641829c..77f2d97 100644 --- a/Vector.i +++ b/Vector.i @@ -63,4 +63,13 @@ sub get { return [ map { gsl_vector_get($self->{_vector}, $_ ) } @$indices ]; } +sub set { + my ($self, $indices, $values) = @_; + croak(__PACKAGE__.'::set($indices, $values) - $indices and $values must be array references of the same length') + unless ( ref $indices eq 'ARRAY' && ref $values eq 'ARRAY' && $#$indices == $#$values ); + + map { gsl_vector_set($self->{_vector}, @$indices[$_], @$values[$_] ) } (0..$#$indices); + return; +} + %} -- 2.11.4.GIT