sciruby / rb-gsl Goto Github PK
View Code? Open in Web Editor NEWRuby interface to the GNU Scientific Library
Home Page: https://github.com/SciRuby/rb-gsl
License: Other
Ruby interface to the GNU Scientific Library
Home Page: https://github.com/SciRuby/rb-gsl
License: Other
Currently numbers of the Ruby Complex
type cannot be assigned to a matrix of type GSL::Matrix::Complex
, it must have GSL::Complex
types:
q = GSL::Matrix::Complex.alloc(2,2)
# => #<GSL::Matrix::Complex[2,2]:0x7da6cc0>
# [ [ 0.000e+00 0.000e+00 ] [ 0.000e+00 0.000e+00 ]
# [ 0.000e+00 0.000e+00 ] [ 0.000e+00 0.000e+00 ] ]
q[0,0] = Complex(2,3)
# TypeError: wrong type Complex, (nil, Array, Float, Integer, or GSL::Complex expected)
q[0,0] = GSL::Complex.alloc(2,3)
#=> #<GSL::Matrix::Complex[2,2]:0x7d9b488>
#[ [ 2.000e+00 3.000e+00 ] [ 0.000e+00 0.000e+00 ]
# [ 0.000e+00 0.000e+00 ] [ 0.000e+00 0.000e+00 ] ]
Making this work with Ruby Complex types would be great.
Hi,
I have this small test (test_interp.rb) of the Interp function:
require "gsl"
x=[0,1,2,3,4].to_gv
y=[0,1,2,3,4].to_gv
x_new = [3.5].to_gv
puts "x: #{x.inspect}"
puts "y: #{y.inspect}"
puts "x_new: #{x_new.inspect}"
i=GSL::Interp.alloc("linear",x.length)
y_new = i.eval(x,y,x_new)
puts "y_new: #{y_new.inspect}"
With ruby 1.9.3p125, rb-gsl 1.14.7 and GSL 1.14 this always works fine.
With ruby 2.2.0, rb-gsl 1.16.0.6 and GSL 1.16 this gives the error:
test_interp.rb:9:in `eval': Ruby/GSL error code 1, interpolation error (file interp.c, line 150), input domain error (GSL::ERROR::EDOM)
The bad thing is: this error is not reproducable, sometimes the example works, but most of the time it does not. Is there a known issue which explains the behaviour?
Thanks and best regards
Daniel
I am running alpine in a docker image and running ruby code. This successfully installs all packages but fails when I try require gsl. I have stripped out many of the additional libraries to find a minimal test.
Here is the Dockerfile:
FROM alpine:3.4
RUN apk upgrade --update \
&& apk add libatomic readline readline-dev libxml2 libxml2-dev \
libxslt libxslt-dev zlib-dev zlib ruby yaml \
yaml-dev libffi-dev build-base git nodejs \
ruby-io-console ruby-irb ruby-json ruby-rake \
make gsl gsl-dev \
gcc g++ libffi-dev ruby-dev tzdata
RUN gsl-config --cflags
RUN gem install --no-document nmatrix gsl
ADD scripts/gsl-test.rb test.rb
RUN ruby test.rb
The test file is:
require 'gsl'
Running docker build . produces the following output:
Sending build context to Docker daemon 20 MB
Step 0 : FROM alpine:3.4
---> ad84c222f6a3
Step 1 : RUN apk upgrade --update && apk add libatomic readline readline-dev libxml2 libxml2-dev libxslt libxslt-dev zlib-dev zlib ruby yaml yaml-dev libffi-dev build-base git nodejs ruby-io-console ruby-irb ruby-json ruby-rake make gsl gsl-dev gcc g++ libffi-dev ruby-dev tzdata
---> Using cache
---> b7f66d6f2bd7
Step 2 : RUN gsl-config --cflags
---> Using cache
---> b5acc8868a74
Step 3 : RUN gem install --no-document nmatrix gsl
---> Using cache
---> 2623683a706e
Step 4 : ADD scripts/gsl-test.rb test.rb
---> e4388f952198
Removing intermediate container 743340a3be60
Step 5 : RUN ruby test.rb
---> Running in c53a34ece153
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': Error relocating /usr/lib/ruby/gems/2.3.0/gems/gsl-2.1.0.1/lib/gsl_native.so: gsl_multifit_fdfsolver_jac: symbol not found - /usr/lib/ruby/gems/2.3.0/gems/gsl-2.1.0.1/lib/gsl_native.so (LoadError)
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/lib/ruby/gems/2.3.0/gems/backports-3.6.8/lib/backports/std_lib.rb:9:in `require_with_backports'
from /usr/lib/ruby/gems/2.3.0/gems/gsl-2.1.0.1/lib/gsl.rb:11:in `<top (required)>'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from test.rb:1:in `<main>'
The command '/bin/sh -c ruby test.rb' returned a non-zero code: 1
Any assistance would be greatly appreciated.
Hi, I had updated to Ubuntu 17.10 and met this error
/home/gleb/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.5/lib/active_support/dependencies.rb:292:in `require': libgsl.so.19: cannot open shared object file: No such file or directory - /home/gleb/.rvm/gems/ruby-2.4.1/gems/gsl-2.1.0.3/lib/gsl_native.so (LoadError)
Currently i'm using gsl (2.1.0.3). This issue was disappeared when I wrote in gemfile
gem 'gsl', github: 'SciRuby/rb-gsl', branch: 'master'
Ruby 2.4 unifies Fixnum
and Bignum
into Integer
, which makes gem native extension broken.
$ gem install gsl
Building native extensions. This could take a while...
ERROR: Error installing gsl:
ERROR: Failed to build gem native extension.
……
compiling error.c
In file included from error.c:11:
In file included from ./include/rb_gsl.h:18:
In file included from include/rb_gsl_poly.h:18:
In file included from include/rb_gsl_array.h:27:
In file included from include/rb_gsl_common.h:20:
/usr/local/Cellar/gsl/2.3/include/gsl/gsl_version.h:18:9: warning: 'GSL_VERSION' macro redefined [-Wmacro-redefined]
#define GSL_VERSION "2.3"
^
<command line>:1:9: note: previous definition is here
#define GSL_VERSION 2.3
^
error.c:83:66: error: use of undeclared identifier 'rb_cFixnum'
pgsl_error[-2] = rb_define_class_under(mgsl_error, "CONTINUE", rb_cFixnum);
^
error.c:85:64: error: use of undeclared identifier 'rb_cFixnum'
pgsl_error[0] = rb_define_class_under(mgsl_error, "SUCCESS", rb_cFixnum);
^
1 warning and 2 errors generated.
make: *** [error.o] Error 1
make failed, exit code 2
Please use 3 numbers for coding the version instead of 4 as now - 2.1.0.3. 'gem' is not able to see that x.x.0.1 is newer than x.x.0
http://guides.rubygems.org/patterns/#semantic-versioning
I tried to install gem install sciruby-full on Ruby 2.5 (under OpenSUSE). It fails because of 2.1.0.3 version is not recognizable by the 'gem'. But 2.1.0 is not buildable with Ruby >= 2.4
I had fixed the issue locally by extracting dependencies of sciruby-full in a separate Gemfile with installing by bundle.
Any attempt to run GSL::Blas.zgemm
causes a crash:
2.2.6 :001 > require 'gsl'
=> true
2.2.6 :002 > GSL::Blas.zgemm
irb):2: [BUG] Segmentation fault at 0x00000000000000
ruby 2.2.6p396 (2016-11-15 revision 56800) [powerpc64le-linux]
-- Control frame information -----------------------------------------------
c:0019 p:---- s:0075 e:000074 CFUNC :zgemm
c:0018 p:0013 s:0072 e:000071 EVAL (irb):2 [FINISH]
<snip>
This is a NULL pointer dereference in
rb_gsl_blas_zgemm
in blas3.c
:
In line 94, you have:
gsl_complex *pa = NULL, *pb = NULL;
Then line 97 tries to dereference pa
and assign something to a member:
(*pa).dat[0] = 1.0; (*pa).dat[1] = 0.0;
This causes the null pointer dereference.
I found this with cppcheck
.
Hi,
I'm trying to install gsl without narray, but it seems like it is implicitly required. During install of the gem, I get this: checking for narray.h... no
, which is correct. But then I get:
.../5.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -l:narray.so
collect2: error: ld returned 1 exit status
Makefile:254: recipe for target 'gsl_native.so' failed
make: *** [gsl_native.so] Error 1
ERROR: Error installing gsl:
ERROR: Failed to build gem native extension.
It seems that extconf.rb
always includes narray as a dependency.
If I change
gsl_gem_config('narray', 'src')
have_header('narray.h')
have_library('narray') if RUBY_PLATFORM =~ /cygwin|mingw/
to
if have_header('narray.h')
gsl_gem_config('narray', 'src')
have_library('narray') if RUBY_PLATFORM =~ /cygwin|mingw/
end
everything works fine.
The latest rb-gsl release does not build against the current gsl 2.1 release. I see:
histogram.c: In function 'rb_gsl_histogram_fit_gaussian':
histogram.c:1222:23: error: 'gsl_multifit_fdfsolver' has no member named 'J'
gsl_multifit_covar(s->J, 0.0, covar);
^
histogram.c: In function 'rb_gsl_histogram_fit_rayleigh':
histogram.c:1356:23: error: 'gsl_multifit_fdfsolver' has no member named 'J'
gsl_multifit_covar(s->J, 0.0, covar);
^
histogram.c: In function 'rb_gsl_histogram_fit_xexponential':
histogram.c:1492:23: error: 'gsl_multifit_fdfsolver' has no member named 'J'
gsl_multifit_covar(s->J, 0.0, covar);
^
Please see the original bug report at:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=798535
Updated build log with 1.16.0.6:
http://debomatic-i386.debian.net/distribution#unstable/ruby-gsl/1.16.0.6+dfsg1-1/buildlog
...
Failure: test_dht3(DhtTest)
dht_test.rb:54:in `test_dht3'
51:
52: vout = dht.apply(vin)
53:
=> 54: assert_equal 0.18148296716239096, vout[0]
55: assert_equal 0.35680451269699853, vout[5]
56: assert_equal 0.21101009980456306, vout[10]
57: assert_equal 0.02892068100516861, vout[35]
<0.18148296716239096> expected but was
<0.18148296716239112>
diff:
? 0.18148296716239096
...
I will merge the nmatrix specific changes to blackwinter/rb-gsl
Hi, just wanted to let you know that the documentation link in the readme is broken: http://sciruby.com/rb-gsl
The latest release on Rubygems points to https://blackwinter.github.io/rb-gsl/, which is still active, but looks like the previous repo.
I am frequently seeing a segmentation fault during iteration of the nelder-mead algorithm:
app/services/g_amoeba.rb:47: [BUG] Segmentation fault at 0x0000000000000000
ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-darwin17]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
for more details.
Don't forget to include the above Crash Report log file in bug reports.
-- Control frame information -----------------------------------------------
c:0063 p:---- s:0325 e:000324 CFUNC :iterate
c:0062 p:0009 s:0321 e:000320 BLOCK
I have attached the crash report. Sometimes it does not cause a segmentation fault, but instead reports that
Failure/Error: minimizer.iterate
NoMethodError:
undefined method `call' for 0:Integer
My cost function, includes a summation along the lines of ary.map{|a| (a -x)**2} . It appears that the problem occurs more frequently the larger the size of ary. When ary is 1000 then it happens almost every time. The crash is occurring when the dimensionality is 1 (the final implementation has higher dimensionality but I am comparing against an known solution when there is a dimensionality of 1.
Commit 4eb44d5 broke rb-gsl. It adds includes for porting.h
, which doesn't exist.
Hello, I have compiled GSL 2.4 on my Windows 10 PC and I want to then install rb-gsl using gem install gsl
, but I was wondering what environment variables I should add my GSL library to. Thank you for the help!
GSL deprecated a few functions which may not be available on all platforms.
GSL in Debian for example disabled deprecated functions in the official package in unstable resulting build failure in rb-gsl: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=841611
m1.size => [1,3]
m2.size => [3,3]
m1*m2 => fails, the result matrix is not being sized properly
It looks like 2.1.0.3 got released, but never got tagged. Could someone tag it? It appears to be commit 6f2011e
Clang 16 makes -Wincompatible-function-pointer-types
an error by default.
rb-gsl hits the following failure when building with Clang 16:
[...]
blas2.c:1084:3: error: incompatible function pointer types passing 'VALUE (VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)' (aka 'unsigned long (unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long)') to parameter of type 'VALUE (*)(VALUE, VALUE, VALUE, VALUE, VALUE)' (aka 'unsigned long (*)(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long)') [-Wincompatible-function-pointer-types]
rb_define_module_function(module, "dsyr2!", rb_gsl_blas_dsyr2, 4);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/ruby-2.7.0/ruby/ruby.h:2827:135: note: expanded from macro 'rb_define_module_function'
#define rb_define_module_function(klass, mid, func, arity) rb_define_module_function_choose_prototypem3((arity),(func))((klass),(mid),(func),(arity));
^~~~~~
/usr/include/ruby-2.7.0/ruby/ruby.h:2804:1: note: passing argument to parameter 'func' here
RB_METHOD_DEFINITION_DECL(rb_define_module_function, (2,3), (VALUE klass, const char *name), (klass, name))
^
/usr/include/ruby-2.7.0/ruby/intern.h:1077:89: note: expanded from macro 'RB_METHOD_DEFINITION_DECL'
RB_METHOD_DEFINITION_DECL_1(def,nonnull,def##3 ,3 ,decl,vars,(VALUE,VALUE,VALUE,VALUE)) \
^
/usr/include/ruby-2.7.0/ruby/intern.h:1069:5: note: expanded from macro '\
RB_METHOD_DEFINITION_DECL_1'
RB_METHOD_DEFINITION_DECL_C(def,nonnull,defname,decl,vars,funcargs) \
^
/usr/include/ruby-2.7.0/ruby/intern.h:1042:118: note: expanded from macro 'RB_METHOD_DEFINITION_DECL_C'
__attribute__((__unused__,__weakref__(#def),__nonnull__ nonnull))static void defname(RB_UNWRAP_MACRO decl,VALUE(*func)funcargs,int arity);
^
To reproduce this bug:
-Werror=incompatible-function-pointer-types
-Werror=incompatible-pointer-types
(GCC lacks a more specific warning)Reported downstream in Gentoo at https://bugs.gentoo.org/895684.
I tried to install rb-gsl on Windows 10, but it always fails. I have gsl compiled from source using MinGW and gcc 4.7. When I run gem install gsl
, I always get
D:\Base\Programming>gem install gsl Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... ERROR: Error installing gsl: ERROR: Failed to build gem native extension. current directory: C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/gsl-2.1.0.1/ext/gsl_native C:/tools/ruby23/bin/ruby.exe -r ./siteconf20160524-12832-1dzrmsa.rb extconf.rb sh: gsl-config: No such file or directory *** ERROR: missing required library to compile this module: undefined method
chomp' for nil:NilClass *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=C:/tools/ruby23/bin/$(RUBY_BASE_NAME) --with-gsl-version extconf failed, exit code 1 Gem files will remain installed in C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/gsl-2.1.0.1 for inspection. Results logged to C:/tools/ruby23/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/gsl-2.1.0.1/gem_make.out `
In the error file, it seems lgsl
and lgslcblash
are missing. Not sure if gsl is supposed to run in Windows or not. I am using Ruby 2.3 for this build, BTW.
Writing rake tasks for setup tasks like build and install.
Following the installation instructions I get the following compile error:
export NMATRIX=1
gem install rb-gsl
WARNING: You don't have /home/ram/.gem/ruby/2.3.0/bin in your PATH,
gem executables will not run.
Building native extensions. This could take a while...
ERROR: Error installing rb-gsl:
ERROR: Failed to build gem native extension.
current directory: /home/ram/.gem/ruby/2.3.0/gems/gsl-2.1.0/ext/gsl_native
/usr/bin/ruby -r ./siteconf20160509-11351-f80np0.rb extconf.rb
checking gsl version... 2.1
checking gsl cflags... -I/usr/include
checking gsl libs... -L/usr/lib -lgsl -lgslcblas -lm
checking for round()... yes
checking for alf/alf.h... no
checking for qrngextra/qrngextra.h... no
checking for rngextra/rngextra.h... no
checking for tensor/tensor.h... no
checking for gsl/gsl_multimin_fsdf.h... no
checking for gsl/gsl_cqp.h... no
checking for jacobi.h... no
checking for ndlinear/gsl_multifit_ndlinear.h... no
checking for ool/ool_version.h... no
checking for gsl_eigen_francis() in -lgsl... yes
checking for gsl_eigen_francis()... yes
checking for gsl_poly_solve_quartic() in -lgsl... no
checking for graph... yes
checking for nmatrix.h... yes
checking for tamu_anova/tamu_anova.h... no
checking for gsl_multifit_fdfsolver.J in gsl/gsl_multifit_nlin.h... no
checking for gsl_sf_mathieu_a_e() in gsl/gsl_sf_mathieu.h... yes
checking for gsl_sf_mathieu_b_e() in gsl/gsl_sf_mathieu.h... yes
checking for gsl_sf_mathieu_ce_e() in gsl/gsl_sf_mathieu.h... yes
checking for gsl_sf_mathieu_se_e() in gsl/gsl_sf_mathieu.h... yes
checking for gsl_sf_mathieu_Mc_e() in gsl/gsl_sf_mathieu.h... yes
checking for gsl_sf_mathieu_Ms_e() in gsl/gsl_sf_mathieu.h... yes
creating gsl_config.h
creating Makefile
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/ram/.gem/ruby/2.3.0/extensions/x86_64-linux/2.3.0/gsl-2.1.0/mkmf.log
current directory: /home/ram/.gem/ruby/2.3.0/gems/gsl-2.1.0/ext/gsl_native
make "DESTDIR=" clean
current directory: /home/ram/.gem/ruby/2.3.0/gems/gsl-2.1.0/ext/gsl_native
make "DESTDIR="
compiling stats.c
In file included from include/rb_gsl_with_nmatrix.h:8:0,
from include/rb_gsl_common.h:27,
from include/rb_gsl_array.h:27,
from stats.c:12:
/home/ram/.gem/ruby/2.3.0/extensions/x86_64-linux/2.3.0/nmatrix-0.2.1/nmatrix.h:95:1: error: redefinition of ‘rb_array_const_ptr’
rb_array_const_ptr(VALUE a)
^~~~~~~~~~~~~~~~~~
In file included from /usr/include/ruby-2.3.0/ruby.h:33:0,
from include/rb_gsl_common.h:15,
from include/rb_gsl_array.h:27,
from stats.c:12:
/usr/include/ruby-2.3.0/ruby/ruby.h:2025:1: note: previous definition of ‘rb_array_const_ptr’ was here
rb_array_const_ptr(VALUE a)
^~~~~~~~~~~~~~~~~~
Makefile:238: recipe for target 'stats.o' failed
make: *** [stats.o] Error 1
make failed, exit code 2
Is there anything I can do?
The problems was, that with a scituby-full installation, the gsl gem was not working because of a superclass mismatch:
ruby -e 'require "gsl"' [15:07:30|16-05-09]
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require': superclass mismatch for class NMatrix (TypeError) from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in
require'
from /home/ram/.gem/ruby/2.3.0/gems/nmatrix-0.2.1/lib/nmatrix/nmatrix.rb:38:in <top (required)>' from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in
require'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in rescue in require' from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in
require'
from /home/ram/.gem/ruby/2.3.0/gems/gsl-2.1.0/lib/gsl.rb:7:in <top (required)>' from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in
require'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in rescue in require' from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in
require'
That's why I tried to install it manually
The NARRAY installation works.
thanks in advance!
We need to add a .travis.yml file to the repository and enable automatic builds/tests on Travis' interface.
Briefly checking out this project, as it is labeled as a requirement for sciruby/statsample-timeseries
, the sciruby/rb-gsl
project seems to be outdated.
For example, when trying to setup this project locally, I receive deprecation warnings.
Unless I am missing something and there is an updated repo elsewhere, I can take a crack at this sometime this weekend. Thanks!
Since the last update appears to be in 2017, and it only claims support for gsl 2.1 in the README (with the latest version seeming to be v2.6), i'm wondering if this project is still active/maintained?
The version of narray that is referenced is outdated and no longer maintained, having since been replaced by Numo::NArray
I also notice that there is a Numo::GSL
project as well, which seems more active, and based on the maintained version of Numo::NArray
GSL v2.1 has just been released. The current rb-gsl is not working with it, which it should ( #24 ).
Question for @blackwinter @minad : Should we maintain backwards compatibility for pre-2.1 GSL versions or force the user to upgrade?
I'd say no need for backward compatibility. What are your views?
I am trying to use gsl (1.16.0.6) for solving over-determined least-squares problems, and a simple test case is not working for me.
require("gsl")
include GSL
m = GSL::Matrix::alloc([0.18, 0.60, 0.57], [0.24, 0.99, 0.58],
[0.14, 0.30, 0.97], [0.51, 0.19, 0.85], [0.34, 0.91, 0.18])
B = GSL::Vector[1, 2, 3, 4, 5]
qr, tau = m.QR_decomp
x, r = qr.QR_lssolve(tau,B)
Whereas, if I write the same problem in plain C, it works find:
#include <stdio.h>
#include <gsl/gsl_linalg.h>
int
main (void)
{
double a_data[] = {0.18, 0.60, 0.57, 0.24, 0.99, 0.58,
0.14, 0.30, 0.97, 0.51, 0.19, 0.85, 0.34, 0.91, 0.18};
double b_data[] = {1.0,2.0,3.0,4.0,5.0};
gsl_matrix_view m = gsl_matrix_view_array (a_data, 5, 3);
gsl_vector_view b = gsl_vector_view_array (b_data, 5);
gsl_vector *x = gsl_vector_alloc (3); // size equal to n
gsl_vector *residual = gsl_vector_alloc (5); // size equal to m
gsl_vector *tau = gsl_vector_alloc (3); //size equal to min(m,n)
gsl_linalg_QR_decomp (&m.matrix, tau); //
gsl_linalg_QR_lssolve(&m.matrix, tau, &b.vector, x, residual);
printf ("x = \n");
gsl_vector_fprintf (stdout, x, "%g");
gsl_vector_free (x);
gsl_vector_free (tau);
gsl_vector_free (residual);
return 0;
}
x =
8.06835
0.884443
0.231883
The only way I can get the ruby code to work is by making the problem square, but that defeats the overall purpose of a least-squares fit in my use-case. Of course, it is just possible that I am messing up the row and column dimensions in the Ruby code in a way that I can't see for looking, but I simply can't find another permutation that should work. I am guessing the ruby-wrapper is mistakenly assuming that over-determined problems are always user-error, whereas this is precisely where a LS fit is most useful.
Thanks! Charles.
Hi,
With GSL 2.x, tests from dht_test.rb fail on some architectures because of precision issues (the last digit may be wrong)
On Debian, it corresponds to i386,arm64, powerpc, s390x, and a few others.
I can sucessfully install rb-gsl
. After uninstalling it and running gem install gsl-nmatrix
, I get the following compile error:
compiling fft.c
[...]
fft.c:910:48: error: use of undeclared identifier 'forward'
rb_define_const(mgsl_fft, "Forward", INT2FIX(forward));
^
[...]
4 warnings and 4 errors generated.
make: *** [fft.o] Error 1
The code it refers to is from ext/fft.c, line 913:
rb_define_const(mgsl_fft, "Forward", INT2FIX(forward));
rb_define_const(mgsl_fft, "FORWARD", INT2FIX(forward));
rb_define_const(mgsl_fft, "Backward", INT2FIX(backward));
rb_define_const(mgsl_fft, "BACKWARD", INT2FIX(backward));
Well then. I cloned this repo, commented out these lines and tried to install again, with a new error message regarding a lack of nm_memory.h
. It wasn't present in the $GEM_HOME/extensions/nmatrix-0.1.0.rc3
directory, so I copied it from NMatrix's repository.
After all that, there are some errors in ext/linalg.c:
compiling linalg.c
linalg.c:74:28: error: read-only variable is not assignable
RBASIC(omatrix)->klass = cgsl_matrix_LU;
~~~~~~~~~~~~~~~~~~~~~~ ^
linalg.c:695:28: error: read-only variable is not assignable
RBASIC(mdecomp)->klass = cgsl_matrix_QR;
~~~~~~~~~~~~~~~~~~~~~~ ^
linalg.c:707:28: error: read-only variable is not assignable
RBASIC(mdecomp)->klass = cgsl_matrix_LQ;
~~~~~~~~~~~~~~~~~~~~~~ ^
linalg.c:734:33: error: read-only variable is not assignable
RBASIC(argv[itmp])->klass = cgsl_vector_tau;
~~~~~~~~~~~~~~~~~~~~~~~~~ ^
linalg.c:743:33: error: read-only variable is not assignable
RBASIC(argv[itmp])->klass = cgsl_vector_tau;
~~~~~~~~~~~~~~~~~~~~~~~~~ ^
linalg.c:1631:23: error: read-only variable is not assignable
RBASIC(vA)->klass = cgsl_matrix_QRPT;
~~~~~~~~~~~~~~~~~ ^
linalg.c:1638:23: error: read-only variable is not assignable
RBASIC(vA)->klass = cgsl_matrix_PTLQ;
~~~~~~~~~~~~~~~~~ ^
7 errors generated.
make: *** [linalg.o] Error 1
Am I doing something wrong? How are you guys getting this repo to compile? :(
Hi! Can you publish new version 2.1.0.2 of gem on rubygems?
The Interp bindings are great.
There are a very similar set of functions for 2-dimensional interpolation
that are not bound though.
In particular they are:
They are extremely similar to the already-bound 1D functions that
are bound in ext/gsl_native/interp.c
I have a feeling that copying this file and doing some minor editing
would result in a working binding for the 2D interpolation.
I propose naming the ruby class Interp2D.
I am volunteering to either do this myself or find someone else to
do it for a bounty that I will fund. I am just creating this issue to document
the intent and requirements.
The 2.1.0 gem as provided by rubygems.org contains lots of files called tmp/i686-linux/stage/*
. I'm pretty sure these shouldn't be there.
Please release 2.1.1 without them. Thanks!
The previous narray code is leading to bloat and might confuse future contributors.
I propose that it should be removed.
The git history of this repository is rather strange, having basically two roots. Perhaps it would be best to rebase the changes for moving from NArray to NMatrix onto david-macmahon/rb-gsl's master branch, or alternatively, create a branch off some older commit in that repository.
I have some experience rewriting git history, would you be interested in such a change?
I'm trying to build rb-gsl as part of the sciruby-full meta gem. Currently, fails with the error
error.c:83:66: error: ‘rb_cFixnum’ undeclared (first use in this function)
pgsl_error[-2] = rb_define_class_under(mgsl_error, "CONTINUE", rb_cFixnum);
In doing some research, it appears this may be due to the fact that Fixnum and Bignum were unified into a single Integer: https://bugs.ruby-lang.org/issues/12005
Hi folks,
I'm using a Ruby gem that depends on rb-gsl
(glove) and decided to see if it would work with gsl-nmatrix
as well. Turns out I couldn't even install it correctly:
λ gem install gsl-nmatrix Fetching: gsl-nmatrix-1.15.3.2.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing gsl-nmatrix:
ERROR: Failed to build gem native extension.
/Users/agarie/.rubies/ruby-2.2.0/bin/ruby -r ./siteconf20150424-7363-1opqasp.rb extconf.rb
checking gsl version... 1.16
checking gsl cflags... -I/usr/local/Cellar/gsl/1.16/include
[...]
In file included from gsl_nmatrix.c:10:
../include/rb_gsl_with_nmatrix.h:3:10: fatal error: 'nmatrix.h' file not found
#include "nmatrix.h"
^
1 error generated.
make: *** [gsl_nmatrix.o] Error 1
make failed, exit code 2
I don't have time to find why it isn't working right now (IIRC @v0dro had the same problem with travis-ci), but that made me think: was there a very strong reason to not merge this fork with the current rb-gsl
gem?
Apparently, the current maintainer is @blackwinter: the rubygems page points to blackwater/rb-gsl.
compiling wavelet.c
In file included from /usr/include/ruby-2.0.0/ruby.h:33:0,
from ../include/rb_gsl_array.h:34,
from wavelet.c:13:
wavelet.c: In function ‘rb_gsl_wavelet_define_const’:
wavelet.c:155:45: error: ‘forward’ undeclared (first use in this function)
rb_define_const(klass, "FORWARD", INT2FIX(forward));
^
/usr/include/ruby-2.0.0/ruby/ruby.h:241:45: note: in definition of macro ‘INT2FIX’
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
^
wavelet.c:155:45: note: each undeclared identifier is reported only once for each function it appears in
rb_define_const(klass, "FORWARD", INT2FIX(forward));
^
/usr/include/ruby-2.0.0/ruby/ruby.h:241:45: note: in definition of macro ‘INT2FIX’
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
^
wavelet.c:157:46: error: ‘backward’ undeclared (first use in this function)
rb_define_const(klass, "BACKWARD", INT2FIX(backward));
^
/usr/include/ruby-2.0.0/ruby/ruby.h:241:45: note: in definition of macro ‘INT2FIX’
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
^
wavelet.c: In function ‘rb_gsl_wavelet_transform0’:
wavelet.c:194:31: error: ‘forward’ undeclared (first use in this function)
gsl_wavelet_direction dir = forward;
^
wavelet.c: In function ‘rb_gsl_wavelet2d’:
wavelet.c:534:31: error: ‘forward’ undeclared (first use in this function)
gsl_wavelet_direction dir = forward;
^
make: *** [wavelet.o] Error 1
Looking at the source, I don't see where forward
would be defined. Maybe narray.h? Am I missing a dependency? Seems like a weird name for a global variable/constant.
/usr/bin/clang -I. -I/opt/local/include/ruby-3.3.0/arm64-darwin23 -I/opt/local/include/ruby-3.3.0/ruby/backward -I/opt/local/include/ruby-3.3.0 -I. -DGSL_VERSION=2.7.1 -DGSL_1_15_LATER -DGSL_1_15_LATER -DGSL_1_16_LATER -DGSL_2_0_LATER -DGSL_2_1_LATER -DHAVE_ROUND -DHAVE_GSL_EIGEN_FRANCIS -DHAVE_GNU_GRAPH -DHAVE_GSL_SF_MATHIEU_A_E -DHAVE_GSL_SF_MATHIEU_B_E -DHAVE_GSL_SF_MATHIEU_CE_E -DHAVE_GSL_SF_MATHIEU_SE_E -DHAVE_GSL_SF_MATHIEU_MC_E -DHAVE_GSL_SF_MATHIEU_MS_E -I./.gem.20240405-74113-3sf0ok/arm64-darwin23 -I/opt/local/include -I/opt/local/libexec/openssl3/include -isystem/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fno-common -pipe -I/opt/local/libexec/openssl3/include -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -fno-common -Wall -Iinclude -I/opt/local/include -arch arm64 -o array.o -c array.c
In file included from array.c:12:
./include/rb_gsl_common.h:29:1: error: unknown type name 'EXTERN'
EXTERN ID rb_gsl_id_beg, rb_gsl_id_end, rb_gsl_id_excl, rb_gsl_id_to_a;
^
./include/rb_gsl_common.h:29:10: error: expected ';' after top level declarator
EXTERN ID rb_gsl_id_beg, rb_gsl_id_end, rb_gsl_id_excl, rb_gsl_id_to_a;
^
;
./include/rb_gsl_common.h:352:1: error: unknown type name 'EXTERN'
EXTERN VALUE cGSL_Object;
^
./include/rb_gsl_common.h:352:13: error: expected ';' after top level declarator
EXTERN VALUE cGSL_Object;
^
;
In file included from array.c:13:
./include/rb_gsl_array.h:39:1: error: unknown type name 'EXTERN'
EXTERN VALUE cgsl_block, cgsl_block_int;
^
./include/rb_gsl_array.h:39:13: error: expected ';' after top level declarator
EXTERN VALUE cgsl_block, cgsl_block_int;
^
;
./include/rb_gsl_array.h:40:1: error: unknown type name 'EXTERN'
EXTERN VALUE cgsl_block_uchar;
^
./include/rb_gsl_array.h:40:13: error: expected ';' after top level declarator
EXTERN VALUE cgsl_block_uchar;
^
;
./include/rb_gsl_array.h:41:1: error: unknown type name 'EXTERN'
EXTERN VALUE cgsl_block_complex;
^
./include/rb_gsl_array.h:41:13: error: expected ';' after top level declarator
EXTERN VALUE cgsl_block_complex;
^
;
./include/rb_gsl_array.h:42:1: error: unknown type name 'EXTERN'
EXTERN VALUE cgsl_vector, cgsl_vector_complex;
^
./include/rb_gsl_array.h:42:13: error: expected ';' after top level declarator
EXTERN VALUE cgsl_vector, cgsl_vector_complex;
^
;
./include/rb_gsl_array.h:43:1: error: unknown type name 'EXTERN'
EXTERN VALUE cgsl_vector_col;
^
./include/rb_gsl_array.h:43:13: error: expected ';' after top level declarator
EXTERN VALUE cgsl_vector_col;
^
;
./include/rb_gsl_array.h:44:1: error: unknown type name 'EXTERN'
EXTERN VALUE cgsl_vector_col_view;
^
./include/rb_gsl_array.h:44:13: error: expected ';' after top level declarator
EXTERN VALUE cgsl_vector_col_view;
^
;
./include/rb_gsl_array.h:45:1: error: unknown type name 'EXTERN'
EXTERN VALUE cgsl_vector_complex_col;
^
./include/rb_gsl_array.h:45:13: error: expected ';' after top level declarator
EXTERN VALUE cgsl_vector_complex_col;
^
;
./include/rb_gsl_array.h:46:1: error: unknown type name 'EXTERN'
EXTERN VALUE cgsl_vector_complex_col_view;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [array.o] Error 1
make failed, exit code 2
Gem files will remain installed in /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_ruby_rb-gsl/rb33-gsl/work/destroot/opt/local/lib/ruby3.3/gems/3.3.0/gems/gsl-2.1.0.3 for inspection.
Results logged to /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_ruby_rb-gsl/rb33-gsl/work/destroot/opt/local/lib/ruby3.3/gems/3.3.0/extensions/arm64-darwin-23/3.3.0/gsl-2.1.0.3/gem_make.out
Command failed: cd "/opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_ruby_rb-gsl/rb33-gsl/work/gsl-2.1.0.3" && /opt/local/bin/gem3.3 install --local --force --install-dir /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_ruby_rb-gsl/rb33-gsl/work/destroot/opt/local/lib/ruby3.3/gems/3.3.0 /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_ruby_rb-gsl/rb33-gsl/work/gsl-2.1.0.3/gsl.gem
Exit code: 1
jose@foobar:~$ git clone https://github.com/SciRuby/rb-gsl.git
Cloning into 'rb-gsl'...
remote: Counting objects: 677, done.
remote: Compressing objects: 100% (581/581), done.
remote: Total 677 (delta 96), reused 669 (delta 88)
Receiving objects: 100% (677/677), 606.06 KiB | 163 KiB/s, done.
Resolving deltas: 100% (96/96), done.
jose@foobar:~$ cd rb-gsl/
jose@foobar:~/rb-gsl$ ruby setup.rb config
setup.rb:788: Use RbConfig instead of obsolete and deprecated Config.
---> lib
---> lib/ool
<--- lib/ool
---> lib/gsl
<--- lib/gsl
<--- lib
---> ext
/home/jose/.rvm/rubies/ruby-1.9.3-p362/bin/ruby /home/jose/rb-gsl/ext/extconf.rb
checking gsl version... 1.15
checking gsl cflags... -I/usr/local/include
checking for main() in -lcblas... yes
checking for main() in -latlas... yes
checking gsl libs... -L/usr/local/lib -lgsl -lcblas -latlas -lm
checking for round()... no
checking for rngextra/rngextra.h... no
checking for qrngextra/qrngextra.h... no
checking for ool/ool_version.h... no
checking for tensor/tensor.h... no
checking for jacobi.h... no
checking for gsl/gsl_cqp.h... no
checking for gsl/gsl_multimin_fsdf.h... no
checking for gsl_poly_solve_quartic() in -lgsl... no
checking for gsl_eigen_francis() in -lgsl... yes
checking for ndlinear/gsl_multifit_ndlinear.h... no
checking for alf/alf.h... no
checking rb-gsl version...1.14.7
checking ruby version... 1.9.3
checking for graph... no
NOTE: Gem.searcher is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.searcher called from /home/jose/rb-gsl/ext/extconf.rb:246.
NOTE: Gem::GemPathSearcher#initialize is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::GemPathSearcher#initialize called from /home/jose/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/site_ruby/1.9.1/rubygems.rb:974.
NOTE: Gem::GemPathSearcher#find is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::GemPathSearcher#find called from /home/jose/rb-gsl/ext/extconf.rb:246.
checking for nmatrix.h... yes
checking for tamu_anova/tamu_anova.h... no
checking for main() in -ltamuanova... no
creating Makefile
<--- ext
jose@foobar:~/rb-gsl$ ruby setup.rb setup
setup.rb:788: Use RbConfig instead of obsolete and deprecated Config.
---> lib
---> lib/ool
<--- lib/ool
---> lib/gsl
<--- lib/gsl
<--- lib
---> ext
make
compiling block.c
In file included from block.c:29:0:
block_source.c: In function ‘rb_gsl_block_compare’:
block_source.c:550:7: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
In file included from block.c:35:0:
block_source.c: In function ‘rb_gsl_block_int_compare’:
block_source.c:550:7: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
In file included from block.c:41:0:
block_source.c: In function ‘rb_gsl_block_uchar_compare’:
block_source.c:550:7: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
compiling linalg.c
linalg.c: In function ‘rb_gsl_linalg_QR_LQ_decomposition’:
linalg.c:669:10: warning: variable ‘size’ set but not used [-Wunused-but-set-variable]
linalg.c: In function ‘rb_gsl_linalg_QR_LQ_lssolve’:
linalg.c:934:51: warning: variable ‘flagr’ set but not used [-Wunused-but-set-variable]
linalg.c:934:40: warning: variable ‘flagx’ set but not used [-Wunused-but-set-variable]
linalg.c: In function ‘rb_gsl_linalg_QRLQPT_RLsvx’:
linalg.c:2136:13: warning: variable ‘flagb’ set but not used [-Wunused-but-set-variable]
linalg.c: In function ‘rb_gsl_linalg_bidiag_decomp’:
linalg.c:2856:7: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
linalg.c: In function ‘rb_gsl_linalg_balance_columns_bang’:
linalg.c:3323:7: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
linalg.c: In function ‘rb_gsl_linalg_balance_columns’:
linalg.c:3334:7: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
compiling histogram.c
histogram.c: In function ‘rb_gsl_histogram_fit_exponential’:
histogram.c:1029:24: warning: variable ‘hh’ set but not used [-Wunused-but-set-variable]
histogram.c: In function ‘rb_gsl_histogram_fit_power’:
histogram.c:1079:24: warning: variable ‘hh’ set but not used [-Wunused-but-set-variable]
compiling cdf.c
compiling sf_dilog.c
sf_dilog.c: In function ‘rb_gsl_sf_complex_dilog_e’:
sf_dilog.c:29:7: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
compiling blas2.c
compiling array.c
array.c: In function ‘carray_set_from_nvector’:
array.c:230:3: warning: implicit declaration of function ‘NM_IsNVector’ [-Wimplicit-function-declaration]
array.c:233:3: warning: implicit declaration of function ‘NM_DENSE_COUNT’ [-Wimplicit-function-declaration]
array.c:236:3: warning: implicit declaration of function ‘NM_DTYPE’ [-Wimplicit-function-declaration]
array.c:236:24: error: ‘NM_FLOAT64’ undeclared (first use in this function)
array.c:236:24: note: each undeclared identifier is reported only once for each function it appears in
array.c:237:14: error: ‘nm_eDataTypeError’ undeclared (first use in this function)
array.c:239:3: warning: implicit declaration of function ‘NM_DENSE_STORAGE’ [-Wimplicit-function-declaration]
array.c:239:34: error: invalid type argument of ‘->’ (have ‘int’)
array.c: In function ‘make_cvector_from_nvector’:
array.c:251:3: warning: implicit declaration of function ‘NM_STYPE’ [-Wimplicit-function-declaration]
array.c:252:14: error: ‘nm_eStorageTypeError’ undeclared (first use in this function)
array.c:255:24: error: ‘size’ undeclared (first use in this function)
array.c:258:24: error: ‘NM_FLOAT64’ undeclared (first use in this function)
array.c:259:14: error: ‘nm_eDataTypeError’ undeclared (first use in this function)
array.c:261:40: error: invalid type argument of ‘->’ (have ‘int’)
make: *** [array.o] Error 1
setup.rb:655:in `command': system("make") failed (RuntimeError)
from setup.rb:664:in `make'
from setup.rb:1258:in `setup_dir_ext'
from setup.rb:1532:in `block in traverse'
from setup.rb:1549:in `dive_into'
from setup.rb:1530:in `traverse'
from setup.rb:1524:in `block in exec_task_traverse'
from setup.rb:1519:in `each'
from setup.rb:1519:in `exec_task_traverse'
from setup.rb:1246:in `exec_setup'
from setup.rb:996:in `exec_setup'
from setup.rb:826:in `invoke'
from setup.rb:773:in `invoke'
from setup.rb:1578:in `<main>'
jose@foobar:~/rb-gsl$ ruby setup.rb install^C
jose@foobar:~/rb-gsl$
jose@foobar:~/rb-gsl$
jose@foobar:~/rb-gsl$
jose@foobar:~/rb-gsl$ gem list nmatrix
*** LOCAL GEMS ***
nmatrix (0.0.2)
jose@foobar:~/rb-gsl$
I installed the gem, and tried it out but I got this error:
from /usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/eli/.gem/ruby/2.4.0/gems/gsl-2.1.0.3/lib/gsl.rb:11:in `<top (required)>'
from /usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `require'
from /usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
from /usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from (irb):1
from /usr/bin/irb:11:in `<main>'
OS: Arch Linux (x86_64)
Since RubyForge is gone, the link is out of date. Perhaps http://www.rubydoc.info/github/SciRuby/rb-gsl/master ?
Updating rb-gsl to comply with the latest nmatrix in all methods will increase interoperability and let users take advantage of other nmatrix extensions as well.
Also, I'd suggest releasing a new gem 'nmatrix-gsl' as an nmatrix extension, that will load the NMatrix class with methods that will call GSL internally, similar to nmatrix-atlas or nmatrix-lapacke. The only hurdle with the extension approach being that of maintaining the methods that will be loaded into nmatrix.
One way I think this can be implemented is by keeping nmatrix-gsl in the main nmatrix repo just like the other nmatrix extensions and adding rb-gsl as a dependency to the nmatrix-gsl gem.
But the problem would be maintaining rb-gsl and nmatrix-gsl in parallel. API changes to rb-gsl will require changes in nmatrix-gsl (in a different repo) as well.
@MohawkJohn @minad @agarie looking forward to hear your thoughts on this.
so I get on error when trying to install
I have the latest gsl libraries installed and on the path
ruby installed using ruby windows installer, version 2.4.3 64 bit.
i run gem install gsl
and get
ERROR: Failed to build gem native extension.
current directory: C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/gsl-2.1.0.3/ext/gsl_native
C:/Ruby24-x64/bin/ruby.exe -r ./siteconf20180102-5768-1uj9tbr.rb extconf.rb
...
compiling fit.c
compiling fresnel.c
fresnel.c:17:21: warning: 'sqrt_pi_2' defined but not used [-Wunused-const-variable=]
static const double sqrt_pi_2 = 1.2533141373155002512078826424; /* sqrt(pi/2) */
^~~~~~~~~
compiling function.c
compiling geometry.c
compiling graph.c
compiling gsl.c
compiling gsl_narray.c
compiling gsl_nmatrix.c
compiling histogram.c
compiling histogram2d.c
compiling histogram3d.c
compiling histogram3d_source.c
compiling histogram_find.c
compiling histogram_oper.c
compiling ieee.c
compiling integration.c
compiling interp.c
compiling interp2d.c
interp2d.c: In function 'rb_gsl_interp_evaluate':
interp2d.c:104:55: warning: format '%d' expects argument of type 'int',
but argument 4 has type 'size_t {aka long long unsigned int}' [-Wformat=]
rb_raise(rb_eTypeError, "size mismatch (za:%d != %d)", (int) zsize,
~^
%I64d
(int) xsize*ysize);
...
followed by similar issues compiling some other files.
am I missing some dependency or something simple I haven't thought of?
I can post the whole out file if needed or is there a way to link it?
I downloaded the gem and when I run
sudo ruby setup.rb I get:
setup.rb:283: warning: duplicated key at line 284 ignored: "bin-dir"
setup.rb:788:in load_rbconfig': uninitialized constant Config (NameError) from setup.rb:768:in
invoke'
from setup.rb:1578:in `
Any clues or ides why is this happening? I installed gsl 1.15 on my OSX Yosemite. Help is warmly appreciated please?
I've tried to get this gem working for ruby 3.0; unfortunately, it seems that some major changes to ruby under the hood make this a rather complex problem.
A few things are simple to fix (e.g., moving "EXTERN" to "RUBY_EXTERN" in some declarations). But other issues seem to involve changes to the macros sitting inside the ruby code itself, e.g., "RB_OBJ_WRITE", which has a new definition in ruby 3.0.
linalg.c:154:5: error: cannot take the address of an rvalue of type 'VALUE' (aka 'unsigned long')
RBGSL_SET_CLASS(omatrix, cgsl_matrix_LU);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/rb_gsl_common.h:302:5: note: expanded from macro 'RBGSL_SET_CLASS'
RBGSL_SET_CLASS0(_obj_, cls); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/rb_gsl_common.h:296:56: note: expanded from macro 'RBGSL_SET_CLASS0'
#define RBGSL_SET_CLASS0(obj0, cls) RB_OBJ_WRITE(obj0, &(RBASIC_CLASS(obj0)), cls)
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/include/ruby-3.0.0/ruby/internal/rgengc.h:108:52: note: expanded from macro 'RB_OBJ_WRITE'
RBIMPL_CAST(rb_obj_write((VALUE)(a), (VALUE *)(slot), (VALUE)(b), __FILE__, __LINE__))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/include/ruby-3.0.0/ruby/internal/cast.h:33:29: note: expanded from macro 'RBIMPL_CAST'
# define RBIMPL_CAST(expr) (expr)
After a lot of fiddling, I think there's a solution.
#ifndef RBGSL_SET_CLASS
#define RBGSL_SET_CLASS(obj, cls) do { \
VALUE _obj_ = (obj); \
RBASIC_SET_CLASS(_obj_, cls); \
} while (0)
#endif
If anyone's reading this and is interested in updating the gem to work with 3.0, let me know.
we get an error undefined method `alloc' for GSL::Matrix:Class since we use v1.16.0.6 although the alloc method gets listed in the GSL::Matrix.methods . With v1.15.3 we don't get the error , any idea why ?
regards
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.