gsl

Function pointers working as closures in C++

社会主义新天地 提交于 2019-12-04 03:52:07
问题 Is there a way in C++ to effectively create a closure which will be a function pointer? I am using the Gnu Scientific Library and I have to create a gsl_function. This function needs to effectively "close" a couple of parameters available when I create it. Is there a nice trick to create a closure so that I don't have to pass all of them as params in the gsl_function structure? If not, should I just pass in a pointer to an array containing these parameters? EDIT I have tried to use boost:

How to CORRECTLY install gsl library in Linux?

夙愿已清 提交于 2019-12-03 16:44:24
I got a problem while installing the GNU Scientific Library (gsl). I put the package on my desktop, and did "./configure", "make", and "sudo make install", according to the document included. I checked the /usr/local/include directory, there is a newly created "gsl" folder in there. But When I tried to use the functions provided by the library, the "undefined reference to 'gsl_sf_beta_inc'" error occurred. Here is my code. #include <stdio.h> #include <gsl/gsl_sf_gamma.h> int main (void) { double a = 20; double b = 1000; double x = 0.5; double result = gsl_sf_beta_inc(a, b, x); printf("%f/d",

How to implement a left matrix division on C++ using gsl

放肆的年华 提交于 2019-12-03 16:03:14
I am trying to port a MATLAB program to C++. And I want to implement a left matrix division between a matrix A and a column vector B . A is an m-by-n matrix with m is not equal to n and B is a column vector with m components. And I want the result X = A\B is the solution in the least squares sense to the under- or overdetermined system of equations AX = B . In other words, X minimizes norm(A*X - B) , the length of the vector AX - B . That means I want it has the same result as the A\B in MATLAB. I want to implement this feature in GSL-GNU (GNU Science Library) and I don't know too much about

installing GSL on Windows XP 32bit for use with codeblocks

匿名 (未验证) 提交于 2019-12-03 10:24:21
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am trying to install Gnu Scientific Library (GSL) on Windows XP, but this is very difficult for me. I found this site http://gnuwin32.sourceforge.net/packages/gsl.htm from which I downloaded "Complete package, except sources" and installed. But this is only 6.2MB large, which I find to be very small. Is this correct? I would be happy to get some help with this. I don't understand why this has to be so difficult. 回答1: I am beginner as well, but I just managed to have it work on windows 8 with codeblock 12.11. installing gsl from

error while loading shared libraries: libgsl.so.0: cannot open shared object file: No such file or directory

早过忘川 提交于 2019-12-03 10:22:40
I use gsl. After I compiled my .cpp file and run it, I faced with below error: error while loading shared libraries: libgsl.so.0: cannot open shared object file: No such file or directory I found same as this problem in: https://groups.google.com/forum/#!topic/cortex_var/6vluX7pP0Sk & Linux error while loading shared libraries: cannot open shared object file: No such file or directory & http://www.gnu.org/software/gsl/manual/html_node/Shared-Libraries.html And I have done as in the above links wrote but the error is still remained. Can anyone help me? To make it work do the following steps

OpenMP and GSL RNG - Performance Issue - 4 threads implementation 10x slower than pure sequential one (quadcore CPU)

匿名 (未验证) 提交于 2019-12-03 08:44:33
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to turn a C project of mine from sequential into parallel programming. Although most of the code has now been redesigned from scratch for this purpose, the generation of random numbers is still at its core. Thus, bad performance of the random number generator (RNG) affects very badly the overall performance of the program. I wrote some code lines (see below) to show the problem I am facing without much verbosity. The problem is the following: everytime the number of threads nt increases, the performance gets singnificantly worse.

Linking GSL (or other library) statically into a shared library

匿名 (未验证) 提交于 2019-12-03 07:36:14
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Note: Despite the mentioning of Python in the following there is a good chance for my problem not to be Python related at all. If I am not mistaken the “module” I mention is equivalent to a C library―at least for the concerns of my problem. On Debian I am trying to create a Python module with C, which in turn uses the GSL. The following Makefile successfully compiles it: CC = gcc -Wall -fPIC -O3 NAME = meinzeug matrizenwuerfler: $(SRC) $(CC) -o $(NAME).o -I/usr/lib/python2.5/site-packages/numpy/core/include -I/usr/include/python2.5 -c $(NAME

Floating-point optimizations - guideline

风流意气都作罢 提交于 2019-12-03 06:02:36
问题 The majority of scientific computing problems that we need solve by implementing a particular algorithm in C/C++ demands accuracy that are much lower than double precision. For example, 1e-6 , 1e-7 accuracy covers 99% of the cases for ODE solvers or numerical integration. Even in the rare cases when we do need higher accuracy, usually the numerical method itself fail before we can dream of reaching an accuracy that is near double precision. Example: we can't expect 1e-16 accuracy from a

Using GNU Scientific Library (GSL) under Windows x64 with MinGW

冷暖自知 提交于 2019-12-03 02:51:28
I have installed MinGW and MSYS on Microsoft Windows (64bit), inside directory C:\MinGW (MSYS directory is C:\MinGW\msys\1.0 ). I have downloaded the latest GNU Scientific Library ( GNU GSL ) package from the official ftp . I have used MSYS to perform configure and make successfully as described in the INSTALL file in the GSL package. That means, in the MSYS command-line interface, in the MSYS home directory, I have inserted: $ ./configure $ make $ make install This produces a local directory under the MSYS directory ( C:\MinGW\msys\1.0 ) including the directories bin , include , lib , and

R not recognizing GSL library undefined references

匿名 (未验证) 提交于 2019-12-03 01:41:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am installing a package from github in R (link here: https://github.com/aliceyiwang/mvabund ), using devtools. I have installed Rtools, using the instructions for another package (here: https://cran.r-project.org/web/packages/dynr/vignettes/InstallationForUsers.pdf ) and all the checks there indicate that GSL and RTools are installed properly. I've set the Windows system environment variables LIB_GSL (as "C:/R/local323" ) and PATHS (as "C:/RTools/bin/", "C:/RTools/mingw_64/bin", "C:/R/R-3.5.1/bin" ) I also run the following code in R