gsl

What is gsl::multi_span to be used for?

匿名 (未验证) 提交于 2019-12-03 01:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: The C++ core guidelines mention spans, not "multi-spans". But - I see that Microsoft's GSL implementation has a multi_span class template < typename ValueType, std::ptrdiff_t FirstDimension, std::ptrdiff_t... RestDimensions > class multi_span { ... }; So, obviously this is some sort of a multi-dimensional version of gsl::span . But what is that supposed to mean? Why do we need this multi-dimensional span, or rather - when would we use it? I can't seem to find any documentation on this. 回答1: In short, it is a span over contiguous piece of

Problems installing gsl gem

匿名 (未验证) 提交于 2019-12-03 01:34:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I can succesfully install the gsl library in my home directory, but when I try to install the gsl gem I get a big list of errors that I do not understand. I am wondering if someone could give me some idea why I could be getting those errors. I can say I have: Installed gsl succesfully; at least that is what it looked like. I pointed the path to gsl-config This is what the error log looks like: ... 回答1: Install ruby GSL: Ubuntu 11.10 includes a newer version (1.15) of libgsl0 that is not compatible with ruby/gsl : Must install older version 1

gsl_odeiv2 in c++ class: Template wrapper for int(…) ode

匿名 (未验证) 提交于 2019-12-03 01:06:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am currently using gsl_odeiv2 methods inside my classes to solve differential equations. But because of the well known memberfunction problem I can not define my ode-system inside the class. I am currently using a workaround: I define my ode in a global namespace: ODE.hpp: #include "EoS.hpp" #include <gsl/gsl_math.h> #include <gsl/gsl_errno.h> namespace ODEs { struct tov_eq_params {EoS *eos;}; int tov_eq(double, const double *, double *, void *); } ODE.cpp: namespace ODEs { int tov_eq(double r, const double *PM, double *dPdM, void *p) {

在Ubuntu上使用GSL库

匿名 (未验证) 提交于 2019-12-03 00:34:01
在Linux系统上,比较好的科学计算库应该就属GSL库了,而且GSL库编译安装非常方便,没有任何第三方库依赖,直接编译安装即可,这在开源软件界绝对是一个不小的奇迹,因为绝大多数开源软件,想要编译运行,都会把我们折磨得死去活来,解决一个又一个依赖库和版本冲突,是一个绝对的体力活,还需要耐心和毅力。所以GSL库真的是一个不可多得的开源科学计算库。 我们首先下载GSL源码: git clone git : //git .savannah .gnu .org /gsl .git 其会把代码下载到当前目录下的gsl目录,进入gsl目录,运行: ./ autogen . sh 然后运行: . / configure -- enable - maintainer - mode 然后运行: make make install 其会将头文件安装到/usr/local/include目录,库文件安装到/user/local/lib目录下。 为了验证编译安装成功,编辑如下文件: #include <stdio.h> #include <gsl/gsl_sf_bessel.h> int main ( int argc , char ** argv ) { double x = 5.0 ; double y = gsl_sf_bessel_J0 ( x ); printf ( "bessel=%f\r\n"

在Ubuntu上使用GSL库

匿名 (未验证) 提交于 2019-12-03 00:34:01
在Linux系统上,比较好的科学计算库应该就属GSL库了,而且GSL库编译安装非常方便,没有任何第三方库依赖,直接编译安装即可,这在开源软件界绝对是一个不小的奇迹,因为绝大多数开源软件,想要编译运行,都会把我们折磨得死去活来,解决一个又一个依赖库和版本冲突,是一个绝对的体力活,还需要耐心和毅力。所以GSL库真的是一个不可多得的开源科学计算库。 我们首先下载GSL源码: git clone git://git .savannah .gnu .org /gsl .git 其会把代码下载到当前目录下的gsl目录,进入gsl目录,运行: ./autogen .sh 然后运行: . /configure -- enable -maintainer -mode 然后运行: make make install 其会将头文件安装到/usr/local/include目录,库文件安装到/user/local/lib目录下。 为了验证编译安装成功,编辑如下文件: #include <stdio.h> #include <gsl/gsl_sf_bessel.h> int main( int argc, char ** argv) { double x = 5.0 ; double y = gsl_sf_bessel_J0(x); printf ( "bessel=%f\r\n" , y); return

Using random numbers with GPUs

北城余情 提交于 2019-12-03 00:03:00
I'm investigating using nvidia GPUs for Monte-Carlo simulations. However, I would like to use the gsl random number generators and also a parallel random number generator such as SPRNG. Does anyone know if this is possible? Update I've played about with RNG using GPUs. At present there isn't a nice solution. The Mersenne Twister that comes with the SDK isn't really suitable for (my) Monte-Carlo simulations since it takes an incredibly long time to generate seeds. The NAG libraries are more promising. You can generate RNs either in batches or in individual threads. However, only a few

R BayesVarSel on Ubuntu installation

时间秒杀一切 提交于 2019-12-02 07:18:52
问题 I'm trying to install the BayesVarSel package on a ubuntu 12 box on AWS EC2 . It works fine on my windows 7 machine ( R 2.15.1 ). I've attached a screenshot of the error message. It appears to be an issue with the GNU GSL library. I couldn't find a quick way to install GSL (ie sudo apt-get GSL, etc.) so I wanted to see if others have had a similar issue. I'm open to other packages with similar functionality. EDIT: A couple other things I've tried without luck : 回答1: I was able to recreate the

Linking GSL in Cmakelists.txt in CLion

做~自己de王妃 提交于 2019-12-02 05:45:12
问题 I have a code with multiple files, that uses the GSL Library. When I compile the code through the terminal with the command g++ main.cpp -lm -lgsl -lgslcblas -o Exec This compiles and gives the correct output and no errors. However, when I try and build the code in CLion I get the error undefined reference to `gsl_rng_uniform' I have linked the various .cpp files in my code through the CMakeLists.txt, but I think, I have to something similar to the flags to link to GSL. My CMakeLists.txt file

C++ wrapper for GSL root finding algorithm with derivative

梦想的初衷 提交于 2019-12-01 21:41:07
问题 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 derivative in advance. But I wonder if this can be done more elegant with a wrapper. Some time ago I found a very handy template (GSL C++ wrapper) which works fine for one function to e.g. integrate and I make heavy usage of it. Now I am wondering if

C++ wrapper for GSL root finding algorithm with derivative

故事扮演 提交于 2019-12-01 20:41:34
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 derivative in advance. But I wonder if this can be done more elegant with a wrapper. Some time ago I found a very handy template (GSL C++ wrapper) which works fine for one function to e.g. integrate and I make heavy usage of it. Now I am wondering if this approach can be extended to provide two functions for the GSL, namely the function itself and its