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
4
votes
1 answer

Undefined references in GSL

I'm trying to link gsl in a small c program. #include "stdlib.h" #include "stdio.h" #include "gsl/gsl_block_float.h" #include "gsl/gsl_matrix_float.h" int main(void) { gsl_matrix_float* m = gsl_matrix_float_alloc(2, 2); …
user4468022
4
votes
1 answer

Cannot use GSL library on macOS - ld: symbol(s) not found for architecture x86_64

I have followed the instructions provided for installing the GSL-1.16 library and I think I have successfully installed the library. However when I try to compile & run the example program found in the website…
bergercookie
  • 2,542
  • 1
  • 30
  • 38
4
votes
2 answers

Random numbers from binomial distribution

I need to generate quickly lots of random numbers from binomial distributions for dramatically different trial sizes (most, however, will be small). I was hoping not to have to code an algorithm by hand (see, e.g., this related discussion from…
Sarah
  • 1,614
  • 1
  • 23
  • 37
4
votes
1 answer

C++ wrapper for GSL root finding algorithm with derivative

So, while I am pretty happy to find a lot of answers on Stack Overflow I decided it is time to ask a question myself. I am trying to use a root finding algorithm with derivatives. In accordance with the GSL I have to define the function and its…
user3809161
4
votes
1 answer

Numerical integration of smooth unimodal function with GSL?

Can someone post a simple example of numerical integration of a smooth unimodal function in a finite interval with GSL?
a06e
  • 18,594
  • 33
  • 93
  • 169
4
votes
2 answers

Sine wave least squares curve fitting possible (using GSL)?

Is it possible to fit an A*sin(B*t+C) function with GSL or a similar library? i want to get the A and C parameter of a sine wave present in 4096 samples (8bit) and can provide an good approximation of B. A think that should be possible with GSLs…
Benjamin
  • 286
  • 3
  • 12
4
votes
2 answers

Cython, C++ and gsl

So I have set up a c++ class with say class.cpp, class.h. class.cpp uses some functions from gsl (it has #include ) I have no problem linking this to another c++ file main.cpp and I can compile it with g++ -o main main.o class.o …
Jonathan Lindgren
  • 1,192
  • 3
  • 14
  • 31
4
votes
1 answer

Extend and Embed Python (and NumPy) with C++ (and GSL): pass gsl_matrix to python and back

my problem "should" be simple but I am still not able to solve it. I am currently working on a project that requires some heavy computations (done in C++) and some post-simulations data analysis (done in Python). However, now I am changing the main…
Rene
  • 41
  • 2
4
votes
1 answer

Internal compiler error with nested functions in OpenMP parallel regions

I tried to call the Monte Carlo integration subroutine of GSL library to do some numerical calculation. Because my for loop is rather simple, meaning the results of different runs are independent, I expect it should be very straightforward to…
Leo Fang
  • 773
  • 5
  • 12
4
votes
3 answers

Making a subset from a large C library

I am using some functions of the GSL library in my C application. This library is so large and has a lot of functions and facilities which I want only a few of them. My problem is that I want to use my application on a small embedded system and…
Saba Jamalian
  • 750
  • 2
  • 10
  • 24
4
votes
2 answers

is there a count_if function for a gsl_vector? C/C++

I am using the gnu scientific library (GSL). Say I have a gsl_vector like this: 7 0 -6 5 8 0 10 -2 That's a vector containing positive numbers, negative numbers, and zeros as elements. I want to count the number of non-zero elements or zero…
blur
  • 53
  • 6
4
votes
3 answers

Linking GSL to C via make

Umpteenth linking question. I am trying to build some simple C code that calls the GNU scientific library. However, the GSL folder is not nested in my project folder. So, the code lives in, say, C:/c-examples/ and the GSL library is C:/gsl. This is…
tchakravarty
  • 10,736
  • 12
  • 72
  • 116
4
votes
4 answers

Complex matrix exponential in C++

Is it actually possible to calculate the Matrix Exponential of a Complex Matrix in c / c++? I've managed to take the product of two complex matrices using blas functions from the GNU Science Library. for matC = matA * matB: gsl_blas_zgemm…
Quantum_Oli
  • 267
  • 2
  • 10
3
votes
1 answer

Should I use pow and sqrt or just pow for half integers?

In C, I was wondering whether there's an 'optimal' way to compute half-integer powers. In a nutshell, the problem is computing x^(n/2) (assuming n is odd and decently small, and x is a some float). Is there a major difference in performance/accuracy…
3
votes
2 answers

parallelizing linear algebra using gsl library

In my c++ scripts, I have many for loops to compute linear algebra operations. I am wondering what is the best way to make the loops parallel? One example is the following function which computes the kronecker product of two matrices. void…
Dalek
  • 4,168
  • 11
  • 48
  • 100