Hi!
I am new to GSL and trying to permute a vector using the function 
gsl_permute_vector. But I get gsl_permute_vector is not defined for this scope. 

Could you please help me? I think it is rather easy but I am stuck.

Plus, why is the return value of the function int? (There are other functions 
in the library with return int but if  used in the code examples they are used 
like return void.
My code is below.  Thanks for any suggestions! 

// permute_vector.cc

#include <stdio.h>
#include <gsl/gsl_permutation.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
#include<gsl/gsl_rng.h>
#include<gsl/gsl_randist.h>
#include <iostream>
    using namespace std;

int main (void)
{
    gsl_permutation * p = gsl_permutation_alloc (3);
  gsl_permutation_init (p);
    
    int i;
    gsl_vector * v = gsl_vector_alloc (3);
    for (i = 0; i < 3; i++)
    {
        gsl_vector_set (v, i, 1.23 + i);
    }
    
    
    for (i = 0; i < 3; i++) 
    {
        printf ("v_%d = %g\n", i, gsl_vector_get (v, i));
    }
    
    cout << "Permute vector: " << endl;
    gsl_permute_vector(p,v);
    
    for (i = 0; i < 3; i++) 
    {
        printf ("v_%d = %g\n", i, gsl_vector_get (v, i));
    }

    gsl_vector_free (v);
    return 0;
}

BTW, is there a web page with more examples using the GSL? Web search didn't 
find much...

Kind regards
  Oliver

Unbegrenzter Speicher, Top-Spamschutz, 120 SMS und eigene E-MailDomain inkl.
http://office.freenet.de/dienste/emailoffice/produktuebersicht/power/mail/index.html

_______________________________________________
Help-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gsl

Reply via email to