Skip to content

Commit 243c3dc

Browse files
committed
travis changes
travis changes travis changes
1 parent 2ea87ea commit 243c3dc

File tree

3 files changed

+24
-22
lines changed

3 files changed

+24
-22
lines changed

.travis.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,18 @@ language:
22
ruby
33

44
rvm:
5-
- 1.9
5+
- 1.9.3
66
- 2.0
7-
- 2.1
8-
- 2.2
9-
- 2.3.0
10-
- ruby-head
11-
- rbx-2
127

138
env:
149
matrix:
1510
- "NARRAY=1"
1611
- "NMATRIX=1"
1712
- ""
1813

19-
matrix:
20-
allow_failures:
21-
- rvm: ruby-head
22-
- rvm: rbx-2
23-
2414
before_install:
2515
- sudo apt-get update -qq
2616
- sudo apt-get install -y libgsl0-dev
2717
- bundle install
18+
- bundle exec rake compile
19+
- bundle exec rake test

ext/gsl_native/eigen.c

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -332,18 +332,17 @@ static VALUE rb_gsl_eigen_symmv_nmatrix(int argc, VALUE *argv, VALUE obj)
332332
gsl_vector_view vv;
333333
unsigned int shape1[1], shape2[2];
334334
int flagw = 0;
335-
336-
if (!NM_IsNMatrix(argv[0]))
337-
rb_raise(rb_eTypeError, "wrong argument type %s (NMatrix expected)",
338-
rb_class2name(CLASS_OF(argv[0])));
339-
nm = NM_STORAGE_DENSE(argv[0]);
340-
if (nm->shape[0] != nm->shape[1])
341-
rb_raise(rb_eRuntimeError, "square matrix required");
342-
A = gsl_matrix_alloc(nm->shape[0], nm->shape[1]);
343-
memcpy(A->data, (double*) nm->elements, sizeof(double)*A->size1*A->size2);
344-
345335
switch (argc) {
346336
case 2:
337+
if (!NM_IsNMatrix(argv[0]))
338+
rb_raise(rb_eTypeError, "wrong argument type %s (NMatrix expected)",
339+
rb_class2name(CLASS_OF(argv[0])));
340+
nm = NM_STORAGE_DENSE(argv[0]);
341+
if (nm->dim < 2) rb_raise(rb_eRuntimeError, "dim >= 2 required");
342+
if (nm->shape[0] != nm->shape[1])
343+
rb_raise(rb_eRuntimeError, "square matrix required");
344+
A = gsl_matrix_alloc(nm->shape[1], nm->shape[0]);
345+
memcpy(A->data, (double*) nm->elements, sizeof(double)*A->size1*A->size2);
347346
if (CLASS_OF(argv[1]) != cgsl_eigen_symmv_workspace)
348347
rb_raise(rb_eTypeError,
349348
"argv[1]: wrong argument type %s (Eigen::Symm::Workspace expected",
@@ -352,6 +351,15 @@ static VALUE rb_gsl_eigen_symmv_nmatrix(int argc, VALUE *argv, VALUE obj)
352351
flagw = 0;
353352
break;
354353
case 1:
354+
if (!NM_IsNMatrix(argv[0]))
355+
rb_raise(rb_eTypeError, "wrong argument type %s (NArray expected)",
356+
rb_class2name(CLASS_OF(argv[0])));
357+
nm = NM_STORAGE_DENSE(argv[0]);
358+
if (nm->dim < 2) rb_raise(rb_eRuntimeError, "rank >= 2 required");
359+
if (nm->shape[0] != nm->shape[1])
360+
rb_raise(rb_eRuntimeError, "square matrix required");
361+
A = gsl_matrix_alloc(nm->shape[1], nm->shape[0]);
362+
memcpy(A->data, (double*) nm->elements, sizeof(double)*A->size1*A->size2);
355363
w = gsl_eigen_symmv_alloc(A->size1);
356364
flagw = 1;
357365
break;
@@ -361,7 +369,7 @@ static VALUE rb_gsl_eigen_symmv_nmatrix(int argc, VALUE *argv, VALUE obj)
361369
}
362370
shape1[0] = A->size1;
363371
shape2[0] = A->size1;
364-
shape2[1] = A->size2;
372+
shape2[1] = A->size1;
365373
eval = rb_nvector_dense_create(FLOAT64, nm->elements, shape1[0]);
366374
evec = rb_nmatrix_dense_create(FLOAT64, shape2, 2, nm->elements, shape2[0]*shape2[1]);
367375
vv = gsl_vector_view_array((double*)NM_DENSE_ELEMENTS(eval), A->size1);

ext/gsl_native/extconf.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ def create_conf_h(file) #:nodoc:
3333
end
3434
end
3535

36+
hfile.printf "#define HAVE_RB_ARRAY_CONST_PTR 1"
37+
3638
hfile.puts
3739
hfile.puts "#endif"
3840
end

0 commit comments

Comments
 (0)