umeboshi has asked for the wisdom of the Perl Monks concerning the following question:

Hi
I'm sorry if I am repeating a question. Haven't been able to figure that out. I cannot use the GSL module and thus not the function which creates a new vector of a given size. I have been trying to find a different module which does that with no success. Any ideas on that?

I am looking for something like
my $vec = Math::GSL::Vec->new($length);
$vec = $vec+1; # adds 1 to each vector element

Thanks a lot!

Replies are listed 'Best First'.
Re: Vector of given size
by syphilis (Archbishop) on Jun 28, 2009 at 10:43 UTC
    This code will do the same as you described:
    use warnings; use strict; my $length = 10; my @vec = (0) x $length; $_ += 1 for @vec; print "@vec\n";
    Anything we can do to help you get Math::GSL installed ?

    Cheers,
    Rob
Re: Vector of given size
by ambrus (Abbot) on Jun 28, 2009 at 10:50 UTC

    There are lots of modules that can handle vetors: eg. there's PDL, possibly other interfaces for GSL or BLAS+Lapack, several interfaces for matlab and other languages oriented on numeric computations or computer algebra. Please be more specific on what you want to do with numeric vectors and then maybe we can give more specific advice.