Questions tagged [gsl]

The GNU Scientific Library (GSL) is a numerical library for C and C++ programmers.

The GNU Scientific Library (GSL) is a numerical library for C and C++ programmers. It is free software under the GNU General Public License.

The library provides a wide range of mathematical routines such as random number generators, special functions and least-squares fitting. There are over 1000 functions in total with an extensive test suite.

http://www.gnu.org/software/gsl/

748 questions
0
votes
1 answer

GSL - GNU Scientific Library: avoid deep copies

I need to pass a gsl_vector to a function that expects a C style array, and vice versa. The slow approach (which involves a deep copy) should be: const size_t n = 4; gsl_vector gx; // initialize and fill gsl_vector gy; // initialize double…
Pietro
  • 12,086
  • 26
  • 100
  • 193
0
votes
1 answer

Why can't gsl_vector_alloc be called before main starts?

From the 21st century C book: Static variables, even those inside of a function, are initialized when the program starts, before main, so you can’t initialize them with a nonconstant value. //this fails: can't call gsl_vector_alloc() before…
qed
  • 22,298
  • 21
  • 125
  • 196
0
votes
1 answer

Convert from double (GNU scientific library) to SC16Q11 in C

I'm using the GNU Scientific Library to define & use complex numbers. A complex number is defined as typedef struct{ double dat[2]; } gsl_complex; Which is just representing real and imaginary parts as a double-precision floating point…
user2742907
  • 87
  • 1
  • 11
0
votes
0 answers

Generating a multinomial distribution

I am trying to write/find a code piece/function which gives back a multinomial distribution given a number and a probability array, say a function: Mult(N, pp[]) For example, for pp={0.3, 0.2, 0.5}, (pp can have variable sizes, say 2 to 10…
0
votes
0 answers

c++ gsl interaction between objects in ode

Would you please help me with my problem. I'm trying to write a program where objects in different class interact. I base my model on the gsl library to resolve my ordinary differential equations (ode). Instances of different classes consume each…
Myotis
  • 45
  • 4
0
votes
1 answer

segfault using STL deque

I'm getting a strange segfault on my code (see below) when the loop arrives on the 81o iteration, and I have no idea why it's happening. I used valgrind, but it spilled an incomprehensible error, which I supose that comes from stl, resulting in…
Hydro Guy
  • 113
  • 2
  • 8
0
votes
1 answer

GSL Eigen Value Code

I am working with GSL right now. I am facing some problem in finding Eigenvalues. It seems that GSL is not properly giving eigenvalues in case of symmetric matrices. I gave the input of certain symmetric matrices that ought to have 0 as an…
0
votes
1 answer

Finding roots of a function

I would like to re-write a code from python to cython, and so far I cythonized all the parts which I simplified in this example by not using them. Therefore I could not keep the python shape of this function. However, I need to estimate the root of…
Dalek
  • 4,168
  • 11
  • 48
  • 100
0
votes
1 answer

Another GSL linking error in Windows

I've done everything, and it's payed off. Trying to compile a mex file from MATLAB using the Windows 7.1 SDK. ~ I've created an compiled my C source code on GCC ~ I've created a MEX file that links and compiles fine via GCC on both Linux and OS X.…
user3145575
0
votes
1 answer

Write and read struct with dynamic arrays and gsl_vectors in C

I have an structure similar to: typedef struct FOO { int m,n; int * am; gsl_vector * bn; } foo; To allocate this structures I do: foo * bar; bar=foo_alloc ( 10, 10 ); Where foo * foo_alloc ( int m, int n ) { foo * f =…
alexis
  • 410
  • 4
  • 18
0
votes
1 answer

Applying callback to call gsl_integration

I am a newbie in c++ and I am trying to modify a code and use gsl_integration library of c in a class called Cosmology. In order to assign member functions to to form a pointer for gsl, I used callback procedure I found by looking up in internet…
Dalek
  • 4,168
  • 11
  • 48
  • 100
0
votes
1 answer

Finding installation path for GSL

I need to install GSL for a package in R and so I did via macports using the following command: sudo port install gsl This seems to work successfully. What I need to know is how can I find the installation path for GSL. In order to install the…
theamateurdataanalyst
  • 2,794
  • 4
  • 38
  • 72
0
votes
1 answer

GSL Error Handler status with Wrapper function in C++

I'm using this wrapper function in c++ for gsl that I saw on other solutions gsl_function_pp Fp( std::bind(&Class::member_function, &(*this), std::placeholders::_1) ); gsl_function *F = static_cast(&Fp); In documentation of…
questioner
  • 107
  • 10
0
votes
0 answers

How to deal with out of range error?

update: forgot to mention that for the loop 1-51 are ok to run but any number larger. will not.... The error is gsl: ../gsl/gsl_matrix_double.h:275: ERROR: first index out of range Default GSL error handler invoked. Aborted The structure of my…
0
votes
2 answers

wrong results of the function gsl_cdf_ugaussian_Pinv

I run this program: #include #include int main(){ double x= 0.5; double res = gsl_cdf_ugaussian_Pinv(x); printf("icdf(%f)=%f\n",x,res); return 0; } For some reason the output is:…
dafnahaktana
  • 837
  • 7
  • 21