Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changes for GSL-1.13.

Runs OK, but left some tests.



git-svn-id: http://rb-gsl.rubyforge.org/svn/trunk/rb-gsl@106 6e764f74-f39f-46f8-8c54-8307d62afe8d
  • Loading branch information...
commit a7c1fbe165c2069989e727897c160d5b51bbf21f 1 parent 0792d86
ytsunesada authored
View
2  examples/const/hoge.txt
@@ -1,2 +0,0 @@
-Fixnum
-5
View
3  ext/complex.c
@@ -962,10 +962,9 @@ void Init_gsl_complex(VALUE module)
rb_define_singleton_method(cgsl_complex, "arccoth", rb_gsl_complex_arccoth, -1);
/***/
- rb_define_method(cgsl_complex, "sqrt", rb_gsl_complex_sqrt, -1);
+
rb_define_method(cgsl_complex, "pow", rb_gsl_complex_pow, -1);
rb_define_method(cgsl_complex, "pow_real", rb_gsl_complex_pow_real, -1);
- rb_define_method(cgsl_complex, "exp", rb_gsl_complex_exp, -1);
rb_define_method(cgsl_complex, "exp", rb_gsl_complex_exp, -1);
rb_define_method(cgsl_complex, "log", rb_gsl_complex_log, -1);
View
5 ext/const.c
@@ -188,6 +188,7 @@ static void rb_gsl_const_cgs(VALUE module)
rb_define_const(module, "RYDBERG", rb_float_new(GSL_CONST_CGS_RYDBERG));
rb_define_const(module, "BOHR_MAGNETON",
rb_float_new(GSL_CONST_CGS_BOHR_MAGNETON));
+
rb_define_const(module, "NUCLEAR_MAGNETON",
rb_float_new(GSL_CONST_CGS_NUCLEAR_MAGNETON));
rb_define_const(module, "ELECTRON_MAGNETIC_MOMENT",
@@ -515,8 +516,10 @@ static void rb_gsl_const_cgs(VALUE module)
rb_define_const(module, "MASS_PROTON", rb_float_new(GSL_CONST_CGSM_MASS_PROTON));
rb_define_const(module, "MASS_NEUTRON", rb_float_new(GSL_CONST_CGSM_MASS_NEUTRON));
rb_define_const(module, "RYDBERG", rb_float_new(GSL_CONST_CGSM_RYDBERG));
+
rb_define_const(module, "BOHR_MAGNETON",
rb_float_new(GSL_CONST_CGSM_BOHR_MAGNETON));
+
rb_define_const(module, "NUCLEAR_MAGNETON",
rb_float_new(GSL_CONST_CGSM_NUCLEAR_MAGNETON));
rb_define_const(module, "ELECTRON_MAGNETIC_MOMENT",
@@ -599,7 +602,9 @@ static void rb_gsl_const_cgs(VALUE module)
rb_float_new(GSL_CONST_CGSM_ELECTRON_CHARGE));
rb_define_const(module, "ELECTRON_CHARGE_ESU",
rb_float_new(GSL_CONST_CGSM_ELECTRON_CHARGE*GSL_CONST_CGSM_SPEED_OF_LIGHT));
+#ifndef GSL_1_13_LATER
rb_define_const(module, "GAUSS", rb_float_new(GSL_CONST_CGSM_GAUSS));
+#endif
rb_define_const(module, "STILB", rb_float_new(GSL_CONST_CGSM_STILB));
rb_define_const(module, "LUMEN", rb_float_new(GSL_CONST_CGSM_LUMEN));
rb_define_const(module, "LUX", rb_float_new(GSL_CONST_CGSM_LUX));
View
2  ext/eigen.c
@@ -2180,7 +2180,7 @@ void Init_gsl_eigen(VALUE module)
rb_gsl_eigen_symmv, -1);
rb_define_module_function(mgsl_eigen, "herm",
rb_gsl_eigen_herm, -1);
- rb_define_module_function(mgsl_eigen, "herm",
+ rb_define_module_function(mgsl_eigen, "hermv",
rb_gsl_eigen_hermv, -1);
rb_define_module_function(module, "eigen_symm",
View
4 ext/linalg_complex.c
@@ -709,8 +709,6 @@ void Init_gsl_linalg_complex(VALUE module)
rb_define_singleton_method(mgsl_linalg_complex_chol, "decomp", rb_gsl_linalg_cholesky_decomp, -1);
rb_define_method(cgsl_matrix_complex, "cholesky_decomp", rb_gsl_linalg_cholesky_decomp, -1);
rb_define_singleton_method(mgsl_linalg_complex_chol, "solve", rb_gsl_linalg_cholesky_solve, -1);
- rb_define_method(cgsl_matrix_complex, "cholesky_solve", rb_gsl_linalg_cholesky_solve, -1);
-
rb_define_method(cgsl_matrix_complex, "cholesky_solve", rb_gsl_linalg_cholesky_solve, -1);
rb_define_method(cgsl_matrix_complex_C, "solve", rb_gsl_linalg_cholesky_solve, -1);
rb_define_singleton_method(mgsl_linalg_complex_chol, "svx", rb_gsl_linalg_cholesky_svx, -1);
@@ -722,7 +720,7 @@ void Init_gsl_linalg_complex(VALUE module)
rb_gsl_linalg_complex_householder_transform, -1);
rb_define_singleton_method(mgsl_linalg_complex_Householder, "transform",
rb_gsl_linalg_complex_householder_transform, -1);
- rb_define_method(cgsl_vector, "householder_transform",
+ rb_define_method(cgsl_vector_complex, "householder_transform",
rb_gsl_linalg_complex_householder_transform, -1);
rb_define_singleton_method(mgsl_linalg_complex, "householder_hm",
View
2  ext/matrix_source.c
@@ -2553,8 +2553,6 @@ void FUNCTION(Init_gsl_matrix,init)(VALUE module)
rb_define_method(GSL_TYPE(cgsl_matrix), "+@",
FUNCTION(rb_gsl_matrix,uplus), 0);
- rb_define_method(GSL_TYPE(cgsl_matrix), "power",
- FUNCTION(rb_gsl_matrix,power), 1);
/*****/
rb_define_method(GSL_TYPE(cgsl_matrix), "submatrix",
View
2  ext/multifit.c
@@ -1808,7 +1808,7 @@ void Init_gsl_multifit(VALUE module)
rb_define_method(cgsl_multifit_fdfsolver, "name", rb_gsl_multifit_fdfsolver_name, 0);
rb_define_method(cgsl_multifit_fdfsolver, "iterate", rb_gsl_multifit_fdfsolver_iterate, 0);
rb_define_method(cgsl_multifit_fdfsolver, "position", rb_gsl_multifit_fdfsolver_position, 0);
- rb_define_alias(cgsl_multifit_fdfsolver, "x", "position");
+ // rb_define_alias(cgsl_multifit_fdfsolver, "x", "position");
rb_define_method(cgsl_multifit_fdfsolver, "print_state", rb_gsl_multifit_fdfsolver_print_state, 1);
rb_define_method(cgsl_multifit_fdfsolver, "fdf", rb_gsl_multifit_fdfsolver_fdf, 0);
rb_define_method(cgsl_multifit_fdfsolver, "test_delta", rb_gsl_multifit_fdfsolver_test_delta, 2);
View
1  ext/permutation.c
@@ -531,7 +531,6 @@ void Init_gsl_permutation(VALUE module)
rb_define_singleton_method(cgsl_permutation, "calloc", rb_gsl_permutation_calloc, 1);
rb_define_method(cgsl_permutation, "size", rb_gsl_permutation_size, 0);
rb_define_method(cgsl_permutation, "init", rb_gsl_permutation_init, 0);
- rb_define_method(cgsl_permutation, "print", rb_gsl_permutation_print, 0);
rb_define_method(cgsl_permutation, "inspect", rb_gsl_permutation_inspect, 0);
rb_define_method(cgsl_permutation, "to_s", rb_gsl_permutation_to_s, 0);
rb_define_method(cgsl_permutation, "get", rb_gsl_permutation_get, -1);
View
2  ext/poly_source.c
@@ -1793,7 +1793,7 @@ void FUNCTION(Init_gsl_poly,init)(VALUE module)
#endif
#ifdef BASE_DOUBLE
- rb_define_singleton_method(cgsl_poly, "eval", rb_gsl_poly_eval_singleton, 2);
+ // rb_define_singleton_method(cgsl_poly, "eval", rb_gsl_poly_eval_singleton, 2);
rb_define_method(cgsl_poly, "to_i", rb_gsl_poly_to_i, 0);
#ifdef GSL_1_11_LATER
rb_define_singleton_method(cgsl_poly, "complex_eval", rb_gsl_poly_eval_singleton, 2);
View
2  ext/vector_complex.c
@@ -2055,7 +2055,7 @@ void Init_gsl_vector_complex(VALUE module)
rb_define_method(cgsl_vector_complex, "coerce", rb_gsl_vector_complex_coerce, 1);
/* 2.Aug.2004 */
- rb_define_singleton_method(cgsl_vector, "inner_product", rb_gsl_vector_complex_inner_product, -1);
+ rb_define_singleton_method(cgsl_vector_complex, "inner_product", rb_gsl_vector_complex_inner_product, -1);
rb_define_singleton_method(cgsl_vector_complex, "dot", rb_gsl_vector_complex_inner_product, -1);
rb_define_method(cgsl_vector_complex, "inner_product", rb_gsl_vector_complex_inner_product, -1);
/* rb_define_alias(cgsl_vector_complex, "dot", "inner_product");*/
View
12 ext/vector_double.c
@@ -839,16 +839,6 @@ static VALUE rb_gsl_vector_plot2(int argc, VALUE *argv, VALUE obj)
return Qtrue;
}
-static VALUE rb_gsl_vector_sqrt(VALUE obj)
-{
- gsl_vector *v = NULL, *vnew = NULL;
- size_t i;
- Data_Get_Vector(obj, v);
- vnew = gsl_vector_alloc(v->size);
- for (i = 0; i < v->size; i++) gsl_vector_set(vnew, i, sqrt(gsl_vector_get(v, i)));
- return Data_Wrap_Struct(VECTOR_ROW_COL(obj), 0, gsl_vector_free, vnew);
-}
-
static VALUE rb_gsl_vector_normalize(int argc, VALUE *argv, VALUE obj)
{
gsl_vector *v = NULL, *vnew = NULL;
@@ -1399,8 +1389,6 @@ void Init_gsl_vector(VALUE module)
/*****/
- rb_define_method(cgsl_vector, "sqrt", rb_gsl_vector_sqrt, 0);
-
rb_define_method(cgsl_vector, "normalize", rb_gsl_vector_normalize, -1);
rb_define_method(cgsl_vector, "normalize!", rb_gsl_vector_normalize_bang, -1);
View
4 tests/gsl_test.rb
@@ -40,7 +40,7 @@ def test_factor(result, expected, factor, desc)
end
end
- def test_factor2(result, expected, factor, desc)
+ def test_factor2(result, expected, factor, desc)
status = nil
if result == expected
status = false
@@ -59,7 +59,7 @@ def test_factor2(result, expected, factor, desc)
printf("FAIL: #{desc} (%.18g observed vs %.18g expected)\n", result, expected)
end
end
-
+
def test_rel(result, expected, relerr, desc)
status = nil
if isnan?(result) or isnan?(expected)
View
31 tests/linalg/cholesky.rb
@@ -18,34 +18,3 @@
a = c.lower
test2(a == c_exp, "#{m.class}#cholesky_decomp")
test2((a*a.trans) == m, "#{m.class}#cholesky_decomp")
-
-require("test/unit")
-class CholeskyTest < Test::Unit::TestCase
- Data7 = GSL::Vector.alloc(66,0, 0,64, 126,63, 124,-62, 61,-61, 60,60, 0,-59,
- 0,-64, 65,0, 62,-124, -61,-122, -60,-60, 59,-59, -58,0,
- 126,-63, 62,124, 308,0, 180,-240, 59,-177, 174,58, -57,
- -114,
- 124,62, -61,122, 180,240, 299,0, 174,-58, 57,171, 56,-112,
- 61,61, -60,60, 59,177, 174,58, 119,0, 0,112, 55,-55,
- 60,-60, 59,59, 174,-58, 57,-171, 0,-112, 116,0, -54,-54,
- 0,59, -58,0, -57,114, 56,112, 55,55, -54,54, 60,0).to_complex2.matrix_view(7, 7)
- Data7_sol = GSL::Vector.alloc(-0.524944196428570,0.209123883928571,
- 1.052873883928572,0.712444196428571,
- 0.117568824404762,0.443191964285714,
- 0.412862723214286,-0.356696428571429,
- 0.815931919642858,-0.265820312500000,
- 0.777929687500000,0.119484747023810,
- 1.058733258928571,-0.132087053571429).to_complex2
- RHS = GSL::Vector.alloc(1, 2, 3, 4, 5, 6, 7).to_complex
- def test_linalg_complex_cholesky_solve
- c = GSL::Linalg::Complex::Cholesky::decomp(Data7)
- x = GSL::Linalg::Complex::Cholesky::solve(c, RHS)
- assert_equal(x, Data7_sol)
- end
- def test_linalg_complex_cholesky_svx
- c = GSL::Linalg::Complex::Cholesky::decomp(Data7)
- x = RHS.clone
- GSL::Linalg::Complex::Cholesky::svx(c, x)
- assert_equal(x, Data7_sol)
- end
-end
Please sign in to comment.
Something went wrong with that request. Please try again.