From 9e277a7de361c57fd6e8ff8244e3ce57ad5bf050 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 4 Oct 2020 12:45:35 +0700 Subject: [PATCH 01/76] Minor changes related to benchmarks and EJML matrix, add GSL module, add wrapper for gsl_matrix, provide headers of gsl, configure cinterop at least for Linux and OSX, update GitHub Actions workflow --- .github/workflows/gradle.yml | 22 +- examples/build.gradle.kts | 5 +- .../ast/ExpressionsInterpretersBenchmark.kt | 138 ++-- .../kotlin/kscience/kmath/ejml/EjmlMatrix.kt | 7 +- kmath-gsl/build.gradle.kts | 26 + .../src/nativeInterop/cinterop/libgsl.def | 8 + .../kscience/kmath/gsl/GslRealMatrix.kt | 47 ++ .../src/nativeMain/resources/gsl/gsl_blas.h | 602 ++++++++++++++ .../nativeMain/resources/gsl/gsl_blas_types.h | 54 ++ .../src/nativeMain/resources/gsl/gsl_block.h | 24 + .../nativeMain/resources/gsl/gsl_block_char.h | 65 ++ .../resources/gsl/gsl_block_complex_double.h | 65 ++ .../resources/gsl/gsl_block_complex_float.h | 65 ++ .../gsl/gsl_block_complex_long_double.h | 65 ++ .../resources/gsl/gsl_block_double.h | 65 ++ .../resources/gsl/gsl_block_float.h | 65 ++ .../nativeMain/resources/gsl/gsl_block_int.h | 65 ++ .../nativeMain/resources/gsl/gsl_block_long.h | 65 ++ .../resources/gsl/gsl_block_long_double.h | 65 ++ .../resources/gsl/gsl_block_short.h | 65 ++ .../resources/gsl/gsl_block_uchar.h | 65 ++ .../nativeMain/resources/gsl/gsl_block_uint.h | 65 ++ .../resources/gsl/gsl_block_ulong.h | 65 ++ .../resources/gsl/gsl_block_ushort.h | 65 ++ .../nativeMain/resources/gsl/gsl_bspline.h | 108 +++ .../src/nativeMain/resources/gsl/gsl_cblas.h | 606 ++++++++++++++ .../src/nativeMain/resources/gsl/gsl_cdf.h | 170 ++++ .../nativeMain/resources/gsl/gsl_chebyshev.h | 133 +++ .../resources/gsl/gsl_check_range.h | 57 ++ .../resources/gsl/gsl_combination.h | 92 +++ .../nativeMain/resources/gsl/gsl_complex.h | 103 +++ .../resources/gsl/gsl_complex_math.h | 142 ++++ .../src/nativeMain/resources/gsl/gsl_const.h | 31 + .../nativeMain/resources/gsl/gsl_const_cgs.h | 116 +++ .../nativeMain/resources/gsl/gsl_const_cgsm.h | 122 +++ .../nativeMain/resources/gsl/gsl_const_mks.h | 126 +++ .../nativeMain/resources/gsl/gsl_const_mksa.h | 126 +++ .../nativeMain/resources/gsl/gsl_const_num.h | 43 + .../src/nativeMain/resources/gsl/gsl_deriv.h | 50 ++ .../resources/gsl/gsl_dft_complex.h | 55 ++ .../resources/gsl/gsl_dft_complex_float.h | 55 ++ .../src/nativeMain/resources/gsl/gsl_dht.h | 87 ++ .../src/nativeMain/resources/gsl/gsl_diff.h | 52 ++ .../src/nativeMain/resources/gsl/gsl_eigen.h | 347 ++++++++ .../src/nativeMain/resources/gsl/gsl_errno.h | 154 ++++ .../src/nativeMain/resources/gsl/gsl_fft.h | 51 ++ .../resources/gsl/gsl_fft_complex.h | 136 +++ .../resources/gsl/gsl_fft_complex_float.h | 139 ++++ .../resources/gsl/gsl_fft_halfcomplex.h | 86 ++ .../resources/gsl/gsl_fft_halfcomplex_float.h | 86 ++ .../nativeMain/resources/gsl/gsl_fft_real.h | 80 ++ .../resources/gsl/gsl_fft_real_float.h | 79 ++ .../src/nativeMain/resources/gsl/gsl_filter.h | 109 +++ .../src/nativeMain/resources/gsl/gsl_fit.h | 85 ++ .../nativeMain/resources/gsl/gsl_heapsort.h | 44 + .../nativeMain/resources/gsl/gsl_histogram.h | 134 +++ .../resources/gsl/gsl_histogram2d.h | 172 ++++ .../nativeMain/resources/gsl/gsl_ieee_utils.h | 99 +++ .../src/nativeMain/resources/gsl/gsl_inline.h | 67 ++ .../resources/gsl/gsl_integration.h | 390 +++++++++ .../src/nativeMain/resources/gsl/gsl_interp.h | 225 +++++ .../nativeMain/resources/gsl/gsl_interp2d.h | 160 ++++ .../src/nativeMain/resources/gsl/gsl_linalg.h | 780 ++++++++++++++++++ .../nativeMain/resources/gsl/gsl_machine.h | 104 +++ .../src/nativeMain/resources/gsl/gsl_math.h | 164 ++++ .../src/nativeMain/resources/gsl/gsl_matrix.h | 25 + .../resources/gsl/gsl_matrix_char.h | 352 ++++++++ .../resources/gsl/gsl_matrix_complex_double.h | 353 ++++++++ .../resources/gsl/gsl_matrix_complex_float.h | 353 ++++++++ .../gsl/gsl_matrix_complex_long_double.h | 353 ++++++++ .../resources/gsl/gsl_matrix_double.h | 352 ++++++++ .../resources/gsl/gsl_matrix_float.h | 352 ++++++++ .../nativeMain/resources/gsl/gsl_matrix_int.h | 352 ++++++++ .../resources/gsl/gsl_matrix_long.h | 352 ++++++++ .../resources/gsl/gsl_matrix_long_double.h | 352 ++++++++ .../resources/gsl/gsl_matrix_short.h | 352 ++++++++ .../resources/gsl/gsl_matrix_uchar.h | 352 ++++++++ .../resources/gsl/gsl_matrix_uint.h | 352 ++++++++ .../resources/gsl/gsl_matrix_ulong.h | 352 ++++++++ .../resources/gsl/gsl_matrix_ushort.h | 352 ++++++++ .../nativeMain/resources/gsl/gsl_message.h | 80 ++ .../src/nativeMain/resources/gsl/gsl_min.h | 111 +++ .../src/nativeMain/resources/gsl/gsl_minmax.h | 102 +++ .../src/nativeMain/resources/gsl/gsl_mode.h | 88 ++ .../src/nativeMain/resources/gsl/gsl_monte.h | 55 ++ .../resources/gsl/gsl_monte_miser.h | 97 +++ .../resources/gsl/gsl_monte_plain.h | 65 ++ .../resources/gsl/gsl_monte_vegas.h | 125 +++ .../nativeMain/resources/gsl/gsl_movstat.h | 138 ++++ .../nativeMain/resources/gsl/gsl_multifit.h | 380 +++++++++ .../resources/gsl/gsl_multifit_nlin.h | 275 ++++++ .../resources/gsl/gsl_multifit_nlinear.h | 303 +++++++ .../nativeMain/resources/gsl/gsl_multilarge.h | 141 ++++ .../resources/gsl/gsl_multilarge_nlinear.h | 313 +++++++ .../nativeMain/resources/gsl/gsl_multimin.h | 226 +++++ .../nativeMain/resources/gsl/gsl_multiroots.h | 177 ++++ .../nativeMain/resources/gsl/gsl_multiset.h | 93 +++ .../src/nativeMain/resources/gsl/gsl_nan.h | 45 + .../src/nativeMain/resources/gsl/gsl_ntuple.h | 82 ++ .../src/nativeMain/resources/gsl/gsl_odeiv.h | 230 ++++++ .../src/nativeMain/resources/gsl/gsl_odeiv2.h | 333 ++++++++ .../resources/gsl/gsl_permutation.h | 100 +++ .../nativeMain/resources/gsl/gsl_permute.h | 24 + .../resources/gsl/gsl_permute_char.h | 44 + .../gsl/gsl_permute_complex_double.h | 45 + .../resources/gsl/gsl_permute_complex_float.h | 45 + .../gsl/gsl_permute_complex_long_double.h | 45 + .../resources/gsl/gsl_permute_double.h | 44 + .../resources/gsl/gsl_permute_float.h | 44 + .../resources/gsl/gsl_permute_int.h | 44 + .../resources/gsl/gsl_permute_long.h | 44 + .../resources/gsl/gsl_permute_long_double.h | 44 + .../resources/gsl/gsl_permute_matrix.h | 24 + .../resources/gsl/gsl_permute_matrix_char.h | 44 + .../gsl/gsl_permute_matrix_complex_double.h | 44 + .../gsl/gsl_permute_matrix_complex_float.h | 44 + .../gsl_permute_matrix_complex_long_double.h | 44 + .../resources/gsl/gsl_permute_matrix_double.h | 44 + .../resources/gsl/gsl_permute_matrix_float.h | 44 + .../resources/gsl/gsl_permute_matrix_int.h | 44 + .../resources/gsl/gsl_permute_matrix_long.h | 44 + .../gsl/gsl_permute_matrix_long_double.h | 44 + .../resources/gsl/gsl_permute_matrix_short.h | 44 + .../resources/gsl/gsl_permute_matrix_uchar.h | 44 + .../resources/gsl/gsl_permute_matrix_uint.h | 44 + .../resources/gsl/gsl_permute_matrix_ulong.h | 44 + .../resources/gsl/gsl_permute_matrix_ushort.h | 44 + .../resources/gsl/gsl_permute_short.h | 44 + .../resources/gsl/gsl_permute_uchar.h | 44 + .../resources/gsl/gsl_permute_uint.h | 44 + .../resources/gsl/gsl_permute_ulong.h | 44 + .../resources/gsl/gsl_permute_ushort.h | 44 + .../resources/gsl/gsl_permute_vector.h | 24 + .../resources/gsl/gsl_permute_vector_char.h | 45 + .../gsl/gsl_permute_vector_complex_double.h | 45 + .../gsl/gsl_permute_vector_complex_float.h | 45 + .../gsl_permute_vector_complex_long_double.h | 45 + .../resources/gsl/gsl_permute_vector_double.h | 45 + .../resources/gsl/gsl_permute_vector_float.h | 45 + .../resources/gsl/gsl_permute_vector_int.h | 45 + .../resources/gsl/gsl_permute_vector_long.h | 45 + .../gsl/gsl_permute_vector_long_double.h | 45 + .../resources/gsl/gsl_permute_vector_short.h | 45 + .../resources/gsl/gsl_permute_vector_uchar.h | 45 + .../resources/gsl/gsl_permute_vector_uint.h | 45 + .../resources/gsl/gsl_permute_vector_ulong.h | 45 + .../resources/gsl/gsl_permute_vector_ushort.h | 45 + .../src/nativeMain/resources/gsl/gsl_poly.h | 183 ++++ .../nativeMain/resources/gsl/gsl_pow_int.h | 61 ++ .../nativeMain/resources/gsl/gsl_precision.h | 66 ++ .../src/nativeMain/resources/gsl/gsl_qrng.h | 111 +++ .../nativeMain/resources/gsl/gsl_randist.h | 219 +++++ .../src/nativeMain/resources/gsl/gsl_rng.h | 217 +++++ .../src/nativeMain/resources/gsl/gsl_roots.h | 127 +++ .../src/nativeMain/resources/gsl/gsl_rstat.h | 81 ++ .../src/nativeMain/resources/gsl/gsl_sf.h | 41 + .../nativeMain/resources/gsl/gsl_sf_airy.h | 139 ++++ .../nativeMain/resources/gsl/gsl_sf_bessel.h | 549 ++++++++++++ .../nativeMain/resources/gsl/gsl_sf_clausen.h | 52 ++ .../nativeMain/resources/gsl/gsl_sf_coulomb.h | 128 +++ .../resources/gsl/gsl_sf_coupling.h | 125 +++ .../nativeMain/resources/gsl/gsl_sf_dawson.h | 52 ++ .../nativeMain/resources/gsl/gsl_sf_debye.h | 91 ++ .../nativeMain/resources/gsl/gsl_sf_dilog.h | 130 +++ .../resources/gsl/gsl_sf_elementary.h | 57 ++ .../nativeMain/resources/gsl/gsl_sf_ellint.h | 112 +++ .../nativeMain/resources/gsl/gsl_sf_elljac.h | 48 ++ .../src/nativeMain/resources/gsl/gsl_sf_erf.h | 91 ++ .../src/nativeMain/resources/gsl/gsl_sf_exp.h | 134 +++ .../nativeMain/resources/gsl/gsl_sf_expint.h | 167 ++++ .../resources/gsl/gsl_sf_fermi_dirac.h | 126 +++ .../nativeMain/resources/gsl/gsl_sf_gamma.h | 293 +++++++ .../resources/gsl/gsl_sf_gegenbauer.h | 73 ++ .../nativeMain/resources/gsl/gsl_sf_hermite.h | 75 ++ .../nativeMain/resources/gsl/gsl_sf_hyperg.h | 154 ++++ .../resources/gsl/gsl_sf_laguerre.h | 68 ++ .../nativeMain/resources/gsl/gsl_sf_lambert.h | 69 ++ .../resources/gsl/gsl_sf_legendre.h | 375 +++++++++ .../src/nativeMain/resources/gsl/gsl_sf_log.h | 82 ++ .../nativeMain/resources/gsl/gsl_sf_mathieu.h | 113 +++ .../nativeMain/resources/gsl/gsl_sf_pow_int.h | 49 ++ .../src/nativeMain/resources/gsl/gsl_sf_psi.h | 113 +++ .../nativeMain/resources/gsl/gsl_sf_result.h | 59 ++ .../resources/gsl/gsl_sf_sincos_pi.h | 57 ++ .../resources/gsl/gsl_sf_synchrotron.h | 60 ++ .../resources/gsl/gsl_sf_transport.h | 78 ++ .../nativeMain/resources/gsl/gsl_sf_trig.h | 152 ++++ .../nativeMain/resources/gsl/gsl_sf_zeta.h | 112 +++ .../src/nativeMain/resources/gsl/gsl_siman.h | 82 ++ .../src/nativeMain/resources/gsl/gsl_sort.h | 20 + .../nativeMain/resources/gsl/gsl_sort_char.h | 51 ++ .../resources/gsl/gsl_sort_double.h | 51 ++ .../nativeMain/resources/gsl/gsl_sort_float.h | 51 ++ .../nativeMain/resources/gsl/gsl_sort_int.h | 51 ++ .../nativeMain/resources/gsl/gsl_sort_long.h | 51 ++ .../resources/gsl/gsl_sort_long_double.h | 51 ++ .../nativeMain/resources/gsl/gsl_sort_short.h | 51 ++ .../nativeMain/resources/gsl/gsl_sort_uchar.h | 51 ++ .../nativeMain/resources/gsl/gsl_sort_uint.h | 51 ++ .../nativeMain/resources/gsl/gsl_sort_ulong.h | 51 ++ .../resources/gsl/gsl_sort_ushort.h | 51 ++ .../resources/gsl/gsl_sort_vector.h | 20 + .../resources/gsl/gsl_sort_vector_char.h | 52 ++ .../resources/gsl/gsl_sort_vector_double.h | 52 ++ .../resources/gsl/gsl_sort_vector_float.h | 52 ++ .../resources/gsl/gsl_sort_vector_int.h | 52 ++ .../resources/gsl/gsl_sort_vector_long.h | 52 ++ .../gsl/gsl_sort_vector_long_double.h | 52 ++ .../resources/gsl/gsl_sort_vector_short.h | 52 ++ .../resources/gsl/gsl_sort_vector_uchar.h | 52 ++ .../resources/gsl/gsl_sort_vector_uint.h | 52 ++ .../resources/gsl/gsl_sort_vector_ulong.h | 52 ++ .../resources/gsl/gsl_sort_vector_ushort.h | 52 ++ .../src/nativeMain/resources/gsl/gsl_spblas.h | 58 ++ .../nativeMain/resources/gsl/gsl_specfunc.h | 10 + .../nativeMain/resources/gsl/gsl_splinalg.h | 79 ++ .../src/nativeMain/resources/gsl/gsl_spline.h | 101 +++ .../nativeMain/resources/gsl/gsl_spline2d.h | 113 +++ .../nativeMain/resources/gsl/gsl_spmatrix.h | 184 +++++ .../nativeMain/resources/gsl/gsl_statistics.h | 20 + .../resources/gsl/gsl_statistics_char.h | 96 +++ .../resources/gsl/gsl_statistics_double.h | 116 +++ .../resources/gsl/gsl_statistics_float.h | 116 +++ .../resources/gsl/gsl_statistics_int.h | 96 +++ .../resources/gsl/gsl_statistics_long.h | 96 +++ .../gsl/gsl_statistics_long_double.h | 116 +++ .../resources/gsl/gsl_statistics_short.h | 96 +++ .../resources/gsl/gsl_statistics_uchar.h | 96 +++ .../resources/gsl/gsl_statistics_uint.h | 96 +++ .../resources/gsl/gsl_statistics_ulong.h | 96 +++ .../resources/gsl/gsl_statistics_ushort.h | 96 +++ .../src/nativeMain/resources/gsl/gsl_sum.h | 162 ++++ .../src/nativeMain/resources/gsl/gsl_sys.h | 63 ++ .../src/nativeMain/resources/gsl/gsl_test.h | 66 ++ .../src/nativeMain/resources/gsl/gsl_types.h | 41 + .../src/nativeMain/resources/gsl/gsl_vector.h | 25 + .../resources/gsl/gsl_vector_char.h | 230 ++++++ .../resources/gsl/gsl_vector_complex.h | 17 + .../resources/gsl/gsl_vector_complex_double.h | 251 ++++++ .../resources/gsl/gsl_vector_complex_float.h | 251 ++++++ .../gsl/gsl_vector_complex_long_double.h | 251 ++++++ .../resources/gsl/gsl_vector_double.h | 230 ++++++ .../resources/gsl/gsl_vector_float.h | 230 ++++++ .../nativeMain/resources/gsl/gsl_vector_int.h | 230 ++++++ .../resources/gsl/gsl_vector_long.h | 230 ++++++ .../resources/gsl/gsl_vector_long_double.h | 230 ++++++ .../resources/gsl/gsl_vector_short.h | 230 ++++++ .../resources/gsl/gsl_vector_uchar.h | 230 ++++++ .../resources/gsl/gsl_vector_uint.h | 230 ++++++ .../resources/gsl/gsl_vector_ulong.h | 230 ++++++ .../resources/gsl/gsl_vector_ushort.h | 230 ++++++ .../nativeMain/resources/gsl/gsl_version.h | 26 + .../nativeMain/resources/gsl/gsl_wavelet.h | 100 +++ .../nativeMain/resources/gsl/gsl_wavelet2d.h | 107 +++ settings.gradle.kts | 8 +- 255 files changed, 30102 insertions(+), 81 deletions(-) create mode 100644 kmath-gsl/build.gradle.kts create mode 100644 kmath-gsl/src/nativeInterop/cinterop/libgsl.def create mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslRealMatrix.kt create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_blas.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_blas_types.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_char.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_complex_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_complex_float.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_complex_long_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_float.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_int.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_long.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_long_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_short.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_uchar.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_uint.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_ulong.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_ushort.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_bspline.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_cblas.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_cdf.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_chebyshev.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_check_range.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_combination.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_complex.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_complex_math.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_const.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_const_cgs.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_const_cgsm.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_const_mks.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_const_mksa.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_const_num.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_deriv.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_dft_complex.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_dft_complex_float.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_dht.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_diff.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_eigen.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_errno.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_fft.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_complex.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_complex_float.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_halfcomplex.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_halfcomplex_float.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_real.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_real_float.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_filter.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_fit.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_heapsort.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_histogram.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_histogram2d.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_ieee_utils.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_inline.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_integration.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_interp.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_interp2d.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_linalg.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_machine.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_math.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_char.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_complex_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_complex_float.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_complex_long_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_float.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_int.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_long.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_long_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_short.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_uchar.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_uint.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_ulong.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_ushort.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_message.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_min.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_minmax.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_mode.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_monte.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_monte_miser.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_monte_plain.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_monte_vegas.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_movstat.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_multifit.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_multifit_nlin.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_multifit_nlinear.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_multilarge.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_multilarge_nlinear.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_multimin.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_multiroots.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_multiset.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_nan.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_ntuple.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_odeiv.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_odeiv2.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permutation.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_char.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_complex_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_complex_float.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_complex_long_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_float.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_int.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_long.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_long_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_char.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_complex_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_complex_float.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_complex_long_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_float.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_int.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_long.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_long_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_short.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_uchar.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_uint.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_ulong.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_ushort.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_short.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_uchar.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_uint.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_ulong.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_ushort.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_char.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_complex_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_complex_float.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_complex_long_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_float.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_int.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_long.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_long_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_short.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_uchar.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_uint.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_ulong.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_ushort.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_poly.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_pow_int.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_precision.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_qrng.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_randist.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_rng.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_roots.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_rstat.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_airy.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_bessel.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_clausen.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_coulomb.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_coupling.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_dawson.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_debye.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_dilog.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_elementary.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_ellint.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_elljac.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_erf.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_exp.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_expint.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_fermi_dirac.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_gamma.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_gegenbauer.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_hermite.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_hyperg.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_laguerre.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_lambert.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_legendre.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_log.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_mathieu.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_pow_int.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_psi.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_result.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_sincos_pi.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_synchrotron.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_transport.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_trig.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_zeta.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_siman.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_char.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_float.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_int.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_long.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_long_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_short.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_uchar.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_uint.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_ulong.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_ushort.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_char.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_float.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_int.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_long.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_long_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_short.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_uchar.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_uint.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_ulong.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_ushort.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_spblas.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_specfunc.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_splinalg.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_spline.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_spline2d.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_spmatrix.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_char.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_float.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_int.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_long.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_long_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_short.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_uchar.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_uint.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_ulong.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_ushort.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sum.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sys.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_test.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_types.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_char.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex_float.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex_long_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_float.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_int.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_long.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_long_double.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_short.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_uchar.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_uint.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_ulong.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_ushort.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_version.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_wavelet.h create mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_wavelet2d.h diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index adc74adfe..c541a8f71 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -4,7 +4,6 @@ on: [push] jobs: build: - runs-on: ubuntu-latest steps: @@ -13,5 +12,24 @@ jobs: uses: actions/setup-java@v1 with: java-version: 11 + - name: Install libgsl-dev + run: sudo apt install libgsl-dev + - name: Cache gradle + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle_6_6_1 + restore-keys: gradle_6_6_1 + + - name: Cache konan + uses: actions/cache@v2 + with: + path: | + ~/.konan/dependencies + ~/.konan/kotlin-native-macos-1.4.0 + key: ${{ runner.os }}-konan-1.4.0 + restore-keys: ${{ runner.os }}-konan-1.4.0 - name: Build with Gradle - run: ./gradlew build + run: ./gradlew -Dorg.gradle.daemon=false build diff --git a/examples/build.gradle.kts b/examples/build.gradle.kts index 900da966b..c8b173d1c 100644 --- a/examples/build.gradle.kts +++ b/examples/build.gradle.kts @@ -1,7 +1,6 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - java kotlin("jvm") kotlin("plugin.allopen") id("kotlinx.benchmark") @@ -12,14 +11,14 @@ allOpen.annotation("org.openjdk.jmh.annotations.State") repositories { maven("https://dl.bintray.com/mipt-npm/kscience") maven("https://dl.bintray.com/mipt-npm/dev") - maven("https://dl.bintray.com/kotlin/kotlin-dev/") + maven("https://dl.bintray.com/kotlin/kotlin-eap") mavenCentral() } sourceSets.register("benchmarks") dependencies { -// implementation(project(":kmath-ast")) + implementation(project(":kmath-ast")) implementation(project(":kmath-core")) implementation(project(":kmath-coroutines")) implementation(project(":kmath-commons")) diff --git a/examples/src/main/kotlin/kscience/kmath/ast/ExpressionsInterpretersBenchmark.kt b/examples/src/main/kotlin/kscience/kmath/ast/ExpressionsInterpretersBenchmark.kt index f0a32e5bd..3279d72ce 100644 --- a/examples/src/main/kotlin/kscience/kmath/ast/ExpressionsInterpretersBenchmark.kt +++ b/examples/src/main/kotlin/kscience/kmath/ast/ExpressionsInterpretersBenchmark.kt @@ -1,70 +1,70 @@ package kscience.kmath.ast -// -//import kscience.kmath.asm.compile -//import kscience.kmath.expressions.Expression -//import kscience.kmath.expressions.expressionInField -//import kscience.kmath.expressions.invoke -//import kscience.kmath.operations.Field -//import kscience.kmath.operations.RealField -//import kotlin.random.Random -//import kotlin.system.measureTimeMillis -// -//class ExpressionsInterpretersBenchmark { -// private val algebra: Field = RealField -// fun functionalExpression() { -// val expr = algebra.expressionInField { -// variable("x") * const(2.0) + const(2.0) / variable("x") - const(16.0) -// } -// -// invokeAndSum(expr) -// } -// -// fun mstExpression() { -// val expr = algebra.mstInField { -// symbol("x") * number(2.0) + number(2.0) / symbol("x") - number(16.0) -// } -// -// invokeAndSum(expr) -// } -// -// fun asmExpression() { -// val expr = algebra.mstInField { -// symbol("x") * number(2.0) + number(2.0) / symbol("x") - number(16.0) -// }.compile() -// -// invokeAndSum(expr) -// } -// -// private fun invokeAndSum(expr: Expression) { -// val random = Random(0) -// var sum = 0.0 -// -// repeat(1000000) { -// sum += expr("x" to random.nextDouble()) -// } -// -// println(sum) -// } -//} -// -//fun main() { -// val benchmark = ExpressionsInterpretersBenchmark() -// -// val fe = measureTimeMillis { -// benchmark.functionalExpression() -// } -// -// println("fe=$fe") -// -// val mst = measureTimeMillis { -// benchmark.mstExpression() -// } -// -// println("mst=$mst") -// -// val asm = measureTimeMillis { -// benchmark.asmExpression() -// } -// -// println("asm=$asm") -//} + +import kscience.kmath.asm.compile +import kscience.kmath.expressions.Expression +import kscience.kmath.expressions.expressionInField +import kscience.kmath.expressions.invoke +import kscience.kmath.operations.Field +import kscience.kmath.operations.RealField +import kotlin.random.Random +import kotlin.system.measureTimeMillis + +class ExpressionsInterpretersBenchmark { + private val algebra: Field = RealField + fun functionalExpression() { + val expr = algebra.expressionInField { + variable("x") * const(2.0) + const(2.0) / variable("x") - const(16.0) + } + + invokeAndSum(expr) + } + + fun mstExpression() { + val expr = algebra.mstInField { + symbol("x") * number(2.0) + number(2.0) / symbol("x") - number(16.0) + } + + invokeAndSum(expr) + } + + fun asmExpression() { + val expr = algebra.mstInField { + symbol("x") * number(2.0) + number(2.0) / symbol("x") - number(16.0) + }.compile() + + invokeAndSum(expr) + } + + private fun invokeAndSum(expr: Expression) { + val random = Random(0) + var sum = 0.0 + + repeat(1000000) { + sum += expr("x" to random.nextDouble()) + } + + println(sum) + } +} + +fun main() { + val benchmark = ExpressionsInterpretersBenchmark() + + val fe = measureTimeMillis { + benchmark.functionalExpression() + } + + println("fe=$fe") + + val mst = measureTimeMillis { + benchmark.mstExpression() + } + + println("mst=$mst") + + val asm = measureTimeMillis { + benchmark.asmExpression() + } + + println("asm=$asm") +} diff --git a/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrix.kt b/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrix.kt index ed6b1571e..a8892924a 100644 --- a/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrix.kt +++ b/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrix.kt @@ -1,12 +1,12 @@ package kscience.kmath.ejml -import org.ejml.dense.row.factory.DecompositionFactory_DDRM -import org.ejml.simple.SimpleMatrix import kscience.kmath.linear.DeterminantFeature import kscience.kmath.linear.FeaturedMatrix import kscience.kmath.linear.LUPDecompositionFeature import kscience.kmath.linear.MatrixFeature import kscience.kmath.structures.NDStructure +import org.ejml.dense.row.factory.DecompositionFactory_DDRM +import org.ejml.simple.SimpleMatrix /** * Represents featured matrix over EJML [SimpleMatrix]. @@ -14,7 +14,8 @@ import kscience.kmath.structures.NDStructure * @property origin the underlying [SimpleMatrix]. * @author Iaroslav Postovalov */ -public class EjmlMatrix(public val origin: SimpleMatrix, features: Set? = null) : FeaturedMatrix { +public class EjmlMatrix(public val origin: SimpleMatrix, features: Set? = null) : + FeaturedMatrix { public override val rowNum: Int get() = origin.numRows() diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts new file mode 100644 index 000000000..806400fc1 --- /dev/null +++ b/kmath-gsl/build.gradle.kts @@ -0,0 +1,26 @@ +@file:Suppress("UNUSED_VARIABLE") + +import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget + +plugins { + id("ru.mipt.npm.native") +} + +kotlin { + targets.withType { + compilations["main"].apply { + cinterops { + val libgsl by creating { + defFile("src/nativeInterop/cinterop/libgsl.def") + includeDirs { allHeaders("./src/nativeMain/resources/") } + } + } + } + } + + sourceSets.commonMain { + dependencies { + api(project(":kmath-core")) + } + } +} diff --git a/kmath-gsl/src/nativeInterop/cinterop/libgsl.def b/kmath-gsl/src/nativeInterop/cinterop/libgsl.def new file mode 100644 index 000000000..567d483e2 --- /dev/null +++ b/kmath-gsl/src/nativeInterop/cinterop/libgsl.def @@ -0,0 +1,8 @@ +package=org.gnu.gsl +headers=gsl/gsl_blas.h +headerFilter=gsl/* +linkerOpts=-lgsl +linkerOpts.linux=-L/usr/lib64 -L/usr/lib/x86_64-linux-gnu +linkerOpts.osx=-L/opt/local/lib -L/usr/local/lib +compilerOpts.linux=-I/usr/include/gsl +compilerOpts.osx=-I/usr/include/gsl diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslRealMatrix.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslRealMatrix.kt new file mode 100644 index 000000000..56e397aed --- /dev/null +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslRealMatrix.kt @@ -0,0 +1,47 @@ +package kscience.kmath.gsl + +import kotlinx.cinterop.CStructVar +import kotlinx.cinterop.CValues +import kotlinx.cinterop.memScoped +import kotlinx.cinterop.pointed +import kscience.kmath.linear.FeaturedMatrix +import kscience.kmath.linear.MatrixFeature +import kscience.kmath.structures.NDStructure +import org.gnu.gsl.gsl_matrix +import org.gnu.gsl.gsl_matrix_equal +import org.gnu.gsl.gsl_matrix_get + +public sealed class GslMatrix : FeaturedMatrix { + public abstract val nativeHandle: CValues + + public override fun hashCode(): Int { + var result = nativeHandle.hashCode() + result = 31 * result + features.hashCode() + return result + } +} + +public class GslRealMatrix(public override val nativeHandle: CValues, features: Set) : + GslMatrix() { + + public override val rowNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + + public override val colNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + + public override val shape: IntArray + get() = intArrayOf(rowNum, colNum) + + public override val features: Set = features + + public override fun suggestFeature(vararg features: MatrixFeature): GslRealMatrix = + GslRealMatrix(nativeHandle, this.features + features) + + public override fun get(i: Int, j: Int): Double = gsl_matrix_get(nativeHandle, i.toULong(), j.toULong()) + + public override fun equals(other: Any?): Boolean { + if (other is GslRealMatrix) gsl_matrix_equal(nativeHandle, other.nativeHandle) + return NDStructure.equals(this, other as? NDStructure<*> ?: return false) + } +} diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_blas.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_blas.h new file mode 100644 index 000000000..7c4271496 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_blas.h @@ -0,0 +1,602 @@ +/* blas/gsl_blas.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* + * Author: G. Jungman + */ +#ifndef __GSL_BLAS_H__ +#define __GSL_BLAS_H__ + +#include +#include + +#include + + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* ======================================================================== + * Level 1 + * ======================================================================== + */ + +int gsl_blas_sdsdot (float alpha, + const gsl_vector_float * X, + const gsl_vector_float * Y, + float * result + ); + +int gsl_blas_dsdot (const gsl_vector_float * X, + const gsl_vector_float * Y, + double * result + ); + +int gsl_blas_sdot (const gsl_vector_float * X, + const gsl_vector_float * Y, + float * result + ); + +int gsl_blas_ddot (const gsl_vector * X, + const gsl_vector * Y, + double * result + ); + + +int gsl_blas_cdotu (const gsl_vector_complex_float * X, + const gsl_vector_complex_float * Y, + gsl_complex_float * dotu); + +int gsl_blas_cdotc (const gsl_vector_complex_float * X, + const gsl_vector_complex_float * Y, + gsl_complex_float * dotc); + +int gsl_blas_zdotu (const gsl_vector_complex * X, + const gsl_vector_complex * Y, + gsl_complex * dotu); + +int gsl_blas_zdotc (const gsl_vector_complex * X, + const gsl_vector_complex * Y, + gsl_complex * dotc); + + +float gsl_blas_snrm2 (const gsl_vector_float * X); +float gsl_blas_sasum (const gsl_vector_float * X); +double gsl_blas_dnrm2 (const gsl_vector * X); +double gsl_blas_dasum (const gsl_vector * X); +float gsl_blas_scnrm2 (const gsl_vector_complex_float * X); +float gsl_blas_scasum (const gsl_vector_complex_float * X); +double gsl_blas_dznrm2 (const gsl_vector_complex * X); +double gsl_blas_dzasum (const gsl_vector_complex * X); + + +CBLAS_INDEX_t gsl_blas_isamax (const gsl_vector_float * X); +CBLAS_INDEX_t gsl_blas_idamax (const gsl_vector * X); +CBLAS_INDEX_t gsl_blas_icamax (const gsl_vector_complex_float * X); +CBLAS_INDEX_t gsl_blas_izamax (const gsl_vector_complex * X); + + +int gsl_blas_sswap (gsl_vector_float * X, + gsl_vector_float * Y); + +int gsl_blas_scopy (const gsl_vector_float * X, + gsl_vector_float * Y); + +int gsl_blas_saxpy (float alpha, + const gsl_vector_float * X, + gsl_vector_float * Y); + +int gsl_blas_dswap (gsl_vector * X, + gsl_vector * Y); + +int gsl_blas_dcopy (const gsl_vector * X, + gsl_vector * Y); + +int gsl_blas_daxpy (double alpha, + const gsl_vector * X, + gsl_vector * Y); + +int gsl_blas_cswap (gsl_vector_complex_float * X, + gsl_vector_complex_float * Y); + +int gsl_blas_ccopy (const gsl_vector_complex_float * X, + gsl_vector_complex_float * Y); + +int gsl_blas_caxpy (const gsl_complex_float alpha, + const gsl_vector_complex_float * X, + gsl_vector_complex_float * Y); + +int gsl_blas_zswap (gsl_vector_complex * X, + gsl_vector_complex * Y); + +int gsl_blas_zcopy (const gsl_vector_complex * X, + gsl_vector_complex * Y); + +int gsl_blas_zaxpy (const gsl_complex alpha, + const gsl_vector_complex * X, + gsl_vector_complex * Y); + + +int gsl_blas_srotg (float a[], float b[], float c[], float s[]); + +int gsl_blas_srotmg (float d1[], float d2[], float b1[], float b2, float P[]); + +int gsl_blas_srot (gsl_vector_float * X, + gsl_vector_float * Y, + float c, float s); + +int gsl_blas_srotm (gsl_vector_float * X, + gsl_vector_float * Y, + const float P[]); + +int gsl_blas_drotg (double a[], double b[], double c[], double s[]); + +int gsl_blas_drotmg (double d1[], double d2[], double b1[], + double b2, double P[]); + +int gsl_blas_drot (gsl_vector * X, + gsl_vector * Y, + const double c, const double s); + +int gsl_blas_drotm (gsl_vector * X, + gsl_vector * Y, + const double P[]); + + +void gsl_blas_sscal (float alpha, gsl_vector_float * X); +void gsl_blas_dscal (double alpha, gsl_vector * X); +void gsl_blas_cscal (const gsl_complex_float alpha, gsl_vector_complex_float * X); +void gsl_blas_zscal (const gsl_complex alpha, gsl_vector_complex * X); +void gsl_blas_csscal (float alpha, gsl_vector_complex_float * X); +void gsl_blas_zdscal (double alpha, gsl_vector_complex * X); + + +/* =========================================================================== + * Level 2 + * =========================================================================== + */ + +/* + * Routines with standard 4 prefixes (S, D, C, Z) + */ +int gsl_blas_sgemv (CBLAS_TRANSPOSE_t TransA, + float alpha, + const gsl_matrix_float * A, + const gsl_vector_float * X, + float beta, + gsl_vector_float * Y); + +int gsl_blas_strmv (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, + const gsl_matrix_float * A, + gsl_vector_float * X); + +int gsl_blas_strsv (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, + const gsl_matrix_float * A, + gsl_vector_float * X); + +int gsl_blas_dgemv (CBLAS_TRANSPOSE_t TransA, + double alpha, + const gsl_matrix * A, + const gsl_vector * X, + double beta, + gsl_vector * Y); + +int gsl_blas_dtrmv (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, + const gsl_matrix * A, + gsl_vector * X); + +int gsl_blas_dtrsv (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, + const gsl_matrix * A, + gsl_vector * X); + +int gsl_blas_cgemv (CBLAS_TRANSPOSE_t TransA, + const gsl_complex_float alpha, + const gsl_matrix_complex_float * A, + const gsl_vector_complex_float * X, + const gsl_complex_float beta, + gsl_vector_complex_float * Y); + +int gsl_blas_ctrmv (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, + const gsl_matrix_complex_float * A, + gsl_vector_complex_float * X); + +int gsl_blas_ctrsv (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, + const gsl_matrix_complex_float * A, + gsl_vector_complex_float * X); + +int gsl_blas_zgemv (CBLAS_TRANSPOSE_t TransA, + const gsl_complex alpha, + const gsl_matrix_complex * A, + const gsl_vector_complex * X, + const gsl_complex beta, + gsl_vector_complex * Y); + +int gsl_blas_ztrmv (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, + const gsl_matrix_complex * A, + gsl_vector_complex * X); + +int gsl_blas_ztrsv (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, + const gsl_matrix_complex * A, + gsl_vector_complex *X); + +/* + * Routines with S and D prefixes only + */ +int gsl_blas_ssymv (CBLAS_UPLO_t Uplo, + float alpha, + const gsl_matrix_float * A, + const gsl_vector_float * X, + float beta, + gsl_vector_float * Y); + +int gsl_blas_sger (float alpha, + const gsl_vector_float * X, + const gsl_vector_float * Y, + gsl_matrix_float * A); + +int gsl_blas_ssyr (CBLAS_UPLO_t Uplo, + float alpha, + const gsl_vector_float * X, + gsl_matrix_float * A); + +int gsl_blas_ssyr2 (CBLAS_UPLO_t Uplo, + float alpha, + const gsl_vector_float * X, + const gsl_vector_float * Y, + gsl_matrix_float * A); + +int gsl_blas_dsymv (CBLAS_UPLO_t Uplo, + double alpha, + const gsl_matrix * A, + const gsl_vector * X, + double beta, + gsl_vector * Y); +int gsl_blas_dger (double alpha, + const gsl_vector * X, + const gsl_vector * Y, + gsl_matrix * A); + +int gsl_blas_dsyr (CBLAS_UPLO_t Uplo, + double alpha, + const gsl_vector * X, + gsl_matrix * A); + +int gsl_blas_dsyr2 (CBLAS_UPLO_t Uplo, + double alpha, + const gsl_vector * X, + const gsl_vector * Y, + gsl_matrix * A); + +/* + * Routines with C and Z prefixes only + */ + +int gsl_blas_chemv (CBLAS_UPLO_t Uplo, + const gsl_complex_float alpha, + const gsl_matrix_complex_float * A, + const gsl_vector_complex_float * X, + const gsl_complex_float beta, + gsl_vector_complex_float * Y); + +int gsl_blas_cgeru (const gsl_complex_float alpha, + const gsl_vector_complex_float * X, + const gsl_vector_complex_float * Y, + gsl_matrix_complex_float * A); + +int gsl_blas_cgerc (const gsl_complex_float alpha, + const gsl_vector_complex_float * X, + const gsl_vector_complex_float * Y, + gsl_matrix_complex_float * A); + +int gsl_blas_cher (CBLAS_UPLO_t Uplo, + float alpha, + const gsl_vector_complex_float * X, + gsl_matrix_complex_float * A); + +int gsl_blas_cher2 (CBLAS_UPLO_t Uplo, + const gsl_complex_float alpha, + const gsl_vector_complex_float * X, + const gsl_vector_complex_float * Y, + gsl_matrix_complex_float * A); + +int gsl_blas_zhemv (CBLAS_UPLO_t Uplo, + const gsl_complex alpha, + const gsl_matrix_complex * A, + const gsl_vector_complex * X, + const gsl_complex beta, + gsl_vector_complex * Y); + +int gsl_blas_zgeru (const gsl_complex alpha, + const gsl_vector_complex * X, + const gsl_vector_complex * Y, + gsl_matrix_complex * A); + +int gsl_blas_zgerc (const gsl_complex alpha, + const gsl_vector_complex * X, + const gsl_vector_complex * Y, + gsl_matrix_complex * A); + +int gsl_blas_zher (CBLAS_UPLO_t Uplo, + double alpha, + const gsl_vector_complex * X, + gsl_matrix_complex * A); + +int gsl_blas_zher2 (CBLAS_UPLO_t Uplo, + const gsl_complex alpha, + const gsl_vector_complex * X, + const gsl_vector_complex * Y, + gsl_matrix_complex * A); + +/* + * =========================================================================== + * Prototypes for level 3 BLAS + * =========================================================================== + */ + +/* + * Routines with standard 4 prefixes (S, D, C, Z) + */ +int gsl_blas_sgemm (CBLAS_TRANSPOSE_t TransA, + CBLAS_TRANSPOSE_t TransB, + float alpha, + const gsl_matrix_float * A, + const gsl_matrix_float * B, + float beta, + gsl_matrix_float * C); + +int gsl_blas_ssymm (CBLAS_SIDE_t Side, CBLAS_UPLO_t Uplo, + float alpha, + const gsl_matrix_float * A, + const gsl_matrix_float * B, + float beta, + gsl_matrix_float * C); + +int gsl_blas_ssyrk (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t Trans, + float alpha, + const gsl_matrix_float * A, + float beta, + gsl_matrix_float * C); + +int gsl_blas_ssyr2k (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t Trans, + float alpha, + const gsl_matrix_float * A, + const gsl_matrix_float * B, + float beta, + gsl_matrix_float * C); + +int gsl_blas_strmm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, + CBLAS_DIAG_t Diag, + float alpha, + const gsl_matrix_float * A, + gsl_matrix_float * B); + +int gsl_blas_strsm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, + CBLAS_DIAG_t Diag, + float alpha, + const gsl_matrix_float * A, + gsl_matrix_float * B); + +int gsl_blas_dgemm (CBLAS_TRANSPOSE_t TransA, + CBLAS_TRANSPOSE_t TransB, + double alpha, + const gsl_matrix * A, + const gsl_matrix * B, + double beta, + gsl_matrix * C); + +int gsl_blas_dsymm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, + double alpha, + const gsl_matrix * A, + const gsl_matrix * B, + double beta, + gsl_matrix * C); + +int gsl_blas_dsyrk (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t Trans, + double alpha, + const gsl_matrix * A, + double beta, + gsl_matrix * C); + +int gsl_blas_dsyr2k (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t Trans, + double alpha, + const gsl_matrix * A, + const gsl_matrix * B, + double beta, + gsl_matrix * C); + +int gsl_blas_dtrmm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, + CBLAS_DIAG_t Diag, + double alpha, + const gsl_matrix * A, + gsl_matrix * B); + +int gsl_blas_dtrsm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, + CBLAS_DIAG_t Diag, + double alpha, + const gsl_matrix * A, + gsl_matrix * B); + +int gsl_blas_cgemm (CBLAS_TRANSPOSE_t TransA, + CBLAS_TRANSPOSE_t TransB, + const gsl_complex_float alpha, + const gsl_matrix_complex_float * A, + const gsl_matrix_complex_float * B, + const gsl_complex_float beta, + gsl_matrix_complex_float * C); + +int gsl_blas_csymm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, + const gsl_complex_float alpha, + const gsl_matrix_complex_float * A, + const gsl_matrix_complex_float * B, + const gsl_complex_float beta, + gsl_matrix_complex_float * C); + +int gsl_blas_csyrk (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t Trans, + const gsl_complex_float alpha, + const gsl_matrix_complex_float * A, + const gsl_complex_float beta, + gsl_matrix_complex_float * C); + +int gsl_blas_csyr2k (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t Trans, + const gsl_complex_float alpha, + const gsl_matrix_complex_float * A, + const gsl_matrix_complex_float * B, + const gsl_complex_float beta, + gsl_matrix_complex_float * C); + +int gsl_blas_ctrmm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, + CBLAS_DIAG_t Diag, + const gsl_complex_float alpha, + const gsl_matrix_complex_float * A, + gsl_matrix_complex_float * B); + +int gsl_blas_ctrsm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, + CBLAS_DIAG_t Diag, + const gsl_complex_float alpha, + const gsl_matrix_complex_float * A, + gsl_matrix_complex_float * B); + +int gsl_blas_zgemm (CBLAS_TRANSPOSE_t TransA, + CBLAS_TRANSPOSE_t TransB, + const gsl_complex alpha, + const gsl_matrix_complex * A, + const gsl_matrix_complex * B, + const gsl_complex beta, + gsl_matrix_complex * C); + +int gsl_blas_zsymm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, + const gsl_complex alpha, + const gsl_matrix_complex * A, + const gsl_matrix_complex * B, + const gsl_complex beta, + gsl_matrix_complex * C); + +int gsl_blas_zsyrk (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t Trans, + const gsl_complex alpha, + const gsl_matrix_complex * A, + const gsl_complex beta, + gsl_matrix_complex * C); + +int gsl_blas_zsyr2k (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t Trans, + const gsl_complex alpha, + const gsl_matrix_complex * A, + const gsl_matrix_complex * B, + const gsl_complex beta, + gsl_matrix_complex *C); + +int gsl_blas_ztrmm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, + CBLAS_DIAG_t Diag, + const gsl_complex alpha, + const gsl_matrix_complex * A, + gsl_matrix_complex * B); + +int gsl_blas_ztrsm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, + CBLAS_DIAG_t Diag, + const gsl_complex alpha, + const gsl_matrix_complex * A, + gsl_matrix_complex * B); + +/* + * Routines with prefixes C and Z only + */ +int gsl_blas_chemm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, + const gsl_complex_float alpha, + const gsl_matrix_complex_float * A, + const gsl_matrix_complex_float * B, + const gsl_complex_float beta, + gsl_matrix_complex_float * C); + +int gsl_blas_cherk (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t Trans, + float alpha, + const gsl_matrix_complex_float * A, + float beta, + gsl_matrix_complex_float * C); + +int gsl_blas_cher2k (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t Trans, + const gsl_complex_float alpha, + const gsl_matrix_complex_float * A, + const gsl_matrix_complex_float * B, + float beta, + gsl_matrix_complex_float * C); + +int gsl_blas_zhemm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, + const gsl_complex alpha, + const gsl_matrix_complex * A, + const gsl_matrix_complex * B, + const gsl_complex beta, + gsl_matrix_complex * C); + +int gsl_blas_zherk (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t Trans, + double alpha, + const gsl_matrix_complex * A, + double beta, + gsl_matrix_complex * C); + +int gsl_blas_zher2k (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t Trans, + const gsl_complex alpha, + const gsl_matrix_complex * A, + const gsl_matrix_complex * B, + double beta, + gsl_matrix_complex * C); + + +__END_DECLS + +#endif /* __GSL_BLAS_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_blas_types.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_blas_types.h new file mode 100644 index 000000000..923edb310 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_blas_types.h @@ -0,0 +1,54 @@ +/* blas/gsl_blas_types.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* + * Author: G. Jungman + */ +/* Based on draft BLAST C interface specification [Jul 7 1998] + */ +#ifndef __GSL_BLAS_TYPES_H__ +#define __GSL_BLAS_TYPES_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef CBLAS_INDEX CBLAS_INDEX_t; +typedef enum CBLAS_ORDER CBLAS_ORDER_t; +typedef enum CBLAS_TRANSPOSE CBLAS_TRANSPOSE_t; +typedef enum CBLAS_UPLO CBLAS_UPLO_t; +typedef enum CBLAS_DIAG CBLAS_DIAG_t; +typedef enum CBLAS_SIDE CBLAS_SIDE_t; + +/* typedef gsl_complex COMPLEX; */ + +__END_DECLS + + +#endif /* __GSL_BLAS_TYPES_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block.h new file mode 100644 index 000000000..f1f9ef87e --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block.h @@ -0,0 +1,24 @@ +#ifndef __GSL_BLOCK_H__ +#define __GSL_BLOCK_H__ + +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#endif /* __GSL_BLOCK_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_char.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_char.h new file mode 100644 index 000000000..70bf969fe --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_char.h @@ -0,0 +1,65 @@ +/* block/gsl_block_char.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_CHAR_H__ +#define __GSL_BLOCK_CHAR_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_char_struct +{ + size_t size; + char *data; +}; + +typedef struct gsl_block_char_struct gsl_block_char; + +gsl_block_char *gsl_block_char_alloc (const size_t n); +gsl_block_char *gsl_block_char_calloc (const size_t n); +void gsl_block_char_free (gsl_block_char * b); + +int gsl_block_char_fread (FILE * stream, gsl_block_char * b); +int gsl_block_char_fwrite (FILE * stream, const gsl_block_char * b); +int gsl_block_char_fscanf (FILE * stream, gsl_block_char * b); +int gsl_block_char_fprintf (FILE * stream, const gsl_block_char * b, const char *format); + +int gsl_block_char_raw_fread (FILE * stream, char * b, const size_t n, const size_t stride); +int gsl_block_char_raw_fwrite (FILE * stream, const char * b, const size_t n, const size_t stride); +int gsl_block_char_raw_fscanf (FILE * stream, char * b, const size_t n, const size_t stride); +int gsl_block_char_raw_fprintf (FILE * stream, const char * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_char_size (const gsl_block_char * b); +char * gsl_block_char_data (const gsl_block_char * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_CHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_complex_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_complex_double.h new file mode 100644 index 000000000..bcf66c08a --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_complex_double.h @@ -0,0 +1,65 @@ +/* block/gsl_block_complex_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_COMPLEX_DOUBLE_H__ +#define __GSL_BLOCK_COMPLEX_DOUBLE_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_complex_struct +{ + size_t size; + double *data; +}; + +typedef struct gsl_block_complex_struct gsl_block_complex; + +gsl_block_complex *gsl_block_complex_alloc (const size_t n); +gsl_block_complex *gsl_block_complex_calloc (const size_t n); +void gsl_block_complex_free (gsl_block_complex * b); + +int gsl_block_complex_fread (FILE * stream, gsl_block_complex * b); +int gsl_block_complex_fwrite (FILE * stream, const gsl_block_complex * b); +int gsl_block_complex_fscanf (FILE * stream, gsl_block_complex * b); +int gsl_block_complex_fprintf (FILE * stream, const gsl_block_complex * b, const char *format); + +int gsl_block_complex_raw_fread (FILE * stream, double * b, const size_t n, const size_t stride); +int gsl_block_complex_raw_fwrite (FILE * stream, const double * b, const size_t n, const size_t stride); +int gsl_block_complex_raw_fscanf (FILE * stream, double * b, const size_t n, const size_t stride); +int gsl_block_complex_raw_fprintf (FILE * stream, const double * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_complex_size (const gsl_block_complex * b); +double * gsl_block_complex_data (const gsl_block_complex * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_COMPLEX_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_complex_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_complex_float.h new file mode 100644 index 000000000..03595dc9f --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_complex_float.h @@ -0,0 +1,65 @@ +/* block/gsl_block_complex_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_COMPLEX_FLOAT_H__ +#define __GSL_BLOCK_COMPLEX_FLOAT_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_complex_float_struct +{ + size_t size; + float *data; +}; + +typedef struct gsl_block_complex_float_struct gsl_block_complex_float; + +gsl_block_complex_float *gsl_block_complex_float_alloc (const size_t n); +gsl_block_complex_float *gsl_block_complex_float_calloc (const size_t n); +void gsl_block_complex_float_free (gsl_block_complex_float * b); + +int gsl_block_complex_float_fread (FILE * stream, gsl_block_complex_float * b); +int gsl_block_complex_float_fwrite (FILE * stream, const gsl_block_complex_float * b); +int gsl_block_complex_float_fscanf (FILE * stream, gsl_block_complex_float * b); +int gsl_block_complex_float_fprintf (FILE * stream, const gsl_block_complex_float * b, const char *format); + +int gsl_block_complex_float_raw_fread (FILE * stream, float * b, const size_t n, const size_t stride); +int gsl_block_complex_float_raw_fwrite (FILE * stream, const float * b, const size_t n, const size_t stride); +int gsl_block_complex_float_raw_fscanf (FILE * stream, float * b, const size_t n, const size_t stride); +int gsl_block_complex_float_raw_fprintf (FILE * stream, const float * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_complex_float_size (const gsl_block_complex_float * b); +float * gsl_block_complex_float_data (const gsl_block_complex_float * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_COMPLEX_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_complex_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_complex_long_double.h new file mode 100644 index 000000000..eb0c60515 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_complex_long_double.h @@ -0,0 +1,65 @@ +/* block/gsl_block_complex_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_COMPLEX_LONG_DOUBLE_H__ +#define __GSL_BLOCK_COMPLEX_LONG_DOUBLE_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_complex_long_double_struct +{ + size_t size; + long double *data; +}; + +typedef struct gsl_block_complex_long_double_struct gsl_block_complex_long_double; + +gsl_block_complex_long_double *gsl_block_complex_long_double_alloc (const size_t n); +gsl_block_complex_long_double *gsl_block_complex_long_double_calloc (const size_t n); +void gsl_block_complex_long_double_free (gsl_block_complex_long_double * b); + +int gsl_block_complex_long_double_fread (FILE * stream, gsl_block_complex_long_double * b); +int gsl_block_complex_long_double_fwrite (FILE * stream, const gsl_block_complex_long_double * b); +int gsl_block_complex_long_double_fscanf (FILE * stream, gsl_block_complex_long_double * b); +int gsl_block_complex_long_double_fprintf (FILE * stream, const gsl_block_complex_long_double * b, const char *format); + +int gsl_block_complex_long_double_raw_fread (FILE * stream, long double * b, const size_t n, const size_t stride); +int gsl_block_complex_long_double_raw_fwrite (FILE * stream, const long double * b, const size_t n, const size_t stride); +int gsl_block_complex_long_double_raw_fscanf (FILE * stream, long double * b, const size_t n, const size_t stride); +int gsl_block_complex_long_double_raw_fprintf (FILE * stream, const long double * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_complex_long_double_size (const gsl_block_complex_long_double * b); +long double * gsl_block_complex_long_double_data (const gsl_block_complex_long_double * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_COMPLEX_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_double.h new file mode 100644 index 000000000..3a95f4d56 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_double.h @@ -0,0 +1,65 @@ +/* block/gsl_block_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_DOUBLE_H__ +#define __GSL_BLOCK_DOUBLE_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_struct +{ + size_t size; + double *data; +}; + +typedef struct gsl_block_struct gsl_block; + +gsl_block *gsl_block_alloc (const size_t n); +gsl_block *gsl_block_calloc (const size_t n); +void gsl_block_free (gsl_block * b); + +int gsl_block_fread (FILE * stream, gsl_block * b); +int gsl_block_fwrite (FILE * stream, const gsl_block * b); +int gsl_block_fscanf (FILE * stream, gsl_block * b); +int gsl_block_fprintf (FILE * stream, const gsl_block * b, const char *format); + +int gsl_block_raw_fread (FILE * stream, double * b, const size_t n, const size_t stride); +int gsl_block_raw_fwrite (FILE * stream, const double * b, const size_t n, const size_t stride); +int gsl_block_raw_fscanf (FILE * stream, double * b, const size_t n, const size_t stride); +int gsl_block_raw_fprintf (FILE * stream, const double * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_size (const gsl_block * b); +double * gsl_block_data (const gsl_block * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_float.h new file mode 100644 index 000000000..f1c3fb35f --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_float.h @@ -0,0 +1,65 @@ +/* block/gsl_block_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_FLOAT_H__ +#define __GSL_BLOCK_FLOAT_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_float_struct +{ + size_t size; + float *data; +}; + +typedef struct gsl_block_float_struct gsl_block_float; + +gsl_block_float *gsl_block_float_alloc (const size_t n); +gsl_block_float *gsl_block_float_calloc (const size_t n); +void gsl_block_float_free (gsl_block_float * b); + +int gsl_block_float_fread (FILE * stream, gsl_block_float * b); +int gsl_block_float_fwrite (FILE * stream, const gsl_block_float * b); +int gsl_block_float_fscanf (FILE * stream, gsl_block_float * b); +int gsl_block_float_fprintf (FILE * stream, const gsl_block_float * b, const char *format); + +int gsl_block_float_raw_fread (FILE * stream, float * b, const size_t n, const size_t stride); +int gsl_block_float_raw_fwrite (FILE * stream, const float * b, const size_t n, const size_t stride); +int gsl_block_float_raw_fscanf (FILE * stream, float * b, const size_t n, const size_t stride); +int gsl_block_float_raw_fprintf (FILE * stream, const float * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_float_size (const gsl_block_float * b); +float * gsl_block_float_data (const gsl_block_float * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_int.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_int.h new file mode 100644 index 000000000..2213f4701 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_int.h @@ -0,0 +1,65 @@ +/* block/gsl_block_int.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_INT_H__ +#define __GSL_BLOCK_INT_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_int_struct +{ + size_t size; + int *data; +}; + +typedef struct gsl_block_int_struct gsl_block_int; + +gsl_block_int *gsl_block_int_alloc (const size_t n); +gsl_block_int *gsl_block_int_calloc (const size_t n); +void gsl_block_int_free (gsl_block_int * b); + +int gsl_block_int_fread (FILE * stream, gsl_block_int * b); +int gsl_block_int_fwrite (FILE * stream, const gsl_block_int * b); +int gsl_block_int_fscanf (FILE * stream, gsl_block_int * b); +int gsl_block_int_fprintf (FILE * stream, const gsl_block_int * b, const char *format); + +int gsl_block_int_raw_fread (FILE * stream, int * b, const size_t n, const size_t stride); +int gsl_block_int_raw_fwrite (FILE * stream, const int * b, const size_t n, const size_t stride); +int gsl_block_int_raw_fscanf (FILE * stream, int * b, const size_t n, const size_t stride); +int gsl_block_int_raw_fprintf (FILE * stream, const int * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_int_size (const gsl_block_int * b); +int * gsl_block_int_data (const gsl_block_int * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_INT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_long.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_long.h new file mode 100644 index 000000000..0c30aa5e4 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_long.h @@ -0,0 +1,65 @@ +/* block/gsl_block_long.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_LONG_H__ +#define __GSL_BLOCK_LONG_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_long_struct +{ + size_t size; + long *data; +}; + +typedef struct gsl_block_long_struct gsl_block_long; + +gsl_block_long *gsl_block_long_alloc (const size_t n); +gsl_block_long *gsl_block_long_calloc (const size_t n); +void gsl_block_long_free (gsl_block_long * b); + +int gsl_block_long_fread (FILE * stream, gsl_block_long * b); +int gsl_block_long_fwrite (FILE * stream, const gsl_block_long * b); +int gsl_block_long_fscanf (FILE * stream, gsl_block_long * b); +int gsl_block_long_fprintf (FILE * stream, const gsl_block_long * b, const char *format); + +int gsl_block_long_raw_fread (FILE * stream, long * b, const size_t n, const size_t stride); +int gsl_block_long_raw_fwrite (FILE * stream, const long * b, const size_t n, const size_t stride); +int gsl_block_long_raw_fscanf (FILE * stream, long * b, const size_t n, const size_t stride); +int gsl_block_long_raw_fprintf (FILE * stream, const long * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_long_size (const gsl_block_long * b); +long * gsl_block_long_data (const gsl_block_long * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_LONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_long_double.h new file mode 100644 index 000000000..639cd8150 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_long_double.h @@ -0,0 +1,65 @@ +/* block/gsl_block_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_LONG_DOUBLE_H__ +#define __GSL_BLOCK_LONG_DOUBLE_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_long_double_struct +{ + size_t size; + long double *data; +}; + +typedef struct gsl_block_long_double_struct gsl_block_long_double; + +gsl_block_long_double *gsl_block_long_double_alloc (const size_t n); +gsl_block_long_double *gsl_block_long_double_calloc (const size_t n); +void gsl_block_long_double_free (gsl_block_long_double * b); + +int gsl_block_long_double_fread (FILE * stream, gsl_block_long_double * b); +int gsl_block_long_double_fwrite (FILE * stream, const gsl_block_long_double * b); +int gsl_block_long_double_fscanf (FILE * stream, gsl_block_long_double * b); +int gsl_block_long_double_fprintf (FILE * stream, const gsl_block_long_double * b, const char *format); + +int gsl_block_long_double_raw_fread (FILE * stream, long double * b, const size_t n, const size_t stride); +int gsl_block_long_double_raw_fwrite (FILE * stream, const long double * b, const size_t n, const size_t stride); +int gsl_block_long_double_raw_fscanf (FILE * stream, long double * b, const size_t n, const size_t stride); +int gsl_block_long_double_raw_fprintf (FILE * stream, const long double * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_long_double_size (const gsl_block_long_double * b); +long double * gsl_block_long_double_data (const gsl_block_long_double * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_short.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_short.h new file mode 100644 index 000000000..97447755c --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_short.h @@ -0,0 +1,65 @@ +/* block/gsl_block_short.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_SHORT_H__ +#define __GSL_BLOCK_SHORT_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_short_struct +{ + size_t size; + short *data; +}; + +typedef struct gsl_block_short_struct gsl_block_short; + +gsl_block_short *gsl_block_short_alloc (const size_t n); +gsl_block_short *gsl_block_short_calloc (const size_t n); +void gsl_block_short_free (gsl_block_short * b); + +int gsl_block_short_fread (FILE * stream, gsl_block_short * b); +int gsl_block_short_fwrite (FILE * stream, const gsl_block_short * b); +int gsl_block_short_fscanf (FILE * stream, gsl_block_short * b); +int gsl_block_short_fprintf (FILE * stream, const gsl_block_short * b, const char *format); + +int gsl_block_short_raw_fread (FILE * stream, short * b, const size_t n, const size_t stride); +int gsl_block_short_raw_fwrite (FILE * stream, const short * b, const size_t n, const size_t stride); +int gsl_block_short_raw_fscanf (FILE * stream, short * b, const size_t n, const size_t stride); +int gsl_block_short_raw_fprintf (FILE * stream, const short * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_short_size (const gsl_block_short * b); +short * gsl_block_short_data (const gsl_block_short * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_SHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_uchar.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_uchar.h new file mode 100644 index 000000000..58cf789dc --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_uchar.h @@ -0,0 +1,65 @@ +/* block/gsl_block_uchar.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_UCHAR_H__ +#define __GSL_BLOCK_UCHAR_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_uchar_struct +{ + size_t size; + unsigned char *data; +}; + +typedef struct gsl_block_uchar_struct gsl_block_uchar; + +gsl_block_uchar *gsl_block_uchar_alloc (const size_t n); +gsl_block_uchar *gsl_block_uchar_calloc (const size_t n); +void gsl_block_uchar_free (gsl_block_uchar * b); + +int gsl_block_uchar_fread (FILE * stream, gsl_block_uchar * b); +int gsl_block_uchar_fwrite (FILE * stream, const gsl_block_uchar * b); +int gsl_block_uchar_fscanf (FILE * stream, gsl_block_uchar * b); +int gsl_block_uchar_fprintf (FILE * stream, const gsl_block_uchar * b, const char *format); + +int gsl_block_uchar_raw_fread (FILE * stream, unsigned char * b, const size_t n, const size_t stride); +int gsl_block_uchar_raw_fwrite (FILE * stream, const unsigned char * b, const size_t n, const size_t stride); +int gsl_block_uchar_raw_fscanf (FILE * stream, unsigned char * b, const size_t n, const size_t stride); +int gsl_block_uchar_raw_fprintf (FILE * stream, const unsigned char * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_uchar_size (const gsl_block_uchar * b); +unsigned char * gsl_block_uchar_data (const gsl_block_uchar * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_UCHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_uint.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_uint.h new file mode 100644 index 000000000..52cf2cbec --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_uint.h @@ -0,0 +1,65 @@ +/* block/gsl_block_uint.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_UINT_H__ +#define __GSL_BLOCK_UINT_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_uint_struct +{ + size_t size; + unsigned int *data; +}; + +typedef struct gsl_block_uint_struct gsl_block_uint; + +gsl_block_uint *gsl_block_uint_alloc (const size_t n); +gsl_block_uint *gsl_block_uint_calloc (const size_t n); +void gsl_block_uint_free (gsl_block_uint * b); + +int gsl_block_uint_fread (FILE * stream, gsl_block_uint * b); +int gsl_block_uint_fwrite (FILE * stream, const gsl_block_uint * b); +int gsl_block_uint_fscanf (FILE * stream, gsl_block_uint * b); +int gsl_block_uint_fprintf (FILE * stream, const gsl_block_uint * b, const char *format); + +int gsl_block_uint_raw_fread (FILE * stream, unsigned int * b, const size_t n, const size_t stride); +int gsl_block_uint_raw_fwrite (FILE * stream, const unsigned int * b, const size_t n, const size_t stride); +int gsl_block_uint_raw_fscanf (FILE * stream, unsigned int * b, const size_t n, const size_t stride); +int gsl_block_uint_raw_fprintf (FILE * stream, const unsigned int * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_uint_size (const gsl_block_uint * b); +unsigned int * gsl_block_uint_data (const gsl_block_uint * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_UINT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_ulong.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_ulong.h new file mode 100644 index 000000000..863ff4759 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_ulong.h @@ -0,0 +1,65 @@ +/* block/gsl_block_ulong.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_ULONG_H__ +#define __GSL_BLOCK_ULONG_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_ulong_struct +{ + size_t size; + unsigned long *data; +}; + +typedef struct gsl_block_ulong_struct gsl_block_ulong; + +gsl_block_ulong *gsl_block_ulong_alloc (const size_t n); +gsl_block_ulong *gsl_block_ulong_calloc (const size_t n); +void gsl_block_ulong_free (gsl_block_ulong * b); + +int gsl_block_ulong_fread (FILE * stream, gsl_block_ulong * b); +int gsl_block_ulong_fwrite (FILE * stream, const gsl_block_ulong * b); +int gsl_block_ulong_fscanf (FILE * stream, gsl_block_ulong * b); +int gsl_block_ulong_fprintf (FILE * stream, const gsl_block_ulong * b, const char *format); + +int gsl_block_ulong_raw_fread (FILE * stream, unsigned long * b, const size_t n, const size_t stride); +int gsl_block_ulong_raw_fwrite (FILE * stream, const unsigned long * b, const size_t n, const size_t stride); +int gsl_block_ulong_raw_fscanf (FILE * stream, unsigned long * b, const size_t n, const size_t stride); +int gsl_block_ulong_raw_fprintf (FILE * stream, const unsigned long * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_ulong_size (const gsl_block_ulong * b); +unsigned long * gsl_block_ulong_data (const gsl_block_ulong * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_ULONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_ushort.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_ushort.h new file mode 100644 index 000000000..24ad7dbff --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_ushort.h @@ -0,0 +1,65 @@ +/* block/gsl_block_ushort.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_USHORT_H__ +#define __GSL_BLOCK_USHORT_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_ushort_struct +{ + size_t size; + unsigned short *data; +}; + +typedef struct gsl_block_ushort_struct gsl_block_ushort; + +gsl_block_ushort *gsl_block_ushort_alloc (const size_t n); +gsl_block_ushort *gsl_block_ushort_calloc (const size_t n); +void gsl_block_ushort_free (gsl_block_ushort * b); + +int gsl_block_ushort_fread (FILE * stream, gsl_block_ushort * b); +int gsl_block_ushort_fwrite (FILE * stream, const gsl_block_ushort * b); +int gsl_block_ushort_fscanf (FILE * stream, gsl_block_ushort * b); +int gsl_block_ushort_fprintf (FILE * stream, const gsl_block_ushort * b, const char *format); + +int gsl_block_ushort_raw_fread (FILE * stream, unsigned short * b, const size_t n, const size_t stride); +int gsl_block_ushort_raw_fwrite (FILE * stream, const unsigned short * b, const size_t n, const size_t stride); +int gsl_block_ushort_raw_fscanf (FILE * stream, unsigned short * b, const size_t n, const size_t stride); +int gsl_block_ushort_raw_fprintf (FILE * stream, const unsigned short * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_ushort_size (const gsl_block_ushort * b); +unsigned short * gsl_block_ushort_data (const gsl_block_ushort * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_USHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_bspline.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_bspline.h new file mode 100644 index 000000000..878fe498a --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_bspline.h @@ -0,0 +1,108 @@ +/* bspline/gsl_bspline.h + * + * Copyright (C) 2006 Patrick Alken + * Copyright (C) 2008 Rhys Ulerich + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BSPLINE_H__ +#define __GSL_BSPLINE_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t k; /* spline order */ + size_t km1; /* k - 1 (polynomial order) */ + size_t l; /* number of polynomial pieces on interval */ + size_t nbreak; /* number of breakpoints (l + 1) */ + size_t n; /* number of bspline basis functions (l + k - 1) */ + + gsl_vector *knots; /* knots vector */ + gsl_vector *deltal; /* left delta */ + gsl_vector *deltar; /* right delta */ + gsl_vector *B; /* temporary spline results */ + + /* bspline derivative parameters */ + gsl_matrix *A; /* work matrix */ + gsl_matrix *dB; /* temporary derivative results */ +} gsl_bspline_workspace; + +gsl_bspline_workspace * +gsl_bspline_alloc(const size_t k, const size_t nbreak); + +void gsl_bspline_free(gsl_bspline_workspace *w); + +size_t gsl_bspline_ncoeffs(gsl_bspline_workspace * w); +size_t gsl_bspline_order(gsl_bspline_workspace * w); +size_t gsl_bspline_nbreak(gsl_bspline_workspace * w); +double gsl_bspline_breakpoint(size_t i, gsl_bspline_workspace * w); +double gsl_bspline_greville_abscissa(size_t i, gsl_bspline_workspace *w); + +int +gsl_bspline_knots(const gsl_vector *breakpts, gsl_bspline_workspace *w); + +int gsl_bspline_knots_uniform(const double a, const double b, + gsl_bspline_workspace *w); + +int +gsl_bspline_knots_greville(const gsl_vector *abscissae, + gsl_bspline_workspace *w, + double *abserr); + +int +gsl_bspline_eval(const double x, gsl_vector *B, + gsl_bspline_workspace *w); + +int +gsl_bspline_eval_nonzero(const double x, + gsl_vector *Bk, + size_t *istart, + size_t *iend, + gsl_bspline_workspace *w); + +int +gsl_bspline_deriv_eval(const double x, + const size_t nderiv, + gsl_matrix *dB, + gsl_bspline_workspace *w); + +int +gsl_bspline_deriv_eval_nonzero(const double x, + const size_t nderiv, + gsl_matrix *dB, + size_t *istart, + size_t *iend, + gsl_bspline_workspace *w); + +__END_DECLS + +#endif /* __GSL_BSPLINE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_cblas.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_cblas.h new file mode 100644 index 000000000..e90e3b037 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_cblas.h @@ -0,0 +1,606 @@ +/* blas/gsl_cblas.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* This is a copy of the CBLAS standard header. + * We carry this around so we do not have to + * break our model for flexible BLAS functionality. + */ + +#ifndef __GSL_CBLAS_H__ +#define __GSL_CBLAS_H__ +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS } +#else +#define __BEGIN_DECLS /* empty */ +#define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* + * Enumerated and derived types + */ +#define CBLAS_INDEX size_t /* this may vary between platforms */ + +enum CBLAS_ORDER {CblasRowMajor=101, CblasColMajor=102}; +enum CBLAS_TRANSPOSE {CblasNoTrans=111, CblasTrans=112, CblasConjTrans=113}; +enum CBLAS_UPLO {CblasUpper=121, CblasLower=122}; +enum CBLAS_DIAG {CblasNonUnit=131, CblasUnit=132}; +enum CBLAS_SIDE {CblasLeft=141, CblasRight=142}; + +/* + * =========================================================================== + * Prototypes for level 1 BLAS functions (complex are recast as routines) + * =========================================================================== + */ +float cblas_sdsdot(const int N, const float alpha, const float *X, + const int incX, const float *Y, const int incY); +double cblas_dsdot(const int N, const float *X, const int incX, const float *Y, + const int incY); +float cblas_sdot(const int N, const float *X, const int incX, + const float *Y, const int incY); +double cblas_ddot(const int N, const double *X, const int incX, + const double *Y, const int incY); + +/* + * Functions having prefixes Z and C only + */ +void cblas_cdotu_sub(const int N, const void *X, const int incX, + const void *Y, const int incY, void *dotu); +void cblas_cdotc_sub(const int N, const void *X, const int incX, + const void *Y, const int incY, void *dotc); + +void cblas_zdotu_sub(const int N, const void *X, const int incX, + const void *Y, const int incY, void *dotu); +void cblas_zdotc_sub(const int N, const void *X, const int incX, + const void *Y, const int incY, void *dotc); + + +/* + * Functions having prefixes S D SC DZ + */ +float cblas_snrm2(const int N, const float *X, const int incX); +float cblas_sasum(const int N, const float *X, const int incX); + +double cblas_dnrm2(const int N, const double *X, const int incX); +double cblas_dasum(const int N, const double *X, const int incX); + +float cblas_scnrm2(const int N, const void *X, const int incX); +float cblas_scasum(const int N, const void *X, const int incX); + +double cblas_dznrm2(const int N, const void *X, const int incX); +double cblas_dzasum(const int N, const void *X, const int incX); + + +/* + * Functions having standard 4 prefixes (S D C Z) + */ +CBLAS_INDEX cblas_isamax(const int N, const float *X, const int incX); +CBLAS_INDEX cblas_idamax(const int N, const double *X, const int incX); +CBLAS_INDEX cblas_icamax(const int N, const void *X, const int incX); +CBLAS_INDEX cblas_izamax(const int N, const void *X, const int incX); + +/* + * =========================================================================== + * Prototypes for level 1 BLAS routines + * =========================================================================== + */ + +/* + * Routines with standard 4 prefixes (s, d, c, z) + */ +void cblas_sswap(const int N, float *X, const int incX, + float *Y, const int incY); +void cblas_scopy(const int N, const float *X, const int incX, + float *Y, const int incY); +void cblas_saxpy(const int N, const float alpha, const float *X, + const int incX, float *Y, const int incY); + +void cblas_dswap(const int N, double *X, const int incX, + double *Y, const int incY); +void cblas_dcopy(const int N, const double *X, const int incX, + double *Y, const int incY); +void cblas_daxpy(const int N, const double alpha, const double *X, + const int incX, double *Y, const int incY); + +void cblas_cswap(const int N, void *X, const int incX, + void *Y, const int incY); +void cblas_ccopy(const int N, const void *X, const int incX, + void *Y, const int incY); +void cblas_caxpy(const int N, const void *alpha, const void *X, + const int incX, void *Y, const int incY); + +void cblas_zswap(const int N, void *X, const int incX, + void *Y, const int incY); +void cblas_zcopy(const int N, const void *X, const int incX, + void *Y, const int incY); +void cblas_zaxpy(const int N, const void *alpha, const void *X, + const int incX, void *Y, const int incY); + + +/* + * Routines with S and D prefix only + */ +void cblas_srotg(float *a, float *b, float *c, float *s); +void cblas_srotmg(float *d1, float *d2, float *b1, const float b2, float *P); +void cblas_srot(const int N, float *X, const int incX, + float *Y, const int incY, const float c, const float s); +void cblas_srotm(const int N, float *X, const int incX, + float *Y, const int incY, const float *P); + +void cblas_drotg(double *a, double *b, double *c, double *s); +void cblas_drotmg(double *d1, double *d2, double *b1, const double b2, double *P); +void cblas_drot(const int N, double *X, const int incX, + double *Y, const int incY, const double c, const double s); +void cblas_drotm(const int N, double *X, const int incX, + double *Y, const int incY, const double *P); + + +/* + * Routines with S D C Z CS and ZD prefixes + */ +void cblas_sscal(const int N, const float alpha, float *X, const int incX); +void cblas_dscal(const int N, const double alpha, double *X, const int incX); +void cblas_cscal(const int N, const void *alpha, void *X, const int incX); +void cblas_zscal(const int N, const void *alpha, void *X, const int incX); +void cblas_csscal(const int N, const float alpha, void *X, const int incX); +void cblas_zdscal(const int N, const double alpha, void *X, const int incX); + +/* + * =========================================================================== + * Prototypes for level 2 BLAS + * =========================================================================== + */ + +/* + * Routines with standard 4 prefixes (S, D, C, Z) + */ +void cblas_sgemv(const enum CBLAS_ORDER order, + const enum CBLAS_TRANSPOSE TransA, const int M, const int N, + const float alpha, const float *A, const int lda, + const float *X, const int incX, const float beta, + float *Y, const int incY); +void cblas_sgbmv(const enum CBLAS_ORDER order, + const enum CBLAS_TRANSPOSE TransA, const int M, const int N, + const int KL, const int KU, const float alpha, + const float *A, const int lda, const float *X, + const int incX, const float beta, float *Y, const int incY); +void cblas_strmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const float *A, const int lda, + float *X, const int incX); +void cblas_stbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const int K, const float *A, const int lda, + float *X, const int incX); +void cblas_stpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const float *Ap, float *X, const int incX); +void cblas_strsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const float *A, const int lda, float *X, + const int incX); +void cblas_stbsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const int K, const float *A, const int lda, + float *X, const int incX); +void cblas_stpsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const float *Ap, float *X, const int incX); + +void cblas_dgemv(const enum CBLAS_ORDER order, + const enum CBLAS_TRANSPOSE TransA, const int M, const int N, + const double alpha, const double *A, const int lda, + const double *X, const int incX, const double beta, + double *Y, const int incY); +void cblas_dgbmv(const enum CBLAS_ORDER order, + const enum CBLAS_TRANSPOSE TransA, const int M, const int N, + const int KL, const int KU, const double alpha, + const double *A, const int lda, const double *X, + const int incX, const double beta, double *Y, const int incY); +void cblas_dtrmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const double *A, const int lda, + double *X, const int incX); +void cblas_dtbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const int K, const double *A, const int lda, + double *X, const int incX); +void cblas_dtpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const double *Ap, double *X, const int incX); +void cblas_dtrsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const double *A, const int lda, double *X, + const int incX); +void cblas_dtbsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const int K, const double *A, const int lda, + double *X, const int incX); +void cblas_dtpsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const double *Ap, double *X, const int incX); + +void cblas_cgemv(const enum CBLAS_ORDER order, + const enum CBLAS_TRANSPOSE TransA, const int M, const int N, + const void *alpha, const void *A, const int lda, + const void *X, const int incX, const void *beta, + void *Y, const int incY); +void cblas_cgbmv(const enum CBLAS_ORDER order, + const enum CBLAS_TRANSPOSE TransA, const int M, const int N, + const int KL, const int KU, const void *alpha, + const void *A, const int lda, const void *X, + const int incX, const void *beta, void *Y, const int incY); +void cblas_ctrmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const void *A, const int lda, + void *X, const int incX); +void cblas_ctbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const int K, const void *A, const int lda, + void *X, const int incX); +void cblas_ctpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const void *Ap, void *X, const int incX); +void cblas_ctrsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const void *A, const int lda, void *X, + const int incX); +void cblas_ctbsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const int K, const void *A, const int lda, + void *X, const int incX); +void cblas_ctpsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const void *Ap, void *X, const int incX); + +void cblas_zgemv(const enum CBLAS_ORDER order, + const enum CBLAS_TRANSPOSE TransA, const int M, const int N, + const void *alpha, const void *A, const int lda, + const void *X, const int incX, const void *beta, + void *Y, const int incY); +void cblas_zgbmv(const enum CBLAS_ORDER order, + const enum CBLAS_TRANSPOSE TransA, const int M, const int N, + const int KL, const int KU, const void *alpha, + const void *A, const int lda, const void *X, + const int incX, const void *beta, void *Y, const int incY); +void cblas_ztrmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const void *A, const int lda, + void *X, const int incX); +void cblas_ztbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const int K, const void *A, const int lda, + void *X, const int incX); +void cblas_ztpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const void *Ap, void *X, const int incX); +void cblas_ztrsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const void *A, const int lda, void *X, + const int incX); +void cblas_ztbsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const int K, const void *A, const int lda, + void *X, const int incX); +void cblas_ztpsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const void *Ap, void *X, const int incX); + + +/* + * Routines with S and D prefixes only + */ +void cblas_ssymv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const float alpha, const float *A, + const int lda, const float *X, const int incX, + const float beta, float *Y, const int incY); +void cblas_ssbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const int K, const float alpha, const float *A, + const int lda, const float *X, const int incX, + const float beta, float *Y, const int incY); +void cblas_sspmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const float alpha, const float *Ap, + const float *X, const int incX, + const float beta, float *Y, const int incY); +void cblas_sger(const enum CBLAS_ORDER order, const int M, const int N, + const float alpha, const float *X, const int incX, + const float *Y, const int incY, float *A, const int lda); +void cblas_ssyr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const float alpha, const float *X, + const int incX, float *A, const int lda); +void cblas_sspr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const float alpha, const float *X, + const int incX, float *Ap); +void cblas_ssyr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const float alpha, const float *X, + const int incX, const float *Y, const int incY, float *A, + const int lda); +void cblas_sspr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const float alpha, const float *X, + const int incX, const float *Y, const int incY, float *A); + +void cblas_dsymv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const double alpha, const double *A, + const int lda, const double *X, const int incX, + const double beta, double *Y, const int incY); +void cblas_dsbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const int K, const double alpha, const double *A, + const int lda, const double *X, const int incX, + const double beta, double *Y, const int incY); +void cblas_dspmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const double alpha, const double *Ap, + const double *X, const int incX, + const double beta, double *Y, const int incY); +void cblas_dger(const enum CBLAS_ORDER order, const int M, const int N, + const double alpha, const double *X, const int incX, + const double *Y, const int incY, double *A, const int lda); +void cblas_dsyr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const double alpha, const double *X, + const int incX, double *A, const int lda); +void cblas_dspr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const double alpha, const double *X, + const int incX, double *Ap); +void cblas_dsyr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const double alpha, const double *X, + const int incX, const double *Y, const int incY, double *A, + const int lda); +void cblas_dspr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const double alpha, const double *X, + const int incX, const double *Y, const int incY, double *A); + + +/* + * Routines with C and Z prefixes only + */ +void cblas_chemv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const void *alpha, const void *A, + const int lda, const void *X, const int incX, + const void *beta, void *Y, const int incY); +void cblas_chbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const int K, const void *alpha, const void *A, + const int lda, const void *X, const int incX, + const void *beta, void *Y, const int incY); +void cblas_chpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const void *alpha, const void *Ap, + const void *X, const int incX, + const void *beta, void *Y, const int incY); +void cblas_cgeru(const enum CBLAS_ORDER order, const int M, const int N, + const void *alpha, const void *X, const int incX, + const void *Y, const int incY, void *A, const int lda); +void cblas_cgerc(const enum CBLAS_ORDER order, const int M, const int N, + const void *alpha, const void *X, const int incX, + const void *Y, const int incY, void *A, const int lda); +void cblas_cher(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const float alpha, const void *X, const int incX, + void *A, const int lda); +void cblas_chpr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const float alpha, const void *X, + const int incX, void *A); +void cblas_cher2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, + const void *alpha, const void *X, const int incX, + const void *Y, const int incY, void *A, const int lda); +void cblas_chpr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, + const void *alpha, const void *X, const int incX, + const void *Y, const int incY, void *Ap); + +void cblas_zhemv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const void *alpha, const void *A, + const int lda, const void *X, const int incX, + const void *beta, void *Y, const int incY); +void cblas_zhbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const int K, const void *alpha, const void *A, + const int lda, const void *X, const int incX, + const void *beta, void *Y, const int incY); +void cblas_zhpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const void *alpha, const void *Ap, + const void *X, const int incX, + const void *beta, void *Y, const int incY); +void cblas_zgeru(const enum CBLAS_ORDER order, const int M, const int N, + const void *alpha, const void *X, const int incX, + const void *Y, const int incY, void *A, const int lda); +void cblas_zgerc(const enum CBLAS_ORDER order, const int M, const int N, + const void *alpha, const void *X, const int incX, + const void *Y, const int incY, void *A, const int lda); +void cblas_zher(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const double alpha, const void *X, const int incX, + void *A, const int lda); +void cblas_zhpr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const double alpha, const void *X, + const int incX, void *A); +void cblas_zher2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, + const void *alpha, const void *X, const int incX, + const void *Y, const int incY, void *A, const int lda); +void cblas_zhpr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, + const void *alpha, const void *X, const int incX, + const void *Y, const int incY, void *Ap); + +/* + * =========================================================================== + * Prototypes for level 3 BLAS + * =========================================================================== + */ + +/* + * Routines with standard 4 prefixes (S, D, C, Z) + */ +void cblas_sgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_TRANSPOSE TransB, const int M, const int N, + const int K, const float alpha, const float *A, + const int lda, const float *B, const int ldb, + const float beta, float *C, const int ldc); +void cblas_ssymm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const int M, const int N, + const float alpha, const float *A, const int lda, + const float *B, const int ldb, const float beta, + float *C, const int ldc); +void cblas_ssyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE Trans, const int N, const int K, + const float alpha, const float *A, const int lda, + const float beta, float *C, const int ldc); +void cblas_ssyr2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE Trans, const int N, const int K, + const float alpha, const float *A, const int lda, + const float *B, const int ldb, const float beta, + float *C, const int ldc); +void cblas_strmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_DIAG Diag, const int M, const int N, + const float alpha, const float *A, const int lda, + float *B, const int ldb); +void cblas_strsm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_DIAG Diag, const int M, const int N, + const float alpha, const float *A, const int lda, + float *B, const int ldb); + +void cblas_dgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_TRANSPOSE TransB, const int M, const int N, + const int K, const double alpha, const double *A, + const int lda, const double *B, const int ldb, + const double beta, double *C, const int ldc); +void cblas_dsymm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const int M, const int N, + const double alpha, const double *A, const int lda, + const double *B, const int ldb, const double beta, + double *C, const int ldc); +void cblas_dsyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE Trans, const int N, const int K, + const double alpha, const double *A, const int lda, + const double beta, double *C, const int ldc); +void cblas_dsyr2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE Trans, const int N, const int K, + const double alpha, const double *A, const int lda, + const double *B, const int ldb, const double beta, + double *C, const int ldc); +void cblas_dtrmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_DIAG Diag, const int M, const int N, + const double alpha, const double *A, const int lda, + double *B, const int ldb); +void cblas_dtrsm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_DIAG Diag, const int M, const int N, + const double alpha, const double *A, const int lda, + double *B, const int ldb); + +void cblas_cgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_TRANSPOSE TransB, const int M, const int N, + const int K, const void *alpha, const void *A, + const int lda, const void *B, const int ldb, + const void *beta, void *C, const int ldc); +void cblas_csymm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const int M, const int N, + const void *alpha, const void *A, const int lda, + const void *B, const int ldb, const void *beta, + void *C, const int ldc); +void cblas_csyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE Trans, const int N, const int K, + const void *alpha, const void *A, const int lda, + const void *beta, void *C, const int ldc); +void cblas_csyr2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE Trans, const int N, const int K, + const void *alpha, const void *A, const int lda, + const void *B, const int ldb, const void *beta, + void *C, const int ldc); +void cblas_ctrmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_DIAG Diag, const int M, const int N, + const void *alpha, const void *A, const int lda, + void *B, const int ldb); +void cblas_ctrsm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_DIAG Diag, const int M, const int N, + const void *alpha, const void *A, const int lda, + void *B, const int ldb); + +void cblas_zgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_TRANSPOSE TransB, const int M, const int N, + const int K, const void *alpha, const void *A, + const int lda, const void *B, const int ldb, + const void *beta, void *C, const int ldc); +void cblas_zsymm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const int M, const int N, + const void *alpha, const void *A, const int lda, + const void *B, const int ldb, const void *beta, + void *C, const int ldc); +void cblas_zsyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE Trans, const int N, const int K, + const void *alpha, const void *A, const int lda, + const void *beta, void *C, const int ldc); +void cblas_zsyr2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE Trans, const int N, const int K, + const void *alpha, const void *A, const int lda, + const void *B, const int ldb, const void *beta, + void *C, const int ldc); +void cblas_ztrmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_DIAG Diag, const int M, const int N, + const void *alpha, const void *A, const int lda, + void *B, const int ldb); +void cblas_ztrsm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_DIAG Diag, const int M, const int N, + const void *alpha, const void *A, const int lda, + void *B, const int ldb); + + +/* + * Routines with prefixes C and Z only + */ +void cblas_chemm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const int M, const int N, + const void *alpha, const void *A, const int lda, + const void *B, const int ldb, const void *beta, + void *C, const int ldc); +void cblas_cherk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE Trans, const int N, const int K, + const float alpha, const void *A, const int lda, + const float beta, void *C, const int ldc); +void cblas_cher2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE Trans, const int N, const int K, + const void *alpha, const void *A, const int lda, + const void *B, const int ldb, const float beta, + void *C, const int ldc); + +void cblas_zhemm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const int M, const int N, + const void *alpha, const void *A, const int lda, + const void *B, const int ldb, const void *beta, + void *C, const int ldc); +void cblas_zherk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE Trans, const int N, const int K, + const double alpha, const void *A, const int lda, + const double beta, void *C, const int ldc); +void cblas_zher2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE Trans, const int N, const int K, + const void *alpha, const void *A, const int lda, + const void *B, const int ldb, const double beta, + void *C, const int ldc); + +void cblas_xerbla(int p, const char *rout, const char *form, ...); + +__END_DECLS + +#endif /* __GSL_CBLAS_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_cdf.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_cdf.h new file mode 100644 index 000000000..2bc3fed5f --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_cdf.h @@ -0,0 +1,170 @@ +/* cdf/gsl_cdf.h + * + * Copyright (C) 2002 Jason H. Stover. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: J. Stover */ + +#ifndef __GSL_CDF_H__ +#define __GSL_CDF_H__ + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_cdf_ugaussian_P (const double x); +double gsl_cdf_ugaussian_Q (const double x); + +double gsl_cdf_ugaussian_Pinv (const double P); +double gsl_cdf_ugaussian_Qinv (const double Q); + +double gsl_cdf_gaussian_P (const double x, const double sigma); +double gsl_cdf_gaussian_Q (const double x, const double sigma); + +double gsl_cdf_gaussian_Pinv (const double P, const double sigma); +double gsl_cdf_gaussian_Qinv (const double Q, const double sigma); + +double gsl_cdf_gamma_P (const double x, const double a, const double b); +double gsl_cdf_gamma_Q (const double x, const double a, const double b); + +double gsl_cdf_gamma_Pinv (const double P, const double a, const double b); +double gsl_cdf_gamma_Qinv (const double Q, const double a, const double b); + +double gsl_cdf_cauchy_P (const double x, const double a); +double gsl_cdf_cauchy_Q (const double x, const double a); + +double gsl_cdf_cauchy_Pinv (const double P, const double a); +double gsl_cdf_cauchy_Qinv (const double Q, const double a); + +double gsl_cdf_laplace_P (const double x, const double a); +double gsl_cdf_laplace_Q (const double x, const double a); + +double gsl_cdf_laplace_Pinv (const double P, const double a); +double gsl_cdf_laplace_Qinv (const double Q, const double a); + +double gsl_cdf_rayleigh_P (const double x, const double sigma); +double gsl_cdf_rayleigh_Q (const double x, const double sigma); + +double gsl_cdf_rayleigh_Pinv (const double P, const double sigma); +double gsl_cdf_rayleigh_Qinv (const double Q, const double sigma); + +double gsl_cdf_chisq_P (const double x, const double nu); +double gsl_cdf_chisq_Q (const double x, const double nu); + +double gsl_cdf_chisq_Pinv (const double P, const double nu); +double gsl_cdf_chisq_Qinv (const double Q, const double nu); + +double gsl_cdf_exponential_P (const double x, const double mu); +double gsl_cdf_exponential_Q (const double x, const double mu); + +double gsl_cdf_exponential_Pinv (const double P, const double mu); +double gsl_cdf_exponential_Qinv (const double Q, const double mu); + +double gsl_cdf_exppow_P (const double x, const double a, const double b); +double gsl_cdf_exppow_Q (const double x, const double a, const double b); + +double gsl_cdf_tdist_P (const double x, const double nu); +double gsl_cdf_tdist_Q (const double x, const double nu); + +double gsl_cdf_tdist_Pinv (const double P, const double nu); +double gsl_cdf_tdist_Qinv (const double Q, const double nu); + +double gsl_cdf_fdist_P (const double x, const double nu1, const double nu2); +double gsl_cdf_fdist_Q (const double x, const double nu1, const double nu2); + +double gsl_cdf_fdist_Pinv (const double P, const double nu1, const double nu2); +double gsl_cdf_fdist_Qinv (const double Q, const double nu1, const double nu2); + +double gsl_cdf_beta_P (const double x, const double a, const double b); +double gsl_cdf_beta_Q (const double x, const double a, const double b); + +double gsl_cdf_beta_Pinv (const double P, const double a, const double b); +double gsl_cdf_beta_Qinv (const double Q, const double a, const double b); + +double gsl_cdf_flat_P (const double x, const double a, const double b); +double gsl_cdf_flat_Q (const double x, const double a, const double b); + +double gsl_cdf_flat_Pinv (const double P, const double a, const double b); +double gsl_cdf_flat_Qinv (const double Q, const double a, const double b); + +double gsl_cdf_lognormal_P (const double x, const double zeta, const double sigma); +double gsl_cdf_lognormal_Q (const double x, const double zeta, const double sigma); + +double gsl_cdf_lognormal_Pinv (const double P, const double zeta, const double sigma); +double gsl_cdf_lognormal_Qinv (const double Q, const double zeta, const double sigma); + +double gsl_cdf_gumbel1_P (const double x, const double a, const double b); +double gsl_cdf_gumbel1_Q (const double x, const double a, const double b); + +double gsl_cdf_gumbel1_Pinv (const double P, const double a, const double b); +double gsl_cdf_gumbel1_Qinv (const double Q, const double a, const double b); + +double gsl_cdf_gumbel2_P (const double x, const double a, const double b); +double gsl_cdf_gumbel2_Q (const double x, const double a, const double b); + +double gsl_cdf_gumbel2_Pinv (const double P, const double a, const double b); +double gsl_cdf_gumbel2_Qinv (const double Q, const double a, const double b); + +double gsl_cdf_weibull_P (const double x, const double a, const double b); +double gsl_cdf_weibull_Q (const double x, const double a, const double b); + +double gsl_cdf_weibull_Pinv (const double P, const double a, const double b); +double gsl_cdf_weibull_Qinv (const double Q, const double a, const double b); + +double gsl_cdf_pareto_P (const double x, const double a, const double b); +double gsl_cdf_pareto_Q (const double x, const double a, const double b); + +double gsl_cdf_pareto_Pinv (const double P, const double a, const double b); +double gsl_cdf_pareto_Qinv (const double Q, const double a, const double b); + +double gsl_cdf_logistic_P (const double x, const double a); +double gsl_cdf_logistic_Q (const double x, const double a); + +double gsl_cdf_logistic_Pinv (const double P, const double a); +double gsl_cdf_logistic_Qinv (const double Q, const double a); + +double gsl_cdf_binomial_P (const unsigned int k, const double p, const unsigned int n); +double gsl_cdf_binomial_Q (const unsigned int k, const double p, const unsigned int n); + +double gsl_cdf_poisson_P (const unsigned int k, const double mu); +double gsl_cdf_poisson_Q (const unsigned int k, const double mu); + +double gsl_cdf_geometric_P (const unsigned int k, const double p); +double gsl_cdf_geometric_Q (const unsigned int k, const double p); + +double gsl_cdf_negative_binomial_P (const unsigned int k, const double p, const double n); +double gsl_cdf_negative_binomial_Q (const unsigned int k, const double p, const double n); + +double gsl_cdf_pascal_P (const unsigned int k, const double p, const unsigned int n); +double gsl_cdf_pascal_Q (const unsigned int k, const double p, const unsigned int n); + +double gsl_cdf_hypergeometric_P (const unsigned int k, const unsigned int n1, + const unsigned int n2, const unsigned int t); +double gsl_cdf_hypergeometric_Q (const unsigned int k, const unsigned int n1, + const unsigned int n2, const unsigned int t); + +__END_DECLS + +#endif /* __GSL_CDF_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_chebyshev.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_chebyshev.h new file mode 100644 index 000000000..858048e40 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_chebyshev.h @@ -0,0 +1,133 @@ +/* cheb/gsl_chebyshev.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_CHEBYSHEV_H__ +#define __GSL_CHEBYSHEV_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* data for a Chebyshev series over a given interval */ + +struct gsl_cheb_series_struct { + + double * c; /* coefficients */ + size_t order; /* order of expansion */ + double a; /* lower interval point */ + double b; /* upper interval point */ + + /* The following exists (mostly) for the benefit + * of the implementation. It is an effective single + * precision order, for use in single precision + * evaluation. Users can use it if they like, but + * only they know how to calculate it, since it is + * specific to the approximated function. By default, + * order_sp = order. + * It is used explicitly only by the gsl_cheb_eval_mode + * functions, which are not meant for casual use. + */ + size_t order_sp; + + /* Additional elements not used by specfunc */ + + double * f; /* function evaluated at chebyschev points */ +}; +typedef struct gsl_cheb_series_struct gsl_cheb_series; + + +/* Calculate a Chebyshev series of specified order over + * a specified interval, for a given function. + * Return 0 on failure. + */ +gsl_cheb_series * gsl_cheb_alloc(const size_t order); + +/* Free a Chebyshev series previously calculated with gsl_cheb_alloc(). + */ +void gsl_cheb_free(gsl_cheb_series * cs); + +/* Calculate a Chebyshev series using the storage provided. + * Uses the interval (a,b) and the order with which it + * was initially created. + * + */ +int gsl_cheb_init(gsl_cheb_series * cs, const gsl_function * func, + const double a, const double b); + +/* Return the order, size of coefficient array and coefficient array ptr */ +size_t gsl_cheb_order (const gsl_cheb_series * cs); +size_t gsl_cheb_size (const gsl_cheb_series * cs); +double *gsl_cheb_coeffs (const gsl_cheb_series * cs); + +/* Evaluate a Chebyshev series at a given point. + * No errors can occur for a struct obtained from gsl_cheb_new(). + */ +double gsl_cheb_eval(const gsl_cheb_series * cs, const double x); +int gsl_cheb_eval_err(const gsl_cheb_series * cs, const double x, + double * result, double * abserr); + + +/* Evaluate a Chebyshev series at a given point, to (at most) the given order. + * No errors can occur for a struct obtained from gsl_cheb_new(). + */ +double gsl_cheb_eval_n(const gsl_cheb_series * cs, const size_t order, + const double x); +int gsl_cheb_eval_n_err(const gsl_cheb_series * cs, const size_t order, + const double x, double * result, double * abserr); + + +/* Evaluate a Chebyshev series at a given point, using the default + * order for double precision mode(s) and the single precision + * order for other modes. + * No errors can occur for a struct obtained from gsl_cheb_new(). + */ +double gsl_cheb_eval_mode(const gsl_cheb_series * cs, const double x, gsl_mode_t mode); +int gsl_cheb_eval_mode_e(const gsl_cheb_series * cs, const double x, gsl_mode_t mode, double * result, double * abserr); + + + +/* Compute the derivative of a Chebyshev series. + */ +int gsl_cheb_calc_deriv(gsl_cheb_series * deriv, const gsl_cheb_series * cs); + +/* Compute the integral of a Chebyshev series. The + * integral is fixed by the condition that it equals zero at + * the left end-point, ie it is precisely + * Integrate[cs(t; a,b), {t, a, x}] + */ +int gsl_cheb_calc_integ(gsl_cheb_series * integ, const gsl_cheb_series * cs); + + + + +__END_DECLS + +#endif /* __GSL_CHEBYSHEV_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_check_range.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_check_range.h new file mode 100644 index 000000000..d110b6b89 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_check_range.h @@ -0,0 +1,57 @@ +/* vector/gsl_check_range.h + * + * Copyright (C) 2003, 2004, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_CHECK_RANGE_H__ +#define __GSL_CHECK_RANGE_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +GSL_VAR int gsl_check_range; + +/* Turn range checking on by default, unless the user defines + GSL_RANGE_CHECK_OFF, or defines GSL_RANGE_CHECK to 0 explicitly */ + +#ifdef GSL_RANGE_CHECK_OFF +# ifndef GSL_RANGE_CHECK +# define GSL_RANGE_CHECK 0 +# else +# error "cannot set both GSL_RANGE_CHECK and GSL_RANGE_CHECK_OFF" +# endif +#else +# ifndef GSL_RANGE_CHECK +# define GSL_RANGE_CHECK 1 +# endif +#endif + +__END_DECLS + +#endif /* __GSL_CHECK_RANGE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_combination.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_combination.h new file mode 100644 index 000000000..69de7cf19 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_combination.h @@ -0,0 +1,92 @@ +/* combination/gsl_combination.h + * based on permutation/gsl_permutation.h by Brian Gough + * + * Copyright (C) 2001 Szymon Jaroszewicz + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_COMBINATION_H__ +#define __GSL_COMBINATION_H__ + +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_combination_struct +{ + size_t n; + size_t k; + size_t *data; +}; + +typedef struct gsl_combination_struct gsl_combination; + +gsl_combination *gsl_combination_alloc (const size_t n, const size_t k); +gsl_combination *gsl_combination_calloc (const size_t n, const size_t k); +void gsl_combination_init_first (gsl_combination * c); +void gsl_combination_init_last (gsl_combination * c); +void gsl_combination_free (gsl_combination * c); +int gsl_combination_memcpy (gsl_combination * dest, const gsl_combination * src); + +int gsl_combination_fread (FILE * stream, gsl_combination * c); +int gsl_combination_fwrite (FILE * stream, const gsl_combination * c); +int gsl_combination_fscanf (FILE * stream, gsl_combination * c); +int gsl_combination_fprintf (FILE * stream, const gsl_combination * c, const char *format); + +size_t gsl_combination_n (const gsl_combination * c); +size_t gsl_combination_k (const gsl_combination * c); +size_t * gsl_combination_data (const gsl_combination * c); + +int gsl_combination_valid (gsl_combination * c); +int gsl_combination_next (gsl_combination * c); +int gsl_combination_prev (gsl_combination * c); + +INLINE_DECL size_t gsl_combination_get (const gsl_combination * c, const size_t i); + +#ifdef HAVE_INLINE + +INLINE_FUN +size_t +gsl_combination_get (const gsl_combination * c, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= c->k)) /* size_t is unsigned, can't be negative */ + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return c->data[i]; +} + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_COMBINATION_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_complex.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_complex.h new file mode 100644 index 000000000..e77b77062 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_complex.h @@ -0,0 +1,103 @@ +/* complex/gsl_complex.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_COMPLEX_H__ +#define __GSL_COMPLEX_H__ + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* two consecutive built-in types as a complex number */ +typedef double * gsl_complex_packed ; +typedef float * gsl_complex_packed_float ; +typedef long double * gsl_complex_packed_long_double ; + +typedef const double * gsl_const_complex_packed ; +typedef const float * gsl_const_complex_packed_float ; +typedef const long double * gsl_const_complex_packed_long_double ; + + +/* 2N consecutive built-in types as N complex numbers */ +typedef double * gsl_complex_packed_array ; +typedef float * gsl_complex_packed_array_float ; +typedef long double * gsl_complex_packed_array_long_double ; + +typedef const double * gsl_const_complex_packed_array ; +typedef const float * gsl_const_complex_packed_array_float ; +typedef const long double * gsl_const_complex_packed_array_long_double ; + + +/* Yes... this seems weird. Trust us. The point is just that + sometimes you want to make it obvious that something is + an output value. The fact that it lacks a 'const' may not + be enough of a clue for people in some contexts. + */ +typedef double * gsl_complex_packed_ptr ; +typedef float * gsl_complex_packed_float_ptr ; +typedef long double * gsl_complex_packed_long_double_ptr ; + +typedef const double * gsl_const_complex_packed_ptr ; +typedef const float * gsl_const_complex_packed_float_ptr ; +typedef const long double * gsl_const_complex_packed_long_double_ptr ; + + +typedef struct + { + long double dat[2]; + } +gsl_complex_long_double; + +typedef struct + { + double dat[2]; + } +gsl_complex; + +typedef struct + { + float dat[2]; + } +gsl_complex_float; + +#define GSL_REAL(z) ((z).dat[0]) +#define GSL_IMAG(z) ((z).dat[1]) +#define GSL_COMPLEX_P(zp) ((zp)->dat) +#define GSL_COMPLEX_P_REAL(zp) ((zp)->dat[0]) +#define GSL_COMPLEX_P_IMAG(zp) ((zp)->dat[1]) +#define GSL_COMPLEX_EQ(z1,z2) (((z1).dat[0] == (z2).dat[0]) && ((z1).dat[1] == (z2).dat[1])) + +#define GSL_SET_COMPLEX(zp,x,y) do {(zp)->dat[0]=(x); (zp)->dat[1]=(y);} while(0) +#define GSL_SET_REAL(zp,x) do {(zp)->dat[0]=(x);} while(0) +#define GSL_SET_IMAG(zp,y) do {(zp)->dat[1]=(y);} while(0) + +#define GSL_SET_COMPLEX_PACKED(zp,n,x,y) do {*((zp)+2*(n))=(x); *((zp)+(2*(n)+1))=(y);} while(0) + +__END_DECLS + +#endif /* __GSL_COMPLEX_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_complex_math.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_complex_math.h new file mode 100644 index 000000000..ad8d076a6 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_complex_math.h @@ -0,0 +1,142 @@ +/* complex/gsl_complex_math.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 Jorma Olavi Tähtinen, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_COMPLEX_MATH_H__ +#define __GSL_COMPLEX_MATH_H__ +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS } +#else +#define __BEGIN_DECLS /* empty */ +#define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* Complex numbers */ + +gsl_complex gsl_complex_polar (double r, double theta); /* r= r e^(i theta) */ + +INLINE_DECL gsl_complex gsl_complex_rect (double x, double y); /* r= real+i*imag */ + +#ifdef HAVE_INLINE +INLINE_FUN gsl_complex +gsl_complex_rect (double x, double y) +{ /* return z = x + i y */ + gsl_complex z; + GSL_SET_COMPLEX (&z, x, y); + return z; +} +#endif + +#define GSL_COMPLEX_ONE (gsl_complex_rect(1.0,0.0)) +#define GSL_COMPLEX_ZERO (gsl_complex_rect(0.0,0.0)) +#define GSL_COMPLEX_NEGONE (gsl_complex_rect(-1.0,0.0)) + +/* Properties of complex numbers */ + +double gsl_complex_arg (gsl_complex z); /* return arg(z), -pi< arg(z) <=+pi */ +double gsl_complex_abs (gsl_complex z); /* return |z| */ +double gsl_complex_abs2 (gsl_complex z); /* return |z|^2 */ +double gsl_complex_logabs (gsl_complex z); /* return log|z| */ + +/* Complex arithmetic operators */ + +gsl_complex gsl_complex_add (gsl_complex a, gsl_complex b); /* r=a+b */ +gsl_complex gsl_complex_sub (gsl_complex a, gsl_complex b); /* r=a-b */ +gsl_complex gsl_complex_mul (gsl_complex a, gsl_complex b); /* r=a*b */ +gsl_complex gsl_complex_div (gsl_complex a, gsl_complex b); /* r=a/b */ + +gsl_complex gsl_complex_add_real (gsl_complex a, double x); /* r=a+x */ +gsl_complex gsl_complex_sub_real (gsl_complex a, double x); /* r=a-x */ +gsl_complex gsl_complex_mul_real (gsl_complex a, double x); /* r=a*x */ +gsl_complex gsl_complex_div_real (gsl_complex a, double x); /* r=a/x */ + +gsl_complex gsl_complex_add_imag (gsl_complex a, double y); /* r=a+iy */ +gsl_complex gsl_complex_sub_imag (gsl_complex a, double y); /* r=a-iy */ +gsl_complex gsl_complex_mul_imag (gsl_complex a, double y); /* r=a*iy */ +gsl_complex gsl_complex_div_imag (gsl_complex a, double y); /* r=a/iy */ + +gsl_complex gsl_complex_conjugate (gsl_complex z); /* r=conj(z) */ +gsl_complex gsl_complex_inverse (gsl_complex a); /* r=1/a */ +gsl_complex gsl_complex_negative (gsl_complex a); /* r=-a */ + +/* Elementary Complex Functions */ + +gsl_complex gsl_complex_sqrt (gsl_complex z); /* r=sqrt(z) */ +gsl_complex gsl_complex_sqrt_real (double x); /* r=sqrt(x) (x<0 ok) */ + +gsl_complex gsl_complex_pow (gsl_complex a, gsl_complex b); /* r=a^b */ +gsl_complex gsl_complex_pow_real (gsl_complex a, double b); /* r=a^b */ + +gsl_complex gsl_complex_exp (gsl_complex a); /* r=exp(a) */ +gsl_complex gsl_complex_log (gsl_complex a); /* r=log(a) (base e) */ +gsl_complex gsl_complex_log10 (gsl_complex a); /* r=log10(a) (base 10) */ +gsl_complex gsl_complex_log_b (gsl_complex a, gsl_complex b); /* r=log_b(a) (base=b) */ + +/* Complex Trigonometric Functions */ + +gsl_complex gsl_complex_sin (gsl_complex a); /* r=sin(a) */ +gsl_complex gsl_complex_cos (gsl_complex a); /* r=cos(a) */ +gsl_complex gsl_complex_sec (gsl_complex a); /* r=sec(a) */ +gsl_complex gsl_complex_csc (gsl_complex a); /* r=csc(a) */ +gsl_complex gsl_complex_tan (gsl_complex a); /* r=tan(a) */ +gsl_complex gsl_complex_cot (gsl_complex a); /* r=cot(a) */ + +/* Inverse Complex Trigonometric Functions */ + +gsl_complex gsl_complex_arcsin (gsl_complex a); /* r=arcsin(a) */ +gsl_complex gsl_complex_arcsin_real (double a); /* r=arcsin(a) */ +gsl_complex gsl_complex_arccos (gsl_complex a); /* r=arccos(a) */ +gsl_complex gsl_complex_arccos_real (double a); /* r=arccos(a) */ +gsl_complex gsl_complex_arcsec (gsl_complex a); /* r=arcsec(a) */ +gsl_complex gsl_complex_arcsec_real (double a); /* r=arcsec(a) */ +gsl_complex gsl_complex_arccsc (gsl_complex a); /* r=arccsc(a) */ +gsl_complex gsl_complex_arccsc_real (double a); /* r=arccsc(a) */ +gsl_complex gsl_complex_arctan (gsl_complex a); /* r=arctan(a) */ +gsl_complex gsl_complex_arccot (gsl_complex a); /* r=arccot(a) */ + +/* Complex Hyperbolic Functions */ + +gsl_complex gsl_complex_sinh (gsl_complex a); /* r=sinh(a) */ +gsl_complex gsl_complex_cosh (gsl_complex a); /* r=coshh(a) */ +gsl_complex gsl_complex_sech (gsl_complex a); /* r=sech(a) */ +gsl_complex gsl_complex_csch (gsl_complex a); /* r=csch(a) */ +gsl_complex gsl_complex_tanh (gsl_complex a); /* r=tanh(a) */ +gsl_complex gsl_complex_coth (gsl_complex a); /* r=coth(a) */ + +/* Inverse Complex Hyperbolic Functions */ + +gsl_complex gsl_complex_arcsinh (gsl_complex a); /* r=arcsinh(a) */ +gsl_complex gsl_complex_arccosh (gsl_complex a); /* r=arccosh(a) */ +gsl_complex gsl_complex_arccosh_real (double a); /* r=arccosh(a) */ +gsl_complex gsl_complex_arcsech (gsl_complex a); /* r=arcsech(a) */ +gsl_complex gsl_complex_arccsch (gsl_complex a); /* r=arccsch(a) */ +gsl_complex gsl_complex_arctanh (gsl_complex a); /* r=arctanh(a) */ +gsl_complex gsl_complex_arctanh_real (double a); /* r=arctanh(a) */ +gsl_complex gsl_complex_arccoth (gsl_complex a); /* r=arccoth(a) */ + +__END_DECLS + +#endif /* __GSL_COMPLEX_MATH_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_const.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_const.h new file mode 100644 index 000000000..5d749dc5e --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_const.h @@ -0,0 +1,31 @@ +/* const/gsl_const.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_CONST__ +#define __GSL_CONST__ + +#include + +#include +#include + +#include +#include + +#endif /* __GSL_CONST__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_cgs.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_cgs.h new file mode 100644 index 000000000..ab95b7b08 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_cgs.h @@ -0,0 +1,116 @@ +/* const/gsl_const_cgs.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + * 2006, 2007, 2008, 2009 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_CONST_CGS__ +#define __GSL_CONST_CGS__ + +#define GSL_CONST_CGS_SPEED_OF_LIGHT (2.99792458e10) /* cm / s */ +#define GSL_CONST_CGS_GRAVITATIONAL_CONSTANT (6.673e-8) /* cm^3 / g s^2 */ +#define GSL_CONST_CGS_PLANCKS_CONSTANT_H (6.62606896e-27) /* g cm^2 / s */ +#define GSL_CONST_CGS_PLANCKS_CONSTANT_HBAR (1.05457162825e-27) /* g cm^2 / s */ +#define GSL_CONST_CGS_ASTRONOMICAL_UNIT (1.49597870691e13) /* cm */ +#define GSL_CONST_CGS_LIGHT_YEAR (9.46053620707e17) /* cm */ +#define GSL_CONST_CGS_PARSEC (3.08567758135e18) /* cm */ +#define GSL_CONST_CGS_GRAV_ACCEL (9.80665e2) /* cm / s^2 */ +#define GSL_CONST_CGS_ELECTRON_VOLT (1.602176487e-12) /* g cm^2 / s^2 */ +#define GSL_CONST_CGS_MASS_ELECTRON (9.10938188e-28) /* g */ +#define GSL_CONST_CGS_MASS_MUON (1.88353109e-25) /* g */ +#define GSL_CONST_CGS_MASS_PROTON (1.67262158e-24) /* g */ +#define GSL_CONST_CGS_MASS_NEUTRON (1.67492716e-24) /* g */ +#define GSL_CONST_CGS_RYDBERG (2.17987196968e-11) /* g cm^2 / s^2 */ +#define GSL_CONST_CGS_BOLTZMANN (1.3806504e-16) /* g cm^2 / K s^2 */ +#define GSL_CONST_CGS_MOLAR_GAS (8.314472e7) /* g cm^2 / K mol s^2 */ +#define GSL_CONST_CGS_STANDARD_GAS_VOLUME (2.2710981e4) /* cm^3 / mol */ +#define GSL_CONST_CGS_MINUTE (6e1) /* s */ +#define GSL_CONST_CGS_HOUR (3.6e3) /* s */ +#define GSL_CONST_CGS_DAY (8.64e4) /* s */ +#define GSL_CONST_CGS_WEEK (6.048e5) /* s */ +#define GSL_CONST_CGS_INCH (2.54e0) /* cm */ +#define GSL_CONST_CGS_FOOT (3.048e1) /* cm */ +#define GSL_CONST_CGS_YARD (9.144e1) /* cm */ +#define GSL_CONST_CGS_MILE (1.609344e5) /* cm */ +#define GSL_CONST_CGS_NAUTICAL_MILE (1.852e5) /* cm */ +#define GSL_CONST_CGS_FATHOM (1.8288e2) /* cm */ +#define GSL_CONST_CGS_MIL (2.54e-3) /* cm */ +#define GSL_CONST_CGS_POINT (3.52777777778e-2) /* cm */ +#define GSL_CONST_CGS_TEXPOINT (3.51459803515e-2) /* cm */ +#define GSL_CONST_CGS_MICRON (1e-4) /* cm */ +#define GSL_CONST_CGS_ANGSTROM (1e-8) /* cm */ +#define GSL_CONST_CGS_HECTARE (1e8) /* cm^2 */ +#define GSL_CONST_CGS_ACRE (4.04685642241e7) /* cm^2 */ +#define GSL_CONST_CGS_BARN (1e-24) /* cm^2 */ +#define GSL_CONST_CGS_LITER (1e3) /* cm^3 */ +#define GSL_CONST_CGS_US_GALLON (3.78541178402e3) /* cm^3 */ +#define GSL_CONST_CGS_QUART (9.46352946004e2) /* cm^3 */ +#define GSL_CONST_CGS_PINT (4.73176473002e2) /* cm^3 */ +#define GSL_CONST_CGS_CUP (2.36588236501e2) /* cm^3 */ +#define GSL_CONST_CGS_FLUID_OUNCE (2.95735295626e1) /* cm^3 */ +#define GSL_CONST_CGS_TABLESPOON (1.47867647813e1) /* cm^3 */ +#define GSL_CONST_CGS_TEASPOON (4.92892159375e0) /* cm^3 */ +#define GSL_CONST_CGS_CANADIAN_GALLON (4.54609e3) /* cm^3 */ +#define GSL_CONST_CGS_UK_GALLON (4.546092e3) /* cm^3 */ +#define GSL_CONST_CGS_MILES_PER_HOUR (4.4704e1) /* cm / s */ +#define GSL_CONST_CGS_KILOMETERS_PER_HOUR (2.77777777778e1) /* cm / s */ +#define GSL_CONST_CGS_KNOT (5.14444444444e1) /* cm / s */ +#define GSL_CONST_CGS_POUND_MASS (4.5359237e2) /* g */ +#define GSL_CONST_CGS_OUNCE_MASS (2.8349523125e1) /* g */ +#define GSL_CONST_CGS_TON (9.0718474e5) /* g */ +#define GSL_CONST_CGS_METRIC_TON (1e6) /* g */ +#define GSL_CONST_CGS_UK_TON (1.0160469088e6) /* g */ +#define GSL_CONST_CGS_TROY_OUNCE (3.1103475e1) /* g */ +#define GSL_CONST_CGS_CARAT (2e-1) /* g */ +#define GSL_CONST_CGS_UNIFIED_ATOMIC_MASS (1.660538782e-24) /* g */ +#define GSL_CONST_CGS_GRAM_FORCE (9.80665e2) /* cm g / s^2 */ +#define GSL_CONST_CGS_POUND_FORCE (4.44822161526e5) /* cm g / s^2 */ +#define GSL_CONST_CGS_KILOPOUND_FORCE (4.44822161526e8) /* cm g / s^2 */ +#define GSL_CONST_CGS_POUNDAL (1.38255e4) /* cm g / s^2 */ +#define GSL_CONST_CGS_CALORIE (4.1868e7) /* g cm^2 / s^2 */ +#define GSL_CONST_CGS_BTU (1.05505585262e10) /* g cm^2 / s^2 */ +#define GSL_CONST_CGS_THERM (1.05506e15) /* g cm^2 / s^2 */ +#define GSL_CONST_CGS_HORSEPOWER (7.457e9) /* g cm^2 / s^3 */ +#define GSL_CONST_CGS_BAR (1e6) /* g / cm s^2 */ +#define GSL_CONST_CGS_STD_ATMOSPHERE (1.01325e6) /* g / cm s^2 */ +#define GSL_CONST_CGS_TORR (1.33322368421e3) /* g / cm s^2 */ +#define GSL_CONST_CGS_METER_OF_MERCURY (1.33322368421e6) /* g / cm s^2 */ +#define GSL_CONST_CGS_INCH_OF_MERCURY (3.38638815789e4) /* g / cm s^2 */ +#define GSL_CONST_CGS_INCH_OF_WATER (2.490889e3) /* g / cm s^2 */ +#define GSL_CONST_CGS_PSI (6.89475729317e4) /* g / cm s^2 */ +#define GSL_CONST_CGS_POISE (1e0) /* g / cm s */ +#define GSL_CONST_CGS_STOKES (1e0) /* cm^2 / s */ +#define GSL_CONST_CGS_STILB (1e0) /* cd / cm^2 */ +#define GSL_CONST_CGS_LUMEN (1e0) /* cd sr */ +#define GSL_CONST_CGS_LUX (1e-4) /* cd sr / cm^2 */ +#define GSL_CONST_CGS_PHOT (1e0) /* cd sr / cm^2 */ +#define GSL_CONST_CGS_FOOTCANDLE (1.076e-3) /* cd sr / cm^2 */ +#define GSL_CONST_CGS_LAMBERT (1e0) /* cd sr / cm^2 */ +#define GSL_CONST_CGS_FOOTLAMBERT (1.07639104e-3) /* cd sr / cm^2 */ +#define GSL_CONST_CGS_CURIE (3.7e10) /* 1 / s */ +#define GSL_CONST_CGS_ROENTGEN (2.58e-7) /* A s / g */ +#define GSL_CONST_CGS_RAD (1e2) /* cm^2 / s^2 */ +#define GSL_CONST_CGS_SOLAR_MASS (1.98892e33) /* g */ +#define GSL_CONST_CGS_BOHR_RADIUS (5.291772083e-9) /* cm */ +#define GSL_CONST_CGS_NEWTON (1e5) /* cm g / s^2 */ +#define GSL_CONST_CGS_DYNE (1e0) /* cm g / s^2 */ +#define GSL_CONST_CGS_JOULE (1e7) /* g cm^2 / s^2 */ +#define GSL_CONST_CGS_ERG (1e0) /* g cm^2 / s^2 */ +#define GSL_CONST_CGS_STEFAN_BOLTZMANN_CONSTANT (5.67040047374e-5) /* g / K^4 s^3 */ +#define GSL_CONST_CGS_THOMSON_CROSS_SECTION (6.65245893699e-25) /* cm^2 */ + +#endif /* __GSL_CONST_CGS__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_cgsm.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_cgsm.h new file mode 100644 index 000000000..2047e5edd --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_cgsm.h @@ -0,0 +1,122 @@ +/* const/gsl_const_cgsm.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + * 2006, 2007, 2008, 2009 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_CONST_CGSM__ +#define __GSL_CONST_CGSM__ + +#define GSL_CONST_CGSM_SPEED_OF_LIGHT (2.99792458e10) /* cm / s */ +#define GSL_CONST_CGSM_GRAVITATIONAL_CONSTANT (6.673e-8) /* cm^3 / g s^2 */ +#define GSL_CONST_CGSM_PLANCKS_CONSTANT_H (6.62606896e-27) /* g cm^2 / s */ +#define GSL_CONST_CGSM_PLANCKS_CONSTANT_HBAR (1.05457162825e-27) /* g cm^2 / s */ +#define GSL_CONST_CGSM_ASTRONOMICAL_UNIT (1.49597870691e13) /* cm */ +#define GSL_CONST_CGSM_LIGHT_YEAR (9.46053620707e17) /* cm */ +#define GSL_CONST_CGSM_PARSEC (3.08567758135e18) /* cm */ +#define GSL_CONST_CGSM_GRAV_ACCEL (9.80665e2) /* cm / s^2 */ +#define GSL_CONST_CGSM_ELECTRON_VOLT (1.602176487e-12) /* g cm^2 / s^2 */ +#define GSL_CONST_CGSM_MASS_ELECTRON (9.10938188e-28) /* g */ +#define GSL_CONST_CGSM_MASS_MUON (1.88353109e-25) /* g */ +#define GSL_CONST_CGSM_MASS_PROTON (1.67262158e-24) /* g */ +#define GSL_CONST_CGSM_MASS_NEUTRON (1.67492716e-24) /* g */ +#define GSL_CONST_CGSM_RYDBERG (2.17987196968e-11) /* g cm^2 / s^2 */ +#define GSL_CONST_CGSM_BOLTZMANN (1.3806504e-16) /* g cm^2 / K s^2 */ +#define GSL_CONST_CGSM_MOLAR_GAS (8.314472e7) /* g cm^2 / K mol s^2 */ +#define GSL_CONST_CGSM_STANDARD_GAS_VOLUME (2.2710981e4) /* cm^3 / mol */ +#define GSL_CONST_CGSM_MINUTE (6e1) /* s */ +#define GSL_CONST_CGSM_HOUR (3.6e3) /* s */ +#define GSL_CONST_CGSM_DAY (8.64e4) /* s */ +#define GSL_CONST_CGSM_WEEK (6.048e5) /* s */ +#define GSL_CONST_CGSM_INCH (2.54e0) /* cm */ +#define GSL_CONST_CGSM_FOOT (3.048e1) /* cm */ +#define GSL_CONST_CGSM_YARD (9.144e1) /* cm */ +#define GSL_CONST_CGSM_MILE (1.609344e5) /* cm */ +#define GSL_CONST_CGSM_NAUTICAL_MILE (1.852e5) /* cm */ +#define GSL_CONST_CGSM_FATHOM (1.8288e2) /* cm */ +#define GSL_CONST_CGSM_MIL (2.54e-3) /* cm */ +#define GSL_CONST_CGSM_POINT (3.52777777778e-2) /* cm */ +#define GSL_CONST_CGSM_TEXPOINT (3.51459803515e-2) /* cm */ +#define GSL_CONST_CGSM_MICRON (1e-4) /* cm */ +#define GSL_CONST_CGSM_ANGSTROM (1e-8) /* cm */ +#define GSL_CONST_CGSM_HECTARE (1e8) /* cm^2 */ +#define GSL_CONST_CGSM_ACRE (4.04685642241e7) /* cm^2 */ +#define GSL_CONST_CGSM_BARN (1e-24) /* cm^2 */ +#define GSL_CONST_CGSM_LITER (1e3) /* cm^3 */ +#define GSL_CONST_CGSM_US_GALLON (3.78541178402e3) /* cm^3 */ +#define GSL_CONST_CGSM_QUART (9.46352946004e2) /* cm^3 */ +#define GSL_CONST_CGSM_PINT (4.73176473002e2) /* cm^3 */ +#define GSL_CONST_CGSM_CUP (2.36588236501e2) /* cm^3 */ +#define GSL_CONST_CGSM_FLUID_OUNCE (2.95735295626e1) /* cm^3 */ +#define GSL_CONST_CGSM_TABLESPOON (1.47867647813e1) /* cm^3 */ +#define GSL_CONST_CGSM_TEASPOON (4.92892159375e0) /* cm^3 */ +#define GSL_CONST_CGSM_CANADIAN_GALLON (4.54609e3) /* cm^3 */ +#define GSL_CONST_CGSM_UK_GALLON (4.546092e3) /* cm^3 */ +#define GSL_CONST_CGSM_MILES_PER_HOUR (4.4704e1) /* cm / s */ +#define GSL_CONST_CGSM_KILOMETERS_PER_HOUR (2.77777777778e1) /* cm / s */ +#define GSL_CONST_CGSM_KNOT (5.14444444444e1) /* cm / s */ +#define GSL_CONST_CGSM_POUND_MASS (4.5359237e2) /* g */ +#define GSL_CONST_CGSM_OUNCE_MASS (2.8349523125e1) /* g */ +#define GSL_CONST_CGSM_TON (9.0718474e5) /* g */ +#define GSL_CONST_CGSM_METRIC_TON (1e6) /* g */ +#define GSL_CONST_CGSM_UK_TON (1.0160469088e6) /* g */ +#define GSL_CONST_CGSM_TROY_OUNCE (3.1103475e1) /* g */ +#define GSL_CONST_CGSM_CARAT (2e-1) /* g */ +#define GSL_CONST_CGSM_UNIFIED_ATOMIC_MASS (1.660538782e-24) /* g */ +#define GSL_CONST_CGSM_GRAM_FORCE (9.80665e2) /* cm g / s^2 */ +#define GSL_CONST_CGSM_POUND_FORCE (4.44822161526e5) /* cm g / s^2 */ +#define GSL_CONST_CGSM_KILOPOUND_FORCE (4.44822161526e8) /* cm g / s^2 */ +#define GSL_CONST_CGSM_POUNDAL (1.38255e4) /* cm g / s^2 */ +#define GSL_CONST_CGSM_CALORIE (4.1868e7) /* g cm^2 / s^2 */ +#define GSL_CONST_CGSM_BTU (1.05505585262e10) /* g cm^2 / s^2 */ +#define GSL_CONST_CGSM_THERM (1.05506e15) /* g cm^2 / s^2 */ +#define GSL_CONST_CGSM_HORSEPOWER (7.457e9) /* g cm^2 / s^3 */ +#define GSL_CONST_CGSM_BAR (1e6) /* g / cm s^2 */ +#define GSL_CONST_CGSM_STD_ATMOSPHERE (1.01325e6) /* g / cm s^2 */ +#define GSL_CONST_CGSM_TORR (1.33322368421e3) /* g / cm s^2 */ +#define GSL_CONST_CGSM_METER_OF_MERCURY (1.33322368421e6) /* g / cm s^2 */ +#define GSL_CONST_CGSM_INCH_OF_MERCURY (3.38638815789e4) /* g / cm s^2 */ +#define GSL_CONST_CGSM_INCH_OF_WATER (2.490889e3) /* g / cm s^2 */ +#define GSL_CONST_CGSM_PSI (6.89475729317e4) /* g / cm s^2 */ +#define GSL_CONST_CGSM_POISE (1e0) /* g / cm s */ +#define GSL_CONST_CGSM_STOKES (1e0) /* cm^2 / s */ +#define GSL_CONST_CGSM_STILB (1e0) /* cd / cm^2 */ +#define GSL_CONST_CGSM_LUMEN (1e0) /* cd sr */ +#define GSL_CONST_CGSM_LUX (1e-4) /* cd sr / cm^2 */ +#define GSL_CONST_CGSM_PHOT (1e0) /* cd sr / cm^2 */ +#define GSL_CONST_CGSM_FOOTCANDLE (1.076e-3) /* cd sr / cm^2 */ +#define GSL_CONST_CGSM_LAMBERT (1e0) /* cd sr / cm^2 */ +#define GSL_CONST_CGSM_FOOTLAMBERT (1.07639104e-3) /* cd sr / cm^2 */ +#define GSL_CONST_CGSM_CURIE (3.7e10) /* 1 / s */ +#define GSL_CONST_CGSM_ROENTGEN (2.58e-8) /* abamp s / g */ +#define GSL_CONST_CGSM_RAD (1e2) /* cm^2 / s^2 */ +#define GSL_CONST_CGSM_SOLAR_MASS (1.98892e33) /* g */ +#define GSL_CONST_CGSM_BOHR_RADIUS (5.291772083e-9) /* cm */ +#define GSL_CONST_CGSM_NEWTON (1e5) /* cm g / s^2 */ +#define GSL_CONST_CGSM_DYNE (1e0) /* cm g / s^2 */ +#define GSL_CONST_CGSM_JOULE (1e7) /* g cm^2 / s^2 */ +#define GSL_CONST_CGSM_ERG (1e0) /* g cm^2 / s^2 */ +#define GSL_CONST_CGSM_STEFAN_BOLTZMANN_CONSTANT (5.67040047374e-5) /* g / K^4 s^3 */ +#define GSL_CONST_CGSM_THOMSON_CROSS_SECTION (6.65245893699e-25) /* cm^2 */ +#define GSL_CONST_CGSM_BOHR_MAGNETON (9.27400899e-21) /* abamp cm^2 */ +#define GSL_CONST_CGSM_NUCLEAR_MAGNETON (5.05078317e-24) /* abamp cm^2 */ +#define GSL_CONST_CGSM_ELECTRON_MAGNETIC_MOMENT (9.28476362e-21) /* abamp cm^2 */ +#define GSL_CONST_CGSM_PROTON_MAGNETIC_MOMENT (1.410606633e-23) /* abamp cm^2 */ +#define GSL_CONST_CGSM_FARADAY (9.64853429775e3) /* abamp s / mol */ +#define GSL_CONST_CGSM_ELECTRON_CHARGE (1.602176487e-20) /* abamp s */ + +#endif /* __GSL_CONST_CGSM__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_mks.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_mks.h new file mode 100644 index 000000000..bc60e2acb --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_mks.h @@ -0,0 +1,126 @@ +/* const/gsl_const_mks.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + * 2006, 2007, 2008, 2009 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_CONST_MKS__ +#define __GSL_CONST_MKS__ + +#define GSL_CONST_MKS_SPEED_OF_LIGHT (2.99792458e8) /* m / s */ +#define GSL_CONST_MKS_GRAVITATIONAL_CONSTANT (6.673e-11) /* m^3 / kg s^2 */ +#define GSL_CONST_MKS_PLANCKS_CONSTANT_H (6.62606896e-34) /* kg m^2 / s */ +#define GSL_CONST_MKS_PLANCKS_CONSTANT_HBAR (1.05457162825e-34) /* kg m^2 / s */ +#define GSL_CONST_MKS_ASTRONOMICAL_UNIT (1.49597870691e11) /* m */ +#define GSL_CONST_MKS_LIGHT_YEAR (9.46053620707e15) /* m */ +#define GSL_CONST_MKS_PARSEC (3.08567758135e16) /* m */ +#define GSL_CONST_MKS_GRAV_ACCEL (9.80665e0) /* m / s^2 */ +#define GSL_CONST_MKS_ELECTRON_VOLT (1.602176487e-19) /* kg m^2 / s^2 */ +#define GSL_CONST_MKS_MASS_ELECTRON (9.10938188e-31) /* kg */ +#define GSL_CONST_MKS_MASS_MUON (1.88353109e-28) /* kg */ +#define GSL_CONST_MKS_MASS_PROTON (1.67262158e-27) /* kg */ +#define GSL_CONST_MKS_MASS_NEUTRON (1.67492716e-27) /* kg */ +#define GSL_CONST_MKS_RYDBERG (2.17987196968e-18) /* kg m^2 / s^2 */ +#define GSL_CONST_MKS_BOLTZMANN (1.3806504e-23) /* kg m^2 / K s^2 */ +#define GSL_CONST_MKS_MOLAR_GAS (8.314472e0) /* kg m^2 / K mol s^2 */ +#define GSL_CONST_MKS_STANDARD_GAS_VOLUME (2.2710981e-2) /* m^3 / mol */ +#define GSL_CONST_MKS_MINUTE (6e1) /* s */ +#define GSL_CONST_MKS_HOUR (3.6e3) /* s */ +#define GSL_CONST_MKS_DAY (8.64e4) /* s */ +#define GSL_CONST_MKS_WEEK (6.048e5) /* s */ +#define GSL_CONST_MKS_INCH (2.54e-2) /* m */ +#define GSL_CONST_MKS_FOOT (3.048e-1) /* m */ +#define GSL_CONST_MKS_YARD (9.144e-1) /* m */ +#define GSL_CONST_MKS_MILE (1.609344e3) /* m */ +#define GSL_CONST_MKS_NAUTICAL_MILE (1.852e3) /* m */ +#define GSL_CONST_MKS_FATHOM (1.8288e0) /* m */ +#define GSL_CONST_MKS_MIL (2.54e-5) /* m */ +#define GSL_CONST_MKS_POINT (3.52777777778e-4) /* m */ +#define GSL_CONST_MKS_TEXPOINT (3.51459803515e-4) /* m */ +#define GSL_CONST_MKS_MICRON (1e-6) /* m */ +#define GSL_CONST_MKS_ANGSTROM (1e-10) /* m */ +#define GSL_CONST_MKS_HECTARE (1e4) /* m^2 */ +#define GSL_CONST_MKS_ACRE (4.04685642241e3) /* m^2 */ +#define GSL_CONST_MKS_BARN (1e-28) /* m^2 */ +#define GSL_CONST_MKS_LITER (1e-3) /* m^3 */ +#define GSL_CONST_MKS_US_GALLON (3.78541178402e-3) /* m^3 */ +#define GSL_CONST_MKS_QUART (9.46352946004e-4) /* m^3 */ +#define GSL_CONST_MKS_PINT (4.73176473002e-4) /* m^3 */ +#define GSL_CONST_MKS_CUP (2.36588236501e-4) /* m^3 */ +#define GSL_CONST_MKS_FLUID_OUNCE (2.95735295626e-5) /* m^3 */ +#define GSL_CONST_MKS_TABLESPOON (1.47867647813e-5) /* m^3 */ +#define GSL_CONST_MKS_TEASPOON (4.92892159375e-6) /* m^3 */ +#define GSL_CONST_MKS_CANADIAN_GALLON (4.54609e-3) /* m^3 */ +#define GSL_CONST_MKS_UK_GALLON (4.546092e-3) /* m^3 */ +#define GSL_CONST_MKS_MILES_PER_HOUR (4.4704e-1) /* m / s */ +#define GSL_CONST_MKS_KILOMETERS_PER_HOUR (2.77777777778e-1) /* m / s */ +#define GSL_CONST_MKS_KNOT (5.14444444444e-1) /* m / s */ +#define GSL_CONST_MKS_POUND_MASS (4.5359237e-1) /* kg */ +#define GSL_CONST_MKS_OUNCE_MASS (2.8349523125e-2) /* kg */ +#define GSL_CONST_MKS_TON (9.0718474e2) /* kg */ +#define GSL_CONST_MKS_METRIC_TON (1e3) /* kg */ +#define GSL_CONST_MKS_UK_TON (1.0160469088e3) /* kg */ +#define GSL_CONST_MKS_TROY_OUNCE (3.1103475e-2) /* kg */ +#define GSL_CONST_MKS_CARAT (2e-4) /* kg */ +#define GSL_CONST_MKS_UNIFIED_ATOMIC_MASS (1.660538782e-27) /* kg */ +#define GSL_CONST_MKS_GRAM_FORCE (9.80665e-3) /* kg m / s^2 */ +#define GSL_CONST_MKS_POUND_FORCE (4.44822161526e0) /* kg m / s^2 */ +#define GSL_CONST_MKS_KILOPOUND_FORCE (4.44822161526e3) /* kg m / s^2 */ +#define GSL_CONST_MKS_POUNDAL (1.38255e-1) /* kg m / s^2 */ +#define GSL_CONST_MKS_CALORIE (4.1868e0) /* kg m^2 / s^2 */ +#define GSL_CONST_MKS_BTU (1.05505585262e3) /* kg m^2 / s^2 */ +#define GSL_CONST_MKS_THERM (1.05506e8) /* kg m^2 / s^2 */ +#define GSL_CONST_MKS_HORSEPOWER (7.457e2) /* kg m^2 / s^3 */ +#define GSL_CONST_MKS_BAR (1e5) /* kg / m s^2 */ +#define GSL_CONST_MKS_STD_ATMOSPHERE (1.01325e5) /* kg / m s^2 */ +#define GSL_CONST_MKS_TORR (1.33322368421e2) /* kg / m s^2 */ +#define GSL_CONST_MKS_METER_OF_MERCURY (1.33322368421e5) /* kg / m s^2 */ +#define GSL_CONST_MKS_INCH_OF_MERCURY (3.38638815789e3) /* kg / m s^2 */ +#define GSL_CONST_MKS_INCH_OF_WATER (2.490889e2) /* kg / m s^2 */ +#define GSL_CONST_MKS_PSI (6.89475729317e3) /* kg / m s^2 */ +#define GSL_CONST_MKS_POISE (1e-1) /* kg m^-1 s^-1 */ +#define GSL_CONST_MKS_STOKES (1e-4) /* m^2 / s */ +#define GSL_CONST_MKS_STILB (1e4) /* cd / m^2 */ +#define GSL_CONST_MKS_LUMEN (1e0) /* cd sr */ +#define GSL_CONST_MKS_LUX (1e0) /* cd sr / m^2 */ +#define GSL_CONST_MKS_PHOT (1e4) /* cd sr / m^2 */ +#define GSL_CONST_MKS_FOOTCANDLE (1.076e1) /* cd sr / m^2 */ +#define GSL_CONST_MKS_LAMBERT (1e4) /* cd sr / m^2 */ +#define GSL_CONST_MKS_FOOTLAMBERT (1.07639104e1) /* cd sr / m^2 */ +#define GSL_CONST_MKS_CURIE (3.7e10) /* 1 / s */ +#define GSL_CONST_MKS_ROENTGEN (2.58e-4) /* A s / kg */ +#define GSL_CONST_MKS_RAD (1e-2) /* m^2 / s^2 */ +#define GSL_CONST_MKS_SOLAR_MASS (1.98892e30) /* kg */ +#define GSL_CONST_MKS_BOHR_RADIUS (5.291772083e-11) /* m */ +#define GSL_CONST_MKS_NEWTON (1e0) /* kg m / s^2 */ +#define GSL_CONST_MKS_DYNE (1e-5) /* kg m / s^2 */ +#define GSL_CONST_MKS_JOULE (1e0) /* kg m^2 / s^2 */ +#define GSL_CONST_MKS_ERG (1e-7) /* kg m^2 / s^2 */ +#define GSL_CONST_MKS_STEFAN_BOLTZMANN_CONSTANT (5.67040047374e-8) /* kg / K^4 s^3 */ +#define GSL_CONST_MKS_THOMSON_CROSS_SECTION (6.65245893699e-29) /* m^2 */ +#define GSL_CONST_MKS_BOHR_MAGNETON (9.27400899e-24) /* A m^2 */ +#define GSL_CONST_MKS_NUCLEAR_MAGNETON (5.05078317e-27) /* A m^2 */ +#define GSL_CONST_MKS_ELECTRON_MAGNETIC_MOMENT (9.28476362e-24) /* A m^2 */ +#define GSL_CONST_MKS_PROTON_MAGNETIC_MOMENT (1.410606633e-26) /* A m^2 */ +#define GSL_CONST_MKS_FARADAY (9.64853429775e4) /* A s / mol */ +#define GSL_CONST_MKS_ELECTRON_CHARGE (1.602176487e-19) /* A s */ +#define GSL_CONST_MKS_VACUUM_PERMITTIVITY (8.854187817e-12) /* A^2 s^4 / kg m^3 */ +#define GSL_CONST_MKS_VACUUM_PERMEABILITY (1.25663706144e-6) /* kg m / A^2 s^2 */ +#define GSL_CONST_MKS_DEBYE (3.33564095198e-30) /* A s^2 / m^2 */ +#define GSL_CONST_MKS_GAUSS (1e-4) /* kg / A s^2 */ + +#endif /* __GSL_CONST_MKS__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_mksa.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_mksa.h new file mode 100644 index 000000000..5d91d1ca4 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_mksa.h @@ -0,0 +1,126 @@ +/* const/gsl_const_mksa.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + * 2006, 2007, 2008, 2009 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_CONST_MKSA__ +#define __GSL_CONST_MKSA__ + +#define GSL_CONST_MKSA_SPEED_OF_LIGHT (2.99792458e8) /* m / s */ +#define GSL_CONST_MKSA_GRAVITATIONAL_CONSTANT (6.673e-11) /* m^3 / kg s^2 */ +#define GSL_CONST_MKSA_PLANCKS_CONSTANT_H (6.62606896e-34) /* kg m^2 / s */ +#define GSL_CONST_MKSA_PLANCKS_CONSTANT_HBAR (1.05457162825e-34) /* kg m^2 / s */ +#define GSL_CONST_MKSA_ASTRONOMICAL_UNIT (1.49597870691e11) /* m */ +#define GSL_CONST_MKSA_LIGHT_YEAR (9.46053620707e15) /* m */ +#define GSL_CONST_MKSA_PARSEC (3.08567758135e16) /* m */ +#define GSL_CONST_MKSA_GRAV_ACCEL (9.80665e0) /* m / s^2 */ +#define GSL_CONST_MKSA_ELECTRON_VOLT (1.602176487e-19) /* kg m^2 / s^2 */ +#define GSL_CONST_MKSA_MASS_ELECTRON (9.10938188e-31) /* kg */ +#define GSL_CONST_MKSA_MASS_MUON (1.88353109e-28) /* kg */ +#define GSL_CONST_MKSA_MASS_PROTON (1.67262158e-27) /* kg */ +#define GSL_CONST_MKSA_MASS_NEUTRON (1.67492716e-27) /* kg */ +#define GSL_CONST_MKSA_RYDBERG (2.17987196968e-18) /* kg m^2 / s^2 */ +#define GSL_CONST_MKSA_BOLTZMANN (1.3806504e-23) /* kg m^2 / K s^2 */ +#define GSL_CONST_MKSA_MOLAR_GAS (8.314472e0) /* kg m^2 / K mol s^2 */ +#define GSL_CONST_MKSA_STANDARD_GAS_VOLUME (2.2710981e-2) /* m^3 / mol */ +#define GSL_CONST_MKSA_MINUTE (6e1) /* s */ +#define GSL_CONST_MKSA_HOUR (3.6e3) /* s */ +#define GSL_CONST_MKSA_DAY (8.64e4) /* s */ +#define GSL_CONST_MKSA_WEEK (6.048e5) /* s */ +#define GSL_CONST_MKSA_INCH (2.54e-2) /* m */ +#define GSL_CONST_MKSA_FOOT (3.048e-1) /* m */ +#define GSL_CONST_MKSA_YARD (9.144e-1) /* m */ +#define GSL_CONST_MKSA_MILE (1.609344e3) /* m */ +#define GSL_CONST_MKSA_NAUTICAL_MILE (1.852e3) /* m */ +#define GSL_CONST_MKSA_FATHOM (1.8288e0) /* m */ +#define GSL_CONST_MKSA_MIL (2.54e-5) /* m */ +#define GSL_CONST_MKSA_POINT (3.52777777778e-4) /* m */ +#define GSL_CONST_MKSA_TEXPOINT (3.51459803515e-4) /* m */ +#define GSL_CONST_MKSA_MICRON (1e-6) /* m */ +#define GSL_CONST_MKSA_ANGSTROM (1e-10) /* m */ +#define GSL_CONST_MKSA_HECTARE (1e4) /* m^2 */ +#define GSL_CONST_MKSA_ACRE (4.04685642241e3) /* m^2 */ +#define GSL_CONST_MKSA_BARN (1e-28) /* m^2 */ +#define GSL_CONST_MKSA_LITER (1e-3) /* m^3 */ +#define GSL_CONST_MKSA_US_GALLON (3.78541178402e-3) /* m^3 */ +#define GSL_CONST_MKSA_QUART (9.46352946004e-4) /* m^3 */ +#define GSL_CONST_MKSA_PINT (4.73176473002e-4) /* m^3 */ +#define GSL_CONST_MKSA_CUP (2.36588236501e-4) /* m^3 */ +#define GSL_CONST_MKSA_FLUID_OUNCE (2.95735295626e-5) /* m^3 */ +#define GSL_CONST_MKSA_TABLESPOON (1.47867647813e-5) /* m^3 */ +#define GSL_CONST_MKSA_TEASPOON (4.92892159375e-6) /* m^3 */ +#define GSL_CONST_MKSA_CANADIAN_GALLON (4.54609e-3) /* m^3 */ +#define GSL_CONST_MKSA_UK_GALLON (4.546092e-3) /* m^3 */ +#define GSL_CONST_MKSA_MILES_PER_HOUR (4.4704e-1) /* m / s */ +#define GSL_CONST_MKSA_KILOMETERS_PER_HOUR (2.77777777778e-1) /* m / s */ +#define GSL_CONST_MKSA_KNOT (5.14444444444e-1) /* m / s */ +#define GSL_CONST_MKSA_POUND_MASS (4.5359237e-1) /* kg */ +#define GSL_CONST_MKSA_OUNCE_MASS (2.8349523125e-2) /* kg */ +#define GSL_CONST_MKSA_TON (9.0718474e2) /* kg */ +#define GSL_CONST_MKSA_METRIC_TON (1e3) /* kg */ +#define GSL_CONST_MKSA_UK_TON (1.0160469088e3) /* kg */ +#define GSL_CONST_MKSA_TROY_OUNCE (3.1103475e-2) /* kg */ +#define GSL_CONST_MKSA_CARAT (2e-4) /* kg */ +#define GSL_CONST_MKSA_UNIFIED_ATOMIC_MASS (1.660538782e-27) /* kg */ +#define GSL_CONST_MKSA_GRAM_FORCE (9.80665e-3) /* kg m / s^2 */ +#define GSL_CONST_MKSA_POUND_FORCE (4.44822161526e0) /* kg m / s^2 */ +#define GSL_CONST_MKSA_KILOPOUND_FORCE (4.44822161526e3) /* kg m / s^2 */ +#define GSL_CONST_MKSA_POUNDAL (1.38255e-1) /* kg m / s^2 */ +#define GSL_CONST_MKSA_CALORIE (4.1868e0) /* kg m^2 / s^2 */ +#define GSL_CONST_MKSA_BTU (1.05505585262e3) /* kg m^2 / s^2 */ +#define GSL_CONST_MKSA_THERM (1.05506e8) /* kg m^2 / s^2 */ +#define GSL_CONST_MKSA_HORSEPOWER (7.457e2) /* kg m^2 / s^3 */ +#define GSL_CONST_MKSA_BAR (1e5) /* kg / m s^2 */ +#define GSL_CONST_MKSA_STD_ATMOSPHERE (1.01325e5) /* kg / m s^2 */ +#define GSL_CONST_MKSA_TORR (1.33322368421e2) /* kg / m s^2 */ +#define GSL_CONST_MKSA_METER_OF_MERCURY (1.33322368421e5) /* kg / m s^2 */ +#define GSL_CONST_MKSA_INCH_OF_MERCURY (3.38638815789e3) /* kg / m s^2 */ +#define GSL_CONST_MKSA_INCH_OF_WATER (2.490889e2) /* kg / m s^2 */ +#define GSL_CONST_MKSA_PSI (6.89475729317e3) /* kg / m s^2 */ +#define GSL_CONST_MKSA_POISE (1e-1) /* kg m^-1 s^-1 */ +#define GSL_CONST_MKSA_STOKES (1e-4) /* m^2 / s */ +#define GSL_CONST_MKSA_STILB (1e4) /* cd / m^2 */ +#define GSL_CONST_MKSA_LUMEN (1e0) /* cd sr */ +#define GSL_CONST_MKSA_LUX (1e0) /* cd sr / m^2 */ +#define GSL_CONST_MKSA_PHOT (1e4) /* cd sr / m^2 */ +#define GSL_CONST_MKSA_FOOTCANDLE (1.076e1) /* cd sr / m^2 */ +#define GSL_CONST_MKSA_LAMBERT (1e4) /* cd sr / m^2 */ +#define GSL_CONST_MKSA_FOOTLAMBERT (1.07639104e1) /* cd sr / m^2 */ +#define GSL_CONST_MKSA_CURIE (3.7e10) /* 1 / s */ +#define GSL_CONST_MKSA_ROENTGEN (2.58e-4) /* A s / kg */ +#define GSL_CONST_MKSA_RAD (1e-2) /* m^2 / s^2 */ +#define GSL_CONST_MKSA_SOLAR_MASS (1.98892e30) /* kg */ +#define GSL_CONST_MKSA_BOHR_RADIUS (5.291772083e-11) /* m */ +#define GSL_CONST_MKSA_NEWTON (1e0) /* kg m / s^2 */ +#define GSL_CONST_MKSA_DYNE (1e-5) /* kg m / s^2 */ +#define GSL_CONST_MKSA_JOULE (1e0) /* kg m^2 / s^2 */ +#define GSL_CONST_MKSA_ERG (1e-7) /* kg m^2 / s^2 */ +#define GSL_CONST_MKSA_STEFAN_BOLTZMANN_CONSTANT (5.67040047374e-8) /* kg / K^4 s^3 */ +#define GSL_CONST_MKSA_THOMSON_CROSS_SECTION (6.65245893699e-29) /* m^2 */ +#define GSL_CONST_MKSA_BOHR_MAGNETON (9.27400899e-24) /* A m^2 */ +#define GSL_CONST_MKSA_NUCLEAR_MAGNETON (5.05078317e-27) /* A m^2 */ +#define GSL_CONST_MKSA_ELECTRON_MAGNETIC_MOMENT (9.28476362e-24) /* A m^2 */ +#define GSL_CONST_MKSA_PROTON_MAGNETIC_MOMENT (1.410606633e-26) /* A m^2 */ +#define GSL_CONST_MKSA_FARADAY (9.64853429775e4) /* A s / mol */ +#define GSL_CONST_MKSA_ELECTRON_CHARGE (1.602176487e-19) /* A s */ +#define GSL_CONST_MKSA_VACUUM_PERMITTIVITY (8.854187817e-12) /* A^2 s^4 / kg m^3 */ +#define GSL_CONST_MKSA_VACUUM_PERMEABILITY (1.25663706144e-6) /* kg m / A^2 s^2 */ +#define GSL_CONST_MKSA_DEBYE (3.33564095198e-30) /* A s^2 / m^2 */ +#define GSL_CONST_MKSA_GAUSS (1e-4) /* kg / A s^2 */ + +#endif /* __GSL_CONST_MKSA__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_num.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_num.h new file mode 100644 index 000000000..385a660f7 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_num.h @@ -0,0 +1,43 @@ +/* const/gsl_const_num.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + * 2006, 2007, 2008, 2009 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_CONST_NUM__ +#define __GSL_CONST_NUM__ + +#define GSL_CONST_NUM_FINE_STRUCTURE (7.297352533e-3) /* 1 */ +#define GSL_CONST_NUM_AVOGADRO (6.02214199e23) /* 1 / mol */ +#define GSL_CONST_NUM_YOTTA (1e24) /* 1 */ +#define GSL_CONST_NUM_ZETTA (1e21) /* 1 */ +#define GSL_CONST_NUM_EXA (1e18) /* 1 */ +#define GSL_CONST_NUM_PETA (1e15) /* 1 */ +#define GSL_CONST_NUM_TERA (1e12) /* 1 */ +#define GSL_CONST_NUM_GIGA (1e9) /* 1 */ +#define GSL_CONST_NUM_MEGA (1e6) /* 1 */ +#define GSL_CONST_NUM_KILO (1e3) /* 1 */ +#define GSL_CONST_NUM_MILLI (1e-3) /* 1 */ +#define GSL_CONST_NUM_MICRO (1e-6) /* 1 */ +#define GSL_CONST_NUM_NANO (1e-9) /* 1 */ +#define GSL_CONST_NUM_PICO (1e-12) /* 1 */ +#define GSL_CONST_NUM_FEMTO (1e-15) /* 1 */ +#define GSL_CONST_NUM_ATTO (1e-18) /* 1 */ +#define GSL_CONST_NUM_ZEPTO (1e-21) /* 1 */ +#define GSL_CONST_NUM_YOCTO (1e-24) /* 1 */ + +#endif /* __GSL_CONST_NUM__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_deriv.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_deriv.h new file mode 100644 index 000000000..7f4694fe7 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_deriv.h @@ -0,0 +1,50 @@ +/* deriv/gsl_deriv.h + * + * Copyright (C) 2000 David Morrison + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_DERIV_H__ +#define __GSL_DERIV_H__ +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_deriv_central (const gsl_function *f, + double x, double h, + double *result, double *abserr); + +int gsl_deriv_backward (const gsl_function *f, + double x, double h, + double *result, double *abserr); + +int gsl_deriv_forward (const gsl_function *f, + double x, double h, + double *result, double *abserr); + +__END_DECLS + +#endif /* __GSL_DERIV_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_dft_complex.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_dft_complex.h new file mode 100644 index 000000000..cb4d08804 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_dft_complex.h @@ -0,0 +1,55 @@ +/* fft/gsl_dft_complex.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_DFT_COMPLEX_H__ +#define __GSL_DFT_COMPLEX_H__ + +#include + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_dft_complex_forward (const double data[], const size_t stride, const size_t n, + double result[]); + +int gsl_dft_complex_backward (const double data[], const size_t stride, const size_t n, + double result[]); + +int gsl_dft_complex_inverse (const double data[], const size_t stride, const size_t n, + double result[]); + +int gsl_dft_complex_transform (const double data[], const size_t stride, const size_t n, + double result[], const gsl_fft_direction sign); + +__END_DECLS + +#endif /* __GSL_DFT_COMPLEX_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_dft_complex_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_dft_complex_float.h new file mode 100644 index 000000000..c511ac09f --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_dft_complex_float.h @@ -0,0 +1,55 @@ +/* fft/gsl_dft_complex_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_DFT_COMPLEX_FLOAT_H__ +#define __GSL_DFT_COMPLEX_FLOAT_H__ + +#include + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_dft_complex_float_forward (const float data[], const size_t stride, const size_t n, + float result[]); + +int gsl_dft_complex_float_backward (const float data[], const size_t stride, const size_t n, + float result[]); + +int gsl_dft_complex_float_inverse (const float data[], const size_t stride, const size_t n, + float result[]); + +int gsl_dft_complex_float_transform (const float data[], const size_t stride, const size_t n, + float result[], const gsl_fft_direction sign); + +__END_DECLS + +#endif /* __GSL_DFT_COMPLEX_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_dht.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_dht.h new file mode 100644 index 000000000..bfc4b2fff --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_dht.h @@ -0,0 +1,87 @@ +/* dht/gsl_dht.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman + */ +#ifndef __GSL_DHT_H__ +#define __GSL_DHT_H__ + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +struct gsl_dht_struct { + size_t size; /* size of the sample arrays to be transformed */ + double nu; /* Bessel function order */ + double xmax; /* the upper limit to the x-sampling domain */ + double kmax; /* the upper limit to the k-sampling domain */ + double * j; /* array of computed J_nu zeros, j_{nu,s} = j[s] */ + double * Jjj; /* transform numerator, J_nu(j_i j_m / j_N) */ + double * J2; /* transform denominator, J_{nu+1}^2(j_m) */ +}; +typedef struct gsl_dht_struct gsl_dht; + + +/* Create a new transform object for a given size + * sampling array on the domain [0, xmax]. + */ +gsl_dht * gsl_dht_alloc(size_t size); +gsl_dht * gsl_dht_new(size_t size, double nu, double xmax); + +/* Recalculate a transform object for given values of nu, xmax. + * You cannot change the size of the object since the internal + * allocation is reused. + */ +int gsl_dht_init(gsl_dht * t, double nu, double xmax); + +/* The n'th computed x sample point for a given transform. + * 0 <= n <= size-1 + */ +double gsl_dht_x_sample(const gsl_dht * t, int n); + + +/* The n'th computed k sample point for a given transform. + * 0 <= n <= size-1 + */ +double gsl_dht_k_sample(const gsl_dht * t, int n); + + +/* Free a transform object. + */ +void gsl_dht_free(gsl_dht * t); + + +/* Perform a transform on a sampled array. + * f_in[0] ... f_in[size-1] and similarly for f_out[] + */ +int gsl_dht_apply(const gsl_dht * t, double * f_in, double * f_out); + + +__END_DECLS + +#endif /* __GSL_DHT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_diff.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_diff.h new file mode 100644 index 000000000..a145894f4 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_diff.h @@ -0,0 +1,52 @@ +/* diff/gsl_diff.h + * + * Copyright (C) 2000 David Morrison + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_DIFF_H__ +#define __GSL_DIFF_H__ +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +#ifndef GSL_DISABLE_DEPRECATED +int gsl_diff_central (const gsl_function *f, + double x, + double *result, double *abserr); + +int gsl_diff_backward (const gsl_function *f, + double x, + double *result, double *abserr); + +int gsl_diff_forward (const gsl_function *f, + double x, + double *result, double *abserr); +#endif + +__END_DECLS + +#endif /* __GSL_DIFF_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_eigen.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_eigen.h new file mode 100644 index 000000000..6de8dba11 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_eigen.h @@ -0,0 +1,347 @@ +/* eigen/gsl_eigen.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2006, 2007 Gerard Jungman, Brian Gough, Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_EIGEN_H__ +#define __GSL_EIGEN_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct { + size_t size; + double * d; + double * sd; +} gsl_eigen_symm_workspace; + +gsl_eigen_symm_workspace * gsl_eigen_symm_alloc (const size_t n); +void gsl_eigen_symm_free (gsl_eigen_symm_workspace * w); +int gsl_eigen_symm (gsl_matrix * A, gsl_vector * eval, gsl_eigen_symm_workspace * w); + +typedef struct { + size_t size; + double * d; + double * sd; + double * gc; + double * gs; +} gsl_eigen_symmv_workspace; + +gsl_eigen_symmv_workspace * gsl_eigen_symmv_alloc (const size_t n); +void gsl_eigen_symmv_free (gsl_eigen_symmv_workspace * w); +int gsl_eigen_symmv (gsl_matrix * A, gsl_vector * eval, gsl_matrix * evec, gsl_eigen_symmv_workspace * w); + +typedef struct { + size_t size; + double * d; + double * sd; + double * tau; +} gsl_eigen_herm_workspace; + +gsl_eigen_herm_workspace * gsl_eigen_herm_alloc (const size_t n); +void gsl_eigen_herm_free (gsl_eigen_herm_workspace * w); +int gsl_eigen_herm (gsl_matrix_complex * A, gsl_vector * eval, + gsl_eigen_herm_workspace * w); + +typedef struct { + size_t size; + double * d; + double * sd; + double * tau; + double * gc; + double * gs; +} gsl_eigen_hermv_workspace; + +gsl_eigen_hermv_workspace * gsl_eigen_hermv_alloc (const size_t n); +void gsl_eigen_hermv_free (gsl_eigen_hermv_workspace * w); +int gsl_eigen_hermv (gsl_matrix_complex * A, gsl_vector * eval, + gsl_matrix_complex * evec, + gsl_eigen_hermv_workspace * w); + +typedef struct { + size_t size; /* matrix size */ + size_t max_iterations; /* max iterations since last eigenvalue found */ + size_t n_iter; /* number of iterations since last eigenvalue found */ + size_t n_evals; /* number of eigenvalues found so far */ + + int compute_t; /* compute Schur form T = Z^t A Z */ + + gsl_matrix *H; /* pointer to Hessenberg matrix */ + gsl_matrix *Z; /* pointer to Schur vector matrix */ +} gsl_eigen_francis_workspace; + +gsl_eigen_francis_workspace * gsl_eigen_francis_alloc (void); +void gsl_eigen_francis_free (gsl_eigen_francis_workspace * w); +void gsl_eigen_francis_T (const int compute_t, + gsl_eigen_francis_workspace * w); +int gsl_eigen_francis (gsl_matrix * H, gsl_vector_complex * eval, + gsl_eigen_francis_workspace * w); +int gsl_eigen_francis_Z (gsl_matrix * H, gsl_vector_complex * eval, + gsl_matrix * Z, + gsl_eigen_francis_workspace * w); + +typedef struct { + size_t size; /* size of matrices */ + gsl_vector *diag; /* diagonal matrix elements from balancing */ + gsl_vector *tau; /* Householder coefficients */ + gsl_matrix *Z; /* pointer to Z matrix */ + int do_balance; /* perform balancing transformation? */ + size_t n_evals; /* number of eigenvalues found */ + + gsl_eigen_francis_workspace *francis_workspace_p; +} gsl_eigen_nonsymm_workspace; + +gsl_eigen_nonsymm_workspace * gsl_eigen_nonsymm_alloc (const size_t n); +void gsl_eigen_nonsymm_free (gsl_eigen_nonsymm_workspace * w); +void gsl_eigen_nonsymm_params (const int compute_t, const int balance, + gsl_eigen_nonsymm_workspace *w); +int gsl_eigen_nonsymm (gsl_matrix * A, gsl_vector_complex * eval, + gsl_eigen_nonsymm_workspace * w); +int gsl_eigen_nonsymm_Z (gsl_matrix * A, gsl_vector_complex * eval, + gsl_matrix * Z, gsl_eigen_nonsymm_workspace * w); + +typedef struct { + size_t size; /* size of matrices */ + gsl_vector *work; /* scratch workspace */ + gsl_vector *work2; /* scratch workspace */ + gsl_vector *work3; /* scratch workspace */ + + gsl_matrix *Z; /* pointer to Schur vectors */ + + gsl_eigen_nonsymm_workspace *nonsymm_workspace_p; +} gsl_eigen_nonsymmv_workspace; + +gsl_eigen_nonsymmv_workspace * gsl_eigen_nonsymmv_alloc (const size_t n); +void gsl_eigen_nonsymmv_free (gsl_eigen_nonsymmv_workspace * w); +void gsl_eigen_nonsymmv_params (const int balance, + gsl_eigen_nonsymmv_workspace *w); +int gsl_eigen_nonsymmv (gsl_matrix * A, gsl_vector_complex * eval, + gsl_matrix_complex * evec, + gsl_eigen_nonsymmv_workspace * w); +int gsl_eigen_nonsymmv_Z (gsl_matrix * A, gsl_vector_complex * eval, + gsl_matrix_complex * evec, gsl_matrix * Z, + gsl_eigen_nonsymmv_workspace * w); + +typedef struct { + size_t size; /* size of matrices */ + gsl_eigen_symm_workspace *symm_workspace_p; +} gsl_eigen_gensymm_workspace; + +gsl_eigen_gensymm_workspace * gsl_eigen_gensymm_alloc (const size_t n); +void gsl_eigen_gensymm_free (gsl_eigen_gensymm_workspace * w); +int gsl_eigen_gensymm (gsl_matrix * A, gsl_matrix * B, + gsl_vector * eval, gsl_eigen_gensymm_workspace * w); +int gsl_eigen_gensymm_standardize (gsl_matrix * A, const gsl_matrix * B); + +typedef struct { + size_t size; /* size of matrices */ + gsl_eigen_symmv_workspace *symmv_workspace_p; +} gsl_eigen_gensymmv_workspace; + +gsl_eigen_gensymmv_workspace * gsl_eigen_gensymmv_alloc (const size_t n); +void gsl_eigen_gensymmv_free (gsl_eigen_gensymmv_workspace * w); +int gsl_eigen_gensymmv (gsl_matrix * A, gsl_matrix * B, + gsl_vector * eval, gsl_matrix * evec, + gsl_eigen_gensymmv_workspace * w); + +typedef struct { + size_t size; /* size of matrices */ + gsl_eigen_herm_workspace *herm_workspace_p; +} gsl_eigen_genherm_workspace; + +gsl_eigen_genherm_workspace * gsl_eigen_genherm_alloc (const size_t n); +void gsl_eigen_genherm_free (gsl_eigen_genherm_workspace * w); +int gsl_eigen_genherm (gsl_matrix_complex * A, gsl_matrix_complex * B, + gsl_vector * eval, gsl_eigen_genherm_workspace * w); +int gsl_eigen_genherm_standardize (gsl_matrix_complex * A, + const gsl_matrix_complex * B); + +typedef struct { + size_t size; /* size of matrices */ + gsl_eigen_hermv_workspace *hermv_workspace_p; +} gsl_eigen_genhermv_workspace; + +gsl_eigen_genhermv_workspace * gsl_eigen_genhermv_alloc (const size_t n); +void gsl_eigen_genhermv_free (gsl_eigen_genhermv_workspace * w); +int gsl_eigen_genhermv (gsl_matrix_complex * A, gsl_matrix_complex * B, + gsl_vector * eval, gsl_matrix_complex * evec, + gsl_eigen_genhermv_workspace * w); + +typedef struct { + size_t size; /* size of matrices */ + gsl_vector *work; /* scratch workspace */ + + size_t n_evals; /* number of eigenvalues found */ + size_t max_iterations; /* maximum QZ iterations allowed */ + size_t n_iter; /* number of iterations since last eigenvalue found */ + double eshift; /* exceptional shift counter */ + + int needtop; /* need to compute top index? */ + + double atol; /* tolerance for splitting A matrix */ + double btol; /* tolerance for splitting B matrix */ + + double ascale; /* scaling factor for shifts */ + double bscale; /* scaling factor for shifts */ + + gsl_matrix *H; /* pointer to hessenberg matrix */ + gsl_matrix *R; /* pointer to upper triangular matrix */ + + int compute_s; /* compute generalized Schur form S */ + int compute_t; /* compute generalized Schur form T */ + + gsl_matrix *Q; /* pointer to left Schur vectors */ + gsl_matrix *Z; /* pointer to right Schur vectors */ +} gsl_eigen_gen_workspace; + +gsl_eigen_gen_workspace * gsl_eigen_gen_alloc (const size_t n); +void gsl_eigen_gen_free (gsl_eigen_gen_workspace * w); +void gsl_eigen_gen_params (const int compute_s, const int compute_t, + const int balance, gsl_eigen_gen_workspace * w); +int gsl_eigen_gen (gsl_matrix * A, gsl_matrix * B, + gsl_vector_complex * alpha, gsl_vector * beta, + gsl_eigen_gen_workspace * w); +int gsl_eigen_gen_QZ (gsl_matrix * A, gsl_matrix * B, + gsl_vector_complex * alpha, gsl_vector * beta, + gsl_matrix * Q, gsl_matrix * Z, + gsl_eigen_gen_workspace * w); + +typedef struct { + size_t size; /* size of matrices */ + + gsl_vector *work1; /* 1-norm of columns of A */ + gsl_vector *work2; /* 1-norm of columns of B */ + gsl_vector *work3; /* real part of eigenvector */ + gsl_vector *work4; /* imag part of eigenvector */ + gsl_vector *work5; /* real part of back-transformed eigenvector */ + gsl_vector *work6; /* imag part of back-transformed eigenvector */ + + gsl_matrix *Q; /* pointer to left Schur vectors */ + gsl_matrix *Z; /* pointer to right Schur vectors */ + + gsl_eigen_gen_workspace *gen_workspace_p; +} gsl_eigen_genv_workspace; + +gsl_eigen_genv_workspace * gsl_eigen_genv_alloc (const size_t n); +void gsl_eigen_genv_free (gsl_eigen_genv_workspace * w); +int gsl_eigen_genv (gsl_matrix * A, gsl_matrix * B, + gsl_vector_complex * alpha, gsl_vector * beta, + gsl_matrix_complex * evec, + gsl_eigen_genv_workspace * w); +int gsl_eigen_genv_QZ (gsl_matrix * A, gsl_matrix * B, + gsl_vector_complex * alpha, gsl_vector * beta, + gsl_matrix_complex * evec, + gsl_matrix * Q, gsl_matrix * Z, + gsl_eigen_genv_workspace * w); + + + +typedef enum { + GSL_EIGEN_SORT_VAL_ASC, + GSL_EIGEN_SORT_VAL_DESC, + GSL_EIGEN_SORT_ABS_ASC, + GSL_EIGEN_SORT_ABS_DESC +} +gsl_eigen_sort_t; + +/* Sort eigensystem results based on eigenvalues. + * Sorts in order of increasing value or increasing + * absolute value. + * + * exceptions: GSL_EBADLEN + */ + +int gsl_eigen_symmv_sort(gsl_vector * eval, gsl_matrix * evec, + gsl_eigen_sort_t sort_type); + +int gsl_eigen_hermv_sort(gsl_vector * eval, gsl_matrix_complex * evec, + gsl_eigen_sort_t sort_type); + +int gsl_eigen_nonsymmv_sort(gsl_vector_complex * eval, + gsl_matrix_complex * evec, + gsl_eigen_sort_t sort_type); + +int gsl_eigen_gensymmv_sort (gsl_vector * eval, gsl_matrix * evec, + gsl_eigen_sort_t sort_type); + +int gsl_eigen_genhermv_sort (gsl_vector * eval, gsl_matrix_complex * evec, + gsl_eigen_sort_t sort_type); + +int gsl_eigen_genv_sort (gsl_vector_complex * alpha, gsl_vector * beta, + gsl_matrix_complex * evec, + gsl_eigen_sort_t sort_type); + +/* Prototypes for the schur module */ + +int gsl_schur_gen_eigvals(const gsl_matrix *A, const gsl_matrix *B, + double *wr1, double *wr2, double *wi, + double *scale1, double *scale2); + +int gsl_schur_solve_equation(double ca, const gsl_matrix *A, double z, + double d1, double d2, const gsl_vector *b, + gsl_vector *x, double *s, double *xnorm, + double smin); + +int gsl_schur_solve_equation_z(double ca, const gsl_matrix *A, + gsl_complex *z, double d1, double d2, + const gsl_vector_complex *b, + gsl_vector_complex *x, double *s, + double *xnorm, double smin); + + +/* The following functions are obsolete: */ + +/* Eigensolve by Jacobi Method + * + * The data in the matrix input is destroyed. + * + * exceptions: + */ +int +gsl_eigen_jacobi(gsl_matrix * matrix, + gsl_vector * eval, + gsl_matrix * evec, + unsigned int max_rot, + unsigned int * nrot); + + +/* Invert by Jacobi Method + * + * exceptions: + */ +int +gsl_eigen_invert_jacobi(const gsl_matrix * matrix, + gsl_matrix * ainv, + unsigned int max_rot); + + + +__END_DECLS + +#endif /* __GSL_EIGEN_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_errno.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_errno.h new file mode 100644 index 000000000..b8e99b433 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_errno.h @@ -0,0 +1,154 @@ +/* err/gsl_errno.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_ERRNO_H__ +#define __GSL_ERRNO_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +enum { + GSL_SUCCESS = 0, + GSL_FAILURE = -1, + GSL_CONTINUE = -2, /* iteration has not converged */ + GSL_EDOM = 1, /* input domain error, e.g sqrt(-1) */ + GSL_ERANGE = 2, /* output range error, e.g. exp(1e100) */ + GSL_EFAULT = 3, /* invalid pointer */ + GSL_EINVAL = 4, /* invalid argument supplied by user */ + GSL_EFAILED = 5, /* generic failure */ + GSL_EFACTOR = 6, /* factorization failed */ + GSL_ESANITY = 7, /* sanity check failed - shouldn't happen */ + GSL_ENOMEM = 8, /* malloc failed */ + GSL_EBADFUNC = 9, /* problem with user-supplied function */ + GSL_ERUNAWAY = 10, /* iterative process is out of control */ + GSL_EMAXITER = 11, /* exceeded max number of iterations */ + GSL_EZERODIV = 12, /* tried to divide by zero */ + GSL_EBADTOL = 13, /* user specified an invalid tolerance */ + GSL_ETOL = 14, /* failed to reach the specified tolerance */ + GSL_EUNDRFLW = 15, /* underflow */ + GSL_EOVRFLW = 16, /* overflow */ + GSL_ELOSS = 17, /* loss of accuracy */ + GSL_EROUND = 18, /* failed because of roundoff error */ + GSL_EBADLEN = 19, /* matrix, vector lengths are not conformant */ + GSL_ENOTSQR = 20, /* matrix not square */ + GSL_ESING = 21, /* apparent singularity detected */ + GSL_EDIVERGE = 22, /* integral or series is divergent */ + GSL_EUNSUP = 23, /* requested feature is not supported by the hardware */ + GSL_EUNIMPL = 24, /* requested feature not (yet) implemented */ + GSL_ECACHE = 25, /* cache limit exceeded */ + GSL_ETABLE = 26, /* table limit exceeded */ + GSL_ENOPROG = 27, /* iteration is not making progress towards solution */ + GSL_ENOPROGJ = 28, /* jacobian evaluations are not improving the solution */ + GSL_ETOLF = 29, /* cannot reach the specified tolerance in F */ + GSL_ETOLX = 30, /* cannot reach the specified tolerance in X */ + GSL_ETOLG = 31, /* cannot reach the specified tolerance in gradient */ + GSL_EOF = 32 /* end of file */ +} ; + +void gsl_error (const char * reason, const char * file, int line, + int gsl_errno); + +void gsl_stream_printf (const char *label, const char *file, + int line, const char *reason); + +const char * gsl_strerror (const int gsl_errno); + +typedef void gsl_error_handler_t (const char * reason, const char * file, + int line, int gsl_errno); + +typedef void gsl_stream_handler_t (const char * label, const char * file, + int line, const char * reason); + +gsl_error_handler_t * +gsl_set_error_handler (gsl_error_handler_t * new_handler); + +gsl_error_handler_t * +gsl_set_error_handler_off (void); + +gsl_stream_handler_t * +gsl_set_stream_handler (gsl_stream_handler_t * new_handler); + +FILE * gsl_set_stream (FILE * new_stream); + +/* GSL_ERROR: call the error handler, and return the error code */ + +#define GSL_ERROR(reason, gsl_errno) \ + do { \ + gsl_error (reason, __FILE__, __LINE__, gsl_errno) ; \ + return gsl_errno ; \ + } while (0) + +/* GSL_ERROR_VAL: call the error handler, and return the given value */ + +#define GSL_ERROR_VAL(reason, gsl_errno, value) \ + do { \ + gsl_error (reason, __FILE__, __LINE__, gsl_errno) ; \ + return value ; \ + } while (0) + +/* GSL_ERROR_VOID: call the error handler, and then return + (for void functions which still need to generate an error) */ + +#define GSL_ERROR_VOID(reason, gsl_errno) \ + do { \ + gsl_error (reason, __FILE__, __LINE__, gsl_errno) ; \ + return ; \ + } while (0) + +/* GSL_ERROR_NULL suitable for out-of-memory conditions */ + +#define GSL_ERROR_NULL(reason, gsl_errno) GSL_ERROR_VAL(reason, gsl_errno, 0) + +/* Sometimes you have several status results returned from + * function calls and you want to combine them in some sensible + * way. You cannot produce a "total" status condition, but you can + * pick one from a set of conditions based on an implied hierarchy. + * + * In other words: + * you have: status_a, status_b, ... + * you want: status = (status_a if it is bad, or status_b if it is bad,...) + * + * In this example you consider status_a to be more important and + * it is checked first, followed by the others in the order specified. + * + * Here are some dumb macros to do this. + */ +#define GSL_ERROR_SELECT_2(a,b) ((a) != GSL_SUCCESS ? (a) : ((b) != GSL_SUCCESS ? (b) : GSL_SUCCESS)) +#define GSL_ERROR_SELECT_3(a,b,c) ((a) != GSL_SUCCESS ? (a) : GSL_ERROR_SELECT_2(b,c)) +#define GSL_ERROR_SELECT_4(a,b,c,d) ((a) != GSL_SUCCESS ? (a) : GSL_ERROR_SELECT_3(b,c,d)) +#define GSL_ERROR_SELECT_5(a,b,c,d,e) ((a) != GSL_SUCCESS ? (a) : GSL_ERROR_SELECT_4(b,c,d,e)) + +#define GSL_STATUS_UPDATE(sp, s) do { if ((s) != GSL_SUCCESS) *(sp) = (s);} while(0) + +__END_DECLS + +#endif /* __GSL_ERRNO_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft.h new file mode 100644 index 000000000..8870a8886 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft.h @@ -0,0 +1,51 @@ +/* fft/gsl_fft.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_FFT_H__ +#define __GSL_FFT_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef enum + { + gsl_fft_forward = -1, gsl_fft_backward = +1 + } +gsl_fft_direction; + +/* this gives the sign in the formula + + h(f) = \sum x(t) exp(+/- 2 pi i f t) + + where - is the forward transform direction and + the inverse direction */ + +__END_DECLS + +#endif /* __GSL_FFT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_complex.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_complex.h new file mode 100644 index 000000000..c13f7ea50 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_complex.h @@ -0,0 +1,136 @@ +/* fft/gsl_fft_complex.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_FFT_COMPLEX_H__ +#define __GSL_FFT_COMPLEX_H__ + +#include + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* Power of 2 routines */ + + +int gsl_fft_complex_radix2_forward (gsl_complex_packed_array data, + const size_t stride, + const size_t n); + +int gsl_fft_complex_radix2_backward (gsl_complex_packed_array data, + const size_t stride, + const size_t n); + +int gsl_fft_complex_radix2_inverse (gsl_complex_packed_array data, + const size_t stride, + const size_t n); + +int gsl_fft_complex_radix2_transform (gsl_complex_packed_array data, + const size_t stride, + const size_t n, + const gsl_fft_direction sign); + +int gsl_fft_complex_radix2_dif_forward (gsl_complex_packed_array data, + const size_t stride, + const size_t n); + +int gsl_fft_complex_radix2_dif_backward (gsl_complex_packed_array data, + const size_t stride, + const size_t n); + +int gsl_fft_complex_radix2_dif_inverse (gsl_complex_packed_array data, + const size_t stride, + const size_t n); + +int gsl_fft_complex_radix2_dif_transform (gsl_complex_packed_array data, + const size_t stride, + const size_t n, + const gsl_fft_direction sign); + +/* Mixed Radix general-N routines */ + +typedef struct + { + size_t n; + size_t nf; + size_t factor[64]; + gsl_complex *twiddle[64]; + gsl_complex *trig; + } +gsl_fft_complex_wavetable; + +typedef struct +{ + size_t n; + double *scratch; +} +gsl_fft_complex_workspace; + + +gsl_fft_complex_wavetable *gsl_fft_complex_wavetable_alloc (size_t n); + +void gsl_fft_complex_wavetable_free (gsl_fft_complex_wavetable * wavetable); + +gsl_fft_complex_workspace *gsl_fft_complex_workspace_alloc (size_t n); + +void gsl_fft_complex_workspace_free (gsl_fft_complex_workspace * workspace); + +int gsl_fft_complex_memcpy (gsl_fft_complex_wavetable * dest, + gsl_fft_complex_wavetable * src); + + +int gsl_fft_complex_forward (gsl_complex_packed_array data, + const size_t stride, + const size_t n, + const gsl_fft_complex_wavetable * wavetable, + gsl_fft_complex_workspace * work); + +int gsl_fft_complex_backward (gsl_complex_packed_array data, + const size_t stride, + const size_t n, + const gsl_fft_complex_wavetable * wavetable, + gsl_fft_complex_workspace * work); + +int gsl_fft_complex_inverse (gsl_complex_packed_array data, + const size_t stride, + const size_t n, + const gsl_fft_complex_wavetable * wavetable, + gsl_fft_complex_workspace * work); + +int gsl_fft_complex_transform (gsl_complex_packed_array data, + const size_t stride, const size_t n, + const gsl_fft_complex_wavetable * wavetable, + gsl_fft_complex_workspace * work, + const gsl_fft_direction sign); + +__END_DECLS + +#endif /* __GSL_FFT_COMPLEX_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_complex_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_complex_float.h new file mode 100644 index 000000000..d3ff395f9 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_complex_float.h @@ -0,0 +1,139 @@ +/* fft/gsl_fft_complex_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_FFT_COMPLEX_FLOAT_H__ +#define __GSL_FFT_COMPLEX_FLOAT_H__ + +#include + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* Power of 2 routines */ + + +int gsl_fft_complex_float_radix2_forward (gsl_complex_packed_array_float data, + const size_t stride, + const size_t n); + +int gsl_fft_complex_float_radix2_backward (gsl_complex_packed_array_float data, + const size_t stride, + const size_t n); + +int gsl_fft_complex_float_radix2_inverse (gsl_complex_packed_array_float data, + const size_t stride, + const size_t n); + +int gsl_fft_complex_float_radix2_transform (gsl_complex_packed_array_float data, + const size_t stride, + const size_t n, + const gsl_fft_direction sign); + +int gsl_fft_complex_float_radix2_dif_forward (gsl_complex_packed_array_float data, + const size_t stride, + const size_t n); + +int gsl_fft_complex_float_radix2_dif_backward (gsl_complex_packed_array_float data, + const size_t stride, + const size_t n); + +int gsl_fft_complex_float_radix2_dif_inverse (gsl_complex_packed_array_float data, + const size_t stride, + const size_t n); + +int gsl_fft_complex_float_radix2_dif_transform (gsl_complex_packed_array_float data, + const size_t stride, + const size_t n, + const gsl_fft_direction sign); + +/* Mixed Radix general-N routines */ + +typedef struct + { + size_t n; + size_t nf; + size_t factor[64]; + gsl_complex_float *twiddle[64]; + gsl_complex_float *trig; + } +gsl_fft_complex_wavetable_float; + +typedef struct +{ + size_t n; + float *scratch; +} +gsl_fft_complex_workspace_float; + + +gsl_fft_complex_wavetable_float *gsl_fft_complex_wavetable_float_alloc (size_t n); + +void gsl_fft_complex_wavetable_float_free (gsl_fft_complex_wavetable_float * wavetable); + +gsl_fft_complex_workspace_float *gsl_fft_complex_workspace_float_alloc (size_t n); + +void gsl_fft_complex_workspace_float_free (gsl_fft_complex_workspace_float * workspace); + + +int gsl_fft_complex_float_memcpy (gsl_fft_complex_wavetable_float * dest, + gsl_fft_complex_wavetable_float * src); + + +int gsl_fft_complex_float_forward (gsl_complex_packed_array_float data, + const size_t stride, + const size_t n, + const gsl_fft_complex_wavetable_float * wavetable, + gsl_fft_complex_workspace_float * work); + +int gsl_fft_complex_float_backward (gsl_complex_packed_array_float data, + const size_t stride, + const size_t n, + const gsl_fft_complex_wavetable_float * wavetable, + gsl_fft_complex_workspace_float * work); + +int gsl_fft_complex_float_inverse (gsl_complex_packed_array_float data, + const size_t stride, + const size_t n, + const gsl_fft_complex_wavetable_float * wavetable, + gsl_fft_complex_workspace_float * work); + +int gsl_fft_complex_float_transform (gsl_complex_packed_array_float data, + const size_t stride, const size_t n, + const gsl_fft_complex_wavetable_float * wavetable, + gsl_fft_complex_workspace_float * work, + const gsl_fft_direction sign); + +__END_DECLS + +#endif /* __GSL_FFT_COMPLEX_FLOAT_H__ */ + + diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_halfcomplex.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_halfcomplex.h new file mode 100644 index 000000000..6751e4762 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_halfcomplex.h @@ -0,0 +1,86 @@ +/* fft/gsl_fft_halfcomplex.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_FFT_HALFCOMPLEX_H__ +#define __GSL_FFT_HALFCOMPLEX_H__ + +#include + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_fft_halfcomplex_radix2_backward (double data[], const size_t stride, const size_t n); +int gsl_fft_halfcomplex_radix2_inverse (double data[], const size_t stride, const size_t n); +int gsl_fft_halfcomplex_radix2_transform (double data[], const size_t stride, const size_t n); + +typedef struct + { + size_t n; + size_t nf; + size_t factor[64]; + gsl_complex *twiddle[64]; + gsl_complex *trig; + } +gsl_fft_halfcomplex_wavetable; + +gsl_fft_halfcomplex_wavetable * gsl_fft_halfcomplex_wavetable_alloc (size_t n); + +void +gsl_fft_halfcomplex_wavetable_free (gsl_fft_halfcomplex_wavetable * wavetable); + + +int gsl_fft_halfcomplex_backward (double data[], const size_t stride, const size_t n, + const gsl_fft_halfcomplex_wavetable * wavetable, + gsl_fft_real_workspace * work); + +int gsl_fft_halfcomplex_inverse (double data[], const size_t stride, const size_t n, + const gsl_fft_halfcomplex_wavetable * wavetable, + gsl_fft_real_workspace * work); + +int gsl_fft_halfcomplex_transform (double data[], const size_t stride, const size_t n, + const gsl_fft_halfcomplex_wavetable * wavetable, + gsl_fft_real_workspace * work); + +int +gsl_fft_halfcomplex_unpack (const double halfcomplex_coefficient[], + double complex_coefficient[], + const size_t stride, const size_t n); + +int +gsl_fft_halfcomplex_radix2_unpack (const double halfcomplex_coefficient[], + double complex_coefficient[], + const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_FFT_HALFCOMPLEX_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_halfcomplex_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_halfcomplex_float.h new file mode 100644 index 000000000..e31836753 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_halfcomplex_float.h @@ -0,0 +1,86 @@ +/* fft/gsl_fft_halfcomplex_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_FFT_HALFCOMPLEX_FLOAT_H__ +#define __GSL_FFT_HALFCOMPLEX_FLOAT_H__ + +#include + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_fft_halfcomplex_float_radix2_backward (float data[], const size_t stride, const size_t n); +int gsl_fft_halfcomplex_float_radix2_inverse (float data[], const size_t stride, const size_t n); +int gsl_fft_halfcomplex_float_radix2_transform (float data[], const size_t stride, const size_t n); + +typedef struct + { + size_t n; + size_t nf; + size_t factor[64]; + gsl_complex_float *twiddle[64]; + gsl_complex_float *trig; + } +gsl_fft_halfcomplex_wavetable_float; + + +gsl_fft_halfcomplex_wavetable_float * gsl_fft_halfcomplex_wavetable_float_alloc (size_t n); + +void +gsl_fft_halfcomplex_wavetable_float_free (gsl_fft_halfcomplex_wavetable_float * wavetable); + +int gsl_fft_halfcomplex_float_backward (float data[], const size_t stride, const size_t n, + const gsl_fft_halfcomplex_wavetable_float * wavetable, + gsl_fft_real_workspace_float * work); + +int gsl_fft_halfcomplex_float_inverse (float data[], const size_t stride, const size_t n, + const gsl_fft_halfcomplex_wavetable_float * wavetable, + gsl_fft_real_workspace_float * work); + +int gsl_fft_halfcomplex_float_transform (float data[], const size_t stride, const size_t n, + const gsl_fft_halfcomplex_wavetable_float * wavetable, + gsl_fft_real_workspace_float * work); + +int +gsl_fft_halfcomplex_float_unpack (const float halfcomplex_coefficient[], + float complex_coefficient[], + const size_t stride, const size_t n); + +int +gsl_fft_halfcomplex_float_radix2_unpack (const float halfcomplex_coefficient[], + float complex_coefficient[], + const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_FFT_HALFCOMPLEX_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_real.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_real.h new file mode 100644 index 000000000..e07a60420 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_real.h @@ -0,0 +1,80 @@ +/* fft/gsl_fft_real.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_FFT_REAL_H__ +#define __GSL_FFT_REAL_H__ + +#include + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_fft_real_radix2_transform (double data[], const size_t stride, const size_t n) ; + +typedef struct + { + size_t n; + size_t nf; + size_t factor[64]; + gsl_complex *twiddle[64]; + gsl_complex *trig; + } +gsl_fft_real_wavetable; + +typedef struct + { + size_t n; + double *scratch; + } +gsl_fft_real_workspace; + +gsl_fft_real_wavetable * gsl_fft_real_wavetable_alloc (size_t n); + +void gsl_fft_real_wavetable_free (gsl_fft_real_wavetable * wavetable); + +gsl_fft_real_workspace * gsl_fft_real_workspace_alloc (size_t n); + +void gsl_fft_real_workspace_free (gsl_fft_real_workspace * workspace); + + +int gsl_fft_real_transform (double data[], const size_t stride, const size_t n, + const gsl_fft_real_wavetable * wavetable, + gsl_fft_real_workspace * work); + + +int gsl_fft_real_unpack (const double real_coefficient[], + double complex_coefficient[], + const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_FFT_REAL_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_real_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_real_float.h new file mode 100644 index 000000000..7a7732f22 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_real_float.h @@ -0,0 +1,79 @@ +/* fft/gsl_fft_real_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_FFT_REAL_FLOAT_H__ +#define __GSL_FFT_REAL_FLOAT_H__ + +#include + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_fft_real_float_radix2_transform (float data[], const size_t stride, const size_t n) ; + +typedef struct + { + size_t n; + size_t nf; + size_t factor[64]; + gsl_complex_float *twiddle[64]; + gsl_complex_float *trig; + } +gsl_fft_real_wavetable_float; + +typedef struct + { + size_t n; + float *scratch; + } +gsl_fft_real_workspace_float; + +gsl_fft_real_wavetable_float * gsl_fft_real_wavetable_float_alloc (size_t n); + +void gsl_fft_real_wavetable_float_free (gsl_fft_real_wavetable_float * wavetable); + +gsl_fft_real_workspace_float * gsl_fft_real_workspace_float_alloc (size_t n); + +void gsl_fft_real_workspace_float_free (gsl_fft_real_workspace_float * workspace); + +int gsl_fft_real_float_transform (float data[], const size_t stride, const size_t n, + const gsl_fft_real_wavetable_float * wavetable, + gsl_fft_real_workspace_float * work); + + +int gsl_fft_real_float_unpack (const float real_float_coefficient[], + float complex_coefficient[], + const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_FFT_REAL_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_filter.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_filter.h new file mode 100644 index 000000000..0339da26a --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_filter.h @@ -0,0 +1,109 @@ +/* filter/gsl_filter.h + * + * Copyright (C) 2018 Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_FILTER_H__ +#define __GSL_FILTER_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* end point handling methods */ +typedef enum +{ + GSL_FILTER_END_PADZERO = GSL_MOVSTAT_END_PADZERO, + GSL_FILTER_END_PADVALUE = GSL_MOVSTAT_END_PADVALUE, + GSL_FILTER_END_TRUNCATE = GSL_MOVSTAT_END_TRUNCATE +} gsl_filter_end_t; + +/* robust scale estimates */ +typedef enum +{ + GSL_FILTER_SCALE_MAD, /* median absolute deviation */ + GSL_FILTER_SCALE_IQR, /* interquartile range */ + GSL_FILTER_SCALE_SN, /* S_n scale statistic */ + GSL_FILTER_SCALE_QN /* Q_n scale statistic */ +} gsl_filter_scale_t; + +/* workspace for Gaussian filter */ +typedef struct +{ + size_t K; /* window size */ + double *kernel; /* Gaussian kernel, size K */ + gsl_movstat_workspace *movstat_workspace_p; +} gsl_filter_gaussian_workspace; + +gsl_filter_gaussian_workspace *gsl_filter_gaussian_alloc(const size_t K); +void gsl_filter_gaussian_free(gsl_filter_gaussian_workspace * w); +int gsl_filter_gaussian(const gsl_filter_end_t endtype, const double alpha, const size_t order, const gsl_vector * x, + gsl_vector * y, gsl_filter_gaussian_workspace * w); +int gsl_filter_gaussian_kernel(const double alpha, const size_t order, const int normalize, gsl_vector * kernel); + +/* workspace for standard median filter */ +typedef struct +{ + gsl_movstat_workspace *movstat_workspace_p; +} gsl_filter_median_workspace; + +gsl_filter_median_workspace *gsl_filter_median_alloc(const size_t K); +void gsl_filter_median_free(gsl_filter_median_workspace * w); +int gsl_filter_median(const gsl_filter_end_t endtype, const gsl_vector * x, gsl_vector * y, gsl_filter_median_workspace * w); + +/* workspace for recursive median filter */ +typedef struct +{ + size_t H; /* window half-length (K / 2) */ + size_t K; /* window size */ + void *state; /* workspace for min/max accumulator */ + double *window; /* array holding first window */ + const gsl_movstat_accum * minmaxacc; /* minimum/maximum accumulator */ + gsl_movstat_workspace *movstat_workspace_p; +} gsl_filter_rmedian_workspace; + +gsl_filter_rmedian_workspace *gsl_filter_rmedian_alloc(const size_t K); +void gsl_filter_rmedian_free(gsl_filter_rmedian_workspace * w); +int gsl_filter_rmedian(const gsl_filter_end_t, const gsl_vector * x, gsl_vector * y, gsl_filter_rmedian_workspace * w); +int gsl_filter_rmedian2(const gsl_vector * x, gsl_vector * y, gsl_filter_rmedian_workspace * w); + +typedef struct +{ + gsl_movstat_workspace *movstat_workspace_p; +} gsl_filter_impulse_workspace; + +gsl_filter_impulse_workspace *gsl_filter_impulse_alloc(const size_t K); +void gsl_filter_impulse_free(gsl_filter_impulse_workspace * w); +int gsl_filter_impulse(const gsl_filter_end_t endtype, const gsl_filter_scale_t scale_type, const double t, + const gsl_vector * x, gsl_vector * y, gsl_vector * xmedian, gsl_vector * xsigma, size_t * noutlier, + gsl_vector_int * ioutlier, gsl_filter_impulse_workspace * w); + +__END_DECLS + +#endif /* __GSL_FILTER_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_fit.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_fit.h new file mode 100644 index 000000000..de83a41d0 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_fit.h @@ -0,0 +1,85 @@ +/* fit/gsl_fit.h + * + * Copyright (C) 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_FIT_H__ +#define __GSL_FIT_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_fit_linear (const double * x, const size_t xstride, + const double * y, const size_t ystride, + const size_t n, + double * c0, double * c1, + double * cov00, double * cov01, double * cov11, + double * sumsq); + + +int gsl_fit_wlinear (const double * x, const size_t xstride, + const double * w, const size_t wstride, + const double * y, const size_t ystride, + const size_t n, + double * c0, double * c1, + double * cov00, double * cov01, double * cov11, + double * chisq); + +int +gsl_fit_linear_est (const double x, + const double c0, const double c1, + const double cov00, const double cov01, const double cov11, + double *y, double *y_err); + + +int gsl_fit_mul (const double * x, const size_t xstride, + const double * y, const size_t ystride, + const size_t n, + double * c1, + double * cov11, + double * sumsq); + +int gsl_fit_wmul (const double * x, const size_t xstride, + const double * w, const size_t wstride, + const double * y, const size_t ystride, + const size_t n, + double * c1, + double * cov11, + double * sumsq); + + +int +gsl_fit_mul_est (const double x, + const double c1, + const double cov11, + double *y, double *y_err); + +__END_DECLS + +#endif /* __GSL_FIT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_heapsort.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_heapsort.h new file mode 100644 index 000000000..213fae1e8 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_heapsort.h @@ -0,0 +1,44 @@ +/* sort/gsl_heapsort.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_HEAPSORT_H__ +#define __GSL_HEAPSORT_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef int (*gsl_comparison_fn_t) (const void *, const void *); + +void gsl_heapsort (void * array, size_t count, size_t size, gsl_comparison_fn_t compare); +int gsl_heapsort_index (size_t * p, const void * array, size_t count, size_t size, gsl_comparison_fn_t compare); + +__END_DECLS + +#endif /* __GSL_HEAPSORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_histogram.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_histogram.h new file mode 100644 index 000000000..e8375c64e --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_histogram.h @@ -0,0 +1,134 @@ +/* histogram/gsl_histogram.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_HISTOGRAM_H__ +#define __GSL_HISTOGRAM_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct { + size_t n ; + double * range ; + double * bin ; +} gsl_histogram ; + +typedef struct { + size_t n ; + double * range ; + double * sum ; +} gsl_histogram_pdf ; + +gsl_histogram * gsl_histogram_alloc (size_t n); + +gsl_histogram * gsl_histogram_calloc (size_t n); +gsl_histogram * gsl_histogram_calloc_uniform (const size_t n, const double xmin, const double xmax); +void gsl_histogram_free (gsl_histogram * h); +int gsl_histogram_increment (gsl_histogram * h, double x); +int gsl_histogram_accumulate (gsl_histogram * h, double x, double weight); +int gsl_histogram_find (const gsl_histogram * h, + const double x, size_t * i); + +double gsl_histogram_get (const gsl_histogram * h, size_t i); +int gsl_histogram_get_range (const gsl_histogram * h, size_t i, + double * lower, double * upper); + +double gsl_histogram_max (const gsl_histogram * h); +double gsl_histogram_min (const gsl_histogram * h); +size_t gsl_histogram_bins (const gsl_histogram * h); + +void gsl_histogram_reset (gsl_histogram * h); + +gsl_histogram * gsl_histogram_calloc_range(size_t n, double * range); + +int +gsl_histogram_set_ranges (gsl_histogram * h, const double range[], size_t size); +int +gsl_histogram_set_ranges_uniform (gsl_histogram * h, double xmin, double xmax); + + + +int +gsl_histogram_memcpy(gsl_histogram * dest, const gsl_histogram * source); + +gsl_histogram * +gsl_histogram_clone(const gsl_histogram * source); + +double gsl_histogram_max_val (const gsl_histogram * h); + +size_t gsl_histogram_max_bin (const gsl_histogram * h); + +double gsl_histogram_min_val (const gsl_histogram * h); + +size_t gsl_histogram_min_bin (const gsl_histogram * h); + +int +gsl_histogram_equal_bins_p(const gsl_histogram *h1, const gsl_histogram *h2); + +int +gsl_histogram_add(gsl_histogram *h1, const gsl_histogram *h2); + +int +gsl_histogram_sub(gsl_histogram *h1, const gsl_histogram *h2); + +int +gsl_histogram_mul(gsl_histogram *h1, const gsl_histogram *h2); + +int +gsl_histogram_div(gsl_histogram *h1, const gsl_histogram *h2); + +int +gsl_histogram_scale(gsl_histogram *h, double scale); + +int +gsl_histogram_shift (gsl_histogram * h, double shift); + + +double gsl_histogram_sigma (const gsl_histogram * h); + +double gsl_histogram_mean (const gsl_histogram * h); + +double gsl_histogram_sum (const gsl_histogram * h); + +int gsl_histogram_fwrite (FILE * stream, const gsl_histogram * h) ; +int gsl_histogram_fread (FILE * stream, gsl_histogram * h); +int gsl_histogram_fprintf (FILE * stream, const gsl_histogram * h, + const char * range_format, const char * bin_format); +int gsl_histogram_fscanf (FILE * stream, gsl_histogram * h); + +gsl_histogram_pdf * gsl_histogram_pdf_alloc (const size_t n); +int gsl_histogram_pdf_init (gsl_histogram_pdf * p, const gsl_histogram * h); +void gsl_histogram_pdf_free (gsl_histogram_pdf * p); +double gsl_histogram_pdf_sample (const gsl_histogram_pdf * p, double r); + +__END_DECLS + +#endif /* __GSL_HISTOGRAM_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_histogram2d.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_histogram2d.h new file mode 100644 index 000000000..90065ac0c --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_histogram2d.h @@ -0,0 +1,172 @@ +/* histogram/gsl_histogram2d.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_HISTOGRAM2D_H__ +#define __GSL_HISTOGRAM2D_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct { + size_t nx, ny ; + double * xrange ; + double * yrange ; + double * bin ; +} gsl_histogram2d ; + +typedef struct { + size_t nx, ny ; + double * xrange ; + double * yrange ; + double * sum ; +} gsl_histogram2d_pdf ; + +gsl_histogram2d * gsl_histogram2d_alloc (const size_t nx, const size_t ny); +gsl_histogram2d * gsl_histogram2d_calloc (const size_t nx, const size_t ny); +gsl_histogram2d * gsl_histogram2d_calloc_uniform (const size_t nx, const size_t ny, + const double xmin, const double xmax, + const double ymin, const double ymax); + +void gsl_histogram2d_free (gsl_histogram2d * h); + +int gsl_histogram2d_increment (gsl_histogram2d * h, double x, double y); +int gsl_histogram2d_accumulate (gsl_histogram2d * h, + double x, double y, double weight); +int gsl_histogram2d_find (const gsl_histogram2d * h, + const double x, const double y, size_t * i, size_t * j); + +double gsl_histogram2d_get (const gsl_histogram2d * h, const size_t i, const size_t j); +int gsl_histogram2d_get_xrange (const gsl_histogram2d * h, const size_t i, + double * xlower, double * xupper); +int gsl_histogram2d_get_yrange (const gsl_histogram2d * h, const size_t j, + double * ylower, double * yupper); + + +double gsl_histogram2d_xmax (const gsl_histogram2d * h); +double gsl_histogram2d_xmin (const gsl_histogram2d * h); +size_t gsl_histogram2d_nx (const gsl_histogram2d * h); + +double gsl_histogram2d_ymax (const gsl_histogram2d * h); +double gsl_histogram2d_ymin (const gsl_histogram2d * h); +size_t gsl_histogram2d_ny (const gsl_histogram2d * h); + +void gsl_histogram2d_reset (gsl_histogram2d * h); + +gsl_histogram2d * +gsl_histogram2d_calloc_range(size_t nx, size_t ny, + double *xrange, double *yrange); + +int +gsl_histogram2d_set_ranges_uniform (gsl_histogram2d * h, + double xmin, double xmax, + double ymin, double ymax); + +int +gsl_histogram2d_set_ranges (gsl_histogram2d * h, + const double xrange[], size_t xsize, + const double yrange[], size_t ysize); + +int +gsl_histogram2d_memcpy(gsl_histogram2d *dest, const gsl_histogram2d *source); + +gsl_histogram2d * +gsl_histogram2d_clone(const gsl_histogram2d * source); + +double +gsl_histogram2d_max_val(const gsl_histogram2d *h); + +void +gsl_histogram2d_max_bin (const gsl_histogram2d *h, size_t *i, size_t *j); + +double +gsl_histogram2d_min_val(const gsl_histogram2d *h); + +void +gsl_histogram2d_min_bin (const gsl_histogram2d *h, size_t *i, size_t *j); + +double +gsl_histogram2d_xmean (const gsl_histogram2d * h); + +double +gsl_histogram2d_ymean (const gsl_histogram2d * h); + +double +gsl_histogram2d_xsigma (const gsl_histogram2d * h); + +double +gsl_histogram2d_ysigma (const gsl_histogram2d * h); + +double +gsl_histogram2d_cov (const gsl_histogram2d * h); + +double +gsl_histogram2d_sum (const gsl_histogram2d *h); + +int +gsl_histogram2d_equal_bins_p(const gsl_histogram2d *h1, + const gsl_histogram2d *h2) ; + +int +gsl_histogram2d_add(gsl_histogram2d *h1, const gsl_histogram2d *h2); + +int +gsl_histogram2d_sub(gsl_histogram2d *h1, const gsl_histogram2d *h2); + +int +gsl_histogram2d_mul(gsl_histogram2d *h1, const gsl_histogram2d *h2); + +int +gsl_histogram2d_div(gsl_histogram2d *h1, const gsl_histogram2d *h2); + +int +gsl_histogram2d_scale(gsl_histogram2d *h, double scale); + +int +gsl_histogram2d_shift(gsl_histogram2d *h, double shift); + +int gsl_histogram2d_fwrite (FILE * stream, const gsl_histogram2d * h) ; +int gsl_histogram2d_fread (FILE * stream, gsl_histogram2d * h); +int gsl_histogram2d_fprintf (FILE * stream, const gsl_histogram2d * h, + const char * range_format, + const char * bin_format); +int gsl_histogram2d_fscanf (FILE * stream, gsl_histogram2d * h); + +gsl_histogram2d_pdf * gsl_histogram2d_pdf_alloc (const size_t nx, const size_t ny); +int gsl_histogram2d_pdf_init (gsl_histogram2d_pdf * p, const gsl_histogram2d * h); +void gsl_histogram2d_pdf_free (gsl_histogram2d_pdf * p); +int gsl_histogram2d_pdf_sample (const gsl_histogram2d_pdf * p, + double r1, double r2, + double * x, double * y); + +__END_DECLS + +#endif /* __GSL_HISTOGRAM2D_H__ */ + diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_ieee_utils.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_ieee_utils.h new file mode 100644 index 000000000..a96122076 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_ieee_utils.h @@ -0,0 +1,99 @@ +/* ieee-utils/gsl_ieee_utils.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_IEEE_UTILS_H__ +#define __GSL_IEEE_UTILS_H__ +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +enum { + GSL_IEEE_TYPE_NAN = 1, + GSL_IEEE_TYPE_INF = 2, + GSL_IEEE_TYPE_NORMAL = 3, + GSL_IEEE_TYPE_DENORMAL = 4, + GSL_IEEE_TYPE_ZERO = 5 +} ; + +typedef struct { + int sign ; + char mantissa[24] ; /* Actual bits are 0..22, element 23 is \0 */ + int exponent ; + int type ; +} gsl_ieee_float_rep ; + +typedef struct { + int sign ; + char mantissa[53] ; /* Actual bits are 0..51, element 52 is \0 */ + int exponent ; + int type ; +} gsl_ieee_double_rep ; + + +void gsl_ieee_printf_float (const float * x) ; +void gsl_ieee_printf_double (const double * x) ; + +void gsl_ieee_fprintf_float (FILE * stream, const float * x) ; +void gsl_ieee_fprintf_double (FILE * stream, const double * x) ; + +void gsl_ieee_float_to_rep (const float * x, gsl_ieee_float_rep * r) ; +void gsl_ieee_double_to_rep (const double * x, gsl_ieee_double_rep * r) ; + +enum { + GSL_IEEE_SINGLE_PRECISION = 1, + GSL_IEEE_DOUBLE_PRECISION = 2, + GSL_IEEE_EXTENDED_PRECISION = 3 +} ; + +enum { + GSL_IEEE_ROUND_TO_NEAREST = 1, + GSL_IEEE_ROUND_DOWN = 2, + GSL_IEEE_ROUND_UP = 3, + GSL_IEEE_ROUND_TO_ZERO = 4 +} ; + +enum { + GSL_IEEE_MASK_INVALID = 1, + GSL_IEEE_MASK_DENORMALIZED = 2, + GSL_IEEE_MASK_DIVISION_BY_ZERO = 4, + GSL_IEEE_MASK_OVERFLOW = 8, + GSL_IEEE_MASK_UNDERFLOW = 16, + GSL_IEEE_MASK_ALL = 31, + GSL_IEEE_TRAP_INEXACT = 32 +} ; + +void gsl_ieee_env_setup (void) ; +int gsl_ieee_read_mode_string (const char * description, int * precision, + int * rounding, int * exception_mask) ; +int gsl_ieee_set_mode (int precision, int rounding, int exception_mask) ; + +__END_DECLS + +#endif /* __GSL_IEEE_UTILS_H__ */ + diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_inline.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_inline.h new file mode 100644 index 000000000..2172201af --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_inline.h @@ -0,0 +1,67 @@ +/* gsl_inline.h + * + * Copyright (C) 2008, 2009 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_INLINE_H__ +#define __GSL_INLINE_H__ + +/* In recent versiions of GCC, the inline keyword has two different + forms: GNU and C99. + + In GNU mode we can use 'extern inline' to make inline functions + work like macros. The function is only inlined--it is never output + as a definition in an object file. + + In the new C99 mode 'extern inline' has a different meaning--it + causes the definition of the function to be output in each object + file where it is used. This will result in multiple-definition + errors on linking. The 'inline' keyword on its own (without + extern) has the same behavior as the original GNU 'extern inline'. + + The C99 style is the default with -std=c99 in GCC 4.3. + + This header file allows either form of inline to be used by + redefining the macros INLINE_DECL and INLINE_FUN. These are used + in the public header files as + + INLINE_DECL double gsl_foo (double x); + #ifdef HAVE_INLINE + INLINE_FUN double gsl_foo (double x) { return x+1.0; } ; + #endif + +*/ + +#ifdef HAVE_INLINE +# if defined(__GNUC_STDC_INLINE__) || defined(GSL_C99_INLINE) || defined(HAVE_C99_INLINE) +# define INLINE_DECL inline /* use C99 inline */ +# define INLINE_FUN inline +# else +# define INLINE_DECL /* use GNU extern inline */ +# define INLINE_FUN extern inline +# endif +#else +# define INLINE_DECL /* */ +#endif + +/* Range checking conditions in headers do not require any run-time + tests of the global variable gsl_check_range. They are enabled or + disabled in user code at compile time with GSL_RANGE_CHECK macro. + See also build.h. */ +#define GSL_RANGE_COND(x) (x) + +#endif /* __GSL_INLINE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_integration.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_integration.h new file mode 100644 index 000000000..b0c1b0286 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_integration.h @@ -0,0 +1,390 @@ +/* integration/gsl_integration.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_INTEGRATION_H__ +#define __GSL_INTEGRATION_H__ +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* Workspace for adaptive integrators */ + +typedef struct + { + size_t limit; + size_t size; + size_t nrmax; + size_t i; + size_t maximum_level; + double *alist; + double *blist; + double *rlist; + double *elist; + size_t *order; + size_t *level; + } +gsl_integration_workspace; + +gsl_integration_workspace * + gsl_integration_workspace_alloc (const size_t n); + +void + gsl_integration_workspace_free (gsl_integration_workspace * w); + + +/* Workspace for QAWS integrator */ + +typedef struct +{ + double alpha; + double beta; + int mu; + int nu; + double ri[25]; + double rj[25]; + double rg[25]; + double rh[25]; +} +gsl_integration_qaws_table; + +gsl_integration_qaws_table * +gsl_integration_qaws_table_alloc (double alpha, double beta, int mu, int nu); + +int +gsl_integration_qaws_table_set (gsl_integration_qaws_table * t, + double alpha, double beta, int mu, int nu); + +void +gsl_integration_qaws_table_free (gsl_integration_qaws_table * t); + +/* Workspace for QAWO integrator */ + +enum gsl_integration_qawo_enum { GSL_INTEG_COSINE, GSL_INTEG_SINE }; + +typedef struct +{ + size_t n; + double omega; + double L; + double par; + enum gsl_integration_qawo_enum sine; + double *chebmo; +} +gsl_integration_qawo_table; + +gsl_integration_qawo_table * +gsl_integration_qawo_table_alloc (double omega, double L, + enum gsl_integration_qawo_enum sine, + size_t n); + +int +gsl_integration_qawo_table_set (gsl_integration_qawo_table * t, + double omega, double L, + enum gsl_integration_qawo_enum sine); + +int +gsl_integration_qawo_table_set_length (gsl_integration_qawo_table * t, + double L); + +void +gsl_integration_qawo_table_free (gsl_integration_qawo_table * t); + + +/* Definition of an integration rule */ + +typedef void gsl_integration_rule (const gsl_function * f, + double a, double b, + double *result, double *abserr, + double *defabs, double *resabs); + +void gsl_integration_qk15 (const gsl_function * f, double a, double b, + double *result, double *abserr, + double *resabs, double *resasc); + +void gsl_integration_qk21 (const gsl_function * f, double a, double b, + double *result, double *abserr, + double *resabs, double *resasc); + +void gsl_integration_qk31 (const gsl_function * f, double a, double b, + double *result, double *abserr, + double *resabs, double *resasc); + +void gsl_integration_qk41 (const gsl_function * f, double a, double b, + double *result, double *abserr, + double *resabs, double *resasc); + +void gsl_integration_qk51 (const gsl_function * f, double a, double b, + double *result, double *abserr, + double *resabs, double *resasc); + +void gsl_integration_qk61 (const gsl_function * f, double a, double b, + double *result, double *abserr, + double *resabs, double *resasc); + +void gsl_integration_qcheb (gsl_function * f, double a, double b, + double *cheb12, double *cheb24); + +/* The low-level integration rules in QUADPACK are identified by small + integers (1-6). We'll use symbolic constants to refer to them. */ + +enum + { + GSL_INTEG_GAUSS15 = 1, /* 15 point Gauss-Kronrod rule */ + GSL_INTEG_GAUSS21 = 2, /* 21 point Gauss-Kronrod rule */ + GSL_INTEG_GAUSS31 = 3, /* 31 point Gauss-Kronrod rule */ + GSL_INTEG_GAUSS41 = 4, /* 41 point Gauss-Kronrod rule */ + GSL_INTEG_GAUSS51 = 5, /* 51 point Gauss-Kronrod rule */ + GSL_INTEG_GAUSS61 = 6 /* 61 point Gauss-Kronrod rule */ + }; + +void +gsl_integration_qk (const int n, const double xgk[], + const double wg[], const double wgk[], + double fv1[], double fv2[], + const gsl_function *f, double a, double b, + double * result, double * abserr, + double * resabs, double * resasc); + + +int gsl_integration_qng (const gsl_function * f, + double a, double b, + double epsabs, double epsrel, + double *result, double *abserr, + size_t * neval); + +int gsl_integration_qag (const gsl_function * f, + double a, double b, + double epsabs, double epsrel, size_t limit, + int key, + gsl_integration_workspace * workspace, + double *result, double *abserr); + +int gsl_integration_qagi (gsl_function * f, + double epsabs, double epsrel, size_t limit, + gsl_integration_workspace * workspace, + double *result, double *abserr); + +int gsl_integration_qagiu (gsl_function * f, + double a, + double epsabs, double epsrel, size_t limit, + gsl_integration_workspace * workspace, + double *result, double *abserr); + +int gsl_integration_qagil (gsl_function * f, + double b, + double epsabs, double epsrel, size_t limit, + gsl_integration_workspace * workspace, + double *result, double *abserr); + + +int gsl_integration_qags (const gsl_function * f, + double a, double b, + double epsabs, double epsrel, size_t limit, + gsl_integration_workspace * workspace, + double *result, double *abserr); + +int gsl_integration_qagp (const gsl_function * f, + double *pts, size_t npts, + double epsabs, double epsrel, size_t limit, + gsl_integration_workspace * workspace, + double *result, double *abserr); + +int gsl_integration_qawc (gsl_function *f, + const double a, const double b, const double c, + const double epsabs, const double epsrel, const size_t limit, + gsl_integration_workspace * workspace, + double * result, double * abserr); + +int gsl_integration_qaws (gsl_function * f, + const double a, const double b, + gsl_integration_qaws_table * t, + const double epsabs, const double epsrel, + const size_t limit, + gsl_integration_workspace * workspace, + double *result, double *abserr); + +int gsl_integration_qawo (gsl_function * f, + const double a, + const double epsabs, const double epsrel, + const size_t limit, + gsl_integration_workspace * workspace, + gsl_integration_qawo_table * wf, + double *result, double *abserr); + +int gsl_integration_qawf (gsl_function * f, + const double a, + const double epsabs, + const size_t limit, + gsl_integration_workspace * workspace, + gsl_integration_workspace * cycle_workspace, + gsl_integration_qawo_table * wf, + double *result, double *abserr); + +/* Workspace for fixed-order Gauss-Legendre integration */ + +typedef struct + { + size_t n; /* number of points */ + double *x; /* Gauss abscissae/points */ + double *w; /* Gauss weights for each abscissae */ + int precomputed; /* high precision abscissae/weights precomputed? */ + } +gsl_integration_glfixed_table; + + +gsl_integration_glfixed_table * gsl_integration_glfixed_table_alloc (size_t n); + +void gsl_integration_glfixed_table_free (gsl_integration_glfixed_table * t); + +/* Routine for fixed-order Gauss-Legendre integration */ + +double gsl_integration_glfixed (const gsl_function *f, + double a, + double b, + const gsl_integration_glfixed_table * t); + +/* Routine to retrieve the i-th Gauss-Legendre point and weight from t */ + +int gsl_integration_glfixed_point (double a, + double b, + size_t i, + double *xi, + double *wi, + const gsl_integration_glfixed_table * t); + + +/* Cquad integration - Pedro Gonnet */ + +/* Data of a single interval */ +typedef struct +{ + double a, b; + double c[64]; + double fx[33]; + double igral, err; + int depth, rdepth, ndiv; +} gsl_integration_cquad_ival; + + +/* The workspace is just a collection of intervals */ +typedef struct +{ + size_t size; + gsl_integration_cquad_ival *ivals; + size_t *heap; +} gsl_integration_cquad_workspace; + +gsl_integration_cquad_workspace * +gsl_integration_cquad_workspace_alloc (const size_t n); + +void +gsl_integration_cquad_workspace_free (gsl_integration_cquad_workspace * w); + +int +gsl_integration_cquad (const gsl_function * f, double a, double b, + double epsabs, double epsrel, + gsl_integration_cquad_workspace * ws, + double *result, double *abserr, size_t * nevals); + +/* Romberg integration workspace and routines */ + +typedef struct +{ + size_t n; /* maximum number of steps */ + double *work1; /* workspace for a row of R matrix, size n */ + double *work2; /* workspace for a row of R matrix, size n */ +} gsl_integration_romberg_workspace; + +gsl_integration_romberg_workspace *gsl_integration_romberg_alloc(const size_t n); +void gsl_integration_romberg_free(gsl_integration_romberg_workspace * w); +int gsl_integration_romberg(const gsl_function * f, const double a, const double b, + const double epsabs, const double epsrel, double * result, + size_t * neval, gsl_integration_romberg_workspace * w); + +/* IQPACK related structures and routines */ + +typedef struct +{ + double alpha; + double beta; + double a; + double b; + double zemu; + double shft; + double slp; + double al; + double be; +} gsl_integration_fixed_params; + +typedef struct +{ + int (*check)(const size_t n, const gsl_integration_fixed_params * params); + int (*init)(const size_t n, double * diag, double * subdiag, gsl_integration_fixed_params * params); +} gsl_integration_fixed_type; + +typedef struct +{ + size_t n; /* number of nodes/weights */ + double *weights; /* quadrature weights */ + double *x; /* quadrature nodes */ + double *diag; /* diagonal of Jacobi matrix */ + double *subdiag; /* subdiagonal of Jacobi matrix */ + const gsl_integration_fixed_type * type; +} gsl_integration_fixed_workspace; + +/* IQPACK integral types */ +GSL_VAR const gsl_integration_fixed_type * gsl_integration_fixed_legendre; +GSL_VAR const gsl_integration_fixed_type * gsl_integration_fixed_chebyshev; +GSL_VAR const gsl_integration_fixed_type * gsl_integration_fixed_gegenbauer; +GSL_VAR const gsl_integration_fixed_type * gsl_integration_fixed_jacobi; +GSL_VAR const gsl_integration_fixed_type * gsl_integration_fixed_laguerre; +GSL_VAR const gsl_integration_fixed_type * gsl_integration_fixed_hermite; +GSL_VAR const gsl_integration_fixed_type * gsl_integration_fixed_exponential; +GSL_VAR const gsl_integration_fixed_type * gsl_integration_fixed_rational; +GSL_VAR const gsl_integration_fixed_type * gsl_integration_fixed_chebyshev2; + +gsl_integration_fixed_workspace * +gsl_integration_fixed_alloc(const gsl_integration_fixed_type * type, const size_t n, + const double a, const double b, const double alpha, const double beta); + +void gsl_integration_fixed_free(gsl_integration_fixed_workspace * w); + +size_t gsl_integration_fixed_n(const gsl_integration_fixed_workspace * w); + +double *gsl_integration_fixed_nodes(const gsl_integration_fixed_workspace * w); + +double *gsl_integration_fixed_weights(const gsl_integration_fixed_workspace * w); + +int gsl_integration_fixed(const gsl_function * func, double * result, + const gsl_integration_fixed_workspace * w); + +__END_DECLS + +#endif /* __GSL_INTEGRATION_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_interp.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_interp.h new file mode 100644 index 000000000..8321224a5 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_interp.h @@ -0,0 +1,225 @@ +/* interpolation/gsl_interp.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman + */ +#ifndef __GSL_INTERP_H__ +#define __GSL_INTERP_H__ +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* evaluation accelerator */ +typedef struct { + size_t cache; /* cache of index */ + size_t miss_count; /* keep statistics */ + size_t hit_count; +} +gsl_interp_accel; + + +/* interpolation object type */ +typedef struct { + const char * name; + unsigned int min_size; + void * (*alloc) (size_t size); + int (*init) (void *, const double xa[], const double ya[], size_t size); + int (*eval) (const void *, const double xa[], const double ya[], size_t size, double x, gsl_interp_accel *, double * y); + int (*eval_deriv) (const void *, const double xa[], const double ya[], size_t size, double x, gsl_interp_accel *, double * y_p); + int (*eval_deriv2) (const void *, const double xa[], const double ya[], size_t size, double x, gsl_interp_accel *, double * y_pp); + int (*eval_integ) (const void *, const double xa[], const double ya[], size_t size, gsl_interp_accel *, double a, double b, double * result); + void (*free) (void *); + +} gsl_interp_type; + + +/* general interpolation object */ +typedef struct { + const gsl_interp_type * type; + double xmin; + double xmax; + size_t size; + void * state; +} gsl_interp; + + +/* available types */ +GSL_VAR const gsl_interp_type * gsl_interp_linear; +GSL_VAR const gsl_interp_type * gsl_interp_polynomial; +GSL_VAR const gsl_interp_type * gsl_interp_cspline; +GSL_VAR const gsl_interp_type * gsl_interp_cspline_periodic; +GSL_VAR const gsl_interp_type * gsl_interp_akima; +GSL_VAR const gsl_interp_type * gsl_interp_akima_periodic; +GSL_VAR const gsl_interp_type * gsl_interp_steffen; + +gsl_interp_accel * +gsl_interp_accel_alloc(void); + +int +gsl_interp_accel_reset (gsl_interp_accel * a); + +void +gsl_interp_accel_free(gsl_interp_accel * a); + +gsl_interp * +gsl_interp_alloc(const gsl_interp_type * T, size_t n); + +int +gsl_interp_init(gsl_interp * obj, const double xa[], const double ya[], size_t size); + +const char * gsl_interp_name(const gsl_interp * interp); +unsigned int gsl_interp_min_size(const gsl_interp * interp); +unsigned int gsl_interp_type_min_size(const gsl_interp_type * T); + + +int +gsl_interp_eval_e(const gsl_interp * obj, + const double xa[], const double ya[], double x, + gsl_interp_accel * a, double * y); + +double +gsl_interp_eval(const gsl_interp * obj, + const double xa[], const double ya[], double x, + gsl_interp_accel * a); + +int +gsl_interp_eval_deriv_e(const gsl_interp * obj, + const double xa[], const double ya[], double x, + gsl_interp_accel * a, + double * d); + +double +gsl_interp_eval_deriv(const gsl_interp * obj, + const double xa[], const double ya[], double x, + gsl_interp_accel * a); + +int +gsl_interp_eval_deriv2_e(const gsl_interp * obj, + const double xa[], const double ya[], double x, + gsl_interp_accel * a, + double * d2); + +double +gsl_interp_eval_deriv2(const gsl_interp * obj, + const double xa[], const double ya[], double x, + gsl_interp_accel * a); + +int +gsl_interp_eval_integ_e(const gsl_interp * obj, + const double xa[], const double ya[], + double a, double b, + gsl_interp_accel * acc, + double * result); + +double +gsl_interp_eval_integ(const gsl_interp * obj, + const double xa[], const double ya[], + double a, double b, + gsl_interp_accel * acc); + +void +gsl_interp_free(gsl_interp * interp); + +INLINE_DECL size_t +gsl_interp_bsearch(const double x_array[], double x, + size_t index_lo, size_t index_hi); + +#ifdef HAVE_INLINE + +/* Perform a binary search of an array of values. + * + * The parameters index_lo and index_hi provide an initial bracket, + * and it is assumed that index_lo < index_hi. The resulting index + * is guaranteed to be strictly less than index_hi and greater than + * or equal to index_lo, so that the implicit bracket [index, index+1] + * always corresponds to a region within the implicit value range of + * the value array. + * + * Note that this means the relationship of 'x' to x_array[index] + * and x_array[index+1] depends on the result region, i.e. the + * behaviour at the boundaries may not correspond to what you + * expect. We have the following complete specification of the + * behaviour. + * Suppose the input is x_array[] = { x0, x1, ..., xN } + * if ( x == x0 ) then index == 0 + * if ( x > x0 && x <= x1 ) then index == 0, and sim. for other interior pts + * if ( x == xN ) then index == N-1 + * if ( x > xN ) then index == N-1 + * if ( x < x0 ) then index == 0 + */ + +INLINE_FUN size_t +gsl_interp_bsearch(const double x_array[], double x, + size_t index_lo, size_t index_hi) +{ + size_t ilo = index_lo; + size_t ihi = index_hi; + while(ihi > ilo + 1) { + size_t i = (ihi + ilo)/2; + if(x_array[i] > x) + ihi = i; + else + ilo = i; + } + + return ilo; +} +#endif + +INLINE_DECL size_t +gsl_interp_accel_find(gsl_interp_accel * a, const double x_array[], size_t size, double x); + +#ifdef HAVE_INLINE +INLINE_FUN size_t +gsl_interp_accel_find(gsl_interp_accel * a, const double xa[], size_t len, double x) +{ + size_t x_index = a->cache; + + if(x < xa[x_index]) { + a->miss_count++; + a->cache = gsl_interp_bsearch(xa, x, 0, x_index); + } + else if(x >= xa[x_index + 1]) { + a->miss_count++; + a->cache = gsl_interp_bsearch(xa, x, x_index, len-1); + } + else { + a->hit_count++; + } + + return a->cache; +} +#endif /* HAVE_INLINE */ + + +__END_DECLS + +#endif /* __GSL_INTERP_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_interp2d.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_interp2d.h new file mode 100644 index 000000000..e105fa31d --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_interp2d.h @@ -0,0 +1,160 @@ +/* interpolation/gsl_interp2d.h + * + * Copyright 2012 David Zaslavsky + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_INTERP2D_H__ +#define __GSL_INTERP2D_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct { + const char* name; + unsigned int min_size; + void * (*alloc)(size_t xsize, size_t ysize); + int (*init)(void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize); + int (*eval)(const void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize, double x, double y, gsl_interp_accel*, gsl_interp_accel*, double* z); + int (*eval_deriv_x) (const void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize, double x, double y, gsl_interp_accel*, gsl_interp_accel*, double* z_p); + int (*eval_deriv_y) (const void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize, double x, double y, gsl_interp_accel*, gsl_interp_accel*, double* z_p); + int (*eval_deriv_xx) (const void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize, double x, double y, gsl_interp_accel*, gsl_interp_accel*, double* z_pp); + int (*eval_deriv_xy) (const void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize, double x, double y, gsl_interp_accel*, gsl_interp_accel*, double* z_pp); + int (*eval_deriv_yy) (const void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize, double x, double y, gsl_interp_accel*, gsl_interp_accel*, double* z_pp); + void (*free)(void *); +} gsl_interp2d_type; + +typedef struct { + const gsl_interp2d_type * type; /* interpolation type */ + double xmin; /* minimum value of x for which data have been provided */ + double xmax; /* maximum value of x for which data have been provided */ + double ymin; /* minimum value of y for which data have been provided */ + double ymax; /* maximum value of y for which data have been provided */ + size_t xsize; /* number of x values provided */ + size_t ysize; /* number of y values provided */ + void * state; /* internal state object specific to the interpolation type */ +} gsl_interp2d; + +/* available types */ +GSL_VAR const gsl_interp2d_type * gsl_interp2d_bilinear; +GSL_VAR const gsl_interp2d_type * gsl_interp2d_bicubic; + +gsl_interp2d * gsl_interp2d_alloc(const gsl_interp2d_type * T, const size_t xsize, + const size_t ysize); + +const char * gsl_interp2d_name(const gsl_interp2d * interp); +size_t gsl_interp2d_min_size(const gsl_interp2d * interp); +size_t gsl_interp2d_type_min_size(const gsl_interp2d_type * T); +int gsl_interp2d_set(const gsl_interp2d * interp, double zarr[], + const size_t i, const size_t j, const double z); +double gsl_interp2d_get(const gsl_interp2d * interp, const double zarr[], + const size_t i, const size_t j); +size_t gsl_interp2d_idx(const gsl_interp2d * interp, + const size_t i, const size_t j); +int gsl_interp2d_init(gsl_interp2d * interp, const double xa[], const double ya[], + const double za[], const size_t xsize, const size_t ysize); +void gsl_interp2d_free(gsl_interp2d * interp); + +double gsl_interp2d_eval(const gsl_interp2d * interp, const double xarr[], + const double yarr[], const double zarr[], const double x, + const double y, gsl_interp_accel * xa, gsl_interp_accel * ya); + +double gsl_interp2d_eval_extrap(const gsl_interp2d * interp, + const double xarr[], const double yarr[], + const double zarr[], const double x, + const double y, gsl_interp_accel * xa, + gsl_interp_accel * ya); + +int gsl_interp2d_eval_e(const gsl_interp2d * interp, const double xarr[], + const double yarr[], const double zarr[], + const double x, const double y, gsl_interp_accel* xa, + gsl_interp_accel* ya, double * z); + +int gsl_interp2d_eval_e_extrap(const gsl_interp2d * interp, + const double xarr[], + const double yarr[], + const double zarr[], + const double x, + const double y, + gsl_interp_accel * xa, + gsl_interp_accel * ya, + double * z); + +double gsl_interp2d_eval_deriv_x(const gsl_interp2d * interp, const double xarr[], + const double yarr[], const double zarr[], + const double x, const double y, gsl_interp_accel * xa, + gsl_interp_accel * ya); + +int gsl_interp2d_eval_deriv_x_e(const gsl_interp2d * interp, const double xarr[], + const double yarr[], const double zarr[], + const double x, const double y, + gsl_interp_accel * xa, gsl_interp_accel * ya, double * z); + +double gsl_interp2d_eval_deriv_y(const gsl_interp2d * interp, const double xarr[], + const double yarr[], const double zarr[], + const double x, const double y, + gsl_interp_accel* xa, gsl_interp_accel* ya); + +int gsl_interp2d_eval_deriv_y_e(const gsl_interp2d * interp, const double xarr[], + const double yarr[], const double zarr[], + const double x, const double y, + gsl_interp_accel * xa, gsl_interp_accel * ya, double * z); + +double gsl_interp2d_eval_deriv_xx(const gsl_interp2d * interp, const double xarr[], + const double yarr[], const double zarr[], + const double x, const double y, + gsl_interp_accel * xa, gsl_interp_accel * ya); + +int gsl_interp2d_eval_deriv_xx_e(const gsl_interp2d * interp, const double xarr[], + const double yarr[], const double zarr[], + const double x, const double y, + gsl_interp_accel * xa, gsl_interp_accel * ya, double * z); + +double gsl_interp2d_eval_deriv_yy(const gsl_interp2d * interp, const double xarr[], + const double yarr[], const double zarr[], + const double x, const double y, + gsl_interp_accel * xa, gsl_interp_accel * ya); + +int gsl_interp2d_eval_deriv_yy_e(const gsl_interp2d * interp, const double xarr[], + const double yarr[], const double zarr[], + const double x, const double y, + gsl_interp_accel * xa, gsl_interp_accel * ya, double * z); + +double gsl_interp2d_eval_deriv_xy(const gsl_interp2d * interp, const double xarr[], + const double yarr[], const double zarr[], + const double x, const double y, + gsl_interp_accel * xa, gsl_interp_accel * ya); + +int gsl_interp2d_eval_deriv_xy_e(const gsl_interp2d * interp, const double xarr[], + const double yarr[], const double zarr[], + const double x, const double y, + gsl_interp_accel * xa, gsl_interp_accel * ya, double * z); + + +__END_DECLS + +#endif /* __GSL_INTERP2D_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_linalg.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_linalg.h new file mode 100644 index 000000000..8112f2177 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_linalg.h @@ -0,0 +1,780 @@ +/* linalg/gsl_linalg.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2006, 2007 Gerard Jungman, Brian Gough, Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_LINALG_H__ +#define __GSL_LINALG_H__ + +#include +#include +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS } +#else +#define __BEGIN_DECLS /* empty */ +#define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef enum + { + GSL_LINALG_MOD_NONE = 0, + GSL_LINALG_MOD_TRANSPOSE = 1, + GSL_LINALG_MOD_CONJUGATE = 2 + } +gsl_linalg_matrix_mod_t; + + +/* Note: You can now use the gsl_blas_dgemm function instead of matmult */ + +/* Simple implementation of matrix multiply. + * Calculates C = A.B + * + * exceptions: GSL_EBADLEN + */ +int gsl_linalg_matmult (const gsl_matrix * A, + const gsl_matrix * B, + gsl_matrix * C); + + +/* Simple implementation of matrix multiply. + * Allows transposition of either matrix, so it + * can compute A.B or Trans(A).B or A.Trans(B) or Trans(A).Trans(B) + * + * exceptions: GSL_EBADLEN + */ +int gsl_linalg_matmult_mod (const gsl_matrix * A, + gsl_linalg_matrix_mod_t modA, + const gsl_matrix * B, + gsl_linalg_matrix_mod_t modB, + gsl_matrix * C); + +/* Calculate the matrix exponential by the scaling and + * squaring method described in Moler + Van Loan, + * SIAM Rev 20, 801 (1978). The mode argument allows + * choosing an optimal strategy, from the table + * given in the paper, for a given precision. + * + * exceptions: GSL_ENOTSQR, GSL_EBADLEN + */ +int gsl_linalg_exponential_ss( + const gsl_matrix * A, + gsl_matrix * eA, + gsl_mode_t mode + ); + + +/* Householder Transformations */ + +double gsl_linalg_householder_transform (gsl_vector * v); +gsl_complex gsl_linalg_complex_householder_transform (gsl_vector_complex * v); + +int gsl_linalg_householder_hm (double tau, + const gsl_vector * v, + gsl_matrix * A); + +int gsl_linalg_householder_mh (double tau, + const gsl_vector * v, + gsl_matrix * A); + +int gsl_linalg_householder_hv (double tau, + const gsl_vector * v, + gsl_vector * w); + +int gsl_linalg_householder_hm1 (double tau, + gsl_matrix * A); + +int gsl_linalg_complex_householder_hm (gsl_complex tau, + const gsl_vector_complex * v, + gsl_matrix_complex * A); + +int gsl_linalg_complex_householder_mh (gsl_complex tau, + const gsl_vector_complex * v, + gsl_matrix_complex * A); + +int gsl_linalg_complex_householder_hv (gsl_complex tau, + const gsl_vector_complex * v, + gsl_vector_complex * w); + +/* Hessenberg reduction */ + +int gsl_linalg_hessenberg_decomp(gsl_matrix *A, gsl_vector *tau); +int gsl_linalg_hessenberg_unpack(gsl_matrix * H, gsl_vector * tau, + gsl_matrix * U); +int gsl_linalg_hessenberg_unpack_accum(gsl_matrix * H, gsl_vector * tau, + gsl_matrix * U); +int gsl_linalg_hessenberg_set_zero(gsl_matrix * H); +int gsl_linalg_hessenberg_submatrix(gsl_matrix *M, gsl_matrix *A, + size_t top, gsl_vector *tau); + +/* Hessenberg-Triangular reduction */ + +int gsl_linalg_hesstri_decomp(gsl_matrix * A, gsl_matrix * B, + gsl_matrix * U, gsl_matrix * V, + gsl_vector * work); + +/* Singular Value Decomposition + + * exceptions: + */ + +int +gsl_linalg_SV_decomp (gsl_matrix * A, + gsl_matrix * V, + gsl_vector * S, + gsl_vector * work); + +int +gsl_linalg_SV_decomp_mod (gsl_matrix * A, + gsl_matrix * X, + gsl_matrix * V, + gsl_vector * S, + gsl_vector * work); + +int gsl_linalg_SV_decomp_jacobi (gsl_matrix * A, + gsl_matrix * Q, + gsl_vector * S); + +int +gsl_linalg_SV_solve (const gsl_matrix * U, + const gsl_matrix * Q, + const gsl_vector * S, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_SV_leverage(const gsl_matrix *U, gsl_vector *h); + + +/* LU Decomposition, Gaussian elimination with partial pivoting + */ + +int gsl_linalg_LU_decomp (gsl_matrix * A, gsl_permutation * p, int *signum); + +int gsl_linalg_LU_solve (const gsl_matrix * LU, + const gsl_permutation * p, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_LU_svx (const gsl_matrix * LU, + const gsl_permutation * p, + gsl_vector * x); + +int gsl_linalg_LU_refine (const gsl_matrix * A, + const gsl_matrix * LU, + const gsl_permutation * p, + const gsl_vector * b, + gsl_vector * x, + gsl_vector * work); + +int gsl_linalg_LU_invert (const gsl_matrix * LU, + const gsl_permutation * p, + gsl_matrix * inverse); + +double gsl_linalg_LU_det (gsl_matrix * LU, int signum); +double gsl_linalg_LU_lndet (gsl_matrix * LU); +int gsl_linalg_LU_sgndet (gsl_matrix * lu, int signum); + +/* Complex LU Decomposition */ + +int gsl_linalg_complex_LU_decomp (gsl_matrix_complex * A, + gsl_permutation * p, + int *signum); + +int gsl_linalg_complex_LU_solve (const gsl_matrix_complex * LU, + const gsl_permutation * p, + const gsl_vector_complex * b, + gsl_vector_complex * x); + +int gsl_linalg_complex_LU_svx (const gsl_matrix_complex * LU, + const gsl_permutation * p, + gsl_vector_complex * x); + +int gsl_linalg_complex_LU_refine (const gsl_matrix_complex * A, + const gsl_matrix_complex * LU, + const gsl_permutation * p, + const gsl_vector_complex * b, + gsl_vector_complex * x, + gsl_vector_complex * work); + +int gsl_linalg_complex_LU_invert (const gsl_matrix_complex * LU, + const gsl_permutation * p, + gsl_matrix_complex * inverse); + +gsl_complex gsl_linalg_complex_LU_det (gsl_matrix_complex * LU, + int signum); + +double gsl_linalg_complex_LU_lndet (gsl_matrix_complex * LU); + +gsl_complex gsl_linalg_complex_LU_sgndet (gsl_matrix_complex * LU, + int signum); + +/* QR decomposition */ + +int gsl_linalg_QR_decomp (gsl_matrix * A, + gsl_vector * tau); + +int gsl_linalg_QR_solve (const gsl_matrix * QR, + const gsl_vector * tau, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_QR_svx (const gsl_matrix * QR, + const gsl_vector * tau, + gsl_vector * x); + +int gsl_linalg_QR_lssolve (const gsl_matrix * QR, + const gsl_vector * tau, + const gsl_vector * b, + gsl_vector * x, + gsl_vector * residual); + + +int gsl_linalg_QR_QRsolve (gsl_matrix * Q, + gsl_matrix * R, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_QR_Rsolve (const gsl_matrix * QR, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_QR_Rsvx (const gsl_matrix * QR, + gsl_vector * x); + +int gsl_linalg_QR_update (gsl_matrix * Q, + gsl_matrix * R, + gsl_vector * w, + const gsl_vector * v); + +int gsl_linalg_QR_QTvec (const gsl_matrix * QR, + const gsl_vector * tau, + gsl_vector * v); + +int gsl_linalg_QR_Qvec (const gsl_matrix * QR, + const gsl_vector * tau, + gsl_vector * v); + +int gsl_linalg_QR_QTmat (const gsl_matrix * QR, + const gsl_vector * tau, + gsl_matrix * A); + +int gsl_linalg_QR_matQ (const gsl_matrix * QR, + const gsl_vector * tau, + gsl_matrix * A); + +int gsl_linalg_QR_unpack (const gsl_matrix * QR, + const gsl_vector * tau, + gsl_matrix * Q, + gsl_matrix * R); + +int gsl_linalg_R_solve (const gsl_matrix * R, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_R_svx (const gsl_matrix * R, + gsl_vector * x); + + +/* Q R P^T decomposition */ + +int gsl_linalg_QRPT_decomp (gsl_matrix * A, + gsl_vector * tau, + gsl_permutation * p, + int *signum, + gsl_vector * norm); + +int gsl_linalg_QRPT_decomp2 (const gsl_matrix * A, + gsl_matrix * q, gsl_matrix * r, + gsl_vector * tau, + gsl_permutation * p, + int *signum, + gsl_vector * norm); + +int gsl_linalg_QRPT_solve (const gsl_matrix * QR, + const gsl_vector * tau, + const gsl_permutation * p, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_QRPT_lssolve (const gsl_matrix * QR, + const gsl_vector * tau, + const gsl_permutation * p, + const gsl_vector * b, + gsl_vector * x, + gsl_vector * residual); + +int gsl_linalg_QRPT_lssolve2 (const gsl_matrix * QR, + const gsl_vector * tau, + const gsl_permutation * p, + const gsl_vector * b, + const size_t rank, + gsl_vector * x, + gsl_vector * residual); + +int gsl_linalg_QRPT_svx (const gsl_matrix * QR, + const gsl_vector * tau, + const gsl_permutation * p, + gsl_vector * x); + +int gsl_linalg_QRPT_QRsolve (const gsl_matrix * Q, + const gsl_matrix * R, + const gsl_permutation * p, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_QRPT_Rsolve (const gsl_matrix * QR, + const gsl_permutation * p, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_QRPT_Rsvx (const gsl_matrix * QR, + const gsl_permutation * p, + gsl_vector * x); + +int gsl_linalg_QRPT_update (gsl_matrix * Q, + gsl_matrix * R, + const gsl_permutation * p, + gsl_vector * u, + const gsl_vector * v); + +size_t gsl_linalg_QRPT_rank (const gsl_matrix * QR, const double tol); + +int gsl_linalg_QRPT_rcond(const gsl_matrix * QR, double * rcond, gsl_vector * work); + +/* COD decomposition */ + +int gsl_linalg_COD_decomp(gsl_matrix * A, gsl_vector * tau_Q, gsl_vector * tau_Z, + gsl_permutation * p, size_t * rank, gsl_vector * work); + +int gsl_linalg_COD_decomp_e(gsl_matrix * A, gsl_vector * tau_Q, gsl_vector * tau_Z, + gsl_permutation * p, double tol, size_t * rank, gsl_vector * work); + +int gsl_linalg_COD_lssolve (const gsl_matrix * QRZT, const gsl_vector * tau_Q, const gsl_vector * tau_Z, + const gsl_permutation * perm, const size_t rank, const gsl_vector * b, + gsl_vector * x, gsl_vector * residual); + +int +gsl_linalg_COD_lssolve2 (const double lambda, const gsl_matrix * QRZT, const gsl_vector * tau_Q, const gsl_vector * tau_Z, + const gsl_permutation * perm, const size_t rank, const gsl_vector * b, + gsl_vector * x, gsl_vector * residual, gsl_matrix * S, gsl_vector * work); + +int gsl_linalg_COD_unpack(const gsl_matrix * QRZT, const gsl_vector * tau_Q, + const gsl_vector * tau_Z, const size_t rank, gsl_matrix * Q, + gsl_matrix * R, gsl_matrix * Z); + +int gsl_linalg_COD_matZ(const gsl_matrix * QRZT, const gsl_vector * tau_Z, const size_t rank, + gsl_matrix * A, gsl_vector * work); + +/* LQ decomposition */ + +int gsl_linalg_LQ_decomp (gsl_matrix * A, gsl_vector * tau); + +int gsl_linalg_LQ_solve_T (const gsl_matrix * LQ, const gsl_vector * tau, + const gsl_vector * b, gsl_vector * x); + +int gsl_linalg_LQ_svx_T (const gsl_matrix * LQ, const gsl_vector * tau, + gsl_vector * x); + +int gsl_linalg_LQ_lssolve_T (const gsl_matrix * LQ, const gsl_vector * tau, + const gsl_vector * b, gsl_vector * x, + gsl_vector * residual); + +int gsl_linalg_LQ_Lsolve_T (const gsl_matrix * LQ, const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_LQ_Lsvx_T (const gsl_matrix * LQ, gsl_vector * x); + +int gsl_linalg_L_solve_T (const gsl_matrix * L, const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_LQ_vecQ (const gsl_matrix * LQ, const gsl_vector * tau, + gsl_vector * v); + +int gsl_linalg_LQ_vecQT (const gsl_matrix * LQ, const gsl_vector * tau, + gsl_vector * v); + +int gsl_linalg_LQ_unpack (const gsl_matrix * LQ, const gsl_vector * tau, + gsl_matrix * Q, gsl_matrix * L); + +int gsl_linalg_LQ_update (gsl_matrix * Q, gsl_matrix * R, + const gsl_vector * v, gsl_vector * w); +int gsl_linalg_LQ_LQsolve (gsl_matrix * Q, gsl_matrix * L, + const gsl_vector * b, gsl_vector * x); + +/* P^T L Q decomposition */ + +int gsl_linalg_PTLQ_decomp (gsl_matrix * A, gsl_vector * tau, + gsl_permutation * p, int *signum, + gsl_vector * norm); + +int gsl_linalg_PTLQ_decomp2 (const gsl_matrix * A, gsl_matrix * q, + gsl_matrix * r, gsl_vector * tau, + gsl_permutation * p, int *signum, + gsl_vector * norm); + +int gsl_linalg_PTLQ_solve_T (const gsl_matrix * QR, + const gsl_vector * tau, + const gsl_permutation * p, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_PTLQ_svx_T (const gsl_matrix * LQ, + const gsl_vector * tau, + const gsl_permutation * p, + gsl_vector * x); + +int gsl_linalg_PTLQ_LQsolve_T (const gsl_matrix * Q, const gsl_matrix * L, + const gsl_permutation * p, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_PTLQ_Lsolve_T (const gsl_matrix * LQ, + const gsl_permutation * p, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_PTLQ_Lsvx_T (const gsl_matrix * LQ, + const gsl_permutation * p, + gsl_vector * x); + +int gsl_linalg_PTLQ_update (gsl_matrix * Q, gsl_matrix * L, + const gsl_permutation * p, + const gsl_vector * v, gsl_vector * w); + +/* Cholesky Decomposition */ + +int gsl_linalg_cholesky_decomp (gsl_matrix * A); +int gsl_linalg_cholesky_decomp1 (gsl_matrix * A); + +int gsl_linalg_cholesky_solve (const gsl_matrix * cholesky, + const gsl_vector * b, + gsl_vector * x); +int gsl_linalg_cholesky_solve_mat (const gsl_matrix * cholesky, + const gsl_matrix * B, + gsl_matrix * X); + +int gsl_linalg_cholesky_svx (const gsl_matrix * cholesky, + gsl_vector * x); +int gsl_linalg_cholesky_svx_mat (const gsl_matrix * cholesky, + gsl_matrix * X); + +int gsl_linalg_cholesky_invert(gsl_matrix * cholesky); + +/* Cholesky decomposition with unit-diagonal triangular parts. + * A = L D L^T, where diag(L) = (1,1,...,1). + * Upon exit, A contains L and L^T as for Cholesky, and + * the diagonal of A is (1,1,...,1). The vector Dis set + * to the diagonal elements of the diagonal matrix D. + */ +int gsl_linalg_cholesky_decomp_unit(gsl_matrix * A, gsl_vector * D); + +int gsl_linalg_cholesky_scale(const gsl_matrix * A, gsl_vector * S); + +int gsl_linalg_cholesky_scale_apply(gsl_matrix * A, const gsl_vector * S); + +int gsl_linalg_cholesky_decomp2(gsl_matrix * A, gsl_vector * S); + +int gsl_linalg_cholesky_svx2 (const gsl_matrix * LLT, + const gsl_vector * S, + gsl_vector * x); + +int gsl_linalg_cholesky_solve2 (const gsl_matrix * LLT, + const gsl_vector * S, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_cholesky_rcond (const gsl_matrix * LLT, double * rcond, + gsl_vector * work); + +/* Complex Cholesky Decomposition */ + +int gsl_linalg_complex_cholesky_decomp (gsl_matrix_complex * A); + +int gsl_linalg_complex_cholesky_solve (const gsl_matrix_complex * cholesky, + const gsl_vector_complex * b, + gsl_vector_complex * x); + +int gsl_linalg_complex_cholesky_svx (const gsl_matrix_complex * cholesky, + gsl_vector_complex * x); + +int gsl_linalg_complex_cholesky_invert(gsl_matrix_complex * cholesky); + +/* Pivoted Cholesky LDLT decomposition */ + +int gsl_linalg_pcholesky_decomp (gsl_matrix * A, gsl_permutation * p); + +int gsl_linalg_pcholesky_solve(const gsl_matrix * LDLT, + const gsl_permutation * p, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_pcholesky_svx(const gsl_matrix * LDLT, + const gsl_permutation * p, + gsl_vector * x); + +int gsl_linalg_pcholesky_decomp2(gsl_matrix * A, gsl_permutation * p, + gsl_vector * S); + +int gsl_linalg_pcholesky_solve2(const gsl_matrix * LDLT, + const gsl_permutation * p, + const gsl_vector * S, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_pcholesky_svx2(const gsl_matrix * LDLT, + const gsl_permutation * p, + const gsl_vector * S, + gsl_vector * x); + +int gsl_linalg_pcholesky_invert(const gsl_matrix * LDLT, const gsl_permutation * p, + gsl_matrix * Ainv); + +int gsl_linalg_pcholesky_rcond (const gsl_matrix * LDLT, const gsl_permutation * p, + double * rcond, gsl_vector * work); + +/* Modified Cholesky decomposition */ + +int gsl_linalg_mcholesky_decomp (gsl_matrix * A, gsl_permutation * p, + gsl_vector * E); + +int gsl_linalg_mcholesky_solve(const gsl_matrix * LDLT, + const gsl_permutation * p, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_mcholesky_svx(const gsl_matrix * LDLT, + const gsl_permutation * p, + gsl_vector * x); + +int gsl_linalg_mcholesky_rcond (const gsl_matrix * LDLT, const gsl_permutation * p, + double * rcond, gsl_vector * work); + +int gsl_linalg_mcholesky_invert(const gsl_matrix * LDLT, const gsl_permutation * p, + gsl_matrix * Ainv); + +/* Symmetric to symmetric tridiagonal decomposition */ + +int gsl_linalg_symmtd_decomp (gsl_matrix * A, + gsl_vector * tau); + +int gsl_linalg_symmtd_unpack (const gsl_matrix * A, + const gsl_vector * tau, + gsl_matrix * Q, + gsl_vector * diag, + gsl_vector * subdiag); + +int gsl_linalg_symmtd_unpack_T (const gsl_matrix * A, + gsl_vector * diag, + gsl_vector * subdiag); + +/* Hermitian to symmetric tridiagonal decomposition */ + +int gsl_linalg_hermtd_decomp (gsl_matrix_complex * A, + gsl_vector_complex * tau); + +int gsl_linalg_hermtd_unpack (const gsl_matrix_complex * A, + const gsl_vector_complex * tau, + gsl_matrix_complex * U, + gsl_vector * diag, + gsl_vector * sudiag); + +int gsl_linalg_hermtd_unpack_T (const gsl_matrix_complex * A, + gsl_vector * diag, + gsl_vector * subdiag); + +/* Linear Solve Using Householder Transformations + + * exceptions: + */ + +int gsl_linalg_HH_solve (gsl_matrix * A, const gsl_vector * b, gsl_vector * x); +int gsl_linalg_HH_svx (gsl_matrix * A, gsl_vector * x); + +/* Linear solve for a symmetric tridiagonal system. + + * The input vectors represent the NxN matrix as follows: + * + * diag[0] offdiag[0] 0 ... + * offdiag[0] diag[1] offdiag[1] ... + * 0 offdiag[1] diag[2] ... + * 0 0 offdiag[2] ... + * ... ... ... ... + */ +int gsl_linalg_solve_symm_tridiag (const gsl_vector * diag, + const gsl_vector * offdiag, + const gsl_vector * b, + gsl_vector * x); + +/* Linear solve for a nonsymmetric tridiagonal system. + + * The input vectors represent the NxN matrix as follows: + * + * diag[0] abovediag[0] 0 ... + * belowdiag[0] diag[1] abovediag[1] ... + * 0 belowdiag[1] diag[2] ... + * 0 0 belowdiag[2] ... + * ... ... ... ... + */ +int gsl_linalg_solve_tridiag (const gsl_vector * diag, + const gsl_vector * abovediag, + const gsl_vector * belowdiag, + const gsl_vector * b, + gsl_vector * x); + + +/* Linear solve for a symmetric cyclic tridiagonal system. + + * The input vectors represent the NxN matrix as follows: + * + * diag[0] offdiag[0] 0 ..... offdiag[N-1] + * offdiag[0] diag[1] offdiag[1] ..... + * 0 offdiag[1] diag[2] ..... + * 0 0 offdiag[2] ..... + * ... ... + * offdiag[N-1] ... + */ +int gsl_linalg_solve_symm_cyc_tridiag (const gsl_vector * diag, + const gsl_vector * offdiag, + const gsl_vector * b, + gsl_vector * x); + +/* Linear solve for a nonsymmetric cyclic tridiagonal system. + + * The input vectors represent the NxN matrix as follows: + * + * diag[0] abovediag[0] 0 ..... belowdiag[N-1] + * belowdiag[0] diag[1] abovediag[1] ..... + * 0 belowdiag[1] diag[2] + * 0 0 belowdiag[2] ..... + * ... ... + * abovediag[N-1] ... + */ +int gsl_linalg_solve_cyc_tridiag (const gsl_vector * diag, + const gsl_vector * abovediag, + const gsl_vector * belowdiag, + const gsl_vector * b, + gsl_vector * x); + + +/* Bidiagonal decomposition */ + +int gsl_linalg_bidiag_decomp (gsl_matrix * A, + gsl_vector * tau_U, + gsl_vector * tau_V); + +int gsl_linalg_bidiag_unpack (const gsl_matrix * A, + const gsl_vector * tau_U, + gsl_matrix * U, + const gsl_vector * tau_V, + gsl_matrix * V, + gsl_vector * diag, + gsl_vector * superdiag); + +int gsl_linalg_bidiag_unpack2 (gsl_matrix * A, + gsl_vector * tau_U, + gsl_vector * tau_V, + gsl_matrix * V); + +int gsl_linalg_bidiag_unpack_B (const gsl_matrix * A, + gsl_vector * diag, + gsl_vector * superdiag); + +/* Balancing */ + +int gsl_linalg_balance_matrix (gsl_matrix * A, gsl_vector * D); +int gsl_linalg_balance_accum (gsl_matrix * A, gsl_vector * D); +int gsl_linalg_balance_columns (gsl_matrix * A, gsl_vector * D); + +/* condition estimation */ + +int gsl_linalg_tri_upper_rcond(const gsl_matrix * A, double * rcond, gsl_vector * work); +int gsl_linalg_tri_lower_rcond(const gsl_matrix * A, double * rcond, gsl_vector * work); +int gsl_linalg_invnorm1(const size_t N, + int (* Ainvx)(CBLAS_TRANSPOSE_t TransA, gsl_vector * x, void * params), + void * params, double * Ainvnorm, gsl_vector * work); + +/* triangular matrices */ + +int gsl_linalg_tri_upper_invert(gsl_matrix * T); +int gsl_linalg_tri_lower_invert(gsl_matrix * T); +int gsl_linalg_tri_upper_unit_invert(gsl_matrix * T); +int gsl_linalg_tri_lower_unit_invert(gsl_matrix * T); + +INLINE_DECL void gsl_linalg_givens (const double a, const double b, + double *c, double *s); +INLINE_DECL void gsl_linalg_givens_gv (gsl_vector * v, const size_t i, + const size_t j, const double c, + const double s); + +#ifdef HAVE_INLINE + +/* Generate a Givens rotation (cos,sin) which takes v=(x,y) to (|v|,0) + From Golub and Van Loan, "Matrix Computations", Section 5.1.8 */ +INLINE_FUN +void +gsl_linalg_givens (const double a, const double b, double *c, double *s) +{ + if (b == 0) + { + *c = 1; + *s = 0; + } + else if (fabs (b) > fabs (a)) + { + double t = -a / b; + double s1 = 1.0 / sqrt (1 + t * t); + *s = s1; + *c = s1 * t; + } + else + { + double t = -b / a; + double c1 = 1.0 / sqrt (1 + t * t); + *c = c1; + *s = c1 * t; + } +} /* gsl_linalg_givens() */ + +INLINE_FUN +void +gsl_linalg_givens_gv (gsl_vector * v, const size_t i, const size_t j, + const double c, const double s) +{ + /* Apply rotation to vector v' = G^T v */ + + double vi = gsl_vector_get (v, i); + double vj = gsl_vector_get (v, j); + gsl_vector_set (v, i, c * vi - s * vj); + gsl_vector_set (v, j, s * vi + c * vj); +} + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_LINALG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_machine.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_machine.h new file mode 100644 index 000000000..c44ffc2a4 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_machine.h @@ -0,0 +1,104 @@ +/* Author: B. Gough and G. Jungman */ +#ifndef __GSL_MACHINE_H__ +#define __GSL_MACHINE_H__ + +#include +#include + +/* magic constants; mostly for the benefit of the implementation */ + +/* -*-MACHINE CONSTANTS-*- + * + * PLATFORM: Whiz-O-Matic 9000 + * FP_PLATFORM: IEEE-Virtual + * HOSTNAME: nnn.lanl.gov + * DATE: Fri Nov 20 17:53:26 MST 1998 + */ +#define GSL_DBL_EPSILON 2.2204460492503131e-16 +#define GSL_SQRT_DBL_EPSILON 1.4901161193847656e-08 +#define GSL_ROOT3_DBL_EPSILON 6.0554544523933429e-06 +#define GSL_ROOT4_DBL_EPSILON 1.2207031250000000e-04 +#define GSL_ROOT5_DBL_EPSILON 7.4009597974140505e-04 +#define GSL_ROOT6_DBL_EPSILON 2.4607833005759251e-03 +#define GSL_LOG_DBL_EPSILON (-3.6043653389117154e+01) + +#define GSL_DBL_MIN 2.2250738585072014e-308 +#define GSL_SQRT_DBL_MIN 1.4916681462400413e-154 +#define GSL_ROOT3_DBL_MIN 2.8126442852362996e-103 +#define GSL_ROOT4_DBL_MIN 1.2213386697554620e-77 +#define GSL_ROOT5_DBL_MIN 2.9476022969691763e-62 +#define GSL_ROOT6_DBL_MIN 5.3034368905798218e-52 +#define GSL_LOG_DBL_MIN (-7.0839641853226408e+02) + +#define GSL_DBL_MAX 1.7976931348623157e+308 +#define GSL_SQRT_DBL_MAX 1.3407807929942596e+154 +#define GSL_ROOT3_DBL_MAX 5.6438030941222897e+102 +#define GSL_ROOT4_DBL_MAX 1.1579208923731620e+77 +#define GSL_ROOT5_DBL_MAX 4.4765466227572707e+61 +#define GSL_ROOT6_DBL_MAX 2.3756689782295612e+51 +#define GSL_LOG_DBL_MAX 7.0978271289338397e+02 + +#define GSL_FLT_EPSILON 1.1920928955078125e-07 +#define GSL_SQRT_FLT_EPSILON 3.4526698300124393e-04 +#define GSL_ROOT3_FLT_EPSILON 4.9215666011518501e-03 +#define GSL_ROOT4_FLT_EPSILON 1.8581361171917516e-02 +#define GSL_ROOT5_FLT_EPSILON 4.1234622211652937e-02 +#define GSL_ROOT6_FLT_EPSILON 7.0153878019335827e-02 +#define GSL_LOG_FLT_EPSILON (-1.5942385152878742e+01) + +#define GSL_FLT_MIN 1.1754943508222875e-38 +#define GSL_SQRT_FLT_MIN 1.0842021724855044e-19 +#define GSL_ROOT3_FLT_MIN 2.2737367544323241e-13 +#define GSL_ROOT4_FLT_MIN 3.2927225399135965e-10 +#define GSL_ROOT5_FLT_MIN 2.5944428542140822e-08 +#define GSL_ROOT6_FLT_MIN 4.7683715820312542e-07 +#define GSL_LOG_FLT_MIN (-8.7336544750553102e+01) + +#define GSL_FLT_MAX 3.4028234663852886e+38 +#define GSL_SQRT_FLT_MAX 1.8446743523953730e+19 +#define GSL_ROOT3_FLT_MAX 6.9814635196223242e+12 +#define GSL_ROOT4_FLT_MAX 4.2949672319999986e+09 +#define GSL_ROOT5_FLT_MAX 5.0859007855960041e+07 +#define GSL_ROOT6_FLT_MAX 2.6422459233807749e+06 +#define GSL_LOG_FLT_MAX 8.8722839052068352e+01 + +#define GSL_SFLT_EPSILON 4.8828125000000000e-04 +#define GSL_SQRT_SFLT_EPSILON 2.2097086912079612e-02 +#define GSL_ROOT3_SFLT_EPSILON 7.8745065618429588e-02 +#define GSL_ROOT4_SFLT_EPSILON 1.4865088937534013e-01 +#define GSL_ROOT5_SFLT_EPSILON 2.1763764082403100e-01 +#define GSL_ROOT6_SFLT_EPSILON 2.8061551207734325e-01 +#define GSL_LOG_SFLT_EPSILON (-7.6246189861593985e+00) + +/* !MACHINE CONSTANTS! */ + + +/* a little internal backwards compatibility */ +#define GSL_MACH_EPS GSL_DBL_EPSILON + + + +/* Here are the constants related to or derived from + * machine constants. These are not to be confused with + * the constants that define various precision levels + * for the precision/error system. + * + * This information is determined at configure time + * and is platform dependent. Edit at your own risk. + * + * PLATFORM: WHIZ-O-MATIC + * CONFIG-DATE: Thu Nov 19 19:27:18 MST 1998 + * CONFIG-HOST: nnn.lanl.gov + */ + +/* machine precision constants */ +/* #define GSL_MACH_EPS 1.0e-15 */ +#define GSL_SQRT_MACH_EPS 3.2e-08 +#define GSL_ROOT3_MACH_EPS 1.0e-05 +#define GSL_ROOT4_MACH_EPS 0.000178 +#define GSL_ROOT5_MACH_EPS 0.00100 +#define GSL_ROOT6_MACH_EPS 0.00316 +#define GSL_LOG_MACH_EPS (-34.54) + + +#endif /* __GSL_MACHINE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_math.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_math.h new file mode 100644 index 000000000..2d09df173 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_math.h @@ -0,0 +1,164 @@ +/* gsl_math.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATH_H__ +#define __GSL_MATH_H__ +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef M_E +#define M_E 2.71828182845904523536028747135 /* e */ +#endif + +#ifndef M_LOG2E +#define M_LOG2E 1.44269504088896340735992468100 /* log_2 (e) */ +#endif + +#ifndef M_LOG10E +#define M_LOG10E 0.43429448190325182765112891892 /* log_10 (e) */ +#endif + +#ifndef M_SQRT2 +#define M_SQRT2 1.41421356237309504880168872421 /* sqrt(2) */ +#endif + +#ifndef M_SQRT1_2 +#define M_SQRT1_2 0.70710678118654752440084436210 /* sqrt(1/2) */ +#endif + + +#ifndef M_SQRT3 +#define M_SQRT3 1.73205080756887729352744634151 /* sqrt(3) */ +#endif + +#ifndef M_PI +#define M_PI 3.14159265358979323846264338328 /* pi */ +#endif + +#ifndef M_PI_2 +#define M_PI_2 1.57079632679489661923132169164 /* pi/2 */ +#endif + +#ifndef M_PI_4 +#define M_PI_4 0.78539816339744830961566084582 /* pi/4 */ +#endif + +#ifndef M_SQRTPI +#define M_SQRTPI 1.77245385090551602729816748334 /* sqrt(pi) */ +#endif + +#ifndef M_2_SQRTPI +#define M_2_SQRTPI 1.12837916709551257389615890312 /* 2/sqrt(pi) */ +#endif + +#ifndef M_1_PI +#define M_1_PI 0.31830988618379067153776752675 /* 1/pi */ +#endif + +#ifndef M_2_PI +#define M_2_PI 0.63661977236758134307553505349 /* 2/pi */ +#endif + +#ifndef M_LN10 +#define M_LN10 2.30258509299404568401799145468 /* ln(10) */ +#endif + +#ifndef M_LN2 +#define M_LN2 0.69314718055994530941723212146 /* ln(2) */ +#endif + +#ifndef M_LNPI +#define M_LNPI 1.14472988584940017414342735135 /* ln(pi) */ +#endif + +#ifndef M_EULER +#define M_EULER 0.57721566490153286060651209008 /* Euler constant */ +#endif + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* other needlessly compulsive abstractions */ + +#define GSL_IS_ODD(n) ((n) & 1) +#define GSL_IS_EVEN(n) (!(GSL_IS_ODD(n))) +#define GSL_SIGN(x) ((x) >= 0.0 ? 1 : -1) + +/* Return nonzero if x is a real number, i.e. non NaN or infinite. */ +#define GSL_IS_REAL(x) (gsl_finite(x)) + +/* Definition of an arbitrary function with parameters */ + +struct gsl_function_struct +{ + double (* function) (double x, void * params); + void * params; +}; + +typedef struct gsl_function_struct gsl_function ; + +#define GSL_FN_EVAL(F,x) (*((F)->function))(x,(F)->params) + +/* Definition of an arbitrary function returning two values, r1, r2 */ + +struct gsl_function_fdf_struct +{ + double (* f) (double x, void * params); + double (* df) (double x, void * params); + void (* fdf) (double x, void * params, double * f, double * df); + void * params; +}; + +typedef struct gsl_function_fdf_struct gsl_function_fdf ; + +#define GSL_FN_FDF_EVAL_F(FDF,x) (*((FDF)->f))(x,(FDF)->params) +#define GSL_FN_FDF_EVAL_DF(FDF,x) (*((FDF)->df))(x,(FDF)->params) +#define GSL_FN_FDF_EVAL_F_DF(FDF,x,y,dy) (*((FDF)->fdf))(x,(FDF)->params,(y),(dy)) + + +/* Definition of an arbitrary vector-valued function with parameters */ + +struct gsl_function_vec_struct +{ + int (* function) (double x, double y[], void * params); + void * params; +}; + +typedef struct gsl_function_vec_struct gsl_function_vec ; + +#define GSL_FN_VEC_EVAL(F,x,y) (*((F)->function))(x,y,(F)->params) + +__END_DECLS + +#endif /* __GSL_MATH_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix.h new file mode 100644 index 000000000..9b7ed7655 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix.h @@ -0,0 +1,25 @@ +#ifndef __GSL_MATRIX_H__ +#define __GSL_MATRIX_H__ + +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include + + +#endif /* __GSL_MATRIX_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_char.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_char.h new file mode 100644 index 000000000..7e81de300 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_char.h @@ -0,0 +1,352 @@ +/* matrix/gsl_matrix_char.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_CHAR_H__ +#define __GSL_MATRIX_CHAR_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + char * data; + gsl_block_char * block; + int owner; +} gsl_matrix_char; + +typedef struct +{ + gsl_matrix_char matrix; +} _gsl_matrix_char_view; + +typedef _gsl_matrix_char_view gsl_matrix_char_view; + +typedef struct +{ + gsl_matrix_char matrix; +} _gsl_matrix_char_const_view; + +typedef const _gsl_matrix_char_const_view gsl_matrix_char_const_view; + +/* Allocation */ + +gsl_matrix_char * +gsl_matrix_char_alloc (const size_t n1, const size_t n2); + +gsl_matrix_char * +gsl_matrix_char_calloc (const size_t n1, const size_t n2); + +gsl_matrix_char * +gsl_matrix_char_alloc_from_block (gsl_block_char * b, + const size_t offset, + const size_t n1, + const size_t n2, + const size_t d2); + +gsl_matrix_char * +gsl_matrix_char_alloc_from_matrix (gsl_matrix_char * m, + const size_t k1, + const size_t k2, + const size_t n1, + const size_t n2); + +gsl_vector_char * +gsl_vector_char_alloc_row_from_matrix (gsl_matrix_char * m, + const size_t i); + +gsl_vector_char * +gsl_vector_char_alloc_col_from_matrix (gsl_matrix_char * m, + const size_t j); + +void gsl_matrix_char_free (gsl_matrix_char * m); + +/* Views */ + +_gsl_matrix_char_view +gsl_matrix_char_submatrix (gsl_matrix_char * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_char_view +gsl_matrix_char_row (gsl_matrix_char * m, const size_t i); + +_gsl_vector_char_view +gsl_matrix_char_column (gsl_matrix_char * m, const size_t j); + +_gsl_vector_char_view +gsl_matrix_char_diagonal (gsl_matrix_char * m); + +_gsl_vector_char_view +gsl_matrix_char_subdiagonal (gsl_matrix_char * m, const size_t k); + +_gsl_vector_char_view +gsl_matrix_char_superdiagonal (gsl_matrix_char * m, const size_t k); + +_gsl_vector_char_view +gsl_matrix_char_subrow (gsl_matrix_char * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_char_view +gsl_matrix_char_subcolumn (gsl_matrix_char * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_char_view +gsl_matrix_char_view_array (char * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_char_view +gsl_matrix_char_view_array_with_tda (char * base, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_char_view +gsl_matrix_char_view_vector (gsl_vector_char * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_char_view +gsl_matrix_char_view_vector_with_tda (gsl_vector_char * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_char_const_view +gsl_matrix_char_const_submatrix (const gsl_matrix_char * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_char_const_view +gsl_matrix_char_const_row (const gsl_matrix_char * m, + const size_t i); + +_gsl_vector_char_const_view +gsl_matrix_char_const_column (const gsl_matrix_char * m, + const size_t j); + +_gsl_vector_char_const_view +gsl_matrix_char_const_diagonal (const gsl_matrix_char * m); + +_gsl_vector_char_const_view +gsl_matrix_char_const_subdiagonal (const gsl_matrix_char * m, + const size_t k); + +_gsl_vector_char_const_view +gsl_matrix_char_const_superdiagonal (const gsl_matrix_char * m, + const size_t k); + +_gsl_vector_char_const_view +gsl_matrix_char_const_subrow (const gsl_matrix_char * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_char_const_view +gsl_matrix_char_const_subcolumn (const gsl_matrix_char * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_char_const_view +gsl_matrix_char_const_view_array (const char * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_char_const_view +gsl_matrix_char_const_view_array_with_tda (const char * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_char_const_view +gsl_matrix_char_const_view_vector (const gsl_vector_char * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_char_const_view +gsl_matrix_char_const_view_vector_with_tda (const gsl_vector_char * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +void gsl_matrix_char_set_zero (gsl_matrix_char * m); +void gsl_matrix_char_set_identity (gsl_matrix_char * m); +void gsl_matrix_char_set_all (gsl_matrix_char * m, char x); + +int gsl_matrix_char_fread (FILE * stream, gsl_matrix_char * m) ; +int gsl_matrix_char_fwrite (FILE * stream, const gsl_matrix_char * m) ; +int gsl_matrix_char_fscanf (FILE * stream, gsl_matrix_char * m); +int gsl_matrix_char_fprintf (FILE * stream, const gsl_matrix_char * m, const char * format); + +int gsl_matrix_char_memcpy(gsl_matrix_char * dest, const gsl_matrix_char * src); +int gsl_matrix_char_swap(gsl_matrix_char * m1, gsl_matrix_char * m2); +int gsl_matrix_char_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_char * dest, const gsl_matrix_char * src); + +int gsl_matrix_char_swap_rows(gsl_matrix_char * m, const size_t i, const size_t j); +int gsl_matrix_char_swap_columns(gsl_matrix_char * m, const size_t i, const size_t j); +int gsl_matrix_char_swap_rowcol(gsl_matrix_char * m, const size_t i, const size_t j); +int gsl_matrix_char_transpose (gsl_matrix_char * m); +int gsl_matrix_char_transpose_memcpy (gsl_matrix_char * dest, const gsl_matrix_char * src); +int gsl_matrix_char_transpose_tricpy (const char uplo_src, const int copy_diag, gsl_matrix_char * dest, const gsl_matrix_char * src); + +char gsl_matrix_char_max (const gsl_matrix_char * m); +char gsl_matrix_char_min (const gsl_matrix_char * m); +void gsl_matrix_char_minmax (const gsl_matrix_char * m, char * min_out, char * max_out); + +void gsl_matrix_char_max_index (const gsl_matrix_char * m, size_t * imax, size_t *jmax); +void gsl_matrix_char_min_index (const gsl_matrix_char * m, size_t * imin, size_t *jmin); +void gsl_matrix_char_minmax_index (const gsl_matrix_char * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); + +int gsl_matrix_char_equal (const gsl_matrix_char * a, const gsl_matrix_char * b); + +int gsl_matrix_char_isnull (const gsl_matrix_char * m); +int gsl_matrix_char_ispos (const gsl_matrix_char * m); +int gsl_matrix_char_isneg (const gsl_matrix_char * m); +int gsl_matrix_char_isnonneg (const gsl_matrix_char * m); + +int gsl_matrix_char_add (gsl_matrix_char * a, const gsl_matrix_char * b); +int gsl_matrix_char_sub (gsl_matrix_char * a, const gsl_matrix_char * b); +int gsl_matrix_char_mul_elements (gsl_matrix_char * a, const gsl_matrix_char * b); +int gsl_matrix_char_div_elements (gsl_matrix_char * a, const gsl_matrix_char * b); +int gsl_matrix_char_scale (gsl_matrix_char * a, const double x); +int gsl_matrix_char_add_constant (gsl_matrix_char * a, const double x); +int gsl_matrix_char_add_diagonal (gsl_matrix_char * a, const double x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_char_get_row(gsl_vector_char * v, const gsl_matrix_char * m, const size_t i); +int gsl_matrix_char_get_col(gsl_vector_char * v, const gsl_matrix_char * m, const size_t j); +int gsl_matrix_char_set_row(gsl_matrix_char * m, const size_t i, const gsl_vector_char * v); +int gsl_matrix_char_set_col(gsl_matrix_char * m, const size_t j, const gsl_vector_char * v); +/***********************************************************************/ + +/* inline functions if you are using GCC */ + +INLINE_DECL char gsl_matrix_char_get(const gsl_matrix_char * m, const size_t i, const size_t j); +INLINE_DECL void gsl_matrix_char_set(gsl_matrix_char * m, const size_t i, const size_t j, const char x); +INLINE_DECL char * gsl_matrix_char_ptr(gsl_matrix_char * m, const size_t i, const size_t j); +INLINE_DECL const char * gsl_matrix_char_const_ptr(const gsl_matrix_char * m, const size_t i, const size_t j); + +#ifdef HAVE_INLINE +INLINE_FUN +char +gsl_matrix_char_get(const gsl_matrix_char * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; + } + } +#endif + return m->data[i * m->tda + j] ; +} + +INLINE_FUN +void +gsl_matrix_char_set(gsl_matrix_char * m, const size_t i, const size_t j, const char x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } + } +#endif + m->data[i * m->tda + j] = x ; +} + +INLINE_FUN +char * +gsl_matrix_char_ptr(gsl_matrix_char * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (char *) (m->data + (i * m->tda + j)) ; +} + +INLINE_FUN +const char * +gsl_matrix_char_const_ptr(const gsl_matrix_char * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (const char *) (m->data + (i * m->tda + j)) ; +} + +#endif + +__END_DECLS + +#endif /* __GSL_MATRIX_CHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_complex_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_complex_double.h new file mode 100644 index 000000000..3b8791389 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_complex_double.h @@ -0,0 +1,353 @@ +/* matrix/gsl_matrix_complex_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_COMPLEX_DOUBLE_H__ +#define __GSL_MATRIX_COMPLEX_DOUBLE_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + double * data; + gsl_block_complex * block; + int owner; +} gsl_matrix_complex ; + +typedef struct +{ + gsl_matrix_complex matrix; +} _gsl_matrix_complex_view; + +typedef _gsl_matrix_complex_view gsl_matrix_complex_view; + +typedef struct +{ + gsl_matrix_complex matrix; +} _gsl_matrix_complex_const_view; + +typedef const _gsl_matrix_complex_const_view gsl_matrix_complex_const_view; + + +/* Allocation */ + +gsl_matrix_complex * +gsl_matrix_complex_alloc (const size_t n1, const size_t n2); + +gsl_matrix_complex * +gsl_matrix_complex_calloc (const size_t n1, const size_t n2); + +gsl_matrix_complex * +gsl_matrix_complex_alloc_from_block (gsl_block_complex * b, + const size_t offset, + const size_t n1, const size_t n2, const size_t d2); + +gsl_matrix_complex * +gsl_matrix_complex_alloc_from_matrix (gsl_matrix_complex * b, + const size_t k1, const size_t k2, + const size_t n1, const size_t n2); + +gsl_vector_complex * +gsl_vector_complex_alloc_row_from_matrix (gsl_matrix_complex * m, + const size_t i); + +gsl_vector_complex * +gsl_vector_complex_alloc_col_from_matrix (gsl_matrix_complex * m, + const size_t j); + +void gsl_matrix_complex_free (gsl_matrix_complex * m); + +/* Views */ + +_gsl_matrix_complex_view +gsl_matrix_complex_submatrix (gsl_matrix_complex * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_complex_view +gsl_matrix_complex_row (gsl_matrix_complex * m, const size_t i); + +_gsl_vector_complex_view +gsl_matrix_complex_column (gsl_matrix_complex * m, const size_t j); + +_gsl_vector_complex_view +gsl_matrix_complex_diagonal (gsl_matrix_complex * m); + +_gsl_vector_complex_view +gsl_matrix_complex_subdiagonal (gsl_matrix_complex * m, const size_t k); + +_gsl_vector_complex_view +gsl_matrix_complex_superdiagonal (gsl_matrix_complex * m, const size_t k); + +_gsl_vector_complex_view +gsl_matrix_complex_subrow (gsl_matrix_complex * m, + const size_t i, const size_t offset, + const size_t n); + +_gsl_vector_complex_view +gsl_matrix_complex_subcolumn (gsl_matrix_complex * m, + const size_t j, const size_t offset, + const size_t n); + +_gsl_matrix_complex_view +gsl_matrix_complex_view_array (double * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_complex_view +gsl_matrix_complex_view_array_with_tda (double * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_complex_view +gsl_matrix_complex_view_vector (gsl_vector_complex * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_complex_view +gsl_matrix_complex_view_vector_with_tda (gsl_vector_complex * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_complex_const_view +gsl_matrix_complex_const_submatrix (const gsl_matrix_complex * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_complex_const_view +gsl_matrix_complex_const_row (const gsl_matrix_complex * m, + const size_t i); + +_gsl_vector_complex_const_view +gsl_matrix_complex_const_column (const gsl_matrix_complex * m, + const size_t j); + +_gsl_vector_complex_const_view +gsl_matrix_complex_const_diagonal (const gsl_matrix_complex * m); + +_gsl_vector_complex_const_view +gsl_matrix_complex_const_subdiagonal (const gsl_matrix_complex * m, + const size_t k); + +_gsl_vector_complex_const_view +gsl_matrix_complex_const_superdiagonal (const gsl_matrix_complex * m, + const size_t k); + +_gsl_vector_complex_const_view +gsl_matrix_complex_const_subrow (const gsl_matrix_complex * m, + const size_t i, const size_t offset, + const size_t n); + +_gsl_vector_complex_const_view +gsl_matrix_complex_const_subcolumn (const gsl_matrix_complex * m, + const size_t j, const size_t offset, + const size_t n); + +_gsl_matrix_complex_const_view +gsl_matrix_complex_const_view_array (const double * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_complex_const_view +gsl_matrix_complex_const_view_array_with_tda (const double * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_complex_const_view +gsl_matrix_complex_const_view_vector (const gsl_vector_complex * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_complex_const_view +gsl_matrix_complex_const_view_vector_with_tda (const gsl_vector_complex * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +void gsl_matrix_complex_set_zero (gsl_matrix_complex * m); +void gsl_matrix_complex_set_identity (gsl_matrix_complex * m); +void gsl_matrix_complex_set_all (gsl_matrix_complex * m, gsl_complex x); + +int gsl_matrix_complex_fread (FILE * stream, gsl_matrix_complex * m) ; +int gsl_matrix_complex_fwrite (FILE * stream, const gsl_matrix_complex * m) ; +int gsl_matrix_complex_fscanf (FILE * stream, gsl_matrix_complex * m); +int gsl_matrix_complex_fprintf (FILE * stream, const gsl_matrix_complex * m, const char * format); + +int gsl_matrix_complex_memcpy(gsl_matrix_complex * dest, const gsl_matrix_complex * src); +int gsl_matrix_complex_swap(gsl_matrix_complex * m1, gsl_matrix_complex * m2); +int gsl_matrix_complex_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_complex * dest, const gsl_matrix_complex * src); + +int gsl_matrix_complex_swap_rows(gsl_matrix_complex * m, const size_t i, const size_t j); +int gsl_matrix_complex_swap_columns(gsl_matrix_complex * m, const size_t i, const size_t j); +int gsl_matrix_complex_swap_rowcol(gsl_matrix_complex * m, const size_t i, const size_t j); + +int gsl_matrix_complex_transpose (gsl_matrix_complex * m); +int gsl_matrix_complex_transpose_memcpy (gsl_matrix_complex * dest, const gsl_matrix_complex * src); +int gsl_matrix_complex_transpose_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_complex * dest, const gsl_matrix_complex * src); + +int gsl_matrix_complex_equal (const gsl_matrix_complex * a, const gsl_matrix_complex * b); + +int gsl_matrix_complex_isnull (const gsl_matrix_complex * m); +int gsl_matrix_complex_ispos (const gsl_matrix_complex * m); +int gsl_matrix_complex_isneg (const gsl_matrix_complex * m); +int gsl_matrix_complex_isnonneg (const gsl_matrix_complex * m); + +int gsl_matrix_complex_add (gsl_matrix_complex * a, const gsl_matrix_complex * b); +int gsl_matrix_complex_sub (gsl_matrix_complex * a, const gsl_matrix_complex * b); +int gsl_matrix_complex_mul_elements (gsl_matrix_complex * a, const gsl_matrix_complex * b); +int gsl_matrix_complex_div_elements (gsl_matrix_complex * a, const gsl_matrix_complex * b); +int gsl_matrix_complex_scale (gsl_matrix_complex * a, const gsl_complex x); +int gsl_matrix_complex_add_constant (gsl_matrix_complex * a, const gsl_complex x); +int gsl_matrix_complex_add_diagonal (gsl_matrix_complex * a, const gsl_complex x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_complex_get_row(gsl_vector_complex * v, const gsl_matrix_complex * m, const size_t i); +int gsl_matrix_complex_get_col(gsl_vector_complex * v, const gsl_matrix_complex * m, const size_t j); +int gsl_matrix_complex_set_row(gsl_matrix_complex * m, const size_t i, const gsl_vector_complex * v); +int gsl_matrix_complex_set_col(gsl_matrix_complex * m, const size_t j, const gsl_vector_complex * v); +/***********************************************************************/ + +/* inline functions if you are using GCC */ + +INLINE_DECL gsl_complex gsl_matrix_complex_get(const gsl_matrix_complex * m, const size_t i, const size_t j); +INLINE_DECL void gsl_matrix_complex_set(gsl_matrix_complex * m, const size_t i, const size_t j, const gsl_complex x); + +INLINE_DECL gsl_complex * gsl_matrix_complex_ptr(gsl_matrix_complex * m, const size_t i, const size_t j); +INLINE_DECL const gsl_complex * gsl_matrix_complex_const_ptr(const gsl_matrix_complex * m, const size_t i, const size_t j); + +#ifdef HAVE_INLINE + +INLINE_FUN +gsl_complex +gsl_matrix_complex_get(const gsl_matrix_complex * m, + const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + gsl_complex zero = {{0,0}}; + + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, zero) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, zero) ; + } + } +#endif + return *(gsl_complex *)(m->data + 2*(i * m->tda + j)) ; +} + +INLINE_FUN +void +gsl_matrix_complex_set(gsl_matrix_complex * m, + const size_t i, const size_t j, const gsl_complex x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } + } +#endif + *(gsl_complex *)(m->data + 2*(i * m->tda + j)) = x ; +} + +INLINE_FUN +gsl_complex * +gsl_matrix_complex_ptr(gsl_matrix_complex * m, + const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (gsl_complex *)(m->data + 2*(i * m->tda + j)) ; +} + +INLINE_FUN +const gsl_complex * +gsl_matrix_complex_const_ptr(const gsl_matrix_complex * m, + const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (const gsl_complex *)(m->data + 2*(i * m->tda + j)) ; +} + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_MATRIX_COMPLEX_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_complex_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_complex_float.h new file mode 100644 index 000000000..c91eb19eb --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_complex_float.h @@ -0,0 +1,353 @@ +/* matrix/gsl_matrix_complex_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_COMPLEX_FLOAT_H__ +#define __GSL_MATRIX_COMPLEX_FLOAT_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + float * data; + gsl_block_complex_float * block; + int owner; +} gsl_matrix_complex_float ; + +typedef struct +{ + gsl_matrix_complex_float matrix; +} _gsl_matrix_complex_float_view; + +typedef _gsl_matrix_complex_float_view gsl_matrix_complex_float_view; + +typedef struct +{ + gsl_matrix_complex_float matrix; +} _gsl_matrix_complex_float_const_view; + +typedef const _gsl_matrix_complex_float_const_view gsl_matrix_complex_float_const_view; + + +/* Allocation */ + +gsl_matrix_complex_float * +gsl_matrix_complex_float_alloc (const size_t n1, const size_t n2); + +gsl_matrix_complex_float * +gsl_matrix_complex_float_calloc (const size_t n1, const size_t n2); + +gsl_matrix_complex_float * +gsl_matrix_complex_float_alloc_from_block (gsl_block_complex_float * b, + const size_t offset, + const size_t n1, const size_t n2, const size_t d2); + +gsl_matrix_complex_float * +gsl_matrix_complex_float_alloc_from_matrix (gsl_matrix_complex_float * b, + const size_t k1, const size_t k2, + const size_t n1, const size_t n2); + +gsl_vector_complex_float * +gsl_vector_complex_float_alloc_row_from_matrix (gsl_matrix_complex_float * m, + const size_t i); + +gsl_vector_complex_float * +gsl_vector_complex_float_alloc_col_from_matrix (gsl_matrix_complex_float * m, + const size_t j); + +void gsl_matrix_complex_float_free (gsl_matrix_complex_float * m); + +/* Views */ + +_gsl_matrix_complex_float_view +gsl_matrix_complex_float_submatrix (gsl_matrix_complex_float * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_complex_float_view +gsl_matrix_complex_float_row (gsl_matrix_complex_float * m, const size_t i); + +_gsl_vector_complex_float_view +gsl_matrix_complex_float_column (gsl_matrix_complex_float * m, const size_t j); + +_gsl_vector_complex_float_view +gsl_matrix_complex_float_diagonal (gsl_matrix_complex_float * m); + +_gsl_vector_complex_float_view +gsl_matrix_complex_float_subdiagonal (gsl_matrix_complex_float * m, const size_t k); + +_gsl_vector_complex_float_view +gsl_matrix_complex_float_superdiagonal (gsl_matrix_complex_float * m, const size_t k); + +_gsl_vector_complex_float_view +gsl_matrix_complex_float_subrow (gsl_matrix_complex_float * m, + const size_t i, const size_t offset, + const size_t n); + +_gsl_vector_complex_float_view +gsl_matrix_complex_float_subcolumn (gsl_matrix_complex_float * m, + const size_t j, const size_t offset, + const size_t n); + +_gsl_matrix_complex_float_view +gsl_matrix_complex_float_view_array (float * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_complex_float_view +gsl_matrix_complex_float_view_array_with_tda (float * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_complex_float_view +gsl_matrix_complex_float_view_vector (gsl_vector_complex_float * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_complex_float_view +gsl_matrix_complex_float_view_vector_with_tda (gsl_vector_complex_float * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_complex_float_const_view +gsl_matrix_complex_float_const_submatrix (const gsl_matrix_complex_float * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_complex_float_const_view +gsl_matrix_complex_float_const_row (const gsl_matrix_complex_float * m, + const size_t i); + +_gsl_vector_complex_float_const_view +gsl_matrix_complex_float_const_column (const gsl_matrix_complex_float * m, + const size_t j); + +_gsl_vector_complex_float_const_view +gsl_matrix_complex_float_const_diagonal (const gsl_matrix_complex_float * m); + +_gsl_vector_complex_float_const_view +gsl_matrix_complex_float_const_subdiagonal (const gsl_matrix_complex_float * m, + const size_t k); + +_gsl_vector_complex_float_const_view +gsl_matrix_complex_float_const_superdiagonal (const gsl_matrix_complex_float * m, + const size_t k); + +_gsl_vector_complex_float_const_view +gsl_matrix_complex_float_const_subrow (const gsl_matrix_complex_float * m, + const size_t i, const size_t offset, + const size_t n); + +_gsl_vector_complex_float_const_view +gsl_matrix_complex_float_const_subcolumn (const gsl_matrix_complex_float * m, + const size_t j, const size_t offset, + const size_t n); + +_gsl_matrix_complex_float_const_view +gsl_matrix_complex_float_const_view_array (const float * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_complex_float_const_view +gsl_matrix_complex_float_const_view_array_with_tda (const float * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_complex_float_const_view +gsl_matrix_complex_float_const_view_vector (const gsl_vector_complex_float * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_complex_float_const_view +gsl_matrix_complex_float_const_view_vector_with_tda (const gsl_vector_complex_float * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +void gsl_matrix_complex_float_set_zero (gsl_matrix_complex_float * m); +void gsl_matrix_complex_float_set_identity (gsl_matrix_complex_float * m); +void gsl_matrix_complex_float_set_all (gsl_matrix_complex_float * m, gsl_complex_float x); + +int gsl_matrix_complex_float_fread (FILE * stream, gsl_matrix_complex_float * m) ; +int gsl_matrix_complex_float_fwrite (FILE * stream, const gsl_matrix_complex_float * m) ; +int gsl_matrix_complex_float_fscanf (FILE * stream, gsl_matrix_complex_float * m); +int gsl_matrix_complex_float_fprintf (FILE * stream, const gsl_matrix_complex_float * m, const char * format); + +int gsl_matrix_complex_float_memcpy(gsl_matrix_complex_float * dest, const gsl_matrix_complex_float * src); +int gsl_matrix_complex_float_swap(gsl_matrix_complex_float * m1, gsl_matrix_complex_float * m2); +int gsl_matrix_complex_float_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_complex_float * dest, const gsl_matrix_complex_float * src); + +int gsl_matrix_complex_float_swap_rows(gsl_matrix_complex_float * m, const size_t i, const size_t j); +int gsl_matrix_complex_float_swap_columns(gsl_matrix_complex_float * m, const size_t i, const size_t j); +int gsl_matrix_complex_float_swap_rowcol(gsl_matrix_complex_float * m, const size_t i, const size_t j); + +int gsl_matrix_complex_float_transpose (gsl_matrix_complex_float * m); +int gsl_matrix_complex_float_transpose_memcpy (gsl_matrix_complex_float * dest, const gsl_matrix_complex_float * src); +int gsl_matrix_complex_float_transpose_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_complex_float * dest, const gsl_matrix_complex_float * src); + +int gsl_matrix_complex_float_equal (const gsl_matrix_complex_float * a, const gsl_matrix_complex_float * b); + +int gsl_matrix_complex_float_isnull (const gsl_matrix_complex_float * m); +int gsl_matrix_complex_float_ispos (const gsl_matrix_complex_float * m); +int gsl_matrix_complex_float_isneg (const gsl_matrix_complex_float * m); +int gsl_matrix_complex_float_isnonneg (const gsl_matrix_complex_float * m); + +int gsl_matrix_complex_float_add (gsl_matrix_complex_float * a, const gsl_matrix_complex_float * b); +int gsl_matrix_complex_float_sub (gsl_matrix_complex_float * a, const gsl_matrix_complex_float * b); +int gsl_matrix_complex_float_mul_elements (gsl_matrix_complex_float * a, const gsl_matrix_complex_float * b); +int gsl_matrix_complex_float_div_elements (gsl_matrix_complex_float * a, const gsl_matrix_complex_float * b); +int gsl_matrix_complex_float_scale (gsl_matrix_complex_float * a, const gsl_complex_float x); +int gsl_matrix_complex_float_add_constant (gsl_matrix_complex_float * a, const gsl_complex_float x); +int gsl_matrix_complex_float_add_diagonal (gsl_matrix_complex_float * a, const gsl_complex_float x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_complex_float_get_row(gsl_vector_complex_float * v, const gsl_matrix_complex_float * m, const size_t i); +int gsl_matrix_complex_float_get_col(gsl_vector_complex_float * v, const gsl_matrix_complex_float * m, const size_t j); +int gsl_matrix_complex_float_set_row(gsl_matrix_complex_float * m, const size_t i, const gsl_vector_complex_float * v); +int gsl_matrix_complex_float_set_col(gsl_matrix_complex_float * m, const size_t j, const gsl_vector_complex_float * v); +/***********************************************************************/ + +/* inline functions if you are using GCC */ + +INLINE_DECL gsl_complex_float gsl_matrix_complex_float_get(const gsl_matrix_complex_float * m, const size_t i, const size_t j); +INLINE_DECL void gsl_matrix_complex_float_set(gsl_matrix_complex_float * m, const size_t i, const size_t j, const gsl_complex_float x); + +INLINE_DECL gsl_complex_float * gsl_matrix_complex_float_ptr(gsl_matrix_complex_float * m, const size_t i, const size_t j); +INLINE_DECL const gsl_complex_float * gsl_matrix_complex_float_const_ptr(const gsl_matrix_complex_float * m, const size_t i, const size_t j); + +#ifdef HAVE_INLINE + +INLINE_FUN +gsl_complex_float +gsl_matrix_complex_float_get(const gsl_matrix_complex_float * m, + const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + gsl_complex_float zero = {{0,0}}; + + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, zero) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, zero) ; + } + } +#endif + return *(gsl_complex_float *)(m->data + 2*(i * m->tda + j)) ; +} + +INLINE_FUN +void +gsl_matrix_complex_float_set(gsl_matrix_complex_float * m, + const size_t i, const size_t j, const gsl_complex_float x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } + } +#endif + *(gsl_complex_float *)(m->data + 2*(i * m->tda + j)) = x ; +} + +INLINE_FUN +gsl_complex_float * +gsl_matrix_complex_float_ptr(gsl_matrix_complex_float * m, + const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (gsl_complex_float *)(m->data + 2*(i * m->tda + j)) ; +} + +INLINE_FUN +const gsl_complex_float * +gsl_matrix_complex_float_const_ptr(const gsl_matrix_complex_float * m, + const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (const gsl_complex_float *)(m->data + 2*(i * m->tda + j)) ; +} + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_MATRIX_COMPLEX_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_complex_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_complex_long_double.h new file mode 100644 index 000000000..58314ffa5 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_complex_long_double.h @@ -0,0 +1,353 @@ +/* matrix/gsl_matrix_complex_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_COMPLEX_LONG_DOUBLE_H__ +#define __GSL_MATRIX_COMPLEX_LONG_DOUBLE_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + long double * data; + gsl_block_complex_long_double * block; + int owner; +} gsl_matrix_complex_long_double ; + +typedef struct +{ + gsl_matrix_complex_long_double matrix; +} _gsl_matrix_complex_long_double_view; + +typedef _gsl_matrix_complex_long_double_view gsl_matrix_complex_long_double_view; + +typedef struct +{ + gsl_matrix_complex_long_double matrix; +} _gsl_matrix_complex_long_double_const_view; + +typedef const _gsl_matrix_complex_long_double_const_view gsl_matrix_complex_long_double_const_view; + + +/* Allocation */ + +gsl_matrix_complex_long_double * +gsl_matrix_complex_long_double_alloc (const size_t n1, const size_t n2); + +gsl_matrix_complex_long_double * +gsl_matrix_complex_long_double_calloc (const size_t n1, const size_t n2); + +gsl_matrix_complex_long_double * +gsl_matrix_complex_long_double_alloc_from_block (gsl_block_complex_long_double * b, + const size_t offset, + const size_t n1, const size_t n2, const size_t d2); + +gsl_matrix_complex_long_double * +gsl_matrix_complex_long_double_alloc_from_matrix (gsl_matrix_complex_long_double * b, + const size_t k1, const size_t k2, + const size_t n1, const size_t n2); + +gsl_vector_complex_long_double * +gsl_vector_complex_long_double_alloc_row_from_matrix (gsl_matrix_complex_long_double * m, + const size_t i); + +gsl_vector_complex_long_double * +gsl_vector_complex_long_double_alloc_col_from_matrix (gsl_matrix_complex_long_double * m, + const size_t j); + +void gsl_matrix_complex_long_double_free (gsl_matrix_complex_long_double * m); + +/* Views */ + +_gsl_matrix_complex_long_double_view +gsl_matrix_complex_long_double_submatrix (gsl_matrix_complex_long_double * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_complex_long_double_view +gsl_matrix_complex_long_double_row (gsl_matrix_complex_long_double * m, const size_t i); + +_gsl_vector_complex_long_double_view +gsl_matrix_complex_long_double_column (gsl_matrix_complex_long_double * m, const size_t j); + +_gsl_vector_complex_long_double_view +gsl_matrix_complex_long_double_diagonal (gsl_matrix_complex_long_double * m); + +_gsl_vector_complex_long_double_view +gsl_matrix_complex_long_double_subdiagonal (gsl_matrix_complex_long_double * m, const size_t k); + +_gsl_vector_complex_long_double_view +gsl_matrix_complex_long_double_superdiagonal (gsl_matrix_complex_long_double * m, const size_t k); + +_gsl_vector_complex_long_double_view +gsl_matrix_complex_long_double_subrow (gsl_matrix_complex_long_double * m, + const size_t i, const size_t offset, + const size_t n); + +_gsl_vector_complex_long_double_view +gsl_matrix_complex_long_double_subcolumn (gsl_matrix_complex_long_double * m, + const size_t j, const size_t offset, + const size_t n); + +_gsl_matrix_complex_long_double_view +gsl_matrix_complex_long_double_view_array (long double * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_complex_long_double_view +gsl_matrix_complex_long_double_view_array_with_tda (long double * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_complex_long_double_view +gsl_matrix_complex_long_double_view_vector (gsl_vector_complex_long_double * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_complex_long_double_view +gsl_matrix_complex_long_double_view_vector_with_tda (gsl_vector_complex_long_double * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_complex_long_double_const_view +gsl_matrix_complex_long_double_const_submatrix (const gsl_matrix_complex_long_double * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_complex_long_double_const_view +gsl_matrix_complex_long_double_const_row (const gsl_matrix_complex_long_double * m, + const size_t i); + +_gsl_vector_complex_long_double_const_view +gsl_matrix_complex_long_double_const_column (const gsl_matrix_complex_long_double * m, + const size_t j); + +_gsl_vector_complex_long_double_const_view +gsl_matrix_complex_long_double_const_diagonal (const gsl_matrix_complex_long_double * m); + +_gsl_vector_complex_long_double_const_view +gsl_matrix_complex_long_double_const_subdiagonal (const gsl_matrix_complex_long_double * m, + const size_t k); + +_gsl_vector_complex_long_double_const_view +gsl_matrix_complex_long_double_const_superdiagonal (const gsl_matrix_complex_long_double * m, + const size_t k); + +_gsl_vector_complex_long_double_const_view +gsl_matrix_complex_long_double_const_subrow (const gsl_matrix_complex_long_double * m, + const size_t i, const size_t offset, + const size_t n); + +_gsl_vector_complex_long_double_const_view +gsl_matrix_complex_long_double_const_subcolumn (const gsl_matrix_complex_long_double * m, + const size_t j, const size_t offset, + const size_t n); + +_gsl_matrix_complex_long_double_const_view +gsl_matrix_complex_long_double_const_view_array (const long double * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_complex_long_double_const_view +gsl_matrix_complex_long_double_const_view_array_with_tda (const long double * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_complex_long_double_const_view +gsl_matrix_complex_long_double_const_view_vector (const gsl_vector_complex_long_double * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_complex_long_double_const_view +gsl_matrix_complex_long_double_const_view_vector_with_tda (const gsl_vector_complex_long_double * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +void gsl_matrix_complex_long_double_set_zero (gsl_matrix_complex_long_double * m); +void gsl_matrix_complex_long_double_set_identity (gsl_matrix_complex_long_double * m); +void gsl_matrix_complex_long_double_set_all (gsl_matrix_complex_long_double * m, gsl_complex_long_double x); + +int gsl_matrix_complex_long_double_fread (FILE * stream, gsl_matrix_complex_long_double * m) ; +int gsl_matrix_complex_long_double_fwrite (FILE * stream, const gsl_matrix_complex_long_double * m) ; +int gsl_matrix_complex_long_double_fscanf (FILE * stream, gsl_matrix_complex_long_double * m); +int gsl_matrix_complex_long_double_fprintf (FILE * stream, const gsl_matrix_complex_long_double * m, const char * format); + +int gsl_matrix_complex_long_double_memcpy(gsl_matrix_complex_long_double * dest, const gsl_matrix_complex_long_double * src); +int gsl_matrix_complex_long_double_swap(gsl_matrix_complex_long_double * m1, gsl_matrix_complex_long_double * m2); +int gsl_matrix_complex_long_double_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_complex_long_double * dest, const gsl_matrix_complex_long_double * src); + +int gsl_matrix_complex_long_double_swap_rows(gsl_matrix_complex_long_double * m, const size_t i, const size_t j); +int gsl_matrix_complex_long_double_swap_columns(gsl_matrix_complex_long_double * m, const size_t i, const size_t j); +int gsl_matrix_complex_long_double_swap_rowcol(gsl_matrix_complex_long_double * m, const size_t i, const size_t j); + +int gsl_matrix_complex_long_double_transpose (gsl_matrix_complex_long_double * m); +int gsl_matrix_complex_long_double_transpose_memcpy (gsl_matrix_complex_long_double * dest, const gsl_matrix_complex_long_double * src); +int gsl_matrix_complex_long_double_transpose_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_complex_long_double * dest, const gsl_matrix_complex_long_double * src); + +int gsl_matrix_complex_long_double_equal (const gsl_matrix_complex_long_double * a, const gsl_matrix_complex_long_double * b); + +int gsl_matrix_complex_long_double_isnull (const gsl_matrix_complex_long_double * m); +int gsl_matrix_complex_long_double_ispos (const gsl_matrix_complex_long_double * m); +int gsl_matrix_complex_long_double_isneg (const gsl_matrix_complex_long_double * m); +int gsl_matrix_complex_long_double_isnonneg (const gsl_matrix_complex_long_double * m); + +int gsl_matrix_complex_long_double_add (gsl_matrix_complex_long_double * a, const gsl_matrix_complex_long_double * b); +int gsl_matrix_complex_long_double_sub (gsl_matrix_complex_long_double * a, const gsl_matrix_complex_long_double * b); +int gsl_matrix_complex_long_double_mul_elements (gsl_matrix_complex_long_double * a, const gsl_matrix_complex_long_double * b); +int gsl_matrix_complex_long_double_div_elements (gsl_matrix_complex_long_double * a, const gsl_matrix_complex_long_double * b); +int gsl_matrix_complex_long_double_scale (gsl_matrix_complex_long_double * a, const gsl_complex_long_double x); +int gsl_matrix_complex_long_double_add_constant (gsl_matrix_complex_long_double * a, const gsl_complex_long_double x); +int gsl_matrix_complex_long_double_add_diagonal (gsl_matrix_complex_long_double * a, const gsl_complex_long_double x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_complex_long_double_get_row(gsl_vector_complex_long_double * v, const gsl_matrix_complex_long_double * m, const size_t i); +int gsl_matrix_complex_long_double_get_col(gsl_vector_complex_long_double * v, const gsl_matrix_complex_long_double * m, const size_t j); +int gsl_matrix_complex_long_double_set_row(gsl_matrix_complex_long_double * m, const size_t i, const gsl_vector_complex_long_double * v); +int gsl_matrix_complex_long_double_set_col(gsl_matrix_complex_long_double * m, const size_t j, const gsl_vector_complex_long_double * v); +/***********************************************************************/ + +/* inline functions if you are using GCC */ + +INLINE_DECL gsl_complex_long_double gsl_matrix_complex_long_double_get(const gsl_matrix_complex_long_double * m, const size_t i, const size_t j); +INLINE_DECL void gsl_matrix_complex_long_double_set(gsl_matrix_complex_long_double * m, const size_t i, const size_t j, const gsl_complex_long_double x); + +INLINE_DECL gsl_complex_long_double * gsl_matrix_complex_long_double_ptr(gsl_matrix_complex_long_double * m, const size_t i, const size_t j); +INLINE_DECL const gsl_complex_long_double * gsl_matrix_complex_long_double_const_ptr(const gsl_matrix_complex_long_double * m, const size_t i, const size_t j); + +#ifdef HAVE_INLINE + +INLINE_FUN +gsl_complex_long_double +gsl_matrix_complex_long_double_get(const gsl_matrix_complex_long_double * m, + const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + gsl_complex_long_double zero = {{0,0}}; + + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, zero) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, zero) ; + } + } +#endif + return *(gsl_complex_long_double *)(m->data + 2*(i * m->tda + j)) ; +} + +INLINE_FUN +void +gsl_matrix_complex_long_double_set(gsl_matrix_complex_long_double * m, + const size_t i, const size_t j, const gsl_complex_long_double x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } + } +#endif + *(gsl_complex_long_double *)(m->data + 2*(i * m->tda + j)) = x ; +} + +INLINE_FUN +gsl_complex_long_double * +gsl_matrix_complex_long_double_ptr(gsl_matrix_complex_long_double * m, + const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (gsl_complex_long_double *)(m->data + 2*(i * m->tda + j)) ; +} + +INLINE_FUN +const gsl_complex_long_double * +gsl_matrix_complex_long_double_const_ptr(const gsl_matrix_complex_long_double * m, + const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (const gsl_complex_long_double *)(m->data + 2*(i * m->tda + j)) ; +} + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_MATRIX_COMPLEX_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_double.h new file mode 100644 index 000000000..64f7eed58 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_double.h @@ -0,0 +1,352 @@ +/* matrix/gsl_matrix_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_DOUBLE_H__ +#define __GSL_MATRIX_DOUBLE_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + double * data; + gsl_block * block; + int owner; +} gsl_matrix; + +typedef struct +{ + gsl_matrix matrix; +} _gsl_matrix_view; + +typedef _gsl_matrix_view gsl_matrix_view; + +typedef struct +{ + gsl_matrix matrix; +} _gsl_matrix_const_view; + +typedef const _gsl_matrix_const_view gsl_matrix_const_view; + +/* Allocation */ + +gsl_matrix * +gsl_matrix_alloc (const size_t n1, const size_t n2); + +gsl_matrix * +gsl_matrix_calloc (const size_t n1, const size_t n2); + +gsl_matrix * +gsl_matrix_alloc_from_block (gsl_block * b, + const size_t offset, + const size_t n1, + const size_t n2, + const size_t d2); + +gsl_matrix * +gsl_matrix_alloc_from_matrix (gsl_matrix * m, + const size_t k1, + const size_t k2, + const size_t n1, + const size_t n2); + +gsl_vector * +gsl_vector_alloc_row_from_matrix (gsl_matrix * m, + const size_t i); + +gsl_vector * +gsl_vector_alloc_col_from_matrix (gsl_matrix * m, + const size_t j); + +void gsl_matrix_free (gsl_matrix * m); + +/* Views */ + +_gsl_matrix_view +gsl_matrix_submatrix (gsl_matrix * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_view +gsl_matrix_row (gsl_matrix * m, const size_t i); + +_gsl_vector_view +gsl_matrix_column (gsl_matrix * m, const size_t j); + +_gsl_vector_view +gsl_matrix_diagonal (gsl_matrix * m); + +_gsl_vector_view +gsl_matrix_subdiagonal (gsl_matrix * m, const size_t k); + +_gsl_vector_view +gsl_matrix_superdiagonal (gsl_matrix * m, const size_t k); + +_gsl_vector_view +gsl_matrix_subrow (gsl_matrix * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_view +gsl_matrix_subcolumn (gsl_matrix * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_view +gsl_matrix_view_array (double * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_view +gsl_matrix_view_array_with_tda (double * base, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_view +gsl_matrix_view_vector (gsl_vector * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_view +gsl_matrix_view_vector_with_tda (gsl_vector * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_const_view +gsl_matrix_const_submatrix (const gsl_matrix * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_const_view +gsl_matrix_const_row (const gsl_matrix * m, + const size_t i); + +_gsl_vector_const_view +gsl_matrix_const_column (const gsl_matrix * m, + const size_t j); + +_gsl_vector_const_view +gsl_matrix_const_diagonal (const gsl_matrix * m); + +_gsl_vector_const_view +gsl_matrix_const_subdiagonal (const gsl_matrix * m, + const size_t k); + +_gsl_vector_const_view +gsl_matrix_const_superdiagonal (const gsl_matrix * m, + const size_t k); + +_gsl_vector_const_view +gsl_matrix_const_subrow (const gsl_matrix * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_const_view +gsl_matrix_const_subcolumn (const gsl_matrix * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_const_view +gsl_matrix_const_view_array (const double * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_const_view +gsl_matrix_const_view_array_with_tda (const double * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_const_view +gsl_matrix_const_view_vector (const gsl_vector * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_const_view +gsl_matrix_const_view_vector_with_tda (const gsl_vector * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +void gsl_matrix_set_zero (gsl_matrix * m); +void gsl_matrix_set_identity (gsl_matrix * m); +void gsl_matrix_set_all (gsl_matrix * m, double x); + +int gsl_matrix_fread (FILE * stream, gsl_matrix * m) ; +int gsl_matrix_fwrite (FILE * stream, const gsl_matrix * m) ; +int gsl_matrix_fscanf (FILE * stream, gsl_matrix * m); +int gsl_matrix_fprintf (FILE * stream, const gsl_matrix * m, const char * format); + +int gsl_matrix_memcpy(gsl_matrix * dest, const gsl_matrix * src); +int gsl_matrix_swap(gsl_matrix * m1, gsl_matrix * m2); +int gsl_matrix_tricpy(const char uplo_src, const int copy_diag, gsl_matrix * dest, const gsl_matrix * src); + +int gsl_matrix_swap_rows(gsl_matrix * m, const size_t i, const size_t j); +int gsl_matrix_swap_columns(gsl_matrix * m, const size_t i, const size_t j); +int gsl_matrix_swap_rowcol(gsl_matrix * m, const size_t i, const size_t j); +int gsl_matrix_transpose (gsl_matrix * m); +int gsl_matrix_transpose_memcpy (gsl_matrix * dest, const gsl_matrix * src); +int gsl_matrix_transpose_tricpy (const char uplo_src, const int copy_diag, gsl_matrix * dest, const gsl_matrix * src); + +double gsl_matrix_max (const gsl_matrix * m); +double gsl_matrix_min (const gsl_matrix * m); +void gsl_matrix_minmax (const gsl_matrix * m, double * min_out, double * max_out); + +void gsl_matrix_max_index (const gsl_matrix * m, size_t * imax, size_t *jmax); +void gsl_matrix_min_index (const gsl_matrix * m, size_t * imin, size_t *jmin); +void gsl_matrix_minmax_index (const gsl_matrix * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); + +int gsl_matrix_equal (const gsl_matrix * a, const gsl_matrix * b); + +int gsl_matrix_isnull (const gsl_matrix * m); +int gsl_matrix_ispos (const gsl_matrix * m); +int gsl_matrix_isneg (const gsl_matrix * m); +int gsl_matrix_isnonneg (const gsl_matrix * m); + +int gsl_matrix_add (gsl_matrix * a, const gsl_matrix * b); +int gsl_matrix_sub (gsl_matrix * a, const gsl_matrix * b); +int gsl_matrix_mul_elements (gsl_matrix * a, const gsl_matrix * b); +int gsl_matrix_div_elements (gsl_matrix * a, const gsl_matrix * b); +int gsl_matrix_scale (gsl_matrix * a, const double x); +int gsl_matrix_add_constant (gsl_matrix * a, const double x); +int gsl_matrix_add_diagonal (gsl_matrix * a, const double x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_get_row(gsl_vector * v, const gsl_matrix * m, const size_t i); +int gsl_matrix_get_col(gsl_vector * v, const gsl_matrix * m, const size_t j); +int gsl_matrix_set_row(gsl_matrix * m, const size_t i, const gsl_vector * v); +int gsl_matrix_set_col(gsl_matrix * m, const size_t j, const gsl_vector * v); +/***********************************************************************/ + +/* inline functions if you are using GCC */ + +INLINE_DECL double gsl_matrix_get(const gsl_matrix * m, const size_t i, const size_t j); +INLINE_DECL void gsl_matrix_set(gsl_matrix * m, const size_t i, const size_t j, const double x); +INLINE_DECL double * gsl_matrix_ptr(gsl_matrix * m, const size_t i, const size_t j); +INLINE_DECL const double * gsl_matrix_const_ptr(const gsl_matrix * m, const size_t i, const size_t j); + +#ifdef HAVE_INLINE +INLINE_FUN +double +gsl_matrix_get(const gsl_matrix * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; + } + } +#endif + return m->data[i * m->tda + j] ; +} + +INLINE_FUN +void +gsl_matrix_set(gsl_matrix * m, const size_t i, const size_t j, const double x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } + } +#endif + m->data[i * m->tda + j] = x ; +} + +INLINE_FUN +double * +gsl_matrix_ptr(gsl_matrix * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (double *) (m->data + (i * m->tda + j)) ; +} + +INLINE_FUN +const double * +gsl_matrix_const_ptr(const gsl_matrix * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (const double *) (m->data + (i * m->tda + j)) ; +} + +#endif + +__END_DECLS + +#endif /* __GSL_MATRIX_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_float.h new file mode 100644 index 000000000..baa50079d --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_float.h @@ -0,0 +1,352 @@ +/* matrix/gsl_matrix_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_FLOAT_H__ +#define __GSL_MATRIX_FLOAT_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + float * data; + gsl_block_float * block; + int owner; +} gsl_matrix_float; + +typedef struct +{ + gsl_matrix_float matrix; +} _gsl_matrix_float_view; + +typedef _gsl_matrix_float_view gsl_matrix_float_view; + +typedef struct +{ + gsl_matrix_float matrix; +} _gsl_matrix_float_const_view; + +typedef const _gsl_matrix_float_const_view gsl_matrix_float_const_view; + +/* Allocation */ + +gsl_matrix_float * +gsl_matrix_float_alloc (const size_t n1, const size_t n2); + +gsl_matrix_float * +gsl_matrix_float_calloc (const size_t n1, const size_t n2); + +gsl_matrix_float * +gsl_matrix_float_alloc_from_block (gsl_block_float * b, + const size_t offset, + const size_t n1, + const size_t n2, + const size_t d2); + +gsl_matrix_float * +gsl_matrix_float_alloc_from_matrix (gsl_matrix_float * m, + const size_t k1, + const size_t k2, + const size_t n1, + const size_t n2); + +gsl_vector_float * +gsl_vector_float_alloc_row_from_matrix (gsl_matrix_float * m, + const size_t i); + +gsl_vector_float * +gsl_vector_float_alloc_col_from_matrix (gsl_matrix_float * m, + const size_t j); + +void gsl_matrix_float_free (gsl_matrix_float * m); + +/* Views */ + +_gsl_matrix_float_view +gsl_matrix_float_submatrix (gsl_matrix_float * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_float_view +gsl_matrix_float_row (gsl_matrix_float * m, const size_t i); + +_gsl_vector_float_view +gsl_matrix_float_column (gsl_matrix_float * m, const size_t j); + +_gsl_vector_float_view +gsl_matrix_float_diagonal (gsl_matrix_float * m); + +_gsl_vector_float_view +gsl_matrix_float_subdiagonal (gsl_matrix_float * m, const size_t k); + +_gsl_vector_float_view +gsl_matrix_float_superdiagonal (gsl_matrix_float * m, const size_t k); + +_gsl_vector_float_view +gsl_matrix_float_subrow (gsl_matrix_float * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_float_view +gsl_matrix_float_subcolumn (gsl_matrix_float * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_float_view +gsl_matrix_float_view_array (float * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_float_view +gsl_matrix_float_view_array_with_tda (float * base, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_float_view +gsl_matrix_float_view_vector (gsl_vector_float * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_float_view +gsl_matrix_float_view_vector_with_tda (gsl_vector_float * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_float_const_view +gsl_matrix_float_const_submatrix (const gsl_matrix_float * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_float_const_view +gsl_matrix_float_const_row (const gsl_matrix_float * m, + const size_t i); + +_gsl_vector_float_const_view +gsl_matrix_float_const_column (const gsl_matrix_float * m, + const size_t j); + +_gsl_vector_float_const_view +gsl_matrix_float_const_diagonal (const gsl_matrix_float * m); + +_gsl_vector_float_const_view +gsl_matrix_float_const_subdiagonal (const gsl_matrix_float * m, + const size_t k); + +_gsl_vector_float_const_view +gsl_matrix_float_const_superdiagonal (const gsl_matrix_float * m, + const size_t k); + +_gsl_vector_float_const_view +gsl_matrix_float_const_subrow (const gsl_matrix_float * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_float_const_view +gsl_matrix_float_const_subcolumn (const gsl_matrix_float * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_float_const_view +gsl_matrix_float_const_view_array (const float * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_float_const_view +gsl_matrix_float_const_view_array_with_tda (const float * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_float_const_view +gsl_matrix_float_const_view_vector (const gsl_vector_float * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_float_const_view +gsl_matrix_float_const_view_vector_with_tda (const gsl_vector_float * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +void gsl_matrix_float_set_zero (gsl_matrix_float * m); +void gsl_matrix_float_set_identity (gsl_matrix_float * m); +void gsl_matrix_float_set_all (gsl_matrix_float * m, float x); + +int gsl_matrix_float_fread (FILE * stream, gsl_matrix_float * m) ; +int gsl_matrix_float_fwrite (FILE * stream, const gsl_matrix_float * m) ; +int gsl_matrix_float_fscanf (FILE * stream, gsl_matrix_float * m); +int gsl_matrix_float_fprintf (FILE * stream, const gsl_matrix_float * m, const char * format); + +int gsl_matrix_float_memcpy(gsl_matrix_float * dest, const gsl_matrix_float * src); +int gsl_matrix_float_swap(gsl_matrix_float * m1, gsl_matrix_float * m2); +int gsl_matrix_float_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_float * dest, const gsl_matrix_float * src); + +int gsl_matrix_float_swap_rows(gsl_matrix_float * m, const size_t i, const size_t j); +int gsl_matrix_float_swap_columns(gsl_matrix_float * m, const size_t i, const size_t j); +int gsl_matrix_float_swap_rowcol(gsl_matrix_float * m, const size_t i, const size_t j); +int gsl_matrix_float_transpose (gsl_matrix_float * m); +int gsl_matrix_float_transpose_memcpy (gsl_matrix_float * dest, const gsl_matrix_float * src); +int gsl_matrix_float_transpose_tricpy (const char uplo_src, const int copy_diag, gsl_matrix_float * dest, const gsl_matrix_float * src); + +float gsl_matrix_float_max (const gsl_matrix_float * m); +float gsl_matrix_float_min (const gsl_matrix_float * m); +void gsl_matrix_float_minmax (const gsl_matrix_float * m, float * min_out, float * max_out); + +void gsl_matrix_float_max_index (const gsl_matrix_float * m, size_t * imax, size_t *jmax); +void gsl_matrix_float_min_index (const gsl_matrix_float * m, size_t * imin, size_t *jmin); +void gsl_matrix_float_minmax_index (const gsl_matrix_float * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); + +int gsl_matrix_float_equal (const gsl_matrix_float * a, const gsl_matrix_float * b); + +int gsl_matrix_float_isnull (const gsl_matrix_float * m); +int gsl_matrix_float_ispos (const gsl_matrix_float * m); +int gsl_matrix_float_isneg (const gsl_matrix_float * m); +int gsl_matrix_float_isnonneg (const gsl_matrix_float * m); + +int gsl_matrix_float_add (gsl_matrix_float * a, const gsl_matrix_float * b); +int gsl_matrix_float_sub (gsl_matrix_float * a, const gsl_matrix_float * b); +int gsl_matrix_float_mul_elements (gsl_matrix_float * a, const gsl_matrix_float * b); +int gsl_matrix_float_div_elements (gsl_matrix_float * a, const gsl_matrix_float * b); +int gsl_matrix_float_scale (gsl_matrix_float * a, const double x); +int gsl_matrix_float_add_constant (gsl_matrix_float * a, const double x); +int gsl_matrix_float_add_diagonal (gsl_matrix_float * a, const double x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_float_get_row(gsl_vector_float * v, const gsl_matrix_float * m, const size_t i); +int gsl_matrix_float_get_col(gsl_vector_float * v, const gsl_matrix_float * m, const size_t j); +int gsl_matrix_float_set_row(gsl_matrix_float * m, const size_t i, const gsl_vector_float * v); +int gsl_matrix_float_set_col(gsl_matrix_float * m, const size_t j, const gsl_vector_float * v); +/***********************************************************************/ + +/* inline functions if you are using GCC */ + +INLINE_DECL float gsl_matrix_float_get(const gsl_matrix_float * m, const size_t i, const size_t j); +INLINE_DECL void gsl_matrix_float_set(gsl_matrix_float * m, const size_t i, const size_t j, const float x); +INLINE_DECL float * gsl_matrix_float_ptr(gsl_matrix_float * m, const size_t i, const size_t j); +INLINE_DECL const float * gsl_matrix_float_const_ptr(const gsl_matrix_float * m, const size_t i, const size_t j); + +#ifdef HAVE_INLINE +INLINE_FUN +float +gsl_matrix_float_get(const gsl_matrix_float * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; + } + } +#endif + return m->data[i * m->tda + j] ; +} + +INLINE_FUN +void +gsl_matrix_float_set(gsl_matrix_float * m, const size_t i, const size_t j, const float x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } + } +#endif + m->data[i * m->tda + j] = x ; +} + +INLINE_FUN +float * +gsl_matrix_float_ptr(gsl_matrix_float * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (float *) (m->data + (i * m->tda + j)) ; +} + +INLINE_FUN +const float * +gsl_matrix_float_const_ptr(const gsl_matrix_float * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (const float *) (m->data + (i * m->tda + j)) ; +} + +#endif + +__END_DECLS + +#endif /* __GSL_MATRIX_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_int.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_int.h new file mode 100644 index 000000000..b2b9c6106 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_int.h @@ -0,0 +1,352 @@ +/* matrix/gsl_matrix_int.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_INT_H__ +#define __GSL_MATRIX_INT_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + int * data; + gsl_block_int * block; + int owner; +} gsl_matrix_int; + +typedef struct +{ + gsl_matrix_int matrix; +} _gsl_matrix_int_view; + +typedef _gsl_matrix_int_view gsl_matrix_int_view; + +typedef struct +{ + gsl_matrix_int matrix; +} _gsl_matrix_int_const_view; + +typedef const _gsl_matrix_int_const_view gsl_matrix_int_const_view; + +/* Allocation */ + +gsl_matrix_int * +gsl_matrix_int_alloc (const size_t n1, const size_t n2); + +gsl_matrix_int * +gsl_matrix_int_calloc (const size_t n1, const size_t n2); + +gsl_matrix_int * +gsl_matrix_int_alloc_from_block (gsl_block_int * b, + const size_t offset, + const size_t n1, + const size_t n2, + const size_t d2); + +gsl_matrix_int * +gsl_matrix_int_alloc_from_matrix (gsl_matrix_int * m, + const size_t k1, + const size_t k2, + const size_t n1, + const size_t n2); + +gsl_vector_int * +gsl_vector_int_alloc_row_from_matrix (gsl_matrix_int * m, + const size_t i); + +gsl_vector_int * +gsl_vector_int_alloc_col_from_matrix (gsl_matrix_int * m, + const size_t j); + +void gsl_matrix_int_free (gsl_matrix_int * m); + +/* Views */ + +_gsl_matrix_int_view +gsl_matrix_int_submatrix (gsl_matrix_int * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_int_view +gsl_matrix_int_row (gsl_matrix_int * m, const size_t i); + +_gsl_vector_int_view +gsl_matrix_int_column (gsl_matrix_int * m, const size_t j); + +_gsl_vector_int_view +gsl_matrix_int_diagonal (gsl_matrix_int * m); + +_gsl_vector_int_view +gsl_matrix_int_subdiagonal (gsl_matrix_int * m, const size_t k); + +_gsl_vector_int_view +gsl_matrix_int_superdiagonal (gsl_matrix_int * m, const size_t k); + +_gsl_vector_int_view +gsl_matrix_int_subrow (gsl_matrix_int * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_int_view +gsl_matrix_int_subcolumn (gsl_matrix_int * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_int_view +gsl_matrix_int_view_array (int * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_int_view +gsl_matrix_int_view_array_with_tda (int * base, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_int_view +gsl_matrix_int_view_vector (gsl_vector_int * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_int_view +gsl_matrix_int_view_vector_with_tda (gsl_vector_int * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_int_const_view +gsl_matrix_int_const_submatrix (const gsl_matrix_int * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_int_const_view +gsl_matrix_int_const_row (const gsl_matrix_int * m, + const size_t i); + +_gsl_vector_int_const_view +gsl_matrix_int_const_column (const gsl_matrix_int * m, + const size_t j); + +_gsl_vector_int_const_view +gsl_matrix_int_const_diagonal (const gsl_matrix_int * m); + +_gsl_vector_int_const_view +gsl_matrix_int_const_subdiagonal (const gsl_matrix_int * m, + const size_t k); + +_gsl_vector_int_const_view +gsl_matrix_int_const_superdiagonal (const gsl_matrix_int * m, + const size_t k); + +_gsl_vector_int_const_view +gsl_matrix_int_const_subrow (const gsl_matrix_int * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_int_const_view +gsl_matrix_int_const_subcolumn (const gsl_matrix_int * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_int_const_view +gsl_matrix_int_const_view_array (const int * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_int_const_view +gsl_matrix_int_const_view_array_with_tda (const int * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_int_const_view +gsl_matrix_int_const_view_vector (const gsl_vector_int * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_int_const_view +gsl_matrix_int_const_view_vector_with_tda (const gsl_vector_int * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +void gsl_matrix_int_set_zero (gsl_matrix_int * m); +void gsl_matrix_int_set_identity (gsl_matrix_int * m); +void gsl_matrix_int_set_all (gsl_matrix_int * m, int x); + +int gsl_matrix_int_fread (FILE * stream, gsl_matrix_int * m) ; +int gsl_matrix_int_fwrite (FILE * stream, const gsl_matrix_int * m) ; +int gsl_matrix_int_fscanf (FILE * stream, gsl_matrix_int * m); +int gsl_matrix_int_fprintf (FILE * stream, const gsl_matrix_int * m, const char * format); + +int gsl_matrix_int_memcpy(gsl_matrix_int * dest, const gsl_matrix_int * src); +int gsl_matrix_int_swap(gsl_matrix_int * m1, gsl_matrix_int * m2); +int gsl_matrix_int_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_int * dest, const gsl_matrix_int * src); + +int gsl_matrix_int_swap_rows(gsl_matrix_int * m, const size_t i, const size_t j); +int gsl_matrix_int_swap_columns(gsl_matrix_int * m, const size_t i, const size_t j); +int gsl_matrix_int_swap_rowcol(gsl_matrix_int * m, const size_t i, const size_t j); +int gsl_matrix_int_transpose (gsl_matrix_int * m); +int gsl_matrix_int_transpose_memcpy (gsl_matrix_int * dest, const gsl_matrix_int * src); +int gsl_matrix_int_transpose_tricpy (const char uplo_src, const int copy_diag, gsl_matrix_int * dest, const gsl_matrix_int * src); + +int gsl_matrix_int_max (const gsl_matrix_int * m); +int gsl_matrix_int_min (const gsl_matrix_int * m); +void gsl_matrix_int_minmax (const gsl_matrix_int * m, int * min_out, int * max_out); + +void gsl_matrix_int_max_index (const gsl_matrix_int * m, size_t * imax, size_t *jmax); +void gsl_matrix_int_min_index (const gsl_matrix_int * m, size_t * imin, size_t *jmin); +void gsl_matrix_int_minmax_index (const gsl_matrix_int * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); + +int gsl_matrix_int_equal (const gsl_matrix_int * a, const gsl_matrix_int * b); + +int gsl_matrix_int_isnull (const gsl_matrix_int * m); +int gsl_matrix_int_ispos (const gsl_matrix_int * m); +int gsl_matrix_int_isneg (const gsl_matrix_int * m); +int gsl_matrix_int_isnonneg (const gsl_matrix_int * m); + +int gsl_matrix_int_add (gsl_matrix_int * a, const gsl_matrix_int * b); +int gsl_matrix_int_sub (gsl_matrix_int * a, const gsl_matrix_int * b); +int gsl_matrix_int_mul_elements (gsl_matrix_int * a, const gsl_matrix_int * b); +int gsl_matrix_int_div_elements (gsl_matrix_int * a, const gsl_matrix_int * b); +int gsl_matrix_int_scale (gsl_matrix_int * a, const double x); +int gsl_matrix_int_add_constant (gsl_matrix_int * a, const double x); +int gsl_matrix_int_add_diagonal (gsl_matrix_int * a, const double x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_int_get_row(gsl_vector_int * v, const gsl_matrix_int * m, const size_t i); +int gsl_matrix_int_get_col(gsl_vector_int * v, const gsl_matrix_int * m, const size_t j); +int gsl_matrix_int_set_row(gsl_matrix_int * m, const size_t i, const gsl_vector_int * v); +int gsl_matrix_int_set_col(gsl_matrix_int * m, const size_t j, const gsl_vector_int * v); +/***********************************************************************/ + +/* inline functions if you are using GCC */ + +INLINE_DECL int gsl_matrix_int_get(const gsl_matrix_int * m, const size_t i, const size_t j); +INLINE_DECL void gsl_matrix_int_set(gsl_matrix_int * m, const size_t i, const size_t j, const int x); +INLINE_DECL int * gsl_matrix_int_ptr(gsl_matrix_int * m, const size_t i, const size_t j); +INLINE_DECL const int * gsl_matrix_int_const_ptr(const gsl_matrix_int * m, const size_t i, const size_t j); + +#ifdef HAVE_INLINE +INLINE_FUN +int +gsl_matrix_int_get(const gsl_matrix_int * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; + } + } +#endif + return m->data[i * m->tda + j] ; +} + +INLINE_FUN +void +gsl_matrix_int_set(gsl_matrix_int * m, const size_t i, const size_t j, const int x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } + } +#endif + m->data[i * m->tda + j] = x ; +} + +INLINE_FUN +int * +gsl_matrix_int_ptr(gsl_matrix_int * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (int *) (m->data + (i * m->tda + j)) ; +} + +INLINE_FUN +const int * +gsl_matrix_int_const_ptr(const gsl_matrix_int * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (const int *) (m->data + (i * m->tda + j)) ; +} + +#endif + +__END_DECLS + +#endif /* __GSL_MATRIX_INT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_long.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_long.h new file mode 100644 index 000000000..f9b097ccd --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_long.h @@ -0,0 +1,352 @@ +/* matrix/gsl_matrix_long.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_LONG_H__ +#define __GSL_MATRIX_LONG_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + long * data; + gsl_block_long * block; + int owner; +} gsl_matrix_long; + +typedef struct +{ + gsl_matrix_long matrix; +} _gsl_matrix_long_view; + +typedef _gsl_matrix_long_view gsl_matrix_long_view; + +typedef struct +{ + gsl_matrix_long matrix; +} _gsl_matrix_long_const_view; + +typedef const _gsl_matrix_long_const_view gsl_matrix_long_const_view; + +/* Allocation */ + +gsl_matrix_long * +gsl_matrix_long_alloc (const size_t n1, const size_t n2); + +gsl_matrix_long * +gsl_matrix_long_calloc (const size_t n1, const size_t n2); + +gsl_matrix_long * +gsl_matrix_long_alloc_from_block (gsl_block_long * b, + const size_t offset, + const size_t n1, + const size_t n2, + const size_t d2); + +gsl_matrix_long * +gsl_matrix_long_alloc_from_matrix (gsl_matrix_long * m, + const size_t k1, + const size_t k2, + const size_t n1, + const size_t n2); + +gsl_vector_long * +gsl_vector_long_alloc_row_from_matrix (gsl_matrix_long * m, + const size_t i); + +gsl_vector_long * +gsl_vector_long_alloc_col_from_matrix (gsl_matrix_long * m, + const size_t j); + +void gsl_matrix_long_free (gsl_matrix_long * m); + +/* Views */ + +_gsl_matrix_long_view +gsl_matrix_long_submatrix (gsl_matrix_long * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_long_view +gsl_matrix_long_row (gsl_matrix_long * m, const size_t i); + +_gsl_vector_long_view +gsl_matrix_long_column (gsl_matrix_long * m, const size_t j); + +_gsl_vector_long_view +gsl_matrix_long_diagonal (gsl_matrix_long * m); + +_gsl_vector_long_view +gsl_matrix_long_subdiagonal (gsl_matrix_long * m, const size_t k); + +_gsl_vector_long_view +gsl_matrix_long_superdiagonal (gsl_matrix_long * m, const size_t k); + +_gsl_vector_long_view +gsl_matrix_long_subrow (gsl_matrix_long * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_long_view +gsl_matrix_long_subcolumn (gsl_matrix_long * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_long_view +gsl_matrix_long_view_array (long * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_long_view +gsl_matrix_long_view_array_with_tda (long * base, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_long_view +gsl_matrix_long_view_vector (gsl_vector_long * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_long_view +gsl_matrix_long_view_vector_with_tda (gsl_vector_long * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_long_const_view +gsl_matrix_long_const_submatrix (const gsl_matrix_long * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_long_const_view +gsl_matrix_long_const_row (const gsl_matrix_long * m, + const size_t i); + +_gsl_vector_long_const_view +gsl_matrix_long_const_column (const gsl_matrix_long * m, + const size_t j); + +_gsl_vector_long_const_view +gsl_matrix_long_const_diagonal (const gsl_matrix_long * m); + +_gsl_vector_long_const_view +gsl_matrix_long_const_subdiagonal (const gsl_matrix_long * m, + const size_t k); + +_gsl_vector_long_const_view +gsl_matrix_long_const_superdiagonal (const gsl_matrix_long * m, + const size_t k); + +_gsl_vector_long_const_view +gsl_matrix_long_const_subrow (const gsl_matrix_long * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_long_const_view +gsl_matrix_long_const_subcolumn (const gsl_matrix_long * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_long_const_view +gsl_matrix_long_const_view_array (const long * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_long_const_view +gsl_matrix_long_const_view_array_with_tda (const long * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_long_const_view +gsl_matrix_long_const_view_vector (const gsl_vector_long * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_long_const_view +gsl_matrix_long_const_view_vector_with_tda (const gsl_vector_long * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +void gsl_matrix_long_set_zero (gsl_matrix_long * m); +void gsl_matrix_long_set_identity (gsl_matrix_long * m); +void gsl_matrix_long_set_all (gsl_matrix_long * m, long x); + +int gsl_matrix_long_fread (FILE * stream, gsl_matrix_long * m) ; +int gsl_matrix_long_fwrite (FILE * stream, const gsl_matrix_long * m) ; +int gsl_matrix_long_fscanf (FILE * stream, gsl_matrix_long * m); +int gsl_matrix_long_fprintf (FILE * stream, const gsl_matrix_long * m, const char * format); + +int gsl_matrix_long_memcpy(gsl_matrix_long * dest, const gsl_matrix_long * src); +int gsl_matrix_long_swap(gsl_matrix_long * m1, gsl_matrix_long * m2); +int gsl_matrix_long_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_long * dest, const gsl_matrix_long * src); + +int gsl_matrix_long_swap_rows(gsl_matrix_long * m, const size_t i, const size_t j); +int gsl_matrix_long_swap_columns(gsl_matrix_long * m, const size_t i, const size_t j); +int gsl_matrix_long_swap_rowcol(gsl_matrix_long * m, const size_t i, const size_t j); +int gsl_matrix_long_transpose (gsl_matrix_long * m); +int gsl_matrix_long_transpose_memcpy (gsl_matrix_long * dest, const gsl_matrix_long * src); +int gsl_matrix_long_transpose_tricpy (const char uplo_src, const int copy_diag, gsl_matrix_long * dest, const gsl_matrix_long * src); + +long gsl_matrix_long_max (const gsl_matrix_long * m); +long gsl_matrix_long_min (const gsl_matrix_long * m); +void gsl_matrix_long_minmax (const gsl_matrix_long * m, long * min_out, long * max_out); + +void gsl_matrix_long_max_index (const gsl_matrix_long * m, size_t * imax, size_t *jmax); +void gsl_matrix_long_min_index (const gsl_matrix_long * m, size_t * imin, size_t *jmin); +void gsl_matrix_long_minmax_index (const gsl_matrix_long * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); + +int gsl_matrix_long_equal (const gsl_matrix_long * a, const gsl_matrix_long * b); + +int gsl_matrix_long_isnull (const gsl_matrix_long * m); +int gsl_matrix_long_ispos (const gsl_matrix_long * m); +int gsl_matrix_long_isneg (const gsl_matrix_long * m); +int gsl_matrix_long_isnonneg (const gsl_matrix_long * m); + +int gsl_matrix_long_add (gsl_matrix_long * a, const gsl_matrix_long * b); +int gsl_matrix_long_sub (gsl_matrix_long * a, const gsl_matrix_long * b); +int gsl_matrix_long_mul_elements (gsl_matrix_long * a, const gsl_matrix_long * b); +int gsl_matrix_long_div_elements (gsl_matrix_long * a, const gsl_matrix_long * b); +int gsl_matrix_long_scale (gsl_matrix_long * a, const double x); +int gsl_matrix_long_add_constant (gsl_matrix_long * a, const double x); +int gsl_matrix_long_add_diagonal (gsl_matrix_long * a, const double x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_long_get_row(gsl_vector_long * v, const gsl_matrix_long * m, const size_t i); +int gsl_matrix_long_get_col(gsl_vector_long * v, const gsl_matrix_long * m, const size_t j); +int gsl_matrix_long_set_row(gsl_matrix_long * m, const size_t i, const gsl_vector_long * v); +int gsl_matrix_long_set_col(gsl_matrix_long * m, const size_t j, const gsl_vector_long * v); +/***********************************************************************/ + +/* inline functions if you are using GCC */ + +INLINE_DECL long gsl_matrix_long_get(const gsl_matrix_long * m, const size_t i, const size_t j); +INLINE_DECL void gsl_matrix_long_set(gsl_matrix_long * m, const size_t i, const size_t j, const long x); +INLINE_DECL long * gsl_matrix_long_ptr(gsl_matrix_long * m, const size_t i, const size_t j); +INLINE_DECL const long * gsl_matrix_long_const_ptr(const gsl_matrix_long * m, const size_t i, const size_t j); + +#ifdef HAVE_INLINE +INLINE_FUN +long +gsl_matrix_long_get(const gsl_matrix_long * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; + } + } +#endif + return m->data[i * m->tda + j] ; +} + +INLINE_FUN +void +gsl_matrix_long_set(gsl_matrix_long * m, const size_t i, const size_t j, const long x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } + } +#endif + m->data[i * m->tda + j] = x ; +} + +INLINE_FUN +long * +gsl_matrix_long_ptr(gsl_matrix_long * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (long *) (m->data + (i * m->tda + j)) ; +} + +INLINE_FUN +const long * +gsl_matrix_long_const_ptr(const gsl_matrix_long * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (const long *) (m->data + (i * m->tda + j)) ; +} + +#endif + +__END_DECLS + +#endif /* __GSL_MATRIX_LONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_long_double.h new file mode 100644 index 000000000..0f5555350 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_long_double.h @@ -0,0 +1,352 @@ +/* matrix/gsl_matrix_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_LONG_DOUBLE_H__ +#define __GSL_MATRIX_LONG_DOUBLE_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + long double * data; + gsl_block_long_double * block; + int owner; +} gsl_matrix_long_double; + +typedef struct +{ + gsl_matrix_long_double matrix; +} _gsl_matrix_long_double_view; + +typedef _gsl_matrix_long_double_view gsl_matrix_long_double_view; + +typedef struct +{ + gsl_matrix_long_double matrix; +} _gsl_matrix_long_double_const_view; + +typedef const _gsl_matrix_long_double_const_view gsl_matrix_long_double_const_view; + +/* Allocation */ + +gsl_matrix_long_double * +gsl_matrix_long_double_alloc (const size_t n1, const size_t n2); + +gsl_matrix_long_double * +gsl_matrix_long_double_calloc (const size_t n1, const size_t n2); + +gsl_matrix_long_double * +gsl_matrix_long_double_alloc_from_block (gsl_block_long_double * b, + const size_t offset, + const size_t n1, + const size_t n2, + const size_t d2); + +gsl_matrix_long_double * +gsl_matrix_long_double_alloc_from_matrix (gsl_matrix_long_double * m, + const size_t k1, + const size_t k2, + const size_t n1, + const size_t n2); + +gsl_vector_long_double * +gsl_vector_long_double_alloc_row_from_matrix (gsl_matrix_long_double * m, + const size_t i); + +gsl_vector_long_double * +gsl_vector_long_double_alloc_col_from_matrix (gsl_matrix_long_double * m, + const size_t j); + +void gsl_matrix_long_double_free (gsl_matrix_long_double * m); + +/* Views */ + +_gsl_matrix_long_double_view +gsl_matrix_long_double_submatrix (gsl_matrix_long_double * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_long_double_view +gsl_matrix_long_double_row (gsl_matrix_long_double * m, const size_t i); + +_gsl_vector_long_double_view +gsl_matrix_long_double_column (gsl_matrix_long_double * m, const size_t j); + +_gsl_vector_long_double_view +gsl_matrix_long_double_diagonal (gsl_matrix_long_double * m); + +_gsl_vector_long_double_view +gsl_matrix_long_double_subdiagonal (gsl_matrix_long_double * m, const size_t k); + +_gsl_vector_long_double_view +gsl_matrix_long_double_superdiagonal (gsl_matrix_long_double * m, const size_t k); + +_gsl_vector_long_double_view +gsl_matrix_long_double_subrow (gsl_matrix_long_double * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_long_double_view +gsl_matrix_long_double_subcolumn (gsl_matrix_long_double * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_long_double_view +gsl_matrix_long_double_view_array (long double * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_long_double_view +gsl_matrix_long_double_view_array_with_tda (long double * base, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_long_double_view +gsl_matrix_long_double_view_vector (gsl_vector_long_double * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_long_double_view +gsl_matrix_long_double_view_vector_with_tda (gsl_vector_long_double * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_long_double_const_view +gsl_matrix_long_double_const_submatrix (const gsl_matrix_long_double * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_long_double_const_view +gsl_matrix_long_double_const_row (const gsl_matrix_long_double * m, + const size_t i); + +_gsl_vector_long_double_const_view +gsl_matrix_long_double_const_column (const gsl_matrix_long_double * m, + const size_t j); + +_gsl_vector_long_double_const_view +gsl_matrix_long_double_const_diagonal (const gsl_matrix_long_double * m); + +_gsl_vector_long_double_const_view +gsl_matrix_long_double_const_subdiagonal (const gsl_matrix_long_double * m, + const size_t k); + +_gsl_vector_long_double_const_view +gsl_matrix_long_double_const_superdiagonal (const gsl_matrix_long_double * m, + const size_t k); + +_gsl_vector_long_double_const_view +gsl_matrix_long_double_const_subrow (const gsl_matrix_long_double * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_long_double_const_view +gsl_matrix_long_double_const_subcolumn (const gsl_matrix_long_double * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_long_double_const_view +gsl_matrix_long_double_const_view_array (const long double * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_long_double_const_view +gsl_matrix_long_double_const_view_array_with_tda (const long double * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_long_double_const_view +gsl_matrix_long_double_const_view_vector (const gsl_vector_long_double * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_long_double_const_view +gsl_matrix_long_double_const_view_vector_with_tda (const gsl_vector_long_double * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +void gsl_matrix_long_double_set_zero (gsl_matrix_long_double * m); +void gsl_matrix_long_double_set_identity (gsl_matrix_long_double * m); +void gsl_matrix_long_double_set_all (gsl_matrix_long_double * m, long double x); + +int gsl_matrix_long_double_fread (FILE * stream, gsl_matrix_long_double * m) ; +int gsl_matrix_long_double_fwrite (FILE * stream, const gsl_matrix_long_double * m) ; +int gsl_matrix_long_double_fscanf (FILE * stream, gsl_matrix_long_double * m); +int gsl_matrix_long_double_fprintf (FILE * stream, const gsl_matrix_long_double * m, const char * format); + +int gsl_matrix_long_double_memcpy(gsl_matrix_long_double * dest, const gsl_matrix_long_double * src); +int gsl_matrix_long_double_swap(gsl_matrix_long_double * m1, gsl_matrix_long_double * m2); +int gsl_matrix_long_double_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_long_double * dest, const gsl_matrix_long_double * src); + +int gsl_matrix_long_double_swap_rows(gsl_matrix_long_double * m, const size_t i, const size_t j); +int gsl_matrix_long_double_swap_columns(gsl_matrix_long_double * m, const size_t i, const size_t j); +int gsl_matrix_long_double_swap_rowcol(gsl_matrix_long_double * m, const size_t i, const size_t j); +int gsl_matrix_long_double_transpose (gsl_matrix_long_double * m); +int gsl_matrix_long_double_transpose_memcpy (gsl_matrix_long_double * dest, const gsl_matrix_long_double * src); +int gsl_matrix_long_double_transpose_tricpy (const char uplo_src, const int copy_diag, gsl_matrix_long_double * dest, const gsl_matrix_long_double * src); + +long double gsl_matrix_long_double_max (const gsl_matrix_long_double * m); +long double gsl_matrix_long_double_min (const gsl_matrix_long_double * m); +void gsl_matrix_long_double_minmax (const gsl_matrix_long_double * m, long double * min_out, long double * max_out); + +void gsl_matrix_long_double_max_index (const gsl_matrix_long_double * m, size_t * imax, size_t *jmax); +void gsl_matrix_long_double_min_index (const gsl_matrix_long_double * m, size_t * imin, size_t *jmin); +void gsl_matrix_long_double_minmax_index (const gsl_matrix_long_double * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); + +int gsl_matrix_long_double_equal (const gsl_matrix_long_double * a, const gsl_matrix_long_double * b); + +int gsl_matrix_long_double_isnull (const gsl_matrix_long_double * m); +int gsl_matrix_long_double_ispos (const gsl_matrix_long_double * m); +int gsl_matrix_long_double_isneg (const gsl_matrix_long_double * m); +int gsl_matrix_long_double_isnonneg (const gsl_matrix_long_double * m); + +int gsl_matrix_long_double_add (gsl_matrix_long_double * a, const gsl_matrix_long_double * b); +int gsl_matrix_long_double_sub (gsl_matrix_long_double * a, const gsl_matrix_long_double * b); +int gsl_matrix_long_double_mul_elements (gsl_matrix_long_double * a, const gsl_matrix_long_double * b); +int gsl_matrix_long_double_div_elements (gsl_matrix_long_double * a, const gsl_matrix_long_double * b); +int gsl_matrix_long_double_scale (gsl_matrix_long_double * a, const double x); +int gsl_matrix_long_double_add_constant (gsl_matrix_long_double * a, const double x); +int gsl_matrix_long_double_add_diagonal (gsl_matrix_long_double * a, const double x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_long_double_get_row(gsl_vector_long_double * v, const gsl_matrix_long_double * m, const size_t i); +int gsl_matrix_long_double_get_col(gsl_vector_long_double * v, const gsl_matrix_long_double * m, const size_t j); +int gsl_matrix_long_double_set_row(gsl_matrix_long_double * m, const size_t i, const gsl_vector_long_double * v); +int gsl_matrix_long_double_set_col(gsl_matrix_long_double * m, const size_t j, const gsl_vector_long_double * v); +/***********************************************************************/ + +/* inline functions if you are using GCC */ + +INLINE_DECL long double gsl_matrix_long_double_get(const gsl_matrix_long_double * m, const size_t i, const size_t j); +INLINE_DECL void gsl_matrix_long_double_set(gsl_matrix_long_double * m, const size_t i, const size_t j, const long double x); +INLINE_DECL long double * gsl_matrix_long_double_ptr(gsl_matrix_long_double * m, const size_t i, const size_t j); +INLINE_DECL const long double * gsl_matrix_long_double_const_ptr(const gsl_matrix_long_double * m, const size_t i, const size_t j); + +#ifdef HAVE_INLINE +INLINE_FUN +long double +gsl_matrix_long_double_get(const gsl_matrix_long_double * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; + } + } +#endif + return m->data[i * m->tda + j] ; +} + +INLINE_FUN +void +gsl_matrix_long_double_set(gsl_matrix_long_double * m, const size_t i, const size_t j, const long double x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } + } +#endif + m->data[i * m->tda + j] = x ; +} + +INLINE_FUN +long double * +gsl_matrix_long_double_ptr(gsl_matrix_long_double * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (long double *) (m->data + (i * m->tda + j)) ; +} + +INLINE_FUN +const long double * +gsl_matrix_long_double_const_ptr(const gsl_matrix_long_double * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (const long double *) (m->data + (i * m->tda + j)) ; +} + +#endif + +__END_DECLS + +#endif /* __GSL_MATRIX_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_short.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_short.h new file mode 100644 index 000000000..f79324980 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_short.h @@ -0,0 +1,352 @@ +/* matrix/gsl_matrix_short.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_SHORT_H__ +#define __GSL_MATRIX_SHORT_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + short * data; + gsl_block_short * block; + int owner; +} gsl_matrix_short; + +typedef struct +{ + gsl_matrix_short matrix; +} _gsl_matrix_short_view; + +typedef _gsl_matrix_short_view gsl_matrix_short_view; + +typedef struct +{ + gsl_matrix_short matrix; +} _gsl_matrix_short_const_view; + +typedef const _gsl_matrix_short_const_view gsl_matrix_short_const_view; + +/* Allocation */ + +gsl_matrix_short * +gsl_matrix_short_alloc (const size_t n1, const size_t n2); + +gsl_matrix_short * +gsl_matrix_short_calloc (const size_t n1, const size_t n2); + +gsl_matrix_short * +gsl_matrix_short_alloc_from_block (gsl_block_short * b, + const size_t offset, + const size_t n1, + const size_t n2, + const size_t d2); + +gsl_matrix_short * +gsl_matrix_short_alloc_from_matrix (gsl_matrix_short * m, + const size_t k1, + const size_t k2, + const size_t n1, + const size_t n2); + +gsl_vector_short * +gsl_vector_short_alloc_row_from_matrix (gsl_matrix_short * m, + const size_t i); + +gsl_vector_short * +gsl_vector_short_alloc_col_from_matrix (gsl_matrix_short * m, + const size_t j); + +void gsl_matrix_short_free (gsl_matrix_short * m); + +/* Views */ + +_gsl_matrix_short_view +gsl_matrix_short_submatrix (gsl_matrix_short * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_short_view +gsl_matrix_short_row (gsl_matrix_short * m, const size_t i); + +_gsl_vector_short_view +gsl_matrix_short_column (gsl_matrix_short * m, const size_t j); + +_gsl_vector_short_view +gsl_matrix_short_diagonal (gsl_matrix_short * m); + +_gsl_vector_short_view +gsl_matrix_short_subdiagonal (gsl_matrix_short * m, const size_t k); + +_gsl_vector_short_view +gsl_matrix_short_superdiagonal (gsl_matrix_short * m, const size_t k); + +_gsl_vector_short_view +gsl_matrix_short_subrow (gsl_matrix_short * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_short_view +gsl_matrix_short_subcolumn (gsl_matrix_short * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_short_view +gsl_matrix_short_view_array (short * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_short_view +gsl_matrix_short_view_array_with_tda (short * base, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_short_view +gsl_matrix_short_view_vector (gsl_vector_short * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_short_view +gsl_matrix_short_view_vector_with_tda (gsl_vector_short * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_short_const_view +gsl_matrix_short_const_submatrix (const gsl_matrix_short * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_short_const_view +gsl_matrix_short_const_row (const gsl_matrix_short * m, + const size_t i); + +_gsl_vector_short_const_view +gsl_matrix_short_const_column (const gsl_matrix_short * m, + const size_t j); + +_gsl_vector_short_const_view +gsl_matrix_short_const_diagonal (const gsl_matrix_short * m); + +_gsl_vector_short_const_view +gsl_matrix_short_const_subdiagonal (const gsl_matrix_short * m, + const size_t k); + +_gsl_vector_short_const_view +gsl_matrix_short_const_superdiagonal (const gsl_matrix_short * m, + const size_t k); + +_gsl_vector_short_const_view +gsl_matrix_short_const_subrow (const gsl_matrix_short * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_short_const_view +gsl_matrix_short_const_subcolumn (const gsl_matrix_short * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_short_const_view +gsl_matrix_short_const_view_array (const short * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_short_const_view +gsl_matrix_short_const_view_array_with_tda (const short * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_short_const_view +gsl_matrix_short_const_view_vector (const gsl_vector_short * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_short_const_view +gsl_matrix_short_const_view_vector_with_tda (const gsl_vector_short * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +void gsl_matrix_short_set_zero (gsl_matrix_short * m); +void gsl_matrix_short_set_identity (gsl_matrix_short * m); +void gsl_matrix_short_set_all (gsl_matrix_short * m, short x); + +int gsl_matrix_short_fread (FILE * stream, gsl_matrix_short * m) ; +int gsl_matrix_short_fwrite (FILE * stream, const gsl_matrix_short * m) ; +int gsl_matrix_short_fscanf (FILE * stream, gsl_matrix_short * m); +int gsl_matrix_short_fprintf (FILE * stream, const gsl_matrix_short * m, const char * format); + +int gsl_matrix_short_memcpy(gsl_matrix_short * dest, const gsl_matrix_short * src); +int gsl_matrix_short_swap(gsl_matrix_short * m1, gsl_matrix_short * m2); +int gsl_matrix_short_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_short * dest, const gsl_matrix_short * src); + +int gsl_matrix_short_swap_rows(gsl_matrix_short * m, const size_t i, const size_t j); +int gsl_matrix_short_swap_columns(gsl_matrix_short * m, const size_t i, const size_t j); +int gsl_matrix_short_swap_rowcol(gsl_matrix_short * m, const size_t i, const size_t j); +int gsl_matrix_short_transpose (gsl_matrix_short * m); +int gsl_matrix_short_transpose_memcpy (gsl_matrix_short * dest, const gsl_matrix_short * src); +int gsl_matrix_short_transpose_tricpy (const char uplo_src, const int copy_diag, gsl_matrix_short * dest, const gsl_matrix_short * src); + +short gsl_matrix_short_max (const gsl_matrix_short * m); +short gsl_matrix_short_min (const gsl_matrix_short * m); +void gsl_matrix_short_minmax (const gsl_matrix_short * m, short * min_out, short * max_out); + +void gsl_matrix_short_max_index (const gsl_matrix_short * m, size_t * imax, size_t *jmax); +void gsl_matrix_short_min_index (const gsl_matrix_short * m, size_t * imin, size_t *jmin); +void gsl_matrix_short_minmax_index (const gsl_matrix_short * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); + +int gsl_matrix_short_equal (const gsl_matrix_short * a, const gsl_matrix_short * b); + +int gsl_matrix_short_isnull (const gsl_matrix_short * m); +int gsl_matrix_short_ispos (const gsl_matrix_short * m); +int gsl_matrix_short_isneg (const gsl_matrix_short * m); +int gsl_matrix_short_isnonneg (const gsl_matrix_short * m); + +int gsl_matrix_short_add (gsl_matrix_short * a, const gsl_matrix_short * b); +int gsl_matrix_short_sub (gsl_matrix_short * a, const gsl_matrix_short * b); +int gsl_matrix_short_mul_elements (gsl_matrix_short * a, const gsl_matrix_short * b); +int gsl_matrix_short_div_elements (gsl_matrix_short * a, const gsl_matrix_short * b); +int gsl_matrix_short_scale (gsl_matrix_short * a, const double x); +int gsl_matrix_short_add_constant (gsl_matrix_short * a, const double x); +int gsl_matrix_short_add_diagonal (gsl_matrix_short * a, const double x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_short_get_row(gsl_vector_short * v, const gsl_matrix_short * m, const size_t i); +int gsl_matrix_short_get_col(gsl_vector_short * v, const gsl_matrix_short * m, const size_t j); +int gsl_matrix_short_set_row(gsl_matrix_short * m, const size_t i, const gsl_vector_short * v); +int gsl_matrix_short_set_col(gsl_matrix_short * m, const size_t j, const gsl_vector_short * v); +/***********************************************************************/ + +/* inline functions if you are using GCC */ + +INLINE_DECL short gsl_matrix_short_get(const gsl_matrix_short * m, const size_t i, const size_t j); +INLINE_DECL void gsl_matrix_short_set(gsl_matrix_short * m, const size_t i, const size_t j, const short x); +INLINE_DECL short * gsl_matrix_short_ptr(gsl_matrix_short * m, const size_t i, const size_t j); +INLINE_DECL const short * gsl_matrix_short_const_ptr(const gsl_matrix_short * m, const size_t i, const size_t j); + +#ifdef HAVE_INLINE +INLINE_FUN +short +gsl_matrix_short_get(const gsl_matrix_short * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; + } + } +#endif + return m->data[i * m->tda + j] ; +} + +INLINE_FUN +void +gsl_matrix_short_set(gsl_matrix_short * m, const size_t i, const size_t j, const short x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } + } +#endif + m->data[i * m->tda + j] = x ; +} + +INLINE_FUN +short * +gsl_matrix_short_ptr(gsl_matrix_short * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (short *) (m->data + (i * m->tda + j)) ; +} + +INLINE_FUN +const short * +gsl_matrix_short_const_ptr(const gsl_matrix_short * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (const short *) (m->data + (i * m->tda + j)) ; +} + +#endif + +__END_DECLS + +#endif /* __GSL_MATRIX_SHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_uchar.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_uchar.h new file mode 100644 index 000000000..1e6746347 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_uchar.h @@ -0,0 +1,352 @@ +/* matrix/gsl_matrix_uchar.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_UCHAR_H__ +#define __GSL_MATRIX_UCHAR_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + unsigned char * data; + gsl_block_uchar * block; + int owner; +} gsl_matrix_uchar; + +typedef struct +{ + gsl_matrix_uchar matrix; +} _gsl_matrix_uchar_view; + +typedef _gsl_matrix_uchar_view gsl_matrix_uchar_view; + +typedef struct +{ + gsl_matrix_uchar matrix; +} _gsl_matrix_uchar_const_view; + +typedef const _gsl_matrix_uchar_const_view gsl_matrix_uchar_const_view; + +/* Allocation */ + +gsl_matrix_uchar * +gsl_matrix_uchar_alloc (const size_t n1, const size_t n2); + +gsl_matrix_uchar * +gsl_matrix_uchar_calloc (const size_t n1, const size_t n2); + +gsl_matrix_uchar * +gsl_matrix_uchar_alloc_from_block (gsl_block_uchar * b, + const size_t offset, + const size_t n1, + const size_t n2, + const size_t d2); + +gsl_matrix_uchar * +gsl_matrix_uchar_alloc_from_matrix (gsl_matrix_uchar * m, + const size_t k1, + const size_t k2, + const size_t n1, + const size_t n2); + +gsl_vector_uchar * +gsl_vector_uchar_alloc_row_from_matrix (gsl_matrix_uchar * m, + const size_t i); + +gsl_vector_uchar * +gsl_vector_uchar_alloc_col_from_matrix (gsl_matrix_uchar * m, + const size_t j); + +void gsl_matrix_uchar_free (gsl_matrix_uchar * m); + +/* Views */ + +_gsl_matrix_uchar_view +gsl_matrix_uchar_submatrix (gsl_matrix_uchar * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_uchar_view +gsl_matrix_uchar_row (gsl_matrix_uchar * m, const size_t i); + +_gsl_vector_uchar_view +gsl_matrix_uchar_column (gsl_matrix_uchar * m, const size_t j); + +_gsl_vector_uchar_view +gsl_matrix_uchar_diagonal (gsl_matrix_uchar * m); + +_gsl_vector_uchar_view +gsl_matrix_uchar_subdiagonal (gsl_matrix_uchar * m, const size_t k); + +_gsl_vector_uchar_view +gsl_matrix_uchar_superdiagonal (gsl_matrix_uchar * m, const size_t k); + +_gsl_vector_uchar_view +gsl_matrix_uchar_subrow (gsl_matrix_uchar * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_uchar_view +gsl_matrix_uchar_subcolumn (gsl_matrix_uchar * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_uchar_view +gsl_matrix_uchar_view_array (unsigned char * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_uchar_view +gsl_matrix_uchar_view_array_with_tda (unsigned char * base, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_uchar_view +gsl_matrix_uchar_view_vector (gsl_vector_uchar * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_uchar_view +gsl_matrix_uchar_view_vector_with_tda (gsl_vector_uchar * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_uchar_const_view +gsl_matrix_uchar_const_submatrix (const gsl_matrix_uchar * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_uchar_const_view +gsl_matrix_uchar_const_row (const gsl_matrix_uchar * m, + const size_t i); + +_gsl_vector_uchar_const_view +gsl_matrix_uchar_const_column (const gsl_matrix_uchar * m, + const size_t j); + +_gsl_vector_uchar_const_view +gsl_matrix_uchar_const_diagonal (const gsl_matrix_uchar * m); + +_gsl_vector_uchar_const_view +gsl_matrix_uchar_const_subdiagonal (const gsl_matrix_uchar * m, + const size_t k); + +_gsl_vector_uchar_const_view +gsl_matrix_uchar_const_superdiagonal (const gsl_matrix_uchar * m, + const size_t k); + +_gsl_vector_uchar_const_view +gsl_matrix_uchar_const_subrow (const gsl_matrix_uchar * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_uchar_const_view +gsl_matrix_uchar_const_subcolumn (const gsl_matrix_uchar * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_uchar_const_view +gsl_matrix_uchar_const_view_array (const unsigned char * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_uchar_const_view +gsl_matrix_uchar_const_view_array_with_tda (const unsigned char * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_uchar_const_view +gsl_matrix_uchar_const_view_vector (const gsl_vector_uchar * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_uchar_const_view +gsl_matrix_uchar_const_view_vector_with_tda (const gsl_vector_uchar * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +void gsl_matrix_uchar_set_zero (gsl_matrix_uchar * m); +void gsl_matrix_uchar_set_identity (gsl_matrix_uchar * m); +void gsl_matrix_uchar_set_all (gsl_matrix_uchar * m, unsigned char x); + +int gsl_matrix_uchar_fread (FILE * stream, gsl_matrix_uchar * m) ; +int gsl_matrix_uchar_fwrite (FILE * stream, const gsl_matrix_uchar * m) ; +int gsl_matrix_uchar_fscanf (FILE * stream, gsl_matrix_uchar * m); +int gsl_matrix_uchar_fprintf (FILE * stream, const gsl_matrix_uchar * m, const char * format); + +int gsl_matrix_uchar_memcpy(gsl_matrix_uchar * dest, const gsl_matrix_uchar * src); +int gsl_matrix_uchar_swap(gsl_matrix_uchar * m1, gsl_matrix_uchar * m2); +int gsl_matrix_uchar_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_uchar * dest, const gsl_matrix_uchar * src); + +int gsl_matrix_uchar_swap_rows(gsl_matrix_uchar * m, const size_t i, const size_t j); +int gsl_matrix_uchar_swap_columns(gsl_matrix_uchar * m, const size_t i, const size_t j); +int gsl_matrix_uchar_swap_rowcol(gsl_matrix_uchar * m, const size_t i, const size_t j); +int gsl_matrix_uchar_transpose (gsl_matrix_uchar * m); +int gsl_matrix_uchar_transpose_memcpy (gsl_matrix_uchar * dest, const gsl_matrix_uchar * src); +int gsl_matrix_uchar_transpose_tricpy (const char uplo_src, const int copy_diag, gsl_matrix_uchar * dest, const gsl_matrix_uchar * src); + +unsigned char gsl_matrix_uchar_max (const gsl_matrix_uchar * m); +unsigned char gsl_matrix_uchar_min (const gsl_matrix_uchar * m); +void gsl_matrix_uchar_minmax (const gsl_matrix_uchar * m, unsigned char * min_out, unsigned char * max_out); + +void gsl_matrix_uchar_max_index (const gsl_matrix_uchar * m, size_t * imax, size_t *jmax); +void gsl_matrix_uchar_min_index (const gsl_matrix_uchar * m, size_t * imin, size_t *jmin); +void gsl_matrix_uchar_minmax_index (const gsl_matrix_uchar * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); + +int gsl_matrix_uchar_equal (const gsl_matrix_uchar * a, const gsl_matrix_uchar * b); + +int gsl_matrix_uchar_isnull (const gsl_matrix_uchar * m); +int gsl_matrix_uchar_ispos (const gsl_matrix_uchar * m); +int gsl_matrix_uchar_isneg (const gsl_matrix_uchar * m); +int gsl_matrix_uchar_isnonneg (const gsl_matrix_uchar * m); + +int gsl_matrix_uchar_add (gsl_matrix_uchar * a, const gsl_matrix_uchar * b); +int gsl_matrix_uchar_sub (gsl_matrix_uchar * a, const gsl_matrix_uchar * b); +int gsl_matrix_uchar_mul_elements (gsl_matrix_uchar * a, const gsl_matrix_uchar * b); +int gsl_matrix_uchar_div_elements (gsl_matrix_uchar * a, const gsl_matrix_uchar * b); +int gsl_matrix_uchar_scale (gsl_matrix_uchar * a, const double x); +int gsl_matrix_uchar_add_constant (gsl_matrix_uchar * a, const double x); +int gsl_matrix_uchar_add_diagonal (gsl_matrix_uchar * a, const double x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_uchar_get_row(gsl_vector_uchar * v, const gsl_matrix_uchar * m, const size_t i); +int gsl_matrix_uchar_get_col(gsl_vector_uchar * v, const gsl_matrix_uchar * m, const size_t j); +int gsl_matrix_uchar_set_row(gsl_matrix_uchar * m, const size_t i, const gsl_vector_uchar * v); +int gsl_matrix_uchar_set_col(gsl_matrix_uchar * m, const size_t j, const gsl_vector_uchar * v); +/***********************************************************************/ + +/* inline functions if you are using GCC */ + +INLINE_DECL unsigned char gsl_matrix_uchar_get(const gsl_matrix_uchar * m, const size_t i, const size_t j); +INLINE_DECL void gsl_matrix_uchar_set(gsl_matrix_uchar * m, const size_t i, const size_t j, const unsigned char x); +INLINE_DECL unsigned char * gsl_matrix_uchar_ptr(gsl_matrix_uchar * m, const size_t i, const size_t j); +INLINE_DECL const unsigned char * gsl_matrix_uchar_const_ptr(const gsl_matrix_uchar * m, const size_t i, const size_t j); + +#ifdef HAVE_INLINE +INLINE_FUN +unsigned char +gsl_matrix_uchar_get(const gsl_matrix_uchar * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; + } + } +#endif + return m->data[i * m->tda + j] ; +} + +INLINE_FUN +void +gsl_matrix_uchar_set(gsl_matrix_uchar * m, const size_t i, const size_t j, const unsigned char x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } + } +#endif + m->data[i * m->tda + j] = x ; +} + +INLINE_FUN +unsigned char * +gsl_matrix_uchar_ptr(gsl_matrix_uchar * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (unsigned char *) (m->data + (i * m->tda + j)) ; +} + +INLINE_FUN +const unsigned char * +gsl_matrix_uchar_const_ptr(const gsl_matrix_uchar * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (const unsigned char *) (m->data + (i * m->tda + j)) ; +} + +#endif + +__END_DECLS + +#endif /* __GSL_MATRIX_UCHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_uint.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_uint.h new file mode 100644 index 000000000..2d9000261 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_uint.h @@ -0,0 +1,352 @@ +/* matrix/gsl_matrix_uint.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_UINT_H__ +#define __GSL_MATRIX_UINT_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + unsigned int * data; + gsl_block_uint * block; + int owner; +} gsl_matrix_uint; + +typedef struct +{ + gsl_matrix_uint matrix; +} _gsl_matrix_uint_view; + +typedef _gsl_matrix_uint_view gsl_matrix_uint_view; + +typedef struct +{ + gsl_matrix_uint matrix; +} _gsl_matrix_uint_const_view; + +typedef const _gsl_matrix_uint_const_view gsl_matrix_uint_const_view; + +/* Allocation */ + +gsl_matrix_uint * +gsl_matrix_uint_alloc (const size_t n1, const size_t n2); + +gsl_matrix_uint * +gsl_matrix_uint_calloc (const size_t n1, const size_t n2); + +gsl_matrix_uint * +gsl_matrix_uint_alloc_from_block (gsl_block_uint * b, + const size_t offset, + const size_t n1, + const size_t n2, + const size_t d2); + +gsl_matrix_uint * +gsl_matrix_uint_alloc_from_matrix (gsl_matrix_uint * m, + const size_t k1, + const size_t k2, + const size_t n1, + const size_t n2); + +gsl_vector_uint * +gsl_vector_uint_alloc_row_from_matrix (gsl_matrix_uint * m, + const size_t i); + +gsl_vector_uint * +gsl_vector_uint_alloc_col_from_matrix (gsl_matrix_uint * m, + const size_t j); + +void gsl_matrix_uint_free (gsl_matrix_uint * m); + +/* Views */ + +_gsl_matrix_uint_view +gsl_matrix_uint_submatrix (gsl_matrix_uint * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_uint_view +gsl_matrix_uint_row (gsl_matrix_uint * m, const size_t i); + +_gsl_vector_uint_view +gsl_matrix_uint_column (gsl_matrix_uint * m, const size_t j); + +_gsl_vector_uint_view +gsl_matrix_uint_diagonal (gsl_matrix_uint * m); + +_gsl_vector_uint_view +gsl_matrix_uint_subdiagonal (gsl_matrix_uint * m, const size_t k); + +_gsl_vector_uint_view +gsl_matrix_uint_superdiagonal (gsl_matrix_uint * m, const size_t k); + +_gsl_vector_uint_view +gsl_matrix_uint_subrow (gsl_matrix_uint * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_uint_view +gsl_matrix_uint_subcolumn (gsl_matrix_uint * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_uint_view +gsl_matrix_uint_view_array (unsigned int * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_uint_view +gsl_matrix_uint_view_array_with_tda (unsigned int * base, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_uint_view +gsl_matrix_uint_view_vector (gsl_vector_uint * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_uint_view +gsl_matrix_uint_view_vector_with_tda (gsl_vector_uint * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_uint_const_view +gsl_matrix_uint_const_submatrix (const gsl_matrix_uint * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_uint_const_view +gsl_matrix_uint_const_row (const gsl_matrix_uint * m, + const size_t i); + +_gsl_vector_uint_const_view +gsl_matrix_uint_const_column (const gsl_matrix_uint * m, + const size_t j); + +_gsl_vector_uint_const_view +gsl_matrix_uint_const_diagonal (const gsl_matrix_uint * m); + +_gsl_vector_uint_const_view +gsl_matrix_uint_const_subdiagonal (const gsl_matrix_uint * m, + const size_t k); + +_gsl_vector_uint_const_view +gsl_matrix_uint_const_superdiagonal (const gsl_matrix_uint * m, + const size_t k); + +_gsl_vector_uint_const_view +gsl_matrix_uint_const_subrow (const gsl_matrix_uint * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_uint_const_view +gsl_matrix_uint_const_subcolumn (const gsl_matrix_uint * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_uint_const_view +gsl_matrix_uint_const_view_array (const unsigned int * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_uint_const_view +gsl_matrix_uint_const_view_array_with_tda (const unsigned int * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_uint_const_view +gsl_matrix_uint_const_view_vector (const gsl_vector_uint * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_uint_const_view +gsl_matrix_uint_const_view_vector_with_tda (const gsl_vector_uint * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +void gsl_matrix_uint_set_zero (gsl_matrix_uint * m); +void gsl_matrix_uint_set_identity (gsl_matrix_uint * m); +void gsl_matrix_uint_set_all (gsl_matrix_uint * m, unsigned int x); + +int gsl_matrix_uint_fread (FILE * stream, gsl_matrix_uint * m) ; +int gsl_matrix_uint_fwrite (FILE * stream, const gsl_matrix_uint * m) ; +int gsl_matrix_uint_fscanf (FILE * stream, gsl_matrix_uint * m); +int gsl_matrix_uint_fprintf (FILE * stream, const gsl_matrix_uint * m, const char * format); + +int gsl_matrix_uint_memcpy(gsl_matrix_uint * dest, const gsl_matrix_uint * src); +int gsl_matrix_uint_swap(gsl_matrix_uint * m1, gsl_matrix_uint * m2); +int gsl_matrix_uint_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_uint * dest, const gsl_matrix_uint * src); + +int gsl_matrix_uint_swap_rows(gsl_matrix_uint * m, const size_t i, const size_t j); +int gsl_matrix_uint_swap_columns(gsl_matrix_uint * m, const size_t i, const size_t j); +int gsl_matrix_uint_swap_rowcol(gsl_matrix_uint * m, const size_t i, const size_t j); +int gsl_matrix_uint_transpose (gsl_matrix_uint * m); +int gsl_matrix_uint_transpose_memcpy (gsl_matrix_uint * dest, const gsl_matrix_uint * src); +int gsl_matrix_uint_transpose_tricpy (const char uplo_src, const int copy_diag, gsl_matrix_uint * dest, const gsl_matrix_uint * src); + +unsigned int gsl_matrix_uint_max (const gsl_matrix_uint * m); +unsigned int gsl_matrix_uint_min (const gsl_matrix_uint * m); +void gsl_matrix_uint_minmax (const gsl_matrix_uint * m, unsigned int * min_out, unsigned int * max_out); + +void gsl_matrix_uint_max_index (const gsl_matrix_uint * m, size_t * imax, size_t *jmax); +void gsl_matrix_uint_min_index (const gsl_matrix_uint * m, size_t * imin, size_t *jmin); +void gsl_matrix_uint_minmax_index (const gsl_matrix_uint * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); + +int gsl_matrix_uint_equal (const gsl_matrix_uint * a, const gsl_matrix_uint * b); + +int gsl_matrix_uint_isnull (const gsl_matrix_uint * m); +int gsl_matrix_uint_ispos (const gsl_matrix_uint * m); +int gsl_matrix_uint_isneg (const gsl_matrix_uint * m); +int gsl_matrix_uint_isnonneg (const gsl_matrix_uint * m); + +int gsl_matrix_uint_add (gsl_matrix_uint * a, const gsl_matrix_uint * b); +int gsl_matrix_uint_sub (gsl_matrix_uint * a, const gsl_matrix_uint * b); +int gsl_matrix_uint_mul_elements (gsl_matrix_uint * a, const gsl_matrix_uint * b); +int gsl_matrix_uint_div_elements (gsl_matrix_uint * a, const gsl_matrix_uint * b); +int gsl_matrix_uint_scale (gsl_matrix_uint * a, const double x); +int gsl_matrix_uint_add_constant (gsl_matrix_uint * a, const double x); +int gsl_matrix_uint_add_diagonal (gsl_matrix_uint * a, const double x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_uint_get_row(gsl_vector_uint * v, const gsl_matrix_uint * m, const size_t i); +int gsl_matrix_uint_get_col(gsl_vector_uint * v, const gsl_matrix_uint * m, const size_t j); +int gsl_matrix_uint_set_row(gsl_matrix_uint * m, const size_t i, const gsl_vector_uint * v); +int gsl_matrix_uint_set_col(gsl_matrix_uint * m, const size_t j, const gsl_vector_uint * v); +/***********************************************************************/ + +/* inline functions if you are using GCC */ + +INLINE_DECL unsigned int gsl_matrix_uint_get(const gsl_matrix_uint * m, const size_t i, const size_t j); +INLINE_DECL void gsl_matrix_uint_set(gsl_matrix_uint * m, const size_t i, const size_t j, const unsigned int x); +INLINE_DECL unsigned int * gsl_matrix_uint_ptr(gsl_matrix_uint * m, const size_t i, const size_t j); +INLINE_DECL const unsigned int * gsl_matrix_uint_const_ptr(const gsl_matrix_uint * m, const size_t i, const size_t j); + +#ifdef HAVE_INLINE +INLINE_FUN +unsigned int +gsl_matrix_uint_get(const gsl_matrix_uint * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; + } + } +#endif + return m->data[i * m->tda + j] ; +} + +INLINE_FUN +void +gsl_matrix_uint_set(gsl_matrix_uint * m, const size_t i, const size_t j, const unsigned int x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } + } +#endif + m->data[i * m->tda + j] = x ; +} + +INLINE_FUN +unsigned int * +gsl_matrix_uint_ptr(gsl_matrix_uint * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (unsigned int *) (m->data + (i * m->tda + j)) ; +} + +INLINE_FUN +const unsigned int * +gsl_matrix_uint_const_ptr(const gsl_matrix_uint * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (const unsigned int *) (m->data + (i * m->tda + j)) ; +} + +#endif + +__END_DECLS + +#endif /* __GSL_MATRIX_UINT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_ulong.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_ulong.h new file mode 100644 index 000000000..d9fd50d84 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_ulong.h @@ -0,0 +1,352 @@ +/* matrix/gsl_matrix_ulong.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_ULONG_H__ +#define __GSL_MATRIX_ULONG_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + unsigned long * data; + gsl_block_ulong * block; + int owner; +} gsl_matrix_ulong; + +typedef struct +{ + gsl_matrix_ulong matrix; +} _gsl_matrix_ulong_view; + +typedef _gsl_matrix_ulong_view gsl_matrix_ulong_view; + +typedef struct +{ + gsl_matrix_ulong matrix; +} _gsl_matrix_ulong_const_view; + +typedef const _gsl_matrix_ulong_const_view gsl_matrix_ulong_const_view; + +/* Allocation */ + +gsl_matrix_ulong * +gsl_matrix_ulong_alloc (const size_t n1, const size_t n2); + +gsl_matrix_ulong * +gsl_matrix_ulong_calloc (const size_t n1, const size_t n2); + +gsl_matrix_ulong * +gsl_matrix_ulong_alloc_from_block (gsl_block_ulong * b, + const size_t offset, + const size_t n1, + const size_t n2, + const size_t d2); + +gsl_matrix_ulong * +gsl_matrix_ulong_alloc_from_matrix (gsl_matrix_ulong * m, + const size_t k1, + const size_t k2, + const size_t n1, + const size_t n2); + +gsl_vector_ulong * +gsl_vector_ulong_alloc_row_from_matrix (gsl_matrix_ulong * m, + const size_t i); + +gsl_vector_ulong * +gsl_vector_ulong_alloc_col_from_matrix (gsl_matrix_ulong * m, + const size_t j); + +void gsl_matrix_ulong_free (gsl_matrix_ulong * m); + +/* Views */ + +_gsl_matrix_ulong_view +gsl_matrix_ulong_submatrix (gsl_matrix_ulong * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_ulong_view +gsl_matrix_ulong_row (gsl_matrix_ulong * m, const size_t i); + +_gsl_vector_ulong_view +gsl_matrix_ulong_column (gsl_matrix_ulong * m, const size_t j); + +_gsl_vector_ulong_view +gsl_matrix_ulong_diagonal (gsl_matrix_ulong * m); + +_gsl_vector_ulong_view +gsl_matrix_ulong_subdiagonal (gsl_matrix_ulong * m, const size_t k); + +_gsl_vector_ulong_view +gsl_matrix_ulong_superdiagonal (gsl_matrix_ulong * m, const size_t k); + +_gsl_vector_ulong_view +gsl_matrix_ulong_subrow (gsl_matrix_ulong * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_ulong_view +gsl_matrix_ulong_subcolumn (gsl_matrix_ulong * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_ulong_view +gsl_matrix_ulong_view_array (unsigned long * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_ulong_view +gsl_matrix_ulong_view_array_with_tda (unsigned long * base, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_ulong_view +gsl_matrix_ulong_view_vector (gsl_vector_ulong * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_ulong_view +gsl_matrix_ulong_view_vector_with_tda (gsl_vector_ulong * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_ulong_const_view +gsl_matrix_ulong_const_submatrix (const gsl_matrix_ulong * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_ulong_const_view +gsl_matrix_ulong_const_row (const gsl_matrix_ulong * m, + const size_t i); + +_gsl_vector_ulong_const_view +gsl_matrix_ulong_const_column (const gsl_matrix_ulong * m, + const size_t j); + +_gsl_vector_ulong_const_view +gsl_matrix_ulong_const_diagonal (const gsl_matrix_ulong * m); + +_gsl_vector_ulong_const_view +gsl_matrix_ulong_const_subdiagonal (const gsl_matrix_ulong * m, + const size_t k); + +_gsl_vector_ulong_const_view +gsl_matrix_ulong_const_superdiagonal (const gsl_matrix_ulong * m, + const size_t k); + +_gsl_vector_ulong_const_view +gsl_matrix_ulong_const_subrow (const gsl_matrix_ulong * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_ulong_const_view +gsl_matrix_ulong_const_subcolumn (const gsl_matrix_ulong * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_ulong_const_view +gsl_matrix_ulong_const_view_array (const unsigned long * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_ulong_const_view +gsl_matrix_ulong_const_view_array_with_tda (const unsigned long * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_ulong_const_view +gsl_matrix_ulong_const_view_vector (const gsl_vector_ulong * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_ulong_const_view +gsl_matrix_ulong_const_view_vector_with_tda (const gsl_vector_ulong * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +void gsl_matrix_ulong_set_zero (gsl_matrix_ulong * m); +void gsl_matrix_ulong_set_identity (gsl_matrix_ulong * m); +void gsl_matrix_ulong_set_all (gsl_matrix_ulong * m, unsigned long x); + +int gsl_matrix_ulong_fread (FILE * stream, gsl_matrix_ulong * m) ; +int gsl_matrix_ulong_fwrite (FILE * stream, const gsl_matrix_ulong * m) ; +int gsl_matrix_ulong_fscanf (FILE * stream, gsl_matrix_ulong * m); +int gsl_matrix_ulong_fprintf (FILE * stream, const gsl_matrix_ulong * m, const char * format); + +int gsl_matrix_ulong_memcpy(gsl_matrix_ulong * dest, const gsl_matrix_ulong * src); +int gsl_matrix_ulong_swap(gsl_matrix_ulong * m1, gsl_matrix_ulong * m2); +int gsl_matrix_ulong_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_ulong * dest, const gsl_matrix_ulong * src); + +int gsl_matrix_ulong_swap_rows(gsl_matrix_ulong * m, const size_t i, const size_t j); +int gsl_matrix_ulong_swap_columns(gsl_matrix_ulong * m, const size_t i, const size_t j); +int gsl_matrix_ulong_swap_rowcol(gsl_matrix_ulong * m, const size_t i, const size_t j); +int gsl_matrix_ulong_transpose (gsl_matrix_ulong * m); +int gsl_matrix_ulong_transpose_memcpy (gsl_matrix_ulong * dest, const gsl_matrix_ulong * src); +int gsl_matrix_ulong_transpose_tricpy (const char uplo_src, const int copy_diag, gsl_matrix_ulong * dest, const gsl_matrix_ulong * src); + +unsigned long gsl_matrix_ulong_max (const gsl_matrix_ulong * m); +unsigned long gsl_matrix_ulong_min (const gsl_matrix_ulong * m); +void gsl_matrix_ulong_minmax (const gsl_matrix_ulong * m, unsigned long * min_out, unsigned long * max_out); + +void gsl_matrix_ulong_max_index (const gsl_matrix_ulong * m, size_t * imax, size_t *jmax); +void gsl_matrix_ulong_min_index (const gsl_matrix_ulong * m, size_t * imin, size_t *jmin); +void gsl_matrix_ulong_minmax_index (const gsl_matrix_ulong * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); + +int gsl_matrix_ulong_equal (const gsl_matrix_ulong * a, const gsl_matrix_ulong * b); + +int gsl_matrix_ulong_isnull (const gsl_matrix_ulong * m); +int gsl_matrix_ulong_ispos (const gsl_matrix_ulong * m); +int gsl_matrix_ulong_isneg (const gsl_matrix_ulong * m); +int gsl_matrix_ulong_isnonneg (const gsl_matrix_ulong * m); + +int gsl_matrix_ulong_add (gsl_matrix_ulong * a, const gsl_matrix_ulong * b); +int gsl_matrix_ulong_sub (gsl_matrix_ulong * a, const gsl_matrix_ulong * b); +int gsl_matrix_ulong_mul_elements (gsl_matrix_ulong * a, const gsl_matrix_ulong * b); +int gsl_matrix_ulong_div_elements (gsl_matrix_ulong * a, const gsl_matrix_ulong * b); +int gsl_matrix_ulong_scale (gsl_matrix_ulong * a, const double x); +int gsl_matrix_ulong_add_constant (gsl_matrix_ulong * a, const double x); +int gsl_matrix_ulong_add_diagonal (gsl_matrix_ulong * a, const double x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_ulong_get_row(gsl_vector_ulong * v, const gsl_matrix_ulong * m, const size_t i); +int gsl_matrix_ulong_get_col(gsl_vector_ulong * v, const gsl_matrix_ulong * m, const size_t j); +int gsl_matrix_ulong_set_row(gsl_matrix_ulong * m, const size_t i, const gsl_vector_ulong * v); +int gsl_matrix_ulong_set_col(gsl_matrix_ulong * m, const size_t j, const gsl_vector_ulong * v); +/***********************************************************************/ + +/* inline functions if you are using GCC */ + +INLINE_DECL unsigned long gsl_matrix_ulong_get(const gsl_matrix_ulong * m, const size_t i, const size_t j); +INLINE_DECL void gsl_matrix_ulong_set(gsl_matrix_ulong * m, const size_t i, const size_t j, const unsigned long x); +INLINE_DECL unsigned long * gsl_matrix_ulong_ptr(gsl_matrix_ulong * m, const size_t i, const size_t j); +INLINE_DECL const unsigned long * gsl_matrix_ulong_const_ptr(const gsl_matrix_ulong * m, const size_t i, const size_t j); + +#ifdef HAVE_INLINE +INLINE_FUN +unsigned long +gsl_matrix_ulong_get(const gsl_matrix_ulong * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; + } + } +#endif + return m->data[i * m->tda + j] ; +} + +INLINE_FUN +void +gsl_matrix_ulong_set(gsl_matrix_ulong * m, const size_t i, const size_t j, const unsigned long x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } + } +#endif + m->data[i * m->tda + j] = x ; +} + +INLINE_FUN +unsigned long * +gsl_matrix_ulong_ptr(gsl_matrix_ulong * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (unsigned long *) (m->data + (i * m->tda + j)) ; +} + +INLINE_FUN +const unsigned long * +gsl_matrix_ulong_const_ptr(const gsl_matrix_ulong * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (const unsigned long *) (m->data + (i * m->tda + j)) ; +} + +#endif + +__END_DECLS + +#endif /* __GSL_MATRIX_ULONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_ushort.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_ushort.h new file mode 100644 index 000000000..e06cc2ac3 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_ushort.h @@ -0,0 +1,352 @@ +/* matrix/gsl_matrix_ushort.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_USHORT_H__ +#define __GSL_MATRIX_USHORT_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + unsigned short * data; + gsl_block_ushort * block; + int owner; +} gsl_matrix_ushort; + +typedef struct +{ + gsl_matrix_ushort matrix; +} _gsl_matrix_ushort_view; + +typedef _gsl_matrix_ushort_view gsl_matrix_ushort_view; + +typedef struct +{ + gsl_matrix_ushort matrix; +} _gsl_matrix_ushort_const_view; + +typedef const _gsl_matrix_ushort_const_view gsl_matrix_ushort_const_view; + +/* Allocation */ + +gsl_matrix_ushort * +gsl_matrix_ushort_alloc (const size_t n1, const size_t n2); + +gsl_matrix_ushort * +gsl_matrix_ushort_calloc (const size_t n1, const size_t n2); + +gsl_matrix_ushort * +gsl_matrix_ushort_alloc_from_block (gsl_block_ushort * b, + const size_t offset, + const size_t n1, + const size_t n2, + const size_t d2); + +gsl_matrix_ushort * +gsl_matrix_ushort_alloc_from_matrix (gsl_matrix_ushort * m, + const size_t k1, + const size_t k2, + const size_t n1, + const size_t n2); + +gsl_vector_ushort * +gsl_vector_ushort_alloc_row_from_matrix (gsl_matrix_ushort * m, + const size_t i); + +gsl_vector_ushort * +gsl_vector_ushort_alloc_col_from_matrix (gsl_matrix_ushort * m, + const size_t j); + +void gsl_matrix_ushort_free (gsl_matrix_ushort * m); + +/* Views */ + +_gsl_matrix_ushort_view +gsl_matrix_ushort_submatrix (gsl_matrix_ushort * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_ushort_view +gsl_matrix_ushort_row (gsl_matrix_ushort * m, const size_t i); + +_gsl_vector_ushort_view +gsl_matrix_ushort_column (gsl_matrix_ushort * m, const size_t j); + +_gsl_vector_ushort_view +gsl_matrix_ushort_diagonal (gsl_matrix_ushort * m); + +_gsl_vector_ushort_view +gsl_matrix_ushort_subdiagonal (gsl_matrix_ushort * m, const size_t k); + +_gsl_vector_ushort_view +gsl_matrix_ushort_superdiagonal (gsl_matrix_ushort * m, const size_t k); + +_gsl_vector_ushort_view +gsl_matrix_ushort_subrow (gsl_matrix_ushort * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_ushort_view +gsl_matrix_ushort_subcolumn (gsl_matrix_ushort * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_ushort_view +gsl_matrix_ushort_view_array (unsigned short * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_ushort_view +gsl_matrix_ushort_view_array_with_tda (unsigned short * base, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_ushort_view +gsl_matrix_ushort_view_vector (gsl_vector_ushort * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_ushort_view +gsl_matrix_ushort_view_vector_with_tda (gsl_vector_ushort * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_ushort_const_view +gsl_matrix_ushort_const_submatrix (const gsl_matrix_ushort * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_ushort_const_view +gsl_matrix_ushort_const_row (const gsl_matrix_ushort * m, + const size_t i); + +_gsl_vector_ushort_const_view +gsl_matrix_ushort_const_column (const gsl_matrix_ushort * m, + const size_t j); + +_gsl_vector_ushort_const_view +gsl_matrix_ushort_const_diagonal (const gsl_matrix_ushort * m); + +_gsl_vector_ushort_const_view +gsl_matrix_ushort_const_subdiagonal (const gsl_matrix_ushort * m, + const size_t k); + +_gsl_vector_ushort_const_view +gsl_matrix_ushort_const_superdiagonal (const gsl_matrix_ushort * m, + const size_t k); + +_gsl_vector_ushort_const_view +gsl_matrix_ushort_const_subrow (const gsl_matrix_ushort * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_ushort_const_view +gsl_matrix_ushort_const_subcolumn (const gsl_matrix_ushort * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_ushort_const_view +gsl_matrix_ushort_const_view_array (const unsigned short * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_ushort_const_view +gsl_matrix_ushort_const_view_array_with_tda (const unsigned short * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_ushort_const_view +gsl_matrix_ushort_const_view_vector (const gsl_vector_ushort * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_ushort_const_view +gsl_matrix_ushort_const_view_vector_with_tda (const gsl_vector_ushort * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +void gsl_matrix_ushort_set_zero (gsl_matrix_ushort * m); +void gsl_matrix_ushort_set_identity (gsl_matrix_ushort * m); +void gsl_matrix_ushort_set_all (gsl_matrix_ushort * m, unsigned short x); + +int gsl_matrix_ushort_fread (FILE * stream, gsl_matrix_ushort * m) ; +int gsl_matrix_ushort_fwrite (FILE * stream, const gsl_matrix_ushort * m) ; +int gsl_matrix_ushort_fscanf (FILE * stream, gsl_matrix_ushort * m); +int gsl_matrix_ushort_fprintf (FILE * stream, const gsl_matrix_ushort * m, const char * format); + +int gsl_matrix_ushort_memcpy(gsl_matrix_ushort * dest, const gsl_matrix_ushort * src); +int gsl_matrix_ushort_swap(gsl_matrix_ushort * m1, gsl_matrix_ushort * m2); +int gsl_matrix_ushort_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_ushort * dest, const gsl_matrix_ushort * src); + +int gsl_matrix_ushort_swap_rows(gsl_matrix_ushort * m, const size_t i, const size_t j); +int gsl_matrix_ushort_swap_columns(gsl_matrix_ushort * m, const size_t i, const size_t j); +int gsl_matrix_ushort_swap_rowcol(gsl_matrix_ushort * m, const size_t i, const size_t j); +int gsl_matrix_ushort_transpose (gsl_matrix_ushort * m); +int gsl_matrix_ushort_transpose_memcpy (gsl_matrix_ushort * dest, const gsl_matrix_ushort * src); +int gsl_matrix_ushort_transpose_tricpy (const char uplo_src, const int copy_diag, gsl_matrix_ushort * dest, const gsl_matrix_ushort * src); + +unsigned short gsl_matrix_ushort_max (const gsl_matrix_ushort * m); +unsigned short gsl_matrix_ushort_min (const gsl_matrix_ushort * m); +void gsl_matrix_ushort_minmax (const gsl_matrix_ushort * m, unsigned short * min_out, unsigned short * max_out); + +void gsl_matrix_ushort_max_index (const gsl_matrix_ushort * m, size_t * imax, size_t *jmax); +void gsl_matrix_ushort_min_index (const gsl_matrix_ushort * m, size_t * imin, size_t *jmin); +void gsl_matrix_ushort_minmax_index (const gsl_matrix_ushort * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); + +int gsl_matrix_ushort_equal (const gsl_matrix_ushort * a, const gsl_matrix_ushort * b); + +int gsl_matrix_ushort_isnull (const gsl_matrix_ushort * m); +int gsl_matrix_ushort_ispos (const gsl_matrix_ushort * m); +int gsl_matrix_ushort_isneg (const gsl_matrix_ushort * m); +int gsl_matrix_ushort_isnonneg (const gsl_matrix_ushort * m); + +int gsl_matrix_ushort_add (gsl_matrix_ushort * a, const gsl_matrix_ushort * b); +int gsl_matrix_ushort_sub (gsl_matrix_ushort * a, const gsl_matrix_ushort * b); +int gsl_matrix_ushort_mul_elements (gsl_matrix_ushort * a, const gsl_matrix_ushort * b); +int gsl_matrix_ushort_div_elements (gsl_matrix_ushort * a, const gsl_matrix_ushort * b); +int gsl_matrix_ushort_scale (gsl_matrix_ushort * a, const double x); +int gsl_matrix_ushort_add_constant (gsl_matrix_ushort * a, const double x); +int gsl_matrix_ushort_add_diagonal (gsl_matrix_ushort * a, const double x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_ushort_get_row(gsl_vector_ushort * v, const gsl_matrix_ushort * m, const size_t i); +int gsl_matrix_ushort_get_col(gsl_vector_ushort * v, const gsl_matrix_ushort * m, const size_t j); +int gsl_matrix_ushort_set_row(gsl_matrix_ushort * m, const size_t i, const gsl_vector_ushort * v); +int gsl_matrix_ushort_set_col(gsl_matrix_ushort * m, const size_t j, const gsl_vector_ushort * v); +/***********************************************************************/ + +/* inline functions if you are using GCC */ + +INLINE_DECL unsigned short gsl_matrix_ushort_get(const gsl_matrix_ushort * m, const size_t i, const size_t j); +INLINE_DECL void gsl_matrix_ushort_set(gsl_matrix_ushort * m, const size_t i, const size_t j, const unsigned short x); +INLINE_DECL unsigned short * gsl_matrix_ushort_ptr(gsl_matrix_ushort * m, const size_t i, const size_t j); +INLINE_DECL const unsigned short * gsl_matrix_ushort_const_ptr(const gsl_matrix_ushort * m, const size_t i, const size_t j); + +#ifdef HAVE_INLINE +INLINE_FUN +unsigned short +gsl_matrix_ushort_get(const gsl_matrix_ushort * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; + } + } +#endif + return m->data[i * m->tda + j] ; +} + +INLINE_FUN +void +gsl_matrix_ushort_set(gsl_matrix_ushort * m, const size_t i, const size_t j, const unsigned short x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } + } +#endif + m->data[i * m->tda + j] = x ; +} + +INLINE_FUN +unsigned short * +gsl_matrix_ushort_ptr(gsl_matrix_ushort * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (unsigned short *) (m->data + (i * m->tda + j)) ; +} + +INLINE_FUN +const unsigned short * +gsl_matrix_ushort_const_ptr(const gsl_matrix_ushort * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(1)) + { + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } + } +#endif + return (const unsigned short *) (m->data + (i * m->tda + j)) ; +} + +#endif + +__END_DECLS + +#endif /* __GSL_MATRIX_USHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_message.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_message.h new file mode 100644 index 000000000..166ff9ddf --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_message.h @@ -0,0 +1,80 @@ +/* err/gsl_message.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MESSAGE_H__ +#define __GSL_MESSAGE_H__ +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* Provide a general messaging service for client use. Messages can + * be selectively turned off at compile time by defining an + * appropriate message mask. Client code which uses the GSL_MESSAGE() + * macro must provide a mask which is or'ed with the GSL_MESSAGE_MASK. + * + * The messaging service can be completely turned off + * by defining GSL_MESSAGING_OFF. */ + +void gsl_message(const char * message, const char * file, int line, + unsigned int mask); + +#ifndef GSL_MESSAGE_MASK +#define GSL_MESSAGE_MASK 0xffffffffu /* default all messages allowed */ +#endif + +GSL_VAR unsigned int gsl_message_mask ; + +/* Provide some symolic masks for client ease of use. */ + +enum { + GSL_MESSAGE_MASK_A = 1, + GSL_MESSAGE_MASK_B = 2, + GSL_MESSAGE_MASK_C = 4, + GSL_MESSAGE_MASK_D = 8, + GSL_MESSAGE_MASK_E = 16, + GSL_MESSAGE_MASK_F = 32, + GSL_MESSAGE_MASK_G = 64, + GSL_MESSAGE_MASK_H = 128 +} ; + +#ifdef GSL_MESSAGING_OFF /* throw away messages */ +#define GSL_MESSAGE(message, mask) do { } while(0) +#else /* output all messages */ +#define GSL_MESSAGE(message, mask) \ + do { \ + if (mask & GSL_MESSAGE_MASK) \ + gsl_message (message, __FILE__, __LINE__, mask) ; \ + } while (0) +#endif + +__END_DECLS + +#endif /* __GSL_MESSAGE_H__ */ + + diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_min.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_min.h new file mode 100644 index 000000000..c179572a3 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_min.h @@ -0,0 +1,111 @@ +/* min/gsl_min.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007, 2009 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MIN_H__ +#define __GSL_MIN_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct + { + const char *name; + size_t size; + int (*set) (void *state, gsl_function * f, double x_minimum, double f_minimum, double x_lower, double f_lower, double x_upper, double f_upper); + int (*iterate) (void *state, gsl_function * f, double * x_minimum, double * f_minimum, double * x_lower, double * f_lower, double * x_upper, double * f_upper); + } +gsl_min_fminimizer_type; + +typedef struct + { + const gsl_min_fminimizer_type * type; + gsl_function * function ; + double x_minimum ; + double x_lower ; + double x_upper ; + double f_minimum, f_lower, f_upper; + void *state; + } +gsl_min_fminimizer; + +gsl_min_fminimizer * +gsl_min_fminimizer_alloc (const gsl_min_fminimizer_type * T) ; + +void gsl_min_fminimizer_free (gsl_min_fminimizer * s); + +int gsl_min_fminimizer_set (gsl_min_fminimizer * s, + gsl_function * f, double x_minimum, + double x_lower, double x_upper); + +int gsl_min_fminimizer_set_with_values (gsl_min_fminimizer * s, + gsl_function * f, + double x_minimum, double f_minimum, + double x_lower, double f_lower, + double x_upper, double f_upper); + +int gsl_min_fminimizer_iterate (gsl_min_fminimizer * s); + +const char * gsl_min_fminimizer_name (const gsl_min_fminimizer * s); + +double gsl_min_fminimizer_x_minimum (const gsl_min_fminimizer * s); +double gsl_min_fminimizer_x_lower (const gsl_min_fminimizer * s); +double gsl_min_fminimizer_x_upper (const gsl_min_fminimizer * s); +double gsl_min_fminimizer_f_minimum (const gsl_min_fminimizer * s); +double gsl_min_fminimizer_f_lower (const gsl_min_fminimizer * s); +double gsl_min_fminimizer_f_upper (const gsl_min_fminimizer * s); + +/* Deprecated, use x_minimum instead */ +double gsl_min_fminimizer_minimum (const gsl_min_fminimizer * s); + +int +gsl_min_test_interval (double x_lower, double x_upper, double epsabs, double epsrel); + +GSL_VAR const gsl_min_fminimizer_type * gsl_min_fminimizer_goldensection; +GSL_VAR const gsl_min_fminimizer_type * gsl_min_fminimizer_brent; +GSL_VAR const gsl_min_fminimizer_type * gsl_min_fminimizer_quad_golden; + +typedef +int (*gsl_min_bracketing_function)(gsl_function *f, + double *x_minimum,double * f_minimum, + double *x_lower, double * f_lower, + double *x_upper, double * f_upper, + size_t eval_max); + +int +gsl_min_find_bracket(gsl_function *f,double *x_minimum,double * f_minimum, + double *x_lower, double * f_lower, + double *x_upper, double * f_upper, + size_t eval_max); + +__END_DECLS + +#endif /* __GSL_MIN_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_minmax.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_minmax.h new file mode 100644 index 000000000..0d9a8360d --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_minmax.h @@ -0,0 +1,102 @@ +/* gsl_minmax.h + * + * Copyright (C) 2008 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MINMAX_H__ +#define __GSL_MINMAX_H__ +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* Define MAX and MIN macros/functions if they don't exist. */ + +/* plain old macros for general use */ +#define GSL_MAX(a,b) ((a) > (b) ? (a) : (b)) +#define GSL_MIN(a,b) ((a) < (b) ? (a) : (b)) + +/* function versions of the above, in case they are needed */ +double gsl_max (double a, double b); +double gsl_min (double a, double b); + +/* inline-friendly strongly typed versions */ +#ifdef HAVE_INLINE + +INLINE_FUN int GSL_MAX_INT (int a, int b); +INLINE_FUN int GSL_MIN_INT (int a, int b); +INLINE_FUN double GSL_MAX_DBL (double a, double b); +INLINE_FUN double GSL_MIN_DBL (double a, double b); +INLINE_FUN long double GSL_MAX_LDBL (long double a, long double b); +INLINE_FUN long double GSL_MIN_LDBL (long double a, long double b); + +INLINE_FUN int +GSL_MAX_INT (int a, int b) +{ + return GSL_MAX (a, b); +} + +INLINE_FUN int +GSL_MIN_INT (int a, int b) +{ + return GSL_MIN (a, b); +} + +INLINE_FUN double +GSL_MAX_DBL (double a, double b) +{ + return GSL_MAX (a, b); +} + +INLINE_FUN double +GSL_MIN_DBL (double a, double b) +{ + return GSL_MIN (a, b); +} + +INLINE_FUN long double +GSL_MAX_LDBL (long double a, long double b) +{ + return GSL_MAX (a, b); +} + +INLINE_FUN long double +GSL_MIN_LDBL (long double a, long double b) +{ + return GSL_MIN (a, b); +} +#else +#define GSL_MAX_INT(a,b) GSL_MAX(a,b) +#define GSL_MIN_INT(a,b) GSL_MIN(a,b) +#define GSL_MAX_DBL(a,b) GSL_MAX(a,b) +#define GSL_MIN_DBL(a,b) GSL_MIN(a,b) +#define GSL_MAX_LDBL(a,b) GSL_MAX(a,b) +#define GSL_MIN_LDBL(a,b) GSL_MIN(a,b) +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_POW_INT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_mode.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_mode.h new file mode 100644 index 000000000..c8e5d55d6 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_mode.h @@ -0,0 +1,88 @@ +/* gsl_mode.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: B. Gough and G. Jungman */ + +#ifndef __GSL_MODE_H__ +#define __GSL_MODE_H__ +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Some functions can take a mode argument. This + * is a rough method to do things like control + * the precision of the algorithm. This mainly + * occurs in special functions, but we figured + * it was ok to have a general facility. + * + * The mode type is 32-bit field. Most of + * the fields are currently unused. Users + * '|' various predefined constants to get + * a desired mode. + */ +typedef unsigned int gsl_mode_t; + + +/* Here are the predefined constants. + * Note that the precision constants + * are special because they are used + * to index arrays, so do not change + * them. The precision information is + * in the low order 3 bits of gsl_mode_t + * (the third bit is currently unused). + */ + +/* Note that "0" is double precision, + * so that you get that by default if + * you forget a flag. + */ +#define GSL_PREC_DOUBLE 0 +#define GSL_PREC_SINGLE 1 +#define GSL_PREC_APPROX 2 + +#ifdef HAVE_INLINE +INLINE_FUN unsigned int GSL_MODE_PREC(gsl_mode_t mt); + +INLINE_FUN unsigned int +GSL_MODE_PREC(gsl_mode_t mt) +{ return (mt & (unsigned int)7); } +#else /* HAVE_INLINE */ +#define GSL_MODE_PREC(mt) ((mt) & (unsigned int)7) +#endif /* HAVE_INLINE */ + + +/* Here are some predefined generic modes. + */ +#define GSL_MODE_DEFAULT 0 + + +__END_DECLS + +#endif /* __GSL_MODE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_monte.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_monte.h new file mode 100644 index 000000000..4d1d88e25 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_monte.h @@ -0,0 +1,55 @@ +/* monte/gsl_monte.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Michael Booth + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Some things common to all the Monte-Carlo implementations */ +/* Author: MJB */ + +#ifndef __GSL_MONTE_H__ +#define __GSL_MONTE_H__ + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* Hide the function type in a typedef so that we can use it in all our + integration functions, and make it easy to change things. +*/ + +struct gsl_monte_function_struct { + double (*f)(double * x_array, size_t dim, void * params); + size_t dim; + void * params; +}; + +typedef struct gsl_monte_function_struct gsl_monte_function; + +#define GSL_MONTE_FN_EVAL(F,x) (*((F)->f))(x,(F)->dim,(F)->params) + + +__END_DECLS + +#endif /* __GSL_MONTE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_monte_miser.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_monte_miser.h new file mode 100644 index 000000000..5940396d1 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_monte_miser.h @@ -0,0 +1,97 @@ +/* monte/gsl_monte_miser.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Michael Booth + * Copyright (C) 2009 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: MJB */ + +#ifndef __GSL_MONTE_MISER_H__ +#define __GSL_MONTE_MISER_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct { + size_t min_calls; + size_t min_calls_per_bisection; + double dither; + double estimate_frac; + double alpha; + size_t dim; + int estimate_style; + int depth; + int verbose; + double * x; + double * xmid; + double * sigma_l; + double * sigma_r; + double * fmax_l; + double * fmax_r; + double * fmin_l; + double * fmin_r; + double * fsum_l; + double * fsum_r; + double * fsum2_l; + double * fsum2_r; + size_t * hits_l; + size_t * hits_r; +} gsl_monte_miser_state; + +int gsl_monte_miser_integrate(gsl_monte_function * f, + const double xl[], const double xh[], + size_t dim, size_t calls, + gsl_rng *r, + gsl_monte_miser_state* state, + double *result, double *abserr); + +gsl_monte_miser_state* gsl_monte_miser_alloc(size_t dim); + +int gsl_monte_miser_init(gsl_monte_miser_state* state); + +void gsl_monte_miser_free(gsl_monte_miser_state* state); + +typedef struct { + double estimate_frac; + size_t min_calls; + size_t min_calls_per_bisection; + double alpha; + double dither; +} gsl_monte_miser_params; + +void gsl_monte_miser_params_get (const gsl_monte_miser_state * state, + gsl_monte_miser_params * params); + +void gsl_monte_miser_params_set (gsl_monte_miser_state * state, + const gsl_monte_miser_params * params); + +__END_DECLS + +#endif /* __GSL_MONTE_MISER_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_monte_plain.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_monte_plain.h new file mode 100644 index 000000000..c4745b97d --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_monte_plain.h @@ -0,0 +1,65 @@ +/* monte/gsl_monte_plain.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Michael Booth + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Plain Monte-Carlo. */ + +/* Author: MJB */ + +#ifndef __GSL_MONTE_PLAIN_H__ +#define __GSL_MONTE_PLAIN_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct { + size_t dim; + double *x; +} gsl_monte_plain_state; + +int +gsl_monte_plain_integrate (const gsl_monte_function * f, + const double xl[], const double xu[], + const size_t dim, + const size_t calls, + gsl_rng * r, + gsl_monte_plain_state * state, + double *result, double *abserr); + +gsl_monte_plain_state* gsl_monte_plain_alloc(size_t dim); + +int gsl_monte_plain_init(gsl_monte_plain_state* state); + +void gsl_monte_plain_free (gsl_monte_plain_state* state); + +__END_DECLS + +#endif /* __GSL_MONTE_PLAIN_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_monte_vegas.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_monte_vegas.h new file mode 100644 index 000000000..0942c04dc --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_monte_vegas.h @@ -0,0 +1,125 @@ +/* monte/gsl_monte_vegas.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Michael Booth + * Copyright (C) 2009 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* header for the gsl "vegas" routines. Mike Booth, May 1998 */ + +#ifndef __GSL_MONTE_VEGAS_H__ +#define __GSL_MONTE_VEGAS_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +enum {GSL_VEGAS_MODE_IMPORTANCE = 1, + GSL_VEGAS_MODE_IMPORTANCE_ONLY = 0, + GSL_VEGAS_MODE_STRATIFIED = -1}; + +typedef struct { + /* grid */ + size_t dim; + size_t bins_max; + unsigned int bins; + unsigned int boxes; /* these are both counted along the axes */ + double * xi; + double * xin; + double * delx; + double * weight; + double vol; + + double * x; + int * bin; + int * box; + + /* distribution */ + double * d; + + /* control variables */ + double alpha; + int mode; + int verbose; + unsigned int iterations; + int stage; + + /* scratch variables preserved between calls to vegas1/2/3 */ + double jac; + double wtd_int_sum; + double sum_wgts; + double chi_sum; + double chisq; + + double result; + double sigma; + + unsigned int it_start; + unsigned int it_num; + unsigned int samples; + unsigned int calls_per_box; + + FILE * ostream; + +} gsl_monte_vegas_state; + +int gsl_monte_vegas_integrate(gsl_monte_function * f, + double xl[], double xu[], + size_t dim, size_t calls, + gsl_rng * r, + gsl_monte_vegas_state *state, + double* result, double* abserr); + +gsl_monte_vegas_state* gsl_monte_vegas_alloc(size_t dim); + +int gsl_monte_vegas_init(gsl_monte_vegas_state* state); + +void gsl_monte_vegas_free (gsl_monte_vegas_state* state); + +double gsl_monte_vegas_chisq (const gsl_monte_vegas_state* state); +void gsl_monte_vegas_runval (const gsl_monte_vegas_state* state, double * result, double * sigma); + +typedef struct { + double alpha; + size_t iterations; + int stage; + int mode; + int verbose; + FILE * ostream; +} gsl_monte_vegas_params; + +void gsl_monte_vegas_params_get (const gsl_monte_vegas_state * state, + gsl_monte_vegas_params * params); + +void gsl_monte_vegas_params_set (gsl_monte_vegas_state * state, + const gsl_monte_vegas_params * params); + +__END_DECLS + +#endif /* __GSL_MONTE_VEGAS_H__ */ + diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_movstat.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_movstat.h new file mode 100644 index 000000000..54f4fceb2 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_movstat.h @@ -0,0 +1,138 @@ +/* movstat/gsl_movstat.h + * + * Copyright (C) 2018 Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MOVSTAT_H__ +#define __GSL_MOVSTAT_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef enum +{ + GSL_MOVSTAT_END_PADZERO, + GSL_MOVSTAT_END_PADVALUE, + GSL_MOVSTAT_END_TRUNCATE +} gsl_movstat_end_t; + +/* accumulator struct + * size - return number of bytes needed for accumulator with maximum of n elements + * init - initialize accumulator state + * insert - insert a single sample into accumulator; if there are already n + * samples in accumulator, oldest sample is overwritten + * delete_oldest - delete oldest sample from accumulator + * get - return accumulated value + */ +typedef struct +{ + size_t (*size) (const size_t n); + int (*init) (const size_t n, void * vstate); + int (*insert) (const double x, void * vstate); + int (*delete_oldest) (void * vstate); + int (*get) (void * params, double * result, const void * vstate); +} gsl_movstat_accum; + +typedef struct +{ + double (* function) (const size_t n, double x[], void * params); + void * params; +} gsl_movstat_function; + +#define GSL_MOVSTAT_FN_EVAL(F,n,x) (*((F)->function))((n),(x),(F)->params) + +/* workspace for moving window statistics */ + +typedef struct +{ + size_t H; /* number of previous samples in window */ + size_t J; /* number of after samples in window */ + size_t K; /* window size K = H + J + 1 */ + double *work; /* workspace, size K */ + void *state; /* state workspace for various accumulators */ + size_t state_size; /* bytes allocated for 'state' */ +} gsl_movstat_workspace; + +/* alloc.c */ + +gsl_movstat_workspace *gsl_movstat_alloc(const size_t K); +gsl_movstat_workspace *gsl_movstat_alloc2(const size_t H, const size_t J); +gsl_movstat_workspace *gsl_movstat_alloc_with_size(const size_t accum_state_size, const size_t H, const size_t J); +void gsl_movstat_free(gsl_movstat_workspace * w); + +/* apply.c */ +int gsl_movstat_apply_accum(const gsl_movstat_end_t endtype, const gsl_vector * x, + const gsl_movstat_accum * accum, void * accum_params, + gsl_vector * y, gsl_vector * z, + gsl_movstat_workspace * w); +int gsl_movstat_apply(const gsl_movstat_end_t endtype, const gsl_movstat_function * F, + const gsl_vector * x, gsl_vector * y, gsl_movstat_workspace * w); + +/* fill.c */ +size_t gsl_movstat_fill(const gsl_movstat_end_t endtype, const gsl_vector * x, const size_t idx, + const size_t H, const size_t J, double * window); + +int gsl_movstat_mean(const gsl_movstat_end_t endtype, const gsl_vector * x, gsl_vector * y, gsl_movstat_workspace * w); +int gsl_movstat_variance(const gsl_movstat_end_t endtype, const gsl_vector * x, gsl_vector * y, gsl_movstat_workspace * w); +int gsl_movstat_sd(const gsl_movstat_end_t endtype, const gsl_vector * x, gsl_vector * y, gsl_movstat_workspace * w); +int gsl_movstat_median(const gsl_movstat_end_t endtype, const gsl_vector * x, gsl_vector * y, gsl_movstat_workspace * w); +int gsl_movstat_min(const gsl_movstat_end_t endtype, const gsl_vector * x, gsl_vector * y, gsl_movstat_workspace * w); +int gsl_movstat_max(const gsl_movstat_end_t endtype, const gsl_vector * x, gsl_vector * y, gsl_movstat_workspace * w); +int gsl_movstat_minmax(const gsl_movstat_end_t endtype, const gsl_vector * x, gsl_vector * y_min, gsl_vector * y_max, gsl_movstat_workspace * w); +int gsl_movstat_mad0(const gsl_movstat_end_t endtype, const gsl_vector * x, gsl_vector * xmedian, + gsl_vector * xmad, gsl_movstat_workspace * w); +int gsl_movstat_mad(const gsl_movstat_end_t endtype, const gsl_vector * x, gsl_vector * xmedian, + gsl_vector * xmad, gsl_movstat_workspace * w); +int gsl_movstat_qqr(const gsl_movstat_end_t endtype, const gsl_vector * x, const double q, + gsl_vector * xqqr, gsl_movstat_workspace * w); +int gsl_movstat_Sn(const gsl_movstat_end_t endtype, const gsl_vector * x, + gsl_vector * xscale, gsl_movstat_workspace * w); +int gsl_movstat_Qn(const gsl_movstat_end_t endtype, const gsl_vector * x, + gsl_vector * xscale, gsl_movstat_workspace * w); +int gsl_movstat_sum(const gsl_movstat_end_t endtype, const gsl_vector * x, gsl_vector * y, gsl_movstat_workspace * w); + +/* accumulator variables */ + +GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_mad; +GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_max; +GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_mean; +GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_median; +GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_min; +GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_minmax; +GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_sd; +GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_Sn; +GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_sum; +GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_Qn; +GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_qqr; +GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_userfunc; +GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_variance; + +__END_DECLS + +#endif /* __GSL_MOVSTAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_multifit.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_multifit.h new file mode 100644 index 000000000..42cbc54c1 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_multifit.h @@ -0,0 +1,380 @@ +/* multifit/gsl_multifit.h + * + * Copyright (C) 2000, 2007, 2010 Brian Gough + * Copyright (C) 2013, Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MULTIFIT_H__ +#define __GSL_MULTIFIT_H__ + +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t nmax; /* maximum number of observations */ + size_t pmax; /* maximum number of parameters */ + size_t n; /* number of observations in current SVD decomposition */ + size_t p; /* number of parameters in current SVD decomposition */ + gsl_matrix * A; /* least squares matrix for SVD, n-by-p */ + gsl_matrix * Q; + gsl_matrix * QSI; + gsl_vector * S; + gsl_vector * t; + gsl_vector * xt; + gsl_vector * D; + double rcond; /* reciprocal condition number */ +} +gsl_multifit_linear_workspace; + +gsl_multifit_linear_workspace * +gsl_multifit_linear_alloc (const size_t n, const size_t p); + +void +gsl_multifit_linear_free (gsl_multifit_linear_workspace * w); + +int +gsl_multifit_linear (const gsl_matrix * X, + const gsl_vector * y, + gsl_vector * c, + gsl_matrix * cov, + double * chisq, + gsl_multifit_linear_workspace * work); + +int +gsl_multifit_linear_tsvd (const gsl_matrix * X, + const gsl_vector * y, + const double tol, + gsl_vector * c, + gsl_matrix * cov, + double * chisq, + size_t * rank, + gsl_multifit_linear_workspace * work); + +int +gsl_multifit_linear_svd (const gsl_matrix * X, + gsl_multifit_linear_workspace * work); + +int +gsl_multifit_linear_bsvd (const gsl_matrix * X, + gsl_multifit_linear_workspace * work); + +size_t +gsl_multifit_linear_rank(const double tol, const gsl_multifit_linear_workspace * work); + +int +gsl_multifit_linear_solve (const double lambda, + const gsl_matrix * X, + const gsl_vector * y, + gsl_vector * c, + double *rnorm, + double *snorm, + gsl_multifit_linear_workspace * work); + +int +gsl_multifit_linear_applyW(const gsl_matrix * X, + const gsl_vector * w, + const gsl_vector * y, + gsl_matrix * WX, + gsl_vector * Wy); + +int +gsl_multifit_linear_stdform1 (const gsl_vector * L, + const gsl_matrix * X, + const gsl_vector * y, + gsl_matrix * Xs, + gsl_vector * ys, + gsl_multifit_linear_workspace * work); + +int +gsl_multifit_linear_wstdform1 (const gsl_vector * L, + const gsl_matrix * X, + const gsl_vector * w, + const gsl_vector * y, + gsl_matrix * Xs, + gsl_vector * ys, + gsl_multifit_linear_workspace * work); + +int +gsl_multifit_linear_L_decomp (gsl_matrix * L, gsl_vector * tau); + +int +gsl_multifit_linear_stdform2 (const gsl_matrix * LQR, + const gsl_vector * Ltau, + const gsl_matrix * X, + const gsl_vector * y, + gsl_matrix * Xs, + gsl_vector * ys, + gsl_matrix * M, + gsl_multifit_linear_workspace * work); + +int +gsl_multifit_linear_wstdform2 (const gsl_matrix * LQR, + const gsl_vector * Ltau, + const gsl_matrix * X, + const gsl_vector * w, + const gsl_vector * y, + gsl_matrix * Xs, + gsl_vector * ys, + gsl_matrix * M, + gsl_multifit_linear_workspace * work); + +int +gsl_multifit_linear_genform1 (const gsl_vector * L, + const gsl_vector * cs, + gsl_vector * c, + gsl_multifit_linear_workspace * work); + +int +gsl_multifit_linear_genform2 (const gsl_matrix * LQR, + const gsl_vector * Ltau, + const gsl_matrix * X, + const gsl_vector * y, + const gsl_vector * cs, + const gsl_matrix * M, + gsl_vector * c, + gsl_multifit_linear_workspace * work); + +int +gsl_multifit_linear_wgenform2 (const gsl_matrix * LQR, + const gsl_vector * Ltau, + const gsl_matrix * X, + const gsl_vector * w, + const gsl_vector * y, + const gsl_vector * cs, + const gsl_matrix * M, + gsl_vector * c, + gsl_multifit_linear_workspace * work); + +int +gsl_multifit_linear_lreg (const double smin, const double smax, + gsl_vector * reg_param); + +int +gsl_multifit_linear_lcurve (const gsl_vector * y, + gsl_vector * reg_param, + gsl_vector * rho, gsl_vector * eta, + gsl_multifit_linear_workspace * work); + +int +gsl_multifit_linear_lcorner(const gsl_vector *rho, + const gsl_vector *eta, + size_t *idx); + +int +gsl_multifit_linear_lcorner2(const gsl_vector *reg_param, + const gsl_vector *eta, + size_t *idx); + +int +gsl_multifit_linear_Lk(const size_t p, const size_t k, gsl_matrix *L); + +int +gsl_multifit_linear_Lsobolev(const size_t p, const size_t kmax, + const gsl_vector *alpha, gsl_matrix *L, + gsl_multifit_linear_workspace *work); + +int +gsl_multifit_wlinear (const gsl_matrix * X, + const gsl_vector * w, + const gsl_vector * y, + gsl_vector * c, + gsl_matrix * cov, + double * chisq, + gsl_multifit_linear_workspace * work); + +int +gsl_multifit_wlinear_tsvd (const gsl_matrix * X, + const gsl_vector * w, + const gsl_vector * y, + const double tol, + gsl_vector * c, + gsl_matrix * cov, + double * chisq, + size_t * rank, + gsl_multifit_linear_workspace * work); + +int +gsl_multifit_wlinear_svd (const gsl_matrix * X, + const gsl_vector * w, + const gsl_vector * y, + double tol, + size_t * rank, + gsl_vector * c, + gsl_matrix * cov, + double *chisq, + gsl_multifit_linear_workspace * work); + +int +gsl_multifit_wlinear_usvd (const gsl_matrix * X, + const gsl_vector * w, + const gsl_vector * y, + double tol, + size_t * rank, + gsl_vector * c, + gsl_matrix * cov, + double *chisq, + gsl_multifit_linear_workspace * work); + +int +gsl_multifit_linear_est (const gsl_vector * x, + const gsl_vector * c, + const gsl_matrix * cov, double *y, double *y_err); + +double +gsl_multifit_linear_rcond (const gsl_multifit_linear_workspace * w); + +int +gsl_multifit_linear_residuals (const gsl_matrix *X, const gsl_vector *y, + const gsl_vector *c, gsl_vector *r); + +/* gcv.c */ +int +gsl_multifit_linear_gcv_init(const gsl_vector * y, + gsl_vector * reg_param, + gsl_vector * UTy, + double * delta0, + gsl_multifit_linear_workspace * work); + +int +gsl_multifit_linear_gcv_curve(const gsl_vector * reg_param, + const gsl_vector * UTy, + const double delta0, + gsl_vector * G, + gsl_multifit_linear_workspace * work); + +int +gsl_multifit_linear_gcv_min(const gsl_vector * reg_param, + const gsl_vector * UTy, + const gsl_vector * G, + const double delta0, + double * lambda, + gsl_multifit_linear_workspace * work); + +double +gsl_multifit_linear_gcv_calc(const double lambda, + const gsl_vector * UTy, + const double delta0, + gsl_multifit_linear_workspace * work); + +int +gsl_multifit_linear_gcv(const gsl_vector * y, + gsl_vector * reg_param, + gsl_vector * G, + double * lambda, + double * G_lambda, + gsl_multifit_linear_workspace * work); + +typedef struct +{ + const char * name; /* method name */ + int (*wfun)(const gsl_vector *r, gsl_vector *w); + int (*psi_deriv)(const gsl_vector *r, gsl_vector *dpsi); + double tuning_default; /* default tuning constant */ +} gsl_multifit_robust_type; + +typedef struct +{ + double sigma_ols; /* OLS estimate of sigma */ + double sigma_mad; /* MAD estimate of sigma */ + double sigma_rob; /* robust estimate of sigma */ + double sigma; /* final estimate of sigma */ + double Rsq; /* R^2 coefficient of determination */ + double adj_Rsq; /* degree of freedom adjusted R^2 */ + double rmse; /* root mean squared error */ + double sse; /* residual sum of squares */ + size_t dof; /* degrees of freedom */ + size_t numit; /* number of iterations */ + gsl_vector *weights; /* final weights */ + gsl_vector *r; /* final residuals y - X c */ +} gsl_multifit_robust_stats; + +typedef struct +{ + size_t n; /* number of observations */ + size_t p; /* number of parameters */ + size_t numit; /* number of iterations */ + size_t maxiter; /* maximum iterations */ + const gsl_multifit_robust_type *type; + double tune; /* tuning parameter */ + + gsl_vector *r; /* residuals at current iteration */ + gsl_vector *weights; /* weights at current iteration */ + gsl_vector *c_prev; /* coefficients from previous iteration */ + gsl_vector *resfac; /* multiplicative factors for residuals */ + + gsl_vector *psi; /* psi(r) */ + gsl_vector *dpsi; /* psi'(r) */ + + gsl_matrix *QSI; /* Q S^{-1} of original matrix X */ + gsl_vector *D; /* balancing parameters of original matrix X */ + + gsl_vector *workn; /* workspace of length n */ + + gsl_multifit_robust_stats stats; /* various statistics */ + + gsl_multifit_linear_workspace *multifit_p; +} gsl_multifit_robust_workspace; + +/* available types */ +GSL_VAR const gsl_multifit_robust_type * gsl_multifit_robust_default; +GSL_VAR const gsl_multifit_robust_type * gsl_multifit_robust_bisquare; +GSL_VAR const gsl_multifit_robust_type * gsl_multifit_robust_cauchy; +GSL_VAR const gsl_multifit_robust_type * gsl_multifit_robust_fair; +GSL_VAR const gsl_multifit_robust_type * gsl_multifit_robust_huber; +GSL_VAR const gsl_multifit_robust_type * gsl_multifit_robust_ols; +GSL_VAR const gsl_multifit_robust_type * gsl_multifit_robust_welsch; + +gsl_multifit_robust_workspace *gsl_multifit_robust_alloc(const gsl_multifit_robust_type *T, + const size_t n, const size_t p); +void gsl_multifit_robust_free(gsl_multifit_robust_workspace *w); +int gsl_multifit_robust_tune(const double tune, + gsl_multifit_robust_workspace *w); +int gsl_multifit_robust_maxiter(const size_t maxiter, + gsl_multifit_robust_workspace *w); +const char *gsl_multifit_robust_name(const gsl_multifit_robust_workspace *w); +gsl_multifit_robust_stats gsl_multifit_robust_statistics(const gsl_multifit_robust_workspace *w); +int gsl_multifit_robust_weights(const gsl_vector *r, gsl_vector *wts, + gsl_multifit_robust_workspace *w); +int gsl_multifit_robust(const gsl_matrix * X, const gsl_vector * y, + gsl_vector * c, gsl_matrix *cov, + gsl_multifit_robust_workspace *w); +int gsl_multifit_robust_est(const gsl_vector * x, const gsl_vector * c, + const gsl_matrix * cov, double *y, double *y_err); +int gsl_multifit_robust_residuals(const gsl_matrix * X, + const gsl_vector * y, + const gsl_vector * c, gsl_vector * r, + gsl_multifit_robust_workspace * w); + +__END_DECLS + +#endif /* __GSL_MULTIFIT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_multifit_nlin.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_multifit_nlin.h new file mode 100644 index 000000000..b0dd06e79 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_multifit_nlin.h @@ -0,0 +1,275 @@ +/* multifit_nlin/gsl_multifit_nlin.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MULTIFIT_NLIN_H__ +#define __GSL_MULTIFIT_NLIN_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_multifit_gradient (const gsl_matrix * J, const gsl_vector * f, + gsl_vector * g); + +int gsl_multifit_covar (const gsl_matrix * J, const double epsrel, gsl_matrix * covar); +int gsl_multifit_covar_QRPT (gsl_matrix * r, gsl_permutation * perm, + const double epsrel, gsl_matrix * covar); + + +/* Definition of vector-valued functions with parameters based on gsl_vector */ + +struct gsl_multifit_function_struct +{ + int (* f) (const gsl_vector * x, void * params, gsl_vector * f); + size_t n; /* number of functions */ + size_t p; /* number of independent variables */ + void * params; +}; + +typedef struct gsl_multifit_function_struct gsl_multifit_function ; + +#define GSL_MULTIFIT_FN_EVAL(F,x,y) (*((F)->f))(x,(F)->params,(y)) + +typedef struct + { + const char *name; + size_t size; + int (*alloc) (void *state, size_t n, size_t p); + int (*set) (void *state, gsl_multifit_function * function, gsl_vector * x, gsl_vector * f, gsl_vector * dx); + int (*iterate) (void *state, gsl_multifit_function * function, gsl_vector * x, gsl_vector * f, gsl_vector * dx); + void (*free) (void *state); + } +gsl_multifit_fsolver_type; + +typedef struct + { + const gsl_multifit_fsolver_type * type; + gsl_multifit_function * function ; + gsl_vector * x ; + gsl_vector * f ; + gsl_vector * dx ; + void *state; + } +gsl_multifit_fsolver; + +gsl_multifit_fsolver * +gsl_multifit_fsolver_alloc (const gsl_multifit_fsolver_type * T, + size_t n, size_t p); + +void gsl_multifit_fsolver_free (gsl_multifit_fsolver * s); + +int gsl_multifit_fsolver_set (gsl_multifit_fsolver * s, + gsl_multifit_function * f, + const gsl_vector * x); + +int gsl_multifit_fsolver_iterate (gsl_multifit_fsolver * s); + +int gsl_multifit_fsolver_driver (gsl_multifit_fsolver * s, + const size_t maxiter, + const double epsabs, const double epsrel); + +const char * gsl_multifit_fsolver_name (const gsl_multifit_fsolver * s); +gsl_vector * gsl_multifit_fsolver_position (const gsl_multifit_fsolver * s); + +/* Definition of vector-valued functions and gradient with parameters + based on gsl_vector */ + +struct gsl_multifit_function_fdf_struct +{ + int (* f) (const gsl_vector * x, void * params, gsl_vector * f); + int (* df) (const gsl_vector * x, void * params, gsl_matrix * df); + int (* fdf) (const gsl_vector * x, void * params, gsl_vector * f, gsl_matrix *df); + size_t n; /* number of functions */ + size_t p; /* number of independent variables */ + void * params; /* user parameters */ + size_t nevalf; /* number of function evaluations */ + size_t nevaldf; /* number of Jacobian evaluations */ +}; + +typedef struct gsl_multifit_function_fdf_struct gsl_multifit_function_fdf ; + +typedef struct + { + const char *name; + size_t size; + int (*alloc) (void *state, size_t n, size_t p); + int (*set) (void *state, const gsl_vector * wts, + gsl_multifit_function_fdf * fdf, gsl_vector * x, + gsl_vector * f, gsl_vector * dx); + int (*iterate) (void *state, const gsl_vector * wts, + gsl_multifit_function_fdf * fdf, gsl_vector * x, + gsl_vector * f, gsl_vector * dx); + int (*gradient) (void *state, gsl_vector * g); + int (*jac) (void *state, gsl_matrix * J); + void (*free) (void *state); + } +gsl_multifit_fdfsolver_type; + +typedef struct + { + const gsl_multifit_fdfsolver_type * type; + gsl_multifit_function_fdf * fdf ; + gsl_vector * x; /* parameter values x */ + gsl_vector * f; /* residual vector f(x) */ + gsl_vector * dx; /* step dx */ + gsl_vector * g; /* gradient J^T f */ + gsl_vector * sqrt_wts; /* sqrt(wts) */ + size_t niter; /* number of iterations performed */ + void *state; + } +gsl_multifit_fdfsolver; + + +gsl_multifit_fdfsolver * +gsl_multifit_fdfsolver_alloc (const gsl_multifit_fdfsolver_type * T, + size_t n, size_t p); + +int +gsl_multifit_fdfsolver_set (gsl_multifit_fdfsolver * s, + gsl_multifit_function_fdf * fdf, + const gsl_vector * x); +int gsl_multifit_fdfsolver_wset (gsl_multifit_fdfsolver * s, + gsl_multifit_function_fdf * f, + const gsl_vector * x, + const gsl_vector * wts); + +int +gsl_multifit_fdfsolver_iterate (gsl_multifit_fdfsolver * s); + +int gsl_multifit_fdfsolver_driver (gsl_multifit_fdfsolver * s, + const size_t maxiter, + const double xtol, + const double gtol, + const double ftol, + int *info); + +int gsl_multifit_fdfsolver_jac (gsl_multifit_fdfsolver * s, + gsl_matrix * J); + +void +gsl_multifit_fdfsolver_free (gsl_multifit_fdfsolver * s); + +const char * gsl_multifit_fdfsolver_name (const gsl_multifit_fdfsolver * s); +gsl_vector * gsl_multifit_fdfsolver_position (const gsl_multifit_fdfsolver * s); +gsl_vector * gsl_multifit_fdfsolver_residual (const gsl_multifit_fdfsolver * s); +size_t gsl_multifit_fdfsolver_niter (const gsl_multifit_fdfsolver * s); +int gsl_multifit_eval_wf(gsl_multifit_function_fdf *fdf, + const gsl_vector *x, const gsl_vector *wts, + gsl_vector *y); +int gsl_multifit_eval_wdf(gsl_multifit_function_fdf *fdf, + const gsl_vector *x, const gsl_vector *wts, + gsl_matrix *dy); + +int gsl_multifit_fdfsolver_test (const gsl_multifit_fdfsolver * s, + const double xtol, + const double gtol, + const double ftol, int *info); +int gsl_multifit_test_delta (const gsl_vector * dx, const gsl_vector * x, + double epsabs, double epsrel); + +int gsl_multifit_test_gradient (const gsl_vector * g, double epsabs); + +int gsl_multifit_fdfsolver_dif_df(const gsl_vector *x, + const gsl_vector *wts, + gsl_multifit_function_fdf *fdf, + const gsl_vector *f, gsl_matrix *J); +int gsl_multifit_fdfsolver_dif_fdf(const gsl_vector *x, gsl_multifit_function_fdf *fdf, + gsl_vector *f, gsl_matrix *J); + +typedef struct +{ + size_t n; /* number of (original) residuals */ + size_t p; /* number of model parameters */ + double lambda; /* damping parameter */ + const gsl_vector *L_diag; /* diagonal damping matrix or NULL */ + const gsl_matrix *L; /* general damping matrix or NULL */ + gsl_vector *f; /* function values for finite diff J */ + gsl_vector *wts; /* weight vector for augmented system */ + gsl_multifit_fdfsolver * s; + gsl_multifit_function_fdf *fdf; /* user defined fdf */ + gsl_multifit_function_fdf fdftik; /* Tikhonov modified fdf */ +} gsl_multifit_fdfridge; + +gsl_multifit_fdfridge * +gsl_multifit_fdfridge_alloc (const gsl_multifit_fdfsolver_type * T, + const size_t n, const size_t p); +void gsl_multifit_fdfridge_free(gsl_multifit_fdfridge *work); +const char *gsl_multifit_fdfridge_name(const gsl_multifit_fdfridge * w); +gsl_vector *gsl_multifit_fdfridge_position (const gsl_multifit_fdfridge * w); +gsl_vector *gsl_multifit_fdfridge_residual (const gsl_multifit_fdfridge * w); +size_t gsl_multifit_fdfridge_niter (const gsl_multifit_fdfridge * w); +int gsl_multifit_fdfridge_set (gsl_multifit_fdfridge * w, + gsl_multifit_function_fdf * f, + const gsl_vector * x, + const double lambda); +int gsl_multifit_fdfridge_wset (gsl_multifit_fdfridge * w, + gsl_multifit_function_fdf * f, + const gsl_vector * x, + const double lambda, + const gsl_vector * wts); +int gsl_multifit_fdfridge_set2 (gsl_multifit_fdfridge * w, + gsl_multifit_function_fdf * f, + const gsl_vector * x, + const gsl_vector * lambda); +int gsl_multifit_fdfridge_wset2 (gsl_multifit_fdfridge * w, + gsl_multifit_function_fdf * f, + const gsl_vector * x, + const gsl_vector * lambda, + const gsl_vector * wts); +int gsl_multifit_fdfridge_set3 (gsl_multifit_fdfridge * w, + gsl_multifit_function_fdf * f, + const gsl_vector * x, + const gsl_matrix * L); +int gsl_multifit_fdfridge_wset3 (gsl_multifit_fdfridge * w, + gsl_multifit_function_fdf * f, + const gsl_vector * x, + const gsl_matrix * L, + const gsl_vector * wts); +int gsl_multifit_fdfridge_iterate (gsl_multifit_fdfridge * w); +int gsl_multifit_fdfridge_driver (gsl_multifit_fdfridge * w, + const size_t maxiter, + const double xtol, + const double gtol, + const double ftol, + int *info); + +/* extern const gsl_multifit_fsolver_type * gsl_multifit_fsolver_gradient; */ + +GSL_VAR const gsl_multifit_fdfsolver_type * gsl_multifit_fdfsolver_lmsder; +GSL_VAR const gsl_multifit_fdfsolver_type * gsl_multifit_fdfsolver_lmder; +GSL_VAR const gsl_multifit_fdfsolver_type * gsl_multifit_fdfsolver_lmniel; + +__END_DECLS + +#endif /* __GSL_MULTIFIT_NLIN_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_multifit_nlinear.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_multifit_nlinear.h new file mode 100644 index 000000000..4e1828c1f --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_multifit_nlinear.h @@ -0,0 +1,303 @@ +/* multifit_nlinear/gsl_multifit_nlinear.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * Copyright (C) 2015, 2016 Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MULTIFIT_NLINEAR_H__ +#define __GSL_MULTIFIT_NLINEAR_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef enum +{ + GSL_MULTIFIT_NLINEAR_FWDIFF, + GSL_MULTIFIT_NLINEAR_CTRDIFF +} gsl_multifit_nlinear_fdtype; + +/* Definition of vector-valued functions and gradient with parameters + based on gsl_vector */ + +typedef struct +{ + int (* f) (const gsl_vector * x, void * params, gsl_vector * f); + int (* df) (const gsl_vector * x, void * params, gsl_matrix * df); + int (* fvv) (const gsl_vector * x, const gsl_vector * v, void * params, + gsl_vector * fvv); + size_t n; /* number of functions */ + size_t p; /* number of independent variables */ + void * params; /* user parameters */ + size_t nevalf; /* number of function evaluations */ + size_t nevaldf; /* number of Jacobian evaluations */ + size_t nevalfvv; /* number of fvv evaluations */ +} gsl_multifit_nlinear_fdf; + +/* trust region subproblem method */ +typedef struct +{ + const char *name; + void * (*alloc) (const void * params, const size_t n, const size_t p); + int (*init) (const void * vtrust_state, void * vstate); + int (*preloop) (const void * vtrust_state, void * vstate); + int (*step) (const void * vtrust_state, const double delta, + gsl_vector * dx, void * vstate); + int (*preduction) (const void * vtrust_state, const gsl_vector * dx, + double * pred, void * vstate); + void (*free) (void * vstate); +} gsl_multifit_nlinear_trs; + +/* scaling matrix specification */ +typedef struct +{ + const char *name; + int (*init) (const gsl_matrix * J, gsl_vector * diag); + int (*update) (const gsl_matrix * J, gsl_vector * diag); +} gsl_multifit_nlinear_scale; + +/* + * linear least squares solvers - there are three steps to + * solving a least squares problem using a trust region + * method: + * + * 1. init: called once per iteration when a new Jacobian matrix + * is computed; perform factorization of Jacobian (qr,svd) + * or form normal equations matrix (cholesky) + * 2. presolve: called each time a new LM parameter value mu is available; + * used for cholesky method in order to factor + * the (J^T J + mu D^T D) matrix + * 3. solve: solve the least square system for a given rhs + */ +typedef struct +{ + const char *name; + void * (*alloc) (const size_t n, const size_t p); + int (*init) (const void * vtrust_state, void * vstate); + int (*presolve) (const double mu, const void * vtrust_state, void * vstate); + int (*solve) (const gsl_vector * f, gsl_vector * x, + const void * vtrust_state, void * vstate); + int (*rcond) (double * rcond, void * vstate); + void (*free) (void * vstate); +} gsl_multifit_nlinear_solver; + +/* tunable parameters */ +typedef struct +{ + const gsl_multifit_nlinear_trs *trs; /* trust region subproblem method */ + const gsl_multifit_nlinear_scale *scale; /* scaling method */ + const gsl_multifit_nlinear_solver *solver; /* solver method */ + gsl_multifit_nlinear_fdtype fdtype; /* finite difference method */ + double factor_up; /* factor for increasing trust radius */ + double factor_down; /* factor for decreasing trust radius */ + double avmax; /* max allowed |a|/|v| */ + double h_df; /* step size for finite difference Jacobian */ + double h_fvv; /* step size for finite difference fvv */ +} gsl_multifit_nlinear_parameters; + +typedef struct +{ + const char *name; + void * (*alloc) (const gsl_multifit_nlinear_parameters * params, + const size_t n, const size_t p); + int (*init) (void * state, const gsl_vector * wts, + gsl_multifit_nlinear_fdf * fdf, const gsl_vector * x, + gsl_vector * f, gsl_matrix * J, gsl_vector * g); + int (*iterate) (void * state, const gsl_vector * wts, + gsl_multifit_nlinear_fdf * fdf, gsl_vector * x, + gsl_vector * f, gsl_matrix * J, gsl_vector * g, + gsl_vector * dx); + int (*rcond) (double * rcond, void * state); + double (*avratio) (void * state); + void (*free) (void * state); +} gsl_multifit_nlinear_type; + +/* current state passed to low-level trust region algorithms */ +typedef struct +{ + const gsl_vector * x; /* parameter values x */ + const gsl_vector * f; /* residual vector f(x) */ + const gsl_vector * g; /* gradient J^T f */ + const gsl_matrix * J; /* Jacobian J(x) */ + const gsl_vector * diag; /* scaling matrix D */ + const gsl_vector * sqrt_wts; /* sqrt(diag(W)) or NULL for unweighted */ + const double *mu; /* LM parameter */ + const gsl_multifit_nlinear_parameters * params; + void *solver_state; /* workspace for linear least squares solver */ + gsl_multifit_nlinear_fdf * fdf; + double *avratio; /* |a| / |v| */ +} gsl_multifit_nlinear_trust_state; + +typedef struct +{ + const gsl_multifit_nlinear_type * type; + gsl_multifit_nlinear_fdf * fdf ; + gsl_vector * x; /* parameter values x */ + gsl_vector * f; /* residual vector f(x) */ + gsl_vector * dx; /* step dx */ + gsl_vector * g; /* gradient J^T f */ + gsl_matrix * J; /* Jacobian J(x) */ + gsl_vector * sqrt_wts_work; /* sqrt(W) */ + gsl_vector * sqrt_wts; /* ptr to sqrt_wts_work, or NULL if not using weights */ + size_t niter; /* number of iterations performed */ + gsl_multifit_nlinear_parameters params; + void *state; +} gsl_multifit_nlinear_workspace; + +gsl_multifit_nlinear_workspace * +gsl_multifit_nlinear_alloc (const gsl_multifit_nlinear_type * T, + const gsl_multifit_nlinear_parameters * params, + size_t n, size_t p); + +void gsl_multifit_nlinear_free (gsl_multifit_nlinear_workspace * w); + +gsl_multifit_nlinear_parameters gsl_multifit_nlinear_default_parameters(void); + +int +gsl_multifit_nlinear_init (const gsl_vector * x, + gsl_multifit_nlinear_fdf * fdf, + gsl_multifit_nlinear_workspace * w); + +int gsl_multifit_nlinear_winit (const gsl_vector * x, + const gsl_vector * wts, + gsl_multifit_nlinear_fdf * fdf, + gsl_multifit_nlinear_workspace * w); + +int +gsl_multifit_nlinear_iterate (gsl_multifit_nlinear_workspace * w); + +double +gsl_multifit_nlinear_avratio (const gsl_multifit_nlinear_workspace * w); + +int +gsl_multifit_nlinear_driver (const size_t maxiter, + const double xtol, + const double gtol, + const double ftol, + void (*callback)(const size_t iter, void *params, + const gsl_multifit_nlinear_workspace *w), + void *callback_params, + int *info, + gsl_multifit_nlinear_workspace * w); + +gsl_matrix * +gsl_multifit_nlinear_jac (const gsl_multifit_nlinear_workspace * w); + +const char * +gsl_multifit_nlinear_name (const gsl_multifit_nlinear_workspace * w); + +gsl_vector * +gsl_multifit_nlinear_position (const gsl_multifit_nlinear_workspace * w); + +gsl_vector * +gsl_multifit_nlinear_residual (const gsl_multifit_nlinear_workspace * w); + +size_t +gsl_multifit_nlinear_niter (const gsl_multifit_nlinear_workspace * w); + +int +gsl_multifit_nlinear_rcond (double *rcond, const gsl_multifit_nlinear_workspace * w); + +const char * +gsl_multifit_nlinear_trs_name (const gsl_multifit_nlinear_workspace * w); + +int gsl_multifit_nlinear_eval_f(gsl_multifit_nlinear_fdf *fdf, + const gsl_vector *x, + const gsl_vector *swts, + gsl_vector *y); + +int gsl_multifit_nlinear_eval_df(const gsl_vector *x, + const gsl_vector *f, + const gsl_vector *swts, + const double h, + const gsl_multifit_nlinear_fdtype fdtype, + gsl_multifit_nlinear_fdf *fdf, + gsl_matrix *df, gsl_vector *work); + +int +gsl_multifit_nlinear_eval_fvv(const double h, + const gsl_vector *x, + const gsl_vector *v, + const gsl_vector *f, + const gsl_matrix *J, + const gsl_vector *swts, + gsl_multifit_nlinear_fdf *fdf, + gsl_vector *yvv, gsl_vector *work); + +/* covar.c */ +int +gsl_multifit_nlinear_covar (const gsl_matrix * J, const double epsrel, + gsl_matrix * covar); + +/* convergence.c */ +int +gsl_multifit_nlinear_test (const double xtol, const double gtol, + const double ftol, int *info, + const gsl_multifit_nlinear_workspace * w); + +/* fdjac.c */ +int +gsl_multifit_nlinear_df(const double h, const gsl_multifit_nlinear_fdtype fdtype, + const gsl_vector *x, const gsl_vector *wts, + gsl_multifit_nlinear_fdf *fdf, + const gsl_vector *f, gsl_matrix *J, gsl_vector *work); + +/* fdfvv.c */ +int +gsl_multifit_nlinear_fdfvv(const double h, const gsl_vector *x, const gsl_vector *v, + const gsl_vector *f, const gsl_matrix *J, + const gsl_vector *swts, gsl_multifit_nlinear_fdf *fdf, + gsl_vector *fvv, gsl_vector *work); + +/* top-level algorithms */ +GSL_VAR const gsl_multifit_nlinear_type * gsl_multifit_nlinear_trust; + +/* trust region subproblem methods */ +GSL_VAR const gsl_multifit_nlinear_trs * gsl_multifit_nlinear_trs_lm; +GSL_VAR const gsl_multifit_nlinear_trs * gsl_multifit_nlinear_trs_lmaccel; +GSL_VAR const gsl_multifit_nlinear_trs * gsl_multifit_nlinear_trs_dogleg; +GSL_VAR const gsl_multifit_nlinear_trs * gsl_multifit_nlinear_trs_ddogleg; +GSL_VAR const gsl_multifit_nlinear_trs * gsl_multifit_nlinear_trs_subspace2D; + +/* scaling matrix strategies */ +GSL_VAR const gsl_multifit_nlinear_scale * gsl_multifit_nlinear_scale_levenberg; +GSL_VAR const gsl_multifit_nlinear_scale * gsl_multifit_nlinear_scale_marquardt; +GSL_VAR const gsl_multifit_nlinear_scale * gsl_multifit_nlinear_scale_more; + +/* linear solvers */ +GSL_VAR const gsl_multifit_nlinear_solver * gsl_multifit_nlinear_solver_cholesky; +GSL_VAR const gsl_multifit_nlinear_solver * gsl_multifit_nlinear_solver_qr; +GSL_VAR const gsl_multifit_nlinear_solver * gsl_multifit_nlinear_solver_svd; + +__END_DECLS + +#endif /* __GSL_MULTIFIT_NLINEAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_multilarge.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_multilarge.h new file mode 100644 index 000000000..e99c1e1c0 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_multilarge.h @@ -0,0 +1,141 @@ +/* gsl_multilarge.h + * + * Copyright (C) 2015 Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MULTILARGE_H__ +#define __GSL_MULTILARGE_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* iteration solver type */ +typedef struct +{ + const char *name; + void * (*alloc) (const size_t p); + int (*reset) (void *); + int (*accumulate) (gsl_matrix * X, gsl_vector * y, + void *); + int (*solve) (const double lambda, gsl_vector * c, + double * rnorm, double * snorm, void *); + int (*rcond) (double * rcond, void *); + int (*lcurve) (gsl_vector * reg_param, gsl_vector * rho, + gsl_vector * eta, void *); + void (*free) (void *); +} gsl_multilarge_linear_type; + +typedef struct +{ + const gsl_multilarge_linear_type * type; + void * state; + size_t p; +} gsl_multilarge_linear_workspace; + +/* available types */ +GSL_VAR const gsl_multilarge_linear_type * gsl_multilarge_linear_normal; +GSL_VAR const gsl_multilarge_linear_type * gsl_multilarge_linear_tsqr; + +/* + * Prototypes + */ +gsl_multilarge_linear_workspace * +gsl_multilarge_linear_alloc(const gsl_multilarge_linear_type * T, + const size_t p); + +void gsl_multilarge_linear_free(gsl_multilarge_linear_workspace * w); + +const char *gsl_multilarge_linear_name(const gsl_multilarge_linear_workspace * w); + +int gsl_multilarge_linear_reset(gsl_multilarge_linear_workspace * w); + +int gsl_multilarge_linear_accumulate(gsl_matrix * X, + gsl_vector * y, + gsl_multilarge_linear_workspace * w); + +int gsl_multilarge_linear_solve(const double lambda, gsl_vector * c, + double * rnorm, double * snorm, + gsl_multilarge_linear_workspace * w); + +int gsl_multilarge_linear_rcond(double *rcond, gsl_multilarge_linear_workspace * w); + +int gsl_multilarge_linear_lcurve(gsl_vector * reg_param, gsl_vector * rho, + gsl_vector * eta, + gsl_multilarge_linear_workspace * w); + +int gsl_multilarge_linear_wstdform1 (const gsl_vector * L, + const gsl_matrix * X, + const gsl_vector * w, + const gsl_vector * y, + gsl_matrix * Xs, + gsl_vector * ys, + gsl_multilarge_linear_workspace * work); + +int gsl_multilarge_linear_stdform1 (const gsl_vector * L, + const gsl_matrix * X, + const gsl_vector * y, + gsl_matrix * Xs, + gsl_vector * ys, + gsl_multilarge_linear_workspace * work); + +int gsl_multilarge_linear_L_decomp (gsl_matrix * L, gsl_vector * tau); + +int gsl_multilarge_linear_wstdform2 (const gsl_matrix * LQR, + const gsl_vector * Ltau, + const gsl_matrix * X, + const gsl_vector * w, + const gsl_vector * y, + gsl_matrix * Xs, + gsl_vector * ys, + gsl_multilarge_linear_workspace * work); + +int gsl_multilarge_linear_stdform2 (const gsl_matrix * LQR, + const gsl_vector * Ltau, + const gsl_matrix * X, + const gsl_vector * y, + gsl_matrix * Xs, + gsl_vector * ys, + gsl_multilarge_linear_workspace * work); + +int gsl_multilarge_linear_genform1 (const gsl_vector * L, + const gsl_vector * cs, + gsl_vector * c, + gsl_multilarge_linear_workspace * work); + +int gsl_multilarge_linear_genform2 (const gsl_matrix * LQR, + const gsl_vector * Ltau, + const gsl_vector * cs, + gsl_vector * c, + gsl_multilarge_linear_workspace * work); + +__END_DECLS + +#endif /* __GSL_MULTILARGE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_multilarge_nlinear.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_multilarge_nlinear.h new file mode 100644 index 000000000..51e131b30 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_multilarge_nlinear.h @@ -0,0 +1,313 @@ +/* multilarge_nlinear/gsl_multilarge_nlinear.h + * + * Copyright (C) 2015, 2016 Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MULTILARGE_NLINEAR_H__ +#define __GSL_MULTILARGE_NLINEAR_H__ + +#include +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef enum +{ + GSL_MULTILARGE_NLINEAR_FWDIFF, + GSL_MULTILARGE_NLINEAR_CTRDIFF +} gsl_multilarge_nlinear_fdtype; + +/* Definition of vector-valued functions and gradient with parameters + based on gsl_vector */ + +typedef struct +{ + int (* f) (const gsl_vector * x, void * params, gsl_vector * f); + int (* df) (CBLAS_TRANSPOSE_t TransJ, const gsl_vector * x, + const gsl_vector * u, void * params, gsl_vector * v, + gsl_matrix * JTJ); + int (* fvv) (const gsl_vector * x, const gsl_vector * v, void * params, + gsl_vector * fvv); + size_t n; /* number of functions */ + size_t p; /* number of independent variables */ + void * params; /* user parameters */ + size_t nevalf; /* number of function evaluations */ + size_t nevaldfu; /* number of Jacobian matrix-vector evaluations */ + size_t nevaldf2; /* number of Jacobian J^T J evaluations */ + size_t nevalfvv; /* number of fvv evaluations */ +} gsl_multilarge_nlinear_fdf; + +/* trust region subproblem method */ +typedef struct +{ + const char *name; + void * (*alloc) (const void * params, const size_t n, const size_t p); + int (*init) (const void * vtrust_state, void * vstate); + int (*preloop) (const void * vtrust_state, void * vstate); + int (*step) (const void * vtrust_state, const double delta, + gsl_vector * dx, void * vstate); + int (*preduction) (const void * vtrust_state, const gsl_vector * dx, + double * pred, void * vstate); + void (*free) (void * vstate); +} gsl_multilarge_nlinear_trs; + +/* scaling matrix specification */ +typedef struct +{ + const char *name; + int (*init) (const gsl_matrix * JTJ, gsl_vector * diag); + int (*update) (const gsl_matrix * JTJ, gsl_vector * diag); +} gsl_multilarge_nlinear_scale; + +/* + * linear least squares solvers - there are three steps to + * solving a least squares problem using a direct method: + * + * 1. init: called once per iteration when a new Jacobian matrix + * is required; form normal equations matrix J^T J + * 2. presolve: called each time a new LM parameter value mu is available; + * used for cholesky method in order to factor + * the (J^T J + mu D^T D) matrix + * 3. solve: solve the least square system for a given rhs + */ +typedef struct +{ + const char *name; + void * (*alloc) (const size_t n, const size_t p); + int (*init) (const void * vtrust_state, void * vstate); + int (*presolve) (const double mu, const void * vtrust_state, void * vstate); + int (*solve) (const gsl_vector * g, gsl_vector * x, + const void * vtrust_state, void * vstate); + int (*rcond) (double * rcond, const gsl_matrix * JTJ, void * vstate); + int (*covar) (const gsl_matrix * JTJ, gsl_matrix * covar, void * vstate); + void (*free) (void * vstate); +} gsl_multilarge_nlinear_solver; + +/* tunable parameters */ +typedef struct +{ + const gsl_multilarge_nlinear_trs *trs; /* trust region subproblem method */ + const gsl_multilarge_nlinear_scale *scale; /* scaling method */ + const gsl_multilarge_nlinear_solver *solver; /* solver method */ + gsl_multilarge_nlinear_fdtype fdtype; /* finite difference method */ + double factor_up; /* factor for increasing trust radius */ + double factor_down; /* factor for decreasing trust radius */ + double avmax; /* max allowed |a|/|v| */ + double h_df; /* step size for finite difference Jacobian */ + double h_fvv; /* step size for finite difference fvv */ + size_t max_iter; /* maximum iterations for trs method */ + double tol; /* tolerance for solving trs */ +} gsl_multilarge_nlinear_parameters; + +typedef struct +{ + const char *name; + void * (*alloc) (const gsl_multilarge_nlinear_parameters * params, + const size_t n, const size_t p); + int (*init) (void * state, const gsl_vector * wts, + gsl_multilarge_nlinear_fdf * fdf, const gsl_vector * x, + gsl_vector * f, gsl_vector * g, gsl_matrix * JTJ); + int (*iterate) (void * state, const gsl_vector * wts, + gsl_multilarge_nlinear_fdf * fdf, gsl_vector * x, + gsl_vector * f, gsl_vector * g, gsl_matrix * JTJ, + gsl_vector * dx); + int (*rcond) (double * rcond, const gsl_matrix * JTJ, void * state); + int (*covar) (const gsl_matrix * JTJ, gsl_matrix * covar, void * state); + double (*avratio) (void * state); + void (*free) (void * state); +} gsl_multilarge_nlinear_type; + +/* current state passed to low-level trust region algorithms */ +typedef struct +{ + const gsl_vector * x; /* parameter values x */ + const gsl_vector * f; /* residual vector f(x) */ + const gsl_vector * g; /* gradient J^T f */ + const gsl_matrix * JTJ; /* matrix J^T J */ + const gsl_vector * diag; /* scaling matrix D */ + const gsl_vector * sqrt_wts; /* sqrt(diag(W)) or NULL for unweighted */ + const double *mu; /* LM parameter */ + const gsl_multilarge_nlinear_parameters * params; + void *solver_state; /* workspace for direct least squares solver */ + gsl_multilarge_nlinear_fdf * fdf; + double *avratio; /* |a| / |v| */ +} gsl_multilarge_nlinear_trust_state; + +typedef struct +{ + const gsl_multilarge_nlinear_type * type; + gsl_multilarge_nlinear_fdf * fdf ; + gsl_vector * x; /* parameter values x */ + gsl_vector * f; /* residual vector f(x) */ + gsl_vector * dx; /* step dx */ + gsl_vector * g; /* gradient J^T f */ + gsl_matrix * JTJ; /* matrix J^T J */ + gsl_vector * sqrt_wts_work; /* sqrt(W) */ + gsl_vector * sqrt_wts; /* ptr to sqrt_wts_work, or NULL if not using weights */ + size_t n; /* number of residuals */ + size_t p; /* number of parameters */ + size_t niter; /* number of iterations performed */ + gsl_multilarge_nlinear_parameters params; + void *state; +} gsl_multilarge_nlinear_workspace; + +gsl_multilarge_nlinear_workspace * +gsl_multilarge_nlinear_alloc (const gsl_multilarge_nlinear_type * T, + const gsl_multilarge_nlinear_parameters * params, + size_t n, size_t p); + +void gsl_multilarge_nlinear_free (gsl_multilarge_nlinear_workspace * w); + +gsl_multilarge_nlinear_parameters gsl_multilarge_nlinear_default_parameters(void); + +int +gsl_multilarge_nlinear_init (const gsl_vector * x, + gsl_multilarge_nlinear_fdf * fdf, + gsl_multilarge_nlinear_workspace * w); + +int gsl_multilarge_nlinear_winit (const gsl_vector * x, + const gsl_vector * wts, + gsl_multilarge_nlinear_fdf * fdf, + gsl_multilarge_nlinear_workspace * w); + +int +gsl_multilarge_nlinear_iterate (gsl_multilarge_nlinear_workspace * w); + +double +gsl_multilarge_nlinear_avratio (const gsl_multilarge_nlinear_workspace * w); + +int +gsl_multilarge_nlinear_rcond (double * rcond, const gsl_multilarge_nlinear_workspace * w); + +int +gsl_multilarge_nlinear_covar (gsl_matrix * covar, gsl_multilarge_nlinear_workspace * w); + +int +gsl_multilarge_nlinear_driver (const size_t maxiter, + const double xtol, + const double gtol, + const double ftol, + void (*callback)(const size_t iter, void *params, + const gsl_multilarge_nlinear_workspace *w), + void *callback_params, + int *info, + gsl_multilarge_nlinear_workspace * w); + +const char * +gsl_multilarge_nlinear_name (const gsl_multilarge_nlinear_workspace * w); + +gsl_vector * +gsl_multilarge_nlinear_position (const gsl_multilarge_nlinear_workspace * w); + +gsl_vector * +gsl_multilarge_nlinear_residual (const gsl_multilarge_nlinear_workspace * w); + +gsl_vector * +gsl_multilarge_nlinear_step (const gsl_multilarge_nlinear_workspace * w); + +size_t +gsl_multilarge_nlinear_niter (const gsl_multilarge_nlinear_workspace * w); + +const char * +gsl_multilarge_nlinear_trs_name (const gsl_multilarge_nlinear_workspace * w); + +int gsl_multilarge_nlinear_eval_f(gsl_multilarge_nlinear_fdf *fdf, + const gsl_vector *x, + const gsl_vector *swts, + gsl_vector *y); + +int +gsl_multilarge_nlinear_eval_df(const CBLAS_TRANSPOSE_t TransJ, + const gsl_vector *x, + const gsl_vector *f, + const gsl_vector *u, + const gsl_vector *swts, + const double h, + const gsl_multilarge_nlinear_fdtype fdtype, + gsl_multilarge_nlinear_fdf *fdf, + gsl_vector *v, + gsl_matrix *JTJ, + gsl_vector *work); + +int +gsl_multilarge_nlinear_eval_fvv(const double h, + const gsl_vector *x, + const gsl_vector *v, + const gsl_vector *f, + const gsl_vector *swts, + gsl_multilarge_nlinear_fdf *fdf, + gsl_vector *yvv, + gsl_vector *work); + +/* convergence.c */ +int +gsl_multilarge_nlinear_test (const double xtol, const double gtol, + const double ftol, int *info, + const gsl_multilarge_nlinear_workspace * w); + +/* fdjac.c */ +int +gsl_multilarge_nlinear_df(const double h, const gsl_multilarge_nlinear_fdtype fdtype, + const gsl_vector *x, const gsl_vector *wts, + gsl_multilarge_nlinear_fdf *fdf, + const gsl_vector *f, gsl_matrix *J, gsl_vector *work); + +/* fdfvv.c */ +int +gsl_multilarge_nlinear_fdfvv(const double h, const gsl_vector *x, const gsl_vector *v, + const gsl_vector *f, const gsl_matrix *J, + const gsl_vector *swts, gsl_multilarge_nlinear_fdf *fdf, + gsl_vector *fvv, gsl_vector *work); + +/* top-level algorithms */ +GSL_VAR const gsl_multilarge_nlinear_type * gsl_multilarge_nlinear_trust; + +/* trust region subproblem methods */ +GSL_VAR const gsl_multilarge_nlinear_trs * gsl_multilarge_nlinear_trs_lm; +GSL_VAR const gsl_multilarge_nlinear_trs * gsl_multilarge_nlinear_trs_lmaccel; +GSL_VAR const gsl_multilarge_nlinear_trs * gsl_multilarge_nlinear_trs_dogleg; +GSL_VAR const gsl_multilarge_nlinear_trs * gsl_multilarge_nlinear_trs_ddogleg; +GSL_VAR const gsl_multilarge_nlinear_trs * gsl_multilarge_nlinear_trs_subspace2D; +GSL_VAR const gsl_multilarge_nlinear_trs * gsl_multilarge_nlinear_trs_cgst; + +/* scaling matrix strategies */ +GSL_VAR const gsl_multilarge_nlinear_scale * gsl_multilarge_nlinear_scale_levenberg; +GSL_VAR const gsl_multilarge_nlinear_scale * gsl_multilarge_nlinear_scale_marquardt; +GSL_VAR const gsl_multilarge_nlinear_scale * gsl_multilarge_nlinear_scale_more; + +/* linear solvers */ +GSL_VAR const gsl_multilarge_nlinear_solver * gsl_multilarge_nlinear_solver_cholesky; +GSL_VAR const gsl_multilarge_nlinear_solver * gsl_multilarge_nlinear_solver_none; + +__END_DECLS + +#endif /* __GSL_MULTILARGE_NLINEAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_multimin.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_multimin.h new file mode 100644 index 000000000..287022727 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_multimin.h @@ -0,0 +1,226 @@ +/* multimin/gsl_multimin.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Fabrice Rossi + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Modified by Tuomo Keskitalo to include fminimizer and + Nelder Mead related lines */ + +#ifndef __GSL_MULTIMIN_H__ +#define __GSL_MULTIMIN_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* Definition of an arbitrary real-valued function with gsl_vector input and */ +/* parameters */ +struct gsl_multimin_function_struct +{ + double (* f) (const gsl_vector * x, void * params); + size_t n; + void * params; +}; + +typedef struct gsl_multimin_function_struct gsl_multimin_function; + +#define GSL_MULTIMIN_FN_EVAL(F,x) (*((F)->f))(x,(F)->params) + +/* Definition of an arbitrary differentiable real-valued function */ +/* with gsl_vector input and parameters */ +struct gsl_multimin_function_fdf_struct +{ + double (* f) (const gsl_vector * x, void * params); + void (* df) (const gsl_vector * x, void * params,gsl_vector * df); + void (* fdf) (const gsl_vector * x, void * params,double *f,gsl_vector * df); + size_t n; + void * params; +}; + +typedef struct gsl_multimin_function_fdf_struct gsl_multimin_function_fdf; + +#define GSL_MULTIMIN_FN_EVAL_F(F,x) (*((F)->f))(x,(F)->params) +#define GSL_MULTIMIN_FN_EVAL_DF(F,x,g) (*((F)->df))(x,(F)->params,(g)) +#define GSL_MULTIMIN_FN_EVAL_F_DF(F,x,y,g) (*((F)->fdf))(x,(F)->params,(y),(g)) + +int gsl_multimin_diff (const gsl_multimin_function * f, + const gsl_vector * x, gsl_vector * g); + +/* minimization of non-differentiable functions */ + +typedef struct +{ + const char *name; + size_t size; + int (*alloc) (void *state, size_t n); + int (*set) (void *state, gsl_multimin_function * f, + const gsl_vector * x, + double * size, + const gsl_vector * step_size); + int (*iterate) (void *state, gsl_multimin_function * f, + gsl_vector * x, + double * size, + double * fval); + void (*free) (void *state); +} +gsl_multimin_fminimizer_type; + +typedef struct +{ + /* multi dimensional part */ + const gsl_multimin_fminimizer_type *type; + gsl_multimin_function *f; + + double fval; + gsl_vector * x; + + double size; + + void *state; +} +gsl_multimin_fminimizer; + +gsl_multimin_fminimizer * +gsl_multimin_fminimizer_alloc(const gsl_multimin_fminimizer_type *T, + size_t n); + +int +gsl_multimin_fminimizer_set (gsl_multimin_fminimizer * s, + gsl_multimin_function * f, + const gsl_vector * x, + const gsl_vector * step_size); + +void +gsl_multimin_fminimizer_free(gsl_multimin_fminimizer *s); + +const char * +gsl_multimin_fminimizer_name (const gsl_multimin_fminimizer * s); + +int +gsl_multimin_fminimizer_iterate(gsl_multimin_fminimizer *s); + +gsl_vector * +gsl_multimin_fminimizer_x (const gsl_multimin_fminimizer * s); + +double +gsl_multimin_fminimizer_minimum (const gsl_multimin_fminimizer * s); + +double +gsl_multimin_fminimizer_size (const gsl_multimin_fminimizer * s); + +/* Convergence test functions */ + +int +gsl_multimin_test_gradient(const gsl_vector * g, double epsabs); + +int +gsl_multimin_test_size(const double size, double epsabs); + +/* minimisation of differentiable functions */ + +typedef struct +{ + const char *name; + size_t size; + int (*alloc) (void *state, size_t n); + int (*set) (void *state, gsl_multimin_function_fdf * fdf, + const gsl_vector * x, double * f, + gsl_vector * gradient, double step_size, double tol); + int (*iterate) (void *state,gsl_multimin_function_fdf * fdf, + gsl_vector * x, double * f, + gsl_vector * gradient, gsl_vector * dx); + int (*restart) (void *state); + void (*free) (void *state); +} +gsl_multimin_fdfminimizer_type; + +typedef struct +{ + /* multi dimensional part */ + const gsl_multimin_fdfminimizer_type *type; + gsl_multimin_function_fdf *fdf; + + double f; + gsl_vector * x; + gsl_vector * gradient; + gsl_vector * dx; + + void *state; +} +gsl_multimin_fdfminimizer; + +gsl_multimin_fdfminimizer * +gsl_multimin_fdfminimizer_alloc(const gsl_multimin_fdfminimizer_type *T, + size_t n); + +int +gsl_multimin_fdfminimizer_set (gsl_multimin_fdfminimizer * s, + gsl_multimin_function_fdf *fdf, + const gsl_vector * x, + double step_size, double tol); + +void +gsl_multimin_fdfminimizer_free(gsl_multimin_fdfminimizer *s); + +const char * +gsl_multimin_fdfminimizer_name (const gsl_multimin_fdfminimizer * s); + +int +gsl_multimin_fdfminimizer_iterate(gsl_multimin_fdfminimizer *s); + +int +gsl_multimin_fdfminimizer_restart(gsl_multimin_fdfminimizer *s); + +gsl_vector * +gsl_multimin_fdfminimizer_x (const gsl_multimin_fdfminimizer * s); + +gsl_vector * +gsl_multimin_fdfminimizer_dx (const gsl_multimin_fdfminimizer * s); + +gsl_vector * +gsl_multimin_fdfminimizer_gradient (const gsl_multimin_fdfminimizer * s); + +double +gsl_multimin_fdfminimizer_minimum (const gsl_multimin_fdfminimizer * s); + +GSL_VAR const gsl_multimin_fdfminimizer_type *gsl_multimin_fdfminimizer_steepest_descent; +GSL_VAR const gsl_multimin_fdfminimizer_type *gsl_multimin_fdfminimizer_conjugate_pr; +GSL_VAR const gsl_multimin_fdfminimizer_type *gsl_multimin_fdfminimizer_conjugate_fr; +GSL_VAR const gsl_multimin_fdfminimizer_type *gsl_multimin_fdfminimizer_vector_bfgs; +GSL_VAR const gsl_multimin_fdfminimizer_type *gsl_multimin_fdfminimizer_vector_bfgs2; +GSL_VAR const gsl_multimin_fminimizer_type *gsl_multimin_fminimizer_nmsimplex; +GSL_VAR const gsl_multimin_fminimizer_type *gsl_multimin_fminimizer_nmsimplex2; +GSL_VAR const gsl_multimin_fminimizer_type *gsl_multimin_fminimizer_nmsimplex2rand; + +__END_DECLS + +#endif /* __GSL_MULTIMIN_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_multiroots.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_multiroots.h new file mode 100644 index 000000000..7f661547f --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_multiroots.h @@ -0,0 +1,177 @@ +/* multiroots/gsl_multiroots.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MULTIROOTS_H__ +#define __GSL_MULTIROOTS_H__ + +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* Definition of vector-valued functions with parameters based on gsl_vector */ + +struct gsl_multiroot_function_struct +{ + int (* f) (const gsl_vector * x, void * params, gsl_vector * f); + size_t n; + void * params; +}; + +typedef struct gsl_multiroot_function_struct gsl_multiroot_function ; + +#define GSL_MULTIROOT_FN_EVAL(F,x,y) (*((F)->f))(x,(F)->params,(y)) + +int gsl_multiroot_fdjacobian (gsl_multiroot_function * F, + const gsl_vector * x, const gsl_vector * f, + double epsrel, gsl_matrix * jacobian); + + +typedef struct + { + const char *name; + size_t size; + int (*alloc) (void *state, size_t n); + int (*set) (void *state, gsl_multiroot_function * function, gsl_vector * x, gsl_vector * f, gsl_vector * dx); + int (*iterate) (void *state, gsl_multiroot_function * function, gsl_vector * x, gsl_vector * f, gsl_vector * dx); + void (*free) (void *state); + } +gsl_multiroot_fsolver_type; + +typedef struct + { + const gsl_multiroot_fsolver_type * type; + gsl_multiroot_function * function ; + gsl_vector * x ; + gsl_vector * f ; + gsl_vector * dx ; + void *state; + } +gsl_multiroot_fsolver; + +gsl_multiroot_fsolver * +gsl_multiroot_fsolver_alloc (const gsl_multiroot_fsolver_type * T, + size_t n); + +void gsl_multiroot_fsolver_free (gsl_multiroot_fsolver * s); + +int gsl_multiroot_fsolver_set (gsl_multiroot_fsolver * s, + gsl_multiroot_function * f, + const gsl_vector * x); + +int gsl_multiroot_fsolver_iterate (gsl_multiroot_fsolver * s); + +const char * gsl_multiroot_fsolver_name (const gsl_multiroot_fsolver * s); +gsl_vector * gsl_multiroot_fsolver_root (const gsl_multiroot_fsolver * s); +gsl_vector * gsl_multiroot_fsolver_dx (const gsl_multiroot_fsolver * s); +gsl_vector * gsl_multiroot_fsolver_f (const gsl_multiroot_fsolver * s); + +/* Definition of vector-valued functions and gradient with parameters + based on gsl_vector */ + +struct gsl_multiroot_function_fdf_struct +{ + int (* f) (const gsl_vector * x, void * params, gsl_vector * f); + int (* df) (const gsl_vector * x, void * params, gsl_matrix * df); + int (* fdf) (const gsl_vector * x, void * params, gsl_vector * f, gsl_matrix *df); + size_t n; + void * params; +}; + +typedef struct gsl_multiroot_function_fdf_struct gsl_multiroot_function_fdf ; + +#define GSL_MULTIROOT_FN_EVAL_F(F,x,y) ((*((F)->f))(x,(F)->params,(y))) +#define GSL_MULTIROOT_FN_EVAL_DF(F,x,dy) ((*((F)->df))(x,(F)->params,(dy))) +#define GSL_MULTIROOT_FN_EVAL_F_DF(F,x,y,dy) ((*((F)->fdf))(x,(F)->params,(y),(dy))) + +typedef struct + { + const char *name; + size_t size; + int (*alloc) (void *state, size_t n); + int (*set) (void *state, gsl_multiroot_function_fdf * fdf, gsl_vector * x, gsl_vector * f, gsl_matrix * J, gsl_vector * dx); + int (*iterate) (void *state, gsl_multiroot_function_fdf * fdf, gsl_vector * x, gsl_vector * f, gsl_matrix * J, gsl_vector * dx); + void (*free) (void *state); + } +gsl_multiroot_fdfsolver_type; + +typedef struct + { + const gsl_multiroot_fdfsolver_type * type; + gsl_multiroot_function_fdf * fdf ; + gsl_vector * x; + gsl_vector * f; + gsl_matrix * J; + gsl_vector * dx; + void *state; + } +gsl_multiroot_fdfsolver; + +gsl_multiroot_fdfsolver * +gsl_multiroot_fdfsolver_alloc (const gsl_multiroot_fdfsolver_type * T, + size_t n); + +int +gsl_multiroot_fdfsolver_set (gsl_multiroot_fdfsolver * s, + gsl_multiroot_function_fdf * fdf, + const gsl_vector * x); + +int +gsl_multiroot_fdfsolver_iterate (gsl_multiroot_fdfsolver * s); + +void +gsl_multiroot_fdfsolver_free (gsl_multiroot_fdfsolver * s); + +const char * gsl_multiroot_fdfsolver_name (const gsl_multiroot_fdfsolver * s); +gsl_vector * gsl_multiroot_fdfsolver_root (const gsl_multiroot_fdfsolver * s); +gsl_vector * gsl_multiroot_fdfsolver_dx (const gsl_multiroot_fdfsolver * s); +gsl_vector * gsl_multiroot_fdfsolver_f (const gsl_multiroot_fdfsolver * s); + +int gsl_multiroot_test_delta (const gsl_vector * dx, const gsl_vector * x, + double epsabs, double epsrel); + +int gsl_multiroot_test_residual (const gsl_vector * f, double epsabs); + +GSL_VAR const gsl_multiroot_fsolver_type * gsl_multiroot_fsolver_dnewton; +GSL_VAR const gsl_multiroot_fsolver_type * gsl_multiroot_fsolver_broyden; +GSL_VAR const gsl_multiroot_fsolver_type * gsl_multiroot_fsolver_hybrid; +GSL_VAR const gsl_multiroot_fsolver_type * gsl_multiroot_fsolver_hybrids; + +GSL_VAR const gsl_multiroot_fdfsolver_type * gsl_multiroot_fdfsolver_newton; +GSL_VAR const gsl_multiroot_fdfsolver_type * gsl_multiroot_fdfsolver_gnewton; +GSL_VAR const gsl_multiroot_fdfsolver_type * gsl_multiroot_fdfsolver_hybridj; +GSL_VAR const gsl_multiroot_fdfsolver_type * gsl_multiroot_fdfsolver_hybridsj; + + +__END_DECLS + +#endif /* __GSL_MULTIROOTS_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_multiset.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_multiset.h new file mode 100644 index 000000000..1ba5d6cc4 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_multiset.h @@ -0,0 +1,93 @@ +/* multiset/gsl_multiset.h + * based on combination/gsl_combination.h by Szymon Jaroszewicz + * based on permutation/gsl_permutation.h by Brian Gough + * + * Copyright (C) 2009 Rhys Ulerich + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MULTISET_H__ +#define __GSL_MULTISET_H__ + +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_multiset_struct +{ + size_t n; + size_t k; + size_t *data; +}; + +typedef struct gsl_multiset_struct gsl_multiset; + +gsl_multiset *gsl_multiset_alloc (const size_t n, const size_t k); +gsl_multiset *gsl_multiset_calloc (const size_t n, const size_t k); +void gsl_multiset_init_first (gsl_multiset * c); +void gsl_multiset_init_last (gsl_multiset * c); +void gsl_multiset_free (gsl_multiset * c); +int gsl_multiset_memcpy (gsl_multiset * dest, const gsl_multiset * src); + +int gsl_multiset_fread (FILE * stream, gsl_multiset * c); +int gsl_multiset_fwrite (FILE * stream, const gsl_multiset * c); +int gsl_multiset_fscanf (FILE * stream, gsl_multiset * c); +int gsl_multiset_fprintf (FILE * stream, const gsl_multiset * c, const char *format); + +size_t gsl_multiset_n (const gsl_multiset * c); +size_t gsl_multiset_k (const gsl_multiset * c); +size_t * gsl_multiset_data (const gsl_multiset * c); + +int gsl_multiset_valid (gsl_multiset * c); +int gsl_multiset_next (gsl_multiset * c); +int gsl_multiset_prev (gsl_multiset * c); + +INLINE_DECL size_t gsl_multiset_get (const gsl_multiset * c, const size_t i); + +#ifdef HAVE_INLINE + +INLINE_FUN +size_t +gsl_multiset_get (const gsl_multiset * c, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= c->k)) /* size_t is unsigned, can't be negative */ + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return c->data[i]; +} + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_MULTISET_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_nan.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_nan.h new file mode 100644 index 000000000..5cb52efc9 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_nan.h @@ -0,0 +1,45 @@ +/* gsl_nan.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_NAN_H__ +#define __GSL_NAN_H__ + +#ifdef INFINITY +# define GSL_POSINF INFINITY +# define GSL_NEGINF (-INFINITY) +#elif defined(HUGE_VAL) +# define GSL_POSINF HUGE_VAL +# define GSL_NEGINF (-HUGE_VAL) +#else +# define GSL_POSINF (gsl_posinf()) +# define GSL_NEGINF (gsl_neginf()) +#endif + +#ifdef NAN +# define GSL_NAN NAN +#elif defined(INFINITY) +# define GSL_NAN (INFINITY/INFINITY) +#else +# define GSL_NAN (gsl_nan()) +#endif + +#define GSL_POSZERO (+0.0) +#define GSL_NEGZERO (-0.0) + +#endif /* __GSL_NAN_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_ntuple.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_ntuple.h new file mode 100644 index 000000000..90d8a26c3 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_ntuple.h @@ -0,0 +1,82 @@ +/* histogram/ntuple.h + * + * Copyright (C) 2000 Simone Piccardi + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* Jan/2001 Modified by Brian Gough. Minor changes for GSL */ + +#ifndef __GSL_NTUPLE_H__ +#define __GSL_NTUPLE_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct { + FILE * file; + void * ntuple_data; + size_t size; +} gsl_ntuple; + +typedef struct { + int (* function) (void * ntuple_data, void * params); + void * params; +} gsl_ntuple_select_fn; + +typedef struct { + double (* function) (void * ntuple_data, void * params); + void * params; +} gsl_ntuple_value_fn; + +gsl_ntuple * +gsl_ntuple_open (char * filename, void * ntuple_data, size_t size); + +gsl_ntuple * +gsl_ntuple_create (char * filename, void * ntuple_data, size_t size); + +int gsl_ntuple_write (gsl_ntuple * ntuple); +int gsl_ntuple_read (gsl_ntuple * ntuple); + +int gsl_ntuple_bookdata (gsl_ntuple * ntuple); /* synonym for write */ + +int gsl_ntuple_project (gsl_histogram * h, gsl_ntuple * ntuple, + gsl_ntuple_value_fn *value_func, + gsl_ntuple_select_fn *select_func); + +int gsl_ntuple_close (gsl_ntuple * ntuple); + +__END_DECLS + +#endif /* __GSL_NTUPLE_H__ */ + + + + diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_odeiv.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_odeiv.h new file mode 100644 index 000000000..d70f15015 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_odeiv.h @@ -0,0 +1,230 @@ +/* ode-initval/gsl_odeiv.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman + */ +#ifndef __GSL_ODEIV_H__ +#define __GSL_ODEIV_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Description of a system of ODEs. + * + * y' = f(t,y) = dydt(t, y) + * + * The system is specified by giving the right-hand-side + * of the equation and possibly a jacobian function. + * + * Some methods require the jacobian function, which calculates + * the matrix dfdy and the vector dfdt. The matrix dfdy conforms + * to the GSL standard, being a continuous range of floating point + * values, in row-order. + * + * As with GSL function objects, user-supplied parameter + * data is also present. + */ + +typedef struct +{ + int (* function) (double t, const double y[], double dydt[], void * params); + int (* jacobian) (double t, const double y[], double * dfdy, double dfdt[], void * params); + size_t dimension; + void * params; +} +gsl_odeiv_system; + +#define GSL_ODEIV_FN_EVAL(S,t,y,f) (*((S)->function))(t,y,f,(S)->params) +#define GSL_ODEIV_JA_EVAL(S,t,y,dfdy,dfdt) (*((S)->jacobian))(t,y,dfdy,dfdt,(S)->params) + + +/* General stepper object. + * + * Opaque object for stepping an ODE system from t to t+h. + * In general the object has some state which facilitates + * iterating the stepping operation. + */ + +typedef struct +{ + const char * name; + int can_use_dydt_in; + int gives_exact_dydt_out; + void * (*alloc) (size_t dim); + int (*apply) (void * state, size_t dim, double t, double h, double y[], double yerr[], const double dydt_in[], double dydt_out[], const gsl_odeiv_system * dydt); + int (*reset) (void * state, size_t dim); + unsigned int (*order) (void * state); + void (*free) (void * state); +} +gsl_odeiv_step_type; + +typedef struct { + const gsl_odeiv_step_type * type; + size_t dimension; + void * state; +} +gsl_odeiv_step; + + +/* Available stepper types. + * + * rk2 : embedded 2nd(3rd) Runge-Kutta + * rk4 : 4th order (classical) Runge-Kutta + * rkck : embedded 4th(5th) Runge-Kutta, Cash-Karp + * rk8pd : embedded 8th(9th) Runge-Kutta, Prince-Dormand + * rk2imp : implicit 2nd order Runge-Kutta at Gaussian points + * rk4imp : implicit 4th order Runge-Kutta at Gaussian points + * gear1 : M=1 implicit Gear method + * gear2 : M=2 implicit Gear method + */ + +GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_rk2; +GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_rk4; +GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_rkf45; +GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_rkck; +GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_rk8pd; +GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_rk2imp; +GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_rk2simp; +GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_rk4imp; +GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_bsimp; +GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_gear1; +GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_gear2; + + +/* Constructor for specialized stepper objects. + */ +gsl_odeiv_step * gsl_odeiv_step_alloc(const gsl_odeiv_step_type * T, size_t dim); +int gsl_odeiv_step_reset(gsl_odeiv_step * s); +void gsl_odeiv_step_free(gsl_odeiv_step * s); + +/* General stepper object methods. + */ +const char * gsl_odeiv_step_name(const gsl_odeiv_step * s); +unsigned int gsl_odeiv_step_order(const gsl_odeiv_step * s); + +int gsl_odeiv_step_apply(gsl_odeiv_step * s, double t, double h, double y[], double yerr[], const double dydt_in[], double dydt_out[], const gsl_odeiv_system * dydt); + +/* General step size control object. + * + * The hadjust() method controls the adjustment of + * step size given the result of a step and the error. + * Valid hadjust() methods must return one of the codes below. + * + * The general data can be used by specializations + * to store state and control their heuristics. + */ + +typedef struct +{ + const char * name; + void * (*alloc) (void); + int (*init) (void * state, double eps_abs, double eps_rel, double a_y, double a_dydt); + int (*hadjust) (void * state, size_t dim, unsigned int ord, const double y[], const double yerr[], const double yp[], double * h); + void (*free) (void * state); +} +gsl_odeiv_control_type; + +typedef struct +{ + const gsl_odeiv_control_type * type; + void * state; +} +gsl_odeiv_control; + +/* Possible return values for an hadjust() evolution method. + */ +#define GSL_ODEIV_HADJ_INC 1 /* step was increased */ +#define GSL_ODEIV_HADJ_NIL 0 /* step unchanged */ +#define GSL_ODEIV_HADJ_DEC (-1) /* step decreased */ + +gsl_odeiv_control * gsl_odeiv_control_alloc(const gsl_odeiv_control_type * T); +int gsl_odeiv_control_init(gsl_odeiv_control * c, double eps_abs, double eps_rel, double a_y, double a_dydt); +void gsl_odeiv_control_free(gsl_odeiv_control * c); +int gsl_odeiv_control_hadjust (gsl_odeiv_control * c, gsl_odeiv_step * s, const double y[], const double yerr[], const double dydt[], double * h); +const char * gsl_odeiv_control_name(const gsl_odeiv_control * c); + +/* Available control object constructors. + * + * The standard control object is a four parameter heuristic + * defined as follows: + * D0 = eps_abs + eps_rel * (a_y |y| + a_dydt h |y'|) + * D1 = |yerr| + * q = consistency order of method (q=4 for 4(5) embedded RK) + * S = safety factor (0.9 say) + * + * / (D0/D1)^(1/(q+1)) D0 >= D1 + * h_NEW = S h_OLD * | + * \ (D0/D1)^(1/q) D0 < D1 + * + * This encompasses all the standard error scaling methods. + * + * The y method is the standard method with a_y=1, a_dydt=0. + * The yp method is the standard method with a_y=0, a_dydt=1. + */ + +gsl_odeiv_control * gsl_odeiv_control_standard_new(double eps_abs, double eps_rel, double a_y, double a_dydt); +gsl_odeiv_control * gsl_odeiv_control_y_new(double eps_abs, double eps_rel); +gsl_odeiv_control * gsl_odeiv_control_yp_new(double eps_abs, double eps_rel); + +/* This controller computes errors using different absolute errors for + * each component + * + * D0 = eps_abs * scale_abs[i] + eps_rel * (a_y |y| + a_dydt h |y'|) + */ +gsl_odeiv_control * gsl_odeiv_control_scaled_new(double eps_abs, double eps_rel, double a_y, double a_dydt, const double scale_abs[], size_t dim); + +/* General evolution object. + */ +typedef struct { + size_t dimension; + double * y0; + double * yerr; + double * dydt_in; + double * dydt_out; + double last_step; + unsigned long int count; + unsigned long int failed_steps; +} +gsl_odeiv_evolve; + +/* Evolution object methods. + */ +gsl_odeiv_evolve * gsl_odeiv_evolve_alloc(size_t dim); +int gsl_odeiv_evolve_apply(gsl_odeiv_evolve * e, gsl_odeiv_control * con, gsl_odeiv_step * step, const gsl_odeiv_system * dydt, double * t, double t1, double * h, double y[]); +int gsl_odeiv_evolve_reset(gsl_odeiv_evolve * e); +void gsl_odeiv_evolve_free(gsl_odeiv_evolve * e); + + +__END_DECLS + +#endif /* __GSL_ODEIV_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_odeiv2.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_odeiv2.h new file mode 100644 index 000000000..9bcfbae6e --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_odeiv2.h @@ -0,0 +1,333 @@ +/* ode-initval/odeiv2.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ +/* Modified by Tuomo Keskitalo */ + +#ifndef __GSL_ODEIV2_H__ +#define __GSL_ODEIV2_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS +/* Description of a system of ODEs. + * + * y' = f(t,y) = dydt(t, y) + * + * The system is specified by giving the right-hand-side + * of the equation and possibly a jacobian function. + * + * Some methods require the jacobian function, which calculates + * the matrix dfdy and the vector dfdt. The matrix dfdy conforms + * to the GSL standard, being a continuous range of floating point + * values, in row-order. + * + * As with GSL function objects, user-supplied parameter + * data is also present. + */ + typedef struct +{ + int (*function) (double t, const double y[], double dydt[], void *params); + int (*jacobian) (double t, const double y[], double *dfdy, double dfdt[], + void *params); + size_t dimension; + void *params; +} +gsl_odeiv2_system; + +/* Function evaluation macros */ + +#define GSL_ODEIV_FN_EVAL(S,t,y,f) (*((S)->function))(t,y,f,(S)->params) +#define GSL_ODEIV_JA_EVAL(S,t,y,dfdy,dfdt) (*((S)->jacobian))(t,y,dfdy,dfdt,(S)->params) + +/* Type definitions */ + +typedef struct gsl_odeiv2_step_struct gsl_odeiv2_step; +typedef struct gsl_odeiv2_control_struct gsl_odeiv2_control; +typedef struct gsl_odeiv2_evolve_struct gsl_odeiv2_evolve; +typedef struct gsl_odeiv2_driver_struct gsl_odeiv2_driver; + +/* Stepper object + * + * Opaque object for stepping an ODE system from t to t+h. + * In general the object has some state which facilitates + * iterating the stepping operation. + */ + +typedef struct +{ + const char *name; + int can_use_dydt_in; + int gives_exact_dydt_out; + void *(*alloc) (size_t dim); + int (*apply) (void *state, size_t dim, double t, double h, double y[], + double yerr[], const double dydt_in[], double dydt_out[], + const gsl_odeiv2_system * dydt); + int (*set_driver) (void *state, const gsl_odeiv2_driver * d); + int (*reset) (void *state, size_t dim); + unsigned int (*order) (void *state); + void (*free) (void *state); +} +gsl_odeiv2_step_type; + +struct gsl_odeiv2_step_struct +{ + const gsl_odeiv2_step_type *type; + size_t dimension; + void *state; +}; + +/* Available stepper types */ + +GSL_VAR const gsl_odeiv2_step_type *gsl_odeiv2_step_rk2; +GSL_VAR const gsl_odeiv2_step_type *gsl_odeiv2_step_rk4; +GSL_VAR const gsl_odeiv2_step_type *gsl_odeiv2_step_rkf45; +GSL_VAR const gsl_odeiv2_step_type *gsl_odeiv2_step_rkck; +GSL_VAR const gsl_odeiv2_step_type *gsl_odeiv2_step_rk8pd; +GSL_VAR const gsl_odeiv2_step_type *gsl_odeiv2_step_rk2imp; +GSL_VAR const gsl_odeiv2_step_type *gsl_odeiv2_step_rk4imp; +GSL_VAR const gsl_odeiv2_step_type *gsl_odeiv2_step_bsimp; +GSL_VAR const gsl_odeiv2_step_type *gsl_odeiv2_step_rk1imp; +GSL_VAR const gsl_odeiv2_step_type *gsl_odeiv2_step_msadams; +GSL_VAR const gsl_odeiv2_step_type *gsl_odeiv2_step_msbdf; + +/* Stepper object methods */ + +gsl_odeiv2_step *gsl_odeiv2_step_alloc (const gsl_odeiv2_step_type * T, + size_t dim); +int gsl_odeiv2_step_reset (gsl_odeiv2_step * s); +void gsl_odeiv2_step_free (gsl_odeiv2_step * s); +const char *gsl_odeiv2_step_name (const gsl_odeiv2_step * s); +unsigned int gsl_odeiv2_step_order (const gsl_odeiv2_step * s); +int gsl_odeiv2_step_apply (gsl_odeiv2_step * s, double t, double h, + double y[], double yerr[], const double dydt_in[], + double dydt_out[], const gsl_odeiv2_system * dydt); +int gsl_odeiv2_step_set_driver (gsl_odeiv2_step * s, + const gsl_odeiv2_driver * d); + +/* Step size control object. */ + +typedef struct +{ + const char *name; + void *(*alloc) (void); + int (*init) (void *state, double eps_abs, double eps_rel, double a_y, + double a_dydt); + int (*hadjust) (void *state, size_t dim, unsigned int ord, const double y[], + const double yerr[], const double yp[], double *h); + int (*errlevel) (void *state, const double y, const double dydt, + const double h, const size_t ind, double *errlev); + int (*set_driver) (void *state, const gsl_odeiv2_driver * d); + void (*free) (void *state); +} +gsl_odeiv2_control_type; + +struct gsl_odeiv2_control_struct +{ + const gsl_odeiv2_control_type *type; + void *state; +}; + +/* Possible return values for an hadjust() evolution method */ + +#define GSL_ODEIV_HADJ_INC 1 /* step was increased */ +#define GSL_ODEIV_HADJ_NIL 0 /* step unchanged */ +#define GSL_ODEIV_HADJ_DEC (-1) /* step decreased */ + +/* General step size control methods. + * + * The hadjust() method controls the adjustment of + * step size given the result of a step and the error. + * Valid hadjust() methods must return one of the codes below. + * errlevel function calculates the desired error level D0. + * + * The general data can be used by specializations + * to store state and control their heuristics. + */ + +gsl_odeiv2_control *gsl_odeiv2_control_alloc (const gsl_odeiv2_control_type * + T); +int gsl_odeiv2_control_init (gsl_odeiv2_control * c, double eps_abs, + double eps_rel, double a_y, double a_dydt); +void gsl_odeiv2_control_free (gsl_odeiv2_control * c); +int gsl_odeiv2_control_hadjust (gsl_odeiv2_control * c, gsl_odeiv2_step * s, + const double y[], const double yerr[], + const double dydt[], double *h); +const char *gsl_odeiv2_control_name (const gsl_odeiv2_control * c); +int gsl_odeiv2_control_errlevel (gsl_odeiv2_control * c, const double y, + const double dydt, const double h, + const size_t ind, double *errlev); +int gsl_odeiv2_control_set_driver (gsl_odeiv2_control * c, + const gsl_odeiv2_driver * d); + +/* Available control object constructors. + * + * The standard control object is a four parameter heuristic + * defined as follows: + * D0 = eps_abs + eps_rel * (a_y |y| + a_dydt h |y'|) + * D1 = |yerr| + * q = consistency order of method (q=4 for 4(5) embedded RK) + * S = safety factor (0.9 say) + * + * / (D0/D1)^(1/(q+1)) D0 >= D1 + * h_NEW = S h_OLD * | + * \ (D0/D1)^(1/q) D0 < D1 + * + * This encompasses all the standard error scaling methods. + * + * The y method is the standard method with a_y=1, a_dydt=0. + * The yp method is the standard method with a_y=0, a_dydt=1. + */ + +gsl_odeiv2_control *gsl_odeiv2_control_standard_new (double eps_abs, + double eps_rel, + double a_y, + double a_dydt); +gsl_odeiv2_control *gsl_odeiv2_control_y_new (double eps_abs, double eps_rel); +gsl_odeiv2_control *gsl_odeiv2_control_yp_new (double eps_abs, + double eps_rel); + +/* This controller computes errors using different absolute errors for + * each component + * + * D0 = eps_abs * scale_abs[i] + eps_rel * (a_y |y| + a_dydt h |y'|) + */ + +gsl_odeiv2_control *gsl_odeiv2_control_scaled_new (double eps_abs, + double eps_rel, double a_y, + double a_dydt, + const double scale_abs[], + size_t dim); + +/* Evolution object */ + +struct gsl_odeiv2_evolve_struct +{ + size_t dimension; + double *y0; + double *yerr; + double *dydt_in; + double *dydt_out; + double last_step; + unsigned long int count; + unsigned long int failed_steps; + const gsl_odeiv2_driver *driver; +}; + +/* Evolution object methods */ + +gsl_odeiv2_evolve *gsl_odeiv2_evolve_alloc (size_t dim); +int gsl_odeiv2_evolve_apply (gsl_odeiv2_evolve * e, gsl_odeiv2_control * con, + gsl_odeiv2_step * step, + const gsl_odeiv2_system * dydt, double *t, + double t1, double *h, double y[]); +int gsl_odeiv2_evolve_apply_fixed_step (gsl_odeiv2_evolve * e, + gsl_odeiv2_control * con, + gsl_odeiv2_step * step, + const gsl_odeiv2_system * dydt, + double *t, const double h0, + double y[]); +int gsl_odeiv2_evolve_reset (gsl_odeiv2_evolve * e); +void gsl_odeiv2_evolve_free (gsl_odeiv2_evolve * e); +int gsl_odeiv2_evolve_set_driver (gsl_odeiv2_evolve * e, + const gsl_odeiv2_driver * d); + +/* Driver object + * + * This is a high level wrapper for step, control and + * evolve objects. + */ + +struct gsl_odeiv2_driver_struct +{ + const gsl_odeiv2_system *sys; /* ODE system */ + gsl_odeiv2_step *s; /* stepper object */ + gsl_odeiv2_control *c; /* control object */ + gsl_odeiv2_evolve *e; /* evolve object */ + double h; /* step size */ + double hmin; /* minimum step size allowed */ + double hmax; /* maximum step size allowed */ + unsigned long int n; /* number of steps taken */ + unsigned long int nmax; /* Maximum number of steps allowed */ +}; + +/* Driver object methods */ + +gsl_odeiv2_driver *gsl_odeiv2_driver_alloc_y_new (const gsl_odeiv2_system * + sys, + const gsl_odeiv2_step_type * + T, const double hstart, + const double epsabs, + const double epsrel); +gsl_odeiv2_driver *gsl_odeiv2_driver_alloc_yp_new (const gsl_odeiv2_system * + sys, + const gsl_odeiv2_step_type + * T, const double hstart, + const double epsabs, + const double epsrel); +gsl_odeiv2_driver *gsl_odeiv2_driver_alloc_scaled_new (const gsl_odeiv2_system + * sys, + const + gsl_odeiv2_step_type * + T, const double hstart, + const double epsabs, + const double epsrel, + const double a_y, + const double a_dydt, + const double + scale_abs[]); +gsl_odeiv2_driver *gsl_odeiv2_driver_alloc_standard_new (const + gsl_odeiv2_system * + sys, + const + gsl_odeiv2_step_type + * T, + const double hstart, + const double epsabs, + const double epsrel, + const double a_y, + const double a_dydt); +int gsl_odeiv2_driver_set_hmin (gsl_odeiv2_driver * d, const double hmin); +int gsl_odeiv2_driver_set_hmax (gsl_odeiv2_driver * d, const double hmax); +int gsl_odeiv2_driver_set_nmax (gsl_odeiv2_driver * d, + const unsigned long int nmax); +int gsl_odeiv2_driver_apply (gsl_odeiv2_driver * d, double *t, + const double t1, double y[]); +int gsl_odeiv2_driver_apply_fixed_step (gsl_odeiv2_driver * d, double *t, + const double h, + const unsigned long int n, + double y[]); +int gsl_odeiv2_driver_reset (gsl_odeiv2_driver * d); +int gsl_odeiv2_driver_reset_hstart (gsl_odeiv2_driver * d, const double hstart); +void gsl_odeiv2_driver_free (gsl_odeiv2_driver * state); + +__END_DECLS +#endif /* __GSL_ODEIV2_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permutation.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permutation.h new file mode 100644 index 000000000..10ac0f58a --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permutation.h @@ -0,0 +1,100 @@ +/* permutation/gsl_permutation.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTATION_H__ +#define __GSL_PERMUTATION_H__ + +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_permutation_struct +{ + size_t size; + size_t *data; +}; + +typedef struct gsl_permutation_struct gsl_permutation; + +gsl_permutation *gsl_permutation_alloc (const size_t n); +gsl_permutation *gsl_permutation_calloc (const size_t n); +void gsl_permutation_init (gsl_permutation * p); +void gsl_permutation_free (gsl_permutation * p); +int gsl_permutation_memcpy (gsl_permutation * dest, const gsl_permutation * src); + +int gsl_permutation_fread (FILE * stream, gsl_permutation * p); +int gsl_permutation_fwrite (FILE * stream, const gsl_permutation * p); +int gsl_permutation_fscanf (FILE * stream, gsl_permutation * p); +int gsl_permutation_fprintf (FILE * stream, const gsl_permutation * p, const char *format); + +size_t gsl_permutation_size (const gsl_permutation * p); +size_t * gsl_permutation_data (const gsl_permutation * p); + +int gsl_permutation_swap (gsl_permutation * p, const size_t i, const size_t j); + +int gsl_permutation_valid (const gsl_permutation * p); +void gsl_permutation_reverse (gsl_permutation * p); +int gsl_permutation_inverse (gsl_permutation * inv, const gsl_permutation * p); +int gsl_permutation_next (gsl_permutation * p); +int gsl_permutation_prev (gsl_permutation * p); +int gsl_permutation_mul (gsl_permutation * p, const gsl_permutation * pa, const gsl_permutation * pb); + +int gsl_permutation_linear_to_canonical (gsl_permutation * q, const gsl_permutation * p); +int gsl_permutation_canonical_to_linear (gsl_permutation * p, const gsl_permutation * q); + +size_t gsl_permutation_inversions (const gsl_permutation * p); +size_t gsl_permutation_linear_cycles (const gsl_permutation * p); +size_t gsl_permutation_canonical_cycles (const gsl_permutation * q); + +INLINE_DECL size_t gsl_permutation_get (const gsl_permutation * p, const size_t i); + +#ifdef HAVE_INLINE + +INLINE_FUN +size_t +gsl_permutation_get (const gsl_permutation * p, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= p->size)) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return p->data[i]; +} + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_PERMUTATION_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute.h new file mode 100644 index 000000000..23f09a6f0 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute.h @@ -0,0 +1,24 @@ +#ifndef __GSL_PERMUTE_H__ +#define __GSL_PERMUTE_H__ + +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#endif /* __GSL_PERMUTE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_char.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_char.h new file mode 100644 index 000000000..bf2ebb1dc --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_char.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_char.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_CHAR_H__ +#define __GSL_PERMUTE_CHAR_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_char (const size_t * p, char * data, const size_t stride, const size_t n); +int gsl_permute_char_inverse (const size_t * p, char * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_CHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_complex_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_complex_double.h new file mode 100644 index 000000000..c20442b6a --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_complex_double.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_complex_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_COMPLEX_DOUBLE_H__ +#define __GSL_PERMUTE_COMPLEX_DOUBLE_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_complex (const size_t * p, double * data, const size_t stride, const size_t n); +int gsl_permute_complex_inverse (const size_t * p, double * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_COMPLEX_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_complex_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_complex_float.h new file mode 100644 index 000000000..65ee0fe44 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_complex_float.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_complex_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_COMPLEX_FLOAT_H__ +#define __GSL_PERMUTE_COMPLEX_FLOAT_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_complex_float (const size_t * p, float * data, const size_t stride, const size_t n); +int gsl_permute_complex_float_inverse (const size_t * p, float * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_COMPLEX_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_complex_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_complex_long_double.h new file mode 100644 index 000000000..4849b15df --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_complex_long_double.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_complex_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_COMPLEX_LONG_DOUBLE_H__ +#define __GSL_PERMUTE_COMPLEX_LONG_DOUBLE_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_complex_long_double (const size_t * p, long double * data, const size_t stride, const size_t n); +int gsl_permute_complex_long_double_inverse (const size_t * p, long double * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_COMPLEX_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_double.h new file mode 100644 index 000000000..58be1812b --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_double.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_DOUBLE_H__ +#define __GSL_PERMUTE_DOUBLE_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute (const size_t * p, double * data, const size_t stride, const size_t n); +int gsl_permute_inverse (const size_t * p, double * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_float.h new file mode 100644 index 000000000..bc79bd5a4 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_float.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_FLOAT_H__ +#define __GSL_PERMUTE_FLOAT_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_float (const size_t * p, float * data, const size_t stride, const size_t n); +int gsl_permute_float_inverse (const size_t * p, float * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_int.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_int.h new file mode 100644 index 000000000..b6ff50080 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_int.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_int.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_INT_H__ +#define __GSL_PERMUTE_INT_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_int (const size_t * p, int * data, const size_t stride, const size_t n); +int gsl_permute_int_inverse (const size_t * p, int * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_INT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_long.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_long.h new file mode 100644 index 000000000..383294c5a --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_long.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_long.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_LONG_H__ +#define __GSL_PERMUTE_LONG_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_long (const size_t * p, long * data, const size_t stride, const size_t n); +int gsl_permute_long_inverse (const size_t * p, long * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_LONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_long_double.h new file mode 100644 index 000000000..f58e1cd8a --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_long_double.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_LONG_DOUBLE_H__ +#define __GSL_PERMUTE_LONG_DOUBLE_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_long_double (const size_t * p, long double * data, const size_t stride, const size_t n); +int gsl_permute_long_double_inverse (const size_t * p, long double * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix.h new file mode 100644 index 000000000..aa8e67211 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix.h @@ -0,0 +1,24 @@ +#ifndef __GSL_PERMUTE_MATRIX_H__ +#define __GSL_PERMUTE_MATRIX_H__ + +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#endif /* __GSL_PERMUTE_MATRIX_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_char.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_char.h new file mode 100644 index 000000000..7ce67aaa4 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_char.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_matrix_char.h + * + * Copyright (C) 2016 Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_MATRIX_CHAR_H__ +#define __GSL_PERMUTE_MATRIX_CHAR_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_matrix_char (const gsl_permutation * p, gsl_matrix_char * A); + +__END_DECLS + +#endif /* __GSL_PERMUTE_MATRIX_CHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_complex_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_complex_double.h new file mode 100644 index 000000000..0c047b496 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_complex_double.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_matrix_complex_double.h + * + * Copyright (C) 2016 Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_MATRIX_COMPLEX_DOUBLE_H__ +#define __GSL_PERMUTE_MATRIX_COMPLEX_DOUBLE_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_matrix_complex (const gsl_permutation * p, gsl_matrix_complex * A); + +__END_DECLS + +#endif /* __GSL_PERMUTE_MATRIX_COMPLEX_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_complex_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_complex_float.h new file mode 100644 index 000000000..c0a7a94f3 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_complex_float.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_matrix_complex_float.h + * + * Copyright (C) 2016 Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_MATRIX_COMPLEX_FLOAT_H__ +#define __GSL_PERMUTE_MATRIX_COMPLEX_FLOAT_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_matrix_complex_float (const gsl_permutation * p, gsl_matrix_complex_float * A); + +__END_DECLS + +#endif /* __GSL_PERMUTE_MATRIX_COMPLEX_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_complex_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_complex_long_double.h new file mode 100644 index 000000000..a005e9620 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_complex_long_double.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_matrix_complex_long_double.h + * + * Copyright (C) 2016 Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_MATRIX_COMPLEX_LONG_DOUBLE_H__ +#define __GSL_PERMUTE_MATRIX_COMPLEX_LONG_DOUBLE_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_matrix_complex_long_double (const gsl_permutation * p, gsl_matrix_complex_long_double * A); + +__END_DECLS + +#endif /* __GSL_PERMUTE_MATRIX_COMPLEX_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_double.h new file mode 100644 index 000000000..2f17bd813 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_double.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_matrix_double.h + * + * Copyright (C) 2016 Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_MATRIX_DOUBLE_H__ +#define __GSL_PERMUTE_MATRIX_DOUBLE_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_matrix (const gsl_permutation * p, gsl_matrix * A); + +__END_DECLS + +#endif /* __GSL_PERMUTE_MATRIX_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_float.h new file mode 100644 index 000000000..700362262 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_float.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_matrix_float.h + * + * Copyright (C) 2016 Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_MATRIX_FLOAT_H__ +#define __GSL_PERMUTE_MATRIX_FLOAT_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_matrix_float (const gsl_permutation * p, gsl_matrix_float * A); + +__END_DECLS + +#endif /* __GSL_PERMUTE_MATRIX_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_int.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_int.h new file mode 100644 index 000000000..27dfea0d1 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_int.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_matrix_int.h + * + * Copyright (C) 2016 Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_MATRIX_INT_H__ +#define __GSL_PERMUTE_MATRIX_INT_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_matrix_int (const gsl_permutation * p, gsl_matrix_int * A); + +__END_DECLS + +#endif /* __GSL_PERMUTE_MATRIX_INT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_long.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_long.h new file mode 100644 index 000000000..6aaaaf437 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_long.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_matrix_long.h + * + * Copyright (C) 2016 Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_MATRIX_LONG_H__ +#define __GSL_PERMUTE_MATRIX_LONG_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_matrix_long (const gsl_permutation * p, gsl_matrix_long * A); + +__END_DECLS + +#endif /* __GSL_PERMUTE_MATRIX_LONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_long_double.h new file mode 100644 index 000000000..8a7d28c08 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_long_double.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_matrix_long_double.h + * + * Copyright (C) 2016 Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_MATRIX_LONG_DOUBLE_H__ +#define __GSL_PERMUTE_MATRIX_LONG_DOUBLE_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_matrix_long_double (const gsl_permutation * p, gsl_matrix_long_double * A); + +__END_DECLS + +#endif /* __GSL_PERMUTE_MATRIX_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_short.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_short.h new file mode 100644 index 000000000..1982305f9 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_short.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_matrix_short.h + * + * Copyright (C) 2016 Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_MATRIX_SHORT_H__ +#define __GSL_PERMUTE_MATRIX_SHORT_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_matrix_short (const gsl_permutation * p, gsl_matrix_short * A); + +__END_DECLS + +#endif /* __GSL_PERMUTE_MATRIX_SHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_uchar.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_uchar.h new file mode 100644 index 000000000..95991bfac --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_uchar.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_matrix_uchar.h + * + * Copyright (C) 2016 Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_MATRIX_UCHAR_H__ +#define __GSL_PERMUTE_MATRIX_UCHAR_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_matrix_uchar (const gsl_permutation * p, gsl_matrix_uchar * A); + +__END_DECLS + +#endif /* __GSL_PERMUTE_MATRIX_UCHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_uint.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_uint.h new file mode 100644 index 000000000..6497809c2 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_uint.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_matrix_uint.h + * + * Copyright (C) 2016 Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_MATRIX_UINT_H__ +#define __GSL_PERMUTE_MATRIX_UINT_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_matrix_uint (const gsl_permutation * p, gsl_matrix_uint * A); + +__END_DECLS + +#endif /* __GSL_PERMUTE_MATRIX_UINT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_ulong.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_ulong.h new file mode 100644 index 000000000..5aabc470b --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_ulong.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_matrix_ulong.h + * + * Copyright (C) 2016 Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_MATRIX_ULONG_H__ +#define __GSL_PERMUTE_MATRIX_ULONG_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_matrix_ulong (const gsl_permutation * p, gsl_matrix_ulong * A); + +__END_DECLS + +#endif /* __GSL_PERMUTE_MATRIX_ULONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_ushort.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_ushort.h new file mode 100644 index 000000000..e432ffee3 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_ushort.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_matrix_ushort.h + * + * Copyright (C) 2016 Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_MATRIX_USHORT_H__ +#define __GSL_PERMUTE_MATRIX_USHORT_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_matrix_ushort (const gsl_permutation * p, gsl_matrix_ushort * A); + +__END_DECLS + +#endif /* __GSL_PERMUTE_MATRIX_USHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_short.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_short.h new file mode 100644 index 000000000..39cf55d67 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_short.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_short.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_SHORT_H__ +#define __GSL_PERMUTE_SHORT_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_short (const size_t * p, short * data, const size_t stride, const size_t n); +int gsl_permute_short_inverse (const size_t * p, short * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_SHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_uchar.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_uchar.h new file mode 100644 index 000000000..54bb401b0 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_uchar.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_uchar.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_UCHAR_H__ +#define __GSL_PERMUTE_UCHAR_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_uchar (const size_t * p, unsigned char * data, const size_t stride, const size_t n); +int gsl_permute_uchar_inverse (const size_t * p, unsigned char * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_UCHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_uint.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_uint.h new file mode 100644 index 000000000..8915b7bc6 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_uint.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_uint.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_UINT_H__ +#define __GSL_PERMUTE_UINT_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_uint (const size_t * p, unsigned int * data, const size_t stride, const size_t n); +int gsl_permute_uint_inverse (const size_t * p, unsigned int * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_UINT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_ulong.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_ulong.h new file mode 100644 index 000000000..0084c506c --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_ulong.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_ulong.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_ULONG_H__ +#define __GSL_PERMUTE_ULONG_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_ulong (const size_t * p, unsigned long * data, const size_t stride, const size_t n); +int gsl_permute_ulong_inverse (const size_t * p, unsigned long * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_ULONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_ushort.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_ushort.h new file mode 100644 index 000000000..eff079a57 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_ushort.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_ushort.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_USHORT_H__ +#define __GSL_PERMUTE_USHORT_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_ushort (const size_t * p, unsigned short * data, const size_t stride, const size_t n); +int gsl_permute_ushort_inverse (const size_t * p, unsigned short * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_USHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector.h new file mode 100644 index 000000000..4369e4955 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector.h @@ -0,0 +1,24 @@ +#ifndef __GSL_PERMUTE_VECTOR_H__ +#define __GSL_PERMUTE_VECTOR_H__ + +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#endif /* __GSL_PERMUTE_VECTOR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_char.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_char.h new file mode 100644 index 000000000..15278eddf --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_char.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_char.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_CHAR_H__ +#define __GSL_PERMUTE_VECTOR_CHAR_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_char (const gsl_permutation * p, gsl_vector_char * v); +int gsl_permute_vector_char_inverse (const gsl_permutation * p, gsl_vector_char * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_CHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_complex_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_complex_double.h new file mode 100644 index 000000000..60558e21a --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_complex_double.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_complex_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_COMPLEX_DOUBLE_H__ +#define __GSL_PERMUTE_VECTOR_COMPLEX_DOUBLE_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_complex (const gsl_permutation * p, gsl_vector_complex * v); +int gsl_permute_vector_complex_inverse (const gsl_permutation * p, gsl_vector_complex * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_COMPLEX_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_complex_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_complex_float.h new file mode 100644 index 000000000..b08696bc6 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_complex_float.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_complex_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_COMPLEX_FLOAT_H__ +#define __GSL_PERMUTE_VECTOR_COMPLEX_FLOAT_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_complex_float (const gsl_permutation * p, gsl_vector_complex_float * v); +int gsl_permute_vector_complex_float_inverse (const gsl_permutation * p, gsl_vector_complex_float * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_COMPLEX_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_complex_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_complex_long_double.h new file mode 100644 index 000000000..c19ac25d8 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_complex_long_double.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_complex_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_COMPLEX_LONG_DOUBLE_H__ +#define __GSL_PERMUTE_VECTOR_COMPLEX_LONG_DOUBLE_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_complex_long_double (const gsl_permutation * p, gsl_vector_complex_long_double * v); +int gsl_permute_vector_complex_long_double_inverse (const gsl_permutation * p, gsl_vector_complex_long_double * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_COMPLEX_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_double.h new file mode 100644 index 000000000..65f616744 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_double.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_DOUBLE_H__ +#define __GSL_PERMUTE_VECTOR_DOUBLE_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector (const gsl_permutation * p, gsl_vector * v); +int gsl_permute_vector_inverse (const gsl_permutation * p, gsl_vector * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_float.h new file mode 100644 index 000000000..bdd9d1a63 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_float.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_FLOAT_H__ +#define __GSL_PERMUTE_VECTOR_FLOAT_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_float (const gsl_permutation * p, gsl_vector_float * v); +int gsl_permute_vector_float_inverse (const gsl_permutation * p, gsl_vector_float * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_int.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_int.h new file mode 100644 index 000000000..3316d504f --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_int.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_int.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_INT_H__ +#define __GSL_PERMUTE_VECTOR_INT_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_int (const gsl_permutation * p, gsl_vector_int * v); +int gsl_permute_vector_int_inverse (const gsl_permutation * p, gsl_vector_int * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_INT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_long.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_long.h new file mode 100644 index 000000000..291f949b3 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_long.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_long.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_LONG_H__ +#define __GSL_PERMUTE_VECTOR_LONG_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_long (const gsl_permutation * p, gsl_vector_long * v); +int gsl_permute_vector_long_inverse (const gsl_permutation * p, gsl_vector_long * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_LONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_long_double.h new file mode 100644 index 000000000..a6b02960a --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_long_double.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_LONG_DOUBLE_H__ +#define __GSL_PERMUTE_VECTOR_LONG_DOUBLE_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_long_double (const gsl_permutation * p, gsl_vector_long_double * v); +int gsl_permute_vector_long_double_inverse (const gsl_permutation * p, gsl_vector_long_double * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_short.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_short.h new file mode 100644 index 000000000..cd0dd6b4b --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_short.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_short.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_SHORT_H__ +#define __GSL_PERMUTE_VECTOR_SHORT_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_short (const gsl_permutation * p, gsl_vector_short * v); +int gsl_permute_vector_short_inverse (const gsl_permutation * p, gsl_vector_short * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_SHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_uchar.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_uchar.h new file mode 100644 index 000000000..df069a0a6 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_uchar.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_uchar.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_UCHAR_H__ +#define __GSL_PERMUTE_VECTOR_UCHAR_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_uchar (const gsl_permutation * p, gsl_vector_uchar * v); +int gsl_permute_vector_uchar_inverse (const gsl_permutation * p, gsl_vector_uchar * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_UCHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_uint.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_uint.h new file mode 100644 index 000000000..ee5218af9 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_uint.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_uint.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_UINT_H__ +#define __GSL_PERMUTE_VECTOR_UINT_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_uint (const gsl_permutation * p, gsl_vector_uint * v); +int gsl_permute_vector_uint_inverse (const gsl_permutation * p, gsl_vector_uint * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_UINT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_ulong.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_ulong.h new file mode 100644 index 000000000..e536d9a8a --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_ulong.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_ulong.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_ULONG_H__ +#define __GSL_PERMUTE_VECTOR_ULONG_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_ulong (const gsl_permutation * p, gsl_vector_ulong * v); +int gsl_permute_vector_ulong_inverse (const gsl_permutation * p, gsl_vector_ulong * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_ULONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_ushort.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_ushort.h new file mode 100644 index 000000000..7533ba00a --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_ushort.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_ushort.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_USHORT_H__ +#define __GSL_PERMUTE_VECTOR_USHORT_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_ushort (const gsl_permutation * p, gsl_vector_ushort * v); +int gsl_permute_vector_ushort_inverse (const gsl_permutation * p, gsl_vector_ushort * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_USHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_poly.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_poly.h new file mode 100644 index 000000000..2352857ff --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_poly.h @@ -0,0 +1,183 @@ +/* poly/gsl_poly.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_POLY_H__ +#define __GSL_POLY_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Evaluate polynomial + * + * c[0] + c[1] x + c[2] x^2 + ... + c[len-1] x^(len-1) + * + * exceptions: none + */ + +/* real polynomial, real x */ +INLINE_DECL double gsl_poly_eval(const double c[], const int len, const double x); + +/* real polynomial, complex x */ +INLINE_DECL gsl_complex gsl_poly_complex_eval (const double c [], const int len, const gsl_complex z); + +/* complex polynomial, complex x */ +INLINE_DECL gsl_complex gsl_complex_poly_complex_eval (const gsl_complex c [], const int len, const gsl_complex z); + +int gsl_poly_eval_derivs(const double c[], const size_t lenc, const double x, double res[], const size_t lenres); + +#ifdef HAVE_INLINE +INLINE_FUN +double +gsl_poly_eval(const double c[], const int len, const double x) +{ + int i; + double ans = c[len-1]; + for(i=len-1; i>0; i--) ans = c[i-1] + x * ans; + return ans; +} + +INLINE_FUN +gsl_complex +gsl_poly_complex_eval(const double c[], const int len, const gsl_complex z) +{ + int i; + gsl_complex ans; + GSL_SET_COMPLEX (&ans, c[len-1], 0.0); + for(i=len-1; i>0; i--) { + /* The following three lines are equivalent to + ans = gsl_complex_add_real (gsl_complex_mul (z, ans), c[i-1]); + but faster */ + double tmp = c[i-1] + GSL_REAL (z) * GSL_REAL (ans) - GSL_IMAG (z) * GSL_IMAG (ans); + GSL_SET_IMAG (&ans, GSL_IMAG (z) * GSL_REAL (ans) + GSL_REAL (z) * GSL_IMAG (ans)); + GSL_SET_REAL (&ans, tmp); + } + return ans; +} + +INLINE_FUN +gsl_complex +gsl_complex_poly_complex_eval(const gsl_complex c[], const int len, const gsl_complex z) +{ + int i; + gsl_complex ans = c[len-1]; + for(i=len-1; i>0; i--) { + /* The following three lines are equivalent to + ans = gsl_complex_add (c[i-1], gsl_complex_mul (x, ans)); + but faster */ + double tmp = GSL_REAL (c[i-1]) + GSL_REAL (z) * GSL_REAL (ans) - GSL_IMAG (z) * GSL_IMAG (ans); + GSL_SET_IMAG (&ans, GSL_IMAG (c[i-1]) + GSL_IMAG (z) * GSL_REAL (ans) + GSL_REAL (z) * GSL_IMAG (ans)); + GSL_SET_REAL (&ans, tmp); + } + return ans; +} +#endif /* HAVE_INLINE */ + +/* Work with divided-difference polynomials, Abramowitz & Stegun 25.2.26 */ + +int +gsl_poly_dd_init (double dd[], const double x[], const double y[], + size_t size); + +INLINE_DECL double +gsl_poly_dd_eval (const double dd[], const double xa[], const size_t size, const double x); + +#ifdef HAVE_INLINE +INLINE_FUN +double +gsl_poly_dd_eval(const double dd[], const double xa[], const size_t size, const double x) +{ + size_t i; + double y = dd[size - 1]; + for (i = size - 1; i--;) y = dd[i] + (x - xa[i]) * y; + return y; +} +#endif /* HAVE_INLINE */ + + +int +gsl_poly_dd_taylor (double c[], double xp, + const double dd[], const double x[], size_t size, + double w[]); + +int +gsl_poly_dd_hermite_init (double dd[], double z[], const double xa[], const double ya[], + const double dya[], const size_t size); + +/* Solve for real or complex roots of the standard quadratic equation, + * returning the number of real roots. + * + * Roots are returned ordered. + */ +int gsl_poly_solve_quadratic (double a, double b, double c, + double * x0, double * x1); + +int +gsl_poly_complex_solve_quadratic (double a, double b, double c, + gsl_complex * z0, gsl_complex * z1); + + +/* Solve for real roots of the cubic equation + * x^3 + a x^2 + b x + c = 0, returning the + * number of real roots. + * + * Roots are returned ordered. + */ +int gsl_poly_solve_cubic (double a, double b, double c, + double * x0, double * x1, double * x2); + +int +gsl_poly_complex_solve_cubic (double a, double b, double c, + gsl_complex * z0, gsl_complex * z1, + gsl_complex * z2); + + +/* Solve for the complex roots of a general real polynomial */ + +typedef struct +{ + size_t nc ; + double * matrix ; +} +gsl_poly_complex_workspace ; + +gsl_poly_complex_workspace * gsl_poly_complex_workspace_alloc (size_t n); +void gsl_poly_complex_workspace_free (gsl_poly_complex_workspace * w); + +int +gsl_poly_complex_solve (const double * a, size_t n, + gsl_poly_complex_workspace * w, + gsl_complex_packed_ptr z); + +__END_DECLS + +#endif /* __GSL_POLY_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_pow_int.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_pow_int.h new file mode 100644 index 000000000..6aa01fbcf --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_pow_int.h @@ -0,0 +1,61 @@ +/* gsl_pow_int.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_POW_INT_H__ +#define __GSL_POW_INT_H__ +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +INLINE_DECL double gsl_pow_2(const double x); +INLINE_DECL double gsl_pow_3(const double x); +INLINE_DECL double gsl_pow_4(const double x); +INLINE_DECL double gsl_pow_5(const double x); +INLINE_DECL double gsl_pow_6(const double x); +INLINE_DECL double gsl_pow_7(const double x); +INLINE_DECL double gsl_pow_8(const double x); +INLINE_DECL double gsl_pow_9(const double x); + +#ifdef HAVE_INLINE +INLINE_FUN double gsl_pow_2(const double x) { return x*x; } +INLINE_FUN double gsl_pow_3(const double x) { return x*x*x; } +INLINE_FUN double gsl_pow_4(const double x) { double x2 = x*x; return x2*x2; } +INLINE_FUN double gsl_pow_5(const double x) { double x2 = x*x; return x2*x2*x; } +INLINE_FUN double gsl_pow_6(const double x) { double x2 = x*x; return x2*x2*x2; } +INLINE_FUN double gsl_pow_7(const double x) { double x3 = x*x*x; return x3*x3*x; } +INLINE_FUN double gsl_pow_8(const double x) { double x2 = x*x; double x4 = x2*x2; return x4*x4; } +INLINE_FUN double gsl_pow_9(const double x) { double x3 = x*x*x; return x3*x3*x3; } +#endif + +double gsl_pow_int(double x, int n); +double gsl_pow_uint(double x, unsigned int n); + +__END_DECLS + +#endif /* __GSL_POW_INT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_precision.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_precision.h new file mode 100644 index 000000000..97a204ead --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_precision.h @@ -0,0 +1,66 @@ +/* gsl_precision.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: B. Gough and G. Jungman */ + +#ifndef __GSL_PRECISION_H__ +#define __GSL_PRECISION_H__ +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* A type for the precision indicator. + * This is mainly for pedagogy. + */ +typedef unsigned int gsl_prec_t; + + +/* The number of precision types. + * Remember that precision-mode + * can index an array. + */ +#define _GSL_PREC_T_NUM 3 + + +/* Arrays containing derived + * precision constants for the + * different precision levels. + */ +GSL_VAR const double gsl_prec_eps[]; +GSL_VAR const double gsl_prec_sqrt_eps[]; +GSL_VAR const double gsl_prec_root3_eps[]; +GSL_VAR const double gsl_prec_root4_eps[]; +GSL_VAR const double gsl_prec_root5_eps[]; +GSL_VAR const double gsl_prec_root6_eps[]; + + +__END_DECLS + +#endif /* __GSL_PRECISION_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_qrng.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_qrng.h new file mode 100644 index 000000000..47de500fb --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_qrng.h @@ -0,0 +1,111 @@ +/* Author: G. Jungman + modifications from O. Teytaud + */ +#ifndef __GSL_QRNG_H__ +#define __GSL_QRNG_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Once again, more inane C-style OOP... kill me now. */ + +/* Structure describing a type of generator. + */ +typedef struct +{ + const char * name; + unsigned int max_dimension; + size_t (*state_size) (unsigned int dimension); + int (*init_state) (void * state, unsigned int dimension); + int (*get) (void * state, unsigned int dimension, double x[]); +} +gsl_qrng_type; + +/* Structure describing a generator instance of a + * specified type, with generator-specific state info + * and dimension-specific info. + */ +typedef struct +{ + const gsl_qrng_type * type; + unsigned int dimension; + size_t state_size; + void * state; +} +gsl_qrng; + + +/* Supported generator types. + */ +GSL_VAR const gsl_qrng_type * gsl_qrng_niederreiter_2; +GSL_VAR const gsl_qrng_type * gsl_qrng_sobol; +GSL_VAR const gsl_qrng_type * gsl_qrng_halton; +GSL_VAR const gsl_qrng_type * gsl_qrng_reversehalton; + + +/* Allocate and initialize a generator + * of the specified type, in the given + * space dimension. + */ +gsl_qrng * gsl_qrng_alloc (const gsl_qrng_type * T, unsigned int dimension); + + +/* Copy a generator. */ +int gsl_qrng_memcpy (gsl_qrng * dest, const gsl_qrng * src); + + +/* Clone a generator. */ +gsl_qrng * gsl_qrng_clone (const gsl_qrng * q); + + +/* Free a generator. */ +void gsl_qrng_free (gsl_qrng * q); + + +/* Intialize a generator. */ +void gsl_qrng_init (gsl_qrng * q); + + +/* Get the standardized name of the generator. */ +const char * gsl_qrng_name (const gsl_qrng * q); + + +/* ISN'T THIS CONFUSING FOR PEOPLE? + WHAT IF SOMEBODY TRIES TO COPY WITH THIS ??? + */ +size_t gsl_qrng_size (const gsl_qrng * q); + + +void * gsl_qrng_state (const gsl_qrng * q); + + +/* Retrieve next vector in sequence. */ +INLINE_DECL int gsl_qrng_get (const gsl_qrng * q, double x[]); + +#ifdef HAVE_INLINE +INLINE_FUN int gsl_qrng_get (const gsl_qrng * q, double x[]) +{ + return (q->type->get) (q->state, q->dimension, x); +} + +#endif /* HAVE_INLINE */ + + +__END_DECLS + + +#endif /* !__GSL_QRNG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_randist.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_randist.h new file mode 100644 index 000000000..d38ccb36c --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_randist.h @@ -0,0 +1,219 @@ +/* randist/gsl_randist.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 James Theiler, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_RANDIST_H__ +#define __GSL_RANDIST_H__ +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +unsigned int gsl_ran_bernoulli (const gsl_rng * r, double p); +double gsl_ran_bernoulli_pdf (const unsigned int k, double p); + +double gsl_ran_beta (const gsl_rng * r, const double a, const double b); +double gsl_ran_beta_pdf (const double x, const double a, const double b); + +unsigned int gsl_ran_binomial (const gsl_rng * r, double p, unsigned int n); +unsigned int gsl_ran_binomial_knuth (const gsl_rng * r, double p, unsigned int n); +unsigned int gsl_ran_binomial_tpe (const gsl_rng * r, double p, unsigned int n); +double gsl_ran_binomial_pdf (const unsigned int k, const double p, const unsigned int n); + +double gsl_ran_exponential (const gsl_rng * r, const double mu); +double gsl_ran_exponential_pdf (const double x, const double mu); + +double gsl_ran_exppow (const gsl_rng * r, const double a, const double b); +double gsl_ran_exppow_pdf (const double x, const double a, const double b); + +double gsl_ran_cauchy (const gsl_rng * r, const double a); +double gsl_ran_cauchy_pdf (const double x, const double a); + +double gsl_ran_chisq (const gsl_rng * r, const double nu); +double gsl_ran_chisq_pdf (const double x, const double nu); + +void gsl_ran_dirichlet (const gsl_rng * r, const size_t K, const double alpha[], double theta[]); +double gsl_ran_dirichlet_pdf (const size_t K, const double alpha[], const double theta[]); +double gsl_ran_dirichlet_lnpdf (const size_t K, const double alpha[], const double theta[]); + +double gsl_ran_erlang (const gsl_rng * r, const double a, const double n); +double gsl_ran_erlang_pdf (const double x, const double a, const double n); + +double gsl_ran_fdist (const gsl_rng * r, const double nu1, const double nu2); +double gsl_ran_fdist_pdf (const double x, const double nu1, const double nu2); + +double gsl_ran_flat (const gsl_rng * r, const double a, const double b); +double gsl_ran_flat_pdf (double x, const double a, const double b); + +double gsl_ran_gamma (const gsl_rng * r, const double a, const double b); +double gsl_ran_gamma_int (const gsl_rng * r, const unsigned int a); +double gsl_ran_gamma_pdf (const double x, const double a, const double b); +double gsl_ran_gamma_mt (const gsl_rng * r, const double a, const double b); +double gsl_ran_gamma_knuth (const gsl_rng * r, const double a, const double b); + +double gsl_ran_gaussian (const gsl_rng * r, const double sigma); +double gsl_ran_gaussian_ratio_method (const gsl_rng * r, const double sigma); +double gsl_ran_gaussian_ziggurat (const gsl_rng * r, const double sigma); +double gsl_ran_gaussian_pdf (const double x, const double sigma); + +double gsl_ran_ugaussian (const gsl_rng * r); +double gsl_ran_ugaussian_ratio_method (const gsl_rng * r); +double gsl_ran_ugaussian_pdf (const double x); + +double gsl_ran_gaussian_tail (const gsl_rng * r, const double a, const double sigma); +double gsl_ran_gaussian_tail_pdf (const double x, const double a, const double sigma); + +double gsl_ran_ugaussian_tail (const gsl_rng * r, const double a); +double gsl_ran_ugaussian_tail_pdf (const double x, const double a); + +void gsl_ran_bivariate_gaussian (const gsl_rng * r, double sigma_x, double sigma_y, double rho, double *x, double *y); +double gsl_ran_bivariate_gaussian_pdf (const double x, const double y, const double sigma_x, const double sigma_y, const double rho); + +int gsl_ran_multivariate_gaussian (const gsl_rng * r, const gsl_vector * mu, const gsl_matrix * L, gsl_vector * result); +int gsl_ran_multivariate_gaussian_log_pdf (const gsl_vector * x, + const gsl_vector * mu, + const gsl_matrix * L, + double * result, + gsl_vector * work); +int gsl_ran_multivariate_gaussian_pdf (const gsl_vector * x, + const gsl_vector * mu, + const gsl_matrix * L, + double * result, + gsl_vector * work); +int gsl_ran_multivariate_gaussian_mean (const gsl_matrix * X, gsl_vector * mu_hat); +int gsl_ran_multivariate_gaussian_vcov (const gsl_matrix * X, gsl_matrix * sigma_hat); + +int gsl_ran_wishart (const gsl_rng * r, + const double df, + const gsl_matrix * L, + gsl_matrix * result, + gsl_matrix * work); +int gsl_ran_wishart_log_pdf (const gsl_matrix * X, + const gsl_matrix * L_X, + const double df, + const gsl_matrix * L, + double * result, + gsl_matrix * work); +int gsl_ran_wishart_pdf (const gsl_matrix * X, + const gsl_matrix * L_X, + const double df, + const gsl_matrix * L, + double * result, + gsl_matrix * work); + +double gsl_ran_landau (const gsl_rng * r); +double gsl_ran_landau_pdf (const double x); + +unsigned int gsl_ran_geometric (const gsl_rng * r, const double p); +double gsl_ran_geometric_pdf (const unsigned int k, const double p); + +unsigned int gsl_ran_hypergeometric (const gsl_rng * r, unsigned int n1, unsigned int n2, unsigned int t); +double gsl_ran_hypergeometric_pdf (const unsigned int k, const unsigned int n1, const unsigned int n2, unsigned int t); + +double gsl_ran_gumbel1 (const gsl_rng * r, const double a, const double b); +double gsl_ran_gumbel1_pdf (const double x, const double a, const double b); + +double gsl_ran_gumbel2 (const gsl_rng * r, const double a, const double b); +double gsl_ran_gumbel2_pdf (const double x, const double a, const double b); + +double gsl_ran_logistic (const gsl_rng * r, const double a); +double gsl_ran_logistic_pdf (const double x, const double a); + +double gsl_ran_lognormal (const gsl_rng * r, const double zeta, const double sigma); +double gsl_ran_lognormal_pdf (const double x, const double zeta, const double sigma); + +unsigned int gsl_ran_logarithmic (const gsl_rng * r, const double p); +double gsl_ran_logarithmic_pdf (const unsigned int k, const double p); + +void gsl_ran_multinomial (const gsl_rng * r, const size_t K, + const unsigned int N, const double p[], + unsigned int n[] ); +double gsl_ran_multinomial_pdf (const size_t K, + const double p[], const unsigned int n[] ); +double gsl_ran_multinomial_lnpdf (const size_t K, + const double p[], const unsigned int n[] ); + + +unsigned int gsl_ran_negative_binomial (const gsl_rng * r, double p, double n); +double gsl_ran_negative_binomial_pdf (const unsigned int k, const double p, double n); + +unsigned int gsl_ran_pascal (const gsl_rng * r, double p, unsigned int n); +double gsl_ran_pascal_pdf (const unsigned int k, const double p, unsigned int n); + +double gsl_ran_pareto (const gsl_rng * r, double a, const double b); +double gsl_ran_pareto_pdf (const double x, const double a, const double b); + +unsigned int gsl_ran_poisson (const gsl_rng * r, double mu); +void gsl_ran_poisson_array (const gsl_rng * r, size_t n, unsigned int array[], + double mu); +double gsl_ran_poisson_pdf (const unsigned int k, const double mu); + +double gsl_ran_rayleigh (const gsl_rng * r, const double sigma); +double gsl_ran_rayleigh_pdf (const double x, const double sigma); + +double gsl_ran_rayleigh_tail (const gsl_rng * r, const double a, const double sigma); +double gsl_ran_rayleigh_tail_pdf (const double x, const double a, const double sigma); + +double gsl_ran_tdist (const gsl_rng * r, const double nu); +double gsl_ran_tdist_pdf (const double x, const double nu); + +double gsl_ran_laplace (const gsl_rng * r, const double a); +double gsl_ran_laplace_pdf (const double x, const double a); + +double gsl_ran_levy (const gsl_rng * r, const double c, const double alpha); +double gsl_ran_levy_skew (const gsl_rng * r, const double c, const double alpha, const double beta); + +double gsl_ran_weibull (const gsl_rng * r, const double a, const double b); +double gsl_ran_weibull_pdf (const double x, const double a, const double b); + +void gsl_ran_dir_2d (const gsl_rng * r, double * x, double * y); +void gsl_ran_dir_2d_trig_method (const gsl_rng * r, double * x, double * y); +void gsl_ran_dir_3d (const gsl_rng * r, double * x, double * y, double * z); +void gsl_ran_dir_nd (const gsl_rng * r, size_t n, double * x); + +void gsl_ran_shuffle (const gsl_rng * r, void * base, size_t nmembm, size_t size); +int gsl_ran_choose (const gsl_rng * r, void * dest, size_t k, void * src, size_t n, size_t size) ; +void gsl_ran_sample (const gsl_rng * r, void * dest, size_t k, void * src, size_t n, size_t size) ; + + +typedef struct { /* struct for Walker algorithm */ + size_t K; + size_t *A; + double *F; +} gsl_ran_discrete_t; + +gsl_ran_discrete_t * gsl_ran_discrete_preproc (size_t K, const double *P); +void gsl_ran_discrete_free(gsl_ran_discrete_t *g); +size_t gsl_ran_discrete (const gsl_rng *r, const gsl_ran_discrete_t *g); +double gsl_ran_discrete_pdf (size_t k, const gsl_ran_discrete_t *g); + + +__END_DECLS + +#endif /* __GSL_RANDIST_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_rng.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_rng.h new file mode 100644 index 000000000..4ec55911c --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_rng.h @@ -0,0 +1,217 @@ +/* rng/gsl_rng.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 James Theiler, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_RNG_H__ +#define __GSL_RNG_H__ +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct + { + const char *name; + unsigned long int max; + unsigned long int min; + size_t size; + void (*set) (void *state, unsigned long int seed); + unsigned long int (*get) (void *state); + double (*get_double) (void *state); + } +gsl_rng_type; + +typedef struct + { + const gsl_rng_type * type; + void *state; + } +gsl_rng; + + +/* These structs also need to appear in default.c so you can select + them via the environment variable GSL_RNG_TYPE */ + +GSL_VAR const gsl_rng_type *gsl_rng_borosh13; +GSL_VAR const gsl_rng_type *gsl_rng_coveyou; +GSL_VAR const gsl_rng_type *gsl_rng_cmrg; +GSL_VAR const gsl_rng_type *gsl_rng_fishman18; +GSL_VAR const gsl_rng_type *gsl_rng_fishman20; +GSL_VAR const gsl_rng_type *gsl_rng_fishman2x; +GSL_VAR const gsl_rng_type *gsl_rng_gfsr4; +GSL_VAR const gsl_rng_type *gsl_rng_knuthran; +GSL_VAR const gsl_rng_type *gsl_rng_knuthran2; +GSL_VAR const gsl_rng_type *gsl_rng_knuthran2002; +GSL_VAR const gsl_rng_type *gsl_rng_lecuyer21; +GSL_VAR const gsl_rng_type *gsl_rng_minstd; +GSL_VAR const gsl_rng_type *gsl_rng_mrg; +GSL_VAR const gsl_rng_type *gsl_rng_mt19937; +GSL_VAR const gsl_rng_type *gsl_rng_mt19937_1999; +GSL_VAR const gsl_rng_type *gsl_rng_mt19937_1998; +GSL_VAR const gsl_rng_type *gsl_rng_r250; +GSL_VAR const gsl_rng_type *gsl_rng_ran0; +GSL_VAR const gsl_rng_type *gsl_rng_ran1; +GSL_VAR const gsl_rng_type *gsl_rng_ran2; +GSL_VAR const gsl_rng_type *gsl_rng_ran3; +GSL_VAR const gsl_rng_type *gsl_rng_rand; +GSL_VAR const gsl_rng_type *gsl_rng_rand48; +GSL_VAR const gsl_rng_type *gsl_rng_random128_bsd; +GSL_VAR const gsl_rng_type *gsl_rng_random128_glibc2; +GSL_VAR const gsl_rng_type *gsl_rng_random128_libc5; +GSL_VAR const gsl_rng_type *gsl_rng_random256_bsd; +GSL_VAR const gsl_rng_type *gsl_rng_random256_glibc2; +GSL_VAR const gsl_rng_type *gsl_rng_random256_libc5; +GSL_VAR const gsl_rng_type *gsl_rng_random32_bsd; +GSL_VAR const gsl_rng_type *gsl_rng_random32_glibc2; +GSL_VAR const gsl_rng_type *gsl_rng_random32_libc5; +GSL_VAR const gsl_rng_type *gsl_rng_random64_bsd; +GSL_VAR const gsl_rng_type *gsl_rng_random64_glibc2; +GSL_VAR const gsl_rng_type *gsl_rng_random64_libc5; +GSL_VAR const gsl_rng_type *gsl_rng_random8_bsd; +GSL_VAR const gsl_rng_type *gsl_rng_random8_glibc2; +GSL_VAR const gsl_rng_type *gsl_rng_random8_libc5; +GSL_VAR const gsl_rng_type *gsl_rng_random_bsd; +GSL_VAR const gsl_rng_type *gsl_rng_random_glibc2; +GSL_VAR const gsl_rng_type *gsl_rng_random_libc5; +GSL_VAR const gsl_rng_type *gsl_rng_randu; +GSL_VAR const gsl_rng_type *gsl_rng_ranf; +GSL_VAR const gsl_rng_type *gsl_rng_ranlux; +GSL_VAR const gsl_rng_type *gsl_rng_ranlux389; +GSL_VAR const gsl_rng_type *gsl_rng_ranlxd1; +GSL_VAR const gsl_rng_type *gsl_rng_ranlxd2; +GSL_VAR const gsl_rng_type *gsl_rng_ranlxs0; +GSL_VAR const gsl_rng_type *gsl_rng_ranlxs1; +GSL_VAR const gsl_rng_type *gsl_rng_ranlxs2; +GSL_VAR const gsl_rng_type *gsl_rng_ranmar; +GSL_VAR const gsl_rng_type *gsl_rng_slatec; +GSL_VAR const gsl_rng_type *gsl_rng_taus; +GSL_VAR const gsl_rng_type *gsl_rng_taus2; +GSL_VAR const gsl_rng_type *gsl_rng_taus113; +GSL_VAR const gsl_rng_type *gsl_rng_transputer; +GSL_VAR const gsl_rng_type *gsl_rng_tt800; +GSL_VAR const gsl_rng_type *gsl_rng_uni; +GSL_VAR const gsl_rng_type *gsl_rng_uni32; +GSL_VAR const gsl_rng_type *gsl_rng_vax; +GSL_VAR const gsl_rng_type *gsl_rng_waterman14; +GSL_VAR const gsl_rng_type *gsl_rng_zuf; + +const gsl_rng_type ** gsl_rng_types_setup(void); + +GSL_VAR const gsl_rng_type *gsl_rng_default; +GSL_VAR unsigned long int gsl_rng_default_seed; + +gsl_rng *gsl_rng_alloc (const gsl_rng_type * T); +int gsl_rng_memcpy (gsl_rng * dest, const gsl_rng * src); +gsl_rng *gsl_rng_clone (const gsl_rng * r); + +void gsl_rng_free (gsl_rng * r); + +void gsl_rng_set (const gsl_rng * r, unsigned long int seed); +unsigned long int gsl_rng_max (const gsl_rng * r); +unsigned long int gsl_rng_min (const gsl_rng * r); +const char *gsl_rng_name (const gsl_rng * r); + +int gsl_rng_fread (FILE * stream, gsl_rng * r); +int gsl_rng_fwrite (FILE * stream, const gsl_rng * r); + +size_t gsl_rng_size (const gsl_rng * r); +void * gsl_rng_state (const gsl_rng * r); + +void gsl_rng_print_state (const gsl_rng * r); + +const gsl_rng_type * gsl_rng_env_setup (void); + +INLINE_DECL unsigned long int gsl_rng_get (const gsl_rng * r); +INLINE_DECL double gsl_rng_uniform (const gsl_rng * r); +INLINE_DECL double gsl_rng_uniform_pos (const gsl_rng * r); +INLINE_DECL unsigned long int gsl_rng_uniform_int (const gsl_rng * r, unsigned long int n); + +#ifdef HAVE_INLINE + +INLINE_FUN unsigned long int +gsl_rng_get (const gsl_rng * r) +{ + return (r->type->get) (r->state); +} + +INLINE_FUN double +gsl_rng_uniform (const gsl_rng * r) +{ + return (r->type->get_double) (r->state); +} + +INLINE_FUN double +gsl_rng_uniform_pos (const gsl_rng * r) +{ + double x ; + do + { + x = (r->type->get_double) (r->state) ; + } + while (x == 0) ; + + return x ; +} + +/* Note: to avoid integer overflow in (range+1) we work with scale = + range/n = (max-min)/n rather than scale=(max-min+1)/n, this reduces + efficiency slightly but avoids having to check for the out of range + value. Note that range is typically O(2^32) so the addition of 1 + is negligible in most usage. */ + +INLINE_FUN unsigned long int +gsl_rng_uniform_int (const gsl_rng * r, unsigned long int n) +{ + unsigned long int offset = r->type->min; + unsigned long int range = r->type->max - offset; + unsigned long int scale; + unsigned long int k; + + if (n > range || n == 0) + { + GSL_ERROR_VAL ("invalid n, either 0 or exceeds maximum value of generator", + GSL_EINVAL, 0) ; + } + + scale = range / n; + + do + { + k = (((r->type->get) (r->state)) - offset) / scale; + } + while (k >= n); + + return k; +} +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_RNG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_roots.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_roots.h new file mode 100644 index 000000000..46e458706 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_roots.h @@ -0,0 +1,127 @@ +/* roots/gsl_roots.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Reid Priedhorsky, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_ROOTS_H__ +#define __GSL_ROOTS_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct + { + const char *name; + size_t size; + int (*set) (void *state, gsl_function * f, double * root, double x_lower, double x_upper); + int (*iterate) (void *state, gsl_function * f, double * root, double * x_lower, double * x_upper); + } +gsl_root_fsolver_type; + +typedef struct + { + const gsl_root_fsolver_type * type; + gsl_function * function ; + double root ; + double x_lower; + double x_upper; + void *state; + } +gsl_root_fsolver; + +typedef struct + { + const char *name; + size_t size; + int (*set) (void *state, gsl_function_fdf * f, double * root); + int (*iterate) (void *state, gsl_function_fdf * f, double * root); + } +gsl_root_fdfsolver_type; + +typedef struct + { + const gsl_root_fdfsolver_type * type; + gsl_function_fdf * fdf ; + double root ; + void *state; + } +gsl_root_fdfsolver; + +gsl_root_fsolver * +gsl_root_fsolver_alloc (const gsl_root_fsolver_type * T); +void gsl_root_fsolver_free (gsl_root_fsolver * s); + +int gsl_root_fsolver_set (gsl_root_fsolver * s, + gsl_function * f, + double x_lower, double x_upper); + +int gsl_root_fsolver_iterate (gsl_root_fsolver * s); + +const char * gsl_root_fsolver_name (const gsl_root_fsolver * s); +double gsl_root_fsolver_root (const gsl_root_fsolver * s); +double gsl_root_fsolver_x_lower (const gsl_root_fsolver * s); +double gsl_root_fsolver_x_upper (const gsl_root_fsolver * s); + + +gsl_root_fdfsolver * +gsl_root_fdfsolver_alloc (const gsl_root_fdfsolver_type * T); + +int +gsl_root_fdfsolver_set (gsl_root_fdfsolver * s, + gsl_function_fdf * fdf, double root); + +int +gsl_root_fdfsolver_iterate (gsl_root_fdfsolver * s); + +void +gsl_root_fdfsolver_free (gsl_root_fdfsolver * s); + +const char * gsl_root_fdfsolver_name (const gsl_root_fdfsolver * s); +double gsl_root_fdfsolver_root (const gsl_root_fdfsolver * s); + +int +gsl_root_test_interval (double x_lower, double x_upper, double epsabs, double epsrel); + +int +gsl_root_test_residual (double f, double epsabs); + +int +gsl_root_test_delta (double x1, double x0, double epsabs, double epsrel); + +GSL_VAR const gsl_root_fsolver_type * gsl_root_fsolver_bisection; +GSL_VAR const gsl_root_fsolver_type * gsl_root_fsolver_brent; +GSL_VAR const gsl_root_fsolver_type * gsl_root_fsolver_falsepos; +GSL_VAR const gsl_root_fdfsolver_type * gsl_root_fdfsolver_newton; +GSL_VAR const gsl_root_fdfsolver_type * gsl_root_fdfsolver_secant; +GSL_VAR const gsl_root_fdfsolver_type * gsl_root_fdfsolver_steffenson; + +__END_DECLS + +#endif /* __GSL_ROOTS_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_rstat.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_rstat.h new file mode 100644 index 000000000..f2aab6b17 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_rstat.h @@ -0,0 +1,81 @@ +/* rstat/gsl_rstat.h + * + * Copyright (C) 2015 Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_RSTAT_H__ +#define __GSL_RSTAT_H__ + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + double p; /* p-quantile */ + double q[5]; /* heights q_i */ + int npos[5]; /* positions n_i */ + double np[5]; /* desired positions n_i' */ + double dnp[5]; /* increments dn_i' */ + size_t n; /* number of data added */ +} gsl_rstat_quantile_workspace; + +gsl_rstat_quantile_workspace *gsl_rstat_quantile_alloc(const double p); +void gsl_rstat_quantile_free(gsl_rstat_quantile_workspace *w); +int gsl_rstat_quantile_reset(gsl_rstat_quantile_workspace *w); +int gsl_rstat_quantile_add(const double x, gsl_rstat_quantile_workspace *w); +double gsl_rstat_quantile_get(gsl_rstat_quantile_workspace *w); + +typedef struct +{ + double min; /* minimum value added */ + double max; /* maximum value added */ + double mean; /* current mean */ + double M2; /* M_k = sum_{i=1..n} [ x_i - mean_n ]^k */ + double M3; + double M4; + size_t n; /* number of data points added */ + gsl_rstat_quantile_workspace *median_workspace_p; /* median workspace */ +} gsl_rstat_workspace; + +gsl_rstat_workspace *gsl_rstat_alloc(void); +void gsl_rstat_free(gsl_rstat_workspace *w); +size_t gsl_rstat_n(const gsl_rstat_workspace *w); +int gsl_rstat_add(const double x, gsl_rstat_workspace *w); +double gsl_rstat_min(const gsl_rstat_workspace *w); +double gsl_rstat_max(const gsl_rstat_workspace *w); +double gsl_rstat_mean(const gsl_rstat_workspace *w); +double gsl_rstat_variance(const gsl_rstat_workspace *w); +double gsl_rstat_sd(const gsl_rstat_workspace *w); +double gsl_rstat_rms(const gsl_rstat_workspace *w); +double gsl_rstat_sd_mean(const gsl_rstat_workspace *w); +double gsl_rstat_median(gsl_rstat_workspace *w); +double gsl_rstat_skew(const gsl_rstat_workspace *w); +double gsl_rstat_kurtosis(const gsl_rstat_workspace *w); +int gsl_rstat_reset(gsl_rstat_workspace *w); + +__END_DECLS + +#endif /* __GSL_RSTAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf.h new file mode 100644 index 000000000..cb9cafd2b --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf.h @@ -0,0 +1,41 @@ +/* Author: G. Jungman */ + +#ifndef __GSL_SF_H__ +#define __GSL_SF_H__ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#endif /* __GSL_SF_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_airy.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_airy.h new file mode 100644 index 000000000..703338306 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_airy.h @@ -0,0 +1,139 @@ +/* specfunc/gsl_sf_airy.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_AIRY_H__ +#define __GSL_SF_AIRY_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Airy function Ai(x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_airy_Ai_e(const double x, const gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_airy_Ai(const double x, gsl_mode_t mode); + + +/* Airy function Bi(x) + * + * exceptions: GSL_EOVRFLW + */ +int gsl_sf_airy_Bi_e(const double x, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_airy_Bi(const double x, gsl_mode_t mode); + + +/* scaled Ai(x): + * Ai(x) x < 0 + * exp(+2/3 x^{3/2}) Ai(x) x > 0 + * + * exceptions: none + */ +int gsl_sf_airy_Ai_scaled_e(const double x, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_airy_Ai_scaled(const double x, gsl_mode_t mode); + + +/* scaled Bi(x): + * Bi(x) x < 0 + * exp(-2/3 x^{3/2}) Bi(x) x > 0 + * + * exceptions: none + */ +int gsl_sf_airy_Bi_scaled_e(const double x, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_airy_Bi_scaled(const double x, gsl_mode_t mode); + + +/* derivative Ai'(x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_airy_Ai_deriv_e(const double x, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_airy_Ai_deriv(const double x, gsl_mode_t mode); + + +/* derivative Bi'(x) + * + * exceptions: GSL_EOVRFLW + */ +int gsl_sf_airy_Bi_deriv_e(const double x, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_airy_Bi_deriv(const double x, gsl_mode_t mode); + + +/* scaled derivative Ai'(x): + * Ai'(x) x < 0 + * exp(+2/3 x^{3/2}) Ai'(x) x > 0 + * + * exceptions: none + */ +int gsl_sf_airy_Ai_deriv_scaled_e(const double x, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_airy_Ai_deriv_scaled(const double x, gsl_mode_t mode); + + +/* scaled derivative: + * Bi'(x) x < 0 + * exp(-2/3 x^{3/2}) Bi'(x) x > 0 + * + * exceptions: none + */ +int gsl_sf_airy_Bi_deriv_scaled_e(const double x, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_airy_Bi_deriv_scaled(const double x, gsl_mode_t mode); + + +/* Zeros of Ai(x) + */ +int gsl_sf_airy_zero_Ai_e(unsigned int s, gsl_sf_result * result); +double gsl_sf_airy_zero_Ai(unsigned int s); + + +/* Zeros of Bi(x) + */ +int gsl_sf_airy_zero_Bi_e(unsigned int s, gsl_sf_result * result); +double gsl_sf_airy_zero_Bi(unsigned int s); + + +/* Zeros of Ai'(x) + */ +int gsl_sf_airy_zero_Ai_deriv_e(unsigned int s, gsl_sf_result * result); +double gsl_sf_airy_zero_Ai_deriv(unsigned int s); + + +/* Zeros of Bi'(x) + */ +int gsl_sf_airy_zero_Bi_deriv_e(unsigned int s, gsl_sf_result * result); +double gsl_sf_airy_zero_Bi_deriv(unsigned int s); + + +__END_DECLS + +#endif /* __GSL_SF_AIRY_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_bessel.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_bessel.h new file mode 100644 index 000000000..d72957aeb --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_bessel.h @@ -0,0 +1,549 @@ +/* specfunc/gsl_sf_bessel.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_BESSEL_H__ +#define __GSL_SF_BESSEL_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Regular Bessel Function J_0(x) + * + * exceptions: none + */ +int gsl_sf_bessel_J0_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_J0(const double x); + + +/* Regular Bessel Function J_1(x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_J1_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_J1(const double x); + + +/* Regular Bessel Function J_n(x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_Jn_e(int n, double x, gsl_sf_result * result); +double gsl_sf_bessel_Jn(const int n, const double x); + + +/* Regular Bessel Function J_n(x), nmin <= n <= nmax + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_Jn_array(int nmin, int nmax, double x, double * result_array); + + +/* Irregular Bessel function Y_0(x) + * + * x > 0.0 + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_Y0_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_Y0(const double x); + + +/* Irregular Bessel function Y_1(x) + * + * x > 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_bessel_Y1_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_Y1(const double x); + + +/* Irregular Bessel function Y_n(x) + * + * x > 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_bessel_Yn_e(int n,const double x, gsl_sf_result * result); +double gsl_sf_bessel_Yn(const int n,const double x); + + +/* Irregular Bessel function Y_n(x), nmin <= n <= nmax + * + * x > 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_bessel_Yn_array(const int nmin, const int nmax, const double x, double * result_array); + + +/* Regular modified Bessel function I_0(x) + * + * exceptions: GSL_EOVRFLW + */ +int gsl_sf_bessel_I0_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_I0(const double x); + + +/* Regular modified Bessel function I_1(x) + * + * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_bessel_I1_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_I1(const double x); + + +/* Regular modified Bessel function I_n(x) + * + * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_bessel_In_e(const int n, const double x, gsl_sf_result * result); +double gsl_sf_bessel_In(const int n, const double x); + + +/* Regular modified Bessel function I_n(x) for n=nmin,...,nmax + * + * nmin >=0, nmax >= nmin + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_bessel_In_array(const int nmin, const int nmax, const double x, double * result_array); + + +/* Scaled regular modified Bessel function + * exp(-|x|) I_0(x) + * + * exceptions: none + */ +int gsl_sf_bessel_I0_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_I0_scaled(const double x); + + +/* Scaled regular modified Bessel function + * exp(-|x|) I_1(x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_I1_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_I1_scaled(const double x); + + +/* Scaled regular modified Bessel function + * exp(-|x|) I_n(x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_In_scaled_e(int n, const double x, gsl_sf_result * result); +double gsl_sf_bessel_In_scaled(const int n, const double x); + + +/* Scaled regular modified Bessel function + * exp(-|x|) I_n(x) for n=nmin,...,nmax + * + * nmin >=0, nmax >= nmin + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_In_scaled_array(const int nmin, const int nmax, const double x, double * result_array); + + +/* Irregular modified Bessel function K_0(x) + * + * x > 0.0 + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_K0_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_K0(const double x); + + +/* Irregular modified Bessel function K_1(x) + * + * x > 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_bessel_K1_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_K1(const double x); + + +/* Irregular modified Bessel function K_n(x) + * + * x > 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_bessel_Kn_e(const int n, const double x, gsl_sf_result * result); +double gsl_sf_bessel_Kn(const int n, const double x); + + +/* Irregular modified Bessel function K_n(x) for n=nmin,...,nmax + * + * x > 0.0, nmin >=0, nmax >= nmin + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_bessel_Kn_array(const int nmin, const int nmax, const double x, double * result_array); + + +/* Scaled irregular modified Bessel function + * exp(x) K_0(x) + * + * x > 0.0 + * exceptions: GSL_EDOM + */ +int gsl_sf_bessel_K0_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_K0_scaled(const double x); + + +/* Scaled irregular modified Bessel function + * exp(x) K_1(x) + * + * x > 0.0 + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_K1_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_K1_scaled(const double x); + + +/* Scaled irregular modified Bessel function + * exp(x) K_n(x) + * + * x > 0.0 + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_Kn_scaled_e(int n, const double x, gsl_sf_result * result); +double gsl_sf_bessel_Kn_scaled(const int n, const double x); + + +/* Scaled irregular modified Bessel function exp(x) K_n(x) for n=nmin,...,nmax + * + * x > 0.0, nmin >=0, nmax >= nmin + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_Kn_scaled_array(const int nmin, const int nmax, const double x, double * result_array); + + +/* Regular spherical Bessel function j_0(x) = sin(x)/x + * + * exceptions: none + */ +int gsl_sf_bessel_j0_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_j0(const double x); + + +/* Regular spherical Bessel function j_1(x) = (sin(x)/x - cos(x))/x + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_j1_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_j1(const double x); + + +/* Regular spherical Bessel function j_2(x) = ((3/x^2 - 1)sin(x) - 3cos(x)/x)/x + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_j2_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_j2(const double x); + + +/* Regular spherical Bessel function j_l(x) + * + * l >= 0, x >= 0.0 + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_jl_e(const int l, const double x, gsl_sf_result * result); +double gsl_sf_bessel_jl(const int l, const double x); + + +/* Regular spherical Bessel function j_l(x) for l=0,1,...,lmax + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_jl_array(const int lmax, const double x, double * result_array); + + +/* Regular spherical Bessel function j_l(x) for l=0,1,...,lmax + * Uses Steed's method. + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_jl_steed_array(const int lmax, const double x, double * jl_x_array); + + +/* Irregular spherical Bessel function y_0(x) + * + * exceptions: none + */ +int gsl_sf_bessel_y0_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_y0(const double x); + + +/* Irregular spherical Bessel function y_1(x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_y1_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_y1(const double x); + + +/* Irregular spherical Bessel function y_2(x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_y2_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_y2(const double x); + + +/* Irregular spherical Bessel function y_l(x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_yl_e(int l, const double x, gsl_sf_result * result); +double gsl_sf_bessel_yl(const int l, const double x); + + +/* Irregular spherical Bessel function y_l(x) for l=0,1,...,lmax + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_yl_array(const int lmax, const double x, double * result_array); + + +/* Regular scaled modified spherical Bessel function + * + * Exp[-|x|] i_0(x) + * + * exceptions: none + */ +int gsl_sf_bessel_i0_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_i0_scaled(const double x); + + +/* Regular scaled modified spherical Bessel function + * + * Exp[-|x|] i_1(x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_i1_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_i1_scaled(const double x); + + +/* Regular scaled modified spherical Bessel function + * + * Exp[-|x|] i_2(x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_i2_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_i2_scaled(const double x); + + +/* Regular scaled modified spherical Bessel functions + * + * Exp[-|x|] i_l(x) + * + * i_l(x) = Sqrt[Pi/(2x)] BesselI[l+1/2,x] + * + * l >= 0 + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_il_scaled_e(const int l, double x, gsl_sf_result * result); +double gsl_sf_bessel_il_scaled(const int l, const double x); + + +/* Regular scaled modified spherical Bessel functions + * + * Exp[-|x|] i_l(x) + * for l=0,1,...,lmax + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_il_scaled_array(const int lmax, const double x, double * result_array); + + +/* Irregular scaled modified spherical Bessel function + * Exp[x] k_0(x) + * + * x > 0.0 + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_k0_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_k0_scaled(const double x); + + +/* Irregular modified spherical Bessel function + * Exp[x] k_1(x) + * + * x > 0.0 + * exceptions: GSL_EDOM, GSL_EUNDRFLW, GSL_EOVRFLW + */ +int gsl_sf_bessel_k1_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_k1_scaled(const double x); + + +/* Irregular modified spherical Bessel function + * Exp[x] k_2(x) + * + * x > 0.0 + * exceptions: GSL_EDOM, GSL_EUNDRFLW, GSL_EOVRFLW + */ +int gsl_sf_bessel_k2_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_k2_scaled(const double x); + + +/* Irregular modified spherical Bessel function + * Exp[x] k_l[x] + * + * k_l(x) = Sqrt[Pi/(2x)] BesselK[l+1/2,x] + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_kl_scaled_e(int l, const double x, gsl_sf_result * result); +double gsl_sf_bessel_kl_scaled(const int l, const double x); + + +/* Irregular scaled modified spherical Bessel function + * Exp[x] k_l(x) + * + * for l=0,1,...,lmax + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_kl_scaled_array(const int lmax, const double x, double * result_array); + + +/* Regular cylindrical Bessel function J_nu(x) + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_Jnu_e(const double nu, const double x, gsl_sf_result * result); +double gsl_sf_bessel_Jnu(const double nu, const double x); + + +/* Irregular cylindrical Bessel function Y_nu(x) + * + * exceptions: + */ +int gsl_sf_bessel_Ynu_e(double nu, double x, gsl_sf_result * result); +double gsl_sf_bessel_Ynu(const double nu, const double x); + + +/* Regular cylindrical Bessel function J_nu(x) + * evaluated at a series of x values. The array + * contains the x values. They are assumed to be + * strictly ordered and positive. The array is + * over-written with the values of J_nu(x_i). + * + * exceptions: GSL_EDOM, GSL_EINVAL + */ +int gsl_sf_bessel_sequence_Jnu_e(double nu, gsl_mode_t mode, size_t size, double * v); + + +/* Scaled modified cylindrical Bessel functions + * + * Exp[-|x|] BesselI[nu, x] + * x >= 0, nu >= 0 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_bessel_Inu_scaled_e(double nu, double x, gsl_sf_result * result); +double gsl_sf_bessel_Inu_scaled(double nu, double x); + + +/* Modified cylindrical Bessel functions + * + * BesselI[nu, x] + * x >= 0, nu >= 0 + * + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_bessel_Inu_e(double nu, double x, gsl_sf_result * result); +double gsl_sf_bessel_Inu(double nu, double x); + + +/* Scaled modified cylindrical Bessel functions + * + * Exp[+|x|] BesselK[nu, x] + * x > 0, nu >= 0 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_bessel_Knu_scaled_e(const double nu, const double x, gsl_sf_result * result); +double gsl_sf_bessel_Knu_scaled(const double nu, const double x); + +int gsl_sf_bessel_Knu_scaled_e10_e(const double nu, const double x, gsl_sf_result_e10 * result); + +/* Modified cylindrical Bessel functions + * + * BesselK[nu, x] + * x > 0, nu >= 0 + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_Knu_e(const double nu, const double x, gsl_sf_result * result); +double gsl_sf_bessel_Knu(const double nu, const double x); + + +/* Logarithm of modified cylindrical Bessel functions. + * + * Log[BesselK[nu, x]] + * x > 0, nu >= 0 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_bessel_lnKnu_e(const double nu, const double x, gsl_sf_result * result); +double gsl_sf_bessel_lnKnu(const double nu, const double x); + + +/* s'th positive zero of the Bessel function J_0(x). + * + * exceptions: + */ +int gsl_sf_bessel_zero_J0_e(unsigned int s, gsl_sf_result * result); +double gsl_sf_bessel_zero_J0(unsigned int s); + + +/* s'th positive zero of the Bessel function J_1(x). + * + * exceptions: + */ +int gsl_sf_bessel_zero_J1_e(unsigned int s, gsl_sf_result * result); +double gsl_sf_bessel_zero_J1(unsigned int s); + + +/* s'th positive zero of the Bessel function J_nu(x). + * + * exceptions: + */ +int gsl_sf_bessel_zero_Jnu_e(double nu, unsigned int s, gsl_sf_result * result); +double gsl_sf_bessel_zero_Jnu(double nu, unsigned int s); + + +__END_DECLS + +#endif /* __GSL_SF_BESSEL_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_clausen.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_clausen.h new file mode 100644 index 000000000..8e4ccd244 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_clausen.h @@ -0,0 +1,52 @@ +/* specfunc/gsl_sf_clausen.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_CLAUSEN_H__ +#define __GSL_SF_CLAUSEN_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Calculate the Clausen integral: + * Cl_2(x) := Integrate[-Log[2 Sin[t/2]], {t,0,x}] + * + * Relation to dilogarithm: + * Cl_2(theta) = Im[ Li_2(e^(i theta)) ] + */ +int gsl_sf_clausen_e(double x, gsl_sf_result * result); +double gsl_sf_clausen(const double x); + + +__END_DECLS + +#endif /* __GSL_SF_CLAUSEN_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_coulomb.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_coulomb.h new file mode 100644 index 000000000..764a5714d --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_coulomb.h @@ -0,0 +1,128 @@ +/* specfunc/gsl_sf_coulomb.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_COULOMB_H__ +#define __GSL_SF_COULOMB_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Normalized hydrogenic bound states, radial dependence. */ + +/* R_1 := 2Z sqrt(Z) exp(-Z r) + */ +int gsl_sf_hydrogenicR_1_e(const double Z, const double r, gsl_sf_result * result); +double gsl_sf_hydrogenicR_1(const double Z, const double r); + +/* R_n := norm exp(-Z r/n) (2Z/n)^l Laguerre[n-l-1, 2l+1, 2Z/n r] + * + * normalization such that psi(n,l,r) = R_n Y_{lm} + */ +int gsl_sf_hydrogenicR_e(const int n, const int l, const double Z, const double r, gsl_sf_result * result); +double gsl_sf_hydrogenicR(const int n, const int l, const double Z, const double r); + + +/* Coulomb wave functions F_{lam_F}(eta,x), G_{lam_G}(eta,x) + * and their derivatives; lam_G := lam_F - k_lam_G + * + * lam_F, lam_G > -0.5 + * x > 0.0 + * + * Conventions of Abramowitz+Stegun. + * + * Because there can be a large dynamic range of values, + * overflows are handled gracefully. If an overflow occurs, + * GSL_EOVRFLW is signalled and exponent(s) are returned + * through exp_F, exp_G. These are such that + * + * F_L(eta,x) = fc[k_L] * exp(exp_F) + * G_L(eta,x) = gc[k_L] * exp(exp_G) + * F_L'(eta,x) = fcp[k_L] * exp(exp_F) + * G_L'(eta,x) = gcp[k_L] * exp(exp_G) + */ +int +gsl_sf_coulomb_wave_FG_e(const double eta, const double x, + const double lam_F, + const int k_lam_G, + gsl_sf_result * F, gsl_sf_result * Fp, + gsl_sf_result * G, gsl_sf_result * Gp, + double * exp_F, double * exp_G); + + +/* F_L(eta,x) as array */ +int gsl_sf_coulomb_wave_F_array( + double lam_min, int kmax, + double eta, double x, + double * fc_array, + double * F_exponent + ); + +/* F_L(eta,x), G_L(eta,x) as arrays */ +int gsl_sf_coulomb_wave_FG_array(double lam_min, int kmax, + double eta, double x, + double * fc_array, double * gc_array, + double * F_exponent, + double * G_exponent + ); + +/* F_L(eta,x), G_L(eta,x), F'_L(eta,x), G'_L(eta,x) as arrays */ +int gsl_sf_coulomb_wave_FGp_array(double lam_min, int kmax, + double eta, double x, + double * fc_array, double * fcp_array, + double * gc_array, double * gcp_array, + double * F_exponent, + double * G_exponent + ); + +/* Coulomb wave function divided by the argument, + * F(eta, x)/x. This is the function which reduces to + * spherical Bessel functions in the limit eta->0. + */ +int gsl_sf_coulomb_wave_sphF_array(double lam_min, int kmax, + double eta, double x, + double * fc_array, + double * F_exponent + ); + + +/* Coulomb wave function normalization constant. + * [Abramowitz+Stegun 14.1.8, 14.1.9] + */ +int gsl_sf_coulomb_CL_e(double L, double eta, gsl_sf_result * result); +int gsl_sf_coulomb_CL_array(double Lmin, int kmax, double eta, double * cl); + + +__END_DECLS + +#endif /* __GSL_SF_COULOMB_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_coupling.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_coupling.h new file mode 100644 index 000000000..c46b9f583 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_coupling.h @@ -0,0 +1,125 @@ +/* specfunc/gsl_sf_coupling.h + * + * Copyright (C) 1996,1997,1998,1999,2000,2001,2002 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_COUPLING_H__ +#define __GSL_SF_COUPLING_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* 3j Symbols: / ja jb jc \ + * \ ma mb mc / + * + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_coupling_3j_e(int two_ja, int two_jb, int two_jc, + int two_ma, int two_mb, int two_mc, + gsl_sf_result * result + ); +double gsl_sf_coupling_3j(int two_ja, int two_jb, int two_jc, + int two_ma, int two_mb, int two_mc + ); + + +/* 6j Symbols: / ja jb jc \ + * \ jd je jf / + * + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_coupling_6j_e(int two_ja, int two_jb, int two_jc, + int two_jd, int two_je, int two_jf, + gsl_sf_result * result + ); +double gsl_sf_coupling_6j(int two_ja, int two_jb, int two_jc, + int two_jd, int two_je, int two_jf + ); + +/* Racah W coefficients: + * + * W(a b c d; e f) = (-1)^{a+b+c+d} / a b e \ + * \ d c f / + * + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_coupling_RacahW_e(int two_ja, int two_jb, int two_jc, + int two_jd, int two_je, int two_jf, + gsl_sf_result * result + ); +double gsl_sf_coupling_RacahW(int two_ja, int two_jb, int two_jc, + int two_jd, int two_je, int two_jf + ); + + +/* 9j Symbols: / ja jb jc \ + * | jd je jf | + * \ jg jh ji / + * + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_coupling_9j_e(int two_ja, int two_jb, int two_jc, + int two_jd, int two_je, int two_jf, + int two_jg, int two_jh, int two_ji, + gsl_sf_result * result + ); +double gsl_sf_coupling_9j(int two_ja, int two_jb, int two_jc, + int two_jd, int two_je, int two_jf, + int two_jg, int two_jh, int two_ji + ); + + +/* INCORRECT version of 6j Symbols: + * This function actually calculates + * / ja jb je \ + * \ jd jc jf / + * It represents the original implementation, + * which had the above permutation of the + * arguments. This was wrong and confusing, + * and I had to fix it. Sorry for the trouble. + * [GJ] Tue Nov 26 12:53:39 MST 2002 + * + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +#ifndef GSL_DISABLE_DEPRECATED +int gsl_sf_coupling_6j_INCORRECT_e(int two_ja, int two_jb, int two_jc, + int two_jd, int two_je, int two_jf, + gsl_sf_result * result + ); +double gsl_sf_coupling_6j_INCORRECT(int two_ja, int two_jb, int two_jc, + int two_jd, int two_je, int two_jf + ); +#endif /* !GSL_DISABLE_DEPRECATED */ + + +__END_DECLS + +#endif /* __GSL_SF_COUPLING_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_dawson.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_dawson.h new file mode 100644 index 000000000..7c11f9f41 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_dawson.h @@ -0,0 +1,52 @@ +/* specfunc/gsl_sf_dawson.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_DAWSON_H__ +#define __GSL_SF_DAWSON_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Dawson's integral: + * + * Exp[-x^2] Integral[ Exp[t^2], {t,0,x}] + * + * exceptions: GSL_EUNDRFLW; + */ +int gsl_sf_dawson_e(double x, gsl_sf_result * result); +double gsl_sf_dawson(double x); + + +__END_DECLS + +#endif /* __GSL_SF_DAWSON_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_debye.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_debye.h new file mode 100644 index 000000000..bc732b17b --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_debye.h @@ -0,0 +1,91 @@ +/* specfunc/gsl_sf_debye.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ +/* augmented by D_5(x) and D_6(x) by Richard J. Mathar, 2005-11-08 */ + +#ifndef __GSL_SF_DEBYE_H__ +#define __GSL_SF_DEBYE_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* D_n(x) := n/x^n Integrate[t^n/(e^t - 1), {t,0,x}] */ + +/* D_1(x) + * + * exceptions: GSL_EDOM + */ +int gsl_sf_debye_1_e(const double x, gsl_sf_result * result); +double gsl_sf_debye_1(const double x); + + +/* D_2(x) + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_debye_2_e(const double x, gsl_sf_result * result); +double gsl_sf_debye_2(const double x); + + +/* D_3(x) + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_debye_3_e(const double x, gsl_sf_result * result); +double gsl_sf_debye_3(const double x); + + +/* D_4(x) + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_debye_4_e(const double x, gsl_sf_result * result); +double gsl_sf_debye_4(const double x); + +/* D_5(x) + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_debye_5_e(const double x, gsl_sf_result * result); +double gsl_sf_debye_5(const double x); + +/* D_6(x) + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_debye_6_e(const double x, gsl_sf_result * result); +double gsl_sf_debye_6(const double x); + + +__END_DECLS + +#endif /* __GSL_SF_DEBYE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_dilog.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_dilog.h new file mode 100644 index 000000000..79b2b76f5 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_dilog.h @@ -0,0 +1,130 @@ +/* specfunc/gsl_sf_dilog.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_DILOG_H__ +#define __GSL_SF_DILOG_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Real part of DiLogarithm(x), for real argument. + * In Lewin's notation, this is Li_2(x). + * + * Li_2(x) = - Re[ Integrate[ Log[1-s] / s, {s, 0, x}] ] + * + * The function in the complex plane has a branch point + * at z = 1; we place the cut in the conventional way, + * on [1, +infty). This means that the value for real x > 1 + * is a matter of definition; however, this choice does not + * affect the real part and so is not relevant to the + * interpretation of this implemented function. + */ +int gsl_sf_dilog_e(const double x, gsl_sf_result * result); +double gsl_sf_dilog(const double x); + + +/* DiLogarithm(z), for complex argument z = x + i y. + * Computes the principal branch. + * + * Recall that the branch cut is on the real axis with x > 1. + * The imaginary part of the computed value on the cut is given + * by -Pi*log(x), which is the limiting value taken approaching + * from y < 0. This is a conventional choice, though there is no + * true standardized choice. + * + * Note that there is no canonical way to lift the defining + * contour to the full Riemann surface because of the appearance + * of a "hidden branch point" at z = 0 on non-principal sheets. + * Experts will know the simple algebraic prescription for + * obtaining the sheet they want; non-experts will not want + * to know anything about it. This is why GSL chooses to compute + * only on the principal branch. + */ +int +gsl_sf_complex_dilog_xy_e( + const double x, + const double y, + gsl_sf_result * result_re, + gsl_sf_result * result_im + ); + + + +/* DiLogarithm(z), for complex argument z = r Exp[i theta]. + * Computes the principal branch, thereby assuming an + * implicit reduction of theta to the range (-2 pi, 2 pi). + * + * If theta is identically zero, the imaginary part is computed + * as if approaching from y > 0. For other values of theta no + * special consideration is given, since it is assumed that + * no other machine representations of multiples of pi will + * produce y = 0 precisely. This assumption depends on some + * subtle properties of the machine arithmetic, such as + * correct rounding and monotonicity of the underlying + * implementation of sin() and cos(). + * + * This function is ok, but the interface is confusing since + * it makes it appear that the branch structure is resolved. + * Furthermore the handling of values close to the branch + * cut is subtle. Perhap this interface should be deprecated. + */ +int +gsl_sf_complex_dilog_e( + const double r, + const double theta, + gsl_sf_result * result_re, + gsl_sf_result * result_im + ); + + + +/* Spence integral; spence(s) := Li_2(1-s) + * + * This function has a branch point at 0; we place the + * cut on (-infty,0). Because of our choice for the value + * of Li_2(z) on the cut, spence(s) is continuous as + * s approaches the cut from above. In other words, + * we define spence(x) = spence(x + i 0+). + */ +int +gsl_sf_complex_spence_xy_e( + const double x, + const double y, + gsl_sf_result * real_sp, + gsl_sf_result * imag_sp + ); + + +__END_DECLS + +#endif /* __GSL_SF_DILOG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_elementary.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_elementary.h new file mode 100644 index 000000000..467bfdaab --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_elementary.h @@ -0,0 +1,57 @@ +/* specfunc/gsl_sf_elementary.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +/* Miscellaneous elementary functions and operations. + */ +#ifndef __GSL_SF_ELEMENTARY_H__ +#define __GSL_SF_ELEMENTARY_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Multiplication. + * + * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_multiply_e(const double x, const double y, gsl_sf_result * result); +double gsl_sf_multiply(const double x, const double y); + + +/* Multiplication of quantities with associated errors. + */ +int gsl_sf_multiply_err_e(const double x, const double dx, const double y, const double dy, gsl_sf_result * result); + + +__END_DECLS + +#endif /* __GSL_SF_ELEMENTARY_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_ellint.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_ellint.h new file mode 100644 index 000000000..7f68f0e29 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_ellint.h @@ -0,0 +1,112 @@ +/* specfunc/gsl_sf_ellint.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_ELLINT_H__ +#define __GSL_SF_ELLINT_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Legendre form of complete elliptic integrals + * + * K(k) = Integral[1/Sqrt[1 - k^2 Sin[t]^2], {t, 0, Pi/2}] + * E(k) = Integral[ Sqrt[1 - k^2 Sin[t]^2], {t, 0, Pi/2}] + * + * exceptions: GSL_EDOM + */ +int gsl_sf_ellint_Kcomp_e(double k, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_ellint_Kcomp(double k, gsl_mode_t mode); + +int gsl_sf_ellint_Ecomp_e(double k, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_ellint_Ecomp(double k, gsl_mode_t mode); + +int gsl_sf_ellint_Pcomp_e(double k, double n, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_ellint_Pcomp(double k, double n, gsl_mode_t mode); + +int gsl_sf_ellint_Dcomp_e(double k, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_ellint_Dcomp(double k, gsl_mode_t mode); + + +/* Legendre form of incomplete elliptic integrals + * + * F(phi,k) = Integral[1/Sqrt[1 - k^2 Sin[t]^2], {t, 0, phi}] + * E(phi,k) = Integral[ Sqrt[1 - k^2 Sin[t]^2], {t, 0, phi}] + * P(phi,k,n) = Integral[(1 + n Sin[t]^2)^(-1)/Sqrt[1 - k^2 Sin[t]^2], {t, 0, phi}] + * D(phi,k,n) = R_D(1-Sin[phi]^2, 1-k^2 Sin[phi]^2, 1.0) + * + * F: [Carlson, Numerische Mathematik 33 (1979) 1, (4.1)] + * E: [Carlson, ", (4.2)] + * P: [Carlson, ", (4.3)] + * D: [Carlson, ", (4.4)] + * + * exceptions: GSL_EDOM + */ +int gsl_sf_ellint_F_e(double phi, double k, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_ellint_F(double phi, double k, gsl_mode_t mode); + +int gsl_sf_ellint_E_e(double phi, double k, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_ellint_E(double phi, double k, gsl_mode_t mode); + +int gsl_sf_ellint_P_e(double phi, double k, double n, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_ellint_P(double phi, double k, double n, gsl_mode_t mode); + +int gsl_sf_ellint_D_e(double phi, double k, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_ellint_D(double phi, double k, gsl_mode_t mode); + + +/* Carlson's symmetric basis of functions + * + * RC(x,y) = 1/2 Integral[(t+x)^(-1/2) (t+y)^(-1)], {t,0,Inf}] + * RD(x,y,z) = 3/2 Integral[(t+x)^(-1/2) (t+y)^(-1/2) (t+z)^(-3/2), {t,0,Inf}] + * RF(x,y,z) = 1/2 Integral[(t+x)^(-1/2) (t+y)^(-1/2) (t+z)^(-1/2), {t,0,Inf}] + * RJ(x,y,z,p) = 3/2 Integral[(t+x)^(-1/2) (t+y)^(-1/2) (t+z)^(-1/2) (t+p)^(-1), {t,0,Inf}] + * + * exceptions: GSL_EDOM + */ +int gsl_sf_ellint_RC_e(double x, double y, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_ellint_RC(double x, double y, gsl_mode_t mode); + +int gsl_sf_ellint_RD_e(double x, double y, double z, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_ellint_RD(double x, double y, double z, gsl_mode_t mode); + +int gsl_sf_ellint_RF_e(double x, double y, double z, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_ellint_RF(double x, double y, double z, gsl_mode_t mode); + +int gsl_sf_ellint_RJ_e(double x, double y, double z, double p, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_ellint_RJ(double x, double y, double z, double p, gsl_mode_t mode); + + +__END_DECLS + +#endif /* __GSL_SF_ELLINT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_elljac.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_elljac.h new file mode 100644 index 000000000..7f804a5c5 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_elljac.h @@ -0,0 +1,48 @@ +/* specfunc/gsl_sf_elljac.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_ELLJAC_H__ +#define __GSL_SF_ELLJAC_H__ + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Jacobian elliptic functions sn, dn, cn, + * by descending Landen transformations + * + * exceptions: GSL_EDOM + */ +int gsl_sf_elljac_e(double u, double m, double * sn, double * cn, double * dn); + + +__END_DECLS + +#endif /* __GSL_SF_ELLJAC_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_erf.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_erf.h new file mode 100644 index 000000000..a196d0dfe --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_erf.h @@ -0,0 +1,91 @@ +/* specfunc/gsl_sf_erf.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_ERF_H__ +#define __GSL_SF_ERF_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Complementary Error Function + * erfc(x) := 2/Sqrt[Pi] Integrate[Exp[-t^2], {t,x,Infinity}] + * + * exceptions: none + */ +int gsl_sf_erfc_e(double x, gsl_sf_result * result); +double gsl_sf_erfc(double x); + + +/* Log Complementary Error Function + * + * exceptions: none + */ +int gsl_sf_log_erfc_e(double x, gsl_sf_result * result); +double gsl_sf_log_erfc(double x); + + +/* Error Function + * erf(x) := 2/Sqrt[Pi] Integrate[Exp[-t^2], {t,0,x}] + * + * exceptions: none + */ +int gsl_sf_erf_e(double x, gsl_sf_result * result); +double gsl_sf_erf(double x); + + +/* Probability functions: + * Z(x) : Abramowitz+Stegun 26.2.1 + * Q(x) : Abramowitz+Stegun 26.2.3 + * + * exceptions: none + */ +int gsl_sf_erf_Z_e(double x, gsl_sf_result * result); +int gsl_sf_erf_Q_e(double x, gsl_sf_result * result); +double gsl_sf_erf_Z(double x); +double gsl_sf_erf_Q(double x); + + +/* Hazard function, also known as the inverse Mill's ratio. + * + * H(x) := Z(x)/Q(x) + * = Sqrt[2/Pi] Exp[-x^2 / 2] / Erfc[x/Sqrt[2]] + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_hazard_e(double x, gsl_sf_result * result); +double gsl_sf_hazard(double x); + + +__END_DECLS + +#endif /* __GSL_SF_ERF_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_exp.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_exp.h new file mode 100644 index 000000000..8f8aff760 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_exp.h @@ -0,0 +1,134 @@ +/* specfunc/gsl_sf_exp.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_EXP_H__ +#define __GSL_SF_EXP_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* Provide an exp() function with GSL semantics, + * i.e. with proper error checking, etc. + * + * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_exp_e(const double x, gsl_sf_result * result); +double gsl_sf_exp(const double x); + + +/* Exp(x) + * + * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_exp_e10_e(const double x, gsl_sf_result_e10 * result); + + +/* Exponentiate and multiply by a given factor: y * Exp(x) + * + * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_exp_mult_e(const double x, const double y, gsl_sf_result * result); +double gsl_sf_exp_mult(const double x, const double y); + + +/* Exponentiate and multiply by a given factor: y * Exp(x) + * + * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_exp_mult_e10_e(const double x, const double y, gsl_sf_result_e10 * result); + + +/* exp(x)-1 + * + * exceptions: GSL_EOVRFLW + */ +int gsl_sf_expm1_e(const double x, gsl_sf_result * result); +double gsl_sf_expm1(const double x); + + +/* (exp(x)-1)/x = 1 + x/2 + x^2/(2*3) + x^3/(2*3*4) + ... + * + * exceptions: GSL_EOVRFLW + */ +int gsl_sf_exprel_e(const double x, gsl_sf_result * result); +double gsl_sf_exprel(const double x); + + +/* 2(exp(x)-1-x)/x^2 = 1 + x/3 + x^2/(3*4) + x^3/(3*4*5) + ... + * + * exceptions: GSL_EOVRFLW + */ +int gsl_sf_exprel_2_e(double x, gsl_sf_result * result); +double gsl_sf_exprel_2(const double x); + + +/* Similarly for the N-th generalization of + * the above. The so-called N-relative exponential + * + * exprel_N(x) = N!/x^N (exp(x) - Sum[x^k/k!, {k,0,N-1}]) + * = 1 + x/(N+1) + x^2/((N+1)(N+2)) + ... + * = 1F1(1,1+N,x) + */ +int gsl_sf_exprel_n_e(const int n, const double x, gsl_sf_result * result); +double gsl_sf_exprel_n(const int n, const double x); + +int gsl_sf_exprel_n_CF_e(const double n, const double x, gsl_sf_result * result); + + +/* Exponentiate a quantity with an associated error. + */ +int gsl_sf_exp_err_e(const double x, const double dx, gsl_sf_result * result); + +/* Exponentiate a quantity with an associated error. + */ +int gsl_sf_exp_err_e10_e(const double x, const double dx, gsl_sf_result_e10 * result); + + +/* Exponentiate and multiply by a given factor: y * Exp(x), + * for quantities with associated errors. + * + * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_exp_mult_err_e(const double x, const double dx, const double y, const double dy, gsl_sf_result * result); + + +/* Exponentiate and multiply by a given factor: y * Exp(x), + * for quantities with associated errors. + * + * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_exp_mult_err_e10_e(const double x, const double dx, const double y, const double dy, gsl_sf_result_e10 * result); + +__END_DECLS + +#endif /* __GSL_SF_EXP_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_expint.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_expint.h new file mode 100644 index 000000000..4005f72a6 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_expint.h @@ -0,0 +1,167 @@ +/* specfunc/gsl_sf_expint.h + * + * Copyright (C) 2007 Brian Gough + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_EXPINT_H__ +#define __GSL_SF_EXPINT_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* E_1(x) := Re[ Integrate[ Exp[-xt]/t, {t,1,Infinity}] ] + * + * x != 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_expint_E1_e(const double x, gsl_sf_result * result); +double gsl_sf_expint_E1(const double x); + + +/* E_2(x) := Re[ Integrate[ Exp[-xt]/t^2, {t,1,Infinity}] ] + * + * x != 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_expint_E2_e(const double x, gsl_sf_result * result); +double gsl_sf_expint_E2(const double x); + + +/* E_n(x) := Re[ Integrate[ Exp[-xt]/t^n, {t,1,Infinity}] ] + * + * x != 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_expint_En_e(const int n, const double x, gsl_sf_result * result); +double gsl_sf_expint_En(const int n, const double x); + + +/* E_1_scaled(x) := exp(x) E_1(x) + * + * x != 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_expint_E1_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_expint_E1_scaled(const double x); + + +/* E_2_scaled(x) := exp(x) E_2(x) + * + * x != 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_expint_E2_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_expint_E2_scaled(const double x); + +/* E_n_scaled(x) := exp(x) E_n(x) + * + * x != 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_expint_En_scaled_e(const int n, const double x, gsl_sf_result * result); +double gsl_sf_expint_En_scaled(const int n, const double x); + + +/* Ei(x) := - PV Integrate[ Exp[-t]/t, {t,-x,Infinity}] + * := PV Integrate[ Exp[t]/t, {t,-Infinity,x}] + * + * x != 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_expint_Ei_e(const double x, gsl_sf_result * result); +double gsl_sf_expint_Ei(const double x); + + +/* Ei_scaled(x) := exp(-x) Ei(x) + * + * x != 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_expint_Ei_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_expint_Ei_scaled(const double x); + + +/* Shi(x) := Integrate[ Sinh[t]/t, {t,0,x}] + * + * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_Shi_e(const double x, gsl_sf_result * result); +double gsl_sf_Shi(const double x); + + +/* Chi(x) := Re[ M_EULER + log(x) + Integrate[(Cosh[t]-1)/t, {t,0,x}] ] + * + * x != 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_Chi_e(const double x, gsl_sf_result * result); +double gsl_sf_Chi(const double x); + + +/* Ei_3(x) := Integral[ Exp[-t^3], {t,0,x}] + * + * x >= 0.0 + * exceptions: GSL_EDOM + */ +int gsl_sf_expint_3_e(const double x, gsl_sf_result * result); +double gsl_sf_expint_3(double x); + + +/* Si(x) := Integrate[ Sin[t]/t, {t,0,x}] + * + * exceptions: none + */ +int gsl_sf_Si_e(const double x, gsl_sf_result * result); +double gsl_sf_Si(const double x); + + +/* Ci(x) := -Integrate[ Cos[t]/t, {t,x,Infinity}] + * + * x > 0.0 + * exceptions: GSL_EDOM + */ +int gsl_sf_Ci_e(const double x, gsl_sf_result * result); +double gsl_sf_Ci(const double x); + + +/* AtanInt(x) := Integral[ Arctan[t]/t, {t,0,x}] + * + * + * exceptions: + */ +int gsl_sf_atanint_e(const double x, gsl_sf_result * result); +double gsl_sf_atanint(const double x); + + +__END_DECLS + +#endif /* __GSL_SF_EXPINT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_fermi_dirac.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_fermi_dirac.h new file mode 100644 index 000000000..8f708cd2b --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_fermi_dirac.h @@ -0,0 +1,126 @@ +/* specfunc/gsl_sf_fermi_dirac.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_FERMI_DIRAC_H__ +#define __GSL_SF_FERMI_DIRAC_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Complete Fermi-Dirac Integrals: + * + * F_j(x) := 1/Gamma[j+1] Integral[ t^j /(Exp[t-x] + 1), {t,0,Infinity}] + * + * + * Incomplete Fermi-Dirac Integrals: + * + * F_j(x,b) := 1/Gamma[j+1] Integral[ t^j /(Exp[t-x] + 1), {t,b,Infinity}] + */ + + +/* Complete integral F_{-1}(x) = e^x / (1 + e^x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_fermi_dirac_m1_e(const double x, gsl_sf_result * result); +double gsl_sf_fermi_dirac_m1(const double x); + + +/* Complete integral F_0(x) = ln(1 + e^x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_fermi_dirac_0_e(const double x, gsl_sf_result * result); +double gsl_sf_fermi_dirac_0(const double x); + + +/* Complete integral F_1(x) + * + * exceptions: GSL_EUNDRFLW, GSL_EOVRFLW + */ +int gsl_sf_fermi_dirac_1_e(const double x, gsl_sf_result * result); +double gsl_sf_fermi_dirac_1(const double x); + + +/* Complete integral F_2(x) + * + * exceptions: GSL_EUNDRFLW, GSL_EOVRFLW + */ +int gsl_sf_fermi_dirac_2_e(const double x, gsl_sf_result * result); +double gsl_sf_fermi_dirac_2(const double x); + + +/* Complete integral F_j(x) + * for integer j + * + * exceptions: GSL_EUNDRFLW, GSL_EOVRFLW + */ +int gsl_sf_fermi_dirac_int_e(const int j, const double x, gsl_sf_result * result); +double gsl_sf_fermi_dirac_int(const int j, const double x); + + +/* Complete integral F_{-1/2}(x) + * + * exceptions: GSL_EUNDRFLW, GSL_EOVRFLW + */ +int gsl_sf_fermi_dirac_mhalf_e(const double x, gsl_sf_result * result); +double gsl_sf_fermi_dirac_mhalf(const double x); + + +/* Complete integral F_{1/2}(x) + * + * exceptions: GSL_EUNDRFLW, GSL_EOVRFLW + */ +int gsl_sf_fermi_dirac_half_e(const double x, gsl_sf_result * result); +double gsl_sf_fermi_dirac_half(const double x); + + +/* Complete integral F_{3/2}(x) + * + * exceptions: GSL_EUNDRFLW, GSL_EOVRFLW + */ +int gsl_sf_fermi_dirac_3half_e(const double x, gsl_sf_result * result); +double gsl_sf_fermi_dirac_3half(const double x); + + +/* Incomplete integral F_0(x,b) = ln(1 + e^(b-x)) - (b-x) + * + * exceptions: GSL_EUNDRFLW, GSL_EDOM + */ +int gsl_sf_fermi_dirac_inc_0_e(const double x, const double b, gsl_sf_result * result); +double gsl_sf_fermi_dirac_inc_0(const double x, const double b); + + +__END_DECLS + +#endif /* __GSL_SF_FERMI_DIRAC_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_gamma.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_gamma.h new file mode 100644 index 000000000..d5e867ba6 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_gamma.h @@ -0,0 +1,293 @@ +/* specfunc/gsl_sf_gamma.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_GAMMA_H__ +#define __GSL_SF_GAMMA_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Log[Gamma(x)], x not a negative integer + * Uses real Lanczos method. + * Returns the real part of Log[Gamma[x]] when x < 0, + * i.e. Log[|Gamma[x]|]. + * + * exceptions: GSL_EDOM, GSL_EROUND + */ +int gsl_sf_lngamma_e(double x, gsl_sf_result * result); +double gsl_sf_lngamma(const double x); + + +/* Log[Gamma(x)], x not a negative integer + * Uses real Lanczos method. Determines + * the sign of Gamma[x] as well as Log[|Gamma[x]|] for x < 0. + * So Gamma[x] = sgn * Exp[result_lg]. + * + * exceptions: GSL_EDOM, GSL_EROUND + */ +int gsl_sf_lngamma_sgn_e(double x, gsl_sf_result * result_lg, double *sgn); + + +/* Gamma(x), x not a negative integer + * Uses real Lanczos method. + * + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EROUND + */ +int gsl_sf_gamma_e(const double x, gsl_sf_result * result); +double gsl_sf_gamma(const double x); + + +/* Regulated Gamma Function, x > 0 + * Gamma^*(x) = Gamma(x)/(Sqrt[2Pi] x^(x-1/2) exp(-x)) + * = (1 + 1/(12x) + ...), x->Inf + * A useful suggestion of Temme. + * + * exceptions: GSL_EDOM + */ +int gsl_sf_gammastar_e(const double x, gsl_sf_result * result); +double gsl_sf_gammastar(const double x); + + +/* 1/Gamma(x) + * Uses real Lanczos method. + * + * exceptions: GSL_EUNDRFLW, GSL_EROUND + */ +int gsl_sf_gammainv_e(const double x, gsl_sf_result * result); +double gsl_sf_gammainv(const double x); + + +/* Log[Gamma(z)] for z complex, z not a negative integer + * Uses complex Lanczos method. Note that the phase part (arg) + * is not well-determined when |z| is very large, due + * to inevitable roundoff in restricting to (-Pi,Pi]. + * This will raise the GSL_ELOSS exception when it occurs. + * The absolute value part (lnr), however, never suffers. + * + * Calculates: + * lnr = log|Gamma(z)| + * arg = arg(Gamma(z)) in (-Pi, Pi] + * + * exceptions: GSL_EDOM, GSL_ELOSS + */ +int gsl_sf_lngamma_complex_e(double zr, double zi, gsl_sf_result * lnr, gsl_sf_result * arg); + + +/* x^n / n! + * + * x >= 0.0, n >= 0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_taylorcoeff_e(const int n, const double x, gsl_sf_result * result); +double gsl_sf_taylorcoeff(const int n, const double x); + + +/* n! + * + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_fact_e(const unsigned int n, gsl_sf_result * result); +double gsl_sf_fact(const unsigned int n); + + +/* n!! = n(n-2)(n-4) ... + * + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_doublefact_e(const unsigned int n, gsl_sf_result * result); +double gsl_sf_doublefact(const unsigned int n); + + +/* log(n!) + * Faster than ln(Gamma(n+1)) for n < 170; defers for larger n. + * + * exceptions: none + */ +int gsl_sf_lnfact_e(const unsigned int n, gsl_sf_result * result); +double gsl_sf_lnfact(const unsigned int n); + + +/* log(n!!) + * + * exceptions: none + */ +int gsl_sf_lndoublefact_e(const unsigned int n, gsl_sf_result * result); +double gsl_sf_lndoublefact(const unsigned int n); + + +/* log(n choose m) + * + * exceptions: GSL_EDOM + */ +int gsl_sf_lnchoose_e(unsigned int n, unsigned int m, gsl_sf_result * result); +double gsl_sf_lnchoose(unsigned int n, unsigned int m); + + +/* n choose m + * + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_choose_e(unsigned int n, unsigned int m, gsl_sf_result * result); +double gsl_sf_choose(unsigned int n, unsigned int m); + + +/* Logarithm of Pochhammer (Apell) symbol + * log( (a)_x ) + * where (a)_x := Gamma[a + x]/Gamma[a] + * + * a > 0, a+x > 0 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_lnpoch_e(const double a, const double x, gsl_sf_result * result); +double gsl_sf_lnpoch(const double a, const double x); + + +/* Logarithm of Pochhammer (Apell) symbol, with sign information. + * result = log( |(a)_x| ) + * sgn = sgn( (a)_x ) + * where (a)_x := Gamma[a + x]/Gamma[a] + * + * a != neg integer, a+x != neg integer + * + * exceptions: GSL_EDOM + */ +int gsl_sf_lnpoch_sgn_e(const double a, const double x, gsl_sf_result * result, double * sgn); + + +/* Pochhammer (Apell) symbol + * (a)_x := Gamma[a + x]/Gamma[x] + * + * a != neg integer, a+x != neg integer + * + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_poch_e(const double a, const double x, gsl_sf_result * result); +double gsl_sf_poch(const double a, const double x); + + +/* Relative Pochhammer (Apell) symbol + * ((a,x) - 1)/x + * where (a,x) = (a)_x := Gamma[a + x]/Gamma[a] + * + * exceptions: GSL_EDOM + */ +int gsl_sf_pochrel_e(const double a, const double x, gsl_sf_result * result); +double gsl_sf_pochrel(const double a, const double x); + + +/* Normalized Incomplete Gamma Function + * + * Q(a,x) = 1/Gamma(a) Integral[ t^(a-1) e^(-t), {t,x,Infinity} ] + * + * a >= 0, x >= 0 + * Q(a,0) := 1 + * Q(0,x) := 0, x != 0 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_gamma_inc_Q_e(const double a, const double x, gsl_sf_result * result); +double gsl_sf_gamma_inc_Q(const double a, const double x); + + +/* Complementary Normalized Incomplete Gamma Function + * + * P(a,x) = 1/Gamma(a) Integral[ t^(a-1) e^(-t), {t,0,x} ] + * + * a > 0, x >= 0 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_gamma_inc_P_e(const double a, const double x, gsl_sf_result * result); +double gsl_sf_gamma_inc_P(const double a, const double x); + + +/* Non-normalized Incomplete Gamma Function + * + * Gamma(a,x) := Integral[ t^(a-1) e^(-t), {t,x,Infinity} ] + * + * x >= 0.0 + * Gamma(a, 0) := Gamma(a) + * + * exceptions: GSL_EDOM + */ +int gsl_sf_gamma_inc_e(const double a, const double x, gsl_sf_result * result); +double gsl_sf_gamma_inc(const double a, const double x); + + +/* Logarithm of Beta Function + * Log[B(a,b)] + * + * a > 0, b > 0 + * exceptions: GSL_EDOM + */ +int gsl_sf_lnbeta_e(const double a, const double b, gsl_sf_result * result); +double gsl_sf_lnbeta(const double a, const double b); + +int gsl_sf_lnbeta_sgn_e(const double x, const double y, gsl_sf_result * result, double * sgn); + + +/* Beta Function + * B(a,b) + * + * a > 0, b > 0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_beta_e(const double a, const double b, gsl_sf_result * result); +double gsl_sf_beta(const double a, const double b); + + +/* Normalized Incomplete Beta Function + * B_x(a,b)/B(a,b) + * + * a > 0, b > 0, 0 <= x <= 1 + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_beta_inc_e(const double a, const double b, const double x, gsl_sf_result * result); +double gsl_sf_beta_inc(const double a, const double b, const double x); + + +/* The maximum x such that gamma(x) is not + * considered an overflow. + */ +#define GSL_SF_GAMMA_XMAX 171.0 + +/* The maximum n such that gsl_sf_fact(n) does not give an overflow. */ +#define GSL_SF_FACT_NMAX 170 + +/* The maximum n such that gsl_sf_doublefact(n) does not give an overflow. */ +#define GSL_SF_DOUBLEFACT_NMAX 297 + +__END_DECLS + +#endif /* __GSL_SF_GAMMA_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_gegenbauer.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_gegenbauer.h new file mode 100644 index 000000000..bf41d218e --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_gegenbauer.h @@ -0,0 +1,73 @@ +/* specfunc/gsl_sf_gegenbauer.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_GEGENBAUER_H__ +#define __GSL_SF_GEGENBAUER_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Evaluate Gegenbauer polynomials + * using explicit representations. + * + * exceptions: none + */ +int gsl_sf_gegenpoly_1_e(double lambda, double x, gsl_sf_result * result); +int gsl_sf_gegenpoly_2_e(double lambda, double x, gsl_sf_result * result); +int gsl_sf_gegenpoly_3_e(double lambda, double x, gsl_sf_result * result); +double gsl_sf_gegenpoly_1(double lambda, double x); +double gsl_sf_gegenpoly_2(double lambda, double x); +double gsl_sf_gegenpoly_3(double lambda, double x); + + +/* Evaluate Gegenbauer polynomials. + * + * lambda > -1/2, n >= 0 + * exceptions: GSL_EDOM + */ +int gsl_sf_gegenpoly_n_e(int n, double lambda, double x, gsl_sf_result * result); +double gsl_sf_gegenpoly_n(int n, double lambda, double x); + + +/* Calculate array of Gegenbauer polynomials + * for n = (0, 1, 2, ... nmax) + * + * lambda > -1/2, nmax >= 0 + * exceptions: GSL_EDOM + */ +int gsl_sf_gegenpoly_array(int nmax, double lambda, double x, double * result_array); + + +__END_DECLS + +#endif /* __GSL_SF_GEGENBAUER_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_hermite.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_hermite.h new file mode 100644 index 000000000..391b959e8 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_hermite.h @@ -0,0 +1,75 @@ +/* gsl_sf_hermite.h + * + * Copyright (C) 2011-2014 Konrad Griessinger + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/*----------------------------------------------------------------------* + * (konradg(at)gmx.net) * + *----------------------------------------------------------------------*/ + +#ifndef __GSL_SF_HERMITE_H__ +#define __GSL_SF_HERMITE_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_sf_hermite_prob_e(const int n, const double x, gsl_sf_result * result); +double gsl_sf_hermite_prob(const int n, const double x); +int gsl_sf_hermite_prob_der_e(const int m, const int n, const double x, gsl_sf_result * result); +double gsl_sf_hermite_prob_der(const int m, const int n, const double x); +int gsl_sf_hermite_phys_e(const int n, const double x, gsl_sf_result * result); +double gsl_sf_hermite_phys(const int n, const double x); +int gsl_sf_hermite_phys_der_e(const int m, const int n, const double x, gsl_sf_result * result); +double gsl_sf_hermite_phys_der(const int m, const int n, const double x); +int gsl_sf_hermite_func_e(const int n, const double x, gsl_sf_result * result); +double gsl_sf_hermite_func(const int n, const double x); +int gsl_sf_hermite_prob_array(const int nmax, const double x, double * result_array); +int gsl_sf_hermite_prob_array_der(const int m, const int nmax, const double x, double * result_array); +int gsl_sf_hermite_prob_der_array(const int mmax, const int n, const double x, double * result_array); +int gsl_sf_hermite_prob_series_e(const int n, const double x, const double * a, gsl_sf_result * result); +double gsl_sf_hermite_prob_series(const int n, const double x, const double * a); +int gsl_sf_hermite_phys_array(const int nmax, const double x, double * result_array); +int gsl_sf_hermite_phys_array_der(const int m, const int nmax, const double x, double * result_array); +int gsl_sf_hermite_phys_der_array(const int mmax, const int n, const double x, double * result_array); +int gsl_sf_hermite_phys_series_e(const int n, const double x, const double * a, gsl_sf_result * result); +double gsl_sf_hermite_phys_series(const int n, const double x, const double * a); +int gsl_sf_hermite_func_array(const int nmax, const double x, double * result_array); +int gsl_sf_hermite_func_series_e(const int n, const double x, const double * a, gsl_sf_result * result); +double gsl_sf_hermite_func_series(const int n, const double x, const double * a); +int gsl_sf_hermite_func_der_e(const int m, const int n, const double x, gsl_sf_result * result); +double gsl_sf_hermite_func_der(const int m, const int n, const double x); +int gsl_sf_hermite_prob_zero_e(const int n, const int s, gsl_sf_result * result); +double gsl_sf_hermite_prob_zero(const int n, const int s); +int gsl_sf_hermite_phys_zero_e(const int n, const int s, gsl_sf_result * result); +double gsl_sf_hermite_phys_zero(const int n, const int s); +int gsl_sf_hermite_func_zero_e(const int n, const int s, gsl_sf_result * result); +double gsl_sf_hermite_func_zero(const int n, const int s); + +__END_DECLS + +#endif /* __GSL_SF_HERMITE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_hyperg.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_hyperg.h new file mode 100644 index 000000000..8366b88d0 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_hyperg.h @@ -0,0 +1,154 @@ +/* specfunc/gsl_sf_hyperg.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_HYPERG_H__ +#define __GSL_SF_HYPERG_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Hypergeometric function related to Bessel functions + * 0F1[c,x] = + * Gamma[c] x^(1/2(1-c)) I_{c-1}(2 Sqrt[x]) + * Gamma[c] (-x)^(1/2(1-c)) J_{c-1}(2 Sqrt[-x]) + * + * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_hyperg_0F1_e(double c, double x, gsl_sf_result * result); +double gsl_sf_hyperg_0F1(const double c, const double x); + + +/* Confluent hypergeometric function for integer parameters. + * 1F1[m,n,x] = M(m,n,x) + * + * exceptions: + */ +int gsl_sf_hyperg_1F1_int_e(const int m, const int n, const double x, gsl_sf_result * result); +double gsl_sf_hyperg_1F1_int(const int m, const int n, double x); + + +/* Confluent hypergeometric function. + * 1F1[a,b,x] = M(a,b,x) + * + * exceptions: + */ +int gsl_sf_hyperg_1F1_e(const double a, const double b, const double x, gsl_sf_result * result); +double gsl_sf_hyperg_1F1(double a, double b, double x); + + +/* Confluent hypergeometric function for integer parameters. + * U(m,n,x) + * + * exceptions: + */ +int gsl_sf_hyperg_U_int_e(const int m, const int n, const double x, gsl_sf_result * result); +double gsl_sf_hyperg_U_int(const int m, const int n, const double x); + + +/* Confluent hypergeometric function for integer parameters. + * U(m,n,x) + * + * exceptions: + */ +int gsl_sf_hyperg_U_int_e10_e(const int m, const int n, const double x, gsl_sf_result_e10 * result); + + +/* Confluent hypergeometric function. + * U(a,b,x) + * + * exceptions: + */ +int gsl_sf_hyperg_U_e(const double a, const double b, const double x, gsl_sf_result * result); +double gsl_sf_hyperg_U(const double a, const double b, const double x); + + +/* Confluent hypergeometric function. + * U(a,b,x) + * + * exceptions: + */ +int gsl_sf_hyperg_U_e10_e(const double a, const double b, const double x, gsl_sf_result_e10 * result); + + +/* Gauss hypergeometric function 2F1[a,b,c,x] + * |x| < 1 + * + * exceptions: + */ +int gsl_sf_hyperg_2F1_e(double a, double b, const double c, const double x, gsl_sf_result * result); +double gsl_sf_hyperg_2F1(double a, double b, double c, double x); + + +/* Gauss hypergeometric function + * 2F1[aR + I aI, aR - I aI, c, x] + * |x| < 1 + * + * exceptions: + */ +int gsl_sf_hyperg_2F1_conj_e(const double aR, const double aI, const double c, const double x, gsl_sf_result * result); +double gsl_sf_hyperg_2F1_conj(double aR, double aI, double c, double x); + + +/* Renormalized Gauss hypergeometric function + * 2F1[a,b,c,x] / Gamma[c] + * |x| < 1 + * + * exceptions: + */ +int gsl_sf_hyperg_2F1_renorm_e(const double a, const double b, const double c, const double x, gsl_sf_result * result); +double gsl_sf_hyperg_2F1_renorm(double a, double b, double c, double x); + + +/* Renormalized Gauss hypergeometric function + * 2F1[aR + I aI, aR - I aI, c, x] / Gamma[c] + * |x| < 1 + * + * exceptions: + */ +int gsl_sf_hyperg_2F1_conj_renorm_e(const double aR, const double aI, const double c, const double x, gsl_sf_result * result); +double gsl_sf_hyperg_2F1_conj_renorm(double aR, double aI, double c, double x); + + +/* Mysterious hypergeometric function. The series representation + * is a divergent hypergeometric series. However, for x < 0 we + * have 2F0(a,b,x) = (-1/x)^a U(a,1+a-b,-1/x) + * + * exceptions: GSL_EDOM + */ +int gsl_sf_hyperg_2F0_e(const double a, const double b, const double x, gsl_sf_result * result); +double gsl_sf_hyperg_2F0(const double a, const double b, const double x); + + +__END_DECLS + +#endif /* __GSL_SF_HYPERG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_laguerre.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_laguerre.h new file mode 100644 index 000000000..0d7f1c370 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_laguerre.h @@ -0,0 +1,68 @@ +/* specfunc/gsl_sf_laguerre.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_LAGUERRE_H__ +#define __GSL_SF_LAGUERRE_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* L^a_n(x) = (a+1)_n / n! 1F1(-n,a+1,x) */ + + +/* Evaluate generalized Laguerre polynomials + * using explicit representations. + * + * exceptions: none + */ +int gsl_sf_laguerre_1_e(const double a, const double x, gsl_sf_result * result); +int gsl_sf_laguerre_2_e(const double a, const double x, gsl_sf_result * result); +int gsl_sf_laguerre_3_e(const double a, const double x, gsl_sf_result * result); +double gsl_sf_laguerre_1(double a, double x); +double gsl_sf_laguerre_2(double a, double x); +double gsl_sf_laguerre_3(double a, double x); + + +/* Evaluate generalized Laguerre polynomials. + * + * a > -1.0 + * n >= 0 + * exceptions: GSL_EDOM + */ +int gsl_sf_laguerre_n_e(const int n, const double a, const double x, gsl_sf_result * result); +double gsl_sf_laguerre_n(int n, double a, double x); + + +__END_DECLS + +#endif /* __GSL_SF_LAGUERRE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_lambert.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_lambert.h new file mode 100644 index 000000000..53b70a3a3 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_lambert.h @@ -0,0 +1,69 @@ +/* specfunc/gsl_sf_lambert.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_LAMBERT_H__ +#define __GSL_SF_LAMBERT_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Lambert's Function W_0(x) + * + * W_0(x) is the principal branch of the + * implicit function defined by W e^W = x. + * + * -1/E < x < \infty + * + * exceptions: GSL_EMAXITER; + */ +int gsl_sf_lambert_W0_e(double x, gsl_sf_result * result); +double gsl_sf_lambert_W0(double x); + + +/* Lambert's Function W_{-1}(x) + * + * W_{-1}(x) is the second real branch of the + * implicit function defined by W e^W = x. + * It agrees with W_0(x) when x >= 0. + * + * -1/E < x < \infty + * + * exceptions: GSL_MAXITER; + */ +int gsl_sf_lambert_Wm1_e(double x, gsl_sf_result * result); +double gsl_sf_lambert_Wm1(double x); + + +__END_DECLS + +#endif /* __GSL_SF_LAMBERT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_legendre.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_legendre.h new file mode 100644 index 000000000..a7a4b070b --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_legendre.h @@ -0,0 +1,375 @@ +/* specfunc/gsl_sf_legendre.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_LEGENDRE_H__ +#define __GSL_SF_LEGENDRE_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* P_l(x) l >= 0; |x| <= 1 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_legendre_Pl_e(const int l, const double x, gsl_sf_result * result); +double gsl_sf_legendre_Pl(const int l, const double x); + + +/* P_l(x) for l=0,...,lmax; |x| <= 1 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_legendre_Pl_array( + const int lmax, const double x, + double * result_array + ); + + +/* P_l(x) and P_l'(x) for l=0,...,lmax; |x| <= 1 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_legendre_Pl_deriv_array( + const int lmax, const double x, + double * result_array, + double * result_deriv_array + ); + + +/* P_l(x), l=1,2,3 + * + * exceptions: none + */ +int gsl_sf_legendre_P1_e(double x, gsl_sf_result * result); +int gsl_sf_legendre_P2_e(double x, gsl_sf_result * result); +int gsl_sf_legendre_P3_e(double x, gsl_sf_result * result); +double gsl_sf_legendre_P1(const double x); +double gsl_sf_legendre_P2(const double x); +double gsl_sf_legendre_P3(const double x); + + +/* Q_0(x), x > -1, x != 1 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_legendre_Q0_e(const double x, gsl_sf_result * result); +double gsl_sf_legendre_Q0(const double x); + + +/* Q_1(x), x > -1, x != 1 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_legendre_Q1_e(const double x, gsl_sf_result * result); +double gsl_sf_legendre_Q1(const double x); + + +/* Q_l(x), x > -1, x != 1, l >= 0 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_legendre_Ql_e(const int l, const double x, gsl_sf_result * result); +double gsl_sf_legendre_Ql(const int l, const double x); + + +/* P_l^m(x) m >= 0; l >= m; |x| <= 1.0 + * + * Note that this function grows combinatorially with l. + * Therefore we can easily generate an overflow for l larger + * than about 150. + * + * There is no trouble for small m, but when m and l are both large, + * then there will be trouble. Rather than allow overflows, these + * functions refuse to calculate when they can sense that l and m are + * too big. + * + * If you really want to calculate a spherical harmonic, then DO NOT + * use this. Instead use legendre_sphPlm() below, which uses a similar + * recursion, but with the normalized functions. + * + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_legendre_Plm_e(const int l, const int m, const double x, gsl_sf_result * result); +double gsl_sf_legendre_Plm(const int l, const int m, const double x); + + +/* P_l^m(x) m >= 0; l >= m; |x| <= 1.0 + * l=|m|,...,lmax + * + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_legendre_Plm_array( + const int lmax, const int m, const double x, + double * result_array + ); + + +/* P_l^m(x) and d(P_l^m(x))/dx; m >= 0; lmax >= m; |x| <= 1.0 + * l=|m|,...,lmax + * + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_legendre_Plm_deriv_array( + const int lmax, const int m, const double x, + double * result_array, + double * result_deriv_array + ); + + +/* P_l^m(x), normalized properly for use in spherical harmonics + * m >= 0; l >= m; |x| <= 1.0 + * + * There is no overflow problem, as there is for the + * standard normalization of P_l^m(x). + * + * Specifically, it returns: + * + * sqrt((2l+1)/(4pi)) sqrt((l-m)!/(l+m)!) P_l^m(x) + * + * exceptions: GSL_EDOM + */ +int gsl_sf_legendre_sphPlm_e(const int l, int m, const double x, gsl_sf_result * result); +double gsl_sf_legendre_sphPlm(const int l, const int m, const double x); + + +/* sphPlm(l,m,x) values + * m >= 0; l >= m; |x| <= 1.0 + * l=|m|,...,lmax + * + * exceptions: GSL_EDOM + */ +int gsl_sf_legendre_sphPlm_array( + const int lmax, int m, const double x, + double * result_array + ); + + +/* sphPlm(l,m,x) and d(sphPlm(l,m,x))/dx values + * m >= 0; l >= m; |x| <= 1.0 + * l=|m|,...,lmax + * + * exceptions: GSL_EDOM + */ +int gsl_sf_legendre_sphPlm_deriv_array( + const int lmax, const int m, const double x, + double * result_array, + double * result_deriv_array + ); + + + +/* size of result_array[] needed for the array versions of Plm + * (lmax - m + 1) + */ +int gsl_sf_legendre_array_size(const int lmax, const int m); + +/* Irregular Spherical Conical Function + * P^{1/2}_{-1/2 + I lambda}(x) + * + * x > -1.0 + * exceptions: GSL_EDOM + */ +int gsl_sf_conicalP_half_e(const double lambda, const double x, gsl_sf_result * result); +double gsl_sf_conicalP_half(const double lambda, const double x); + + +/* Regular Spherical Conical Function + * P^{-1/2}_{-1/2 + I lambda}(x) + * + * x > -1.0 + * exceptions: GSL_EDOM + */ +int gsl_sf_conicalP_mhalf_e(const double lambda, const double x, gsl_sf_result * result); +double gsl_sf_conicalP_mhalf(const double lambda, const double x); + + +/* Conical Function + * P^{0}_{-1/2 + I lambda}(x) + * + * x > -1.0 + * exceptions: GSL_EDOM + */ +int gsl_sf_conicalP_0_e(const double lambda, const double x, gsl_sf_result * result); +double gsl_sf_conicalP_0(const double lambda, const double x); + + +/* Conical Function + * P^{1}_{-1/2 + I lambda}(x) + * + * x > -1.0 + * exceptions: GSL_EDOM + */ +int gsl_sf_conicalP_1_e(const double lambda, const double x, gsl_sf_result * result); +double gsl_sf_conicalP_1(const double lambda, const double x); + + +/* Regular Spherical Conical Function + * P^{-1/2-l}_{-1/2 + I lambda}(x) + * + * x > -1.0, l >= -1 + * exceptions: GSL_EDOM + */ +int gsl_sf_conicalP_sph_reg_e(const int l, const double lambda, const double x, gsl_sf_result * result); +double gsl_sf_conicalP_sph_reg(const int l, const double lambda, const double x); + + +/* Regular Cylindrical Conical Function + * P^{-m}_{-1/2 + I lambda}(x) + * + * x > -1.0, m >= -1 + * exceptions: GSL_EDOM + */ +int gsl_sf_conicalP_cyl_reg_e(const int m, const double lambda, const double x, gsl_sf_result * result); +double gsl_sf_conicalP_cyl_reg(const int m, const double lambda, const double x); + + +/* The following spherical functions are specializations + * of Legendre functions which give the regular eigenfunctions + * of the Laplacian on a 3-dimensional hyperbolic space. + * Of particular interest is the flat limit, which is + * Flat-Lim := {lambda->Inf, eta->0, lambda*eta fixed}. + */ + +/* Zeroth radial eigenfunction of the Laplacian on the + * 3-dimensional hyperbolic space. + * + * legendre_H3d_0(lambda,eta) := sin(lambda*eta)/(lambda*sinh(eta)) + * + * Normalization: + * Flat-Lim legendre_H3d_0(lambda,eta) = j_0(lambda*eta) + * + * eta >= 0.0 + * exceptions: GSL_EDOM + */ +int gsl_sf_legendre_H3d_0_e(const double lambda, const double eta, gsl_sf_result * result); +double gsl_sf_legendre_H3d_0(const double lambda, const double eta); + + +/* First radial eigenfunction of the Laplacian on the + * 3-dimensional hyperbolic space. + * + * legendre_H3d_1(lambda,eta) := + * 1/sqrt(lambda^2 + 1) sin(lam eta)/(lam sinh(eta)) + * (coth(eta) - lambda cot(lambda*eta)) + * + * Normalization: + * Flat-Lim legendre_H3d_1(lambda,eta) = j_1(lambda*eta) + * + * eta >= 0.0 + * exceptions: GSL_EDOM + */ +int gsl_sf_legendre_H3d_1_e(const double lambda, const double eta, gsl_sf_result * result); +double gsl_sf_legendre_H3d_1(const double lambda, const double eta); + + +/* l'th radial eigenfunction of the Laplacian on the + * 3-dimensional hyperbolic space. + * + * Normalization: + * Flat-Lim legendre_H3d_l(l,lambda,eta) = j_l(lambda*eta) + * + * eta >= 0.0, l >= 0 + * exceptions: GSL_EDOM + */ +int gsl_sf_legendre_H3d_e(const int l, const double lambda, const double eta, gsl_sf_result * result); +double gsl_sf_legendre_H3d(const int l, const double lambda, const double eta); + + +/* Array of H3d(ell), 0 <= ell <= lmax + */ +int gsl_sf_legendre_H3d_array(const int lmax, const double lambda, const double eta, double * result_array); + +/* associated legendre P_{lm} routines */ + +typedef enum +{ + GSL_SF_LEGENDRE_SCHMIDT, + GSL_SF_LEGENDRE_SPHARM, + GSL_SF_LEGENDRE_FULL, + GSL_SF_LEGENDRE_NONE +} gsl_sf_legendre_t; + +int gsl_sf_legendre_array(const gsl_sf_legendre_t norm, + const size_t lmax, const double x, + double result_array[]); +int gsl_sf_legendre_array_e(const gsl_sf_legendre_t norm, + const size_t lmax, const double x, + const double csphase, + double result_array[]); +int gsl_sf_legendre_deriv_array(const gsl_sf_legendre_t norm, + const size_t lmax, const double x, + double result_array[], + double result_deriv_array[]); +int gsl_sf_legendre_deriv_array_e(const gsl_sf_legendre_t norm, + const size_t lmax, const double x, + const double csphase, + double result_array[], + double result_deriv_array[]); +int gsl_sf_legendre_deriv_alt_array(const gsl_sf_legendre_t norm, + const size_t lmax, const double x, + double result_array[], + double result_deriv_array[]); +int gsl_sf_legendre_deriv_alt_array_e(const gsl_sf_legendre_t norm, + const size_t lmax, const double x, + const double csphase, + double result_array[], + double result_deriv_array[]); +int gsl_sf_legendre_deriv2_array(const gsl_sf_legendre_t norm, + const size_t lmax, const double x, + double result_array[], + double result_deriv_array[], + double result_deriv2_array[]); +int gsl_sf_legendre_deriv2_array_e(const gsl_sf_legendre_t norm, + const size_t lmax, const double x, + const double csphase, + double result_array[], + double result_deriv_array[], + double result_deriv2_array[]); +int gsl_sf_legendre_deriv2_alt_array(const gsl_sf_legendre_t norm, + const size_t lmax, const double x, + double result_array[], + double result_deriv_array[], + double result_deriv2_array[]); +int gsl_sf_legendre_deriv2_alt_array_e(const gsl_sf_legendre_t norm, + const size_t lmax, const double x, + const double csphase, + double result_array[], + double result_deriv_array[], + double result_deriv2_array[]); +size_t gsl_sf_legendre_array_n(const size_t lmax); +size_t gsl_sf_legendre_array_index(const size_t l, const size_t m); +size_t gsl_sf_legendre_nlm(const size_t lmax); + +__END_DECLS + +#endif /* __GSL_SF_LEGENDRE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_log.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_log.h new file mode 100644 index 000000000..92aa68574 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_log.h @@ -0,0 +1,82 @@ +/* specfunc/gsl_sf_log.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_LOG_H__ +#define __GSL_SF_LOG_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Provide a logarithm function with GSL semantics. + * + * exceptions: GSL_EDOM + */ +int gsl_sf_log_e(const double x, gsl_sf_result * result); +double gsl_sf_log(const double x); + + +/* Log(|x|) + * + * exceptions: GSL_EDOM + */ +int gsl_sf_log_abs_e(const double x, gsl_sf_result * result); +double gsl_sf_log_abs(const double x); + + +/* Complex Logarithm + * exp(lnr + I theta) = zr + I zi + * Returns argument in [-pi,pi]. + * + * exceptions: GSL_EDOM + */ +int gsl_sf_complex_log_e(const double zr, const double zi, gsl_sf_result * lnr, gsl_sf_result * theta); + + +/* Log(1 + x) + * + * exceptions: GSL_EDOM + */ +int gsl_sf_log_1plusx_e(const double x, gsl_sf_result * result); +double gsl_sf_log_1plusx(const double x); + + +/* Log(1 + x) - x + * + * exceptions: GSL_EDOM + */ +int gsl_sf_log_1plusx_mx_e(const double x, gsl_sf_result * result); +double gsl_sf_log_1plusx_mx(const double x); + +__END_DECLS + +#endif /* __GSL_SF_LOG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_mathieu.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_mathieu.h new file mode 100644 index 000000000..8dc8d14e8 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_mathieu.h @@ -0,0 +1,113 @@ +/* specfunc/gsl_sf_mathieu.h + * + * Copyright (C) 2002 Lowell Johnson + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* Author: L. Johnson */ + +#ifndef __GSL_SF_MATHIEU_H__ +#define __GSL_SF_MATHIEU_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +#define GSL_SF_MATHIEU_COEFF 100 + +typedef struct +{ + size_t size; + size_t even_order; + size_t odd_order; + int extra_values; + double qa; /* allow for caching of results: not implemented yet */ + double qb; /* allow for caching of results: not implemented yet */ + double *aa; + double *bb; + double *dd; + double *ee; + double *tt; + double *e2; + double *zz; + gsl_vector *eval; + gsl_matrix *evec; + gsl_eigen_symmv_workspace *wmat; +} gsl_sf_mathieu_workspace; + + +/* Compute an array of characteristic (eigen) values from the recurrence + matrices for the Mathieu equations. */ +int gsl_sf_mathieu_a_array(int order_min, int order_max, double qq, gsl_sf_mathieu_workspace *work, double result_array[]); +int gsl_sf_mathieu_b_array(int order_min, int order_max, double qq, gsl_sf_mathieu_workspace *work, double result_array[]); + +/* Compute the characteristic value for a Mathieu function of order n and + type ntype. */ +int gsl_sf_mathieu_a_e(int order, double qq, gsl_sf_result *result); +double gsl_sf_mathieu_a(int order, double qq); +int gsl_sf_mathieu_b_e(int order, double qq, gsl_sf_result *result); +double gsl_sf_mathieu_b(int order, double qq); + +/* Compute the Fourier coefficients for a Mathieu function. */ +int gsl_sf_mathieu_a_coeff(int order, double qq, double aa, double coeff[]); +int gsl_sf_mathieu_b_coeff(int order, double qq, double aa, double coeff[]); + +/* Allocate computational storage space for eigenvalue solution. */ +gsl_sf_mathieu_workspace *gsl_sf_mathieu_alloc(const size_t nn, + const double qq); +void gsl_sf_mathieu_free(gsl_sf_mathieu_workspace *workspace); + +/* Compute an angular Mathieu function. */ +int gsl_sf_mathieu_ce_e(int order, double qq, double zz, gsl_sf_result *result); +double gsl_sf_mathieu_ce(int order, double qq, double zz); +int gsl_sf_mathieu_se_e(int order, double qq, double zz, gsl_sf_result *result); +double gsl_sf_mathieu_se(int order, double qq, double zz); +int gsl_sf_mathieu_ce_array(int nmin, int nmax, double qq, double zz, + gsl_sf_mathieu_workspace *work, + double result_array[]); +int gsl_sf_mathieu_se_array(int nmin, int nmax, double qq, double zz, + gsl_sf_mathieu_workspace *work, + double result_array[]); + +/* Compute a radial Mathieu function. */ +int gsl_sf_mathieu_Mc_e(int kind, int order, double qq, double zz, + gsl_sf_result *result); +double gsl_sf_mathieu_Mc(int kind, int order, double qq, double zz); +int gsl_sf_mathieu_Ms_e(int kind, int order, double qq, double zz, + gsl_sf_result *result); +double gsl_sf_mathieu_Ms(int kind, int order, double qq, double zz); +int gsl_sf_mathieu_Mc_array(int kind, int nmin, int nmax, double qq, + double zz, gsl_sf_mathieu_workspace *work, + double result_array[]); +int gsl_sf_mathieu_Ms_array(int kind, int nmin, int nmax, double qq, + double zz, gsl_sf_mathieu_workspace *work, + double result_array[]); + + +__END_DECLS + +#endif /* !__GSL_SF_MATHIEU_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_pow_int.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_pow_int.h new file mode 100644 index 000000000..e535d5721 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_pow_int.h @@ -0,0 +1,49 @@ +/* specfunc/gsl_sf_pow_int.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_POW_INT_H__ +#define __GSL_SF_POW_INT_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Calculate x^n. + * Does not check for overflow/underflow. + */ +int gsl_sf_pow_int_e(double x, int n, gsl_sf_result * result); +double gsl_sf_pow_int(const double x, const int n); + + +__END_DECLS + +#endif /* __GSL_SF_POW_INT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_psi.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_psi.h new file mode 100644 index 000000000..ec6117906 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_psi.h @@ -0,0 +1,113 @@ +/* specfunc/gsl_sf_psi.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_PSI_H__ +#define __GSL_SF_PSI_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Poly-Gamma Functions + * + * psi(m,x) := (d/dx)^m psi(0,x) = (d/dx)^{m+1} log(gamma(x)) + */ + + +/* Di-Gamma Function psi(n) = psi(0,n) + * + * n > 0 + * exceptions: GSL_EDOM + */ +int gsl_sf_psi_int_e(const int n, gsl_sf_result * result); +double gsl_sf_psi_int(const int n); + + +/* Di-Gamma Function psi(x) = psi(0, x) + * + * x != 0.0, -1.0, -2.0, ... + * exceptions: GSL_EDOM, GSL_ELOSS + */ +int gsl_sf_psi_e(const double x, gsl_sf_result * result); +double gsl_sf_psi(const double x); + + +/* Di-Gamma Function Re[psi(1 + I y)] + * + * exceptions: none + */ +int gsl_sf_psi_1piy_e(const double y, gsl_sf_result * result); +double gsl_sf_psi_1piy(const double y); + + +/* Di-Gamma Function psi(z) for general complex argument z = x + iy + * + * exceptions: GSL_EDOM + */ +int gsl_sf_complex_psi_e( + const double x, + const double y, + gsl_sf_result * result_re, + gsl_sf_result * result_im + ); + + +/* Tri-Gamma Function psi^(1)(n) + * + * n > 0 + * exceptions: GSL_EDOM + */ +int gsl_sf_psi_1_int_e(const int n, gsl_sf_result * result); +double gsl_sf_psi_1_int(const int n); + + +/* Tri-Gamma Function psi^(1)(x) + * + * x != 0.0, -1.0, -2.0, ... + * exceptions: GSL_EDOM, GSL_ELOSS + */ +int gsl_sf_psi_1_e(const double x, gsl_sf_result * result); +double gsl_sf_psi_1(const double x); + + +/* Poly-Gamma Function psi^(n)(x) + * + * n >= 0, x > 0.0 + * exceptions: GSL_EDOM + */ +int gsl_sf_psi_n_e(const int n, const double x, gsl_sf_result * result); +double gsl_sf_psi_n(const int n, const double x); + + +__END_DECLS + +#endif /* __GSL_SF_PSI_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_result.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_result.h new file mode 100644 index 000000000..512bad7c4 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_result.h @@ -0,0 +1,59 @@ +/* specfunc/gsl_sf_result.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_RESULT_H__ +#define __GSL_SF_RESULT_H__ + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_sf_result_struct { + double val; + double err; +}; +typedef struct gsl_sf_result_struct gsl_sf_result; + +#define GSL_SF_RESULT_SET(r,v,e) do { (r)->val=(v); (r)->err=(e); } while(0) + + +struct gsl_sf_result_e10_struct { + double val; + double err; + int e10; +}; +typedef struct gsl_sf_result_e10_struct gsl_sf_result_e10; + + +int gsl_sf_result_smash_e(const gsl_sf_result_e10 * re, gsl_sf_result * r); + + +__END_DECLS + +#endif /* __GSL_SF_RESULT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_sincos_pi.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_sincos_pi.h new file mode 100644 index 000000000..62fafbe18 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_sincos_pi.h @@ -0,0 +1,57 @@ +/* specfunc/gsl_sf_sincos_pi.h + * + * Copyright (C) 2017 Konrad Griessinger + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman, K. Griessinger */ + +#ifndef __GSL_SF_SINCOS_PI_H__ +#define __GSL_SF_SINCOS_PI_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* sin_pi(x) with GSL semantics. This is actually important + * because we want to control the error estimate, and trying + * to guess the error for the standard library implementation + * every time it is used would be a little goofy. + */ +int gsl_sf_sin_pi_e(double x, gsl_sf_result * result); +double gsl_sf_sin_pi(const double x); + + +/* cos_pi(x) with GSL semantics. + */ +int gsl_sf_cos_pi_e(double x, gsl_sf_result * result); +double gsl_sf_cos_pi(const double x); + + +__END_DECLS + +#endif /* __GSL_SF_SINCOS_PI_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_synchrotron.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_synchrotron.h new file mode 100644 index 000000000..26028c893 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_synchrotron.h @@ -0,0 +1,60 @@ +/* specfunc/gsl_sf_synchrotron.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_SYNCHROTRON_H__ +#define __GSL_SF_SYNCHROTRON_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* First synchrotron function: + * synchrotron_1(x) = x Integral[ K_{5/3}(t), {t, x, Infinity}] + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_synchrotron_1_e(const double x, gsl_sf_result * result); +double gsl_sf_synchrotron_1(const double x); + + +/* Second synchroton function: + * synchrotron_2(x) = x * K_{2/3}(x) + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_synchrotron_2_e(const double x, gsl_sf_result * result); +double gsl_sf_synchrotron_2(const double x); + + +__END_DECLS + +#endif /* __GSL_SF_SYNCHROTRON_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_transport.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_transport.h new file mode 100644 index 000000000..c0fd7fc23 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_transport.h @@ -0,0 +1,78 @@ +/* specfunc/gsl_sf_transport.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_TRANSPORT_H__ +#define __GSL_SF_TRANSPORT_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Transport function: + * J(n,x) := Integral[ t^n e^t /(e^t - 1)^2, {t,0,x}] + */ + +/* J(2,x) + * + * exceptions: GSL_EDOM + */ +int gsl_sf_transport_2_e(const double x, gsl_sf_result * result); +double gsl_sf_transport_2(const double x); + + +/* J(3,x) + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_transport_3_e(const double x, gsl_sf_result * result); +double gsl_sf_transport_3(const double x); + + +/* J(4,x) + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_transport_4_e(const double x, gsl_sf_result * result); +double gsl_sf_transport_4(const double x); + + +/* J(5,x) + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_transport_5_e(const double x, gsl_sf_result * result); +double gsl_sf_transport_5(const double x); + + +__END_DECLS + +#endif /* __GSL_SF_TRANSPORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_trig.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_trig.h new file mode 100644 index 000000000..e2c5722d9 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_trig.h @@ -0,0 +1,152 @@ +/* specfunc/gsl_sf_trig.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_TRIG_H__ +#define __GSL_SF_TRIG_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Sin(x) with GSL semantics. This is actually important + * because we want to control the error estimate, and trying + * to guess the error for the standard library implementation + * every time it is used would be a little goofy. + */ +int gsl_sf_sin_e(double x, gsl_sf_result * result); +double gsl_sf_sin(const double x); + + +/* Cos(x) with GSL semantics. + */ +int gsl_sf_cos_e(double x, gsl_sf_result * result); +double gsl_sf_cos(const double x); + + +/* Hypot(x,y) with GSL semantics. + */ +int gsl_sf_hypot_e(const double x, const double y, gsl_sf_result * result); +double gsl_sf_hypot(const double x, const double y); + + +/* Sin(z) for complex z + * + * exceptions: GSL_EOVRFLW + */ +int gsl_sf_complex_sin_e(const double zr, const double zi, gsl_sf_result * szr, gsl_sf_result * szi); + + +/* Cos(z) for complex z + * + * exceptions: GSL_EOVRFLW + */ +int gsl_sf_complex_cos_e(const double zr, const double zi, gsl_sf_result * czr, gsl_sf_result * czi); + + +/* Log(Sin(z)) for complex z + * + * exceptions: GSL_EDOM, GSL_ELOSS + */ +int gsl_sf_complex_logsin_e(const double zr, const double zi, gsl_sf_result * lszr, gsl_sf_result * lszi); + + +/* Sinc(x) = sin(pi x) / (pi x) + * + * exceptions: none + */ +int gsl_sf_sinc_e(double x, gsl_sf_result * result); +double gsl_sf_sinc(const double x); + + +/* Log(Sinh(x)), x > 0 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_lnsinh_e(const double x, gsl_sf_result * result); +double gsl_sf_lnsinh(const double x); + + +/* Log(Cosh(x)) + * + * exceptions: none + */ +int gsl_sf_lncosh_e(const double x, gsl_sf_result * result); +double gsl_sf_lncosh(const double x); + + +/* Convert polar to rectlinear coordinates. + * + * exceptions: GSL_ELOSS + */ +int gsl_sf_polar_to_rect(const double r, const double theta, gsl_sf_result * x, gsl_sf_result * y); + +/* Convert rectilinear to polar coordinates. + * return argument in range [-pi, pi] + * + * exceptions: GSL_EDOM + */ +int gsl_sf_rect_to_polar(const double x, const double y, gsl_sf_result * r, gsl_sf_result * theta); + +/* Sin(x) for quantity with an associated error. + */ +int gsl_sf_sin_err_e(const double x, const double dx, gsl_sf_result * result); + + +/* Cos(x) for quantity with an associated error. + */ +int gsl_sf_cos_err_e(const double x, const double dx, gsl_sf_result * result); + + +/* Force an angle to lie in the range (-pi,pi]. + * + * exceptions: GSL_ELOSS + */ +int gsl_sf_angle_restrict_symm_e(double * theta); +double gsl_sf_angle_restrict_symm(const double theta); + + +/* Force an angle to lie in the range [0, 2pi) + * + * exceptions: GSL_ELOSS + */ +int gsl_sf_angle_restrict_pos_e(double * theta); +double gsl_sf_angle_restrict_pos(const double theta); + + +int gsl_sf_angle_restrict_symm_err_e(const double theta, gsl_sf_result * result); + +int gsl_sf_angle_restrict_pos_err_e(const double theta, gsl_sf_result * result); + + +__END_DECLS + +#endif /* __GSL_SF_TRIG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_zeta.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_zeta.h new file mode 100644 index 000000000..2d7fad0ad --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_zeta.h @@ -0,0 +1,112 @@ +/* specfunc/gsl_sf_zeta.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_ZETA_H__ +#define __GSL_SF_ZETA_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Riemann Zeta Function + * zeta(n) = Sum[ k^(-n), {k,1,Infinity} ] + * + * n=integer, n != 1 + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_zeta_int_e(const int n, gsl_sf_result * result); +double gsl_sf_zeta_int(const int n); + + +/* Riemann Zeta Function + * zeta(x) = Sum[ k^(-s), {k,1,Infinity} ], s != 1.0 + * + * s != 1.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_zeta_e(const double s, gsl_sf_result * result); +double gsl_sf_zeta(const double s); + + +/* Riemann Zeta Function minus 1 + * useful for evaluating the fractional part + * of Riemann zeta for large argument + * + * s != 1.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_zetam1_e(const double s, gsl_sf_result * result); +double gsl_sf_zetam1(const double s); + + +/* Riemann Zeta Function minus 1 for integer arg + * useful for evaluating the fractional part + * of Riemann zeta for large argument + * + * s != 1.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_zetam1_int_e(const int s, gsl_sf_result * result); +double gsl_sf_zetam1_int(const int s); + + +/* Hurwitz Zeta Function + * zeta(s,q) = Sum[ (k+q)^(-s), {k,0,Infinity} ] + * + * s > 1.0, q > 0.0 + * exceptions: GSL_EDOM, GSL_EUNDRFLW, GSL_EOVRFLW + */ +int gsl_sf_hzeta_e(const double s, const double q, gsl_sf_result * result); +double gsl_sf_hzeta(const double s, const double q); + + +/* Eta Function + * eta(n) = (1-2^(1-n)) zeta(n) + * + * exceptions: GSL_EUNDRFLW, GSL_EOVRFLW + */ +int gsl_sf_eta_int_e(int n, gsl_sf_result * result); +double gsl_sf_eta_int(const int n); + + +/* Eta Function + * eta(s) = (1-2^(1-s)) zeta(s) + * + * exceptions: GSL_EUNDRFLW, GSL_EOVRFLW + */ +int gsl_sf_eta_e(const double s, gsl_sf_result * result); +double gsl_sf_eta(const double s); + + +__END_DECLS + +#endif /* __GSL_SF_ZETA_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_siman.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_siman.h new file mode 100644 index 000000000..a16f7c7c7 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_siman.h @@ -0,0 +1,82 @@ +/* siman/gsl_siman.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Mark Galassi + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SIMAN_H__ +#define __GSL_SIMAN_H__ +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* types for the function pointers passed to gsl_siman_solve */ + +typedef double (*gsl_siman_Efunc_t) (void *xp); +typedef void (*gsl_siman_step_t) (const gsl_rng *r, void *xp, double step_size); +typedef double (*gsl_siman_metric_t) (void *xp, void *yp); +typedef void (*gsl_siman_print_t) (void *xp); +typedef void (*gsl_siman_copy_t) (void *source, void *dest); +typedef void * (*gsl_siman_copy_construct_t) (void *xp); +typedef void (*gsl_siman_destroy_t) (void *xp); + +/* this structure contains all the information needed to structure the + search, beyond the energy function, the step function and the + initial guess. */ + +typedef struct { + int n_tries; /* how many points to try for each step */ + int iters_fixed_T; /* how many iterations at each temperature? */ + double step_size; /* max step size in the random walk */ + /* the following parameters are for the Boltzmann distribution */ + double k, t_initial, mu_t, t_min; +} gsl_siman_params_t; + +/* prototype for the workhorse function */ + +void gsl_siman_solve(const gsl_rng * r, + void *x0_p, gsl_siman_Efunc_t Ef, + gsl_siman_step_t take_step, + gsl_siman_metric_t distance, + gsl_siman_print_t print_position, + gsl_siman_copy_t copyfunc, + gsl_siman_copy_construct_t copy_constructor, + gsl_siman_destroy_t destructor, + size_t element_size, + gsl_siman_params_t params); + +void +gsl_siman_solve_many (const gsl_rng * r, void *x0_p, gsl_siman_Efunc_t Ef, + gsl_siman_step_t take_step, + gsl_siman_metric_t distance, + gsl_siman_print_t print_position, + size_t element_size, + gsl_siman_params_t params); + +__END_DECLS + +#endif /* __GSL_SIMAN_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort.h new file mode 100644 index 000000000..b1496c2ef --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort.h @@ -0,0 +1,20 @@ +#ifndef __GSL_SORT_H__ +#define __GSL_SORT_H__ + +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#endif /* __GSL_SORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_char.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_char.h new file mode 100644 index 000000000..a4bf3514f --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_char.h @@ -0,0 +1,51 @@ +/* sort/gsl_sort_char.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_CHAR_H__ +#define __GSL_SORT_CHAR_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_char (char * data, const size_t stride, const size_t n); +void gsl_sort2_char (char * data1, const size_t stride1, char * data2, const size_t stride2, const size_t n); +void gsl_sort_char_index (size_t * p, const char * data, const size_t stride, const size_t n); + +int gsl_sort_char_smallest (char * dest, const size_t k, const char * src, const size_t stride, const size_t n); +int gsl_sort_char_smallest_index (size_t * p, const size_t k, const char * src, const size_t stride, const size_t n); + +int gsl_sort_char_largest (char * dest, const size_t k, const char * src, const size_t stride, const size_t n); +int gsl_sort_char_largest_index (size_t * p, const size_t k, const char * src, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_SORT_CHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_double.h new file mode 100644 index 000000000..3f67f43dd --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_double.h @@ -0,0 +1,51 @@ +/* sort/gsl_sort_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_DOUBLE_H__ +#define __GSL_SORT_DOUBLE_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort (double * data, const size_t stride, const size_t n); +void gsl_sort2 (double * data1, const size_t stride1, double * data2, const size_t stride2, const size_t n); +void gsl_sort_index (size_t * p, const double * data, const size_t stride, const size_t n); + +int gsl_sort_smallest (double * dest, const size_t k, const double * src, const size_t stride, const size_t n); +int gsl_sort_smallest_index (size_t * p, const size_t k, const double * src, const size_t stride, const size_t n); + +int gsl_sort_largest (double * dest, const size_t k, const double * src, const size_t stride, const size_t n); +int gsl_sort_largest_index (size_t * p, const size_t k, const double * src, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_SORT_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_float.h new file mode 100644 index 000000000..505a1c6bf --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_float.h @@ -0,0 +1,51 @@ +/* sort/gsl_sort_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_FLOAT_H__ +#define __GSL_SORT_FLOAT_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_float (float * data, const size_t stride, const size_t n); +void gsl_sort2_float (float * data1, const size_t stride1, float * data2, const size_t stride2, const size_t n); +void gsl_sort_float_index (size_t * p, const float * data, const size_t stride, const size_t n); + +int gsl_sort_float_smallest (float * dest, const size_t k, const float * src, const size_t stride, const size_t n); +int gsl_sort_float_smallest_index (size_t * p, const size_t k, const float * src, const size_t stride, const size_t n); + +int gsl_sort_float_largest (float * dest, const size_t k, const float * src, const size_t stride, const size_t n); +int gsl_sort_float_largest_index (size_t * p, const size_t k, const float * src, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_SORT_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_int.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_int.h new file mode 100644 index 000000000..7aa8d3859 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_int.h @@ -0,0 +1,51 @@ +/* sort/gsl_sort_int.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_INT_H__ +#define __GSL_SORT_INT_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_int (int * data, const size_t stride, const size_t n); +void gsl_sort2_int (int * data1, const size_t stride1, int * data2, const size_t stride2, const size_t n); +void gsl_sort_int_index (size_t * p, const int * data, const size_t stride, const size_t n); + +int gsl_sort_int_smallest (int * dest, const size_t k, const int * src, const size_t stride, const size_t n); +int gsl_sort_int_smallest_index (size_t * p, const size_t k, const int * src, const size_t stride, const size_t n); + +int gsl_sort_int_largest (int * dest, const size_t k, const int * src, const size_t stride, const size_t n); +int gsl_sort_int_largest_index (size_t * p, const size_t k, const int * src, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_SORT_INT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_long.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_long.h new file mode 100644 index 000000000..7f4d68929 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_long.h @@ -0,0 +1,51 @@ +/* sort/gsl_sort_long.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_LONG_H__ +#define __GSL_SORT_LONG_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_long (long * data, const size_t stride, const size_t n); +void gsl_sort2_long (long * data1, const size_t stride1, long * data2, const size_t stride2, const size_t n); +void gsl_sort_long_index (size_t * p, const long * data, const size_t stride, const size_t n); + +int gsl_sort_long_smallest (long * dest, const size_t k, const long * src, const size_t stride, const size_t n); +int gsl_sort_long_smallest_index (size_t * p, const size_t k, const long * src, const size_t stride, const size_t n); + +int gsl_sort_long_largest (long * dest, const size_t k, const long * src, const size_t stride, const size_t n); +int gsl_sort_long_largest_index (size_t * p, const size_t k, const long * src, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_SORT_LONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_long_double.h new file mode 100644 index 000000000..164fd231e --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_long_double.h @@ -0,0 +1,51 @@ +/* sort/gsl_sort_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_LONG_DOUBLE_H__ +#define __GSL_SORT_LONG_DOUBLE_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_long_double (long double * data, const size_t stride, const size_t n); +void gsl_sort2_long_double (long double * data1, const size_t stride1, long double * data2, const size_t stride2, const size_t n); +void gsl_sort_long_double_index (size_t * p, const long double * data, const size_t stride, const size_t n); + +int gsl_sort_long_double_smallest (long double * dest, const size_t k, const long double * src, const size_t stride, const size_t n); +int gsl_sort_long_double_smallest_index (size_t * p, const size_t k, const long double * src, const size_t stride, const size_t n); + +int gsl_sort_long_double_largest (long double * dest, const size_t k, const long double * src, const size_t stride, const size_t n); +int gsl_sort_long_double_largest_index (size_t * p, const size_t k, const long double * src, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_SORT_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_short.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_short.h new file mode 100644 index 000000000..4626e9e2e --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_short.h @@ -0,0 +1,51 @@ +/* sort/gsl_sort_short.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_SHORT_H__ +#define __GSL_SORT_SHORT_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_short (short * data, const size_t stride, const size_t n); +void gsl_sort2_short (short * data1, const size_t stride1, short * data2, const size_t stride2, const size_t n); +void gsl_sort_short_index (size_t * p, const short * data, const size_t stride, const size_t n); + +int gsl_sort_short_smallest (short * dest, const size_t k, const short * src, const size_t stride, const size_t n); +int gsl_sort_short_smallest_index (size_t * p, const size_t k, const short * src, const size_t stride, const size_t n); + +int gsl_sort_short_largest (short * dest, const size_t k, const short * src, const size_t stride, const size_t n); +int gsl_sort_short_largest_index (size_t * p, const size_t k, const short * src, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_SORT_SHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_uchar.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_uchar.h new file mode 100644 index 000000000..6cd511d53 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_uchar.h @@ -0,0 +1,51 @@ +/* sort/gsl_sort_uchar.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_UCHAR_H__ +#define __GSL_SORT_UCHAR_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_uchar (unsigned char * data, const size_t stride, const size_t n); +void gsl_sort2_uchar (unsigned char * data1, const size_t stride1, unsigned char * data2, const size_t stride2, const size_t n); +void gsl_sort_uchar_index (size_t * p, const unsigned char * data, const size_t stride, const size_t n); + +int gsl_sort_uchar_smallest (unsigned char * dest, const size_t k, const unsigned char * src, const size_t stride, const size_t n); +int gsl_sort_uchar_smallest_index (size_t * p, const size_t k, const unsigned char * src, const size_t stride, const size_t n); + +int gsl_sort_uchar_largest (unsigned char * dest, const size_t k, const unsigned char * src, const size_t stride, const size_t n); +int gsl_sort_uchar_largest_index (size_t * p, const size_t k, const unsigned char * src, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_SORT_UCHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_uint.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_uint.h new file mode 100644 index 000000000..639e596f3 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_uint.h @@ -0,0 +1,51 @@ +/* sort/gsl_sort_uint.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_UINT_H__ +#define __GSL_SORT_UINT_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_uint (unsigned int * data, const size_t stride, const size_t n); +void gsl_sort2_uint (unsigned int * data1, const size_t stride1, unsigned int * data2, const size_t stride2, const size_t n); +void gsl_sort_uint_index (size_t * p, const unsigned int * data, const size_t stride, const size_t n); + +int gsl_sort_uint_smallest (unsigned int * dest, const size_t k, const unsigned int * src, const size_t stride, const size_t n); +int gsl_sort_uint_smallest_index (size_t * p, const size_t k, const unsigned int * src, const size_t stride, const size_t n); + +int gsl_sort_uint_largest (unsigned int * dest, const size_t k, const unsigned int * src, const size_t stride, const size_t n); +int gsl_sort_uint_largest_index (size_t * p, const size_t k, const unsigned int * src, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_SORT_UINT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_ulong.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_ulong.h new file mode 100644 index 000000000..4f8e41d47 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_ulong.h @@ -0,0 +1,51 @@ +/* sort/gsl_sort_ulong.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_ULONG_H__ +#define __GSL_SORT_ULONG_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_ulong (unsigned long * data, const size_t stride, const size_t n); +void gsl_sort2_ulong (unsigned long * data1, const size_t stride1, unsigned long * data2, const size_t stride2, const size_t n); +void gsl_sort_ulong_index (size_t * p, const unsigned long * data, const size_t stride, const size_t n); + +int gsl_sort_ulong_smallest (unsigned long * dest, const size_t k, const unsigned long * src, const size_t stride, const size_t n); +int gsl_sort_ulong_smallest_index (size_t * p, const size_t k, const unsigned long * src, const size_t stride, const size_t n); + +int gsl_sort_ulong_largest (unsigned long * dest, const size_t k, const unsigned long * src, const size_t stride, const size_t n); +int gsl_sort_ulong_largest_index (size_t * p, const size_t k, const unsigned long * src, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_SORT_ULONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_ushort.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_ushort.h new file mode 100644 index 000000000..6da3d107e --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_ushort.h @@ -0,0 +1,51 @@ +/* sort/gsl_sort_ushort.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_USHORT_H__ +#define __GSL_SORT_USHORT_H__ + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_ushort (unsigned short * data, const size_t stride, const size_t n); +void gsl_sort2_ushort (unsigned short * data1, const size_t stride1, unsigned short * data2, const size_t stride2, const size_t n); +void gsl_sort_ushort_index (size_t * p, const unsigned short * data, const size_t stride, const size_t n); + +int gsl_sort_ushort_smallest (unsigned short * dest, const size_t k, const unsigned short * src, const size_t stride, const size_t n); +int gsl_sort_ushort_smallest_index (size_t * p, const size_t k, const unsigned short * src, const size_t stride, const size_t n); + +int gsl_sort_ushort_largest (unsigned short * dest, const size_t k, const unsigned short * src, const size_t stride, const size_t n); +int gsl_sort_ushort_largest_index (size_t * p, const size_t k, const unsigned short * src, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_SORT_USHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector.h new file mode 100644 index 000000000..d65a9ee9b --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector.h @@ -0,0 +1,20 @@ +#ifndef __GSL_SORT_VECTOR_H__ +#define __GSL_SORT_VECTOR_H__ + +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#endif /* __GSL_SORT_VECTOR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_char.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_char.h new file mode 100644 index 000000000..39721fbdd --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_char.h @@ -0,0 +1,52 @@ +/* sort/gsl_sort_vector_char.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_VECTOR_CHAR_H__ +#define __GSL_SORT_VECTOR_CHAR_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_vector_char (gsl_vector_char * v); +void gsl_sort_vector2_char (gsl_vector_char * v1, gsl_vector_char * v2); +int gsl_sort_vector_char_index (gsl_permutation * p, const gsl_vector_char * v); + +int gsl_sort_vector_char_smallest (char * dest, const size_t k, const gsl_vector_char * v); +int gsl_sort_vector_char_largest (char * dest, const size_t k, const gsl_vector_char * v); + +int gsl_sort_vector_char_smallest_index (size_t * p, const size_t k, const gsl_vector_char * v); +int gsl_sort_vector_char_largest_index (size_t * p, const size_t k, const gsl_vector_char * v); + +__END_DECLS + +#endif /* __GSL_SORT_VECTOR_CHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_double.h new file mode 100644 index 000000000..f60a7447e --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_double.h @@ -0,0 +1,52 @@ +/* sort/gsl_sort_vector_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_VECTOR_DOUBLE_H__ +#define __GSL_SORT_VECTOR_DOUBLE_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_vector (gsl_vector * v); +void gsl_sort_vector2 (gsl_vector * v1, gsl_vector * v2); +int gsl_sort_vector_index (gsl_permutation * p, const gsl_vector * v); + +int gsl_sort_vector_smallest (double * dest, const size_t k, const gsl_vector * v); +int gsl_sort_vector_largest (double * dest, const size_t k, const gsl_vector * v); + +int gsl_sort_vector_smallest_index (size_t * p, const size_t k, const gsl_vector * v); +int gsl_sort_vector_largest_index (size_t * p, const size_t k, const gsl_vector * v); + +__END_DECLS + +#endif /* __GSL_SORT_VECTOR_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_float.h new file mode 100644 index 000000000..fe035c3a8 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_float.h @@ -0,0 +1,52 @@ +/* sort/gsl_sort_vector_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_VECTOR_FLOAT_H__ +#define __GSL_SORT_VECTOR_FLOAT_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_vector_float (gsl_vector_float * v); +void gsl_sort_vector2_float (gsl_vector_float * v1, gsl_vector_float * v2); +int gsl_sort_vector_float_index (gsl_permutation * p, const gsl_vector_float * v); + +int gsl_sort_vector_float_smallest (float * dest, const size_t k, const gsl_vector_float * v); +int gsl_sort_vector_float_largest (float * dest, const size_t k, const gsl_vector_float * v); + +int gsl_sort_vector_float_smallest_index (size_t * p, const size_t k, const gsl_vector_float * v); +int gsl_sort_vector_float_largest_index (size_t * p, const size_t k, const gsl_vector_float * v); + +__END_DECLS + +#endif /* __GSL_SORT_VECTOR_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_int.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_int.h new file mode 100644 index 000000000..3179bca1b --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_int.h @@ -0,0 +1,52 @@ +/* sort/gsl_sort_vector_int.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_VECTOR_INT_H__ +#define __GSL_SORT_VECTOR_INT_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_vector_int (gsl_vector_int * v); +void gsl_sort_vector2_int (gsl_vector_int * v1, gsl_vector_int * v2); +int gsl_sort_vector_int_index (gsl_permutation * p, const gsl_vector_int * v); + +int gsl_sort_vector_int_smallest (int * dest, const size_t k, const gsl_vector_int * v); +int gsl_sort_vector_int_largest (int * dest, const size_t k, const gsl_vector_int * v); + +int gsl_sort_vector_int_smallest_index (size_t * p, const size_t k, const gsl_vector_int * v); +int gsl_sort_vector_int_largest_index (size_t * p, const size_t k, const gsl_vector_int * v); + +__END_DECLS + +#endif /* __GSL_SORT_VECTOR_INT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_long.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_long.h new file mode 100644 index 000000000..41eebeca8 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_long.h @@ -0,0 +1,52 @@ +/* sort/gsl_sort_vector_long.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_VECTOR_LONG_H__ +#define __GSL_SORT_VECTOR_LONG_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_vector_long (gsl_vector_long * v); +void gsl_sort_vector2_long (gsl_vector_long * v1, gsl_vector_long * v2); +int gsl_sort_vector_long_index (gsl_permutation * p, const gsl_vector_long * v); + +int gsl_sort_vector_long_smallest (long * dest, const size_t k, const gsl_vector_long * v); +int gsl_sort_vector_long_largest (long * dest, const size_t k, const gsl_vector_long * v); + +int gsl_sort_vector_long_smallest_index (size_t * p, const size_t k, const gsl_vector_long * v); +int gsl_sort_vector_long_largest_index (size_t * p, const size_t k, const gsl_vector_long * v); + +__END_DECLS + +#endif /* __GSL_SORT_VECTOR_LONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_long_double.h new file mode 100644 index 000000000..4409d0617 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_long_double.h @@ -0,0 +1,52 @@ +/* sort/gsl_sort_vector_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_VECTOR_LONG_DOUBLE_H__ +#define __GSL_SORT_VECTOR_LONG_DOUBLE_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_vector_long_double (gsl_vector_long_double * v); +void gsl_sort_vector2_long_double (gsl_vector_long_double * v1, gsl_vector_long_double * v2); +int gsl_sort_vector_long_double_index (gsl_permutation * p, const gsl_vector_long_double * v); + +int gsl_sort_vector_long_double_smallest (long double * dest, const size_t k, const gsl_vector_long_double * v); +int gsl_sort_vector_long_double_largest (long double * dest, const size_t k, const gsl_vector_long_double * v); + +int gsl_sort_vector_long_double_smallest_index (size_t * p, const size_t k, const gsl_vector_long_double * v); +int gsl_sort_vector_long_double_largest_index (size_t * p, const size_t k, const gsl_vector_long_double * v); + +__END_DECLS + +#endif /* __GSL_SORT_VECTOR_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_short.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_short.h new file mode 100644 index 000000000..f25e86959 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_short.h @@ -0,0 +1,52 @@ +/* sort/gsl_sort_vector_short.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_VECTOR_SHORT_H__ +#define __GSL_SORT_VECTOR_SHORT_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_vector_short (gsl_vector_short * v); +void gsl_sort_vector2_short (gsl_vector_short * v1, gsl_vector_short * v2); +int gsl_sort_vector_short_index (gsl_permutation * p, const gsl_vector_short * v); + +int gsl_sort_vector_short_smallest (short * dest, const size_t k, const gsl_vector_short * v); +int gsl_sort_vector_short_largest (short * dest, const size_t k, const gsl_vector_short * v); + +int gsl_sort_vector_short_smallest_index (size_t * p, const size_t k, const gsl_vector_short * v); +int gsl_sort_vector_short_largest_index (size_t * p, const size_t k, const gsl_vector_short * v); + +__END_DECLS + +#endif /* __GSL_SORT_VECTOR_SHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_uchar.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_uchar.h new file mode 100644 index 000000000..edc340853 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_uchar.h @@ -0,0 +1,52 @@ +/* sort/gsl_sort_vector_uchar.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_VECTOR_UCHAR_H__ +#define __GSL_SORT_VECTOR_UCHAR_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_vector_uchar (gsl_vector_uchar * v); +void gsl_sort_vector2_uchar (gsl_vector_uchar * v1, gsl_vector_uchar * v2); +int gsl_sort_vector_uchar_index (gsl_permutation * p, const gsl_vector_uchar * v); + +int gsl_sort_vector_uchar_smallest (unsigned char * dest, const size_t k, const gsl_vector_uchar * v); +int gsl_sort_vector_uchar_largest (unsigned char * dest, const size_t k, const gsl_vector_uchar * v); + +int gsl_sort_vector_uchar_smallest_index (size_t * p, const size_t k, const gsl_vector_uchar * v); +int gsl_sort_vector_uchar_largest_index (size_t * p, const size_t k, const gsl_vector_uchar * v); + +__END_DECLS + +#endif /* __GSL_SORT_VECTOR_UCHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_uint.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_uint.h new file mode 100644 index 000000000..6e45b8452 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_uint.h @@ -0,0 +1,52 @@ +/* sort/gsl_sort_vector_uint.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_VECTOR_UINT_H__ +#define __GSL_SORT_VECTOR_UINT_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_vector_uint (gsl_vector_uint * v); +void gsl_sort_vector2_uint (gsl_vector_uint * v1, gsl_vector_uint * v2); +int gsl_sort_vector_uint_index (gsl_permutation * p, const gsl_vector_uint * v); + +int gsl_sort_vector_uint_smallest (unsigned int * dest, const size_t k, const gsl_vector_uint * v); +int gsl_sort_vector_uint_largest (unsigned int * dest, const size_t k, const gsl_vector_uint * v); + +int gsl_sort_vector_uint_smallest_index (size_t * p, const size_t k, const gsl_vector_uint * v); +int gsl_sort_vector_uint_largest_index (size_t * p, const size_t k, const gsl_vector_uint * v); + +__END_DECLS + +#endif /* __GSL_SORT_VECTOR_UINT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_ulong.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_ulong.h new file mode 100644 index 000000000..e65105752 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_ulong.h @@ -0,0 +1,52 @@ +/* sort/gsl_sort_vector_ulong.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_VECTOR_ULONG_H__ +#define __GSL_SORT_VECTOR_ULONG_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_vector_ulong (gsl_vector_ulong * v); +void gsl_sort_vector2_ulong (gsl_vector_ulong * v1, gsl_vector_ulong * v2); +int gsl_sort_vector_ulong_index (gsl_permutation * p, const gsl_vector_ulong * v); + +int gsl_sort_vector_ulong_smallest (unsigned long * dest, const size_t k, const gsl_vector_ulong * v); +int gsl_sort_vector_ulong_largest (unsigned long * dest, const size_t k, const gsl_vector_ulong * v); + +int gsl_sort_vector_ulong_smallest_index (size_t * p, const size_t k, const gsl_vector_ulong * v); +int gsl_sort_vector_ulong_largest_index (size_t * p, const size_t k, const gsl_vector_ulong * v); + +__END_DECLS + +#endif /* __GSL_SORT_VECTOR_ULONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_ushort.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_ushort.h new file mode 100644 index 000000000..09eb0bd12 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_ushort.h @@ -0,0 +1,52 @@ +/* sort/gsl_sort_vector_ushort.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_VECTOR_USHORT_H__ +#define __GSL_SORT_VECTOR_USHORT_H__ + +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_vector_ushort (gsl_vector_ushort * v); +void gsl_sort_vector2_ushort (gsl_vector_ushort * v1, gsl_vector_ushort * v2); +int gsl_sort_vector_ushort_index (gsl_permutation * p, const gsl_vector_ushort * v); + +int gsl_sort_vector_ushort_smallest (unsigned short * dest, const size_t k, const gsl_vector_ushort * v); +int gsl_sort_vector_ushort_largest (unsigned short * dest, const size_t k, const gsl_vector_ushort * v); + +int gsl_sort_vector_ushort_smallest_index (size_t * p, const size_t k, const gsl_vector_ushort * v); +int gsl_sort_vector_ushort_largest_index (size_t * p, const size_t k, const gsl_vector_ushort * v); + +__END_DECLS + +#endif /* __GSL_SORT_VECTOR_USHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_spblas.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_spblas.h new file mode 100644 index 000000000..9d66088fe --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_spblas.h @@ -0,0 +1,58 @@ +/* gsl_spblas.h + * + * Copyright (C) 2012-2014 Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SPBLAS_H__ +#define __GSL_SPBLAS_H__ + +#include + +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* + * Prototypes + */ + +int gsl_spblas_dgemv(const CBLAS_TRANSPOSE_t TransA, const double alpha, + const gsl_spmatrix *A, const gsl_vector *x, + const double beta, gsl_vector *y); +int gsl_spblas_dgemm(const double alpha, const gsl_spmatrix *A, + const gsl_spmatrix *B, gsl_spmatrix *C); +size_t gsl_spblas_scatter(const gsl_spmatrix *A, const size_t j, + const double alpha, size_t *w, double *x, + const size_t mark, gsl_spmatrix *C, size_t nz); + +__END_DECLS + +#endif /* __GSL_SPBLAS_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_specfunc.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_specfunc.h new file mode 100644 index 000000000..e07b5aa08 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_specfunc.h @@ -0,0 +1,10 @@ +/* Author: G. Jungman */ + + +/* Convenience header */ +#ifndef __GSL_SPECFUNC_H__ +#define __GSL_SPECFUNC_H__ + +#include + +#endif /* __GSL_SPECFUNC_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_splinalg.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_splinalg.h new file mode 100644 index 000000000..265b6ae60 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_splinalg.h @@ -0,0 +1,79 @@ +/* gsl_splinalg.h + * + * Copyright (C) 2012-2014 Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SPLINALG_H__ +#define __GSL_SPLINALG_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* iteration solver type */ +typedef struct +{ + const char *name; + void * (*alloc) (const size_t n, const size_t m); + int (*iterate) (const gsl_spmatrix *A, const gsl_vector *b, + const double tol, gsl_vector *x, void *); + double (*normr)(const void *); + void (*free) (void *); +} gsl_splinalg_itersolve_type; + +typedef struct +{ + const gsl_splinalg_itersolve_type * type; + double normr; /* current residual norm || b - A x || */ + void * state; +} gsl_splinalg_itersolve; + +/* available types */ +GSL_VAR const gsl_splinalg_itersolve_type * gsl_splinalg_itersolve_gmres; + +/* + * Prototypes + */ +gsl_splinalg_itersolve * +gsl_splinalg_itersolve_alloc(const gsl_splinalg_itersolve_type *T, + const size_t n, const size_t m); +void gsl_splinalg_itersolve_free(gsl_splinalg_itersolve *w); +const char *gsl_splinalg_itersolve_name(const gsl_splinalg_itersolve *w); +int gsl_splinalg_itersolve_iterate(const gsl_spmatrix *A, + const gsl_vector *b, + const double tol, gsl_vector *x, + gsl_splinalg_itersolve *w); +double gsl_splinalg_itersolve_normr(const gsl_splinalg_itersolve *w); + +__END_DECLS + +#endif /* __GSL_SPLINALG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_spline.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_spline.h new file mode 100644 index 000000000..08255ca88 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_spline.h @@ -0,0 +1,101 @@ +/* interpolation/gsl_spline.h + * + * Copyright (C) 2001, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SPLINE_H__ +#define __GSL_SPLINE_H__ +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* general interpolation object */ +typedef struct { + gsl_interp * interp; + double * x; + double * y; + size_t size; +} gsl_spline; + +gsl_spline * +gsl_spline_alloc(const gsl_interp_type * T, size_t size); + +int +gsl_spline_init(gsl_spline * spline, const double xa[], const double ya[], size_t size); + +const char * gsl_spline_name(const gsl_spline * spline); +unsigned int gsl_spline_min_size(const gsl_spline * spline); + + +int +gsl_spline_eval_e(const gsl_spline * spline, double x, + gsl_interp_accel * a, double * y); + +double +gsl_spline_eval(const gsl_spline * spline, double x, gsl_interp_accel * a); + +int +gsl_spline_eval_deriv_e(const gsl_spline * spline, + double x, + gsl_interp_accel * a, + double * y); + +double +gsl_spline_eval_deriv(const gsl_spline * spline, + double x, + gsl_interp_accel * a); + +int +gsl_spline_eval_deriv2_e(const gsl_spline * spline, + double x, + gsl_interp_accel * a, + double * y); + +double +gsl_spline_eval_deriv2(const gsl_spline * spline, + double x, + gsl_interp_accel * a); + +int +gsl_spline_eval_integ_e(const gsl_spline * spline, + double a, double b, + gsl_interp_accel * acc, + double * y); + +double +gsl_spline_eval_integ(const gsl_spline * spline, + double a, double b, + gsl_interp_accel * acc); + +void +gsl_spline_free(gsl_spline * spline); + +__END_DECLS + +#endif /* __GSL_INTERP_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_spline2d.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_spline2d.h new file mode 100644 index 000000000..a30480001 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_spline2d.h @@ -0,0 +1,113 @@ +/* interpolation/gsl_spline2d.h + * + * Copyright 2012 David Zaslavsky + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SPLINE2D_H__ +#define __GSL_SPLINE2D_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* + * A 2D interpolation object which stores the arrays defining the function. + * In all other respects, this is just like a gsl_interp2d object. + */ +typedef struct +{ + gsl_interp2d interp_object; /* low-level interpolation object */ + double * xarr; /* x data array */ + double * yarr; /* y data array */ + double * zarr; /* z data array */ +} gsl_spline2d; + +gsl_spline2d * gsl_spline2d_alloc(const gsl_interp2d_type * T, size_t xsize, size_t ysize); + +int gsl_spline2d_init(gsl_spline2d * interp, const double xa[], + const double ya[], const double za[], + size_t xsize, size_t ysize); + +void gsl_spline2d_free(gsl_spline2d * interp); + +double gsl_spline2d_eval(const gsl_spline2d * interp, const double x, + const double y, gsl_interp_accel* xa, gsl_interp_accel* ya); + +int gsl_spline2d_eval_e(const gsl_spline2d * interp, const double x, + const double y, gsl_interp_accel* xa, gsl_interp_accel* ya, + double * z); + +double gsl_spline2d_eval_deriv_x(const gsl_spline2d * interp, const double x, + const double y, gsl_interp_accel* xa, gsl_interp_accel* ya); + +int gsl_spline2d_eval_deriv_x_e(const gsl_spline2d * interp, const double x, + const double y, gsl_interp_accel* xa, + gsl_interp_accel* ya, double * z); + +double gsl_spline2d_eval_deriv_y(const gsl_spline2d * interp, const double x, + const double y, gsl_interp_accel* xa, + gsl_interp_accel* ya); + +int gsl_spline2d_eval_deriv_y_e(const gsl_spline2d * interp, const double x, + const double y, gsl_interp_accel* xa, + gsl_interp_accel* ya, double * z); + +double gsl_spline2d_eval_deriv_xx(const gsl_spline2d * interp, const double x, + const double y, gsl_interp_accel* xa, gsl_interp_accel* ya); + +int gsl_spline2d_eval_deriv_xx_e(const gsl_spline2d * interp, const double x, + const double y, gsl_interp_accel* xa, + gsl_interp_accel* ya, double * z); + +double gsl_spline2d_eval_deriv_yy(const gsl_spline2d * interp, const double x, + const double y, gsl_interp_accel* xa, gsl_interp_accel* ya); + +int gsl_spline2d_eval_deriv_yy_e(const gsl_spline2d * interp, const double x, + const double y, gsl_interp_accel* xa, + gsl_interp_accel* ya, double * z); + +double gsl_spline2d_eval_deriv_xy(const gsl_spline2d * interp, const double x, + const double y, gsl_interp_accel* xa, gsl_interp_accel* ya); + +int gsl_spline2d_eval_deriv_xy_e(const gsl_spline2d * interp, const double x, + const double y, gsl_interp_accel* xa, + gsl_interp_accel* ya, double * z); + +size_t gsl_spline2d_min_size(const gsl_spline2d * interp); + +const char * gsl_spline2d_name(const gsl_spline2d * interp); + +int gsl_spline2d_set(const gsl_spline2d * interp, double zarr[], + const size_t i, const size_t j, const double z); +double gsl_spline2d_get(const gsl_spline2d * interp, const double zarr[], + const size_t i, const size_t j); + +__END_DECLS + +#endif /* __GSL_SPLINE2D_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_spmatrix.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_spmatrix.h new file mode 100644 index 000000000..a4f949ba9 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_spmatrix.h @@ -0,0 +1,184 @@ +/* gsl_spmatrix.h + * + * Copyright (C) 2012-2014 Patrick Alken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SPMATRIX_H__ +#define __GSL_SPMATRIX_H__ + +#include + +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* + * Binary tree data structure for storing sparse matrix elements + * in triplet format. This is used for efficiently detecting + * duplicates and element retrieval via gsl_spmatrix_get + */ +typedef struct +{ + void *tree; /* tree structure */ + void *node_array; /* preallocated array of tree nodes */ + size_t n; /* number of tree nodes in use (<= nzmax) */ +} gsl_spmatrix_tree; + +/* + * Triplet format: + * + * If data[n] = A_{ij}, then: + * i = A->i[n] + * j = A->p[n] + * + * Compressed column format (CCS): + * + * If data[n] = A_{ij}, then: + * i = A->i[n] + * A->p[j] <= n < A->p[j+1] + * so that column j is stored in + * [ data[p[j]], data[p[j] + 1], ..., data[p[j+1] - 1] ] + * + * Compressed row format (CRS): + * + * If data[n] = A_{ij}, then: + * j = A->i[n] + * A->p[i] <= n < A->p[i+1] + * so that row i is stored in + * [ data[p[i]], data[p[i] + 1], ..., data[p[i+1] - 1] ] + */ + +typedef struct +{ + size_t size1; /* number of rows */ + size_t size2; /* number of columns */ + + /* i (size nzmax) contains: + * + * Triplet/CCS: row indices + * CRS: column indices + */ + size_t *i; + + double *data; /* matrix elements of size nzmax */ + + /* + * p contains the column indices (triplet) or column pointers (compcol) + * + * triplet: p[n] = column number of element data[n] + * CCS: p[j] = index in data of first non-zero element in column j + * CRS: p[i] = index in data of first non-zero element in row i + */ + size_t *p; + + size_t nzmax; /* maximum number of matrix elements */ + size_t nz; /* number of non-zero values in matrix */ + + gsl_spmatrix_tree *tree_data; /* binary tree for sorting triplet data */ + + /* + * workspace of size MAX(size1,size2)*MAX(sizeof(double),sizeof(size_t)) + * used in various routines + */ + union + { + void *work; + size_t *work_sze; + double *work_dbl; + }; + + size_t sptype; /* sparse storage type */ +} gsl_spmatrix; + +#define GSL_SPMATRIX_TRIPLET (0) +#define GSL_SPMATRIX_CCS (1) +#define GSL_SPMATRIX_CRS (2) + +#define GSL_SPMATRIX_ISTRIPLET(m) ((m)->sptype == GSL_SPMATRIX_TRIPLET) +#define GSL_SPMATRIX_ISCCS(m) ((m)->sptype == GSL_SPMATRIX_CCS) +#define GSL_SPMATRIX_ISCRS(m) ((m)->sptype == GSL_SPMATRIX_CRS) + +/* + * Prototypes + */ + +gsl_spmatrix *gsl_spmatrix_alloc(const size_t n1, const size_t n2); +gsl_spmatrix *gsl_spmatrix_alloc_nzmax(const size_t n1, const size_t n2, + const size_t nzmax, const size_t flags); +void gsl_spmatrix_free(gsl_spmatrix *m); +int gsl_spmatrix_realloc(const size_t nzmax, gsl_spmatrix *m); +int gsl_spmatrix_set_zero(gsl_spmatrix *m); +size_t gsl_spmatrix_nnz(const gsl_spmatrix *m); +int gsl_spmatrix_compare_idx(const size_t ia, const size_t ja, + const size_t ib, const size_t jb); +int gsl_spmatrix_tree_rebuild(gsl_spmatrix * m); + +/* spcopy.c */ +int gsl_spmatrix_memcpy(gsl_spmatrix *dest, const gsl_spmatrix *src); + +/* spgetset.c */ +double gsl_spmatrix_get(const gsl_spmatrix *m, const size_t i, + const size_t j); +int gsl_spmatrix_set(gsl_spmatrix *m, const size_t i, const size_t j, + const double x); +double *gsl_spmatrix_ptr(gsl_spmatrix *m, const size_t i, const size_t j); + +/* spcompress.c */ +gsl_spmatrix *gsl_spmatrix_compcol(const gsl_spmatrix *T); +gsl_spmatrix *gsl_spmatrix_ccs(const gsl_spmatrix *T); +gsl_spmatrix *gsl_spmatrix_crs(const gsl_spmatrix *T); +void gsl_spmatrix_cumsum(const size_t n, size_t *c); + +/* spio.c */ +int gsl_spmatrix_fprintf(FILE *stream, const gsl_spmatrix *m, + const char *format); +gsl_spmatrix * gsl_spmatrix_fscanf(FILE *stream); +int gsl_spmatrix_fwrite(FILE *stream, const gsl_spmatrix *m); +int gsl_spmatrix_fread(FILE *stream, gsl_spmatrix *m); + +/* spoper.c */ +int gsl_spmatrix_scale(gsl_spmatrix *m, const double x); +int gsl_spmatrix_minmax(const gsl_spmatrix *m, double *min_out, + double *max_out); +int gsl_spmatrix_add(gsl_spmatrix *c, const gsl_spmatrix *a, + const gsl_spmatrix *b); +int gsl_spmatrix_d2sp(gsl_spmatrix *S, const gsl_matrix *A); +int gsl_spmatrix_sp2d(gsl_matrix *A, const gsl_spmatrix *S); + +/* spprop.c */ +int gsl_spmatrix_equal(const gsl_spmatrix *a, const gsl_spmatrix *b); + +/* spswap.c */ +int gsl_spmatrix_transpose(gsl_spmatrix * m); +int gsl_spmatrix_transpose2(gsl_spmatrix * m); +int gsl_spmatrix_transpose_memcpy(gsl_spmatrix *dest, const gsl_spmatrix *src); + +__END_DECLS + +#endif /* __GSL_SPMATRIX_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics.h new file mode 100644 index 000000000..9fb414f28 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics.h @@ -0,0 +1,20 @@ +#ifndef __GSL_STATISTICS_H__ +#define __GSL_STATISTICS_H__ + +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#endif /* __GSL_STATISTICS_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_char.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_char.h new file mode 100644 index 000000000..c77d4c423 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_char.h @@ -0,0 +1,96 @@ +/* statistics/gsl_statistics_char.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_STATISTICS_CHAR_H__ +#define __GSL_STATISTICS_CHAR_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_stats_char_mean (const char data[], const size_t stride, const size_t n); +double gsl_stats_char_variance (const char data[], const size_t stride, const size_t n); +double gsl_stats_char_sd (const char data[], const size_t stride, const size_t n); +double gsl_stats_char_variance_with_fixed_mean (const char data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_char_sd_with_fixed_mean (const char data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_char_tss (const char data[], const size_t stride, const size_t n); +double gsl_stats_char_tss_m (const char data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_char_absdev (const char data[], const size_t stride, const size_t n); +double gsl_stats_char_skew (const char data[], const size_t stride, const size_t n); +double gsl_stats_char_kurtosis (const char data[], const size_t stride, const size_t n); +double gsl_stats_char_lag1_autocorrelation (const char data[], const size_t stride, const size_t n); + +double gsl_stats_char_covariance (const char data1[], const size_t stride1,const char data2[], const size_t stride2, const size_t n); +double gsl_stats_char_correlation (const char data1[], const size_t stride1,const char data2[], const size_t stride2, const size_t n); +double gsl_stats_char_spearman (const char data1[], const size_t stride1, const char data2[], const size_t stride2, const size_t n, double work[]); + +double gsl_stats_char_variance_m (const char data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_char_sd_m (const char data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_char_absdev_m (const char data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_char_skew_m_sd (const char data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_char_kurtosis_m_sd (const char data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_char_lag1_autocorrelation_m (const char data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_char_covariance_m (const char data1[], const size_t stride1,const char data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); + + +double gsl_stats_char_pvariance (const char data1[], const size_t stride1, const size_t n1, const char data2[], const size_t stride2, const size_t n2); +double gsl_stats_char_ttest (const char data1[], const size_t stride1, const size_t n1, const char data2[], const size_t stride2, const size_t n2); + +char gsl_stats_char_max (const char data[], const size_t stride, const size_t n); +char gsl_stats_char_min (const char data[], const size_t stride, const size_t n); +void gsl_stats_char_minmax (char * min, char * max, const char data[], const size_t stride, const size_t n); + +size_t gsl_stats_char_max_index (const char data[], const size_t stride, const size_t n); +size_t gsl_stats_char_min_index (const char data[], const size_t stride, const size_t n); +void gsl_stats_char_minmax_index (size_t * min_index, size_t * max_index, const char data[], const size_t stride, const size_t n); + +char gsl_stats_char_select(char data[], const size_t stride, const size_t n, const size_t k); + +double gsl_stats_char_median_from_sorted_data (const char sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_char_median (char sorted_data[], const size_t stride, const size_t n); +double gsl_stats_char_quantile_from_sorted_data (const char sorted_data[], const size_t stride, const size_t n, const double f) ; + +double gsl_stats_char_trmean_from_sorted_data (const double trim, const char sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_char_gastwirth_from_sorted_data (const char sorted_data[], const size_t stride, const size_t n) ; + +double gsl_stats_char_mad0(const char data[], const size_t stride, const size_t n, double work[]); +double gsl_stats_char_mad(const char data[], const size_t stride, const size_t n, double work[]); + +char gsl_stats_char_Sn0_from_sorted_data (const char sorted_data[], const size_t stride, const size_t n, char work[]) ; +double gsl_stats_char_Sn_from_sorted_data (const char sorted_data[], const size_t stride, const size_t n, char work[]) ; + +char gsl_stats_char_Qn0_from_sorted_data (const char sorted_data[], const size_t stride, const size_t n, char work[], int work_int[]) ; +double gsl_stats_char_Qn_from_sorted_data (const char sorted_data[], const size_t stride, const size_t n, char work[], int work_int[]) ; + +__END_DECLS + +#endif /* __GSL_STATISTICS_CHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_double.h new file mode 100644 index 000000000..9969472ca --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_double.h @@ -0,0 +1,116 @@ +/* statistics/gsl_statistics_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_STATISTICS_DOUBLE_H__ +#define __GSL_STATISTICS_DOUBLE_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_stats_mean (const double data[], const size_t stride, const size_t n); +double gsl_stats_variance (const double data[], const size_t stride, const size_t n); +double gsl_stats_sd (const double data[], const size_t stride, const size_t n); +double gsl_stats_variance_with_fixed_mean (const double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_sd_with_fixed_mean (const double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_tss (const double data[], const size_t stride, const size_t n); +double gsl_stats_tss_m (const double data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_absdev (const double data[], const size_t stride, const size_t n); +double gsl_stats_skew (const double data[], const size_t stride, const size_t n); +double gsl_stats_kurtosis (const double data[], const size_t stride, const size_t n); +double gsl_stats_lag1_autocorrelation (const double data[], const size_t stride, const size_t n); + +double gsl_stats_covariance (const double data1[], const size_t stride1,const double data2[], const size_t stride2, const size_t n); +double gsl_stats_correlation (const double data1[], const size_t stride1,const double data2[], const size_t stride2, const size_t n); +double gsl_stats_spearman (const double data1[], const size_t stride1, const double data2[], const size_t stride2, const size_t n, double work[]); + +double gsl_stats_variance_m (const double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_sd_m (const double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_absdev_m (const double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_skew_m_sd (const double data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_kurtosis_m_sd (const double data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_lag1_autocorrelation_m (const double data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_covariance_m (const double data1[], const size_t stride1,const double data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); + +/* DEFINED FOR FLOATING POINT TYPES ONLY */ + +double gsl_stats_wmean (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n); +double gsl_stats_wvariance (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n); +double gsl_stats_wsd (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n); +double gsl_stats_wvariance_with_fixed_mean (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_wsd_with_fixed_mean (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_wtss (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n); +double gsl_stats_wtss_m (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n, const double wmean); +double gsl_stats_wabsdev (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n); +double gsl_stats_wskew (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n); +double gsl_stats_wkurtosis (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n); + +double gsl_stats_wvariance_m (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n, const double wmean); +double gsl_stats_wsd_m (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n, const double wmean); +double gsl_stats_wabsdev_m (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n, const double wmean); +double gsl_stats_wskew_m_sd (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n, const double wmean, const double wsd); +double gsl_stats_wkurtosis_m_sd (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n, const double wmean, const double wsd); + +/* END OF FLOATING POINT TYPES */ + +double gsl_stats_pvariance (const double data1[], const size_t stride1, const size_t n1, const double data2[], const size_t stride2, const size_t n2); +double gsl_stats_ttest (const double data1[], const size_t stride1, const size_t n1, const double data2[], const size_t stride2, const size_t n2); + +double gsl_stats_max (const double data[], const size_t stride, const size_t n); +double gsl_stats_min (const double data[], const size_t stride, const size_t n); +void gsl_stats_minmax (double * min, double * max, const double data[], const size_t stride, const size_t n); + +size_t gsl_stats_max_index (const double data[], const size_t stride, const size_t n); +size_t gsl_stats_min_index (const double data[], const size_t stride, const size_t n); +void gsl_stats_minmax_index (size_t * min_index, size_t * max_index, const double data[], const size_t stride, const size_t n); + +double gsl_stats_select(double data[], const size_t stride, const size_t n, const size_t k); + +double gsl_stats_median_from_sorted_data (const double sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_median (double sorted_data[], const size_t stride, const size_t n); +double gsl_stats_quantile_from_sorted_data (const double sorted_data[], const size_t stride, const size_t n, const double f) ; + +double gsl_stats_trmean_from_sorted_data (const double trim, const double sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_gastwirth_from_sorted_data (const double sorted_data[], const size_t stride, const size_t n) ; + +double gsl_stats_mad0(const double data[], const size_t stride, const size_t n, double work[]); +double gsl_stats_mad(const double data[], const size_t stride, const size_t n, double work[]); + +double gsl_stats_Sn0_from_sorted_data (const double sorted_data[], const size_t stride, const size_t n, double work[]) ; +double gsl_stats_Sn_from_sorted_data (const double sorted_data[], const size_t stride, const size_t n, double work[]) ; + +double gsl_stats_Qn0_from_sorted_data (const double sorted_data[], const size_t stride, const size_t n, double work[], int work_int[]) ; +double gsl_stats_Qn_from_sorted_data (const double sorted_data[], const size_t stride, const size_t n, double work[], int work_int[]) ; + +__END_DECLS + +#endif /* __GSL_STATISTICS_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_float.h new file mode 100644 index 000000000..fa61a4d88 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_float.h @@ -0,0 +1,116 @@ +/* statistics/gsl_statistics_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_STATISTICS_FLOAT_H__ +#define __GSL_STATISTICS_FLOAT_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_stats_float_mean (const float data[], const size_t stride, const size_t n); +double gsl_stats_float_variance (const float data[], const size_t stride, const size_t n); +double gsl_stats_float_sd (const float data[], const size_t stride, const size_t n); +double gsl_stats_float_variance_with_fixed_mean (const float data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_float_sd_with_fixed_mean (const float data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_float_tss (const float data[], const size_t stride, const size_t n); +double gsl_stats_float_tss_m (const float data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_float_absdev (const float data[], const size_t stride, const size_t n); +double gsl_stats_float_skew (const float data[], const size_t stride, const size_t n); +double gsl_stats_float_kurtosis (const float data[], const size_t stride, const size_t n); +double gsl_stats_float_lag1_autocorrelation (const float data[], const size_t stride, const size_t n); + +double gsl_stats_float_covariance (const float data1[], const size_t stride1,const float data2[], const size_t stride2, const size_t n); +double gsl_stats_float_correlation (const float data1[], const size_t stride1,const float data2[], const size_t stride2, const size_t n); +double gsl_stats_float_spearman (const float data1[], const size_t stride1, const float data2[], const size_t stride2, const size_t n, double work[]); + +double gsl_stats_float_variance_m (const float data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_float_sd_m (const float data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_float_absdev_m (const float data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_float_skew_m_sd (const float data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_float_kurtosis_m_sd (const float data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_float_lag1_autocorrelation_m (const float data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_float_covariance_m (const float data1[], const size_t stride1,const float data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); + +/* DEFINED FOR FLOATING POINT TYPES ONLY */ + +double gsl_stats_float_wmean (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n); +double gsl_stats_float_wvariance (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n); +double gsl_stats_float_wsd (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n); +double gsl_stats_float_wvariance_with_fixed_mean (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_float_wsd_with_fixed_mean (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_float_wtss (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n); +double gsl_stats_float_wtss_m (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n, const double wmean); +double gsl_stats_float_wabsdev (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n); +double gsl_stats_float_wskew (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n); +double gsl_stats_float_wkurtosis (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n); + +double gsl_stats_float_wvariance_m (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n, const double wmean); +double gsl_stats_float_wsd_m (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n, const double wmean); +double gsl_stats_float_wabsdev_m (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n, const double wmean); +double gsl_stats_float_wskew_m_sd (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n, const double wmean, const double wsd); +double gsl_stats_float_wkurtosis_m_sd (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n, const double wmean, const double wsd); + +/* END OF FLOATING POINT TYPES */ + +double gsl_stats_float_pvariance (const float data1[], const size_t stride1, const size_t n1, const float data2[], const size_t stride2, const size_t n2); +double gsl_stats_float_ttest (const float data1[], const size_t stride1, const size_t n1, const float data2[], const size_t stride2, const size_t n2); + +float gsl_stats_float_max (const float data[], const size_t stride, const size_t n); +float gsl_stats_float_min (const float data[], const size_t stride, const size_t n); +void gsl_stats_float_minmax (float * min, float * max, const float data[], const size_t stride, const size_t n); + +size_t gsl_stats_float_max_index (const float data[], const size_t stride, const size_t n); +size_t gsl_stats_float_min_index (const float data[], const size_t stride, const size_t n); +void gsl_stats_float_minmax_index (size_t * min_index, size_t * max_index, const float data[], const size_t stride, const size_t n); + +float gsl_stats_float_select(float data[], const size_t stride, const size_t n, const size_t k); + +double gsl_stats_float_median_from_sorted_data (const float sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_float_median (float sorted_data[], const size_t stride, const size_t n); +double gsl_stats_float_quantile_from_sorted_data (const float sorted_data[], const size_t stride, const size_t n, const double f) ; + +double gsl_stats_float_trmean_from_sorted_data (const double trim, const float sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_float_gastwirth_from_sorted_data (const float sorted_data[], const size_t stride, const size_t n) ; + +double gsl_stats_float_mad0(const float data[], const size_t stride, const size_t n, double work[]); +double gsl_stats_float_mad(const float data[], const size_t stride, const size_t n, double work[]); + +float gsl_stats_float_Sn0_from_sorted_data (const float sorted_data[], const size_t stride, const size_t n, float work[]) ; +double gsl_stats_float_Sn_from_sorted_data (const float sorted_data[], const size_t stride, const size_t n, float work[]) ; + +float gsl_stats_float_Qn0_from_sorted_data (const float sorted_data[], const size_t stride, const size_t n, float work[], int work_int[]) ; +double gsl_stats_float_Qn_from_sorted_data (const float sorted_data[], const size_t stride, const size_t n, float work[], int work_int[]) ; + +__END_DECLS + +#endif /* __GSL_STATISTICS_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_int.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_int.h new file mode 100644 index 000000000..1d02b3a6b --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_int.h @@ -0,0 +1,96 @@ +/* statistics/gsl_statistics_int.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_STATISTICS_INT_H__ +#define __GSL_STATISTICS_INT_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_stats_int_mean (const int data[], const size_t stride, const size_t n); +double gsl_stats_int_variance (const int data[], const size_t stride, const size_t n); +double gsl_stats_int_sd (const int data[], const size_t stride, const size_t n); +double gsl_stats_int_variance_with_fixed_mean (const int data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_int_sd_with_fixed_mean (const int data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_int_tss (const int data[], const size_t stride, const size_t n); +double gsl_stats_int_tss_m (const int data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_int_absdev (const int data[], const size_t stride, const size_t n); +double gsl_stats_int_skew (const int data[], const size_t stride, const size_t n); +double gsl_stats_int_kurtosis (const int data[], const size_t stride, const size_t n); +double gsl_stats_int_lag1_autocorrelation (const int data[], const size_t stride, const size_t n); + +double gsl_stats_int_covariance (const int data1[], const size_t stride1,const int data2[], const size_t stride2, const size_t n); +double gsl_stats_int_correlation (const int data1[], const size_t stride1,const int data2[], const size_t stride2, const size_t n); +double gsl_stats_int_spearman (const int data1[], const size_t stride1, const int data2[], const size_t stride2, const size_t n, double work[]); + +double gsl_stats_int_variance_m (const int data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_int_sd_m (const int data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_int_absdev_m (const int data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_int_skew_m_sd (const int data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_int_kurtosis_m_sd (const int data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_int_lag1_autocorrelation_m (const int data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_int_covariance_m (const int data1[], const size_t stride1,const int data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); + + +double gsl_stats_int_pvariance (const int data1[], const size_t stride1, const size_t n1, const int data2[], const size_t stride2, const size_t n2); +double gsl_stats_int_ttest (const int data1[], const size_t stride1, const size_t n1, const int data2[], const size_t stride2, const size_t n2); + +int gsl_stats_int_max (const int data[], const size_t stride, const size_t n); +int gsl_stats_int_min (const int data[], const size_t stride, const size_t n); +void gsl_stats_int_minmax (int * min, int * max, const int data[], const size_t stride, const size_t n); + +size_t gsl_stats_int_max_index (const int data[], const size_t stride, const size_t n); +size_t gsl_stats_int_min_index (const int data[], const size_t stride, const size_t n); +void gsl_stats_int_minmax_index (size_t * min_index, size_t * max_index, const int data[], const size_t stride, const size_t n); + +int gsl_stats_int_select(int data[], const size_t stride, const size_t n, const size_t k); + +double gsl_stats_int_median_from_sorted_data (const int sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_int_median (int sorted_data[], const size_t stride, const size_t n); +double gsl_stats_int_quantile_from_sorted_data (const int sorted_data[], const size_t stride, const size_t n, const double f) ; + +double gsl_stats_int_trmean_from_sorted_data (const double trim, const int sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_int_gastwirth_from_sorted_data (const int sorted_data[], const size_t stride, const size_t n) ; + +double gsl_stats_int_mad0(const int data[], const size_t stride, const size_t n, double work[]); +double gsl_stats_int_mad(const int data[], const size_t stride, const size_t n, double work[]); + +int gsl_stats_int_Sn0_from_sorted_data (const int sorted_data[], const size_t stride, const size_t n, int work[]) ; +double gsl_stats_int_Sn_from_sorted_data (const int sorted_data[], const size_t stride, const size_t n, int work[]) ; + +int gsl_stats_int_Qn0_from_sorted_data (const int sorted_data[], const size_t stride, const size_t n, int work[], int work_int[]) ; +double gsl_stats_int_Qn_from_sorted_data (const int sorted_data[], const size_t stride, const size_t n, int work[], int work_int[]) ; + +__END_DECLS + +#endif /* __GSL_STATISTICS_INT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_long.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_long.h new file mode 100644 index 000000000..5bc4bbd7c --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_long.h @@ -0,0 +1,96 @@ +/* statistics/gsl_statistics_long.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_STATISTICS_LONG_H__ +#define __GSL_STATISTICS_LONG_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_stats_long_mean (const long data[], const size_t stride, const size_t n); +double gsl_stats_long_variance (const long data[], const size_t stride, const size_t n); +double gsl_stats_long_sd (const long data[], const size_t stride, const size_t n); +double gsl_stats_long_variance_with_fixed_mean (const long data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_long_sd_with_fixed_mean (const long data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_long_tss (const long data[], const size_t stride, const size_t n); +double gsl_stats_long_tss_m (const long data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_long_absdev (const long data[], const size_t stride, const size_t n); +double gsl_stats_long_skew (const long data[], const size_t stride, const size_t n); +double gsl_stats_long_kurtosis (const long data[], const size_t stride, const size_t n); +double gsl_stats_long_lag1_autocorrelation (const long data[], const size_t stride, const size_t n); + +double gsl_stats_long_covariance (const long data1[], const size_t stride1,const long data2[], const size_t stride2, const size_t n); +double gsl_stats_long_correlation (const long data1[], const size_t stride1,const long data2[], const size_t stride2, const size_t n); +double gsl_stats_long_spearman (const long data1[], const size_t stride1, const long data2[], const size_t stride2, const size_t n, double work[]); + +double gsl_stats_long_variance_m (const long data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_long_sd_m (const long data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_long_absdev_m (const long data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_long_skew_m_sd (const long data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_long_kurtosis_m_sd (const long data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_long_lag1_autocorrelation_m (const long data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_long_covariance_m (const long data1[], const size_t stride1,const long data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); + + +double gsl_stats_long_pvariance (const long data1[], const size_t stride1, const size_t n1, const long data2[], const size_t stride2, const size_t n2); +double gsl_stats_long_ttest (const long data1[], const size_t stride1, const size_t n1, const long data2[], const size_t stride2, const size_t n2); + +long gsl_stats_long_max (const long data[], const size_t stride, const size_t n); +long gsl_stats_long_min (const long data[], const size_t stride, const size_t n); +void gsl_stats_long_minmax (long * min, long * max, const long data[], const size_t stride, const size_t n); + +size_t gsl_stats_long_max_index (const long data[], const size_t stride, const size_t n); +size_t gsl_stats_long_min_index (const long data[], const size_t stride, const size_t n); +void gsl_stats_long_minmax_index (size_t * min_index, size_t * max_index, const long data[], const size_t stride, const size_t n); + +long gsl_stats_long_select(long data[], const size_t stride, const size_t n, const size_t k); + +double gsl_stats_long_median_from_sorted_data (const long sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_long_median (long sorted_data[], const size_t stride, const size_t n); +double gsl_stats_long_quantile_from_sorted_data (const long sorted_data[], const size_t stride, const size_t n, const double f) ; + +double gsl_stats_long_trmean_from_sorted_data (const double trim, const long sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_long_gastwirth_from_sorted_data (const long sorted_data[], const size_t stride, const size_t n) ; + +double gsl_stats_long_mad0(const long data[], const size_t stride, const size_t n, double work[]); +double gsl_stats_long_mad(const long data[], const size_t stride, const size_t n, double work[]); + +long gsl_stats_long_Sn0_from_sorted_data (const long sorted_data[], const size_t stride, const size_t n, long work[]) ; +double gsl_stats_long_Sn_from_sorted_data (const long sorted_data[], const size_t stride, const size_t n, long work[]) ; + +long gsl_stats_long_Qn0_from_sorted_data (const long sorted_data[], const size_t stride, const size_t n, long work[], int work_int[]) ; +double gsl_stats_long_Qn_from_sorted_data (const long sorted_data[], const size_t stride, const size_t n, long work[], int work_int[]) ; + +__END_DECLS + +#endif /* __GSL_STATISTICS_LONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_long_double.h new file mode 100644 index 000000000..6b384271d --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_long_double.h @@ -0,0 +1,116 @@ +/* statistics/gsl_statistics_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_STATISTICS_LONG_DOUBLE_H__ +#define __GSL_STATISTICS_LONG_DOUBLE_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_stats_long_double_mean (const long double data[], const size_t stride, const size_t n); +double gsl_stats_long_double_variance (const long double data[], const size_t stride, const size_t n); +double gsl_stats_long_double_sd (const long double data[], const size_t stride, const size_t n); +double gsl_stats_long_double_variance_with_fixed_mean (const long double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_long_double_sd_with_fixed_mean (const long double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_long_double_tss (const long double data[], const size_t stride, const size_t n); +double gsl_stats_long_double_tss_m (const long double data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_long_double_absdev (const long double data[], const size_t stride, const size_t n); +double gsl_stats_long_double_skew (const long double data[], const size_t stride, const size_t n); +double gsl_stats_long_double_kurtosis (const long double data[], const size_t stride, const size_t n); +double gsl_stats_long_double_lag1_autocorrelation (const long double data[], const size_t stride, const size_t n); + +double gsl_stats_long_double_covariance (const long double data1[], const size_t stride1,const long double data2[], const size_t stride2, const size_t n); +double gsl_stats_long_double_correlation (const long double data1[], const size_t stride1,const long double data2[], const size_t stride2, const size_t n); +double gsl_stats_long_double_spearman (const long double data1[], const size_t stride1, const long double data2[], const size_t stride2, const size_t n, double work[]); + +double gsl_stats_long_double_variance_m (const long double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_long_double_sd_m (const long double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_long_double_absdev_m (const long double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_long_double_skew_m_sd (const long double data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_long_double_kurtosis_m_sd (const long double data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_long_double_lag1_autocorrelation_m (const long double data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_long_double_covariance_m (const long double data1[], const size_t stride1,const long double data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); + +/* DEFINED FOR FLOATING POINT TYPES ONLY */ + +double gsl_stats_long_double_wmean (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n); +double gsl_stats_long_double_wvariance (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n); +double gsl_stats_long_double_wsd (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n); +double gsl_stats_long_double_wvariance_with_fixed_mean (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_long_double_wsd_with_fixed_mean (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_long_double_wtss (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n); +double gsl_stats_long_double_wtss_m (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n, const double wmean); +double gsl_stats_long_double_wabsdev (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n); +double gsl_stats_long_double_wskew (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n); +double gsl_stats_long_double_wkurtosis (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n); + +double gsl_stats_long_double_wvariance_m (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n, const double wmean); +double gsl_stats_long_double_wsd_m (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n, const double wmean); +double gsl_stats_long_double_wabsdev_m (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n, const double wmean); +double gsl_stats_long_double_wskew_m_sd (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n, const double wmean, const double wsd); +double gsl_stats_long_double_wkurtosis_m_sd (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n, const double wmean, const double wsd); + +/* END OF FLOATING POINT TYPES */ + +double gsl_stats_long_double_pvariance (const long double data1[], const size_t stride1, const size_t n1, const long double data2[], const size_t stride2, const size_t n2); +double gsl_stats_long_double_ttest (const long double data1[], const size_t stride1, const size_t n1, const long double data2[], const size_t stride2, const size_t n2); + +long double gsl_stats_long_double_max (const long double data[], const size_t stride, const size_t n); +long double gsl_stats_long_double_min (const long double data[], const size_t stride, const size_t n); +void gsl_stats_long_double_minmax (long double * min, long double * max, const long double data[], const size_t stride, const size_t n); + +size_t gsl_stats_long_double_max_index (const long double data[], const size_t stride, const size_t n); +size_t gsl_stats_long_double_min_index (const long double data[], const size_t stride, const size_t n); +void gsl_stats_long_double_minmax_index (size_t * min_index, size_t * max_index, const long double data[], const size_t stride, const size_t n); + +long double gsl_stats_long_double_select(long double data[], const size_t stride, const size_t n, const size_t k); + +double gsl_stats_long_double_median_from_sorted_data (const long double sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_long_double_median (long double sorted_data[], const size_t stride, const size_t n); +double gsl_stats_long_double_quantile_from_sorted_data (const long double sorted_data[], const size_t stride, const size_t n, const double f) ; + +double gsl_stats_long_double_trmean_from_sorted_data (const double trim, const long double sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_long_double_gastwirth_from_sorted_data (const long double sorted_data[], const size_t stride, const size_t n) ; + +double gsl_stats_long_double_mad0(const long double data[], const size_t stride, const size_t n, double work[]); +double gsl_stats_long_double_mad(const long double data[], const size_t stride, const size_t n, double work[]); + +long double gsl_stats_long_double_Sn0_from_sorted_data (const long double sorted_data[], const size_t stride, const size_t n, long double work[]) ; +double gsl_stats_long_double_Sn_from_sorted_data (const long double sorted_data[], const size_t stride, const size_t n, long double work[]) ; + +long double gsl_stats_long_double_Qn0_from_sorted_data (const long double sorted_data[], const size_t stride, const size_t n, long double work[], int work_int[]) ; +double gsl_stats_long_double_Qn_from_sorted_data (const long double sorted_data[], const size_t stride, const size_t n, long double work[], int work_int[]) ; + +__END_DECLS + +#endif /* __GSL_STATISTICS_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_short.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_short.h new file mode 100644 index 000000000..8ecaceeaa --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_short.h @@ -0,0 +1,96 @@ +/* statistics/gsl_statistics_short.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_STATISTICS_SHORT_H__ +#define __GSL_STATISTICS_SHORT_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_stats_short_mean (const short data[], const size_t stride, const size_t n); +double gsl_stats_short_variance (const short data[], const size_t stride, const size_t n); +double gsl_stats_short_sd (const short data[], const size_t stride, const size_t n); +double gsl_stats_short_variance_with_fixed_mean (const short data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_short_sd_with_fixed_mean (const short data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_short_tss (const short data[], const size_t stride, const size_t n); +double gsl_stats_short_tss_m (const short data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_short_absdev (const short data[], const size_t stride, const size_t n); +double gsl_stats_short_skew (const short data[], const size_t stride, const size_t n); +double gsl_stats_short_kurtosis (const short data[], const size_t stride, const size_t n); +double gsl_stats_short_lag1_autocorrelation (const short data[], const size_t stride, const size_t n); + +double gsl_stats_short_covariance (const short data1[], const size_t stride1,const short data2[], const size_t stride2, const size_t n); +double gsl_stats_short_correlation (const short data1[], const size_t stride1,const short data2[], const size_t stride2, const size_t n); +double gsl_stats_short_spearman (const short data1[], const size_t stride1, const short data2[], const size_t stride2, const size_t n, double work[]); + +double gsl_stats_short_variance_m (const short data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_short_sd_m (const short data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_short_absdev_m (const short data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_short_skew_m_sd (const short data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_short_kurtosis_m_sd (const short data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_short_lag1_autocorrelation_m (const short data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_short_covariance_m (const short data1[], const size_t stride1,const short data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); + + +double gsl_stats_short_pvariance (const short data1[], const size_t stride1, const size_t n1, const short data2[], const size_t stride2, const size_t n2); +double gsl_stats_short_ttest (const short data1[], const size_t stride1, const size_t n1, const short data2[], const size_t stride2, const size_t n2); + +short gsl_stats_short_max (const short data[], const size_t stride, const size_t n); +short gsl_stats_short_min (const short data[], const size_t stride, const size_t n); +void gsl_stats_short_minmax (short * min, short * max, const short data[], const size_t stride, const size_t n); + +size_t gsl_stats_short_max_index (const short data[], const size_t stride, const size_t n); +size_t gsl_stats_short_min_index (const short data[], const size_t stride, const size_t n); +void gsl_stats_short_minmax_index (size_t * min_index, size_t * max_index, const short data[], const size_t stride, const size_t n); + +short gsl_stats_short_select(short data[], const size_t stride, const size_t n, const size_t k); + +double gsl_stats_short_median_from_sorted_data (const short sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_short_median (short sorted_data[], const size_t stride, const size_t n); +double gsl_stats_short_quantile_from_sorted_data (const short sorted_data[], const size_t stride, const size_t n, const double f) ; + +double gsl_stats_short_trmean_from_sorted_data (const double trim, const short sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_short_gastwirth_from_sorted_data (const short sorted_data[], const size_t stride, const size_t n) ; + +double gsl_stats_short_mad0(const short data[], const size_t stride, const size_t n, double work[]); +double gsl_stats_short_mad(const short data[], const size_t stride, const size_t n, double work[]); + +short gsl_stats_short_Sn0_from_sorted_data (const short sorted_data[], const size_t stride, const size_t n, short work[]) ; +double gsl_stats_short_Sn_from_sorted_data (const short sorted_data[], const size_t stride, const size_t n, short work[]) ; + +short gsl_stats_short_Qn0_from_sorted_data (const short sorted_data[], const size_t stride, const size_t n, short work[], int work_int[]) ; +double gsl_stats_short_Qn_from_sorted_data (const short sorted_data[], const size_t stride, const size_t n, short work[], int work_int[]) ; + +__END_DECLS + +#endif /* __GSL_STATISTICS_SHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_uchar.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_uchar.h new file mode 100644 index 000000000..e5f549b01 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_uchar.h @@ -0,0 +1,96 @@ +/* statistics/gsl_statistics_uchar.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_STATISTICS_UCHAR_H__ +#define __GSL_STATISTICS_UCHAR_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_stats_uchar_mean (const unsigned char data[], const size_t stride, const size_t n); +double gsl_stats_uchar_variance (const unsigned char data[], const size_t stride, const size_t n); +double gsl_stats_uchar_sd (const unsigned char data[], const size_t stride, const size_t n); +double gsl_stats_uchar_variance_with_fixed_mean (const unsigned char data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_uchar_sd_with_fixed_mean (const unsigned char data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_uchar_tss (const unsigned char data[], const size_t stride, const size_t n); +double gsl_stats_uchar_tss_m (const unsigned char data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_uchar_absdev (const unsigned char data[], const size_t stride, const size_t n); +double gsl_stats_uchar_skew (const unsigned char data[], const size_t stride, const size_t n); +double gsl_stats_uchar_kurtosis (const unsigned char data[], const size_t stride, const size_t n); +double gsl_stats_uchar_lag1_autocorrelation (const unsigned char data[], const size_t stride, const size_t n); + +double gsl_stats_uchar_covariance (const unsigned char data1[], const size_t stride1,const unsigned char data2[], const size_t stride2, const size_t n); +double gsl_stats_uchar_correlation (const unsigned char data1[], const size_t stride1,const unsigned char data2[], const size_t stride2, const size_t n); +double gsl_stats_uchar_spearman (const unsigned char data1[], const size_t stride1, const unsigned char data2[], const size_t stride2, const size_t n, double work[]); + +double gsl_stats_uchar_variance_m (const unsigned char data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_uchar_sd_m (const unsigned char data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_uchar_absdev_m (const unsigned char data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_uchar_skew_m_sd (const unsigned char data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_uchar_kurtosis_m_sd (const unsigned char data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_uchar_lag1_autocorrelation_m (const unsigned char data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_uchar_covariance_m (const unsigned char data1[], const size_t stride1,const unsigned char data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); + + +double gsl_stats_uchar_pvariance (const unsigned char data1[], const size_t stride1, const size_t n1, const unsigned char data2[], const size_t stride2, const size_t n2); +double gsl_stats_uchar_ttest (const unsigned char data1[], const size_t stride1, const size_t n1, const unsigned char data2[], const size_t stride2, const size_t n2); + +unsigned char gsl_stats_uchar_max (const unsigned char data[], const size_t stride, const size_t n); +unsigned char gsl_stats_uchar_min (const unsigned char data[], const size_t stride, const size_t n); +void gsl_stats_uchar_minmax (unsigned char * min, unsigned char * max, const unsigned char data[], const size_t stride, const size_t n); + +size_t gsl_stats_uchar_max_index (const unsigned char data[], const size_t stride, const size_t n); +size_t gsl_stats_uchar_min_index (const unsigned char data[], const size_t stride, const size_t n); +void gsl_stats_uchar_minmax_index (size_t * min_index, size_t * max_index, const unsigned char data[], const size_t stride, const size_t n); + +unsigned char gsl_stats_uchar_select(unsigned char data[], const size_t stride, const size_t n, const size_t k); + +double gsl_stats_uchar_median_from_sorted_data (const unsigned char sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_uchar_median (unsigned char sorted_data[], const size_t stride, const size_t n); +double gsl_stats_uchar_quantile_from_sorted_data (const unsigned char sorted_data[], const size_t stride, const size_t n, const double f) ; + +double gsl_stats_uchar_trmean_from_sorted_data (const double trim, const unsigned char sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_uchar_gastwirth_from_sorted_data (const unsigned char sorted_data[], const size_t stride, const size_t n) ; + +double gsl_stats_uchar_mad0(const unsigned char data[], const size_t stride, const size_t n, double work[]); +double gsl_stats_uchar_mad(const unsigned char data[], const size_t stride, const size_t n, double work[]); + +unsigned char gsl_stats_uchar_Sn0_from_sorted_data (const unsigned char sorted_data[], const size_t stride, const size_t n, unsigned char work[]) ; +double gsl_stats_uchar_Sn_from_sorted_data (const unsigned char sorted_data[], const size_t stride, const size_t n, unsigned char work[]) ; + +unsigned char gsl_stats_uchar_Qn0_from_sorted_data (const unsigned char sorted_data[], const size_t stride, const size_t n, unsigned char work[], int work_int[]) ; +double gsl_stats_uchar_Qn_from_sorted_data (const unsigned char sorted_data[], const size_t stride, const size_t n, unsigned char work[], int work_int[]) ; + +__END_DECLS + +#endif /* __GSL_STATISTICS_UCHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_uint.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_uint.h new file mode 100644 index 000000000..fca9e7d5a --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_uint.h @@ -0,0 +1,96 @@ +/* statistics/gsl_statistics_uint.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_STATISTICS_UINT_H__ +#define __GSL_STATISTICS_UINT_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_stats_uint_mean (const unsigned int data[], const size_t stride, const size_t n); +double gsl_stats_uint_variance (const unsigned int data[], const size_t stride, const size_t n); +double gsl_stats_uint_sd (const unsigned int data[], const size_t stride, const size_t n); +double gsl_stats_uint_variance_with_fixed_mean (const unsigned int data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_uint_sd_with_fixed_mean (const unsigned int data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_uint_tss (const unsigned int data[], const size_t stride, const size_t n); +double gsl_stats_uint_tss_m (const unsigned int data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_uint_absdev (const unsigned int data[], const size_t stride, const size_t n); +double gsl_stats_uint_skew (const unsigned int data[], const size_t stride, const size_t n); +double gsl_stats_uint_kurtosis (const unsigned int data[], const size_t stride, const size_t n); +double gsl_stats_uint_lag1_autocorrelation (const unsigned int data[], const size_t stride, const size_t n); + +double gsl_stats_uint_covariance (const unsigned int data1[], const size_t stride1,const unsigned int data2[], const size_t stride2, const size_t n); +double gsl_stats_uint_correlation (const unsigned int data1[], const size_t stride1,const unsigned int data2[], const size_t stride2, const size_t n); +double gsl_stats_uint_spearman (const unsigned int data1[], const size_t stride1, const unsigned int data2[], const size_t stride2, const size_t n, double work[]); + +double gsl_stats_uint_variance_m (const unsigned int data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_uint_sd_m (const unsigned int data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_uint_absdev_m (const unsigned int data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_uint_skew_m_sd (const unsigned int data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_uint_kurtosis_m_sd (const unsigned int data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_uint_lag1_autocorrelation_m (const unsigned int data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_uint_covariance_m (const unsigned int data1[], const size_t stride1,const unsigned int data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); + + +double gsl_stats_uint_pvariance (const unsigned int data1[], const size_t stride1, const size_t n1, const unsigned int data2[], const size_t stride2, const size_t n2); +double gsl_stats_uint_ttest (const unsigned int data1[], const size_t stride1, const size_t n1, const unsigned int data2[], const size_t stride2, const size_t n2); + +unsigned int gsl_stats_uint_max (const unsigned int data[], const size_t stride, const size_t n); +unsigned int gsl_stats_uint_min (const unsigned int data[], const size_t stride, const size_t n); +void gsl_stats_uint_minmax (unsigned int * min, unsigned int * max, const unsigned int data[], const size_t stride, const size_t n); + +size_t gsl_stats_uint_max_index (const unsigned int data[], const size_t stride, const size_t n); +size_t gsl_stats_uint_min_index (const unsigned int data[], const size_t stride, const size_t n); +void gsl_stats_uint_minmax_index (size_t * min_index, size_t * max_index, const unsigned int data[], const size_t stride, const size_t n); + +unsigned int gsl_stats_uint_select(unsigned int data[], const size_t stride, const size_t n, const size_t k); + +double gsl_stats_uint_median_from_sorted_data (const unsigned int sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_uint_median (unsigned int sorted_data[], const size_t stride, const size_t n); +double gsl_stats_uint_quantile_from_sorted_data (const unsigned int sorted_data[], const size_t stride, const size_t n, const double f) ; + +double gsl_stats_uint_trmean_from_sorted_data (const double trim, const unsigned int sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_uint_gastwirth_from_sorted_data (const unsigned int sorted_data[], const size_t stride, const size_t n) ; + +double gsl_stats_uint_mad0(const unsigned int data[], const size_t stride, const size_t n, double work[]); +double gsl_stats_uint_mad(const unsigned int data[], const size_t stride, const size_t n, double work[]); + +unsigned int gsl_stats_uint_Sn0_from_sorted_data (const unsigned int sorted_data[], const size_t stride, const size_t n, unsigned int work[]) ; +double gsl_stats_uint_Sn_from_sorted_data (const unsigned int sorted_data[], const size_t stride, const size_t n, unsigned int work[]) ; + +unsigned int gsl_stats_uint_Qn0_from_sorted_data (const unsigned int sorted_data[], const size_t stride, const size_t n, unsigned int work[], int work_int[]) ; +double gsl_stats_uint_Qn_from_sorted_data (const unsigned int sorted_data[], const size_t stride, const size_t n, unsigned int work[], int work_int[]) ; + +__END_DECLS + +#endif /* __GSL_STATISTICS_UINT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_ulong.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_ulong.h new file mode 100644 index 000000000..2957fd142 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_ulong.h @@ -0,0 +1,96 @@ +/* statistics/gsl_statistics_ulong.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_STATISTICS_ULONG_H__ +#define __GSL_STATISTICS_ULONG_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_stats_ulong_mean (const unsigned long data[], const size_t stride, const size_t n); +double gsl_stats_ulong_variance (const unsigned long data[], const size_t stride, const size_t n); +double gsl_stats_ulong_sd (const unsigned long data[], const size_t stride, const size_t n); +double gsl_stats_ulong_variance_with_fixed_mean (const unsigned long data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_ulong_sd_with_fixed_mean (const unsigned long data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_ulong_tss (const unsigned long data[], const size_t stride, const size_t n); +double gsl_stats_ulong_tss_m (const unsigned long data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_ulong_absdev (const unsigned long data[], const size_t stride, const size_t n); +double gsl_stats_ulong_skew (const unsigned long data[], const size_t stride, const size_t n); +double gsl_stats_ulong_kurtosis (const unsigned long data[], const size_t stride, const size_t n); +double gsl_stats_ulong_lag1_autocorrelation (const unsigned long data[], const size_t stride, const size_t n); + +double gsl_stats_ulong_covariance (const unsigned long data1[], const size_t stride1,const unsigned long data2[], const size_t stride2, const size_t n); +double gsl_stats_ulong_correlation (const unsigned long data1[], const size_t stride1,const unsigned long data2[], const size_t stride2, const size_t n); +double gsl_stats_ulong_spearman (const unsigned long data1[], const size_t stride1, const unsigned long data2[], const size_t stride2, const size_t n, double work[]); + +double gsl_stats_ulong_variance_m (const unsigned long data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_ulong_sd_m (const unsigned long data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_ulong_absdev_m (const unsigned long data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_ulong_skew_m_sd (const unsigned long data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_ulong_kurtosis_m_sd (const unsigned long data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_ulong_lag1_autocorrelation_m (const unsigned long data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_ulong_covariance_m (const unsigned long data1[], const size_t stride1,const unsigned long data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); + + +double gsl_stats_ulong_pvariance (const unsigned long data1[], const size_t stride1, const size_t n1, const unsigned long data2[], const size_t stride2, const size_t n2); +double gsl_stats_ulong_ttest (const unsigned long data1[], const size_t stride1, const size_t n1, const unsigned long data2[], const size_t stride2, const size_t n2); + +unsigned long gsl_stats_ulong_max (const unsigned long data[], const size_t stride, const size_t n); +unsigned long gsl_stats_ulong_min (const unsigned long data[], const size_t stride, const size_t n); +void gsl_stats_ulong_minmax (unsigned long * min, unsigned long * max, const unsigned long data[], const size_t stride, const size_t n); + +size_t gsl_stats_ulong_max_index (const unsigned long data[], const size_t stride, const size_t n); +size_t gsl_stats_ulong_min_index (const unsigned long data[], const size_t stride, const size_t n); +void gsl_stats_ulong_minmax_index (size_t * min_index, size_t * max_index, const unsigned long data[], const size_t stride, const size_t n); + +unsigned long gsl_stats_ulong_select(unsigned long data[], const size_t stride, const size_t n, const size_t k); + +double gsl_stats_ulong_median_from_sorted_data (const unsigned long sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_ulong_median (unsigned long sorted_data[], const size_t stride, const size_t n); +double gsl_stats_ulong_quantile_from_sorted_data (const unsigned long sorted_data[], const size_t stride, const size_t n, const double f) ; + +double gsl_stats_ulong_trmean_from_sorted_data (const double trim, const unsigned long sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_ulong_gastwirth_from_sorted_data (const unsigned long sorted_data[], const size_t stride, const size_t n) ; + +double gsl_stats_ulong_mad0(const unsigned long data[], const size_t stride, const size_t n, double work[]); +double gsl_stats_ulong_mad(const unsigned long data[], const size_t stride, const size_t n, double work[]); + +unsigned long gsl_stats_ulong_Sn0_from_sorted_data (const unsigned long sorted_data[], const size_t stride, const size_t n, unsigned long work[]) ; +double gsl_stats_ulong_Sn_from_sorted_data (const unsigned long sorted_data[], const size_t stride, const size_t n, unsigned long work[]) ; + +unsigned long gsl_stats_ulong_Qn0_from_sorted_data (const unsigned long sorted_data[], const size_t stride, const size_t n, unsigned long work[], int work_int[]) ; +double gsl_stats_ulong_Qn_from_sorted_data (const unsigned long sorted_data[], const size_t stride, const size_t n, unsigned long work[], int work_int[]) ; + +__END_DECLS + +#endif /* __GSL_STATISTICS_ULONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_ushort.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_ushort.h new file mode 100644 index 000000000..7625f5d47 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_ushort.h @@ -0,0 +1,96 @@ +/* statistics/gsl_statistics_ushort.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_STATISTICS_USHORT_H__ +#define __GSL_STATISTICS_USHORT_H__ + +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_stats_ushort_mean (const unsigned short data[], const size_t stride, const size_t n); +double gsl_stats_ushort_variance (const unsigned short data[], const size_t stride, const size_t n); +double gsl_stats_ushort_sd (const unsigned short data[], const size_t stride, const size_t n); +double gsl_stats_ushort_variance_with_fixed_mean (const unsigned short data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_ushort_sd_with_fixed_mean (const unsigned short data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_ushort_tss (const unsigned short data[], const size_t stride, const size_t n); +double gsl_stats_ushort_tss_m (const unsigned short data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_ushort_absdev (const unsigned short data[], const size_t stride, const size_t n); +double gsl_stats_ushort_skew (const unsigned short data[], const size_t stride, const size_t n); +double gsl_stats_ushort_kurtosis (const unsigned short data[], const size_t stride, const size_t n); +double gsl_stats_ushort_lag1_autocorrelation (const unsigned short data[], const size_t stride, const size_t n); + +double gsl_stats_ushort_covariance (const unsigned short data1[], const size_t stride1,const unsigned short data2[], const size_t stride2, const size_t n); +double gsl_stats_ushort_correlation (const unsigned short data1[], const size_t stride1,const unsigned short data2[], const size_t stride2, const size_t n); +double gsl_stats_ushort_spearman (const unsigned short data1[], const size_t stride1, const unsigned short data2[], const size_t stride2, const size_t n, double work[]); + +double gsl_stats_ushort_variance_m (const unsigned short data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_ushort_sd_m (const unsigned short data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_ushort_absdev_m (const unsigned short data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_ushort_skew_m_sd (const unsigned short data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_ushort_kurtosis_m_sd (const unsigned short data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_ushort_lag1_autocorrelation_m (const unsigned short data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_ushort_covariance_m (const unsigned short data1[], const size_t stride1,const unsigned short data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); + + +double gsl_stats_ushort_pvariance (const unsigned short data1[], const size_t stride1, const size_t n1, const unsigned short data2[], const size_t stride2, const size_t n2); +double gsl_stats_ushort_ttest (const unsigned short data1[], const size_t stride1, const size_t n1, const unsigned short data2[], const size_t stride2, const size_t n2); + +unsigned short gsl_stats_ushort_max (const unsigned short data[], const size_t stride, const size_t n); +unsigned short gsl_stats_ushort_min (const unsigned short data[], const size_t stride, const size_t n); +void gsl_stats_ushort_minmax (unsigned short * min, unsigned short * max, const unsigned short data[], const size_t stride, const size_t n); + +size_t gsl_stats_ushort_max_index (const unsigned short data[], const size_t stride, const size_t n); +size_t gsl_stats_ushort_min_index (const unsigned short data[], const size_t stride, const size_t n); +void gsl_stats_ushort_minmax_index (size_t * min_index, size_t * max_index, const unsigned short data[], const size_t stride, const size_t n); + +unsigned short gsl_stats_ushort_select(unsigned short data[], const size_t stride, const size_t n, const size_t k); + +double gsl_stats_ushort_median_from_sorted_data (const unsigned short sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_ushort_median (unsigned short sorted_data[], const size_t stride, const size_t n); +double gsl_stats_ushort_quantile_from_sorted_data (const unsigned short sorted_data[], const size_t stride, const size_t n, const double f) ; + +double gsl_stats_ushort_trmean_from_sorted_data (const double trim, const unsigned short sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_ushort_gastwirth_from_sorted_data (const unsigned short sorted_data[], const size_t stride, const size_t n) ; + +double gsl_stats_ushort_mad0(const unsigned short data[], const size_t stride, const size_t n, double work[]); +double gsl_stats_ushort_mad(const unsigned short data[], const size_t stride, const size_t n, double work[]); + +unsigned short gsl_stats_ushort_Sn0_from_sorted_data (const unsigned short sorted_data[], const size_t stride, const size_t n, unsigned short work[]) ; +double gsl_stats_ushort_Sn_from_sorted_data (const unsigned short sorted_data[], const size_t stride, const size_t n, unsigned short work[]) ; + +unsigned short gsl_stats_ushort_Qn0_from_sorted_data (const unsigned short sorted_data[], const size_t stride, const size_t n, unsigned short work[], int work_int[]) ; +double gsl_stats_ushort_Qn_from_sorted_data (const unsigned short sorted_data[], const size_t stride, const size_t n, unsigned short work[], int work_int[]) ; + +__END_DECLS + +#endif /* __GSL_STATISTICS_USHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sum.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sum.h new file mode 100644 index 000000000..d9c4da81a --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sum.h @@ -0,0 +1,162 @@ +/* sum/gsl_sum.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + + +#ifndef __GSL_SUM_H__ +#define __GSL_SUM_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* Workspace for Levin U Transform with error estimation, + * + * size = number of terms the workspace can handle + * sum_plain = simple sum of series + * q_num = backward diagonal of numerator; length = size + * q_den = backward diagonal of denominator; length = size + * dq_num = table of numerator derivatives; length = size**2 + * dq_den = table of denominator derivatives; length = size**2 + * dsum = derivative of sum wrt term i; length = size + */ + +typedef struct +{ + size_t size; + size_t i; /* position in array */ + size_t terms_used; /* number of calls */ + double sum_plain; + double *q_num; + double *q_den; + double *dq_num; + double *dq_den; + double *dsum; +} +gsl_sum_levin_u_workspace; + +gsl_sum_levin_u_workspace *gsl_sum_levin_u_alloc (size_t n); +void gsl_sum_levin_u_free (gsl_sum_levin_u_workspace * w); + +/* Basic Levin-u acceleration method. + * + * array = array of series elements + * n = size of array + * sum_accel = result of summation acceleration + * err = estimated error + * + * See [Fessler et al., ACM TOMS 9, 346 (1983) and TOMS-602] + */ + +int gsl_sum_levin_u_accel (const double *array, + const size_t n, + gsl_sum_levin_u_workspace * w, + double *sum_accel, double *abserr); + +/* Basic Levin-u acceleration method with constraints on the terms + * used, + * + * array = array of series elements + * n = size of array + * min_terms = minimum number of terms to sum + * max_terms = maximum number of terms to sum + * sum_accel = result of summation acceleration + * err = estimated error + * + * See [Fessler et al., ACM TOMS 9, 346 (1983) and TOMS-602] + */ + +int gsl_sum_levin_u_minmax (const double *array, + const size_t n, + const size_t min_terms, + const size_t max_terms, + gsl_sum_levin_u_workspace * w, + double *sum_accel, double *abserr); + +/* Basic Levin-u step w/o reference to the array of terms. + * We only need to specify the value of the current term + * to execute the step. See TOMS-745. + * + * sum = t0 + ... + t_{n-1} + term; term = t_{n} + * + * term = value of the series term to be added + * n = position of term in series (starting from 0) + * sum_accel = result of summation acceleration + * sum_plain = simple sum of series + */ + +int +gsl_sum_levin_u_step (const double term, + const size_t n, + const size_t nmax, + gsl_sum_levin_u_workspace * w, + double *sum_accel); + +/* The following functions perform the same calculation without + estimating the errors. They require O(N) storage instead of O(N^2). + This may be useful for summing many similar series where the size + of the error has already been estimated reliably and is not + expected to change. */ + +typedef struct +{ + size_t size; + size_t i; /* position in array */ + size_t terms_used; /* number of calls */ + double sum_plain; + double *q_num; + double *q_den; + double *dsum; +} +gsl_sum_levin_utrunc_workspace; + +gsl_sum_levin_utrunc_workspace *gsl_sum_levin_utrunc_alloc (size_t n); +void gsl_sum_levin_utrunc_free (gsl_sum_levin_utrunc_workspace * w); + +int gsl_sum_levin_utrunc_accel (const double *array, + const size_t n, + gsl_sum_levin_utrunc_workspace * w, + double *sum_accel, double *abserr_trunc); + +int gsl_sum_levin_utrunc_minmax (const double *array, + const size_t n, + const size_t min_terms, + const size_t max_terms, + gsl_sum_levin_utrunc_workspace * w, + double *sum_accel, double *abserr_trunc); + +int gsl_sum_levin_utrunc_step (const double term, + const size_t n, + gsl_sum_levin_utrunc_workspace * w, + double *sum_accel); + +__END_DECLS + +#endif /* __GSL_SUM_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sys.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sys.h new file mode 100644 index 000000000..25e134862 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sys.h @@ -0,0 +1,63 @@ +/* sys/gsl_sys.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SYS_H__ +#define __GSL_SYS_H__ + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_log1p (const double x); +double gsl_expm1 (const double x); +double gsl_hypot (const double x, const double y); +double gsl_hypot3 (const double x, const double y, const double z); +double gsl_acosh (const double x); +double gsl_asinh (const double x); +double gsl_atanh (const double x); + +int gsl_isnan (const double x); +int gsl_isinf (const double x); +int gsl_finite (const double x); + +double gsl_nan (void); +double gsl_posinf (void); +double gsl_neginf (void); +double gsl_fdiv (const double x, const double y); + +double gsl_coerce_double (const double x); +float gsl_coerce_float (const float x); +long double gsl_coerce_long_double (const long double x); + +double gsl_ldexp(const double x, const int e); +double gsl_frexp(const double x, int * e); + +int gsl_fcmp (const double x1, const double x2, const double epsilon); + +__END_DECLS + +#endif /* __GSL_SYS_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_test.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_test.h new file mode 100644 index 000000000..bb86896ce --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_test.h @@ -0,0 +1,66 @@ +/* err/gsl_test.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_TEST_H__ +#define __GSL_TEST_H__ + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void + gsl_test (int status, const char *test_description, ...); + +void +gsl_test_rel (double result, double expected, double relative_error, + const char *test_description, ...) ; + +void +gsl_test_abs (double result, double expected, double absolute_error, + const char *test_description, ...) ; + +void +gsl_test_factor (double result, double expected, double factor, + const char *test_description, ...) ; + +void +gsl_test_int (int result, int expected, const char *test_description, ...) ; + +void +gsl_test_str (const char * result, const char * expected, + const char *test_description, ...) ; + +void + gsl_test_verbose (int verbose) ; + +int + gsl_test_summary (void) ; + + +__END_DECLS + +#endif /* __GSL_TEST_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_types.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_types.h new file mode 100644 index 000000000..0330f551f --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_types.h @@ -0,0 +1,41 @@ +/* gsl_types.h + * + * Copyright (C) 2001, 2007 Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_TYPES_H__ +#define __GSL_TYPES_H__ + +#ifndef GSL_VAR + +#ifdef WIN32 +# ifdef GSL_DLL +# ifdef DLL_EXPORT +# define GSL_VAR extern __declspec(dllexport) +# else +# define GSL_VAR extern __declspec(dllimport) +# endif +# else +# define GSL_VAR extern +# endif +#else +# define GSL_VAR extern +#endif + +#endif + +#endif /* __GSL_TYPES_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector.h new file mode 100644 index 000000000..cf762e42f --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector.h @@ -0,0 +1,25 @@ +#ifndef __GSL_VECTOR_H__ +#define __GSL_VECTOR_H__ + +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include + + +#endif /* __GSL_VECTOR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_char.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_char.h new file mode 100644 index 000000000..ab1107ded --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_char.h @@ -0,0 +1,230 @@ +/* vector/gsl_vector_char.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_CHAR_H__ +#define __GSL_VECTOR_CHAR_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + char *data; + gsl_block_char *block; + int owner; +} +gsl_vector_char; + +typedef struct +{ + gsl_vector_char vector; +} _gsl_vector_char_view; + +typedef _gsl_vector_char_view gsl_vector_char_view; + +typedef struct +{ + gsl_vector_char vector; +} _gsl_vector_char_const_view; + +typedef const _gsl_vector_char_const_view gsl_vector_char_const_view; + + +/* Allocation */ + +gsl_vector_char *gsl_vector_char_alloc (const size_t n); +gsl_vector_char *gsl_vector_char_calloc (const size_t n); + +gsl_vector_char *gsl_vector_char_alloc_from_block (gsl_block_char * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_char *gsl_vector_char_alloc_from_vector (gsl_vector_char * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_char_free (gsl_vector_char * v); + +/* Views */ + +_gsl_vector_char_view +gsl_vector_char_view_array (char *v, size_t n); + +_gsl_vector_char_view +gsl_vector_char_view_array_with_stride (char *base, + size_t stride, + size_t n); + +_gsl_vector_char_const_view +gsl_vector_char_const_view_array (const char *v, size_t n); + +_gsl_vector_char_const_view +gsl_vector_char_const_view_array_with_stride (const char *base, + size_t stride, + size_t n); + +_gsl_vector_char_view +gsl_vector_char_subvector (gsl_vector_char *v, + size_t i, + size_t n); + +_gsl_vector_char_view +gsl_vector_char_subvector_with_stride (gsl_vector_char *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_char_const_view +gsl_vector_char_const_subvector (const gsl_vector_char *v, + size_t i, + size_t n); + +_gsl_vector_char_const_view +gsl_vector_char_const_subvector_with_stride (const gsl_vector_char *v, + size_t i, + size_t stride, + size_t n); + +/* Operations */ + +void gsl_vector_char_set_zero (gsl_vector_char * v); +void gsl_vector_char_set_all (gsl_vector_char * v, char x); +int gsl_vector_char_set_basis (gsl_vector_char * v, size_t i); + +int gsl_vector_char_fread (FILE * stream, gsl_vector_char * v); +int gsl_vector_char_fwrite (FILE * stream, const gsl_vector_char * v); +int gsl_vector_char_fscanf (FILE * stream, gsl_vector_char * v); +int gsl_vector_char_fprintf (FILE * stream, const gsl_vector_char * v, + const char *format); + +int gsl_vector_char_memcpy (gsl_vector_char * dest, const gsl_vector_char * src); + +int gsl_vector_char_reverse (gsl_vector_char * v); + +int gsl_vector_char_swap (gsl_vector_char * v, gsl_vector_char * w); +int gsl_vector_char_swap_elements (gsl_vector_char * v, const size_t i, const size_t j); + +char gsl_vector_char_max (const gsl_vector_char * v); +char gsl_vector_char_min (const gsl_vector_char * v); +void gsl_vector_char_minmax (const gsl_vector_char * v, char * min_out, char * max_out); + +size_t gsl_vector_char_max_index (const gsl_vector_char * v); +size_t gsl_vector_char_min_index (const gsl_vector_char * v); +void gsl_vector_char_minmax_index (const gsl_vector_char * v, size_t * imin, size_t * imax); + +int gsl_vector_char_add (gsl_vector_char * a, const gsl_vector_char * b); +int gsl_vector_char_sub (gsl_vector_char * a, const gsl_vector_char * b); +int gsl_vector_char_mul (gsl_vector_char * a, const gsl_vector_char * b); +int gsl_vector_char_div (gsl_vector_char * a, const gsl_vector_char * b); +int gsl_vector_char_scale (gsl_vector_char * a, const double x); +int gsl_vector_char_add_constant (gsl_vector_char * a, const double x); + +int gsl_vector_char_equal (const gsl_vector_char * u, + const gsl_vector_char * v); + +int gsl_vector_char_isnull (const gsl_vector_char * v); +int gsl_vector_char_ispos (const gsl_vector_char * v); +int gsl_vector_char_isneg (const gsl_vector_char * v); +int gsl_vector_char_isnonneg (const gsl_vector_char * v); + +INLINE_DECL char gsl_vector_char_get (const gsl_vector_char * v, const size_t i); +INLINE_DECL void gsl_vector_char_set (gsl_vector_char * v, const size_t i, char x); +INLINE_DECL char * gsl_vector_char_ptr (gsl_vector_char * v, const size_t i); +INLINE_DECL const char * gsl_vector_char_const_ptr (const gsl_vector_char * v, const size_t i); + +#ifdef HAVE_INLINE + +INLINE_FUN +char +gsl_vector_char_get (const gsl_vector_char * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return v->data[i * v->stride]; +} + +INLINE_FUN +void +gsl_vector_char_set (gsl_vector_char * v, const size_t i, char x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + v->data[i * v->stride] = x; +} + +INLINE_FUN +char * +gsl_vector_char_ptr (gsl_vector_char * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (char *) (v->data + i * v->stride); +} + +INLINE_FUN +const char * +gsl_vector_char_const_ptr (const gsl_vector_char * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (const char *) (v->data + i * v->stride); +} +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_CHAR_H__ */ + + diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex.h new file mode 100644 index 000000000..e56d6a616 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex.h @@ -0,0 +1,17 @@ +#ifndef __GSL_VECTOR_COMPLEX_H__ +#define __GSL_VECTOR_COMPLEX_H__ + +#define GSL_VECTOR_REAL(z, i) ((z)->data[2*(i)*(z)->stride]) +#define GSL_VECTOR_IMAG(z, i) ((z)->data[2*(i)*(z)->stride + 1]) + +#if GSL_RANGE_CHECK +#define GSL_VECTOR_COMPLEX(zv, i) (((i) >= (zv)->size ? (gsl_error ("index out of range", __FILE__, __LINE__, GSL_EINVAL), 0):0 , *GSL_COMPLEX_AT((zv),(i)))) +#else +#define GSL_VECTOR_COMPLEX(zv, i) (*GSL_COMPLEX_AT((zv),(i))) +#endif + +#define GSL_COMPLEX_AT(zv,i) ((gsl_complex*)&((zv)->data[2*(i)*(zv)->stride])) +#define GSL_COMPLEX_FLOAT_AT(zv,i) ((gsl_complex_float*)&((zv)->data[2*(i)*(zv)->stride])) +#define GSL_COMPLEX_LONG_DOUBLE_AT(zv,i) ((gsl_complex_long_double*)&((zv)->data[2*(i)*(zv)->stride])) + +#endif /* __GSL_VECTOR_COMPLEX_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex_double.h new file mode 100644 index 000000000..2e5361762 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex_double.h @@ -0,0 +1,251 @@ +/* vector/gsl_vector_complex_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_COMPLEX_DOUBLE_H__ +#define __GSL_VECTOR_COMPLEX_DOUBLE_H__ + +#include +#include +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + double *data; + gsl_block_complex *block; + int owner; +} gsl_vector_complex; + +typedef struct +{ + gsl_vector_complex vector; +} _gsl_vector_complex_view; + +typedef _gsl_vector_complex_view gsl_vector_complex_view; + +typedef struct +{ + gsl_vector_complex vector; +} _gsl_vector_complex_const_view; + +typedef const _gsl_vector_complex_const_view gsl_vector_complex_const_view; + +/* Allocation */ + +gsl_vector_complex *gsl_vector_complex_alloc (const size_t n); +gsl_vector_complex *gsl_vector_complex_calloc (const size_t n); + +gsl_vector_complex * +gsl_vector_complex_alloc_from_block (gsl_block_complex * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_complex * +gsl_vector_complex_alloc_from_vector (gsl_vector_complex * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_complex_free (gsl_vector_complex * v); + +/* Views */ + +_gsl_vector_complex_view +gsl_vector_complex_view_array (double *base, + size_t n); + +_gsl_vector_complex_view +gsl_vector_complex_view_array_with_stride (double *base, + size_t stride, + size_t n); + +_gsl_vector_complex_const_view +gsl_vector_complex_const_view_array (const double *base, + size_t n); + +_gsl_vector_complex_const_view +gsl_vector_complex_const_view_array_with_stride (const double *base, + size_t stride, + size_t n); + +_gsl_vector_complex_view +gsl_vector_complex_subvector (gsl_vector_complex *base, + size_t i, + size_t n); + + +_gsl_vector_complex_view +gsl_vector_complex_subvector_with_stride (gsl_vector_complex *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_complex_const_view +gsl_vector_complex_const_subvector (const gsl_vector_complex *base, + size_t i, + size_t n); + + +_gsl_vector_complex_const_view +gsl_vector_complex_const_subvector_with_stride (const gsl_vector_complex *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_view +gsl_vector_complex_real (gsl_vector_complex *v); + +_gsl_vector_view +gsl_vector_complex_imag (gsl_vector_complex *v); + +_gsl_vector_const_view +gsl_vector_complex_const_real (const gsl_vector_complex *v); + +_gsl_vector_const_view +gsl_vector_complex_const_imag (const gsl_vector_complex *v); + + +/* Operations */ + +void gsl_vector_complex_set_zero (gsl_vector_complex * v); +void gsl_vector_complex_set_all (gsl_vector_complex * v, + gsl_complex z); +int gsl_vector_complex_set_basis (gsl_vector_complex * v, size_t i); + +int gsl_vector_complex_fread (FILE * stream, + gsl_vector_complex * v); +int gsl_vector_complex_fwrite (FILE * stream, + const gsl_vector_complex * v); +int gsl_vector_complex_fscanf (FILE * stream, + gsl_vector_complex * v); +int gsl_vector_complex_fprintf (FILE * stream, + const gsl_vector_complex * v, + const char *format); + +int gsl_vector_complex_memcpy (gsl_vector_complex * dest, const gsl_vector_complex * src); + +int gsl_vector_complex_reverse (gsl_vector_complex * v); + +int gsl_vector_complex_swap (gsl_vector_complex * v, gsl_vector_complex * w); +int gsl_vector_complex_swap_elements (gsl_vector_complex * v, const size_t i, const size_t j); + +int gsl_vector_complex_equal (const gsl_vector_complex * u, + const gsl_vector_complex * v); + +int gsl_vector_complex_isnull (const gsl_vector_complex * v); +int gsl_vector_complex_ispos (const gsl_vector_complex * v); +int gsl_vector_complex_isneg (const gsl_vector_complex * v); +int gsl_vector_complex_isnonneg (const gsl_vector_complex * v); + +int gsl_vector_complex_add (gsl_vector_complex * a, const gsl_vector_complex * b); +int gsl_vector_complex_sub (gsl_vector_complex * a, const gsl_vector_complex * b); +int gsl_vector_complex_mul (gsl_vector_complex * a, const gsl_vector_complex * b); +int gsl_vector_complex_div (gsl_vector_complex * a, const gsl_vector_complex * b); +int gsl_vector_complex_scale (gsl_vector_complex * a, const gsl_complex x); +int gsl_vector_complex_add_constant (gsl_vector_complex * a, const gsl_complex x); + +INLINE_DECL gsl_complex gsl_vector_complex_get (const gsl_vector_complex * v, const size_t i); +INLINE_DECL void gsl_vector_complex_set (gsl_vector_complex * v, const size_t i, gsl_complex z); +INLINE_DECL gsl_complex *gsl_vector_complex_ptr (gsl_vector_complex * v, const size_t i); +INLINE_DECL const gsl_complex *gsl_vector_complex_const_ptr (const gsl_vector_complex * v, const size_t i); + +#ifdef HAVE_INLINE + +INLINE_FUN +gsl_complex +gsl_vector_complex_get (const gsl_vector_complex * v, + const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + gsl_complex zero = {{0, 0}}; + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, zero); + } +#endif + return *GSL_COMPLEX_AT (v, i); +} + +INLINE_FUN +void +gsl_vector_complex_set (gsl_vector_complex * v, + const size_t i, gsl_complex z) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + *GSL_COMPLEX_AT (v, i) = z; +} + +INLINE_FUN +gsl_complex * +gsl_vector_complex_ptr (gsl_vector_complex * v, + const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return GSL_COMPLEX_AT (v, i); +} + +INLINE_FUN +const gsl_complex * +gsl_vector_complex_const_ptr (const gsl_vector_complex * v, + const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return GSL_COMPLEX_AT (v, i); +} + + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_COMPLEX_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex_float.h new file mode 100644 index 000000000..182f48742 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex_float.h @@ -0,0 +1,251 @@ +/* vector/gsl_vector_complex_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_COMPLEX_FLOAT_H__ +#define __GSL_VECTOR_COMPLEX_FLOAT_H__ + +#include +#include +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + float *data; + gsl_block_complex_float *block; + int owner; +} gsl_vector_complex_float; + +typedef struct +{ + gsl_vector_complex_float vector; +} _gsl_vector_complex_float_view; + +typedef _gsl_vector_complex_float_view gsl_vector_complex_float_view; + +typedef struct +{ + gsl_vector_complex_float vector; +} _gsl_vector_complex_float_const_view; + +typedef const _gsl_vector_complex_float_const_view gsl_vector_complex_float_const_view; + +/* Allocation */ + +gsl_vector_complex_float *gsl_vector_complex_float_alloc (const size_t n); +gsl_vector_complex_float *gsl_vector_complex_float_calloc (const size_t n); + +gsl_vector_complex_float * +gsl_vector_complex_float_alloc_from_block (gsl_block_complex_float * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_complex_float * +gsl_vector_complex_float_alloc_from_vector (gsl_vector_complex_float * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_complex_float_free (gsl_vector_complex_float * v); + +/* Views */ + +_gsl_vector_complex_float_view +gsl_vector_complex_float_view_array (float *base, + size_t n); + +_gsl_vector_complex_float_view +gsl_vector_complex_float_view_array_with_stride (float *base, + size_t stride, + size_t n); + +_gsl_vector_complex_float_const_view +gsl_vector_complex_float_const_view_array (const float *base, + size_t n); + +_gsl_vector_complex_float_const_view +gsl_vector_complex_float_const_view_array_with_stride (const float *base, + size_t stride, + size_t n); + +_gsl_vector_complex_float_view +gsl_vector_complex_float_subvector (gsl_vector_complex_float *base, + size_t i, + size_t n); + + +_gsl_vector_complex_float_view +gsl_vector_complex_float_subvector_with_stride (gsl_vector_complex_float *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_complex_float_const_view +gsl_vector_complex_float_const_subvector (const gsl_vector_complex_float *base, + size_t i, + size_t n); + + +_gsl_vector_complex_float_const_view +gsl_vector_complex_float_const_subvector_with_stride (const gsl_vector_complex_float *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_float_view +gsl_vector_complex_float_real (gsl_vector_complex_float *v); + +_gsl_vector_float_view +gsl_vector_complex_float_imag (gsl_vector_complex_float *v); + +_gsl_vector_float_const_view +gsl_vector_complex_float_const_real (const gsl_vector_complex_float *v); + +_gsl_vector_float_const_view +gsl_vector_complex_float_const_imag (const gsl_vector_complex_float *v); + + +/* Operations */ + +void gsl_vector_complex_float_set_zero (gsl_vector_complex_float * v); +void gsl_vector_complex_float_set_all (gsl_vector_complex_float * v, + gsl_complex_float z); +int gsl_vector_complex_float_set_basis (gsl_vector_complex_float * v, size_t i); + +int gsl_vector_complex_float_fread (FILE * stream, + gsl_vector_complex_float * v); +int gsl_vector_complex_float_fwrite (FILE * stream, + const gsl_vector_complex_float * v); +int gsl_vector_complex_float_fscanf (FILE * stream, + gsl_vector_complex_float * v); +int gsl_vector_complex_float_fprintf (FILE * stream, + const gsl_vector_complex_float * v, + const char *format); + +int gsl_vector_complex_float_memcpy (gsl_vector_complex_float * dest, const gsl_vector_complex_float * src); + +int gsl_vector_complex_float_reverse (gsl_vector_complex_float * v); + +int gsl_vector_complex_float_swap (gsl_vector_complex_float * v, gsl_vector_complex_float * w); +int gsl_vector_complex_float_swap_elements (gsl_vector_complex_float * v, const size_t i, const size_t j); + +int gsl_vector_complex_float_equal (const gsl_vector_complex_float * u, + const gsl_vector_complex_float * v); + +int gsl_vector_complex_float_isnull (const gsl_vector_complex_float * v); +int gsl_vector_complex_float_ispos (const gsl_vector_complex_float * v); +int gsl_vector_complex_float_isneg (const gsl_vector_complex_float * v); +int gsl_vector_complex_float_isnonneg (const gsl_vector_complex_float * v); + +int gsl_vector_complex_float_add (gsl_vector_complex_float * a, const gsl_vector_complex_float * b); +int gsl_vector_complex_float_sub (gsl_vector_complex_float * a, const gsl_vector_complex_float * b); +int gsl_vector_complex_float_mul (gsl_vector_complex_float * a, const gsl_vector_complex_float * b); +int gsl_vector_complex_float_div (gsl_vector_complex_float * a, const gsl_vector_complex_float * b); +int gsl_vector_complex_float_scale (gsl_vector_complex_float * a, const gsl_complex_float x); +int gsl_vector_complex_float_add_constant (gsl_vector_complex_float * a, const gsl_complex_float x); + +INLINE_DECL gsl_complex_float gsl_vector_complex_float_get (const gsl_vector_complex_float * v, const size_t i); +INLINE_DECL void gsl_vector_complex_float_set (gsl_vector_complex_float * v, const size_t i, gsl_complex_float z); +INLINE_DECL gsl_complex_float *gsl_vector_complex_float_ptr (gsl_vector_complex_float * v, const size_t i); +INLINE_DECL const gsl_complex_float *gsl_vector_complex_float_const_ptr (const gsl_vector_complex_float * v, const size_t i); + +#ifdef HAVE_INLINE + +INLINE_FUN +gsl_complex_float +gsl_vector_complex_float_get (const gsl_vector_complex_float * v, + const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + gsl_complex_float zero = {{0, 0}}; + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, zero); + } +#endif + return *GSL_COMPLEX_FLOAT_AT (v, i); +} + +INLINE_FUN +void +gsl_vector_complex_float_set (gsl_vector_complex_float * v, + const size_t i, gsl_complex_float z) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + *GSL_COMPLEX_FLOAT_AT (v, i) = z; +} + +INLINE_FUN +gsl_complex_float * +gsl_vector_complex_float_ptr (gsl_vector_complex_float * v, + const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return GSL_COMPLEX_FLOAT_AT (v, i); +} + +INLINE_FUN +const gsl_complex_float * +gsl_vector_complex_float_const_ptr (const gsl_vector_complex_float * v, + const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return GSL_COMPLEX_FLOAT_AT (v, i); +} + + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_COMPLEX_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex_long_double.h new file mode 100644 index 000000000..91755e0cf --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex_long_double.h @@ -0,0 +1,251 @@ +/* vector/gsl_vector_complex_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_COMPLEX_LONG_DOUBLE_H__ +#define __GSL_VECTOR_COMPLEX_LONG_DOUBLE_H__ + +#include +#include +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + long double *data; + gsl_block_complex_long_double *block; + int owner; +} gsl_vector_complex_long_double; + +typedef struct +{ + gsl_vector_complex_long_double vector; +} _gsl_vector_complex_long_double_view; + +typedef _gsl_vector_complex_long_double_view gsl_vector_complex_long_double_view; + +typedef struct +{ + gsl_vector_complex_long_double vector; +} _gsl_vector_complex_long_double_const_view; + +typedef const _gsl_vector_complex_long_double_const_view gsl_vector_complex_long_double_const_view; + +/* Allocation */ + +gsl_vector_complex_long_double *gsl_vector_complex_long_double_alloc (const size_t n); +gsl_vector_complex_long_double *gsl_vector_complex_long_double_calloc (const size_t n); + +gsl_vector_complex_long_double * +gsl_vector_complex_long_double_alloc_from_block (gsl_block_complex_long_double * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_complex_long_double * +gsl_vector_complex_long_double_alloc_from_vector (gsl_vector_complex_long_double * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_complex_long_double_free (gsl_vector_complex_long_double * v); + +/* Views */ + +_gsl_vector_complex_long_double_view +gsl_vector_complex_long_double_view_array (long double *base, + size_t n); + +_gsl_vector_complex_long_double_view +gsl_vector_complex_long_double_view_array_with_stride (long double *base, + size_t stride, + size_t n); + +_gsl_vector_complex_long_double_const_view +gsl_vector_complex_long_double_const_view_array (const long double *base, + size_t n); + +_gsl_vector_complex_long_double_const_view +gsl_vector_complex_long_double_const_view_array_with_stride (const long double *base, + size_t stride, + size_t n); + +_gsl_vector_complex_long_double_view +gsl_vector_complex_long_double_subvector (gsl_vector_complex_long_double *base, + size_t i, + size_t n); + + +_gsl_vector_complex_long_double_view +gsl_vector_complex_long_double_subvector_with_stride (gsl_vector_complex_long_double *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_complex_long_double_const_view +gsl_vector_complex_long_double_const_subvector (const gsl_vector_complex_long_double *base, + size_t i, + size_t n); + + +_gsl_vector_complex_long_double_const_view +gsl_vector_complex_long_double_const_subvector_with_stride (const gsl_vector_complex_long_double *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_long_double_view +gsl_vector_complex_long_double_real (gsl_vector_complex_long_double *v); + +_gsl_vector_long_double_view +gsl_vector_complex_long_double_imag (gsl_vector_complex_long_double *v); + +_gsl_vector_long_double_const_view +gsl_vector_complex_long_double_const_real (const gsl_vector_complex_long_double *v); + +_gsl_vector_long_double_const_view +gsl_vector_complex_long_double_const_imag (const gsl_vector_complex_long_double *v); + + +/* Operations */ + +void gsl_vector_complex_long_double_set_zero (gsl_vector_complex_long_double * v); +void gsl_vector_complex_long_double_set_all (gsl_vector_complex_long_double * v, + gsl_complex_long_double z); +int gsl_vector_complex_long_double_set_basis (gsl_vector_complex_long_double * v, size_t i); + +int gsl_vector_complex_long_double_fread (FILE * stream, + gsl_vector_complex_long_double * v); +int gsl_vector_complex_long_double_fwrite (FILE * stream, + const gsl_vector_complex_long_double * v); +int gsl_vector_complex_long_double_fscanf (FILE * stream, + gsl_vector_complex_long_double * v); +int gsl_vector_complex_long_double_fprintf (FILE * stream, + const gsl_vector_complex_long_double * v, + const char *format); + +int gsl_vector_complex_long_double_memcpy (gsl_vector_complex_long_double * dest, const gsl_vector_complex_long_double * src); + +int gsl_vector_complex_long_double_reverse (gsl_vector_complex_long_double * v); + +int gsl_vector_complex_long_double_swap (gsl_vector_complex_long_double * v, gsl_vector_complex_long_double * w); +int gsl_vector_complex_long_double_swap_elements (gsl_vector_complex_long_double * v, const size_t i, const size_t j); + +int gsl_vector_complex_long_double_equal (const gsl_vector_complex_long_double * u, + const gsl_vector_complex_long_double * v); + +int gsl_vector_complex_long_double_isnull (const gsl_vector_complex_long_double * v); +int gsl_vector_complex_long_double_ispos (const gsl_vector_complex_long_double * v); +int gsl_vector_complex_long_double_isneg (const gsl_vector_complex_long_double * v); +int gsl_vector_complex_long_double_isnonneg (const gsl_vector_complex_long_double * v); + +int gsl_vector_complex_long_double_add (gsl_vector_complex_long_double * a, const gsl_vector_complex_long_double * b); +int gsl_vector_complex_long_double_sub (gsl_vector_complex_long_double * a, const gsl_vector_complex_long_double * b); +int gsl_vector_complex_long_double_mul (gsl_vector_complex_long_double * a, const gsl_vector_complex_long_double * b); +int gsl_vector_complex_long_double_div (gsl_vector_complex_long_double * a, const gsl_vector_complex_long_double * b); +int gsl_vector_complex_long_double_scale (gsl_vector_complex_long_double * a, const gsl_complex_long_double x); +int gsl_vector_complex_long_double_add_constant (gsl_vector_complex_long_double * a, const gsl_complex_long_double x); + +INLINE_DECL gsl_complex_long_double gsl_vector_complex_long_double_get (const gsl_vector_complex_long_double * v, const size_t i); +INLINE_DECL void gsl_vector_complex_long_double_set (gsl_vector_complex_long_double * v, const size_t i, gsl_complex_long_double z); +INLINE_DECL gsl_complex_long_double *gsl_vector_complex_long_double_ptr (gsl_vector_complex_long_double * v, const size_t i); +INLINE_DECL const gsl_complex_long_double *gsl_vector_complex_long_double_const_ptr (const gsl_vector_complex_long_double * v, const size_t i); + +#ifdef HAVE_INLINE + +INLINE_FUN +gsl_complex_long_double +gsl_vector_complex_long_double_get (const gsl_vector_complex_long_double * v, + const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + gsl_complex_long_double zero = {{0, 0}}; + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, zero); + } +#endif + return *GSL_COMPLEX_LONG_DOUBLE_AT (v, i); +} + +INLINE_FUN +void +gsl_vector_complex_long_double_set (gsl_vector_complex_long_double * v, + const size_t i, gsl_complex_long_double z) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + *GSL_COMPLEX_LONG_DOUBLE_AT (v, i) = z; +} + +INLINE_FUN +gsl_complex_long_double * +gsl_vector_complex_long_double_ptr (gsl_vector_complex_long_double * v, + const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return GSL_COMPLEX_LONG_DOUBLE_AT (v, i); +} + +INLINE_FUN +const gsl_complex_long_double * +gsl_vector_complex_long_double_const_ptr (const gsl_vector_complex_long_double * v, + const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return GSL_COMPLEX_LONG_DOUBLE_AT (v, i); +} + + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_COMPLEX_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_double.h new file mode 100644 index 000000000..26a12d833 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_double.h @@ -0,0 +1,230 @@ +/* vector/gsl_vector_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_DOUBLE_H__ +#define __GSL_VECTOR_DOUBLE_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + double *data; + gsl_block *block; + int owner; +} +gsl_vector; + +typedef struct +{ + gsl_vector vector; +} _gsl_vector_view; + +typedef _gsl_vector_view gsl_vector_view; + +typedef struct +{ + gsl_vector vector; +} _gsl_vector_const_view; + +typedef const _gsl_vector_const_view gsl_vector_const_view; + + +/* Allocation */ + +gsl_vector *gsl_vector_alloc (const size_t n); +gsl_vector *gsl_vector_calloc (const size_t n); + +gsl_vector *gsl_vector_alloc_from_block (gsl_block * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector *gsl_vector_alloc_from_vector (gsl_vector * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_free (gsl_vector * v); + +/* Views */ + +_gsl_vector_view +gsl_vector_view_array (double *v, size_t n); + +_gsl_vector_view +gsl_vector_view_array_with_stride (double *base, + size_t stride, + size_t n); + +_gsl_vector_const_view +gsl_vector_const_view_array (const double *v, size_t n); + +_gsl_vector_const_view +gsl_vector_const_view_array_with_stride (const double *base, + size_t stride, + size_t n); + +_gsl_vector_view +gsl_vector_subvector (gsl_vector *v, + size_t i, + size_t n); + +_gsl_vector_view +gsl_vector_subvector_with_stride (gsl_vector *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_const_view +gsl_vector_const_subvector (const gsl_vector *v, + size_t i, + size_t n); + +_gsl_vector_const_view +gsl_vector_const_subvector_with_stride (const gsl_vector *v, + size_t i, + size_t stride, + size_t n); + +/* Operations */ + +void gsl_vector_set_zero (gsl_vector * v); +void gsl_vector_set_all (gsl_vector * v, double x); +int gsl_vector_set_basis (gsl_vector * v, size_t i); + +int gsl_vector_fread (FILE * stream, gsl_vector * v); +int gsl_vector_fwrite (FILE * stream, const gsl_vector * v); +int gsl_vector_fscanf (FILE * stream, gsl_vector * v); +int gsl_vector_fprintf (FILE * stream, const gsl_vector * v, + const char *format); + +int gsl_vector_memcpy (gsl_vector * dest, const gsl_vector * src); + +int gsl_vector_reverse (gsl_vector * v); + +int gsl_vector_swap (gsl_vector * v, gsl_vector * w); +int gsl_vector_swap_elements (gsl_vector * v, const size_t i, const size_t j); + +double gsl_vector_max (const gsl_vector * v); +double gsl_vector_min (const gsl_vector * v); +void gsl_vector_minmax (const gsl_vector * v, double * min_out, double * max_out); + +size_t gsl_vector_max_index (const gsl_vector * v); +size_t gsl_vector_min_index (const gsl_vector * v); +void gsl_vector_minmax_index (const gsl_vector * v, size_t * imin, size_t * imax); + +int gsl_vector_add (gsl_vector * a, const gsl_vector * b); +int gsl_vector_sub (gsl_vector * a, const gsl_vector * b); +int gsl_vector_mul (gsl_vector * a, const gsl_vector * b); +int gsl_vector_div (gsl_vector * a, const gsl_vector * b); +int gsl_vector_scale (gsl_vector * a, const double x); +int gsl_vector_add_constant (gsl_vector * a, const double x); + +int gsl_vector_equal (const gsl_vector * u, + const gsl_vector * v); + +int gsl_vector_isnull (const gsl_vector * v); +int gsl_vector_ispos (const gsl_vector * v); +int gsl_vector_isneg (const gsl_vector * v); +int gsl_vector_isnonneg (const gsl_vector * v); + +INLINE_DECL double gsl_vector_get (const gsl_vector * v, const size_t i); +INLINE_DECL void gsl_vector_set (gsl_vector * v, const size_t i, double x); +INLINE_DECL double * gsl_vector_ptr (gsl_vector * v, const size_t i); +INLINE_DECL const double * gsl_vector_const_ptr (const gsl_vector * v, const size_t i); + +#ifdef HAVE_INLINE + +INLINE_FUN +double +gsl_vector_get (const gsl_vector * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return v->data[i * v->stride]; +} + +INLINE_FUN +void +gsl_vector_set (gsl_vector * v, const size_t i, double x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + v->data[i * v->stride] = x; +} + +INLINE_FUN +double * +gsl_vector_ptr (gsl_vector * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (double *) (v->data + i * v->stride); +} + +INLINE_FUN +const double * +gsl_vector_const_ptr (const gsl_vector * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (const double *) (v->data + i * v->stride); +} +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_DOUBLE_H__ */ + + diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_float.h new file mode 100644 index 000000000..2b499c81e --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_float.h @@ -0,0 +1,230 @@ +/* vector/gsl_vector_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_FLOAT_H__ +#define __GSL_VECTOR_FLOAT_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + float *data; + gsl_block_float *block; + int owner; +} +gsl_vector_float; + +typedef struct +{ + gsl_vector_float vector; +} _gsl_vector_float_view; + +typedef _gsl_vector_float_view gsl_vector_float_view; + +typedef struct +{ + gsl_vector_float vector; +} _gsl_vector_float_const_view; + +typedef const _gsl_vector_float_const_view gsl_vector_float_const_view; + + +/* Allocation */ + +gsl_vector_float *gsl_vector_float_alloc (const size_t n); +gsl_vector_float *gsl_vector_float_calloc (const size_t n); + +gsl_vector_float *gsl_vector_float_alloc_from_block (gsl_block_float * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_float *gsl_vector_float_alloc_from_vector (gsl_vector_float * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_float_free (gsl_vector_float * v); + +/* Views */ + +_gsl_vector_float_view +gsl_vector_float_view_array (float *v, size_t n); + +_gsl_vector_float_view +gsl_vector_float_view_array_with_stride (float *base, + size_t stride, + size_t n); + +_gsl_vector_float_const_view +gsl_vector_float_const_view_array (const float *v, size_t n); + +_gsl_vector_float_const_view +gsl_vector_float_const_view_array_with_stride (const float *base, + size_t stride, + size_t n); + +_gsl_vector_float_view +gsl_vector_float_subvector (gsl_vector_float *v, + size_t i, + size_t n); + +_gsl_vector_float_view +gsl_vector_float_subvector_with_stride (gsl_vector_float *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_float_const_view +gsl_vector_float_const_subvector (const gsl_vector_float *v, + size_t i, + size_t n); + +_gsl_vector_float_const_view +gsl_vector_float_const_subvector_with_stride (const gsl_vector_float *v, + size_t i, + size_t stride, + size_t n); + +/* Operations */ + +void gsl_vector_float_set_zero (gsl_vector_float * v); +void gsl_vector_float_set_all (gsl_vector_float * v, float x); +int gsl_vector_float_set_basis (gsl_vector_float * v, size_t i); + +int gsl_vector_float_fread (FILE * stream, gsl_vector_float * v); +int gsl_vector_float_fwrite (FILE * stream, const gsl_vector_float * v); +int gsl_vector_float_fscanf (FILE * stream, gsl_vector_float * v); +int gsl_vector_float_fprintf (FILE * stream, const gsl_vector_float * v, + const char *format); + +int gsl_vector_float_memcpy (gsl_vector_float * dest, const gsl_vector_float * src); + +int gsl_vector_float_reverse (gsl_vector_float * v); + +int gsl_vector_float_swap (gsl_vector_float * v, gsl_vector_float * w); +int gsl_vector_float_swap_elements (gsl_vector_float * v, const size_t i, const size_t j); + +float gsl_vector_float_max (const gsl_vector_float * v); +float gsl_vector_float_min (const gsl_vector_float * v); +void gsl_vector_float_minmax (const gsl_vector_float * v, float * min_out, float * max_out); + +size_t gsl_vector_float_max_index (const gsl_vector_float * v); +size_t gsl_vector_float_min_index (const gsl_vector_float * v); +void gsl_vector_float_minmax_index (const gsl_vector_float * v, size_t * imin, size_t * imax); + +int gsl_vector_float_add (gsl_vector_float * a, const gsl_vector_float * b); +int gsl_vector_float_sub (gsl_vector_float * a, const gsl_vector_float * b); +int gsl_vector_float_mul (gsl_vector_float * a, const gsl_vector_float * b); +int gsl_vector_float_div (gsl_vector_float * a, const gsl_vector_float * b); +int gsl_vector_float_scale (gsl_vector_float * a, const double x); +int gsl_vector_float_add_constant (gsl_vector_float * a, const double x); + +int gsl_vector_float_equal (const gsl_vector_float * u, + const gsl_vector_float * v); + +int gsl_vector_float_isnull (const gsl_vector_float * v); +int gsl_vector_float_ispos (const gsl_vector_float * v); +int gsl_vector_float_isneg (const gsl_vector_float * v); +int gsl_vector_float_isnonneg (const gsl_vector_float * v); + +INLINE_DECL float gsl_vector_float_get (const gsl_vector_float * v, const size_t i); +INLINE_DECL void gsl_vector_float_set (gsl_vector_float * v, const size_t i, float x); +INLINE_DECL float * gsl_vector_float_ptr (gsl_vector_float * v, const size_t i); +INLINE_DECL const float * gsl_vector_float_const_ptr (const gsl_vector_float * v, const size_t i); + +#ifdef HAVE_INLINE + +INLINE_FUN +float +gsl_vector_float_get (const gsl_vector_float * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return v->data[i * v->stride]; +} + +INLINE_FUN +void +gsl_vector_float_set (gsl_vector_float * v, const size_t i, float x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + v->data[i * v->stride] = x; +} + +INLINE_FUN +float * +gsl_vector_float_ptr (gsl_vector_float * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (float *) (v->data + i * v->stride); +} + +INLINE_FUN +const float * +gsl_vector_float_const_ptr (const gsl_vector_float * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (const float *) (v->data + i * v->stride); +} +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_FLOAT_H__ */ + + diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_int.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_int.h new file mode 100644 index 000000000..de04a449d --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_int.h @@ -0,0 +1,230 @@ +/* vector/gsl_vector_int.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_INT_H__ +#define __GSL_VECTOR_INT_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + int *data; + gsl_block_int *block; + int owner; +} +gsl_vector_int; + +typedef struct +{ + gsl_vector_int vector; +} _gsl_vector_int_view; + +typedef _gsl_vector_int_view gsl_vector_int_view; + +typedef struct +{ + gsl_vector_int vector; +} _gsl_vector_int_const_view; + +typedef const _gsl_vector_int_const_view gsl_vector_int_const_view; + + +/* Allocation */ + +gsl_vector_int *gsl_vector_int_alloc (const size_t n); +gsl_vector_int *gsl_vector_int_calloc (const size_t n); + +gsl_vector_int *gsl_vector_int_alloc_from_block (gsl_block_int * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_int *gsl_vector_int_alloc_from_vector (gsl_vector_int * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_int_free (gsl_vector_int * v); + +/* Views */ + +_gsl_vector_int_view +gsl_vector_int_view_array (int *v, size_t n); + +_gsl_vector_int_view +gsl_vector_int_view_array_with_stride (int *base, + size_t stride, + size_t n); + +_gsl_vector_int_const_view +gsl_vector_int_const_view_array (const int *v, size_t n); + +_gsl_vector_int_const_view +gsl_vector_int_const_view_array_with_stride (const int *base, + size_t stride, + size_t n); + +_gsl_vector_int_view +gsl_vector_int_subvector (gsl_vector_int *v, + size_t i, + size_t n); + +_gsl_vector_int_view +gsl_vector_int_subvector_with_stride (gsl_vector_int *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_int_const_view +gsl_vector_int_const_subvector (const gsl_vector_int *v, + size_t i, + size_t n); + +_gsl_vector_int_const_view +gsl_vector_int_const_subvector_with_stride (const gsl_vector_int *v, + size_t i, + size_t stride, + size_t n); + +/* Operations */ + +void gsl_vector_int_set_zero (gsl_vector_int * v); +void gsl_vector_int_set_all (gsl_vector_int * v, int x); +int gsl_vector_int_set_basis (gsl_vector_int * v, size_t i); + +int gsl_vector_int_fread (FILE * stream, gsl_vector_int * v); +int gsl_vector_int_fwrite (FILE * stream, const gsl_vector_int * v); +int gsl_vector_int_fscanf (FILE * stream, gsl_vector_int * v); +int gsl_vector_int_fprintf (FILE * stream, const gsl_vector_int * v, + const char *format); + +int gsl_vector_int_memcpy (gsl_vector_int * dest, const gsl_vector_int * src); + +int gsl_vector_int_reverse (gsl_vector_int * v); + +int gsl_vector_int_swap (gsl_vector_int * v, gsl_vector_int * w); +int gsl_vector_int_swap_elements (gsl_vector_int * v, const size_t i, const size_t j); + +int gsl_vector_int_max (const gsl_vector_int * v); +int gsl_vector_int_min (const gsl_vector_int * v); +void gsl_vector_int_minmax (const gsl_vector_int * v, int * min_out, int * max_out); + +size_t gsl_vector_int_max_index (const gsl_vector_int * v); +size_t gsl_vector_int_min_index (const gsl_vector_int * v); +void gsl_vector_int_minmax_index (const gsl_vector_int * v, size_t * imin, size_t * imax); + +int gsl_vector_int_add (gsl_vector_int * a, const gsl_vector_int * b); +int gsl_vector_int_sub (gsl_vector_int * a, const gsl_vector_int * b); +int gsl_vector_int_mul (gsl_vector_int * a, const gsl_vector_int * b); +int gsl_vector_int_div (gsl_vector_int * a, const gsl_vector_int * b); +int gsl_vector_int_scale (gsl_vector_int * a, const double x); +int gsl_vector_int_add_constant (gsl_vector_int * a, const double x); + +int gsl_vector_int_equal (const gsl_vector_int * u, + const gsl_vector_int * v); + +int gsl_vector_int_isnull (const gsl_vector_int * v); +int gsl_vector_int_ispos (const gsl_vector_int * v); +int gsl_vector_int_isneg (const gsl_vector_int * v); +int gsl_vector_int_isnonneg (const gsl_vector_int * v); + +INLINE_DECL int gsl_vector_int_get (const gsl_vector_int * v, const size_t i); +INLINE_DECL void gsl_vector_int_set (gsl_vector_int * v, const size_t i, int x); +INLINE_DECL int * gsl_vector_int_ptr (gsl_vector_int * v, const size_t i); +INLINE_DECL const int * gsl_vector_int_const_ptr (const gsl_vector_int * v, const size_t i); + +#ifdef HAVE_INLINE + +INLINE_FUN +int +gsl_vector_int_get (const gsl_vector_int * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return v->data[i * v->stride]; +} + +INLINE_FUN +void +gsl_vector_int_set (gsl_vector_int * v, const size_t i, int x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + v->data[i * v->stride] = x; +} + +INLINE_FUN +int * +gsl_vector_int_ptr (gsl_vector_int * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (int *) (v->data + i * v->stride); +} + +INLINE_FUN +const int * +gsl_vector_int_const_ptr (const gsl_vector_int * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (const int *) (v->data + i * v->stride); +} +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_INT_H__ */ + + diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_long.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_long.h new file mode 100644 index 000000000..f844a0277 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_long.h @@ -0,0 +1,230 @@ +/* vector/gsl_vector_long.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_LONG_H__ +#define __GSL_VECTOR_LONG_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + long *data; + gsl_block_long *block; + int owner; +} +gsl_vector_long; + +typedef struct +{ + gsl_vector_long vector; +} _gsl_vector_long_view; + +typedef _gsl_vector_long_view gsl_vector_long_view; + +typedef struct +{ + gsl_vector_long vector; +} _gsl_vector_long_const_view; + +typedef const _gsl_vector_long_const_view gsl_vector_long_const_view; + + +/* Allocation */ + +gsl_vector_long *gsl_vector_long_alloc (const size_t n); +gsl_vector_long *gsl_vector_long_calloc (const size_t n); + +gsl_vector_long *gsl_vector_long_alloc_from_block (gsl_block_long * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_long *gsl_vector_long_alloc_from_vector (gsl_vector_long * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_long_free (gsl_vector_long * v); + +/* Views */ + +_gsl_vector_long_view +gsl_vector_long_view_array (long *v, size_t n); + +_gsl_vector_long_view +gsl_vector_long_view_array_with_stride (long *base, + size_t stride, + size_t n); + +_gsl_vector_long_const_view +gsl_vector_long_const_view_array (const long *v, size_t n); + +_gsl_vector_long_const_view +gsl_vector_long_const_view_array_with_stride (const long *base, + size_t stride, + size_t n); + +_gsl_vector_long_view +gsl_vector_long_subvector (gsl_vector_long *v, + size_t i, + size_t n); + +_gsl_vector_long_view +gsl_vector_long_subvector_with_stride (gsl_vector_long *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_long_const_view +gsl_vector_long_const_subvector (const gsl_vector_long *v, + size_t i, + size_t n); + +_gsl_vector_long_const_view +gsl_vector_long_const_subvector_with_stride (const gsl_vector_long *v, + size_t i, + size_t stride, + size_t n); + +/* Operations */ + +void gsl_vector_long_set_zero (gsl_vector_long * v); +void gsl_vector_long_set_all (gsl_vector_long * v, long x); +int gsl_vector_long_set_basis (gsl_vector_long * v, size_t i); + +int gsl_vector_long_fread (FILE * stream, gsl_vector_long * v); +int gsl_vector_long_fwrite (FILE * stream, const gsl_vector_long * v); +int gsl_vector_long_fscanf (FILE * stream, gsl_vector_long * v); +int gsl_vector_long_fprintf (FILE * stream, const gsl_vector_long * v, + const char *format); + +int gsl_vector_long_memcpy (gsl_vector_long * dest, const gsl_vector_long * src); + +int gsl_vector_long_reverse (gsl_vector_long * v); + +int gsl_vector_long_swap (gsl_vector_long * v, gsl_vector_long * w); +int gsl_vector_long_swap_elements (gsl_vector_long * v, const size_t i, const size_t j); + +long gsl_vector_long_max (const gsl_vector_long * v); +long gsl_vector_long_min (const gsl_vector_long * v); +void gsl_vector_long_minmax (const gsl_vector_long * v, long * min_out, long * max_out); + +size_t gsl_vector_long_max_index (const gsl_vector_long * v); +size_t gsl_vector_long_min_index (const gsl_vector_long * v); +void gsl_vector_long_minmax_index (const gsl_vector_long * v, size_t * imin, size_t * imax); + +int gsl_vector_long_add (gsl_vector_long * a, const gsl_vector_long * b); +int gsl_vector_long_sub (gsl_vector_long * a, const gsl_vector_long * b); +int gsl_vector_long_mul (gsl_vector_long * a, const gsl_vector_long * b); +int gsl_vector_long_div (gsl_vector_long * a, const gsl_vector_long * b); +int gsl_vector_long_scale (gsl_vector_long * a, const double x); +int gsl_vector_long_add_constant (gsl_vector_long * a, const double x); + +int gsl_vector_long_equal (const gsl_vector_long * u, + const gsl_vector_long * v); + +int gsl_vector_long_isnull (const gsl_vector_long * v); +int gsl_vector_long_ispos (const gsl_vector_long * v); +int gsl_vector_long_isneg (const gsl_vector_long * v); +int gsl_vector_long_isnonneg (const gsl_vector_long * v); + +INLINE_DECL long gsl_vector_long_get (const gsl_vector_long * v, const size_t i); +INLINE_DECL void gsl_vector_long_set (gsl_vector_long * v, const size_t i, long x); +INLINE_DECL long * gsl_vector_long_ptr (gsl_vector_long * v, const size_t i); +INLINE_DECL const long * gsl_vector_long_const_ptr (const gsl_vector_long * v, const size_t i); + +#ifdef HAVE_INLINE + +INLINE_FUN +long +gsl_vector_long_get (const gsl_vector_long * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return v->data[i * v->stride]; +} + +INLINE_FUN +void +gsl_vector_long_set (gsl_vector_long * v, const size_t i, long x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + v->data[i * v->stride] = x; +} + +INLINE_FUN +long * +gsl_vector_long_ptr (gsl_vector_long * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (long *) (v->data + i * v->stride); +} + +INLINE_FUN +const long * +gsl_vector_long_const_ptr (const gsl_vector_long * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (const long *) (v->data + i * v->stride); +} +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_LONG_H__ */ + + diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_long_double.h new file mode 100644 index 000000000..836b09a52 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_long_double.h @@ -0,0 +1,230 @@ +/* vector/gsl_vector_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_LONG_DOUBLE_H__ +#define __GSL_VECTOR_LONG_DOUBLE_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + long double *data; + gsl_block_long_double *block; + int owner; +} +gsl_vector_long_double; + +typedef struct +{ + gsl_vector_long_double vector; +} _gsl_vector_long_double_view; + +typedef _gsl_vector_long_double_view gsl_vector_long_double_view; + +typedef struct +{ + gsl_vector_long_double vector; +} _gsl_vector_long_double_const_view; + +typedef const _gsl_vector_long_double_const_view gsl_vector_long_double_const_view; + + +/* Allocation */ + +gsl_vector_long_double *gsl_vector_long_double_alloc (const size_t n); +gsl_vector_long_double *gsl_vector_long_double_calloc (const size_t n); + +gsl_vector_long_double *gsl_vector_long_double_alloc_from_block (gsl_block_long_double * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_long_double *gsl_vector_long_double_alloc_from_vector (gsl_vector_long_double * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_long_double_free (gsl_vector_long_double * v); + +/* Views */ + +_gsl_vector_long_double_view +gsl_vector_long_double_view_array (long double *v, size_t n); + +_gsl_vector_long_double_view +gsl_vector_long_double_view_array_with_stride (long double *base, + size_t stride, + size_t n); + +_gsl_vector_long_double_const_view +gsl_vector_long_double_const_view_array (const long double *v, size_t n); + +_gsl_vector_long_double_const_view +gsl_vector_long_double_const_view_array_with_stride (const long double *base, + size_t stride, + size_t n); + +_gsl_vector_long_double_view +gsl_vector_long_double_subvector (gsl_vector_long_double *v, + size_t i, + size_t n); + +_gsl_vector_long_double_view +gsl_vector_long_double_subvector_with_stride (gsl_vector_long_double *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_long_double_const_view +gsl_vector_long_double_const_subvector (const gsl_vector_long_double *v, + size_t i, + size_t n); + +_gsl_vector_long_double_const_view +gsl_vector_long_double_const_subvector_with_stride (const gsl_vector_long_double *v, + size_t i, + size_t stride, + size_t n); + +/* Operations */ + +void gsl_vector_long_double_set_zero (gsl_vector_long_double * v); +void gsl_vector_long_double_set_all (gsl_vector_long_double * v, long double x); +int gsl_vector_long_double_set_basis (gsl_vector_long_double * v, size_t i); + +int gsl_vector_long_double_fread (FILE * stream, gsl_vector_long_double * v); +int gsl_vector_long_double_fwrite (FILE * stream, const gsl_vector_long_double * v); +int gsl_vector_long_double_fscanf (FILE * stream, gsl_vector_long_double * v); +int gsl_vector_long_double_fprintf (FILE * stream, const gsl_vector_long_double * v, + const char *format); + +int gsl_vector_long_double_memcpy (gsl_vector_long_double * dest, const gsl_vector_long_double * src); + +int gsl_vector_long_double_reverse (gsl_vector_long_double * v); + +int gsl_vector_long_double_swap (gsl_vector_long_double * v, gsl_vector_long_double * w); +int gsl_vector_long_double_swap_elements (gsl_vector_long_double * v, const size_t i, const size_t j); + +long double gsl_vector_long_double_max (const gsl_vector_long_double * v); +long double gsl_vector_long_double_min (const gsl_vector_long_double * v); +void gsl_vector_long_double_minmax (const gsl_vector_long_double * v, long double * min_out, long double * max_out); + +size_t gsl_vector_long_double_max_index (const gsl_vector_long_double * v); +size_t gsl_vector_long_double_min_index (const gsl_vector_long_double * v); +void gsl_vector_long_double_minmax_index (const gsl_vector_long_double * v, size_t * imin, size_t * imax); + +int gsl_vector_long_double_add (gsl_vector_long_double * a, const gsl_vector_long_double * b); +int gsl_vector_long_double_sub (gsl_vector_long_double * a, const gsl_vector_long_double * b); +int gsl_vector_long_double_mul (gsl_vector_long_double * a, const gsl_vector_long_double * b); +int gsl_vector_long_double_div (gsl_vector_long_double * a, const gsl_vector_long_double * b); +int gsl_vector_long_double_scale (gsl_vector_long_double * a, const double x); +int gsl_vector_long_double_add_constant (gsl_vector_long_double * a, const double x); + +int gsl_vector_long_double_equal (const gsl_vector_long_double * u, + const gsl_vector_long_double * v); + +int gsl_vector_long_double_isnull (const gsl_vector_long_double * v); +int gsl_vector_long_double_ispos (const gsl_vector_long_double * v); +int gsl_vector_long_double_isneg (const gsl_vector_long_double * v); +int gsl_vector_long_double_isnonneg (const gsl_vector_long_double * v); + +INLINE_DECL long double gsl_vector_long_double_get (const gsl_vector_long_double * v, const size_t i); +INLINE_DECL void gsl_vector_long_double_set (gsl_vector_long_double * v, const size_t i, long double x); +INLINE_DECL long double * gsl_vector_long_double_ptr (gsl_vector_long_double * v, const size_t i); +INLINE_DECL const long double * gsl_vector_long_double_const_ptr (const gsl_vector_long_double * v, const size_t i); + +#ifdef HAVE_INLINE + +INLINE_FUN +long double +gsl_vector_long_double_get (const gsl_vector_long_double * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return v->data[i * v->stride]; +} + +INLINE_FUN +void +gsl_vector_long_double_set (gsl_vector_long_double * v, const size_t i, long double x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + v->data[i * v->stride] = x; +} + +INLINE_FUN +long double * +gsl_vector_long_double_ptr (gsl_vector_long_double * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (long double *) (v->data + i * v->stride); +} + +INLINE_FUN +const long double * +gsl_vector_long_double_const_ptr (const gsl_vector_long_double * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (const long double *) (v->data + i * v->stride); +} +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_LONG_DOUBLE_H__ */ + + diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_short.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_short.h new file mode 100644 index 000000000..4f41f7a6f --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_short.h @@ -0,0 +1,230 @@ +/* vector/gsl_vector_short.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_SHORT_H__ +#define __GSL_VECTOR_SHORT_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + short *data; + gsl_block_short *block; + int owner; +} +gsl_vector_short; + +typedef struct +{ + gsl_vector_short vector; +} _gsl_vector_short_view; + +typedef _gsl_vector_short_view gsl_vector_short_view; + +typedef struct +{ + gsl_vector_short vector; +} _gsl_vector_short_const_view; + +typedef const _gsl_vector_short_const_view gsl_vector_short_const_view; + + +/* Allocation */ + +gsl_vector_short *gsl_vector_short_alloc (const size_t n); +gsl_vector_short *gsl_vector_short_calloc (const size_t n); + +gsl_vector_short *gsl_vector_short_alloc_from_block (gsl_block_short * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_short *gsl_vector_short_alloc_from_vector (gsl_vector_short * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_short_free (gsl_vector_short * v); + +/* Views */ + +_gsl_vector_short_view +gsl_vector_short_view_array (short *v, size_t n); + +_gsl_vector_short_view +gsl_vector_short_view_array_with_stride (short *base, + size_t stride, + size_t n); + +_gsl_vector_short_const_view +gsl_vector_short_const_view_array (const short *v, size_t n); + +_gsl_vector_short_const_view +gsl_vector_short_const_view_array_with_stride (const short *base, + size_t stride, + size_t n); + +_gsl_vector_short_view +gsl_vector_short_subvector (gsl_vector_short *v, + size_t i, + size_t n); + +_gsl_vector_short_view +gsl_vector_short_subvector_with_stride (gsl_vector_short *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_short_const_view +gsl_vector_short_const_subvector (const gsl_vector_short *v, + size_t i, + size_t n); + +_gsl_vector_short_const_view +gsl_vector_short_const_subvector_with_stride (const gsl_vector_short *v, + size_t i, + size_t stride, + size_t n); + +/* Operations */ + +void gsl_vector_short_set_zero (gsl_vector_short * v); +void gsl_vector_short_set_all (gsl_vector_short * v, short x); +int gsl_vector_short_set_basis (gsl_vector_short * v, size_t i); + +int gsl_vector_short_fread (FILE * stream, gsl_vector_short * v); +int gsl_vector_short_fwrite (FILE * stream, const gsl_vector_short * v); +int gsl_vector_short_fscanf (FILE * stream, gsl_vector_short * v); +int gsl_vector_short_fprintf (FILE * stream, const gsl_vector_short * v, + const char *format); + +int gsl_vector_short_memcpy (gsl_vector_short * dest, const gsl_vector_short * src); + +int gsl_vector_short_reverse (gsl_vector_short * v); + +int gsl_vector_short_swap (gsl_vector_short * v, gsl_vector_short * w); +int gsl_vector_short_swap_elements (gsl_vector_short * v, const size_t i, const size_t j); + +short gsl_vector_short_max (const gsl_vector_short * v); +short gsl_vector_short_min (const gsl_vector_short * v); +void gsl_vector_short_minmax (const gsl_vector_short * v, short * min_out, short * max_out); + +size_t gsl_vector_short_max_index (const gsl_vector_short * v); +size_t gsl_vector_short_min_index (const gsl_vector_short * v); +void gsl_vector_short_minmax_index (const gsl_vector_short * v, size_t * imin, size_t * imax); + +int gsl_vector_short_add (gsl_vector_short * a, const gsl_vector_short * b); +int gsl_vector_short_sub (gsl_vector_short * a, const gsl_vector_short * b); +int gsl_vector_short_mul (gsl_vector_short * a, const gsl_vector_short * b); +int gsl_vector_short_div (gsl_vector_short * a, const gsl_vector_short * b); +int gsl_vector_short_scale (gsl_vector_short * a, const double x); +int gsl_vector_short_add_constant (gsl_vector_short * a, const double x); + +int gsl_vector_short_equal (const gsl_vector_short * u, + const gsl_vector_short * v); + +int gsl_vector_short_isnull (const gsl_vector_short * v); +int gsl_vector_short_ispos (const gsl_vector_short * v); +int gsl_vector_short_isneg (const gsl_vector_short * v); +int gsl_vector_short_isnonneg (const gsl_vector_short * v); + +INLINE_DECL short gsl_vector_short_get (const gsl_vector_short * v, const size_t i); +INLINE_DECL void gsl_vector_short_set (gsl_vector_short * v, const size_t i, short x); +INLINE_DECL short * gsl_vector_short_ptr (gsl_vector_short * v, const size_t i); +INLINE_DECL const short * gsl_vector_short_const_ptr (const gsl_vector_short * v, const size_t i); + +#ifdef HAVE_INLINE + +INLINE_FUN +short +gsl_vector_short_get (const gsl_vector_short * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return v->data[i * v->stride]; +} + +INLINE_FUN +void +gsl_vector_short_set (gsl_vector_short * v, const size_t i, short x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + v->data[i * v->stride] = x; +} + +INLINE_FUN +short * +gsl_vector_short_ptr (gsl_vector_short * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (short *) (v->data + i * v->stride); +} + +INLINE_FUN +const short * +gsl_vector_short_const_ptr (const gsl_vector_short * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (const short *) (v->data + i * v->stride); +} +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_SHORT_H__ */ + + diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_uchar.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_uchar.h new file mode 100644 index 000000000..b27096d95 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_uchar.h @@ -0,0 +1,230 @@ +/* vector/gsl_vector_uchar.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_UCHAR_H__ +#define __GSL_VECTOR_UCHAR_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + unsigned char *data; + gsl_block_uchar *block; + int owner; +} +gsl_vector_uchar; + +typedef struct +{ + gsl_vector_uchar vector; +} _gsl_vector_uchar_view; + +typedef _gsl_vector_uchar_view gsl_vector_uchar_view; + +typedef struct +{ + gsl_vector_uchar vector; +} _gsl_vector_uchar_const_view; + +typedef const _gsl_vector_uchar_const_view gsl_vector_uchar_const_view; + + +/* Allocation */ + +gsl_vector_uchar *gsl_vector_uchar_alloc (const size_t n); +gsl_vector_uchar *gsl_vector_uchar_calloc (const size_t n); + +gsl_vector_uchar *gsl_vector_uchar_alloc_from_block (gsl_block_uchar * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_uchar *gsl_vector_uchar_alloc_from_vector (gsl_vector_uchar * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_uchar_free (gsl_vector_uchar * v); + +/* Views */ + +_gsl_vector_uchar_view +gsl_vector_uchar_view_array (unsigned char *v, size_t n); + +_gsl_vector_uchar_view +gsl_vector_uchar_view_array_with_stride (unsigned char *base, + size_t stride, + size_t n); + +_gsl_vector_uchar_const_view +gsl_vector_uchar_const_view_array (const unsigned char *v, size_t n); + +_gsl_vector_uchar_const_view +gsl_vector_uchar_const_view_array_with_stride (const unsigned char *base, + size_t stride, + size_t n); + +_gsl_vector_uchar_view +gsl_vector_uchar_subvector (gsl_vector_uchar *v, + size_t i, + size_t n); + +_gsl_vector_uchar_view +gsl_vector_uchar_subvector_with_stride (gsl_vector_uchar *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_uchar_const_view +gsl_vector_uchar_const_subvector (const gsl_vector_uchar *v, + size_t i, + size_t n); + +_gsl_vector_uchar_const_view +gsl_vector_uchar_const_subvector_with_stride (const gsl_vector_uchar *v, + size_t i, + size_t stride, + size_t n); + +/* Operations */ + +void gsl_vector_uchar_set_zero (gsl_vector_uchar * v); +void gsl_vector_uchar_set_all (gsl_vector_uchar * v, unsigned char x); +int gsl_vector_uchar_set_basis (gsl_vector_uchar * v, size_t i); + +int gsl_vector_uchar_fread (FILE * stream, gsl_vector_uchar * v); +int gsl_vector_uchar_fwrite (FILE * stream, const gsl_vector_uchar * v); +int gsl_vector_uchar_fscanf (FILE * stream, gsl_vector_uchar * v); +int gsl_vector_uchar_fprintf (FILE * stream, const gsl_vector_uchar * v, + const char *format); + +int gsl_vector_uchar_memcpy (gsl_vector_uchar * dest, const gsl_vector_uchar * src); + +int gsl_vector_uchar_reverse (gsl_vector_uchar * v); + +int gsl_vector_uchar_swap (gsl_vector_uchar * v, gsl_vector_uchar * w); +int gsl_vector_uchar_swap_elements (gsl_vector_uchar * v, const size_t i, const size_t j); + +unsigned char gsl_vector_uchar_max (const gsl_vector_uchar * v); +unsigned char gsl_vector_uchar_min (const gsl_vector_uchar * v); +void gsl_vector_uchar_minmax (const gsl_vector_uchar * v, unsigned char * min_out, unsigned char * max_out); + +size_t gsl_vector_uchar_max_index (const gsl_vector_uchar * v); +size_t gsl_vector_uchar_min_index (const gsl_vector_uchar * v); +void gsl_vector_uchar_minmax_index (const gsl_vector_uchar * v, size_t * imin, size_t * imax); + +int gsl_vector_uchar_add (gsl_vector_uchar * a, const gsl_vector_uchar * b); +int gsl_vector_uchar_sub (gsl_vector_uchar * a, const gsl_vector_uchar * b); +int gsl_vector_uchar_mul (gsl_vector_uchar * a, const gsl_vector_uchar * b); +int gsl_vector_uchar_div (gsl_vector_uchar * a, const gsl_vector_uchar * b); +int gsl_vector_uchar_scale (gsl_vector_uchar * a, const double x); +int gsl_vector_uchar_add_constant (gsl_vector_uchar * a, const double x); + +int gsl_vector_uchar_equal (const gsl_vector_uchar * u, + const gsl_vector_uchar * v); + +int gsl_vector_uchar_isnull (const gsl_vector_uchar * v); +int gsl_vector_uchar_ispos (const gsl_vector_uchar * v); +int gsl_vector_uchar_isneg (const gsl_vector_uchar * v); +int gsl_vector_uchar_isnonneg (const gsl_vector_uchar * v); + +INLINE_DECL unsigned char gsl_vector_uchar_get (const gsl_vector_uchar * v, const size_t i); +INLINE_DECL void gsl_vector_uchar_set (gsl_vector_uchar * v, const size_t i, unsigned char x); +INLINE_DECL unsigned char * gsl_vector_uchar_ptr (gsl_vector_uchar * v, const size_t i); +INLINE_DECL const unsigned char * gsl_vector_uchar_const_ptr (const gsl_vector_uchar * v, const size_t i); + +#ifdef HAVE_INLINE + +INLINE_FUN +unsigned char +gsl_vector_uchar_get (const gsl_vector_uchar * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return v->data[i * v->stride]; +} + +INLINE_FUN +void +gsl_vector_uchar_set (gsl_vector_uchar * v, const size_t i, unsigned char x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + v->data[i * v->stride] = x; +} + +INLINE_FUN +unsigned char * +gsl_vector_uchar_ptr (gsl_vector_uchar * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (unsigned char *) (v->data + i * v->stride); +} + +INLINE_FUN +const unsigned char * +gsl_vector_uchar_const_ptr (const gsl_vector_uchar * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (const unsigned char *) (v->data + i * v->stride); +} +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_UCHAR_H__ */ + + diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_uint.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_uint.h new file mode 100644 index 000000000..d2f6cb35e --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_uint.h @@ -0,0 +1,230 @@ +/* vector/gsl_vector_uint.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_UINT_H__ +#define __GSL_VECTOR_UINT_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + unsigned int *data; + gsl_block_uint *block; + int owner; +} +gsl_vector_uint; + +typedef struct +{ + gsl_vector_uint vector; +} _gsl_vector_uint_view; + +typedef _gsl_vector_uint_view gsl_vector_uint_view; + +typedef struct +{ + gsl_vector_uint vector; +} _gsl_vector_uint_const_view; + +typedef const _gsl_vector_uint_const_view gsl_vector_uint_const_view; + + +/* Allocation */ + +gsl_vector_uint *gsl_vector_uint_alloc (const size_t n); +gsl_vector_uint *gsl_vector_uint_calloc (const size_t n); + +gsl_vector_uint *gsl_vector_uint_alloc_from_block (gsl_block_uint * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_uint *gsl_vector_uint_alloc_from_vector (gsl_vector_uint * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_uint_free (gsl_vector_uint * v); + +/* Views */ + +_gsl_vector_uint_view +gsl_vector_uint_view_array (unsigned int *v, size_t n); + +_gsl_vector_uint_view +gsl_vector_uint_view_array_with_stride (unsigned int *base, + size_t stride, + size_t n); + +_gsl_vector_uint_const_view +gsl_vector_uint_const_view_array (const unsigned int *v, size_t n); + +_gsl_vector_uint_const_view +gsl_vector_uint_const_view_array_with_stride (const unsigned int *base, + size_t stride, + size_t n); + +_gsl_vector_uint_view +gsl_vector_uint_subvector (gsl_vector_uint *v, + size_t i, + size_t n); + +_gsl_vector_uint_view +gsl_vector_uint_subvector_with_stride (gsl_vector_uint *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_uint_const_view +gsl_vector_uint_const_subvector (const gsl_vector_uint *v, + size_t i, + size_t n); + +_gsl_vector_uint_const_view +gsl_vector_uint_const_subvector_with_stride (const gsl_vector_uint *v, + size_t i, + size_t stride, + size_t n); + +/* Operations */ + +void gsl_vector_uint_set_zero (gsl_vector_uint * v); +void gsl_vector_uint_set_all (gsl_vector_uint * v, unsigned int x); +int gsl_vector_uint_set_basis (gsl_vector_uint * v, size_t i); + +int gsl_vector_uint_fread (FILE * stream, gsl_vector_uint * v); +int gsl_vector_uint_fwrite (FILE * stream, const gsl_vector_uint * v); +int gsl_vector_uint_fscanf (FILE * stream, gsl_vector_uint * v); +int gsl_vector_uint_fprintf (FILE * stream, const gsl_vector_uint * v, + const char *format); + +int gsl_vector_uint_memcpy (gsl_vector_uint * dest, const gsl_vector_uint * src); + +int gsl_vector_uint_reverse (gsl_vector_uint * v); + +int gsl_vector_uint_swap (gsl_vector_uint * v, gsl_vector_uint * w); +int gsl_vector_uint_swap_elements (gsl_vector_uint * v, const size_t i, const size_t j); + +unsigned int gsl_vector_uint_max (const gsl_vector_uint * v); +unsigned int gsl_vector_uint_min (const gsl_vector_uint * v); +void gsl_vector_uint_minmax (const gsl_vector_uint * v, unsigned int * min_out, unsigned int * max_out); + +size_t gsl_vector_uint_max_index (const gsl_vector_uint * v); +size_t gsl_vector_uint_min_index (const gsl_vector_uint * v); +void gsl_vector_uint_minmax_index (const gsl_vector_uint * v, size_t * imin, size_t * imax); + +int gsl_vector_uint_add (gsl_vector_uint * a, const gsl_vector_uint * b); +int gsl_vector_uint_sub (gsl_vector_uint * a, const gsl_vector_uint * b); +int gsl_vector_uint_mul (gsl_vector_uint * a, const gsl_vector_uint * b); +int gsl_vector_uint_div (gsl_vector_uint * a, const gsl_vector_uint * b); +int gsl_vector_uint_scale (gsl_vector_uint * a, const double x); +int gsl_vector_uint_add_constant (gsl_vector_uint * a, const double x); + +int gsl_vector_uint_equal (const gsl_vector_uint * u, + const gsl_vector_uint * v); + +int gsl_vector_uint_isnull (const gsl_vector_uint * v); +int gsl_vector_uint_ispos (const gsl_vector_uint * v); +int gsl_vector_uint_isneg (const gsl_vector_uint * v); +int gsl_vector_uint_isnonneg (const gsl_vector_uint * v); + +INLINE_DECL unsigned int gsl_vector_uint_get (const gsl_vector_uint * v, const size_t i); +INLINE_DECL void gsl_vector_uint_set (gsl_vector_uint * v, const size_t i, unsigned int x); +INLINE_DECL unsigned int * gsl_vector_uint_ptr (gsl_vector_uint * v, const size_t i); +INLINE_DECL const unsigned int * gsl_vector_uint_const_ptr (const gsl_vector_uint * v, const size_t i); + +#ifdef HAVE_INLINE + +INLINE_FUN +unsigned int +gsl_vector_uint_get (const gsl_vector_uint * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return v->data[i * v->stride]; +} + +INLINE_FUN +void +gsl_vector_uint_set (gsl_vector_uint * v, const size_t i, unsigned int x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + v->data[i * v->stride] = x; +} + +INLINE_FUN +unsigned int * +gsl_vector_uint_ptr (gsl_vector_uint * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (unsigned int *) (v->data + i * v->stride); +} + +INLINE_FUN +const unsigned int * +gsl_vector_uint_const_ptr (const gsl_vector_uint * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (const unsigned int *) (v->data + i * v->stride); +} +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_UINT_H__ */ + + diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_ulong.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_ulong.h new file mode 100644 index 000000000..01bf24294 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_ulong.h @@ -0,0 +1,230 @@ +/* vector/gsl_vector_ulong.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_ULONG_H__ +#define __GSL_VECTOR_ULONG_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + unsigned long *data; + gsl_block_ulong *block; + int owner; +} +gsl_vector_ulong; + +typedef struct +{ + gsl_vector_ulong vector; +} _gsl_vector_ulong_view; + +typedef _gsl_vector_ulong_view gsl_vector_ulong_view; + +typedef struct +{ + gsl_vector_ulong vector; +} _gsl_vector_ulong_const_view; + +typedef const _gsl_vector_ulong_const_view gsl_vector_ulong_const_view; + + +/* Allocation */ + +gsl_vector_ulong *gsl_vector_ulong_alloc (const size_t n); +gsl_vector_ulong *gsl_vector_ulong_calloc (const size_t n); + +gsl_vector_ulong *gsl_vector_ulong_alloc_from_block (gsl_block_ulong * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_ulong *gsl_vector_ulong_alloc_from_vector (gsl_vector_ulong * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_ulong_free (gsl_vector_ulong * v); + +/* Views */ + +_gsl_vector_ulong_view +gsl_vector_ulong_view_array (unsigned long *v, size_t n); + +_gsl_vector_ulong_view +gsl_vector_ulong_view_array_with_stride (unsigned long *base, + size_t stride, + size_t n); + +_gsl_vector_ulong_const_view +gsl_vector_ulong_const_view_array (const unsigned long *v, size_t n); + +_gsl_vector_ulong_const_view +gsl_vector_ulong_const_view_array_with_stride (const unsigned long *base, + size_t stride, + size_t n); + +_gsl_vector_ulong_view +gsl_vector_ulong_subvector (gsl_vector_ulong *v, + size_t i, + size_t n); + +_gsl_vector_ulong_view +gsl_vector_ulong_subvector_with_stride (gsl_vector_ulong *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_ulong_const_view +gsl_vector_ulong_const_subvector (const gsl_vector_ulong *v, + size_t i, + size_t n); + +_gsl_vector_ulong_const_view +gsl_vector_ulong_const_subvector_with_stride (const gsl_vector_ulong *v, + size_t i, + size_t stride, + size_t n); + +/* Operations */ + +void gsl_vector_ulong_set_zero (gsl_vector_ulong * v); +void gsl_vector_ulong_set_all (gsl_vector_ulong * v, unsigned long x); +int gsl_vector_ulong_set_basis (gsl_vector_ulong * v, size_t i); + +int gsl_vector_ulong_fread (FILE * stream, gsl_vector_ulong * v); +int gsl_vector_ulong_fwrite (FILE * stream, const gsl_vector_ulong * v); +int gsl_vector_ulong_fscanf (FILE * stream, gsl_vector_ulong * v); +int gsl_vector_ulong_fprintf (FILE * stream, const gsl_vector_ulong * v, + const char *format); + +int gsl_vector_ulong_memcpy (gsl_vector_ulong * dest, const gsl_vector_ulong * src); + +int gsl_vector_ulong_reverse (gsl_vector_ulong * v); + +int gsl_vector_ulong_swap (gsl_vector_ulong * v, gsl_vector_ulong * w); +int gsl_vector_ulong_swap_elements (gsl_vector_ulong * v, const size_t i, const size_t j); + +unsigned long gsl_vector_ulong_max (const gsl_vector_ulong * v); +unsigned long gsl_vector_ulong_min (const gsl_vector_ulong * v); +void gsl_vector_ulong_minmax (const gsl_vector_ulong * v, unsigned long * min_out, unsigned long * max_out); + +size_t gsl_vector_ulong_max_index (const gsl_vector_ulong * v); +size_t gsl_vector_ulong_min_index (const gsl_vector_ulong * v); +void gsl_vector_ulong_minmax_index (const gsl_vector_ulong * v, size_t * imin, size_t * imax); + +int gsl_vector_ulong_add (gsl_vector_ulong * a, const gsl_vector_ulong * b); +int gsl_vector_ulong_sub (gsl_vector_ulong * a, const gsl_vector_ulong * b); +int gsl_vector_ulong_mul (gsl_vector_ulong * a, const gsl_vector_ulong * b); +int gsl_vector_ulong_div (gsl_vector_ulong * a, const gsl_vector_ulong * b); +int gsl_vector_ulong_scale (gsl_vector_ulong * a, const double x); +int gsl_vector_ulong_add_constant (gsl_vector_ulong * a, const double x); + +int gsl_vector_ulong_equal (const gsl_vector_ulong * u, + const gsl_vector_ulong * v); + +int gsl_vector_ulong_isnull (const gsl_vector_ulong * v); +int gsl_vector_ulong_ispos (const gsl_vector_ulong * v); +int gsl_vector_ulong_isneg (const gsl_vector_ulong * v); +int gsl_vector_ulong_isnonneg (const gsl_vector_ulong * v); + +INLINE_DECL unsigned long gsl_vector_ulong_get (const gsl_vector_ulong * v, const size_t i); +INLINE_DECL void gsl_vector_ulong_set (gsl_vector_ulong * v, const size_t i, unsigned long x); +INLINE_DECL unsigned long * gsl_vector_ulong_ptr (gsl_vector_ulong * v, const size_t i); +INLINE_DECL const unsigned long * gsl_vector_ulong_const_ptr (const gsl_vector_ulong * v, const size_t i); + +#ifdef HAVE_INLINE + +INLINE_FUN +unsigned long +gsl_vector_ulong_get (const gsl_vector_ulong * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return v->data[i * v->stride]; +} + +INLINE_FUN +void +gsl_vector_ulong_set (gsl_vector_ulong * v, const size_t i, unsigned long x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + v->data[i * v->stride] = x; +} + +INLINE_FUN +unsigned long * +gsl_vector_ulong_ptr (gsl_vector_ulong * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (unsigned long *) (v->data + i * v->stride); +} + +INLINE_FUN +const unsigned long * +gsl_vector_ulong_const_ptr (const gsl_vector_ulong * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (const unsigned long *) (v->data + i * v->stride); +} +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_ULONG_H__ */ + + diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_ushort.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_ushort.h new file mode 100644 index 000000000..7b7e66438 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_ushort.h @@ -0,0 +1,230 @@ +/* vector/gsl_vector_ushort.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_USHORT_H__ +#define __GSL_VECTOR_USHORT_H__ + +#include +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + unsigned short *data; + gsl_block_ushort *block; + int owner; +} +gsl_vector_ushort; + +typedef struct +{ + gsl_vector_ushort vector; +} _gsl_vector_ushort_view; + +typedef _gsl_vector_ushort_view gsl_vector_ushort_view; + +typedef struct +{ + gsl_vector_ushort vector; +} _gsl_vector_ushort_const_view; + +typedef const _gsl_vector_ushort_const_view gsl_vector_ushort_const_view; + + +/* Allocation */ + +gsl_vector_ushort *gsl_vector_ushort_alloc (const size_t n); +gsl_vector_ushort *gsl_vector_ushort_calloc (const size_t n); + +gsl_vector_ushort *gsl_vector_ushort_alloc_from_block (gsl_block_ushort * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_ushort *gsl_vector_ushort_alloc_from_vector (gsl_vector_ushort * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_ushort_free (gsl_vector_ushort * v); + +/* Views */ + +_gsl_vector_ushort_view +gsl_vector_ushort_view_array (unsigned short *v, size_t n); + +_gsl_vector_ushort_view +gsl_vector_ushort_view_array_with_stride (unsigned short *base, + size_t stride, + size_t n); + +_gsl_vector_ushort_const_view +gsl_vector_ushort_const_view_array (const unsigned short *v, size_t n); + +_gsl_vector_ushort_const_view +gsl_vector_ushort_const_view_array_with_stride (const unsigned short *base, + size_t stride, + size_t n); + +_gsl_vector_ushort_view +gsl_vector_ushort_subvector (gsl_vector_ushort *v, + size_t i, + size_t n); + +_gsl_vector_ushort_view +gsl_vector_ushort_subvector_with_stride (gsl_vector_ushort *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_ushort_const_view +gsl_vector_ushort_const_subvector (const gsl_vector_ushort *v, + size_t i, + size_t n); + +_gsl_vector_ushort_const_view +gsl_vector_ushort_const_subvector_with_stride (const gsl_vector_ushort *v, + size_t i, + size_t stride, + size_t n); + +/* Operations */ + +void gsl_vector_ushort_set_zero (gsl_vector_ushort * v); +void gsl_vector_ushort_set_all (gsl_vector_ushort * v, unsigned short x); +int gsl_vector_ushort_set_basis (gsl_vector_ushort * v, size_t i); + +int gsl_vector_ushort_fread (FILE * stream, gsl_vector_ushort * v); +int gsl_vector_ushort_fwrite (FILE * stream, const gsl_vector_ushort * v); +int gsl_vector_ushort_fscanf (FILE * stream, gsl_vector_ushort * v); +int gsl_vector_ushort_fprintf (FILE * stream, const gsl_vector_ushort * v, + const char *format); + +int gsl_vector_ushort_memcpy (gsl_vector_ushort * dest, const gsl_vector_ushort * src); + +int gsl_vector_ushort_reverse (gsl_vector_ushort * v); + +int gsl_vector_ushort_swap (gsl_vector_ushort * v, gsl_vector_ushort * w); +int gsl_vector_ushort_swap_elements (gsl_vector_ushort * v, const size_t i, const size_t j); + +unsigned short gsl_vector_ushort_max (const gsl_vector_ushort * v); +unsigned short gsl_vector_ushort_min (const gsl_vector_ushort * v); +void gsl_vector_ushort_minmax (const gsl_vector_ushort * v, unsigned short * min_out, unsigned short * max_out); + +size_t gsl_vector_ushort_max_index (const gsl_vector_ushort * v); +size_t gsl_vector_ushort_min_index (const gsl_vector_ushort * v); +void gsl_vector_ushort_minmax_index (const gsl_vector_ushort * v, size_t * imin, size_t * imax); + +int gsl_vector_ushort_add (gsl_vector_ushort * a, const gsl_vector_ushort * b); +int gsl_vector_ushort_sub (gsl_vector_ushort * a, const gsl_vector_ushort * b); +int gsl_vector_ushort_mul (gsl_vector_ushort * a, const gsl_vector_ushort * b); +int gsl_vector_ushort_div (gsl_vector_ushort * a, const gsl_vector_ushort * b); +int gsl_vector_ushort_scale (gsl_vector_ushort * a, const double x); +int gsl_vector_ushort_add_constant (gsl_vector_ushort * a, const double x); + +int gsl_vector_ushort_equal (const gsl_vector_ushort * u, + const gsl_vector_ushort * v); + +int gsl_vector_ushort_isnull (const gsl_vector_ushort * v); +int gsl_vector_ushort_ispos (const gsl_vector_ushort * v); +int gsl_vector_ushort_isneg (const gsl_vector_ushort * v); +int gsl_vector_ushort_isnonneg (const gsl_vector_ushort * v); + +INLINE_DECL unsigned short gsl_vector_ushort_get (const gsl_vector_ushort * v, const size_t i); +INLINE_DECL void gsl_vector_ushort_set (gsl_vector_ushort * v, const size_t i, unsigned short x); +INLINE_DECL unsigned short * gsl_vector_ushort_ptr (gsl_vector_ushort * v, const size_t i); +INLINE_DECL const unsigned short * gsl_vector_ushort_const_ptr (const gsl_vector_ushort * v, const size_t i); + +#ifdef HAVE_INLINE + +INLINE_FUN +unsigned short +gsl_vector_ushort_get (const gsl_vector_ushort * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return v->data[i * v->stride]; +} + +INLINE_FUN +void +gsl_vector_ushort_set (gsl_vector_ushort * v, const size_t i, unsigned short x) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + v->data[i * v->stride] = x; +} + +INLINE_FUN +unsigned short * +gsl_vector_ushort_ptr (gsl_vector_ushort * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (unsigned short *) (v->data + i * v->stride); +} + +INLINE_FUN +const unsigned short * +gsl_vector_ushort_const_ptr (const gsl_vector_ushort * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (GSL_RANGE_COND(i >= v->size)) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (const unsigned short *) (v->data + i * v->stride); +} +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_USHORT_H__ */ + + diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_version.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_version.h new file mode 100644 index 000000000..00b29b6a5 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_version.h @@ -0,0 +1,26 @@ +#ifndef __GSL_VERSION_H__ +#define __GSL_VERSION_H__ + +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif +__BEGIN_DECLS + + +#define GSL_VERSION "2.5" +#define GSL_MAJOR_VERSION 2 +#define GSL_MINOR_VERSION 5 + +GSL_VAR const char * gsl_version; + +__END_DECLS + +#endif /* __GSL_VERSION_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_wavelet.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_wavelet.h new file mode 100644 index 000000000..5e1ec2b22 --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_wavelet.h @@ -0,0 +1,100 @@ +/* wavelet/gsl_wavelet.h + * + * Copyright (C) 2004 Ivo Alxneit + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_WAVELET_H__ +#define __GSL_WAVELET_H__ +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef enum { + gsl_wavelet_forward = 1, gsl_wavelet_backward = -1 +} +gsl_wavelet_direction; + +typedef struct +{ + const char *name; + int (*init) (const double **h1, const double **g1, + const double **h2, const double **g2, size_t * nc, + size_t * offset, size_t member); +} +gsl_wavelet_type; + +typedef struct +{ + const gsl_wavelet_type *type; + const double *h1; + const double *g1; + const double *h2; + const double *g2; + size_t nc; + size_t offset; +} +gsl_wavelet; + +typedef struct +{ + double *scratch; + size_t n; +} +gsl_wavelet_workspace; + +GSL_VAR const gsl_wavelet_type *gsl_wavelet_daubechies; +GSL_VAR const gsl_wavelet_type *gsl_wavelet_daubechies_centered; +GSL_VAR const gsl_wavelet_type *gsl_wavelet_haar; +GSL_VAR const gsl_wavelet_type *gsl_wavelet_haar_centered; +GSL_VAR const gsl_wavelet_type *gsl_wavelet_bspline; +GSL_VAR const gsl_wavelet_type *gsl_wavelet_bspline_centered; + +gsl_wavelet *gsl_wavelet_alloc (const gsl_wavelet_type * T, size_t k); +void gsl_wavelet_free (gsl_wavelet * w); +const char *gsl_wavelet_name (const gsl_wavelet * w); + +gsl_wavelet_workspace *gsl_wavelet_workspace_alloc (size_t n); +void gsl_wavelet_workspace_free (gsl_wavelet_workspace * work); + +int gsl_wavelet_transform (const gsl_wavelet * w, + double *data, size_t stride, size_t n, + gsl_wavelet_direction dir, + gsl_wavelet_workspace * work); + +int gsl_wavelet_transform_forward (const gsl_wavelet * w, + double *data, size_t stride, size_t n, + gsl_wavelet_workspace * work); + +int gsl_wavelet_transform_inverse (const gsl_wavelet * w, + double *data, size_t stride, size_t n, + gsl_wavelet_workspace * work); + +__END_DECLS + +#endif /* __GSL_WAVELET_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_wavelet2d.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_wavelet2d.h new file mode 100644 index 000000000..173f43e2c --- /dev/null +++ b/kmath-gsl/src/nativeMain/resources/gsl/gsl_wavelet2d.h @@ -0,0 +1,107 @@ +/* wavelet/gsl_wavelet.h + * + * Copyright (C) 2004 Ivo Alxneit + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_WAVELET2D_H__ +#define __GSL_WAVELET2D_H__ +#include +#include +#include +#include +#include + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_wavelet2d_transform (const gsl_wavelet * w, + double *data, + size_t tda, size_t size1, size_t size2, + gsl_wavelet_direction dir, + gsl_wavelet_workspace * work); + +int gsl_wavelet2d_transform_forward (const gsl_wavelet * w, + double *data, + size_t tda, size_t size1, size_t size2, + gsl_wavelet_workspace * work); + +int gsl_wavelet2d_transform_inverse (const gsl_wavelet * w, + double *data, + size_t tda, size_t size1, size_t size2, + gsl_wavelet_workspace * work); + +int gsl_wavelet2d_nstransform (const gsl_wavelet * w, + double *data, + size_t tda, size_t size1, size_t size2, + gsl_wavelet_direction dir, + gsl_wavelet_workspace * work); + +int gsl_wavelet2d_nstransform_forward (const gsl_wavelet * w, + double *data, + size_t tda, size_t size1, size_t size2, + gsl_wavelet_workspace * work); + +int gsl_wavelet2d_nstransform_inverse (const gsl_wavelet * w, + double *data, + size_t tda, size_t size1, size_t size2, + gsl_wavelet_workspace * work); + +int +gsl_wavelet2d_transform_matrix (const gsl_wavelet * w, + gsl_matrix * a, + gsl_wavelet_direction dir, + gsl_wavelet_workspace * work); + +int +gsl_wavelet2d_transform_matrix_forward (const gsl_wavelet * w, + gsl_matrix * a, + gsl_wavelet_workspace * work); + +int +gsl_wavelet2d_transform_matrix_inverse (const gsl_wavelet * w, + gsl_matrix * a, + gsl_wavelet_workspace * work); + + +int +gsl_wavelet2d_nstransform_matrix (const gsl_wavelet * w, + gsl_matrix * a, + gsl_wavelet_direction dir, + gsl_wavelet_workspace * work); + +int +gsl_wavelet2d_nstransform_matrix_forward (const gsl_wavelet * w, + gsl_matrix * a, + gsl_wavelet_workspace * work); + +int +gsl_wavelet2d_nstransform_matrix_inverse (const gsl_wavelet * w, + gsl_matrix * a, + gsl_wavelet_workspace * work); + +__END_DECLS + +#endif /* __GSL_WAVELET2D_H__ */ diff --git a/settings.gradle.kts b/settings.gradle.kts index 7ece3f25c..8f8b1172e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -7,7 +7,6 @@ pluginManagement { maven("https://dl.bintray.com/mipt-npm/kscience") maven("https://dl.bintray.com/mipt-npm/dev") maven("https://dl.bintray.com/kotlin/kotlinx") - maven("https://dl.bintray.com/kotlin/kotlin-dev/") } val toolsVersion = "0.6.1-dev-1.4.20-M1" @@ -25,11 +24,11 @@ pluginManagement { } rootProject.name = "kmath" + include( ":kmath-memory", ":kmath-core", ":kmath-functions", -// ":kmath-io", ":kmath-coroutines", ":kmath-histograms", ":kmath-commons", @@ -39,6 +38,7 @@ include( ":kmath-for-real", ":kmath-geometry", ":kmath-ast", - ":examples", - ":kmath-ejml" + ":kmath-ejml", + ":kmath-gsl", + ":examples" ) From e2af1f095ac8fda7f9467e77aff2d8caa9770a2e Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 4 Oct 2020 13:01:52 +0700 Subject: [PATCH 02/76] Change konan cache path --- .github/workflows/gradle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index c541a8f71..8ab6ecc69 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -28,7 +28,7 @@ jobs: with: path: | ~/.konan/dependencies - ~/.konan/kotlin-native-macos-1.4.0 + ~/.konan/kotlin-native-prebuilt-linux-1.4.20-eap-37 key: ${{ runner.os }}-konan-1.4.0 restore-keys: ${{ runner.os }}-konan-1.4.0 - name: Build with Gradle From 54eb66ac704e8b15088ad8c2959e828504e1643d Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 4 Oct 2020 13:10:20 +0700 Subject: [PATCH 03/76] Add explicit cinterop call --- .github/workflows/gradle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 8ab6ecc69..339a014c8 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -32,4 +32,4 @@ jobs: key: ${{ runner.os }}-konan-1.4.0 restore-keys: ${{ runner.os }}-konan-1.4.0 - name: Build with Gradle - run: ./gradlew -Dorg.gradle.daemon=false build + run: ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslNative build From ef31cfcd654da7659280b1f2e99e1d06efd468b2 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 4 Oct 2020 13:19:49 +0700 Subject: [PATCH 04/76] Simplify build-script --- kmath-gsl/build.gradle.kts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index 806400fc1..3fa4223a8 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -8,12 +8,10 @@ plugins { kotlin { targets.withType { - compilations["main"].apply { - cinterops { - val libgsl by creating { - defFile("src/nativeInterop/cinterop/libgsl.def") - includeDirs { allHeaders("./src/nativeMain/resources/") } - } + compilations["main"].cinterops { + val libgsl by creating { + defFile("src/nativeInterop/cinterop/libgsl.def") + includeDirs { allHeaders("./src/nativeMain/resources/") } } } } From 159b5530fbc9ae0a4a7ea0fdf73edef617889a1f Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 4 Oct 2020 13:22:00 +0700 Subject: [PATCH 05/76] Rename Actions job --- .github/workflows/gradle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 339a014c8..f5e5e62a3 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -3,7 +3,7 @@ name: Gradle build on: [push] jobs: - build: + build-ubuntu: runs-on: ubuntu-latest steps: From fb4d74e90f2b7de4d95f89bd629ada5e3eceed27 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 4 Oct 2020 13:26:21 +0700 Subject: [PATCH 06/76] Add OSX target --- .github/workflows/gradle.yml | 82 ++++++++++++++++++++++++------------ 1 file changed, 56 insertions(+), 26 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index f5e5e62a3..02b7ee2cf 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -1,35 +1,65 @@ name: Gradle build -on: [push] +on: [ push ] jobs: build-ubuntu: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - name: Install libgsl-dev - run: sudo apt install libgsl-dev - - name: Cache gradle - uses: actions/cache@v2 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: gradle_6_6_1 - restore-keys: gradle_6_6_1 + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Install libgsl-dev + run: sudo apt install libgsl-dev + - name: Cache gradle + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle_6_6_1 + restore-keys: gradle_6_6_1 - - name: Cache konan - uses: actions/cache@v2 - with: - path: | - ~/.konan/dependencies - ~/.konan/kotlin-native-prebuilt-linux-1.4.20-eap-37 - key: ${{ runner.os }}-konan-1.4.0 - restore-keys: ${{ runner.os }}-konan-1.4.0 - - name: Build with Gradle - run: ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslNative build + - name: Cache konan + uses: actions/cache@v2 + with: + path: | + ~/.konan/dependencies + ~/.konan/kotlin-native-prebuilt-linux-1.4.20-eap-37 + key: ${{ runner.os }}-konan-1.4.0 + restore-keys: ${{ runner.os }}-konan-1.4.0 + - name: Build with Gradle + run: ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslNative build + build-osx: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Install gsl + run: brew install gsl + - name: Cache gradle + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle_6_6_1 + restore-keys: gradle_6_6_1 + + - name: Cache konan + uses: actions/cache@v2 + with: + path: | + ~/.konan/dependencies + ~/.konan/kotlin-native-prebuilt-macos-1.4.20-eap-37 + key: ${{ runner.os }}-konan-1.4.0 + restore-keys: ${{ runner.os }}-konan-1.4.0 + - name: Build with Gradle + run: ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslNative build From 8f6163698c54e19a77eae4e0db7086d973e5ed93 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 4 Oct 2020 13:39:39 +0700 Subject: [PATCH 07/76] Update tasks --- .github/workflows/gradle.yml | 12 ++++++------ gradle.properties | 6 ++---- .../kotlin/kscience/kmath/gsl/GslRealMatrix.kt | 10 +++++++--- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 02b7ee2cf..0355ff78d 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -29,10 +29,10 @@ jobs: path: | ~/.konan/dependencies ~/.konan/kotlin-native-prebuilt-linux-1.4.20-eap-37 - key: ${{ runner.os }}-konan-1.4.0 - restore-keys: ${{ runner.os }}-konan-1.4.0 + key: ${{ runner.os }}-konan-1.4.20-eap-37 + restore-keys: ${{ runner.os }}-konan-1.4.20-eap-37 - name: Build with Gradle - run: ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslNative build + run: ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslLinuxX64 build build-osx: runs-on: macos-latest @@ -59,7 +59,7 @@ jobs: path: | ~/.konan/dependencies ~/.konan/kotlin-native-prebuilt-macos-1.4.20-eap-37 - key: ${{ runner.os }}-konan-1.4.0 - restore-keys: ${{ runner.os }}-konan-1.4.0 + key: ${{ runner.os }}-konan-1.4.20-eap-37 + restore-keys: ${{ runner.os }}-konan-1.4.20-eap-37 - name: Build with Gradle - run: ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslNative build + run: ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslMacosX64 build diff --git a/gradle.properties b/gradle.properties index 930bba550..b16859f29 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,7 @@ kotlin.code.style=official -kotlin.parallel.tasks.in.project=true kotlin.mpp.enableGranularSourceSetsMetadata=true -kotlin.native.enableDependencyPropagation=false kotlin.mpp.stability.nowarn=true - +kotlin.parallel.tasks.in.project=true org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m org.gradle.parallel=true -systemProp.org.gradle.internal.publish.checksums.insecure=true \ No newline at end of file +systemProp.org.gradle.internal.publish.checksums.insecure=true diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslRealMatrix.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslRealMatrix.kt index 56e397aed..6ef3abdc8 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslRealMatrix.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslRealMatrix.kt @@ -12,7 +12,11 @@ import org.gnu.gsl.gsl_matrix_equal import org.gnu.gsl.gsl_matrix_get public sealed class GslMatrix : FeaturedMatrix { - public abstract val nativeHandle: CValues + protected abstract val nativeHandle: CValues + + override fun equals(other: Any?): Boolean { + return NDStructure.equals(this, other as? NDStructure<*> ?: return false) + } public override fun hashCode(): Int { var result = nativeHandle.hashCode() @@ -21,7 +25,7 @@ public sealed class GslMatrix : FeaturedMatrix { } } -public class GslRealMatrix(public override val nativeHandle: CValues, features: Set) : +public class GslRealMatrix(protected override val nativeHandle: CValues, features: Set) : GslMatrix() { public override val rowNum: Int @@ -42,6 +46,6 @@ public class GslRealMatrix(public override val nativeHandle: CValues public override fun equals(other: Any?): Boolean { if (other is GslRealMatrix) gsl_matrix_equal(nativeHandle, other.nativeHandle) - return NDStructure.equals(this, other as? NDStructure<*> ?: return false) + return super.equals(other) } } From fd4253fc932647f9a1b75d811b243d1c42082420 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 4 Oct 2020 13:54:00 +0700 Subject: [PATCH 08/76] Provide bindings for each gsl_matrix except char, uchar, long_double because they have no clear KMath analogues --- .../kotlin/kscience/kmath/ejml/EjmlMatrix.kt | 3 - .../kotlin/kscience/kmath/gsl/GslMatrices.kt | 237 ++++++++++++++++++ .../kscience/kmath/gsl/GslRealMatrix.kt | 51 ---- 3 files changed, 237 insertions(+), 54 deletions(-) create mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrices.kt delete mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslRealMatrix.kt diff --git a/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrix.kt b/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrix.kt index a8892924a..88b8a5162 100644 --- a/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrix.kt +++ b/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrix.kt @@ -22,9 +22,6 @@ public class EjmlMatrix(public val origin: SimpleMatrix, features: Set = setOf( object : LUPDecompositionFeature, DeterminantFeature { override val determinant: Double diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrices.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrices.kt new file mode 100644 index 000000000..9381a5e5c --- /dev/null +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrices.kt @@ -0,0 +1,237 @@ +package kscience.kmath.gsl + +import kotlinx.cinterop.* +import kscience.kmath.linear.FeaturedMatrix +import kscience.kmath.linear.MatrixFeature +import kscience.kmath.operations.Complex +import kscience.kmath.structures.NDStructure +import org.gnu.gsl.* + +public sealed class GslMatrix : FeaturedMatrix { + protected abstract val nativeHandle: CValues + + override fun equals(other: Any?): Boolean { + return NDStructure.equals(this, other as? NDStructure<*> ?: return false) + } + + public override fun hashCode(): Int { + var result = nativeHandle.hashCode() + result = 31 * result + features.hashCode() + return result + } +} + +public class GslRealMatrix(protected override val nativeHandle: CValues, features: Set) : + GslMatrix() { + + public override val rowNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + + public override val colNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + + public override val features: Set = features + + public override fun suggestFeature(vararg features: MatrixFeature): GslRealMatrix = + GslRealMatrix(nativeHandle, this.features + features) + + public override fun get(i: Int, j: Int): Double = gsl_matrix_get(nativeHandle, i.toULong(), j.toULong()) + + public override fun equals(other: Any?): Boolean { + if (other is GslRealMatrix) gsl_matrix_equal(nativeHandle, other.nativeHandle) + return super.equals(other) + } +} + +public class GslIntMatrix(protected override val nativeHandle: CValues, features: Set) : + GslMatrix() { + + public override val rowNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + + public override val colNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + + public override val features: Set = features + + public override fun suggestFeature(vararg features: MatrixFeature): GslIntMatrix = + GslIntMatrix(nativeHandle, this.features + features) + + public override fun get(i: Int, j: Int): Int = gsl_matrix_int_get(nativeHandle, i.toULong(), j.toULong()) + + public override fun equals(other: Any?): Boolean { + if (other is GslIntMatrix) gsl_matrix_int_equal(nativeHandle, other.nativeHandle) + return super.equals(other) + } +} + +public class GslLongMatrix( + protected override val nativeHandle: CValues, + features: Set +) : + GslMatrix() { + + public override val rowNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + + public override val colNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + + public override val features: Set = features + + public override fun suggestFeature(vararg features: MatrixFeature): GslLongMatrix = + GslLongMatrix(nativeHandle, this.features + features) + + public override fun get(i: Int, j: Int): Long = gsl_matrix_long_get(nativeHandle, i.toULong(), j.toULong()) + + public override fun equals(other: Any?): Boolean { + if (other is GslLongMatrix) gsl_matrix_long_equal(nativeHandle, other.nativeHandle) + return super.equals(other) + } +} + +public class GslFloatMatrix( + protected override val nativeHandle: CValues, + features: Set +) : + GslMatrix() { + + public override val rowNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + + public override val colNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + + public override val features: Set = features + + public override fun suggestFeature(vararg features: MatrixFeature): GslFloatMatrix = + GslFloatMatrix(nativeHandle, this.features + features) + + public override fun get(i: Int, j: Int): Float = gsl_matrix_float_get(nativeHandle, i.toULong(), j.toULong()) + + public override fun equals(other: Any?): Boolean { + if (other is GslFloatMatrix) gsl_matrix_float_equal(nativeHandle, other.nativeHandle) + return super.equals(other) + } +} + +public class GslUIntMatrix( + protected override val nativeHandle: CValues, + features: Set +) : GslMatrix() { + + public override val rowNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + + public override val colNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + + public override val features: Set = features + + public override fun suggestFeature(vararg features: MatrixFeature): GslUIntMatrix = + GslUIntMatrix(nativeHandle, this.features + features) + + public override fun get(i: Int, j: Int): UInt = gsl_matrix_uint_get(nativeHandle, i.toULong(), j.toULong()) + + public override fun equals(other: Any?): Boolean { + if (other is GslUIntMatrix) gsl_matrix_uint_equal(nativeHandle, other.nativeHandle) + return super.equals(other) + } +} + +public class GslULongMatrix( + protected override val nativeHandle: CValues, + features: Set +) : GslMatrix() { + + public override val rowNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + + public override val colNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + + public override val features: Set = features + + public override fun suggestFeature(vararg features: MatrixFeature): GslULongMatrix = + GslULongMatrix(nativeHandle, this.features + features) + + public override fun get(i: Int, j: Int): ULong = gsl_matrix_ulong_get(nativeHandle, i.toULong(), j.toULong()) + + public override fun equals(other: Any?): Boolean { + if (other is GslULongMatrix) gsl_matrix_ulong_equal(nativeHandle, other.nativeHandle) + return super.equals(other) + } +} + +public class GslUShortMatrix( + protected override val nativeHandle: CValues, + features: Set +) : GslMatrix() { + + public override val rowNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + + public override val colNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + + public override val features: Set = features + + public override fun suggestFeature(vararg features: MatrixFeature): GslUShortMatrix = + GslUShortMatrix(nativeHandle, this.features + features) + + public override fun get(i: Int, j: Int): UShort = gsl_matrix_ushort_get(nativeHandle, i.toULong(), j.toULong()) + + public override fun equals(other: Any?): Boolean { + if (other is GslUShortMatrix) gsl_matrix_ushort_equal(nativeHandle, other.nativeHandle) + return super.equals(other) + } +} + +public class GslShortMatrix( + protected override val nativeHandle: CValues, + features: Set +) : GslMatrix() { + + public override val rowNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + + public override val colNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + + public override val features: Set = features + + public override fun suggestFeature(vararg features: MatrixFeature): GslUShortMatrix = + GslShortMatrix(nativeHandle, this.features + features) + + public override fun get(i: Int, j: Int): UShort = gsl_matrix_short_get(nativeHandle, i.toULong(), j.toULong()) + + public override fun equals(other: Any?): Boolean { + if (other is GslShortMatrix) gsl_matrix_short_equal(nativeHandle, other.nativeHandle) + return super.equals(other) + } +} + +public class GslComplexMatrix( + protected override val nativeHandle: CValues, + features: Set +) : GslMatrix() { + + public override val rowNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + + public override val colNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + + public override val features: Set = features + + public override fun suggestFeature(vararg features: MatrixFeature): GslComplexMatrix = + GslComplexMatrix(nativeHandle, this.features + features) + + public override fun get(i: Int, j: Int): Complex = + gsl_matrix_complex_get(nativeHandle, i.toULong(), j.toULong()).useContents { Complex(dat[0], dat[1]) } + + public override fun equals(other: Any?): Boolean { + if (other is GslComplexMatrix) gsl_matrix_complex_equal(nativeHandle, other.nativeHandle) + return super.equals(other) + } +} diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslRealMatrix.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslRealMatrix.kt deleted file mode 100644 index 6ef3abdc8..000000000 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslRealMatrix.kt +++ /dev/null @@ -1,51 +0,0 @@ -package kscience.kmath.gsl - -import kotlinx.cinterop.CStructVar -import kotlinx.cinterop.CValues -import kotlinx.cinterop.memScoped -import kotlinx.cinterop.pointed -import kscience.kmath.linear.FeaturedMatrix -import kscience.kmath.linear.MatrixFeature -import kscience.kmath.structures.NDStructure -import org.gnu.gsl.gsl_matrix -import org.gnu.gsl.gsl_matrix_equal -import org.gnu.gsl.gsl_matrix_get - -public sealed class GslMatrix : FeaturedMatrix { - protected abstract val nativeHandle: CValues - - override fun equals(other: Any?): Boolean { - return NDStructure.equals(this, other as? NDStructure<*> ?: return false) - } - - public override fun hashCode(): Int { - var result = nativeHandle.hashCode() - result = 31 * result + features.hashCode() - return result - } -} - -public class GslRealMatrix(protected override val nativeHandle: CValues, features: Set) : - GslMatrix() { - - public override val rowNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - - public override val colNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - - public override val shape: IntArray - get() = intArrayOf(rowNum, colNum) - - public override val features: Set = features - - public override fun suggestFeature(vararg features: MatrixFeature): GslRealMatrix = - GslRealMatrix(nativeHandle, this.features + features) - - public override fun get(i: Int, j: Int): Double = gsl_matrix_get(nativeHandle, i.toULong(), j.toULong()) - - public override fun equals(other: Any?): Boolean { - if (other is GslRealMatrix) gsl_matrix_equal(nativeHandle, other.nativeHandle) - return super.equals(other) - } -} From 74d226cab74ece00e1f299290352a6488a0dff8b Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 4 Oct 2020 13:54:14 +0700 Subject: [PATCH 09/76] Fix types --- .../src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrices.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrices.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrices.kt index 9381a5e5c..54c062f14 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrices.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrices.kt @@ -200,10 +200,10 @@ public class GslShortMatrix( public override val features: Set = features - public override fun suggestFeature(vararg features: MatrixFeature): GslUShortMatrix = + public override fun suggestFeature(vararg features: MatrixFeature): GslShortMatrix = GslShortMatrix(nativeHandle, this.features + features) - public override fun get(i: Int, j: Int): UShort = gsl_matrix_short_get(nativeHandle, i.toULong(), j.toULong()) + public override fun get(i: Int, j: Int): Short = gsl_matrix_short_get(nativeHandle, i.toULong(), j.toULong()) public override fun equals(other: Any?): Boolean { if (other is GslShortMatrix) gsl_matrix_short_equal(nativeHandle, other.nativeHandle) From 57245587608f10455adbd58275aadb366a37f7fd Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 4 Oct 2020 14:10:53 +0700 Subject: [PATCH 10/76] Reconfigure native build --- .github/workflows/gradle.yml | 4 ++-- kmath-gsl/build.gradle.kts | 14 +++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 0355ff78d..d0dcedad1 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -32,7 +32,7 @@ jobs: key: ${{ runner.os }}-konan-1.4.20-eap-37 restore-keys: ${{ runner.os }}-konan-1.4.20-eap-37 - name: Build with Gradle - run: ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslLinuxX64 build + run: ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslNative build build-osx: runs-on: macos-latest @@ -62,4 +62,4 @@ jobs: key: ${{ runner.os }}-konan-1.4.20-eap-37 restore-keys: ${{ runner.os }}-konan-1.4.20-eap-37 - name: Build with Gradle - run: ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslMacosX64 build + run: ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslNative build diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index 3fa4223a8..19f36a1e4 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -1,14 +1,18 @@ @file:Suppress("UNUSED_VARIABLE") -import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget - plugins { - id("ru.mipt.npm.native") + id("ru.mipt.npm.mpp") } kotlin { - targets.withType { - compilations["main"].cinterops { + val nativeTarget = when (System.getProperty("os.name")) { + "Mac OS X" -> macosX64("native") + "Linux" -> linuxX64("native") + else -> throw GradleException("Host OS is not supported in Kotlin/Native.") + } + + val main by nativeTarget.compilations.getting { + cinterops { val libgsl by creating { defFile("src/nativeInterop/cinterop/libgsl.def") includeDirs { allHeaders("./src/nativeMain/resources/") } From 90bdf00f8b4b959872ff06662de73865b7e68258 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 4 Oct 2020 14:35:51 +0700 Subject: [PATCH 11/76] Sort classes, add vectors support --- .../kotlin/kscience/kmath/gsl/GslMatrices.kt | 151 +++++++++--------- .../kotlin/kscience/kmath/gsl/GslVectors.kt | 84 ++++++++++ .../kscience/kmath/gsl/nativeUtilities.kt | 8 + 3 files changed, 166 insertions(+), 77 deletions(-) create mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVectors.kt create mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/nativeUtilities.kt diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrices.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrices.kt index 54c062f14..95f918209 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrices.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrices.kt @@ -7,10 +7,8 @@ import kscience.kmath.operations.Complex import kscience.kmath.structures.NDStructure import org.gnu.gsl.* -public sealed class GslMatrix : FeaturedMatrix { - protected abstract val nativeHandle: CValues - - override fun equals(other: Any?): Boolean { +public sealed class GslMatrix : StructHolder(), FeaturedMatrix { + public override fun equals(other: Any?): Boolean { return NDStructure.equals(this, other as? NDStructure<*> ?: return false) } @@ -43,6 +41,30 @@ public class GslRealMatrix(protected override val nativeHandle: CValues, + features: Set +) : + GslMatrix() { + public override val rowNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + + public override val colNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + + public override val features: Set = features + + public override fun suggestFeature(vararg features: MatrixFeature): GslFloatMatrix = + GslFloatMatrix(nativeHandle, this.features + features) + + public override fun get(i: Int, j: Int): Float = gsl_matrix_float_get(nativeHandle, i.toULong(), j.toULong()) + + public override fun equals(other: Any?): Boolean { + if (other is GslFloatMatrix) gsl_matrix_float_equal(nativeHandle, other.nativeHandle) + return super.equals(other) + } +} + public class GslIntMatrix(protected override val nativeHandle: CValues, features: Set) : GslMatrix() { @@ -65,6 +87,30 @@ public class GslIntMatrix(protected override val nativeHandle: CValues, + features: Set +) : GslMatrix() { + + public override val rowNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + + public override val colNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + + public override val features: Set = features + + public override fun suggestFeature(vararg features: MatrixFeature): GslUIntMatrix = + GslUIntMatrix(nativeHandle, this.features + features) + + public override fun get(i: Int, j: Int): UInt = gsl_matrix_uint_get(nativeHandle, i.toULong(), j.toULong()) + + public override fun equals(other: Any?): Boolean { + if (other is GslUIntMatrix) gsl_matrix_uint_equal(nativeHandle, other.nativeHandle) + return super.equals(other) + } +} + public class GslLongMatrix( protected override val nativeHandle: CValues, features: Set @@ -90,55 +136,6 @@ public class GslLongMatrix( } } -public class GslFloatMatrix( - protected override val nativeHandle: CValues, - features: Set -) : - GslMatrix() { - - public override val rowNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - - public override val colNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - - public override val features: Set = features - - public override fun suggestFeature(vararg features: MatrixFeature): GslFloatMatrix = - GslFloatMatrix(nativeHandle, this.features + features) - - public override fun get(i: Int, j: Int): Float = gsl_matrix_float_get(nativeHandle, i.toULong(), j.toULong()) - - public override fun equals(other: Any?): Boolean { - if (other is GslFloatMatrix) gsl_matrix_float_equal(nativeHandle, other.nativeHandle) - return super.equals(other) - } -} - -public class GslUIntMatrix( - protected override val nativeHandle: CValues, - features: Set -) : GslMatrix() { - - public override val rowNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - - public override val colNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - - public override val features: Set = features - - public override fun suggestFeature(vararg features: MatrixFeature): GslUIntMatrix = - GslUIntMatrix(nativeHandle, this.features + features) - - public override fun get(i: Int, j: Int): UInt = gsl_matrix_uint_get(nativeHandle, i.toULong(), j.toULong()) - - public override fun equals(other: Any?): Boolean { - if (other is GslUIntMatrix) gsl_matrix_uint_equal(nativeHandle, other.nativeHandle) - return super.equals(other) - } -} - public class GslULongMatrix( protected override val nativeHandle: CValues, features: Set @@ -163,30 +160,6 @@ public class GslULongMatrix( } } -public class GslUShortMatrix( - protected override val nativeHandle: CValues, - features: Set -) : GslMatrix() { - - public override val rowNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - - public override val colNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - - public override val features: Set = features - - public override fun suggestFeature(vararg features: MatrixFeature): GslUShortMatrix = - GslUShortMatrix(nativeHandle, this.features + features) - - public override fun get(i: Int, j: Int): UShort = gsl_matrix_ushort_get(nativeHandle, i.toULong(), j.toULong()) - - public override fun equals(other: Any?): Boolean { - if (other is GslUShortMatrix) gsl_matrix_ushort_equal(nativeHandle, other.nativeHandle) - return super.equals(other) - } -} - public class GslShortMatrix( protected override val nativeHandle: CValues, features: Set @@ -211,6 +184,30 @@ public class GslShortMatrix( } } +public class GslUShortMatrix( + protected override val nativeHandle: CValues, + features: Set +) : GslMatrix() { + + public override val rowNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + + public override val colNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + + public override val features: Set = features + + public override fun suggestFeature(vararg features: MatrixFeature): GslUShortMatrix = + GslUShortMatrix(nativeHandle, this.features + features) + + public override fun get(i: Int, j: Int): UShort = gsl_matrix_ushort_get(nativeHandle, i.toULong(), j.toULong()) + + public override fun equals(other: Any?): Boolean { + if (other is GslUShortMatrix) gsl_matrix_ushort_equal(nativeHandle, other.nativeHandle) + return super.equals(other) + } +} + public class GslComplexMatrix( protected override val nativeHandle: CValues, features: Set diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVectors.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVectors.kt new file mode 100644 index 000000000..fc6e8d329 --- /dev/null +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVectors.kt @@ -0,0 +1,84 @@ +package kscience.kmath.gsl + +import kotlinx.cinterop.* +import kscience.kmath.linear.Point +import kscience.kmath.operations.Complex +import org.gnu.gsl.* + +public sealed class GslVector : StructHolder(), Point { + public override fun iterator(): Iterator = object : Iterator { + private var cursor = 0 + + override fun hasNext(): Boolean = cursor < size + + override fun next(): T { + cursor++ + return this@GslVector[cursor - 1] + } + } +} + +public class GslRealVector(override val nativeHandle: CValues) : GslVector() { + public override val size: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } + + public override fun get(index: Int): Double = gsl_vector_get(nativeHandle, index.toULong()) +} + +public class GslFloatVector(override val nativeHandle: CValues) : GslVector() { + public override val size: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } + + public override fun get(index: Int): Float = gsl_vector_float_get(nativeHandle, index.toULong()) +} + +public class GslIntVector(override val nativeHandle: CValues) : GslVector() { + public override val size: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } + + public override fun get(index: Int): Int = gsl_vector_int_get(nativeHandle, index.toULong()) +} + +public class GslUIntVector(override val nativeHandle: CValues) : GslVector() { + public override val size: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } + + public override fun get(index: Int): UInt = gsl_vector_uint_get(nativeHandle, index.toULong()) +} + +public class GslLongVector(override val nativeHandle: CValues) : GslVector() { + public override val size: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } + + public override fun get(index: Int): Long = gsl_vector_long_get(nativeHandle, index.toULong()) +} + +public class GslULongVector(override val nativeHandle: CValues) : GslVector() { + public override val size: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } + + public override fun get(index: Int): ULong = gsl_vector_ulong_get(nativeHandle, index.toULong()) +} + +public class GslShortVector(override val nativeHandle: CValues) : GslVector() { + public override val size: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } + + public override fun get(index: Int): Short = gsl_vector_short_get(nativeHandle, index.toULong()) +} + +public class GslUShortVector(override val nativeHandle: CValues) : GslVector() { + public override val size: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } + + public override fun get(index: Int): UShort = gsl_vector_ushort_get(nativeHandle, index.toULong()) +} + +public class GslComplexVector(override val nativeHandle: CValues) : GslVector() { + public override val size: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } + + public override fun get(index: Int): Complex = gsl_vector_complex_get(nativeHandle, index.toULong()).useContents { + Complex(dat[0], dat[1]) + } +} diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/nativeUtilities.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/nativeUtilities.kt new file mode 100644 index 000000000..fed31dcaa --- /dev/null +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/nativeUtilities.kt @@ -0,0 +1,8 @@ +package kscience.kmath.gsl + +import kotlinx.cinterop.CStructVar +import kotlinx.cinterop.CValues + +public abstract class StructHolder internal constructor() { + protected abstract val nativeHandle: CValues +} From 881f2280fc697c53a6fe1c68d9e559a9a6cde538 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 4 Oct 2020 14:39:24 +0700 Subject: [PATCH 12/76] Try adding Windows support --- .github/workflows/gradle.yml | 34 ++++++++++++++++++++++++++++++++++ kmath-gsl/build.gradle.kts | 9 ++++++--- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index d0dcedad1..1688995db 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -63,3 +63,37 @@ jobs: restore-keys: ${{ runner.os }}-konan-1.4.20-eap-37 - name: Build with Gradle run: ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslNative build + + build-windows: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Install gsl + run: c:\msys64\usr\bin\pacman --noconfirm -S mingw-w64-x86_64-gsl + - name: Add msys to path + # msys installed on default image but not in path + run: SETX PATH "%PATH%;C:\msys64\mingw64\bin" + - name: Cache gradle + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle_6_6_1 + restore-keys: gradle_6_6_1 + + - name: Cache konan + uses: actions/cache@v2 + with: + path: | + ~/.konan/dependencies + ~/.konan/kotlin-native-prebuilt-mingw-1.4.20-eap-37 + key: ${{ runner.os }}-konan-1.4.20-eap-37 + restore-keys: ${{ runner.os }}-konan-1.4.20-eap-37 + - name: Build with Gradle + run: ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslNative build diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index 19f36a1e4..dfee9b311 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -5,9 +5,12 @@ plugins { } kotlin { - val nativeTarget = when (System.getProperty("os.name")) { - "Mac OS X" -> macosX64("native") - "Linux" -> linuxX64("native") + val hostOs = System.getProperty("os.name") + + val nativeTarget = when { + hostOs == "Mac OS X" -> macosX64("native") + hostOs == "Linux" -> linuxX64("native") + hostOs.startsWith("Windows") -> mingwX64("native") else -> throw GradleException("Host OS is not supported in Kotlin/Native.") } From 0565f0665a6ee52b81b5cc4f2c3ca7ed92ebeefc Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 4 Oct 2020 14:45:33 +0700 Subject: [PATCH 13/76] Turn on daemon on Windows --- .github/workflows/gradle.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 1688995db..9335c2123 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -73,7 +73,7 @@ jobs: uses: actions/setup-java@v1 with: java-version: 11 - - name: Install gsl + - name: Install mingw-w64-x86_64-gsl run: c:\msys64\usr\bin\pacman --noconfirm -S mingw-w64-x86_64-gsl - name: Add msys to path # msys installed on default image but not in path @@ -96,4 +96,4 @@ jobs: key: ${{ runner.os }}-konan-1.4.20-eap-37 restore-keys: ${{ runner.os }}-konan-1.4.20-eap-37 - name: Build with Gradle - run: ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslNative build + run: ./gradlew --build-cache :kmath-gsl:cinteropLibgslNative build From 53f38e749261aa717df358701695a1c0a2b1b75b Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 4 Oct 2020 15:39:35 +0700 Subject: [PATCH 14/76] Simplify compilerOpts --- kmath-gsl/src/nativeInterop/cinterop/libgsl.def | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kmath-gsl/src/nativeInterop/cinterop/libgsl.def b/kmath-gsl/src/nativeInterop/cinterop/libgsl.def index 567d483e2..0f903fe54 100644 --- a/kmath-gsl/src/nativeInterop/cinterop/libgsl.def +++ b/kmath-gsl/src/nativeInterop/cinterop/libgsl.def @@ -1,8 +1,7 @@ package=org.gnu.gsl headers=gsl/gsl_blas.h headerFilter=gsl/* +compilerOpts=-I/usr/include/gsl linkerOpts=-lgsl linkerOpts.linux=-L/usr/lib64 -L/usr/lib/x86_64-linux-gnu linkerOpts.osx=-L/opt/local/lib -L/usr/local/lib -compilerOpts.linux=-I/usr/include/gsl -compilerOpts.osx=-I/usr/include/gsl From eedfcf393287a6dbf499e23cafa91380bc4c2390 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 4 Oct 2020 15:53:24 +0700 Subject: [PATCH 15/76] Drop mingw support in GSL module --- .github/workflows/gradle.yml | 5 +---- kmath-gsl/build.gradle.kts | 14 +++++++------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 9335c2123..4557369bf 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -73,10 +73,7 @@ jobs: uses: actions/setup-java@v1 with: java-version: 11 - - name: Install mingw-w64-x86_64-gsl - run: c:\msys64\usr\bin\pacman --noconfirm -S mingw-w64-x86_64-gsl - name: Add msys to path - # msys installed on default image but not in path run: SETX PATH "%PATH%;C:\msys64\mingw64\bin" - name: Cache gradle uses: actions/cache@v2 @@ -96,4 +93,4 @@ jobs: key: ${{ runner.os }}-konan-1.4.20-eap-37 restore-keys: ${{ runner.os }}-konan-1.4.20-eap-37 - name: Build with Gradle - run: ./gradlew --build-cache :kmath-gsl:cinteropLibgslNative build + run: ./gradlew --build-cache build diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index dfee9b311..b73b1c82c 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -5,13 +5,13 @@ plugins { } kotlin { - val hostOs = System.getProperty("os.name") - - val nativeTarget = when { - hostOs == "Mac OS X" -> macosX64("native") - hostOs == "Linux" -> linuxX64("native") - hostOs.startsWith("Windows") -> mingwX64("native") - else -> throw GradleException("Host OS is not supported in Kotlin/Native.") + val nativeTarget = when (System.getProperty("os.name")) { + "Mac OS X" -> macosX64("native") + "Linux" -> linuxX64("native") + else -> { + logger.warn("Current OS cannot build any of kmath-gsl targets.") + return@kotlin + } } val main by nativeTarget.compilations.getting { From abcde808dc4c0f9515d2cbad1fa5ddda2b4bca31 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 4 Oct 2020 20:17:44 +0700 Subject: [PATCH 16/76] Add first working test, use kotlinx-io fork, major rework of GSL API --- build.gradle.kts | 1 + examples/build.gradle.kts | 1 - .../kscience/kmath/linear/MatrixContext.kt | 9 +- .../kscience/kmath/ejml/EjmlMatrixContext.kt | 9 +- kmath-gsl/build.gradle.kts | 2 + .../kotlin/kscience/kmath/gsl/GslComplex.kt | 12 + .../kotlin/kscience/kmath/gsl/GslMatrices.kt | 290 ++++++++++++------ .../kscience/kmath/gsl/GslMatrixContexts.kt | 57 ++++ .../kscience/kmath/gsl/GslMemoryHolder.kt | 9 + .../kotlin/kscience/kmath/gsl/GslVectors.kt | 71 +++-- .../kscience/kmath/gsl/nativeUtilities.kt | 8 - kmath-gsl/src/nativeTest/kotlin/RealTest.kt | 15 + 12 files changed, 348 insertions(+), 136 deletions(-) create mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt create mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContexts.kt create mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt delete mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/nativeUtilities.kt create mode 100644 kmath-gsl/src/nativeTest/kotlin/RealTest.kt diff --git a/build.gradle.kts b/build.gradle.kts index 05e2d5979..92ad16b85 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,6 +12,7 @@ allprojects { maven("https://dl.bintray.com/kotlin/kotlin-eap") maven("https://dl.bintray.com/kotlin/kotlinx") maven("https://dl.bintray.com/hotkeytlt/maven") + maven("https://dl.bintray.com/commandertvis/kotlinx-io/") } group = "kscience.kmath" diff --git a/examples/build.gradle.kts b/examples/build.gradle.kts index c8b173d1c..a1cc4b6a2 100644 --- a/examples/build.gradle.kts +++ b/examples/build.gradle.kts @@ -26,7 +26,6 @@ dependencies { implementation(project(":kmath-viktor")) implementation(project(":kmath-dimensions")) implementation(project(":kmath-ejml")) - implementation("org.jetbrains.kotlinx:kotlinx-io:0.2.0-npm-dev-11") implementation("org.jetbrains.kotlinx:kotlinx.benchmark.runtime:0.2.0-dev-20") implementation("org.slf4j:slf4j-simple:1.7.30") "benchmarksImplementation"("org.jetbrains.kotlinx:kotlinx.benchmark.runtime-jvm:0.2.0-dev-8") diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt index f4dbce89a..300b963a6 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt @@ -18,10 +18,11 @@ public interface MatrixContext : SpaceOperations> { */ public fun produce(rows: Int, columns: Int, initializer: (i: Int, j: Int) -> T): Matrix - public override fun binaryOperation(operation: String, left: Matrix, right: Matrix): Matrix = when (operation) { - "dot" -> left dot right - else -> super.binaryOperation(operation, left, right) - } + public override fun binaryOperation(operation: String, left: Matrix, right: Matrix): Matrix = + when (operation) { + "dot" -> left dot right + else -> super.binaryOperation(operation, left, right) + } /** * Computes the dot product of this matrix and another one. diff --git a/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrixContext.kt b/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrixContext.kt index 52826a7b1..64dc605f1 100644 --- a/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrixContext.kt +++ b/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrixContext.kt @@ -1,11 +1,11 @@ package kscience.kmath.ejml -import org.ejml.simple.SimpleMatrix import kscience.kmath.linear.MatrixContext import kscience.kmath.linear.Point import kscience.kmath.operations.Space import kscience.kmath.operations.invoke import kscience.kmath.structures.Matrix +import org.ejml.simple.SimpleMatrix /** * Represents context of basic operations operating with [EjmlMatrix]. @@ -29,8 +29,8 @@ public class EjmlMatrixContext(private val space: Space) : MatrixContext override fun produce(rows: Int, columns: Int, initializer: (i: Int, j: Int) -> Double): EjmlMatrix = EjmlMatrix(SimpleMatrix(rows, columns).also { - (0 until it.numRows()).forEach { row -> - (0 until it.numCols()).forEach { col -> it[row, col] = initializer(row, col) } + (0 until rows).forEach { row -> + (0 until columns).forEach { col -> it[row, col] = initializer(row, col) } } }) @@ -49,7 +49,8 @@ public class EjmlMatrixContext(private val space: Space) : MatrixContext public override fun multiply(a: Matrix, k: Number): EjmlMatrix = produce(a.rowNum, a.colNum) { i, j -> space { a[i, j] * k } } - public override operator fun Matrix.times(value: Double): EjmlMatrix = EjmlMatrix(toEjml().origin.scale(value)) + public override operator fun Matrix.times(value: Double): EjmlMatrix = + EjmlMatrix(toEjml().origin.scale(value)) public companion object } diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index b73b1c82c..43538a35d 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -8,6 +8,7 @@ kotlin { val nativeTarget = when (System.getProperty("os.name")) { "Mac OS X" -> macosX64("native") "Linux" -> linuxX64("native") + else -> { logger.warn("Current OS cannot build any of kmath-gsl targets.") return@kotlin @@ -26,6 +27,7 @@ kotlin { sourceSets.commonMain { dependencies { api(project(":kmath-core")) + api("org.jetbrains.kotlinx:kotlinx-io:0.2.0-tvis-3") } } } diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt new file mode 100644 index 000000000..0282afb54 --- /dev/null +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt @@ -0,0 +1,12 @@ +package kscience.kmath.gsl + +import kotlinx.cinterop.* +import kscience.kmath.operations.Complex +import org.gnu.gsl.gsl_complex + +internal fun CValue.toKMath(): Complex = useContents { Complex(dat[0], dat[1]) } + +internal fun Complex.toGsl(): CValue = cValue { + dat[0] = re + dat[1] = im +} diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrices.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrices.kt index 95f918209..5eb8794f2 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrices.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrices.kt @@ -7,7 +7,10 @@ import kscience.kmath.operations.Complex import kscience.kmath.structures.NDStructure import org.gnu.gsl.* -public sealed class GslMatrix : StructHolder(), FeaturedMatrix { +public sealed class GslMatrix : GslMemoryHolder(), FeaturedMatrix { + internal abstract operator fun set(i: Int, j: Int, value: T) + internal abstract fun copy(): GslMatrix + public override fun equals(other: Any?): Boolean { return NDStructure.equals(this, other as? NDStructure<*> ?: return false) } @@ -19,215 +22,318 @@ public sealed class GslMatrix : StructHolder(), FeaturedMatrix { } } -public class GslRealMatrix(protected override val nativeHandle: CValues, features: Set) : - GslMatrix() { - - public override val rowNum: Int +internal class GslRealMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { + override val rowNum: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - public override val colNum: Int + override val colNum: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - public override val features: Set = features + override val features: Set = features - public override fun suggestFeature(vararg features: MatrixFeature): GslRealMatrix = + override fun suggestFeature(vararg features: MatrixFeature): GslRealMatrix = GslRealMatrix(nativeHandle, this.features + features) - public override fun get(i: Int, j: Int): Double = gsl_matrix_get(nativeHandle, i.toULong(), j.toULong()) + override operator fun get(i: Int, j: Int): Double = gsl_matrix_get(nativeHandle, i.toULong(), j.toULong()) - public override fun equals(other: Any?): Boolean { + override operator fun set(i: Int, j: Int, value: Double): Unit = + gsl_matrix_set(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): GslRealMatrix = memScoped { + val new = requireNotNull(gsl_matrix_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_memcpy(new, nativeHandle) + GslRealMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_free(nativeHandle) + + override fun equals(other: Any?): Boolean { if (other is GslRealMatrix) gsl_matrix_equal(nativeHandle, other.nativeHandle) return super.equals(other) } } -public class GslFloatMatrix( - protected override val nativeHandle: CValues, - features: Set -) : - GslMatrix() { - public override val rowNum: Int +internal class GslFloatMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { + override val rowNum: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - public override val colNum: Int + override val colNum: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - public override val features: Set = features + override val features: Set = features - public override fun suggestFeature(vararg features: MatrixFeature): GslFloatMatrix = + override fun suggestFeature(vararg features: MatrixFeature): GslFloatMatrix = GslFloatMatrix(nativeHandle, this.features + features) - public override fun get(i: Int, j: Int): Float = gsl_matrix_float_get(nativeHandle, i.toULong(), j.toULong()) + override operator fun get(i: Int, j: Int): Float = + gsl_matrix_float_get(nativeHandle, i.toULong(), j.toULong()) - public override fun equals(other: Any?): Boolean { + override operator fun set(i: Int, j: Int, value: Float): Unit = + gsl_matrix_float_set(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): GslFloatMatrix = memScoped { + val new = requireNotNull(gsl_matrix_float_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_float_memcpy(new, nativeHandle) + GslFloatMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_float_free(nativeHandle) + + override fun equals(other: Any?): Boolean { if (other is GslFloatMatrix) gsl_matrix_float_equal(nativeHandle, other.nativeHandle) return super.equals(other) } } -public class GslIntMatrix(protected override val nativeHandle: CValues, features: Set) : - GslMatrix() { +internal class GslIntMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { - public override val rowNum: Int + override val rowNum: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - public override val colNum: Int + override val colNum: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - public override val features: Set = features + override val features: Set = features - public override fun suggestFeature(vararg features: MatrixFeature): GslIntMatrix = + override fun suggestFeature(vararg features: MatrixFeature): GslIntMatrix = GslIntMatrix(nativeHandle, this.features + features) - public override fun get(i: Int, j: Int): Int = gsl_matrix_int_get(nativeHandle, i.toULong(), j.toULong()) + override operator fun get(i: Int, j: Int): Int = gsl_matrix_int_get(nativeHandle, i.toULong(), j.toULong()) - public override fun equals(other: Any?): Boolean { + override operator fun set(i: Int, j: Int, value: Int): Unit = + gsl_matrix_int_set(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): GslIntMatrix = memScoped { + val new = requireNotNull(gsl_matrix_int_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_int_memcpy(new, nativeHandle) + GslIntMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_int_free(nativeHandle) + + override fun equals(other: Any?): Boolean { if (other is GslIntMatrix) gsl_matrix_int_equal(nativeHandle, other.nativeHandle) return super.equals(other) } } -public class GslUIntMatrix( - protected override val nativeHandle: CValues, - features: Set -) : GslMatrix() { +internal class GslUIntMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { - public override val rowNum: Int + override val rowNum: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - public override val colNum: Int + override val colNum: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - public override val features: Set = features + override val features: Set = features - public override fun suggestFeature(vararg features: MatrixFeature): GslUIntMatrix = + override fun suggestFeature(vararg features: MatrixFeature): GslUIntMatrix = GslUIntMatrix(nativeHandle, this.features + features) - public override fun get(i: Int, j: Int): UInt = gsl_matrix_uint_get(nativeHandle, i.toULong(), j.toULong()) + override operator fun get(i: Int, j: Int): UInt = gsl_matrix_uint_get(nativeHandle, i.toULong(), j.toULong()) - public override fun equals(other: Any?): Boolean { + override operator fun set(i: Int, j: Int, value: UInt): Unit = + gsl_matrix_uint_set(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): GslUIntMatrix = memScoped { + val new = requireNotNull(gsl_matrix_uint_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_uint_memcpy(new, nativeHandle) + GslUIntMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_uint_free(nativeHandle) + + override fun equals(other: Any?): Boolean { if (other is GslUIntMatrix) gsl_matrix_uint_equal(nativeHandle, other.nativeHandle) return super.equals(other) } } -public class GslLongMatrix( - protected override val nativeHandle: CValues, - features: Set -) : - GslMatrix() { +internal class GslLongMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { - public override val rowNum: Int + override val rowNum: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - public override val colNum: Int + override val colNum: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - public override val features: Set = features + override val features: Set = features - public override fun suggestFeature(vararg features: MatrixFeature): GslLongMatrix = + override fun suggestFeature(vararg features: MatrixFeature): GslLongMatrix = GslLongMatrix(nativeHandle, this.features + features) - public override fun get(i: Int, j: Int): Long = gsl_matrix_long_get(nativeHandle, i.toULong(), j.toULong()) + override operator fun get(i: Int, j: Int): Long = gsl_matrix_long_get(nativeHandle, i.toULong(), j.toULong()) - public override fun equals(other: Any?): Boolean { + override operator fun set(i: Int, j: Int, value: Long): Unit = + gsl_matrix_long_set(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): GslLongMatrix = memScoped { + val new = requireNotNull(gsl_matrix_long_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_long_memcpy(new, nativeHandle) + GslLongMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_long_free(nativeHandle) + + override fun equals(other: Any?): Boolean { if (other is GslLongMatrix) gsl_matrix_long_equal(nativeHandle, other.nativeHandle) return super.equals(other) } } -public class GslULongMatrix( - protected override val nativeHandle: CValues, - features: Set -) : GslMatrix() { +internal class GslULongMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { - public override val rowNum: Int + override val rowNum: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - public override val colNum: Int + override val colNum: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - public override val features: Set = features + override val features: Set = features - public override fun suggestFeature(vararg features: MatrixFeature): GslULongMatrix = + override fun suggestFeature(vararg features: MatrixFeature): GslULongMatrix = GslULongMatrix(nativeHandle, this.features + features) - public override fun get(i: Int, j: Int): ULong = gsl_matrix_ulong_get(nativeHandle, i.toULong(), j.toULong()) + override operator fun get(i: Int, j: Int): ULong = + gsl_matrix_ulong_get(nativeHandle, i.toULong(), j.toULong()) - public override fun equals(other: Any?): Boolean { + override operator fun set(i: Int, j: Int, value: ULong): Unit = + gsl_matrix_ulong_set(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): GslULongMatrix = memScoped { + val new = requireNotNull(gsl_matrix_ulong_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_ulong_memcpy(new, nativeHandle) + GslULongMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_ulong_free(nativeHandle) + + override fun equals(other: Any?): Boolean { if (other is GslULongMatrix) gsl_matrix_ulong_equal(nativeHandle, other.nativeHandle) return super.equals(other) } } -public class GslShortMatrix( - protected override val nativeHandle: CValues, - features: Set -) : GslMatrix() { +internal class GslShortMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { - public override val rowNum: Int + override val rowNum: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - public override val colNum: Int + override val colNum: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - public override val features: Set = features + override val features: Set = features - public override fun suggestFeature(vararg features: MatrixFeature): GslShortMatrix = + override fun suggestFeature(vararg features: MatrixFeature): GslShortMatrix = GslShortMatrix(nativeHandle, this.features + features) - public override fun get(i: Int, j: Int): Short = gsl_matrix_short_get(nativeHandle, i.toULong(), j.toULong()) + override operator fun get(i: Int, j: Int): Short = + gsl_matrix_short_get(nativeHandle, i.toULong(), j.toULong()) - public override fun equals(other: Any?): Boolean { + override operator fun set(i: Int, j: Int, value: Short): Unit = + gsl_matrix_short_set(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): GslShortMatrix = memScoped { + val new = requireNotNull(gsl_matrix_short_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_short_memcpy(new, nativeHandle) + GslShortMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_short_free(nativeHandle) + + override fun equals(other: Any?): Boolean { if (other is GslShortMatrix) gsl_matrix_short_equal(nativeHandle, other.nativeHandle) return super.equals(other) } } -public class GslUShortMatrix( - protected override val nativeHandle: CValues, - features: Set -) : GslMatrix() { +internal class GslUShortMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { - public override val rowNum: Int + override val rowNum: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - public override val colNum: Int + override val colNum: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - public override val features: Set = features + override val features: Set = features - public override fun suggestFeature(vararg features: MatrixFeature): GslUShortMatrix = + override fun suggestFeature(vararg features: MatrixFeature): GslUShortMatrix = GslUShortMatrix(nativeHandle, this.features + features) - public override fun get(i: Int, j: Int): UShort = gsl_matrix_ushort_get(nativeHandle, i.toULong(), j.toULong()) + override operator fun get(i: Int, j: Int): UShort = + gsl_matrix_ushort_get(nativeHandle, i.toULong(), j.toULong()) - public override fun equals(other: Any?): Boolean { + override operator fun set(i: Int, j: Int, value: UShort): Unit = + gsl_matrix_ushort_set(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): GslUShortMatrix = memScoped { + val new = requireNotNull(gsl_matrix_ushort_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_ushort_memcpy(new, nativeHandle) + GslUShortMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_ushort_free(nativeHandle) + + override fun equals(other: Any?): Boolean { if (other is GslUShortMatrix) gsl_matrix_ushort_equal(nativeHandle, other.nativeHandle) return super.equals(other) } } -public class GslComplexMatrix( - protected override val nativeHandle: CValues, - features: Set -) : GslMatrix() { - - public override val rowNum: Int +internal class GslComplexMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { + override val rowNum: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - public override val colNum: Int + override val colNum: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - public override val features: Set = features + override val features: Set = features - public override fun suggestFeature(vararg features: MatrixFeature): GslComplexMatrix = + override fun suggestFeature(vararg features: MatrixFeature): GslComplexMatrix = GslComplexMatrix(nativeHandle, this.features + features) - public override fun get(i: Int, j: Int): Complex = - gsl_matrix_complex_get(nativeHandle, i.toULong(), j.toULong()).useContents { Complex(dat[0], dat[1]) } + override operator fun get(i: Int, j: Int): Complex = + gsl_matrix_complex_get(nativeHandle, i.toULong(), j.toULong()).toKMath() - public override fun equals(other: Any?): Boolean { + override operator fun set(i: Int, j: Int, value: Complex): Unit = + gsl_matrix_complex_set(nativeHandle, i.toULong(), j.toULong(), value.toGsl()) + + override fun copy(): GslComplexMatrix = memScoped { + val new = requireNotNull(gsl_matrix_complex_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_complex_memcpy(new, nativeHandle) + GslComplexMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_complex_free(nativeHandle) + + override fun equals(other: Any?): Boolean { if (other is GslComplexMatrix) gsl_matrix_complex_equal(nativeHandle, other.nativeHandle) return super.equals(other) } diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContexts.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContexts.kt new file mode 100644 index 000000000..a27a22110 --- /dev/null +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContexts.kt @@ -0,0 +1,57 @@ +package kscience.kmath.gsl + +import kotlinx.cinterop.CStructVar +import kscience.kmath.linear.MatrixContext +import kscience.kmath.linear.Point +import kscience.kmath.operations.invoke +import kscience.kmath.structures.Matrix +import org.gnu.gsl.* + +private inline fun GslMatrix.fill(initializer: (Int, Int) -> T): GslMatrix = + apply { + (0 until rowNum).forEach { row -> (0 until colNum).forEach { col -> this[row, col] = initializer(row, col) } } + } + +public sealed class GslMatrixContext : MatrixContext { + @Suppress("UNCHECKED_CAST") + public fun Matrix.toGsl(): GslMatrix = + (if (this is GslMatrix<*, *>) this as GslMatrix else produce(rowNum, colNum) { i, j -> get(i, j) }).copy() + + internal abstract fun produceDirty(rows: Int, columns: Int): GslMatrix + + public override fun produce(rows: Int, columns: Int, initializer: (i: Int, j: Int) -> T): GslMatrix = + produceDirty(rows, columns).fill(initializer) +} + +public object GslRealMatrixContext : GslMatrixContext() { + public override fun produceDirty(rows: Int, columns: Int): GslMatrix = + GslRealMatrix(requireNotNull(gsl_matrix_alloc(rows.toULong(), columns.toULong()))) + + public override fun Matrix.dot(other: Matrix): GslMatrix { + val g1 = toGsl() + gsl_matrix_mul_elements(g1.nativeHandle, other.toGsl().nativeHandle) + return g1 + } + + public override fun Matrix.dot(vector: Point): GslVector { + TODO() + } + + public override fun Matrix.times(value: Double): GslMatrix { + val g1 = toGsl() + gsl_matrix_scale(g1.nativeHandle, value) + return g1 + } + + public override fun add(a: Matrix, b: Matrix): GslMatrix { + val g1 = a.toGsl() + gsl_matrix_add(g1.nativeHandle, b.toGsl().nativeHandle) + return g1 + } + + public override fun multiply(a: Matrix, k: Number): GslMatrix { + val g1 = a.toGsl() + gsl_matrix_scale(g1.nativeHandle, k.toDouble()) + return g1 + } +} diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt new file mode 100644 index 000000000..4c6aa17d7 --- /dev/null +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt @@ -0,0 +1,9 @@ +package kscience.kmath.gsl + +import kotlinx.cinterop.CPointer +import kotlinx.cinterop.CStructVar +import kotlinx.io.Closeable + +public abstract class GslMemoryHolder internal constructor() : Closeable { + internal abstract val nativeHandle: CPointer +} diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVectors.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVectors.kt index fc6e8d329..3806a2e1c 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVectors.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVectors.kt @@ -1,11 +1,14 @@ package kscience.kmath.gsl -import kotlinx.cinterop.* +import kotlinx.cinterop.CPointer +import kotlinx.cinterop.CStructVar +import kotlinx.cinterop.memScoped +import kotlinx.cinterop.pointed import kscience.kmath.linear.Point import kscience.kmath.operations.Complex import org.gnu.gsl.* -public sealed class GslVector : StructHolder(), Point { +public sealed class GslVector : GslMemoryHolder(), Point { public override fun iterator(): Iterator = object : Iterator { private var cursor = 0 @@ -18,67 +21,81 @@ public sealed class GslVector : StructHolder(), Point { } } -public class GslRealVector(override val nativeHandle: CValues) : GslVector() { - public override val size: Int +internal class GslRealVector(override val nativeHandle: CPointer) : GslVector() { + override val size: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } - public override fun get(index: Int): Double = gsl_vector_get(nativeHandle, index.toULong()) + override fun get(index: Int): Double = gsl_vector_get(nativeHandle, index.toULong()) + override fun close(): Unit = gsl_vector_free(nativeHandle) } -public class GslFloatVector(override val nativeHandle: CValues) : GslVector() { - public override val size: Int +internal class GslFloatVector(override val nativeHandle: CPointer) : + GslVector() { + override val size: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } - public override fun get(index: Int): Float = gsl_vector_float_get(nativeHandle, index.toULong()) + override fun get(index: Int): Float = gsl_vector_float_get(nativeHandle, index.toULong()) + override fun close(): Unit = gsl_vector_float_free(nativeHandle) } -public class GslIntVector(override val nativeHandle: CValues) : GslVector() { - public override val size: Int +internal class GslIntVector(override val nativeHandle: CPointer) : GslVector() { + override val size: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } - public override fun get(index: Int): Int = gsl_vector_int_get(nativeHandle, index.toULong()) + override fun get(index: Int): Int = gsl_vector_int_get(nativeHandle, index.toULong()) + override fun close(): Unit = gsl_vector_int_free(nativeHandle) } -public class GslUIntVector(override val nativeHandle: CValues) : GslVector() { - public override val size: Int +internal class GslUIntVector(override val nativeHandle: CPointer) : + GslVector() { + override val size: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } - public override fun get(index: Int): UInt = gsl_vector_uint_get(nativeHandle, index.toULong()) + override fun get(index: Int): UInt = gsl_vector_uint_get(nativeHandle, index.toULong()) + override fun close(): Unit = gsl_vector_uint_free(nativeHandle) } -public class GslLongVector(override val nativeHandle: CValues) : GslVector() { - public override val size: Int +internal class GslLongVector(override val nativeHandle: CPointer) : + GslVector() { + override val size: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } - public override fun get(index: Int): Long = gsl_vector_long_get(nativeHandle, index.toULong()) + override fun get(index: Int): Long = gsl_vector_long_get(nativeHandle, index.toULong()) + override fun close(): Unit = gsl_vector_long_free(nativeHandle) } -public class GslULongVector(override val nativeHandle: CValues) : GslVector() { +internal class GslULongVector(override val nativeHandle: CPointer) : + GslVector() { public override val size: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } public override fun get(index: Int): ULong = gsl_vector_ulong_get(nativeHandle, index.toULong()) + public override fun close(): Unit = gsl_vector_ulong_free(nativeHandle) } -public class GslShortVector(override val nativeHandle: CValues) : GslVector() { +internal class GslShortVector(override val nativeHandle: CPointer) : + GslVector() { public override val size: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } public override fun get(index: Int): Short = gsl_vector_short_get(nativeHandle, index.toULong()) + public override fun close(): Unit = gsl_vector_short_free(nativeHandle) } -public class GslUShortVector(override val nativeHandle: CValues) : GslVector() { - public override val size: Int +internal class GslUShortVector(override val nativeHandle: CPointer) : + GslVector() { + override val size: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } - public override fun get(index: Int): UShort = gsl_vector_ushort_get(nativeHandle, index.toULong()) + override fun get(index: Int): UShort = gsl_vector_ushort_get(nativeHandle, index.toULong()) + override fun close(): Unit = gsl_vector_ushort_free(nativeHandle) } -public class GslComplexVector(override val nativeHandle: CValues) : GslVector() { - public override val size: Int +internal class GslComplexVector(override val nativeHandle: CPointer) : + GslVector() { + override val size: Int get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } - public override fun get(index: Int): Complex = gsl_vector_complex_get(nativeHandle, index.toULong()).useContents { - Complex(dat[0], dat[1]) - } + override fun get(index: Int): Complex = gsl_vector_complex_get(nativeHandle, index.toULong()).toKMath() + override fun close(): Unit = gsl_vector_complex_free(nativeHandle) } diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/nativeUtilities.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/nativeUtilities.kt deleted file mode 100644 index fed31dcaa..000000000 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/nativeUtilities.kt +++ /dev/null @@ -1,8 +0,0 @@ -package kscience.kmath.gsl - -import kotlinx.cinterop.CStructVar -import kotlinx.cinterop.CValues - -public abstract class StructHolder internal constructor() { - protected abstract val nativeHandle: CValues -} diff --git a/kmath-gsl/src/nativeTest/kotlin/RealTest.kt b/kmath-gsl/src/nativeTest/kotlin/RealTest.kt new file mode 100644 index 000000000..8fa664336 --- /dev/null +++ b/kmath-gsl/src/nativeTest/kotlin/RealTest.kt @@ -0,0 +1,15 @@ +package kscience.kmath.gsl + +import kotlinx.io.use +import kscience.kmath.operations.invoke +import kotlin.test.Test +import kotlin.test.assertEquals + +internal class RealTest { + @Test + fun testScale() = GslRealMatrixContext { + GslRealMatrixContext.produce(10, 10) { _, _ -> 0.1 }.use { ma -> + (ma * 20.0).use { mb -> assertEquals(mb[0, 1], 2.0) } + } + } +} From 0a02fd07b478359cafeb4529beb843f79ce40595 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Mon, 5 Oct 2020 13:13:06 +0700 Subject: [PATCH 17/76] Replace manual matrices classes building with codegen --- build.gradle.kts | 6 +- buildSrc/build.gradle.kts | 9 + .../kscience/kmath/gsl/codegen/PsiTestUtil.kt | 69 ++++ .../kmath/gsl/codegen/StringUtilExt.kt | 9 + .../kmath/gsl/codegen/matricesCodegen.kt | 98 +++++ kmath-gsl/build.gradle.kts | 18 +- .../kotlin/kscience/kmath/gsl/GslMatrices.kt | 340 ------------------ .../kotlin/kscience/kmath/gsl/GslMatrix.kt | 21 ++ .../kotlin/kscience/kmath/gsl/GslVectors.kt | 2 +- kmath-gsl/src/nativeTest/kotlin/RealTest.kt | 9 +- 10 files changed, 229 insertions(+), 352 deletions(-) create mode 100644 buildSrc/build.gradle.kts create mode 100644 buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/PsiTestUtil.kt create mode 100644 buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/StringUtilExt.kt create mode 100644 buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt delete mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrices.kt create mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt diff --git a/build.gradle.kts b/build.gradle.kts index 92ad16b85..22ba35d18 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,9 +2,9 @@ plugins { id("ru.mipt.npm.project") } -val kmathVersion: String by extra("0.2.0-dev-2") -val bintrayRepo: String by extra("kscience") -val githubProject: String by extra("kmath") +internal val kmathVersion: String by extra("0.2.0-dev-2") +internal val bintrayRepo: String by extra("kscience") +internal val githubProject: String by extra("kmath") allprojects { repositories { diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 000000000..d0e424c37 --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,9 @@ +plugins { + `kotlin-dsl` +} + +repositories.jcenter() + +dependencies { + implementation(kotlin("compiler-embeddable")) +} diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/PsiTestUtil.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/PsiTestUtil.kt new file mode 100644 index 000000000..edc244bb3 --- /dev/null +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/PsiTestUtil.kt @@ -0,0 +1,69 @@ +package kscience.kmath.gsl.codegen + +import org.jetbrains.kotlin.com.intellij.openapi.util.text.StringUtil +import org.jetbrains.kotlin.com.intellij.psi.PsiFile +import org.jetbrains.kotlin.com.intellij.psi.impl.DebugUtil +import org.jetbrains.kotlin.com.intellij.psi.impl.source.PsiFileImpl +import org.jetbrains.kotlin.com.intellij.testFramework.LightVirtualFile +import org.jetbrains.kotlin.psi.KtFile +import kotlin.math.min + +internal object PsiTestUtil { + fun checkFileStructure(file: KtFile) { + compareFromAllRoots(file) { f -> DebugUtil.psiTreeToString(f, false) } + } + + private fun compareFromAllRoots( + file: KtFile, + function: (PsiFile) -> String + ) { + val dummyFile = createDummyCopy(file) + + val psiTree = StringUtil.join( + file.viewProvider.allFiles, + { param -> function(param) }, + "\n" + ) + + val reparsedTree = StringUtil.join( + dummyFile.viewProvider.allFiles, + { param -> function(param) }, + "\n" + ) + + assertPsiTextTreeConsistency(psiTree, reparsedTree) + } + + private fun assertPsiTextTreeConsistency(psiTree: String, reparsedTree: String) { + var psiTreeMutable = psiTree + var reparsedTreeMutable = reparsedTree + + if (psiTreeMutable != reparsedTreeMutable) { + val psiLines = splitByLinesDontTrim(psiTreeMutable) + val reparsedLines = splitByLinesDontTrim(reparsedTreeMutable) + var i = 0 + + while (true) { + if (i >= psiLines.size || i >= reparsedLines.size || psiLines[i] != reparsedLines[i]) { + psiLines[min(i, psiLines.size - 1)] += " // in PSI structure" + reparsedLines[min(i, reparsedLines.size - 1)] += " // re-created from text" + break + } + + i++ + } + + psiTreeMutable = StringUtil.join(psiLines, "\n") + reparsedTreeMutable = StringUtil.join(reparsedLines, "\n") + assert(reparsedTreeMutable == psiTreeMutable) + } + } + + private fun createDummyCopy(file: KtFile): PsiFile { + val copy = LightVirtualFile(file.name, file.text) + copy.originalFile = file.viewProvider.virtualFile + val dummyCopy = requireNotNull(file.manager.findFile(copy)) + if (dummyCopy is PsiFileImpl) dummyCopy.originalFile = file + return dummyCopy + } +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/StringUtilExt.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/StringUtilExt.kt new file mode 100644 index 000000000..c56655b9f --- /dev/null +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/StringUtilExt.kt @@ -0,0 +1,9 @@ +package kscience.kmath.gsl.codegen + +import java.util.regex.Pattern + +private val EOL_SPLIT_DONT_TRIM_PATTERN: Pattern = Pattern.compile("(\r|\n|\r\n)+") + +internal fun splitByLinesDontTrim(string: String): Array { + return EOL_SPLIT_DONT_TRIM_PATTERN.split(string) +} diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt new file mode 100644 index 000000000..14aafffff --- /dev/null +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt @@ -0,0 +1,98 @@ +package kscience.kmath.gsl.codegen + +import org.jetbrains.kotlin.com.intellij.openapi.project.Project +import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.psi.KtPsiFactory +import org.jetbrains.kotlin.resolve.ImportPath +import java.io.File + +private fun fn(pattern: String, type: String): String { + if (type == "double") return pattern.replace("R", "_") + return pattern.replace("R", "_${type}_") +} + +private fun sn(pattern: String, type: String): String { + if (type == "double") return pattern.replace("R", "") + return pattern.replace("R", "_$type") +} + +private fun KtPsiFactory.createMatrixClass( + f: KtFile, + cTypeName: String, + kotlinTypeName: String, + kotlinTypeAlias: String = kotlinTypeName +) { + val className = "Gsl${kotlinTypeAlias}Matrix" + val structName = sn("gsl_matrixR", cTypeName) + + f += createClass( + """internal class $className( + override val nativeHandle: CPointer<$structName>, + features: Set = emptySet() +) : GslMatrix<$kotlinTypeName, $structName>() { + override val rowNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + + override val colNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + + override val features: Set = features + + override fun suggestFeature(vararg features: MatrixFeature): $className = + ${className}(nativeHandle, this.features + features) + + override operator fun get(i: Int, j: Int): $kotlinTypeName = ${ + fn("gsl_matrixRget", cTypeName) + }(nativeHandle, i.toULong(), j.toULong()) + + override operator fun set(i: Int, j: Int, value: ${kotlinTypeName}): Unit = + ${fn("gsl_matrixRset", cTypeName)}(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): $className = memScoped { + val new = requireNotNull(${fn("gsl_matrixRalloc", cTypeName)}(rowNum.toULong(), colNum.toULong())) + ${fn("gsl_matrixRmemcpy", cTypeName)}(new, nativeHandle) + $className(new, features) + } + + override fun close(): Unit = ${fn("gsl_matrixRfree", cTypeName)}(nativeHandle) + + override fun equals(other: Any?): Boolean { + if (other is $className) ${fn("gsl_matrixRequal", cTypeName)}(nativeHandle, other.nativeHandle) + return super.equals(other) + } +}""" + ) + + f += createNewLine(2) +} + +fun matricesCodegen(outputFile: String, project: Project = createProject()) { + val f = KtPsiFactory(project, true).run { + createFile("package kscience.kmath.gsl").also { f -> + f += createNewLine(2) + f += createImportDirective(ImportPath.fromString("kotlinx.cinterop.*")) + f += createNewLine(1) + f += createImportDirective(ImportPath.fromString("kscience.kmath.linear.*")) + f += createNewLine(1) + f += createImportDirective(ImportPath.fromString("kscience.kmath.operations.*")) + f += createNewLine(1) + f += createImportDirective(ImportPath.fromString("org.gnu.gsl.*")) + f += createNewLine(2) + createMatrixClass(f, "double", "Double", "Real") + createMatrixClass(f, "float", "Float") + createMatrixClass(f, "short", "Short") + createMatrixClass(f, "ushort", "UShort") + createMatrixClass(f, "long", "Long") + createMatrixClass(f, "ulong", "ULong") + createMatrixClass(f, "int", "Int") + createMatrixClass(f, "uint", "UInt") + } + } + + PsiTestUtil.checkFileStructure(f) + + File(outputFile).apply { + parentFile.mkdirs() + writeText(f.text) + } +} diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index 43538a35d..9ff2c30d8 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -1,5 +1,7 @@ @file:Suppress("UNUSED_VARIABLE") +import kscience.kmath.gsl.codegen.matricesCodegen + plugins { id("ru.mipt.npm.mpp") } @@ -24,10 +26,18 @@ kotlin { } } - sourceSets.commonMain { - dependencies { - api(project(":kmath-core")) - api("org.jetbrains.kotlinx:kotlinx-io:0.2.0-tvis-3") + sourceSets { + val nativeMain by getting { + dependencies { + api(project(":kmath-core")) + api("org.jetbrains.kotlinx:kotlinx-io:0.2.0-tvis-3") + } } } } + +internal val codegen: Task by tasks.creating { + matricesCodegen(kotlin.sourceSets["nativeMain"].kotlin.srcDirs.first().absolutePath + "/generated/Matrices.kt") +} + +kotlin.sourceSets["nativeMain"].kotlin.srcDirs(files().builtBy(codegen)) diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrices.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrices.kt deleted file mode 100644 index 5eb8794f2..000000000 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrices.kt +++ /dev/null @@ -1,340 +0,0 @@ -package kscience.kmath.gsl - -import kotlinx.cinterop.* -import kscience.kmath.linear.FeaturedMatrix -import kscience.kmath.linear.MatrixFeature -import kscience.kmath.operations.Complex -import kscience.kmath.structures.NDStructure -import org.gnu.gsl.* - -public sealed class GslMatrix : GslMemoryHolder(), FeaturedMatrix { - internal abstract operator fun set(i: Int, j: Int, value: T) - internal abstract fun copy(): GslMatrix - - public override fun equals(other: Any?): Boolean { - return NDStructure.equals(this, other as? NDStructure<*> ?: return false) - } - - public override fun hashCode(): Int { - var result = nativeHandle.hashCode() - result = 31 * result + features.hashCode() - return result - } -} - -internal class GslRealMatrix( - override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { - override val rowNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - - override val colNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslRealMatrix = - GslRealMatrix(nativeHandle, this.features + features) - - override operator fun get(i: Int, j: Int): Double = gsl_matrix_get(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: Double): Unit = - gsl_matrix_set(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): GslRealMatrix = memScoped { - val new = requireNotNull(gsl_matrix_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_memcpy(new, nativeHandle) - GslRealMatrix(new, features) - } - - override fun close(): Unit = gsl_matrix_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslRealMatrix) gsl_matrix_equal(nativeHandle, other.nativeHandle) - return super.equals(other) - } -} - -internal class GslFloatMatrix( - override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { - override val rowNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - - override val colNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslFloatMatrix = - GslFloatMatrix(nativeHandle, this.features + features) - - override operator fun get(i: Int, j: Int): Float = - gsl_matrix_float_get(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: Float): Unit = - gsl_matrix_float_set(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): GslFloatMatrix = memScoped { - val new = requireNotNull(gsl_matrix_float_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_float_memcpy(new, nativeHandle) - GslFloatMatrix(new, features) - } - - override fun close(): Unit = gsl_matrix_float_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslFloatMatrix) gsl_matrix_float_equal(nativeHandle, other.nativeHandle) - return super.equals(other) - } -} - -internal class GslIntMatrix( - override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { - - override val rowNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - - override val colNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslIntMatrix = - GslIntMatrix(nativeHandle, this.features + features) - - override operator fun get(i: Int, j: Int): Int = gsl_matrix_int_get(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: Int): Unit = - gsl_matrix_int_set(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): GslIntMatrix = memScoped { - val new = requireNotNull(gsl_matrix_int_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_int_memcpy(new, nativeHandle) - GslIntMatrix(new, features) - } - - override fun close(): Unit = gsl_matrix_int_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslIntMatrix) gsl_matrix_int_equal(nativeHandle, other.nativeHandle) - return super.equals(other) - } -} - -internal class GslUIntMatrix( - override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { - - override val rowNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - - override val colNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslUIntMatrix = - GslUIntMatrix(nativeHandle, this.features + features) - - override operator fun get(i: Int, j: Int): UInt = gsl_matrix_uint_get(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: UInt): Unit = - gsl_matrix_uint_set(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): GslUIntMatrix = memScoped { - val new = requireNotNull(gsl_matrix_uint_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_uint_memcpy(new, nativeHandle) - GslUIntMatrix(new, features) - } - - override fun close(): Unit = gsl_matrix_uint_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslUIntMatrix) gsl_matrix_uint_equal(nativeHandle, other.nativeHandle) - return super.equals(other) - } -} - -internal class GslLongMatrix( - override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { - - override val rowNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - - override val colNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslLongMatrix = - GslLongMatrix(nativeHandle, this.features + features) - - override operator fun get(i: Int, j: Int): Long = gsl_matrix_long_get(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: Long): Unit = - gsl_matrix_long_set(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): GslLongMatrix = memScoped { - val new = requireNotNull(gsl_matrix_long_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_long_memcpy(new, nativeHandle) - GslLongMatrix(new, features) - } - - override fun close(): Unit = gsl_matrix_long_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslLongMatrix) gsl_matrix_long_equal(nativeHandle, other.nativeHandle) - return super.equals(other) - } -} - -internal class GslULongMatrix( - override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { - - override val rowNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - - override val colNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslULongMatrix = - GslULongMatrix(nativeHandle, this.features + features) - - override operator fun get(i: Int, j: Int): ULong = - gsl_matrix_ulong_get(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: ULong): Unit = - gsl_matrix_ulong_set(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): GslULongMatrix = memScoped { - val new = requireNotNull(gsl_matrix_ulong_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_ulong_memcpy(new, nativeHandle) - GslULongMatrix(new, features) - } - - override fun close(): Unit = gsl_matrix_ulong_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslULongMatrix) gsl_matrix_ulong_equal(nativeHandle, other.nativeHandle) - return super.equals(other) - } -} - -internal class GslShortMatrix( - override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { - - override val rowNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - - override val colNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslShortMatrix = - GslShortMatrix(nativeHandle, this.features + features) - - override operator fun get(i: Int, j: Int): Short = - gsl_matrix_short_get(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: Short): Unit = - gsl_matrix_short_set(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): GslShortMatrix = memScoped { - val new = requireNotNull(gsl_matrix_short_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_short_memcpy(new, nativeHandle) - GslShortMatrix(new, features) - } - - override fun close(): Unit = gsl_matrix_short_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslShortMatrix) gsl_matrix_short_equal(nativeHandle, other.nativeHandle) - return super.equals(other) - } -} - -internal class GslUShortMatrix( - override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { - - override val rowNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - - override val colNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslUShortMatrix = - GslUShortMatrix(nativeHandle, this.features + features) - - override operator fun get(i: Int, j: Int): UShort = - gsl_matrix_ushort_get(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: UShort): Unit = - gsl_matrix_ushort_set(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): GslUShortMatrix = memScoped { - val new = requireNotNull(gsl_matrix_ushort_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_ushort_memcpy(new, nativeHandle) - GslUShortMatrix(new, features) - } - - override fun close(): Unit = gsl_matrix_ushort_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslUShortMatrix) gsl_matrix_ushort_equal(nativeHandle, other.nativeHandle) - return super.equals(other) - } -} - -internal class GslComplexMatrix( - override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { - override val rowNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - - override val colNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslComplexMatrix = - GslComplexMatrix(nativeHandle, this.features + features) - - override operator fun get(i: Int, j: Int): Complex = - gsl_matrix_complex_get(nativeHandle, i.toULong(), j.toULong()).toKMath() - - override operator fun set(i: Int, j: Int, value: Complex): Unit = - gsl_matrix_complex_set(nativeHandle, i.toULong(), j.toULong(), value.toGsl()) - - override fun copy(): GslComplexMatrix = memScoped { - val new = requireNotNull(gsl_matrix_complex_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_complex_memcpy(new, nativeHandle) - GslComplexMatrix(new, features) - } - - override fun close(): Unit = gsl_matrix_complex_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslComplexMatrix) gsl_matrix_complex_equal(nativeHandle, other.nativeHandle) - return super.equals(other) - } -} diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt new file mode 100644 index 000000000..fadecc4eb --- /dev/null +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt @@ -0,0 +1,21 @@ +package kscience.kmath.gsl + +import kotlinx.cinterop.CStructVar +import kscience.kmath.linear.FeaturedMatrix +import kscience.kmath.structures.NDStructure + +public abstract class GslMatrix internal constructor(): GslMemoryHolder(), + FeaturedMatrix { + internal abstract operator fun set(i: Int, j: Int, value: T) + internal abstract fun copy(): GslMatrix + + public override fun equals(other: Any?): Boolean { + return NDStructure.equals(this, other as? NDStructure<*> ?: return false) + } + + public override fun hashCode(): Int { + var result = nativeHandle.hashCode() + result = 31 * result + features.hashCode() + return result + } +} \ No newline at end of file diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVectors.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVectors.kt index 3806a2e1c..4741d8af1 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVectors.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVectors.kt @@ -8,7 +8,7 @@ import kscience.kmath.linear.Point import kscience.kmath.operations.Complex import org.gnu.gsl.* -public sealed class GslVector : GslMemoryHolder(), Point { +public abstract class GslVector internal constructor(): GslMemoryHolder(), Point { public override fun iterator(): Iterator = object : Iterator { private var cursor = 0 diff --git a/kmath-gsl/src/nativeTest/kotlin/RealTest.kt b/kmath-gsl/src/nativeTest/kotlin/RealTest.kt index 8fa664336..41efbd195 100644 --- a/kmath-gsl/src/nativeTest/kotlin/RealTest.kt +++ b/kmath-gsl/src/nativeTest/kotlin/RealTest.kt @@ -1,6 +1,5 @@ package kscience.kmath.gsl -import kotlinx.io.use import kscience.kmath.operations.invoke import kotlin.test.Test import kotlin.test.assertEquals @@ -8,8 +7,10 @@ import kotlin.test.assertEquals internal class RealTest { @Test fun testScale() = GslRealMatrixContext { - GslRealMatrixContext.produce(10, 10) { _, _ -> 0.1 }.use { ma -> - (ma * 20.0).use { mb -> assertEquals(mb[0, 1], 2.0) } - } + val ma = GslRealMatrixContext.produce(10, 10) { _, _ -> 0.1 } + val mb = (ma * 20.0) + assertEquals(mb[0, 1], 2.0) + mb.close() + ma.close() } } From 77dac58efb709d6ed0479b53d837f5418262a13f Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Mon, 5 Oct 2020 13:13:16 +0700 Subject: [PATCH 18/76] Replace manual matrices classes building with codegen --- .../kmath/gsl/codegen/codegenUtilities.kt | 61 ++++ .../nativeMain/kotlin/generated/Matrices.kt | 279 ++++++++++++++++++ 2 files changed, 340 insertions(+) create mode 100644 buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/codegenUtilities.kt create mode 100644 kmath-gsl/src/nativeMain/kotlin/generated/Matrices.kt diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/codegenUtilities.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/codegenUtilities.kt new file mode 100644 index 000000000..0df7141d7 --- /dev/null +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/codegenUtilities.kt @@ -0,0 +1,61 @@ +package kscience.kmath.gsl.codegen + +import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys +import org.jetbrains.kotlin.cli.common.messages.MessageCollector +import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles +import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment +import org.jetbrains.kotlin.com.intellij.mock.MockProject +import org.jetbrains.kotlin.com.intellij.openapi.extensions.ExtensionPoint +import org.jetbrains.kotlin.com.intellij.openapi.extensions.Extensions +import org.jetbrains.kotlin.com.intellij.openapi.util.UserDataHolderBase +import org.jetbrains.kotlin.com.intellij.pom.PomModel +import org.jetbrains.kotlin.com.intellij.pom.PomModelAspect +import org.jetbrains.kotlin.com.intellij.pom.PomTransaction +import org.jetbrains.kotlin.com.intellij.pom.impl.PomTransactionBase +import org.jetbrains.kotlin.com.intellij.pom.tree.TreeAspect +import org.jetbrains.kotlin.com.intellij.psi.PsiElement +import org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.TreeCopyHandler +import org.jetbrains.kotlin.config.CompilerConfiguration +import org.jetbrains.kotlin.psi.KtFile +import sun.reflect.ReflectionFactory + +internal fun createProject(): MockProject { + val project = KotlinCoreEnvironment.createForProduction( + {}, + CompilerConfiguration().apply { put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, MessageCollector.NONE) }, + EnvironmentConfigFiles.JVM_CONFIG_FILES + ).project as MockProject + + val extensionPoint = "org.jetbrains.kotlin.com.intellij.treeCopyHandler" + + arrayOf(project.extensionArea, Extensions.getRootArea()) + .asSequence() + .filterNot { it.hasExtensionPoint(extensionPoint) } + .forEach { + it.registerExtensionPoint(extensionPoint, TreeCopyHandler::class.java.name, ExtensionPoint.Kind.INTERFACE) + } + + project.registerService(PomModel::class.java, object : UserDataHolderBase(), PomModel { + override fun runTransaction(transaction: PomTransaction) = (transaction as PomTransactionBase).run() + + @Suppress("UNCHECKED_CAST") + override fun getModelAspect(aspect: Class): T? { + if (aspect == TreeAspect::class.java) { + val constructor = ReflectionFactory.getReflectionFactory().newConstructorForSerialization( + aspect, + Any::class.java.getDeclaredConstructor(*arrayOfNulls(0)) + ) + + return constructor.newInstance() as T + } + + return null + } + }) + + return project +} + +internal operator fun PsiElement.plusAssign(e: PsiElement) { + add(e) +} diff --git a/kmath-gsl/src/nativeMain/kotlin/generated/Matrices.kt b/kmath-gsl/src/nativeMain/kotlin/generated/Matrices.kt new file mode 100644 index 000000000..47cb145c8 --- /dev/null +++ b/kmath-gsl/src/nativeMain/kotlin/generated/Matrices.kt @@ -0,0 +1,279 @@ +package kscience.kmath.gsl + +import kotlinx.cinterop.* +import kscience.kmath.linear.* +import kscience.kmath.operations.* +import org.gnu.gsl.* + +internal class GslRealMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { + override val rowNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + + override val colNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + + override val features: Set = features + + override fun suggestFeature(vararg features: MatrixFeature): GslRealMatrix = + GslRealMatrix(nativeHandle, this.features + features) + + override operator fun get(i: Int, j: Int): Double = gsl_matrix_get(nativeHandle, i.toULong(), j.toULong()) + + override operator fun set(i: Int, j: Int, value: Double): Unit = + gsl_matrix_set(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): GslRealMatrix = memScoped { + val new = requireNotNull(gsl_matrix_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_memcpy(new, nativeHandle) + GslRealMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_free(nativeHandle) + + override fun equals(other: Any?): Boolean { + if (other is GslRealMatrix) gsl_matrix_equal(nativeHandle, other.nativeHandle) + return super.equals(other) + } +} + +internal class GslFloatMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { + override val rowNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + + override val colNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + + override val features: Set = features + + override fun suggestFeature(vararg features: MatrixFeature): GslFloatMatrix = + GslFloatMatrix(nativeHandle, this.features + features) + + override operator fun get(i: Int, j: Int): Float = gsl_matrix_float_get(nativeHandle, i.toULong(), j.toULong()) + + override operator fun set(i: Int, j: Int, value: Float): Unit = + gsl_matrix_float_set(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): GslFloatMatrix = memScoped { + val new = requireNotNull(gsl_matrix_float_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_float_memcpy(new, nativeHandle) + GslFloatMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_float_free(nativeHandle) + + override fun equals(other: Any?): Boolean { + if (other is GslFloatMatrix) gsl_matrix_float_equal(nativeHandle, other.nativeHandle) + return super.equals(other) + } +} + +internal class GslShortMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { + override val rowNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + + override val colNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + + override val features: Set = features + + override fun suggestFeature(vararg features: MatrixFeature): GslShortMatrix = + GslShortMatrix(nativeHandle, this.features + features) + + override operator fun get(i: Int, j: Int): Short = gsl_matrix_short_get(nativeHandle, i.toULong(), j.toULong()) + + override operator fun set(i: Int, j: Int, value: Short): Unit = + gsl_matrix_short_set(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): GslShortMatrix = memScoped { + val new = requireNotNull(gsl_matrix_short_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_short_memcpy(new, nativeHandle) + GslShortMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_short_free(nativeHandle) + + override fun equals(other: Any?): Boolean { + if (other is GslShortMatrix) gsl_matrix_short_equal(nativeHandle, other.nativeHandle) + return super.equals(other) + } +} + +internal class GslUShortMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { + override val rowNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + + override val colNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + + override val features: Set = features + + override fun suggestFeature(vararg features: MatrixFeature): GslUShortMatrix = + GslUShortMatrix(nativeHandle, this.features + features) + + override operator fun get(i: Int, j: Int): UShort = gsl_matrix_ushort_get(nativeHandle, i.toULong(), j.toULong()) + + override operator fun set(i: Int, j: Int, value: UShort): Unit = + gsl_matrix_ushort_set(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): GslUShortMatrix = memScoped { + val new = requireNotNull(gsl_matrix_ushort_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_ushort_memcpy(new, nativeHandle) + GslUShortMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_ushort_free(nativeHandle) + + override fun equals(other: Any?): Boolean { + if (other is GslUShortMatrix) gsl_matrix_ushort_equal(nativeHandle, other.nativeHandle) + return super.equals(other) + } +} + +internal class GslLongMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { + override val rowNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + + override val colNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + + override val features: Set = features + + override fun suggestFeature(vararg features: MatrixFeature): GslLongMatrix = + GslLongMatrix(nativeHandle, this.features + features) + + override operator fun get(i: Int, j: Int): Long = gsl_matrix_long_get(nativeHandle, i.toULong(), j.toULong()) + + override operator fun set(i: Int, j: Int, value: Long): Unit = + gsl_matrix_long_set(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): GslLongMatrix = memScoped { + val new = requireNotNull(gsl_matrix_long_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_long_memcpy(new, nativeHandle) + GslLongMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_long_free(nativeHandle) + + override fun equals(other: Any?): Boolean { + if (other is GslLongMatrix) gsl_matrix_long_equal(nativeHandle, other.nativeHandle) + return super.equals(other) + } +} + +internal class GslULongMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { + override val rowNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + + override val colNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + + override val features: Set = features + + override fun suggestFeature(vararg features: MatrixFeature): GslULongMatrix = + GslULongMatrix(nativeHandle, this.features + features) + + override operator fun get(i: Int, j: Int): ULong = gsl_matrix_ulong_get(nativeHandle, i.toULong(), j.toULong()) + + override operator fun set(i: Int, j: Int, value: ULong): Unit = + gsl_matrix_ulong_set(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): GslULongMatrix = memScoped { + val new = requireNotNull(gsl_matrix_ulong_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_ulong_memcpy(new, nativeHandle) + GslULongMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_ulong_free(nativeHandle) + + override fun equals(other: Any?): Boolean { + if (other is GslULongMatrix) gsl_matrix_ulong_equal(nativeHandle, other.nativeHandle) + return super.equals(other) + } +} + +internal class GslIntMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { + override val rowNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + + override val colNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + + override val features: Set = features + + override fun suggestFeature(vararg features: MatrixFeature): GslIntMatrix = + GslIntMatrix(nativeHandle, this.features + features) + + override operator fun get(i: Int, j: Int): Int = gsl_matrix_int_get(nativeHandle, i.toULong(), j.toULong()) + + override operator fun set(i: Int, j: Int, value: Int): Unit = + gsl_matrix_int_set(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): GslIntMatrix = memScoped { + val new = requireNotNull(gsl_matrix_int_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_int_memcpy(new, nativeHandle) + GslIntMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_int_free(nativeHandle) + + override fun equals(other: Any?): Boolean { + if (other is GslIntMatrix) gsl_matrix_int_equal(nativeHandle, other.nativeHandle) + return super.equals(other) + } +} + +internal class GslUIntMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { + override val rowNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + + override val colNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + + override val features: Set = features + + override fun suggestFeature(vararg features: MatrixFeature): GslUIntMatrix = + GslUIntMatrix(nativeHandle, this.features + features) + + override operator fun get(i: Int, j: Int): UInt = gsl_matrix_uint_get(nativeHandle, i.toULong(), j.toULong()) + + override operator fun set(i: Int, j: Int, value: UInt): Unit = + gsl_matrix_uint_set(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): GslUIntMatrix = memScoped { + val new = requireNotNull(gsl_matrix_uint_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_uint_memcpy(new, nativeHandle) + GslUIntMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_uint_free(nativeHandle) + + override fun equals(other: Any?): Boolean { + if (other is GslUIntMatrix) gsl_matrix_uint_equal(nativeHandle, other.nativeHandle) + return super.equals(other) + } +} + From 69a107819bbf5af2a96da2305cfce2e34e89adac Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Mon, 5 Oct 2020 17:46:41 +0700 Subject: [PATCH 19/76] Implement vector codegen --- .../kmath/gsl/codegen/codegenUtilities.kt | 11 +++- .../kmath/gsl/codegen/matricesCodegen.kt | 27 +++----- .../kmath/gsl/codegen/vectorsCodegen.kt | 62 +++++++++++++++++++ kmath-gsl/build.gradle.kts | 2 + .../nativeMain/kotlin/generated/Matrices.kt | 3 +- .../kotlin/kscience/kmath/gsl/GslComplex.kt | 47 +++++++++++++- .../kotlin/kscience/kmath/gsl/GslVector.kt | 17 +++++ 7 files changed, 149 insertions(+), 20 deletions(-) create mode 100644 buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt create mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/codegenUtilities.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/codegenUtilities.kt index 0df7141d7..7f930324f 100644 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/codegenUtilities.kt +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/codegenUtilities.kt @@ -16,7 +16,6 @@ import org.jetbrains.kotlin.com.intellij.pom.tree.TreeAspect import org.jetbrains.kotlin.com.intellij.psi.PsiElement import org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.TreeCopyHandler import org.jetbrains.kotlin.config.CompilerConfiguration -import org.jetbrains.kotlin.psi.KtFile import sun.reflect.ReflectionFactory internal fun createProject(): MockProject { @@ -59,3 +58,13 @@ internal fun createProject(): MockProject { internal operator fun PsiElement.plusAssign(e: PsiElement) { add(e) } + +internal fun fn(pattern: String, type: String): String { + if (type == "double") return pattern.replace("R", "_") + return pattern.replace("R", "_${type}_") +} + +internal fun sn(pattern: String, type: String): String { + if (type == "double") return pattern.replace("R", "") + return pattern.replace("R", "_$type") +} diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt index 14aafffff..1c507cc3d 100644 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt @@ -1,21 +1,13 @@ package kscience.kmath.gsl.codegen +import org.intellij.lang.annotations.Language import org.jetbrains.kotlin.com.intellij.openapi.project.Project +import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtPsiFactory import org.jetbrains.kotlin.resolve.ImportPath import java.io.File -private fun fn(pattern: String, type: String): String { - if (type == "double") return pattern.replace("R", "_") - return pattern.replace("R", "_${type}_") -} - -private fun sn(pattern: String, type: String): String { - if (type == "double") return pattern.replace("R", "") - return pattern.replace("R", "_$type") -} - private fun KtPsiFactory.createMatrixClass( f: KtFile, cTypeName: String, @@ -25,8 +17,7 @@ private fun KtPsiFactory.createMatrixClass( val className = "Gsl${kotlinTypeAlias}Matrix" val structName = sn("gsl_matrixR", cTypeName) - f += createClass( - """internal class $className( + @Language("kotlin") val text = """internal class $className( override val nativeHandle: CPointer<$structName>, features: Set = emptySet() ) : GslMatrix<$kotlinTypeName, $structName>() { @@ -42,8 +33,8 @@ private fun KtPsiFactory.createMatrixClass( ${className}(nativeHandle, this.features + features) override operator fun get(i: Int, j: Int): $kotlinTypeName = ${ - fn("gsl_matrixRget", cTypeName) - }(nativeHandle, i.toULong(), j.toULong()) + fn("gsl_matrixRget", cTypeName) + }(nativeHandle, i.toULong(), j.toULong()) override operator fun set(i: Int, j: Int, value: ${kotlinTypeName}): Unit = ${fn("gsl_matrixRset", cTypeName)}(nativeHandle, i.toULong(), j.toULong(), value) @@ -61,6 +52,8 @@ private fun KtPsiFactory.createMatrixClass( return super.equals(other) } }""" + f += createClass( + text ) f += createNewLine(2) @@ -68,14 +61,14 @@ private fun KtPsiFactory.createMatrixClass( fun matricesCodegen(outputFile: String, project: Project = createProject()) { val f = KtPsiFactory(project, true).run { - createFile("package kscience.kmath.gsl").also { f -> + createFile("@file:Suppress(\"PackageDirectoryMismatch\")").also { f -> + f += createNewLine(2) + f += createPackageDirective(FqName("kscience.kmath.gsl")) f += createNewLine(2) f += createImportDirective(ImportPath.fromString("kotlinx.cinterop.*")) f += createNewLine(1) f += createImportDirective(ImportPath.fromString("kscience.kmath.linear.*")) f += createNewLine(1) - f += createImportDirective(ImportPath.fromString("kscience.kmath.operations.*")) - f += createNewLine(1) f += createImportDirective(ImportPath.fromString("org.gnu.gsl.*")) f += createNewLine(2) createMatrixClass(f, "double", "Double", "Real") diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt new file mode 100644 index 000000000..f29def5b0 --- /dev/null +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt @@ -0,0 +1,62 @@ +package kscience.kmath.gsl.codegen + +import org.intellij.lang.annotations.Language +import org.jetbrains.kotlin.com.intellij.openapi.project.Project +import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.psi.KtPsiFactory +import org.jetbrains.kotlin.resolve.ImportPath +import java.io.File + +private fun KtPsiFactory.createVectorClass( + f: KtFile, + cTypeName: String, + kotlinTypeName: String, + kotlinTypeAlias: String = kotlinTypeName +) { + val className = "Gsl${kotlinTypeAlias}Vector" + val structName = sn("gsl_vectorR", cTypeName) + + @Language("kotlin") val text = + """internal class $className(override val nativeHandle: CPointer<$structName>) : GslVector<$kotlinTypeName, $structName>() { + override val size: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } + + override fun get(index: Int): $kotlinTypeName = ${fn("gsl_vectorRget", cTypeName)}(nativeHandle, index.toULong()) + override fun close(): Unit = ${fn("gsl_vectorRfree", cTypeName)}(nativeHandle) +}""" + f += createClass( + text + ) + + f += createNewLine(2) +} + +fun vectorsCodegen(outputFile: String, project: Project = createProject()) { + val f = KtPsiFactory(project, true).run { + createFile("@file:Suppress(\"PackageDirectoryMismatch\")").also { f -> + f += createNewLine(2) + f += createPackageDirective(FqName("kscience.kmath.gsl")) + f += createNewLine(2) + f += createImportDirective(ImportPath.fromString("kotlinx.cinterop.*")) + f += createNewLine(1) + f += createImportDirective(ImportPath.fromString("org.gnu.gsl.*")) + f += createNewLine(2) + createVectorClass(f, "double", "Double", "Real") + createVectorClass(f, "float", "Float") + createVectorClass(f, "short", "Short") + createVectorClass(f, "ushort", "UShort") + createVectorClass(f, "long", "Long") + createVectorClass(f, "ulong", "ULong") + createVectorClass(f, "int", "Int") + createVectorClass(f, "uint", "UInt") + } + } + + PsiTestUtil.checkFileStructure(f) + + File(outputFile).apply { + parentFile.mkdirs() + writeText(f.text) + } +} diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index 9ff2c30d8..048d7afed 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -1,6 +1,7 @@ @file:Suppress("UNUSED_VARIABLE") import kscience.kmath.gsl.codegen.matricesCodegen +import kscience.kmath.gsl.codegen.vectorsCodegen plugins { id("ru.mipt.npm.mpp") @@ -38,6 +39,7 @@ kotlin { internal val codegen: Task by tasks.creating { matricesCodegen(kotlin.sourceSets["nativeMain"].kotlin.srcDirs.first().absolutePath + "/generated/Matrices.kt") + vectorsCodegen(kotlin.sourceSets["nativeMain"].kotlin.srcDirs.first().absolutePath + "/generated/Vectors.kt") } kotlin.sourceSets["nativeMain"].kotlin.srcDirs(files().builtBy(codegen)) diff --git a/kmath-gsl/src/nativeMain/kotlin/generated/Matrices.kt b/kmath-gsl/src/nativeMain/kotlin/generated/Matrices.kt index 47cb145c8..8d471beaa 100644 --- a/kmath-gsl/src/nativeMain/kotlin/generated/Matrices.kt +++ b/kmath-gsl/src/nativeMain/kotlin/generated/Matrices.kt @@ -1,8 +1,9 @@ +@file:Suppress("PackageDirectoryMismatch") + package kscience.kmath.gsl import kotlinx.cinterop.* import kscience.kmath.linear.* -import kscience.kmath.operations.* import org.gnu.gsl.* internal class GslRealMatrix( diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt index 0282afb54..68bde7ef2 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt @@ -1,8 +1,9 @@ package kscience.kmath.gsl import kotlinx.cinterop.* +import kscience.kmath.linear.MatrixFeature import kscience.kmath.operations.Complex -import org.gnu.gsl.gsl_complex +import org.gnu.gsl.* internal fun CValue.toKMath(): Complex = useContents { Complex(dat[0], dat[1]) } @@ -10,3 +11,47 @@ internal fun Complex.toGsl(): CValue = cValue { dat[0] = re dat[1] = im } + +internal class GslComplexMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { + override val rowNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + + override val colNum: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + + override val features: Set = features + + override fun suggestFeature(vararg features: MatrixFeature): GslComplexMatrix = + GslComplexMatrix(nativeHandle, this.features + features) + + override operator fun get(i: Int, j: Int): Complex = + gsl_matrix_complex_get(nativeHandle, i.toULong(), j.toULong()).toKMath() + + override operator fun set(i: Int, j: Int, value: Complex): Unit = + gsl_matrix_complex_set(nativeHandle, i.toULong(), j.toULong(), value.toGsl()) + + override fun copy(): GslComplexMatrix = memScoped { + val new = requireNotNull(gsl_matrix_complex_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_complex_memcpy(new, nativeHandle) + GslComplexMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_complex_free(nativeHandle) + + override fun equals(other: Any?): Boolean { + if (other is GslComplexMatrix) gsl_matrix_complex_equal(nativeHandle, other.nativeHandle) + return super.equals(other) + } +} + +internal class GslComplexVector(override val nativeHandle: CPointer) : + GslVector() { + override val size: Int + get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } + + override fun get(index: Int): Complex = gsl_vector_complex_get(nativeHandle, index.toULong()).toKMath() + override fun close(): Unit = gsl_vector_complex_free(nativeHandle) +} diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt new file mode 100644 index 000000000..22b80c435 --- /dev/null +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt @@ -0,0 +1,17 @@ +package kscience.kmath.gsl + +import kotlinx.cinterop.CStructVar +import kscience.kmath.linear.Point + +abstract class GslVector internal constructor(): GslMemoryHolder(), Point { + public override fun iterator(): Iterator = object : Iterator { + private var cursor = 0 + + override fun hasNext(): Boolean = cursor < size + + override fun next(): T { + cursor++ + return this@GslVector[cursor - 1] + } + } +} \ No newline at end of file From d46350e7b71707b0ad856a63e29ea25c78ee7adc Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 11 Oct 2020 01:15:37 +0700 Subject: [PATCH 20/76] Rework codegen, use GSL vectors to store vectors, implement MatrixContext for Float, Double and Complex matrices with BLAS --- .../kscience/kmath/gsl/codegen/PsiTestUtil.kt | 4 + .../kmath/gsl/codegen/StringUtilExt.kt | 9 - .../kmath/gsl/codegen/matricesCodegen.kt | 18 +- .../kmath/gsl/codegen/vectorsCodegen.kt | 24 +- .../kscience/kmath/linear/MatrixContext.kt | 2 +- .../kscience/kmath/operations/BigInt.kt | 2 +- kmath-gsl/build.gradle.kts | 4 +- .../nativeMain/kotlin/generated/Matrices.kt | 280 ------------------ .../kotlin/kscience/kmath/gsl/GslComplex.kt | 25 +- .../kotlin/kscience/kmath/gsl/GslMatrix.kt | 4 +- .../kscience/kmath/gsl/GslMatrixContext.kt | 7 + .../kscience/kmath/gsl/GslMatrixContexts.kt | 135 ++++++++- .../kotlin/kscience/kmath/gsl/GslVector.kt | 9 +- .../kotlin/kscience/kmath/gsl/GslVectors.kt | 101 ------- kmath-gsl/src/nativeTest/kotlin/RealTest.kt | 30 ++ 15 files changed, 218 insertions(+), 436 deletions(-) delete mode 100644 buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/StringUtilExt.kt delete mode 100644 kmath-gsl/src/nativeMain/kotlin/generated/Matrices.kt create mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt delete mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVectors.kt diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/PsiTestUtil.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/PsiTestUtil.kt index edc244bb3..2981b9502 100644 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/PsiTestUtil.kt +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/PsiTestUtil.kt @@ -6,8 +6,12 @@ import org.jetbrains.kotlin.com.intellij.psi.impl.DebugUtil import org.jetbrains.kotlin.com.intellij.psi.impl.source.PsiFileImpl import org.jetbrains.kotlin.com.intellij.testFramework.LightVirtualFile import org.jetbrains.kotlin.psi.KtFile +import java.util.regex.Pattern import kotlin.math.min +private val EOL_SPLIT_DONT_TRIM_PATTERN: Pattern = Pattern.compile("(\r|\n|\r\n)+") +internal fun splitByLinesDontTrim(string: String): Array = EOL_SPLIT_DONT_TRIM_PATTERN.split(string) + internal object PsiTestUtil { fun checkFileStructure(file: KtFile) { compareFromAllRoots(file) { f -> DebugUtil.psiTreeToString(f, false) } diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/StringUtilExt.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/StringUtilExt.kt deleted file mode 100644 index c56655b9f..000000000 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/StringUtilExt.kt +++ /dev/null @@ -1,9 +0,0 @@ -package kscience.kmath.gsl.codegen - -import java.util.regex.Pattern - -private val EOL_SPLIT_DONT_TRIM_PATTERN: Pattern = Pattern.compile("(\r|\n|\r\n)+") - -internal fun splitByLinesDontTrim(string: String): Array { - return EOL_SPLIT_DONT_TRIM_PATTERN.split(string) -} diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt index 1c507cc3d..92125f835 100644 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt @@ -22,10 +22,10 @@ private fun KtPsiFactory.createMatrixClass( features: Set = emptySet() ) : GslMatrix<$kotlinTypeName, $structName>() { override val rowNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + get() = nativeHandle.pointed.size1.toInt() override val colNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + get() = nativeHandle.pointed.size2.toInt() override val features: Set = features @@ -39,30 +39,26 @@ private fun KtPsiFactory.createMatrixClass( override operator fun set(i: Int, j: Int, value: ${kotlinTypeName}): Unit = ${fn("gsl_matrixRset", cTypeName)}(nativeHandle, i.toULong(), j.toULong(), value) - override fun copy(): $className = memScoped { + override fun copy(): $className { val new = requireNotNull(${fn("gsl_matrixRalloc", cTypeName)}(rowNum.toULong(), colNum.toULong())) ${fn("gsl_matrixRmemcpy", cTypeName)}(new, nativeHandle) - $className(new, features) + return $className(new, features) } override fun close(): Unit = ${fn("gsl_matrixRfree", cTypeName)}(nativeHandle) override fun equals(other: Any?): Boolean { - if (other is $className) ${fn("gsl_matrixRequal", cTypeName)}(nativeHandle, other.nativeHandle) + if (other is $className) return ${fn("gsl_matrixRequal", cTypeName)}(nativeHandle, other.nativeHandle) == 1 return super.equals(other) } }""" - f += createClass( - text - ) - + f += createClass(text) f += createNewLine(2) } fun matricesCodegen(outputFile: String, project: Project = createProject()) { val f = KtPsiFactory(project, true).run { - createFile("@file:Suppress(\"PackageDirectoryMismatch\")").also { f -> - f += createNewLine(2) + createFile("").also { f -> f += createPackageDirective(FqName("kscience.kmath.gsl")) f += createNewLine(2) f += createImportDirective(ImportPath.fromString("kotlinx.cinterop.*")) diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt index f29def5b0..830e858c4 100644 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt @@ -20,22 +20,34 @@ private fun KtPsiFactory.createVectorClass( @Language("kotlin") val text = """internal class $className(override val nativeHandle: CPointer<$structName>) : GslVector<$kotlinTypeName, $structName>() { override val size: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } + get() = nativeHandle.pointed.size.toInt() override fun get(index: Int): $kotlinTypeName = ${fn("gsl_vectorRget", cTypeName)}(nativeHandle, index.toULong()) + override fun set(index: Int, value: $kotlinTypeName): Unit = ${ + fn("gsl_vectorRset", cTypeName) + }(nativeHandle, index.toULong(), value) + + override fun copy(): $className { + val new = requireNotNull(${fn("gsl_vectorRalloc", cTypeName)}(size.toULong())) + ${fn("gsl_vectorRmemcpy", cTypeName)}(new, nativeHandle) + return ${className}(new) + } + + override fun equals(other: Any?): Boolean { + if (other is $className) return ${fn("gsl_vectorRequal", cTypeName)}(nativeHandle, other.nativeHandle) == 1 + return super.equals(other) + } + override fun close(): Unit = ${fn("gsl_vectorRfree", cTypeName)}(nativeHandle) }""" - f += createClass( - text - ) + f += createClass(text) f += createNewLine(2) } fun vectorsCodegen(outputFile: String, project: Project = createProject()) { val f = KtPsiFactory(project, true).run { - createFile("@file:Suppress(\"PackageDirectoryMismatch\")").also { f -> - f += createNewLine(2) + createFile("").also { f -> f += createPackageDirective(FqName("kscience.kmath.gsl")) f += createNewLine(2) f += createImportDirective(ImportPath.fromString("kotlinx.cinterop.*")) diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt index 300b963a6..c1c4a2d5e 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt @@ -55,7 +55,7 @@ public interface MatrixContext : SpaceOperations> { * Multiplies an element by a matrix of it. * * @receiver the multiplicand. - * @param value the multiplier. + * @param m the multiplier. * @receiver the product. */ public operator fun T.times(m: Matrix): Matrix = m * this diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/BigInt.kt b/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/BigInt.kt index 20f289596..a4f8406fb 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/BigInt.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/BigInt.kt @@ -38,7 +38,7 @@ public object BigIntField : Field { public class BigInt internal constructor( private val sign: Byte, private val magnitude: Magnitude -) : Comparable { + ) : Comparable { public override fun compareTo(other: BigInt): Int = when { (sign == 0.toByte()) and (other.sign == 0.toByte()) -> 0 sign < other.sign -> -1 diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index 048d7afed..09f614d4d 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -38,8 +38,8 @@ kotlin { } internal val codegen: Task by tasks.creating { - matricesCodegen(kotlin.sourceSets["nativeMain"].kotlin.srcDirs.first().absolutePath + "/generated/Matrices.kt") - vectorsCodegen(kotlin.sourceSets["nativeMain"].kotlin.srcDirs.first().absolutePath + "/generated/Vectors.kt") + matricesCodegen(kotlin.sourceSets["nativeMain"].kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Matrices.kt") + vectorsCodegen(kotlin.sourceSets["nativeMain"].kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Vectors.kt") } kotlin.sourceSets["nativeMain"].kotlin.srcDirs(files().builtBy(codegen)) diff --git a/kmath-gsl/src/nativeMain/kotlin/generated/Matrices.kt b/kmath-gsl/src/nativeMain/kotlin/generated/Matrices.kt deleted file mode 100644 index 8d471beaa..000000000 --- a/kmath-gsl/src/nativeMain/kotlin/generated/Matrices.kt +++ /dev/null @@ -1,280 +0,0 @@ -@file:Suppress("PackageDirectoryMismatch") - -package kscience.kmath.gsl - -import kotlinx.cinterop.* -import kscience.kmath.linear.* -import org.gnu.gsl.* - -internal class GslRealMatrix( - override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { - override val rowNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - - override val colNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslRealMatrix = - GslRealMatrix(nativeHandle, this.features + features) - - override operator fun get(i: Int, j: Int): Double = gsl_matrix_get(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: Double): Unit = - gsl_matrix_set(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): GslRealMatrix = memScoped { - val new = requireNotNull(gsl_matrix_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_memcpy(new, nativeHandle) - GslRealMatrix(new, features) - } - - override fun close(): Unit = gsl_matrix_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslRealMatrix) gsl_matrix_equal(nativeHandle, other.nativeHandle) - return super.equals(other) - } -} - -internal class GslFloatMatrix( - override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { - override val rowNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - - override val colNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslFloatMatrix = - GslFloatMatrix(nativeHandle, this.features + features) - - override operator fun get(i: Int, j: Int): Float = gsl_matrix_float_get(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: Float): Unit = - gsl_matrix_float_set(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): GslFloatMatrix = memScoped { - val new = requireNotNull(gsl_matrix_float_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_float_memcpy(new, nativeHandle) - GslFloatMatrix(new, features) - } - - override fun close(): Unit = gsl_matrix_float_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslFloatMatrix) gsl_matrix_float_equal(nativeHandle, other.nativeHandle) - return super.equals(other) - } -} - -internal class GslShortMatrix( - override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { - override val rowNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - - override val colNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslShortMatrix = - GslShortMatrix(nativeHandle, this.features + features) - - override operator fun get(i: Int, j: Int): Short = gsl_matrix_short_get(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: Short): Unit = - gsl_matrix_short_set(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): GslShortMatrix = memScoped { - val new = requireNotNull(gsl_matrix_short_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_short_memcpy(new, nativeHandle) - GslShortMatrix(new, features) - } - - override fun close(): Unit = gsl_matrix_short_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslShortMatrix) gsl_matrix_short_equal(nativeHandle, other.nativeHandle) - return super.equals(other) - } -} - -internal class GslUShortMatrix( - override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { - override val rowNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - - override val colNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslUShortMatrix = - GslUShortMatrix(nativeHandle, this.features + features) - - override operator fun get(i: Int, j: Int): UShort = gsl_matrix_ushort_get(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: UShort): Unit = - gsl_matrix_ushort_set(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): GslUShortMatrix = memScoped { - val new = requireNotNull(gsl_matrix_ushort_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_ushort_memcpy(new, nativeHandle) - GslUShortMatrix(new, features) - } - - override fun close(): Unit = gsl_matrix_ushort_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslUShortMatrix) gsl_matrix_ushort_equal(nativeHandle, other.nativeHandle) - return super.equals(other) - } -} - -internal class GslLongMatrix( - override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { - override val rowNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - - override val colNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslLongMatrix = - GslLongMatrix(nativeHandle, this.features + features) - - override operator fun get(i: Int, j: Int): Long = gsl_matrix_long_get(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: Long): Unit = - gsl_matrix_long_set(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): GslLongMatrix = memScoped { - val new = requireNotNull(gsl_matrix_long_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_long_memcpy(new, nativeHandle) - GslLongMatrix(new, features) - } - - override fun close(): Unit = gsl_matrix_long_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslLongMatrix) gsl_matrix_long_equal(nativeHandle, other.nativeHandle) - return super.equals(other) - } -} - -internal class GslULongMatrix( - override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { - override val rowNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - - override val colNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslULongMatrix = - GslULongMatrix(nativeHandle, this.features + features) - - override operator fun get(i: Int, j: Int): ULong = gsl_matrix_ulong_get(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: ULong): Unit = - gsl_matrix_ulong_set(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): GslULongMatrix = memScoped { - val new = requireNotNull(gsl_matrix_ulong_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_ulong_memcpy(new, nativeHandle) - GslULongMatrix(new, features) - } - - override fun close(): Unit = gsl_matrix_ulong_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslULongMatrix) gsl_matrix_ulong_equal(nativeHandle, other.nativeHandle) - return super.equals(other) - } -} - -internal class GslIntMatrix( - override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { - override val rowNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - - override val colNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslIntMatrix = - GslIntMatrix(nativeHandle, this.features + features) - - override operator fun get(i: Int, j: Int): Int = gsl_matrix_int_get(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: Int): Unit = - gsl_matrix_int_set(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): GslIntMatrix = memScoped { - val new = requireNotNull(gsl_matrix_int_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_int_memcpy(new, nativeHandle) - GslIntMatrix(new, features) - } - - override fun close(): Unit = gsl_matrix_int_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslIntMatrix) gsl_matrix_int_equal(nativeHandle, other.nativeHandle) - return super.equals(other) - } -} - -internal class GslUIntMatrix( - override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { - override val rowNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } - - override val colNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } - - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslUIntMatrix = - GslUIntMatrix(nativeHandle, this.features + features) - - override operator fun get(i: Int, j: Int): UInt = gsl_matrix_uint_get(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: UInt): Unit = - gsl_matrix_uint_set(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): GslUIntMatrix = memScoped { - val new = requireNotNull(gsl_matrix_uint_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_uint_memcpy(new, nativeHandle) - GslUIntMatrix(new, features) - } - - override fun close(): Unit = gsl_matrix_uint_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslUIntMatrix) gsl_matrix_uint_equal(nativeHandle, other.nativeHandle) - return super.equals(other) - } -} - diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt index 68bde7ef2..38d091414 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt @@ -17,10 +17,10 @@ internal class GslComplexMatrix( features: Set = emptySet() ) : GslMatrix() { override val rowNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size1.toInt() } + get() = nativeHandle.pointed.size1.toInt() override val colNum: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size2.toInt() } + get() = nativeHandle.pointed.size2.toInt() override val features: Set = features @@ -33,16 +33,16 @@ internal class GslComplexMatrix( override operator fun set(i: Int, j: Int, value: Complex): Unit = gsl_matrix_complex_set(nativeHandle, i.toULong(), j.toULong(), value.toGsl()) - override fun copy(): GslComplexMatrix = memScoped { + override fun copy(): GslComplexMatrix { val new = requireNotNull(gsl_matrix_complex_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_complex_memcpy(new, nativeHandle) - GslComplexMatrix(new, features) + return GslComplexMatrix(new, features) } override fun close(): Unit = gsl_matrix_complex_free(nativeHandle) override fun equals(other: Any?): Boolean { - if (other is GslComplexMatrix) gsl_matrix_complex_equal(nativeHandle, other.nativeHandle) + if (other is GslComplexMatrix) return gsl_matrix_complex_equal(nativeHandle, other.nativeHandle) == 1 return super.equals(other) } } @@ -50,8 +50,21 @@ internal class GslComplexMatrix( internal class GslComplexVector(override val nativeHandle: CPointer) : GslVector() { override val size: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } + get() = nativeHandle.pointed.size.toInt() override fun get(index: Int): Complex = gsl_vector_complex_get(nativeHandle, index.toULong()).toKMath() + override fun set(index: Int, value: Complex): Unit = gsl_vector_complex_set(nativeHandle, index.toULong(), value.toGsl()) + + override fun copy(): GslComplexVector { + val new = requireNotNull(gsl_vector_complex_alloc(size.toULong())) + gsl_vector_complex_memcpy(new, nativeHandle) + return GslComplexVector(new) + } + + override fun equals(other: Any?): Boolean { + if (other is GslComplexVector) return gsl_vector_complex_equal(nativeHandle, other.nativeHandle) == 1 + return super.equals(other) + } + override fun close(): Unit = gsl_vector_complex_free(nativeHandle) } diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt index fadecc4eb..c7323437d 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt @@ -13,9 +13,9 @@ public abstract class GslMatrix internal constructor(): return NDStructure.equals(this, other as? NDStructure<*> ?: return false) } - public override fun hashCode(): Int { + public final override fun hashCode(): Int { var result = nativeHandle.hashCode() result = 31 * result + features.hashCode() return result } -} \ No newline at end of file +} diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt new file mode 100644 index 000000000..8b0f12883 --- /dev/null +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt @@ -0,0 +1,7 @@ +package kscience.kmath.gsl + +import kotlinx.cinterop.CStructVar +import kscience.kmath.linear.MatrixContext +import kscience.kmath.linear.Point +import kscience.kmath.structures.Matrix + diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContexts.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContexts.kt index a27a22110..4428b0185 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContexts.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContexts.kt @@ -1,40 +1,63 @@ package kscience.kmath.gsl import kotlinx.cinterop.CStructVar +import kotlinx.cinterop.pointed import kscience.kmath.linear.MatrixContext import kscience.kmath.linear.Point -import kscience.kmath.operations.invoke +import kscience.kmath.operations.Complex +import kscience.kmath.operations.ComplexField +import kscience.kmath.operations.toComplex import kscience.kmath.structures.Matrix import org.gnu.gsl.* -private inline fun GslMatrix.fill(initializer: (Int, Int) -> T): GslMatrix = +internal inline fun GslMatrix.fill(initializer: (Int, Int) -> T): GslMatrix = apply { (0 until rowNum).forEach { row -> (0 until colNum).forEach { col -> this[row, col] = initializer(row, col) } } } -public sealed class GslMatrixContext : MatrixContext { +internal inline fun GslVector.fill(initializer: (Int) -> T): GslVector = + apply { (0 until size).forEach { index -> this[index] = initializer(index) } } + +public abstract class GslMatrixContext internal constructor() : + MatrixContext { @Suppress("UNCHECKED_CAST") - public fun Matrix.toGsl(): GslMatrix = - (if (this is GslMatrix<*, *>) this as GslMatrix else produce(rowNum, colNum) { i, j -> get(i, j) }).copy() + public fun Matrix.toGsl(): GslMatrix = (if (this is GslMatrix<*, *>) + this as GslMatrix + else + produce(rowNum, colNum) { i, j -> this[i, j] }).copy() - internal abstract fun produceDirty(rows: Int, columns: Int): GslMatrix + @Suppress("UNCHECKED_CAST") + public fun Point.toGsl(): GslVector = + (if (this is GslVector<*, *>) this as GslVector else produceDirtyVector(size).fill { this[it] }).copy() - public override fun produce(rows: Int, columns: Int, initializer: (i: Int, j: Int) -> T): GslMatrix = - produceDirty(rows, columns).fill(initializer) + internal abstract fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix + internal abstract fun produceDirtyVector(size: Int): GslVector + + public override fun produce(rows: Int, columns: Int, initializer: (i: Int, j: Int) -> T): GslMatrix = + produceDirtyMatrix(rows, columns).fill(initializer) } -public object GslRealMatrixContext : GslMatrixContext() { - public override fun produceDirty(rows: Int, columns: Int): GslMatrix = +public object GslRealMatrixContext : GslMatrixContext() { + override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = GslRealMatrix(requireNotNull(gsl_matrix_alloc(rows.toULong(), columns.toULong()))) + override fun produceDirtyVector(size: Int): GslVector = + GslRealVector(requireNotNull(gsl_vector_alloc(size.toULong()))) + public override fun Matrix.dot(other: Matrix): GslMatrix { - val g1 = toGsl() - gsl_matrix_mul_elements(g1.nativeHandle, other.toGsl().nativeHandle) - return g1 + val x = toGsl().nativeHandle + val a = other.toGsl().nativeHandle + val result = requireNotNull(gsl_matrix_calloc(a.pointed.size1, a.pointed.size2)) + gsl_blas_dgemm(CblasNoTrans, CblasNoTrans, 1.0, x, a, 1.0, result) + return GslRealMatrix(result) } public override fun Matrix.dot(vector: Point): GslVector { - TODO() + val x = toGsl().nativeHandle + val a = vector.toGsl().nativeHandle + val result = requireNotNull(gsl_vector_calloc(a.pointed.size)) + gsl_blas_dgemv(CblasNoTrans, 1.0, x, a, 1.0, result) + return GslRealVector(result) } public override fun Matrix.times(value: Double): GslMatrix { @@ -55,3 +78,87 @@ public object GslRealMatrixContext : GslMatrixContext() { return g1 } } + +public object GslFloatMatrixContext : GslMatrixContext() { + override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = + GslFloatMatrix(requireNotNull(gsl_matrix_float_alloc(rows.toULong(), columns.toULong()))) + + override fun produceDirtyVector(size: Int): GslVector = + GslFloatVector(requireNotNull(gsl_vector_float_alloc(size.toULong()))) + + public override fun Matrix.dot(other: Matrix): GslMatrix { + val x = toGsl().nativeHandle + val a = other.toGsl().nativeHandle + val result = requireNotNull(gsl_matrix_float_calloc(a.pointed.size1, a.pointed.size2)) + gsl_blas_sgemm(CblasNoTrans, CblasNoTrans, 1f, x, a, 1f, result) + return GslFloatMatrix(result) + } + + public override fun Matrix.dot(vector: Point): GslVector { + val x = toGsl().nativeHandle + val a = vector.toGsl().nativeHandle + val result = requireNotNull(gsl_vector_float_calloc(a.pointed.size)) + gsl_blas_sgemv(CblasNoTrans, 1f, x, a, 1f, result) + return GslFloatVector(result) + } + + public override fun Matrix.times(value: Float): GslMatrix { + val g1 = toGsl() + gsl_matrix_float_scale(g1.nativeHandle, value.toDouble()) + return g1 + } + + public override fun add(a: Matrix, b: Matrix): GslMatrix { + val g1 = a.toGsl() + gsl_matrix_float_add(g1.nativeHandle, b.toGsl().nativeHandle) + return g1 + } + + public override fun multiply(a: Matrix, k: Number): GslMatrix { + val g1 = a.toGsl() + gsl_matrix_float_scale(g1.nativeHandle, k.toDouble()) + return g1 + } +} + +public object GslComplexMatrixContext : GslMatrixContext() { + override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = + GslComplexMatrix(requireNotNull(gsl_matrix_complex_alloc(rows.toULong(), columns.toULong()))) + + override fun produceDirtyVector(size: Int): GslVector = + GslComplexVector(requireNotNull(gsl_vector_complex_alloc(size.toULong()))) + + public override fun Matrix.dot(other: Matrix): GslMatrix { + val x = toGsl().nativeHandle + val a = other.toGsl().nativeHandle + val result = requireNotNull(gsl_matrix_complex_calloc(a.pointed.size1, a.pointed.size2)) + gsl_blas_zgemm(CblasNoTrans, CblasNoTrans, ComplexField.one.toGsl(), x, a, ComplexField.one.toGsl(), result) + return GslComplexMatrix(result) + } + + public override fun Matrix.dot(vector: Point): GslVector { + val x = toGsl().nativeHandle + val a = vector.toGsl().nativeHandle + val result = requireNotNull(gsl_vector_complex_calloc(a.pointed.size)) + gsl_blas_zgemv(CblasNoTrans, ComplexField.one.toGsl(), x, a, ComplexField.one.toGsl(), result) + return GslComplexVector(result) + } + + public override fun Matrix.times(value: Complex): GslMatrix { + val g1 = toGsl() + gsl_matrix_complex_scale(g1.nativeHandle, value.toGsl()) + return g1 + } + + public override fun add(a: Matrix, b: Matrix): GslMatrix { + val g1 = a.toGsl() + gsl_matrix_complex_add(g1.nativeHandle, b.toGsl().nativeHandle) + return g1 + } + + public override fun multiply(a: Matrix, k: Number): GslMatrix { + val g1 = a.toGsl() + gsl_matrix_complex_scale(g1.nativeHandle, k.toComplex().toGsl()) + return g1 + } +} diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt index 22b80c435..87fbce607 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt @@ -3,8 +3,11 @@ package kscience.kmath.gsl import kotlinx.cinterop.CStructVar import kscience.kmath.linear.Point -abstract class GslVector internal constructor(): GslMemoryHolder(), Point { - public override fun iterator(): Iterator = object : Iterator { +public abstract class GslVector internal constructor() : GslMemoryHolder(), Point { + internal abstract operator fun set(index: Int, value: T) + internal abstract fun copy(): GslVector + + public final override fun iterator(): Iterator = object : Iterator { private var cursor = 0 override fun hasNext(): Boolean = cursor < size @@ -14,4 +17,4 @@ abstract class GslVector internal constructor(): GslMemoryHol return this@GslVector[cursor - 1] } } -} \ No newline at end of file +} diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVectors.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVectors.kt deleted file mode 100644 index 4741d8af1..000000000 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVectors.kt +++ /dev/null @@ -1,101 +0,0 @@ -package kscience.kmath.gsl - -import kotlinx.cinterop.CPointer -import kotlinx.cinterop.CStructVar -import kotlinx.cinterop.memScoped -import kotlinx.cinterop.pointed -import kscience.kmath.linear.Point -import kscience.kmath.operations.Complex -import org.gnu.gsl.* - -public abstract class GslVector internal constructor(): GslMemoryHolder(), Point { - public override fun iterator(): Iterator = object : Iterator { - private var cursor = 0 - - override fun hasNext(): Boolean = cursor < size - - override fun next(): T { - cursor++ - return this@GslVector[cursor - 1] - } - } -} - -internal class GslRealVector(override val nativeHandle: CPointer) : GslVector() { - override val size: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } - - override fun get(index: Int): Double = gsl_vector_get(nativeHandle, index.toULong()) - override fun close(): Unit = gsl_vector_free(nativeHandle) -} - -internal class GslFloatVector(override val nativeHandle: CPointer) : - GslVector() { - override val size: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } - - override fun get(index: Int): Float = gsl_vector_float_get(nativeHandle, index.toULong()) - override fun close(): Unit = gsl_vector_float_free(nativeHandle) -} - -internal class GslIntVector(override val nativeHandle: CPointer) : GslVector() { - override val size: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } - - override fun get(index: Int): Int = gsl_vector_int_get(nativeHandle, index.toULong()) - override fun close(): Unit = gsl_vector_int_free(nativeHandle) -} - -internal class GslUIntVector(override val nativeHandle: CPointer) : - GslVector() { - override val size: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } - - override fun get(index: Int): UInt = gsl_vector_uint_get(nativeHandle, index.toULong()) - override fun close(): Unit = gsl_vector_uint_free(nativeHandle) -} - -internal class GslLongVector(override val nativeHandle: CPointer) : - GslVector() { - override val size: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } - - override fun get(index: Int): Long = gsl_vector_long_get(nativeHandle, index.toULong()) - override fun close(): Unit = gsl_vector_long_free(nativeHandle) -} - -internal class GslULongVector(override val nativeHandle: CPointer) : - GslVector() { - public override val size: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } - - public override fun get(index: Int): ULong = gsl_vector_ulong_get(nativeHandle, index.toULong()) - public override fun close(): Unit = gsl_vector_ulong_free(nativeHandle) -} - -internal class GslShortVector(override val nativeHandle: CPointer) : - GslVector() { - public override val size: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } - - public override fun get(index: Int): Short = gsl_vector_short_get(nativeHandle, index.toULong()) - public override fun close(): Unit = gsl_vector_short_free(nativeHandle) -} - -internal class GslUShortVector(override val nativeHandle: CPointer) : - GslVector() { - override val size: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } - - override fun get(index: Int): UShort = gsl_vector_ushort_get(nativeHandle, index.toULong()) - override fun close(): Unit = gsl_vector_ushort_free(nativeHandle) -} - -internal class GslComplexVector(override val nativeHandle: CPointer) : - GslVector() { - override val size: Int - get() = memScoped { nativeHandle.getPointer(this).pointed.size.toInt() } - - override fun get(index: Int): Complex = gsl_vector_complex_get(nativeHandle, index.toULong()).toKMath() - override fun close(): Unit = gsl_vector_complex_free(nativeHandle) -} diff --git a/kmath-gsl/src/nativeTest/kotlin/RealTest.kt b/kmath-gsl/src/nativeTest/kotlin/RealTest.kt index 41efbd195..1208443c5 100644 --- a/kmath-gsl/src/nativeTest/kotlin/RealTest.kt +++ b/kmath-gsl/src/nativeTest/kotlin/RealTest.kt @@ -1,8 +1,13 @@ package kscience.kmath.gsl +import kscience.kmath.linear.RealMatrixContext import kscience.kmath.operations.invoke +import kscience.kmath.structures.RealBuffer +import kscience.kmath.structures.asIterable +import kscience.kmath.structures.asSequence import kotlin.test.Test import kotlin.test.assertEquals +import kotlin.test.assertTrue internal class RealTest { @Test @@ -13,4 +18,29 @@ internal class RealTest { mb.close() ma.close() } + + @Test + fun testDotOfMatrixAndVector() { + val ma = GslRealMatrixContext.produce(2, 2) { _, _ -> 100.0 } + val vb = RealBuffer(2) { 0.1 } + val res1 = GslRealMatrixContext { ma dot vb } + val res2 = RealMatrixContext { ma dot vb } + println(res1.asSequence().toList()) + println(res2.asSequence().toList()) + assertTrue(res1.contentEquals(res2)) + res1.close() + } + + @Test + fun testDotOfMatrixAndMatrix() { + val ma = GslRealMatrixContext.produce(2, 2) { _, _ -> 100.0 } + val mb = GslRealMatrixContext.produce(2, 2) { _, _ -> 100.0 } + val res1 = GslRealMatrixContext { ma dot mb } + val res2 = RealMatrixContext { ma dot mb } + println(res1.rows.asIterable().map { it.asSequence() }.flatMap(Sequence<*>::toList)) + println(res2.rows.asIterable().map { it.asSequence() }.flatMap(Sequence<*>::toList)) + assertEquals(res1, res2) + ma.close() + mb.close() + } } From 956fe9b9e6ff904938a3d120e4f85fd149ec45fd Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 11 Oct 2020 01:21:10 +0700 Subject: [PATCH 21/76] Track generated code --- .../kotlin/kscience/kmath/gsl/_Matrices.kt | 278 ++++++++++++++++++ .../kotlin/kscience/kmath/gsl/_Vectors.kt | 173 +++++++++++ 2 files changed, 451 insertions(+) create mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt create mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt new file mode 100644 index 000000000..06a9eb75e --- /dev/null +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt @@ -0,0 +1,278 @@ +package kscience.kmath.gsl + +import kotlinx.cinterop.* +import kscience.kmath.linear.* +import org.gnu.gsl.* + +internal class GslRealMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { + override val rowNum: Int + get() = nativeHandle.pointed.size1.toInt() + + override val colNum: Int + get() = nativeHandle.pointed.size2.toInt() + + override val features: Set = features + + override fun suggestFeature(vararg features: MatrixFeature): GslRealMatrix = + GslRealMatrix(nativeHandle, this.features + features) + + override operator fun get(i: Int, j: Int): Double = gsl_matrix_get(nativeHandle, i.toULong(), j.toULong()) + + override operator fun set(i: Int, j: Int, value: Double): Unit = + gsl_matrix_set(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): GslRealMatrix { + val new = requireNotNull(gsl_matrix_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_memcpy(new, nativeHandle) + return GslRealMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_free(nativeHandle) + + override fun equals(other: Any?): Boolean { + if (other is GslRealMatrix) return gsl_matrix_equal(nativeHandle, other.nativeHandle) == 1 + return super.equals(other) + } +} + +internal class GslFloatMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { + override val rowNum: Int + get() = nativeHandle.pointed.size1.toInt() + + override val colNum: Int + get() = nativeHandle.pointed.size2.toInt() + + override val features: Set = features + + override fun suggestFeature(vararg features: MatrixFeature): GslFloatMatrix = + GslFloatMatrix(nativeHandle, this.features + features) + + override operator fun get(i: Int, j: Int): Float = gsl_matrix_float_get(nativeHandle, i.toULong(), j.toULong()) + + override operator fun set(i: Int, j: Int, value: Float): Unit = + gsl_matrix_float_set(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): GslFloatMatrix { + val new = requireNotNull(gsl_matrix_float_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_float_memcpy(new, nativeHandle) + return GslFloatMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_float_free(nativeHandle) + + override fun equals(other: Any?): Boolean { + if (other is GslFloatMatrix) return gsl_matrix_float_equal(nativeHandle, other.nativeHandle) == 1 + return super.equals(other) + } +} + +internal class GslShortMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { + override val rowNum: Int + get() = nativeHandle.pointed.size1.toInt() + + override val colNum: Int + get() = nativeHandle.pointed.size2.toInt() + + override val features: Set = features + + override fun suggestFeature(vararg features: MatrixFeature): GslShortMatrix = + GslShortMatrix(nativeHandle, this.features + features) + + override operator fun get(i: Int, j: Int): Short = gsl_matrix_short_get(nativeHandle, i.toULong(), j.toULong()) + + override operator fun set(i: Int, j: Int, value: Short): Unit = + gsl_matrix_short_set(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): GslShortMatrix { + val new = requireNotNull(gsl_matrix_short_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_short_memcpy(new, nativeHandle) + return GslShortMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_short_free(nativeHandle) + + override fun equals(other: Any?): Boolean { + if (other is GslShortMatrix) return gsl_matrix_short_equal(nativeHandle, other.nativeHandle) == 1 + return super.equals(other) + } +} + +internal class GslUShortMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { + override val rowNum: Int + get() = nativeHandle.pointed.size1.toInt() + + override val colNum: Int + get() = nativeHandle.pointed.size2.toInt() + + override val features: Set = features + + override fun suggestFeature(vararg features: MatrixFeature): GslUShortMatrix = + GslUShortMatrix(nativeHandle, this.features + features) + + override operator fun get(i: Int, j: Int): UShort = gsl_matrix_ushort_get(nativeHandle, i.toULong(), j.toULong()) + + override operator fun set(i: Int, j: Int, value: UShort): Unit = + gsl_matrix_ushort_set(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): GslUShortMatrix { + val new = requireNotNull(gsl_matrix_ushort_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_ushort_memcpy(new, nativeHandle) + return GslUShortMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_ushort_free(nativeHandle) + + override fun equals(other: Any?): Boolean { + if (other is GslUShortMatrix) return gsl_matrix_ushort_equal(nativeHandle, other.nativeHandle) == 1 + return super.equals(other) + } +} + +internal class GslLongMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { + override val rowNum: Int + get() = nativeHandle.pointed.size1.toInt() + + override val colNum: Int + get() = nativeHandle.pointed.size2.toInt() + + override val features: Set = features + + override fun suggestFeature(vararg features: MatrixFeature): GslLongMatrix = + GslLongMatrix(nativeHandle, this.features + features) + + override operator fun get(i: Int, j: Int): Long = gsl_matrix_long_get(nativeHandle, i.toULong(), j.toULong()) + + override operator fun set(i: Int, j: Int, value: Long): Unit = + gsl_matrix_long_set(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): GslLongMatrix { + val new = requireNotNull(gsl_matrix_long_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_long_memcpy(new, nativeHandle) + return GslLongMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_long_free(nativeHandle) + + override fun equals(other: Any?): Boolean { + if (other is GslLongMatrix) return gsl_matrix_long_equal(nativeHandle, other.nativeHandle) == 1 + return super.equals(other) + } +} + +internal class GslULongMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { + override val rowNum: Int + get() = nativeHandle.pointed.size1.toInt() + + override val colNum: Int + get() = nativeHandle.pointed.size2.toInt() + + override val features: Set = features + + override fun suggestFeature(vararg features: MatrixFeature): GslULongMatrix = + GslULongMatrix(nativeHandle, this.features + features) + + override operator fun get(i: Int, j: Int): ULong = gsl_matrix_ulong_get(nativeHandle, i.toULong(), j.toULong()) + + override operator fun set(i: Int, j: Int, value: ULong): Unit = + gsl_matrix_ulong_set(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): GslULongMatrix { + val new = requireNotNull(gsl_matrix_ulong_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_ulong_memcpy(new, nativeHandle) + return GslULongMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_ulong_free(nativeHandle) + + override fun equals(other: Any?): Boolean { + if (other is GslULongMatrix) return gsl_matrix_ulong_equal(nativeHandle, other.nativeHandle) == 1 + return super.equals(other) + } +} + +internal class GslIntMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { + override val rowNum: Int + get() = nativeHandle.pointed.size1.toInt() + + override val colNum: Int + get() = nativeHandle.pointed.size2.toInt() + + override val features: Set = features + + override fun suggestFeature(vararg features: MatrixFeature): GslIntMatrix = + GslIntMatrix(nativeHandle, this.features + features) + + override operator fun get(i: Int, j: Int): Int = gsl_matrix_int_get(nativeHandle, i.toULong(), j.toULong()) + + override operator fun set(i: Int, j: Int, value: Int): Unit = + gsl_matrix_int_set(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): GslIntMatrix { + val new = requireNotNull(gsl_matrix_int_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_int_memcpy(new, nativeHandle) + return GslIntMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_int_free(nativeHandle) + + override fun equals(other: Any?): Boolean { + if (other is GslIntMatrix) return gsl_matrix_int_equal(nativeHandle, other.nativeHandle) == 1 + return super.equals(other) + } +} + +internal class GslUIntMatrix( + override val nativeHandle: CPointer, + features: Set = emptySet() +) : GslMatrix() { + override val rowNum: Int + get() = nativeHandle.pointed.size1.toInt() + + override val colNum: Int + get() = nativeHandle.pointed.size2.toInt() + + override val features: Set = features + + override fun suggestFeature(vararg features: MatrixFeature): GslUIntMatrix = + GslUIntMatrix(nativeHandle, this.features + features) + + override operator fun get(i: Int, j: Int): UInt = gsl_matrix_uint_get(nativeHandle, i.toULong(), j.toULong()) + + override operator fun set(i: Int, j: Int, value: UInt): Unit = + gsl_matrix_uint_set(nativeHandle, i.toULong(), j.toULong(), value) + + override fun copy(): GslUIntMatrix { + val new = requireNotNull(gsl_matrix_uint_alloc(rowNum.toULong(), colNum.toULong())) + gsl_matrix_uint_memcpy(new, nativeHandle) + return GslUIntMatrix(new, features) + } + + override fun close(): Unit = gsl_matrix_uint_free(nativeHandle) + + override fun equals(other: Any?): Boolean { + if (other is GslUIntMatrix) return gsl_matrix_uint_equal(nativeHandle, other.nativeHandle) == 1 + return super.equals(other) + } +} + diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt new file mode 100644 index 000000000..918fca825 --- /dev/null +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt @@ -0,0 +1,173 @@ +package kscience.kmath.gsl + +import kotlinx.cinterop.* +import org.gnu.gsl.* + +internal class GslRealVector(override val nativeHandle: CPointer) : GslVector() { + override val size: Int + get() = nativeHandle.pointed.size.toInt() + + override fun get(index: Int): Double = gsl_vector_get(nativeHandle, index.toULong()) + override fun set(index: Int, value: Double): Unit = gsl_vector_set(nativeHandle, index.toULong(), value) + + override fun copy(): GslRealVector { + val new = requireNotNull(gsl_vector_alloc(size.toULong())) + gsl_vector_memcpy(new, nativeHandle) + return GslRealVector(new) + } + + override fun equals(other: Any?): Boolean { + if (other is GslRealVector) return gsl_vector_equal(nativeHandle, other.nativeHandle) == 1 + return super.equals(other) + } + + override fun close(): Unit = gsl_vector_free(nativeHandle) +} + +internal class GslFloatVector(override val nativeHandle: CPointer) : GslVector() { + override val size: Int + get() = nativeHandle.pointed.size.toInt() + + override fun get(index: Int): Float = gsl_vector_float_get(nativeHandle, index.toULong()) + override fun set(index: Int, value: Float): Unit = gsl_vector_float_set(nativeHandle, index.toULong(), value) + + override fun copy(): GslFloatVector { + val new = requireNotNull(gsl_vector_float_alloc(size.toULong())) + gsl_vector_float_memcpy(new, nativeHandle) + return GslFloatVector(new) + } + + override fun equals(other: Any?): Boolean { + if (other is GslFloatVector) return gsl_vector_float_equal(nativeHandle, other.nativeHandle) == 1 + return super.equals(other) + } + + override fun close(): Unit = gsl_vector_float_free(nativeHandle) +} + +internal class GslShortVector(override val nativeHandle: CPointer) : GslVector() { + override val size: Int + get() = nativeHandle.pointed.size.toInt() + + override fun get(index: Int): Short = gsl_vector_short_get(nativeHandle, index.toULong()) + override fun set(index: Int, value: Short): Unit = gsl_vector_short_set(nativeHandle, index.toULong(), value) + + override fun copy(): GslShortVector { + val new = requireNotNull(gsl_vector_short_alloc(size.toULong())) + gsl_vector_short_memcpy(new, nativeHandle) + return GslShortVector(new) + } + + override fun equals(other: Any?): Boolean { + if (other is GslShortVector) return gsl_vector_short_equal(nativeHandle, other.nativeHandle) == 1 + return super.equals(other) + } + + override fun close(): Unit = gsl_vector_short_free(nativeHandle) +} + +internal class GslUShortVector(override val nativeHandle: CPointer) : GslVector() { + override val size: Int + get() = nativeHandle.pointed.size.toInt() + + override fun get(index: Int): UShort = gsl_vector_ushort_get(nativeHandle, index.toULong()) + override fun set(index: Int, value: UShort): Unit = gsl_vector_ushort_set(nativeHandle, index.toULong(), value) + + override fun copy(): GslUShortVector { + val new = requireNotNull(gsl_vector_ushort_alloc(size.toULong())) + gsl_vector_ushort_memcpy(new, nativeHandle) + return GslUShortVector(new) + } + + override fun equals(other: Any?): Boolean { + if (other is GslUShortVector) return gsl_vector_ushort_equal(nativeHandle, other.nativeHandle) == 1 + return super.equals(other) + } + + override fun close(): Unit = gsl_vector_ushort_free(nativeHandle) +} + +internal class GslLongVector(override val nativeHandle: CPointer) : GslVector() { + override val size: Int + get() = nativeHandle.pointed.size.toInt() + + override fun get(index: Int): Long = gsl_vector_long_get(nativeHandle, index.toULong()) + override fun set(index: Int, value: Long): Unit = gsl_vector_long_set(nativeHandle, index.toULong(), value) + + override fun copy(): GslLongVector { + val new = requireNotNull(gsl_vector_long_alloc(size.toULong())) + gsl_vector_long_memcpy(new, nativeHandle) + return GslLongVector(new) + } + + override fun equals(other: Any?): Boolean { + if (other is GslLongVector) return gsl_vector_long_equal(nativeHandle, other.nativeHandle) == 1 + return super.equals(other) + } + + override fun close(): Unit = gsl_vector_long_free(nativeHandle) +} + +internal class GslULongVector(override val nativeHandle: CPointer) : GslVector() { + override val size: Int + get() = nativeHandle.pointed.size.toInt() + + override fun get(index: Int): ULong = gsl_vector_ulong_get(nativeHandle, index.toULong()) + override fun set(index: Int, value: ULong): Unit = gsl_vector_ulong_set(nativeHandle, index.toULong(), value) + + override fun copy(): GslULongVector { + val new = requireNotNull(gsl_vector_ulong_alloc(size.toULong())) + gsl_vector_ulong_memcpy(new, nativeHandle) + return GslULongVector(new) + } + + override fun equals(other: Any?): Boolean { + if (other is GslULongVector) return gsl_vector_ulong_equal(nativeHandle, other.nativeHandle) == 1 + return super.equals(other) + } + + override fun close(): Unit = gsl_vector_ulong_free(nativeHandle) +} + +internal class GslIntVector(override val nativeHandle: CPointer) : GslVector() { + override val size: Int + get() = nativeHandle.pointed.size.toInt() + + override fun get(index: Int): Int = gsl_vector_int_get(nativeHandle, index.toULong()) + override fun set(index: Int, value: Int): Unit = gsl_vector_int_set(nativeHandle, index.toULong(), value) + + override fun copy(): GslIntVector { + val new = requireNotNull(gsl_vector_int_alloc(size.toULong())) + gsl_vector_int_memcpy(new, nativeHandle) + return GslIntVector(new) + } + + override fun equals(other: Any?): Boolean { + if (other is GslIntVector) return gsl_vector_int_equal(nativeHandle, other.nativeHandle) == 1 + return super.equals(other) + } + + override fun close(): Unit = gsl_vector_int_free(nativeHandle) +} + +internal class GslUIntVector(override val nativeHandle: CPointer) : GslVector() { + override val size: Int + get() = nativeHandle.pointed.size.toInt() + + override fun get(index: Int): UInt = gsl_vector_uint_get(nativeHandle, index.toULong()) + override fun set(index: Int, value: UInt): Unit = gsl_vector_uint_set(nativeHandle, index.toULong(), value) + + override fun copy(): GslUIntVector { + val new = requireNotNull(gsl_vector_uint_alloc(size.toULong())) + gsl_vector_uint_memcpy(new, nativeHandle) + return GslUIntVector(new) + } + + override fun equals(other: Any?): Boolean { + if (other is GslUIntVector) return gsl_vector_uint_equal(nativeHandle, other.nativeHandle) == 1 + return super.equals(other) + } + + override fun close(): Unit = gsl_vector_uint_free(nativeHandle) +} + From 8af6195265d08088671ea9d8e36d8950f97a4f22 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 11 Oct 2020 01:24:16 +0700 Subject: [PATCH 22/76] Fix build-script error --- kmath-gsl/build.gradle.kts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index 09f614d4d..a816f5cc7 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -35,11 +35,11 @@ kotlin { } } } -} -internal val codegen: Task by tasks.creating { - matricesCodegen(kotlin.sourceSets["nativeMain"].kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Matrices.kt") - vectorsCodegen(kotlin.sourceSets["nativeMain"].kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Vectors.kt") -} + internal val codegen: Task by tasks.creating { + matricesCodegen(kotlin.sourceSets["nativeMain"].kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Matrices.kt") + vectorsCodegen(kotlin.sourceSets["nativeMain"].kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Vectors.kt") + } -kotlin.sourceSets["nativeMain"].kotlin.srcDirs(files().builtBy(codegen)) + sourceSets["nativeMain"].kotlin.srcDirs(files().builtBy(codegen)) +} From 60c7b08b42c5bf126718796324b9f52829033b23 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 11 Oct 2020 01:27:44 +0700 Subject: [PATCH 23/76] Remove invalid modifier --- kmath-gsl/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index a816f5cc7..06129d509 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -36,7 +36,7 @@ kotlin { } } - internal val codegen: Task by tasks.creating { + val codegen: Task by tasks.creating { matricesCodegen(kotlin.sourceSets["nativeMain"].kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Matrices.kt") vectorsCodegen(kotlin.sourceSets["nativeMain"].kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Vectors.kt") } From a0066bb6dd2285fc9373e5a0f87d4b39ba0f62a3 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 11 Oct 2020 03:09:00 +0700 Subject: [PATCH 24/76] Fix compiler-embeddable version, add generated sources --- buildSrc/build.gradle.kts | 2 +- kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index d0e424c37..5093b7930 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -5,5 +5,5 @@ plugins { repositories.jcenter() dependencies { - implementation(kotlin("compiler-embeddable")) + implementation(kotlin("compiler-embeddable", "1.4.10")) } diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt index 918fca825..a33c6c98e 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt @@ -1,6 +1,7 @@ package kscience.kmath.gsl -import kotlinx.cinterop.* +import kotlinx.cinterop.CPointer +import kotlinx.cinterop.pointed import org.gnu.gsl.* internal class GslRealVector(override val nativeHandle: CPointer) : GslVector() { From 21dfc37727e5bd01c25512f33a96c6a90708f8da Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 11 Oct 2020 03:29:38 +0700 Subject: [PATCH 25/76] Hide ignored targets and update generated file --- gradle.properties | 1 + kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index b16859f29..fe2401d09 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,6 +2,7 @@ kotlin.code.style=official kotlin.mpp.enableGranularSourceSetsMetadata=true kotlin.mpp.stability.nowarn=true kotlin.parallel.tasks.in.project=true +kotlin.native.ignoreDisabledTargets=true org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m org.gradle.parallel=true systemProp.org.gradle.internal.publish.checksums.insecure=true diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt index a33c6c98e..918fca825 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt @@ -1,7 +1,6 @@ package kscience.kmath.gsl -import kotlinx.cinterop.CPointer -import kotlinx.cinterop.pointed +import kotlinx.cinterop.* import org.gnu.gsl.* internal class GslRealVector(override val nativeHandle: CPointer) : GslVector() { From 922d27fb62ad871886974e61dd96f84f47cb59dd Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 11 Oct 2020 03:37:04 +0700 Subject: [PATCH 26/76] Restructure codegen task --- kmath-gsl/build.gradle.kts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index 06129d509..7e6005681 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -29,17 +29,17 @@ kotlin { sourceSets { val nativeMain by getting { + val codegen by tasks.creating { + matricesCodegen(kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Matrices.kt") + vectorsCodegen(kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Vectors.kt") + } + + kotlin.srcDirs(files().builtBy(codegen)) + dependencies { api(project(":kmath-core")) api("org.jetbrains.kotlinx:kotlinx-io:0.2.0-tvis-3") } } } - - val codegen: Task by tasks.creating { - matricesCodegen(kotlin.sourceSets["nativeMain"].kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Matrices.kt") - vectorsCodegen(kotlin.sourceSets["nativeMain"].kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Vectors.kt") - } - - sourceSets["nativeMain"].kotlin.srcDirs(files().builtBy(codegen)) } From 7e7da25a995f06492c2b81422461f17ec38dd9a2 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 11 Oct 2020 03:44:43 +0700 Subject: [PATCH 27/76] Drop headers --- gradle.properties | 2 +- kmath-gsl/build.gradle.kts | 5 +- .../src/nativeInterop/cinterop/libgsl.def | 2 +- .../src/nativeMain/resources/gsl/gsl_blas.h | 602 -------------- .../nativeMain/resources/gsl/gsl_blas_types.h | 54 -- .../src/nativeMain/resources/gsl/gsl_block.h | 24 - .../nativeMain/resources/gsl/gsl_block_char.h | 65 -- .../resources/gsl/gsl_block_complex_double.h | 65 -- .../resources/gsl/gsl_block_complex_float.h | 65 -- .../gsl/gsl_block_complex_long_double.h | 65 -- .../resources/gsl/gsl_block_double.h | 65 -- .../resources/gsl/gsl_block_float.h | 65 -- .../nativeMain/resources/gsl/gsl_block_int.h | 65 -- .../nativeMain/resources/gsl/gsl_block_long.h | 65 -- .../resources/gsl/gsl_block_long_double.h | 65 -- .../resources/gsl/gsl_block_short.h | 65 -- .../resources/gsl/gsl_block_uchar.h | 65 -- .../nativeMain/resources/gsl/gsl_block_uint.h | 65 -- .../resources/gsl/gsl_block_ulong.h | 65 -- .../resources/gsl/gsl_block_ushort.h | 65 -- .../nativeMain/resources/gsl/gsl_bspline.h | 108 --- .../src/nativeMain/resources/gsl/gsl_cblas.h | 606 -------------- .../src/nativeMain/resources/gsl/gsl_cdf.h | 170 ---- .../nativeMain/resources/gsl/gsl_chebyshev.h | 133 --- .../resources/gsl/gsl_check_range.h | 57 -- .../resources/gsl/gsl_combination.h | 92 --- .../nativeMain/resources/gsl/gsl_complex.h | 103 --- .../resources/gsl/gsl_complex_math.h | 142 ---- .../src/nativeMain/resources/gsl/gsl_const.h | 31 - .../nativeMain/resources/gsl/gsl_const_cgs.h | 116 --- .../nativeMain/resources/gsl/gsl_const_cgsm.h | 122 --- .../nativeMain/resources/gsl/gsl_const_mks.h | 126 --- .../nativeMain/resources/gsl/gsl_const_mksa.h | 126 --- .../nativeMain/resources/gsl/gsl_const_num.h | 43 - .../src/nativeMain/resources/gsl/gsl_deriv.h | 50 -- .../resources/gsl/gsl_dft_complex.h | 55 -- .../resources/gsl/gsl_dft_complex_float.h | 55 -- .../src/nativeMain/resources/gsl/gsl_dht.h | 87 -- .../src/nativeMain/resources/gsl/gsl_diff.h | 52 -- .../src/nativeMain/resources/gsl/gsl_eigen.h | 347 -------- .../src/nativeMain/resources/gsl/gsl_errno.h | 154 ---- .../src/nativeMain/resources/gsl/gsl_fft.h | 51 -- .../resources/gsl/gsl_fft_complex.h | 136 --- .../resources/gsl/gsl_fft_complex_float.h | 139 ---- .../resources/gsl/gsl_fft_halfcomplex.h | 86 -- .../resources/gsl/gsl_fft_halfcomplex_float.h | 86 -- .../nativeMain/resources/gsl/gsl_fft_real.h | 80 -- .../resources/gsl/gsl_fft_real_float.h | 79 -- .../src/nativeMain/resources/gsl/gsl_filter.h | 109 --- .../src/nativeMain/resources/gsl/gsl_fit.h | 85 -- .../nativeMain/resources/gsl/gsl_heapsort.h | 44 - .../nativeMain/resources/gsl/gsl_histogram.h | 134 --- .../resources/gsl/gsl_histogram2d.h | 172 ---- .../nativeMain/resources/gsl/gsl_ieee_utils.h | 99 --- .../src/nativeMain/resources/gsl/gsl_inline.h | 67 -- .../resources/gsl/gsl_integration.h | 390 --------- .../src/nativeMain/resources/gsl/gsl_interp.h | 225 ----- .../nativeMain/resources/gsl/gsl_interp2d.h | 160 ---- .../src/nativeMain/resources/gsl/gsl_linalg.h | 780 ------------------ .../nativeMain/resources/gsl/gsl_machine.h | 104 --- .../src/nativeMain/resources/gsl/gsl_math.h | 164 ---- .../src/nativeMain/resources/gsl/gsl_matrix.h | 25 - .../resources/gsl/gsl_matrix_char.h | 352 -------- .../resources/gsl/gsl_matrix_complex_double.h | 353 -------- .../resources/gsl/gsl_matrix_complex_float.h | 353 -------- .../gsl/gsl_matrix_complex_long_double.h | 353 -------- .../resources/gsl/gsl_matrix_double.h | 352 -------- .../resources/gsl/gsl_matrix_float.h | 352 -------- .../nativeMain/resources/gsl/gsl_matrix_int.h | 352 -------- .../resources/gsl/gsl_matrix_long.h | 352 -------- .../resources/gsl/gsl_matrix_long_double.h | 352 -------- .../resources/gsl/gsl_matrix_short.h | 352 -------- .../resources/gsl/gsl_matrix_uchar.h | 352 -------- .../resources/gsl/gsl_matrix_uint.h | 352 -------- .../resources/gsl/gsl_matrix_ulong.h | 352 -------- .../resources/gsl/gsl_matrix_ushort.h | 352 -------- .../nativeMain/resources/gsl/gsl_message.h | 80 -- .../src/nativeMain/resources/gsl/gsl_min.h | 111 --- .../src/nativeMain/resources/gsl/gsl_minmax.h | 102 --- .../src/nativeMain/resources/gsl/gsl_mode.h | 88 -- .../src/nativeMain/resources/gsl/gsl_monte.h | 55 -- .../resources/gsl/gsl_monte_miser.h | 97 --- .../resources/gsl/gsl_monte_plain.h | 65 -- .../resources/gsl/gsl_monte_vegas.h | 125 --- .../nativeMain/resources/gsl/gsl_movstat.h | 138 ---- .../nativeMain/resources/gsl/gsl_multifit.h | 380 --------- .../resources/gsl/gsl_multifit_nlin.h | 275 ------ .../resources/gsl/gsl_multifit_nlinear.h | 303 ------- .../nativeMain/resources/gsl/gsl_multilarge.h | 141 ---- .../resources/gsl/gsl_multilarge_nlinear.h | 313 ------- .../nativeMain/resources/gsl/gsl_multimin.h | 226 ----- .../nativeMain/resources/gsl/gsl_multiroots.h | 177 ---- .../nativeMain/resources/gsl/gsl_multiset.h | 93 --- .../src/nativeMain/resources/gsl/gsl_nan.h | 45 - .../src/nativeMain/resources/gsl/gsl_ntuple.h | 82 -- .../src/nativeMain/resources/gsl/gsl_odeiv.h | 230 ------ .../src/nativeMain/resources/gsl/gsl_odeiv2.h | 333 -------- .../resources/gsl/gsl_permutation.h | 100 --- .../nativeMain/resources/gsl/gsl_permute.h | 24 - .../resources/gsl/gsl_permute_char.h | 44 - .../gsl/gsl_permute_complex_double.h | 45 - .../resources/gsl/gsl_permute_complex_float.h | 45 - .../gsl/gsl_permute_complex_long_double.h | 45 - .../resources/gsl/gsl_permute_double.h | 44 - .../resources/gsl/gsl_permute_float.h | 44 - .../resources/gsl/gsl_permute_int.h | 44 - .../resources/gsl/gsl_permute_long.h | 44 - .../resources/gsl/gsl_permute_long_double.h | 44 - .../resources/gsl/gsl_permute_matrix.h | 24 - .../resources/gsl/gsl_permute_matrix_char.h | 44 - .../gsl/gsl_permute_matrix_complex_double.h | 44 - .../gsl/gsl_permute_matrix_complex_float.h | 44 - .../gsl_permute_matrix_complex_long_double.h | 44 - .../resources/gsl/gsl_permute_matrix_double.h | 44 - .../resources/gsl/gsl_permute_matrix_float.h | 44 - .../resources/gsl/gsl_permute_matrix_int.h | 44 - .../resources/gsl/gsl_permute_matrix_long.h | 44 - .../gsl/gsl_permute_matrix_long_double.h | 44 - .../resources/gsl/gsl_permute_matrix_short.h | 44 - .../resources/gsl/gsl_permute_matrix_uchar.h | 44 - .../resources/gsl/gsl_permute_matrix_uint.h | 44 - .../resources/gsl/gsl_permute_matrix_ulong.h | 44 - .../resources/gsl/gsl_permute_matrix_ushort.h | 44 - .../resources/gsl/gsl_permute_short.h | 44 - .../resources/gsl/gsl_permute_uchar.h | 44 - .../resources/gsl/gsl_permute_uint.h | 44 - .../resources/gsl/gsl_permute_ulong.h | 44 - .../resources/gsl/gsl_permute_ushort.h | 44 - .../resources/gsl/gsl_permute_vector.h | 24 - .../resources/gsl/gsl_permute_vector_char.h | 45 - .../gsl/gsl_permute_vector_complex_double.h | 45 - .../gsl/gsl_permute_vector_complex_float.h | 45 - .../gsl_permute_vector_complex_long_double.h | 45 - .../resources/gsl/gsl_permute_vector_double.h | 45 - .../resources/gsl/gsl_permute_vector_float.h | 45 - .../resources/gsl/gsl_permute_vector_int.h | 45 - .../resources/gsl/gsl_permute_vector_long.h | 45 - .../gsl/gsl_permute_vector_long_double.h | 45 - .../resources/gsl/gsl_permute_vector_short.h | 45 - .../resources/gsl/gsl_permute_vector_uchar.h | 45 - .../resources/gsl/gsl_permute_vector_uint.h | 45 - .../resources/gsl/gsl_permute_vector_ulong.h | 45 - .../resources/gsl/gsl_permute_vector_ushort.h | 45 - .../src/nativeMain/resources/gsl/gsl_poly.h | 183 ---- .../nativeMain/resources/gsl/gsl_pow_int.h | 61 -- .../nativeMain/resources/gsl/gsl_precision.h | 66 -- .../src/nativeMain/resources/gsl/gsl_qrng.h | 111 --- .../nativeMain/resources/gsl/gsl_randist.h | 219 ----- .../src/nativeMain/resources/gsl/gsl_rng.h | 217 ----- .../src/nativeMain/resources/gsl/gsl_roots.h | 127 --- .../src/nativeMain/resources/gsl/gsl_rstat.h | 81 -- .../src/nativeMain/resources/gsl/gsl_sf.h | 41 - .../nativeMain/resources/gsl/gsl_sf_airy.h | 139 ---- .../nativeMain/resources/gsl/gsl_sf_bessel.h | 549 ------------ .../nativeMain/resources/gsl/gsl_sf_clausen.h | 52 -- .../nativeMain/resources/gsl/gsl_sf_coulomb.h | 128 --- .../resources/gsl/gsl_sf_coupling.h | 125 --- .../nativeMain/resources/gsl/gsl_sf_dawson.h | 52 -- .../nativeMain/resources/gsl/gsl_sf_debye.h | 91 -- .../nativeMain/resources/gsl/gsl_sf_dilog.h | 130 --- .../resources/gsl/gsl_sf_elementary.h | 57 -- .../nativeMain/resources/gsl/gsl_sf_ellint.h | 112 --- .../nativeMain/resources/gsl/gsl_sf_elljac.h | 48 -- .../src/nativeMain/resources/gsl/gsl_sf_erf.h | 91 -- .../src/nativeMain/resources/gsl/gsl_sf_exp.h | 134 --- .../nativeMain/resources/gsl/gsl_sf_expint.h | 167 ---- .../resources/gsl/gsl_sf_fermi_dirac.h | 126 --- .../nativeMain/resources/gsl/gsl_sf_gamma.h | 293 ------- .../resources/gsl/gsl_sf_gegenbauer.h | 73 -- .../nativeMain/resources/gsl/gsl_sf_hermite.h | 75 -- .../nativeMain/resources/gsl/gsl_sf_hyperg.h | 154 ---- .../resources/gsl/gsl_sf_laguerre.h | 68 -- .../nativeMain/resources/gsl/gsl_sf_lambert.h | 69 -- .../resources/gsl/gsl_sf_legendre.h | 375 --------- .../src/nativeMain/resources/gsl/gsl_sf_log.h | 82 -- .../nativeMain/resources/gsl/gsl_sf_mathieu.h | 113 --- .../nativeMain/resources/gsl/gsl_sf_pow_int.h | 49 -- .../src/nativeMain/resources/gsl/gsl_sf_psi.h | 113 --- .../nativeMain/resources/gsl/gsl_sf_result.h | 59 -- .../resources/gsl/gsl_sf_sincos_pi.h | 57 -- .../resources/gsl/gsl_sf_synchrotron.h | 60 -- .../resources/gsl/gsl_sf_transport.h | 78 -- .../nativeMain/resources/gsl/gsl_sf_trig.h | 152 ---- .../nativeMain/resources/gsl/gsl_sf_zeta.h | 112 --- .../src/nativeMain/resources/gsl/gsl_siman.h | 82 -- .../src/nativeMain/resources/gsl/gsl_sort.h | 20 - .../nativeMain/resources/gsl/gsl_sort_char.h | 51 -- .../resources/gsl/gsl_sort_double.h | 51 -- .../nativeMain/resources/gsl/gsl_sort_float.h | 51 -- .../nativeMain/resources/gsl/gsl_sort_int.h | 51 -- .../nativeMain/resources/gsl/gsl_sort_long.h | 51 -- .../resources/gsl/gsl_sort_long_double.h | 51 -- .../nativeMain/resources/gsl/gsl_sort_short.h | 51 -- .../nativeMain/resources/gsl/gsl_sort_uchar.h | 51 -- .../nativeMain/resources/gsl/gsl_sort_uint.h | 51 -- .../nativeMain/resources/gsl/gsl_sort_ulong.h | 51 -- .../resources/gsl/gsl_sort_ushort.h | 51 -- .../resources/gsl/gsl_sort_vector.h | 20 - .../resources/gsl/gsl_sort_vector_char.h | 52 -- .../resources/gsl/gsl_sort_vector_double.h | 52 -- .../resources/gsl/gsl_sort_vector_float.h | 52 -- .../resources/gsl/gsl_sort_vector_int.h | 52 -- .../resources/gsl/gsl_sort_vector_long.h | 52 -- .../gsl/gsl_sort_vector_long_double.h | 52 -- .../resources/gsl/gsl_sort_vector_short.h | 52 -- .../resources/gsl/gsl_sort_vector_uchar.h | 52 -- .../resources/gsl/gsl_sort_vector_uint.h | 52 -- .../resources/gsl/gsl_sort_vector_ulong.h | 52 -- .../resources/gsl/gsl_sort_vector_ushort.h | 52 -- .../src/nativeMain/resources/gsl/gsl_spblas.h | 58 -- .../nativeMain/resources/gsl/gsl_specfunc.h | 10 - .../nativeMain/resources/gsl/gsl_splinalg.h | 79 -- .../src/nativeMain/resources/gsl/gsl_spline.h | 101 --- .../nativeMain/resources/gsl/gsl_spline2d.h | 113 --- .../nativeMain/resources/gsl/gsl_spmatrix.h | 184 ----- .../nativeMain/resources/gsl/gsl_statistics.h | 20 - .../resources/gsl/gsl_statistics_char.h | 96 --- .../resources/gsl/gsl_statistics_double.h | 116 --- .../resources/gsl/gsl_statistics_float.h | 116 --- .../resources/gsl/gsl_statistics_int.h | 96 --- .../resources/gsl/gsl_statistics_long.h | 96 --- .../gsl/gsl_statistics_long_double.h | 116 --- .../resources/gsl/gsl_statistics_short.h | 96 --- .../resources/gsl/gsl_statistics_uchar.h | 96 --- .../resources/gsl/gsl_statistics_uint.h | 96 --- .../resources/gsl/gsl_statistics_ulong.h | 96 --- .../resources/gsl/gsl_statistics_ushort.h | 96 --- .../src/nativeMain/resources/gsl/gsl_sum.h | 162 ---- .../src/nativeMain/resources/gsl/gsl_sys.h | 63 -- .../src/nativeMain/resources/gsl/gsl_test.h | 66 -- .../src/nativeMain/resources/gsl/gsl_types.h | 41 - .../src/nativeMain/resources/gsl/gsl_vector.h | 25 - .../resources/gsl/gsl_vector_char.h | 230 ------ .../resources/gsl/gsl_vector_complex.h | 17 - .../resources/gsl/gsl_vector_complex_double.h | 251 ------ .../resources/gsl/gsl_vector_complex_float.h | 251 ------ .../gsl/gsl_vector_complex_long_double.h | 251 ------ .../resources/gsl/gsl_vector_double.h | 230 ------ .../resources/gsl/gsl_vector_float.h | 230 ------ .../nativeMain/resources/gsl/gsl_vector_int.h | 230 ------ .../resources/gsl/gsl_vector_long.h | 230 ------ .../resources/gsl/gsl_vector_long_double.h | 230 ------ .../resources/gsl/gsl_vector_short.h | 230 ------ .../resources/gsl/gsl_vector_uchar.h | 230 ------ .../resources/gsl/gsl_vector_uint.h | 230 ------ .../resources/gsl/gsl_vector_ulong.h | 230 ------ .../resources/gsl/gsl_vector_ushort.h | 230 ------ .../nativeMain/resources/gsl/gsl_version.h | 26 - .../nativeMain/resources/gsl/gsl_wavelet.h | 100 --- .../nativeMain/resources/gsl/gsl_wavelet2d.h | 107 --- 250 files changed, 3 insertions(+), 29928 deletions(-) delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_blas.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_blas_types.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_char.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_complex_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_complex_float.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_complex_long_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_float.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_int.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_long.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_long_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_short.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_uchar.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_uint.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_ulong.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_block_ushort.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_bspline.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_cblas.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_cdf.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_chebyshev.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_check_range.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_combination.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_complex.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_complex_math.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_const.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_const_cgs.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_const_cgsm.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_const_mks.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_const_mksa.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_const_num.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_deriv.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_dft_complex.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_dft_complex_float.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_dht.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_diff.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_eigen.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_errno.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_fft.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_complex.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_complex_float.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_halfcomplex.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_halfcomplex_float.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_real.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_real_float.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_filter.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_fit.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_heapsort.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_histogram.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_histogram2d.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_ieee_utils.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_inline.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_integration.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_interp.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_interp2d.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_linalg.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_machine.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_math.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_char.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_complex_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_complex_float.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_complex_long_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_float.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_int.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_long.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_long_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_short.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_uchar.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_uint.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_ulong.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_ushort.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_message.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_min.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_minmax.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_mode.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_monte.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_monte_miser.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_monte_plain.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_monte_vegas.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_movstat.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_multifit.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_multifit_nlin.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_multifit_nlinear.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_multilarge.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_multilarge_nlinear.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_multimin.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_multiroots.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_multiset.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_nan.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_ntuple.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_odeiv.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_odeiv2.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permutation.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_char.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_complex_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_complex_float.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_complex_long_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_float.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_int.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_long.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_long_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_char.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_complex_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_complex_float.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_complex_long_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_float.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_int.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_long.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_long_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_short.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_uchar.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_uint.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_ulong.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_ushort.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_short.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_uchar.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_uint.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_ulong.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_ushort.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_char.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_complex_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_complex_float.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_complex_long_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_float.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_int.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_long.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_long_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_short.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_uchar.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_uint.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_ulong.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_ushort.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_poly.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_pow_int.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_precision.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_qrng.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_randist.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_rng.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_roots.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_rstat.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_airy.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_bessel.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_clausen.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_coulomb.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_coupling.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_dawson.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_debye.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_dilog.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_elementary.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_ellint.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_elljac.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_erf.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_exp.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_expint.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_fermi_dirac.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_gamma.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_gegenbauer.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_hermite.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_hyperg.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_laguerre.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_lambert.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_legendre.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_log.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_mathieu.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_pow_int.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_psi.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_result.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_sincos_pi.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_synchrotron.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_transport.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_trig.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_zeta.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_siman.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_char.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_float.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_int.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_long.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_long_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_short.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_uchar.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_uint.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_ulong.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_ushort.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_char.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_float.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_int.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_long.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_long_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_short.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_uchar.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_uint.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_ulong.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_ushort.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_spblas.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_specfunc.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_splinalg.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_spline.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_spline2d.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_spmatrix.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_char.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_float.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_int.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_long.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_long_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_short.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_uchar.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_uint.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_ulong.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_ushort.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sum.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_sys.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_test.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_types.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_char.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex_float.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex_long_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_float.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_int.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_long.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_long_double.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_short.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_uchar.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_uint.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_ulong.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_ushort.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_version.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_wavelet.h delete mode 100644 kmath-gsl/src/nativeMain/resources/gsl/gsl_wavelet2d.h diff --git a/gradle.properties b/gradle.properties index fe2401d09..d25e32240 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ kotlin.code.style=official kotlin.mpp.enableGranularSourceSetsMetadata=true kotlin.mpp.stability.nowarn=true -kotlin.parallel.tasks.in.project=true kotlin.native.ignoreDisabledTargets=true +kotlin.parallel.tasks.in.project=true org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m org.gradle.parallel=true systemProp.org.gradle.internal.publish.checksums.insecure=true diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index 7e6005681..d6503461a 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -20,10 +20,7 @@ kotlin { val main by nativeTarget.compilations.getting { cinterops { - val libgsl by creating { - defFile("src/nativeInterop/cinterop/libgsl.def") - includeDirs { allHeaders("./src/nativeMain/resources/") } - } + val libgsl by creating { includeDirs { headerFilterOnly("/usr/include/") } } } } diff --git a/kmath-gsl/src/nativeInterop/cinterop/libgsl.def b/kmath-gsl/src/nativeInterop/cinterop/libgsl.def index 0f903fe54..e626f6690 100644 --- a/kmath-gsl/src/nativeInterop/cinterop/libgsl.def +++ b/kmath-gsl/src/nativeInterop/cinterop/libgsl.def @@ -1,6 +1,6 @@ package=org.gnu.gsl headers=gsl/gsl_blas.h -headerFilter=gsl/* +headerFilter=gsl/** compilerOpts=-I/usr/include/gsl linkerOpts=-lgsl linkerOpts.linux=-L/usr/lib64 -L/usr/lib/x86_64-linux-gnu diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_blas.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_blas.h deleted file mode 100644 index 7c4271496..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_blas.h +++ /dev/null @@ -1,602 +0,0 @@ -/* blas/gsl_blas.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* - * Author: G. Jungman - */ -#ifndef __GSL_BLAS_H__ -#define __GSL_BLAS_H__ - -#include -#include - -#include - - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* ======================================================================== - * Level 1 - * ======================================================================== - */ - -int gsl_blas_sdsdot (float alpha, - const gsl_vector_float * X, - const gsl_vector_float * Y, - float * result - ); - -int gsl_blas_dsdot (const gsl_vector_float * X, - const gsl_vector_float * Y, - double * result - ); - -int gsl_blas_sdot (const gsl_vector_float * X, - const gsl_vector_float * Y, - float * result - ); - -int gsl_blas_ddot (const gsl_vector * X, - const gsl_vector * Y, - double * result - ); - - -int gsl_blas_cdotu (const gsl_vector_complex_float * X, - const gsl_vector_complex_float * Y, - gsl_complex_float * dotu); - -int gsl_blas_cdotc (const gsl_vector_complex_float * X, - const gsl_vector_complex_float * Y, - gsl_complex_float * dotc); - -int gsl_blas_zdotu (const gsl_vector_complex * X, - const gsl_vector_complex * Y, - gsl_complex * dotu); - -int gsl_blas_zdotc (const gsl_vector_complex * X, - const gsl_vector_complex * Y, - gsl_complex * dotc); - - -float gsl_blas_snrm2 (const gsl_vector_float * X); -float gsl_blas_sasum (const gsl_vector_float * X); -double gsl_blas_dnrm2 (const gsl_vector * X); -double gsl_blas_dasum (const gsl_vector * X); -float gsl_blas_scnrm2 (const gsl_vector_complex_float * X); -float gsl_blas_scasum (const gsl_vector_complex_float * X); -double gsl_blas_dznrm2 (const gsl_vector_complex * X); -double gsl_blas_dzasum (const gsl_vector_complex * X); - - -CBLAS_INDEX_t gsl_blas_isamax (const gsl_vector_float * X); -CBLAS_INDEX_t gsl_blas_idamax (const gsl_vector * X); -CBLAS_INDEX_t gsl_blas_icamax (const gsl_vector_complex_float * X); -CBLAS_INDEX_t gsl_blas_izamax (const gsl_vector_complex * X); - - -int gsl_blas_sswap (gsl_vector_float * X, - gsl_vector_float * Y); - -int gsl_blas_scopy (const gsl_vector_float * X, - gsl_vector_float * Y); - -int gsl_blas_saxpy (float alpha, - const gsl_vector_float * X, - gsl_vector_float * Y); - -int gsl_blas_dswap (gsl_vector * X, - gsl_vector * Y); - -int gsl_blas_dcopy (const gsl_vector * X, - gsl_vector * Y); - -int gsl_blas_daxpy (double alpha, - const gsl_vector * X, - gsl_vector * Y); - -int gsl_blas_cswap (gsl_vector_complex_float * X, - gsl_vector_complex_float * Y); - -int gsl_blas_ccopy (const gsl_vector_complex_float * X, - gsl_vector_complex_float * Y); - -int gsl_blas_caxpy (const gsl_complex_float alpha, - const gsl_vector_complex_float * X, - gsl_vector_complex_float * Y); - -int gsl_blas_zswap (gsl_vector_complex * X, - gsl_vector_complex * Y); - -int gsl_blas_zcopy (const gsl_vector_complex * X, - gsl_vector_complex * Y); - -int gsl_blas_zaxpy (const gsl_complex alpha, - const gsl_vector_complex * X, - gsl_vector_complex * Y); - - -int gsl_blas_srotg (float a[], float b[], float c[], float s[]); - -int gsl_blas_srotmg (float d1[], float d2[], float b1[], float b2, float P[]); - -int gsl_blas_srot (gsl_vector_float * X, - gsl_vector_float * Y, - float c, float s); - -int gsl_blas_srotm (gsl_vector_float * X, - gsl_vector_float * Y, - const float P[]); - -int gsl_blas_drotg (double a[], double b[], double c[], double s[]); - -int gsl_blas_drotmg (double d1[], double d2[], double b1[], - double b2, double P[]); - -int gsl_blas_drot (gsl_vector * X, - gsl_vector * Y, - const double c, const double s); - -int gsl_blas_drotm (gsl_vector * X, - gsl_vector * Y, - const double P[]); - - -void gsl_blas_sscal (float alpha, gsl_vector_float * X); -void gsl_blas_dscal (double alpha, gsl_vector * X); -void gsl_blas_cscal (const gsl_complex_float alpha, gsl_vector_complex_float * X); -void gsl_blas_zscal (const gsl_complex alpha, gsl_vector_complex * X); -void gsl_blas_csscal (float alpha, gsl_vector_complex_float * X); -void gsl_blas_zdscal (double alpha, gsl_vector_complex * X); - - -/* =========================================================================== - * Level 2 - * =========================================================================== - */ - -/* - * Routines with standard 4 prefixes (S, D, C, Z) - */ -int gsl_blas_sgemv (CBLAS_TRANSPOSE_t TransA, - float alpha, - const gsl_matrix_float * A, - const gsl_vector_float * X, - float beta, - gsl_vector_float * Y); - -int gsl_blas_strmv (CBLAS_UPLO_t Uplo, - CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, - const gsl_matrix_float * A, - gsl_vector_float * X); - -int gsl_blas_strsv (CBLAS_UPLO_t Uplo, - CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, - const gsl_matrix_float * A, - gsl_vector_float * X); - -int gsl_blas_dgemv (CBLAS_TRANSPOSE_t TransA, - double alpha, - const gsl_matrix * A, - const gsl_vector * X, - double beta, - gsl_vector * Y); - -int gsl_blas_dtrmv (CBLAS_UPLO_t Uplo, - CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, - const gsl_matrix * A, - gsl_vector * X); - -int gsl_blas_dtrsv (CBLAS_UPLO_t Uplo, - CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, - const gsl_matrix * A, - gsl_vector * X); - -int gsl_blas_cgemv (CBLAS_TRANSPOSE_t TransA, - const gsl_complex_float alpha, - const gsl_matrix_complex_float * A, - const gsl_vector_complex_float * X, - const gsl_complex_float beta, - gsl_vector_complex_float * Y); - -int gsl_blas_ctrmv (CBLAS_UPLO_t Uplo, - CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, - const gsl_matrix_complex_float * A, - gsl_vector_complex_float * X); - -int gsl_blas_ctrsv (CBLAS_UPLO_t Uplo, - CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, - const gsl_matrix_complex_float * A, - gsl_vector_complex_float * X); - -int gsl_blas_zgemv (CBLAS_TRANSPOSE_t TransA, - const gsl_complex alpha, - const gsl_matrix_complex * A, - const gsl_vector_complex * X, - const gsl_complex beta, - gsl_vector_complex * Y); - -int gsl_blas_ztrmv (CBLAS_UPLO_t Uplo, - CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, - const gsl_matrix_complex * A, - gsl_vector_complex * X); - -int gsl_blas_ztrsv (CBLAS_UPLO_t Uplo, - CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, - const gsl_matrix_complex * A, - gsl_vector_complex *X); - -/* - * Routines with S and D prefixes only - */ -int gsl_blas_ssymv (CBLAS_UPLO_t Uplo, - float alpha, - const gsl_matrix_float * A, - const gsl_vector_float * X, - float beta, - gsl_vector_float * Y); - -int gsl_blas_sger (float alpha, - const gsl_vector_float * X, - const gsl_vector_float * Y, - gsl_matrix_float * A); - -int gsl_blas_ssyr (CBLAS_UPLO_t Uplo, - float alpha, - const gsl_vector_float * X, - gsl_matrix_float * A); - -int gsl_blas_ssyr2 (CBLAS_UPLO_t Uplo, - float alpha, - const gsl_vector_float * X, - const gsl_vector_float * Y, - gsl_matrix_float * A); - -int gsl_blas_dsymv (CBLAS_UPLO_t Uplo, - double alpha, - const gsl_matrix * A, - const gsl_vector * X, - double beta, - gsl_vector * Y); -int gsl_blas_dger (double alpha, - const gsl_vector * X, - const gsl_vector * Y, - gsl_matrix * A); - -int gsl_blas_dsyr (CBLAS_UPLO_t Uplo, - double alpha, - const gsl_vector * X, - gsl_matrix * A); - -int gsl_blas_dsyr2 (CBLAS_UPLO_t Uplo, - double alpha, - const gsl_vector * X, - const gsl_vector * Y, - gsl_matrix * A); - -/* - * Routines with C and Z prefixes only - */ - -int gsl_blas_chemv (CBLAS_UPLO_t Uplo, - const gsl_complex_float alpha, - const gsl_matrix_complex_float * A, - const gsl_vector_complex_float * X, - const gsl_complex_float beta, - gsl_vector_complex_float * Y); - -int gsl_blas_cgeru (const gsl_complex_float alpha, - const gsl_vector_complex_float * X, - const gsl_vector_complex_float * Y, - gsl_matrix_complex_float * A); - -int gsl_blas_cgerc (const gsl_complex_float alpha, - const gsl_vector_complex_float * X, - const gsl_vector_complex_float * Y, - gsl_matrix_complex_float * A); - -int gsl_blas_cher (CBLAS_UPLO_t Uplo, - float alpha, - const gsl_vector_complex_float * X, - gsl_matrix_complex_float * A); - -int gsl_blas_cher2 (CBLAS_UPLO_t Uplo, - const gsl_complex_float alpha, - const gsl_vector_complex_float * X, - const gsl_vector_complex_float * Y, - gsl_matrix_complex_float * A); - -int gsl_blas_zhemv (CBLAS_UPLO_t Uplo, - const gsl_complex alpha, - const gsl_matrix_complex * A, - const gsl_vector_complex * X, - const gsl_complex beta, - gsl_vector_complex * Y); - -int gsl_blas_zgeru (const gsl_complex alpha, - const gsl_vector_complex * X, - const gsl_vector_complex * Y, - gsl_matrix_complex * A); - -int gsl_blas_zgerc (const gsl_complex alpha, - const gsl_vector_complex * X, - const gsl_vector_complex * Y, - gsl_matrix_complex * A); - -int gsl_blas_zher (CBLAS_UPLO_t Uplo, - double alpha, - const gsl_vector_complex * X, - gsl_matrix_complex * A); - -int gsl_blas_zher2 (CBLAS_UPLO_t Uplo, - const gsl_complex alpha, - const gsl_vector_complex * X, - const gsl_vector_complex * Y, - gsl_matrix_complex * A); - -/* - * =========================================================================== - * Prototypes for level 3 BLAS - * =========================================================================== - */ - -/* - * Routines with standard 4 prefixes (S, D, C, Z) - */ -int gsl_blas_sgemm (CBLAS_TRANSPOSE_t TransA, - CBLAS_TRANSPOSE_t TransB, - float alpha, - const gsl_matrix_float * A, - const gsl_matrix_float * B, - float beta, - gsl_matrix_float * C); - -int gsl_blas_ssymm (CBLAS_SIDE_t Side, CBLAS_UPLO_t Uplo, - float alpha, - const gsl_matrix_float * A, - const gsl_matrix_float * B, - float beta, - gsl_matrix_float * C); - -int gsl_blas_ssyrk (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t Trans, - float alpha, - const gsl_matrix_float * A, - float beta, - gsl_matrix_float * C); - -int gsl_blas_ssyr2k (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t Trans, - float alpha, - const gsl_matrix_float * A, - const gsl_matrix_float * B, - float beta, - gsl_matrix_float * C); - -int gsl_blas_strmm (CBLAS_SIDE_t Side, - CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, - CBLAS_DIAG_t Diag, - float alpha, - const gsl_matrix_float * A, - gsl_matrix_float * B); - -int gsl_blas_strsm (CBLAS_SIDE_t Side, - CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, - CBLAS_DIAG_t Diag, - float alpha, - const gsl_matrix_float * A, - gsl_matrix_float * B); - -int gsl_blas_dgemm (CBLAS_TRANSPOSE_t TransA, - CBLAS_TRANSPOSE_t TransB, - double alpha, - const gsl_matrix * A, - const gsl_matrix * B, - double beta, - gsl_matrix * C); - -int gsl_blas_dsymm (CBLAS_SIDE_t Side, - CBLAS_UPLO_t Uplo, - double alpha, - const gsl_matrix * A, - const gsl_matrix * B, - double beta, - gsl_matrix * C); - -int gsl_blas_dsyrk (CBLAS_UPLO_t Uplo, - CBLAS_TRANSPOSE_t Trans, - double alpha, - const gsl_matrix * A, - double beta, - gsl_matrix * C); - -int gsl_blas_dsyr2k (CBLAS_UPLO_t Uplo, - CBLAS_TRANSPOSE_t Trans, - double alpha, - const gsl_matrix * A, - const gsl_matrix * B, - double beta, - gsl_matrix * C); - -int gsl_blas_dtrmm (CBLAS_SIDE_t Side, - CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, - CBLAS_DIAG_t Diag, - double alpha, - const gsl_matrix * A, - gsl_matrix * B); - -int gsl_blas_dtrsm (CBLAS_SIDE_t Side, - CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, - CBLAS_DIAG_t Diag, - double alpha, - const gsl_matrix * A, - gsl_matrix * B); - -int gsl_blas_cgemm (CBLAS_TRANSPOSE_t TransA, - CBLAS_TRANSPOSE_t TransB, - const gsl_complex_float alpha, - const gsl_matrix_complex_float * A, - const gsl_matrix_complex_float * B, - const gsl_complex_float beta, - gsl_matrix_complex_float * C); - -int gsl_blas_csymm (CBLAS_SIDE_t Side, - CBLAS_UPLO_t Uplo, - const gsl_complex_float alpha, - const gsl_matrix_complex_float * A, - const gsl_matrix_complex_float * B, - const gsl_complex_float beta, - gsl_matrix_complex_float * C); - -int gsl_blas_csyrk (CBLAS_UPLO_t Uplo, - CBLAS_TRANSPOSE_t Trans, - const gsl_complex_float alpha, - const gsl_matrix_complex_float * A, - const gsl_complex_float beta, - gsl_matrix_complex_float * C); - -int gsl_blas_csyr2k (CBLAS_UPLO_t Uplo, - CBLAS_TRANSPOSE_t Trans, - const gsl_complex_float alpha, - const gsl_matrix_complex_float * A, - const gsl_matrix_complex_float * B, - const gsl_complex_float beta, - gsl_matrix_complex_float * C); - -int gsl_blas_ctrmm (CBLAS_SIDE_t Side, - CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, - CBLAS_DIAG_t Diag, - const gsl_complex_float alpha, - const gsl_matrix_complex_float * A, - gsl_matrix_complex_float * B); - -int gsl_blas_ctrsm (CBLAS_SIDE_t Side, - CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, - CBLAS_DIAG_t Diag, - const gsl_complex_float alpha, - const gsl_matrix_complex_float * A, - gsl_matrix_complex_float * B); - -int gsl_blas_zgemm (CBLAS_TRANSPOSE_t TransA, - CBLAS_TRANSPOSE_t TransB, - const gsl_complex alpha, - const gsl_matrix_complex * A, - const gsl_matrix_complex * B, - const gsl_complex beta, - gsl_matrix_complex * C); - -int gsl_blas_zsymm (CBLAS_SIDE_t Side, - CBLAS_UPLO_t Uplo, - const gsl_complex alpha, - const gsl_matrix_complex * A, - const gsl_matrix_complex * B, - const gsl_complex beta, - gsl_matrix_complex * C); - -int gsl_blas_zsyrk (CBLAS_UPLO_t Uplo, - CBLAS_TRANSPOSE_t Trans, - const gsl_complex alpha, - const gsl_matrix_complex * A, - const gsl_complex beta, - gsl_matrix_complex * C); - -int gsl_blas_zsyr2k (CBLAS_UPLO_t Uplo, - CBLAS_TRANSPOSE_t Trans, - const gsl_complex alpha, - const gsl_matrix_complex * A, - const gsl_matrix_complex * B, - const gsl_complex beta, - gsl_matrix_complex *C); - -int gsl_blas_ztrmm (CBLAS_SIDE_t Side, - CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, - CBLAS_DIAG_t Diag, - const gsl_complex alpha, - const gsl_matrix_complex * A, - gsl_matrix_complex * B); - -int gsl_blas_ztrsm (CBLAS_SIDE_t Side, - CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, - CBLAS_DIAG_t Diag, - const gsl_complex alpha, - const gsl_matrix_complex * A, - gsl_matrix_complex * B); - -/* - * Routines with prefixes C and Z only - */ -int gsl_blas_chemm (CBLAS_SIDE_t Side, - CBLAS_UPLO_t Uplo, - const gsl_complex_float alpha, - const gsl_matrix_complex_float * A, - const gsl_matrix_complex_float * B, - const gsl_complex_float beta, - gsl_matrix_complex_float * C); - -int gsl_blas_cherk (CBLAS_UPLO_t Uplo, - CBLAS_TRANSPOSE_t Trans, - float alpha, - const gsl_matrix_complex_float * A, - float beta, - gsl_matrix_complex_float * C); - -int gsl_blas_cher2k (CBLAS_UPLO_t Uplo, - CBLAS_TRANSPOSE_t Trans, - const gsl_complex_float alpha, - const gsl_matrix_complex_float * A, - const gsl_matrix_complex_float * B, - float beta, - gsl_matrix_complex_float * C); - -int gsl_blas_zhemm (CBLAS_SIDE_t Side, - CBLAS_UPLO_t Uplo, - const gsl_complex alpha, - const gsl_matrix_complex * A, - const gsl_matrix_complex * B, - const gsl_complex beta, - gsl_matrix_complex * C); - -int gsl_blas_zherk (CBLAS_UPLO_t Uplo, - CBLAS_TRANSPOSE_t Trans, - double alpha, - const gsl_matrix_complex * A, - double beta, - gsl_matrix_complex * C); - -int gsl_blas_zher2k (CBLAS_UPLO_t Uplo, - CBLAS_TRANSPOSE_t Trans, - const gsl_complex alpha, - const gsl_matrix_complex * A, - const gsl_matrix_complex * B, - double beta, - gsl_matrix_complex * C); - - -__END_DECLS - -#endif /* __GSL_BLAS_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_blas_types.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_blas_types.h deleted file mode 100644 index 923edb310..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_blas_types.h +++ /dev/null @@ -1,54 +0,0 @@ -/* blas/gsl_blas_types.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* - * Author: G. Jungman - */ -/* Based on draft BLAST C interface specification [Jul 7 1998] - */ -#ifndef __GSL_BLAS_TYPES_H__ -#define __GSL_BLAS_TYPES_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef CBLAS_INDEX CBLAS_INDEX_t; -typedef enum CBLAS_ORDER CBLAS_ORDER_t; -typedef enum CBLAS_TRANSPOSE CBLAS_TRANSPOSE_t; -typedef enum CBLAS_UPLO CBLAS_UPLO_t; -typedef enum CBLAS_DIAG CBLAS_DIAG_t; -typedef enum CBLAS_SIDE CBLAS_SIDE_t; - -/* typedef gsl_complex COMPLEX; */ - -__END_DECLS - - -#endif /* __GSL_BLAS_TYPES_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block.h deleted file mode 100644 index f1f9ef87e..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __GSL_BLOCK_H__ -#define __GSL_BLOCK_H__ - -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include - -#include -#include - -#endif /* __GSL_BLOCK_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_char.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_char.h deleted file mode 100644 index 70bf969fe..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_char.h +++ /dev/null @@ -1,65 +0,0 @@ -/* block/gsl_block_char.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_BLOCK_CHAR_H__ -#define __GSL_BLOCK_CHAR_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -struct gsl_block_char_struct -{ - size_t size; - char *data; -}; - -typedef struct gsl_block_char_struct gsl_block_char; - -gsl_block_char *gsl_block_char_alloc (const size_t n); -gsl_block_char *gsl_block_char_calloc (const size_t n); -void gsl_block_char_free (gsl_block_char * b); - -int gsl_block_char_fread (FILE * stream, gsl_block_char * b); -int gsl_block_char_fwrite (FILE * stream, const gsl_block_char * b); -int gsl_block_char_fscanf (FILE * stream, gsl_block_char * b); -int gsl_block_char_fprintf (FILE * stream, const gsl_block_char * b, const char *format); - -int gsl_block_char_raw_fread (FILE * stream, char * b, const size_t n, const size_t stride); -int gsl_block_char_raw_fwrite (FILE * stream, const char * b, const size_t n, const size_t stride); -int gsl_block_char_raw_fscanf (FILE * stream, char * b, const size_t n, const size_t stride); -int gsl_block_char_raw_fprintf (FILE * stream, const char * b, const size_t n, const size_t stride, const char *format); - -size_t gsl_block_char_size (const gsl_block_char * b); -char * gsl_block_char_data (const gsl_block_char * b); - -__END_DECLS - -#endif /* __GSL_BLOCK_CHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_complex_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_complex_double.h deleted file mode 100644 index bcf66c08a..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_complex_double.h +++ /dev/null @@ -1,65 +0,0 @@ -/* block/gsl_block_complex_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_BLOCK_COMPLEX_DOUBLE_H__ -#define __GSL_BLOCK_COMPLEX_DOUBLE_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -struct gsl_block_complex_struct -{ - size_t size; - double *data; -}; - -typedef struct gsl_block_complex_struct gsl_block_complex; - -gsl_block_complex *gsl_block_complex_alloc (const size_t n); -gsl_block_complex *gsl_block_complex_calloc (const size_t n); -void gsl_block_complex_free (gsl_block_complex * b); - -int gsl_block_complex_fread (FILE * stream, gsl_block_complex * b); -int gsl_block_complex_fwrite (FILE * stream, const gsl_block_complex * b); -int gsl_block_complex_fscanf (FILE * stream, gsl_block_complex * b); -int gsl_block_complex_fprintf (FILE * stream, const gsl_block_complex * b, const char *format); - -int gsl_block_complex_raw_fread (FILE * stream, double * b, const size_t n, const size_t stride); -int gsl_block_complex_raw_fwrite (FILE * stream, const double * b, const size_t n, const size_t stride); -int gsl_block_complex_raw_fscanf (FILE * stream, double * b, const size_t n, const size_t stride); -int gsl_block_complex_raw_fprintf (FILE * stream, const double * b, const size_t n, const size_t stride, const char *format); - -size_t gsl_block_complex_size (const gsl_block_complex * b); -double * gsl_block_complex_data (const gsl_block_complex * b); - -__END_DECLS - -#endif /* __GSL_BLOCK_COMPLEX_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_complex_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_complex_float.h deleted file mode 100644 index 03595dc9f..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_complex_float.h +++ /dev/null @@ -1,65 +0,0 @@ -/* block/gsl_block_complex_float.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_BLOCK_COMPLEX_FLOAT_H__ -#define __GSL_BLOCK_COMPLEX_FLOAT_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -struct gsl_block_complex_float_struct -{ - size_t size; - float *data; -}; - -typedef struct gsl_block_complex_float_struct gsl_block_complex_float; - -gsl_block_complex_float *gsl_block_complex_float_alloc (const size_t n); -gsl_block_complex_float *gsl_block_complex_float_calloc (const size_t n); -void gsl_block_complex_float_free (gsl_block_complex_float * b); - -int gsl_block_complex_float_fread (FILE * stream, gsl_block_complex_float * b); -int gsl_block_complex_float_fwrite (FILE * stream, const gsl_block_complex_float * b); -int gsl_block_complex_float_fscanf (FILE * stream, gsl_block_complex_float * b); -int gsl_block_complex_float_fprintf (FILE * stream, const gsl_block_complex_float * b, const char *format); - -int gsl_block_complex_float_raw_fread (FILE * stream, float * b, const size_t n, const size_t stride); -int gsl_block_complex_float_raw_fwrite (FILE * stream, const float * b, const size_t n, const size_t stride); -int gsl_block_complex_float_raw_fscanf (FILE * stream, float * b, const size_t n, const size_t stride); -int gsl_block_complex_float_raw_fprintf (FILE * stream, const float * b, const size_t n, const size_t stride, const char *format); - -size_t gsl_block_complex_float_size (const gsl_block_complex_float * b); -float * gsl_block_complex_float_data (const gsl_block_complex_float * b); - -__END_DECLS - -#endif /* __GSL_BLOCK_COMPLEX_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_complex_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_complex_long_double.h deleted file mode 100644 index eb0c60515..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_complex_long_double.h +++ /dev/null @@ -1,65 +0,0 @@ -/* block/gsl_block_complex_long_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_BLOCK_COMPLEX_LONG_DOUBLE_H__ -#define __GSL_BLOCK_COMPLEX_LONG_DOUBLE_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -struct gsl_block_complex_long_double_struct -{ - size_t size; - long double *data; -}; - -typedef struct gsl_block_complex_long_double_struct gsl_block_complex_long_double; - -gsl_block_complex_long_double *gsl_block_complex_long_double_alloc (const size_t n); -gsl_block_complex_long_double *gsl_block_complex_long_double_calloc (const size_t n); -void gsl_block_complex_long_double_free (gsl_block_complex_long_double * b); - -int gsl_block_complex_long_double_fread (FILE * stream, gsl_block_complex_long_double * b); -int gsl_block_complex_long_double_fwrite (FILE * stream, const gsl_block_complex_long_double * b); -int gsl_block_complex_long_double_fscanf (FILE * stream, gsl_block_complex_long_double * b); -int gsl_block_complex_long_double_fprintf (FILE * stream, const gsl_block_complex_long_double * b, const char *format); - -int gsl_block_complex_long_double_raw_fread (FILE * stream, long double * b, const size_t n, const size_t stride); -int gsl_block_complex_long_double_raw_fwrite (FILE * stream, const long double * b, const size_t n, const size_t stride); -int gsl_block_complex_long_double_raw_fscanf (FILE * stream, long double * b, const size_t n, const size_t stride); -int gsl_block_complex_long_double_raw_fprintf (FILE * stream, const long double * b, const size_t n, const size_t stride, const char *format); - -size_t gsl_block_complex_long_double_size (const gsl_block_complex_long_double * b); -long double * gsl_block_complex_long_double_data (const gsl_block_complex_long_double * b); - -__END_DECLS - -#endif /* __GSL_BLOCK_COMPLEX_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_double.h deleted file mode 100644 index 3a95f4d56..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_double.h +++ /dev/null @@ -1,65 +0,0 @@ -/* block/gsl_block_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_BLOCK_DOUBLE_H__ -#define __GSL_BLOCK_DOUBLE_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -struct gsl_block_struct -{ - size_t size; - double *data; -}; - -typedef struct gsl_block_struct gsl_block; - -gsl_block *gsl_block_alloc (const size_t n); -gsl_block *gsl_block_calloc (const size_t n); -void gsl_block_free (gsl_block * b); - -int gsl_block_fread (FILE * stream, gsl_block * b); -int gsl_block_fwrite (FILE * stream, const gsl_block * b); -int gsl_block_fscanf (FILE * stream, gsl_block * b); -int gsl_block_fprintf (FILE * stream, const gsl_block * b, const char *format); - -int gsl_block_raw_fread (FILE * stream, double * b, const size_t n, const size_t stride); -int gsl_block_raw_fwrite (FILE * stream, const double * b, const size_t n, const size_t stride); -int gsl_block_raw_fscanf (FILE * stream, double * b, const size_t n, const size_t stride); -int gsl_block_raw_fprintf (FILE * stream, const double * b, const size_t n, const size_t stride, const char *format); - -size_t gsl_block_size (const gsl_block * b); -double * gsl_block_data (const gsl_block * b); - -__END_DECLS - -#endif /* __GSL_BLOCK_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_float.h deleted file mode 100644 index f1c3fb35f..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_float.h +++ /dev/null @@ -1,65 +0,0 @@ -/* block/gsl_block_float.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_BLOCK_FLOAT_H__ -#define __GSL_BLOCK_FLOAT_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -struct gsl_block_float_struct -{ - size_t size; - float *data; -}; - -typedef struct gsl_block_float_struct gsl_block_float; - -gsl_block_float *gsl_block_float_alloc (const size_t n); -gsl_block_float *gsl_block_float_calloc (const size_t n); -void gsl_block_float_free (gsl_block_float * b); - -int gsl_block_float_fread (FILE * stream, gsl_block_float * b); -int gsl_block_float_fwrite (FILE * stream, const gsl_block_float * b); -int gsl_block_float_fscanf (FILE * stream, gsl_block_float * b); -int gsl_block_float_fprintf (FILE * stream, const gsl_block_float * b, const char *format); - -int gsl_block_float_raw_fread (FILE * stream, float * b, const size_t n, const size_t stride); -int gsl_block_float_raw_fwrite (FILE * stream, const float * b, const size_t n, const size_t stride); -int gsl_block_float_raw_fscanf (FILE * stream, float * b, const size_t n, const size_t stride); -int gsl_block_float_raw_fprintf (FILE * stream, const float * b, const size_t n, const size_t stride, const char *format); - -size_t gsl_block_float_size (const gsl_block_float * b); -float * gsl_block_float_data (const gsl_block_float * b); - -__END_DECLS - -#endif /* __GSL_BLOCK_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_int.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_int.h deleted file mode 100644 index 2213f4701..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_int.h +++ /dev/null @@ -1,65 +0,0 @@ -/* block/gsl_block_int.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_BLOCK_INT_H__ -#define __GSL_BLOCK_INT_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -struct gsl_block_int_struct -{ - size_t size; - int *data; -}; - -typedef struct gsl_block_int_struct gsl_block_int; - -gsl_block_int *gsl_block_int_alloc (const size_t n); -gsl_block_int *gsl_block_int_calloc (const size_t n); -void gsl_block_int_free (gsl_block_int * b); - -int gsl_block_int_fread (FILE * stream, gsl_block_int * b); -int gsl_block_int_fwrite (FILE * stream, const gsl_block_int * b); -int gsl_block_int_fscanf (FILE * stream, gsl_block_int * b); -int gsl_block_int_fprintf (FILE * stream, const gsl_block_int * b, const char *format); - -int gsl_block_int_raw_fread (FILE * stream, int * b, const size_t n, const size_t stride); -int gsl_block_int_raw_fwrite (FILE * stream, const int * b, const size_t n, const size_t stride); -int gsl_block_int_raw_fscanf (FILE * stream, int * b, const size_t n, const size_t stride); -int gsl_block_int_raw_fprintf (FILE * stream, const int * b, const size_t n, const size_t stride, const char *format); - -size_t gsl_block_int_size (const gsl_block_int * b); -int * gsl_block_int_data (const gsl_block_int * b); - -__END_DECLS - -#endif /* __GSL_BLOCK_INT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_long.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_long.h deleted file mode 100644 index 0c30aa5e4..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_long.h +++ /dev/null @@ -1,65 +0,0 @@ -/* block/gsl_block_long.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_BLOCK_LONG_H__ -#define __GSL_BLOCK_LONG_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -struct gsl_block_long_struct -{ - size_t size; - long *data; -}; - -typedef struct gsl_block_long_struct gsl_block_long; - -gsl_block_long *gsl_block_long_alloc (const size_t n); -gsl_block_long *gsl_block_long_calloc (const size_t n); -void gsl_block_long_free (gsl_block_long * b); - -int gsl_block_long_fread (FILE * stream, gsl_block_long * b); -int gsl_block_long_fwrite (FILE * stream, const gsl_block_long * b); -int gsl_block_long_fscanf (FILE * stream, gsl_block_long * b); -int gsl_block_long_fprintf (FILE * stream, const gsl_block_long * b, const char *format); - -int gsl_block_long_raw_fread (FILE * stream, long * b, const size_t n, const size_t stride); -int gsl_block_long_raw_fwrite (FILE * stream, const long * b, const size_t n, const size_t stride); -int gsl_block_long_raw_fscanf (FILE * stream, long * b, const size_t n, const size_t stride); -int gsl_block_long_raw_fprintf (FILE * stream, const long * b, const size_t n, const size_t stride, const char *format); - -size_t gsl_block_long_size (const gsl_block_long * b); -long * gsl_block_long_data (const gsl_block_long * b); - -__END_DECLS - -#endif /* __GSL_BLOCK_LONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_long_double.h deleted file mode 100644 index 639cd8150..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_long_double.h +++ /dev/null @@ -1,65 +0,0 @@ -/* block/gsl_block_long_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_BLOCK_LONG_DOUBLE_H__ -#define __GSL_BLOCK_LONG_DOUBLE_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -struct gsl_block_long_double_struct -{ - size_t size; - long double *data; -}; - -typedef struct gsl_block_long_double_struct gsl_block_long_double; - -gsl_block_long_double *gsl_block_long_double_alloc (const size_t n); -gsl_block_long_double *gsl_block_long_double_calloc (const size_t n); -void gsl_block_long_double_free (gsl_block_long_double * b); - -int gsl_block_long_double_fread (FILE * stream, gsl_block_long_double * b); -int gsl_block_long_double_fwrite (FILE * stream, const gsl_block_long_double * b); -int gsl_block_long_double_fscanf (FILE * stream, gsl_block_long_double * b); -int gsl_block_long_double_fprintf (FILE * stream, const gsl_block_long_double * b, const char *format); - -int gsl_block_long_double_raw_fread (FILE * stream, long double * b, const size_t n, const size_t stride); -int gsl_block_long_double_raw_fwrite (FILE * stream, const long double * b, const size_t n, const size_t stride); -int gsl_block_long_double_raw_fscanf (FILE * stream, long double * b, const size_t n, const size_t stride); -int gsl_block_long_double_raw_fprintf (FILE * stream, const long double * b, const size_t n, const size_t stride, const char *format); - -size_t gsl_block_long_double_size (const gsl_block_long_double * b); -long double * gsl_block_long_double_data (const gsl_block_long_double * b); - -__END_DECLS - -#endif /* __GSL_BLOCK_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_short.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_short.h deleted file mode 100644 index 97447755c..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_short.h +++ /dev/null @@ -1,65 +0,0 @@ -/* block/gsl_block_short.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_BLOCK_SHORT_H__ -#define __GSL_BLOCK_SHORT_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -struct gsl_block_short_struct -{ - size_t size; - short *data; -}; - -typedef struct gsl_block_short_struct gsl_block_short; - -gsl_block_short *gsl_block_short_alloc (const size_t n); -gsl_block_short *gsl_block_short_calloc (const size_t n); -void gsl_block_short_free (gsl_block_short * b); - -int gsl_block_short_fread (FILE * stream, gsl_block_short * b); -int gsl_block_short_fwrite (FILE * stream, const gsl_block_short * b); -int gsl_block_short_fscanf (FILE * stream, gsl_block_short * b); -int gsl_block_short_fprintf (FILE * stream, const gsl_block_short * b, const char *format); - -int gsl_block_short_raw_fread (FILE * stream, short * b, const size_t n, const size_t stride); -int gsl_block_short_raw_fwrite (FILE * stream, const short * b, const size_t n, const size_t stride); -int gsl_block_short_raw_fscanf (FILE * stream, short * b, const size_t n, const size_t stride); -int gsl_block_short_raw_fprintf (FILE * stream, const short * b, const size_t n, const size_t stride, const char *format); - -size_t gsl_block_short_size (const gsl_block_short * b); -short * gsl_block_short_data (const gsl_block_short * b); - -__END_DECLS - -#endif /* __GSL_BLOCK_SHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_uchar.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_uchar.h deleted file mode 100644 index 58cf789dc..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_uchar.h +++ /dev/null @@ -1,65 +0,0 @@ -/* block/gsl_block_uchar.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_BLOCK_UCHAR_H__ -#define __GSL_BLOCK_UCHAR_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -struct gsl_block_uchar_struct -{ - size_t size; - unsigned char *data; -}; - -typedef struct gsl_block_uchar_struct gsl_block_uchar; - -gsl_block_uchar *gsl_block_uchar_alloc (const size_t n); -gsl_block_uchar *gsl_block_uchar_calloc (const size_t n); -void gsl_block_uchar_free (gsl_block_uchar * b); - -int gsl_block_uchar_fread (FILE * stream, gsl_block_uchar * b); -int gsl_block_uchar_fwrite (FILE * stream, const gsl_block_uchar * b); -int gsl_block_uchar_fscanf (FILE * stream, gsl_block_uchar * b); -int gsl_block_uchar_fprintf (FILE * stream, const gsl_block_uchar * b, const char *format); - -int gsl_block_uchar_raw_fread (FILE * stream, unsigned char * b, const size_t n, const size_t stride); -int gsl_block_uchar_raw_fwrite (FILE * stream, const unsigned char * b, const size_t n, const size_t stride); -int gsl_block_uchar_raw_fscanf (FILE * stream, unsigned char * b, const size_t n, const size_t stride); -int gsl_block_uchar_raw_fprintf (FILE * stream, const unsigned char * b, const size_t n, const size_t stride, const char *format); - -size_t gsl_block_uchar_size (const gsl_block_uchar * b); -unsigned char * gsl_block_uchar_data (const gsl_block_uchar * b); - -__END_DECLS - -#endif /* __GSL_BLOCK_UCHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_uint.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_uint.h deleted file mode 100644 index 52cf2cbec..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_uint.h +++ /dev/null @@ -1,65 +0,0 @@ -/* block/gsl_block_uint.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_BLOCK_UINT_H__ -#define __GSL_BLOCK_UINT_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -struct gsl_block_uint_struct -{ - size_t size; - unsigned int *data; -}; - -typedef struct gsl_block_uint_struct gsl_block_uint; - -gsl_block_uint *gsl_block_uint_alloc (const size_t n); -gsl_block_uint *gsl_block_uint_calloc (const size_t n); -void gsl_block_uint_free (gsl_block_uint * b); - -int gsl_block_uint_fread (FILE * stream, gsl_block_uint * b); -int gsl_block_uint_fwrite (FILE * stream, const gsl_block_uint * b); -int gsl_block_uint_fscanf (FILE * stream, gsl_block_uint * b); -int gsl_block_uint_fprintf (FILE * stream, const gsl_block_uint * b, const char *format); - -int gsl_block_uint_raw_fread (FILE * stream, unsigned int * b, const size_t n, const size_t stride); -int gsl_block_uint_raw_fwrite (FILE * stream, const unsigned int * b, const size_t n, const size_t stride); -int gsl_block_uint_raw_fscanf (FILE * stream, unsigned int * b, const size_t n, const size_t stride); -int gsl_block_uint_raw_fprintf (FILE * stream, const unsigned int * b, const size_t n, const size_t stride, const char *format); - -size_t gsl_block_uint_size (const gsl_block_uint * b); -unsigned int * gsl_block_uint_data (const gsl_block_uint * b); - -__END_DECLS - -#endif /* __GSL_BLOCK_UINT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_ulong.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_ulong.h deleted file mode 100644 index 863ff4759..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_ulong.h +++ /dev/null @@ -1,65 +0,0 @@ -/* block/gsl_block_ulong.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_BLOCK_ULONG_H__ -#define __GSL_BLOCK_ULONG_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -struct gsl_block_ulong_struct -{ - size_t size; - unsigned long *data; -}; - -typedef struct gsl_block_ulong_struct gsl_block_ulong; - -gsl_block_ulong *gsl_block_ulong_alloc (const size_t n); -gsl_block_ulong *gsl_block_ulong_calloc (const size_t n); -void gsl_block_ulong_free (gsl_block_ulong * b); - -int gsl_block_ulong_fread (FILE * stream, gsl_block_ulong * b); -int gsl_block_ulong_fwrite (FILE * stream, const gsl_block_ulong * b); -int gsl_block_ulong_fscanf (FILE * stream, gsl_block_ulong * b); -int gsl_block_ulong_fprintf (FILE * stream, const gsl_block_ulong * b, const char *format); - -int gsl_block_ulong_raw_fread (FILE * stream, unsigned long * b, const size_t n, const size_t stride); -int gsl_block_ulong_raw_fwrite (FILE * stream, const unsigned long * b, const size_t n, const size_t stride); -int gsl_block_ulong_raw_fscanf (FILE * stream, unsigned long * b, const size_t n, const size_t stride); -int gsl_block_ulong_raw_fprintf (FILE * stream, const unsigned long * b, const size_t n, const size_t stride, const char *format); - -size_t gsl_block_ulong_size (const gsl_block_ulong * b); -unsigned long * gsl_block_ulong_data (const gsl_block_ulong * b); - -__END_DECLS - -#endif /* __GSL_BLOCK_ULONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_ushort.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_ushort.h deleted file mode 100644 index 24ad7dbff..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_block_ushort.h +++ /dev/null @@ -1,65 +0,0 @@ -/* block/gsl_block_ushort.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_BLOCK_USHORT_H__ -#define __GSL_BLOCK_USHORT_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -struct gsl_block_ushort_struct -{ - size_t size; - unsigned short *data; -}; - -typedef struct gsl_block_ushort_struct gsl_block_ushort; - -gsl_block_ushort *gsl_block_ushort_alloc (const size_t n); -gsl_block_ushort *gsl_block_ushort_calloc (const size_t n); -void gsl_block_ushort_free (gsl_block_ushort * b); - -int gsl_block_ushort_fread (FILE * stream, gsl_block_ushort * b); -int gsl_block_ushort_fwrite (FILE * stream, const gsl_block_ushort * b); -int gsl_block_ushort_fscanf (FILE * stream, gsl_block_ushort * b); -int gsl_block_ushort_fprintf (FILE * stream, const gsl_block_ushort * b, const char *format); - -int gsl_block_ushort_raw_fread (FILE * stream, unsigned short * b, const size_t n, const size_t stride); -int gsl_block_ushort_raw_fwrite (FILE * stream, const unsigned short * b, const size_t n, const size_t stride); -int gsl_block_ushort_raw_fscanf (FILE * stream, unsigned short * b, const size_t n, const size_t stride); -int gsl_block_ushort_raw_fprintf (FILE * stream, const unsigned short * b, const size_t n, const size_t stride, const char *format); - -size_t gsl_block_ushort_size (const gsl_block_ushort * b); -unsigned short * gsl_block_ushort_data (const gsl_block_ushort * b); - -__END_DECLS - -#endif /* __GSL_BLOCK_USHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_bspline.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_bspline.h deleted file mode 100644 index 878fe498a..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_bspline.h +++ /dev/null @@ -1,108 +0,0 @@ -/* bspline/gsl_bspline.h - * - * Copyright (C) 2006 Patrick Alken - * Copyright (C) 2008 Rhys Ulerich - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_BSPLINE_H__ -#define __GSL_BSPLINE_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t k; /* spline order */ - size_t km1; /* k - 1 (polynomial order) */ - size_t l; /* number of polynomial pieces on interval */ - size_t nbreak; /* number of breakpoints (l + 1) */ - size_t n; /* number of bspline basis functions (l + k - 1) */ - - gsl_vector *knots; /* knots vector */ - gsl_vector *deltal; /* left delta */ - gsl_vector *deltar; /* right delta */ - gsl_vector *B; /* temporary spline results */ - - /* bspline derivative parameters */ - gsl_matrix *A; /* work matrix */ - gsl_matrix *dB; /* temporary derivative results */ -} gsl_bspline_workspace; - -gsl_bspline_workspace * -gsl_bspline_alloc(const size_t k, const size_t nbreak); - -void gsl_bspline_free(gsl_bspline_workspace *w); - -size_t gsl_bspline_ncoeffs(gsl_bspline_workspace * w); -size_t gsl_bspline_order(gsl_bspline_workspace * w); -size_t gsl_bspline_nbreak(gsl_bspline_workspace * w); -double gsl_bspline_breakpoint(size_t i, gsl_bspline_workspace * w); -double gsl_bspline_greville_abscissa(size_t i, gsl_bspline_workspace *w); - -int -gsl_bspline_knots(const gsl_vector *breakpts, gsl_bspline_workspace *w); - -int gsl_bspline_knots_uniform(const double a, const double b, - gsl_bspline_workspace *w); - -int -gsl_bspline_knots_greville(const gsl_vector *abscissae, - gsl_bspline_workspace *w, - double *abserr); - -int -gsl_bspline_eval(const double x, gsl_vector *B, - gsl_bspline_workspace *w); - -int -gsl_bspline_eval_nonzero(const double x, - gsl_vector *Bk, - size_t *istart, - size_t *iend, - gsl_bspline_workspace *w); - -int -gsl_bspline_deriv_eval(const double x, - const size_t nderiv, - gsl_matrix *dB, - gsl_bspline_workspace *w); - -int -gsl_bspline_deriv_eval_nonzero(const double x, - const size_t nderiv, - gsl_matrix *dB, - size_t *istart, - size_t *iend, - gsl_bspline_workspace *w); - -__END_DECLS - -#endif /* __GSL_BSPLINE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_cblas.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_cblas.h deleted file mode 100644 index e90e3b037..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_cblas.h +++ /dev/null @@ -1,606 +0,0 @@ -/* blas/gsl_cblas.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* This is a copy of the CBLAS standard header. - * We carry this around so we do not have to - * break our model for flexible BLAS functionality. - */ - -#ifndef __GSL_CBLAS_H__ -#define __GSL_CBLAS_H__ -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -#define __BEGIN_DECLS extern "C" { -#define __END_DECLS } -#else -#define __BEGIN_DECLS /* empty */ -#define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -/* - * Enumerated and derived types - */ -#define CBLAS_INDEX size_t /* this may vary between platforms */ - -enum CBLAS_ORDER {CblasRowMajor=101, CblasColMajor=102}; -enum CBLAS_TRANSPOSE {CblasNoTrans=111, CblasTrans=112, CblasConjTrans=113}; -enum CBLAS_UPLO {CblasUpper=121, CblasLower=122}; -enum CBLAS_DIAG {CblasNonUnit=131, CblasUnit=132}; -enum CBLAS_SIDE {CblasLeft=141, CblasRight=142}; - -/* - * =========================================================================== - * Prototypes for level 1 BLAS functions (complex are recast as routines) - * =========================================================================== - */ -float cblas_sdsdot(const int N, const float alpha, const float *X, - const int incX, const float *Y, const int incY); -double cblas_dsdot(const int N, const float *X, const int incX, const float *Y, - const int incY); -float cblas_sdot(const int N, const float *X, const int incX, - const float *Y, const int incY); -double cblas_ddot(const int N, const double *X, const int incX, - const double *Y, const int incY); - -/* - * Functions having prefixes Z and C only - */ -void cblas_cdotu_sub(const int N, const void *X, const int incX, - const void *Y, const int incY, void *dotu); -void cblas_cdotc_sub(const int N, const void *X, const int incX, - const void *Y, const int incY, void *dotc); - -void cblas_zdotu_sub(const int N, const void *X, const int incX, - const void *Y, const int incY, void *dotu); -void cblas_zdotc_sub(const int N, const void *X, const int incX, - const void *Y, const int incY, void *dotc); - - -/* - * Functions having prefixes S D SC DZ - */ -float cblas_snrm2(const int N, const float *X, const int incX); -float cblas_sasum(const int N, const float *X, const int incX); - -double cblas_dnrm2(const int N, const double *X, const int incX); -double cblas_dasum(const int N, const double *X, const int incX); - -float cblas_scnrm2(const int N, const void *X, const int incX); -float cblas_scasum(const int N, const void *X, const int incX); - -double cblas_dznrm2(const int N, const void *X, const int incX); -double cblas_dzasum(const int N, const void *X, const int incX); - - -/* - * Functions having standard 4 prefixes (S D C Z) - */ -CBLAS_INDEX cblas_isamax(const int N, const float *X, const int incX); -CBLAS_INDEX cblas_idamax(const int N, const double *X, const int incX); -CBLAS_INDEX cblas_icamax(const int N, const void *X, const int incX); -CBLAS_INDEX cblas_izamax(const int N, const void *X, const int incX); - -/* - * =========================================================================== - * Prototypes for level 1 BLAS routines - * =========================================================================== - */ - -/* - * Routines with standard 4 prefixes (s, d, c, z) - */ -void cblas_sswap(const int N, float *X, const int incX, - float *Y, const int incY); -void cblas_scopy(const int N, const float *X, const int incX, - float *Y, const int incY); -void cblas_saxpy(const int N, const float alpha, const float *X, - const int incX, float *Y, const int incY); - -void cblas_dswap(const int N, double *X, const int incX, - double *Y, const int incY); -void cblas_dcopy(const int N, const double *X, const int incX, - double *Y, const int incY); -void cblas_daxpy(const int N, const double alpha, const double *X, - const int incX, double *Y, const int incY); - -void cblas_cswap(const int N, void *X, const int incX, - void *Y, const int incY); -void cblas_ccopy(const int N, const void *X, const int incX, - void *Y, const int incY); -void cblas_caxpy(const int N, const void *alpha, const void *X, - const int incX, void *Y, const int incY); - -void cblas_zswap(const int N, void *X, const int incX, - void *Y, const int incY); -void cblas_zcopy(const int N, const void *X, const int incX, - void *Y, const int incY); -void cblas_zaxpy(const int N, const void *alpha, const void *X, - const int incX, void *Y, const int incY); - - -/* - * Routines with S and D prefix only - */ -void cblas_srotg(float *a, float *b, float *c, float *s); -void cblas_srotmg(float *d1, float *d2, float *b1, const float b2, float *P); -void cblas_srot(const int N, float *X, const int incX, - float *Y, const int incY, const float c, const float s); -void cblas_srotm(const int N, float *X, const int incX, - float *Y, const int incY, const float *P); - -void cblas_drotg(double *a, double *b, double *c, double *s); -void cblas_drotmg(double *d1, double *d2, double *b1, const double b2, double *P); -void cblas_drot(const int N, double *X, const int incX, - double *Y, const int incY, const double c, const double s); -void cblas_drotm(const int N, double *X, const int incX, - double *Y, const int incY, const double *P); - - -/* - * Routines with S D C Z CS and ZD prefixes - */ -void cblas_sscal(const int N, const float alpha, float *X, const int incX); -void cblas_dscal(const int N, const double alpha, double *X, const int incX); -void cblas_cscal(const int N, const void *alpha, void *X, const int incX); -void cblas_zscal(const int N, const void *alpha, void *X, const int incX); -void cblas_csscal(const int N, const float alpha, void *X, const int incX); -void cblas_zdscal(const int N, const double alpha, void *X, const int incX); - -/* - * =========================================================================== - * Prototypes for level 2 BLAS - * =========================================================================== - */ - -/* - * Routines with standard 4 prefixes (S, D, C, Z) - */ -void cblas_sgemv(const enum CBLAS_ORDER order, - const enum CBLAS_TRANSPOSE TransA, const int M, const int N, - const float alpha, const float *A, const int lda, - const float *X, const int incX, const float beta, - float *Y, const int incY); -void cblas_sgbmv(const enum CBLAS_ORDER order, - const enum CBLAS_TRANSPOSE TransA, const int M, const int N, - const int KL, const int KU, const float alpha, - const float *A, const int lda, const float *X, - const int incX, const float beta, float *Y, const int incY); -void cblas_strmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, - const int N, const float *A, const int lda, - float *X, const int incX); -void cblas_stbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, - const int N, const int K, const float *A, const int lda, - float *X, const int incX); -void cblas_stpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, - const int N, const float *Ap, float *X, const int incX); -void cblas_strsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, - const int N, const float *A, const int lda, float *X, - const int incX); -void cblas_stbsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, - const int N, const int K, const float *A, const int lda, - float *X, const int incX); -void cblas_stpsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, - const int N, const float *Ap, float *X, const int incX); - -void cblas_dgemv(const enum CBLAS_ORDER order, - const enum CBLAS_TRANSPOSE TransA, const int M, const int N, - const double alpha, const double *A, const int lda, - const double *X, const int incX, const double beta, - double *Y, const int incY); -void cblas_dgbmv(const enum CBLAS_ORDER order, - const enum CBLAS_TRANSPOSE TransA, const int M, const int N, - const int KL, const int KU, const double alpha, - const double *A, const int lda, const double *X, - const int incX, const double beta, double *Y, const int incY); -void cblas_dtrmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, - const int N, const double *A, const int lda, - double *X, const int incX); -void cblas_dtbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, - const int N, const int K, const double *A, const int lda, - double *X, const int incX); -void cblas_dtpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, - const int N, const double *Ap, double *X, const int incX); -void cblas_dtrsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, - const int N, const double *A, const int lda, double *X, - const int incX); -void cblas_dtbsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, - const int N, const int K, const double *A, const int lda, - double *X, const int incX); -void cblas_dtpsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, - const int N, const double *Ap, double *X, const int incX); - -void cblas_cgemv(const enum CBLAS_ORDER order, - const enum CBLAS_TRANSPOSE TransA, const int M, const int N, - const void *alpha, const void *A, const int lda, - const void *X, const int incX, const void *beta, - void *Y, const int incY); -void cblas_cgbmv(const enum CBLAS_ORDER order, - const enum CBLAS_TRANSPOSE TransA, const int M, const int N, - const int KL, const int KU, const void *alpha, - const void *A, const int lda, const void *X, - const int incX, const void *beta, void *Y, const int incY); -void cblas_ctrmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, - const int N, const void *A, const int lda, - void *X, const int incX); -void cblas_ctbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, - const int N, const int K, const void *A, const int lda, - void *X, const int incX); -void cblas_ctpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, - const int N, const void *Ap, void *X, const int incX); -void cblas_ctrsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, - const int N, const void *A, const int lda, void *X, - const int incX); -void cblas_ctbsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, - const int N, const int K, const void *A, const int lda, - void *X, const int incX); -void cblas_ctpsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, - const int N, const void *Ap, void *X, const int incX); - -void cblas_zgemv(const enum CBLAS_ORDER order, - const enum CBLAS_TRANSPOSE TransA, const int M, const int N, - const void *alpha, const void *A, const int lda, - const void *X, const int incX, const void *beta, - void *Y, const int incY); -void cblas_zgbmv(const enum CBLAS_ORDER order, - const enum CBLAS_TRANSPOSE TransA, const int M, const int N, - const int KL, const int KU, const void *alpha, - const void *A, const int lda, const void *X, - const int incX, const void *beta, void *Y, const int incY); -void cblas_ztrmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, - const int N, const void *A, const int lda, - void *X, const int incX); -void cblas_ztbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, - const int N, const int K, const void *A, const int lda, - void *X, const int incX); -void cblas_ztpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, - const int N, const void *Ap, void *X, const int incX); -void cblas_ztrsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, - const int N, const void *A, const int lda, void *X, - const int incX); -void cblas_ztbsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, - const int N, const int K, const void *A, const int lda, - void *X, const int incX); -void cblas_ztpsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, - const int N, const void *Ap, void *X, const int incX); - - -/* - * Routines with S and D prefixes only - */ -void cblas_ssymv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const int N, const float alpha, const float *A, - const int lda, const float *X, const int incX, - const float beta, float *Y, const int incY); -void cblas_ssbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const int N, const int K, const float alpha, const float *A, - const int lda, const float *X, const int incX, - const float beta, float *Y, const int incY); -void cblas_sspmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const int N, const float alpha, const float *Ap, - const float *X, const int incX, - const float beta, float *Y, const int incY); -void cblas_sger(const enum CBLAS_ORDER order, const int M, const int N, - const float alpha, const float *X, const int incX, - const float *Y, const int incY, float *A, const int lda); -void cblas_ssyr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const int N, const float alpha, const float *X, - const int incX, float *A, const int lda); -void cblas_sspr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const int N, const float alpha, const float *X, - const int incX, float *Ap); -void cblas_ssyr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const int N, const float alpha, const float *X, - const int incX, const float *Y, const int incY, float *A, - const int lda); -void cblas_sspr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const int N, const float alpha, const float *X, - const int incX, const float *Y, const int incY, float *A); - -void cblas_dsymv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const int N, const double alpha, const double *A, - const int lda, const double *X, const int incX, - const double beta, double *Y, const int incY); -void cblas_dsbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const int N, const int K, const double alpha, const double *A, - const int lda, const double *X, const int incX, - const double beta, double *Y, const int incY); -void cblas_dspmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const int N, const double alpha, const double *Ap, - const double *X, const int incX, - const double beta, double *Y, const int incY); -void cblas_dger(const enum CBLAS_ORDER order, const int M, const int N, - const double alpha, const double *X, const int incX, - const double *Y, const int incY, double *A, const int lda); -void cblas_dsyr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const int N, const double alpha, const double *X, - const int incX, double *A, const int lda); -void cblas_dspr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const int N, const double alpha, const double *X, - const int incX, double *Ap); -void cblas_dsyr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const int N, const double alpha, const double *X, - const int incX, const double *Y, const int incY, double *A, - const int lda); -void cblas_dspr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const int N, const double alpha, const double *X, - const int incX, const double *Y, const int incY, double *A); - - -/* - * Routines with C and Z prefixes only - */ -void cblas_chemv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const int N, const void *alpha, const void *A, - const int lda, const void *X, const int incX, - const void *beta, void *Y, const int incY); -void cblas_chbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const int N, const int K, const void *alpha, const void *A, - const int lda, const void *X, const int incX, - const void *beta, void *Y, const int incY); -void cblas_chpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const int N, const void *alpha, const void *Ap, - const void *X, const int incX, - const void *beta, void *Y, const int incY); -void cblas_cgeru(const enum CBLAS_ORDER order, const int M, const int N, - const void *alpha, const void *X, const int incX, - const void *Y, const int incY, void *A, const int lda); -void cblas_cgerc(const enum CBLAS_ORDER order, const int M, const int N, - const void *alpha, const void *X, const int incX, - const void *Y, const int incY, void *A, const int lda); -void cblas_cher(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const int N, const float alpha, const void *X, const int incX, - void *A, const int lda); -void cblas_chpr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const int N, const float alpha, const void *X, - const int incX, void *A); -void cblas_cher2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, - const void *alpha, const void *X, const int incX, - const void *Y, const int incY, void *A, const int lda); -void cblas_chpr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, - const void *alpha, const void *X, const int incX, - const void *Y, const int incY, void *Ap); - -void cblas_zhemv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const int N, const void *alpha, const void *A, - const int lda, const void *X, const int incX, - const void *beta, void *Y, const int incY); -void cblas_zhbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const int N, const int K, const void *alpha, const void *A, - const int lda, const void *X, const int incX, - const void *beta, void *Y, const int incY); -void cblas_zhpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const int N, const void *alpha, const void *Ap, - const void *X, const int incX, - const void *beta, void *Y, const int incY); -void cblas_zgeru(const enum CBLAS_ORDER order, const int M, const int N, - const void *alpha, const void *X, const int incX, - const void *Y, const int incY, void *A, const int lda); -void cblas_zgerc(const enum CBLAS_ORDER order, const int M, const int N, - const void *alpha, const void *X, const int incX, - const void *Y, const int incY, void *A, const int lda); -void cblas_zher(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const int N, const double alpha, const void *X, const int incX, - void *A, const int lda); -void cblas_zhpr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, - const int N, const double alpha, const void *X, - const int incX, void *A); -void cblas_zher2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, - const void *alpha, const void *X, const int incX, - const void *Y, const int incY, void *A, const int lda); -void cblas_zhpr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, - const void *alpha, const void *X, const int incX, - const void *Y, const int incY, void *Ap); - -/* - * =========================================================================== - * Prototypes for level 3 BLAS - * =========================================================================== - */ - -/* - * Routines with standard 4 prefixes (S, D, C, Z) - */ -void cblas_sgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, - const enum CBLAS_TRANSPOSE TransB, const int M, const int N, - const int K, const float alpha, const float *A, - const int lda, const float *B, const int ldb, - const float beta, float *C, const int ldc); -void cblas_ssymm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, - const enum CBLAS_UPLO Uplo, const int M, const int N, - const float alpha, const float *A, const int lda, - const float *B, const int ldb, const float beta, - float *C, const int ldc); -void cblas_ssyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE Trans, const int N, const int K, - const float alpha, const float *A, const int lda, - const float beta, float *C, const int ldc); -void cblas_ssyr2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE Trans, const int N, const int K, - const float alpha, const float *A, const int lda, - const float *B, const int ldb, const float beta, - float *C, const int ldc); -void cblas_strmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, - const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, - const enum CBLAS_DIAG Diag, const int M, const int N, - const float alpha, const float *A, const int lda, - float *B, const int ldb); -void cblas_strsm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, - const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, - const enum CBLAS_DIAG Diag, const int M, const int N, - const float alpha, const float *A, const int lda, - float *B, const int ldb); - -void cblas_dgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, - const enum CBLAS_TRANSPOSE TransB, const int M, const int N, - const int K, const double alpha, const double *A, - const int lda, const double *B, const int ldb, - const double beta, double *C, const int ldc); -void cblas_dsymm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, - const enum CBLAS_UPLO Uplo, const int M, const int N, - const double alpha, const double *A, const int lda, - const double *B, const int ldb, const double beta, - double *C, const int ldc); -void cblas_dsyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE Trans, const int N, const int K, - const double alpha, const double *A, const int lda, - const double beta, double *C, const int ldc); -void cblas_dsyr2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE Trans, const int N, const int K, - const double alpha, const double *A, const int lda, - const double *B, const int ldb, const double beta, - double *C, const int ldc); -void cblas_dtrmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, - const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, - const enum CBLAS_DIAG Diag, const int M, const int N, - const double alpha, const double *A, const int lda, - double *B, const int ldb); -void cblas_dtrsm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, - const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, - const enum CBLAS_DIAG Diag, const int M, const int N, - const double alpha, const double *A, const int lda, - double *B, const int ldb); - -void cblas_cgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, - const enum CBLAS_TRANSPOSE TransB, const int M, const int N, - const int K, const void *alpha, const void *A, - const int lda, const void *B, const int ldb, - const void *beta, void *C, const int ldc); -void cblas_csymm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, - const enum CBLAS_UPLO Uplo, const int M, const int N, - const void *alpha, const void *A, const int lda, - const void *B, const int ldb, const void *beta, - void *C, const int ldc); -void cblas_csyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE Trans, const int N, const int K, - const void *alpha, const void *A, const int lda, - const void *beta, void *C, const int ldc); -void cblas_csyr2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE Trans, const int N, const int K, - const void *alpha, const void *A, const int lda, - const void *B, const int ldb, const void *beta, - void *C, const int ldc); -void cblas_ctrmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, - const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, - const enum CBLAS_DIAG Diag, const int M, const int N, - const void *alpha, const void *A, const int lda, - void *B, const int ldb); -void cblas_ctrsm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, - const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, - const enum CBLAS_DIAG Diag, const int M, const int N, - const void *alpha, const void *A, const int lda, - void *B, const int ldb); - -void cblas_zgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, - const enum CBLAS_TRANSPOSE TransB, const int M, const int N, - const int K, const void *alpha, const void *A, - const int lda, const void *B, const int ldb, - const void *beta, void *C, const int ldc); -void cblas_zsymm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, - const enum CBLAS_UPLO Uplo, const int M, const int N, - const void *alpha, const void *A, const int lda, - const void *B, const int ldb, const void *beta, - void *C, const int ldc); -void cblas_zsyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE Trans, const int N, const int K, - const void *alpha, const void *A, const int lda, - const void *beta, void *C, const int ldc); -void cblas_zsyr2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE Trans, const int N, const int K, - const void *alpha, const void *A, const int lda, - const void *B, const int ldb, const void *beta, - void *C, const int ldc); -void cblas_ztrmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, - const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, - const enum CBLAS_DIAG Diag, const int M, const int N, - const void *alpha, const void *A, const int lda, - void *B, const int ldb); -void cblas_ztrsm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, - const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, - const enum CBLAS_DIAG Diag, const int M, const int N, - const void *alpha, const void *A, const int lda, - void *B, const int ldb); - - -/* - * Routines with prefixes C and Z only - */ -void cblas_chemm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, - const enum CBLAS_UPLO Uplo, const int M, const int N, - const void *alpha, const void *A, const int lda, - const void *B, const int ldb, const void *beta, - void *C, const int ldc); -void cblas_cherk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE Trans, const int N, const int K, - const float alpha, const void *A, const int lda, - const float beta, void *C, const int ldc); -void cblas_cher2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE Trans, const int N, const int K, - const void *alpha, const void *A, const int lda, - const void *B, const int ldb, const float beta, - void *C, const int ldc); - -void cblas_zhemm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, - const enum CBLAS_UPLO Uplo, const int M, const int N, - const void *alpha, const void *A, const int lda, - const void *B, const int ldb, const void *beta, - void *C, const int ldc); -void cblas_zherk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE Trans, const int N, const int K, - const double alpha, const void *A, const int lda, - const double beta, void *C, const int ldc); -void cblas_zher2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, - const enum CBLAS_TRANSPOSE Trans, const int N, const int K, - const void *alpha, const void *A, const int lda, - const void *B, const int ldb, const double beta, - void *C, const int ldc); - -void cblas_xerbla(int p, const char *rout, const char *form, ...); - -__END_DECLS - -#endif /* __GSL_CBLAS_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_cdf.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_cdf.h deleted file mode 100644 index 2bc3fed5f..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_cdf.h +++ /dev/null @@ -1,170 +0,0 @@ -/* cdf/gsl_cdf.h - * - * Copyright (C) 2002 Jason H. Stover. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: J. Stover */ - -#ifndef __GSL_CDF_H__ -#define __GSL_CDF_H__ - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -double gsl_cdf_ugaussian_P (const double x); -double gsl_cdf_ugaussian_Q (const double x); - -double gsl_cdf_ugaussian_Pinv (const double P); -double gsl_cdf_ugaussian_Qinv (const double Q); - -double gsl_cdf_gaussian_P (const double x, const double sigma); -double gsl_cdf_gaussian_Q (const double x, const double sigma); - -double gsl_cdf_gaussian_Pinv (const double P, const double sigma); -double gsl_cdf_gaussian_Qinv (const double Q, const double sigma); - -double gsl_cdf_gamma_P (const double x, const double a, const double b); -double gsl_cdf_gamma_Q (const double x, const double a, const double b); - -double gsl_cdf_gamma_Pinv (const double P, const double a, const double b); -double gsl_cdf_gamma_Qinv (const double Q, const double a, const double b); - -double gsl_cdf_cauchy_P (const double x, const double a); -double gsl_cdf_cauchy_Q (const double x, const double a); - -double gsl_cdf_cauchy_Pinv (const double P, const double a); -double gsl_cdf_cauchy_Qinv (const double Q, const double a); - -double gsl_cdf_laplace_P (const double x, const double a); -double gsl_cdf_laplace_Q (const double x, const double a); - -double gsl_cdf_laplace_Pinv (const double P, const double a); -double gsl_cdf_laplace_Qinv (const double Q, const double a); - -double gsl_cdf_rayleigh_P (const double x, const double sigma); -double gsl_cdf_rayleigh_Q (const double x, const double sigma); - -double gsl_cdf_rayleigh_Pinv (const double P, const double sigma); -double gsl_cdf_rayleigh_Qinv (const double Q, const double sigma); - -double gsl_cdf_chisq_P (const double x, const double nu); -double gsl_cdf_chisq_Q (const double x, const double nu); - -double gsl_cdf_chisq_Pinv (const double P, const double nu); -double gsl_cdf_chisq_Qinv (const double Q, const double nu); - -double gsl_cdf_exponential_P (const double x, const double mu); -double gsl_cdf_exponential_Q (const double x, const double mu); - -double gsl_cdf_exponential_Pinv (const double P, const double mu); -double gsl_cdf_exponential_Qinv (const double Q, const double mu); - -double gsl_cdf_exppow_P (const double x, const double a, const double b); -double gsl_cdf_exppow_Q (const double x, const double a, const double b); - -double gsl_cdf_tdist_P (const double x, const double nu); -double gsl_cdf_tdist_Q (const double x, const double nu); - -double gsl_cdf_tdist_Pinv (const double P, const double nu); -double gsl_cdf_tdist_Qinv (const double Q, const double nu); - -double gsl_cdf_fdist_P (const double x, const double nu1, const double nu2); -double gsl_cdf_fdist_Q (const double x, const double nu1, const double nu2); - -double gsl_cdf_fdist_Pinv (const double P, const double nu1, const double nu2); -double gsl_cdf_fdist_Qinv (const double Q, const double nu1, const double nu2); - -double gsl_cdf_beta_P (const double x, const double a, const double b); -double gsl_cdf_beta_Q (const double x, const double a, const double b); - -double gsl_cdf_beta_Pinv (const double P, const double a, const double b); -double gsl_cdf_beta_Qinv (const double Q, const double a, const double b); - -double gsl_cdf_flat_P (const double x, const double a, const double b); -double gsl_cdf_flat_Q (const double x, const double a, const double b); - -double gsl_cdf_flat_Pinv (const double P, const double a, const double b); -double gsl_cdf_flat_Qinv (const double Q, const double a, const double b); - -double gsl_cdf_lognormal_P (const double x, const double zeta, const double sigma); -double gsl_cdf_lognormal_Q (const double x, const double zeta, const double sigma); - -double gsl_cdf_lognormal_Pinv (const double P, const double zeta, const double sigma); -double gsl_cdf_lognormal_Qinv (const double Q, const double zeta, const double sigma); - -double gsl_cdf_gumbel1_P (const double x, const double a, const double b); -double gsl_cdf_gumbel1_Q (const double x, const double a, const double b); - -double gsl_cdf_gumbel1_Pinv (const double P, const double a, const double b); -double gsl_cdf_gumbel1_Qinv (const double Q, const double a, const double b); - -double gsl_cdf_gumbel2_P (const double x, const double a, const double b); -double gsl_cdf_gumbel2_Q (const double x, const double a, const double b); - -double gsl_cdf_gumbel2_Pinv (const double P, const double a, const double b); -double gsl_cdf_gumbel2_Qinv (const double Q, const double a, const double b); - -double gsl_cdf_weibull_P (const double x, const double a, const double b); -double gsl_cdf_weibull_Q (const double x, const double a, const double b); - -double gsl_cdf_weibull_Pinv (const double P, const double a, const double b); -double gsl_cdf_weibull_Qinv (const double Q, const double a, const double b); - -double gsl_cdf_pareto_P (const double x, const double a, const double b); -double gsl_cdf_pareto_Q (const double x, const double a, const double b); - -double gsl_cdf_pareto_Pinv (const double P, const double a, const double b); -double gsl_cdf_pareto_Qinv (const double Q, const double a, const double b); - -double gsl_cdf_logistic_P (const double x, const double a); -double gsl_cdf_logistic_Q (const double x, const double a); - -double gsl_cdf_logistic_Pinv (const double P, const double a); -double gsl_cdf_logistic_Qinv (const double Q, const double a); - -double gsl_cdf_binomial_P (const unsigned int k, const double p, const unsigned int n); -double gsl_cdf_binomial_Q (const unsigned int k, const double p, const unsigned int n); - -double gsl_cdf_poisson_P (const unsigned int k, const double mu); -double gsl_cdf_poisson_Q (const unsigned int k, const double mu); - -double gsl_cdf_geometric_P (const unsigned int k, const double p); -double gsl_cdf_geometric_Q (const unsigned int k, const double p); - -double gsl_cdf_negative_binomial_P (const unsigned int k, const double p, const double n); -double gsl_cdf_negative_binomial_Q (const unsigned int k, const double p, const double n); - -double gsl_cdf_pascal_P (const unsigned int k, const double p, const unsigned int n); -double gsl_cdf_pascal_Q (const unsigned int k, const double p, const unsigned int n); - -double gsl_cdf_hypergeometric_P (const unsigned int k, const unsigned int n1, - const unsigned int n2, const unsigned int t); -double gsl_cdf_hypergeometric_Q (const unsigned int k, const unsigned int n1, - const unsigned int n2, const unsigned int t); - -__END_DECLS - -#endif /* __GSL_CDF_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_chebyshev.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_chebyshev.h deleted file mode 100644 index 858048e40..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_chebyshev.h +++ /dev/null @@ -1,133 +0,0 @@ -/* cheb/gsl_chebyshev.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_CHEBYSHEV_H__ -#define __GSL_CHEBYSHEV_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* data for a Chebyshev series over a given interval */ - -struct gsl_cheb_series_struct { - - double * c; /* coefficients */ - size_t order; /* order of expansion */ - double a; /* lower interval point */ - double b; /* upper interval point */ - - /* The following exists (mostly) for the benefit - * of the implementation. It is an effective single - * precision order, for use in single precision - * evaluation. Users can use it if they like, but - * only they know how to calculate it, since it is - * specific to the approximated function. By default, - * order_sp = order. - * It is used explicitly only by the gsl_cheb_eval_mode - * functions, which are not meant for casual use. - */ - size_t order_sp; - - /* Additional elements not used by specfunc */ - - double * f; /* function evaluated at chebyschev points */ -}; -typedef struct gsl_cheb_series_struct gsl_cheb_series; - - -/* Calculate a Chebyshev series of specified order over - * a specified interval, for a given function. - * Return 0 on failure. - */ -gsl_cheb_series * gsl_cheb_alloc(const size_t order); - -/* Free a Chebyshev series previously calculated with gsl_cheb_alloc(). - */ -void gsl_cheb_free(gsl_cheb_series * cs); - -/* Calculate a Chebyshev series using the storage provided. - * Uses the interval (a,b) and the order with which it - * was initially created. - * - */ -int gsl_cheb_init(gsl_cheb_series * cs, const gsl_function * func, - const double a, const double b); - -/* Return the order, size of coefficient array and coefficient array ptr */ -size_t gsl_cheb_order (const gsl_cheb_series * cs); -size_t gsl_cheb_size (const gsl_cheb_series * cs); -double *gsl_cheb_coeffs (const gsl_cheb_series * cs); - -/* Evaluate a Chebyshev series at a given point. - * No errors can occur for a struct obtained from gsl_cheb_new(). - */ -double gsl_cheb_eval(const gsl_cheb_series * cs, const double x); -int gsl_cheb_eval_err(const gsl_cheb_series * cs, const double x, - double * result, double * abserr); - - -/* Evaluate a Chebyshev series at a given point, to (at most) the given order. - * No errors can occur for a struct obtained from gsl_cheb_new(). - */ -double gsl_cheb_eval_n(const gsl_cheb_series * cs, const size_t order, - const double x); -int gsl_cheb_eval_n_err(const gsl_cheb_series * cs, const size_t order, - const double x, double * result, double * abserr); - - -/* Evaluate a Chebyshev series at a given point, using the default - * order for double precision mode(s) and the single precision - * order for other modes. - * No errors can occur for a struct obtained from gsl_cheb_new(). - */ -double gsl_cheb_eval_mode(const gsl_cheb_series * cs, const double x, gsl_mode_t mode); -int gsl_cheb_eval_mode_e(const gsl_cheb_series * cs, const double x, gsl_mode_t mode, double * result, double * abserr); - - - -/* Compute the derivative of a Chebyshev series. - */ -int gsl_cheb_calc_deriv(gsl_cheb_series * deriv, const gsl_cheb_series * cs); - -/* Compute the integral of a Chebyshev series. The - * integral is fixed by the condition that it equals zero at - * the left end-point, ie it is precisely - * Integrate[cs(t; a,b), {t, a, x}] - */ -int gsl_cheb_calc_integ(gsl_cheb_series * integ, const gsl_cheb_series * cs); - - - - -__END_DECLS - -#endif /* __GSL_CHEBYSHEV_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_check_range.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_check_range.h deleted file mode 100644 index d110b6b89..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_check_range.h +++ /dev/null @@ -1,57 +0,0 @@ -/* vector/gsl_check_range.h - * - * Copyright (C) 2003, 2004, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_CHECK_RANGE_H__ -#define __GSL_CHECK_RANGE_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -GSL_VAR int gsl_check_range; - -/* Turn range checking on by default, unless the user defines - GSL_RANGE_CHECK_OFF, or defines GSL_RANGE_CHECK to 0 explicitly */ - -#ifdef GSL_RANGE_CHECK_OFF -# ifndef GSL_RANGE_CHECK -# define GSL_RANGE_CHECK 0 -# else -# error "cannot set both GSL_RANGE_CHECK and GSL_RANGE_CHECK_OFF" -# endif -#else -# ifndef GSL_RANGE_CHECK -# define GSL_RANGE_CHECK 1 -# endif -#endif - -__END_DECLS - -#endif /* __GSL_CHECK_RANGE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_combination.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_combination.h deleted file mode 100644 index 69de7cf19..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_combination.h +++ /dev/null @@ -1,92 +0,0 @@ -/* combination/gsl_combination.h - * based on permutation/gsl_permutation.h by Brian Gough - * - * Copyright (C) 2001 Szymon Jaroszewicz - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_COMBINATION_H__ -#define __GSL_COMBINATION_H__ - -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -struct gsl_combination_struct -{ - size_t n; - size_t k; - size_t *data; -}; - -typedef struct gsl_combination_struct gsl_combination; - -gsl_combination *gsl_combination_alloc (const size_t n, const size_t k); -gsl_combination *gsl_combination_calloc (const size_t n, const size_t k); -void gsl_combination_init_first (gsl_combination * c); -void gsl_combination_init_last (gsl_combination * c); -void gsl_combination_free (gsl_combination * c); -int gsl_combination_memcpy (gsl_combination * dest, const gsl_combination * src); - -int gsl_combination_fread (FILE * stream, gsl_combination * c); -int gsl_combination_fwrite (FILE * stream, const gsl_combination * c); -int gsl_combination_fscanf (FILE * stream, gsl_combination * c); -int gsl_combination_fprintf (FILE * stream, const gsl_combination * c, const char *format); - -size_t gsl_combination_n (const gsl_combination * c); -size_t gsl_combination_k (const gsl_combination * c); -size_t * gsl_combination_data (const gsl_combination * c); - -int gsl_combination_valid (gsl_combination * c); -int gsl_combination_next (gsl_combination * c); -int gsl_combination_prev (gsl_combination * c); - -INLINE_DECL size_t gsl_combination_get (const gsl_combination * c, const size_t i); - -#ifdef HAVE_INLINE - -INLINE_FUN -size_t -gsl_combination_get (const gsl_combination * c, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= c->k)) /* size_t is unsigned, can't be negative */ - { - GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); - } -#endif - return c->data[i]; -} - -#endif /* HAVE_INLINE */ - -__END_DECLS - -#endif /* __GSL_COMBINATION_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_complex.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_complex.h deleted file mode 100644 index e77b77062..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_complex.h +++ /dev/null @@ -1,103 +0,0 @@ -/* complex/gsl_complex.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_COMPLEX_H__ -#define __GSL_COMPLEX_H__ - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* two consecutive built-in types as a complex number */ -typedef double * gsl_complex_packed ; -typedef float * gsl_complex_packed_float ; -typedef long double * gsl_complex_packed_long_double ; - -typedef const double * gsl_const_complex_packed ; -typedef const float * gsl_const_complex_packed_float ; -typedef const long double * gsl_const_complex_packed_long_double ; - - -/* 2N consecutive built-in types as N complex numbers */ -typedef double * gsl_complex_packed_array ; -typedef float * gsl_complex_packed_array_float ; -typedef long double * gsl_complex_packed_array_long_double ; - -typedef const double * gsl_const_complex_packed_array ; -typedef const float * gsl_const_complex_packed_array_float ; -typedef const long double * gsl_const_complex_packed_array_long_double ; - - -/* Yes... this seems weird. Trust us. The point is just that - sometimes you want to make it obvious that something is - an output value. The fact that it lacks a 'const' may not - be enough of a clue for people in some contexts. - */ -typedef double * gsl_complex_packed_ptr ; -typedef float * gsl_complex_packed_float_ptr ; -typedef long double * gsl_complex_packed_long_double_ptr ; - -typedef const double * gsl_const_complex_packed_ptr ; -typedef const float * gsl_const_complex_packed_float_ptr ; -typedef const long double * gsl_const_complex_packed_long_double_ptr ; - - -typedef struct - { - long double dat[2]; - } -gsl_complex_long_double; - -typedef struct - { - double dat[2]; - } -gsl_complex; - -typedef struct - { - float dat[2]; - } -gsl_complex_float; - -#define GSL_REAL(z) ((z).dat[0]) -#define GSL_IMAG(z) ((z).dat[1]) -#define GSL_COMPLEX_P(zp) ((zp)->dat) -#define GSL_COMPLEX_P_REAL(zp) ((zp)->dat[0]) -#define GSL_COMPLEX_P_IMAG(zp) ((zp)->dat[1]) -#define GSL_COMPLEX_EQ(z1,z2) (((z1).dat[0] == (z2).dat[0]) && ((z1).dat[1] == (z2).dat[1])) - -#define GSL_SET_COMPLEX(zp,x,y) do {(zp)->dat[0]=(x); (zp)->dat[1]=(y);} while(0) -#define GSL_SET_REAL(zp,x) do {(zp)->dat[0]=(x);} while(0) -#define GSL_SET_IMAG(zp,y) do {(zp)->dat[1]=(y);} while(0) - -#define GSL_SET_COMPLEX_PACKED(zp,n,x,y) do {*((zp)+2*(n))=(x); *((zp)+(2*(n)+1))=(y);} while(0) - -__END_DECLS - -#endif /* __GSL_COMPLEX_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_complex_math.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_complex_math.h deleted file mode 100644 index ad8d076a6..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_complex_math.h +++ /dev/null @@ -1,142 +0,0 @@ -/* complex/gsl_complex_math.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 Jorma Olavi Tähtinen, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_COMPLEX_MATH_H__ -#define __GSL_COMPLEX_MATH_H__ -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -#define __BEGIN_DECLS extern "C" { -#define __END_DECLS } -#else -#define __BEGIN_DECLS /* empty */ -#define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -/* Complex numbers */ - -gsl_complex gsl_complex_polar (double r, double theta); /* r= r e^(i theta) */ - -INLINE_DECL gsl_complex gsl_complex_rect (double x, double y); /* r= real+i*imag */ - -#ifdef HAVE_INLINE -INLINE_FUN gsl_complex -gsl_complex_rect (double x, double y) -{ /* return z = x + i y */ - gsl_complex z; - GSL_SET_COMPLEX (&z, x, y); - return z; -} -#endif - -#define GSL_COMPLEX_ONE (gsl_complex_rect(1.0,0.0)) -#define GSL_COMPLEX_ZERO (gsl_complex_rect(0.0,0.0)) -#define GSL_COMPLEX_NEGONE (gsl_complex_rect(-1.0,0.0)) - -/* Properties of complex numbers */ - -double gsl_complex_arg (gsl_complex z); /* return arg(z), -pi< arg(z) <=+pi */ -double gsl_complex_abs (gsl_complex z); /* return |z| */ -double gsl_complex_abs2 (gsl_complex z); /* return |z|^2 */ -double gsl_complex_logabs (gsl_complex z); /* return log|z| */ - -/* Complex arithmetic operators */ - -gsl_complex gsl_complex_add (gsl_complex a, gsl_complex b); /* r=a+b */ -gsl_complex gsl_complex_sub (gsl_complex a, gsl_complex b); /* r=a-b */ -gsl_complex gsl_complex_mul (gsl_complex a, gsl_complex b); /* r=a*b */ -gsl_complex gsl_complex_div (gsl_complex a, gsl_complex b); /* r=a/b */ - -gsl_complex gsl_complex_add_real (gsl_complex a, double x); /* r=a+x */ -gsl_complex gsl_complex_sub_real (gsl_complex a, double x); /* r=a-x */ -gsl_complex gsl_complex_mul_real (gsl_complex a, double x); /* r=a*x */ -gsl_complex gsl_complex_div_real (gsl_complex a, double x); /* r=a/x */ - -gsl_complex gsl_complex_add_imag (gsl_complex a, double y); /* r=a+iy */ -gsl_complex gsl_complex_sub_imag (gsl_complex a, double y); /* r=a-iy */ -gsl_complex gsl_complex_mul_imag (gsl_complex a, double y); /* r=a*iy */ -gsl_complex gsl_complex_div_imag (gsl_complex a, double y); /* r=a/iy */ - -gsl_complex gsl_complex_conjugate (gsl_complex z); /* r=conj(z) */ -gsl_complex gsl_complex_inverse (gsl_complex a); /* r=1/a */ -gsl_complex gsl_complex_negative (gsl_complex a); /* r=-a */ - -/* Elementary Complex Functions */ - -gsl_complex gsl_complex_sqrt (gsl_complex z); /* r=sqrt(z) */ -gsl_complex gsl_complex_sqrt_real (double x); /* r=sqrt(x) (x<0 ok) */ - -gsl_complex gsl_complex_pow (gsl_complex a, gsl_complex b); /* r=a^b */ -gsl_complex gsl_complex_pow_real (gsl_complex a, double b); /* r=a^b */ - -gsl_complex gsl_complex_exp (gsl_complex a); /* r=exp(a) */ -gsl_complex gsl_complex_log (gsl_complex a); /* r=log(a) (base e) */ -gsl_complex gsl_complex_log10 (gsl_complex a); /* r=log10(a) (base 10) */ -gsl_complex gsl_complex_log_b (gsl_complex a, gsl_complex b); /* r=log_b(a) (base=b) */ - -/* Complex Trigonometric Functions */ - -gsl_complex gsl_complex_sin (gsl_complex a); /* r=sin(a) */ -gsl_complex gsl_complex_cos (gsl_complex a); /* r=cos(a) */ -gsl_complex gsl_complex_sec (gsl_complex a); /* r=sec(a) */ -gsl_complex gsl_complex_csc (gsl_complex a); /* r=csc(a) */ -gsl_complex gsl_complex_tan (gsl_complex a); /* r=tan(a) */ -gsl_complex gsl_complex_cot (gsl_complex a); /* r=cot(a) */ - -/* Inverse Complex Trigonometric Functions */ - -gsl_complex gsl_complex_arcsin (gsl_complex a); /* r=arcsin(a) */ -gsl_complex gsl_complex_arcsin_real (double a); /* r=arcsin(a) */ -gsl_complex gsl_complex_arccos (gsl_complex a); /* r=arccos(a) */ -gsl_complex gsl_complex_arccos_real (double a); /* r=arccos(a) */ -gsl_complex gsl_complex_arcsec (gsl_complex a); /* r=arcsec(a) */ -gsl_complex gsl_complex_arcsec_real (double a); /* r=arcsec(a) */ -gsl_complex gsl_complex_arccsc (gsl_complex a); /* r=arccsc(a) */ -gsl_complex gsl_complex_arccsc_real (double a); /* r=arccsc(a) */ -gsl_complex gsl_complex_arctan (gsl_complex a); /* r=arctan(a) */ -gsl_complex gsl_complex_arccot (gsl_complex a); /* r=arccot(a) */ - -/* Complex Hyperbolic Functions */ - -gsl_complex gsl_complex_sinh (gsl_complex a); /* r=sinh(a) */ -gsl_complex gsl_complex_cosh (gsl_complex a); /* r=coshh(a) */ -gsl_complex gsl_complex_sech (gsl_complex a); /* r=sech(a) */ -gsl_complex gsl_complex_csch (gsl_complex a); /* r=csch(a) */ -gsl_complex gsl_complex_tanh (gsl_complex a); /* r=tanh(a) */ -gsl_complex gsl_complex_coth (gsl_complex a); /* r=coth(a) */ - -/* Inverse Complex Hyperbolic Functions */ - -gsl_complex gsl_complex_arcsinh (gsl_complex a); /* r=arcsinh(a) */ -gsl_complex gsl_complex_arccosh (gsl_complex a); /* r=arccosh(a) */ -gsl_complex gsl_complex_arccosh_real (double a); /* r=arccosh(a) */ -gsl_complex gsl_complex_arcsech (gsl_complex a); /* r=arcsech(a) */ -gsl_complex gsl_complex_arccsch (gsl_complex a); /* r=arccsch(a) */ -gsl_complex gsl_complex_arctanh (gsl_complex a); /* r=arctanh(a) */ -gsl_complex gsl_complex_arctanh_real (double a); /* r=arctanh(a) */ -gsl_complex gsl_complex_arccoth (gsl_complex a); /* r=arccoth(a) */ - -__END_DECLS - -#endif /* __GSL_COMPLEX_MATH_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_const.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_const.h deleted file mode 100644 index 5d749dc5e..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_const.h +++ /dev/null @@ -1,31 +0,0 @@ -/* const/gsl_const.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_CONST__ -#define __GSL_CONST__ - -#include - -#include -#include - -#include -#include - -#endif /* __GSL_CONST__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_cgs.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_cgs.h deleted file mode 100644 index ab95b7b08..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_cgs.h +++ /dev/null @@ -1,116 +0,0 @@ -/* const/gsl_const_cgs.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - * 2006, 2007, 2008, 2009 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_CONST_CGS__ -#define __GSL_CONST_CGS__ - -#define GSL_CONST_CGS_SPEED_OF_LIGHT (2.99792458e10) /* cm / s */ -#define GSL_CONST_CGS_GRAVITATIONAL_CONSTANT (6.673e-8) /* cm^3 / g s^2 */ -#define GSL_CONST_CGS_PLANCKS_CONSTANT_H (6.62606896e-27) /* g cm^2 / s */ -#define GSL_CONST_CGS_PLANCKS_CONSTANT_HBAR (1.05457162825e-27) /* g cm^2 / s */ -#define GSL_CONST_CGS_ASTRONOMICAL_UNIT (1.49597870691e13) /* cm */ -#define GSL_CONST_CGS_LIGHT_YEAR (9.46053620707e17) /* cm */ -#define GSL_CONST_CGS_PARSEC (3.08567758135e18) /* cm */ -#define GSL_CONST_CGS_GRAV_ACCEL (9.80665e2) /* cm / s^2 */ -#define GSL_CONST_CGS_ELECTRON_VOLT (1.602176487e-12) /* g cm^2 / s^2 */ -#define GSL_CONST_CGS_MASS_ELECTRON (9.10938188e-28) /* g */ -#define GSL_CONST_CGS_MASS_MUON (1.88353109e-25) /* g */ -#define GSL_CONST_CGS_MASS_PROTON (1.67262158e-24) /* g */ -#define GSL_CONST_CGS_MASS_NEUTRON (1.67492716e-24) /* g */ -#define GSL_CONST_CGS_RYDBERG (2.17987196968e-11) /* g cm^2 / s^2 */ -#define GSL_CONST_CGS_BOLTZMANN (1.3806504e-16) /* g cm^2 / K s^2 */ -#define GSL_CONST_CGS_MOLAR_GAS (8.314472e7) /* g cm^2 / K mol s^2 */ -#define GSL_CONST_CGS_STANDARD_GAS_VOLUME (2.2710981e4) /* cm^3 / mol */ -#define GSL_CONST_CGS_MINUTE (6e1) /* s */ -#define GSL_CONST_CGS_HOUR (3.6e3) /* s */ -#define GSL_CONST_CGS_DAY (8.64e4) /* s */ -#define GSL_CONST_CGS_WEEK (6.048e5) /* s */ -#define GSL_CONST_CGS_INCH (2.54e0) /* cm */ -#define GSL_CONST_CGS_FOOT (3.048e1) /* cm */ -#define GSL_CONST_CGS_YARD (9.144e1) /* cm */ -#define GSL_CONST_CGS_MILE (1.609344e5) /* cm */ -#define GSL_CONST_CGS_NAUTICAL_MILE (1.852e5) /* cm */ -#define GSL_CONST_CGS_FATHOM (1.8288e2) /* cm */ -#define GSL_CONST_CGS_MIL (2.54e-3) /* cm */ -#define GSL_CONST_CGS_POINT (3.52777777778e-2) /* cm */ -#define GSL_CONST_CGS_TEXPOINT (3.51459803515e-2) /* cm */ -#define GSL_CONST_CGS_MICRON (1e-4) /* cm */ -#define GSL_CONST_CGS_ANGSTROM (1e-8) /* cm */ -#define GSL_CONST_CGS_HECTARE (1e8) /* cm^2 */ -#define GSL_CONST_CGS_ACRE (4.04685642241e7) /* cm^2 */ -#define GSL_CONST_CGS_BARN (1e-24) /* cm^2 */ -#define GSL_CONST_CGS_LITER (1e3) /* cm^3 */ -#define GSL_CONST_CGS_US_GALLON (3.78541178402e3) /* cm^3 */ -#define GSL_CONST_CGS_QUART (9.46352946004e2) /* cm^3 */ -#define GSL_CONST_CGS_PINT (4.73176473002e2) /* cm^3 */ -#define GSL_CONST_CGS_CUP (2.36588236501e2) /* cm^3 */ -#define GSL_CONST_CGS_FLUID_OUNCE (2.95735295626e1) /* cm^3 */ -#define GSL_CONST_CGS_TABLESPOON (1.47867647813e1) /* cm^3 */ -#define GSL_CONST_CGS_TEASPOON (4.92892159375e0) /* cm^3 */ -#define GSL_CONST_CGS_CANADIAN_GALLON (4.54609e3) /* cm^3 */ -#define GSL_CONST_CGS_UK_GALLON (4.546092e3) /* cm^3 */ -#define GSL_CONST_CGS_MILES_PER_HOUR (4.4704e1) /* cm / s */ -#define GSL_CONST_CGS_KILOMETERS_PER_HOUR (2.77777777778e1) /* cm / s */ -#define GSL_CONST_CGS_KNOT (5.14444444444e1) /* cm / s */ -#define GSL_CONST_CGS_POUND_MASS (4.5359237e2) /* g */ -#define GSL_CONST_CGS_OUNCE_MASS (2.8349523125e1) /* g */ -#define GSL_CONST_CGS_TON (9.0718474e5) /* g */ -#define GSL_CONST_CGS_METRIC_TON (1e6) /* g */ -#define GSL_CONST_CGS_UK_TON (1.0160469088e6) /* g */ -#define GSL_CONST_CGS_TROY_OUNCE (3.1103475e1) /* g */ -#define GSL_CONST_CGS_CARAT (2e-1) /* g */ -#define GSL_CONST_CGS_UNIFIED_ATOMIC_MASS (1.660538782e-24) /* g */ -#define GSL_CONST_CGS_GRAM_FORCE (9.80665e2) /* cm g / s^2 */ -#define GSL_CONST_CGS_POUND_FORCE (4.44822161526e5) /* cm g / s^2 */ -#define GSL_CONST_CGS_KILOPOUND_FORCE (4.44822161526e8) /* cm g / s^2 */ -#define GSL_CONST_CGS_POUNDAL (1.38255e4) /* cm g / s^2 */ -#define GSL_CONST_CGS_CALORIE (4.1868e7) /* g cm^2 / s^2 */ -#define GSL_CONST_CGS_BTU (1.05505585262e10) /* g cm^2 / s^2 */ -#define GSL_CONST_CGS_THERM (1.05506e15) /* g cm^2 / s^2 */ -#define GSL_CONST_CGS_HORSEPOWER (7.457e9) /* g cm^2 / s^3 */ -#define GSL_CONST_CGS_BAR (1e6) /* g / cm s^2 */ -#define GSL_CONST_CGS_STD_ATMOSPHERE (1.01325e6) /* g / cm s^2 */ -#define GSL_CONST_CGS_TORR (1.33322368421e3) /* g / cm s^2 */ -#define GSL_CONST_CGS_METER_OF_MERCURY (1.33322368421e6) /* g / cm s^2 */ -#define GSL_CONST_CGS_INCH_OF_MERCURY (3.38638815789e4) /* g / cm s^2 */ -#define GSL_CONST_CGS_INCH_OF_WATER (2.490889e3) /* g / cm s^2 */ -#define GSL_CONST_CGS_PSI (6.89475729317e4) /* g / cm s^2 */ -#define GSL_CONST_CGS_POISE (1e0) /* g / cm s */ -#define GSL_CONST_CGS_STOKES (1e0) /* cm^2 / s */ -#define GSL_CONST_CGS_STILB (1e0) /* cd / cm^2 */ -#define GSL_CONST_CGS_LUMEN (1e0) /* cd sr */ -#define GSL_CONST_CGS_LUX (1e-4) /* cd sr / cm^2 */ -#define GSL_CONST_CGS_PHOT (1e0) /* cd sr / cm^2 */ -#define GSL_CONST_CGS_FOOTCANDLE (1.076e-3) /* cd sr / cm^2 */ -#define GSL_CONST_CGS_LAMBERT (1e0) /* cd sr / cm^2 */ -#define GSL_CONST_CGS_FOOTLAMBERT (1.07639104e-3) /* cd sr / cm^2 */ -#define GSL_CONST_CGS_CURIE (3.7e10) /* 1 / s */ -#define GSL_CONST_CGS_ROENTGEN (2.58e-7) /* A s / g */ -#define GSL_CONST_CGS_RAD (1e2) /* cm^2 / s^2 */ -#define GSL_CONST_CGS_SOLAR_MASS (1.98892e33) /* g */ -#define GSL_CONST_CGS_BOHR_RADIUS (5.291772083e-9) /* cm */ -#define GSL_CONST_CGS_NEWTON (1e5) /* cm g / s^2 */ -#define GSL_CONST_CGS_DYNE (1e0) /* cm g / s^2 */ -#define GSL_CONST_CGS_JOULE (1e7) /* g cm^2 / s^2 */ -#define GSL_CONST_CGS_ERG (1e0) /* g cm^2 / s^2 */ -#define GSL_CONST_CGS_STEFAN_BOLTZMANN_CONSTANT (5.67040047374e-5) /* g / K^4 s^3 */ -#define GSL_CONST_CGS_THOMSON_CROSS_SECTION (6.65245893699e-25) /* cm^2 */ - -#endif /* __GSL_CONST_CGS__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_cgsm.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_cgsm.h deleted file mode 100644 index 2047e5edd..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_cgsm.h +++ /dev/null @@ -1,122 +0,0 @@ -/* const/gsl_const_cgsm.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - * 2006, 2007, 2008, 2009 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_CONST_CGSM__ -#define __GSL_CONST_CGSM__ - -#define GSL_CONST_CGSM_SPEED_OF_LIGHT (2.99792458e10) /* cm / s */ -#define GSL_CONST_CGSM_GRAVITATIONAL_CONSTANT (6.673e-8) /* cm^3 / g s^2 */ -#define GSL_CONST_CGSM_PLANCKS_CONSTANT_H (6.62606896e-27) /* g cm^2 / s */ -#define GSL_CONST_CGSM_PLANCKS_CONSTANT_HBAR (1.05457162825e-27) /* g cm^2 / s */ -#define GSL_CONST_CGSM_ASTRONOMICAL_UNIT (1.49597870691e13) /* cm */ -#define GSL_CONST_CGSM_LIGHT_YEAR (9.46053620707e17) /* cm */ -#define GSL_CONST_CGSM_PARSEC (3.08567758135e18) /* cm */ -#define GSL_CONST_CGSM_GRAV_ACCEL (9.80665e2) /* cm / s^2 */ -#define GSL_CONST_CGSM_ELECTRON_VOLT (1.602176487e-12) /* g cm^2 / s^2 */ -#define GSL_CONST_CGSM_MASS_ELECTRON (9.10938188e-28) /* g */ -#define GSL_CONST_CGSM_MASS_MUON (1.88353109e-25) /* g */ -#define GSL_CONST_CGSM_MASS_PROTON (1.67262158e-24) /* g */ -#define GSL_CONST_CGSM_MASS_NEUTRON (1.67492716e-24) /* g */ -#define GSL_CONST_CGSM_RYDBERG (2.17987196968e-11) /* g cm^2 / s^2 */ -#define GSL_CONST_CGSM_BOLTZMANN (1.3806504e-16) /* g cm^2 / K s^2 */ -#define GSL_CONST_CGSM_MOLAR_GAS (8.314472e7) /* g cm^2 / K mol s^2 */ -#define GSL_CONST_CGSM_STANDARD_GAS_VOLUME (2.2710981e4) /* cm^3 / mol */ -#define GSL_CONST_CGSM_MINUTE (6e1) /* s */ -#define GSL_CONST_CGSM_HOUR (3.6e3) /* s */ -#define GSL_CONST_CGSM_DAY (8.64e4) /* s */ -#define GSL_CONST_CGSM_WEEK (6.048e5) /* s */ -#define GSL_CONST_CGSM_INCH (2.54e0) /* cm */ -#define GSL_CONST_CGSM_FOOT (3.048e1) /* cm */ -#define GSL_CONST_CGSM_YARD (9.144e1) /* cm */ -#define GSL_CONST_CGSM_MILE (1.609344e5) /* cm */ -#define GSL_CONST_CGSM_NAUTICAL_MILE (1.852e5) /* cm */ -#define GSL_CONST_CGSM_FATHOM (1.8288e2) /* cm */ -#define GSL_CONST_CGSM_MIL (2.54e-3) /* cm */ -#define GSL_CONST_CGSM_POINT (3.52777777778e-2) /* cm */ -#define GSL_CONST_CGSM_TEXPOINT (3.51459803515e-2) /* cm */ -#define GSL_CONST_CGSM_MICRON (1e-4) /* cm */ -#define GSL_CONST_CGSM_ANGSTROM (1e-8) /* cm */ -#define GSL_CONST_CGSM_HECTARE (1e8) /* cm^2 */ -#define GSL_CONST_CGSM_ACRE (4.04685642241e7) /* cm^2 */ -#define GSL_CONST_CGSM_BARN (1e-24) /* cm^2 */ -#define GSL_CONST_CGSM_LITER (1e3) /* cm^3 */ -#define GSL_CONST_CGSM_US_GALLON (3.78541178402e3) /* cm^3 */ -#define GSL_CONST_CGSM_QUART (9.46352946004e2) /* cm^3 */ -#define GSL_CONST_CGSM_PINT (4.73176473002e2) /* cm^3 */ -#define GSL_CONST_CGSM_CUP (2.36588236501e2) /* cm^3 */ -#define GSL_CONST_CGSM_FLUID_OUNCE (2.95735295626e1) /* cm^3 */ -#define GSL_CONST_CGSM_TABLESPOON (1.47867647813e1) /* cm^3 */ -#define GSL_CONST_CGSM_TEASPOON (4.92892159375e0) /* cm^3 */ -#define GSL_CONST_CGSM_CANADIAN_GALLON (4.54609e3) /* cm^3 */ -#define GSL_CONST_CGSM_UK_GALLON (4.546092e3) /* cm^3 */ -#define GSL_CONST_CGSM_MILES_PER_HOUR (4.4704e1) /* cm / s */ -#define GSL_CONST_CGSM_KILOMETERS_PER_HOUR (2.77777777778e1) /* cm / s */ -#define GSL_CONST_CGSM_KNOT (5.14444444444e1) /* cm / s */ -#define GSL_CONST_CGSM_POUND_MASS (4.5359237e2) /* g */ -#define GSL_CONST_CGSM_OUNCE_MASS (2.8349523125e1) /* g */ -#define GSL_CONST_CGSM_TON (9.0718474e5) /* g */ -#define GSL_CONST_CGSM_METRIC_TON (1e6) /* g */ -#define GSL_CONST_CGSM_UK_TON (1.0160469088e6) /* g */ -#define GSL_CONST_CGSM_TROY_OUNCE (3.1103475e1) /* g */ -#define GSL_CONST_CGSM_CARAT (2e-1) /* g */ -#define GSL_CONST_CGSM_UNIFIED_ATOMIC_MASS (1.660538782e-24) /* g */ -#define GSL_CONST_CGSM_GRAM_FORCE (9.80665e2) /* cm g / s^2 */ -#define GSL_CONST_CGSM_POUND_FORCE (4.44822161526e5) /* cm g / s^2 */ -#define GSL_CONST_CGSM_KILOPOUND_FORCE (4.44822161526e8) /* cm g / s^2 */ -#define GSL_CONST_CGSM_POUNDAL (1.38255e4) /* cm g / s^2 */ -#define GSL_CONST_CGSM_CALORIE (4.1868e7) /* g cm^2 / s^2 */ -#define GSL_CONST_CGSM_BTU (1.05505585262e10) /* g cm^2 / s^2 */ -#define GSL_CONST_CGSM_THERM (1.05506e15) /* g cm^2 / s^2 */ -#define GSL_CONST_CGSM_HORSEPOWER (7.457e9) /* g cm^2 / s^3 */ -#define GSL_CONST_CGSM_BAR (1e6) /* g / cm s^2 */ -#define GSL_CONST_CGSM_STD_ATMOSPHERE (1.01325e6) /* g / cm s^2 */ -#define GSL_CONST_CGSM_TORR (1.33322368421e3) /* g / cm s^2 */ -#define GSL_CONST_CGSM_METER_OF_MERCURY (1.33322368421e6) /* g / cm s^2 */ -#define GSL_CONST_CGSM_INCH_OF_MERCURY (3.38638815789e4) /* g / cm s^2 */ -#define GSL_CONST_CGSM_INCH_OF_WATER (2.490889e3) /* g / cm s^2 */ -#define GSL_CONST_CGSM_PSI (6.89475729317e4) /* g / cm s^2 */ -#define GSL_CONST_CGSM_POISE (1e0) /* g / cm s */ -#define GSL_CONST_CGSM_STOKES (1e0) /* cm^2 / s */ -#define GSL_CONST_CGSM_STILB (1e0) /* cd / cm^2 */ -#define GSL_CONST_CGSM_LUMEN (1e0) /* cd sr */ -#define GSL_CONST_CGSM_LUX (1e-4) /* cd sr / cm^2 */ -#define GSL_CONST_CGSM_PHOT (1e0) /* cd sr / cm^2 */ -#define GSL_CONST_CGSM_FOOTCANDLE (1.076e-3) /* cd sr / cm^2 */ -#define GSL_CONST_CGSM_LAMBERT (1e0) /* cd sr / cm^2 */ -#define GSL_CONST_CGSM_FOOTLAMBERT (1.07639104e-3) /* cd sr / cm^2 */ -#define GSL_CONST_CGSM_CURIE (3.7e10) /* 1 / s */ -#define GSL_CONST_CGSM_ROENTGEN (2.58e-8) /* abamp s / g */ -#define GSL_CONST_CGSM_RAD (1e2) /* cm^2 / s^2 */ -#define GSL_CONST_CGSM_SOLAR_MASS (1.98892e33) /* g */ -#define GSL_CONST_CGSM_BOHR_RADIUS (5.291772083e-9) /* cm */ -#define GSL_CONST_CGSM_NEWTON (1e5) /* cm g / s^2 */ -#define GSL_CONST_CGSM_DYNE (1e0) /* cm g / s^2 */ -#define GSL_CONST_CGSM_JOULE (1e7) /* g cm^2 / s^2 */ -#define GSL_CONST_CGSM_ERG (1e0) /* g cm^2 / s^2 */ -#define GSL_CONST_CGSM_STEFAN_BOLTZMANN_CONSTANT (5.67040047374e-5) /* g / K^4 s^3 */ -#define GSL_CONST_CGSM_THOMSON_CROSS_SECTION (6.65245893699e-25) /* cm^2 */ -#define GSL_CONST_CGSM_BOHR_MAGNETON (9.27400899e-21) /* abamp cm^2 */ -#define GSL_CONST_CGSM_NUCLEAR_MAGNETON (5.05078317e-24) /* abamp cm^2 */ -#define GSL_CONST_CGSM_ELECTRON_MAGNETIC_MOMENT (9.28476362e-21) /* abamp cm^2 */ -#define GSL_CONST_CGSM_PROTON_MAGNETIC_MOMENT (1.410606633e-23) /* abamp cm^2 */ -#define GSL_CONST_CGSM_FARADAY (9.64853429775e3) /* abamp s / mol */ -#define GSL_CONST_CGSM_ELECTRON_CHARGE (1.602176487e-20) /* abamp s */ - -#endif /* __GSL_CONST_CGSM__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_mks.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_mks.h deleted file mode 100644 index bc60e2acb..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_mks.h +++ /dev/null @@ -1,126 +0,0 @@ -/* const/gsl_const_mks.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - * 2006, 2007, 2008, 2009 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_CONST_MKS__ -#define __GSL_CONST_MKS__ - -#define GSL_CONST_MKS_SPEED_OF_LIGHT (2.99792458e8) /* m / s */ -#define GSL_CONST_MKS_GRAVITATIONAL_CONSTANT (6.673e-11) /* m^3 / kg s^2 */ -#define GSL_CONST_MKS_PLANCKS_CONSTANT_H (6.62606896e-34) /* kg m^2 / s */ -#define GSL_CONST_MKS_PLANCKS_CONSTANT_HBAR (1.05457162825e-34) /* kg m^2 / s */ -#define GSL_CONST_MKS_ASTRONOMICAL_UNIT (1.49597870691e11) /* m */ -#define GSL_CONST_MKS_LIGHT_YEAR (9.46053620707e15) /* m */ -#define GSL_CONST_MKS_PARSEC (3.08567758135e16) /* m */ -#define GSL_CONST_MKS_GRAV_ACCEL (9.80665e0) /* m / s^2 */ -#define GSL_CONST_MKS_ELECTRON_VOLT (1.602176487e-19) /* kg m^2 / s^2 */ -#define GSL_CONST_MKS_MASS_ELECTRON (9.10938188e-31) /* kg */ -#define GSL_CONST_MKS_MASS_MUON (1.88353109e-28) /* kg */ -#define GSL_CONST_MKS_MASS_PROTON (1.67262158e-27) /* kg */ -#define GSL_CONST_MKS_MASS_NEUTRON (1.67492716e-27) /* kg */ -#define GSL_CONST_MKS_RYDBERG (2.17987196968e-18) /* kg m^2 / s^2 */ -#define GSL_CONST_MKS_BOLTZMANN (1.3806504e-23) /* kg m^2 / K s^2 */ -#define GSL_CONST_MKS_MOLAR_GAS (8.314472e0) /* kg m^2 / K mol s^2 */ -#define GSL_CONST_MKS_STANDARD_GAS_VOLUME (2.2710981e-2) /* m^3 / mol */ -#define GSL_CONST_MKS_MINUTE (6e1) /* s */ -#define GSL_CONST_MKS_HOUR (3.6e3) /* s */ -#define GSL_CONST_MKS_DAY (8.64e4) /* s */ -#define GSL_CONST_MKS_WEEK (6.048e5) /* s */ -#define GSL_CONST_MKS_INCH (2.54e-2) /* m */ -#define GSL_CONST_MKS_FOOT (3.048e-1) /* m */ -#define GSL_CONST_MKS_YARD (9.144e-1) /* m */ -#define GSL_CONST_MKS_MILE (1.609344e3) /* m */ -#define GSL_CONST_MKS_NAUTICAL_MILE (1.852e3) /* m */ -#define GSL_CONST_MKS_FATHOM (1.8288e0) /* m */ -#define GSL_CONST_MKS_MIL (2.54e-5) /* m */ -#define GSL_CONST_MKS_POINT (3.52777777778e-4) /* m */ -#define GSL_CONST_MKS_TEXPOINT (3.51459803515e-4) /* m */ -#define GSL_CONST_MKS_MICRON (1e-6) /* m */ -#define GSL_CONST_MKS_ANGSTROM (1e-10) /* m */ -#define GSL_CONST_MKS_HECTARE (1e4) /* m^2 */ -#define GSL_CONST_MKS_ACRE (4.04685642241e3) /* m^2 */ -#define GSL_CONST_MKS_BARN (1e-28) /* m^2 */ -#define GSL_CONST_MKS_LITER (1e-3) /* m^3 */ -#define GSL_CONST_MKS_US_GALLON (3.78541178402e-3) /* m^3 */ -#define GSL_CONST_MKS_QUART (9.46352946004e-4) /* m^3 */ -#define GSL_CONST_MKS_PINT (4.73176473002e-4) /* m^3 */ -#define GSL_CONST_MKS_CUP (2.36588236501e-4) /* m^3 */ -#define GSL_CONST_MKS_FLUID_OUNCE (2.95735295626e-5) /* m^3 */ -#define GSL_CONST_MKS_TABLESPOON (1.47867647813e-5) /* m^3 */ -#define GSL_CONST_MKS_TEASPOON (4.92892159375e-6) /* m^3 */ -#define GSL_CONST_MKS_CANADIAN_GALLON (4.54609e-3) /* m^3 */ -#define GSL_CONST_MKS_UK_GALLON (4.546092e-3) /* m^3 */ -#define GSL_CONST_MKS_MILES_PER_HOUR (4.4704e-1) /* m / s */ -#define GSL_CONST_MKS_KILOMETERS_PER_HOUR (2.77777777778e-1) /* m / s */ -#define GSL_CONST_MKS_KNOT (5.14444444444e-1) /* m / s */ -#define GSL_CONST_MKS_POUND_MASS (4.5359237e-1) /* kg */ -#define GSL_CONST_MKS_OUNCE_MASS (2.8349523125e-2) /* kg */ -#define GSL_CONST_MKS_TON (9.0718474e2) /* kg */ -#define GSL_CONST_MKS_METRIC_TON (1e3) /* kg */ -#define GSL_CONST_MKS_UK_TON (1.0160469088e3) /* kg */ -#define GSL_CONST_MKS_TROY_OUNCE (3.1103475e-2) /* kg */ -#define GSL_CONST_MKS_CARAT (2e-4) /* kg */ -#define GSL_CONST_MKS_UNIFIED_ATOMIC_MASS (1.660538782e-27) /* kg */ -#define GSL_CONST_MKS_GRAM_FORCE (9.80665e-3) /* kg m / s^2 */ -#define GSL_CONST_MKS_POUND_FORCE (4.44822161526e0) /* kg m / s^2 */ -#define GSL_CONST_MKS_KILOPOUND_FORCE (4.44822161526e3) /* kg m / s^2 */ -#define GSL_CONST_MKS_POUNDAL (1.38255e-1) /* kg m / s^2 */ -#define GSL_CONST_MKS_CALORIE (4.1868e0) /* kg m^2 / s^2 */ -#define GSL_CONST_MKS_BTU (1.05505585262e3) /* kg m^2 / s^2 */ -#define GSL_CONST_MKS_THERM (1.05506e8) /* kg m^2 / s^2 */ -#define GSL_CONST_MKS_HORSEPOWER (7.457e2) /* kg m^2 / s^3 */ -#define GSL_CONST_MKS_BAR (1e5) /* kg / m s^2 */ -#define GSL_CONST_MKS_STD_ATMOSPHERE (1.01325e5) /* kg / m s^2 */ -#define GSL_CONST_MKS_TORR (1.33322368421e2) /* kg / m s^2 */ -#define GSL_CONST_MKS_METER_OF_MERCURY (1.33322368421e5) /* kg / m s^2 */ -#define GSL_CONST_MKS_INCH_OF_MERCURY (3.38638815789e3) /* kg / m s^2 */ -#define GSL_CONST_MKS_INCH_OF_WATER (2.490889e2) /* kg / m s^2 */ -#define GSL_CONST_MKS_PSI (6.89475729317e3) /* kg / m s^2 */ -#define GSL_CONST_MKS_POISE (1e-1) /* kg m^-1 s^-1 */ -#define GSL_CONST_MKS_STOKES (1e-4) /* m^2 / s */ -#define GSL_CONST_MKS_STILB (1e4) /* cd / m^2 */ -#define GSL_CONST_MKS_LUMEN (1e0) /* cd sr */ -#define GSL_CONST_MKS_LUX (1e0) /* cd sr / m^2 */ -#define GSL_CONST_MKS_PHOT (1e4) /* cd sr / m^2 */ -#define GSL_CONST_MKS_FOOTCANDLE (1.076e1) /* cd sr / m^2 */ -#define GSL_CONST_MKS_LAMBERT (1e4) /* cd sr / m^2 */ -#define GSL_CONST_MKS_FOOTLAMBERT (1.07639104e1) /* cd sr / m^2 */ -#define GSL_CONST_MKS_CURIE (3.7e10) /* 1 / s */ -#define GSL_CONST_MKS_ROENTGEN (2.58e-4) /* A s / kg */ -#define GSL_CONST_MKS_RAD (1e-2) /* m^2 / s^2 */ -#define GSL_CONST_MKS_SOLAR_MASS (1.98892e30) /* kg */ -#define GSL_CONST_MKS_BOHR_RADIUS (5.291772083e-11) /* m */ -#define GSL_CONST_MKS_NEWTON (1e0) /* kg m / s^2 */ -#define GSL_CONST_MKS_DYNE (1e-5) /* kg m / s^2 */ -#define GSL_CONST_MKS_JOULE (1e0) /* kg m^2 / s^2 */ -#define GSL_CONST_MKS_ERG (1e-7) /* kg m^2 / s^2 */ -#define GSL_CONST_MKS_STEFAN_BOLTZMANN_CONSTANT (5.67040047374e-8) /* kg / K^4 s^3 */ -#define GSL_CONST_MKS_THOMSON_CROSS_SECTION (6.65245893699e-29) /* m^2 */ -#define GSL_CONST_MKS_BOHR_MAGNETON (9.27400899e-24) /* A m^2 */ -#define GSL_CONST_MKS_NUCLEAR_MAGNETON (5.05078317e-27) /* A m^2 */ -#define GSL_CONST_MKS_ELECTRON_MAGNETIC_MOMENT (9.28476362e-24) /* A m^2 */ -#define GSL_CONST_MKS_PROTON_MAGNETIC_MOMENT (1.410606633e-26) /* A m^2 */ -#define GSL_CONST_MKS_FARADAY (9.64853429775e4) /* A s / mol */ -#define GSL_CONST_MKS_ELECTRON_CHARGE (1.602176487e-19) /* A s */ -#define GSL_CONST_MKS_VACUUM_PERMITTIVITY (8.854187817e-12) /* A^2 s^4 / kg m^3 */ -#define GSL_CONST_MKS_VACUUM_PERMEABILITY (1.25663706144e-6) /* kg m / A^2 s^2 */ -#define GSL_CONST_MKS_DEBYE (3.33564095198e-30) /* A s^2 / m^2 */ -#define GSL_CONST_MKS_GAUSS (1e-4) /* kg / A s^2 */ - -#endif /* __GSL_CONST_MKS__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_mksa.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_mksa.h deleted file mode 100644 index 5d91d1ca4..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_mksa.h +++ /dev/null @@ -1,126 +0,0 @@ -/* const/gsl_const_mksa.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - * 2006, 2007, 2008, 2009 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_CONST_MKSA__ -#define __GSL_CONST_MKSA__ - -#define GSL_CONST_MKSA_SPEED_OF_LIGHT (2.99792458e8) /* m / s */ -#define GSL_CONST_MKSA_GRAVITATIONAL_CONSTANT (6.673e-11) /* m^3 / kg s^2 */ -#define GSL_CONST_MKSA_PLANCKS_CONSTANT_H (6.62606896e-34) /* kg m^2 / s */ -#define GSL_CONST_MKSA_PLANCKS_CONSTANT_HBAR (1.05457162825e-34) /* kg m^2 / s */ -#define GSL_CONST_MKSA_ASTRONOMICAL_UNIT (1.49597870691e11) /* m */ -#define GSL_CONST_MKSA_LIGHT_YEAR (9.46053620707e15) /* m */ -#define GSL_CONST_MKSA_PARSEC (3.08567758135e16) /* m */ -#define GSL_CONST_MKSA_GRAV_ACCEL (9.80665e0) /* m / s^2 */ -#define GSL_CONST_MKSA_ELECTRON_VOLT (1.602176487e-19) /* kg m^2 / s^2 */ -#define GSL_CONST_MKSA_MASS_ELECTRON (9.10938188e-31) /* kg */ -#define GSL_CONST_MKSA_MASS_MUON (1.88353109e-28) /* kg */ -#define GSL_CONST_MKSA_MASS_PROTON (1.67262158e-27) /* kg */ -#define GSL_CONST_MKSA_MASS_NEUTRON (1.67492716e-27) /* kg */ -#define GSL_CONST_MKSA_RYDBERG (2.17987196968e-18) /* kg m^2 / s^2 */ -#define GSL_CONST_MKSA_BOLTZMANN (1.3806504e-23) /* kg m^2 / K s^2 */ -#define GSL_CONST_MKSA_MOLAR_GAS (8.314472e0) /* kg m^2 / K mol s^2 */ -#define GSL_CONST_MKSA_STANDARD_GAS_VOLUME (2.2710981e-2) /* m^3 / mol */ -#define GSL_CONST_MKSA_MINUTE (6e1) /* s */ -#define GSL_CONST_MKSA_HOUR (3.6e3) /* s */ -#define GSL_CONST_MKSA_DAY (8.64e4) /* s */ -#define GSL_CONST_MKSA_WEEK (6.048e5) /* s */ -#define GSL_CONST_MKSA_INCH (2.54e-2) /* m */ -#define GSL_CONST_MKSA_FOOT (3.048e-1) /* m */ -#define GSL_CONST_MKSA_YARD (9.144e-1) /* m */ -#define GSL_CONST_MKSA_MILE (1.609344e3) /* m */ -#define GSL_CONST_MKSA_NAUTICAL_MILE (1.852e3) /* m */ -#define GSL_CONST_MKSA_FATHOM (1.8288e0) /* m */ -#define GSL_CONST_MKSA_MIL (2.54e-5) /* m */ -#define GSL_CONST_MKSA_POINT (3.52777777778e-4) /* m */ -#define GSL_CONST_MKSA_TEXPOINT (3.51459803515e-4) /* m */ -#define GSL_CONST_MKSA_MICRON (1e-6) /* m */ -#define GSL_CONST_MKSA_ANGSTROM (1e-10) /* m */ -#define GSL_CONST_MKSA_HECTARE (1e4) /* m^2 */ -#define GSL_CONST_MKSA_ACRE (4.04685642241e3) /* m^2 */ -#define GSL_CONST_MKSA_BARN (1e-28) /* m^2 */ -#define GSL_CONST_MKSA_LITER (1e-3) /* m^3 */ -#define GSL_CONST_MKSA_US_GALLON (3.78541178402e-3) /* m^3 */ -#define GSL_CONST_MKSA_QUART (9.46352946004e-4) /* m^3 */ -#define GSL_CONST_MKSA_PINT (4.73176473002e-4) /* m^3 */ -#define GSL_CONST_MKSA_CUP (2.36588236501e-4) /* m^3 */ -#define GSL_CONST_MKSA_FLUID_OUNCE (2.95735295626e-5) /* m^3 */ -#define GSL_CONST_MKSA_TABLESPOON (1.47867647813e-5) /* m^3 */ -#define GSL_CONST_MKSA_TEASPOON (4.92892159375e-6) /* m^3 */ -#define GSL_CONST_MKSA_CANADIAN_GALLON (4.54609e-3) /* m^3 */ -#define GSL_CONST_MKSA_UK_GALLON (4.546092e-3) /* m^3 */ -#define GSL_CONST_MKSA_MILES_PER_HOUR (4.4704e-1) /* m / s */ -#define GSL_CONST_MKSA_KILOMETERS_PER_HOUR (2.77777777778e-1) /* m / s */ -#define GSL_CONST_MKSA_KNOT (5.14444444444e-1) /* m / s */ -#define GSL_CONST_MKSA_POUND_MASS (4.5359237e-1) /* kg */ -#define GSL_CONST_MKSA_OUNCE_MASS (2.8349523125e-2) /* kg */ -#define GSL_CONST_MKSA_TON (9.0718474e2) /* kg */ -#define GSL_CONST_MKSA_METRIC_TON (1e3) /* kg */ -#define GSL_CONST_MKSA_UK_TON (1.0160469088e3) /* kg */ -#define GSL_CONST_MKSA_TROY_OUNCE (3.1103475e-2) /* kg */ -#define GSL_CONST_MKSA_CARAT (2e-4) /* kg */ -#define GSL_CONST_MKSA_UNIFIED_ATOMIC_MASS (1.660538782e-27) /* kg */ -#define GSL_CONST_MKSA_GRAM_FORCE (9.80665e-3) /* kg m / s^2 */ -#define GSL_CONST_MKSA_POUND_FORCE (4.44822161526e0) /* kg m / s^2 */ -#define GSL_CONST_MKSA_KILOPOUND_FORCE (4.44822161526e3) /* kg m / s^2 */ -#define GSL_CONST_MKSA_POUNDAL (1.38255e-1) /* kg m / s^2 */ -#define GSL_CONST_MKSA_CALORIE (4.1868e0) /* kg m^2 / s^2 */ -#define GSL_CONST_MKSA_BTU (1.05505585262e3) /* kg m^2 / s^2 */ -#define GSL_CONST_MKSA_THERM (1.05506e8) /* kg m^2 / s^2 */ -#define GSL_CONST_MKSA_HORSEPOWER (7.457e2) /* kg m^2 / s^3 */ -#define GSL_CONST_MKSA_BAR (1e5) /* kg / m s^2 */ -#define GSL_CONST_MKSA_STD_ATMOSPHERE (1.01325e5) /* kg / m s^2 */ -#define GSL_CONST_MKSA_TORR (1.33322368421e2) /* kg / m s^2 */ -#define GSL_CONST_MKSA_METER_OF_MERCURY (1.33322368421e5) /* kg / m s^2 */ -#define GSL_CONST_MKSA_INCH_OF_MERCURY (3.38638815789e3) /* kg / m s^2 */ -#define GSL_CONST_MKSA_INCH_OF_WATER (2.490889e2) /* kg / m s^2 */ -#define GSL_CONST_MKSA_PSI (6.89475729317e3) /* kg / m s^2 */ -#define GSL_CONST_MKSA_POISE (1e-1) /* kg m^-1 s^-1 */ -#define GSL_CONST_MKSA_STOKES (1e-4) /* m^2 / s */ -#define GSL_CONST_MKSA_STILB (1e4) /* cd / m^2 */ -#define GSL_CONST_MKSA_LUMEN (1e0) /* cd sr */ -#define GSL_CONST_MKSA_LUX (1e0) /* cd sr / m^2 */ -#define GSL_CONST_MKSA_PHOT (1e4) /* cd sr / m^2 */ -#define GSL_CONST_MKSA_FOOTCANDLE (1.076e1) /* cd sr / m^2 */ -#define GSL_CONST_MKSA_LAMBERT (1e4) /* cd sr / m^2 */ -#define GSL_CONST_MKSA_FOOTLAMBERT (1.07639104e1) /* cd sr / m^2 */ -#define GSL_CONST_MKSA_CURIE (3.7e10) /* 1 / s */ -#define GSL_CONST_MKSA_ROENTGEN (2.58e-4) /* A s / kg */ -#define GSL_CONST_MKSA_RAD (1e-2) /* m^2 / s^2 */ -#define GSL_CONST_MKSA_SOLAR_MASS (1.98892e30) /* kg */ -#define GSL_CONST_MKSA_BOHR_RADIUS (5.291772083e-11) /* m */ -#define GSL_CONST_MKSA_NEWTON (1e0) /* kg m / s^2 */ -#define GSL_CONST_MKSA_DYNE (1e-5) /* kg m / s^2 */ -#define GSL_CONST_MKSA_JOULE (1e0) /* kg m^2 / s^2 */ -#define GSL_CONST_MKSA_ERG (1e-7) /* kg m^2 / s^2 */ -#define GSL_CONST_MKSA_STEFAN_BOLTZMANN_CONSTANT (5.67040047374e-8) /* kg / K^4 s^3 */ -#define GSL_CONST_MKSA_THOMSON_CROSS_SECTION (6.65245893699e-29) /* m^2 */ -#define GSL_CONST_MKSA_BOHR_MAGNETON (9.27400899e-24) /* A m^2 */ -#define GSL_CONST_MKSA_NUCLEAR_MAGNETON (5.05078317e-27) /* A m^2 */ -#define GSL_CONST_MKSA_ELECTRON_MAGNETIC_MOMENT (9.28476362e-24) /* A m^2 */ -#define GSL_CONST_MKSA_PROTON_MAGNETIC_MOMENT (1.410606633e-26) /* A m^2 */ -#define GSL_CONST_MKSA_FARADAY (9.64853429775e4) /* A s / mol */ -#define GSL_CONST_MKSA_ELECTRON_CHARGE (1.602176487e-19) /* A s */ -#define GSL_CONST_MKSA_VACUUM_PERMITTIVITY (8.854187817e-12) /* A^2 s^4 / kg m^3 */ -#define GSL_CONST_MKSA_VACUUM_PERMEABILITY (1.25663706144e-6) /* kg m / A^2 s^2 */ -#define GSL_CONST_MKSA_DEBYE (3.33564095198e-30) /* A s^2 / m^2 */ -#define GSL_CONST_MKSA_GAUSS (1e-4) /* kg / A s^2 */ - -#endif /* __GSL_CONST_MKSA__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_num.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_num.h deleted file mode 100644 index 385a660f7..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_const_num.h +++ /dev/null @@ -1,43 +0,0 @@ -/* const/gsl_const_num.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - * 2006, 2007, 2008, 2009 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_CONST_NUM__ -#define __GSL_CONST_NUM__ - -#define GSL_CONST_NUM_FINE_STRUCTURE (7.297352533e-3) /* 1 */ -#define GSL_CONST_NUM_AVOGADRO (6.02214199e23) /* 1 / mol */ -#define GSL_CONST_NUM_YOTTA (1e24) /* 1 */ -#define GSL_CONST_NUM_ZETTA (1e21) /* 1 */ -#define GSL_CONST_NUM_EXA (1e18) /* 1 */ -#define GSL_CONST_NUM_PETA (1e15) /* 1 */ -#define GSL_CONST_NUM_TERA (1e12) /* 1 */ -#define GSL_CONST_NUM_GIGA (1e9) /* 1 */ -#define GSL_CONST_NUM_MEGA (1e6) /* 1 */ -#define GSL_CONST_NUM_KILO (1e3) /* 1 */ -#define GSL_CONST_NUM_MILLI (1e-3) /* 1 */ -#define GSL_CONST_NUM_MICRO (1e-6) /* 1 */ -#define GSL_CONST_NUM_NANO (1e-9) /* 1 */ -#define GSL_CONST_NUM_PICO (1e-12) /* 1 */ -#define GSL_CONST_NUM_FEMTO (1e-15) /* 1 */ -#define GSL_CONST_NUM_ATTO (1e-18) /* 1 */ -#define GSL_CONST_NUM_ZEPTO (1e-21) /* 1 */ -#define GSL_CONST_NUM_YOCTO (1e-24) /* 1 */ - -#endif /* __GSL_CONST_NUM__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_deriv.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_deriv.h deleted file mode 100644 index 7f4694fe7..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_deriv.h +++ /dev/null @@ -1,50 +0,0 @@ -/* deriv/gsl_deriv.h - * - * Copyright (C) 2000 David Morrison - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_DERIV_H__ -#define __GSL_DERIV_H__ -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_deriv_central (const gsl_function *f, - double x, double h, - double *result, double *abserr); - -int gsl_deriv_backward (const gsl_function *f, - double x, double h, - double *result, double *abserr); - -int gsl_deriv_forward (const gsl_function *f, - double x, double h, - double *result, double *abserr); - -__END_DECLS - -#endif /* __GSL_DERIV_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_dft_complex.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_dft_complex.h deleted file mode 100644 index cb4d08804..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_dft_complex.h +++ /dev/null @@ -1,55 +0,0 @@ -/* fft/gsl_dft_complex.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_DFT_COMPLEX_H__ -#define __GSL_DFT_COMPLEX_H__ - -#include - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_dft_complex_forward (const double data[], const size_t stride, const size_t n, - double result[]); - -int gsl_dft_complex_backward (const double data[], const size_t stride, const size_t n, - double result[]); - -int gsl_dft_complex_inverse (const double data[], const size_t stride, const size_t n, - double result[]); - -int gsl_dft_complex_transform (const double data[], const size_t stride, const size_t n, - double result[], const gsl_fft_direction sign); - -__END_DECLS - -#endif /* __GSL_DFT_COMPLEX_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_dft_complex_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_dft_complex_float.h deleted file mode 100644 index c511ac09f..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_dft_complex_float.h +++ /dev/null @@ -1,55 +0,0 @@ -/* fft/gsl_dft_complex_float.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_DFT_COMPLEX_FLOAT_H__ -#define __GSL_DFT_COMPLEX_FLOAT_H__ - -#include - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_dft_complex_float_forward (const float data[], const size_t stride, const size_t n, - float result[]); - -int gsl_dft_complex_float_backward (const float data[], const size_t stride, const size_t n, - float result[]); - -int gsl_dft_complex_float_inverse (const float data[], const size_t stride, const size_t n, - float result[]); - -int gsl_dft_complex_float_transform (const float data[], const size_t stride, const size_t n, - float result[], const gsl_fft_direction sign); - -__END_DECLS - -#endif /* __GSL_DFT_COMPLEX_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_dht.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_dht.h deleted file mode 100644 index bfc4b2fff..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_dht.h +++ /dev/null @@ -1,87 +0,0 @@ -/* dht/gsl_dht.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman - */ -#ifndef __GSL_DHT_H__ -#define __GSL_DHT_H__ - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -struct gsl_dht_struct { - size_t size; /* size of the sample arrays to be transformed */ - double nu; /* Bessel function order */ - double xmax; /* the upper limit to the x-sampling domain */ - double kmax; /* the upper limit to the k-sampling domain */ - double * j; /* array of computed J_nu zeros, j_{nu,s} = j[s] */ - double * Jjj; /* transform numerator, J_nu(j_i j_m / j_N) */ - double * J2; /* transform denominator, J_{nu+1}^2(j_m) */ -}; -typedef struct gsl_dht_struct gsl_dht; - - -/* Create a new transform object for a given size - * sampling array on the domain [0, xmax]. - */ -gsl_dht * gsl_dht_alloc(size_t size); -gsl_dht * gsl_dht_new(size_t size, double nu, double xmax); - -/* Recalculate a transform object for given values of nu, xmax. - * You cannot change the size of the object since the internal - * allocation is reused. - */ -int gsl_dht_init(gsl_dht * t, double nu, double xmax); - -/* The n'th computed x sample point for a given transform. - * 0 <= n <= size-1 - */ -double gsl_dht_x_sample(const gsl_dht * t, int n); - - -/* The n'th computed k sample point for a given transform. - * 0 <= n <= size-1 - */ -double gsl_dht_k_sample(const gsl_dht * t, int n); - - -/* Free a transform object. - */ -void gsl_dht_free(gsl_dht * t); - - -/* Perform a transform on a sampled array. - * f_in[0] ... f_in[size-1] and similarly for f_out[] - */ -int gsl_dht_apply(const gsl_dht * t, double * f_in, double * f_out); - - -__END_DECLS - -#endif /* __GSL_DHT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_diff.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_diff.h deleted file mode 100644 index a145894f4..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_diff.h +++ /dev/null @@ -1,52 +0,0 @@ -/* diff/gsl_diff.h - * - * Copyright (C) 2000 David Morrison - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_DIFF_H__ -#define __GSL_DIFF_H__ -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -#ifndef GSL_DISABLE_DEPRECATED -int gsl_diff_central (const gsl_function *f, - double x, - double *result, double *abserr); - -int gsl_diff_backward (const gsl_function *f, - double x, - double *result, double *abserr); - -int gsl_diff_forward (const gsl_function *f, - double x, - double *result, double *abserr); -#endif - -__END_DECLS - -#endif /* __GSL_DIFF_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_eigen.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_eigen.h deleted file mode 100644 index 6de8dba11..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_eigen.h +++ /dev/null @@ -1,347 +0,0 @@ -/* eigen/gsl_eigen.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2006, 2007 Gerard Jungman, Brian Gough, Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_EIGEN_H__ -#define __GSL_EIGEN_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct { - size_t size; - double * d; - double * sd; -} gsl_eigen_symm_workspace; - -gsl_eigen_symm_workspace * gsl_eigen_symm_alloc (const size_t n); -void gsl_eigen_symm_free (gsl_eigen_symm_workspace * w); -int gsl_eigen_symm (gsl_matrix * A, gsl_vector * eval, gsl_eigen_symm_workspace * w); - -typedef struct { - size_t size; - double * d; - double * sd; - double * gc; - double * gs; -} gsl_eigen_symmv_workspace; - -gsl_eigen_symmv_workspace * gsl_eigen_symmv_alloc (const size_t n); -void gsl_eigen_symmv_free (gsl_eigen_symmv_workspace * w); -int gsl_eigen_symmv (gsl_matrix * A, gsl_vector * eval, gsl_matrix * evec, gsl_eigen_symmv_workspace * w); - -typedef struct { - size_t size; - double * d; - double * sd; - double * tau; -} gsl_eigen_herm_workspace; - -gsl_eigen_herm_workspace * gsl_eigen_herm_alloc (const size_t n); -void gsl_eigen_herm_free (gsl_eigen_herm_workspace * w); -int gsl_eigen_herm (gsl_matrix_complex * A, gsl_vector * eval, - gsl_eigen_herm_workspace * w); - -typedef struct { - size_t size; - double * d; - double * sd; - double * tau; - double * gc; - double * gs; -} gsl_eigen_hermv_workspace; - -gsl_eigen_hermv_workspace * gsl_eigen_hermv_alloc (const size_t n); -void gsl_eigen_hermv_free (gsl_eigen_hermv_workspace * w); -int gsl_eigen_hermv (gsl_matrix_complex * A, gsl_vector * eval, - gsl_matrix_complex * evec, - gsl_eigen_hermv_workspace * w); - -typedef struct { - size_t size; /* matrix size */ - size_t max_iterations; /* max iterations since last eigenvalue found */ - size_t n_iter; /* number of iterations since last eigenvalue found */ - size_t n_evals; /* number of eigenvalues found so far */ - - int compute_t; /* compute Schur form T = Z^t A Z */ - - gsl_matrix *H; /* pointer to Hessenberg matrix */ - gsl_matrix *Z; /* pointer to Schur vector matrix */ -} gsl_eigen_francis_workspace; - -gsl_eigen_francis_workspace * gsl_eigen_francis_alloc (void); -void gsl_eigen_francis_free (gsl_eigen_francis_workspace * w); -void gsl_eigen_francis_T (const int compute_t, - gsl_eigen_francis_workspace * w); -int gsl_eigen_francis (gsl_matrix * H, gsl_vector_complex * eval, - gsl_eigen_francis_workspace * w); -int gsl_eigen_francis_Z (gsl_matrix * H, gsl_vector_complex * eval, - gsl_matrix * Z, - gsl_eigen_francis_workspace * w); - -typedef struct { - size_t size; /* size of matrices */ - gsl_vector *diag; /* diagonal matrix elements from balancing */ - gsl_vector *tau; /* Householder coefficients */ - gsl_matrix *Z; /* pointer to Z matrix */ - int do_balance; /* perform balancing transformation? */ - size_t n_evals; /* number of eigenvalues found */ - - gsl_eigen_francis_workspace *francis_workspace_p; -} gsl_eigen_nonsymm_workspace; - -gsl_eigen_nonsymm_workspace * gsl_eigen_nonsymm_alloc (const size_t n); -void gsl_eigen_nonsymm_free (gsl_eigen_nonsymm_workspace * w); -void gsl_eigen_nonsymm_params (const int compute_t, const int balance, - gsl_eigen_nonsymm_workspace *w); -int gsl_eigen_nonsymm (gsl_matrix * A, gsl_vector_complex * eval, - gsl_eigen_nonsymm_workspace * w); -int gsl_eigen_nonsymm_Z (gsl_matrix * A, gsl_vector_complex * eval, - gsl_matrix * Z, gsl_eigen_nonsymm_workspace * w); - -typedef struct { - size_t size; /* size of matrices */ - gsl_vector *work; /* scratch workspace */ - gsl_vector *work2; /* scratch workspace */ - gsl_vector *work3; /* scratch workspace */ - - gsl_matrix *Z; /* pointer to Schur vectors */ - - gsl_eigen_nonsymm_workspace *nonsymm_workspace_p; -} gsl_eigen_nonsymmv_workspace; - -gsl_eigen_nonsymmv_workspace * gsl_eigen_nonsymmv_alloc (const size_t n); -void gsl_eigen_nonsymmv_free (gsl_eigen_nonsymmv_workspace * w); -void gsl_eigen_nonsymmv_params (const int balance, - gsl_eigen_nonsymmv_workspace *w); -int gsl_eigen_nonsymmv (gsl_matrix * A, gsl_vector_complex * eval, - gsl_matrix_complex * evec, - gsl_eigen_nonsymmv_workspace * w); -int gsl_eigen_nonsymmv_Z (gsl_matrix * A, gsl_vector_complex * eval, - gsl_matrix_complex * evec, gsl_matrix * Z, - gsl_eigen_nonsymmv_workspace * w); - -typedef struct { - size_t size; /* size of matrices */ - gsl_eigen_symm_workspace *symm_workspace_p; -} gsl_eigen_gensymm_workspace; - -gsl_eigen_gensymm_workspace * gsl_eigen_gensymm_alloc (const size_t n); -void gsl_eigen_gensymm_free (gsl_eigen_gensymm_workspace * w); -int gsl_eigen_gensymm (gsl_matrix * A, gsl_matrix * B, - gsl_vector * eval, gsl_eigen_gensymm_workspace * w); -int gsl_eigen_gensymm_standardize (gsl_matrix * A, const gsl_matrix * B); - -typedef struct { - size_t size; /* size of matrices */ - gsl_eigen_symmv_workspace *symmv_workspace_p; -} gsl_eigen_gensymmv_workspace; - -gsl_eigen_gensymmv_workspace * gsl_eigen_gensymmv_alloc (const size_t n); -void gsl_eigen_gensymmv_free (gsl_eigen_gensymmv_workspace * w); -int gsl_eigen_gensymmv (gsl_matrix * A, gsl_matrix * B, - gsl_vector * eval, gsl_matrix * evec, - gsl_eigen_gensymmv_workspace * w); - -typedef struct { - size_t size; /* size of matrices */ - gsl_eigen_herm_workspace *herm_workspace_p; -} gsl_eigen_genherm_workspace; - -gsl_eigen_genherm_workspace * gsl_eigen_genherm_alloc (const size_t n); -void gsl_eigen_genherm_free (gsl_eigen_genherm_workspace * w); -int gsl_eigen_genherm (gsl_matrix_complex * A, gsl_matrix_complex * B, - gsl_vector * eval, gsl_eigen_genherm_workspace * w); -int gsl_eigen_genherm_standardize (gsl_matrix_complex * A, - const gsl_matrix_complex * B); - -typedef struct { - size_t size; /* size of matrices */ - gsl_eigen_hermv_workspace *hermv_workspace_p; -} gsl_eigen_genhermv_workspace; - -gsl_eigen_genhermv_workspace * gsl_eigen_genhermv_alloc (const size_t n); -void gsl_eigen_genhermv_free (gsl_eigen_genhermv_workspace * w); -int gsl_eigen_genhermv (gsl_matrix_complex * A, gsl_matrix_complex * B, - gsl_vector * eval, gsl_matrix_complex * evec, - gsl_eigen_genhermv_workspace * w); - -typedef struct { - size_t size; /* size of matrices */ - gsl_vector *work; /* scratch workspace */ - - size_t n_evals; /* number of eigenvalues found */ - size_t max_iterations; /* maximum QZ iterations allowed */ - size_t n_iter; /* number of iterations since last eigenvalue found */ - double eshift; /* exceptional shift counter */ - - int needtop; /* need to compute top index? */ - - double atol; /* tolerance for splitting A matrix */ - double btol; /* tolerance for splitting B matrix */ - - double ascale; /* scaling factor for shifts */ - double bscale; /* scaling factor for shifts */ - - gsl_matrix *H; /* pointer to hessenberg matrix */ - gsl_matrix *R; /* pointer to upper triangular matrix */ - - int compute_s; /* compute generalized Schur form S */ - int compute_t; /* compute generalized Schur form T */ - - gsl_matrix *Q; /* pointer to left Schur vectors */ - gsl_matrix *Z; /* pointer to right Schur vectors */ -} gsl_eigen_gen_workspace; - -gsl_eigen_gen_workspace * gsl_eigen_gen_alloc (const size_t n); -void gsl_eigen_gen_free (gsl_eigen_gen_workspace * w); -void gsl_eigen_gen_params (const int compute_s, const int compute_t, - const int balance, gsl_eigen_gen_workspace * w); -int gsl_eigen_gen (gsl_matrix * A, gsl_matrix * B, - gsl_vector_complex * alpha, gsl_vector * beta, - gsl_eigen_gen_workspace * w); -int gsl_eigen_gen_QZ (gsl_matrix * A, gsl_matrix * B, - gsl_vector_complex * alpha, gsl_vector * beta, - gsl_matrix * Q, gsl_matrix * Z, - gsl_eigen_gen_workspace * w); - -typedef struct { - size_t size; /* size of matrices */ - - gsl_vector *work1; /* 1-norm of columns of A */ - gsl_vector *work2; /* 1-norm of columns of B */ - gsl_vector *work3; /* real part of eigenvector */ - gsl_vector *work4; /* imag part of eigenvector */ - gsl_vector *work5; /* real part of back-transformed eigenvector */ - gsl_vector *work6; /* imag part of back-transformed eigenvector */ - - gsl_matrix *Q; /* pointer to left Schur vectors */ - gsl_matrix *Z; /* pointer to right Schur vectors */ - - gsl_eigen_gen_workspace *gen_workspace_p; -} gsl_eigen_genv_workspace; - -gsl_eigen_genv_workspace * gsl_eigen_genv_alloc (const size_t n); -void gsl_eigen_genv_free (gsl_eigen_genv_workspace * w); -int gsl_eigen_genv (gsl_matrix * A, gsl_matrix * B, - gsl_vector_complex * alpha, gsl_vector * beta, - gsl_matrix_complex * evec, - gsl_eigen_genv_workspace * w); -int gsl_eigen_genv_QZ (gsl_matrix * A, gsl_matrix * B, - gsl_vector_complex * alpha, gsl_vector * beta, - gsl_matrix_complex * evec, - gsl_matrix * Q, gsl_matrix * Z, - gsl_eigen_genv_workspace * w); - - - -typedef enum { - GSL_EIGEN_SORT_VAL_ASC, - GSL_EIGEN_SORT_VAL_DESC, - GSL_EIGEN_SORT_ABS_ASC, - GSL_EIGEN_SORT_ABS_DESC -} -gsl_eigen_sort_t; - -/* Sort eigensystem results based on eigenvalues. - * Sorts in order of increasing value or increasing - * absolute value. - * - * exceptions: GSL_EBADLEN - */ - -int gsl_eigen_symmv_sort(gsl_vector * eval, gsl_matrix * evec, - gsl_eigen_sort_t sort_type); - -int gsl_eigen_hermv_sort(gsl_vector * eval, gsl_matrix_complex * evec, - gsl_eigen_sort_t sort_type); - -int gsl_eigen_nonsymmv_sort(gsl_vector_complex * eval, - gsl_matrix_complex * evec, - gsl_eigen_sort_t sort_type); - -int gsl_eigen_gensymmv_sort (gsl_vector * eval, gsl_matrix * evec, - gsl_eigen_sort_t sort_type); - -int gsl_eigen_genhermv_sort (gsl_vector * eval, gsl_matrix_complex * evec, - gsl_eigen_sort_t sort_type); - -int gsl_eigen_genv_sort (gsl_vector_complex * alpha, gsl_vector * beta, - gsl_matrix_complex * evec, - gsl_eigen_sort_t sort_type); - -/* Prototypes for the schur module */ - -int gsl_schur_gen_eigvals(const gsl_matrix *A, const gsl_matrix *B, - double *wr1, double *wr2, double *wi, - double *scale1, double *scale2); - -int gsl_schur_solve_equation(double ca, const gsl_matrix *A, double z, - double d1, double d2, const gsl_vector *b, - gsl_vector *x, double *s, double *xnorm, - double smin); - -int gsl_schur_solve_equation_z(double ca, const gsl_matrix *A, - gsl_complex *z, double d1, double d2, - const gsl_vector_complex *b, - gsl_vector_complex *x, double *s, - double *xnorm, double smin); - - -/* The following functions are obsolete: */ - -/* Eigensolve by Jacobi Method - * - * The data in the matrix input is destroyed. - * - * exceptions: - */ -int -gsl_eigen_jacobi(gsl_matrix * matrix, - gsl_vector * eval, - gsl_matrix * evec, - unsigned int max_rot, - unsigned int * nrot); - - -/* Invert by Jacobi Method - * - * exceptions: - */ -int -gsl_eigen_invert_jacobi(const gsl_matrix * matrix, - gsl_matrix * ainv, - unsigned int max_rot); - - - -__END_DECLS - -#endif /* __GSL_EIGEN_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_errno.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_errno.h deleted file mode 100644 index b8e99b433..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_errno.h +++ /dev/null @@ -1,154 +0,0 @@ -/* err/gsl_errno.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_ERRNO_H__ -#define __GSL_ERRNO_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -enum { - GSL_SUCCESS = 0, - GSL_FAILURE = -1, - GSL_CONTINUE = -2, /* iteration has not converged */ - GSL_EDOM = 1, /* input domain error, e.g sqrt(-1) */ - GSL_ERANGE = 2, /* output range error, e.g. exp(1e100) */ - GSL_EFAULT = 3, /* invalid pointer */ - GSL_EINVAL = 4, /* invalid argument supplied by user */ - GSL_EFAILED = 5, /* generic failure */ - GSL_EFACTOR = 6, /* factorization failed */ - GSL_ESANITY = 7, /* sanity check failed - shouldn't happen */ - GSL_ENOMEM = 8, /* malloc failed */ - GSL_EBADFUNC = 9, /* problem with user-supplied function */ - GSL_ERUNAWAY = 10, /* iterative process is out of control */ - GSL_EMAXITER = 11, /* exceeded max number of iterations */ - GSL_EZERODIV = 12, /* tried to divide by zero */ - GSL_EBADTOL = 13, /* user specified an invalid tolerance */ - GSL_ETOL = 14, /* failed to reach the specified tolerance */ - GSL_EUNDRFLW = 15, /* underflow */ - GSL_EOVRFLW = 16, /* overflow */ - GSL_ELOSS = 17, /* loss of accuracy */ - GSL_EROUND = 18, /* failed because of roundoff error */ - GSL_EBADLEN = 19, /* matrix, vector lengths are not conformant */ - GSL_ENOTSQR = 20, /* matrix not square */ - GSL_ESING = 21, /* apparent singularity detected */ - GSL_EDIVERGE = 22, /* integral or series is divergent */ - GSL_EUNSUP = 23, /* requested feature is not supported by the hardware */ - GSL_EUNIMPL = 24, /* requested feature not (yet) implemented */ - GSL_ECACHE = 25, /* cache limit exceeded */ - GSL_ETABLE = 26, /* table limit exceeded */ - GSL_ENOPROG = 27, /* iteration is not making progress towards solution */ - GSL_ENOPROGJ = 28, /* jacobian evaluations are not improving the solution */ - GSL_ETOLF = 29, /* cannot reach the specified tolerance in F */ - GSL_ETOLX = 30, /* cannot reach the specified tolerance in X */ - GSL_ETOLG = 31, /* cannot reach the specified tolerance in gradient */ - GSL_EOF = 32 /* end of file */ -} ; - -void gsl_error (const char * reason, const char * file, int line, - int gsl_errno); - -void gsl_stream_printf (const char *label, const char *file, - int line, const char *reason); - -const char * gsl_strerror (const int gsl_errno); - -typedef void gsl_error_handler_t (const char * reason, const char * file, - int line, int gsl_errno); - -typedef void gsl_stream_handler_t (const char * label, const char * file, - int line, const char * reason); - -gsl_error_handler_t * -gsl_set_error_handler (gsl_error_handler_t * new_handler); - -gsl_error_handler_t * -gsl_set_error_handler_off (void); - -gsl_stream_handler_t * -gsl_set_stream_handler (gsl_stream_handler_t * new_handler); - -FILE * gsl_set_stream (FILE * new_stream); - -/* GSL_ERROR: call the error handler, and return the error code */ - -#define GSL_ERROR(reason, gsl_errno) \ - do { \ - gsl_error (reason, __FILE__, __LINE__, gsl_errno) ; \ - return gsl_errno ; \ - } while (0) - -/* GSL_ERROR_VAL: call the error handler, and return the given value */ - -#define GSL_ERROR_VAL(reason, gsl_errno, value) \ - do { \ - gsl_error (reason, __FILE__, __LINE__, gsl_errno) ; \ - return value ; \ - } while (0) - -/* GSL_ERROR_VOID: call the error handler, and then return - (for void functions which still need to generate an error) */ - -#define GSL_ERROR_VOID(reason, gsl_errno) \ - do { \ - gsl_error (reason, __FILE__, __LINE__, gsl_errno) ; \ - return ; \ - } while (0) - -/* GSL_ERROR_NULL suitable for out-of-memory conditions */ - -#define GSL_ERROR_NULL(reason, gsl_errno) GSL_ERROR_VAL(reason, gsl_errno, 0) - -/* Sometimes you have several status results returned from - * function calls and you want to combine them in some sensible - * way. You cannot produce a "total" status condition, but you can - * pick one from a set of conditions based on an implied hierarchy. - * - * In other words: - * you have: status_a, status_b, ... - * you want: status = (status_a if it is bad, or status_b if it is bad,...) - * - * In this example you consider status_a to be more important and - * it is checked first, followed by the others in the order specified. - * - * Here are some dumb macros to do this. - */ -#define GSL_ERROR_SELECT_2(a,b) ((a) != GSL_SUCCESS ? (a) : ((b) != GSL_SUCCESS ? (b) : GSL_SUCCESS)) -#define GSL_ERROR_SELECT_3(a,b,c) ((a) != GSL_SUCCESS ? (a) : GSL_ERROR_SELECT_2(b,c)) -#define GSL_ERROR_SELECT_4(a,b,c,d) ((a) != GSL_SUCCESS ? (a) : GSL_ERROR_SELECT_3(b,c,d)) -#define GSL_ERROR_SELECT_5(a,b,c,d,e) ((a) != GSL_SUCCESS ? (a) : GSL_ERROR_SELECT_4(b,c,d,e)) - -#define GSL_STATUS_UPDATE(sp, s) do { if ((s) != GSL_SUCCESS) *(sp) = (s);} while(0) - -__END_DECLS - -#endif /* __GSL_ERRNO_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft.h deleted file mode 100644 index 8870a8886..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft.h +++ /dev/null @@ -1,51 +0,0 @@ -/* fft/gsl_fft.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_FFT_H__ -#define __GSL_FFT_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef enum - { - gsl_fft_forward = -1, gsl_fft_backward = +1 - } -gsl_fft_direction; - -/* this gives the sign in the formula - - h(f) = \sum x(t) exp(+/- 2 pi i f t) - - where - is the forward transform direction and + the inverse direction */ - -__END_DECLS - -#endif /* __GSL_FFT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_complex.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_complex.h deleted file mode 100644 index c13f7ea50..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_complex.h +++ /dev/null @@ -1,136 +0,0 @@ -/* fft/gsl_fft_complex.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_FFT_COMPLEX_H__ -#define __GSL_FFT_COMPLEX_H__ - -#include - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -/* Power of 2 routines */ - - -int gsl_fft_complex_radix2_forward (gsl_complex_packed_array data, - const size_t stride, - const size_t n); - -int gsl_fft_complex_radix2_backward (gsl_complex_packed_array data, - const size_t stride, - const size_t n); - -int gsl_fft_complex_radix2_inverse (gsl_complex_packed_array data, - const size_t stride, - const size_t n); - -int gsl_fft_complex_radix2_transform (gsl_complex_packed_array data, - const size_t stride, - const size_t n, - const gsl_fft_direction sign); - -int gsl_fft_complex_radix2_dif_forward (gsl_complex_packed_array data, - const size_t stride, - const size_t n); - -int gsl_fft_complex_radix2_dif_backward (gsl_complex_packed_array data, - const size_t stride, - const size_t n); - -int gsl_fft_complex_radix2_dif_inverse (gsl_complex_packed_array data, - const size_t stride, - const size_t n); - -int gsl_fft_complex_radix2_dif_transform (gsl_complex_packed_array data, - const size_t stride, - const size_t n, - const gsl_fft_direction sign); - -/* Mixed Radix general-N routines */ - -typedef struct - { - size_t n; - size_t nf; - size_t factor[64]; - gsl_complex *twiddle[64]; - gsl_complex *trig; - } -gsl_fft_complex_wavetable; - -typedef struct -{ - size_t n; - double *scratch; -} -gsl_fft_complex_workspace; - - -gsl_fft_complex_wavetable *gsl_fft_complex_wavetable_alloc (size_t n); - -void gsl_fft_complex_wavetable_free (gsl_fft_complex_wavetable * wavetable); - -gsl_fft_complex_workspace *gsl_fft_complex_workspace_alloc (size_t n); - -void gsl_fft_complex_workspace_free (gsl_fft_complex_workspace * workspace); - -int gsl_fft_complex_memcpy (gsl_fft_complex_wavetable * dest, - gsl_fft_complex_wavetable * src); - - -int gsl_fft_complex_forward (gsl_complex_packed_array data, - const size_t stride, - const size_t n, - const gsl_fft_complex_wavetable * wavetable, - gsl_fft_complex_workspace * work); - -int gsl_fft_complex_backward (gsl_complex_packed_array data, - const size_t stride, - const size_t n, - const gsl_fft_complex_wavetable * wavetable, - gsl_fft_complex_workspace * work); - -int gsl_fft_complex_inverse (gsl_complex_packed_array data, - const size_t stride, - const size_t n, - const gsl_fft_complex_wavetable * wavetable, - gsl_fft_complex_workspace * work); - -int gsl_fft_complex_transform (gsl_complex_packed_array data, - const size_t stride, const size_t n, - const gsl_fft_complex_wavetable * wavetable, - gsl_fft_complex_workspace * work, - const gsl_fft_direction sign); - -__END_DECLS - -#endif /* __GSL_FFT_COMPLEX_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_complex_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_complex_float.h deleted file mode 100644 index d3ff395f9..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_complex_float.h +++ /dev/null @@ -1,139 +0,0 @@ -/* fft/gsl_fft_complex_float.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_FFT_COMPLEX_FLOAT_H__ -#define __GSL_FFT_COMPLEX_FLOAT_H__ - -#include - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -/* Power of 2 routines */ - - -int gsl_fft_complex_float_radix2_forward (gsl_complex_packed_array_float data, - const size_t stride, - const size_t n); - -int gsl_fft_complex_float_radix2_backward (gsl_complex_packed_array_float data, - const size_t stride, - const size_t n); - -int gsl_fft_complex_float_radix2_inverse (gsl_complex_packed_array_float data, - const size_t stride, - const size_t n); - -int gsl_fft_complex_float_radix2_transform (gsl_complex_packed_array_float data, - const size_t stride, - const size_t n, - const gsl_fft_direction sign); - -int gsl_fft_complex_float_radix2_dif_forward (gsl_complex_packed_array_float data, - const size_t stride, - const size_t n); - -int gsl_fft_complex_float_radix2_dif_backward (gsl_complex_packed_array_float data, - const size_t stride, - const size_t n); - -int gsl_fft_complex_float_radix2_dif_inverse (gsl_complex_packed_array_float data, - const size_t stride, - const size_t n); - -int gsl_fft_complex_float_radix2_dif_transform (gsl_complex_packed_array_float data, - const size_t stride, - const size_t n, - const gsl_fft_direction sign); - -/* Mixed Radix general-N routines */ - -typedef struct - { - size_t n; - size_t nf; - size_t factor[64]; - gsl_complex_float *twiddle[64]; - gsl_complex_float *trig; - } -gsl_fft_complex_wavetable_float; - -typedef struct -{ - size_t n; - float *scratch; -} -gsl_fft_complex_workspace_float; - - -gsl_fft_complex_wavetable_float *gsl_fft_complex_wavetable_float_alloc (size_t n); - -void gsl_fft_complex_wavetable_float_free (gsl_fft_complex_wavetable_float * wavetable); - -gsl_fft_complex_workspace_float *gsl_fft_complex_workspace_float_alloc (size_t n); - -void gsl_fft_complex_workspace_float_free (gsl_fft_complex_workspace_float * workspace); - - -int gsl_fft_complex_float_memcpy (gsl_fft_complex_wavetable_float * dest, - gsl_fft_complex_wavetable_float * src); - - -int gsl_fft_complex_float_forward (gsl_complex_packed_array_float data, - const size_t stride, - const size_t n, - const gsl_fft_complex_wavetable_float * wavetable, - gsl_fft_complex_workspace_float * work); - -int gsl_fft_complex_float_backward (gsl_complex_packed_array_float data, - const size_t stride, - const size_t n, - const gsl_fft_complex_wavetable_float * wavetable, - gsl_fft_complex_workspace_float * work); - -int gsl_fft_complex_float_inverse (gsl_complex_packed_array_float data, - const size_t stride, - const size_t n, - const gsl_fft_complex_wavetable_float * wavetable, - gsl_fft_complex_workspace_float * work); - -int gsl_fft_complex_float_transform (gsl_complex_packed_array_float data, - const size_t stride, const size_t n, - const gsl_fft_complex_wavetable_float * wavetable, - gsl_fft_complex_workspace_float * work, - const gsl_fft_direction sign); - -__END_DECLS - -#endif /* __GSL_FFT_COMPLEX_FLOAT_H__ */ - - diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_halfcomplex.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_halfcomplex.h deleted file mode 100644 index 6751e4762..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_halfcomplex.h +++ /dev/null @@ -1,86 +0,0 @@ -/* fft/gsl_fft_halfcomplex.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_FFT_HALFCOMPLEX_H__ -#define __GSL_FFT_HALFCOMPLEX_H__ - -#include - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_fft_halfcomplex_radix2_backward (double data[], const size_t stride, const size_t n); -int gsl_fft_halfcomplex_radix2_inverse (double data[], const size_t stride, const size_t n); -int gsl_fft_halfcomplex_radix2_transform (double data[], const size_t stride, const size_t n); - -typedef struct - { - size_t n; - size_t nf; - size_t factor[64]; - gsl_complex *twiddle[64]; - gsl_complex *trig; - } -gsl_fft_halfcomplex_wavetable; - -gsl_fft_halfcomplex_wavetable * gsl_fft_halfcomplex_wavetable_alloc (size_t n); - -void -gsl_fft_halfcomplex_wavetable_free (gsl_fft_halfcomplex_wavetable * wavetable); - - -int gsl_fft_halfcomplex_backward (double data[], const size_t stride, const size_t n, - const gsl_fft_halfcomplex_wavetable * wavetable, - gsl_fft_real_workspace * work); - -int gsl_fft_halfcomplex_inverse (double data[], const size_t stride, const size_t n, - const gsl_fft_halfcomplex_wavetable * wavetable, - gsl_fft_real_workspace * work); - -int gsl_fft_halfcomplex_transform (double data[], const size_t stride, const size_t n, - const gsl_fft_halfcomplex_wavetable * wavetable, - gsl_fft_real_workspace * work); - -int -gsl_fft_halfcomplex_unpack (const double halfcomplex_coefficient[], - double complex_coefficient[], - const size_t stride, const size_t n); - -int -gsl_fft_halfcomplex_radix2_unpack (const double halfcomplex_coefficient[], - double complex_coefficient[], - const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_FFT_HALFCOMPLEX_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_halfcomplex_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_halfcomplex_float.h deleted file mode 100644 index e31836753..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_halfcomplex_float.h +++ /dev/null @@ -1,86 +0,0 @@ -/* fft/gsl_fft_halfcomplex_float.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_FFT_HALFCOMPLEX_FLOAT_H__ -#define __GSL_FFT_HALFCOMPLEX_FLOAT_H__ - -#include - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_fft_halfcomplex_float_radix2_backward (float data[], const size_t stride, const size_t n); -int gsl_fft_halfcomplex_float_radix2_inverse (float data[], const size_t stride, const size_t n); -int gsl_fft_halfcomplex_float_radix2_transform (float data[], const size_t stride, const size_t n); - -typedef struct - { - size_t n; - size_t nf; - size_t factor[64]; - gsl_complex_float *twiddle[64]; - gsl_complex_float *trig; - } -gsl_fft_halfcomplex_wavetable_float; - - -gsl_fft_halfcomplex_wavetable_float * gsl_fft_halfcomplex_wavetable_float_alloc (size_t n); - -void -gsl_fft_halfcomplex_wavetable_float_free (gsl_fft_halfcomplex_wavetable_float * wavetable); - -int gsl_fft_halfcomplex_float_backward (float data[], const size_t stride, const size_t n, - const gsl_fft_halfcomplex_wavetable_float * wavetable, - gsl_fft_real_workspace_float * work); - -int gsl_fft_halfcomplex_float_inverse (float data[], const size_t stride, const size_t n, - const gsl_fft_halfcomplex_wavetable_float * wavetable, - gsl_fft_real_workspace_float * work); - -int gsl_fft_halfcomplex_float_transform (float data[], const size_t stride, const size_t n, - const gsl_fft_halfcomplex_wavetable_float * wavetable, - gsl_fft_real_workspace_float * work); - -int -gsl_fft_halfcomplex_float_unpack (const float halfcomplex_coefficient[], - float complex_coefficient[], - const size_t stride, const size_t n); - -int -gsl_fft_halfcomplex_float_radix2_unpack (const float halfcomplex_coefficient[], - float complex_coefficient[], - const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_FFT_HALFCOMPLEX_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_real.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_real.h deleted file mode 100644 index e07a60420..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_real.h +++ /dev/null @@ -1,80 +0,0 @@ -/* fft/gsl_fft_real.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_FFT_REAL_H__ -#define __GSL_FFT_REAL_H__ - -#include - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_fft_real_radix2_transform (double data[], const size_t stride, const size_t n) ; - -typedef struct - { - size_t n; - size_t nf; - size_t factor[64]; - gsl_complex *twiddle[64]; - gsl_complex *trig; - } -gsl_fft_real_wavetable; - -typedef struct - { - size_t n; - double *scratch; - } -gsl_fft_real_workspace; - -gsl_fft_real_wavetable * gsl_fft_real_wavetable_alloc (size_t n); - -void gsl_fft_real_wavetable_free (gsl_fft_real_wavetable * wavetable); - -gsl_fft_real_workspace * gsl_fft_real_workspace_alloc (size_t n); - -void gsl_fft_real_workspace_free (gsl_fft_real_workspace * workspace); - - -int gsl_fft_real_transform (double data[], const size_t stride, const size_t n, - const gsl_fft_real_wavetable * wavetable, - gsl_fft_real_workspace * work); - - -int gsl_fft_real_unpack (const double real_coefficient[], - double complex_coefficient[], - const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_FFT_REAL_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_real_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_real_float.h deleted file mode 100644 index 7a7732f22..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_fft_real_float.h +++ /dev/null @@ -1,79 +0,0 @@ -/* fft/gsl_fft_real_float.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_FFT_REAL_FLOAT_H__ -#define __GSL_FFT_REAL_FLOAT_H__ - -#include - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_fft_real_float_radix2_transform (float data[], const size_t stride, const size_t n) ; - -typedef struct - { - size_t n; - size_t nf; - size_t factor[64]; - gsl_complex_float *twiddle[64]; - gsl_complex_float *trig; - } -gsl_fft_real_wavetable_float; - -typedef struct - { - size_t n; - float *scratch; - } -gsl_fft_real_workspace_float; - -gsl_fft_real_wavetable_float * gsl_fft_real_wavetable_float_alloc (size_t n); - -void gsl_fft_real_wavetable_float_free (gsl_fft_real_wavetable_float * wavetable); - -gsl_fft_real_workspace_float * gsl_fft_real_workspace_float_alloc (size_t n); - -void gsl_fft_real_workspace_float_free (gsl_fft_real_workspace_float * workspace); - -int gsl_fft_real_float_transform (float data[], const size_t stride, const size_t n, - const gsl_fft_real_wavetable_float * wavetable, - gsl_fft_real_workspace_float * work); - - -int gsl_fft_real_float_unpack (const float real_float_coefficient[], - float complex_coefficient[], - const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_FFT_REAL_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_filter.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_filter.h deleted file mode 100644 index 0339da26a..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_filter.h +++ /dev/null @@ -1,109 +0,0 @@ -/* filter/gsl_filter.h - * - * Copyright (C) 2018 Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_FILTER_H__ -#define __GSL_FILTER_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -/* end point handling methods */ -typedef enum -{ - GSL_FILTER_END_PADZERO = GSL_MOVSTAT_END_PADZERO, - GSL_FILTER_END_PADVALUE = GSL_MOVSTAT_END_PADVALUE, - GSL_FILTER_END_TRUNCATE = GSL_MOVSTAT_END_TRUNCATE -} gsl_filter_end_t; - -/* robust scale estimates */ -typedef enum -{ - GSL_FILTER_SCALE_MAD, /* median absolute deviation */ - GSL_FILTER_SCALE_IQR, /* interquartile range */ - GSL_FILTER_SCALE_SN, /* S_n scale statistic */ - GSL_FILTER_SCALE_QN /* Q_n scale statistic */ -} gsl_filter_scale_t; - -/* workspace for Gaussian filter */ -typedef struct -{ - size_t K; /* window size */ - double *kernel; /* Gaussian kernel, size K */ - gsl_movstat_workspace *movstat_workspace_p; -} gsl_filter_gaussian_workspace; - -gsl_filter_gaussian_workspace *gsl_filter_gaussian_alloc(const size_t K); -void gsl_filter_gaussian_free(gsl_filter_gaussian_workspace * w); -int gsl_filter_gaussian(const gsl_filter_end_t endtype, const double alpha, const size_t order, const gsl_vector * x, - gsl_vector * y, gsl_filter_gaussian_workspace * w); -int gsl_filter_gaussian_kernel(const double alpha, const size_t order, const int normalize, gsl_vector * kernel); - -/* workspace for standard median filter */ -typedef struct -{ - gsl_movstat_workspace *movstat_workspace_p; -} gsl_filter_median_workspace; - -gsl_filter_median_workspace *gsl_filter_median_alloc(const size_t K); -void gsl_filter_median_free(gsl_filter_median_workspace * w); -int gsl_filter_median(const gsl_filter_end_t endtype, const gsl_vector * x, gsl_vector * y, gsl_filter_median_workspace * w); - -/* workspace for recursive median filter */ -typedef struct -{ - size_t H; /* window half-length (K / 2) */ - size_t K; /* window size */ - void *state; /* workspace for min/max accumulator */ - double *window; /* array holding first window */ - const gsl_movstat_accum * minmaxacc; /* minimum/maximum accumulator */ - gsl_movstat_workspace *movstat_workspace_p; -} gsl_filter_rmedian_workspace; - -gsl_filter_rmedian_workspace *gsl_filter_rmedian_alloc(const size_t K); -void gsl_filter_rmedian_free(gsl_filter_rmedian_workspace * w); -int gsl_filter_rmedian(const gsl_filter_end_t, const gsl_vector * x, gsl_vector * y, gsl_filter_rmedian_workspace * w); -int gsl_filter_rmedian2(const gsl_vector * x, gsl_vector * y, gsl_filter_rmedian_workspace * w); - -typedef struct -{ - gsl_movstat_workspace *movstat_workspace_p; -} gsl_filter_impulse_workspace; - -gsl_filter_impulse_workspace *gsl_filter_impulse_alloc(const size_t K); -void gsl_filter_impulse_free(gsl_filter_impulse_workspace * w); -int gsl_filter_impulse(const gsl_filter_end_t endtype, const gsl_filter_scale_t scale_type, const double t, - const gsl_vector * x, gsl_vector * y, gsl_vector * xmedian, gsl_vector * xsigma, size_t * noutlier, - gsl_vector_int * ioutlier, gsl_filter_impulse_workspace * w); - -__END_DECLS - -#endif /* __GSL_FILTER_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_fit.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_fit.h deleted file mode 100644 index de83a41d0..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_fit.h +++ /dev/null @@ -1,85 +0,0 @@ -/* fit/gsl_fit.h - * - * Copyright (C) 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_FIT_H__ -#define __GSL_FIT_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_fit_linear (const double * x, const size_t xstride, - const double * y, const size_t ystride, - const size_t n, - double * c0, double * c1, - double * cov00, double * cov01, double * cov11, - double * sumsq); - - -int gsl_fit_wlinear (const double * x, const size_t xstride, - const double * w, const size_t wstride, - const double * y, const size_t ystride, - const size_t n, - double * c0, double * c1, - double * cov00, double * cov01, double * cov11, - double * chisq); - -int -gsl_fit_linear_est (const double x, - const double c0, const double c1, - const double cov00, const double cov01, const double cov11, - double *y, double *y_err); - - -int gsl_fit_mul (const double * x, const size_t xstride, - const double * y, const size_t ystride, - const size_t n, - double * c1, - double * cov11, - double * sumsq); - -int gsl_fit_wmul (const double * x, const size_t xstride, - const double * w, const size_t wstride, - const double * y, const size_t ystride, - const size_t n, - double * c1, - double * cov11, - double * sumsq); - - -int -gsl_fit_mul_est (const double x, - const double c1, - const double cov11, - double *y, double *y_err); - -__END_DECLS - -#endif /* __GSL_FIT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_heapsort.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_heapsort.h deleted file mode 100644 index 213fae1e8..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_heapsort.h +++ /dev/null @@ -1,44 +0,0 @@ -/* sort/gsl_heapsort.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_HEAPSORT_H__ -#define __GSL_HEAPSORT_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef int (*gsl_comparison_fn_t) (const void *, const void *); - -void gsl_heapsort (void * array, size_t count, size_t size, gsl_comparison_fn_t compare); -int gsl_heapsort_index (size_t * p, const void * array, size_t count, size_t size, gsl_comparison_fn_t compare); - -__END_DECLS - -#endif /* __GSL_HEAPSORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_histogram.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_histogram.h deleted file mode 100644 index e8375c64e..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_histogram.h +++ /dev/null @@ -1,134 +0,0 @@ -/* histogram/gsl_histogram.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_HISTOGRAM_H__ -#define __GSL_HISTOGRAM_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct { - size_t n ; - double * range ; - double * bin ; -} gsl_histogram ; - -typedef struct { - size_t n ; - double * range ; - double * sum ; -} gsl_histogram_pdf ; - -gsl_histogram * gsl_histogram_alloc (size_t n); - -gsl_histogram * gsl_histogram_calloc (size_t n); -gsl_histogram * gsl_histogram_calloc_uniform (const size_t n, const double xmin, const double xmax); -void gsl_histogram_free (gsl_histogram * h); -int gsl_histogram_increment (gsl_histogram * h, double x); -int gsl_histogram_accumulate (gsl_histogram * h, double x, double weight); -int gsl_histogram_find (const gsl_histogram * h, - const double x, size_t * i); - -double gsl_histogram_get (const gsl_histogram * h, size_t i); -int gsl_histogram_get_range (const gsl_histogram * h, size_t i, - double * lower, double * upper); - -double gsl_histogram_max (const gsl_histogram * h); -double gsl_histogram_min (const gsl_histogram * h); -size_t gsl_histogram_bins (const gsl_histogram * h); - -void gsl_histogram_reset (gsl_histogram * h); - -gsl_histogram * gsl_histogram_calloc_range(size_t n, double * range); - -int -gsl_histogram_set_ranges (gsl_histogram * h, const double range[], size_t size); -int -gsl_histogram_set_ranges_uniform (gsl_histogram * h, double xmin, double xmax); - - - -int -gsl_histogram_memcpy(gsl_histogram * dest, const gsl_histogram * source); - -gsl_histogram * -gsl_histogram_clone(const gsl_histogram * source); - -double gsl_histogram_max_val (const gsl_histogram * h); - -size_t gsl_histogram_max_bin (const gsl_histogram * h); - -double gsl_histogram_min_val (const gsl_histogram * h); - -size_t gsl_histogram_min_bin (const gsl_histogram * h); - -int -gsl_histogram_equal_bins_p(const gsl_histogram *h1, const gsl_histogram *h2); - -int -gsl_histogram_add(gsl_histogram *h1, const gsl_histogram *h2); - -int -gsl_histogram_sub(gsl_histogram *h1, const gsl_histogram *h2); - -int -gsl_histogram_mul(gsl_histogram *h1, const gsl_histogram *h2); - -int -gsl_histogram_div(gsl_histogram *h1, const gsl_histogram *h2); - -int -gsl_histogram_scale(gsl_histogram *h, double scale); - -int -gsl_histogram_shift (gsl_histogram * h, double shift); - - -double gsl_histogram_sigma (const gsl_histogram * h); - -double gsl_histogram_mean (const gsl_histogram * h); - -double gsl_histogram_sum (const gsl_histogram * h); - -int gsl_histogram_fwrite (FILE * stream, const gsl_histogram * h) ; -int gsl_histogram_fread (FILE * stream, gsl_histogram * h); -int gsl_histogram_fprintf (FILE * stream, const gsl_histogram * h, - const char * range_format, const char * bin_format); -int gsl_histogram_fscanf (FILE * stream, gsl_histogram * h); - -gsl_histogram_pdf * gsl_histogram_pdf_alloc (const size_t n); -int gsl_histogram_pdf_init (gsl_histogram_pdf * p, const gsl_histogram * h); -void gsl_histogram_pdf_free (gsl_histogram_pdf * p); -double gsl_histogram_pdf_sample (const gsl_histogram_pdf * p, double r); - -__END_DECLS - -#endif /* __GSL_HISTOGRAM_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_histogram2d.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_histogram2d.h deleted file mode 100644 index 90065ac0c..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_histogram2d.h +++ /dev/null @@ -1,172 +0,0 @@ -/* histogram/gsl_histogram2d.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_HISTOGRAM2D_H__ -#define __GSL_HISTOGRAM2D_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct { - size_t nx, ny ; - double * xrange ; - double * yrange ; - double * bin ; -} gsl_histogram2d ; - -typedef struct { - size_t nx, ny ; - double * xrange ; - double * yrange ; - double * sum ; -} gsl_histogram2d_pdf ; - -gsl_histogram2d * gsl_histogram2d_alloc (const size_t nx, const size_t ny); -gsl_histogram2d * gsl_histogram2d_calloc (const size_t nx, const size_t ny); -gsl_histogram2d * gsl_histogram2d_calloc_uniform (const size_t nx, const size_t ny, - const double xmin, const double xmax, - const double ymin, const double ymax); - -void gsl_histogram2d_free (gsl_histogram2d * h); - -int gsl_histogram2d_increment (gsl_histogram2d * h, double x, double y); -int gsl_histogram2d_accumulate (gsl_histogram2d * h, - double x, double y, double weight); -int gsl_histogram2d_find (const gsl_histogram2d * h, - const double x, const double y, size_t * i, size_t * j); - -double gsl_histogram2d_get (const gsl_histogram2d * h, const size_t i, const size_t j); -int gsl_histogram2d_get_xrange (const gsl_histogram2d * h, const size_t i, - double * xlower, double * xupper); -int gsl_histogram2d_get_yrange (const gsl_histogram2d * h, const size_t j, - double * ylower, double * yupper); - - -double gsl_histogram2d_xmax (const gsl_histogram2d * h); -double gsl_histogram2d_xmin (const gsl_histogram2d * h); -size_t gsl_histogram2d_nx (const gsl_histogram2d * h); - -double gsl_histogram2d_ymax (const gsl_histogram2d * h); -double gsl_histogram2d_ymin (const gsl_histogram2d * h); -size_t gsl_histogram2d_ny (const gsl_histogram2d * h); - -void gsl_histogram2d_reset (gsl_histogram2d * h); - -gsl_histogram2d * -gsl_histogram2d_calloc_range(size_t nx, size_t ny, - double *xrange, double *yrange); - -int -gsl_histogram2d_set_ranges_uniform (gsl_histogram2d * h, - double xmin, double xmax, - double ymin, double ymax); - -int -gsl_histogram2d_set_ranges (gsl_histogram2d * h, - const double xrange[], size_t xsize, - const double yrange[], size_t ysize); - -int -gsl_histogram2d_memcpy(gsl_histogram2d *dest, const gsl_histogram2d *source); - -gsl_histogram2d * -gsl_histogram2d_clone(const gsl_histogram2d * source); - -double -gsl_histogram2d_max_val(const gsl_histogram2d *h); - -void -gsl_histogram2d_max_bin (const gsl_histogram2d *h, size_t *i, size_t *j); - -double -gsl_histogram2d_min_val(const gsl_histogram2d *h); - -void -gsl_histogram2d_min_bin (const gsl_histogram2d *h, size_t *i, size_t *j); - -double -gsl_histogram2d_xmean (const gsl_histogram2d * h); - -double -gsl_histogram2d_ymean (const gsl_histogram2d * h); - -double -gsl_histogram2d_xsigma (const gsl_histogram2d * h); - -double -gsl_histogram2d_ysigma (const gsl_histogram2d * h); - -double -gsl_histogram2d_cov (const gsl_histogram2d * h); - -double -gsl_histogram2d_sum (const gsl_histogram2d *h); - -int -gsl_histogram2d_equal_bins_p(const gsl_histogram2d *h1, - const gsl_histogram2d *h2) ; - -int -gsl_histogram2d_add(gsl_histogram2d *h1, const gsl_histogram2d *h2); - -int -gsl_histogram2d_sub(gsl_histogram2d *h1, const gsl_histogram2d *h2); - -int -gsl_histogram2d_mul(gsl_histogram2d *h1, const gsl_histogram2d *h2); - -int -gsl_histogram2d_div(gsl_histogram2d *h1, const gsl_histogram2d *h2); - -int -gsl_histogram2d_scale(gsl_histogram2d *h, double scale); - -int -gsl_histogram2d_shift(gsl_histogram2d *h, double shift); - -int gsl_histogram2d_fwrite (FILE * stream, const gsl_histogram2d * h) ; -int gsl_histogram2d_fread (FILE * stream, gsl_histogram2d * h); -int gsl_histogram2d_fprintf (FILE * stream, const gsl_histogram2d * h, - const char * range_format, - const char * bin_format); -int gsl_histogram2d_fscanf (FILE * stream, gsl_histogram2d * h); - -gsl_histogram2d_pdf * gsl_histogram2d_pdf_alloc (const size_t nx, const size_t ny); -int gsl_histogram2d_pdf_init (gsl_histogram2d_pdf * p, const gsl_histogram2d * h); -void gsl_histogram2d_pdf_free (gsl_histogram2d_pdf * p); -int gsl_histogram2d_pdf_sample (const gsl_histogram2d_pdf * p, - double r1, double r2, - double * x, double * y); - -__END_DECLS - -#endif /* __GSL_HISTOGRAM2D_H__ */ - diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_ieee_utils.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_ieee_utils.h deleted file mode 100644 index a96122076..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_ieee_utils.h +++ /dev/null @@ -1,99 +0,0 @@ -/* ieee-utils/gsl_ieee_utils.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_IEEE_UTILS_H__ -#define __GSL_IEEE_UTILS_H__ -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -enum { - GSL_IEEE_TYPE_NAN = 1, - GSL_IEEE_TYPE_INF = 2, - GSL_IEEE_TYPE_NORMAL = 3, - GSL_IEEE_TYPE_DENORMAL = 4, - GSL_IEEE_TYPE_ZERO = 5 -} ; - -typedef struct { - int sign ; - char mantissa[24] ; /* Actual bits are 0..22, element 23 is \0 */ - int exponent ; - int type ; -} gsl_ieee_float_rep ; - -typedef struct { - int sign ; - char mantissa[53] ; /* Actual bits are 0..51, element 52 is \0 */ - int exponent ; - int type ; -} gsl_ieee_double_rep ; - - -void gsl_ieee_printf_float (const float * x) ; -void gsl_ieee_printf_double (const double * x) ; - -void gsl_ieee_fprintf_float (FILE * stream, const float * x) ; -void gsl_ieee_fprintf_double (FILE * stream, const double * x) ; - -void gsl_ieee_float_to_rep (const float * x, gsl_ieee_float_rep * r) ; -void gsl_ieee_double_to_rep (const double * x, gsl_ieee_double_rep * r) ; - -enum { - GSL_IEEE_SINGLE_PRECISION = 1, - GSL_IEEE_DOUBLE_PRECISION = 2, - GSL_IEEE_EXTENDED_PRECISION = 3 -} ; - -enum { - GSL_IEEE_ROUND_TO_NEAREST = 1, - GSL_IEEE_ROUND_DOWN = 2, - GSL_IEEE_ROUND_UP = 3, - GSL_IEEE_ROUND_TO_ZERO = 4 -} ; - -enum { - GSL_IEEE_MASK_INVALID = 1, - GSL_IEEE_MASK_DENORMALIZED = 2, - GSL_IEEE_MASK_DIVISION_BY_ZERO = 4, - GSL_IEEE_MASK_OVERFLOW = 8, - GSL_IEEE_MASK_UNDERFLOW = 16, - GSL_IEEE_MASK_ALL = 31, - GSL_IEEE_TRAP_INEXACT = 32 -} ; - -void gsl_ieee_env_setup (void) ; -int gsl_ieee_read_mode_string (const char * description, int * precision, - int * rounding, int * exception_mask) ; -int gsl_ieee_set_mode (int precision, int rounding, int exception_mask) ; - -__END_DECLS - -#endif /* __GSL_IEEE_UTILS_H__ */ - diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_inline.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_inline.h deleted file mode 100644 index 2172201af..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_inline.h +++ /dev/null @@ -1,67 +0,0 @@ -/* gsl_inline.h - * - * Copyright (C) 2008, 2009 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_INLINE_H__ -#define __GSL_INLINE_H__ - -/* In recent versiions of GCC, the inline keyword has two different - forms: GNU and C99. - - In GNU mode we can use 'extern inline' to make inline functions - work like macros. The function is only inlined--it is never output - as a definition in an object file. - - In the new C99 mode 'extern inline' has a different meaning--it - causes the definition of the function to be output in each object - file where it is used. This will result in multiple-definition - errors on linking. The 'inline' keyword on its own (without - extern) has the same behavior as the original GNU 'extern inline'. - - The C99 style is the default with -std=c99 in GCC 4.3. - - This header file allows either form of inline to be used by - redefining the macros INLINE_DECL and INLINE_FUN. These are used - in the public header files as - - INLINE_DECL double gsl_foo (double x); - #ifdef HAVE_INLINE - INLINE_FUN double gsl_foo (double x) { return x+1.0; } ; - #endif - -*/ - -#ifdef HAVE_INLINE -# if defined(__GNUC_STDC_INLINE__) || defined(GSL_C99_INLINE) || defined(HAVE_C99_INLINE) -# define INLINE_DECL inline /* use C99 inline */ -# define INLINE_FUN inline -# else -# define INLINE_DECL /* use GNU extern inline */ -# define INLINE_FUN extern inline -# endif -#else -# define INLINE_DECL /* */ -#endif - -/* Range checking conditions in headers do not require any run-time - tests of the global variable gsl_check_range. They are enabled or - disabled in user code at compile time with GSL_RANGE_CHECK macro. - See also build.h. */ -#define GSL_RANGE_COND(x) (x) - -#endif /* __GSL_INLINE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_integration.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_integration.h deleted file mode 100644 index b0c1b0286..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_integration.h +++ /dev/null @@ -1,390 +0,0 @@ -/* integration/gsl_integration.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_INTEGRATION_H__ -#define __GSL_INTEGRATION_H__ -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -/* Workspace for adaptive integrators */ - -typedef struct - { - size_t limit; - size_t size; - size_t nrmax; - size_t i; - size_t maximum_level; - double *alist; - double *blist; - double *rlist; - double *elist; - size_t *order; - size_t *level; - } -gsl_integration_workspace; - -gsl_integration_workspace * - gsl_integration_workspace_alloc (const size_t n); - -void - gsl_integration_workspace_free (gsl_integration_workspace * w); - - -/* Workspace for QAWS integrator */ - -typedef struct -{ - double alpha; - double beta; - int mu; - int nu; - double ri[25]; - double rj[25]; - double rg[25]; - double rh[25]; -} -gsl_integration_qaws_table; - -gsl_integration_qaws_table * -gsl_integration_qaws_table_alloc (double alpha, double beta, int mu, int nu); - -int -gsl_integration_qaws_table_set (gsl_integration_qaws_table * t, - double alpha, double beta, int mu, int nu); - -void -gsl_integration_qaws_table_free (gsl_integration_qaws_table * t); - -/* Workspace for QAWO integrator */ - -enum gsl_integration_qawo_enum { GSL_INTEG_COSINE, GSL_INTEG_SINE }; - -typedef struct -{ - size_t n; - double omega; - double L; - double par; - enum gsl_integration_qawo_enum sine; - double *chebmo; -} -gsl_integration_qawo_table; - -gsl_integration_qawo_table * -gsl_integration_qawo_table_alloc (double omega, double L, - enum gsl_integration_qawo_enum sine, - size_t n); - -int -gsl_integration_qawo_table_set (gsl_integration_qawo_table * t, - double omega, double L, - enum gsl_integration_qawo_enum sine); - -int -gsl_integration_qawo_table_set_length (gsl_integration_qawo_table * t, - double L); - -void -gsl_integration_qawo_table_free (gsl_integration_qawo_table * t); - - -/* Definition of an integration rule */ - -typedef void gsl_integration_rule (const gsl_function * f, - double a, double b, - double *result, double *abserr, - double *defabs, double *resabs); - -void gsl_integration_qk15 (const gsl_function * f, double a, double b, - double *result, double *abserr, - double *resabs, double *resasc); - -void gsl_integration_qk21 (const gsl_function * f, double a, double b, - double *result, double *abserr, - double *resabs, double *resasc); - -void gsl_integration_qk31 (const gsl_function * f, double a, double b, - double *result, double *abserr, - double *resabs, double *resasc); - -void gsl_integration_qk41 (const gsl_function * f, double a, double b, - double *result, double *abserr, - double *resabs, double *resasc); - -void gsl_integration_qk51 (const gsl_function * f, double a, double b, - double *result, double *abserr, - double *resabs, double *resasc); - -void gsl_integration_qk61 (const gsl_function * f, double a, double b, - double *result, double *abserr, - double *resabs, double *resasc); - -void gsl_integration_qcheb (gsl_function * f, double a, double b, - double *cheb12, double *cheb24); - -/* The low-level integration rules in QUADPACK are identified by small - integers (1-6). We'll use symbolic constants to refer to them. */ - -enum - { - GSL_INTEG_GAUSS15 = 1, /* 15 point Gauss-Kronrod rule */ - GSL_INTEG_GAUSS21 = 2, /* 21 point Gauss-Kronrod rule */ - GSL_INTEG_GAUSS31 = 3, /* 31 point Gauss-Kronrod rule */ - GSL_INTEG_GAUSS41 = 4, /* 41 point Gauss-Kronrod rule */ - GSL_INTEG_GAUSS51 = 5, /* 51 point Gauss-Kronrod rule */ - GSL_INTEG_GAUSS61 = 6 /* 61 point Gauss-Kronrod rule */ - }; - -void -gsl_integration_qk (const int n, const double xgk[], - const double wg[], const double wgk[], - double fv1[], double fv2[], - const gsl_function *f, double a, double b, - double * result, double * abserr, - double * resabs, double * resasc); - - -int gsl_integration_qng (const gsl_function * f, - double a, double b, - double epsabs, double epsrel, - double *result, double *abserr, - size_t * neval); - -int gsl_integration_qag (const gsl_function * f, - double a, double b, - double epsabs, double epsrel, size_t limit, - int key, - gsl_integration_workspace * workspace, - double *result, double *abserr); - -int gsl_integration_qagi (gsl_function * f, - double epsabs, double epsrel, size_t limit, - gsl_integration_workspace * workspace, - double *result, double *abserr); - -int gsl_integration_qagiu (gsl_function * f, - double a, - double epsabs, double epsrel, size_t limit, - gsl_integration_workspace * workspace, - double *result, double *abserr); - -int gsl_integration_qagil (gsl_function * f, - double b, - double epsabs, double epsrel, size_t limit, - gsl_integration_workspace * workspace, - double *result, double *abserr); - - -int gsl_integration_qags (const gsl_function * f, - double a, double b, - double epsabs, double epsrel, size_t limit, - gsl_integration_workspace * workspace, - double *result, double *abserr); - -int gsl_integration_qagp (const gsl_function * f, - double *pts, size_t npts, - double epsabs, double epsrel, size_t limit, - gsl_integration_workspace * workspace, - double *result, double *abserr); - -int gsl_integration_qawc (gsl_function *f, - const double a, const double b, const double c, - const double epsabs, const double epsrel, const size_t limit, - gsl_integration_workspace * workspace, - double * result, double * abserr); - -int gsl_integration_qaws (gsl_function * f, - const double a, const double b, - gsl_integration_qaws_table * t, - const double epsabs, const double epsrel, - const size_t limit, - gsl_integration_workspace * workspace, - double *result, double *abserr); - -int gsl_integration_qawo (gsl_function * f, - const double a, - const double epsabs, const double epsrel, - const size_t limit, - gsl_integration_workspace * workspace, - gsl_integration_qawo_table * wf, - double *result, double *abserr); - -int gsl_integration_qawf (gsl_function * f, - const double a, - const double epsabs, - const size_t limit, - gsl_integration_workspace * workspace, - gsl_integration_workspace * cycle_workspace, - gsl_integration_qawo_table * wf, - double *result, double *abserr); - -/* Workspace for fixed-order Gauss-Legendre integration */ - -typedef struct - { - size_t n; /* number of points */ - double *x; /* Gauss abscissae/points */ - double *w; /* Gauss weights for each abscissae */ - int precomputed; /* high precision abscissae/weights precomputed? */ - } -gsl_integration_glfixed_table; - - -gsl_integration_glfixed_table * gsl_integration_glfixed_table_alloc (size_t n); - -void gsl_integration_glfixed_table_free (gsl_integration_glfixed_table * t); - -/* Routine for fixed-order Gauss-Legendre integration */ - -double gsl_integration_glfixed (const gsl_function *f, - double a, - double b, - const gsl_integration_glfixed_table * t); - -/* Routine to retrieve the i-th Gauss-Legendre point and weight from t */ - -int gsl_integration_glfixed_point (double a, - double b, - size_t i, - double *xi, - double *wi, - const gsl_integration_glfixed_table * t); - - -/* Cquad integration - Pedro Gonnet */ - -/* Data of a single interval */ -typedef struct -{ - double a, b; - double c[64]; - double fx[33]; - double igral, err; - int depth, rdepth, ndiv; -} gsl_integration_cquad_ival; - - -/* The workspace is just a collection of intervals */ -typedef struct -{ - size_t size; - gsl_integration_cquad_ival *ivals; - size_t *heap; -} gsl_integration_cquad_workspace; - -gsl_integration_cquad_workspace * -gsl_integration_cquad_workspace_alloc (const size_t n); - -void -gsl_integration_cquad_workspace_free (gsl_integration_cquad_workspace * w); - -int -gsl_integration_cquad (const gsl_function * f, double a, double b, - double epsabs, double epsrel, - gsl_integration_cquad_workspace * ws, - double *result, double *abserr, size_t * nevals); - -/* Romberg integration workspace and routines */ - -typedef struct -{ - size_t n; /* maximum number of steps */ - double *work1; /* workspace for a row of R matrix, size n */ - double *work2; /* workspace for a row of R matrix, size n */ -} gsl_integration_romberg_workspace; - -gsl_integration_romberg_workspace *gsl_integration_romberg_alloc(const size_t n); -void gsl_integration_romberg_free(gsl_integration_romberg_workspace * w); -int gsl_integration_romberg(const gsl_function * f, const double a, const double b, - const double epsabs, const double epsrel, double * result, - size_t * neval, gsl_integration_romberg_workspace * w); - -/* IQPACK related structures and routines */ - -typedef struct -{ - double alpha; - double beta; - double a; - double b; - double zemu; - double shft; - double slp; - double al; - double be; -} gsl_integration_fixed_params; - -typedef struct -{ - int (*check)(const size_t n, const gsl_integration_fixed_params * params); - int (*init)(const size_t n, double * diag, double * subdiag, gsl_integration_fixed_params * params); -} gsl_integration_fixed_type; - -typedef struct -{ - size_t n; /* number of nodes/weights */ - double *weights; /* quadrature weights */ - double *x; /* quadrature nodes */ - double *diag; /* diagonal of Jacobi matrix */ - double *subdiag; /* subdiagonal of Jacobi matrix */ - const gsl_integration_fixed_type * type; -} gsl_integration_fixed_workspace; - -/* IQPACK integral types */ -GSL_VAR const gsl_integration_fixed_type * gsl_integration_fixed_legendre; -GSL_VAR const gsl_integration_fixed_type * gsl_integration_fixed_chebyshev; -GSL_VAR const gsl_integration_fixed_type * gsl_integration_fixed_gegenbauer; -GSL_VAR const gsl_integration_fixed_type * gsl_integration_fixed_jacobi; -GSL_VAR const gsl_integration_fixed_type * gsl_integration_fixed_laguerre; -GSL_VAR const gsl_integration_fixed_type * gsl_integration_fixed_hermite; -GSL_VAR const gsl_integration_fixed_type * gsl_integration_fixed_exponential; -GSL_VAR const gsl_integration_fixed_type * gsl_integration_fixed_rational; -GSL_VAR const gsl_integration_fixed_type * gsl_integration_fixed_chebyshev2; - -gsl_integration_fixed_workspace * -gsl_integration_fixed_alloc(const gsl_integration_fixed_type * type, const size_t n, - const double a, const double b, const double alpha, const double beta); - -void gsl_integration_fixed_free(gsl_integration_fixed_workspace * w); - -size_t gsl_integration_fixed_n(const gsl_integration_fixed_workspace * w); - -double *gsl_integration_fixed_nodes(const gsl_integration_fixed_workspace * w); - -double *gsl_integration_fixed_weights(const gsl_integration_fixed_workspace * w); - -int gsl_integration_fixed(const gsl_function * func, double * result, - const gsl_integration_fixed_workspace * w); - -__END_DECLS - -#endif /* __GSL_INTEGRATION_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_interp.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_interp.h deleted file mode 100644 index 8321224a5..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_interp.h +++ /dev/null @@ -1,225 +0,0 @@ -/* interpolation/gsl_interp.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman - */ -#ifndef __GSL_INTERP_H__ -#define __GSL_INTERP_H__ -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -/* evaluation accelerator */ -typedef struct { - size_t cache; /* cache of index */ - size_t miss_count; /* keep statistics */ - size_t hit_count; -} -gsl_interp_accel; - - -/* interpolation object type */ -typedef struct { - const char * name; - unsigned int min_size; - void * (*alloc) (size_t size); - int (*init) (void *, const double xa[], const double ya[], size_t size); - int (*eval) (const void *, const double xa[], const double ya[], size_t size, double x, gsl_interp_accel *, double * y); - int (*eval_deriv) (const void *, const double xa[], const double ya[], size_t size, double x, gsl_interp_accel *, double * y_p); - int (*eval_deriv2) (const void *, const double xa[], const double ya[], size_t size, double x, gsl_interp_accel *, double * y_pp); - int (*eval_integ) (const void *, const double xa[], const double ya[], size_t size, gsl_interp_accel *, double a, double b, double * result); - void (*free) (void *); - -} gsl_interp_type; - - -/* general interpolation object */ -typedef struct { - const gsl_interp_type * type; - double xmin; - double xmax; - size_t size; - void * state; -} gsl_interp; - - -/* available types */ -GSL_VAR const gsl_interp_type * gsl_interp_linear; -GSL_VAR const gsl_interp_type * gsl_interp_polynomial; -GSL_VAR const gsl_interp_type * gsl_interp_cspline; -GSL_VAR const gsl_interp_type * gsl_interp_cspline_periodic; -GSL_VAR const gsl_interp_type * gsl_interp_akima; -GSL_VAR const gsl_interp_type * gsl_interp_akima_periodic; -GSL_VAR const gsl_interp_type * gsl_interp_steffen; - -gsl_interp_accel * -gsl_interp_accel_alloc(void); - -int -gsl_interp_accel_reset (gsl_interp_accel * a); - -void -gsl_interp_accel_free(gsl_interp_accel * a); - -gsl_interp * -gsl_interp_alloc(const gsl_interp_type * T, size_t n); - -int -gsl_interp_init(gsl_interp * obj, const double xa[], const double ya[], size_t size); - -const char * gsl_interp_name(const gsl_interp * interp); -unsigned int gsl_interp_min_size(const gsl_interp * interp); -unsigned int gsl_interp_type_min_size(const gsl_interp_type * T); - - -int -gsl_interp_eval_e(const gsl_interp * obj, - const double xa[], const double ya[], double x, - gsl_interp_accel * a, double * y); - -double -gsl_interp_eval(const gsl_interp * obj, - const double xa[], const double ya[], double x, - gsl_interp_accel * a); - -int -gsl_interp_eval_deriv_e(const gsl_interp * obj, - const double xa[], const double ya[], double x, - gsl_interp_accel * a, - double * d); - -double -gsl_interp_eval_deriv(const gsl_interp * obj, - const double xa[], const double ya[], double x, - gsl_interp_accel * a); - -int -gsl_interp_eval_deriv2_e(const gsl_interp * obj, - const double xa[], const double ya[], double x, - gsl_interp_accel * a, - double * d2); - -double -gsl_interp_eval_deriv2(const gsl_interp * obj, - const double xa[], const double ya[], double x, - gsl_interp_accel * a); - -int -gsl_interp_eval_integ_e(const gsl_interp * obj, - const double xa[], const double ya[], - double a, double b, - gsl_interp_accel * acc, - double * result); - -double -gsl_interp_eval_integ(const gsl_interp * obj, - const double xa[], const double ya[], - double a, double b, - gsl_interp_accel * acc); - -void -gsl_interp_free(gsl_interp * interp); - -INLINE_DECL size_t -gsl_interp_bsearch(const double x_array[], double x, - size_t index_lo, size_t index_hi); - -#ifdef HAVE_INLINE - -/* Perform a binary search of an array of values. - * - * The parameters index_lo and index_hi provide an initial bracket, - * and it is assumed that index_lo < index_hi. The resulting index - * is guaranteed to be strictly less than index_hi and greater than - * or equal to index_lo, so that the implicit bracket [index, index+1] - * always corresponds to a region within the implicit value range of - * the value array. - * - * Note that this means the relationship of 'x' to x_array[index] - * and x_array[index+1] depends on the result region, i.e. the - * behaviour at the boundaries may not correspond to what you - * expect. We have the following complete specification of the - * behaviour. - * Suppose the input is x_array[] = { x0, x1, ..., xN } - * if ( x == x0 ) then index == 0 - * if ( x > x0 && x <= x1 ) then index == 0, and sim. for other interior pts - * if ( x == xN ) then index == N-1 - * if ( x > xN ) then index == N-1 - * if ( x < x0 ) then index == 0 - */ - -INLINE_FUN size_t -gsl_interp_bsearch(const double x_array[], double x, - size_t index_lo, size_t index_hi) -{ - size_t ilo = index_lo; - size_t ihi = index_hi; - while(ihi > ilo + 1) { - size_t i = (ihi + ilo)/2; - if(x_array[i] > x) - ihi = i; - else - ilo = i; - } - - return ilo; -} -#endif - -INLINE_DECL size_t -gsl_interp_accel_find(gsl_interp_accel * a, const double x_array[], size_t size, double x); - -#ifdef HAVE_INLINE -INLINE_FUN size_t -gsl_interp_accel_find(gsl_interp_accel * a, const double xa[], size_t len, double x) -{ - size_t x_index = a->cache; - - if(x < xa[x_index]) { - a->miss_count++; - a->cache = gsl_interp_bsearch(xa, x, 0, x_index); - } - else if(x >= xa[x_index + 1]) { - a->miss_count++; - a->cache = gsl_interp_bsearch(xa, x, x_index, len-1); - } - else { - a->hit_count++; - } - - return a->cache; -} -#endif /* HAVE_INLINE */ - - -__END_DECLS - -#endif /* __GSL_INTERP_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_interp2d.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_interp2d.h deleted file mode 100644 index e105fa31d..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_interp2d.h +++ /dev/null @@ -1,160 +0,0 @@ -/* interpolation/gsl_interp2d.h - * - * Copyright 2012 David Zaslavsky - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_INTERP2D_H__ -#define __GSL_INTERP2D_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct { - const char* name; - unsigned int min_size; - void * (*alloc)(size_t xsize, size_t ysize); - int (*init)(void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize); - int (*eval)(const void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize, double x, double y, gsl_interp_accel*, gsl_interp_accel*, double* z); - int (*eval_deriv_x) (const void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize, double x, double y, gsl_interp_accel*, gsl_interp_accel*, double* z_p); - int (*eval_deriv_y) (const void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize, double x, double y, gsl_interp_accel*, gsl_interp_accel*, double* z_p); - int (*eval_deriv_xx) (const void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize, double x, double y, gsl_interp_accel*, gsl_interp_accel*, double* z_pp); - int (*eval_deriv_xy) (const void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize, double x, double y, gsl_interp_accel*, gsl_interp_accel*, double* z_pp); - int (*eval_deriv_yy) (const void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize, double x, double y, gsl_interp_accel*, gsl_interp_accel*, double* z_pp); - void (*free)(void *); -} gsl_interp2d_type; - -typedef struct { - const gsl_interp2d_type * type; /* interpolation type */ - double xmin; /* minimum value of x for which data have been provided */ - double xmax; /* maximum value of x for which data have been provided */ - double ymin; /* minimum value of y for which data have been provided */ - double ymax; /* maximum value of y for which data have been provided */ - size_t xsize; /* number of x values provided */ - size_t ysize; /* number of y values provided */ - void * state; /* internal state object specific to the interpolation type */ -} gsl_interp2d; - -/* available types */ -GSL_VAR const gsl_interp2d_type * gsl_interp2d_bilinear; -GSL_VAR const gsl_interp2d_type * gsl_interp2d_bicubic; - -gsl_interp2d * gsl_interp2d_alloc(const gsl_interp2d_type * T, const size_t xsize, - const size_t ysize); - -const char * gsl_interp2d_name(const gsl_interp2d * interp); -size_t gsl_interp2d_min_size(const gsl_interp2d * interp); -size_t gsl_interp2d_type_min_size(const gsl_interp2d_type * T); -int gsl_interp2d_set(const gsl_interp2d * interp, double zarr[], - const size_t i, const size_t j, const double z); -double gsl_interp2d_get(const gsl_interp2d * interp, const double zarr[], - const size_t i, const size_t j); -size_t gsl_interp2d_idx(const gsl_interp2d * interp, - const size_t i, const size_t j); -int gsl_interp2d_init(gsl_interp2d * interp, const double xa[], const double ya[], - const double za[], const size_t xsize, const size_t ysize); -void gsl_interp2d_free(gsl_interp2d * interp); - -double gsl_interp2d_eval(const gsl_interp2d * interp, const double xarr[], - const double yarr[], const double zarr[], const double x, - const double y, gsl_interp_accel * xa, gsl_interp_accel * ya); - -double gsl_interp2d_eval_extrap(const gsl_interp2d * interp, - const double xarr[], const double yarr[], - const double zarr[], const double x, - const double y, gsl_interp_accel * xa, - gsl_interp_accel * ya); - -int gsl_interp2d_eval_e(const gsl_interp2d * interp, const double xarr[], - const double yarr[], const double zarr[], - const double x, const double y, gsl_interp_accel* xa, - gsl_interp_accel* ya, double * z); - -int gsl_interp2d_eval_e_extrap(const gsl_interp2d * interp, - const double xarr[], - const double yarr[], - const double zarr[], - const double x, - const double y, - gsl_interp_accel * xa, - gsl_interp_accel * ya, - double * z); - -double gsl_interp2d_eval_deriv_x(const gsl_interp2d * interp, const double xarr[], - const double yarr[], const double zarr[], - const double x, const double y, gsl_interp_accel * xa, - gsl_interp_accel * ya); - -int gsl_interp2d_eval_deriv_x_e(const gsl_interp2d * interp, const double xarr[], - const double yarr[], const double zarr[], - const double x, const double y, - gsl_interp_accel * xa, gsl_interp_accel * ya, double * z); - -double gsl_interp2d_eval_deriv_y(const gsl_interp2d * interp, const double xarr[], - const double yarr[], const double zarr[], - const double x, const double y, - gsl_interp_accel* xa, gsl_interp_accel* ya); - -int gsl_interp2d_eval_deriv_y_e(const gsl_interp2d * interp, const double xarr[], - const double yarr[], const double zarr[], - const double x, const double y, - gsl_interp_accel * xa, gsl_interp_accel * ya, double * z); - -double gsl_interp2d_eval_deriv_xx(const gsl_interp2d * interp, const double xarr[], - const double yarr[], const double zarr[], - const double x, const double y, - gsl_interp_accel * xa, gsl_interp_accel * ya); - -int gsl_interp2d_eval_deriv_xx_e(const gsl_interp2d * interp, const double xarr[], - const double yarr[], const double zarr[], - const double x, const double y, - gsl_interp_accel * xa, gsl_interp_accel * ya, double * z); - -double gsl_interp2d_eval_deriv_yy(const gsl_interp2d * interp, const double xarr[], - const double yarr[], const double zarr[], - const double x, const double y, - gsl_interp_accel * xa, gsl_interp_accel * ya); - -int gsl_interp2d_eval_deriv_yy_e(const gsl_interp2d * interp, const double xarr[], - const double yarr[], const double zarr[], - const double x, const double y, - gsl_interp_accel * xa, gsl_interp_accel * ya, double * z); - -double gsl_interp2d_eval_deriv_xy(const gsl_interp2d * interp, const double xarr[], - const double yarr[], const double zarr[], - const double x, const double y, - gsl_interp_accel * xa, gsl_interp_accel * ya); - -int gsl_interp2d_eval_deriv_xy_e(const gsl_interp2d * interp, const double xarr[], - const double yarr[], const double zarr[], - const double x, const double y, - gsl_interp_accel * xa, gsl_interp_accel * ya, double * z); - - -__END_DECLS - -#endif /* __GSL_INTERP2D_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_linalg.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_linalg.h deleted file mode 100644 index 8112f2177..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_linalg.h +++ /dev/null @@ -1,780 +0,0 @@ -/* linalg/gsl_linalg.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2006, 2007 Gerard Jungman, Brian Gough, Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_LINALG_H__ -#define __GSL_LINALG_H__ - -#include -#include -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -#define __BEGIN_DECLS extern "C" { -#define __END_DECLS } -#else -#define __BEGIN_DECLS /* empty */ -#define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef enum - { - GSL_LINALG_MOD_NONE = 0, - GSL_LINALG_MOD_TRANSPOSE = 1, - GSL_LINALG_MOD_CONJUGATE = 2 - } -gsl_linalg_matrix_mod_t; - - -/* Note: You can now use the gsl_blas_dgemm function instead of matmult */ - -/* Simple implementation of matrix multiply. - * Calculates C = A.B - * - * exceptions: GSL_EBADLEN - */ -int gsl_linalg_matmult (const gsl_matrix * A, - const gsl_matrix * B, - gsl_matrix * C); - - -/* Simple implementation of matrix multiply. - * Allows transposition of either matrix, so it - * can compute A.B or Trans(A).B or A.Trans(B) or Trans(A).Trans(B) - * - * exceptions: GSL_EBADLEN - */ -int gsl_linalg_matmult_mod (const gsl_matrix * A, - gsl_linalg_matrix_mod_t modA, - const gsl_matrix * B, - gsl_linalg_matrix_mod_t modB, - gsl_matrix * C); - -/* Calculate the matrix exponential by the scaling and - * squaring method described in Moler + Van Loan, - * SIAM Rev 20, 801 (1978). The mode argument allows - * choosing an optimal strategy, from the table - * given in the paper, for a given precision. - * - * exceptions: GSL_ENOTSQR, GSL_EBADLEN - */ -int gsl_linalg_exponential_ss( - const gsl_matrix * A, - gsl_matrix * eA, - gsl_mode_t mode - ); - - -/* Householder Transformations */ - -double gsl_linalg_householder_transform (gsl_vector * v); -gsl_complex gsl_linalg_complex_householder_transform (gsl_vector_complex * v); - -int gsl_linalg_householder_hm (double tau, - const gsl_vector * v, - gsl_matrix * A); - -int gsl_linalg_householder_mh (double tau, - const gsl_vector * v, - gsl_matrix * A); - -int gsl_linalg_householder_hv (double tau, - const gsl_vector * v, - gsl_vector * w); - -int gsl_linalg_householder_hm1 (double tau, - gsl_matrix * A); - -int gsl_linalg_complex_householder_hm (gsl_complex tau, - const gsl_vector_complex * v, - gsl_matrix_complex * A); - -int gsl_linalg_complex_householder_mh (gsl_complex tau, - const gsl_vector_complex * v, - gsl_matrix_complex * A); - -int gsl_linalg_complex_householder_hv (gsl_complex tau, - const gsl_vector_complex * v, - gsl_vector_complex * w); - -/* Hessenberg reduction */ - -int gsl_linalg_hessenberg_decomp(gsl_matrix *A, gsl_vector *tau); -int gsl_linalg_hessenberg_unpack(gsl_matrix * H, gsl_vector * tau, - gsl_matrix * U); -int gsl_linalg_hessenberg_unpack_accum(gsl_matrix * H, gsl_vector * tau, - gsl_matrix * U); -int gsl_linalg_hessenberg_set_zero(gsl_matrix * H); -int gsl_linalg_hessenberg_submatrix(gsl_matrix *M, gsl_matrix *A, - size_t top, gsl_vector *tau); - -/* Hessenberg-Triangular reduction */ - -int gsl_linalg_hesstri_decomp(gsl_matrix * A, gsl_matrix * B, - gsl_matrix * U, gsl_matrix * V, - gsl_vector * work); - -/* Singular Value Decomposition - - * exceptions: - */ - -int -gsl_linalg_SV_decomp (gsl_matrix * A, - gsl_matrix * V, - gsl_vector * S, - gsl_vector * work); - -int -gsl_linalg_SV_decomp_mod (gsl_matrix * A, - gsl_matrix * X, - gsl_matrix * V, - gsl_vector * S, - gsl_vector * work); - -int gsl_linalg_SV_decomp_jacobi (gsl_matrix * A, - gsl_matrix * Q, - gsl_vector * S); - -int -gsl_linalg_SV_solve (const gsl_matrix * U, - const gsl_matrix * Q, - const gsl_vector * S, - const gsl_vector * b, - gsl_vector * x); - -int gsl_linalg_SV_leverage(const gsl_matrix *U, gsl_vector *h); - - -/* LU Decomposition, Gaussian elimination with partial pivoting - */ - -int gsl_linalg_LU_decomp (gsl_matrix * A, gsl_permutation * p, int *signum); - -int gsl_linalg_LU_solve (const gsl_matrix * LU, - const gsl_permutation * p, - const gsl_vector * b, - gsl_vector * x); - -int gsl_linalg_LU_svx (const gsl_matrix * LU, - const gsl_permutation * p, - gsl_vector * x); - -int gsl_linalg_LU_refine (const gsl_matrix * A, - const gsl_matrix * LU, - const gsl_permutation * p, - const gsl_vector * b, - gsl_vector * x, - gsl_vector * work); - -int gsl_linalg_LU_invert (const gsl_matrix * LU, - const gsl_permutation * p, - gsl_matrix * inverse); - -double gsl_linalg_LU_det (gsl_matrix * LU, int signum); -double gsl_linalg_LU_lndet (gsl_matrix * LU); -int gsl_linalg_LU_sgndet (gsl_matrix * lu, int signum); - -/* Complex LU Decomposition */ - -int gsl_linalg_complex_LU_decomp (gsl_matrix_complex * A, - gsl_permutation * p, - int *signum); - -int gsl_linalg_complex_LU_solve (const gsl_matrix_complex * LU, - const gsl_permutation * p, - const gsl_vector_complex * b, - gsl_vector_complex * x); - -int gsl_linalg_complex_LU_svx (const gsl_matrix_complex * LU, - const gsl_permutation * p, - gsl_vector_complex * x); - -int gsl_linalg_complex_LU_refine (const gsl_matrix_complex * A, - const gsl_matrix_complex * LU, - const gsl_permutation * p, - const gsl_vector_complex * b, - gsl_vector_complex * x, - gsl_vector_complex * work); - -int gsl_linalg_complex_LU_invert (const gsl_matrix_complex * LU, - const gsl_permutation * p, - gsl_matrix_complex * inverse); - -gsl_complex gsl_linalg_complex_LU_det (gsl_matrix_complex * LU, - int signum); - -double gsl_linalg_complex_LU_lndet (gsl_matrix_complex * LU); - -gsl_complex gsl_linalg_complex_LU_sgndet (gsl_matrix_complex * LU, - int signum); - -/* QR decomposition */ - -int gsl_linalg_QR_decomp (gsl_matrix * A, - gsl_vector * tau); - -int gsl_linalg_QR_solve (const gsl_matrix * QR, - const gsl_vector * tau, - const gsl_vector * b, - gsl_vector * x); - -int gsl_linalg_QR_svx (const gsl_matrix * QR, - const gsl_vector * tau, - gsl_vector * x); - -int gsl_linalg_QR_lssolve (const gsl_matrix * QR, - const gsl_vector * tau, - const gsl_vector * b, - gsl_vector * x, - gsl_vector * residual); - - -int gsl_linalg_QR_QRsolve (gsl_matrix * Q, - gsl_matrix * R, - const gsl_vector * b, - gsl_vector * x); - -int gsl_linalg_QR_Rsolve (const gsl_matrix * QR, - const gsl_vector * b, - gsl_vector * x); - -int gsl_linalg_QR_Rsvx (const gsl_matrix * QR, - gsl_vector * x); - -int gsl_linalg_QR_update (gsl_matrix * Q, - gsl_matrix * R, - gsl_vector * w, - const gsl_vector * v); - -int gsl_linalg_QR_QTvec (const gsl_matrix * QR, - const gsl_vector * tau, - gsl_vector * v); - -int gsl_linalg_QR_Qvec (const gsl_matrix * QR, - const gsl_vector * tau, - gsl_vector * v); - -int gsl_linalg_QR_QTmat (const gsl_matrix * QR, - const gsl_vector * tau, - gsl_matrix * A); - -int gsl_linalg_QR_matQ (const gsl_matrix * QR, - const gsl_vector * tau, - gsl_matrix * A); - -int gsl_linalg_QR_unpack (const gsl_matrix * QR, - const gsl_vector * tau, - gsl_matrix * Q, - gsl_matrix * R); - -int gsl_linalg_R_solve (const gsl_matrix * R, - const gsl_vector * b, - gsl_vector * x); - -int gsl_linalg_R_svx (const gsl_matrix * R, - gsl_vector * x); - - -/* Q R P^T decomposition */ - -int gsl_linalg_QRPT_decomp (gsl_matrix * A, - gsl_vector * tau, - gsl_permutation * p, - int *signum, - gsl_vector * norm); - -int gsl_linalg_QRPT_decomp2 (const gsl_matrix * A, - gsl_matrix * q, gsl_matrix * r, - gsl_vector * tau, - gsl_permutation * p, - int *signum, - gsl_vector * norm); - -int gsl_linalg_QRPT_solve (const gsl_matrix * QR, - const gsl_vector * tau, - const gsl_permutation * p, - const gsl_vector * b, - gsl_vector * x); - -int gsl_linalg_QRPT_lssolve (const gsl_matrix * QR, - const gsl_vector * tau, - const gsl_permutation * p, - const gsl_vector * b, - gsl_vector * x, - gsl_vector * residual); - -int gsl_linalg_QRPT_lssolve2 (const gsl_matrix * QR, - const gsl_vector * tau, - const gsl_permutation * p, - const gsl_vector * b, - const size_t rank, - gsl_vector * x, - gsl_vector * residual); - -int gsl_linalg_QRPT_svx (const gsl_matrix * QR, - const gsl_vector * tau, - const gsl_permutation * p, - gsl_vector * x); - -int gsl_linalg_QRPT_QRsolve (const gsl_matrix * Q, - const gsl_matrix * R, - const gsl_permutation * p, - const gsl_vector * b, - gsl_vector * x); - -int gsl_linalg_QRPT_Rsolve (const gsl_matrix * QR, - const gsl_permutation * p, - const gsl_vector * b, - gsl_vector * x); - -int gsl_linalg_QRPT_Rsvx (const gsl_matrix * QR, - const gsl_permutation * p, - gsl_vector * x); - -int gsl_linalg_QRPT_update (gsl_matrix * Q, - gsl_matrix * R, - const gsl_permutation * p, - gsl_vector * u, - const gsl_vector * v); - -size_t gsl_linalg_QRPT_rank (const gsl_matrix * QR, const double tol); - -int gsl_linalg_QRPT_rcond(const gsl_matrix * QR, double * rcond, gsl_vector * work); - -/* COD decomposition */ - -int gsl_linalg_COD_decomp(gsl_matrix * A, gsl_vector * tau_Q, gsl_vector * tau_Z, - gsl_permutation * p, size_t * rank, gsl_vector * work); - -int gsl_linalg_COD_decomp_e(gsl_matrix * A, gsl_vector * tau_Q, gsl_vector * tau_Z, - gsl_permutation * p, double tol, size_t * rank, gsl_vector * work); - -int gsl_linalg_COD_lssolve (const gsl_matrix * QRZT, const gsl_vector * tau_Q, const gsl_vector * tau_Z, - const gsl_permutation * perm, const size_t rank, const gsl_vector * b, - gsl_vector * x, gsl_vector * residual); - -int -gsl_linalg_COD_lssolve2 (const double lambda, const gsl_matrix * QRZT, const gsl_vector * tau_Q, const gsl_vector * tau_Z, - const gsl_permutation * perm, const size_t rank, const gsl_vector * b, - gsl_vector * x, gsl_vector * residual, gsl_matrix * S, gsl_vector * work); - -int gsl_linalg_COD_unpack(const gsl_matrix * QRZT, const gsl_vector * tau_Q, - const gsl_vector * tau_Z, const size_t rank, gsl_matrix * Q, - gsl_matrix * R, gsl_matrix * Z); - -int gsl_linalg_COD_matZ(const gsl_matrix * QRZT, const gsl_vector * tau_Z, const size_t rank, - gsl_matrix * A, gsl_vector * work); - -/* LQ decomposition */ - -int gsl_linalg_LQ_decomp (gsl_matrix * A, gsl_vector * tau); - -int gsl_linalg_LQ_solve_T (const gsl_matrix * LQ, const gsl_vector * tau, - const gsl_vector * b, gsl_vector * x); - -int gsl_linalg_LQ_svx_T (const gsl_matrix * LQ, const gsl_vector * tau, - gsl_vector * x); - -int gsl_linalg_LQ_lssolve_T (const gsl_matrix * LQ, const gsl_vector * tau, - const gsl_vector * b, gsl_vector * x, - gsl_vector * residual); - -int gsl_linalg_LQ_Lsolve_T (const gsl_matrix * LQ, const gsl_vector * b, - gsl_vector * x); - -int gsl_linalg_LQ_Lsvx_T (const gsl_matrix * LQ, gsl_vector * x); - -int gsl_linalg_L_solve_T (const gsl_matrix * L, const gsl_vector * b, - gsl_vector * x); - -int gsl_linalg_LQ_vecQ (const gsl_matrix * LQ, const gsl_vector * tau, - gsl_vector * v); - -int gsl_linalg_LQ_vecQT (const gsl_matrix * LQ, const gsl_vector * tau, - gsl_vector * v); - -int gsl_linalg_LQ_unpack (const gsl_matrix * LQ, const gsl_vector * tau, - gsl_matrix * Q, gsl_matrix * L); - -int gsl_linalg_LQ_update (gsl_matrix * Q, gsl_matrix * R, - const gsl_vector * v, gsl_vector * w); -int gsl_linalg_LQ_LQsolve (gsl_matrix * Q, gsl_matrix * L, - const gsl_vector * b, gsl_vector * x); - -/* P^T L Q decomposition */ - -int gsl_linalg_PTLQ_decomp (gsl_matrix * A, gsl_vector * tau, - gsl_permutation * p, int *signum, - gsl_vector * norm); - -int gsl_linalg_PTLQ_decomp2 (const gsl_matrix * A, gsl_matrix * q, - gsl_matrix * r, gsl_vector * tau, - gsl_permutation * p, int *signum, - gsl_vector * norm); - -int gsl_linalg_PTLQ_solve_T (const gsl_matrix * QR, - const gsl_vector * tau, - const gsl_permutation * p, - const gsl_vector * b, - gsl_vector * x); - -int gsl_linalg_PTLQ_svx_T (const gsl_matrix * LQ, - const gsl_vector * tau, - const gsl_permutation * p, - gsl_vector * x); - -int gsl_linalg_PTLQ_LQsolve_T (const gsl_matrix * Q, const gsl_matrix * L, - const gsl_permutation * p, - const gsl_vector * b, - gsl_vector * x); - -int gsl_linalg_PTLQ_Lsolve_T (const gsl_matrix * LQ, - const gsl_permutation * p, - const gsl_vector * b, - gsl_vector * x); - -int gsl_linalg_PTLQ_Lsvx_T (const gsl_matrix * LQ, - const gsl_permutation * p, - gsl_vector * x); - -int gsl_linalg_PTLQ_update (gsl_matrix * Q, gsl_matrix * L, - const gsl_permutation * p, - const gsl_vector * v, gsl_vector * w); - -/* Cholesky Decomposition */ - -int gsl_linalg_cholesky_decomp (gsl_matrix * A); -int gsl_linalg_cholesky_decomp1 (gsl_matrix * A); - -int gsl_linalg_cholesky_solve (const gsl_matrix * cholesky, - const gsl_vector * b, - gsl_vector * x); -int gsl_linalg_cholesky_solve_mat (const gsl_matrix * cholesky, - const gsl_matrix * B, - gsl_matrix * X); - -int gsl_linalg_cholesky_svx (const gsl_matrix * cholesky, - gsl_vector * x); -int gsl_linalg_cholesky_svx_mat (const gsl_matrix * cholesky, - gsl_matrix * X); - -int gsl_linalg_cholesky_invert(gsl_matrix * cholesky); - -/* Cholesky decomposition with unit-diagonal triangular parts. - * A = L D L^T, where diag(L) = (1,1,...,1). - * Upon exit, A contains L and L^T as for Cholesky, and - * the diagonal of A is (1,1,...,1). The vector Dis set - * to the diagonal elements of the diagonal matrix D. - */ -int gsl_linalg_cholesky_decomp_unit(gsl_matrix * A, gsl_vector * D); - -int gsl_linalg_cholesky_scale(const gsl_matrix * A, gsl_vector * S); - -int gsl_linalg_cholesky_scale_apply(gsl_matrix * A, const gsl_vector * S); - -int gsl_linalg_cholesky_decomp2(gsl_matrix * A, gsl_vector * S); - -int gsl_linalg_cholesky_svx2 (const gsl_matrix * LLT, - const gsl_vector * S, - gsl_vector * x); - -int gsl_linalg_cholesky_solve2 (const gsl_matrix * LLT, - const gsl_vector * S, - const gsl_vector * b, - gsl_vector * x); - -int gsl_linalg_cholesky_rcond (const gsl_matrix * LLT, double * rcond, - gsl_vector * work); - -/* Complex Cholesky Decomposition */ - -int gsl_linalg_complex_cholesky_decomp (gsl_matrix_complex * A); - -int gsl_linalg_complex_cholesky_solve (const gsl_matrix_complex * cholesky, - const gsl_vector_complex * b, - gsl_vector_complex * x); - -int gsl_linalg_complex_cholesky_svx (const gsl_matrix_complex * cholesky, - gsl_vector_complex * x); - -int gsl_linalg_complex_cholesky_invert(gsl_matrix_complex * cholesky); - -/* Pivoted Cholesky LDLT decomposition */ - -int gsl_linalg_pcholesky_decomp (gsl_matrix * A, gsl_permutation * p); - -int gsl_linalg_pcholesky_solve(const gsl_matrix * LDLT, - const gsl_permutation * p, - const gsl_vector * b, - gsl_vector * x); - -int gsl_linalg_pcholesky_svx(const gsl_matrix * LDLT, - const gsl_permutation * p, - gsl_vector * x); - -int gsl_linalg_pcholesky_decomp2(gsl_matrix * A, gsl_permutation * p, - gsl_vector * S); - -int gsl_linalg_pcholesky_solve2(const gsl_matrix * LDLT, - const gsl_permutation * p, - const gsl_vector * S, - const gsl_vector * b, - gsl_vector * x); - -int gsl_linalg_pcholesky_svx2(const gsl_matrix * LDLT, - const gsl_permutation * p, - const gsl_vector * S, - gsl_vector * x); - -int gsl_linalg_pcholesky_invert(const gsl_matrix * LDLT, const gsl_permutation * p, - gsl_matrix * Ainv); - -int gsl_linalg_pcholesky_rcond (const gsl_matrix * LDLT, const gsl_permutation * p, - double * rcond, gsl_vector * work); - -/* Modified Cholesky decomposition */ - -int gsl_linalg_mcholesky_decomp (gsl_matrix * A, gsl_permutation * p, - gsl_vector * E); - -int gsl_linalg_mcholesky_solve(const gsl_matrix * LDLT, - const gsl_permutation * p, - const gsl_vector * b, - gsl_vector * x); - -int gsl_linalg_mcholesky_svx(const gsl_matrix * LDLT, - const gsl_permutation * p, - gsl_vector * x); - -int gsl_linalg_mcholesky_rcond (const gsl_matrix * LDLT, const gsl_permutation * p, - double * rcond, gsl_vector * work); - -int gsl_linalg_mcholesky_invert(const gsl_matrix * LDLT, const gsl_permutation * p, - gsl_matrix * Ainv); - -/* Symmetric to symmetric tridiagonal decomposition */ - -int gsl_linalg_symmtd_decomp (gsl_matrix * A, - gsl_vector * tau); - -int gsl_linalg_symmtd_unpack (const gsl_matrix * A, - const gsl_vector * tau, - gsl_matrix * Q, - gsl_vector * diag, - gsl_vector * subdiag); - -int gsl_linalg_symmtd_unpack_T (const gsl_matrix * A, - gsl_vector * diag, - gsl_vector * subdiag); - -/* Hermitian to symmetric tridiagonal decomposition */ - -int gsl_linalg_hermtd_decomp (gsl_matrix_complex * A, - gsl_vector_complex * tau); - -int gsl_linalg_hermtd_unpack (const gsl_matrix_complex * A, - const gsl_vector_complex * tau, - gsl_matrix_complex * U, - gsl_vector * diag, - gsl_vector * sudiag); - -int gsl_linalg_hermtd_unpack_T (const gsl_matrix_complex * A, - gsl_vector * diag, - gsl_vector * subdiag); - -/* Linear Solve Using Householder Transformations - - * exceptions: - */ - -int gsl_linalg_HH_solve (gsl_matrix * A, const gsl_vector * b, gsl_vector * x); -int gsl_linalg_HH_svx (gsl_matrix * A, gsl_vector * x); - -/* Linear solve for a symmetric tridiagonal system. - - * The input vectors represent the NxN matrix as follows: - * - * diag[0] offdiag[0] 0 ... - * offdiag[0] diag[1] offdiag[1] ... - * 0 offdiag[1] diag[2] ... - * 0 0 offdiag[2] ... - * ... ... ... ... - */ -int gsl_linalg_solve_symm_tridiag (const gsl_vector * diag, - const gsl_vector * offdiag, - const gsl_vector * b, - gsl_vector * x); - -/* Linear solve for a nonsymmetric tridiagonal system. - - * The input vectors represent the NxN matrix as follows: - * - * diag[0] abovediag[0] 0 ... - * belowdiag[0] diag[1] abovediag[1] ... - * 0 belowdiag[1] diag[2] ... - * 0 0 belowdiag[2] ... - * ... ... ... ... - */ -int gsl_linalg_solve_tridiag (const gsl_vector * diag, - const gsl_vector * abovediag, - const gsl_vector * belowdiag, - const gsl_vector * b, - gsl_vector * x); - - -/* Linear solve for a symmetric cyclic tridiagonal system. - - * The input vectors represent the NxN matrix as follows: - * - * diag[0] offdiag[0] 0 ..... offdiag[N-1] - * offdiag[0] diag[1] offdiag[1] ..... - * 0 offdiag[1] diag[2] ..... - * 0 0 offdiag[2] ..... - * ... ... - * offdiag[N-1] ... - */ -int gsl_linalg_solve_symm_cyc_tridiag (const gsl_vector * diag, - const gsl_vector * offdiag, - const gsl_vector * b, - gsl_vector * x); - -/* Linear solve for a nonsymmetric cyclic tridiagonal system. - - * The input vectors represent the NxN matrix as follows: - * - * diag[0] abovediag[0] 0 ..... belowdiag[N-1] - * belowdiag[0] diag[1] abovediag[1] ..... - * 0 belowdiag[1] diag[2] - * 0 0 belowdiag[2] ..... - * ... ... - * abovediag[N-1] ... - */ -int gsl_linalg_solve_cyc_tridiag (const gsl_vector * diag, - const gsl_vector * abovediag, - const gsl_vector * belowdiag, - const gsl_vector * b, - gsl_vector * x); - - -/* Bidiagonal decomposition */ - -int gsl_linalg_bidiag_decomp (gsl_matrix * A, - gsl_vector * tau_U, - gsl_vector * tau_V); - -int gsl_linalg_bidiag_unpack (const gsl_matrix * A, - const gsl_vector * tau_U, - gsl_matrix * U, - const gsl_vector * tau_V, - gsl_matrix * V, - gsl_vector * diag, - gsl_vector * superdiag); - -int gsl_linalg_bidiag_unpack2 (gsl_matrix * A, - gsl_vector * tau_U, - gsl_vector * tau_V, - gsl_matrix * V); - -int gsl_linalg_bidiag_unpack_B (const gsl_matrix * A, - gsl_vector * diag, - gsl_vector * superdiag); - -/* Balancing */ - -int gsl_linalg_balance_matrix (gsl_matrix * A, gsl_vector * D); -int gsl_linalg_balance_accum (gsl_matrix * A, gsl_vector * D); -int gsl_linalg_balance_columns (gsl_matrix * A, gsl_vector * D); - -/* condition estimation */ - -int gsl_linalg_tri_upper_rcond(const gsl_matrix * A, double * rcond, gsl_vector * work); -int gsl_linalg_tri_lower_rcond(const gsl_matrix * A, double * rcond, gsl_vector * work); -int gsl_linalg_invnorm1(const size_t N, - int (* Ainvx)(CBLAS_TRANSPOSE_t TransA, gsl_vector * x, void * params), - void * params, double * Ainvnorm, gsl_vector * work); - -/* triangular matrices */ - -int gsl_linalg_tri_upper_invert(gsl_matrix * T); -int gsl_linalg_tri_lower_invert(gsl_matrix * T); -int gsl_linalg_tri_upper_unit_invert(gsl_matrix * T); -int gsl_linalg_tri_lower_unit_invert(gsl_matrix * T); - -INLINE_DECL void gsl_linalg_givens (const double a, const double b, - double *c, double *s); -INLINE_DECL void gsl_linalg_givens_gv (gsl_vector * v, const size_t i, - const size_t j, const double c, - const double s); - -#ifdef HAVE_INLINE - -/* Generate a Givens rotation (cos,sin) which takes v=(x,y) to (|v|,0) - From Golub and Van Loan, "Matrix Computations", Section 5.1.8 */ -INLINE_FUN -void -gsl_linalg_givens (const double a, const double b, double *c, double *s) -{ - if (b == 0) - { - *c = 1; - *s = 0; - } - else if (fabs (b) > fabs (a)) - { - double t = -a / b; - double s1 = 1.0 / sqrt (1 + t * t); - *s = s1; - *c = s1 * t; - } - else - { - double t = -b / a; - double c1 = 1.0 / sqrt (1 + t * t); - *c = c1; - *s = c1 * t; - } -} /* gsl_linalg_givens() */ - -INLINE_FUN -void -gsl_linalg_givens_gv (gsl_vector * v, const size_t i, const size_t j, - const double c, const double s) -{ - /* Apply rotation to vector v' = G^T v */ - - double vi = gsl_vector_get (v, i); - double vj = gsl_vector_get (v, j); - gsl_vector_set (v, i, c * vi - s * vj); - gsl_vector_set (v, j, s * vi + c * vj); -} - -#endif /* HAVE_INLINE */ - -__END_DECLS - -#endif /* __GSL_LINALG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_machine.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_machine.h deleted file mode 100644 index c44ffc2a4..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_machine.h +++ /dev/null @@ -1,104 +0,0 @@ -/* Author: B. Gough and G. Jungman */ -#ifndef __GSL_MACHINE_H__ -#define __GSL_MACHINE_H__ - -#include -#include - -/* magic constants; mostly for the benefit of the implementation */ - -/* -*-MACHINE CONSTANTS-*- - * - * PLATFORM: Whiz-O-Matic 9000 - * FP_PLATFORM: IEEE-Virtual - * HOSTNAME: nnn.lanl.gov - * DATE: Fri Nov 20 17:53:26 MST 1998 - */ -#define GSL_DBL_EPSILON 2.2204460492503131e-16 -#define GSL_SQRT_DBL_EPSILON 1.4901161193847656e-08 -#define GSL_ROOT3_DBL_EPSILON 6.0554544523933429e-06 -#define GSL_ROOT4_DBL_EPSILON 1.2207031250000000e-04 -#define GSL_ROOT5_DBL_EPSILON 7.4009597974140505e-04 -#define GSL_ROOT6_DBL_EPSILON 2.4607833005759251e-03 -#define GSL_LOG_DBL_EPSILON (-3.6043653389117154e+01) - -#define GSL_DBL_MIN 2.2250738585072014e-308 -#define GSL_SQRT_DBL_MIN 1.4916681462400413e-154 -#define GSL_ROOT3_DBL_MIN 2.8126442852362996e-103 -#define GSL_ROOT4_DBL_MIN 1.2213386697554620e-77 -#define GSL_ROOT5_DBL_MIN 2.9476022969691763e-62 -#define GSL_ROOT6_DBL_MIN 5.3034368905798218e-52 -#define GSL_LOG_DBL_MIN (-7.0839641853226408e+02) - -#define GSL_DBL_MAX 1.7976931348623157e+308 -#define GSL_SQRT_DBL_MAX 1.3407807929942596e+154 -#define GSL_ROOT3_DBL_MAX 5.6438030941222897e+102 -#define GSL_ROOT4_DBL_MAX 1.1579208923731620e+77 -#define GSL_ROOT5_DBL_MAX 4.4765466227572707e+61 -#define GSL_ROOT6_DBL_MAX 2.3756689782295612e+51 -#define GSL_LOG_DBL_MAX 7.0978271289338397e+02 - -#define GSL_FLT_EPSILON 1.1920928955078125e-07 -#define GSL_SQRT_FLT_EPSILON 3.4526698300124393e-04 -#define GSL_ROOT3_FLT_EPSILON 4.9215666011518501e-03 -#define GSL_ROOT4_FLT_EPSILON 1.8581361171917516e-02 -#define GSL_ROOT5_FLT_EPSILON 4.1234622211652937e-02 -#define GSL_ROOT6_FLT_EPSILON 7.0153878019335827e-02 -#define GSL_LOG_FLT_EPSILON (-1.5942385152878742e+01) - -#define GSL_FLT_MIN 1.1754943508222875e-38 -#define GSL_SQRT_FLT_MIN 1.0842021724855044e-19 -#define GSL_ROOT3_FLT_MIN 2.2737367544323241e-13 -#define GSL_ROOT4_FLT_MIN 3.2927225399135965e-10 -#define GSL_ROOT5_FLT_MIN 2.5944428542140822e-08 -#define GSL_ROOT6_FLT_MIN 4.7683715820312542e-07 -#define GSL_LOG_FLT_MIN (-8.7336544750553102e+01) - -#define GSL_FLT_MAX 3.4028234663852886e+38 -#define GSL_SQRT_FLT_MAX 1.8446743523953730e+19 -#define GSL_ROOT3_FLT_MAX 6.9814635196223242e+12 -#define GSL_ROOT4_FLT_MAX 4.2949672319999986e+09 -#define GSL_ROOT5_FLT_MAX 5.0859007855960041e+07 -#define GSL_ROOT6_FLT_MAX 2.6422459233807749e+06 -#define GSL_LOG_FLT_MAX 8.8722839052068352e+01 - -#define GSL_SFLT_EPSILON 4.8828125000000000e-04 -#define GSL_SQRT_SFLT_EPSILON 2.2097086912079612e-02 -#define GSL_ROOT3_SFLT_EPSILON 7.8745065618429588e-02 -#define GSL_ROOT4_SFLT_EPSILON 1.4865088937534013e-01 -#define GSL_ROOT5_SFLT_EPSILON 2.1763764082403100e-01 -#define GSL_ROOT6_SFLT_EPSILON 2.8061551207734325e-01 -#define GSL_LOG_SFLT_EPSILON (-7.6246189861593985e+00) - -/* !MACHINE CONSTANTS! */ - - -/* a little internal backwards compatibility */ -#define GSL_MACH_EPS GSL_DBL_EPSILON - - - -/* Here are the constants related to or derived from - * machine constants. These are not to be confused with - * the constants that define various precision levels - * for the precision/error system. - * - * This information is determined at configure time - * and is platform dependent. Edit at your own risk. - * - * PLATFORM: WHIZ-O-MATIC - * CONFIG-DATE: Thu Nov 19 19:27:18 MST 1998 - * CONFIG-HOST: nnn.lanl.gov - */ - -/* machine precision constants */ -/* #define GSL_MACH_EPS 1.0e-15 */ -#define GSL_SQRT_MACH_EPS 3.2e-08 -#define GSL_ROOT3_MACH_EPS 1.0e-05 -#define GSL_ROOT4_MACH_EPS 0.000178 -#define GSL_ROOT5_MACH_EPS 0.00100 -#define GSL_ROOT6_MACH_EPS 0.00316 -#define GSL_LOG_MACH_EPS (-34.54) - - -#endif /* __GSL_MACHINE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_math.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_math.h deleted file mode 100644 index 2d09df173..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_math.h +++ /dev/null @@ -1,164 +0,0 @@ -/* gsl_math.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MATH_H__ -#define __GSL_MATH_H__ -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef M_E -#define M_E 2.71828182845904523536028747135 /* e */ -#endif - -#ifndef M_LOG2E -#define M_LOG2E 1.44269504088896340735992468100 /* log_2 (e) */ -#endif - -#ifndef M_LOG10E -#define M_LOG10E 0.43429448190325182765112891892 /* log_10 (e) */ -#endif - -#ifndef M_SQRT2 -#define M_SQRT2 1.41421356237309504880168872421 /* sqrt(2) */ -#endif - -#ifndef M_SQRT1_2 -#define M_SQRT1_2 0.70710678118654752440084436210 /* sqrt(1/2) */ -#endif - - -#ifndef M_SQRT3 -#define M_SQRT3 1.73205080756887729352744634151 /* sqrt(3) */ -#endif - -#ifndef M_PI -#define M_PI 3.14159265358979323846264338328 /* pi */ -#endif - -#ifndef M_PI_2 -#define M_PI_2 1.57079632679489661923132169164 /* pi/2 */ -#endif - -#ifndef M_PI_4 -#define M_PI_4 0.78539816339744830961566084582 /* pi/4 */ -#endif - -#ifndef M_SQRTPI -#define M_SQRTPI 1.77245385090551602729816748334 /* sqrt(pi) */ -#endif - -#ifndef M_2_SQRTPI -#define M_2_SQRTPI 1.12837916709551257389615890312 /* 2/sqrt(pi) */ -#endif - -#ifndef M_1_PI -#define M_1_PI 0.31830988618379067153776752675 /* 1/pi */ -#endif - -#ifndef M_2_PI -#define M_2_PI 0.63661977236758134307553505349 /* 2/pi */ -#endif - -#ifndef M_LN10 -#define M_LN10 2.30258509299404568401799145468 /* ln(10) */ -#endif - -#ifndef M_LN2 -#define M_LN2 0.69314718055994530941723212146 /* ln(2) */ -#endif - -#ifndef M_LNPI -#define M_LNPI 1.14472988584940017414342735135 /* ln(pi) */ -#endif - -#ifndef M_EULER -#define M_EULER 0.57721566490153286060651209008 /* Euler constant */ -#endif - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -/* other needlessly compulsive abstractions */ - -#define GSL_IS_ODD(n) ((n) & 1) -#define GSL_IS_EVEN(n) (!(GSL_IS_ODD(n))) -#define GSL_SIGN(x) ((x) >= 0.0 ? 1 : -1) - -/* Return nonzero if x is a real number, i.e. non NaN or infinite. */ -#define GSL_IS_REAL(x) (gsl_finite(x)) - -/* Definition of an arbitrary function with parameters */ - -struct gsl_function_struct -{ - double (* function) (double x, void * params); - void * params; -}; - -typedef struct gsl_function_struct gsl_function ; - -#define GSL_FN_EVAL(F,x) (*((F)->function))(x,(F)->params) - -/* Definition of an arbitrary function returning two values, r1, r2 */ - -struct gsl_function_fdf_struct -{ - double (* f) (double x, void * params); - double (* df) (double x, void * params); - void (* fdf) (double x, void * params, double * f, double * df); - void * params; -}; - -typedef struct gsl_function_fdf_struct gsl_function_fdf ; - -#define GSL_FN_FDF_EVAL_F(FDF,x) (*((FDF)->f))(x,(FDF)->params) -#define GSL_FN_FDF_EVAL_DF(FDF,x) (*((FDF)->df))(x,(FDF)->params) -#define GSL_FN_FDF_EVAL_F_DF(FDF,x,y,dy) (*((FDF)->fdf))(x,(FDF)->params,(y),(dy)) - - -/* Definition of an arbitrary vector-valued function with parameters */ - -struct gsl_function_vec_struct -{ - int (* function) (double x, double y[], void * params); - void * params; -}; - -typedef struct gsl_function_vec_struct gsl_function_vec ; - -#define GSL_FN_VEC_EVAL(F,x,y) (*((F)->function))(x,y,(F)->params) - -__END_DECLS - -#endif /* __GSL_MATH_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix.h deleted file mode 100644 index 9b7ed7655..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __GSL_MATRIX_H__ -#define __GSL_MATRIX_H__ - -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include - -#include -#include - - -#endif /* __GSL_MATRIX_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_char.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_char.h deleted file mode 100644 index 7e81de300..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_char.h +++ /dev/null @@ -1,352 +0,0 @@ -/* matrix/gsl_matrix_char.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MATRIX_CHAR_H__ -#define __GSL_MATRIX_CHAR_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size1; - size_t size2; - size_t tda; - char * data; - gsl_block_char * block; - int owner; -} gsl_matrix_char; - -typedef struct -{ - gsl_matrix_char matrix; -} _gsl_matrix_char_view; - -typedef _gsl_matrix_char_view gsl_matrix_char_view; - -typedef struct -{ - gsl_matrix_char matrix; -} _gsl_matrix_char_const_view; - -typedef const _gsl_matrix_char_const_view gsl_matrix_char_const_view; - -/* Allocation */ - -gsl_matrix_char * -gsl_matrix_char_alloc (const size_t n1, const size_t n2); - -gsl_matrix_char * -gsl_matrix_char_calloc (const size_t n1, const size_t n2); - -gsl_matrix_char * -gsl_matrix_char_alloc_from_block (gsl_block_char * b, - const size_t offset, - const size_t n1, - const size_t n2, - const size_t d2); - -gsl_matrix_char * -gsl_matrix_char_alloc_from_matrix (gsl_matrix_char * m, - const size_t k1, - const size_t k2, - const size_t n1, - const size_t n2); - -gsl_vector_char * -gsl_vector_char_alloc_row_from_matrix (gsl_matrix_char * m, - const size_t i); - -gsl_vector_char * -gsl_vector_char_alloc_col_from_matrix (gsl_matrix_char * m, - const size_t j); - -void gsl_matrix_char_free (gsl_matrix_char * m); - -/* Views */ - -_gsl_matrix_char_view -gsl_matrix_char_submatrix (gsl_matrix_char * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_char_view -gsl_matrix_char_row (gsl_matrix_char * m, const size_t i); - -_gsl_vector_char_view -gsl_matrix_char_column (gsl_matrix_char * m, const size_t j); - -_gsl_vector_char_view -gsl_matrix_char_diagonal (gsl_matrix_char * m); - -_gsl_vector_char_view -gsl_matrix_char_subdiagonal (gsl_matrix_char * m, const size_t k); - -_gsl_vector_char_view -gsl_matrix_char_superdiagonal (gsl_matrix_char * m, const size_t k); - -_gsl_vector_char_view -gsl_matrix_char_subrow (gsl_matrix_char * m, const size_t i, - const size_t offset, const size_t n); - -_gsl_vector_char_view -gsl_matrix_char_subcolumn (gsl_matrix_char * m, const size_t j, - const size_t offset, const size_t n); - -_gsl_matrix_char_view -gsl_matrix_char_view_array (char * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_char_view -gsl_matrix_char_view_array_with_tda (char * base, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_char_view -gsl_matrix_char_view_vector (gsl_vector_char * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_char_view -gsl_matrix_char_view_vector_with_tda (gsl_vector_char * v, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_char_const_view -gsl_matrix_char_const_submatrix (const gsl_matrix_char * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_char_const_view -gsl_matrix_char_const_row (const gsl_matrix_char * m, - const size_t i); - -_gsl_vector_char_const_view -gsl_matrix_char_const_column (const gsl_matrix_char * m, - const size_t j); - -_gsl_vector_char_const_view -gsl_matrix_char_const_diagonal (const gsl_matrix_char * m); - -_gsl_vector_char_const_view -gsl_matrix_char_const_subdiagonal (const gsl_matrix_char * m, - const size_t k); - -_gsl_vector_char_const_view -gsl_matrix_char_const_superdiagonal (const gsl_matrix_char * m, - const size_t k); - -_gsl_vector_char_const_view -gsl_matrix_char_const_subrow (const gsl_matrix_char * m, const size_t i, - const size_t offset, const size_t n); - -_gsl_vector_char_const_view -gsl_matrix_char_const_subcolumn (const gsl_matrix_char * m, const size_t j, - const size_t offset, const size_t n); - -_gsl_matrix_char_const_view -gsl_matrix_char_const_view_array (const char * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_char_const_view -gsl_matrix_char_const_view_array_with_tda (const char * base, - const size_t n1, - const size_t n2, - const size_t tda); - -_gsl_matrix_char_const_view -gsl_matrix_char_const_view_vector (const gsl_vector_char * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_char_const_view -gsl_matrix_char_const_view_vector_with_tda (const gsl_vector_char * v, - const size_t n1, - const size_t n2, - const size_t tda); - -/* Operations */ - -void gsl_matrix_char_set_zero (gsl_matrix_char * m); -void gsl_matrix_char_set_identity (gsl_matrix_char * m); -void gsl_matrix_char_set_all (gsl_matrix_char * m, char x); - -int gsl_matrix_char_fread (FILE * stream, gsl_matrix_char * m) ; -int gsl_matrix_char_fwrite (FILE * stream, const gsl_matrix_char * m) ; -int gsl_matrix_char_fscanf (FILE * stream, gsl_matrix_char * m); -int gsl_matrix_char_fprintf (FILE * stream, const gsl_matrix_char * m, const char * format); - -int gsl_matrix_char_memcpy(gsl_matrix_char * dest, const gsl_matrix_char * src); -int gsl_matrix_char_swap(gsl_matrix_char * m1, gsl_matrix_char * m2); -int gsl_matrix_char_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_char * dest, const gsl_matrix_char * src); - -int gsl_matrix_char_swap_rows(gsl_matrix_char * m, const size_t i, const size_t j); -int gsl_matrix_char_swap_columns(gsl_matrix_char * m, const size_t i, const size_t j); -int gsl_matrix_char_swap_rowcol(gsl_matrix_char * m, const size_t i, const size_t j); -int gsl_matrix_char_transpose (gsl_matrix_char * m); -int gsl_matrix_char_transpose_memcpy (gsl_matrix_char * dest, const gsl_matrix_char * src); -int gsl_matrix_char_transpose_tricpy (const char uplo_src, const int copy_diag, gsl_matrix_char * dest, const gsl_matrix_char * src); - -char gsl_matrix_char_max (const gsl_matrix_char * m); -char gsl_matrix_char_min (const gsl_matrix_char * m); -void gsl_matrix_char_minmax (const gsl_matrix_char * m, char * min_out, char * max_out); - -void gsl_matrix_char_max_index (const gsl_matrix_char * m, size_t * imax, size_t *jmax); -void gsl_matrix_char_min_index (const gsl_matrix_char * m, size_t * imin, size_t *jmin); -void gsl_matrix_char_minmax_index (const gsl_matrix_char * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); - -int gsl_matrix_char_equal (const gsl_matrix_char * a, const gsl_matrix_char * b); - -int gsl_matrix_char_isnull (const gsl_matrix_char * m); -int gsl_matrix_char_ispos (const gsl_matrix_char * m); -int gsl_matrix_char_isneg (const gsl_matrix_char * m); -int gsl_matrix_char_isnonneg (const gsl_matrix_char * m); - -int gsl_matrix_char_add (gsl_matrix_char * a, const gsl_matrix_char * b); -int gsl_matrix_char_sub (gsl_matrix_char * a, const gsl_matrix_char * b); -int gsl_matrix_char_mul_elements (gsl_matrix_char * a, const gsl_matrix_char * b); -int gsl_matrix_char_div_elements (gsl_matrix_char * a, const gsl_matrix_char * b); -int gsl_matrix_char_scale (gsl_matrix_char * a, const double x); -int gsl_matrix_char_add_constant (gsl_matrix_char * a, const double x); -int gsl_matrix_char_add_diagonal (gsl_matrix_char * a, const double x); - -/***********************************************************************/ -/* The functions below are obsolete */ -/***********************************************************************/ -int gsl_matrix_char_get_row(gsl_vector_char * v, const gsl_matrix_char * m, const size_t i); -int gsl_matrix_char_get_col(gsl_vector_char * v, const gsl_matrix_char * m, const size_t j); -int gsl_matrix_char_set_row(gsl_matrix_char * m, const size_t i, const gsl_vector_char * v); -int gsl_matrix_char_set_col(gsl_matrix_char * m, const size_t j, const gsl_vector_char * v); -/***********************************************************************/ - -/* inline functions if you are using GCC */ - -INLINE_DECL char gsl_matrix_char_get(const gsl_matrix_char * m, const size_t i, const size_t j); -INLINE_DECL void gsl_matrix_char_set(gsl_matrix_char * m, const size_t i, const size_t j, const char x); -INLINE_DECL char * gsl_matrix_char_ptr(gsl_matrix_char * m, const size_t i, const size_t j); -INLINE_DECL const char * gsl_matrix_char_const_ptr(const gsl_matrix_char * m, const size_t i, const size_t j); - -#ifdef HAVE_INLINE -INLINE_FUN -char -gsl_matrix_char_get(const gsl_matrix_char * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; - } - } -#endif - return m->data[i * m->tda + j] ; -} - -INLINE_FUN -void -gsl_matrix_char_set(gsl_matrix_char * m, const size_t i, const size_t j, const char x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; - } - } -#endif - m->data[i * m->tda + j] = x ; -} - -INLINE_FUN -char * -gsl_matrix_char_ptr(gsl_matrix_char * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (char *) (m->data + (i * m->tda + j)) ; -} - -INLINE_FUN -const char * -gsl_matrix_char_const_ptr(const gsl_matrix_char * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (const char *) (m->data + (i * m->tda + j)) ; -} - -#endif - -__END_DECLS - -#endif /* __GSL_MATRIX_CHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_complex_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_complex_double.h deleted file mode 100644 index 3b8791389..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_complex_double.h +++ /dev/null @@ -1,353 +0,0 @@ -/* matrix/gsl_matrix_complex_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MATRIX_COMPLEX_DOUBLE_H__ -#define __GSL_MATRIX_COMPLEX_DOUBLE_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size1; - size_t size2; - size_t tda; - double * data; - gsl_block_complex * block; - int owner; -} gsl_matrix_complex ; - -typedef struct -{ - gsl_matrix_complex matrix; -} _gsl_matrix_complex_view; - -typedef _gsl_matrix_complex_view gsl_matrix_complex_view; - -typedef struct -{ - gsl_matrix_complex matrix; -} _gsl_matrix_complex_const_view; - -typedef const _gsl_matrix_complex_const_view gsl_matrix_complex_const_view; - - -/* Allocation */ - -gsl_matrix_complex * -gsl_matrix_complex_alloc (const size_t n1, const size_t n2); - -gsl_matrix_complex * -gsl_matrix_complex_calloc (const size_t n1, const size_t n2); - -gsl_matrix_complex * -gsl_matrix_complex_alloc_from_block (gsl_block_complex * b, - const size_t offset, - const size_t n1, const size_t n2, const size_t d2); - -gsl_matrix_complex * -gsl_matrix_complex_alloc_from_matrix (gsl_matrix_complex * b, - const size_t k1, const size_t k2, - const size_t n1, const size_t n2); - -gsl_vector_complex * -gsl_vector_complex_alloc_row_from_matrix (gsl_matrix_complex * m, - const size_t i); - -gsl_vector_complex * -gsl_vector_complex_alloc_col_from_matrix (gsl_matrix_complex * m, - const size_t j); - -void gsl_matrix_complex_free (gsl_matrix_complex * m); - -/* Views */ - -_gsl_matrix_complex_view -gsl_matrix_complex_submatrix (gsl_matrix_complex * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_complex_view -gsl_matrix_complex_row (gsl_matrix_complex * m, const size_t i); - -_gsl_vector_complex_view -gsl_matrix_complex_column (gsl_matrix_complex * m, const size_t j); - -_gsl_vector_complex_view -gsl_matrix_complex_diagonal (gsl_matrix_complex * m); - -_gsl_vector_complex_view -gsl_matrix_complex_subdiagonal (gsl_matrix_complex * m, const size_t k); - -_gsl_vector_complex_view -gsl_matrix_complex_superdiagonal (gsl_matrix_complex * m, const size_t k); - -_gsl_vector_complex_view -gsl_matrix_complex_subrow (gsl_matrix_complex * m, - const size_t i, const size_t offset, - const size_t n); - -_gsl_vector_complex_view -gsl_matrix_complex_subcolumn (gsl_matrix_complex * m, - const size_t j, const size_t offset, - const size_t n); - -_gsl_matrix_complex_view -gsl_matrix_complex_view_array (double * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_complex_view -gsl_matrix_complex_view_array_with_tda (double * base, - const size_t n1, - const size_t n2, - const size_t tda); - -_gsl_matrix_complex_view -gsl_matrix_complex_view_vector (gsl_vector_complex * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_complex_view -gsl_matrix_complex_view_vector_with_tda (gsl_vector_complex * v, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_complex_const_view -gsl_matrix_complex_const_submatrix (const gsl_matrix_complex * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_complex_const_view -gsl_matrix_complex_const_row (const gsl_matrix_complex * m, - const size_t i); - -_gsl_vector_complex_const_view -gsl_matrix_complex_const_column (const gsl_matrix_complex * m, - const size_t j); - -_gsl_vector_complex_const_view -gsl_matrix_complex_const_diagonal (const gsl_matrix_complex * m); - -_gsl_vector_complex_const_view -gsl_matrix_complex_const_subdiagonal (const gsl_matrix_complex * m, - const size_t k); - -_gsl_vector_complex_const_view -gsl_matrix_complex_const_superdiagonal (const gsl_matrix_complex * m, - const size_t k); - -_gsl_vector_complex_const_view -gsl_matrix_complex_const_subrow (const gsl_matrix_complex * m, - const size_t i, const size_t offset, - const size_t n); - -_gsl_vector_complex_const_view -gsl_matrix_complex_const_subcolumn (const gsl_matrix_complex * m, - const size_t j, const size_t offset, - const size_t n); - -_gsl_matrix_complex_const_view -gsl_matrix_complex_const_view_array (const double * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_complex_const_view -gsl_matrix_complex_const_view_array_with_tda (const double * base, - const size_t n1, - const size_t n2, - const size_t tda); - -_gsl_matrix_complex_const_view -gsl_matrix_complex_const_view_vector (const gsl_vector_complex * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_complex_const_view -gsl_matrix_complex_const_view_vector_with_tda (const gsl_vector_complex * v, - const size_t n1, - const size_t n2, - const size_t tda); - -/* Operations */ - -void gsl_matrix_complex_set_zero (gsl_matrix_complex * m); -void gsl_matrix_complex_set_identity (gsl_matrix_complex * m); -void gsl_matrix_complex_set_all (gsl_matrix_complex * m, gsl_complex x); - -int gsl_matrix_complex_fread (FILE * stream, gsl_matrix_complex * m) ; -int gsl_matrix_complex_fwrite (FILE * stream, const gsl_matrix_complex * m) ; -int gsl_matrix_complex_fscanf (FILE * stream, gsl_matrix_complex * m); -int gsl_matrix_complex_fprintf (FILE * stream, const gsl_matrix_complex * m, const char * format); - -int gsl_matrix_complex_memcpy(gsl_matrix_complex * dest, const gsl_matrix_complex * src); -int gsl_matrix_complex_swap(gsl_matrix_complex * m1, gsl_matrix_complex * m2); -int gsl_matrix_complex_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_complex * dest, const gsl_matrix_complex * src); - -int gsl_matrix_complex_swap_rows(gsl_matrix_complex * m, const size_t i, const size_t j); -int gsl_matrix_complex_swap_columns(gsl_matrix_complex * m, const size_t i, const size_t j); -int gsl_matrix_complex_swap_rowcol(gsl_matrix_complex * m, const size_t i, const size_t j); - -int gsl_matrix_complex_transpose (gsl_matrix_complex * m); -int gsl_matrix_complex_transpose_memcpy (gsl_matrix_complex * dest, const gsl_matrix_complex * src); -int gsl_matrix_complex_transpose_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_complex * dest, const gsl_matrix_complex * src); - -int gsl_matrix_complex_equal (const gsl_matrix_complex * a, const gsl_matrix_complex * b); - -int gsl_matrix_complex_isnull (const gsl_matrix_complex * m); -int gsl_matrix_complex_ispos (const gsl_matrix_complex * m); -int gsl_matrix_complex_isneg (const gsl_matrix_complex * m); -int gsl_matrix_complex_isnonneg (const gsl_matrix_complex * m); - -int gsl_matrix_complex_add (gsl_matrix_complex * a, const gsl_matrix_complex * b); -int gsl_matrix_complex_sub (gsl_matrix_complex * a, const gsl_matrix_complex * b); -int gsl_matrix_complex_mul_elements (gsl_matrix_complex * a, const gsl_matrix_complex * b); -int gsl_matrix_complex_div_elements (gsl_matrix_complex * a, const gsl_matrix_complex * b); -int gsl_matrix_complex_scale (gsl_matrix_complex * a, const gsl_complex x); -int gsl_matrix_complex_add_constant (gsl_matrix_complex * a, const gsl_complex x); -int gsl_matrix_complex_add_diagonal (gsl_matrix_complex * a, const gsl_complex x); - -/***********************************************************************/ -/* The functions below are obsolete */ -/***********************************************************************/ -int gsl_matrix_complex_get_row(gsl_vector_complex * v, const gsl_matrix_complex * m, const size_t i); -int gsl_matrix_complex_get_col(gsl_vector_complex * v, const gsl_matrix_complex * m, const size_t j); -int gsl_matrix_complex_set_row(gsl_matrix_complex * m, const size_t i, const gsl_vector_complex * v); -int gsl_matrix_complex_set_col(gsl_matrix_complex * m, const size_t j, const gsl_vector_complex * v); -/***********************************************************************/ - -/* inline functions if you are using GCC */ - -INLINE_DECL gsl_complex gsl_matrix_complex_get(const gsl_matrix_complex * m, const size_t i, const size_t j); -INLINE_DECL void gsl_matrix_complex_set(gsl_matrix_complex * m, const size_t i, const size_t j, const gsl_complex x); - -INLINE_DECL gsl_complex * gsl_matrix_complex_ptr(gsl_matrix_complex * m, const size_t i, const size_t j); -INLINE_DECL const gsl_complex * gsl_matrix_complex_const_ptr(const gsl_matrix_complex * m, const size_t i, const size_t j); - -#ifdef HAVE_INLINE - -INLINE_FUN -gsl_complex -gsl_matrix_complex_get(const gsl_matrix_complex * m, - const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - gsl_complex zero = {{0,0}}; - - if (i >= m->size1) - { - GSL_ERROR_VAL("first index out of range", GSL_EINVAL, zero) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VAL("second index out of range", GSL_EINVAL, zero) ; - } - } -#endif - return *(gsl_complex *)(m->data + 2*(i * m->tda + j)) ; -} - -INLINE_FUN -void -gsl_matrix_complex_set(gsl_matrix_complex * m, - const size_t i, const size_t j, const gsl_complex x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; - } - } -#endif - *(gsl_complex *)(m->data + 2*(i * m->tda + j)) = x ; -} - -INLINE_FUN -gsl_complex * -gsl_matrix_complex_ptr(gsl_matrix_complex * m, - const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (gsl_complex *)(m->data + 2*(i * m->tda + j)) ; -} - -INLINE_FUN -const gsl_complex * -gsl_matrix_complex_const_ptr(const gsl_matrix_complex * m, - const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (const gsl_complex *)(m->data + 2*(i * m->tda + j)) ; -} - -#endif /* HAVE_INLINE */ - -__END_DECLS - -#endif /* __GSL_MATRIX_COMPLEX_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_complex_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_complex_float.h deleted file mode 100644 index c91eb19eb..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_complex_float.h +++ /dev/null @@ -1,353 +0,0 @@ -/* matrix/gsl_matrix_complex_float.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MATRIX_COMPLEX_FLOAT_H__ -#define __GSL_MATRIX_COMPLEX_FLOAT_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size1; - size_t size2; - size_t tda; - float * data; - gsl_block_complex_float * block; - int owner; -} gsl_matrix_complex_float ; - -typedef struct -{ - gsl_matrix_complex_float matrix; -} _gsl_matrix_complex_float_view; - -typedef _gsl_matrix_complex_float_view gsl_matrix_complex_float_view; - -typedef struct -{ - gsl_matrix_complex_float matrix; -} _gsl_matrix_complex_float_const_view; - -typedef const _gsl_matrix_complex_float_const_view gsl_matrix_complex_float_const_view; - - -/* Allocation */ - -gsl_matrix_complex_float * -gsl_matrix_complex_float_alloc (const size_t n1, const size_t n2); - -gsl_matrix_complex_float * -gsl_matrix_complex_float_calloc (const size_t n1, const size_t n2); - -gsl_matrix_complex_float * -gsl_matrix_complex_float_alloc_from_block (gsl_block_complex_float * b, - const size_t offset, - const size_t n1, const size_t n2, const size_t d2); - -gsl_matrix_complex_float * -gsl_matrix_complex_float_alloc_from_matrix (gsl_matrix_complex_float * b, - const size_t k1, const size_t k2, - const size_t n1, const size_t n2); - -gsl_vector_complex_float * -gsl_vector_complex_float_alloc_row_from_matrix (gsl_matrix_complex_float * m, - const size_t i); - -gsl_vector_complex_float * -gsl_vector_complex_float_alloc_col_from_matrix (gsl_matrix_complex_float * m, - const size_t j); - -void gsl_matrix_complex_float_free (gsl_matrix_complex_float * m); - -/* Views */ - -_gsl_matrix_complex_float_view -gsl_matrix_complex_float_submatrix (gsl_matrix_complex_float * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_complex_float_view -gsl_matrix_complex_float_row (gsl_matrix_complex_float * m, const size_t i); - -_gsl_vector_complex_float_view -gsl_matrix_complex_float_column (gsl_matrix_complex_float * m, const size_t j); - -_gsl_vector_complex_float_view -gsl_matrix_complex_float_diagonal (gsl_matrix_complex_float * m); - -_gsl_vector_complex_float_view -gsl_matrix_complex_float_subdiagonal (gsl_matrix_complex_float * m, const size_t k); - -_gsl_vector_complex_float_view -gsl_matrix_complex_float_superdiagonal (gsl_matrix_complex_float * m, const size_t k); - -_gsl_vector_complex_float_view -gsl_matrix_complex_float_subrow (gsl_matrix_complex_float * m, - const size_t i, const size_t offset, - const size_t n); - -_gsl_vector_complex_float_view -gsl_matrix_complex_float_subcolumn (gsl_matrix_complex_float * m, - const size_t j, const size_t offset, - const size_t n); - -_gsl_matrix_complex_float_view -gsl_matrix_complex_float_view_array (float * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_complex_float_view -gsl_matrix_complex_float_view_array_with_tda (float * base, - const size_t n1, - const size_t n2, - const size_t tda); - -_gsl_matrix_complex_float_view -gsl_matrix_complex_float_view_vector (gsl_vector_complex_float * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_complex_float_view -gsl_matrix_complex_float_view_vector_with_tda (gsl_vector_complex_float * v, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_complex_float_const_view -gsl_matrix_complex_float_const_submatrix (const gsl_matrix_complex_float * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_complex_float_const_view -gsl_matrix_complex_float_const_row (const gsl_matrix_complex_float * m, - const size_t i); - -_gsl_vector_complex_float_const_view -gsl_matrix_complex_float_const_column (const gsl_matrix_complex_float * m, - const size_t j); - -_gsl_vector_complex_float_const_view -gsl_matrix_complex_float_const_diagonal (const gsl_matrix_complex_float * m); - -_gsl_vector_complex_float_const_view -gsl_matrix_complex_float_const_subdiagonal (const gsl_matrix_complex_float * m, - const size_t k); - -_gsl_vector_complex_float_const_view -gsl_matrix_complex_float_const_superdiagonal (const gsl_matrix_complex_float * m, - const size_t k); - -_gsl_vector_complex_float_const_view -gsl_matrix_complex_float_const_subrow (const gsl_matrix_complex_float * m, - const size_t i, const size_t offset, - const size_t n); - -_gsl_vector_complex_float_const_view -gsl_matrix_complex_float_const_subcolumn (const gsl_matrix_complex_float * m, - const size_t j, const size_t offset, - const size_t n); - -_gsl_matrix_complex_float_const_view -gsl_matrix_complex_float_const_view_array (const float * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_complex_float_const_view -gsl_matrix_complex_float_const_view_array_with_tda (const float * base, - const size_t n1, - const size_t n2, - const size_t tda); - -_gsl_matrix_complex_float_const_view -gsl_matrix_complex_float_const_view_vector (const gsl_vector_complex_float * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_complex_float_const_view -gsl_matrix_complex_float_const_view_vector_with_tda (const gsl_vector_complex_float * v, - const size_t n1, - const size_t n2, - const size_t tda); - -/* Operations */ - -void gsl_matrix_complex_float_set_zero (gsl_matrix_complex_float * m); -void gsl_matrix_complex_float_set_identity (gsl_matrix_complex_float * m); -void gsl_matrix_complex_float_set_all (gsl_matrix_complex_float * m, gsl_complex_float x); - -int gsl_matrix_complex_float_fread (FILE * stream, gsl_matrix_complex_float * m) ; -int gsl_matrix_complex_float_fwrite (FILE * stream, const gsl_matrix_complex_float * m) ; -int gsl_matrix_complex_float_fscanf (FILE * stream, gsl_matrix_complex_float * m); -int gsl_matrix_complex_float_fprintf (FILE * stream, const gsl_matrix_complex_float * m, const char * format); - -int gsl_matrix_complex_float_memcpy(gsl_matrix_complex_float * dest, const gsl_matrix_complex_float * src); -int gsl_matrix_complex_float_swap(gsl_matrix_complex_float * m1, gsl_matrix_complex_float * m2); -int gsl_matrix_complex_float_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_complex_float * dest, const gsl_matrix_complex_float * src); - -int gsl_matrix_complex_float_swap_rows(gsl_matrix_complex_float * m, const size_t i, const size_t j); -int gsl_matrix_complex_float_swap_columns(gsl_matrix_complex_float * m, const size_t i, const size_t j); -int gsl_matrix_complex_float_swap_rowcol(gsl_matrix_complex_float * m, const size_t i, const size_t j); - -int gsl_matrix_complex_float_transpose (gsl_matrix_complex_float * m); -int gsl_matrix_complex_float_transpose_memcpy (gsl_matrix_complex_float * dest, const gsl_matrix_complex_float * src); -int gsl_matrix_complex_float_transpose_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_complex_float * dest, const gsl_matrix_complex_float * src); - -int gsl_matrix_complex_float_equal (const gsl_matrix_complex_float * a, const gsl_matrix_complex_float * b); - -int gsl_matrix_complex_float_isnull (const gsl_matrix_complex_float * m); -int gsl_matrix_complex_float_ispos (const gsl_matrix_complex_float * m); -int gsl_matrix_complex_float_isneg (const gsl_matrix_complex_float * m); -int gsl_matrix_complex_float_isnonneg (const gsl_matrix_complex_float * m); - -int gsl_matrix_complex_float_add (gsl_matrix_complex_float * a, const gsl_matrix_complex_float * b); -int gsl_matrix_complex_float_sub (gsl_matrix_complex_float * a, const gsl_matrix_complex_float * b); -int gsl_matrix_complex_float_mul_elements (gsl_matrix_complex_float * a, const gsl_matrix_complex_float * b); -int gsl_matrix_complex_float_div_elements (gsl_matrix_complex_float * a, const gsl_matrix_complex_float * b); -int gsl_matrix_complex_float_scale (gsl_matrix_complex_float * a, const gsl_complex_float x); -int gsl_matrix_complex_float_add_constant (gsl_matrix_complex_float * a, const gsl_complex_float x); -int gsl_matrix_complex_float_add_diagonal (gsl_matrix_complex_float * a, const gsl_complex_float x); - -/***********************************************************************/ -/* The functions below are obsolete */ -/***********************************************************************/ -int gsl_matrix_complex_float_get_row(gsl_vector_complex_float * v, const gsl_matrix_complex_float * m, const size_t i); -int gsl_matrix_complex_float_get_col(gsl_vector_complex_float * v, const gsl_matrix_complex_float * m, const size_t j); -int gsl_matrix_complex_float_set_row(gsl_matrix_complex_float * m, const size_t i, const gsl_vector_complex_float * v); -int gsl_matrix_complex_float_set_col(gsl_matrix_complex_float * m, const size_t j, const gsl_vector_complex_float * v); -/***********************************************************************/ - -/* inline functions if you are using GCC */ - -INLINE_DECL gsl_complex_float gsl_matrix_complex_float_get(const gsl_matrix_complex_float * m, const size_t i, const size_t j); -INLINE_DECL void gsl_matrix_complex_float_set(gsl_matrix_complex_float * m, const size_t i, const size_t j, const gsl_complex_float x); - -INLINE_DECL gsl_complex_float * gsl_matrix_complex_float_ptr(gsl_matrix_complex_float * m, const size_t i, const size_t j); -INLINE_DECL const gsl_complex_float * gsl_matrix_complex_float_const_ptr(const gsl_matrix_complex_float * m, const size_t i, const size_t j); - -#ifdef HAVE_INLINE - -INLINE_FUN -gsl_complex_float -gsl_matrix_complex_float_get(const gsl_matrix_complex_float * m, - const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - gsl_complex_float zero = {{0,0}}; - - if (i >= m->size1) - { - GSL_ERROR_VAL("first index out of range", GSL_EINVAL, zero) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VAL("second index out of range", GSL_EINVAL, zero) ; - } - } -#endif - return *(gsl_complex_float *)(m->data + 2*(i * m->tda + j)) ; -} - -INLINE_FUN -void -gsl_matrix_complex_float_set(gsl_matrix_complex_float * m, - const size_t i, const size_t j, const gsl_complex_float x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; - } - } -#endif - *(gsl_complex_float *)(m->data + 2*(i * m->tda + j)) = x ; -} - -INLINE_FUN -gsl_complex_float * -gsl_matrix_complex_float_ptr(gsl_matrix_complex_float * m, - const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (gsl_complex_float *)(m->data + 2*(i * m->tda + j)) ; -} - -INLINE_FUN -const gsl_complex_float * -gsl_matrix_complex_float_const_ptr(const gsl_matrix_complex_float * m, - const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (const gsl_complex_float *)(m->data + 2*(i * m->tda + j)) ; -} - -#endif /* HAVE_INLINE */ - -__END_DECLS - -#endif /* __GSL_MATRIX_COMPLEX_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_complex_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_complex_long_double.h deleted file mode 100644 index 58314ffa5..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_complex_long_double.h +++ /dev/null @@ -1,353 +0,0 @@ -/* matrix/gsl_matrix_complex_long_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MATRIX_COMPLEX_LONG_DOUBLE_H__ -#define __GSL_MATRIX_COMPLEX_LONG_DOUBLE_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size1; - size_t size2; - size_t tda; - long double * data; - gsl_block_complex_long_double * block; - int owner; -} gsl_matrix_complex_long_double ; - -typedef struct -{ - gsl_matrix_complex_long_double matrix; -} _gsl_matrix_complex_long_double_view; - -typedef _gsl_matrix_complex_long_double_view gsl_matrix_complex_long_double_view; - -typedef struct -{ - gsl_matrix_complex_long_double matrix; -} _gsl_matrix_complex_long_double_const_view; - -typedef const _gsl_matrix_complex_long_double_const_view gsl_matrix_complex_long_double_const_view; - - -/* Allocation */ - -gsl_matrix_complex_long_double * -gsl_matrix_complex_long_double_alloc (const size_t n1, const size_t n2); - -gsl_matrix_complex_long_double * -gsl_matrix_complex_long_double_calloc (const size_t n1, const size_t n2); - -gsl_matrix_complex_long_double * -gsl_matrix_complex_long_double_alloc_from_block (gsl_block_complex_long_double * b, - const size_t offset, - const size_t n1, const size_t n2, const size_t d2); - -gsl_matrix_complex_long_double * -gsl_matrix_complex_long_double_alloc_from_matrix (gsl_matrix_complex_long_double * b, - const size_t k1, const size_t k2, - const size_t n1, const size_t n2); - -gsl_vector_complex_long_double * -gsl_vector_complex_long_double_alloc_row_from_matrix (gsl_matrix_complex_long_double * m, - const size_t i); - -gsl_vector_complex_long_double * -gsl_vector_complex_long_double_alloc_col_from_matrix (gsl_matrix_complex_long_double * m, - const size_t j); - -void gsl_matrix_complex_long_double_free (gsl_matrix_complex_long_double * m); - -/* Views */ - -_gsl_matrix_complex_long_double_view -gsl_matrix_complex_long_double_submatrix (gsl_matrix_complex_long_double * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_complex_long_double_view -gsl_matrix_complex_long_double_row (gsl_matrix_complex_long_double * m, const size_t i); - -_gsl_vector_complex_long_double_view -gsl_matrix_complex_long_double_column (gsl_matrix_complex_long_double * m, const size_t j); - -_gsl_vector_complex_long_double_view -gsl_matrix_complex_long_double_diagonal (gsl_matrix_complex_long_double * m); - -_gsl_vector_complex_long_double_view -gsl_matrix_complex_long_double_subdiagonal (gsl_matrix_complex_long_double * m, const size_t k); - -_gsl_vector_complex_long_double_view -gsl_matrix_complex_long_double_superdiagonal (gsl_matrix_complex_long_double * m, const size_t k); - -_gsl_vector_complex_long_double_view -gsl_matrix_complex_long_double_subrow (gsl_matrix_complex_long_double * m, - const size_t i, const size_t offset, - const size_t n); - -_gsl_vector_complex_long_double_view -gsl_matrix_complex_long_double_subcolumn (gsl_matrix_complex_long_double * m, - const size_t j, const size_t offset, - const size_t n); - -_gsl_matrix_complex_long_double_view -gsl_matrix_complex_long_double_view_array (long double * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_complex_long_double_view -gsl_matrix_complex_long_double_view_array_with_tda (long double * base, - const size_t n1, - const size_t n2, - const size_t tda); - -_gsl_matrix_complex_long_double_view -gsl_matrix_complex_long_double_view_vector (gsl_vector_complex_long_double * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_complex_long_double_view -gsl_matrix_complex_long_double_view_vector_with_tda (gsl_vector_complex_long_double * v, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_complex_long_double_const_view -gsl_matrix_complex_long_double_const_submatrix (const gsl_matrix_complex_long_double * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_complex_long_double_const_view -gsl_matrix_complex_long_double_const_row (const gsl_matrix_complex_long_double * m, - const size_t i); - -_gsl_vector_complex_long_double_const_view -gsl_matrix_complex_long_double_const_column (const gsl_matrix_complex_long_double * m, - const size_t j); - -_gsl_vector_complex_long_double_const_view -gsl_matrix_complex_long_double_const_diagonal (const gsl_matrix_complex_long_double * m); - -_gsl_vector_complex_long_double_const_view -gsl_matrix_complex_long_double_const_subdiagonal (const gsl_matrix_complex_long_double * m, - const size_t k); - -_gsl_vector_complex_long_double_const_view -gsl_matrix_complex_long_double_const_superdiagonal (const gsl_matrix_complex_long_double * m, - const size_t k); - -_gsl_vector_complex_long_double_const_view -gsl_matrix_complex_long_double_const_subrow (const gsl_matrix_complex_long_double * m, - const size_t i, const size_t offset, - const size_t n); - -_gsl_vector_complex_long_double_const_view -gsl_matrix_complex_long_double_const_subcolumn (const gsl_matrix_complex_long_double * m, - const size_t j, const size_t offset, - const size_t n); - -_gsl_matrix_complex_long_double_const_view -gsl_matrix_complex_long_double_const_view_array (const long double * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_complex_long_double_const_view -gsl_matrix_complex_long_double_const_view_array_with_tda (const long double * base, - const size_t n1, - const size_t n2, - const size_t tda); - -_gsl_matrix_complex_long_double_const_view -gsl_matrix_complex_long_double_const_view_vector (const gsl_vector_complex_long_double * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_complex_long_double_const_view -gsl_matrix_complex_long_double_const_view_vector_with_tda (const gsl_vector_complex_long_double * v, - const size_t n1, - const size_t n2, - const size_t tda); - -/* Operations */ - -void gsl_matrix_complex_long_double_set_zero (gsl_matrix_complex_long_double * m); -void gsl_matrix_complex_long_double_set_identity (gsl_matrix_complex_long_double * m); -void gsl_matrix_complex_long_double_set_all (gsl_matrix_complex_long_double * m, gsl_complex_long_double x); - -int gsl_matrix_complex_long_double_fread (FILE * stream, gsl_matrix_complex_long_double * m) ; -int gsl_matrix_complex_long_double_fwrite (FILE * stream, const gsl_matrix_complex_long_double * m) ; -int gsl_matrix_complex_long_double_fscanf (FILE * stream, gsl_matrix_complex_long_double * m); -int gsl_matrix_complex_long_double_fprintf (FILE * stream, const gsl_matrix_complex_long_double * m, const char * format); - -int gsl_matrix_complex_long_double_memcpy(gsl_matrix_complex_long_double * dest, const gsl_matrix_complex_long_double * src); -int gsl_matrix_complex_long_double_swap(gsl_matrix_complex_long_double * m1, gsl_matrix_complex_long_double * m2); -int gsl_matrix_complex_long_double_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_complex_long_double * dest, const gsl_matrix_complex_long_double * src); - -int gsl_matrix_complex_long_double_swap_rows(gsl_matrix_complex_long_double * m, const size_t i, const size_t j); -int gsl_matrix_complex_long_double_swap_columns(gsl_matrix_complex_long_double * m, const size_t i, const size_t j); -int gsl_matrix_complex_long_double_swap_rowcol(gsl_matrix_complex_long_double * m, const size_t i, const size_t j); - -int gsl_matrix_complex_long_double_transpose (gsl_matrix_complex_long_double * m); -int gsl_matrix_complex_long_double_transpose_memcpy (gsl_matrix_complex_long_double * dest, const gsl_matrix_complex_long_double * src); -int gsl_matrix_complex_long_double_transpose_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_complex_long_double * dest, const gsl_matrix_complex_long_double * src); - -int gsl_matrix_complex_long_double_equal (const gsl_matrix_complex_long_double * a, const gsl_matrix_complex_long_double * b); - -int gsl_matrix_complex_long_double_isnull (const gsl_matrix_complex_long_double * m); -int gsl_matrix_complex_long_double_ispos (const gsl_matrix_complex_long_double * m); -int gsl_matrix_complex_long_double_isneg (const gsl_matrix_complex_long_double * m); -int gsl_matrix_complex_long_double_isnonneg (const gsl_matrix_complex_long_double * m); - -int gsl_matrix_complex_long_double_add (gsl_matrix_complex_long_double * a, const gsl_matrix_complex_long_double * b); -int gsl_matrix_complex_long_double_sub (gsl_matrix_complex_long_double * a, const gsl_matrix_complex_long_double * b); -int gsl_matrix_complex_long_double_mul_elements (gsl_matrix_complex_long_double * a, const gsl_matrix_complex_long_double * b); -int gsl_matrix_complex_long_double_div_elements (gsl_matrix_complex_long_double * a, const gsl_matrix_complex_long_double * b); -int gsl_matrix_complex_long_double_scale (gsl_matrix_complex_long_double * a, const gsl_complex_long_double x); -int gsl_matrix_complex_long_double_add_constant (gsl_matrix_complex_long_double * a, const gsl_complex_long_double x); -int gsl_matrix_complex_long_double_add_diagonal (gsl_matrix_complex_long_double * a, const gsl_complex_long_double x); - -/***********************************************************************/ -/* The functions below are obsolete */ -/***********************************************************************/ -int gsl_matrix_complex_long_double_get_row(gsl_vector_complex_long_double * v, const gsl_matrix_complex_long_double * m, const size_t i); -int gsl_matrix_complex_long_double_get_col(gsl_vector_complex_long_double * v, const gsl_matrix_complex_long_double * m, const size_t j); -int gsl_matrix_complex_long_double_set_row(gsl_matrix_complex_long_double * m, const size_t i, const gsl_vector_complex_long_double * v); -int gsl_matrix_complex_long_double_set_col(gsl_matrix_complex_long_double * m, const size_t j, const gsl_vector_complex_long_double * v); -/***********************************************************************/ - -/* inline functions if you are using GCC */ - -INLINE_DECL gsl_complex_long_double gsl_matrix_complex_long_double_get(const gsl_matrix_complex_long_double * m, const size_t i, const size_t j); -INLINE_DECL void gsl_matrix_complex_long_double_set(gsl_matrix_complex_long_double * m, const size_t i, const size_t j, const gsl_complex_long_double x); - -INLINE_DECL gsl_complex_long_double * gsl_matrix_complex_long_double_ptr(gsl_matrix_complex_long_double * m, const size_t i, const size_t j); -INLINE_DECL const gsl_complex_long_double * gsl_matrix_complex_long_double_const_ptr(const gsl_matrix_complex_long_double * m, const size_t i, const size_t j); - -#ifdef HAVE_INLINE - -INLINE_FUN -gsl_complex_long_double -gsl_matrix_complex_long_double_get(const gsl_matrix_complex_long_double * m, - const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - gsl_complex_long_double zero = {{0,0}}; - - if (i >= m->size1) - { - GSL_ERROR_VAL("first index out of range", GSL_EINVAL, zero) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VAL("second index out of range", GSL_EINVAL, zero) ; - } - } -#endif - return *(gsl_complex_long_double *)(m->data + 2*(i * m->tda + j)) ; -} - -INLINE_FUN -void -gsl_matrix_complex_long_double_set(gsl_matrix_complex_long_double * m, - const size_t i, const size_t j, const gsl_complex_long_double x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; - } - } -#endif - *(gsl_complex_long_double *)(m->data + 2*(i * m->tda + j)) = x ; -} - -INLINE_FUN -gsl_complex_long_double * -gsl_matrix_complex_long_double_ptr(gsl_matrix_complex_long_double * m, - const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (gsl_complex_long_double *)(m->data + 2*(i * m->tda + j)) ; -} - -INLINE_FUN -const gsl_complex_long_double * -gsl_matrix_complex_long_double_const_ptr(const gsl_matrix_complex_long_double * m, - const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (const gsl_complex_long_double *)(m->data + 2*(i * m->tda + j)) ; -} - -#endif /* HAVE_INLINE */ - -__END_DECLS - -#endif /* __GSL_MATRIX_COMPLEX_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_double.h deleted file mode 100644 index 64f7eed58..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_double.h +++ /dev/null @@ -1,352 +0,0 @@ -/* matrix/gsl_matrix_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MATRIX_DOUBLE_H__ -#define __GSL_MATRIX_DOUBLE_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size1; - size_t size2; - size_t tda; - double * data; - gsl_block * block; - int owner; -} gsl_matrix; - -typedef struct -{ - gsl_matrix matrix; -} _gsl_matrix_view; - -typedef _gsl_matrix_view gsl_matrix_view; - -typedef struct -{ - gsl_matrix matrix; -} _gsl_matrix_const_view; - -typedef const _gsl_matrix_const_view gsl_matrix_const_view; - -/* Allocation */ - -gsl_matrix * -gsl_matrix_alloc (const size_t n1, const size_t n2); - -gsl_matrix * -gsl_matrix_calloc (const size_t n1, const size_t n2); - -gsl_matrix * -gsl_matrix_alloc_from_block (gsl_block * b, - const size_t offset, - const size_t n1, - const size_t n2, - const size_t d2); - -gsl_matrix * -gsl_matrix_alloc_from_matrix (gsl_matrix * m, - const size_t k1, - const size_t k2, - const size_t n1, - const size_t n2); - -gsl_vector * -gsl_vector_alloc_row_from_matrix (gsl_matrix * m, - const size_t i); - -gsl_vector * -gsl_vector_alloc_col_from_matrix (gsl_matrix * m, - const size_t j); - -void gsl_matrix_free (gsl_matrix * m); - -/* Views */ - -_gsl_matrix_view -gsl_matrix_submatrix (gsl_matrix * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_view -gsl_matrix_row (gsl_matrix * m, const size_t i); - -_gsl_vector_view -gsl_matrix_column (gsl_matrix * m, const size_t j); - -_gsl_vector_view -gsl_matrix_diagonal (gsl_matrix * m); - -_gsl_vector_view -gsl_matrix_subdiagonal (gsl_matrix * m, const size_t k); - -_gsl_vector_view -gsl_matrix_superdiagonal (gsl_matrix * m, const size_t k); - -_gsl_vector_view -gsl_matrix_subrow (gsl_matrix * m, const size_t i, - const size_t offset, const size_t n); - -_gsl_vector_view -gsl_matrix_subcolumn (gsl_matrix * m, const size_t j, - const size_t offset, const size_t n); - -_gsl_matrix_view -gsl_matrix_view_array (double * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_view -gsl_matrix_view_array_with_tda (double * base, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_view -gsl_matrix_view_vector (gsl_vector * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_view -gsl_matrix_view_vector_with_tda (gsl_vector * v, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_const_view -gsl_matrix_const_submatrix (const gsl_matrix * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_const_view -gsl_matrix_const_row (const gsl_matrix * m, - const size_t i); - -_gsl_vector_const_view -gsl_matrix_const_column (const gsl_matrix * m, - const size_t j); - -_gsl_vector_const_view -gsl_matrix_const_diagonal (const gsl_matrix * m); - -_gsl_vector_const_view -gsl_matrix_const_subdiagonal (const gsl_matrix * m, - const size_t k); - -_gsl_vector_const_view -gsl_matrix_const_superdiagonal (const gsl_matrix * m, - const size_t k); - -_gsl_vector_const_view -gsl_matrix_const_subrow (const gsl_matrix * m, const size_t i, - const size_t offset, const size_t n); - -_gsl_vector_const_view -gsl_matrix_const_subcolumn (const gsl_matrix * m, const size_t j, - const size_t offset, const size_t n); - -_gsl_matrix_const_view -gsl_matrix_const_view_array (const double * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_const_view -gsl_matrix_const_view_array_with_tda (const double * base, - const size_t n1, - const size_t n2, - const size_t tda); - -_gsl_matrix_const_view -gsl_matrix_const_view_vector (const gsl_vector * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_const_view -gsl_matrix_const_view_vector_with_tda (const gsl_vector * v, - const size_t n1, - const size_t n2, - const size_t tda); - -/* Operations */ - -void gsl_matrix_set_zero (gsl_matrix * m); -void gsl_matrix_set_identity (gsl_matrix * m); -void gsl_matrix_set_all (gsl_matrix * m, double x); - -int gsl_matrix_fread (FILE * stream, gsl_matrix * m) ; -int gsl_matrix_fwrite (FILE * stream, const gsl_matrix * m) ; -int gsl_matrix_fscanf (FILE * stream, gsl_matrix * m); -int gsl_matrix_fprintf (FILE * stream, const gsl_matrix * m, const char * format); - -int gsl_matrix_memcpy(gsl_matrix * dest, const gsl_matrix * src); -int gsl_matrix_swap(gsl_matrix * m1, gsl_matrix * m2); -int gsl_matrix_tricpy(const char uplo_src, const int copy_diag, gsl_matrix * dest, const gsl_matrix * src); - -int gsl_matrix_swap_rows(gsl_matrix * m, const size_t i, const size_t j); -int gsl_matrix_swap_columns(gsl_matrix * m, const size_t i, const size_t j); -int gsl_matrix_swap_rowcol(gsl_matrix * m, const size_t i, const size_t j); -int gsl_matrix_transpose (gsl_matrix * m); -int gsl_matrix_transpose_memcpy (gsl_matrix * dest, const gsl_matrix * src); -int gsl_matrix_transpose_tricpy (const char uplo_src, const int copy_diag, gsl_matrix * dest, const gsl_matrix * src); - -double gsl_matrix_max (const gsl_matrix * m); -double gsl_matrix_min (const gsl_matrix * m); -void gsl_matrix_minmax (const gsl_matrix * m, double * min_out, double * max_out); - -void gsl_matrix_max_index (const gsl_matrix * m, size_t * imax, size_t *jmax); -void gsl_matrix_min_index (const gsl_matrix * m, size_t * imin, size_t *jmin); -void gsl_matrix_minmax_index (const gsl_matrix * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); - -int gsl_matrix_equal (const gsl_matrix * a, const gsl_matrix * b); - -int gsl_matrix_isnull (const gsl_matrix * m); -int gsl_matrix_ispos (const gsl_matrix * m); -int gsl_matrix_isneg (const gsl_matrix * m); -int gsl_matrix_isnonneg (const gsl_matrix * m); - -int gsl_matrix_add (gsl_matrix * a, const gsl_matrix * b); -int gsl_matrix_sub (gsl_matrix * a, const gsl_matrix * b); -int gsl_matrix_mul_elements (gsl_matrix * a, const gsl_matrix * b); -int gsl_matrix_div_elements (gsl_matrix * a, const gsl_matrix * b); -int gsl_matrix_scale (gsl_matrix * a, const double x); -int gsl_matrix_add_constant (gsl_matrix * a, const double x); -int gsl_matrix_add_diagonal (gsl_matrix * a, const double x); - -/***********************************************************************/ -/* The functions below are obsolete */ -/***********************************************************************/ -int gsl_matrix_get_row(gsl_vector * v, const gsl_matrix * m, const size_t i); -int gsl_matrix_get_col(gsl_vector * v, const gsl_matrix * m, const size_t j); -int gsl_matrix_set_row(gsl_matrix * m, const size_t i, const gsl_vector * v); -int gsl_matrix_set_col(gsl_matrix * m, const size_t j, const gsl_vector * v); -/***********************************************************************/ - -/* inline functions if you are using GCC */ - -INLINE_DECL double gsl_matrix_get(const gsl_matrix * m, const size_t i, const size_t j); -INLINE_DECL void gsl_matrix_set(gsl_matrix * m, const size_t i, const size_t j, const double x); -INLINE_DECL double * gsl_matrix_ptr(gsl_matrix * m, const size_t i, const size_t j); -INLINE_DECL const double * gsl_matrix_const_ptr(const gsl_matrix * m, const size_t i, const size_t j); - -#ifdef HAVE_INLINE -INLINE_FUN -double -gsl_matrix_get(const gsl_matrix * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; - } - } -#endif - return m->data[i * m->tda + j] ; -} - -INLINE_FUN -void -gsl_matrix_set(gsl_matrix * m, const size_t i, const size_t j, const double x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; - } - } -#endif - m->data[i * m->tda + j] = x ; -} - -INLINE_FUN -double * -gsl_matrix_ptr(gsl_matrix * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (double *) (m->data + (i * m->tda + j)) ; -} - -INLINE_FUN -const double * -gsl_matrix_const_ptr(const gsl_matrix * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (const double *) (m->data + (i * m->tda + j)) ; -} - -#endif - -__END_DECLS - -#endif /* __GSL_MATRIX_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_float.h deleted file mode 100644 index baa50079d..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_float.h +++ /dev/null @@ -1,352 +0,0 @@ -/* matrix/gsl_matrix_float.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MATRIX_FLOAT_H__ -#define __GSL_MATRIX_FLOAT_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size1; - size_t size2; - size_t tda; - float * data; - gsl_block_float * block; - int owner; -} gsl_matrix_float; - -typedef struct -{ - gsl_matrix_float matrix; -} _gsl_matrix_float_view; - -typedef _gsl_matrix_float_view gsl_matrix_float_view; - -typedef struct -{ - gsl_matrix_float matrix; -} _gsl_matrix_float_const_view; - -typedef const _gsl_matrix_float_const_view gsl_matrix_float_const_view; - -/* Allocation */ - -gsl_matrix_float * -gsl_matrix_float_alloc (const size_t n1, const size_t n2); - -gsl_matrix_float * -gsl_matrix_float_calloc (const size_t n1, const size_t n2); - -gsl_matrix_float * -gsl_matrix_float_alloc_from_block (gsl_block_float * b, - const size_t offset, - const size_t n1, - const size_t n2, - const size_t d2); - -gsl_matrix_float * -gsl_matrix_float_alloc_from_matrix (gsl_matrix_float * m, - const size_t k1, - const size_t k2, - const size_t n1, - const size_t n2); - -gsl_vector_float * -gsl_vector_float_alloc_row_from_matrix (gsl_matrix_float * m, - const size_t i); - -gsl_vector_float * -gsl_vector_float_alloc_col_from_matrix (gsl_matrix_float * m, - const size_t j); - -void gsl_matrix_float_free (gsl_matrix_float * m); - -/* Views */ - -_gsl_matrix_float_view -gsl_matrix_float_submatrix (gsl_matrix_float * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_float_view -gsl_matrix_float_row (gsl_matrix_float * m, const size_t i); - -_gsl_vector_float_view -gsl_matrix_float_column (gsl_matrix_float * m, const size_t j); - -_gsl_vector_float_view -gsl_matrix_float_diagonal (gsl_matrix_float * m); - -_gsl_vector_float_view -gsl_matrix_float_subdiagonal (gsl_matrix_float * m, const size_t k); - -_gsl_vector_float_view -gsl_matrix_float_superdiagonal (gsl_matrix_float * m, const size_t k); - -_gsl_vector_float_view -gsl_matrix_float_subrow (gsl_matrix_float * m, const size_t i, - const size_t offset, const size_t n); - -_gsl_vector_float_view -gsl_matrix_float_subcolumn (gsl_matrix_float * m, const size_t j, - const size_t offset, const size_t n); - -_gsl_matrix_float_view -gsl_matrix_float_view_array (float * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_float_view -gsl_matrix_float_view_array_with_tda (float * base, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_float_view -gsl_matrix_float_view_vector (gsl_vector_float * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_float_view -gsl_matrix_float_view_vector_with_tda (gsl_vector_float * v, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_float_const_view -gsl_matrix_float_const_submatrix (const gsl_matrix_float * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_float_const_view -gsl_matrix_float_const_row (const gsl_matrix_float * m, - const size_t i); - -_gsl_vector_float_const_view -gsl_matrix_float_const_column (const gsl_matrix_float * m, - const size_t j); - -_gsl_vector_float_const_view -gsl_matrix_float_const_diagonal (const gsl_matrix_float * m); - -_gsl_vector_float_const_view -gsl_matrix_float_const_subdiagonal (const gsl_matrix_float * m, - const size_t k); - -_gsl_vector_float_const_view -gsl_matrix_float_const_superdiagonal (const gsl_matrix_float * m, - const size_t k); - -_gsl_vector_float_const_view -gsl_matrix_float_const_subrow (const gsl_matrix_float * m, const size_t i, - const size_t offset, const size_t n); - -_gsl_vector_float_const_view -gsl_matrix_float_const_subcolumn (const gsl_matrix_float * m, const size_t j, - const size_t offset, const size_t n); - -_gsl_matrix_float_const_view -gsl_matrix_float_const_view_array (const float * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_float_const_view -gsl_matrix_float_const_view_array_with_tda (const float * base, - const size_t n1, - const size_t n2, - const size_t tda); - -_gsl_matrix_float_const_view -gsl_matrix_float_const_view_vector (const gsl_vector_float * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_float_const_view -gsl_matrix_float_const_view_vector_with_tda (const gsl_vector_float * v, - const size_t n1, - const size_t n2, - const size_t tda); - -/* Operations */ - -void gsl_matrix_float_set_zero (gsl_matrix_float * m); -void gsl_matrix_float_set_identity (gsl_matrix_float * m); -void gsl_matrix_float_set_all (gsl_matrix_float * m, float x); - -int gsl_matrix_float_fread (FILE * stream, gsl_matrix_float * m) ; -int gsl_matrix_float_fwrite (FILE * stream, const gsl_matrix_float * m) ; -int gsl_matrix_float_fscanf (FILE * stream, gsl_matrix_float * m); -int gsl_matrix_float_fprintf (FILE * stream, const gsl_matrix_float * m, const char * format); - -int gsl_matrix_float_memcpy(gsl_matrix_float * dest, const gsl_matrix_float * src); -int gsl_matrix_float_swap(gsl_matrix_float * m1, gsl_matrix_float * m2); -int gsl_matrix_float_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_float * dest, const gsl_matrix_float * src); - -int gsl_matrix_float_swap_rows(gsl_matrix_float * m, const size_t i, const size_t j); -int gsl_matrix_float_swap_columns(gsl_matrix_float * m, const size_t i, const size_t j); -int gsl_matrix_float_swap_rowcol(gsl_matrix_float * m, const size_t i, const size_t j); -int gsl_matrix_float_transpose (gsl_matrix_float * m); -int gsl_matrix_float_transpose_memcpy (gsl_matrix_float * dest, const gsl_matrix_float * src); -int gsl_matrix_float_transpose_tricpy (const char uplo_src, const int copy_diag, gsl_matrix_float * dest, const gsl_matrix_float * src); - -float gsl_matrix_float_max (const gsl_matrix_float * m); -float gsl_matrix_float_min (const gsl_matrix_float * m); -void gsl_matrix_float_minmax (const gsl_matrix_float * m, float * min_out, float * max_out); - -void gsl_matrix_float_max_index (const gsl_matrix_float * m, size_t * imax, size_t *jmax); -void gsl_matrix_float_min_index (const gsl_matrix_float * m, size_t * imin, size_t *jmin); -void gsl_matrix_float_minmax_index (const gsl_matrix_float * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); - -int gsl_matrix_float_equal (const gsl_matrix_float * a, const gsl_matrix_float * b); - -int gsl_matrix_float_isnull (const gsl_matrix_float * m); -int gsl_matrix_float_ispos (const gsl_matrix_float * m); -int gsl_matrix_float_isneg (const gsl_matrix_float * m); -int gsl_matrix_float_isnonneg (const gsl_matrix_float * m); - -int gsl_matrix_float_add (gsl_matrix_float * a, const gsl_matrix_float * b); -int gsl_matrix_float_sub (gsl_matrix_float * a, const gsl_matrix_float * b); -int gsl_matrix_float_mul_elements (gsl_matrix_float * a, const gsl_matrix_float * b); -int gsl_matrix_float_div_elements (gsl_matrix_float * a, const gsl_matrix_float * b); -int gsl_matrix_float_scale (gsl_matrix_float * a, const double x); -int gsl_matrix_float_add_constant (gsl_matrix_float * a, const double x); -int gsl_matrix_float_add_diagonal (gsl_matrix_float * a, const double x); - -/***********************************************************************/ -/* The functions below are obsolete */ -/***********************************************************************/ -int gsl_matrix_float_get_row(gsl_vector_float * v, const gsl_matrix_float * m, const size_t i); -int gsl_matrix_float_get_col(gsl_vector_float * v, const gsl_matrix_float * m, const size_t j); -int gsl_matrix_float_set_row(gsl_matrix_float * m, const size_t i, const gsl_vector_float * v); -int gsl_matrix_float_set_col(gsl_matrix_float * m, const size_t j, const gsl_vector_float * v); -/***********************************************************************/ - -/* inline functions if you are using GCC */ - -INLINE_DECL float gsl_matrix_float_get(const gsl_matrix_float * m, const size_t i, const size_t j); -INLINE_DECL void gsl_matrix_float_set(gsl_matrix_float * m, const size_t i, const size_t j, const float x); -INLINE_DECL float * gsl_matrix_float_ptr(gsl_matrix_float * m, const size_t i, const size_t j); -INLINE_DECL const float * gsl_matrix_float_const_ptr(const gsl_matrix_float * m, const size_t i, const size_t j); - -#ifdef HAVE_INLINE -INLINE_FUN -float -gsl_matrix_float_get(const gsl_matrix_float * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; - } - } -#endif - return m->data[i * m->tda + j] ; -} - -INLINE_FUN -void -gsl_matrix_float_set(gsl_matrix_float * m, const size_t i, const size_t j, const float x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; - } - } -#endif - m->data[i * m->tda + j] = x ; -} - -INLINE_FUN -float * -gsl_matrix_float_ptr(gsl_matrix_float * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (float *) (m->data + (i * m->tda + j)) ; -} - -INLINE_FUN -const float * -gsl_matrix_float_const_ptr(const gsl_matrix_float * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (const float *) (m->data + (i * m->tda + j)) ; -} - -#endif - -__END_DECLS - -#endif /* __GSL_MATRIX_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_int.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_int.h deleted file mode 100644 index b2b9c6106..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_int.h +++ /dev/null @@ -1,352 +0,0 @@ -/* matrix/gsl_matrix_int.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MATRIX_INT_H__ -#define __GSL_MATRIX_INT_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size1; - size_t size2; - size_t tda; - int * data; - gsl_block_int * block; - int owner; -} gsl_matrix_int; - -typedef struct -{ - gsl_matrix_int matrix; -} _gsl_matrix_int_view; - -typedef _gsl_matrix_int_view gsl_matrix_int_view; - -typedef struct -{ - gsl_matrix_int matrix; -} _gsl_matrix_int_const_view; - -typedef const _gsl_matrix_int_const_view gsl_matrix_int_const_view; - -/* Allocation */ - -gsl_matrix_int * -gsl_matrix_int_alloc (const size_t n1, const size_t n2); - -gsl_matrix_int * -gsl_matrix_int_calloc (const size_t n1, const size_t n2); - -gsl_matrix_int * -gsl_matrix_int_alloc_from_block (gsl_block_int * b, - const size_t offset, - const size_t n1, - const size_t n2, - const size_t d2); - -gsl_matrix_int * -gsl_matrix_int_alloc_from_matrix (gsl_matrix_int * m, - const size_t k1, - const size_t k2, - const size_t n1, - const size_t n2); - -gsl_vector_int * -gsl_vector_int_alloc_row_from_matrix (gsl_matrix_int * m, - const size_t i); - -gsl_vector_int * -gsl_vector_int_alloc_col_from_matrix (gsl_matrix_int * m, - const size_t j); - -void gsl_matrix_int_free (gsl_matrix_int * m); - -/* Views */ - -_gsl_matrix_int_view -gsl_matrix_int_submatrix (gsl_matrix_int * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_int_view -gsl_matrix_int_row (gsl_matrix_int * m, const size_t i); - -_gsl_vector_int_view -gsl_matrix_int_column (gsl_matrix_int * m, const size_t j); - -_gsl_vector_int_view -gsl_matrix_int_diagonal (gsl_matrix_int * m); - -_gsl_vector_int_view -gsl_matrix_int_subdiagonal (gsl_matrix_int * m, const size_t k); - -_gsl_vector_int_view -gsl_matrix_int_superdiagonal (gsl_matrix_int * m, const size_t k); - -_gsl_vector_int_view -gsl_matrix_int_subrow (gsl_matrix_int * m, const size_t i, - const size_t offset, const size_t n); - -_gsl_vector_int_view -gsl_matrix_int_subcolumn (gsl_matrix_int * m, const size_t j, - const size_t offset, const size_t n); - -_gsl_matrix_int_view -gsl_matrix_int_view_array (int * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_int_view -gsl_matrix_int_view_array_with_tda (int * base, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_int_view -gsl_matrix_int_view_vector (gsl_vector_int * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_int_view -gsl_matrix_int_view_vector_with_tda (gsl_vector_int * v, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_int_const_view -gsl_matrix_int_const_submatrix (const gsl_matrix_int * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_int_const_view -gsl_matrix_int_const_row (const gsl_matrix_int * m, - const size_t i); - -_gsl_vector_int_const_view -gsl_matrix_int_const_column (const gsl_matrix_int * m, - const size_t j); - -_gsl_vector_int_const_view -gsl_matrix_int_const_diagonal (const gsl_matrix_int * m); - -_gsl_vector_int_const_view -gsl_matrix_int_const_subdiagonal (const gsl_matrix_int * m, - const size_t k); - -_gsl_vector_int_const_view -gsl_matrix_int_const_superdiagonal (const gsl_matrix_int * m, - const size_t k); - -_gsl_vector_int_const_view -gsl_matrix_int_const_subrow (const gsl_matrix_int * m, const size_t i, - const size_t offset, const size_t n); - -_gsl_vector_int_const_view -gsl_matrix_int_const_subcolumn (const gsl_matrix_int * m, const size_t j, - const size_t offset, const size_t n); - -_gsl_matrix_int_const_view -gsl_matrix_int_const_view_array (const int * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_int_const_view -gsl_matrix_int_const_view_array_with_tda (const int * base, - const size_t n1, - const size_t n2, - const size_t tda); - -_gsl_matrix_int_const_view -gsl_matrix_int_const_view_vector (const gsl_vector_int * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_int_const_view -gsl_matrix_int_const_view_vector_with_tda (const gsl_vector_int * v, - const size_t n1, - const size_t n2, - const size_t tda); - -/* Operations */ - -void gsl_matrix_int_set_zero (gsl_matrix_int * m); -void gsl_matrix_int_set_identity (gsl_matrix_int * m); -void gsl_matrix_int_set_all (gsl_matrix_int * m, int x); - -int gsl_matrix_int_fread (FILE * stream, gsl_matrix_int * m) ; -int gsl_matrix_int_fwrite (FILE * stream, const gsl_matrix_int * m) ; -int gsl_matrix_int_fscanf (FILE * stream, gsl_matrix_int * m); -int gsl_matrix_int_fprintf (FILE * stream, const gsl_matrix_int * m, const char * format); - -int gsl_matrix_int_memcpy(gsl_matrix_int * dest, const gsl_matrix_int * src); -int gsl_matrix_int_swap(gsl_matrix_int * m1, gsl_matrix_int * m2); -int gsl_matrix_int_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_int * dest, const gsl_matrix_int * src); - -int gsl_matrix_int_swap_rows(gsl_matrix_int * m, const size_t i, const size_t j); -int gsl_matrix_int_swap_columns(gsl_matrix_int * m, const size_t i, const size_t j); -int gsl_matrix_int_swap_rowcol(gsl_matrix_int * m, const size_t i, const size_t j); -int gsl_matrix_int_transpose (gsl_matrix_int * m); -int gsl_matrix_int_transpose_memcpy (gsl_matrix_int * dest, const gsl_matrix_int * src); -int gsl_matrix_int_transpose_tricpy (const char uplo_src, const int copy_diag, gsl_matrix_int * dest, const gsl_matrix_int * src); - -int gsl_matrix_int_max (const gsl_matrix_int * m); -int gsl_matrix_int_min (const gsl_matrix_int * m); -void gsl_matrix_int_minmax (const gsl_matrix_int * m, int * min_out, int * max_out); - -void gsl_matrix_int_max_index (const gsl_matrix_int * m, size_t * imax, size_t *jmax); -void gsl_matrix_int_min_index (const gsl_matrix_int * m, size_t * imin, size_t *jmin); -void gsl_matrix_int_minmax_index (const gsl_matrix_int * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); - -int gsl_matrix_int_equal (const gsl_matrix_int * a, const gsl_matrix_int * b); - -int gsl_matrix_int_isnull (const gsl_matrix_int * m); -int gsl_matrix_int_ispos (const gsl_matrix_int * m); -int gsl_matrix_int_isneg (const gsl_matrix_int * m); -int gsl_matrix_int_isnonneg (const gsl_matrix_int * m); - -int gsl_matrix_int_add (gsl_matrix_int * a, const gsl_matrix_int * b); -int gsl_matrix_int_sub (gsl_matrix_int * a, const gsl_matrix_int * b); -int gsl_matrix_int_mul_elements (gsl_matrix_int * a, const gsl_matrix_int * b); -int gsl_matrix_int_div_elements (gsl_matrix_int * a, const gsl_matrix_int * b); -int gsl_matrix_int_scale (gsl_matrix_int * a, const double x); -int gsl_matrix_int_add_constant (gsl_matrix_int * a, const double x); -int gsl_matrix_int_add_diagonal (gsl_matrix_int * a, const double x); - -/***********************************************************************/ -/* The functions below are obsolete */ -/***********************************************************************/ -int gsl_matrix_int_get_row(gsl_vector_int * v, const gsl_matrix_int * m, const size_t i); -int gsl_matrix_int_get_col(gsl_vector_int * v, const gsl_matrix_int * m, const size_t j); -int gsl_matrix_int_set_row(gsl_matrix_int * m, const size_t i, const gsl_vector_int * v); -int gsl_matrix_int_set_col(gsl_matrix_int * m, const size_t j, const gsl_vector_int * v); -/***********************************************************************/ - -/* inline functions if you are using GCC */ - -INLINE_DECL int gsl_matrix_int_get(const gsl_matrix_int * m, const size_t i, const size_t j); -INLINE_DECL void gsl_matrix_int_set(gsl_matrix_int * m, const size_t i, const size_t j, const int x); -INLINE_DECL int * gsl_matrix_int_ptr(gsl_matrix_int * m, const size_t i, const size_t j); -INLINE_DECL const int * gsl_matrix_int_const_ptr(const gsl_matrix_int * m, const size_t i, const size_t j); - -#ifdef HAVE_INLINE -INLINE_FUN -int -gsl_matrix_int_get(const gsl_matrix_int * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; - } - } -#endif - return m->data[i * m->tda + j] ; -} - -INLINE_FUN -void -gsl_matrix_int_set(gsl_matrix_int * m, const size_t i, const size_t j, const int x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; - } - } -#endif - m->data[i * m->tda + j] = x ; -} - -INLINE_FUN -int * -gsl_matrix_int_ptr(gsl_matrix_int * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (int *) (m->data + (i * m->tda + j)) ; -} - -INLINE_FUN -const int * -gsl_matrix_int_const_ptr(const gsl_matrix_int * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (const int *) (m->data + (i * m->tda + j)) ; -} - -#endif - -__END_DECLS - -#endif /* __GSL_MATRIX_INT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_long.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_long.h deleted file mode 100644 index f9b097ccd..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_long.h +++ /dev/null @@ -1,352 +0,0 @@ -/* matrix/gsl_matrix_long.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MATRIX_LONG_H__ -#define __GSL_MATRIX_LONG_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size1; - size_t size2; - size_t tda; - long * data; - gsl_block_long * block; - int owner; -} gsl_matrix_long; - -typedef struct -{ - gsl_matrix_long matrix; -} _gsl_matrix_long_view; - -typedef _gsl_matrix_long_view gsl_matrix_long_view; - -typedef struct -{ - gsl_matrix_long matrix; -} _gsl_matrix_long_const_view; - -typedef const _gsl_matrix_long_const_view gsl_matrix_long_const_view; - -/* Allocation */ - -gsl_matrix_long * -gsl_matrix_long_alloc (const size_t n1, const size_t n2); - -gsl_matrix_long * -gsl_matrix_long_calloc (const size_t n1, const size_t n2); - -gsl_matrix_long * -gsl_matrix_long_alloc_from_block (gsl_block_long * b, - const size_t offset, - const size_t n1, - const size_t n2, - const size_t d2); - -gsl_matrix_long * -gsl_matrix_long_alloc_from_matrix (gsl_matrix_long * m, - const size_t k1, - const size_t k2, - const size_t n1, - const size_t n2); - -gsl_vector_long * -gsl_vector_long_alloc_row_from_matrix (gsl_matrix_long * m, - const size_t i); - -gsl_vector_long * -gsl_vector_long_alloc_col_from_matrix (gsl_matrix_long * m, - const size_t j); - -void gsl_matrix_long_free (gsl_matrix_long * m); - -/* Views */ - -_gsl_matrix_long_view -gsl_matrix_long_submatrix (gsl_matrix_long * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_long_view -gsl_matrix_long_row (gsl_matrix_long * m, const size_t i); - -_gsl_vector_long_view -gsl_matrix_long_column (gsl_matrix_long * m, const size_t j); - -_gsl_vector_long_view -gsl_matrix_long_diagonal (gsl_matrix_long * m); - -_gsl_vector_long_view -gsl_matrix_long_subdiagonal (gsl_matrix_long * m, const size_t k); - -_gsl_vector_long_view -gsl_matrix_long_superdiagonal (gsl_matrix_long * m, const size_t k); - -_gsl_vector_long_view -gsl_matrix_long_subrow (gsl_matrix_long * m, const size_t i, - const size_t offset, const size_t n); - -_gsl_vector_long_view -gsl_matrix_long_subcolumn (gsl_matrix_long * m, const size_t j, - const size_t offset, const size_t n); - -_gsl_matrix_long_view -gsl_matrix_long_view_array (long * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_long_view -gsl_matrix_long_view_array_with_tda (long * base, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_long_view -gsl_matrix_long_view_vector (gsl_vector_long * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_long_view -gsl_matrix_long_view_vector_with_tda (gsl_vector_long * v, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_long_const_view -gsl_matrix_long_const_submatrix (const gsl_matrix_long * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_long_const_view -gsl_matrix_long_const_row (const gsl_matrix_long * m, - const size_t i); - -_gsl_vector_long_const_view -gsl_matrix_long_const_column (const gsl_matrix_long * m, - const size_t j); - -_gsl_vector_long_const_view -gsl_matrix_long_const_diagonal (const gsl_matrix_long * m); - -_gsl_vector_long_const_view -gsl_matrix_long_const_subdiagonal (const gsl_matrix_long * m, - const size_t k); - -_gsl_vector_long_const_view -gsl_matrix_long_const_superdiagonal (const gsl_matrix_long * m, - const size_t k); - -_gsl_vector_long_const_view -gsl_matrix_long_const_subrow (const gsl_matrix_long * m, const size_t i, - const size_t offset, const size_t n); - -_gsl_vector_long_const_view -gsl_matrix_long_const_subcolumn (const gsl_matrix_long * m, const size_t j, - const size_t offset, const size_t n); - -_gsl_matrix_long_const_view -gsl_matrix_long_const_view_array (const long * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_long_const_view -gsl_matrix_long_const_view_array_with_tda (const long * base, - const size_t n1, - const size_t n2, - const size_t tda); - -_gsl_matrix_long_const_view -gsl_matrix_long_const_view_vector (const gsl_vector_long * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_long_const_view -gsl_matrix_long_const_view_vector_with_tda (const gsl_vector_long * v, - const size_t n1, - const size_t n2, - const size_t tda); - -/* Operations */ - -void gsl_matrix_long_set_zero (gsl_matrix_long * m); -void gsl_matrix_long_set_identity (gsl_matrix_long * m); -void gsl_matrix_long_set_all (gsl_matrix_long * m, long x); - -int gsl_matrix_long_fread (FILE * stream, gsl_matrix_long * m) ; -int gsl_matrix_long_fwrite (FILE * stream, const gsl_matrix_long * m) ; -int gsl_matrix_long_fscanf (FILE * stream, gsl_matrix_long * m); -int gsl_matrix_long_fprintf (FILE * stream, const gsl_matrix_long * m, const char * format); - -int gsl_matrix_long_memcpy(gsl_matrix_long * dest, const gsl_matrix_long * src); -int gsl_matrix_long_swap(gsl_matrix_long * m1, gsl_matrix_long * m2); -int gsl_matrix_long_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_long * dest, const gsl_matrix_long * src); - -int gsl_matrix_long_swap_rows(gsl_matrix_long * m, const size_t i, const size_t j); -int gsl_matrix_long_swap_columns(gsl_matrix_long * m, const size_t i, const size_t j); -int gsl_matrix_long_swap_rowcol(gsl_matrix_long * m, const size_t i, const size_t j); -int gsl_matrix_long_transpose (gsl_matrix_long * m); -int gsl_matrix_long_transpose_memcpy (gsl_matrix_long * dest, const gsl_matrix_long * src); -int gsl_matrix_long_transpose_tricpy (const char uplo_src, const int copy_diag, gsl_matrix_long * dest, const gsl_matrix_long * src); - -long gsl_matrix_long_max (const gsl_matrix_long * m); -long gsl_matrix_long_min (const gsl_matrix_long * m); -void gsl_matrix_long_minmax (const gsl_matrix_long * m, long * min_out, long * max_out); - -void gsl_matrix_long_max_index (const gsl_matrix_long * m, size_t * imax, size_t *jmax); -void gsl_matrix_long_min_index (const gsl_matrix_long * m, size_t * imin, size_t *jmin); -void gsl_matrix_long_minmax_index (const gsl_matrix_long * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); - -int gsl_matrix_long_equal (const gsl_matrix_long * a, const gsl_matrix_long * b); - -int gsl_matrix_long_isnull (const gsl_matrix_long * m); -int gsl_matrix_long_ispos (const gsl_matrix_long * m); -int gsl_matrix_long_isneg (const gsl_matrix_long * m); -int gsl_matrix_long_isnonneg (const gsl_matrix_long * m); - -int gsl_matrix_long_add (gsl_matrix_long * a, const gsl_matrix_long * b); -int gsl_matrix_long_sub (gsl_matrix_long * a, const gsl_matrix_long * b); -int gsl_matrix_long_mul_elements (gsl_matrix_long * a, const gsl_matrix_long * b); -int gsl_matrix_long_div_elements (gsl_matrix_long * a, const gsl_matrix_long * b); -int gsl_matrix_long_scale (gsl_matrix_long * a, const double x); -int gsl_matrix_long_add_constant (gsl_matrix_long * a, const double x); -int gsl_matrix_long_add_diagonal (gsl_matrix_long * a, const double x); - -/***********************************************************************/ -/* The functions below are obsolete */ -/***********************************************************************/ -int gsl_matrix_long_get_row(gsl_vector_long * v, const gsl_matrix_long * m, const size_t i); -int gsl_matrix_long_get_col(gsl_vector_long * v, const gsl_matrix_long * m, const size_t j); -int gsl_matrix_long_set_row(gsl_matrix_long * m, const size_t i, const gsl_vector_long * v); -int gsl_matrix_long_set_col(gsl_matrix_long * m, const size_t j, const gsl_vector_long * v); -/***********************************************************************/ - -/* inline functions if you are using GCC */ - -INLINE_DECL long gsl_matrix_long_get(const gsl_matrix_long * m, const size_t i, const size_t j); -INLINE_DECL void gsl_matrix_long_set(gsl_matrix_long * m, const size_t i, const size_t j, const long x); -INLINE_DECL long * gsl_matrix_long_ptr(gsl_matrix_long * m, const size_t i, const size_t j); -INLINE_DECL const long * gsl_matrix_long_const_ptr(const gsl_matrix_long * m, const size_t i, const size_t j); - -#ifdef HAVE_INLINE -INLINE_FUN -long -gsl_matrix_long_get(const gsl_matrix_long * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; - } - } -#endif - return m->data[i * m->tda + j] ; -} - -INLINE_FUN -void -gsl_matrix_long_set(gsl_matrix_long * m, const size_t i, const size_t j, const long x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; - } - } -#endif - m->data[i * m->tda + j] = x ; -} - -INLINE_FUN -long * -gsl_matrix_long_ptr(gsl_matrix_long * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (long *) (m->data + (i * m->tda + j)) ; -} - -INLINE_FUN -const long * -gsl_matrix_long_const_ptr(const gsl_matrix_long * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (const long *) (m->data + (i * m->tda + j)) ; -} - -#endif - -__END_DECLS - -#endif /* __GSL_MATRIX_LONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_long_double.h deleted file mode 100644 index 0f5555350..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_long_double.h +++ /dev/null @@ -1,352 +0,0 @@ -/* matrix/gsl_matrix_long_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MATRIX_LONG_DOUBLE_H__ -#define __GSL_MATRIX_LONG_DOUBLE_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size1; - size_t size2; - size_t tda; - long double * data; - gsl_block_long_double * block; - int owner; -} gsl_matrix_long_double; - -typedef struct -{ - gsl_matrix_long_double matrix; -} _gsl_matrix_long_double_view; - -typedef _gsl_matrix_long_double_view gsl_matrix_long_double_view; - -typedef struct -{ - gsl_matrix_long_double matrix; -} _gsl_matrix_long_double_const_view; - -typedef const _gsl_matrix_long_double_const_view gsl_matrix_long_double_const_view; - -/* Allocation */ - -gsl_matrix_long_double * -gsl_matrix_long_double_alloc (const size_t n1, const size_t n2); - -gsl_matrix_long_double * -gsl_matrix_long_double_calloc (const size_t n1, const size_t n2); - -gsl_matrix_long_double * -gsl_matrix_long_double_alloc_from_block (gsl_block_long_double * b, - const size_t offset, - const size_t n1, - const size_t n2, - const size_t d2); - -gsl_matrix_long_double * -gsl_matrix_long_double_alloc_from_matrix (gsl_matrix_long_double * m, - const size_t k1, - const size_t k2, - const size_t n1, - const size_t n2); - -gsl_vector_long_double * -gsl_vector_long_double_alloc_row_from_matrix (gsl_matrix_long_double * m, - const size_t i); - -gsl_vector_long_double * -gsl_vector_long_double_alloc_col_from_matrix (gsl_matrix_long_double * m, - const size_t j); - -void gsl_matrix_long_double_free (gsl_matrix_long_double * m); - -/* Views */ - -_gsl_matrix_long_double_view -gsl_matrix_long_double_submatrix (gsl_matrix_long_double * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_long_double_view -gsl_matrix_long_double_row (gsl_matrix_long_double * m, const size_t i); - -_gsl_vector_long_double_view -gsl_matrix_long_double_column (gsl_matrix_long_double * m, const size_t j); - -_gsl_vector_long_double_view -gsl_matrix_long_double_diagonal (gsl_matrix_long_double * m); - -_gsl_vector_long_double_view -gsl_matrix_long_double_subdiagonal (gsl_matrix_long_double * m, const size_t k); - -_gsl_vector_long_double_view -gsl_matrix_long_double_superdiagonal (gsl_matrix_long_double * m, const size_t k); - -_gsl_vector_long_double_view -gsl_matrix_long_double_subrow (gsl_matrix_long_double * m, const size_t i, - const size_t offset, const size_t n); - -_gsl_vector_long_double_view -gsl_matrix_long_double_subcolumn (gsl_matrix_long_double * m, const size_t j, - const size_t offset, const size_t n); - -_gsl_matrix_long_double_view -gsl_matrix_long_double_view_array (long double * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_long_double_view -gsl_matrix_long_double_view_array_with_tda (long double * base, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_long_double_view -gsl_matrix_long_double_view_vector (gsl_vector_long_double * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_long_double_view -gsl_matrix_long_double_view_vector_with_tda (gsl_vector_long_double * v, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_long_double_const_view -gsl_matrix_long_double_const_submatrix (const gsl_matrix_long_double * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_long_double_const_view -gsl_matrix_long_double_const_row (const gsl_matrix_long_double * m, - const size_t i); - -_gsl_vector_long_double_const_view -gsl_matrix_long_double_const_column (const gsl_matrix_long_double * m, - const size_t j); - -_gsl_vector_long_double_const_view -gsl_matrix_long_double_const_diagonal (const gsl_matrix_long_double * m); - -_gsl_vector_long_double_const_view -gsl_matrix_long_double_const_subdiagonal (const gsl_matrix_long_double * m, - const size_t k); - -_gsl_vector_long_double_const_view -gsl_matrix_long_double_const_superdiagonal (const gsl_matrix_long_double * m, - const size_t k); - -_gsl_vector_long_double_const_view -gsl_matrix_long_double_const_subrow (const gsl_matrix_long_double * m, const size_t i, - const size_t offset, const size_t n); - -_gsl_vector_long_double_const_view -gsl_matrix_long_double_const_subcolumn (const gsl_matrix_long_double * m, const size_t j, - const size_t offset, const size_t n); - -_gsl_matrix_long_double_const_view -gsl_matrix_long_double_const_view_array (const long double * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_long_double_const_view -gsl_matrix_long_double_const_view_array_with_tda (const long double * base, - const size_t n1, - const size_t n2, - const size_t tda); - -_gsl_matrix_long_double_const_view -gsl_matrix_long_double_const_view_vector (const gsl_vector_long_double * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_long_double_const_view -gsl_matrix_long_double_const_view_vector_with_tda (const gsl_vector_long_double * v, - const size_t n1, - const size_t n2, - const size_t tda); - -/* Operations */ - -void gsl_matrix_long_double_set_zero (gsl_matrix_long_double * m); -void gsl_matrix_long_double_set_identity (gsl_matrix_long_double * m); -void gsl_matrix_long_double_set_all (gsl_matrix_long_double * m, long double x); - -int gsl_matrix_long_double_fread (FILE * stream, gsl_matrix_long_double * m) ; -int gsl_matrix_long_double_fwrite (FILE * stream, const gsl_matrix_long_double * m) ; -int gsl_matrix_long_double_fscanf (FILE * stream, gsl_matrix_long_double * m); -int gsl_matrix_long_double_fprintf (FILE * stream, const gsl_matrix_long_double * m, const char * format); - -int gsl_matrix_long_double_memcpy(gsl_matrix_long_double * dest, const gsl_matrix_long_double * src); -int gsl_matrix_long_double_swap(gsl_matrix_long_double * m1, gsl_matrix_long_double * m2); -int gsl_matrix_long_double_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_long_double * dest, const gsl_matrix_long_double * src); - -int gsl_matrix_long_double_swap_rows(gsl_matrix_long_double * m, const size_t i, const size_t j); -int gsl_matrix_long_double_swap_columns(gsl_matrix_long_double * m, const size_t i, const size_t j); -int gsl_matrix_long_double_swap_rowcol(gsl_matrix_long_double * m, const size_t i, const size_t j); -int gsl_matrix_long_double_transpose (gsl_matrix_long_double * m); -int gsl_matrix_long_double_transpose_memcpy (gsl_matrix_long_double * dest, const gsl_matrix_long_double * src); -int gsl_matrix_long_double_transpose_tricpy (const char uplo_src, const int copy_diag, gsl_matrix_long_double * dest, const gsl_matrix_long_double * src); - -long double gsl_matrix_long_double_max (const gsl_matrix_long_double * m); -long double gsl_matrix_long_double_min (const gsl_matrix_long_double * m); -void gsl_matrix_long_double_minmax (const gsl_matrix_long_double * m, long double * min_out, long double * max_out); - -void gsl_matrix_long_double_max_index (const gsl_matrix_long_double * m, size_t * imax, size_t *jmax); -void gsl_matrix_long_double_min_index (const gsl_matrix_long_double * m, size_t * imin, size_t *jmin); -void gsl_matrix_long_double_minmax_index (const gsl_matrix_long_double * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); - -int gsl_matrix_long_double_equal (const gsl_matrix_long_double * a, const gsl_matrix_long_double * b); - -int gsl_matrix_long_double_isnull (const gsl_matrix_long_double * m); -int gsl_matrix_long_double_ispos (const gsl_matrix_long_double * m); -int gsl_matrix_long_double_isneg (const gsl_matrix_long_double * m); -int gsl_matrix_long_double_isnonneg (const gsl_matrix_long_double * m); - -int gsl_matrix_long_double_add (gsl_matrix_long_double * a, const gsl_matrix_long_double * b); -int gsl_matrix_long_double_sub (gsl_matrix_long_double * a, const gsl_matrix_long_double * b); -int gsl_matrix_long_double_mul_elements (gsl_matrix_long_double * a, const gsl_matrix_long_double * b); -int gsl_matrix_long_double_div_elements (gsl_matrix_long_double * a, const gsl_matrix_long_double * b); -int gsl_matrix_long_double_scale (gsl_matrix_long_double * a, const double x); -int gsl_matrix_long_double_add_constant (gsl_matrix_long_double * a, const double x); -int gsl_matrix_long_double_add_diagonal (gsl_matrix_long_double * a, const double x); - -/***********************************************************************/ -/* The functions below are obsolete */ -/***********************************************************************/ -int gsl_matrix_long_double_get_row(gsl_vector_long_double * v, const gsl_matrix_long_double * m, const size_t i); -int gsl_matrix_long_double_get_col(gsl_vector_long_double * v, const gsl_matrix_long_double * m, const size_t j); -int gsl_matrix_long_double_set_row(gsl_matrix_long_double * m, const size_t i, const gsl_vector_long_double * v); -int gsl_matrix_long_double_set_col(gsl_matrix_long_double * m, const size_t j, const gsl_vector_long_double * v); -/***********************************************************************/ - -/* inline functions if you are using GCC */ - -INLINE_DECL long double gsl_matrix_long_double_get(const gsl_matrix_long_double * m, const size_t i, const size_t j); -INLINE_DECL void gsl_matrix_long_double_set(gsl_matrix_long_double * m, const size_t i, const size_t j, const long double x); -INLINE_DECL long double * gsl_matrix_long_double_ptr(gsl_matrix_long_double * m, const size_t i, const size_t j); -INLINE_DECL const long double * gsl_matrix_long_double_const_ptr(const gsl_matrix_long_double * m, const size_t i, const size_t j); - -#ifdef HAVE_INLINE -INLINE_FUN -long double -gsl_matrix_long_double_get(const gsl_matrix_long_double * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; - } - } -#endif - return m->data[i * m->tda + j] ; -} - -INLINE_FUN -void -gsl_matrix_long_double_set(gsl_matrix_long_double * m, const size_t i, const size_t j, const long double x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; - } - } -#endif - m->data[i * m->tda + j] = x ; -} - -INLINE_FUN -long double * -gsl_matrix_long_double_ptr(gsl_matrix_long_double * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (long double *) (m->data + (i * m->tda + j)) ; -} - -INLINE_FUN -const long double * -gsl_matrix_long_double_const_ptr(const gsl_matrix_long_double * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (const long double *) (m->data + (i * m->tda + j)) ; -} - -#endif - -__END_DECLS - -#endif /* __GSL_MATRIX_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_short.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_short.h deleted file mode 100644 index f79324980..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_short.h +++ /dev/null @@ -1,352 +0,0 @@ -/* matrix/gsl_matrix_short.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MATRIX_SHORT_H__ -#define __GSL_MATRIX_SHORT_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size1; - size_t size2; - size_t tda; - short * data; - gsl_block_short * block; - int owner; -} gsl_matrix_short; - -typedef struct -{ - gsl_matrix_short matrix; -} _gsl_matrix_short_view; - -typedef _gsl_matrix_short_view gsl_matrix_short_view; - -typedef struct -{ - gsl_matrix_short matrix; -} _gsl_matrix_short_const_view; - -typedef const _gsl_matrix_short_const_view gsl_matrix_short_const_view; - -/* Allocation */ - -gsl_matrix_short * -gsl_matrix_short_alloc (const size_t n1, const size_t n2); - -gsl_matrix_short * -gsl_matrix_short_calloc (const size_t n1, const size_t n2); - -gsl_matrix_short * -gsl_matrix_short_alloc_from_block (gsl_block_short * b, - const size_t offset, - const size_t n1, - const size_t n2, - const size_t d2); - -gsl_matrix_short * -gsl_matrix_short_alloc_from_matrix (gsl_matrix_short * m, - const size_t k1, - const size_t k2, - const size_t n1, - const size_t n2); - -gsl_vector_short * -gsl_vector_short_alloc_row_from_matrix (gsl_matrix_short * m, - const size_t i); - -gsl_vector_short * -gsl_vector_short_alloc_col_from_matrix (gsl_matrix_short * m, - const size_t j); - -void gsl_matrix_short_free (gsl_matrix_short * m); - -/* Views */ - -_gsl_matrix_short_view -gsl_matrix_short_submatrix (gsl_matrix_short * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_short_view -gsl_matrix_short_row (gsl_matrix_short * m, const size_t i); - -_gsl_vector_short_view -gsl_matrix_short_column (gsl_matrix_short * m, const size_t j); - -_gsl_vector_short_view -gsl_matrix_short_diagonal (gsl_matrix_short * m); - -_gsl_vector_short_view -gsl_matrix_short_subdiagonal (gsl_matrix_short * m, const size_t k); - -_gsl_vector_short_view -gsl_matrix_short_superdiagonal (gsl_matrix_short * m, const size_t k); - -_gsl_vector_short_view -gsl_matrix_short_subrow (gsl_matrix_short * m, const size_t i, - const size_t offset, const size_t n); - -_gsl_vector_short_view -gsl_matrix_short_subcolumn (gsl_matrix_short * m, const size_t j, - const size_t offset, const size_t n); - -_gsl_matrix_short_view -gsl_matrix_short_view_array (short * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_short_view -gsl_matrix_short_view_array_with_tda (short * base, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_short_view -gsl_matrix_short_view_vector (gsl_vector_short * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_short_view -gsl_matrix_short_view_vector_with_tda (gsl_vector_short * v, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_short_const_view -gsl_matrix_short_const_submatrix (const gsl_matrix_short * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_short_const_view -gsl_matrix_short_const_row (const gsl_matrix_short * m, - const size_t i); - -_gsl_vector_short_const_view -gsl_matrix_short_const_column (const gsl_matrix_short * m, - const size_t j); - -_gsl_vector_short_const_view -gsl_matrix_short_const_diagonal (const gsl_matrix_short * m); - -_gsl_vector_short_const_view -gsl_matrix_short_const_subdiagonal (const gsl_matrix_short * m, - const size_t k); - -_gsl_vector_short_const_view -gsl_matrix_short_const_superdiagonal (const gsl_matrix_short * m, - const size_t k); - -_gsl_vector_short_const_view -gsl_matrix_short_const_subrow (const gsl_matrix_short * m, const size_t i, - const size_t offset, const size_t n); - -_gsl_vector_short_const_view -gsl_matrix_short_const_subcolumn (const gsl_matrix_short * m, const size_t j, - const size_t offset, const size_t n); - -_gsl_matrix_short_const_view -gsl_matrix_short_const_view_array (const short * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_short_const_view -gsl_matrix_short_const_view_array_with_tda (const short * base, - const size_t n1, - const size_t n2, - const size_t tda); - -_gsl_matrix_short_const_view -gsl_matrix_short_const_view_vector (const gsl_vector_short * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_short_const_view -gsl_matrix_short_const_view_vector_with_tda (const gsl_vector_short * v, - const size_t n1, - const size_t n2, - const size_t tda); - -/* Operations */ - -void gsl_matrix_short_set_zero (gsl_matrix_short * m); -void gsl_matrix_short_set_identity (gsl_matrix_short * m); -void gsl_matrix_short_set_all (gsl_matrix_short * m, short x); - -int gsl_matrix_short_fread (FILE * stream, gsl_matrix_short * m) ; -int gsl_matrix_short_fwrite (FILE * stream, const gsl_matrix_short * m) ; -int gsl_matrix_short_fscanf (FILE * stream, gsl_matrix_short * m); -int gsl_matrix_short_fprintf (FILE * stream, const gsl_matrix_short * m, const char * format); - -int gsl_matrix_short_memcpy(gsl_matrix_short * dest, const gsl_matrix_short * src); -int gsl_matrix_short_swap(gsl_matrix_short * m1, gsl_matrix_short * m2); -int gsl_matrix_short_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_short * dest, const gsl_matrix_short * src); - -int gsl_matrix_short_swap_rows(gsl_matrix_short * m, const size_t i, const size_t j); -int gsl_matrix_short_swap_columns(gsl_matrix_short * m, const size_t i, const size_t j); -int gsl_matrix_short_swap_rowcol(gsl_matrix_short * m, const size_t i, const size_t j); -int gsl_matrix_short_transpose (gsl_matrix_short * m); -int gsl_matrix_short_transpose_memcpy (gsl_matrix_short * dest, const gsl_matrix_short * src); -int gsl_matrix_short_transpose_tricpy (const char uplo_src, const int copy_diag, gsl_matrix_short * dest, const gsl_matrix_short * src); - -short gsl_matrix_short_max (const gsl_matrix_short * m); -short gsl_matrix_short_min (const gsl_matrix_short * m); -void gsl_matrix_short_minmax (const gsl_matrix_short * m, short * min_out, short * max_out); - -void gsl_matrix_short_max_index (const gsl_matrix_short * m, size_t * imax, size_t *jmax); -void gsl_matrix_short_min_index (const gsl_matrix_short * m, size_t * imin, size_t *jmin); -void gsl_matrix_short_minmax_index (const gsl_matrix_short * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); - -int gsl_matrix_short_equal (const gsl_matrix_short * a, const gsl_matrix_short * b); - -int gsl_matrix_short_isnull (const gsl_matrix_short * m); -int gsl_matrix_short_ispos (const gsl_matrix_short * m); -int gsl_matrix_short_isneg (const gsl_matrix_short * m); -int gsl_matrix_short_isnonneg (const gsl_matrix_short * m); - -int gsl_matrix_short_add (gsl_matrix_short * a, const gsl_matrix_short * b); -int gsl_matrix_short_sub (gsl_matrix_short * a, const gsl_matrix_short * b); -int gsl_matrix_short_mul_elements (gsl_matrix_short * a, const gsl_matrix_short * b); -int gsl_matrix_short_div_elements (gsl_matrix_short * a, const gsl_matrix_short * b); -int gsl_matrix_short_scale (gsl_matrix_short * a, const double x); -int gsl_matrix_short_add_constant (gsl_matrix_short * a, const double x); -int gsl_matrix_short_add_diagonal (gsl_matrix_short * a, const double x); - -/***********************************************************************/ -/* The functions below are obsolete */ -/***********************************************************************/ -int gsl_matrix_short_get_row(gsl_vector_short * v, const gsl_matrix_short * m, const size_t i); -int gsl_matrix_short_get_col(gsl_vector_short * v, const gsl_matrix_short * m, const size_t j); -int gsl_matrix_short_set_row(gsl_matrix_short * m, const size_t i, const gsl_vector_short * v); -int gsl_matrix_short_set_col(gsl_matrix_short * m, const size_t j, const gsl_vector_short * v); -/***********************************************************************/ - -/* inline functions if you are using GCC */ - -INLINE_DECL short gsl_matrix_short_get(const gsl_matrix_short * m, const size_t i, const size_t j); -INLINE_DECL void gsl_matrix_short_set(gsl_matrix_short * m, const size_t i, const size_t j, const short x); -INLINE_DECL short * gsl_matrix_short_ptr(gsl_matrix_short * m, const size_t i, const size_t j); -INLINE_DECL const short * gsl_matrix_short_const_ptr(const gsl_matrix_short * m, const size_t i, const size_t j); - -#ifdef HAVE_INLINE -INLINE_FUN -short -gsl_matrix_short_get(const gsl_matrix_short * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; - } - } -#endif - return m->data[i * m->tda + j] ; -} - -INLINE_FUN -void -gsl_matrix_short_set(gsl_matrix_short * m, const size_t i, const size_t j, const short x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; - } - } -#endif - m->data[i * m->tda + j] = x ; -} - -INLINE_FUN -short * -gsl_matrix_short_ptr(gsl_matrix_short * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (short *) (m->data + (i * m->tda + j)) ; -} - -INLINE_FUN -const short * -gsl_matrix_short_const_ptr(const gsl_matrix_short * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (const short *) (m->data + (i * m->tda + j)) ; -} - -#endif - -__END_DECLS - -#endif /* __GSL_MATRIX_SHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_uchar.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_uchar.h deleted file mode 100644 index 1e6746347..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_uchar.h +++ /dev/null @@ -1,352 +0,0 @@ -/* matrix/gsl_matrix_uchar.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MATRIX_UCHAR_H__ -#define __GSL_MATRIX_UCHAR_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size1; - size_t size2; - size_t tda; - unsigned char * data; - gsl_block_uchar * block; - int owner; -} gsl_matrix_uchar; - -typedef struct -{ - gsl_matrix_uchar matrix; -} _gsl_matrix_uchar_view; - -typedef _gsl_matrix_uchar_view gsl_matrix_uchar_view; - -typedef struct -{ - gsl_matrix_uchar matrix; -} _gsl_matrix_uchar_const_view; - -typedef const _gsl_matrix_uchar_const_view gsl_matrix_uchar_const_view; - -/* Allocation */ - -gsl_matrix_uchar * -gsl_matrix_uchar_alloc (const size_t n1, const size_t n2); - -gsl_matrix_uchar * -gsl_matrix_uchar_calloc (const size_t n1, const size_t n2); - -gsl_matrix_uchar * -gsl_matrix_uchar_alloc_from_block (gsl_block_uchar * b, - const size_t offset, - const size_t n1, - const size_t n2, - const size_t d2); - -gsl_matrix_uchar * -gsl_matrix_uchar_alloc_from_matrix (gsl_matrix_uchar * m, - const size_t k1, - const size_t k2, - const size_t n1, - const size_t n2); - -gsl_vector_uchar * -gsl_vector_uchar_alloc_row_from_matrix (gsl_matrix_uchar * m, - const size_t i); - -gsl_vector_uchar * -gsl_vector_uchar_alloc_col_from_matrix (gsl_matrix_uchar * m, - const size_t j); - -void gsl_matrix_uchar_free (gsl_matrix_uchar * m); - -/* Views */ - -_gsl_matrix_uchar_view -gsl_matrix_uchar_submatrix (gsl_matrix_uchar * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_uchar_view -gsl_matrix_uchar_row (gsl_matrix_uchar * m, const size_t i); - -_gsl_vector_uchar_view -gsl_matrix_uchar_column (gsl_matrix_uchar * m, const size_t j); - -_gsl_vector_uchar_view -gsl_matrix_uchar_diagonal (gsl_matrix_uchar * m); - -_gsl_vector_uchar_view -gsl_matrix_uchar_subdiagonal (gsl_matrix_uchar * m, const size_t k); - -_gsl_vector_uchar_view -gsl_matrix_uchar_superdiagonal (gsl_matrix_uchar * m, const size_t k); - -_gsl_vector_uchar_view -gsl_matrix_uchar_subrow (gsl_matrix_uchar * m, const size_t i, - const size_t offset, const size_t n); - -_gsl_vector_uchar_view -gsl_matrix_uchar_subcolumn (gsl_matrix_uchar * m, const size_t j, - const size_t offset, const size_t n); - -_gsl_matrix_uchar_view -gsl_matrix_uchar_view_array (unsigned char * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_uchar_view -gsl_matrix_uchar_view_array_with_tda (unsigned char * base, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_uchar_view -gsl_matrix_uchar_view_vector (gsl_vector_uchar * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_uchar_view -gsl_matrix_uchar_view_vector_with_tda (gsl_vector_uchar * v, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_uchar_const_view -gsl_matrix_uchar_const_submatrix (const gsl_matrix_uchar * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_uchar_const_view -gsl_matrix_uchar_const_row (const gsl_matrix_uchar * m, - const size_t i); - -_gsl_vector_uchar_const_view -gsl_matrix_uchar_const_column (const gsl_matrix_uchar * m, - const size_t j); - -_gsl_vector_uchar_const_view -gsl_matrix_uchar_const_diagonal (const gsl_matrix_uchar * m); - -_gsl_vector_uchar_const_view -gsl_matrix_uchar_const_subdiagonal (const gsl_matrix_uchar * m, - const size_t k); - -_gsl_vector_uchar_const_view -gsl_matrix_uchar_const_superdiagonal (const gsl_matrix_uchar * m, - const size_t k); - -_gsl_vector_uchar_const_view -gsl_matrix_uchar_const_subrow (const gsl_matrix_uchar * m, const size_t i, - const size_t offset, const size_t n); - -_gsl_vector_uchar_const_view -gsl_matrix_uchar_const_subcolumn (const gsl_matrix_uchar * m, const size_t j, - const size_t offset, const size_t n); - -_gsl_matrix_uchar_const_view -gsl_matrix_uchar_const_view_array (const unsigned char * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_uchar_const_view -gsl_matrix_uchar_const_view_array_with_tda (const unsigned char * base, - const size_t n1, - const size_t n2, - const size_t tda); - -_gsl_matrix_uchar_const_view -gsl_matrix_uchar_const_view_vector (const gsl_vector_uchar * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_uchar_const_view -gsl_matrix_uchar_const_view_vector_with_tda (const gsl_vector_uchar * v, - const size_t n1, - const size_t n2, - const size_t tda); - -/* Operations */ - -void gsl_matrix_uchar_set_zero (gsl_matrix_uchar * m); -void gsl_matrix_uchar_set_identity (gsl_matrix_uchar * m); -void gsl_matrix_uchar_set_all (gsl_matrix_uchar * m, unsigned char x); - -int gsl_matrix_uchar_fread (FILE * stream, gsl_matrix_uchar * m) ; -int gsl_matrix_uchar_fwrite (FILE * stream, const gsl_matrix_uchar * m) ; -int gsl_matrix_uchar_fscanf (FILE * stream, gsl_matrix_uchar * m); -int gsl_matrix_uchar_fprintf (FILE * stream, const gsl_matrix_uchar * m, const char * format); - -int gsl_matrix_uchar_memcpy(gsl_matrix_uchar * dest, const gsl_matrix_uchar * src); -int gsl_matrix_uchar_swap(gsl_matrix_uchar * m1, gsl_matrix_uchar * m2); -int gsl_matrix_uchar_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_uchar * dest, const gsl_matrix_uchar * src); - -int gsl_matrix_uchar_swap_rows(gsl_matrix_uchar * m, const size_t i, const size_t j); -int gsl_matrix_uchar_swap_columns(gsl_matrix_uchar * m, const size_t i, const size_t j); -int gsl_matrix_uchar_swap_rowcol(gsl_matrix_uchar * m, const size_t i, const size_t j); -int gsl_matrix_uchar_transpose (gsl_matrix_uchar * m); -int gsl_matrix_uchar_transpose_memcpy (gsl_matrix_uchar * dest, const gsl_matrix_uchar * src); -int gsl_matrix_uchar_transpose_tricpy (const char uplo_src, const int copy_diag, gsl_matrix_uchar * dest, const gsl_matrix_uchar * src); - -unsigned char gsl_matrix_uchar_max (const gsl_matrix_uchar * m); -unsigned char gsl_matrix_uchar_min (const gsl_matrix_uchar * m); -void gsl_matrix_uchar_minmax (const gsl_matrix_uchar * m, unsigned char * min_out, unsigned char * max_out); - -void gsl_matrix_uchar_max_index (const gsl_matrix_uchar * m, size_t * imax, size_t *jmax); -void gsl_matrix_uchar_min_index (const gsl_matrix_uchar * m, size_t * imin, size_t *jmin); -void gsl_matrix_uchar_minmax_index (const gsl_matrix_uchar * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); - -int gsl_matrix_uchar_equal (const gsl_matrix_uchar * a, const gsl_matrix_uchar * b); - -int gsl_matrix_uchar_isnull (const gsl_matrix_uchar * m); -int gsl_matrix_uchar_ispos (const gsl_matrix_uchar * m); -int gsl_matrix_uchar_isneg (const gsl_matrix_uchar * m); -int gsl_matrix_uchar_isnonneg (const gsl_matrix_uchar * m); - -int gsl_matrix_uchar_add (gsl_matrix_uchar * a, const gsl_matrix_uchar * b); -int gsl_matrix_uchar_sub (gsl_matrix_uchar * a, const gsl_matrix_uchar * b); -int gsl_matrix_uchar_mul_elements (gsl_matrix_uchar * a, const gsl_matrix_uchar * b); -int gsl_matrix_uchar_div_elements (gsl_matrix_uchar * a, const gsl_matrix_uchar * b); -int gsl_matrix_uchar_scale (gsl_matrix_uchar * a, const double x); -int gsl_matrix_uchar_add_constant (gsl_matrix_uchar * a, const double x); -int gsl_matrix_uchar_add_diagonal (gsl_matrix_uchar * a, const double x); - -/***********************************************************************/ -/* The functions below are obsolete */ -/***********************************************************************/ -int gsl_matrix_uchar_get_row(gsl_vector_uchar * v, const gsl_matrix_uchar * m, const size_t i); -int gsl_matrix_uchar_get_col(gsl_vector_uchar * v, const gsl_matrix_uchar * m, const size_t j); -int gsl_matrix_uchar_set_row(gsl_matrix_uchar * m, const size_t i, const gsl_vector_uchar * v); -int gsl_matrix_uchar_set_col(gsl_matrix_uchar * m, const size_t j, const gsl_vector_uchar * v); -/***********************************************************************/ - -/* inline functions if you are using GCC */ - -INLINE_DECL unsigned char gsl_matrix_uchar_get(const gsl_matrix_uchar * m, const size_t i, const size_t j); -INLINE_DECL void gsl_matrix_uchar_set(gsl_matrix_uchar * m, const size_t i, const size_t j, const unsigned char x); -INLINE_DECL unsigned char * gsl_matrix_uchar_ptr(gsl_matrix_uchar * m, const size_t i, const size_t j); -INLINE_DECL const unsigned char * gsl_matrix_uchar_const_ptr(const gsl_matrix_uchar * m, const size_t i, const size_t j); - -#ifdef HAVE_INLINE -INLINE_FUN -unsigned char -gsl_matrix_uchar_get(const gsl_matrix_uchar * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; - } - } -#endif - return m->data[i * m->tda + j] ; -} - -INLINE_FUN -void -gsl_matrix_uchar_set(gsl_matrix_uchar * m, const size_t i, const size_t j, const unsigned char x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; - } - } -#endif - m->data[i * m->tda + j] = x ; -} - -INLINE_FUN -unsigned char * -gsl_matrix_uchar_ptr(gsl_matrix_uchar * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (unsigned char *) (m->data + (i * m->tda + j)) ; -} - -INLINE_FUN -const unsigned char * -gsl_matrix_uchar_const_ptr(const gsl_matrix_uchar * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (const unsigned char *) (m->data + (i * m->tda + j)) ; -} - -#endif - -__END_DECLS - -#endif /* __GSL_MATRIX_UCHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_uint.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_uint.h deleted file mode 100644 index 2d9000261..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_uint.h +++ /dev/null @@ -1,352 +0,0 @@ -/* matrix/gsl_matrix_uint.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MATRIX_UINT_H__ -#define __GSL_MATRIX_UINT_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size1; - size_t size2; - size_t tda; - unsigned int * data; - gsl_block_uint * block; - int owner; -} gsl_matrix_uint; - -typedef struct -{ - gsl_matrix_uint matrix; -} _gsl_matrix_uint_view; - -typedef _gsl_matrix_uint_view gsl_matrix_uint_view; - -typedef struct -{ - gsl_matrix_uint matrix; -} _gsl_matrix_uint_const_view; - -typedef const _gsl_matrix_uint_const_view gsl_matrix_uint_const_view; - -/* Allocation */ - -gsl_matrix_uint * -gsl_matrix_uint_alloc (const size_t n1, const size_t n2); - -gsl_matrix_uint * -gsl_matrix_uint_calloc (const size_t n1, const size_t n2); - -gsl_matrix_uint * -gsl_matrix_uint_alloc_from_block (gsl_block_uint * b, - const size_t offset, - const size_t n1, - const size_t n2, - const size_t d2); - -gsl_matrix_uint * -gsl_matrix_uint_alloc_from_matrix (gsl_matrix_uint * m, - const size_t k1, - const size_t k2, - const size_t n1, - const size_t n2); - -gsl_vector_uint * -gsl_vector_uint_alloc_row_from_matrix (gsl_matrix_uint * m, - const size_t i); - -gsl_vector_uint * -gsl_vector_uint_alloc_col_from_matrix (gsl_matrix_uint * m, - const size_t j); - -void gsl_matrix_uint_free (gsl_matrix_uint * m); - -/* Views */ - -_gsl_matrix_uint_view -gsl_matrix_uint_submatrix (gsl_matrix_uint * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_uint_view -gsl_matrix_uint_row (gsl_matrix_uint * m, const size_t i); - -_gsl_vector_uint_view -gsl_matrix_uint_column (gsl_matrix_uint * m, const size_t j); - -_gsl_vector_uint_view -gsl_matrix_uint_diagonal (gsl_matrix_uint * m); - -_gsl_vector_uint_view -gsl_matrix_uint_subdiagonal (gsl_matrix_uint * m, const size_t k); - -_gsl_vector_uint_view -gsl_matrix_uint_superdiagonal (gsl_matrix_uint * m, const size_t k); - -_gsl_vector_uint_view -gsl_matrix_uint_subrow (gsl_matrix_uint * m, const size_t i, - const size_t offset, const size_t n); - -_gsl_vector_uint_view -gsl_matrix_uint_subcolumn (gsl_matrix_uint * m, const size_t j, - const size_t offset, const size_t n); - -_gsl_matrix_uint_view -gsl_matrix_uint_view_array (unsigned int * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_uint_view -gsl_matrix_uint_view_array_with_tda (unsigned int * base, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_uint_view -gsl_matrix_uint_view_vector (gsl_vector_uint * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_uint_view -gsl_matrix_uint_view_vector_with_tda (gsl_vector_uint * v, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_uint_const_view -gsl_matrix_uint_const_submatrix (const gsl_matrix_uint * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_uint_const_view -gsl_matrix_uint_const_row (const gsl_matrix_uint * m, - const size_t i); - -_gsl_vector_uint_const_view -gsl_matrix_uint_const_column (const gsl_matrix_uint * m, - const size_t j); - -_gsl_vector_uint_const_view -gsl_matrix_uint_const_diagonal (const gsl_matrix_uint * m); - -_gsl_vector_uint_const_view -gsl_matrix_uint_const_subdiagonal (const gsl_matrix_uint * m, - const size_t k); - -_gsl_vector_uint_const_view -gsl_matrix_uint_const_superdiagonal (const gsl_matrix_uint * m, - const size_t k); - -_gsl_vector_uint_const_view -gsl_matrix_uint_const_subrow (const gsl_matrix_uint * m, const size_t i, - const size_t offset, const size_t n); - -_gsl_vector_uint_const_view -gsl_matrix_uint_const_subcolumn (const gsl_matrix_uint * m, const size_t j, - const size_t offset, const size_t n); - -_gsl_matrix_uint_const_view -gsl_matrix_uint_const_view_array (const unsigned int * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_uint_const_view -gsl_matrix_uint_const_view_array_with_tda (const unsigned int * base, - const size_t n1, - const size_t n2, - const size_t tda); - -_gsl_matrix_uint_const_view -gsl_matrix_uint_const_view_vector (const gsl_vector_uint * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_uint_const_view -gsl_matrix_uint_const_view_vector_with_tda (const gsl_vector_uint * v, - const size_t n1, - const size_t n2, - const size_t tda); - -/* Operations */ - -void gsl_matrix_uint_set_zero (gsl_matrix_uint * m); -void gsl_matrix_uint_set_identity (gsl_matrix_uint * m); -void gsl_matrix_uint_set_all (gsl_matrix_uint * m, unsigned int x); - -int gsl_matrix_uint_fread (FILE * stream, gsl_matrix_uint * m) ; -int gsl_matrix_uint_fwrite (FILE * stream, const gsl_matrix_uint * m) ; -int gsl_matrix_uint_fscanf (FILE * stream, gsl_matrix_uint * m); -int gsl_matrix_uint_fprintf (FILE * stream, const gsl_matrix_uint * m, const char * format); - -int gsl_matrix_uint_memcpy(gsl_matrix_uint * dest, const gsl_matrix_uint * src); -int gsl_matrix_uint_swap(gsl_matrix_uint * m1, gsl_matrix_uint * m2); -int gsl_matrix_uint_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_uint * dest, const gsl_matrix_uint * src); - -int gsl_matrix_uint_swap_rows(gsl_matrix_uint * m, const size_t i, const size_t j); -int gsl_matrix_uint_swap_columns(gsl_matrix_uint * m, const size_t i, const size_t j); -int gsl_matrix_uint_swap_rowcol(gsl_matrix_uint * m, const size_t i, const size_t j); -int gsl_matrix_uint_transpose (gsl_matrix_uint * m); -int gsl_matrix_uint_transpose_memcpy (gsl_matrix_uint * dest, const gsl_matrix_uint * src); -int gsl_matrix_uint_transpose_tricpy (const char uplo_src, const int copy_diag, gsl_matrix_uint * dest, const gsl_matrix_uint * src); - -unsigned int gsl_matrix_uint_max (const gsl_matrix_uint * m); -unsigned int gsl_matrix_uint_min (const gsl_matrix_uint * m); -void gsl_matrix_uint_minmax (const gsl_matrix_uint * m, unsigned int * min_out, unsigned int * max_out); - -void gsl_matrix_uint_max_index (const gsl_matrix_uint * m, size_t * imax, size_t *jmax); -void gsl_matrix_uint_min_index (const gsl_matrix_uint * m, size_t * imin, size_t *jmin); -void gsl_matrix_uint_minmax_index (const gsl_matrix_uint * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); - -int gsl_matrix_uint_equal (const gsl_matrix_uint * a, const gsl_matrix_uint * b); - -int gsl_matrix_uint_isnull (const gsl_matrix_uint * m); -int gsl_matrix_uint_ispos (const gsl_matrix_uint * m); -int gsl_matrix_uint_isneg (const gsl_matrix_uint * m); -int gsl_matrix_uint_isnonneg (const gsl_matrix_uint * m); - -int gsl_matrix_uint_add (gsl_matrix_uint * a, const gsl_matrix_uint * b); -int gsl_matrix_uint_sub (gsl_matrix_uint * a, const gsl_matrix_uint * b); -int gsl_matrix_uint_mul_elements (gsl_matrix_uint * a, const gsl_matrix_uint * b); -int gsl_matrix_uint_div_elements (gsl_matrix_uint * a, const gsl_matrix_uint * b); -int gsl_matrix_uint_scale (gsl_matrix_uint * a, const double x); -int gsl_matrix_uint_add_constant (gsl_matrix_uint * a, const double x); -int gsl_matrix_uint_add_diagonal (gsl_matrix_uint * a, const double x); - -/***********************************************************************/ -/* The functions below are obsolete */ -/***********************************************************************/ -int gsl_matrix_uint_get_row(gsl_vector_uint * v, const gsl_matrix_uint * m, const size_t i); -int gsl_matrix_uint_get_col(gsl_vector_uint * v, const gsl_matrix_uint * m, const size_t j); -int gsl_matrix_uint_set_row(gsl_matrix_uint * m, const size_t i, const gsl_vector_uint * v); -int gsl_matrix_uint_set_col(gsl_matrix_uint * m, const size_t j, const gsl_vector_uint * v); -/***********************************************************************/ - -/* inline functions if you are using GCC */ - -INLINE_DECL unsigned int gsl_matrix_uint_get(const gsl_matrix_uint * m, const size_t i, const size_t j); -INLINE_DECL void gsl_matrix_uint_set(gsl_matrix_uint * m, const size_t i, const size_t j, const unsigned int x); -INLINE_DECL unsigned int * gsl_matrix_uint_ptr(gsl_matrix_uint * m, const size_t i, const size_t j); -INLINE_DECL const unsigned int * gsl_matrix_uint_const_ptr(const gsl_matrix_uint * m, const size_t i, const size_t j); - -#ifdef HAVE_INLINE -INLINE_FUN -unsigned int -gsl_matrix_uint_get(const gsl_matrix_uint * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; - } - } -#endif - return m->data[i * m->tda + j] ; -} - -INLINE_FUN -void -gsl_matrix_uint_set(gsl_matrix_uint * m, const size_t i, const size_t j, const unsigned int x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; - } - } -#endif - m->data[i * m->tda + j] = x ; -} - -INLINE_FUN -unsigned int * -gsl_matrix_uint_ptr(gsl_matrix_uint * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (unsigned int *) (m->data + (i * m->tda + j)) ; -} - -INLINE_FUN -const unsigned int * -gsl_matrix_uint_const_ptr(const gsl_matrix_uint * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (const unsigned int *) (m->data + (i * m->tda + j)) ; -} - -#endif - -__END_DECLS - -#endif /* __GSL_MATRIX_UINT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_ulong.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_ulong.h deleted file mode 100644 index d9fd50d84..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_ulong.h +++ /dev/null @@ -1,352 +0,0 @@ -/* matrix/gsl_matrix_ulong.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MATRIX_ULONG_H__ -#define __GSL_MATRIX_ULONG_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size1; - size_t size2; - size_t tda; - unsigned long * data; - gsl_block_ulong * block; - int owner; -} gsl_matrix_ulong; - -typedef struct -{ - gsl_matrix_ulong matrix; -} _gsl_matrix_ulong_view; - -typedef _gsl_matrix_ulong_view gsl_matrix_ulong_view; - -typedef struct -{ - gsl_matrix_ulong matrix; -} _gsl_matrix_ulong_const_view; - -typedef const _gsl_matrix_ulong_const_view gsl_matrix_ulong_const_view; - -/* Allocation */ - -gsl_matrix_ulong * -gsl_matrix_ulong_alloc (const size_t n1, const size_t n2); - -gsl_matrix_ulong * -gsl_matrix_ulong_calloc (const size_t n1, const size_t n2); - -gsl_matrix_ulong * -gsl_matrix_ulong_alloc_from_block (gsl_block_ulong * b, - const size_t offset, - const size_t n1, - const size_t n2, - const size_t d2); - -gsl_matrix_ulong * -gsl_matrix_ulong_alloc_from_matrix (gsl_matrix_ulong * m, - const size_t k1, - const size_t k2, - const size_t n1, - const size_t n2); - -gsl_vector_ulong * -gsl_vector_ulong_alloc_row_from_matrix (gsl_matrix_ulong * m, - const size_t i); - -gsl_vector_ulong * -gsl_vector_ulong_alloc_col_from_matrix (gsl_matrix_ulong * m, - const size_t j); - -void gsl_matrix_ulong_free (gsl_matrix_ulong * m); - -/* Views */ - -_gsl_matrix_ulong_view -gsl_matrix_ulong_submatrix (gsl_matrix_ulong * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_ulong_view -gsl_matrix_ulong_row (gsl_matrix_ulong * m, const size_t i); - -_gsl_vector_ulong_view -gsl_matrix_ulong_column (gsl_matrix_ulong * m, const size_t j); - -_gsl_vector_ulong_view -gsl_matrix_ulong_diagonal (gsl_matrix_ulong * m); - -_gsl_vector_ulong_view -gsl_matrix_ulong_subdiagonal (gsl_matrix_ulong * m, const size_t k); - -_gsl_vector_ulong_view -gsl_matrix_ulong_superdiagonal (gsl_matrix_ulong * m, const size_t k); - -_gsl_vector_ulong_view -gsl_matrix_ulong_subrow (gsl_matrix_ulong * m, const size_t i, - const size_t offset, const size_t n); - -_gsl_vector_ulong_view -gsl_matrix_ulong_subcolumn (gsl_matrix_ulong * m, const size_t j, - const size_t offset, const size_t n); - -_gsl_matrix_ulong_view -gsl_matrix_ulong_view_array (unsigned long * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_ulong_view -gsl_matrix_ulong_view_array_with_tda (unsigned long * base, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_ulong_view -gsl_matrix_ulong_view_vector (gsl_vector_ulong * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_ulong_view -gsl_matrix_ulong_view_vector_with_tda (gsl_vector_ulong * v, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_ulong_const_view -gsl_matrix_ulong_const_submatrix (const gsl_matrix_ulong * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_ulong_const_view -gsl_matrix_ulong_const_row (const gsl_matrix_ulong * m, - const size_t i); - -_gsl_vector_ulong_const_view -gsl_matrix_ulong_const_column (const gsl_matrix_ulong * m, - const size_t j); - -_gsl_vector_ulong_const_view -gsl_matrix_ulong_const_diagonal (const gsl_matrix_ulong * m); - -_gsl_vector_ulong_const_view -gsl_matrix_ulong_const_subdiagonal (const gsl_matrix_ulong * m, - const size_t k); - -_gsl_vector_ulong_const_view -gsl_matrix_ulong_const_superdiagonal (const gsl_matrix_ulong * m, - const size_t k); - -_gsl_vector_ulong_const_view -gsl_matrix_ulong_const_subrow (const gsl_matrix_ulong * m, const size_t i, - const size_t offset, const size_t n); - -_gsl_vector_ulong_const_view -gsl_matrix_ulong_const_subcolumn (const gsl_matrix_ulong * m, const size_t j, - const size_t offset, const size_t n); - -_gsl_matrix_ulong_const_view -gsl_matrix_ulong_const_view_array (const unsigned long * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_ulong_const_view -gsl_matrix_ulong_const_view_array_with_tda (const unsigned long * base, - const size_t n1, - const size_t n2, - const size_t tda); - -_gsl_matrix_ulong_const_view -gsl_matrix_ulong_const_view_vector (const gsl_vector_ulong * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_ulong_const_view -gsl_matrix_ulong_const_view_vector_with_tda (const gsl_vector_ulong * v, - const size_t n1, - const size_t n2, - const size_t tda); - -/* Operations */ - -void gsl_matrix_ulong_set_zero (gsl_matrix_ulong * m); -void gsl_matrix_ulong_set_identity (gsl_matrix_ulong * m); -void gsl_matrix_ulong_set_all (gsl_matrix_ulong * m, unsigned long x); - -int gsl_matrix_ulong_fread (FILE * stream, gsl_matrix_ulong * m) ; -int gsl_matrix_ulong_fwrite (FILE * stream, const gsl_matrix_ulong * m) ; -int gsl_matrix_ulong_fscanf (FILE * stream, gsl_matrix_ulong * m); -int gsl_matrix_ulong_fprintf (FILE * stream, const gsl_matrix_ulong * m, const char * format); - -int gsl_matrix_ulong_memcpy(gsl_matrix_ulong * dest, const gsl_matrix_ulong * src); -int gsl_matrix_ulong_swap(gsl_matrix_ulong * m1, gsl_matrix_ulong * m2); -int gsl_matrix_ulong_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_ulong * dest, const gsl_matrix_ulong * src); - -int gsl_matrix_ulong_swap_rows(gsl_matrix_ulong * m, const size_t i, const size_t j); -int gsl_matrix_ulong_swap_columns(gsl_matrix_ulong * m, const size_t i, const size_t j); -int gsl_matrix_ulong_swap_rowcol(gsl_matrix_ulong * m, const size_t i, const size_t j); -int gsl_matrix_ulong_transpose (gsl_matrix_ulong * m); -int gsl_matrix_ulong_transpose_memcpy (gsl_matrix_ulong * dest, const gsl_matrix_ulong * src); -int gsl_matrix_ulong_transpose_tricpy (const char uplo_src, const int copy_diag, gsl_matrix_ulong * dest, const gsl_matrix_ulong * src); - -unsigned long gsl_matrix_ulong_max (const gsl_matrix_ulong * m); -unsigned long gsl_matrix_ulong_min (const gsl_matrix_ulong * m); -void gsl_matrix_ulong_minmax (const gsl_matrix_ulong * m, unsigned long * min_out, unsigned long * max_out); - -void gsl_matrix_ulong_max_index (const gsl_matrix_ulong * m, size_t * imax, size_t *jmax); -void gsl_matrix_ulong_min_index (const gsl_matrix_ulong * m, size_t * imin, size_t *jmin); -void gsl_matrix_ulong_minmax_index (const gsl_matrix_ulong * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); - -int gsl_matrix_ulong_equal (const gsl_matrix_ulong * a, const gsl_matrix_ulong * b); - -int gsl_matrix_ulong_isnull (const gsl_matrix_ulong * m); -int gsl_matrix_ulong_ispos (const gsl_matrix_ulong * m); -int gsl_matrix_ulong_isneg (const gsl_matrix_ulong * m); -int gsl_matrix_ulong_isnonneg (const gsl_matrix_ulong * m); - -int gsl_matrix_ulong_add (gsl_matrix_ulong * a, const gsl_matrix_ulong * b); -int gsl_matrix_ulong_sub (gsl_matrix_ulong * a, const gsl_matrix_ulong * b); -int gsl_matrix_ulong_mul_elements (gsl_matrix_ulong * a, const gsl_matrix_ulong * b); -int gsl_matrix_ulong_div_elements (gsl_matrix_ulong * a, const gsl_matrix_ulong * b); -int gsl_matrix_ulong_scale (gsl_matrix_ulong * a, const double x); -int gsl_matrix_ulong_add_constant (gsl_matrix_ulong * a, const double x); -int gsl_matrix_ulong_add_diagonal (gsl_matrix_ulong * a, const double x); - -/***********************************************************************/ -/* The functions below are obsolete */ -/***********************************************************************/ -int gsl_matrix_ulong_get_row(gsl_vector_ulong * v, const gsl_matrix_ulong * m, const size_t i); -int gsl_matrix_ulong_get_col(gsl_vector_ulong * v, const gsl_matrix_ulong * m, const size_t j); -int gsl_matrix_ulong_set_row(gsl_matrix_ulong * m, const size_t i, const gsl_vector_ulong * v); -int gsl_matrix_ulong_set_col(gsl_matrix_ulong * m, const size_t j, const gsl_vector_ulong * v); -/***********************************************************************/ - -/* inline functions if you are using GCC */ - -INLINE_DECL unsigned long gsl_matrix_ulong_get(const gsl_matrix_ulong * m, const size_t i, const size_t j); -INLINE_DECL void gsl_matrix_ulong_set(gsl_matrix_ulong * m, const size_t i, const size_t j, const unsigned long x); -INLINE_DECL unsigned long * gsl_matrix_ulong_ptr(gsl_matrix_ulong * m, const size_t i, const size_t j); -INLINE_DECL const unsigned long * gsl_matrix_ulong_const_ptr(const gsl_matrix_ulong * m, const size_t i, const size_t j); - -#ifdef HAVE_INLINE -INLINE_FUN -unsigned long -gsl_matrix_ulong_get(const gsl_matrix_ulong * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; - } - } -#endif - return m->data[i * m->tda + j] ; -} - -INLINE_FUN -void -gsl_matrix_ulong_set(gsl_matrix_ulong * m, const size_t i, const size_t j, const unsigned long x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; - } - } -#endif - m->data[i * m->tda + j] = x ; -} - -INLINE_FUN -unsigned long * -gsl_matrix_ulong_ptr(gsl_matrix_ulong * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (unsigned long *) (m->data + (i * m->tda + j)) ; -} - -INLINE_FUN -const unsigned long * -gsl_matrix_ulong_const_ptr(const gsl_matrix_ulong * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (const unsigned long *) (m->data + (i * m->tda + j)) ; -} - -#endif - -__END_DECLS - -#endif /* __GSL_MATRIX_ULONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_ushort.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_ushort.h deleted file mode 100644 index e06cc2ac3..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_matrix_ushort.h +++ /dev/null @@ -1,352 +0,0 @@ -/* matrix/gsl_matrix_ushort.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MATRIX_USHORT_H__ -#define __GSL_MATRIX_USHORT_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size1; - size_t size2; - size_t tda; - unsigned short * data; - gsl_block_ushort * block; - int owner; -} gsl_matrix_ushort; - -typedef struct -{ - gsl_matrix_ushort matrix; -} _gsl_matrix_ushort_view; - -typedef _gsl_matrix_ushort_view gsl_matrix_ushort_view; - -typedef struct -{ - gsl_matrix_ushort matrix; -} _gsl_matrix_ushort_const_view; - -typedef const _gsl_matrix_ushort_const_view gsl_matrix_ushort_const_view; - -/* Allocation */ - -gsl_matrix_ushort * -gsl_matrix_ushort_alloc (const size_t n1, const size_t n2); - -gsl_matrix_ushort * -gsl_matrix_ushort_calloc (const size_t n1, const size_t n2); - -gsl_matrix_ushort * -gsl_matrix_ushort_alloc_from_block (gsl_block_ushort * b, - const size_t offset, - const size_t n1, - const size_t n2, - const size_t d2); - -gsl_matrix_ushort * -gsl_matrix_ushort_alloc_from_matrix (gsl_matrix_ushort * m, - const size_t k1, - const size_t k2, - const size_t n1, - const size_t n2); - -gsl_vector_ushort * -gsl_vector_ushort_alloc_row_from_matrix (gsl_matrix_ushort * m, - const size_t i); - -gsl_vector_ushort * -gsl_vector_ushort_alloc_col_from_matrix (gsl_matrix_ushort * m, - const size_t j); - -void gsl_matrix_ushort_free (gsl_matrix_ushort * m); - -/* Views */ - -_gsl_matrix_ushort_view -gsl_matrix_ushort_submatrix (gsl_matrix_ushort * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_ushort_view -gsl_matrix_ushort_row (gsl_matrix_ushort * m, const size_t i); - -_gsl_vector_ushort_view -gsl_matrix_ushort_column (gsl_matrix_ushort * m, const size_t j); - -_gsl_vector_ushort_view -gsl_matrix_ushort_diagonal (gsl_matrix_ushort * m); - -_gsl_vector_ushort_view -gsl_matrix_ushort_subdiagonal (gsl_matrix_ushort * m, const size_t k); - -_gsl_vector_ushort_view -gsl_matrix_ushort_superdiagonal (gsl_matrix_ushort * m, const size_t k); - -_gsl_vector_ushort_view -gsl_matrix_ushort_subrow (gsl_matrix_ushort * m, const size_t i, - const size_t offset, const size_t n); - -_gsl_vector_ushort_view -gsl_matrix_ushort_subcolumn (gsl_matrix_ushort * m, const size_t j, - const size_t offset, const size_t n); - -_gsl_matrix_ushort_view -gsl_matrix_ushort_view_array (unsigned short * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_ushort_view -gsl_matrix_ushort_view_array_with_tda (unsigned short * base, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_ushort_view -gsl_matrix_ushort_view_vector (gsl_vector_ushort * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_ushort_view -gsl_matrix_ushort_view_vector_with_tda (gsl_vector_ushort * v, - const size_t n1, - const size_t n2, - const size_t tda); - - -_gsl_matrix_ushort_const_view -gsl_matrix_ushort_const_submatrix (const gsl_matrix_ushort * m, - const size_t i, const size_t j, - const size_t n1, const size_t n2); - -_gsl_vector_ushort_const_view -gsl_matrix_ushort_const_row (const gsl_matrix_ushort * m, - const size_t i); - -_gsl_vector_ushort_const_view -gsl_matrix_ushort_const_column (const gsl_matrix_ushort * m, - const size_t j); - -_gsl_vector_ushort_const_view -gsl_matrix_ushort_const_diagonal (const gsl_matrix_ushort * m); - -_gsl_vector_ushort_const_view -gsl_matrix_ushort_const_subdiagonal (const gsl_matrix_ushort * m, - const size_t k); - -_gsl_vector_ushort_const_view -gsl_matrix_ushort_const_superdiagonal (const gsl_matrix_ushort * m, - const size_t k); - -_gsl_vector_ushort_const_view -gsl_matrix_ushort_const_subrow (const gsl_matrix_ushort * m, const size_t i, - const size_t offset, const size_t n); - -_gsl_vector_ushort_const_view -gsl_matrix_ushort_const_subcolumn (const gsl_matrix_ushort * m, const size_t j, - const size_t offset, const size_t n); - -_gsl_matrix_ushort_const_view -gsl_matrix_ushort_const_view_array (const unsigned short * base, - const size_t n1, - const size_t n2); - -_gsl_matrix_ushort_const_view -gsl_matrix_ushort_const_view_array_with_tda (const unsigned short * base, - const size_t n1, - const size_t n2, - const size_t tda); - -_gsl_matrix_ushort_const_view -gsl_matrix_ushort_const_view_vector (const gsl_vector_ushort * v, - const size_t n1, - const size_t n2); - -_gsl_matrix_ushort_const_view -gsl_matrix_ushort_const_view_vector_with_tda (const gsl_vector_ushort * v, - const size_t n1, - const size_t n2, - const size_t tda); - -/* Operations */ - -void gsl_matrix_ushort_set_zero (gsl_matrix_ushort * m); -void gsl_matrix_ushort_set_identity (gsl_matrix_ushort * m); -void gsl_matrix_ushort_set_all (gsl_matrix_ushort * m, unsigned short x); - -int gsl_matrix_ushort_fread (FILE * stream, gsl_matrix_ushort * m) ; -int gsl_matrix_ushort_fwrite (FILE * stream, const gsl_matrix_ushort * m) ; -int gsl_matrix_ushort_fscanf (FILE * stream, gsl_matrix_ushort * m); -int gsl_matrix_ushort_fprintf (FILE * stream, const gsl_matrix_ushort * m, const char * format); - -int gsl_matrix_ushort_memcpy(gsl_matrix_ushort * dest, const gsl_matrix_ushort * src); -int gsl_matrix_ushort_swap(gsl_matrix_ushort * m1, gsl_matrix_ushort * m2); -int gsl_matrix_ushort_tricpy(const char uplo_src, const int copy_diag, gsl_matrix_ushort * dest, const gsl_matrix_ushort * src); - -int gsl_matrix_ushort_swap_rows(gsl_matrix_ushort * m, const size_t i, const size_t j); -int gsl_matrix_ushort_swap_columns(gsl_matrix_ushort * m, const size_t i, const size_t j); -int gsl_matrix_ushort_swap_rowcol(gsl_matrix_ushort * m, const size_t i, const size_t j); -int gsl_matrix_ushort_transpose (gsl_matrix_ushort * m); -int gsl_matrix_ushort_transpose_memcpy (gsl_matrix_ushort * dest, const gsl_matrix_ushort * src); -int gsl_matrix_ushort_transpose_tricpy (const char uplo_src, const int copy_diag, gsl_matrix_ushort * dest, const gsl_matrix_ushort * src); - -unsigned short gsl_matrix_ushort_max (const gsl_matrix_ushort * m); -unsigned short gsl_matrix_ushort_min (const gsl_matrix_ushort * m); -void gsl_matrix_ushort_minmax (const gsl_matrix_ushort * m, unsigned short * min_out, unsigned short * max_out); - -void gsl_matrix_ushort_max_index (const gsl_matrix_ushort * m, size_t * imax, size_t *jmax); -void gsl_matrix_ushort_min_index (const gsl_matrix_ushort * m, size_t * imin, size_t *jmin); -void gsl_matrix_ushort_minmax_index (const gsl_matrix_ushort * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); - -int gsl_matrix_ushort_equal (const gsl_matrix_ushort * a, const gsl_matrix_ushort * b); - -int gsl_matrix_ushort_isnull (const gsl_matrix_ushort * m); -int gsl_matrix_ushort_ispos (const gsl_matrix_ushort * m); -int gsl_matrix_ushort_isneg (const gsl_matrix_ushort * m); -int gsl_matrix_ushort_isnonneg (const gsl_matrix_ushort * m); - -int gsl_matrix_ushort_add (gsl_matrix_ushort * a, const gsl_matrix_ushort * b); -int gsl_matrix_ushort_sub (gsl_matrix_ushort * a, const gsl_matrix_ushort * b); -int gsl_matrix_ushort_mul_elements (gsl_matrix_ushort * a, const gsl_matrix_ushort * b); -int gsl_matrix_ushort_div_elements (gsl_matrix_ushort * a, const gsl_matrix_ushort * b); -int gsl_matrix_ushort_scale (gsl_matrix_ushort * a, const double x); -int gsl_matrix_ushort_add_constant (gsl_matrix_ushort * a, const double x); -int gsl_matrix_ushort_add_diagonal (gsl_matrix_ushort * a, const double x); - -/***********************************************************************/ -/* The functions below are obsolete */ -/***********************************************************************/ -int gsl_matrix_ushort_get_row(gsl_vector_ushort * v, const gsl_matrix_ushort * m, const size_t i); -int gsl_matrix_ushort_get_col(gsl_vector_ushort * v, const gsl_matrix_ushort * m, const size_t j); -int gsl_matrix_ushort_set_row(gsl_matrix_ushort * m, const size_t i, const gsl_vector_ushort * v); -int gsl_matrix_ushort_set_col(gsl_matrix_ushort * m, const size_t j, const gsl_vector_ushort * v); -/***********************************************************************/ - -/* inline functions if you are using GCC */ - -INLINE_DECL unsigned short gsl_matrix_ushort_get(const gsl_matrix_ushort * m, const size_t i, const size_t j); -INLINE_DECL void gsl_matrix_ushort_set(gsl_matrix_ushort * m, const size_t i, const size_t j, const unsigned short x); -INLINE_DECL unsigned short * gsl_matrix_ushort_ptr(gsl_matrix_ushort * m, const size_t i, const size_t j); -INLINE_DECL const unsigned short * gsl_matrix_ushort_const_ptr(const gsl_matrix_ushort * m, const size_t i, const size_t j); - -#ifdef HAVE_INLINE -INLINE_FUN -unsigned short -gsl_matrix_ushort_get(const gsl_matrix_ushort * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; - } - } -#endif - return m->data[i * m->tda + j] ; -} - -INLINE_FUN -void -gsl_matrix_ushort_set(gsl_matrix_ushort * m, const size_t i, const size_t j, const unsigned short x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; - } - } -#endif - m->data[i * m->tda + j] = x ; -} - -INLINE_FUN -unsigned short * -gsl_matrix_ushort_ptr(gsl_matrix_ushort * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (unsigned short *) (m->data + (i * m->tda + j)) ; -} - -INLINE_FUN -const unsigned short * -gsl_matrix_ushort_const_ptr(const gsl_matrix_ushort * m, const size_t i, const size_t j) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(1)) - { - if (i >= m->size1) - { - GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; - } - else if (j >= m->size2) - { - GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; - } - } -#endif - return (const unsigned short *) (m->data + (i * m->tda + j)) ; -} - -#endif - -__END_DECLS - -#endif /* __GSL_MATRIX_USHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_message.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_message.h deleted file mode 100644 index 166ff9ddf..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_message.h +++ /dev/null @@ -1,80 +0,0 @@ -/* err/gsl_message.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MESSAGE_H__ -#define __GSL_MESSAGE_H__ -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -/* Provide a general messaging service for client use. Messages can - * be selectively turned off at compile time by defining an - * appropriate message mask. Client code which uses the GSL_MESSAGE() - * macro must provide a mask which is or'ed with the GSL_MESSAGE_MASK. - * - * The messaging service can be completely turned off - * by defining GSL_MESSAGING_OFF. */ - -void gsl_message(const char * message, const char * file, int line, - unsigned int mask); - -#ifndef GSL_MESSAGE_MASK -#define GSL_MESSAGE_MASK 0xffffffffu /* default all messages allowed */ -#endif - -GSL_VAR unsigned int gsl_message_mask ; - -/* Provide some symolic masks for client ease of use. */ - -enum { - GSL_MESSAGE_MASK_A = 1, - GSL_MESSAGE_MASK_B = 2, - GSL_MESSAGE_MASK_C = 4, - GSL_MESSAGE_MASK_D = 8, - GSL_MESSAGE_MASK_E = 16, - GSL_MESSAGE_MASK_F = 32, - GSL_MESSAGE_MASK_G = 64, - GSL_MESSAGE_MASK_H = 128 -} ; - -#ifdef GSL_MESSAGING_OFF /* throw away messages */ -#define GSL_MESSAGE(message, mask) do { } while(0) -#else /* output all messages */ -#define GSL_MESSAGE(message, mask) \ - do { \ - if (mask & GSL_MESSAGE_MASK) \ - gsl_message (message, __FILE__, __LINE__, mask) ; \ - } while (0) -#endif - -__END_DECLS - -#endif /* __GSL_MESSAGE_H__ */ - - diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_min.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_min.h deleted file mode 100644 index c179572a3..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_min.h +++ /dev/null @@ -1,111 +0,0 @@ -/* min/gsl_min.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007, 2009 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MIN_H__ -#define __GSL_MIN_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct - { - const char *name; - size_t size; - int (*set) (void *state, gsl_function * f, double x_minimum, double f_minimum, double x_lower, double f_lower, double x_upper, double f_upper); - int (*iterate) (void *state, gsl_function * f, double * x_minimum, double * f_minimum, double * x_lower, double * f_lower, double * x_upper, double * f_upper); - } -gsl_min_fminimizer_type; - -typedef struct - { - const gsl_min_fminimizer_type * type; - gsl_function * function ; - double x_minimum ; - double x_lower ; - double x_upper ; - double f_minimum, f_lower, f_upper; - void *state; - } -gsl_min_fminimizer; - -gsl_min_fminimizer * -gsl_min_fminimizer_alloc (const gsl_min_fminimizer_type * T) ; - -void gsl_min_fminimizer_free (gsl_min_fminimizer * s); - -int gsl_min_fminimizer_set (gsl_min_fminimizer * s, - gsl_function * f, double x_minimum, - double x_lower, double x_upper); - -int gsl_min_fminimizer_set_with_values (gsl_min_fminimizer * s, - gsl_function * f, - double x_minimum, double f_minimum, - double x_lower, double f_lower, - double x_upper, double f_upper); - -int gsl_min_fminimizer_iterate (gsl_min_fminimizer * s); - -const char * gsl_min_fminimizer_name (const gsl_min_fminimizer * s); - -double gsl_min_fminimizer_x_minimum (const gsl_min_fminimizer * s); -double gsl_min_fminimizer_x_lower (const gsl_min_fminimizer * s); -double gsl_min_fminimizer_x_upper (const gsl_min_fminimizer * s); -double gsl_min_fminimizer_f_minimum (const gsl_min_fminimizer * s); -double gsl_min_fminimizer_f_lower (const gsl_min_fminimizer * s); -double gsl_min_fminimizer_f_upper (const gsl_min_fminimizer * s); - -/* Deprecated, use x_minimum instead */ -double gsl_min_fminimizer_minimum (const gsl_min_fminimizer * s); - -int -gsl_min_test_interval (double x_lower, double x_upper, double epsabs, double epsrel); - -GSL_VAR const gsl_min_fminimizer_type * gsl_min_fminimizer_goldensection; -GSL_VAR const gsl_min_fminimizer_type * gsl_min_fminimizer_brent; -GSL_VAR const gsl_min_fminimizer_type * gsl_min_fminimizer_quad_golden; - -typedef -int (*gsl_min_bracketing_function)(gsl_function *f, - double *x_minimum,double * f_minimum, - double *x_lower, double * f_lower, - double *x_upper, double * f_upper, - size_t eval_max); - -int -gsl_min_find_bracket(gsl_function *f,double *x_minimum,double * f_minimum, - double *x_lower, double * f_lower, - double *x_upper, double * f_upper, - size_t eval_max); - -__END_DECLS - -#endif /* __GSL_MIN_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_minmax.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_minmax.h deleted file mode 100644 index 0d9a8360d..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_minmax.h +++ /dev/null @@ -1,102 +0,0 @@ -/* gsl_minmax.h - * - * Copyright (C) 2008 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MINMAX_H__ -#define __GSL_MINMAX_H__ -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -/* Define MAX and MIN macros/functions if they don't exist. */ - -/* plain old macros for general use */ -#define GSL_MAX(a,b) ((a) > (b) ? (a) : (b)) -#define GSL_MIN(a,b) ((a) < (b) ? (a) : (b)) - -/* function versions of the above, in case they are needed */ -double gsl_max (double a, double b); -double gsl_min (double a, double b); - -/* inline-friendly strongly typed versions */ -#ifdef HAVE_INLINE - -INLINE_FUN int GSL_MAX_INT (int a, int b); -INLINE_FUN int GSL_MIN_INT (int a, int b); -INLINE_FUN double GSL_MAX_DBL (double a, double b); -INLINE_FUN double GSL_MIN_DBL (double a, double b); -INLINE_FUN long double GSL_MAX_LDBL (long double a, long double b); -INLINE_FUN long double GSL_MIN_LDBL (long double a, long double b); - -INLINE_FUN int -GSL_MAX_INT (int a, int b) -{ - return GSL_MAX (a, b); -} - -INLINE_FUN int -GSL_MIN_INT (int a, int b) -{ - return GSL_MIN (a, b); -} - -INLINE_FUN double -GSL_MAX_DBL (double a, double b) -{ - return GSL_MAX (a, b); -} - -INLINE_FUN double -GSL_MIN_DBL (double a, double b) -{ - return GSL_MIN (a, b); -} - -INLINE_FUN long double -GSL_MAX_LDBL (long double a, long double b) -{ - return GSL_MAX (a, b); -} - -INLINE_FUN long double -GSL_MIN_LDBL (long double a, long double b) -{ - return GSL_MIN (a, b); -} -#else -#define GSL_MAX_INT(a,b) GSL_MAX(a,b) -#define GSL_MIN_INT(a,b) GSL_MIN(a,b) -#define GSL_MAX_DBL(a,b) GSL_MAX(a,b) -#define GSL_MIN_DBL(a,b) GSL_MIN(a,b) -#define GSL_MAX_LDBL(a,b) GSL_MAX(a,b) -#define GSL_MIN_LDBL(a,b) GSL_MIN(a,b) -#endif /* HAVE_INLINE */ - -__END_DECLS - -#endif /* __GSL_POW_INT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_mode.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_mode.h deleted file mode 100644 index c8e5d55d6..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_mode.h +++ /dev/null @@ -1,88 +0,0 @@ -/* gsl_mode.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: B. Gough and G. Jungman */ - -#ifndef __GSL_MODE_H__ -#define __GSL_MODE_H__ -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Some functions can take a mode argument. This - * is a rough method to do things like control - * the precision of the algorithm. This mainly - * occurs in special functions, but we figured - * it was ok to have a general facility. - * - * The mode type is 32-bit field. Most of - * the fields are currently unused. Users - * '|' various predefined constants to get - * a desired mode. - */ -typedef unsigned int gsl_mode_t; - - -/* Here are the predefined constants. - * Note that the precision constants - * are special because they are used - * to index arrays, so do not change - * them. The precision information is - * in the low order 3 bits of gsl_mode_t - * (the third bit is currently unused). - */ - -/* Note that "0" is double precision, - * so that you get that by default if - * you forget a flag. - */ -#define GSL_PREC_DOUBLE 0 -#define GSL_PREC_SINGLE 1 -#define GSL_PREC_APPROX 2 - -#ifdef HAVE_INLINE -INLINE_FUN unsigned int GSL_MODE_PREC(gsl_mode_t mt); - -INLINE_FUN unsigned int -GSL_MODE_PREC(gsl_mode_t mt) -{ return (mt & (unsigned int)7); } -#else /* HAVE_INLINE */ -#define GSL_MODE_PREC(mt) ((mt) & (unsigned int)7) -#endif /* HAVE_INLINE */ - - -/* Here are some predefined generic modes. - */ -#define GSL_MODE_DEFAULT 0 - - -__END_DECLS - -#endif /* __GSL_MODE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_monte.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_monte.h deleted file mode 100644 index 4d1d88e25..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_monte.h +++ /dev/null @@ -1,55 +0,0 @@ -/* monte/gsl_monte.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Michael Booth - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Some things common to all the Monte-Carlo implementations */ -/* Author: MJB */ - -#ifndef __GSL_MONTE_H__ -#define __GSL_MONTE_H__ - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -/* Hide the function type in a typedef so that we can use it in all our - integration functions, and make it easy to change things. -*/ - -struct gsl_monte_function_struct { - double (*f)(double * x_array, size_t dim, void * params); - size_t dim; - void * params; -}; - -typedef struct gsl_monte_function_struct gsl_monte_function; - -#define GSL_MONTE_FN_EVAL(F,x) (*((F)->f))(x,(F)->dim,(F)->params) - - -__END_DECLS - -#endif /* __GSL_MONTE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_monte_miser.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_monte_miser.h deleted file mode 100644 index 5940396d1..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_monte_miser.h +++ /dev/null @@ -1,97 +0,0 @@ -/* monte/gsl_monte_miser.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Michael Booth - * Copyright (C) 2009 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: MJB */ - -#ifndef __GSL_MONTE_MISER_H__ -#define __GSL_MONTE_MISER_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct { - size_t min_calls; - size_t min_calls_per_bisection; - double dither; - double estimate_frac; - double alpha; - size_t dim; - int estimate_style; - int depth; - int verbose; - double * x; - double * xmid; - double * sigma_l; - double * sigma_r; - double * fmax_l; - double * fmax_r; - double * fmin_l; - double * fmin_r; - double * fsum_l; - double * fsum_r; - double * fsum2_l; - double * fsum2_r; - size_t * hits_l; - size_t * hits_r; -} gsl_monte_miser_state; - -int gsl_monte_miser_integrate(gsl_monte_function * f, - const double xl[], const double xh[], - size_t dim, size_t calls, - gsl_rng *r, - gsl_monte_miser_state* state, - double *result, double *abserr); - -gsl_monte_miser_state* gsl_monte_miser_alloc(size_t dim); - -int gsl_monte_miser_init(gsl_monte_miser_state* state); - -void gsl_monte_miser_free(gsl_monte_miser_state* state); - -typedef struct { - double estimate_frac; - size_t min_calls; - size_t min_calls_per_bisection; - double alpha; - double dither; -} gsl_monte_miser_params; - -void gsl_monte_miser_params_get (const gsl_monte_miser_state * state, - gsl_monte_miser_params * params); - -void gsl_monte_miser_params_set (gsl_monte_miser_state * state, - const gsl_monte_miser_params * params); - -__END_DECLS - -#endif /* __GSL_MONTE_MISER_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_monte_plain.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_monte_plain.h deleted file mode 100644 index c4745b97d..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_monte_plain.h +++ /dev/null @@ -1,65 +0,0 @@ -/* monte/gsl_monte_plain.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Michael Booth - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Plain Monte-Carlo. */ - -/* Author: MJB */ - -#ifndef __GSL_MONTE_PLAIN_H__ -#define __GSL_MONTE_PLAIN_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct { - size_t dim; - double *x; -} gsl_monte_plain_state; - -int -gsl_monte_plain_integrate (const gsl_monte_function * f, - const double xl[], const double xu[], - const size_t dim, - const size_t calls, - gsl_rng * r, - gsl_monte_plain_state * state, - double *result, double *abserr); - -gsl_monte_plain_state* gsl_monte_plain_alloc(size_t dim); - -int gsl_monte_plain_init(gsl_monte_plain_state* state); - -void gsl_monte_plain_free (gsl_monte_plain_state* state); - -__END_DECLS - -#endif /* __GSL_MONTE_PLAIN_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_monte_vegas.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_monte_vegas.h deleted file mode 100644 index 0942c04dc..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_monte_vegas.h +++ /dev/null @@ -1,125 +0,0 @@ -/* monte/gsl_monte_vegas.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Michael Booth - * Copyright (C) 2009 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* header for the gsl "vegas" routines. Mike Booth, May 1998 */ - -#ifndef __GSL_MONTE_VEGAS_H__ -#define __GSL_MONTE_VEGAS_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -enum {GSL_VEGAS_MODE_IMPORTANCE = 1, - GSL_VEGAS_MODE_IMPORTANCE_ONLY = 0, - GSL_VEGAS_MODE_STRATIFIED = -1}; - -typedef struct { - /* grid */ - size_t dim; - size_t bins_max; - unsigned int bins; - unsigned int boxes; /* these are both counted along the axes */ - double * xi; - double * xin; - double * delx; - double * weight; - double vol; - - double * x; - int * bin; - int * box; - - /* distribution */ - double * d; - - /* control variables */ - double alpha; - int mode; - int verbose; - unsigned int iterations; - int stage; - - /* scratch variables preserved between calls to vegas1/2/3 */ - double jac; - double wtd_int_sum; - double sum_wgts; - double chi_sum; - double chisq; - - double result; - double sigma; - - unsigned int it_start; - unsigned int it_num; - unsigned int samples; - unsigned int calls_per_box; - - FILE * ostream; - -} gsl_monte_vegas_state; - -int gsl_monte_vegas_integrate(gsl_monte_function * f, - double xl[], double xu[], - size_t dim, size_t calls, - gsl_rng * r, - gsl_monte_vegas_state *state, - double* result, double* abserr); - -gsl_monte_vegas_state* gsl_monte_vegas_alloc(size_t dim); - -int gsl_monte_vegas_init(gsl_monte_vegas_state* state); - -void gsl_monte_vegas_free (gsl_monte_vegas_state* state); - -double gsl_monte_vegas_chisq (const gsl_monte_vegas_state* state); -void gsl_monte_vegas_runval (const gsl_monte_vegas_state* state, double * result, double * sigma); - -typedef struct { - double alpha; - size_t iterations; - int stage; - int mode; - int verbose; - FILE * ostream; -} gsl_monte_vegas_params; - -void gsl_monte_vegas_params_get (const gsl_monte_vegas_state * state, - gsl_monte_vegas_params * params); - -void gsl_monte_vegas_params_set (gsl_monte_vegas_state * state, - const gsl_monte_vegas_params * params); - -__END_DECLS - -#endif /* __GSL_MONTE_VEGAS_H__ */ - diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_movstat.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_movstat.h deleted file mode 100644 index 54f4fceb2..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_movstat.h +++ /dev/null @@ -1,138 +0,0 @@ -/* movstat/gsl_movstat.h - * - * Copyright (C) 2018 Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MOVSTAT_H__ -#define __GSL_MOVSTAT_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef enum -{ - GSL_MOVSTAT_END_PADZERO, - GSL_MOVSTAT_END_PADVALUE, - GSL_MOVSTAT_END_TRUNCATE -} gsl_movstat_end_t; - -/* accumulator struct - * size - return number of bytes needed for accumulator with maximum of n elements - * init - initialize accumulator state - * insert - insert a single sample into accumulator; if there are already n - * samples in accumulator, oldest sample is overwritten - * delete_oldest - delete oldest sample from accumulator - * get - return accumulated value - */ -typedef struct -{ - size_t (*size) (const size_t n); - int (*init) (const size_t n, void * vstate); - int (*insert) (const double x, void * vstate); - int (*delete_oldest) (void * vstate); - int (*get) (void * params, double * result, const void * vstate); -} gsl_movstat_accum; - -typedef struct -{ - double (* function) (const size_t n, double x[], void * params); - void * params; -} gsl_movstat_function; - -#define GSL_MOVSTAT_FN_EVAL(F,n,x) (*((F)->function))((n),(x),(F)->params) - -/* workspace for moving window statistics */ - -typedef struct -{ - size_t H; /* number of previous samples in window */ - size_t J; /* number of after samples in window */ - size_t K; /* window size K = H + J + 1 */ - double *work; /* workspace, size K */ - void *state; /* state workspace for various accumulators */ - size_t state_size; /* bytes allocated for 'state' */ -} gsl_movstat_workspace; - -/* alloc.c */ - -gsl_movstat_workspace *gsl_movstat_alloc(const size_t K); -gsl_movstat_workspace *gsl_movstat_alloc2(const size_t H, const size_t J); -gsl_movstat_workspace *gsl_movstat_alloc_with_size(const size_t accum_state_size, const size_t H, const size_t J); -void gsl_movstat_free(gsl_movstat_workspace * w); - -/* apply.c */ -int gsl_movstat_apply_accum(const gsl_movstat_end_t endtype, const gsl_vector * x, - const gsl_movstat_accum * accum, void * accum_params, - gsl_vector * y, gsl_vector * z, - gsl_movstat_workspace * w); -int gsl_movstat_apply(const gsl_movstat_end_t endtype, const gsl_movstat_function * F, - const gsl_vector * x, gsl_vector * y, gsl_movstat_workspace * w); - -/* fill.c */ -size_t gsl_movstat_fill(const gsl_movstat_end_t endtype, const gsl_vector * x, const size_t idx, - const size_t H, const size_t J, double * window); - -int gsl_movstat_mean(const gsl_movstat_end_t endtype, const gsl_vector * x, gsl_vector * y, gsl_movstat_workspace * w); -int gsl_movstat_variance(const gsl_movstat_end_t endtype, const gsl_vector * x, gsl_vector * y, gsl_movstat_workspace * w); -int gsl_movstat_sd(const gsl_movstat_end_t endtype, const gsl_vector * x, gsl_vector * y, gsl_movstat_workspace * w); -int gsl_movstat_median(const gsl_movstat_end_t endtype, const gsl_vector * x, gsl_vector * y, gsl_movstat_workspace * w); -int gsl_movstat_min(const gsl_movstat_end_t endtype, const gsl_vector * x, gsl_vector * y, gsl_movstat_workspace * w); -int gsl_movstat_max(const gsl_movstat_end_t endtype, const gsl_vector * x, gsl_vector * y, gsl_movstat_workspace * w); -int gsl_movstat_minmax(const gsl_movstat_end_t endtype, const gsl_vector * x, gsl_vector * y_min, gsl_vector * y_max, gsl_movstat_workspace * w); -int gsl_movstat_mad0(const gsl_movstat_end_t endtype, const gsl_vector * x, gsl_vector * xmedian, - gsl_vector * xmad, gsl_movstat_workspace * w); -int gsl_movstat_mad(const gsl_movstat_end_t endtype, const gsl_vector * x, gsl_vector * xmedian, - gsl_vector * xmad, gsl_movstat_workspace * w); -int gsl_movstat_qqr(const gsl_movstat_end_t endtype, const gsl_vector * x, const double q, - gsl_vector * xqqr, gsl_movstat_workspace * w); -int gsl_movstat_Sn(const gsl_movstat_end_t endtype, const gsl_vector * x, - gsl_vector * xscale, gsl_movstat_workspace * w); -int gsl_movstat_Qn(const gsl_movstat_end_t endtype, const gsl_vector * x, - gsl_vector * xscale, gsl_movstat_workspace * w); -int gsl_movstat_sum(const gsl_movstat_end_t endtype, const gsl_vector * x, gsl_vector * y, gsl_movstat_workspace * w); - -/* accumulator variables */ - -GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_mad; -GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_max; -GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_mean; -GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_median; -GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_min; -GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_minmax; -GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_sd; -GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_Sn; -GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_sum; -GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_Qn; -GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_qqr; -GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_userfunc; -GSL_VAR const gsl_movstat_accum * gsl_movstat_accum_variance; - -__END_DECLS - -#endif /* __GSL_MOVSTAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_multifit.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_multifit.h deleted file mode 100644 index 42cbc54c1..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_multifit.h +++ /dev/null @@ -1,380 +0,0 @@ -/* multifit/gsl_multifit.h - * - * Copyright (C) 2000, 2007, 2010 Brian Gough - * Copyright (C) 2013, Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MULTIFIT_H__ -#define __GSL_MULTIFIT_H__ - -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t nmax; /* maximum number of observations */ - size_t pmax; /* maximum number of parameters */ - size_t n; /* number of observations in current SVD decomposition */ - size_t p; /* number of parameters in current SVD decomposition */ - gsl_matrix * A; /* least squares matrix for SVD, n-by-p */ - gsl_matrix * Q; - gsl_matrix * QSI; - gsl_vector * S; - gsl_vector * t; - gsl_vector * xt; - gsl_vector * D; - double rcond; /* reciprocal condition number */ -} -gsl_multifit_linear_workspace; - -gsl_multifit_linear_workspace * -gsl_multifit_linear_alloc (const size_t n, const size_t p); - -void -gsl_multifit_linear_free (gsl_multifit_linear_workspace * w); - -int -gsl_multifit_linear (const gsl_matrix * X, - const gsl_vector * y, - gsl_vector * c, - gsl_matrix * cov, - double * chisq, - gsl_multifit_linear_workspace * work); - -int -gsl_multifit_linear_tsvd (const gsl_matrix * X, - const gsl_vector * y, - const double tol, - gsl_vector * c, - gsl_matrix * cov, - double * chisq, - size_t * rank, - gsl_multifit_linear_workspace * work); - -int -gsl_multifit_linear_svd (const gsl_matrix * X, - gsl_multifit_linear_workspace * work); - -int -gsl_multifit_linear_bsvd (const gsl_matrix * X, - gsl_multifit_linear_workspace * work); - -size_t -gsl_multifit_linear_rank(const double tol, const gsl_multifit_linear_workspace * work); - -int -gsl_multifit_linear_solve (const double lambda, - const gsl_matrix * X, - const gsl_vector * y, - gsl_vector * c, - double *rnorm, - double *snorm, - gsl_multifit_linear_workspace * work); - -int -gsl_multifit_linear_applyW(const gsl_matrix * X, - const gsl_vector * w, - const gsl_vector * y, - gsl_matrix * WX, - gsl_vector * Wy); - -int -gsl_multifit_linear_stdform1 (const gsl_vector * L, - const gsl_matrix * X, - const gsl_vector * y, - gsl_matrix * Xs, - gsl_vector * ys, - gsl_multifit_linear_workspace * work); - -int -gsl_multifit_linear_wstdform1 (const gsl_vector * L, - const gsl_matrix * X, - const gsl_vector * w, - const gsl_vector * y, - gsl_matrix * Xs, - gsl_vector * ys, - gsl_multifit_linear_workspace * work); - -int -gsl_multifit_linear_L_decomp (gsl_matrix * L, gsl_vector * tau); - -int -gsl_multifit_linear_stdform2 (const gsl_matrix * LQR, - const gsl_vector * Ltau, - const gsl_matrix * X, - const gsl_vector * y, - gsl_matrix * Xs, - gsl_vector * ys, - gsl_matrix * M, - gsl_multifit_linear_workspace * work); - -int -gsl_multifit_linear_wstdform2 (const gsl_matrix * LQR, - const gsl_vector * Ltau, - const gsl_matrix * X, - const gsl_vector * w, - const gsl_vector * y, - gsl_matrix * Xs, - gsl_vector * ys, - gsl_matrix * M, - gsl_multifit_linear_workspace * work); - -int -gsl_multifit_linear_genform1 (const gsl_vector * L, - const gsl_vector * cs, - gsl_vector * c, - gsl_multifit_linear_workspace * work); - -int -gsl_multifit_linear_genform2 (const gsl_matrix * LQR, - const gsl_vector * Ltau, - const gsl_matrix * X, - const gsl_vector * y, - const gsl_vector * cs, - const gsl_matrix * M, - gsl_vector * c, - gsl_multifit_linear_workspace * work); - -int -gsl_multifit_linear_wgenform2 (const gsl_matrix * LQR, - const gsl_vector * Ltau, - const gsl_matrix * X, - const gsl_vector * w, - const gsl_vector * y, - const gsl_vector * cs, - const gsl_matrix * M, - gsl_vector * c, - gsl_multifit_linear_workspace * work); - -int -gsl_multifit_linear_lreg (const double smin, const double smax, - gsl_vector * reg_param); - -int -gsl_multifit_linear_lcurve (const gsl_vector * y, - gsl_vector * reg_param, - gsl_vector * rho, gsl_vector * eta, - gsl_multifit_linear_workspace * work); - -int -gsl_multifit_linear_lcorner(const gsl_vector *rho, - const gsl_vector *eta, - size_t *idx); - -int -gsl_multifit_linear_lcorner2(const gsl_vector *reg_param, - const gsl_vector *eta, - size_t *idx); - -int -gsl_multifit_linear_Lk(const size_t p, const size_t k, gsl_matrix *L); - -int -gsl_multifit_linear_Lsobolev(const size_t p, const size_t kmax, - const gsl_vector *alpha, gsl_matrix *L, - gsl_multifit_linear_workspace *work); - -int -gsl_multifit_wlinear (const gsl_matrix * X, - const gsl_vector * w, - const gsl_vector * y, - gsl_vector * c, - gsl_matrix * cov, - double * chisq, - gsl_multifit_linear_workspace * work); - -int -gsl_multifit_wlinear_tsvd (const gsl_matrix * X, - const gsl_vector * w, - const gsl_vector * y, - const double tol, - gsl_vector * c, - gsl_matrix * cov, - double * chisq, - size_t * rank, - gsl_multifit_linear_workspace * work); - -int -gsl_multifit_wlinear_svd (const gsl_matrix * X, - const gsl_vector * w, - const gsl_vector * y, - double tol, - size_t * rank, - gsl_vector * c, - gsl_matrix * cov, - double *chisq, - gsl_multifit_linear_workspace * work); - -int -gsl_multifit_wlinear_usvd (const gsl_matrix * X, - const gsl_vector * w, - const gsl_vector * y, - double tol, - size_t * rank, - gsl_vector * c, - gsl_matrix * cov, - double *chisq, - gsl_multifit_linear_workspace * work); - -int -gsl_multifit_linear_est (const gsl_vector * x, - const gsl_vector * c, - const gsl_matrix * cov, double *y, double *y_err); - -double -gsl_multifit_linear_rcond (const gsl_multifit_linear_workspace * w); - -int -gsl_multifit_linear_residuals (const gsl_matrix *X, const gsl_vector *y, - const gsl_vector *c, gsl_vector *r); - -/* gcv.c */ -int -gsl_multifit_linear_gcv_init(const gsl_vector * y, - gsl_vector * reg_param, - gsl_vector * UTy, - double * delta0, - gsl_multifit_linear_workspace * work); - -int -gsl_multifit_linear_gcv_curve(const gsl_vector * reg_param, - const gsl_vector * UTy, - const double delta0, - gsl_vector * G, - gsl_multifit_linear_workspace * work); - -int -gsl_multifit_linear_gcv_min(const gsl_vector * reg_param, - const gsl_vector * UTy, - const gsl_vector * G, - const double delta0, - double * lambda, - gsl_multifit_linear_workspace * work); - -double -gsl_multifit_linear_gcv_calc(const double lambda, - const gsl_vector * UTy, - const double delta0, - gsl_multifit_linear_workspace * work); - -int -gsl_multifit_linear_gcv(const gsl_vector * y, - gsl_vector * reg_param, - gsl_vector * G, - double * lambda, - double * G_lambda, - gsl_multifit_linear_workspace * work); - -typedef struct -{ - const char * name; /* method name */ - int (*wfun)(const gsl_vector *r, gsl_vector *w); - int (*psi_deriv)(const gsl_vector *r, gsl_vector *dpsi); - double tuning_default; /* default tuning constant */ -} gsl_multifit_robust_type; - -typedef struct -{ - double sigma_ols; /* OLS estimate of sigma */ - double sigma_mad; /* MAD estimate of sigma */ - double sigma_rob; /* robust estimate of sigma */ - double sigma; /* final estimate of sigma */ - double Rsq; /* R^2 coefficient of determination */ - double adj_Rsq; /* degree of freedom adjusted R^2 */ - double rmse; /* root mean squared error */ - double sse; /* residual sum of squares */ - size_t dof; /* degrees of freedom */ - size_t numit; /* number of iterations */ - gsl_vector *weights; /* final weights */ - gsl_vector *r; /* final residuals y - X c */ -} gsl_multifit_robust_stats; - -typedef struct -{ - size_t n; /* number of observations */ - size_t p; /* number of parameters */ - size_t numit; /* number of iterations */ - size_t maxiter; /* maximum iterations */ - const gsl_multifit_robust_type *type; - double tune; /* tuning parameter */ - - gsl_vector *r; /* residuals at current iteration */ - gsl_vector *weights; /* weights at current iteration */ - gsl_vector *c_prev; /* coefficients from previous iteration */ - gsl_vector *resfac; /* multiplicative factors for residuals */ - - gsl_vector *psi; /* psi(r) */ - gsl_vector *dpsi; /* psi'(r) */ - - gsl_matrix *QSI; /* Q S^{-1} of original matrix X */ - gsl_vector *D; /* balancing parameters of original matrix X */ - - gsl_vector *workn; /* workspace of length n */ - - gsl_multifit_robust_stats stats; /* various statistics */ - - gsl_multifit_linear_workspace *multifit_p; -} gsl_multifit_robust_workspace; - -/* available types */ -GSL_VAR const gsl_multifit_robust_type * gsl_multifit_robust_default; -GSL_VAR const gsl_multifit_robust_type * gsl_multifit_robust_bisquare; -GSL_VAR const gsl_multifit_robust_type * gsl_multifit_robust_cauchy; -GSL_VAR const gsl_multifit_robust_type * gsl_multifit_robust_fair; -GSL_VAR const gsl_multifit_robust_type * gsl_multifit_robust_huber; -GSL_VAR const gsl_multifit_robust_type * gsl_multifit_robust_ols; -GSL_VAR const gsl_multifit_robust_type * gsl_multifit_robust_welsch; - -gsl_multifit_robust_workspace *gsl_multifit_robust_alloc(const gsl_multifit_robust_type *T, - const size_t n, const size_t p); -void gsl_multifit_robust_free(gsl_multifit_robust_workspace *w); -int gsl_multifit_robust_tune(const double tune, - gsl_multifit_robust_workspace *w); -int gsl_multifit_robust_maxiter(const size_t maxiter, - gsl_multifit_robust_workspace *w); -const char *gsl_multifit_robust_name(const gsl_multifit_robust_workspace *w); -gsl_multifit_robust_stats gsl_multifit_robust_statistics(const gsl_multifit_robust_workspace *w); -int gsl_multifit_robust_weights(const gsl_vector *r, gsl_vector *wts, - gsl_multifit_robust_workspace *w); -int gsl_multifit_robust(const gsl_matrix * X, const gsl_vector * y, - gsl_vector * c, gsl_matrix *cov, - gsl_multifit_robust_workspace *w); -int gsl_multifit_robust_est(const gsl_vector * x, const gsl_vector * c, - const gsl_matrix * cov, double *y, double *y_err); -int gsl_multifit_robust_residuals(const gsl_matrix * X, - const gsl_vector * y, - const gsl_vector * c, gsl_vector * r, - gsl_multifit_robust_workspace * w); - -__END_DECLS - -#endif /* __GSL_MULTIFIT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_multifit_nlin.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_multifit_nlin.h deleted file mode 100644 index b0dd06e79..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_multifit_nlin.h +++ /dev/null @@ -1,275 +0,0 @@ -/* multifit_nlin/gsl_multifit_nlin.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MULTIFIT_NLIN_H__ -#define __GSL_MULTIFIT_NLIN_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_multifit_gradient (const gsl_matrix * J, const gsl_vector * f, - gsl_vector * g); - -int gsl_multifit_covar (const gsl_matrix * J, const double epsrel, gsl_matrix * covar); -int gsl_multifit_covar_QRPT (gsl_matrix * r, gsl_permutation * perm, - const double epsrel, gsl_matrix * covar); - - -/* Definition of vector-valued functions with parameters based on gsl_vector */ - -struct gsl_multifit_function_struct -{ - int (* f) (const gsl_vector * x, void * params, gsl_vector * f); - size_t n; /* number of functions */ - size_t p; /* number of independent variables */ - void * params; -}; - -typedef struct gsl_multifit_function_struct gsl_multifit_function ; - -#define GSL_MULTIFIT_FN_EVAL(F,x,y) (*((F)->f))(x,(F)->params,(y)) - -typedef struct - { - const char *name; - size_t size; - int (*alloc) (void *state, size_t n, size_t p); - int (*set) (void *state, gsl_multifit_function * function, gsl_vector * x, gsl_vector * f, gsl_vector * dx); - int (*iterate) (void *state, gsl_multifit_function * function, gsl_vector * x, gsl_vector * f, gsl_vector * dx); - void (*free) (void *state); - } -gsl_multifit_fsolver_type; - -typedef struct - { - const gsl_multifit_fsolver_type * type; - gsl_multifit_function * function ; - gsl_vector * x ; - gsl_vector * f ; - gsl_vector * dx ; - void *state; - } -gsl_multifit_fsolver; - -gsl_multifit_fsolver * -gsl_multifit_fsolver_alloc (const gsl_multifit_fsolver_type * T, - size_t n, size_t p); - -void gsl_multifit_fsolver_free (gsl_multifit_fsolver * s); - -int gsl_multifit_fsolver_set (gsl_multifit_fsolver * s, - gsl_multifit_function * f, - const gsl_vector * x); - -int gsl_multifit_fsolver_iterate (gsl_multifit_fsolver * s); - -int gsl_multifit_fsolver_driver (gsl_multifit_fsolver * s, - const size_t maxiter, - const double epsabs, const double epsrel); - -const char * gsl_multifit_fsolver_name (const gsl_multifit_fsolver * s); -gsl_vector * gsl_multifit_fsolver_position (const gsl_multifit_fsolver * s); - -/* Definition of vector-valued functions and gradient with parameters - based on gsl_vector */ - -struct gsl_multifit_function_fdf_struct -{ - int (* f) (const gsl_vector * x, void * params, gsl_vector * f); - int (* df) (const gsl_vector * x, void * params, gsl_matrix * df); - int (* fdf) (const gsl_vector * x, void * params, gsl_vector * f, gsl_matrix *df); - size_t n; /* number of functions */ - size_t p; /* number of independent variables */ - void * params; /* user parameters */ - size_t nevalf; /* number of function evaluations */ - size_t nevaldf; /* number of Jacobian evaluations */ -}; - -typedef struct gsl_multifit_function_fdf_struct gsl_multifit_function_fdf ; - -typedef struct - { - const char *name; - size_t size; - int (*alloc) (void *state, size_t n, size_t p); - int (*set) (void *state, const gsl_vector * wts, - gsl_multifit_function_fdf * fdf, gsl_vector * x, - gsl_vector * f, gsl_vector * dx); - int (*iterate) (void *state, const gsl_vector * wts, - gsl_multifit_function_fdf * fdf, gsl_vector * x, - gsl_vector * f, gsl_vector * dx); - int (*gradient) (void *state, gsl_vector * g); - int (*jac) (void *state, gsl_matrix * J); - void (*free) (void *state); - } -gsl_multifit_fdfsolver_type; - -typedef struct - { - const gsl_multifit_fdfsolver_type * type; - gsl_multifit_function_fdf * fdf ; - gsl_vector * x; /* parameter values x */ - gsl_vector * f; /* residual vector f(x) */ - gsl_vector * dx; /* step dx */ - gsl_vector * g; /* gradient J^T f */ - gsl_vector * sqrt_wts; /* sqrt(wts) */ - size_t niter; /* number of iterations performed */ - void *state; - } -gsl_multifit_fdfsolver; - - -gsl_multifit_fdfsolver * -gsl_multifit_fdfsolver_alloc (const gsl_multifit_fdfsolver_type * T, - size_t n, size_t p); - -int -gsl_multifit_fdfsolver_set (gsl_multifit_fdfsolver * s, - gsl_multifit_function_fdf * fdf, - const gsl_vector * x); -int gsl_multifit_fdfsolver_wset (gsl_multifit_fdfsolver * s, - gsl_multifit_function_fdf * f, - const gsl_vector * x, - const gsl_vector * wts); - -int -gsl_multifit_fdfsolver_iterate (gsl_multifit_fdfsolver * s); - -int gsl_multifit_fdfsolver_driver (gsl_multifit_fdfsolver * s, - const size_t maxiter, - const double xtol, - const double gtol, - const double ftol, - int *info); - -int gsl_multifit_fdfsolver_jac (gsl_multifit_fdfsolver * s, - gsl_matrix * J); - -void -gsl_multifit_fdfsolver_free (gsl_multifit_fdfsolver * s); - -const char * gsl_multifit_fdfsolver_name (const gsl_multifit_fdfsolver * s); -gsl_vector * gsl_multifit_fdfsolver_position (const gsl_multifit_fdfsolver * s); -gsl_vector * gsl_multifit_fdfsolver_residual (const gsl_multifit_fdfsolver * s); -size_t gsl_multifit_fdfsolver_niter (const gsl_multifit_fdfsolver * s); -int gsl_multifit_eval_wf(gsl_multifit_function_fdf *fdf, - const gsl_vector *x, const gsl_vector *wts, - gsl_vector *y); -int gsl_multifit_eval_wdf(gsl_multifit_function_fdf *fdf, - const gsl_vector *x, const gsl_vector *wts, - gsl_matrix *dy); - -int gsl_multifit_fdfsolver_test (const gsl_multifit_fdfsolver * s, - const double xtol, - const double gtol, - const double ftol, int *info); -int gsl_multifit_test_delta (const gsl_vector * dx, const gsl_vector * x, - double epsabs, double epsrel); - -int gsl_multifit_test_gradient (const gsl_vector * g, double epsabs); - -int gsl_multifit_fdfsolver_dif_df(const gsl_vector *x, - const gsl_vector *wts, - gsl_multifit_function_fdf *fdf, - const gsl_vector *f, gsl_matrix *J); -int gsl_multifit_fdfsolver_dif_fdf(const gsl_vector *x, gsl_multifit_function_fdf *fdf, - gsl_vector *f, gsl_matrix *J); - -typedef struct -{ - size_t n; /* number of (original) residuals */ - size_t p; /* number of model parameters */ - double lambda; /* damping parameter */ - const gsl_vector *L_diag; /* diagonal damping matrix or NULL */ - const gsl_matrix *L; /* general damping matrix or NULL */ - gsl_vector *f; /* function values for finite diff J */ - gsl_vector *wts; /* weight vector for augmented system */ - gsl_multifit_fdfsolver * s; - gsl_multifit_function_fdf *fdf; /* user defined fdf */ - gsl_multifit_function_fdf fdftik; /* Tikhonov modified fdf */ -} gsl_multifit_fdfridge; - -gsl_multifit_fdfridge * -gsl_multifit_fdfridge_alloc (const gsl_multifit_fdfsolver_type * T, - const size_t n, const size_t p); -void gsl_multifit_fdfridge_free(gsl_multifit_fdfridge *work); -const char *gsl_multifit_fdfridge_name(const gsl_multifit_fdfridge * w); -gsl_vector *gsl_multifit_fdfridge_position (const gsl_multifit_fdfridge * w); -gsl_vector *gsl_multifit_fdfridge_residual (const gsl_multifit_fdfridge * w); -size_t gsl_multifit_fdfridge_niter (const gsl_multifit_fdfridge * w); -int gsl_multifit_fdfridge_set (gsl_multifit_fdfridge * w, - gsl_multifit_function_fdf * f, - const gsl_vector * x, - const double lambda); -int gsl_multifit_fdfridge_wset (gsl_multifit_fdfridge * w, - gsl_multifit_function_fdf * f, - const gsl_vector * x, - const double lambda, - const gsl_vector * wts); -int gsl_multifit_fdfridge_set2 (gsl_multifit_fdfridge * w, - gsl_multifit_function_fdf * f, - const gsl_vector * x, - const gsl_vector * lambda); -int gsl_multifit_fdfridge_wset2 (gsl_multifit_fdfridge * w, - gsl_multifit_function_fdf * f, - const gsl_vector * x, - const gsl_vector * lambda, - const gsl_vector * wts); -int gsl_multifit_fdfridge_set3 (gsl_multifit_fdfridge * w, - gsl_multifit_function_fdf * f, - const gsl_vector * x, - const gsl_matrix * L); -int gsl_multifit_fdfridge_wset3 (gsl_multifit_fdfridge * w, - gsl_multifit_function_fdf * f, - const gsl_vector * x, - const gsl_matrix * L, - const gsl_vector * wts); -int gsl_multifit_fdfridge_iterate (gsl_multifit_fdfridge * w); -int gsl_multifit_fdfridge_driver (gsl_multifit_fdfridge * w, - const size_t maxiter, - const double xtol, - const double gtol, - const double ftol, - int *info); - -/* extern const gsl_multifit_fsolver_type * gsl_multifit_fsolver_gradient; */ - -GSL_VAR const gsl_multifit_fdfsolver_type * gsl_multifit_fdfsolver_lmsder; -GSL_VAR const gsl_multifit_fdfsolver_type * gsl_multifit_fdfsolver_lmder; -GSL_VAR const gsl_multifit_fdfsolver_type * gsl_multifit_fdfsolver_lmniel; - -__END_DECLS - -#endif /* __GSL_MULTIFIT_NLIN_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_multifit_nlinear.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_multifit_nlinear.h deleted file mode 100644 index 4e1828c1f..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_multifit_nlinear.h +++ /dev/null @@ -1,303 +0,0 @@ -/* multifit_nlinear/gsl_multifit_nlinear.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * Copyright (C) 2015, 2016 Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MULTIFIT_NLINEAR_H__ -#define __GSL_MULTIFIT_NLINEAR_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef enum -{ - GSL_MULTIFIT_NLINEAR_FWDIFF, - GSL_MULTIFIT_NLINEAR_CTRDIFF -} gsl_multifit_nlinear_fdtype; - -/* Definition of vector-valued functions and gradient with parameters - based on gsl_vector */ - -typedef struct -{ - int (* f) (const gsl_vector * x, void * params, gsl_vector * f); - int (* df) (const gsl_vector * x, void * params, gsl_matrix * df); - int (* fvv) (const gsl_vector * x, const gsl_vector * v, void * params, - gsl_vector * fvv); - size_t n; /* number of functions */ - size_t p; /* number of independent variables */ - void * params; /* user parameters */ - size_t nevalf; /* number of function evaluations */ - size_t nevaldf; /* number of Jacobian evaluations */ - size_t nevalfvv; /* number of fvv evaluations */ -} gsl_multifit_nlinear_fdf; - -/* trust region subproblem method */ -typedef struct -{ - const char *name; - void * (*alloc) (const void * params, const size_t n, const size_t p); - int (*init) (const void * vtrust_state, void * vstate); - int (*preloop) (const void * vtrust_state, void * vstate); - int (*step) (const void * vtrust_state, const double delta, - gsl_vector * dx, void * vstate); - int (*preduction) (const void * vtrust_state, const gsl_vector * dx, - double * pred, void * vstate); - void (*free) (void * vstate); -} gsl_multifit_nlinear_trs; - -/* scaling matrix specification */ -typedef struct -{ - const char *name; - int (*init) (const gsl_matrix * J, gsl_vector * diag); - int (*update) (const gsl_matrix * J, gsl_vector * diag); -} gsl_multifit_nlinear_scale; - -/* - * linear least squares solvers - there are three steps to - * solving a least squares problem using a trust region - * method: - * - * 1. init: called once per iteration when a new Jacobian matrix - * is computed; perform factorization of Jacobian (qr,svd) - * or form normal equations matrix (cholesky) - * 2. presolve: called each time a new LM parameter value mu is available; - * used for cholesky method in order to factor - * the (J^T J + mu D^T D) matrix - * 3. solve: solve the least square system for a given rhs - */ -typedef struct -{ - const char *name; - void * (*alloc) (const size_t n, const size_t p); - int (*init) (const void * vtrust_state, void * vstate); - int (*presolve) (const double mu, const void * vtrust_state, void * vstate); - int (*solve) (const gsl_vector * f, gsl_vector * x, - const void * vtrust_state, void * vstate); - int (*rcond) (double * rcond, void * vstate); - void (*free) (void * vstate); -} gsl_multifit_nlinear_solver; - -/* tunable parameters */ -typedef struct -{ - const gsl_multifit_nlinear_trs *trs; /* trust region subproblem method */ - const gsl_multifit_nlinear_scale *scale; /* scaling method */ - const gsl_multifit_nlinear_solver *solver; /* solver method */ - gsl_multifit_nlinear_fdtype fdtype; /* finite difference method */ - double factor_up; /* factor for increasing trust radius */ - double factor_down; /* factor for decreasing trust radius */ - double avmax; /* max allowed |a|/|v| */ - double h_df; /* step size for finite difference Jacobian */ - double h_fvv; /* step size for finite difference fvv */ -} gsl_multifit_nlinear_parameters; - -typedef struct -{ - const char *name; - void * (*alloc) (const gsl_multifit_nlinear_parameters * params, - const size_t n, const size_t p); - int (*init) (void * state, const gsl_vector * wts, - gsl_multifit_nlinear_fdf * fdf, const gsl_vector * x, - gsl_vector * f, gsl_matrix * J, gsl_vector * g); - int (*iterate) (void * state, const gsl_vector * wts, - gsl_multifit_nlinear_fdf * fdf, gsl_vector * x, - gsl_vector * f, gsl_matrix * J, gsl_vector * g, - gsl_vector * dx); - int (*rcond) (double * rcond, void * state); - double (*avratio) (void * state); - void (*free) (void * state); -} gsl_multifit_nlinear_type; - -/* current state passed to low-level trust region algorithms */ -typedef struct -{ - const gsl_vector * x; /* parameter values x */ - const gsl_vector * f; /* residual vector f(x) */ - const gsl_vector * g; /* gradient J^T f */ - const gsl_matrix * J; /* Jacobian J(x) */ - const gsl_vector * diag; /* scaling matrix D */ - const gsl_vector * sqrt_wts; /* sqrt(diag(W)) or NULL for unweighted */ - const double *mu; /* LM parameter */ - const gsl_multifit_nlinear_parameters * params; - void *solver_state; /* workspace for linear least squares solver */ - gsl_multifit_nlinear_fdf * fdf; - double *avratio; /* |a| / |v| */ -} gsl_multifit_nlinear_trust_state; - -typedef struct -{ - const gsl_multifit_nlinear_type * type; - gsl_multifit_nlinear_fdf * fdf ; - gsl_vector * x; /* parameter values x */ - gsl_vector * f; /* residual vector f(x) */ - gsl_vector * dx; /* step dx */ - gsl_vector * g; /* gradient J^T f */ - gsl_matrix * J; /* Jacobian J(x) */ - gsl_vector * sqrt_wts_work; /* sqrt(W) */ - gsl_vector * sqrt_wts; /* ptr to sqrt_wts_work, or NULL if not using weights */ - size_t niter; /* number of iterations performed */ - gsl_multifit_nlinear_parameters params; - void *state; -} gsl_multifit_nlinear_workspace; - -gsl_multifit_nlinear_workspace * -gsl_multifit_nlinear_alloc (const gsl_multifit_nlinear_type * T, - const gsl_multifit_nlinear_parameters * params, - size_t n, size_t p); - -void gsl_multifit_nlinear_free (gsl_multifit_nlinear_workspace * w); - -gsl_multifit_nlinear_parameters gsl_multifit_nlinear_default_parameters(void); - -int -gsl_multifit_nlinear_init (const gsl_vector * x, - gsl_multifit_nlinear_fdf * fdf, - gsl_multifit_nlinear_workspace * w); - -int gsl_multifit_nlinear_winit (const gsl_vector * x, - const gsl_vector * wts, - gsl_multifit_nlinear_fdf * fdf, - gsl_multifit_nlinear_workspace * w); - -int -gsl_multifit_nlinear_iterate (gsl_multifit_nlinear_workspace * w); - -double -gsl_multifit_nlinear_avratio (const gsl_multifit_nlinear_workspace * w); - -int -gsl_multifit_nlinear_driver (const size_t maxiter, - const double xtol, - const double gtol, - const double ftol, - void (*callback)(const size_t iter, void *params, - const gsl_multifit_nlinear_workspace *w), - void *callback_params, - int *info, - gsl_multifit_nlinear_workspace * w); - -gsl_matrix * -gsl_multifit_nlinear_jac (const gsl_multifit_nlinear_workspace * w); - -const char * -gsl_multifit_nlinear_name (const gsl_multifit_nlinear_workspace * w); - -gsl_vector * -gsl_multifit_nlinear_position (const gsl_multifit_nlinear_workspace * w); - -gsl_vector * -gsl_multifit_nlinear_residual (const gsl_multifit_nlinear_workspace * w); - -size_t -gsl_multifit_nlinear_niter (const gsl_multifit_nlinear_workspace * w); - -int -gsl_multifit_nlinear_rcond (double *rcond, const gsl_multifit_nlinear_workspace * w); - -const char * -gsl_multifit_nlinear_trs_name (const gsl_multifit_nlinear_workspace * w); - -int gsl_multifit_nlinear_eval_f(gsl_multifit_nlinear_fdf *fdf, - const gsl_vector *x, - const gsl_vector *swts, - gsl_vector *y); - -int gsl_multifit_nlinear_eval_df(const gsl_vector *x, - const gsl_vector *f, - const gsl_vector *swts, - const double h, - const gsl_multifit_nlinear_fdtype fdtype, - gsl_multifit_nlinear_fdf *fdf, - gsl_matrix *df, gsl_vector *work); - -int -gsl_multifit_nlinear_eval_fvv(const double h, - const gsl_vector *x, - const gsl_vector *v, - const gsl_vector *f, - const gsl_matrix *J, - const gsl_vector *swts, - gsl_multifit_nlinear_fdf *fdf, - gsl_vector *yvv, gsl_vector *work); - -/* covar.c */ -int -gsl_multifit_nlinear_covar (const gsl_matrix * J, const double epsrel, - gsl_matrix * covar); - -/* convergence.c */ -int -gsl_multifit_nlinear_test (const double xtol, const double gtol, - const double ftol, int *info, - const gsl_multifit_nlinear_workspace * w); - -/* fdjac.c */ -int -gsl_multifit_nlinear_df(const double h, const gsl_multifit_nlinear_fdtype fdtype, - const gsl_vector *x, const gsl_vector *wts, - gsl_multifit_nlinear_fdf *fdf, - const gsl_vector *f, gsl_matrix *J, gsl_vector *work); - -/* fdfvv.c */ -int -gsl_multifit_nlinear_fdfvv(const double h, const gsl_vector *x, const gsl_vector *v, - const gsl_vector *f, const gsl_matrix *J, - const gsl_vector *swts, gsl_multifit_nlinear_fdf *fdf, - gsl_vector *fvv, gsl_vector *work); - -/* top-level algorithms */ -GSL_VAR const gsl_multifit_nlinear_type * gsl_multifit_nlinear_trust; - -/* trust region subproblem methods */ -GSL_VAR const gsl_multifit_nlinear_trs * gsl_multifit_nlinear_trs_lm; -GSL_VAR const gsl_multifit_nlinear_trs * gsl_multifit_nlinear_trs_lmaccel; -GSL_VAR const gsl_multifit_nlinear_trs * gsl_multifit_nlinear_trs_dogleg; -GSL_VAR const gsl_multifit_nlinear_trs * gsl_multifit_nlinear_trs_ddogleg; -GSL_VAR const gsl_multifit_nlinear_trs * gsl_multifit_nlinear_trs_subspace2D; - -/* scaling matrix strategies */ -GSL_VAR const gsl_multifit_nlinear_scale * gsl_multifit_nlinear_scale_levenberg; -GSL_VAR const gsl_multifit_nlinear_scale * gsl_multifit_nlinear_scale_marquardt; -GSL_VAR const gsl_multifit_nlinear_scale * gsl_multifit_nlinear_scale_more; - -/* linear solvers */ -GSL_VAR const gsl_multifit_nlinear_solver * gsl_multifit_nlinear_solver_cholesky; -GSL_VAR const gsl_multifit_nlinear_solver * gsl_multifit_nlinear_solver_qr; -GSL_VAR const gsl_multifit_nlinear_solver * gsl_multifit_nlinear_solver_svd; - -__END_DECLS - -#endif /* __GSL_MULTIFIT_NLINEAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_multilarge.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_multilarge.h deleted file mode 100644 index e99c1e1c0..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_multilarge.h +++ /dev/null @@ -1,141 +0,0 @@ -/* gsl_multilarge.h - * - * Copyright (C) 2015 Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MULTILARGE_H__ -#define __GSL_MULTILARGE_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -/* iteration solver type */ -typedef struct -{ - const char *name; - void * (*alloc) (const size_t p); - int (*reset) (void *); - int (*accumulate) (gsl_matrix * X, gsl_vector * y, - void *); - int (*solve) (const double lambda, gsl_vector * c, - double * rnorm, double * snorm, void *); - int (*rcond) (double * rcond, void *); - int (*lcurve) (gsl_vector * reg_param, gsl_vector * rho, - gsl_vector * eta, void *); - void (*free) (void *); -} gsl_multilarge_linear_type; - -typedef struct -{ - const gsl_multilarge_linear_type * type; - void * state; - size_t p; -} gsl_multilarge_linear_workspace; - -/* available types */ -GSL_VAR const gsl_multilarge_linear_type * gsl_multilarge_linear_normal; -GSL_VAR const gsl_multilarge_linear_type * gsl_multilarge_linear_tsqr; - -/* - * Prototypes - */ -gsl_multilarge_linear_workspace * -gsl_multilarge_linear_alloc(const gsl_multilarge_linear_type * T, - const size_t p); - -void gsl_multilarge_linear_free(gsl_multilarge_linear_workspace * w); - -const char *gsl_multilarge_linear_name(const gsl_multilarge_linear_workspace * w); - -int gsl_multilarge_linear_reset(gsl_multilarge_linear_workspace * w); - -int gsl_multilarge_linear_accumulate(gsl_matrix * X, - gsl_vector * y, - gsl_multilarge_linear_workspace * w); - -int gsl_multilarge_linear_solve(const double lambda, gsl_vector * c, - double * rnorm, double * snorm, - gsl_multilarge_linear_workspace * w); - -int gsl_multilarge_linear_rcond(double *rcond, gsl_multilarge_linear_workspace * w); - -int gsl_multilarge_linear_lcurve(gsl_vector * reg_param, gsl_vector * rho, - gsl_vector * eta, - gsl_multilarge_linear_workspace * w); - -int gsl_multilarge_linear_wstdform1 (const gsl_vector * L, - const gsl_matrix * X, - const gsl_vector * w, - const gsl_vector * y, - gsl_matrix * Xs, - gsl_vector * ys, - gsl_multilarge_linear_workspace * work); - -int gsl_multilarge_linear_stdform1 (const gsl_vector * L, - const gsl_matrix * X, - const gsl_vector * y, - gsl_matrix * Xs, - gsl_vector * ys, - gsl_multilarge_linear_workspace * work); - -int gsl_multilarge_linear_L_decomp (gsl_matrix * L, gsl_vector * tau); - -int gsl_multilarge_linear_wstdform2 (const gsl_matrix * LQR, - const gsl_vector * Ltau, - const gsl_matrix * X, - const gsl_vector * w, - const gsl_vector * y, - gsl_matrix * Xs, - gsl_vector * ys, - gsl_multilarge_linear_workspace * work); - -int gsl_multilarge_linear_stdform2 (const gsl_matrix * LQR, - const gsl_vector * Ltau, - const gsl_matrix * X, - const gsl_vector * y, - gsl_matrix * Xs, - gsl_vector * ys, - gsl_multilarge_linear_workspace * work); - -int gsl_multilarge_linear_genform1 (const gsl_vector * L, - const gsl_vector * cs, - gsl_vector * c, - gsl_multilarge_linear_workspace * work); - -int gsl_multilarge_linear_genform2 (const gsl_matrix * LQR, - const gsl_vector * Ltau, - const gsl_vector * cs, - gsl_vector * c, - gsl_multilarge_linear_workspace * work); - -__END_DECLS - -#endif /* __GSL_MULTILARGE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_multilarge_nlinear.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_multilarge_nlinear.h deleted file mode 100644 index 51e131b30..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_multilarge_nlinear.h +++ /dev/null @@ -1,313 +0,0 @@ -/* multilarge_nlinear/gsl_multilarge_nlinear.h - * - * Copyright (C) 2015, 2016 Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MULTILARGE_NLINEAR_H__ -#define __GSL_MULTILARGE_NLINEAR_H__ - -#include -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef enum -{ - GSL_MULTILARGE_NLINEAR_FWDIFF, - GSL_MULTILARGE_NLINEAR_CTRDIFF -} gsl_multilarge_nlinear_fdtype; - -/* Definition of vector-valued functions and gradient with parameters - based on gsl_vector */ - -typedef struct -{ - int (* f) (const gsl_vector * x, void * params, gsl_vector * f); - int (* df) (CBLAS_TRANSPOSE_t TransJ, const gsl_vector * x, - const gsl_vector * u, void * params, gsl_vector * v, - gsl_matrix * JTJ); - int (* fvv) (const gsl_vector * x, const gsl_vector * v, void * params, - gsl_vector * fvv); - size_t n; /* number of functions */ - size_t p; /* number of independent variables */ - void * params; /* user parameters */ - size_t nevalf; /* number of function evaluations */ - size_t nevaldfu; /* number of Jacobian matrix-vector evaluations */ - size_t nevaldf2; /* number of Jacobian J^T J evaluations */ - size_t nevalfvv; /* number of fvv evaluations */ -} gsl_multilarge_nlinear_fdf; - -/* trust region subproblem method */ -typedef struct -{ - const char *name; - void * (*alloc) (const void * params, const size_t n, const size_t p); - int (*init) (const void * vtrust_state, void * vstate); - int (*preloop) (const void * vtrust_state, void * vstate); - int (*step) (const void * vtrust_state, const double delta, - gsl_vector * dx, void * vstate); - int (*preduction) (const void * vtrust_state, const gsl_vector * dx, - double * pred, void * vstate); - void (*free) (void * vstate); -} gsl_multilarge_nlinear_trs; - -/* scaling matrix specification */ -typedef struct -{ - const char *name; - int (*init) (const gsl_matrix * JTJ, gsl_vector * diag); - int (*update) (const gsl_matrix * JTJ, gsl_vector * diag); -} gsl_multilarge_nlinear_scale; - -/* - * linear least squares solvers - there are three steps to - * solving a least squares problem using a direct method: - * - * 1. init: called once per iteration when a new Jacobian matrix - * is required; form normal equations matrix J^T J - * 2. presolve: called each time a new LM parameter value mu is available; - * used for cholesky method in order to factor - * the (J^T J + mu D^T D) matrix - * 3. solve: solve the least square system for a given rhs - */ -typedef struct -{ - const char *name; - void * (*alloc) (const size_t n, const size_t p); - int (*init) (const void * vtrust_state, void * vstate); - int (*presolve) (const double mu, const void * vtrust_state, void * vstate); - int (*solve) (const gsl_vector * g, gsl_vector * x, - const void * vtrust_state, void * vstate); - int (*rcond) (double * rcond, const gsl_matrix * JTJ, void * vstate); - int (*covar) (const gsl_matrix * JTJ, gsl_matrix * covar, void * vstate); - void (*free) (void * vstate); -} gsl_multilarge_nlinear_solver; - -/* tunable parameters */ -typedef struct -{ - const gsl_multilarge_nlinear_trs *trs; /* trust region subproblem method */ - const gsl_multilarge_nlinear_scale *scale; /* scaling method */ - const gsl_multilarge_nlinear_solver *solver; /* solver method */ - gsl_multilarge_nlinear_fdtype fdtype; /* finite difference method */ - double factor_up; /* factor for increasing trust radius */ - double factor_down; /* factor for decreasing trust radius */ - double avmax; /* max allowed |a|/|v| */ - double h_df; /* step size for finite difference Jacobian */ - double h_fvv; /* step size for finite difference fvv */ - size_t max_iter; /* maximum iterations for trs method */ - double tol; /* tolerance for solving trs */ -} gsl_multilarge_nlinear_parameters; - -typedef struct -{ - const char *name; - void * (*alloc) (const gsl_multilarge_nlinear_parameters * params, - const size_t n, const size_t p); - int (*init) (void * state, const gsl_vector * wts, - gsl_multilarge_nlinear_fdf * fdf, const gsl_vector * x, - gsl_vector * f, gsl_vector * g, gsl_matrix * JTJ); - int (*iterate) (void * state, const gsl_vector * wts, - gsl_multilarge_nlinear_fdf * fdf, gsl_vector * x, - gsl_vector * f, gsl_vector * g, gsl_matrix * JTJ, - gsl_vector * dx); - int (*rcond) (double * rcond, const gsl_matrix * JTJ, void * state); - int (*covar) (const gsl_matrix * JTJ, gsl_matrix * covar, void * state); - double (*avratio) (void * state); - void (*free) (void * state); -} gsl_multilarge_nlinear_type; - -/* current state passed to low-level trust region algorithms */ -typedef struct -{ - const gsl_vector * x; /* parameter values x */ - const gsl_vector * f; /* residual vector f(x) */ - const gsl_vector * g; /* gradient J^T f */ - const gsl_matrix * JTJ; /* matrix J^T J */ - const gsl_vector * diag; /* scaling matrix D */ - const gsl_vector * sqrt_wts; /* sqrt(diag(W)) or NULL for unweighted */ - const double *mu; /* LM parameter */ - const gsl_multilarge_nlinear_parameters * params; - void *solver_state; /* workspace for direct least squares solver */ - gsl_multilarge_nlinear_fdf * fdf; - double *avratio; /* |a| / |v| */ -} gsl_multilarge_nlinear_trust_state; - -typedef struct -{ - const gsl_multilarge_nlinear_type * type; - gsl_multilarge_nlinear_fdf * fdf ; - gsl_vector * x; /* parameter values x */ - gsl_vector * f; /* residual vector f(x) */ - gsl_vector * dx; /* step dx */ - gsl_vector * g; /* gradient J^T f */ - gsl_matrix * JTJ; /* matrix J^T J */ - gsl_vector * sqrt_wts_work; /* sqrt(W) */ - gsl_vector * sqrt_wts; /* ptr to sqrt_wts_work, or NULL if not using weights */ - size_t n; /* number of residuals */ - size_t p; /* number of parameters */ - size_t niter; /* number of iterations performed */ - gsl_multilarge_nlinear_parameters params; - void *state; -} gsl_multilarge_nlinear_workspace; - -gsl_multilarge_nlinear_workspace * -gsl_multilarge_nlinear_alloc (const gsl_multilarge_nlinear_type * T, - const gsl_multilarge_nlinear_parameters * params, - size_t n, size_t p); - -void gsl_multilarge_nlinear_free (gsl_multilarge_nlinear_workspace * w); - -gsl_multilarge_nlinear_parameters gsl_multilarge_nlinear_default_parameters(void); - -int -gsl_multilarge_nlinear_init (const gsl_vector * x, - gsl_multilarge_nlinear_fdf * fdf, - gsl_multilarge_nlinear_workspace * w); - -int gsl_multilarge_nlinear_winit (const gsl_vector * x, - const gsl_vector * wts, - gsl_multilarge_nlinear_fdf * fdf, - gsl_multilarge_nlinear_workspace * w); - -int -gsl_multilarge_nlinear_iterate (gsl_multilarge_nlinear_workspace * w); - -double -gsl_multilarge_nlinear_avratio (const gsl_multilarge_nlinear_workspace * w); - -int -gsl_multilarge_nlinear_rcond (double * rcond, const gsl_multilarge_nlinear_workspace * w); - -int -gsl_multilarge_nlinear_covar (gsl_matrix * covar, gsl_multilarge_nlinear_workspace * w); - -int -gsl_multilarge_nlinear_driver (const size_t maxiter, - const double xtol, - const double gtol, - const double ftol, - void (*callback)(const size_t iter, void *params, - const gsl_multilarge_nlinear_workspace *w), - void *callback_params, - int *info, - gsl_multilarge_nlinear_workspace * w); - -const char * -gsl_multilarge_nlinear_name (const gsl_multilarge_nlinear_workspace * w); - -gsl_vector * -gsl_multilarge_nlinear_position (const gsl_multilarge_nlinear_workspace * w); - -gsl_vector * -gsl_multilarge_nlinear_residual (const gsl_multilarge_nlinear_workspace * w); - -gsl_vector * -gsl_multilarge_nlinear_step (const gsl_multilarge_nlinear_workspace * w); - -size_t -gsl_multilarge_nlinear_niter (const gsl_multilarge_nlinear_workspace * w); - -const char * -gsl_multilarge_nlinear_trs_name (const gsl_multilarge_nlinear_workspace * w); - -int gsl_multilarge_nlinear_eval_f(gsl_multilarge_nlinear_fdf *fdf, - const gsl_vector *x, - const gsl_vector *swts, - gsl_vector *y); - -int -gsl_multilarge_nlinear_eval_df(const CBLAS_TRANSPOSE_t TransJ, - const gsl_vector *x, - const gsl_vector *f, - const gsl_vector *u, - const gsl_vector *swts, - const double h, - const gsl_multilarge_nlinear_fdtype fdtype, - gsl_multilarge_nlinear_fdf *fdf, - gsl_vector *v, - gsl_matrix *JTJ, - gsl_vector *work); - -int -gsl_multilarge_nlinear_eval_fvv(const double h, - const gsl_vector *x, - const gsl_vector *v, - const gsl_vector *f, - const gsl_vector *swts, - gsl_multilarge_nlinear_fdf *fdf, - gsl_vector *yvv, - gsl_vector *work); - -/* convergence.c */ -int -gsl_multilarge_nlinear_test (const double xtol, const double gtol, - const double ftol, int *info, - const gsl_multilarge_nlinear_workspace * w); - -/* fdjac.c */ -int -gsl_multilarge_nlinear_df(const double h, const gsl_multilarge_nlinear_fdtype fdtype, - const gsl_vector *x, const gsl_vector *wts, - gsl_multilarge_nlinear_fdf *fdf, - const gsl_vector *f, gsl_matrix *J, gsl_vector *work); - -/* fdfvv.c */ -int -gsl_multilarge_nlinear_fdfvv(const double h, const gsl_vector *x, const gsl_vector *v, - const gsl_vector *f, const gsl_matrix *J, - const gsl_vector *swts, gsl_multilarge_nlinear_fdf *fdf, - gsl_vector *fvv, gsl_vector *work); - -/* top-level algorithms */ -GSL_VAR const gsl_multilarge_nlinear_type * gsl_multilarge_nlinear_trust; - -/* trust region subproblem methods */ -GSL_VAR const gsl_multilarge_nlinear_trs * gsl_multilarge_nlinear_trs_lm; -GSL_VAR const gsl_multilarge_nlinear_trs * gsl_multilarge_nlinear_trs_lmaccel; -GSL_VAR const gsl_multilarge_nlinear_trs * gsl_multilarge_nlinear_trs_dogleg; -GSL_VAR const gsl_multilarge_nlinear_trs * gsl_multilarge_nlinear_trs_ddogleg; -GSL_VAR const gsl_multilarge_nlinear_trs * gsl_multilarge_nlinear_trs_subspace2D; -GSL_VAR const gsl_multilarge_nlinear_trs * gsl_multilarge_nlinear_trs_cgst; - -/* scaling matrix strategies */ -GSL_VAR const gsl_multilarge_nlinear_scale * gsl_multilarge_nlinear_scale_levenberg; -GSL_VAR const gsl_multilarge_nlinear_scale * gsl_multilarge_nlinear_scale_marquardt; -GSL_VAR const gsl_multilarge_nlinear_scale * gsl_multilarge_nlinear_scale_more; - -/* linear solvers */ -GSL_VAR const gsl_multilarge_nlinear_solver * gsl_multilarge_nlinear_solver_cholesky; -GSL_VAR const gsl_multilarge_nlinear_solver * gsl_multilarge_nlinear_solver_none; - -__END_DECLS - -#endif /* __GSL_MULTILARGE_NLINEAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_multimin.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_multimin.h deleted file mode 100644 index 287022727..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_multimin.h +++ /dev/null @@ -1,226 +0,0 @@ -/* multimin/gsl_multimin.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Fabrice Rossi - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Modified by Tuomo Keskitalo to include fminimizer and - Nelder Mead related lines */ - -#ifndef __GSL_MULTIMIN_H__ -#define __GSL_MULTIMIN_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -/* Definition of an arbitrary real-valued function with gsl_vector input and */ -/* parameters */ -struct gsl_multimin_function_struct -{ - double (* f) (const gsl_vector * x, void * params); - size_t n; - void * params; -}; - -typedef struct gsl_multimin_function_struct gsl_multimin_function; - -#define GSL_MULTIMIN_FN_EVAL(F,x) (*((F)->f))(x,(F)->params) - -/* Definition of an arbitrary differentiable real-valued function */ -/* with gsl_vector input and parameters */ -struct gsl_multimin_function_fdf_struct -{ - double (* f) (const gsl_vector * x, void * params); - void (* df) (const gsl_vector * x, void * params,gsl_vector * df); - void (* fdf) (const gsl_vector * x, void * params,double *f,gsl_vector * df); - size_t n; - void * params; -}; - -typedef struct gsl_multimin_function_fdf_struct gsl_multimin_function_fdf; - -#define GSL_MULTIMIN_FN_EVAL_F(F,x) (*((F)->f))(x,(F)->params) -#define GSL_MULTIMIN_FN_EVAL_DF(F,x,g) (*((F)->df))(x,(F)->params,(g)) -#define GSL_MULTIMIN_FN_EVAL_F_DF(F,x,y,g) (*((F)->fdf))(x,(F)->params,(y),(g)) - -int gsl_multimin_diff (const gsl_multimin_function * f, - const gsl_vector * x, gsl_vector * g); - -/* minimization of non-differentiable functions */ - -typedef struct -{ - const char *name; - size_t size; - int (*alloc) (void *state, size_t n); - int (*set) (void *state, gsl_multimin_function * f, - const gsl_vector * x, - double * size, - const gsl_vector * step_size); - int (*iterate) (void *state, gsl_multimin_function * f, - gsl_vector * x, - double * size, - double * fval); - void (*free) (void *state); -} -gsl_multimin_fminimizer_type; - -typedef struct -{ - /* multi dimensional part */ - const gsl_multimin_fminimizer_type *type; - gsl_multimin_function *f; - - double fval; - gsl_vector * x; - - double size; - - void *state; -} -gsl_multimin_fminimizer; - -gsl_multimin_fminimizer * -gsl_multimin_fminimizer_alloc(const gsl_multimin_fminimizer_type *T, - size_t n); - -int -gsl_multimin_fminimizer_set (gsl_multimin_fminimizer * s, - gsl_multimin_function * f, - const gsl_vector * x, - const gsl_vector * step_size); - -void -gsl_multimin_fminimizer_free(gsl_multimin_fminimizer *s); - -const char * -gsl_multimin_fminimizer_name (const gsl_multimin_fminimizer * s); - -int -gsl_multimin_fminimizer_iterate(gsl_multimin_fminimizer *s); - -gsl_vector * -gsl_multimin_fminimizer_x (const gsl_multimin_fminimizer * s); - -double -gsl_multimin_fminimizer_minimum (const gsl_multimin_fminimizer * s); - -double -gsl_multimin_fminimizer_size (const gsl_multimin_fminimizer * s); - -/* Convergence test functions */ - -int -gsl_multimin_test_gradient(const gsl_vector * g, double epsabs); - -int -gsl_multimin_test_size(const double size, double epsabs); - -/* minimisation of differentiable functions */ - -typedef struct -{ - const char *name; - size_t size; - int (*alloc) (void *state, size_t n); - int (*set) (void *state, gsl_multimin_function_fdf * fdf, - const gsl_vector * x, double * f, - gsl_vector * gradient, double step_size, double tol); - int (*iterate) (void *state,gsl_multimin_function_fdf * fdf, - gsl_vector * x, double * f, - gsl_vector * gradient, gsl_vector * dx); - int (*restart) (void *state); - void (*free) (void *state); -} -gsl_multimin_fdfminimizer_type; - -typedef struct -{ - /* multi dimensional part */ - const gsl_multimin_fdfminimizer_type *type; - gsl_multimin_function_fdf *fdf; - - double f; - gsl_vector * x; - gsl_vector * gradient; - gsl_vector * dx; - - void *state; -} -gsl_multimin_fdfminimizer; - -gsl_multimin_fdfminimizer * -gsl_multimin_fdfminimizer_alloc(const gsl_multimin_fdfminimizer_type *T, - size_t n); - -int -gsl_multimin_fdfminimizer_set (gsl_multimin_fdfminimizer * s, - gsl_multimin_function_fdf *fdf, - const gsl_vector * x, - double step_size, double tol); - -void -gsl_multimin_fdfminimizer_free(gsl_multimin_fdfminimizer *s); - -const char * -gsl_multimin_fdfminimizer_name (const gsl_multimin_fdfminimizer * s); - -int -gsl_multimin_fdfminimizer_iterate(gsl_multimin_fdfminimizer *s); - -int -gsl_multimin_fdfminimizer_restart(gsl_multimin_fdfminimizer *s); - -gsl_vector * -gsl_multimin_fdfminimizer_x (const gsl_multimin_fdfminimizer * s); - -gsl_vector * -gsl_multimin_fdfminimizer_dx (const gsl_multimin_fdfminimizer * s); - -gsl_vector * -gsl_multimin_fdfminimizer_gradient (const gsl_multimin_fdfminimizer * s); - -double -gsl_multimin_fdfminimizer_minimum (const gsl_multimin_fdfminimizer * s); - -GSL_VAR const gsl_multimin_fdfminimizer_type *gsl_multimin_fdfminimizer_steepest_descent; -GSL_VAR const gsl_multimin_fdfminimizer_type *gsl_multimin_fdfminimizer_conjugate_pr; -GSL_VAR const gsl_multimin_fdfminimizer_type *gsl_multimin_fdfminimizer_conjugate_fr; -GSL_VAR const gsl_multimin_fdfminimizer_type *gsl_multimin_fdfminimizer_vector_bfgs; -GSL_VAR const gsl_multimin_fdfminimizer_type *gsl_multimin_fdfminimizer_vector_bfgs2; -GSL_VAR const gsl_multimin_fminimizer_type *gsl_multimin_fminimizer_nmsimplex; -GSL_VAR const gsl_multimin_fminimizer_type *gsl_multimin_fminimizer_nmsimplex2; -GSL_VAR const gsl_multimin_fminimizer_type *gsl_multimin_fminimizer_nmsimplex2rand; - -__END_DECLS - -#endif /* __GSL_MULTIMIN_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_multiroots.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_multiroots.h deleted file mode 100644 index 7f661547f..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_multiroots.h +++ /dev/null @@ -1,177 +0,0 @@ -/* multiroots/gsl_multiroots.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MULTIROOTS_H__ -#define __GSL_MULTIROOTS_H__ - -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -/* Definition of vector-valued functions with parameters based on gsl_vector */ - -struct gsl_multiroot_function_struct -{ - int (* f) (const gsl_vector * x, void * params, gsl_vector * f); - size_t n; - void * params; -}; - -typedef struct gsl_multiroot_function_struct gsl_multiroot_function ; - -#define GSL_MULTIROOT_FN_EVAL(F,x,y) (*((F)->f))(x,(F)->params,(y)) - -int gsl_multiroot_fdjacobian (gsl_multiroot_function * F, - const gsl_vector * x, const gsl_vector * f, - double epsrel, gsl_matrix * jacobian); - - -typedef struct - { - const char *name; - size_t size; - int (*alloc) (void *state, size_t n); - int (*set) (void *state, gsl_multiroot_function * function, gsl_vector * x, gsl_vector * f, gsl_vector * dx); - int (*iterate) (void *state, gsl_multiroot_function * function, gsl_vector * x, gsl_vector * f, gsl_vector * dx); - void (*free) (void *state); - } -gsl_multiroot_fsolver_type; - -typedef struct - { - const gsl_multiroot_fsolver_type * type; - gsl_multiroot_function * function ; - gsl_vector * x ; - gsl_vector * f ; - gsl_vector * dx ; - void *state; - } -gsl_multiroot_fsolver; - -gsl_multiroot_fsolver * -gsl_multiroot_fsolver_alloc (const gsl_multiroot_fsolver_type * T, - size_t n); - -void gsl_multiroot_fsolver_free (gsl_multiroot_fsolver * s); - -int gsl_multiroot_fsolver_set (gsl_multiroot_fsolver * s, - gsl_multiroot_function * f, - const gsl_vector * x); - -int gsl_multiroot_fsolver_iterate (gsl_multiroot_fsolver * s); - -const char * gsl_multiroot_fsolver_name (const gsl_multiroot_fsolver * s); -gsl_vector * gsl_multiroot_fsolver_root (const gsl_multiroot_fsolver * s); -gsl_vector * gsl_multiroot_fsolver_dx (const gsl_multiroot_fsolver * s); -gsl_vector * gsl_multiroot_fsolver_f (const gsl_multiroot_fsolver * s); - -/* Definition of vector-valued functions and gradient with parameters - based on gsl_vector */ - -struct gsl_multiroot_function_fdf_struct -{ - int (* f) (const gsl_vector * x, void * params, gsl_vector * f); - int (* df) (const gsl_vector * x, void * params, gsl_matrix * df); - int (* fdf) (const gsl_vector * x, void * params, gsl_vector * f, gsl_matrix *df); - size_t n; - void * params; -}; - -typedef struct gsl_multiroot_function_fdf_struct gsl_multiroot_function_fdf ; - -#define GSL_MULTIROOT_FN_EVAL_F(F,x,y) ((*((F)->f))(x,(F)->params,(y))) -#define GSL_MULTIROOT_FN_EVAL_DF(F,x,dy) ((*((F)->df))(x,(F)->params,(dy))) -#define GSL_MULTIROOT_FN_EVAL_F_DF(F,x,y,dy) ((*((F)->fdf))(x,(F)->params,(y),(dy))) - -typedef struct - { - const char *name; - size_t size; - int (*alloc) (void *state, size_t n); - int (*set) (void *state, gsl_multiroot_function_fdf * fdf, gsl_vector * x, gsl_vector * f, gsl_matrix * J, gsl_vector * dx); - int (*iterate) (void *state, gsl_multiroot_function_fdf * fdf, gsl_vector * x, gsl_vector * f, gsl_matrix * J, gsl_vector * dx); - void (*free) (void *state); - } -gsl_multiroot_fdfsolver_type; - -typedef struct - { - const gsl_multiroot_fdfsolver_type * type; - gsl_multiroot_function_fdf * fdf ; - gsl_vector * x; - gsl_vector * f; - gsl_matrix * J; - gsl_vector * dx; - void *state; - } -gsl_multiroot_fdfsolver; - -gsl_multiroot_fdfsolver * -gsl_multiroot_fdfsolver_alloc (const gsl_multiroot_fdfsolver_type * T, - size_t n); - -int -gsl_multiroot_fdfsolver_set (gsl_multiroot_fdfsolver * s, - gsl_multiroot_function_fdf * fdf, - const gsl_vector * x); - -int -gsl_multiroot_fdfsolver_iterate (gsl_multiroot_fdfsolver * s); - -void -gsl_multiroot_fdfsolver_free (gsl_multiroot_fdfsolver * s); - -const char * gsl_multiroot_fdfsolver_name (const gsl_multiroot_fdfsolver * s); -gsl_vector * gsl_multiroot_fdfsolver_root (const gsl_multiroot_fdfsolver * s); -gsl_vector * gsl_multiroot_fdfsolver_dx (const gsl_multiroot_fdfsolver * s); -gsl_vector * gsl_multiroot_fdfsolver_f (const gsl_multiroot_fdfsolver * s); - -int gsl_multiroot_test_delta (const gsl_vector * dx, const gsl_vector * x, - double epsabs, double epsrel); - -int gsl_multiroot_test_residual (const gsl_vector * f, double epsabs); - -GSL_VAR const gsl_multiroot_fsolver_type * gsl_multiroot_fsolver_dnewton; -GSL_VAR const gsl_multiroot_fsolver_type * gsl_multiroot_fsolver_broyden; -GSL_VAR const gsl_multiroot_fsolver_type * gsl_multiroot_fsolver_hybrid; -GSL_VAR const gsl_multiroot_fsolver_type * gsl_multiroot_fsolver_hybrids; - -GSL_VAR const gsl_multiroot_fdfsolver_type * gsl_multiroot_fdfsolver_newton; -GSL_VAR const gsl_multiroot_fdfsolver_type * gsl_multiroot_fdfsolver_gnewton; -GSL_VAR const gsl_multiroot_fdfsolver_type * gsl_multiroot_fdfsolver_hybridj; -GSL_VAR const gsl_multiroot_fdfsolver_type * gsl_multiroot_fdfsolver_hybridsj; - - -__END_DECLS - -#endif /* __GSL_MULTIROOTS_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_multiset.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_multiset.h deleted file mode 100644 index 1ba5d6cc4..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_multiset.h +++ /dev/null @@ -1,93 +0,0 @@ -/* multiset/gsl_multiset.h - * based on combination/gsl_combination.h by Szymon Jaroszewicz - * based on permutation/gsl_permutation.h by Brian Gough - * - * Copyright (C) 2009 Rhys Ulerich - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_MULTISET_H__ -#define __GSL_MULTISET_H__ - -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -struct gsl_multiset_struct -{ - size_t n; - size_t k; - size_t *data; -}; - -typedef struct gsl_multiset_struct gsl_multiset; - -gsl_multiset *gsl_multiset_alloc (const size_t n, const size_t k); -gsl_multiset *gsl_multiset_calloc (const size_t n, const size_t k); -void gsl_multiset_init_first (gsl_multiset * c); -void gsl_multiset_init_last (gsl_multiset * c); -void gsl_multiset_free (gsl_multiset * c); -int gsl_multiset_memcpy (gsl_multiset * dest, const gsl_multiset * src); - -int gsl_multiset_fread (FILE * stream, gsl_multiset * c); -int gsl_multiset_fwrite (FILE * stream, const gsl_multiset * c); -int gsl_multiset_fscanf (FILE * stream, gsl_multiset * c); -int gsl_multiset_fprintf (FILE * stream, const gsl_multiset * c, const char *format); - -size_t gsl_multiset_n (const gsl_multiset * c); -size_t gsl_multiset_k (const gsl_multiset * c); -size_t * gsl_multiset_data (const gsl_multiset * c); - -int gsl_multiset_valid (gsl_multiset * c); -int gsl_multiset_next (gsl_multiset * c); -int gsl_multiset_prev (gsl_multiset * c); - -INLINE_DECL size_t gsl_multiset_get (const gsl_multiset * c, const size_t i); - -#ifdef HAVE_INLINE - -INLINE_FUN -size_t -gsl_multiset_get (const gsl_multiset * c, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= c->k)) /* size_t is unsigned, can't be negative */ - { - GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); - } -#endif - return c->data[i]; -} - -#endif /* HAVE_INLINE */ - -__END_DECLS - -#endif /* __GSL_MULTISET_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_nan.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_nan.h deleted file mode 100644 index 5cb52efc9..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_nan.h +++ /dev/null @@ -1,45 +0,0 @@ -/* gsl_nan.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_NAN_H__ -#define __GSL_NAN_H__ - -#ifdef INFINITY -# define GSL_POSINF INFINITY -# define GSL_NEGINF (-INFINITY) -#elif defined(HUGE_VAL) -# define GSL_POSINF HUGE_VAL -# define GSL_NEGINF (-HUGE_VAL) -#else -# define GSL_POSINF (gsl_posinf()) -# define GSL_NEGINF (gsl_neginf()) -#endif - -#ifdef NAN -# define GSL_NAN NAN -#elif defined(INFINITY) -# define GSL_NAN (INFINITY/INFINITY) -#else -# define GSL_NAN (gsl_nan()) -#endif - -#define GSL_POSZERO (+0.0) -#define GSL_NEGZERO (-0.0) - -#endif /* __GSL_NAN_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_ntuple.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_ntuple.h deleted file mode 100644 index 90d8a26c3..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_ntuple.h +++ /dev/null @@ -1,82 +0,0 @@ -/* histogram/ntuple.h - * - * Copyright (C) 2000 Simone Piccardi - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* Jan/2001 Modified by Brian Gough. Minor changes for GSL */ - -#ifndef __GSL_NTUPLE_H__ -#define __GSL_NTUPLE_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct { - FILE * file; - void * ntuple_data; - size_t size; -} gsl_ntuple; - -typedef struct { - int (* function) (void * ntuple_data, void * params); - void * params; -} gsl_ntuple_select_fn; - -typedef struct { - double (* function) (void * ntuple_data, void * params); - void * params; -} gsl_ntuple_value_fn; - -gsl_ntuple * -gsl_ntuple_open (char * filename, void * ntuple_data, size_t size); - -gsl_ntuple * -gsl_ntuple_create (char * filename, void * ntuple_data, size_t size); - -int gsl_ntuple_write (gsl_ntuple * ntuple); -int gsl_ntuple_read (gsl_ntuple * ntuple); - -int gsl_ntuple_bookdata (gsl_ntuple * ntuple); /* synonym for write */ - -int gsl_ntuple_project (gsl_histogram * h, gsl_ntuple * ntuple, - gsl_ntuple_value_fn *value_func, - gsl_ntuple_select_fn *select_func); - -int gsl_ntuple_close (gsl_ntuple * ntuple); - -__END_DECLS - -#endif /* __GSL_NTUPLE_H__ */ - - - - diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_odeiv.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_odeiv.h deleted file mode 100644 index d70f15015..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_odeiv.h +++ /dev/null @@ -1,230 +0,0 @@ -/* ode-initval/gsl_odeiv.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman - */ -#ifndef __GSL_ODEIV_H__ -#define __GSL_ODEIV_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Description of a system of ODEs. - * - * y' = f(t,y) = dydt(t, y) - * - * The system is specified by giving the right-hand-side - * of the equation and possibly a jacobian function. - * - * Some methods require the jacobian function, which calculates - * the matrix dfdy and the vector dfdt. The matrix dfdy conforms - * to the GSL standard, being a continuous range of floating point - * values, in row-order. - * - * As with GSL function objects, user-supplied parameter - * data is also present. - */ - -typedef struct -{ - int (* function) (double t, const double y[], double dydt[], void * params); - int (* jacobian) (double t, const double y[], double * dfdy, double dfdt[], void * params); - size_t dimension; - void * params; -} -gsl_odeiv_system; - -#define GSL_ODEIV_FN_EVAL(S,t,y,f) (*((S)->function))(t,y,f,(S)->params) -#define GSL_ODEIV_JA_EVAL(S,t,y,dfdy,dfdt) (*((S)->jacobian))(t,y,dfdy,dfdt,(S)->params) - - -/* General stepper object. - * - * Opaque object for stepping an ODE system from t to t+h. - * In general the object has some state which facilitates - * iterating the stepping operation. - */ - -typedef struct -{ - const char * name; - int can_use_dydt_in; - int gives_exact_dydt_out; - void * (*alloc) (size_t dim); - int (*apply) (void * state, size_t dim, double t, double h, double y[], double yerr[], const double dydt_in[], double dydt_out[], const gsl_odeiv_system * dydt); - int (*reset) (void * state, size_t dim); - unsigned int (*order) (void * state); - void (*free) (void * state); -} -gsl_odeiv_step_type; - -typedef struct { - const gsl_odeiv_step_type * type; - size_t dimension; - void * state; -} -gsl_odeiv_step; - - -/* Available stepper types. - * - * rk2 : embedded 2nd(3rd) Runge-Kutta - * rk4 : 4th order (classical) Runge-Kutta - * rkck : embedded 4th(5th) Runge-Kutta, Cash-Karp - * rk8pd : embedded 8th(9th) Runge-Kutta, Prince-Dormand - * rk2imp : implicit 2nd order Runge-Kutta at Gaussian points - * rk4imp : implicit 4th order Runge-Kutta at Gaussian points - * gear1 : M=1 implicit Gear method - * gear2 : M=2 implicit Gear method - */ - -GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_rk2; -GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_rk4; -GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_rkf45; -GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_rkck; -GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_rk8pd; -GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_rk2imp; -GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_rk2simp; -GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_rk4imp; -GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_bsimp; -GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_gear1; -GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_gear2; - - -/* Constructor for specialized stepper objects. - */ -gsl_odeiv_step * gsl_odeiv_step_alloc(const gsl_odeiv_step_type * T, size_t dim); -int gsl_odeiv_step_reset(gsl_odeiv_step * s); -void gsl_odeiv_step_free(gsl_odeiv_step * s); - -/* General stepper object methods. - */ -const char * gsl_odeiv_step_name(const gsl_odeiv_step * s); -unsigned int gsl_odeiv_step_order(const gsl_odeiv_step * s); - -int gsl_odeiv_step_apply(gsl_odeiv_step * s, double t, double h, double y[], double yerr[], const double dydt_in[], double dydt_out[], const gsl_odeiv_system * dydt); - -/* General step size control object. - * - * The hadjust() method controls the adjustment of - * step size given the result of a step and the error. - * Valid hadjust() methods must return one of the codes below. - * - * The general data can be used by specializations - * to store state and control their heuristics. - */ - -typedef struct -{ - const char * name; - void * (*alloc) (void); - int (*init) (void * state, double eps_abs, double eps_rel, double a_y, double a_dydt); - int (*hadjust) (void * state, size_t dim, unsigned int ord, const double y[], const double yerr[], const double yp[], double * h); - void (*free) (void * state); -} -gsl_odeiv_control_type; - -typedef struct -{ - const gsl_odeiv_control_type * type; - void * state; -} -gsl_odeiv_control; - -/* Possible return values for an hadjust() evolution method. - */ -#define GSL_ODEIV_HADJ_INC 1 /* step was increased */ -#define GSL_ODEIV_HADJ_NIL 0 /* step unchanged */ -#define GSL_ODEIV_HADJ_DEC (-1) /* step decreased */ - -gsl_odeiv_control * gsl_odeiv_control_alloc(const gsl_odeiv_control_type * T); -int gsl_odeiv_control_init(gsl_odeiv_control * c, double eps_abs, double eps_rel, double a_y, double a_dydt); -void gsl_odeiv_control_free(gsl_odeiv_control * c); -int gsl_odeiv_control_hadjust (gsl_odeiv_control * c, gsl_odeiv_step * s, const double y[], const double yerr[], const double dydt[], double * h); -const char * gsl_odeiv_control_name(const gsl_odeiv_control * c); - -/* Available control object constructors. - * - * The standard control object is a four parameter heuristic - * defined as follows: - * D0 = eps_abs + eps_rel * (a_y |y| + a_dydt h |y'|) - * D1 = |yerr| - * q = consistency order of method (q=4 for 4(5) embedded RK) - * S = safety factor (0.9 say) - * - * / (D0/D1)^(1/(q+1)) D0 >= D1 - * h_NEW = S h_OLD * | - * \ (D0/D1)^(1/q) D0 < D1 - * - * This encompasses all the standard error scaling methods. - * - * The y method is the standard method with a_y=1, a_dydt=0. - * The yp method is the standard method with a_y=0, a_dydt=1. - */ - -gsl_odeiv_control * gsl_odeiv_control_standard_new(double eps_abs, double eps_rel, double a_y, double a_dydt); -gsl_odeiv_control * gsl_odeiv_control_y_new(double eps_abs, double eps_rel); -gsl_odeiv_control * gsl_odeiv_control_yp_new(double eps_abs, double eps_rel); - -/* This controller computes errors using different absolute errors for - * each component - * - * D0 = eps_abs * scale_abs[i] + eps_rel * (a_y |y| + a_dydt h |y'|) - */ -gsl_odeiv_control * gsl_odeiv_control_scaled_new(double eps_abs, double eps_rel, double a_y, double a_dydt, const double scale_abs[], size_t dim); - -/* General evolution object. - */ -typedef struct { - size_t dimension; - double * y0; - double * yerr; - double * dydt_in; - double * dydt_out; - double last_step; - unsigned long int count; - unsigned long int failed_steps; -} -gsl_odeiv_evolve; - -/* Evolution object methods. - */ -gsl_odeiv_evolve * gsl_odeiv_evolve_alloc(size_t dim); -int gsl_odeiv_evolve_apply(gsl_odeiv_evolve * e, gsl_odeiv_control * con, gsl_odeiv_step * step, const gsl_odeiv_system * dydt, double * t, double t1, double * h, double y[]); -int gsl_odeiv_evolve_reset(gsl_odeiv_evolve * e); -void gsl_odeiv_evolve_free(gsl_odeiv_evolve * e); - - -__END_DECLS - -#endif /* __GSL_ODEIV_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_odeiv2.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_odeiv2.h deleted file mode 100644 index 9bcfbae6e..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_odeiv2.h +++ /dev/null @@ -1,333 +0,0 @@ -/* ode-initval/odeiv2.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ -/* Modified by Tuomo Keskitalo */ - -#ifndef __GSL_ODEIV2_H__ -#define __GSL_ODEIV2_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS -/* Description of a system of ODEs. - * - * y' = f(t,y) = dydt(t, y) - * - * The system is specified by giving the right-hand-side - * of the equation and possibly a jacobian function. - * - * Some methods require the jacobian function, which calculates - * the matrix dfdy and the vector dfdt. The matrix dfdy conforms - * to the GSL standard, being a continuous range of floating point - * values, in row-order. - * - * As with GSL function objects, user-supplied parameter - * data is also present. - */ - typedef struct -{ - int (*function) (double t, const double y[], double dydt[], void *params); - int (*jacobian) (double t, const double y[], double *dfdy, double dfdt[], - void *params); - size_t dimension; - void *params; -} -gsl_odeiv2_system; - -/* Function evaluation macros */ - -#define GSL_ODEIV_FN_EVAL(S,t,y,f) (*((S)->function))(t,y,f,(S)->params) -#define GSL_ODEIV_JA_EVAL(S,t,y,dfdy,dfdt) (*((S)->jacobian))(t,y,dfdy,dfdt,(S)->params) - -/* Type definitions */ - -typedef struct gsl_odeiv2_step_struct gsl_odeiv2_step; -typedef struct gsl_odeiv2_control_struct gsl_odeiv2_control; -typedef struct gsl_odeiv2_evolve_struct gsl_odeiv2_evolve; -typedef struct gsl_odeiv2_driver_struct gsl_odeiv2_driver; - -/* Stepper object - * - * Opaque object for stepping an ODE system from t to t+h. - * In general the object has some state which facilitates - * iterating the stepping operation. - */ - -typedef struct -{ - const char *name; - int can_use_dydt_in; - int gives_exact_dydt_out; - void *(*alloc) (size_t dim); - int (*apply) (void *state, size_t dim, double t, double h, double y[], - double yerr[], const double dydt_in[], double dydt_out[], - const gsl_odeiv2_system * dydt); - int (*set_driver) (void *state, const gsl_odeiv2_driver * d); - int (*reset) (void *state, size_t dim); - unsigned int (*order) (void *state); - void (*free) (void *state); -} -gsl_odeiv2_step_type; - -struct gsl_odeiv2_step_struct -{ - const gsl_odeiv2_step_type *type; - size_t dimension; - void *state; -}; - -/* Available stepper types */ - -GSL_VAR const gsl_odeiv2_step_type *gsl_odeiv2_step_rk2; -GSL_VAR const gsl_odeiv2_step_type *gsl_odeiv2_step_rk4; -GSL_VAR const gsl_odeiv2_step_type *gsl_odeiv2_step_rkf45; -GSL_VAR const gsl_odeiv2_step_type *gsl_odeiv2_step_rkck; -GSL_VAR const gsl_odeiv2_step_type *gsl_odeiv2_step_rk8pd; -GSL_VAR const gsl_odeiv2_step_type *gsl_odeiv2_step_rk2imp; -GSL_VAR const gsl_odeiv2_step_type *gsl_odeiv2_step_rk4imp; -GSL_VAR const gsl_odeiv2_step_type *gsl_odeiv2_step_bsimp; -GSL_VAR const gsl_odeiv2_step_type *gsl_odeiv2_step_rk1imp; -GSL_VAR const gsl_odeiv2_step_type *gsl_odeiv2_step_msadams; -GSL_VAR const gsl_odeiv2_step_type *gsl_odeiv2_step_msbdf; - -/* Stepper object methods */ - -gsl_odeiv2_step *gsl_odeiv2_step_alloc (const gsl_odeiv2_step_type * T, - size_t dim); -int gsl_odeiv2_step_reset (gsl_odeiv2_step * s); -void gsl_odeiv2_step_free (gsl_odeiv2_step * s); -const char *gsl_odeiv2_step_name (const gsl_odeiv2_step * s); -unsigned int gsl_odeiv2_step_order (const gsl_odeiv2_step * s); -int gsl_odeiv2_step_apply (gsl_odeiv2_step * s, double t, double h, - double y[], double yerr[], const double dydt_in[], - double dydt_out[], const gsl_odeiv2_system * dydt); -int gsl_odeiv2_step_set_driver (gsl_odeiv2_step * s, - const gsl_odeiv2_driver * d); - -/* Step size control object. */ - -typedef struct -{ - const char *name; - void *(*alloc) (void); - int (*init) (void *state, double eps_abs, double eps_rel, double a_y, - double a_dydt); - int (*hadjust) (void *state, size_t dim, unsigned int ord, const double y[], - const double yerr[], const double yp[], double *h); - int (*errlevel) (void *state, const double y, const double dydt, - const double h, const size_t ind, double *errlev); - int (*set_driver) (void *state, const gsl_odeiv2_driver * d); - void (*free) (void *state); -} -gsl_odeiv2_control_type; - -struct gsl_odeiv2_control_struct -{ - const gsl_odeiv2_control_type *type; - void *state; -}; - -/* Possible return values for an hadjust() evolution method */ - -#define GSL_ODEIV_HADJ_INC 1 /* step was increased */ -#define GSL_ODEIV_HADJ_NIL 0 /* step unchanged */ -#define GSL_ODEIV_HADJ_DEC (-1) /* step decreased */ - -/* General step size control methods. - * - * The hadjust() method controls the adjustment of - * step size given the result of a step and the error. - * Valid hadjust() methods must return one of the codes below. - * errlevel function calculates the desired error level D0. - * - * The general data can be used by specializations - * to store state and control their heuristics. - */ - -gsl_odeiv2_control *gsl_odeiv2_control_alloc (const gsl_odeiv2_control_type * - T); -int gsl_odeiv2_control_init (gsl_odeiv2_control * c, double eps_abs, - double eps_rel, double a_y, double a_dydt); -void gsl_odeiv2_control_free (gsl_odeiv2_control * c); -int gsl_odeiv2_control_hadjust (gsl_odeiv2_control * c, gsl_odeiv2_step * s, - const double y[], const double yerr[], - const double dydt[], double *h); -const char *gsl_odeiv2_control_name (const gsl_odeiv2_control * c); -int gsl_odeiv2_control_errlevel (gsl_odeiv2_control * c, const double y, - const double dydt, const double h, - const size_t ind, double *errlev); -int gsl_odeiv2_control_set_driver (gsl_odeiv2_control * c, - const gsl_odeiv2_driver * d); - -/* Available control object constructors. - * - * The standard control object is a four parameter heuristic - * defined as follows: - * D0 = eps_abs + eps_rel * (a_y |y| + a_dydt h |y'|) - * D1 = |yerr| - * q = consistency order of method (q=4 for 4(5) embedded RK) - * S = safety factor (0.9 say) - * - * / (D0/D1)^(1/(q+1)) D0 >= D1 - * h_NEW = S h_OLD * | - * \ (D0/D1)^(1/q) D0 < D1 - * - * This encompasses all the standard error scaling methods. - * - * The y method is the standard method with a_y=1, a_dydt=0. - * The yp method is the standard method with a_y=0, a_dydt=1. - */ - -gsl_odeiv2_control *gsl_odeiv2_control_standard_new (double eps_abs, - double eps_rel, - double a_y, - double a_dydt); -gsl_odeiv2_control *gsl_odeiv2_control_y_new (double eps_abs, double eps_rel); -gsl_odeiv2_control *gsl_odeiv2_control_yp_new (double eps_abs, - double eps_rel); - -/* This controller computes errors using different absolute errors for - * each component - * - * D0 = eps_abs * scale_abs[i] + eps_rel * (a_y |y| + a_dydt h |y'|) - */ - -gsl_odeiv2_control *gsl_odeiv2_control_scaled_new (double eps_abs, - double eps_rel, double a_y, - double a_dydt, - const double scale_abs[], - size_t dim); - -/* Evolution object */ - -struct gsl_odeiv2_evolve_struct -{ - size_t dimension; - double *y0; - double *yerr; - double *dydt_in; - double *dydt_out; - double last_step; - unsigned long int count; - unsigned long int failed_steps; - const gsl_odeiv2_driver *driver; -}; - -/* Evolution object methods */ - -gsl_odeiv2_evolve *gsl_odeiv2_evolve_alloc (size_t dim); -int gsl_odeiv2_evolve_apply (gsl_odeiv2_evolve * e, gsl_odeiv2_control * con, - gsl_odeiv2_step * step, - const gsl_odeiv2_system * dydt, double *t, - double t1, double *h, double y[]); -int gsl_odeiv2_evolve_apply_fixed_step (gsl_odeiv2_evolve * e, - gsl_odeiv2_control * con, - gsl_odeiv2_step * step, - const gsl_odeiv2_system * dydt, - double *t, const double h0, - double y[]); -int gsl_odeiv2_evolve_reset (gsl_odeiv2_evolve * e); -void gsl_odeiv2_evolve_free (gsl_odeiv2_evolve * e); -int gsl_odeiv2_evolve_set_driver (gsl_odeiv2_evolve * e, - const gsl_odeiv2_driver * d); - -/* Driver object - * - * This is a high level wrapper for step, control and - * evolve objects. - */ - -struct gsl_odeiv2_driver_struct -{ - const gsl_odeiv2_system *sys; /* ODE system */ - gsl_odeiv2_step *s; /* stepper object */ - gsl_odeiv2_control *c; /* control object */ - gsl_odeiv2_evolve *e; /* evolve object */ - double h; /* step size */ - double hmin; /* minimum step size allowed */ - double hmax; /* maximum step size allowed */ - unsigned long int n; /* number of steps taken */ - unsigned long int nmax; /* Maximum number of steps allowed */ -}; - -/* Driver object methods */ - -gsl_odeiv2_driver *gsl_odeiv2_driver_alloc_y_new (const gsl_odeiv2_system * - sys, - const gsl_odeiv2_step_type * - T, const double hstart, - const double epsabs, - const double epsrel); -gsl_odeiv2_driver *gsl_odeiv2_driver_alloc_yp_new (const gsl_odeiv2_system * - sys, - const gsl_odeiv2_step_type - * T, const double hstart, - const double epsabs, - const double epsrel); -gsl_odeiv2_driver *gsl_odeiv2_driver_alloc_scaled_new (const gsl_odeiv2_system - * sys, - const - gsl_odeiv2_step_type * - T, const double hstart, - const double epsabs, - const double epsrel, - const double a_y, - const double a_dydt, - const double - scale_abs[]); -gsl_odeiv2_driver *gsl_odeiv2_driver_alloc_standard_new (const - gsl_odeiv2_system * - sys, - const - gsl_odeiv2_step_type - * T, - const double hstart, - const double epsabs, - const double epsrel, - const double a_y, - const double a_dydt); -int gsl_odeiv2_driver_set_hmin (gsl_odeiv2_driver * d, const double hmin); -int gsl_odeiv2_driver_set_hmax (gsl_odeiv2_driver * d, const double hmax); -int gsl_odeiv2_driver_set_nmax (gsl_odeiv2_driver * d, - const unsigned long int nmax); -int gsl_odeiv2_driver_apply (gsl_odeiv2_driver * d, double *t, - const double t1, double y[]); -int gsl_odeiv2_driver_apply_fixed_step (gsl_odeiv2_driver * d, double *t, - const double h, - const unsigned long int n, - double y[]); -int gsl_odeiv2_driver_reset (gsl_odeiv2_driver * d); -int gsl_odeiv2_driver_reset_hstart (gsl_odeiv2_driver * d, const double hstart); -void gsl_odeiv2_driver_free (gsl_odeiv2_driver * state); - -__END_DECLS -#endif /* __GSL_ODEIV2_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permutation.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permutation.h deleted file mode 100644 index 10ac0f58a..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permutation.h +++ /dev/null @@ -1,100 +0,0 @@ -/* permutation/gsl_permutation.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTATION_H__ -#define __GSL_PERMUTATION_H__ - -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -struct gsl_permutation_struct -{ - size_t size; - size_t *data; -}; - -typedef struct gsl_permutation_struct gsl_permutation; - -gsl_permutation *gsl_permutation_alloc (const size_t n); -gsl_permutation *gsl_permutation_calloc (const size_t n); -void gsl_permutation_init (gsl_permutation * p); -void gsl_permutation_free (gsl_permutation * p); -int gsl_permutation_memcpy (gsl_permutation * dest, const gsl_permutation * src); - -int gsl_permutation_fread (FILE * stream, gsl_permutation * p); -int gsl_permutation_fwrite (FILE * stream, const gsl_permutation * p); -int gsl_permutation_fscanf (FILE * stream, gsl_permutation * p); -int gsl_permutation_fprintf (FILE * stream, const gsl_permutation * p, const char *format); - -size_t gsl_permutation_size (const gsl_permutation * p); -size_t * gsl_permutation_data (const gsl_permutation * p); - -int gsl_permutation_swap (gsl_permutation * p, const size_t i, const size_t j); - -int gsl_permutation_valid (const gsl_permutation * p); -void gsl_permutation_reverse (gsl_permutation * p); -int gsl_permutation_inverse (gsl_permutation * inv, const gsl_permutation * p); -int gsl_permutation_next (gsl_permutation * p); -int gsl_permutation_prev (gsl_permutation * p); -int gsl_permutation_mul (gsl_permutation * p, const gsl_permutation * pa, const gsl_permutation * pb); - -int gsl_permutation_linear_to_canonical (gsl_permutation * q, const gsl_permutation * p); -int gsl_permutation_canonical_to_linear (gsl_permutation * p, const gsl_permutation * q); - -size_t gsl_permutation_inversions (const gsl_permutation * p); -size_t gsl_permutation_linear_cycles (const gsl_permutation * p); -size_t gsl_permutation_canonical_cycles (const gsl_permutation * q); - -INLINE_DECL size_t gsl_permutation_get (const gsl_permutation * p, const size_t i); - -#ifdef HAVE_INLINE - -INLINE_FUN -size_t -gsl_permutation_get (const gsl_permutation * p, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= p->size)) - { - GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); - } -#endif - return p->data[i]; -} - -#endif /* HAVE_INLINE */ - -__END_DECLS - -#endif /* __GSL_PERMUTATION_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute.h deleted file mode 100644 index 23f09a6f0..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __GSL_PERMUTE_H__ -#define __GSL_PERMUTE_H__ - -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include - -#include -#include - -#endif /* __GSL_PERMUTE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_char.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_char.h deleted file mode 100644 index bf2ebb1dc..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_char.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_char.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_CHAR_H__ -#define __GSL_PERMUTE_CHAR_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_char (const size_t * p, char * data, const size_t stride, const size_t n); -int gsl_permute_char_inverse (const size_t * p, char * data, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_PERMUTE_CHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_complex_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_complex_double.h deleted file mode 100644 index c20442b6a..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_complex_double.h +++ /dev/null @@ -1,45 +0,0 @@ -/* permutation/gsl_permute_complex_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_COMPLEX_DOUBLE_H__ -#define __GSL_PERMUTE_COMPLEX_DOUBLE_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_complex (const size_t * p, double * data, const size_t stride, const size_t n); -int gsl_permute_complex_inverse (const size_t * p, double * data, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_PERMUTE_COMPLEX_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_complex_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_complex_float.h deleted file mode 100644 index 65ee0fe44..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_complex_float.h +++ /dev/null @@ -1,45 +0,0 @@ -/* permutation/gsl_permute_complex_float.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_COMPLEX_FLOAT_H__ -#define __GSL_PERMUTE_COMPLEX_FLOAT_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_complex_float (const size_t * p, float * data, const size_t stride, const size_t n); -int gsl_permute_complex_float_inverse (const size_t * p, float * data, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_PERMUTE_COMPLEX_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_complex_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_complex_long_double.h deleted file mode 100644 index 4849b15df..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_complex_long_double.h +++ /dev/null @@ -1,45 +0,0 @@ -/* permutation/gsl_permute_complex_long_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_COMPLEX_LONG_DOUBLE_H__ -#define __GSL_PERMUTE_COMPLEX_LONG_DOUBLE_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_complex_long_double (const size_t * p, long double * data, const size_t stride, const size_t n); -int gsl_permute_complex_long_double_inverse (const size_t * p, long double * data, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_PERMUTE_COMPLEX_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_double.h deleted file mode 100644 index 58be1812b..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_double.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_DOUBLE_H__ -#define __GSL_PERMUTE_DOUBLE_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute (const size_t * p, double * data, const size_t stride, const size_t n); -int gsl_permute_inverse (const size_t * p, double * data, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_PERMUTE_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_float.h deleted file mode 100644 index bc79bd5a4..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_float.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_float.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_FLOAT_H__ -#define __GSL_PERMUTE_FLOAT_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_float (const size_t * p, float * data, const size_t stride, const size_t n); -int gsl_permute_float_inverse (const size_t * p, float * data, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_PERMUTE_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_int.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_int.h deleted file mode 100644 index b6ff50080..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_int.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_int.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_INT_H__ -#define __GSL_PERMUTE_INT_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_int (const size_t * p, int * data, const size_t stride, const size_t n); -int gsl_permute_int_inverse (const size_t * p, int * data, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_PERMUTE_INT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_long.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_long.h deleted file mode 100644 index 383294c5a..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_long.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_long.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_LONG_H__ -#define __GSL_PERMUTE_LONG_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_long (const size_t * p, long * data, const size_t stride, const size_t n); -int gsl_permute_long_inverse (const size_t * p, long * data, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_PERMUTE_LONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_long_double.h deleted file mode 100644 index f58e1cd8a..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_long_double.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_long_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_LONG_DOUBLE_H__ -#define __GSL_PERMUTE_LONG_DOUBLE_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_long_double (const size_t * p, long double * data, const size_t stride, const size_t n); -int gsl_permute_long_double_inverse (const size_t * p, long double * data, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_PERMUTE_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix.h deleted file mode 100644 index aa8e67211..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __GSL_PERMUTE_MATRIX_H__ -#define __GSL_PERMUTE_MATRIX_H__ - -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include - -#include -#include - -#endif /* __GSL_PERMUTE_MATRIX_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_char.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_char.h deleted file mode 100644 index 7ce67aaa4..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_char.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_matrix_char.h - * - * Copyright (C) 2016 Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_MATRIX_CHAR_H__ -#define __GSL_PERMUTE_MATRIX_CHAR_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_matrix_char (const gsl_permutation * p, gsl_matrix_char * A); - -__END_DECLS - -#endif /* __GSL_PERMUTE_MATRIX_CHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_complex_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_complex_double.h deleted file mode 100644 index 0c047b496..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_complex_double.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_matrix_complex_double.h - * - * Copyright (C) 2016 Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_MATRIX_COMPLEX_DOUBLE_H__ -#define __GSL_PERMUTE_MATRIX_COMPLEX_DOUBLE_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_matrix_complex (const gsl_permutation * p, gsl_matrix_complex * A); - -__END_DECLS - -#endif /* __GSL_PERMUTE_MATRIX_COMPLEX_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_complex_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_complex_float.h deleted file mode 100644 index c0a7a94f3..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_complex_float.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_matrix_complex_float.h - * - * Copyright (C) 2016 Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_MATRIX_COMPLEX_FLOAT_H__ -#define __GSL_PERMUTE_MATRIX_COMPLEX_FLOAT_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_matrix_complex_float (const gsl_permutation * p, gsl_matrix_complex_float * A); - -__END_DECLS - -#endif /* __GSL_PERMUTE_MATRIX_COMPLEX_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_complex_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_complex_long_double.h deleted file mode 100644 index a005e9620..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_complex_long_double.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_matrix_complex_long_double.h - * - * Copyright (C) 2016 Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_MATRIX_COMPLEX_LONG_DOUBLE_H__ -#define __GSL_PERMUTE_MATRIX_COMPLEX_LONG_DOUBLE_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_matrix_complex_long_double (const gsl_permutation * p, gsl_matrix_complex_long_double * A); - -__END_DECLS - -#endif /* __GSL_PERMUTE_MATRIX_COMPLEX_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_double.h deleted file mode 100644 index 2f17bd813..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_double.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_matrix_double.h - * - * Copyright (C) 2016 Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_MATRIX_DOUBLE_H__ -#define __GSL_PERMUTE_MATRIX_DOUBLE_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_matrix (const gsl_permutation * p, gsl_matrix * A); - -__END_DECLS - -#endif /* __GSL_PERMUTE_MATRIX_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_float.h deleted file mode 100644 index 700362262..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_float.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_matrix_float.h - * - * Copyright (C) 2016 Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_MATRIX_FLOAT_H__ -#define __GSL_PERMUTE_MATRIX_FLOAT_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_matrix_float (const gsl_permutation * p, gsl_matrix_float * A); - -__END_DECLS - -#endif /* __GSL_PERMUTE_MATRIX_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_int.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_int.h deleted file mode 100644 index 27dfea0d1..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_int.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_matrix_int.h - * - * Copyright (C) 2016 Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_MATRIX_INT_H__ -#define __GSL_PERMUTE_MATRIX_INT_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_matrix_int (const gsl_permutation * p, gsl_matrix_int * A); - -__END_DECLS - -#endif /* __GSL_PERMUTE_MATRIX_INT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_long.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_long.h deleted file mode 100644 index 6aaaaf437..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_long.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_matrix_long.h - * - * Copyright (C) 2016 Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_MATRIX_LONG_H__ -#define __GSL_PERMUTE_MATRIX_LONG_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_matrix_long (const gsl_permutation * p, gsl_matrix_long * A); - -__END_DECLS - -#endif /* __GSL_PERMUTE_MATRIX_LONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_long_double.h deleted file mode 100644 index 8a7d28c08..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_long_double.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_matrix_long_double.h - * - * Copyright (C) 2016 Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_MATRIX_LONG_DOUBLE_H__ -#define __GSL_PERMUTE_MATRIX_LONG_DOUBLE_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_matrix_long_double (const gsl_permutation * p, gsl_matrix_long_double * A); - -__END_DECLS - -#endif /* __GSL_PERMUTE_MATRIX_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_short.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_short.h deleted file mode 100644 index 1982305f9..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_short.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_matrix_short.h - * - * Copyright (C) 2016 Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_MATRIX_SHORT_H__ -#define __GSL_PERMUTE_MATRIX_SHORT_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_matrix_short (const gsl_permutation * p, gsl_matrix_short * A); - -__END_DECLS - -#endif /* __GSL_PERMUTE_MATRIX_SHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_uchar.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_uchar.h deleted file mode 100644 index 95991bfac..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_uchar.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_matrix_uchar.h - * - * Copyright (C) 2016 Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_MATRIX_UCHAR_H__ -#define __GSL_PERMUTE_MATRIX_UCHAR_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_matrix_uchar (const gsl_permutation * p, gsl_matrix_uchar * A); - -__END_DECLS - -#endif /* __GSL_PERMUTE_MATRIX_UCHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_uint.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_uint.h deleted file mode 100644 index 6497809c2..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_uint.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_matrix_uint.h - * - * Copyright (C) 2016 Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_MATRIX_UINT_H__ -#define __GSL_PERMUTE_MATRIX_UINT_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_matrix_uint (const gsl_permutation * p, gsl_matrix_uint * A); - -__END_DECLS - -#endif /* __GSL_PERMUTE_MATRIX_UINT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_ulong.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_ulong.h deleted file mode 100644 index 5aabc470b..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_ulong.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_matrix_ulong.h - * - * Copyright (C) 2016 Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_MATRIX_ULONG_H__ -#define __GSL_PERMUTE_MATRIX_ULONG_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_matrix_ulong (const gsl_permutation * p, gsl_matrix_ulong * A); - -__END_DECLS - -#endif /* __GSL_PERMUTE_MATRIX_ULONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_ushort.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_ushort.h deleted file mode 100644 index e432ffee3..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_matrix_ushort.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_matrix_ushort.h - * - * Copyright (C) 2016 Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_MATRIX_USHORT_H__ -#define __GSL_PERMUTE_MATRIX_USHORT_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_matrix_ushort (const gsl_permutation * p, gsl_matrix_ushort * A); - -__END_DECLS - -#endif /* __GSL_PERMUTE_MATRIX_USHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_short.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_short.h deleted file mode 100644 index 39cf55d67..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_short.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_short.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_SHORT_H__ -#define __GSL_PERMUTE_SHORT_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_short (const size_t * p, short * data, const size_t stride, const size_t n); -int gsl_permute_short_inverse (const size_t * p, short * data, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_PERMUTE_SHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_uchar.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_uchar.h deleted file mode 100644 index 54bb401b0..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_uchar.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_uchar.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_UCHAR_H__ -#define __GSL_PERMUTE_UCHAR_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_uchar (const size_t * p, unsigned char * data, const size_t stride, const size_t n); -int gsl_permute_uchar_inverse (const size_t * p, unsigned char * data, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_PERMUTE_UCHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_uint.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_uint.h deleted file mode 100644 index 8915b7bc6..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_uint.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_uint.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_UINT_H__ -#define __GSL_PERMUTE_UINT_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_uint (const size_t * p, unsigned int * data, const size_t stride, const size_t n); -int gsl_permute_uint_inverse (const size_t * p, unsigned int * data, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_PERMUTE_UINT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_ulong.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_ulong.h deleted file mode 100644 index 0084c506c..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_ulong.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_ulong.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_ULONG_H__ -#define __GSL_PERMUTE_ULONG_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_ulong (const size_t * p, unsigned long * data, const size_t stride, const size_t n); -int gsl_permute_ulong_inverse (const size_t * p, unsigned long * data, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_PERMUTE_ULONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_ushort.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_ushort.h deleted file mode 100644 index eff079a57..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_ushort.h +++ /dev/null @@ -1,44 +0,0 @@ -/* permutation/gsl_permute_ushort.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_USHORT_H__ -#define __GSL_PERMUTE_USHORT_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_ushort (const size_t * p, unsigned short * data, const size_t stride, const size_t n); -int gsl_permute_ushort_inverse (const size_t * p, unsigned short * data, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_PERMUTE_USHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector.h deleted file mode 100644 index 4369e4955..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __GSL_PERMUTE_VECTOR_H__ -#define __GSL_PERMUTE_VECTOR_H__ - -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include - -#include -#include - -#endif /* __GSL_PERMUTE_VECTOR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_char.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_char.h deleted file mode 100644 index 15278eddf..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_char.h +++ /dev/null @@ -1,45 +0,0 @@ -/* permutation/gsl_permute_vector_char.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_VECTOR_CHAR_H__ -#define __GSL_PERMUTE_VECTOR_CHAR_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_vector_char (const gsl_permutation * p, gsl_vector_char * v); -int gsl_permute_vector_char_inverse (const gsl_permutation * p, gsl_vector_char * v); - -__END_DECLS - -#endif /* __GSL_PERMUTE_VECTOR_CHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_complex_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_complex_double.h deleted file mode 100644 index 60558e21a..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_complex_double.h +++ /dev/null @@ -1,45 +0,0 @@ -/* permutation/gsl_permute_vector_complex_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_VECTOR_COMPLEX_DOUBLE_H__ -#define __GSL_PERMUTE_VECTOR_COMPLEX_DOUBLE_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_vector_complex (const gsl_permutation * p, gsl_vector_complex * v); -int gsl_permute_vector_complex_inverse (const gsl_permutation * p, gsl_vector_complex * v); - -__END_DECLS - -#endif /* __GSL_PERMUTE_VECTOR_COMPLEX_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_complex_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_complex_float.h deleted file mode 100644 index b08696bc6..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_complex_float.h +++ /dev/null @@ -1,45 +0,0 @@ -/* permutation/gsl_permute_vector_complex_float.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_VECTOR_COMPLEX_FLOAT_H__ -#define __GSL_PERMUTE_VECTOR_COMPLEX_FLOAT_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_vector_complex_float (const gsl_permutation * p, gsl_vector_complex_float * v); -int gsl_permute_vector_complex_float_inverse (const gsl_permutation * p, gsl_vector_complex_float * v); - -__END_DECLS - -#endif /* __GSL_PERMUTE_VECTOR_COMPLEX_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_complex_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_complex_long_double.h deleted file mode 100644 index c19ac25d8..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_complex_long_double.h +++ /dev/null @@ -1,45 +0,0 @@ -/* permutation/gsl_permute_vector_complex_long_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_VECTOR_COMPLEX_LONG_DOUBLE_H__ -#define __GSL_PERMUTE_VECTOR_COMPLEX_LONG_DOUBLE_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_vector_complex_long_double (const gsl_permutation * p, gsl_vector_complex_long_double * v); -int gsl_permute_vector_complex_long_double_inverse (const gsl_permutation * p, gsl_vector_complex_long_double * v); - -__END_DECLS - -#endif /* __GSL_PERMUTE_VECTOR_COMPLEX_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_double.h deleted file mode 100644 index 65f616744..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_double.h +++ /dev/null @@ -1,45 +0,0 @@ -/* permutation/gsl_permute_vector_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_VECTOR_DOUBLE_H__ -#define __GSL_PERMUTE_VECTOR_DOUBLE_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_vector (const gsl_permutation * p, gsl_vector * v); -int gsl_permute_vector_inverse (const gsl_permutation * p, gsl_vector * v); - -__END_DECLS - -#endif /* __GSL_PERMUTE_VECTOR_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_float.h deleted file mode 100644 index bdd9d1a63..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_float.h +++ /dev/null @@ -1,45 +0,0 @@ -/* permutation/gsl_permute_vector_float.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_VECTOR_FLOAT_H__ -#define __GSL_PERMUTE_VECTOR_FLOAT_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_vector_float (const gsl_permutation * p, gsl_vector_float * v); -int gsl_permute_vector_float_inverse (const gsl_permutation * p, gsl_vector_float * v); - -__END_DECLS - -#endif /* __GSL_PERMUTE_VECTOR_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_int.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_int.h deleted file mode 100644 index 3316d504f..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_int.h +++ /dev/null @@ -1,45 +0,0 @@ -/* permutation/gsl_permute_vector_int.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_VECTOR_INT_H__ -#define __GSL_PERMUTE_VECTOR_INT_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_vector_int (const gsl_permutation * p, gsl_vector_int * v); -int gsl_permute_vector_int_inverse (const gsl_permutation * p, gsl_vector_int * v); - -__END_DECLS - -#endif /* __GSL_PERMUTE_VECTOR_INT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_long.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_long.h deleted file mode 100644 index 291f949b3..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_long.h +++ /dev/null @@ -1,45 +0,0 @@ -/* permutation/gsl_permute_vector_long.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_VECTOR_LONG_H__ -#define __GSL_PERMUTE_VECTOR_LONG_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_vector_long (const gsl_permutation * p, gsl_vector_long * v); -int gsl_permute_vector_long_inverse (const gsl_permutation * p, gsl_vector_long * v); - -__END_DECLS - -#endif /* __GSL_PERMUTE_VECTOR_LONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_long_double.h deleted file mode 100644 index a6b02960a..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_long_double.h +++ /dev/null @@ -1,45 +0,0 @@ -/* permutation/gsl_permute_vector_long_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_VECTOR_LONG_DOUBLE_H__ -#define __GSL_PERMUTE_VECTOR_LONG_DOUBLE_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_vector_long_double (const gsl_permutation * p, gsl_vector_long_double * v); -int gsl_permute_vector_long_double_inverse (const gsl_permutation * p, gsl_vector_long_double * v); - -__END_DECLS - -#endif /* __GSL_PERMUTE_VECTOR_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_short.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_short.h deleted file mode 100644 index cd0dd6b4b..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_short.h +++ /dev/null @@ -1,45 +0,0 @@ -/* permutation/gsl_permute_vector_short.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_VECTOR_SHORT_H__ -#define __GSL_PERMUTE_VECTOR_SHORT_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_vector_short (const gsl_permutation * p, gsl_vector_short * v); -int gsl_permute_vector_short_inverse (const gsl_permutation * p, gsl_vector_short * v); - -__END_DECLS - -#endif /* __GSL_PERMUTE_VECTOR_SHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_uchar.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_uchar.h deleted file mode 100644 index df069a0a6..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_uchar.h +++ /dev/null @@ -1,45 +0,0 @@ -/* permutation/gsl_permute_vector_uchar.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_VECTOR_UCHAR_H__ -#define __GSL_PERMUTE_VECTOR_UCHAR_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_vector_uchar (const gsl_permutation * p, gsl_vector_uchar * v); -int gsl_permute_vector_uchar_inverse (const gsl_permutation * p, gsl_vector_uchar * v); - -__END_DECLS - -#endif /* __GSL_PERMUTE_VECTOR_UCHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_uint.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_uint.h deleted file mode 100644 index ee5218af9..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_uint.h +++ /dev/null @@ -1,45 +0,0 @@ -/* permutation/gsl_permute_vector_uint.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_VECTOR_UINT_H__ -#define __GSL_PERMUTE_VECTOR_UINT_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_vector_uint (const gsl_permutation * p, gsl_vector_uint * v); -int gsl_permute_vector_uint_inverse (const gsl_permutation * p, gsl_vector_uint * v); - -__END_DECLS - -#endif /* __GSL_PERMUTE_VECTOR_UINT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_ulong.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_ulong.h deleted file mode 100644 index e536d9a8a..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_ulong.h +++ /dev/null @@ -1,45 +0,0 @@ -/* permutation/gsl_permute_vector_ulong.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_VECTOR_ULONG_H__ -#define __GSL_PERMUTE_VECTOR_ULONG_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_vector_ulong (const gsl_permutation * p, gsl_vector_ulong * v); -int gsl_permute_vector_ulong_inverse (const gsl_permutation * p, gsl_vector_ulong * v); - -__END_DECLS - -#endif /* __GSL_PERMUTE_VECTOR_ULONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_ushort.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_ushort.h deleted file mode 100644 index 7533ba00a..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_permute_vector_ushort.h +++ /dev/null @@ -1,45 +0,0 @@ -/* permutation/gsl_permute_vector_ushort.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_PERMUTE_VECTOR_USHORT_H__ -#define __GSL_PERMUTE_VECTOR_USHORT_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_permute_vector_ushort (const gsl_permutation * p, gsl_vector_ushort * v); -int gsl_permute_vector_ushort_inverse (const gsl_permutation * p, gsl_vector_ushort * v); - -__END_DECLS - -#endif /* __GSL_PERMUTE_VECTOR_USHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_poly.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_poly.h deleted file mode 100644 index 2352857ff..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_poly.h +++ /dev/null @@ -1,183 +0,0 @@ -/* poly/gsl_poly.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_POLY_H__ -#define __GSL_POLY_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Evaluate polynomial - * - * c[0] + c[1] x + c[2] x^2 + ... + c[len-1] x^(len-1) - * - * exceptions: none - */ - -/* real polynomial, real x */ -INLINE_DECL double gsl_poly_eval(const double c[], const int len, const double x); - -/* real polynomial, complex x */ -INLINE_DECL gsl_complex gsl_poly_complex_eval (const double c [], const int len, const gsl_complex z); - -/* complex polynomial, complex x */ -INLINE_DECL gsl_complex gsl_complex_poly_complex_eval (const gsl_complex c [], const int len, const gsl_complex z); - -int gsl_poly_eval_derivs(const double c[], const size_t lenc, const double x, double res[], const size_t lenres); - -#ifdef HAVE_INLINE -INLINE_FUN -double -gsl_poly_eval(const double c[], const int len, const double x) -{ - int i; - double ans = c[len-1]; - for(i=len-1; i>0; i--) ans = c[i-1] + x * ans; - return ans; -} - -INLINE_FUN -gsl_complex -gsl_poly_complex_eval(const double c[], const int len, const gsl_complex z) -{ - int i; - gsl_complex ans; - GSL_SET_COMPLEX (&ans, c[len-1], 0.0); - for(i=len-1; i>0; i--) { - /* The following three lines are equivalent to - ans = gsl_complex_add_real (gsl_complex_mul (z, ans), c[i-1]); - but faster */ - double tmp = c[i-1] + GSL_REAL (z) * GSL_REAL (ans) - GSL_IMAG (z) * GSL_IMAG (ans); - GSL_SET_IMAG (&ans, GSL_IMAG (z) * GSL_REAL (ans) + GSL_REAL (z) * GSL_IMAG (ans)); - GSL_SET_REAL (&ans, tmp); - } - return ans; -} - -INLINE_FUN -gsl_complex -gsl_complex_poly_complex_eval(const gsl_complex c[], const int len, const gsl_complex z) -{ - int i; - gsl_complex ans = c[len-1]; - for(i=len-1; i>0; i--) { - /* The following three lines are equivalent to - ans = gsl_complex_add (c[i-1], gsl_complex_mul (x, ans)); - but faster */ - double tmp = GSL_REAL (c[i-1]) + GSL_REAL (z) * GSL_REAL (ans) - GSL_IMAG (z) * GSL_IMAG (ans); - GSL_SET_IMAG (&ans, GSL_IMAG (c[i-1]) + GSL_IMAG (z) * GSL_REAL (ans) + GSL_REAL (z) * GSL_IMAG (ans)); - GSL_SET_REAL (&ans, tmp); - } - return ans; -} -#endif /* HAVE_INLINE */ - -/* Work with divided-difference polynomials, Abramowitz & Stegun 25.2.26 */ - -int -gsl_poly_dd_init (double dd[], const double x[], const double y[], - size_t size); - -INLINE_DECL double -gsl_poly_dd_eval (const double dd[], const double xa[], const size_t size, const double x); - -#ifdef HAVE_INLINE -INLINE_FUN -double -gsl_poly_dd_eval(const double dd[], const double xa[], const size_t size, const double x) -{ - size_t i; - double y = dd[size - 1]; - for (i = size - 1; i--;) y = dd[i] + (x - xa[i]) * y; - return y; -} -#endif /* HAVE_INLINE */ - - -int -gsl_poly_dd_taylor (double c[], double xp, - const double dd[], const double x[], size_t size, - double w[]); - -int -gsl_poly_dd_hermite_init (double dd[], double z[], const double xa[], const double ya[], - const double dya[], const size_t size); - -/* Solve for real or complex roots of the standard quadratic equation, - * returning the number of real roots. - * - * Roots are returned ordered. - */ -int gsl_poly_solve_quadratic (double a, double b, double c, - double * x0, double * x1); - -int -gsl_poly_complex_solve_quadratic (double a, double b, double c, - gsl_complex * z0, gsl_complex * z1); - - -/* Solve for real roots of the cubic equation - * x^3 + a x^2 + b x + c = 0, returning the - * number of real roots. - * - * Roots are returned ordered. - */ -int gsl_poly_solve_cubic (double a, double b, double c, - double * x0, double * x1, double * x2); - -int -gsl_poly_complex_solve_cubic (double a, double b, double c, - gsl_complex * z0, gsl_complex * z1, - gsl_complex * z2); - - -/* Solve for the complex roots of a general real polynomial */ - -typedef struct -{ - size_t nc ; - double * matrix ; -} -gsl_poly_complex_workspace ; - -gsl_poly_complex_workspace * gsl_poly_complex_workspace_alloc (size_t n); -void gsl_poly_complex_workspace_free (gsl_poly_complex_workspace * w); - -int -gsl_poly_complex_solve (const double * a, size_t n, - gsl_poly_complex_workspace * w, - gsl_complex_packed_ptr z); - -__END_DECLS - -#endif /* __GSL_POLY_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_pow_int.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_pow_int.h deleted file mode 100644 index 6aa01fbcf..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_pow_int.h +++ /dev/null @@ -1,61 +0,0 @@ -/* gsl_pow_int.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_POW_INT_H__ -#define __GSL_POW_INT_H__ -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -INLINE_DECL double gsl_pow_2(const double x); -INLINE_DECL double gsl_pow_3(const double x); -INLINE_DECL double gsl_pow_4(const double x); -INLINE_DECL double gsl_pow_5(const double x); -INLINE_DECL double gsl_pow_6(const double x); -INLINE_DECL double gsl_pow_7(const double x); -INLINE_DECL double gsl_pow_8(const double x); -INLINE_DECL double gsl_pow_9(const double x); - -#ifdef HAVE_INLINE -INLINE_FUN double gsl_pow_2(const double x) { return x*x; } -INLINE_FUN double gsl_pow_3(const double x) { return x*x*x; } -INLINE_FUN double gsl_pow_4(const double x) { double x2 = x*x; return x2*x2; } -INLINE_FUN double gsl_pow_5(const double x) { double x2 = x*x; return x2*x2*x; } -INLINE_FUN double gsl_pow_6(const double x) { double x2 = x*x; return x2*x2*x2; } -INLINE_FUN double gsl_pow_7(const double x) { double x3 = x*x*x; return x3*x3*x; } -INLINE_FUN double gsl_pow_8(const double x) { double x2 = x*x; double x4 = x2*x2; return x4*x4; } -INLINE_FUN double gsl_pow_9(const double x) { double x3 = x*x*x; return x3*x3*x3; } -#endif - -double gsl_pow_int(double x, int n); -double gsl_pow_uint(double x, unsigned int n); - -__END_DECLS - -#endif /* __GSL_POW_INT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_precision.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_precision.h deleted file mode 100644 index 97a204ead..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_precision.h +++ /dev/null @@ -1,66 +0,0 @@ -/* gsl_precision.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: B. Gough and G. Jungman */ - -#ifndef __GSL_PRECISION_H__ -#define __GSL_PRECISION_H__ -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* A type for the precision indicator. - * This is mainly for pedagogy. - */ -typedef unsigned int gsl_prec_t; - - -/* The number of precision types. - * Remember that precision-mode - * can index an array. - */ -#define _GSL_PREC_T_NUM 3 - - -/* Arrays containing derived - * precision constants for the - * different precision levels. - */ -GSL_VAR const double gsl_prec_eps[]; -GSL_VAR const double gsl_prec_sqrt_eps[]; -GSL_VAR const double gsl_prec_root3_eps[]; -GSL_VAR const double gsl_prec_root4_eps[]; -GSL_VAR const double gsl_prec_root5_eps[]; -GSL_VAR const double gsl_prec_root6_eps[]; - - -__END_DECLS - -#endif /* __GSL_PRECISION_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_qrng.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_qrng.h deleted file mode 100644 index 47de500fb..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_qrng.h +++ /dev/null @@ -1,111 +0,0 @@ -/* Author: G. Jungman + modifications from O. Teytaud - */ -#ifndef __GSL_QRNG_H__ -#define __GSL_QRNG_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Once again, more inane C-style OOP... kill me now. */ - -/* Structure describing a type of generator. - */ -typedef struct -{ - const char * name; - unsigned int max_dimension; - size_t (*state_size) (unsigned int dimension); - int (*init_state) (void * state, unsigned int dimension); - int (*get) (void * state, unsigned int dimension, double x[]); -} -gsl_qrng_type; - -/* Structure describing a generator instance of a - * specified type, with generator-specific state info - * and dimension-specific info. - */ -typedef struct -{ - const gsl_qrng_type * type; - unsigned int dimension; - size_t state_size; - void * state; -} -gsl_qrng; - - -/* Supported generator types. - */ -GSL_VAR const gsl_qrng_type * gsl_qrng_niederreiter_2; -GSL_VAR const gsl_qrng_type * gsl_qrng_sobol; -GSL_VAR const gsl_qrng_type * gsl_qrng_halton; -GSL_VAR const gsl_qrng_type * gsl_qrng_reversehalton; - - -/* Allocate and initialize a generator - * of the specified type, in the given - * space dimension. - */ -gsl_qrng * gsl_qrng_alloc (const gsl_qrng_type * T, unsigned int dimension); - - -/* Copy a generator. */ -int gsl_qrng_memcpy (gsl_qrng * dest, const gsl_qrng * src); - - -/* Clone a generator. */ -gsl_qrng * gsl_qrng_clone (const gsl_qrng * q); - - -/* Free a generator. */ -void gsl_qrng_free (gsl_qrng * q); - - -/* Intialize a generator. */ -void gsl_qrng_init (gsl_qrng * q); - - -/* Get the standardized name of the generator. */ -const char * gsl_qrng_name (const gsl_qrng * q); - - -/* ISN'T THIS CONFUSING FOR PEOPLE? - WHAT IF SOMEBODY TRIES TO COPY WITH THIS ??? - */ -size_t gsl_qrng_size (const gsl_qrng * q); - - -void * gsl_qrng_state (const gsl_qrng * q); - - -/* Retrieve next vector in sequence. */ -INLINE_DECL int gsl_qrng_get (const gsl_qrng * q, double x[]); - -#ifdef HAVE_INLINE -INLINE_FUN int gsl_qrng_get (const gsl_qrng * q, double x[]) -{ - return (q->type->get) (q->state, q->dimension, x); -} - -#endif /* HAVE_INLINE */ - - -__END_DECLS - - -#endif /* !__GSL_QRNG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_randist.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_randist.h deleted file mode 100644 index d38ccb36c..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_randist.h +++ /dev/null @@ -1,219 +0,0 @@ -/* randist/gsl_randist.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 James Theiler, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_RANDIST_H__ -#define __GSL_RANDIST_H__ -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -unsigned int gsl_ran_bernoulli (const gsl_rng * r, double p); -double gsl_ran_bernoulli_pdf (const unsigned int k, double p); - -double gsl_ran_beta (const gsl_rng * r, const double a, const double b); -double gsl_ran_beta_pdf (const double x, const double a, const double b); - -unsigned int gsl_ran_binomial (const gsl_rng * r, double p, unsigned int n); -unsigned int gsl_ran_binomial_knuth (const gsl_rng * r, double p, unsigned int n); -unsigned int gsl_ran_binomial_tpe (const gsl_rng * r, double p, unsigned int n); -double gsl_ran_binomial_pdf (const unsigned int k, const double p, const unsigned int n); - -double gsl_ran_exponential (const gsl_rng * r, const double mu); -double gsl_ran_exponential_pdf (const double x, const double mu); - -double gsl_ran_exppow (const gsl_rng * r, const double a, const double b); -double gsl_ran_exppow_pdf (const double x, const double a, const double b); - -double gsl_ran_cauchy (const gsl_rng * r, const double a); -double gsl_ran_cauchy_pdf (const double x, const double a); - -double gsl_ran_chisq (const gsl_rng * r, const double nu); -double gsl_ran_chisq_pdf (const double x, const double nu); - -void gsl_ran_dirichlet (const gsl_rng * r, const size_t K, const double alpha[], double theta[]); -double gsl_ran_dirichlet_pdf (const size_t K, const double alpha[], const double theta[]); -double gsl_ran_dirichlet_lnpdf (const size_t K, const double alpha[], const double theta[]); - -double gsl_ran_erlang (const gsl_rng * r, const double a, const double n); -double gsl_ran_erlang_pdf (const double x, const double a, const double n); - -double gsl_ran_fdist (const gsl_rng * r, const double nu1, const double nu2); -double gsl_ran_fdist_pdf (const double x, const double nu1, const double nu2); - -double gsl_ran_flat (const gsl_rng * r, const double a, const double b); -double gsl_ran_flat_pdf (double x, const double a, const double b); - -double gsl_ran_gamma (const gsl_rng * r, const double a, const double b); -double gsl_ran_gamma_int (const gsl_rng * r, const unsigned int a); -double gsl_ran_gamma_pdf (const double x, const double a, const double b); -double gsl_ran_gamma_mt (const gsl_rng * r, const double a, const double b); -double gsl_ran_gamma_knuth (const gsl_rng * r, const double a, const double b); - -double gsl_ran_gaussian (const gsl_rng * r, const double sigma); -double gsl_ran_gaussian_ratio_method (const gsl_rng * r, const double sigma); -double gsl_ran_gaussian_ziggurat (const gsl_rng * r, const double sigma); -double gsl_ran_gaussian_pdf (const double x, const double sigma); - -double gsl_ran_ugaussian (const gsl_rng * r); -double gsl_ran_ugaussian_ratio_method (const gsl_rng * r); -double gsl_ran_ugaussian_pdf (const double x); - -double gsl_ran_gaussian_tail (const gsl_rng * r, const double a, const double sigma); -double gsl_ran_gaussian_tail_pdf (const double x, const double a, const double sigma); - -double gsl_ran_ugaussian_tail (const gsl_rng * r, const double a); -double gsl_ran_ugaussian_tail_pdf (const double x, const double a); - -void gsl_ran_bivariate_gaussian (const gsl_rng * r, double sigma_x, double sigma_y, double rho, double *x, double *y); -double gsl_ran_bivariate_gaussian_pdf (const double x, const double y, const double sigma_x, const double sigma_y, const double rho); - -int gsl_ran_multivariate_gaussian (const gsl_rng * r, const gsl_vector * mu, const gsl_matrix * L, gsl_vector * result); -int gsl_ran_multivariate_gaussian_log_pdf (const gsl_vector * x, - const gsl_vector * mu, - const gsl_matrix * L, - double * result, - gsl_vector * work); -int gsl_ran_multivariate_gaussian_pdf (const gsl_vector * x, - const gsl_vector * mu, - const gsl_matrix * L, - double * result, - gsl_vector * work); -int gsl_ran_multivariate_gaussian_mean (const gsl_matrix * X, gsl_vector * mu_hat); -int gsl_ran_multivariate_gaussian_vcov (const gsl_matrix * X, gsl_matrix * sigma_hat); - -int gsl_ran_wishart (const gsl_rng * r, - const double df, - const gsl_matrix * L, - gsl_matrix * result, - gsl_matrix * work); -int gsl_ran_wishart_log_pdf (const gsl_matrix * X, - const gsl_matrix * L_X, - const double df, - const gsl_matrix * L, - double * result, - gsl_matrix * work); -int gsl_ran_wishart_pdf (const gsl_matrix * X, - const gsl_matrix * L_X, - const double df, - const gsl_matrix * L, - double * result, - gsl_matrix * work); - -double gsl_ran_landau (const gsl_rng * r); -double gsl_ran_landau_pdf (const double x); - -unsigned int gsl_ran_geometric (const gsl_rng * r, const double p); -double gsl_ran_geometric_pdf (const unsigned int k, const double p); - -unsigned int gsl_ran_hypergeometric (const gsl_rng * r, unsigned int n1, unsigned int n2, unsigned int t); -double gsl_ran_hypergeometric_pdf (const unsigned int k, const unsigned int n1, const unsigned int n2, unsigned int t); - -double gsl_ran_gumbel1 (const gsl_rng * r, const double a, const double b); -double gsl_ran_gumbel1_pdf (const double x, const double a, const double b); - -double gsl_ran_gumbel2 (const gsl_rng * r, const double a, const double b); -double gsl_ran_gumbel2_pdf (const double x, const double a, const double b); - -double gsl_ran_logistic (const gsl_rng * r, const double a); -double gsl_ran_logistic_pdf (const double x, const double a); - -double gsl_ran_lognormal (const gsl_rng * r, const double zeta, const double sigma); -double gsl_ran_lognormal_pdf (const double x, const double zeta, const double sigma); - -unsigned int gsl_ran_logarithmic (const gsl_rng * r, const double p); -double gsl_ran_logarithmic_pdf (const unsigned int k, const double p); - -void gsl_ran_multinomial (const gsl_rng * r, const size_t K, - const unsigned int N, const double p[], - unsigned int n[] ); -double gsl_ran_multinomial_pdf (const size_t K, - const double p[], const unsigned int n[] ); -double gsl_ran_multinomial_lnpdf (const size_t K, - const double p[], const unsigned int n[] ); - - -unsigned int gsl_ran_negative_binomial (const gsl_rng * r, double p, double n); -double gsl_ran_negative_binomial_pdf (const unsigned int k, const double p, double n); - -unsigned int gsl_ran_pascal (const gsl_rng * r, double p, unsigned int n); -double gsl_ran_pascal_pdf (const unsigned int k, const double p, unsigned int n); - -double gsl_ran_pareto (const gsl_rng * r, double a, const double b); -double gsl_ran_pareto_pdf (const double x, const double a, const double b); - -unsigned int gsl_ran_poisson (const gsl_rng * r, double mu); -void gsl_ran_poisson_array (const gsl_rng * r, size_t n, unsigned int array[], - double mu); -double gsl_ran_poisson_pdf (const unsigned int k, const double mu); - -double gsl_ran_rayleigh (const gsl_rng * r, const double sigma); -double gsl_ran_rayleigh_pdf (const double x, const double sigma); - -double gsl_ran_rayleigh_tail (const gsl_rng * r, const double a, const double sigma); -double gsl_ran_rayleigh_tail_pdf (const double x, const double a, const double sigma); - -double gsl_ran_tdist (const gsl_rng * r, const double nu); -double gsl_ran_tdist_pdf (const double x, const double nu); - -double gsl_ran_laplace (const gsl_rng * r, const double a); -double gsl_ran_laplace_pdf (const double x, const double a); - -double gsl_ran_levy (const gsl_rng * r, const double c, const double alpha); -double gsl_ran_levy_skew (const gsl_rng * r, const double c, const double alpha, const double beta); - -double gsl_ran_weibull (const gsl_rng * r, const double a, const double b); -double gsl_ran_weibull_pdf (const double x, const double a, const double b); - -void gsl_ran_dir_2d (const gsl_rng * r, double * x, double * y); -void gsl_ran_dir_2d_trig_method (const gsl_rng * r, double * x, double * y); -void gsl_ran_dir_3d (const gsl_rng * r, double * x, double * y, double * z); -void gsl_ran_dir_nd (const gsl_rng * r, size_t n, double * x); - -void gsl_ran_shuffle (const gsl_rng * r, void * base, size_t nmembm, size_t size); -int gsl_ran_choose (const gsl_rng * r, void * dest, size_t k, void * src, size_t n, size_t size) ; -void gsl_ran_sample (const gsl_rng * r, void * dest, size_t k, void * src, size_t n, size_t size) ; - - -typedef struct { /* struct for Walker algorithm */ - size_t K; - size_t *A; - double *F; -} gsl_ran_discrete_t; - -gsl_ran_discrete_t * gsl_ran_discrete_preproc (size_t K, const double *P); -void gsl_ran_discrete_free(gsl_ran_discrete_t *g); -size_t gsl_ran_discrete (const gsl_rng *r, const gsl_ran_discrete_t *g); -double gsl_ran_discrete_pdf (size_t k, const gsl_ran_discrete_t *g); - - -__END_DECLS - -#endif /* __GSL_RANDIST_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_rng.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_rng.h deleted file mode 100644 index 4ec55911c..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_rng.h +++ /dev/null @@ -1,217 +0,0 @@ -/* rng/gsl_rng.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 James Theiler, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_RNG_H__ -#define __GSL_RNG_H__ -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct - { - const char *name; - unsigned long int max; - unsigned long int min; - size_t size; - void (*set) (void *state, unsigned long int seed); - unsigned long int (*get) (void *state); - double (*get_double) (void *state); - } -gsl_rng_type; - -typedef struct - { - const gsl_rng_type * type; - void *state; - } -gsl_rng; - - -/* These structs also need to appear in default.c so you can select - them via the environment variable GSL_RNG_TYPE */ - -GSL_VAR const gsl_rng_type *gsl_rng_borosh13; -GSL_VAR const gsl_rng_type *gsl_rng_coveyou; -GSL_VAR const gsl_rng_type *gsl_rng_cmrg; -GSL_VAR const gsl_rng_type *gsl_rng_fishman18; -GSL_VAR const gsl_rng_type *gsl_rng_fishman20; -GSL_VAR const gsl_rng_type *gsl_rng_fishman2x; -GSL_VAR const gsl_rng_type *gsl_rng_gfsr4; -GSL_VAR const gsl_rng_type *gsl_rng_knuthran; -GSL_VAR const gsl_rng_type *gsl_rng_knuthran2; -GSL_VAR const gsl_rng_type *gsl_rng_knuthran2002; -GSL_VAR const gsl_rng_type *gsl_rng_lecuyer21; -GSL_VAR const gsl_rng_type *gsl_rng_minstd; -GSL_VAR const gsl_rng_type *gsl_rng_mrg; -GSL_VAR const gsl_rng_type *gsl_rng_mt19937; -GSL_VAR const gsl_rng_type *gsl_rng_mt19937_1999; -GSL_VAR const gsl_rng_type *gsl_rng_mt19937_1998; -GSL_VAR const gsl_rng_type *gsl_rng_r250; -GSL_VAR const gsl_rng_type *gsl_rng_ran0; -GSL_VAR const gsl_rng_type *gsl_rng_ran1; -GSL_VAR const gsl_rng_type *gsl_rng_ran2; -GSL_VAR const gsl_rng_type *gsl_rng_ran3; -GSL_VAR const gsl_rng_type *gsl_rng_rand; -GSL_VAR const gsl_rng_type *gsl_rng_rand48; -GSL_VAR const gsl_rng_type *gsl_rng_random128_bsd; -GSL_VAR const gsl_rng_type *gsl_rng_random128_glibc2; -GSL_VAR const gsl_rng_type *gsl_rng_random128_libc5; -GSL_VAR const gsl_rng_type *gsl_rng_random256_bsd; -GSL_VAR const gsl_rng_type *gsl_rng_random256_glibc2; -GSL_VAR const gsl_rng_type *gsl_rng_random256_libc5; -GSL_VAR const gsl_rng_type *gsl_rng_random32_bsd; -GSL_VAR const gsl_rng_type *gsl_rng_random32_glibc2; -GSL_VAR const gsl_rng_type *gsl_rng_random32_libc5; -GSL_VAR const gsl_rng_type *gsl_rng_random64_bsd; -GSL_VAR const gsl_rng_type *gsl_rng_random64_glibc2; -GSL_VAR const gsl_rng_type *gsl_rng_random64_libc5; -GSL_VAR const gsl_rng_type *gsl_rng_random8_bsd; -GSL_VAR const gsl_rng_type *gsl_rng_random8_glibc2; -GSL_VAR const gsl_rng_type *gsl_rng_random8_libc5; -GSL_VAR const gsl_rng_type *gsl_rng_random_bsd; -GSL_VAR const gsl_rng_type *gsl_rng_random_glibc2; -GSL_VAR const gsl_rng_type *gsl_rng_random_libc5; -GSL_VAR const gsl_rng_type *gsl_rng_randu; -GSL_VAR const gsl_rng_type *gsl_rng_ranf; -GSL_VAR const gsl_rng_type *gsl_rng_ranlux; -GSL_VAR const gsl_rng_type *gsl_rng_ranlux389; -GSL_VAR const gsl_rng_type *gsl_rng_ranlxd1; -GSL_VAR const gsl_rng_type *gsl_rng_ranlxd2; -GSL_VAR const gsl_rng_type *gsl_rng_ranlxs0; -GSL_VAR const gsl_rng_type *gsl_rng_ranlxs1; -GSL_VAR const gsl_rng_type *gsl_rng_ranlxs2; -GSL_VAR const gsl_rng_type *gsl_rng_ranmar; -GSL_VAR const gsl_rng_type *gsl_rng_slatec; -GSL_VAR const gsl_rng_type *gsl_rng_taus; -GSL_VAR const gsl_rng_type *gsl_rng_taus2; -GSL_VAR const gsl_rng_type *gsl_rng_taus113; -GSL_VAR const gsl_rng_type *gsl_rng_transputer; -GSL_VAR const gsl_rng_type *gsl_rng_tt800; -GSL_VAR const gsl_rng_type *gsl_rng_uni; -GSL_VAR const gsl_rng_type *gsl_rng_uni32; -GSL_VAR const gsl_rng_type *gsl_rng_vax; -GSL_VAR const gsl_rng_type *gsl_rng_waterman14; -GSL_VAR const gsl_rng_type *gsl_rng_zuf; - -const gsl_rng_type ** gsl_rng_types_setup(void); - -GSL_VAR const gsl_rng_type *gsl_rng_default; -GSL_VAR unsigned long int gsl_rng_default_seed; - -gsl_rng *gsl_rng_alloc (const gsl_rng_type * T); -int gsl_rng_memcpy (gsl_rng * dest, const gsl_rng * src); -gsl_rng *gsl_rng_clone (const gsl_rng * r); - -void gsl_rng_free (gsl_rng * r); - -void gsl_rng_set (const gsl_rng * r, unsigned long int seed); -unsigned long int gsl_rng_max (const gsl_rng * r); -unsigned long int gsl_rng_min (const gsl_rng * r); -const char *gsl_rng_name (const gsl_rng * r); - -int gsl_rng_fread (FILE * stream, gsl_rng * r); -int gsl_rng_fwrite (FILE * stream, const gsl_rng * r); - -size_t gsl_rng_size (const gsl_rng * r); -void * gsl_rng_state (const gsl_rng * r); - -void gsl_rng_print_state (const gsl_rng * r); - -const gsl_rng_type * gsl_rng_env_setup (void); - -INLINE_DECL unsigned long int gsl_rng_get (const gsl_rng * r); -INLINE_DECL double gsl_rng_uniform (const gsl_rng * r); -INLINE_DECL double gsl_rng_uniform_pos (const gsl_rng * r); -INLINE_DECL unsigned long int gsl_rng_uniform_int (const gsl_rng * r, unsigned long int n); - -#ifdef HAVE_INLINE - -INLINE_FUN unsigned long int -gsl_rng_get (const gsl_rng * r) -{ - return (r->type->get) (r->state); -} - -INLINE_FUN double -gsl_rng_uniform (const gsl_rng * r) -{ - return (r->type->get_double) (r->state); -} - -INLINE_FUN double -gsl_rng_uniform_pos (const gsl_rng * r) -{ - double x ; - do - { - x = (r->type->get_double) (r->state) ; - } - while (x == 0) ; - - return x ; -} - -/* Note: to avoid integer overflow in (range+1) we work with scale = - range/n = (max-min)/n rather than scale=(max-min+1)/n, this reduces - efficiency slightly but avoids having to check for the out of range - value. Note that range is typically O(2^32) so the addition of 1 - is negligible in most usage. */ - -INLINE_FUN unsigned long int -gsl_rng_uniform_int (const gsl_rng * r, unsigned long int n) -{ - unsigned long int offset = r->type->min; - unsigned long int range = r->type->max - offset; - unsigned long int scale; - unsigned long int k; - - if (n > range || n == 0) - { - GSL_ERROR_VAL ("invalid n, either 0 or exceeds maximum value of generator", - GSL_EINVAL, 0) ; - } - - scale = range / n; - - do - { - k = (((r->type->get) (r->state)) - offset) / scale; - } - while (k >= n); - - return k; -} -#endif /* HAVE_INLINE */ - -__END_DECLS - -#endif /* __GSL_RNG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_roots.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_roots.h deleted file mode 100644 index 46e458706..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_roots.h +++ /dev/null @@ -1,127 +0,0 @@ -/* roots/gsl_roots.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Reid Priedhorsky, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_ROOTS_H__ -#define __GSL_ROOTS_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct - { - const char *name; - size_t size; - int (*set) (void *state, gsl_function * f, double * root, double x_lower, double x_upper); - int (*iterate) (void *state, gsl_function * f, double * root, double * x_lower, double * x_upper); - } -gsl_root_fsolver_type; - -typedef struct - { - const gsl_root_fsolver_type * type; - gsl_function * function ; - double root ; - double x_lower; - double x_upper; - void *state; - } -gsl_root_fsolver; - -typedef struct - { - const char *name; - size_t size; - int (*set) (void *state, gsl_function_fdf * f, double * root); - int (*iterate) (void *state, gsl_function_fdf * f, double * root); - } -gsl_root_fdfsolver_type; - -typedef struct - { - const gsl_root_fdfsolver_type * type; - gsl_function_fdf * fdf ; - double root ; - void *state; - } -gsl_root_fdfsolver; - -gsl_root_fsolver * -gsl_root_fsolver_alloc (const gsl_root_fsolver_type * T); -void gsl_root_fsolver_free (gsl_root_fsolver * s); - -int gsl_root_fsolver_set (gsl_root_fsolver * s, - gsl_function * f, - double x_lower, double x_upper); - -int gsl_root_fsolver_iterate (gsl_root_fsolver * s); - -const char * gsl_root_fsolver_name (const gsl_root_fsolver * s); -double gsl_root_fsolver_root (const gsl_root_fsolver * s); -double gsl_root_fsolver_x_lower (const gsl_root_fsolver * s); -double gsl_root_fsolver_x_upper (const gsl_root_fsolver * s); - - -gsl_root_fdfsolver * -gsl_root_fdfsolver_alloc (const gsl_root_fdfsolver_type * T); - -int -gsl_root_fdfsolver_set (gsl_root_fdfsolver * s, - gsl_function_fdf * fdf, double root); - -int -gsl_root_fdfsolver_iterate (gsl_root_fdfsolver * s); - -void -gsl_root_fdfsolver_free (gsl_root_fdfsolver * s); - -const char * gsl_root_fdfsolver_name (const gsl_root_fdfsolver * s); -double gsl_root_fdfsolver_root (const gsl_root_fdfsolver * s); - -int -gsl_root_test_interval (double x_lower, double x_upper, double epsabs, double epsrel); - -int -gsl_root_test_residual (double f, double epsabs); - -int -gsl_root_test_delta (double x1, double x0, double epsabs, double epsrel); - -GSL_VAR const gsl_root_fsolver_type * gsl_root_fsolver_bisection; -GSL_VAR const gsl_root_fsolver_type * gsl_root_fsolver_brent; -GSL_VAR const gsl_root_fsolver_type * gsl_root_fsolver_falsepos; -GSL_VAR const gsl_root_fdfsolver_type * gsl_root_fdfsolver_newton; -GSL_VAR const gsl_root_fdfsolver_type * gsl_root_fdfsolver_secant; -GSL_VAR const gsl_root_fdfsolver_type * gsl_root_fdfsolver_steffenson; - -__END_DECLS - -#endif /* __GSL_ROOTS_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_rstat.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_rstat.h deleted file mode 100644 index f2aab6b17..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_rstat.h +++ /dev/null @@ -1,81 +0,0 @@ -/* rstat/gsl_rstat.h - * - * Copyright (C) 2015 Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_RSTAT_H__ -#define __GSL_RSTAT_H__ - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - double p; /* p-quantile */ - double q[5]; /* heights q_i */ - int npos[5]; /* positions n_i */ - double np[5]; /* desired positions n_i' */ - double dnp[5]; /* increments dn_i' */ - size_t n; /* number of data added */ -} gsl_rstat_quantile_workspace; - -gsl_rstat_quantile_workspace *gsl_rstat_quantile_alloc(const double p); -void gsl_rstat_quantile_free(gsl_rstat_quantile_workspace *w); -int gsl_rstat_quantile_reset(gsl_rstat_quantile_workspace *w); -int gsl_rstat_quantile_add(const double x, gsl_rstat_quantile_workspace *w); -double gsl_rstat_quantile_get(gsl_rstat_quantile_workspace *w); - -typedef struct -{ - double min; /* minimum value added */ - double max; /* maximum value added */ - double mean; /* current mean */ - double M2; /* M_k = sum_{i=1..n} [ x_i - mean_n ]^k */ - double M3; - double M4; - size_t n; /* number of data points added */ - gsl_rstat_quantile_workspace *median_workspace_p; /* median workspace */ -} gsl_rstat_workspace; - -gsl_rstat_workspace *gsl_rstat_alloc(void); -void gsl_rstat_free(gsl_rstat_workspace *w); -size_t gsl_rstat_n(const gsl_rstat_workspace *w); -int gsl_rstat_add(const double x, gsl_rstat_workspace *w); -double gsl_rstat_min(const gsl_rstat_workspace *w); -double gsl_rstat_max(const gsl_rstat_workspace *w); -double gsl_rstat_mean(const gsl_rstat_workspace *w); -double gsl_rstat_variance(const gsl_rstat_workspace *w); -double gsl_rstat_sd(const gsl_rstat_workspace *w); -double gsl_rstat_rms(const gsl_rstat_workspace *w); -double gsl_rstat_sd_mean(const gsl_rstat_workspace *w); -double gsl_rstat_median(gsl_rstat_workspace *w); -double gsl_rstat_skew(const gsl_rstat_workspace *w); -double gsl_rstat_kurtosis(const gsl_rstat_workspace *w); -int gsl_rstat_reset(gsl_rstat_workspace *w); - -__END_DECLS - -#endif /* __GSL_RSTAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf.h deleted file mode 100644 index cb9cafd2b..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Author: G. Jungman */ - -#ifndef __GSL_SF_H__ -#define __GSL_SF_H__ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#endif /* __GSL_SF_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_airy.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_airy.h deleted file mode 100644 index 703338306..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_airy.h +++ /dev/null @@ -1,139 +0,0 @@ -/* specfunc/gsl_sf_airy.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_AIRY_H__ -#define __GSL_SF_AIRY_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Airy function Ai(x) - * - * exceptions: GSL_EUNDRFLW - */ -int gsl_sf_airy_Ai_e(const double x, const gsl_mode_t mode, gsl_sf_result * result); -double gsl_sf_airy_Ai(const double x, gsl_mode_t mode); - - -/* Airy function Bi(x) - * - * exceptions: GSL_EOVRFLW - */ -int gsl_sf_airy_Bi_e(const double x, gsl_mode_t mode, gsl_sf_result * result); -double gsl_sf_airy_Bi(const double x, gsl_mode_t mode); - - -/* scaled Ai(x): - * Ai(x) x < 0 - * exp(+2/3 x^{3/2}) Ai(x) x > 0 - * - * exceptions: none - */ -int gsl_sf_airy_Ai_scaled_e(const double x, gsl_mode_t mode, gsl_sf_result * result); -double gsl_sf_airy_Ai_scaled(const double x, gsl_mode_t mode); - - -/* scaled Bi(x): - * Bi(x) x < 0 - * exp(-2/3 x^{3/2}) Bi(x) x > 0 - * - * exceptions: none - */ -int gsl_sf_airy_Bi_scaled_e(const double x, gsl_mode_t mode, gsl_sf_result * result); -double gsl_sf_airy_Bi_scaled(const double x, gsl_mode_t mode); - - -/* derivative Ai'(x) - * - * exceptions: GSL_EUNDRFLW - */ -int gsl_sf_airy_Ai_deriv_e(const double x, gsl_mode_t mode, gsl_sf_result * result); -double gsl_sf_airy_Ai_deriv(const double x, gsl_mode_t mode); - - -/* derivative Bi'(x) - * - * exceptions: GSL_EOVRFLW - */ -int gsl_sf_airy_Bi_deriv_e(const double x, gsl_mode_t mode, gsl_sf_result * result); -double gsl_sf_airy_Bi_deriv(const double x, gsl_mode_t mode); - - -/* scaled derivative Ai'(x): - * Ai'(x) x < 0 - * exp(+2/3 x^{3/2}) Ai'(x) x > 0 - * - * exceptions: none - */ -int gsl_sf_airy_Ai_deriv_scaled_e(const double x, gsl_mode_t mode, gsl_sf_result * result); -double gsl_sf_airy_Ai_deriv_scaled(const double x, gsl_mode_t mode); - - -/* scaled derivative: - * Bi'(x) x < 0 - * exp(-2/3 x^{3/2}) Bi'(x) x > 0 - * - * exceptions: none - */ -int gsl_sf_airy_Bi_deriv_scaled_e(const double x, gsl_mode_t mode, gsl_sf_result * result); -double gsl_sf_airy_Bi_deriv_scaled(const double x, gsl_mode_t mode); - - -/* Zeros of Ai(x) - */ -int gsl_sf_airy_zero_Ai_e(unsigned int s, gsl_sf_result * result); -double gsl_sf_airy_zero_Ai(unsigned int s); - - -/* Zeros of Bi(x) - */ -int gsl_sf_airy_zero_Bi_e(unsigned int s, gsl_sf_result * result); -double gsl_sf_airy_zero_Bi(unsigned int s); - - -/* Zeros of Ai'(x) - */ -int gsl_sf_airy_zero_Ai_deriv_e(unsigned int s, gsl_sf_result * result); -double gsl_sf_airy_zero_Ai_deriv(unsigned int s); - - -/* Zeros of Bi'(x) - */ -int gsl_sf_airy_zero_Bi_deriv_e(unsigned int s, gsl_sf_result * result); -double gsl_sf_airy_zero_Bi_deriv(unsigned int s); - - -__END_DECLS - -#endif /* __GSL_SF_AIRY_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_bessel.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_bessel.h deleted file mode 100644 index d72957aeb..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_bessel.h +++ /dev/null @@ -1,549 +0,0 @@ -/* specfunc/gsl_sf_bessel.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_BESSEL_H__ -#define __GSL_SF_BESSEL_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Regular Bessel Function J_0(x) - * - * exceptions: none - */ -int gsl_sf_bessel_J0_e(const double x, gsl_sf_result * result); -double gsl_sf_bessel_J0(const double x); - - -/* Regular Bessel Function J_1(x) - * - * exceptions: GSL_EUNDRFLW - */ -int gsl_sf_bessel_J1_e(const double x, gsl_sf_result * result); -double gsl_sf_bessel_J1(const double x); - - -/* Regular Bessel Function J_n(x) - * - * exceptions: GSL_EUNDRFLW - */ -int gsl_sf_bessel_Jn_e(int n, double x, gsl_sf_result * result); -double gsl_sf_bessel_Jn(const int n, const double x); - - -/* Regular Bessel Function J_n(x), nmin <= n <= nmax - * - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_bessel_Jn_array(int nmin, int nmax, double x, double * result_array); - - -/* Irregular Bessel function Y_0(x) - * - * x > 0.0 - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_bessel_Y0_e(const double x, gsl_sf_result * result); -double gsl_sf_bessel_Y0(const double x); - - -/* Irregular Bessel function Y_1(x) - * - * x > 0.0 - * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_bessel_Y1_e(const double x, gsl_sf_result * result); -double gsl_sf_bessel_Y1(const double x); - - -/* Irregular Bessel function Y_n(x) - * - * x > 0.0 - * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_bessel_Yn_e(int n,const double x, gsl_sf_result * result); -double gsl_sf_bessel_Yn(const int n,const double x); - - -/* Irregular Bessel function Y_n(x), nmin <= n <= nmax - * - * x > 0.0 - * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_bessel_Yn_array(const int nmin, const int nmax, const double x, double * result_array); - - -/* Regular modified Bessel function I_0(x) - * - * exceptions: GSL_EOVRFLW - */ -int gsl_sf_bessel_I0_e(const double x, gsl_sf_result * result); -double gsl_sf_bessel_I0(const double x); - - -/* Regular modified Bessel function I_1(x) - * - * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_bessel_I1_e(const double x, gsl_sf_result * result); -double gsl_sf_bessel_I1(const double x); - - -/* Regular modified Bessel function I_n(x) - * - * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_bessel_In_e(const int n, const double x, gsl_sf_result * result); -double gsl_sf_bessel_In(const int n, const double x); - - -/* Regular modified Bessel function I_n(x) for n=nmin,...,nmax - * - * nmin >=0, nmax >= nmin - * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_bessel_In_array(const int nmin, const int nmax, const double x, double * result_array); - - -/* Scaled regular modified Bessel function - * exp(-|x|) I_0(x) - * - * exceptions: none - */ -int gsl_sf_bessel_I0_scaled_e(const double x, gsl_sf_result * result); -double gsl_sf_bessel_I0_scaled(const double x); - - -/* Scaled regular modified Bessel function - * exp(-|x|) I_1(x) - * - * exceptions: GSL_EUNDRFLW - */ -int gsl_sf_bessel_I1_scaled_e(const double x, gsl_sf_result * result); -double gsl_sf_bessel_I1_scaled(const double x); - - -/* Scaled regular modified Bessel function - * exp(-|x|) I_n(x) - * - * exceptions: GSL_EUNDRFLW - */ -int gsl_sf_bessel_In_scaled_e(int n, const double x, gsl_sf_result * result); -double gsl_sf_bessel_In_scaled(const int n, const double x); - - -/* Scaled regular modified Bessel function - * exp(-|x|) I_n(x) for n=nmin,...,nmax - * - * nmin >=0, nmax >= nmin - * exceptions: GSL_EUNDRFLW - */ -int gsl_sf_bessel_In_scaled_array(const int nmin, const int nmax, const double x, double * result_array); - - -/* Irregular modified Bessel function K_0(x) - * - * x > 0.0 - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_bessel_K0_e(const double x, gsl_sf_result * result); -double gsl_sf_bessel_K0(const double x); - - -/* Irregular modified Bessel function K_1(x) - * - * x > 0.0 - * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_bessel_K1_e(const double x, gsl_sf_result * result); -double gsl_sf_bessel_K1(const double x); - - -/* Irregular modified Bessel function K_n(x) - * - * x > 0.0 - * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_bessel_Kn_e(const int n, const double x, gsl_sf_result * result); -double gsl_sf_bessel_Kn(const int n, const double x); - - -/* Irregular modified Bessel function K_n(x) for n=nmin,...,nmax - * - * x > 0.0, nmin >=0, nmax >= nmin - * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_bessel_Kn_array(const int nmin, const int nmax, const double x, double * result_array); - - -/* Scaled irregular modified Bessel function - * exp(x) K_0(x) - * - * x > 0.0 - * exceptions: GSL_EDOM - */ -int gsl_sf_bessel_K0_scaled_e(const double x, gsl_sf_result * result); -double gsl_sf_bessel_K0_scaled(const double x); - - -/* Scaled irregular modified Bessel function - * exp(x) K_1(x) - * - * x > 0.0 - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_bessel_K1_scaled_e(const double x, gsl_sf_result * result); -double gsl_sf_bessel_K1_scaled(const double x); - - -/* Scaled irregular modified Bessel function - * exp(x) K_n(x) - * - * x > 0.0 - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_bessel_Kn_scaled_e(int n, const double x, gsl_sf_result * result); -double gsl_sf_bessel_Kn_scaled(const int n, const double x); - - -/* Scaled irregular modified Bessel function exp(x) K_n(x) for n=nmin,...,nmax - * - * x > 0.0, nmin >=0, nmax >= nmin - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_bessel_Kn_scaled_array(const int nmin, const int nmax, const double x, double * result_array); - - -/* Regular spherical Bessel function j_0(x) = sin(x)/x - * - * exceptions: none - */ -int gsl_sf_bessel_j0_e(const double x, gsl_sf_result * result); -double gsl_sf_bessel_j0(const double x); - - -/* Regular spherical Bessel function j_1(x) = (sin(x)/x - cos(x))/x - * - * exceptions: GSL_EUNDRFLW - */ -int gsl_sf_bessel_j1_e(const double x, gsl_sf_result * result); -double gsl_sf_bessel_j1(const double x); - - -/* Regular spherical Bessel function j_2(x) = ((3/x^2 - 1)sin(x) - 3cos(x)/x)/x - * - * exceptions: GSL_EUNDRFLW - */ -int gsl_sf_bessel_j2_e(const double x, gsl_sf_result * result); -double gsl_sf_bessel_j2(const double x); - - -/* Regular spherical Bessel function j_l(x) - * - * l >= 0, x >= 0.0 - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_bessel_jl_e(const int l, const double x, gsl_sf_result * result); -double gsl_sf_bessel_jl(const int l, const double x); - - -/* Regular spherical Bessel function j_l(x) for l=0,1,...,lmax - * - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_bessel_jl_array(const int lmax, const double x, double * result_array); - - -/* Regular spherical Bessel function j_l(x) for l=0,1,...,lmax - * Uses Steed's method. - * - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_bessel_jl_steed_array(const int lmax, const double x, double * jl_x_array); - - -/* Irregular spherical Bessel function y_0(x) - * - * exceptions: none - */ -int gsl_sf_bessel_y0_e(const double x, gsl_sf_result * result); -double gsl_sf_bessel_y0(const double x); - - -/* Irregular spherical Bessel function y_1(x) - * - * exceptions: GSL_EUNDRFLW - */ -int gsl_sf_bessel_y1_e(const double x, gsl_sf_result * result); -double gsl_sf_bessel_y1(const double x); - - -/* Irregular spherical Bessel function y_2(x) - * - * exceptions: GSL_EUNDRFLW - */ -int gsl_sf_bessel_y2_e(const double x, gsl_sf_result * result); -double gsl_sf_bessel_y2(const double x); - - -/* Irregular spherical Bessel function y_l(x) - * - * exceptions: GSL_EUNDRFLW - */ -int gsl_sf_bessel_yl_e(int l, const double x, gsl_sf_result * result); -double gsl_sf_bessel_yl(const int l, const double x); - - -/* Irregular spherical Bessel function y_l(x) for l=0,1,...,lmax - * - * exceptions: GSL_EUNDRFLW - */ -int gsl_sf_bessel_yl_array(const int lmax, const double x, double * result_array); - - -/* Regular scaled modified spherical Bessel function - * - * Exp[-|x|] i_0(x) - * - * exceptions: none - */ -int gsl_sf_bessel_i0_scaled_e(const double x, gsl_sf_result * result); -double gsl_sf_bessel_i0_scaled(const double x); - - -/* Regular scaled modified spherical Bessel function - * - * Exp[-|x|] i_1(x) - * - * exceptions: GSL_EUNDRFLW - */ -int gsl_sf_bessel_i1_scaled_e(const double x, gsl_sf_result * result); -double gsl_sf_bessel_i1_scaled(const double x); - - -/* Regular scaled modified spherical Bessel function - * - * Exp[-|x|] i_2(x) - * - * exceptions: GSL_EUNDRFLW - */ -int gsl_sf_bessel_i2_scaled_e(const double x, gsl_sf_result * result); -double gsl_sf_bessel_i2_scaled(const double x); - - -/* Regular scaled modified spherical Bessel functions - * - * Exp[-|x|] i_l(x) - * - * i_l(x) = Sqrt[Pi/(2x)] BesselI[l+1/2,x] - * - * l >= 0 - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_bessel_il_scaled_e(const int l, double x, gsl_sf_result * result); -double gsl_sf_bessel_il_scaled(const int l, const double x); - - -/* Regular scaled modified spherical Bessel functions - * - * Exp[-|x|] i_l(x) - * for l=0,1,...,lmax - * - * exceptions: GSL_EUNDRFLW - */ -int gsl_sf_bessel_il_scaled_array(const int lmax, const double x, double * result_array); - - -/* Irregular scaled modified spherical Bessel function - * Exp[x] k_0(x) - * - * x > 0.0 - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_bessel_k0_scaled_e(const double x, gsl_sf_result * result); -double gsl_sf_bessel_k0_scaled(const double x); - - -/* Irregular modified spherical Bessel function - * Exp[x] k_1(x) - * - * x > 0.0 - * exceptions: GSL_EDOM, GSL_EUNDRFLW, GSL_EOVRFLW - */ -int gsl_sf_bessel_k1_scaled_e(const double x, gsl_sf_result * result); -double gsl_sf_bessel_k1_scaled(const double x); - - -/* Irregular modified spherical Bessel function - * Exp[x] k_2(x) - * - * x > 0.0 - * exceptions: GSL_EDOM, GSL_EUNDRFLW, GSL_EOVRFLW - */ -int gsl_sf_bessel_k2_scaled_e(const double x, gsl_sf_result * result); -double gsl_sf_bessel_k2_scaled(const double x); - - -/* Irregular modified spherical Bessel function - * Exp[x] k_l[x] - * - * k_l(x) = Sqrt[Pi/(2x)] BesselK[l+1/2,x] - * - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_bessel_kl_scaled_e(int l, const double x, gsl_sf_result * result); -double gsl_sf_bessel_kl_scaled(const int l, const double x); - - -/* Irregular scaled modified spherical Bessel function - * Exp[x] k_l(x) - * - * for l=0,1,...,lmax - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_bessel_kl_scaled_array(const int lmax, const double x, double * result_array); - - -/* Regular cylindrical Bessel function J_nu(x) - * - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_bessel_Jnu_e(const double nu, const double x, gsl_sf_result * result); -double gsl_sf_bessel_Jnu(const double nu, const double x); - - -/* Irregular cylindrical Bessel function Y_nu(x) - * - * exceptions: - */ -int gsl_sf_bessel_Ynu_e(double nu, double x, gsl_sf_result * result); -double gsl_sf_bessel_Ynu(const double nu, const double x); - - -/* Regular cylindrical Bessel function J_nu(x) - * evaluated at a series of x values. The array - * contains the x values. They are assumed to be - * strictly ordered and positive. The array is - * over-written with the values of J_nu(x_i). - * - * exceptions: GSL_EDOM, GSL_EINVAL - */ -int gsl_sf_bessel_sequence_Jnu_e(double nu, gsl_mode_t mode, size_t size, double * v); - - -/* Scaled modified cylindrical Bessel functions - * - * Exp[-|x|] BesselI[nu, x] - * x >= 0, nu >= 0 - * - * exceptions: GSL_EDOM - */ -int gsl_sf_bessel_Inu_scaled_e(double nu, double x, gsl_sf_result * result); -double gsl_sf_bessel_Inu_scaled(double nu, double x); - - -/* Modified cylindrical Bessel functions - * - * BesselI[nu, x] - * x >= 0, nu >= 0 - * - * exceptions: GSL_EDOM, GSL_EOVRFLW - */ -int gsl_sf_bessel_Inu_e(double nu, double x, gsl_sf_result * result); -double gsl_sf_bessel_Inu(double nu, double x); - - -/* Scaled modified cylindrical Bessel functions - * - * Exp[+|x|] BesselK[nu, x] - * x > 0, nu >= 0 - * - * exceptions: GSL_EDOM - */ -int gsl_sf_bessel_Knu_scaled_e(const double nu, const double x, gsl_sf_result * result); -double gsl_sf_bessel_Knu_scaled(const double nu, const double x); - -int gsl_sf_bessel_Knu_scaled_e10_e(const double nu, const double x, gsl_sf_result_e10 * result); - -/* Modified cylindrical Bessel functions - * - * BesselK[nu, x] - * x > 0, nu >= 0 - * - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_bessel_Knu_e(const double nu, const double x, gsl_sf_result * result); -double gsl_sf_bessel_Knu(const double nu, const double x); - - -/* Logarithm of modified cylindrical Bessel functions. - * - * Log[BesselK[nu, x]] - * x > 0, nu >= 0 - * - * exceptions: GSL_EDOM - */ -int gsl_sf_bessel_lnKnu_e(const double nu, const double x, gsl_sf_result * result); -double gsl_sf_bessel_lnKnu(const double nu, const double x); - - -/* s'th positive zero of the Bessel function J_0(x). - * - * exceptions: - */ -int gsl_sf_bessel_zero_J0_e(unsigned int s, gsl_sf_result * result); -double gsl_sf_bessel_zero_J0(unsigned int s); - - -/* s'th positive zero of the Bessel function J_1(x). - * - * exceptions: - */ -int gsl_sf_bessel_zero_J1_e(unsigned int s, gsl_sf_result * result); -double gsl_sf_bessel_zero_J1(unsigned int s); - - -/* s'th positive zero of the Bessel function J_nu(x). - * - * exceptions: - */ -int gsl_sf_bessel_zero_Jnu_e(double nu, unsigned int s, gsl_sf_result * result); -double gsl_sf_bessel_zero_Jnu(double nu, unsigned int s); - - -__END_DECLS - -#endif /* __GSL_SF_BESSEL_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_clausen.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_clausen.h deleted file mode 100644 index 8e4ccd244..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_clausen.h +++ /dev/null @@ -1,52 +0,0 @@ -/* specfunc/gsl_sf_clausen.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_CLAUSEN_H__ -#define __GSL_SF_CLAUSEN_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Calculate the Clausen integral: - * Cl_2(x) := Integrate[-Log[2 Sin[t/2]], {t,0,x}] - * - * Relation to dilogarithm: - * Cl_2(theta) = Im[ Li_2(e^(i theta)) ] - */ -int gsl_sf_clausen_e(double x, gsl_sf_result * result); -double gsl_sf_clausen(const double x); - - -__END_DECLS - -#endif /* __GSL_SF_CLAUSEN_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_coulomb.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_coulomb.h deleted file mode 100644 index 764a5714d..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_coulomb.h +++ /dev/null @@ -1,128 +0,0 @@ -/* specfunc/gsl_sf_coulomb.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_COULOMB_H__ -#define __GSL_SF_COULOMB_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Normalized hydrogenic bound states, radial dependence. */ - -/* R_1 := 2Z sqrt(Z) exp(-Z r) - */ -int gsl_sf_hydrogenicR_1_e(const double Z, const double r, gsl_sf_result * result); -double gsl_sf_hydrogenicR_1(const double Z, const double r); - -/* R_n := norm exp(-Z r/n) (2Z/n)^l Laguerre[n-l-1, 2l+1, 2Z/n r] - * - * normalization such that psi(n,l,r) = R_n Y_{lm} - */ -int gsl_sf_hydrogenicR_e(const int n, const int l, const double Z, const double r, gsl_sf_result * result); -double gsl_sf_hydrogenicR(const int n, const int l, const double Z, const double r); - - -/* Coulomb wave functions F_{lam_F}(eta,x), G_{lam_G}(eta,x) - * and their derivatives; lam_G := lam_F - k_lam_G - * - * lam_F, lam_G > -0.5 - * x > 0.0 - * - * Conventions of Abramowitz+Stegun. - * - * Because there can be a large dynamic range of values, - * overflows are handled gracefully. If an overflow occurs, - * GSL_EOVRFLW is signalled and exponent(s) are returned - * through exp_F, exp_G. These are such that - * - * F_L(eta,x) = fc[k_L] * exp(exp_F) - * G_L(eta,x) = gc[k_L] * exp(exp_G) - * F_L'(eta,x) = fcp[k_L] * exp(exp_F) - * G_L'(eta,x) = gcp[k_L] * exp(exp_G) - */ -int -gsl_sf_coulomb_wave_FG_e(const double eta, const double x, - const double lam_F, - const int k_lam_G, - gsl_sf_result * F, gsl_sf_result * Fp, - gsl_sf_result * G, gsl_sf_result * Gp, - double * exp_F, double * exp_G); - - -/* F_L(eta,x) as array */ -int gsl_sf_coulomb_wave_F_array( - double lam_min, int kmax, - double eta, double x, - double * fc_array, - double * F_exponent - ); - -/* F_L(eta,x), G_L(eta,x) as arrays */ -int gsl_sf_coulomb_wave_FG_array(double lam_min, int kmax, - double eta, double x, - double * fc_array, double * gc_array, - double * F_exponent, - double * G_exponent - ); - -/* F_L(eta,x), G_L(eta,x), F'_L(eta,x), G'_L(eta,x) as arrays */ -int gsl_sf_coulomb_wave_FGp_array(double lam_min, int kmax, - double eta, double x, - double * fc_array, double * fcp_array, - double * gc_array, double * gcp_array, - double * F_exponent, - double * G_exponent - ); - -/* Coulomb wave function divided by the argument, - * F(eta, x)/x. This is the function which reduces to - * spherical Bessel functions in the limit eta->0. - */ -int gsl_sf_coulomb_wave_sphF_array(double lam_min, int kmax, - double eta, double x, - double * fc_array, - double * F_exponent - ); - - -/* Coulomb wave function normalization constant. - * [Abramowitz+Stegun 14.1.8, 14.1.9] - */ -int gsl_sf_coulomb_CL_e(double L, double eta, gsl_sf_result * result); -int gsl_sf_coulomb_CL_array(double Lmin, int kmax, double eta, double * cl); - - -__END_DECLS - -#endif /* __GSL_SF_COULOMB_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_coupling.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_coupling.h deleted file mode 100644 index c46b9f583..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_coupling.h +++ /dev/null @@ -1,125 +0,0 @@ -/* specfunc/gsl_sf_coupling.h - * - * Copyright (C) 1996,1997,1998,1999,2000,2001,2002 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_COUPLING_H__ -#define __GSL_SF_COUPLING_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* 3j Symbols: / ja jb jc \ - * \ ma mb mc / - * - * exceptions: GSL_EDOM, GSL_EOVRFLW - */ -int gsl_sf_coupling_3j_e(int two_ja, int two_jb, int two_jc, - int two_ma, int two_mb, int two_mc, - gsl_sf_result * result - ); -double gsl_sf_coupling_3j(int two_ja, int two_jb, int two_jc, - int two_ma, int two_mb, int two_mc - ); - - -/* 6j Symbols: / ja jb jc \ - * \ jd je jf / - * - * exceptions: GSL_EDOM, GSL_EOVRFLW - */ -int gsl_sf_coupling_6j_e(int two_ja, int two_jb, int two_jc, - int two_jd, int two_je, int two_jf, - gsl_sf_result * result - ); -double gsl_sf_coupling_6j(int two_ja, int two_jb, int two_jc, - int two_jd, int two_je, int two_jf - ); - -/* Racah W coefficients: - * - * W(a b c d; e f) = (-1)^{a+b+c+d} / a b e \ - * \ d c f / - * - * exceptions: GSL_EDOM, GSL_EOVRFLW - */ -int gsl_sf_coupling_RacahW_e(int two_ja, int two_jb, int two_jc, - int two_jd, int two_je, int two_jf, - gsl_sf_result * result - ); -double gsl_sf_coupling_RacahW(int two_ja, int two_jb, int two_jc, - int two_jd, int two_je, int two_jf - ); - - -/* 9j Symbols: / ja jb jc \ - * | jd je jf | - * \ jg jh ji / - * - * exceptions: GSL_EDOM, GSL_EOVRFLW - */ -int gsl_sf_coupling_9j_e(int two_ja, int two_jb, int two_jc, - int two_jd, int two_je, int two_jf, - int two_jg, int two_jh, int two_ji, - gsl_sf_result * result - ); -double gsl_sf_coupling_9j(int two_ja, int two_jb, int two_jc, - int two_jd, int two_je, int two_jf, - int two_jg, int two_jh, int two_ji - ); - - -/* INCORRECT version of 6j Symbols: - * This function actually calculates - * / ja jb je \ - * \ jd jc jf / - * It represents the original implementation, - * which had the above permutation of the - * arguments. This was wrong and confusing, - * and I had to fix it. Sorry for the trouble. - * [GJ] Tue Nov 26 12:53:39 MST 2002 - * - * exceptions: GSL_EDOM, GSL_EOVRFLW - */ -#ifndef GSL_DISABLE_DEPRECATED -int gsl_sf_coupling_6j_INCORRECT_e(int two_ja, int two_jb, int two_jc, - int two_jd, int two_je, int two_jf, - gsl_sf_result * result - ); -double gsl_sf_coupling_6j_INCORRECT(int two_ja, int two_jb, int two_jc, - int two_jd, int two_je, int two_jf - ); -#endif /* !GSL_DISABLE_DEPRECATED */ - - -__END_DECLS - -#endif /* __GSL_SF_COUPLING_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_dawson.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_dawson.h deleted file mode 100644 index 7c11f9f41..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_dawson.h +++ /dev/null @@ -1,52 +0,0 @@ -/* specfunc/gsl_sf_dawson.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_DAWSON_H__ -#define __GSL_SF_DAWSON_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Dawson's integral: - * - * Exp[-x^2] Integral[ Exp[t^2], {t,0,x}] - * - * exceptions: GSL_EUNDRFLW; - */ -int gsl_sf_dawson_e(double x, gsl_sf_result * result); -double gsl_sf_dawson(double x); - - -__END_DECLS - -#endif /* __GSL_SF_DAWSON_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_debye.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_debye.h deleted file mode 100644 index bc732b17b..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_debye.h +++ /dev/null @@ -1,91 +0,0 @@ -/* specfunc/gsl_sf_debye.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ -/* augmented by D_5(x) and D_6(x) by Richard J. Mathar, 2005-11-08 */ - -#ifndef __GSL_SF_DEBYE_H__ -#define __GSL_SF_DEBYE_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* D_n(x) := n/x^n Integrate[t^n/(e^t - 1), {t,0,x}] */ - -/* D_1(x) - * - * exceptions: GSL_EDOM - */ -int gsl_sf_debye_1_e(const double x, gsl_sf_result * result); -double gsl_sf_debye_1(const double x); - - -/* D_2(x) - * - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_debye_2_e(const double x, gsl_sf_result * result); -double gsl_sf_debye_2(const double x); - - -/* D_3(x) - * - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_debye_3_e(const double x, gsl_sf_result * result); -double gsl_sf_debye_3(const double x); - - -/* D_4(x) - * - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_debye_4_e(const double x, gsl_sf_result * result); -double gsl_sf_debye_4(const double x); - -/* D_5(x) - * - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_debye_5_e(const double x, gsl_sf_result * result); -double gsl_sf_debye_5(const double x); - -/* D_6(x) - * - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_debye_6_e(const double x, gsl_sf_result * result); -double gsl_sf_debye_6(const double x); - - -__END_DECLS - -#endif /* __GSL_SF_DEBYE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_dilog.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_dilog.h deleted file mode 100644 index 79b2b76f5..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_dilog.h +++ /dev/null @@ -1,130 +0,0 @@ -/* specfunc/gsl_sf_dilog.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_DILOG_H__ -#define __GSL_SF_DILOG_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Real part of DiLogarithm(x), for real argument. - * In Lewin's notation, this is Li_2(x). - * - * Li_2(x) = - Re[ Integrate[ Log[1-s] / s, {s, 0, x}] ] - * - * The function in the complex plane has a branch point - * at z = 1; we place the cut in the conventional way, - * on [1, +infty). This means that the value for real x > 1 - * is a matter of definition; however, this choice does not - * affect the real part and so is not relevant to the - * interpretation of this implemented function. - */ -int gsl_sf_dilog_e(const double x, gsl_sf_result * result); -double gsl_sf_dilog(const double x); - - -/* DiLogarithm(z), for complex argument z = x + i y. - * Computes the principal branch. - * - * Recall that the branch cut is on the real axis with x > 1. - * The imaginary part of the computed value on the cut is given - * by -Pi*log(x), which is the limiting value taken approaching - * from y < 0. This is a conventional choice, though there is no - * true standardized choice. - * - * Note that there is no canonical way to lift the defining - * contour to the full Riemann surface because of the appearance - * of a "hidden branch point" at z = 0 on non-principal sheets. - * Experts will know the simple algebraic prescription for - * obtaining the sheet they want; non-experts will not want - * to know anything about it. This is why GSL chooses to compute - * only on the principal branch. - */ -int -gsl_sf_complex_dilog_xy_e( - const double x, - const double y, - gsl_sf_result * result_re, - gsl_sf_result * result_im - ); - - - -/* DiLogarithm(z), for complex argument z = r Exp[i theta]. - * Computes the principal branch, thereby assuming an - * implicit reduction of theta to the range (-2 pi, 2 pi). - * - * If theta is identically zero, the imaginary part is computed - * as if approaching from y > 0. For other values of theta no - * special consideration is given, since it is assumed that - * no other machine representations of multiples of pi will - * produce y = 0 precisely. This assumption depends on some - * subtle properties of the machine arithmetic, such as - * correct rounding and monotonicity of the underlying - * implementation of sin() and cos(). - * - * This function is ok, but the interface is confusing since - * it makes it appear that the branch structure is resolved. - * Furthermore the handling of values close to the branch - * cut is subtle. Perhap this interface should be deprecated. - */ -int -gsl_sf_complex_dilog_e( - const double r, - const double theta, - gsl_sf_result * result_re, - gsl_sf_result * result_im - ); - - - -/* Spence integral; spence(s) := Li_2(1-s) - * - * This function has a branch point at 0; we place the - * cut on (-infty,0). Because of our choice for the value - * of Li_2(z) on the cut, spence(s) is continuous as - * s approaches the cut from above. In other words, - * we define spence(x) = spence(x + i 0+). - */ -int -gsl_sf_complex_spence_xy_e( - const double x, - const double y, - gsl_sf_result * real_sp, - gsl_sf_result * imag_sp - ); - - -__END_DECLS - -#endif /* __GSL_SF_DILOG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_elementary.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_elementary.h deleted file mode 100644 index 467bfdaab..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_elementary.h +++ /dev/null @@ -1,57 +0,0 @@ -/* specfunc/gsl_sf_elementary.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -/* Miscellaneous elementary functions and operations. - */ -#ifndef __GSL_SF_ELEMENTARY_H__ -#define __GSL_SF_ELEMENTARY_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Multiplication. - * - * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_multiply_e(const double x, const double y, gsl_sf_result * result); -double gsl_sf_multiply(const double x, const double y); - - -/* Multiplication of quantities with associated errors. - */ -int gsl_sf_multiply_err_e(const double x, const double dx, const double y, const double dy, gsl_sf_result * result); - - -__END_DECLS - -#endif /* __GSL_SF_ELEMENTARY_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_ellint.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_ellint.h deleted file mode 100644 index 7f68f0e29..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_ellint.h +++ /dev/null @@ -1,112 +0,0 @@ -/* specfunc/gsl_sf_ellint.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_ELLINT_H__ -#define __GSL_SF_ELLINT_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Legendre form of complete elliptic integrals - * - * K(k) = Integral[1/Sqrt[1 - k^2 Sin[t]^2], {t, 0, Pi/2}] - * E(k) = Integral[ Sqrt[1 - k^2 Sin[t]^2], {t, 0, Pi/2}] - * - * exceptions: GSL_EDOM - */ -int gsl_sf_ellint_Kcomp_e(double k, gsl_mode_t mode, gsl_sf_result * result); -double gsl_sf_ellint_Kcomp(double k, gsl_mode_t mode); - -int gsl_sf_ellint_Ecomp_e(double k, gsl_mode_t mode, gsl_sf_result * result); -double gsl_sf_ellint_Ecomp(double k, gsl_mode_t mode); - -int gsl_sf_ellint_Pcomp_e(double k, double n, gsl_mode_t mode, gsl_sf_result * result); -double gsl_sf_ellint_Pcomp(double k, double n, gsl_mode_t mode); - -int gsl_sf_ellint_Dcomp_e(double k, gsl_mode_t mode, gsl_sf_result * result); -double gsl_sf_ellint_Dcomp(double k, gsl_mode_t mode); - - -/* Legendre form of incomplete elliptic integrals - * - * F(phi,k) = Integral[1/Sqrt[1 - k^2 Sin[t]^2], {t, 0, phi}] - * E(phi,k) = Integral[ Sqrt[1 - k^2 Sin[t]^2], {t, 0, phi}] - * P(phi,k,n) = Integral[(1 + n Sin[t]^2)^(-1)/Sqrt[1 - k^2 Sin[t]^2], {t, 0, phi}] - * D(phi,k,n) = R_D(1-Sin[phi]^2, 1-k^2 Sin[phi]^2, 1.0) - * - * F: [Carlson, Numerische Mathematik 33 (1979) 1, (4.1)] - * E: [Carlson, ", (4.2)] - * P: [Carlson, ", (4.3)] - * D: [Carlson, ", (4.4)] - * - * exceptions: GSL_EDOM - */ -int gsl_sf_ellint_F_e(double phi, double k, gsl_mode_t mode, gsl_sf_result * result); -double gsl_sf_ellint_F(double phi, double k, gsl_mode_t mode); - -int gsl_sf_ellint_E_e(double phi, double k, gsl_mode_t mode, gsl_sf_result * result); -double gsl_sf_ellint_E(double phi, double k, gsl_mode_t mode); - -int gsl_sf_ellint_P_e(double phi, double k, double n, gsl_mode_t mode, gsl_sf_result * result); -double gsl_sf_ellint_P(double phi, double k, double n, gsl_mode_t mode); - -int gsl_sf_ellint_D_e(double phi, double k, gsl_mode_t mode, gsl_sf_result * result); -double gsl_sf_ellint_D(double phi, double k, gsl_mode_t mode); - - -/* Carlson's symmetric basis of functions - * - * RC(x,y) = 1/2 Integral[(t+x)^(-1/2) (t+y)^(-1)], {t,0,Inf}] - * RD(x,y,z) = 3/2 Integral[(t+x)^(-1/2) (t+y)^(-1/2) (t+z)^(-3/2), {t,0,Inf}] - * RF(x,y,z) = 1/2 Integral[(t+x)^(-1/2) (t+y)^(-1/2) (t+z)^(-1/2), {t,0,Inf}] - * RJ(x,y,z,p) = 3/2 Integral[(t+x)^(-1/2) (t+y)^(-1/2) (t+z)^(-1/2) (t+p)^(-1), {t,0,Inf}] - * - * exceptions: GSL_EDOM - */ -int gsl_sf_ellint_RC_e(double x, double y, gsl_mode_t mode, gsl_sf_result * result); -double gsl_sf_ellint_RC(double x, double y, gsl_mode_t mode); - -int gsl_sf_ellint_RD_e(double x, double y, double z, gsl_mode_t mode, gsl_sf_result * result); -double gsl_sf_ellint_RD(double x, double y, double z, gsl_mode_t mode); - -int gsl_sf_ellint_RF_e(double x, double y, double z, gsl_mode_t mode, gsl_sf_result * result); -double gsl_sf_ellint_RF(double x, double y, double z, gsl_mode_t mode); - -int gsl_sf_ellint_RJ_e(double x, double y, double z, double p, gsl_mode_t mode, gsl_sf_result * result); -double gsl_sf_ellint_RJ(double x, double y, double z, double p, gsl_mode_t mode); - - -__END_DECLS - -#endif /* __GSL_SF_ELLINT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_elljac.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_elljac.h deleted file mode 100644 index 7f804a5c5..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_elljac.h +++ /dev/null @@ -1,48 +0,0 @@ -/* specfunc/gsl_sf_elljac.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_ELLJAC_H__ -#define __GSL_SF_ELLJAC_H__ - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Jacobian elliptic functions sn, dn, cn, - * by descending Landen transformations - * - * exceptions: GSL_EDOM - */ -int gsl_sf_elljac_e(double u, double m, double * sn, double * cn, double * dn); - - -__END_DECLS - -#endif /* __GSL_SF_ELLJAC_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_erf.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_erf.h deleted file mode 100644 index a196d0dfe..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_erf.h +++ /dev/null @@ -1,91 +0,0 @@ -/* specfunc/gsl_sf_erf.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_ERF_H__ -#define __GSL_SF_ERF_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Complementary Error Function - * erfc(x) := 2/Sqrt[Pi] Integrate[Exp[-t^2], {t,x,Infinity}] - * - * exceptions: none - */ -int gsl_sf_erfc_e(double x, gsl_sf_result * result); -double gsl_sf_erfc(double x); - - -/* Log Complementary Error Function - * - * exceptions: none - */ -int gsl_sf_log_erfc_e(double x, gsl_sf_result * result); -double gsl_sf_log_erfc(double x); - - -/* Error Function - * erf(x) := 2/Sqrt[Pi] Integrate[Exp[-t^2], {t,0,x}] - * - * exceptions: none - */ -int gsl_sf_erf_e(double x, gsl_sf_result * result); -double gsl_sf_erf(double x); - - -/* Probability functions: - * Z(x) : Abramowitz+Stegun 26.2.1 - * Q(x) : Abramowitz+Stegun 26.2.3 - * - * exceptions: none - */ -int gsl_sf_erf_Z_e(double x, gsl_sf_result * result); -int gsl_sf_erf_Q_e(double x, gsl_sf_result * result); -double gsl_sf_erf_Z(double x); -double gsl_sf_erf_Q(double x); - - -/* Hazard function, also known as the inverse Mill's ratio. - * - * H(x) := Z(x)/Q(x) - * = Sqrt[2/Pi] Exp[-x^2 / 2] / Erfc[x/Sqrt[2]] - * - * exceptions: GSL_EUNDRFLW - */ -int gsl_sf_hazard_e(double x, gsl_sf_result * result); -double gsl_sf_hazard(double x); - - -__END_DECLS - -#endif /* __GSL_SF_ERF_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_exp.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_exp.h deleted file mode 100644 index 8f8aff760..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_exp.h +++ /dev/null @@ -1,134 +0,0 @@ -/* specfunc/gsl_sf_exp.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_EXP_H__ -#define __GSL_SF_EXP_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -/* Provide an exp() function with GSL semantics, - * i.e. with proper error checking, etc. - * - * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_exp_e(const double x, gsl_sf_result * result); -double gsl_sf_exp(const double x); - - -/* Exp(x) - * - * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_exp_e10_e(const double x, gsl_sf_result_e10 * result); - - -/* Exponentiate and multiply by a given factor: y * Exp(x) - * - * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_exp_mult_e(const double x, const double y, gsl_sf_result * result); -double gsl_sf_exp_mult(const double x, const double y); - - -/* Exponentiate and multiply by a given factor: y * Exp(x) - * - * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_exp_mult_e10_e(const double x, const double y, gsl_sf_result_e10 * result); - - -/* exp(x)-1 - * - * exceptions: GSL_EOVRFLW - */ -int gsl_sf_expm1_e(const double x, gsl_sf_result * result); -double gsl_sf_expm1(const double x); - - -/* (exp(x)-1)/x = 1 + x/2 + x^2/(2*3) + x^3/(2*3*4) + ... - * - * exceptions: GSL_EOVRFLW - */ -int gsl_sf_exprel_e(const double x, gsl_sf_result * result); -double gsl_sf_exprel(const double x); - - -/* 2(exp(x)-1-x)/x^2 = 1 + x/3 + x^2/(3*4) + x^3/(3*4*5) + ... - * - * exceptions: GSL_EOVRFLW - */ -int gsl_sf_exprel_2_e(double x, gsl_sf_result * result); -double gsl_sf_exprel_2(const double x); - - -/* Similarly for the N-th generalization of - * the above. The so-called N-relative exponential - * - * exprel_N(x) = N!/x^N (exp(x) - Sum[x^k/k!, {k,0,N-1}]) - * = 1 + x/(N+1) + x^2/((N+1)(N+2)) + ... - * = 1F1(1,1+N,x) - */ -int gsl_sf_exprel_n_e(const int n, const double x, gsl_sf_result * result); -double gsl_sf_exprel_n(const int n, const double x); - -int gsl_sf_exprel_n_CF_e(const double n, const double x, gsl_sf_result * result); - - -/* Exponentiate a quantity with an associated error. - */ -int gsl_sf_exp_err_e(const double x, const double dx, gsl_sf_result * result); - -/* Exponentiate a quantity with an associated error. - */ -int gsl_sf_exp_err_e10_e(const double x, const double dx, gsl_sf_result_e10 * result); - - -/* Exponentiate and multiply by a given factor: y * Exp(x), - * for quantities with associated errors. - * - * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_exp_mult_err_e(const double x, const double dx, const double y, const double dy, gsl_sf_result * result); - - -/* Exponentiate and multiply by a given factor: y * Exp(x), - * for quantities with associated errors. - * - * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_exp_mult_err_e10_e(const double x, const double dx, const double y, const double dy, gsl_sf_result_e10 * result); - -__END_DECLS - -#endif /* __GSL_SF_EXP_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_expint.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_expint.h deleted file mode 100644 index 4005f72a6..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_expint.h +++ /dev/null @@ -1,167 +0,0 @@ -/* specfunc/gsl_sf_expint.h - * - * Copyright (C) 2007 Brian Gough - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_EXPINT_H__ -#define __GSL_SF_EXPINT_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* E_1(x) := Re[ Integrate[ Exp[-xt]/t, {t,1,Infinity}] ] - * - * x != 0.0 - * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_expint_E1_e(const double x, gsl_sf_result * result); -double gsl_sf_expint_E1(const double x); - - -/* E_2(x) := Re[ Integrate[ Exp[-xt]/t^2, {t,1,Infinity}] ] - * - * x != 0.0 - * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_expint_E2_e(const double x, gsl_sf_result * result); -double gsl_sf_expint_E2(const double x); - - -/* E_n(x) := Re[ Integrate[ Exp[-xt]/t^n, {t,1,Infinity}] ] - * - * x != 0.0 - * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_expint_En_e(const int n, const double x, gsl_sf_result * result); -double gsl_sf_expint_En(const int n, const double x); - - -/* E_1_scaled(x) := exp(x) E_1(x) - * - * x != 0.0 - * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_expint_E1_scaled_e(const double x, gsl_sf_result * result); -double gsl_sf_expint_E1_scaled(const double x); - - -/* E_2_scaled(x) := exp(x) E_2(x) - * - * x != 0.0 - * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_expint_E2_scaled_e(const double x, gsl_sf_result * result); -double gsl_sf_expint_E2_scaled(const double x); - -/* E_n_scaled(x) := exp(x) E_n(x) - * - * x != 0.0 - * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_expint_En_scaled_e(const int n, const double x, gsl_sf_result * result); -double gsl_sf_expint_En_scaled(const int n, const double x); - - -/* Ei(x) := - PV Integrate[ Exp[-t]/t, {t,-x,Infinity}] - * := PV Integrate[ Exp[t]/t, {t,-Infinity,x}] - * - * x != 0.0 - * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_expint_Ei_e(const double x, gsl_sf_result * result); -double gsl_sf_expint_Ei(const double x); - - -/* Ei_scaled(x) := exp(-x) Ei(x) - * - * x != 0.0 - * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_expint_Ei_scaled_e(const double x, gsl_sf_result * result); -double gsl_sf_expint_Ei_scaled(const double x); - - -/* Shi(x) := Integrate[ Sinh[t]/t, {t,0,x}] - * - * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_Shi_e(const double x, gsl_sf_result * result); -double gsl_sf_Shi(const double x); - - -/* Chi(x) := Re[ M_EULER + log(x) + Integrate[(Cosh[t]-1)/t, {t,0,x}] ] - * - * x != 0.0 - * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_Chi_e(const double x, gsl_sf_result * result); -double gsl_sf_Chi(const double x); - - -/* Ei_3(x) := Integral[ Exp[-t^3], {t,0,x}] - * - * x >= 0.0 - * exceptions: GSL_EDOM - */ -int gsl_sf_expint_3_e(const double x, gsl_sf_result * result); -double gsl_sf_expint_3(double x); - - -/* Si(x) := Integrate[ Sin[t]/t, {t,0,x}] - * - * exceptions: none - */ -int gsl_sf_Si_e(const double x, gsl_sf_result * result); -double gsl_sf_Si(const double x); - - -/* Ci(x) := -Integrate[ Cos[t]/t, {t,x,Infinity}] - * - * x > 0.0 - * exceptions: GSL_EDOM - */ -int gsl_sf_Ci_e(const double x, gsl_sf_result * result); -double gsl_sf_Ci(const double x); - - -/* AtanInt(x) := Integral[ Arctan[t]/t, {t,0,x}] - * - * - * exceptions: - */ -int gsl_sf_atanint_e(const double x, gsl_sf_result * result); -double gsl_sf_atanint(const double x); - - -__END_DECLS - -#endif /* __GSL_SF_EXPINT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_fermi_dirac.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_fermi_dirac.h deleted file mode 100644 index 8f708cd2b..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_fermi_dirac.h +++ /dev/null @@ -1,126 +0,0 @@ -/* specfunc/gsl_sf_fermi_dirac.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_FERMI_DIRAC_H__ -#define __GSL_SF_FERMI_DIRAC_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Complete Fermi-Dirac Integrals: - * - * F_j(x) := 1/Gamma[j+1] Integral[ t^j /(Exp[t-x] + 1), {t,0,Infinity}] - * - * - * Incomplete Fermi-Dirac Integrals: - * - * F_j(x,b) := 1/Gamma[j+1] Integral[ t^j /(Exp[t-x] + 1), {t,b,Infinity}] - */ - - -/* Complete integral F_{-1}(x) = e^x / (1 + e^x) - * - * exceptions: GSL_EUNDRFLW - */ -int gsl_sf_fermi_dirac_m1_e(const double x, gsl_sf_result * result); -double gsl_sf_fermi_dirac_m1(const double x); - - -/* Complete integral F_0(x) = ln(1 + e^x) - * - * exceptions: GSL_EUNDRFLW - */ -int gsl_sf_fermi_dirac_0_e(const double x, gsl_sf_result * result); -double gsl_sf_fermi_dirac_0(const double x); - - -/* Complete integral F_1(x) - * - * exceptions: GSL_EUNDRFLW, GSL_EOVRFLW - */ -int gsl_sf_fermi_dirac_1_e(const double x, gsl_sf_result * result); -double gsl_sf_fermi_dirac_1(const double x); - - -/* Complete integral F_2(x) - * - * exceptions: GSL_EUNDRFLW, GSL_EOVRFLW - */ -int gsl_sf_fermi_dirac_2_e(const double x, gsl_sf_result * result); -double gsl_sf_fermi_dirac_2(const double x); - - -/* Complete integral F_j(x) - * for integer j - * - * exceptions: GSL_EUNDRFLW, GSL_EOVRFLW - */ -int gsl_sf_fermi_dirac_int_e(const int j, const double x, gsl_sf_result * result); -double gsl_sf_fermi_dirac_int(const int j, const double x); - - -/* Complete integral F_{-1/2}(x) - * - * exceptions: GSL_EUNDRFLW, GSL_EOVRFLW - */ -int gsl_sf_fermi_dirac_mhalf_e(const double x, gsl_sf_result * result); -double gsl_sf_fermi_dirac_mhalf(const double x); - - -/* Complete integral F_{1/2}(x) - * - * exceptions: GSL_EUNDRFLW, GSL_EOVRFLW - */ -int gsl_sf_fermi_dirac_half_e(const double x, gsl_sf_result * result); -double gsl_sf_fermi_dirac_half(const double x); - - -/* Complete integral F_{3/2}(x) - * - * exceptions: GSL_EUNDRFLW, GSL_EOVRFLW - */ -int gsl_sf_fermi_dirac_3half_e(const double x, gsl_sf_result * result); -double gsl_sf_fermi_dirac_3half(const double x); - - -/* Incomplete integral F_0(x,b) = ln(1 + e^(b-x)) - (b-x) - * - * exceptions: GSL_EUNDRFLW, GSL_EDOM - */ -int gsl_sf_fermi_dirac_inc_0_e(const double x, const double b, gsl_sf_result * result); -double gsl_sf_fermi_dirac_inc_0(const double x, const double b); - - -__END_DECLS - -#endif /* __GSL_SF_FERMI_DIRAC_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_gamma.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_gamma.h deleted file mode 100644 index d5e867ba6..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_gamma.h +++ /dev/null @@ -1,293 +0,0 @@ -/* specfunc/gsl_sf_gamma.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_GAMMA_H__ -#define __GSL_SF_GAMMA_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Log[Gamma(x)], x not a negative integer - * Uses real Lanczos method. - * Returns the real part of Log[Gamma[x]] when x < 0, - * i.e. Log[|Gamma[x]|]. - * - * exceptions: GSL_EDOM, GSL_EROUND - */ -int gsl_sf_lngamma_e(double x, gsl_sf_result * result); -double gsl_sf_lngamma(const double x); - - -/* Log[Gamma(x)], x not a negative integer - * Uses real Lanczos method. Determines - * the sign of Gamma[x] as well as Log[|Gamma[x]|] for x < 0. - * So Gamma[x] = sgn * Exp[result_lg]. - * - * exceptions: GSL_EDOM, GSL_EROUND - */ -int gsl_sf_lngamma_sgn_e(double x, gsl_sf_result * result_lg, double *sgn); - - -/* Gamma(x), x not a negative integer - * Uses real Lanczos method. - * - * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EROUND - */ -int gsl_sf_gamma_e(const double x, gsl_sf_result * result); -double gsl_sf_gamma(const double x); - - -/* Regulated Gamma Function, x > 0 - * Gamma^*(x) = Gamma(x)/(Sqrt[2Pi] x^(x-1/2) exp(-x)) - * = (1 + 1/(12x) + ...), x->Inf - * A useful suggestion of Temme. - * - * exceptions: GSL_EDOM - */ -int gsl_sf_gammastar_e(const double x, gsl_sf_result * result); -double gsl_sf_gammastar(const double x); - - -/* 1/Gamma(x) - * Uses real Lanczos method. - * - * exceptions: GSL_EUNDRFLW, GSL_EROUND - */ -int gsl_sf_gammainv_e(const double x, gsl_sf_result * result); -double gsl_sf_gammainv(const double x); - - -/* Log[Gamma(z)] for z complex, z not a negative integer - * Uses complex Lanczos method. Note that the phase part (arg) - * is not well-determined when |z| is very large, due - * to inevitable roundoff in restricting to (-Pi,Pi]. - * This will raise the GSL_ELOSS exception when it occurs. - * The absolute value part (lnr), however, never suffers. - * - * Calculates: - * lnr = log|Gamma(z)| - * arg = arg(Gamma(z)) in (-Pi, Pi] - * - * exceptions: GSL_EDOM, GSL_ELOSS - */ -int gsl_sf_lngamma_complex_e(double zr, double zi, gsl_sf_result * lnr, gsl_sf_result * arg); - - -/* x^n / n! - * - * x >= 0.0, n >= 0 - * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_taylorcoeff_e(const int n, const double x, gsl_sf_result * result); -double gsl_sf_taylorcoeff(const int n, const double x); - - -/* n! - * - * exceptions: GSL_EDOM, GSL_EOVRFLW - */ -int gsl_sf_fact_e(const unsigned int n, gsl_sf_result * result); -double gsl_sf_fact(const unsigned int n); - - -/* n!! = n(n-2)(n-4) ... - * - * exceptions: GSL_EDOM, GSL_EOVRFLW - */ -int gsl_sf_doublefact_e(const unsigned int n, gsl_sf_result * result); -double gsl_sf_doublefact(const unsigned int n); - - -/* log(n!) - * Faster than ln(Gamma(n+1)) for n < 170; defers for larger n. - * - * exceptions: none - */ -int gsl_sf_lnfact_e(const unsigned int n, gsl_sf_result * result); -double gsl_sf_lnfact(const unsigned int n); - - -/* log(n!!) - * - * exceptions: none - */ -int gsl_sf_lndoublefact_e(const unsigned int n, gsl_sf_result * result); -double gsl_sf_lndoublefact(const unsigned int n); - - -/* log(n choose m) - * - * exceptions: GSL_EDOM - */ -int gsl_sf_lnchoose_e(unsigned int n, unsigned int m, gsl_sf_result * result); -double gsl_sf_lnchoose(unsigned int n, unsigned int m); - - -/* n choose m - * - * exceptions: GSL_EDOM, GSL_EOVRFLW - */ -int gsl_sf_choose_e(unsigned int n, unsigned int m, gsl_sf_result * result); -double gsl_sf_choose(unsigned int n, unsigned int m); - - -/* Logarithm of Pochhammer (Apell) symbol - * log( (a)_x ) - * where (a)_x := Gamma[a + x]/Gamma[a] - * - * a > 0, a+x > 0 - * - * exceptions: GSL_EDOM - */ -int gsl_sf_lnpoch_e(const double a, const double x, gsl_sf_result * result); -double gsl_sf_lnpoch(const double a, const double x); - - -/* Logarithm of Pochhammer (Apell) symbol, with sign information. - * result = log( |(a)_x| ) - * sgn = sgn( (a)_x ) - * where (a)_x := Gamma[a + x]/Gamma[a] - * - * a != neg integer, a+x != neg integer - * - * exceptions: GSL_EDOM - */ -int gsl_sf_lnpoch_sgn_e(const double a, const double x, gsl_sf_result * result, double * sgn); - - -/* Pochhammer (Apell) symbol - * (a)_x := Gamma[a + x]/Gamma[x] - * - * a != neg integer, a+x != neg integer - * - * exceptions: GSL_EDOM, GSL_EOVRFLW - */ -int gsl_sf_poch_e(const double a, const double x, gsl_sf_result * result); -double gsl_sf_poch(const double a, const double x); - - -/* Relative Pochhammer (Apell) symbol - * ((a,x) - 1)/x - * where (a,x) = (a)_x := Gamma[a + x]/Gamma[a] - * - * exceptions: GSL_EDOM - */ -int gsl_sf_pochrel_e(const double a, const double x, gsl_sf_result * result); -double gsl_sf_pochrel(const double a, const double x); - - -/* Normalized Incomplete Gamma Function - * - * Q(a,x) = 1/Gamma(a) Integral[ t^(a-1) e^(-t), {t,x,Infinity} ] - * - * a >= 0, x >= 0 - * Q(a,0) := 1 - * Q(0,x) := 0, x != 0 - * - * exceptions: GSL_EDOM - */ -int gsl_sf_gamma_inc_Q_e(const double a, const double x, gsl_sf_result * result); -double gsl_sf_gamma_inc_Q(const double a, const double x); - - -/* Complementary Normalized Incomplete Gamma Function - * - * P(a,x) = 1/Gamma(a) Integral[ t^(a-1) e^(-t), {t,0,x} ] - * - * a > 0, x >= 0 - * - * exceptions: GSL_EDOM - */ -int gsl_sf_gamma_inc_P_e(const double a, const double x, gsl_sf_result * result); -double gsl_sf_gamma_inc_P(const double a, const double x); - - -/* Non-normalized Incomplete Gamma Function - * - * Gamma(a,x) := Integral[ t^(a-1) e^(-t), {t,x,Infinity} ] - * - * x >= 0.0 - * Gamma(a, 0) := Gamma(a) - * - * exceptions: GSL_EDOM - */ -int gsl_sf_gamma_inc_e(const double a, const double x, gsl_sf_result * result); -double gsl_sf_gamma_inc(const double a, const double x); - - -/* Logarithm of Beta Function - * Log[B(a,b)] - * - * a > 0, b > 0 - * exceptions: GSL_EDOM - */ -int gsl_sf_lnbeta_e(const double a, const double b, gsl_sf_result * result); -double gsl_sf_lnbeta(const double a, const double b); - -int gsl_sf_lnbeta_sgn_e(const double x, const double y, gsl_sf_result * result, double * sgn); - - -/* Beta Function - * B(a,b) - * - * a > 0, b > 0 - * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_beta_e(const double a, const double b, gsl_sf_result * result); -double gsl_sf_beta(const double a, const double b); - - -/* Normalized Incomplete Beta Function - * B_x(a,b)/B(a,b) - * - * a > 0, b > 0, 0 <= x <= 1 - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_beta_inc_e(const double a, const double b, const double x, gsl_sf_result * result); -double gsl_sf_beta_inc(const double a, const double b, const double x); - - -/* The maximum x such that gamma(x) is not - * considered an overflow. - */ -#define GSL_SF_GAMMA_XMAX 171.0 - -/* The maximum n such that gsl_sf_fact(n) does not give an overflow. */ -#define GSL_SF_FACT_NMAX 170 - -/* The maximum n such that gsl_sf_doublefact(n) does not give an overflow. */ -#define GSL_SF_DOUBLEFACT_NMAX 297 - -__END_DECLS - -#endif /* __GSL_SF_GAMMA_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_gegenbauer.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_gegenbauer.h deleted file mode 100644 index bf41d218e..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_gegenbauer.h +++ /dev/null @@ -1,73 +0,0 @@ -/* specfunc/gsl_sf_gegenbauer.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_GEGENBAUER_H__ -#define __GSL_SF_GEGENBAUER_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Evaluate Gegenbauer polynomials - * using explicit representations. - * - * exceptions: none - */ -int gsl_sf_gegenpoly_1_e(double lambda, double x, gsl_sf_result * result); -int gsl_sf_gegenpoly_2_e(double lambda, double x, gsl_sf_result * result); -int gsl_sf_gegenpoly_3_e(double lambda, double x, gsl_sf_result * result); -double gsl_sf_gegenpoly_1(double lambda, double x); -double gsl_sf_gegenpoly_2(double lambda, double x); -double gsl_sf_gegenpoly_3(double lambda, double x); - - -/* Evaluate Gegenbauer polynomials. - * - * lambda > -1/2, n >= 0 - * exceptions: GSL_EDOM - */ -int gsl_sf_gegenpoly_n_e(int n, double lambda, double x, gsl_sf_result * result); -double gsl_sf_gegenpoly_n(int n, double lambda, double x); - - -/* Calculate array of Gegenbauer polynomials - * for n = (0, 1, 2, ... nmax) - * - * lambda > -1/2, nmax >= 0 - * exceptions: GSL_EDOM - */ -int gsl_sf_gegenpoly_array(int nmax, double lambda, double x, double * result_array); - - -__END_DECLS - -#endif /* __GSL_SF_GEGENBAUER_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_hermite.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_hermite.h deleted file mode 100644 index 391b959e8..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_hermite.h +++ /dev/null @@ -1,75 +0,0 @@ -/* gsl_sf_hermite.h - * - * Copyright (C) 2011-2014 Konrad Griessinger - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/*----------------------------------------------------------------------* - * (konradg(at)gmx.net) * - *----------------------------------------------------------------------*/ - -#ifndef __GSL_SF_HERMITE_H__ -#define __GSL_SF_HERMITE_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_sf_hermite_prob_e(const int n, const double x, gsl_sf_result * result); -double gsl_sf_hermite_prob(const int n, const double x); -int gsl_sf_hermite_prob_der_e(const int m, const int n, const double x, gsl_sf_result * result); -double gsl_sf_hermite_prob_der(const int m, const int n, const double x); -int gsl_sf_hermite_phys_e(const int n, const double x, gsl_sf_result * result); -double gsl_sf_hermite_phys(const int n, const double x); -int gsl_sf_hermite_phys_der_e(const int m, const int n, const double x, gsl_sf_result * result); -double gsl_sf_hermite_phys_der(const int m, const int n, const double x); -int gsl_sf_hermite_func_e(const int n, const double x, gsl_sf_result * result); -double gsl_sf_hermite_func(const int n, const double x); -int gsl_sf_hermite_prob_array(const int nmax, const double x, double * result_array); -int gsl_sf_hermite_prob_array_der(const int m, const int nmax, const double x, double * result_array); -int gsl_sf_hermite_prob_der_array(const int mmax, const int n, const double x, double * result_array); -int gsl_sf_hermite_prob_series_e(const int n, const double x, const double * a, gsl_sf_result * result); -double gsl_sf_hermite_prob_series(const int n, const double x, const double * a); -int gsl_sf_hermite_phys_array(const int nmax, const double x, double * result_array); -int gsl_sf_hermite_phys_array_der(const int m, const int nmax, const double x, double * result_array); -int gsl_sf_hermite_phys_der_array(const int mmax, const int n, const double x, double * result_array); -int gsl_sf_hermite_phys_series_e(const int n, const double x, const double * a, gsl_sf_result * result); -double gsl_sf_hermite_phys_series(const int n, const double x, const double * a); -int gsl_sf_hermite_func_array(const int nmax, const double x, double * result_array); -int gsl_sf_hermite_func_series_e(const int n, const double x, const double * a, gsl_sf_result * result); -double gsl_sf_hermite_func_series(const int n, const double x, const double * a); -int gsl_sf_hermite_func_der_e(const int m, const int n, const double x, gsl_sf_result * result); -double gsl_sf_hermite_func_der(const int m, const int n, const double x); -int gsl_sf_hermite_prob_zero_e(const int n, const int s, gsl_sf_result * result); -double gsl_sf_hermite_prob_zero(const int n, const int s); -int gsl_sf_hermite_phys_zero_e(const int n, const int s, gsl_sf_result * result); -double gsl_sf_hermite_phys_zero(const int n, const int s); -int gsl_sf_hermite_func_zero_e(const int n, const int s, gsl_sf_result * result); -double gsl_sf_hermite_func_zero(const int n, const int s); - -__END_DECLS - -#endif /* __GSL_SF_HERMITE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_hyperg.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_hyperg.h deleted file mode 100644 index 8366b88d0..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_hyperg.h +++ /dev/null @@ -1,154 +0,0 @@ -/* specfunc/gsl_sf_hyperg.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_HYPERG_H__ -#define __GSL_SF_HYPERG_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Hypergeometric function related to Bessel functions - * 0F1[c,x] = - * Gamma[c] x^(1/2(1-c)) I_{c-1}(2 Sqrt[x]) - * Gamma[c] (-x)^(1/2(1-c)) J_{c-1}(2 Sqrt[-x]) - * - * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW - */ -int gsl_sf_hyperg_0F1_e(double c, double x, gsl_sf_result * result); -double gsl_sf_hyperg_0F1(const double c, const double x); - - -/* Confluent hypergeometric function for integer parameters. - * 1F1[m,n,x] = M(m,n,x) - * - * exceptions: - */ -int gsl_sf_hyperg_1F1_int_e(const int m, const int n, const double x, gsl_sf_result * result); -double gsl_sf_hyperg_1F1_int(const int m, const int n, double x); - - -/* Confluent hypergeometric function. - * 1F1[a,b,x] = M(a,b,x) - * - * exceptions: - */ -int gsl_sf_hyperg_1F1_e(const double a, const double b, const double x, gsl_sf_result * result); -double gsl_sf_hyperg_1F1(double a, double b, double x); - - -/* Confluent hypergeometric function for integer parameters. - * U(m,n,x) - * - * exceptions: - */ -int gsl_sf_hyperg_U_int_e(const int m, const int n, const double x, gsl_sf_result * result); -double gsl_sf_hyperg_U_int(const int m, const int n, const double x); - - -/* Confluent hypergeometric function for integer parameters. - * U(m,n,x) - * - * exceptions: - */ -int gsl_sf_hyperg_U_int_e10_e(const int m, const int n, const double x, gsl_sf_result_e10 * result); - - -/* Confluent hypergeometric function. - * U(a,b,x) - * - * exceptions: - */ -int gsl_sf_hyperg_U_e(const double a, const double b, const double x, gsl_sf_result * result); -double gsl_sf_hyperg_U(const double a, const double b, const double x); - - -/* Confluent hypergeometric function. - * U(a,b,x) - * - * exceptions: - */ -int gsl_sf_hyperg_U_e10_e(const double a, const double b, const double x, gsl_sf_result_e10 * result); - - -/* Gauss hypergeometric function 2F1[a,b,c,x] - * |x| < 1 - * - * exceptions: - */ -int gsl_sf_hyperg_2F1_e(double a, double b, const double c, const double x, gsl_sf_result * result); -double gsl_sf_hyperg_2F1(double a, double b, double c, double x); - - -/* Gauss hypergeometric function - * 2F1[aR + I aI, aR - I aI, c, x] - * |x| < 1 - * - * exceptions: - */ -int gsl_sf_hyperg_2F1_conj_e(const double aR, const double aI, const double c, const double x, gsl_sf_result * result); -double gsl_sf_hyperg_2F1_conj(double aR, double aI, double c, double x); - - -/* Renormalized Gauss hypergeometric function - * 2F1[a,b,c,x] / Gamma[c] - * |x| < 1 - * - * exceptions: - */ -int gsl_sf_hyperg_2F1_renorm_e(const double a, const double b, const double c, const double x, gsl_sf_result * result); -double gsl_sf_hyperg_2F1_renorm(double a, double b, double c, double x); - - -/* Renormalized Gauss hypergeometric function - * 2F1[aR + I aI, aR - I aI, c, x] / Gamma[c] - * |x| < 1 - * - * exceptions: - */ -int gsl_sf_hyperg_2F1_conj_renorm_e(const double aR, const double aI, const double c, const double x, gsl_sf_result * result); -double gsl_sf_hyperg_2F1_conj_renorm(double aR, double aI, double c, double x); - - -/* Mysterious hypergeometric function. The series representation - * is a divergent hypergeometric series. However, for x < 0 we - * have 2F0(a,b,x) = (-1/x)^a U(a,1+a-b,-1/x) - * - * exceptions: GSL_EDOM - */ -int gsl_sf_hyperg_2F0_e(const double a, const double b, const double x, gsl_sf_result * result); -double gsl_sf_hyperg_2F0(const double a, const double b, const double x); - - -__END_DECLS - -#endif /* __GSL_SF_HYPERG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_laguerre.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_laguerre.h deleted file mode 100644 index 0d7f1c370..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_laguerre.h +++ /dev/null @@ -1,68 +0,0 @@ -/* specfunc/gsl_sf_laguerre.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_LAGUERRE_H__ -#define __GSL_SF_LAGUERRE_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* L^a_n(x) = (a+1)_n / n! 1F1(-n,a+1,x) */ - - -/* Evaluate generalized Laguerre polynomials - * using explicit representations. - * - * exceptions: none - */ -int gsl_sf_laguerre_1_e(const double a, const double x, gsl_sf_result * result); -int gsl_sf_laguerre_2_e(const double a, const double x, gsl_sf_result * result); -int gsl_sf_laguerre_3_e(const double a, const double x, gsl_sf_result * result); -double gsl_sf_laguerre_1(double a, double x); -double gsl_sf_laguerre_2(double a, double x); -double gsl_sf_laguerre_3(double a, double x); - - -/* Evaluate generalized Laguerre polynomials. - * - * a > -1.0 - * n >= 0 - * exceptions: GSL_EDOM - */ -int gsl_sf_laguerre_n_e(const int n, const double a, const double x, gsl_sf_result * result); -double gsl_sf_laguerre_n(int n, double a, double x); - - -__END_DECLS - -#endif /* __GSL_SF_LAGUERRE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_lambert.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_lambert.h deleted file mode 100644 index 53b70a3a3..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_lambert.h +++ /dev/null @@ -1,69 +0,0 @@ -/* specfunc/gsl_sf_lambert.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_LAMBERT_H__ -#define __GSL_SF_LAMBERT_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Lambert's Function W_0(x) - * - * W_0(x) is the principal branch of the - * implicit function defined by W e^W = x. - * - * -1/E < x < \infty - * - * exceptions: GSL_EMAXITER; - */ -int gsl_sf_lambert_W0_e(double x, gsl_sf_result * result); -double gsl_sf_lambert_W0(double x); - - -/* Lambert's Function W_{-1}(x) - * - * W_{-1}(x) is the second real branch of the - * implicit function defined by W e^W = x. - * It agrees with W_0(x) when x >= 0. - * - * -1/E < x < \infty - * - * exceptions: GSL_MAXITER; - */ -int gsl_sf_lambert_Wm1_e(double x, gsl_sf_result * result); -double gsl_sf_lambert_Wm1(double x); - - -__END_DECLS - -#endif /* __GSL_SF_LAMBERT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_legendre.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_legendre.h deleted file mode 100644 index a7a4b070b..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_legendre.h +++ /dev/null @@ -1,375 +0,0 @@ -/* specfunc/gsl_sf_legendre.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_LEGENDRE_H__ -#define __GSL_SF_LEGENDRE_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* P_l(x) l >= 0; |x| <= 1 - * - * exceptions: GSL_EDOM - */ -int gsl_sf_legendre_Pl_e(const int l, const double x, gsl_sf_result * result); -double gsl_sf_legendre_Pl(const int l, const double x); - - -/* P_l(x) for l=0,...,lmax; |x| <= 1 - * - * exceptions: GSL_EDOM - */ -int gsl_sf_legendre_Pl_array( - const int lmax, const double x, - double * result_array - ); - - -/* P_l(x) and P_l'(x) for l=0,...,lmax; |x| <= 1 - * - * exceptions: GSL_EDOM - */ -int gsl_sf_legendre_Pl_deriv_array( - const int lmax, const double x, - double * result_array, - double * result_deriv_array - ); - - -/* P_l(x), l=1,2,3 - * - * exceptions: none - */ -int gsl_sf_legendre_P1_e(double x, gsl_sf_result * result); -int gsl_sf_legendre_P2_e(double x, gsl_sf_result * result); -int gsl_sf_legendre_P3_e(double x, gsl_sf_result * result); -double gsl_sf_legendre_P1(const double x); -double gsl_sf_legendre_P2(const double x); -double gsl_sf_legendre_P3(const double x); - - -/* Q_0(x), x > -1, x != 1 - * - * exceptions: GSL_EDOM - */ -int gsl_sf_legendre_Q0_e(const double x, gsl_sf_result * result); -double gsl_sf_legendre_Q0(const double x); - - -/* Q_1(x), x > -1, x != 1 - * - * exceptions: GSL_EDOM - */ -int gsl_sf_legendre_Q1_e(const double x, gsl_sf_result * result); -double gsl_sf_legendre_Q1(const double x); - - -/* Q_l(x), x > -1, x != 1, l >= 0 - * - * exceptions: GSL_EDOM - */ -int gsl_sf_legendre_Ql_e(const int l, const double x, gsl_sf_result * result); -double gsl_sf_legendre_Ql(const int l, const double x); - - -/* P_l^m(x) m >= 0; l >= m; |x| <= 1.0 - * - * Note that this function grows combinatorially with l. - * Therefore we can easily generate an overflow for l larger - * than about 150. - * - * There is no trouble for small m, but when m and l are both large, - * then there will be trouble. Rather than allow overflows, these - * functions refuse to calculate when they can sense that l and m are - * too big. - * - * If you really want to calculate a spherical harmonic, then DO NOT - * use this. Instead use legendre_sphPlm() below, which uses a similar - * recursion, but with the normalized functions. - * - * exceptions: GSL_EDOM, GSL_EOVRFLW - */ -int gsl_sf_legendre_Plm_e(const int l, const int m, const double x, gsl_sf_result * result); -double gsl_sf_legendre_Plm(const int l, const int m, const double x); - - -/* P_l^m(x) m >= 0; l >= m; |x| <= 1.0 - * l=|m|,...,lmax - * - * exceptions: GSL_EDOM, GSL_EOVRFLW - */ -int gsl_sf_legendre_Plm_array( - const int lmax, const int m, const double x, - double * result_array - ); - - -/* P_l^m(x) and d(P_l^m(x))/dx; m >= 0; lmax >= m; |x| <= 1.0 - * l=|m|,...,lmax - * - * exceptions: GSL_EDOM, GSL_EOVRFLW - */ -int gsl_sf_legendre_Plm_deriv_array( - const int lmax, const int m, const double x, - double * result_array, - double * result_deriv_array - ); - - -/* P_l^m(x), normalized properly for use in spherical harmonics - * m >= 0; l >= m; |x| <= 1.0 - * - * There is no overflow problem, as there is for the - * standard normalization of P_l^m(x). - * - * Specifically, it returns: - * - * sqrt((2l+1)/(4pi)) sqrt((l-m)!/(l+m)!) P_l^m(x) - * - * exceptions: GSL_EDOM - */ -int gsl_sf_legendre_sphPlm_e(const int l, int m, const double x, gsl_sf_result * result); -double gsl_sf_legendre_sphPlm(const int l, const int m, const double x); - - -/* sphPlm(l,m,x) values - * m >= 0; l >= m; |x| <= 1.0 - * l=|m|,...,lmax - * - * exceptions: GSL_EDOM - */ -int gsl_sf_legendre_sphPlm_array( - const int lmax, int m, const double x, - double * result_array - ); - - -/* sphPlm(l,m,x) and d(sphPlm(l,m,x))/dx values - * m >= 0; l >= m; |x| <= 1.0 - * l=|m|,...,lmax - * - * exceptions: GSL_EDOM - */ -int gsl_sf_legendre_sphPlm_deriv_array( - const int lmax, const int m, const double x, - double * result_array, - double * result_deriv_array - ); - - - -/* size of result_array[] needed for the array versions of Plm - * (lmax - m + 1) - */ -int gsl_sf_legendre_array_size(const int lmax, const int m); - -/* Irregular Spherical Conical Function - * P^{1/2}_{-1/2 + I lambda}(x) - * - * x > -1.0 - * exceptions: GSL_EDOM - */ -int gsl_sf_conicalP_half_e(const double lambda, const double x, gsl_sf_result * result); -double gsl_sf_conicalP_half(const double lambda, const double x); - - -/* Regular Spherical Conical Function - * P^{-1/2}_{-1/2 + I lambda}(x) - * - * x > -1.0 - * exceptions: GSL_EDOM - */ -int gsl_sf_conicalP_mhalf_e(const double lambda, const double x, gsl_sf_result * result); -double gsl_sf_conicalP_mhalf(const double lambda, const double x); - - -/* Conical Function - * P^{0}_{-1/2 + I lambda}(x) - * - * x > -1.0 - * exceptions: GSL_EDOM - */ -int gsl_sf_conicalP_0_e(const double lambda, const double x, gsl_sf_result * result); -double gsl_sf_conicalP_0(const double lambda, const double x); - - -/* Conical Function - * P^{1}_{-1/2 + I lambda}(x) - * - * x > -1.0 - * exceptions: GSL_EDOM - */ -int gsl_sf_conicalP_1_e(const double lambda, const double x, gsl_sf_result * result); -double gsl_sf_conicalP_1(const double lambda, const double x); - - -/* Regular Spherical Conical Function - * P^{-1/2-l}_{-1/2 + I lambda}(x) - * - * x > -1.0, l >= -1 - * exceptions: GSL_EDOM - */ -int gsl_sf_conicalP_sph_reg_e(const int l, const double lambda, const double x, gsl_sf_result * result); -double gsl_sf_conicalP_sph_reg(const int l, const double lambda, const double x); - - -/* Regular Cylindrical Conical Function - * P^{-m}_{-1/2 + I lambda}(x) - * - * x > -1.0, m >= -1 - * exceptions: GSL_EDOM - */ -int gsl_sf_conicalP_cyl_reg_e(const int m, const double lambda, const double x, gsl_sf_result * result); -double gsl_sf_conicalP_cyl_reg(const int m, const double lambda, const double x); - - -/* The following spherical functions are specializations - * of Legendre functions which give the regular eigenfunctions - * of the Laplacian on a 3-dimensional hyperbolic space. - * Of particular interest is the flat limit, which is - * Flat-Lim := {lambda->Inf, eta->0, lambda*eta fixed}. - */ - -/* Zeroth radial eigenfunction of the Laplacian on the - * 3-dimensional hyperbolic space. - * - * legendre_H3d_0(lambda,eta) := sin(lambda*eta)/(lambda*sinh(eta)) - * - * Normalization: - * Flat-Lim legendre_H3d_0(lambda,eta) = j_0(lambda*eta) - * - * eta >= 0.0 - * exceptions: GSL_EDOM - */ -int gsl_sf_legendre_H3d_0_e(const double lambda, const double eta, gsl_sf_result * result); -double gsl_sf_legendre_H3d_0(const double lambda, const double eta); - - -/* First radial eigenfunction of the Laplacian on the - * 3-dimensional hyperbolic space. - * - * legendre_H3d_1(lambda,eta) := - * 1/sqrt(lambda^2 + 1) sin(lam eta)/(lam sinh(eta)) - * (coth(eta) - lambda cot(lambda*eta)) - * - * Normalization: - * Flat-Lim legendre_H3d_1(lambda,eta) = j_1(lambda*eta) - * - * eta >= 0.0 - * exceptions: GSL_EDOM - */ -int gsl_sf_legendre_H3d_1_e(const double lambda, const double eta, gsl_sf_result * result); -double gsl_sf_legendre_H3d_1(const double lambda, const double eta); - - -/* l'th radial eigenfunction of the Laplacian on the - * 3-dimensional hyperbolic space. - * - * Normalization: - * Flat-Lim legendre_H3d_l(l,lambda,eta) = j_l(lambda*eta) - * - * eta >= 0.0, l >= 0 - * exceptions: GSL_EDOM - */ -int gsl_sf_legendre_H3d_e(const int l, const double lambda, const double eta, gsl_sf_result * result); -double gsl_sf_legendre_H3d(const int l, const double lambda, const double eta); - - -/* Array of H3d(ell), 0 <= ell <= lmax - */ -int gsl_sf_legendre_H3d_array(const int lmax, const double lambda, const double eta, double * result_array); - -/* associated legendre P_{lm} routines */ - -typedef enum -{ - GSL_SF_LEGENDRE_SCHMIDT, - GSL_SF_LEGENDRE_SPHARM, - GSL_SF_LEGENDRE_FULL, - GSL_SF_LEGENDRE_NONE -} gsl_sf_legendre_t; - -int gsl_sf_legendre_array(const gsl_sf_legendre_t norm, - const size_t lmax, const double x, - double result_array[]); -int gsl_sf_legendre_array_e(const gsl_sf_legendre_t norm, - const size_t lmax, const double x, - const double csphase, - double result_array[]); -int gsl_sf_legendre_deriv_array(const gsl_sf_legendre_t norm, - const size_t lmax, const double x, - double result_array[], - double result_deriv_array[]); -int gsl_sf_legendre_deriv_array_e(const gsl_sf_legendre_t norm, - const size_t lmax, const double x, - const double csphase, - double result_array[], - double result_deriv_array[]); -int gsl_sf_legendre_deriv_alt_array(const gsl_sf_legendre_t norm, - const size_t lmax, const double x, - double result_array[], - double result_deriv_array[]); -int gsl_sf_legendre_deriv_alt_array_e(const gsl_sf_legendre_t norm, - const size_t lmax, const double x, - const double csphase, - double result_array[], - double result_deriv_array[]); -int gsl_sf_legendre_deriv2_array(const gsl_sf_legendre_t norm, - const size_t lmax, const double x, - double result_array[], - double result_deriv_array[], - double result_deriv2_array[]); -int gsl_sf_legendre_deriv2_array_e(const gsl_sf_legendre_t norm, - const size_t lmax, const double x, - const double csphase, - double result_array[], - double result_deriv_array[], - double result_deriv2_array[]); -int gsl_sf_legendre_deriv2_alt_array(const gsl_sf_legendre_t norm, - const size_t lmax, const double x, - double result_array[], - double result_deriv_array[], - double result_deriv2_array[]); -int gsl_sf_legendre_deriv2_alt_array_e(const gsl_sf_legendre_t norm, - const size_t lmax, const double x, - const double csphase, - double result_array[], - double result_deriv_array[], - double result_deriv2_array[]); -size_t gsl_sf_legendre_array_n(const size_t lmax); -size_t gsl_sf_legendre_array_index(const size_t l, const size_t m); -size_t gsl_sf_legendre_nlm(const size_t lmax); - -__END_DECLS - -#endif /* __GSL_SF_LEGENDRE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_log.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_log.h deleted file mode 100644 index 92aa68574..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_log.h +++ /dev/null @@ -1,82 +0,0 @@ -/* specfunc/gsl_sf_log.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_LOG_H__ -#define __GSL_SF_LOG_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Provide a logarithm function with GSL semantics. - * - * exceptions: GSL_EDOM - */ -int gsl_sf_log_e(const double x, gsl_sf_result * result); -double gsl_sf_log(const double x); - - -/* Log(|x|) - * - * exceptions: GSL_EDOM - */ -int gsl_sf_log_abs_e(const double x, gsl_sf_result * result); -double gsl_sf_log_abs(const double x); - - -/* Complex Logarithm - * exp(lnr + I theta) = zr + I zi - * Returns argument in [-pi,pi]. - * - * exceptions: GSL_EDOM - */ -int gsl_sf_complex_log_e(const double zr, const double zi, gsl_sf_result * lnr, gsl_sf_result * theta); - - -/* Log(1 + x) - * - * exceptions: GSL_EDOM - */ -int gsl_sf_log_1plusx_e(const double x, gsl_sf_result * result); -double gsl_sf_log_1plusx(const double x); - - -/* Log(1 + x) - x - * - * exceptions: GSL_EDOM - */ -int gsl_sf_log_1plusx_mx_e(const double x, gsl_sf_result * result); -double gsl_sf_log_1plusx_mx(const double x); - -__END_DECLS - -#endif /* __GSL_SF_LOG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_mathieu.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_mathieu.h deleted file mode 100644 index 8dc8d14e8..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_mathieu.h +++ /dev/null @@ -1,113 +0,0 @@ -/* specfunc/gsl_sf_mathieu.h - * - * Copyright (C) 2002 Lowell Johnson - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* Author: L. Johnson */ - -#ifndef __GSL_SF_MATHIEU_H__ -#define __GSL_SF_MATHIEU_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -#define GSL_SF_MATHIEU_COEFF 100 - -typedef struct -{ - size_t size; - size_t even_order; - size_t odd_order; - int extra_values; - double qa; /* allow for caching of results: not implemented yet */ - double qb; /* allow for caching of results: not implemented yet */ - double *aa; - double *bb; - double *dd; - double *ee; - double *tt; - double *e2; - double *zz; - gsl_vector *eval; - gsl_matrix *evec; - gsl_eigen_symmv_workspace *wmat; -} gsl_sf_mathieu_workspace; - - -/* Compute an array of characteristic (eigen) values from the recurrence - matrices for the Mathieu equations. */ -int gsl_sf_mathieu_a_array(int order_min, int order_max, double qq, gsl_sf_mathieu_workspace *work, double result_array[]); -int gsl_sf_mathieu_b_array(int order_min, int order_max, double qq, gsl_sf_mathieu_workspace *work, double result_array[]); - -/* Compute the characteristic value for a Mathieu function of order n and - type ntype. */ -int gsl_sf_mathieu_a_e(int order, double qq, gsl_sf_result *result); -double gsl_sf_mathieu_a(int order, double qq); -int gsl_sf_mathieu_b_e(int order, double qq, gsl_sf_result *result); -double gsl_sf_mathieu_b(int order, double qq); - -/* Compute the Fourier coefficients for a Mathieu function. */ -int gsl_sf_mathieu_a_coeff(int order, double qq, double aa, double coeff[]); -int gsl_sf_mathieu_b_coeff(int order, double qq, double aa, double coeff[]); - -/* Allocate computational storage space for eigenvalue solution. */ -gsl_sf_mathieu_workspace *gsl_sf_mathieu_alloc(const size_t nn, - const double qq); -void gsl_sf_mathieu_free(gsl_sf_mathieu_workspace *workspace); - -/* Compute an angular Mathieu function. */ -int gsl_sf_mathieu_ce_e(int order, double qq, double zz, gsl_sf_result *result); -double gsl_sf_mathieu_ce(int order, double qq, double zz); -int gsl_sf_mathieu_se_e(int order, double qq, double zz, gsl_sf_result *result); -double gsl_sf_mathieu_se(int order, double qq, double zz); -int gsl_sf_mathieu_ce_array(int nmin, int nmax, double qq, double zz, - gsl_sf_mathieu_workspace *work, - double result_array[]); -int gsl_sf_mathieu_se_array(int nmin, int nmax, double qq, double zz, - gsl_sf_mathieu_workspace *work, - double result_array[]); - -/* Compute a radial Mathieu function. */ -int gsl_sf_mathieu_Mc_e(int kind, int order, double qq, double zz, - gsl_sf_result *result); -double gsl_sf_mathieu_Mc(int kind, int order, double qq, double zz); -int gsl_sf_mathieu_Ms_e(int kind, int order, double qq, double zz, - gsl_sf_result *result); -double gsl_sf_mathieu_Ms(int kind, int order, double qq, double zz); -int gsl_sf_mathieu_Mc_array(int kind, int nmin, int nmax, double qq, - double zz, gsl_sf_mathieu_workspace *work, - double result_array[]); -int gsl_sf_mathieu_Ms_array(int kind, int nmin, int nmax, double qq, - double zz, gsl_sf_mathieu_workspace *work, - double result_array[]); - - -__END_DECLS - -#endif /* !__GSL_SF_MATHIEU_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_pow_int.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_pow_int.h deleted file mode 100644 index e535d5721..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_pow_int.h +++ /dev/null @@ -1,49 +0,0 @@ -/* specfunc/gsl_sf_pow_int.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_POW_INT_H__ -#define __GSL_SF_POW_INT_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Calculate x^n. - * Does not check for overflow/underflow. - */ -int gsl_sf_pow_int_e(double x, int n, gsl_sf_result * result); -double gsl_sf_pow_int(const double x, const int n); - - -__END_DECLS - -#endif /* __GSL_SF_POW_INT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_psi.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_psi.h deleted file mode 100644 index ec6117906..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_psi.h +++ /dev/null @@ -1,113 +0,0 @@ -/* specfunc/gsl_sf_psi.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_PSI_H__ -#define __GSL_SF_PSI_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Poly-Gamma Functions - * - * psi(m,x) := (d/dx)^m psi(0,x) = (d/dx)^{m+1} log(gamma(x)) - */ - - -/* Di-Gamma Function psi(n) = psi(0,n) - * - * n > 0 - * exceptions: GSL_EDOM - */ -int gsl_sf_psi_int_e(const int n, gsl_sf_result * result); -double gsl_sf_psi_int(const int n); - - -/* Di-Gamma Function psi(x) = psi(0, x) - * - * x != 0.0, -1.0, -2.0, ... - * exceptions: GSL_EDOM, GSL_ELOSS - */ -int gsl_sf_psi_e(const double x, gsl_sf_result * result); -double gsl_sf_psi(const double x); - - -/* Di-Gamma Function Re[psi(1 + I y)] - * - * exceptions: none - */ -int gsl_sf_psi_1piy_e(const double y, gsl_sf_result * result); -double gsl_sf_psi_1piy(const double y); - - -/* Di-Gamma Function psi(z) for general complex argument z = x + iy - * - * exceptions: GSL_EDOM - */ -int gsl_sf_complex_psi_e( - const double x, - const double y, - gsl_sf_result * result_re, - gsl_sf_result * result_im - ); - - -/* Tri-Gamma Function psi^(1)(n) - * - * n > 0 - * exceptions: GSL_EDOM - */ -int gsl_sf_psi_1_int_e(const int n, gsl_sf_result * result); -double gsl_sf_psi_1_int(const int n); - - -/* Tri-Gamma Function psi^(1)(x) - * - * x != 0.0, -1.0, -2.0, ... - * exceptions: GSL_EDOM, GSL_ELOSS - */ -int gsl_sf_psi_1_e(const double x, gsl_sf_result * result); -double gsl_sf_psi_1(const double x); - - -/* Poly-Gamma Function psi^(n)(x) - * - * n >= 0, x > 0.0 - * exceptions: GSL_EDOM - */ -int gsl_sf_psi_n_e(const int n, const double x, gsl_sf_result * result); -double gsl_sf_psi_n(const int n, const double x); - - -__END_DECLS - -#endif /* __GSL_SF_PSI_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_result.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_result.h deleted file mode 100644 index 512bad7c4..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_result.h +++ /dev/null @@ -1,59 +0,0 @@ -/* specfunc/gsl_sf_result.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_RESULT_H__ -#define __GSL_SF_RESULT_H__ - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -struct gsl_sf_result_struct { - double val; - double err; -}; -typedef struct gsl_sf_result_struct gsl_sf_result; - -#define GSL_SF_RESULT_SET(r,v,e) do { (r)->val=(v); (r)->err=(e); } while(0) - - -struct gsl_sf_result_e10_struct { - double val; - double err; - int e10; -}; -typedef struct gsl_sf_result_e10_struct gsl_sf_result_e10; - - -int gsl_sf_result_smash_e(const gsl_sf_result_e10 * re, gsl_sf_result * r); - - -__END_DECLS - -#endif /* __GSL_SF_RESULT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_sincos_pi.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_sincos_pi.h deleted file mode 100644 index 62fafbe18..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_sincos_pi.h +++ /dev/null @@ -1,57 +0,0 @@ -/* specfunc/gsl_sf_sincos_pi.h - * - * Copyright (C) 2017 Konrad Griessinger - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman, K. Griessinger */ - -#ifndef __GSL_SF_SINCOS_PI_H__ -#define __GSL_SF_SINCOS_PI_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* sin_pi(x) with GSL semantics. This is actually important - * because we want to control the error estimate, and trying - * to guess the error for the standard library implementation - * every time it is used would be a little goofy. - */ -int gsl_sf_sin_pi_e(double x, gsl_sf_result * result); -double gsl_sf_sin_pi(const double x); - - -/* cos_pi(x) with GSL semantics. - */ -int gsl_sf_cos_pi_e(double x, gsl_sf_result * result); -double gsl_sf_cos_pi(const double x); - - -__END_DECLS - -#endif /* __GSL_SF_SINCOS_PI_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_synchrotron.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_synchrotron.h deleted file mode 100644 index 26028c893..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_synchrotron.h +++ /dev/null @@ -1,60 +0,0 @@ -/* specfunc/gsl_sf_synchrotron.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_SYNCHROTRON_H__ -#define __GSL_SF_SYNCHROTRON_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* First synchrotron function: - * synchrotron_1(x) = x Integral[ K_{5/3}(t), {t, x, Infinity}] - * - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_synchrotron_1_e(const double x, gsl_sf_result * result); -double gsl_sf_synchrotron_1(const double x); - - -/* Second synchroton function: - * synchrotron_2(x) = x * K_{2/3}(x) - * - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_synchrotron_2_e(const double x, gsl_sf_result * result); -double gsl_sf_synchrotron_2(const double x); - - -__END_DECLS - -#endif /* __GSL_SF_SYNCHROTRON_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_transport.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_transport.h deleted file mode 100644 index c0fd7fc23..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_transport.h +++ /dev/null @@ -1,78 +0,0 @@ -/* specfunc/gsl_sf_transport.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_TRANSPORT_H__ -#define __GSL_SF_TRANSPORT_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Transport function: - * J(n,x) := Integral[ t^n e^t /(e^t - 1)^2, {t,0,x}] - */ - -/* J(2,x) - * - * exceptions: GSL_EDOM - */ -int gsl_sf_transport_2_e(const double x, gsl_sf_result * result); -double gsl_sf_transport_2(const double x); - - -/* J(3,x) - * - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_transport_3_e(const double x, gsl_sf_result * result); -double gsl_sf_transport_3(const double x); - - -/* J(4,x) - * - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_transport_4_e(const double x, gsl_sf_result * result); -double gsl_sf_transport_4(const double x); - - -/* J(5,x) - * - * exceptions: GSL_EDOM, GSL_EUNDRFLW - */ -int gsl_sf_transport_5_e(const double x, gsl_sf_result * result); -double gsl_sf_transport_5(const double x); - - -__END_DECLS - -#endif /* __GSL_SF_TRANSPORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_trig.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_trig.h deleted file mode 100644 index e2c5722d9..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_trig.h +++ /dev/null @@ -1,152 +0,0 @@ -/* specfunc/gsl_sf_trig.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_TRIG_H__ -#define __GSL_SF_TRIG_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Sin(x) with GSL semantics. This is actually important - * because we want to control the error estimate, and trying - * to guess the error for the standard library implementation - * every time it is used would be a little goofy. - */ -int gsl_sf_sin_e(double x, gsl_sf_result * result); -double gsl_sf_sin(const double x); - - -/* Cos(x) with GSL semantics. - */ -int gsl_sf_cos_e(double x, gsl_sf_result * result); -double gsl_sf_cos(const double x); - - -/* Hypot(x,y) with GSL semantics. - */ -int gsl_sf_hypot_e(const double x, const double y, gsl_sf_result * result); -double gsl_sf_hypot(const double x, const double y); - - -/* Sin(z) for complex z - * - * exceptions: GSL_EOVRFLW - */ -int gsl_sf_complex_sin_e(const double zr, const double zi, gsl_sf_result * szr, gsl_sf_result * szi); - - -/* Cos(z) for complex z - * - * exceptions: GSL_EOVRFLW - */ -int gsl_sf_complex_cos_e(const double zr, const double zi, gsl_sf_result * czr, gsl_sf_result * czi); - - -/* Log(Sin(z)) for complex z - * - * exceptions: GSL_EDOM, GSL_ELOSS - */ -int gsl_sf_complex_logsin_e(const double zr, const double zi, gsl_sf_result * lszr, gsl_sf_result * lszi); - - -/* Sinc(x) = sin(pi x) / (pi x) - * - * exceptions: none - */ -int gsl_sf_sinc_e(double x, gsl_sf_result * result); -double gsl_sf_sinc(const double x); - - -/* Log(Sinh(x)), x > 0 - * - * exceptions: GSL_EDOM - */ -int gsl_sf_lnsinh_e(const double x, gsl_sf_result * result); -double gsl_sf_lnsinh(const double x); - - -/* Log(Cosh(x)) - * - * exceptions: none - */ -int gsl_sf_lncosh_e(const double x, gsl_sf_result * result); -double gsl_sf_lncosh(const double x); - - -/* Convert polar to rectlinear coordinates. - * - * exceptions: GSL_ELOSS - */ -int gsl_sf_polar_to_rect(const double r, const double theta, gsl_sf_result * x, gsl_sf_result * y); - -/* Convert rectilinear to polar coordinates. - * return argument in range [-pi, pi] - * - * exceptions: GSL_EDOM - */ -int gsl_sf_rect_to_polar(const double x, const double y, gsl_sf_result * r, gsl_sf_result * theta); - -/* Sin(x) for quantity with an associated error. - */ -int gsl_sf_sin_err_e(const double x, const double dx, gsl_sf_result * result); - - -/* Cos(x) for quantity with an associated error. - */ -int gsl_sf_cos_err_e(const double x, const double dx, gsl_sf_result * result); - - -/* Force an angle to lie in the range (-pi,pi]. - * - * exceptions: GSL_ELOSS - */ -int gsl_sf_angle_restrict_symm_e(double * theta); -double gsl_sf_angle_restrict_symm(const double theta); - - -/* Force an angle to lie in the range [0, 2pi) - * - * exceptions: GSL_ELOSS - */ -int gsl_sf_angle_restrict_pos_e(double * theta); -double gsl_sf_angle_restrict_pos(const double theta); - - -int gsl_sf_angle_restrict_symm_err_e(const double theta, gsl_sf_result * result); - -int gsl_sf_angle_restrict_pos_err_e(const double theta, gsl_sf_result * result); - - -__END_DECLS - -#endif /* __GSL_SF_TRIG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_zeta.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_zeta.h deleted file mode 100644 index 2d7fad0ad..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sf_zeta.h +++ /dev/null @@ -1,112 +0,0 @@ -/* specfunc/gsl_sf_zeta.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - -#ifndef __GSL_SF_ZETA_H__ -#define __GSL_SF_ZETA_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* Riemann Zeta Function - * zeta(n) = Sum[ k^(-n), {k,1,Infinity} ] - * - * n=integer, n != 1 - * exceptions: GSL_EDOM, GSL_EOVRFLW - */ -int gsl_sf_zeta_int_e(const int n, gsl_sf_result * result); -double gsl_sf_zeta_int(const int n); - - -/* Riemann Zeta Function - * zeta(x) = Sum[ k^(-s), {k,1,Infinity} ], s != 1.0 - * - * s != 1.0 - * exceptions: GSL_EDOM, GSL_EOVRFLW - */ -int gsl_sf_zeta_e(const double s, gsl_sf_result * result); -double gsl_sf_zeta(const double s); - - -/* Riemann Zeta Function minus 1 - * useful for evaluating the fractional part - * of Riemann zeta for large argument - * - * s != 1.0 - * exceptions: GSL_EDOM, GSL_EOVRFLW - */ -int gsl_sf_zetam1_e(const double s, gsl_sf_result * result); -double gsl_sf_zetam1(const double s); - - -/* Riemann Zeta Function minus 1 for integer arg - * useful for evaluating the fractional part - * of Riemann zeta for large argument - * - * s != 1.0 - * exceptions: GSL_EDOM, GSL_EOVRFLW - */ -int gsl_sf_zetam1_int_e(const int s, gsl_sf_result * result); -double gsl_sf_zetam1_int(const int s); - - -/* Hurwitz Zeta Function - * zeta(s,q) = Sum[ (k+q)^(-s), {k,0,Infinity} ] - * - * s > 1.0, q > 0.0 - * exceptions: GSL_EDOM, GSL_EUNDRFLW, GSL_EOVRFLW - */ -int gsl_sf_hzeta_e(const double s, const double q, gsl_sf_result * result); -double gsl_sf_hzeta(const double s, const double q); - - -/* Eta Function - * eta(n) = (1-2^(1-n)) zeta(n) - * - * exceptions: GSL_EUNDRFLW, GSL_EOVRFLW - */ -int gsl_sf_eta_int_e(int n, gsl_sf_result * result); -double gsl_sf_eta_int(const int n); - - -/* Eta Function - * eta(s) = (1-2^(1-s)) zeta(s) - * - * exceptions: GSL_EUNDRFLW, GSL_EOVRFLW - */ -int gsl_sf_eta_e(const double s, gsl_sf_result * result); -double gsl_sf_eta(const double s); - - -__END_DECLS - -#endif /* __GSL_SF_ZETA_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_siman.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_siman.h deleted file mode 100644 index a16f7c7c7..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_siman.h +++ /dev/null @@ -1,82 +0,0 @@ -/* siman/gsl_siman.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Mark Galassi - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SIMAN_H__ -#define __GSL_SIMAN_H__ -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -/* types for the function pointers passed to gsl_siman_solve */ - -typedef double (*gsl_siman_Efunc_t) (void *xp); -typedef void (*gsl_siman_step_t) (const gsl_rng *r, void *xp, double step_size); -typedef double (*gsl_siman_metric_t) (void *xp, void *yp); -typedef void (*gsl_siman_print_t) (void *xp); -typedef void (*gsl_siman_copy_t) (void *source, void *dest); -typedef void * (*gsl_siman_copy_construct_t) (void *xp); -typedef void (*gsl_siman_destroy_t) (void *xp); - -/* this structure contains all the information needed to structure the - search, beyond the energy function, the step function and the - initial guess. */ - -typedef struct { - int n_tries; /* how many points to try for each step */ - int iters_fixed_T; /* how many iterations at each temperature? */ - double step_size; /* max step size in the random walk */ - /* the following parameters are for the Boltzmann distribution */ - double k, t_initial, mu_t, t_min; -} gsl_siman_params_t; - -/* prototype for the workhorse function */ - -void gsl_siman_solve(const gsl_rng * r, - void *x0_p, gsl_siman_Efunc_t Ef, - gsl_siman_step_t take_step, - gsl_siman_metric_t distance, - gsl_siman_print_t print_position, - gsl_siman_copy_t copyfunc, - gsl_siman_copy_construct_t copy_constructor, - gsl_siman_destroy_t destructor, - size_t element_size, - gsl_siman_params_t params); - -void -gsl_siman_solve_many (const gsl_rng * r, void *x0_p, gsl_siman_Efunc_t Ef, - gsl_siman_step_t take_step, - gsl_siman_metric_t distance, - gsl_siman_print_t print_position, - size_t element_size, - gsl_siman_params_t params); - -__END_DECLS - -#endif /* __GSL_SIMAN_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort.h deleted file mode 100644 index b1496c2ef..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __GSL_SORT_H__ -#define __GSL_SORT_H__ - -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include - -#include -#include - -#endif /* __GSL_SORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_char.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_char.h deleted file mode 100644 index a4bf3514f..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_char.h +++ /dev/null @@ -1,51 +0,0 @@ -/* sort/gsl_sort_char.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SORT_CHAR_H__ -#define __GSL_SORT_CHAR_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -void gsl_sort_char (char * data, const size_t stride, const size_t n); -void gsl_sort2_char (char * data1, const size_t stride1, char * data2, const size_t stride2, const size_t n); -void gsl_sort_char_index (size_t * p, const char * data, const size_t stride, const size_t n); - -int gsl_sort_char_smallest (char * dest, const size_t k, const char * src, const size_t stride, const size_t n); -int gsl_sort_char_smallest_index (size_t * p, const size_t k, const char * src, const size_t stride, const size_t n); - -int gsl_sort_char_largest (char * dest, const size_t k, const char * src, const size_t stride, const size_t n); -int gsl_sort_char_largest_index (size_t * p, const size_t k, const char * src, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_SORT_CHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_double.h deleted file mode 100644 index 3f67f43dd..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_double.h +++ /dev/null @@ -1,51 +0,0 @@ -/* sort/gsl_sort_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SORT_DOUBLE_H__ -#define __GSL_SORT_DOUBLE_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -void gsl_sort (double * data, const size_t stride, const size_t n); -void gsl_sort2 (double * data1, const size_t stride1, double * data2, const size_t stride2, const size_t n); -void gsl_sort_index (size_t * p, const double * data, const size_t stride, const size_t n); - -int gsl_sort_smallest (double * dest, const size_t k, const double * src, const size_t stride, const size_t n); -int gsl_sort_smallest_index (size_t * p, const size_t k, const double * src, const size_t stride, const size_t n); - -int gsl_sort_largest (double * dest, const size_t k, const double * src, const size_t stride, const size_t n); -int gsl_sort_largest_index (size_t * p, const size_t k, const double * src, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_SORT_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_float.h deleted file mode 100644 index 505a1c6bf..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_float.h +++ /dev/null @@ -1,51 +0,0 @@ -/* sort/gsl_sort_float.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SORT_FLOAT_H__ -#define __GSL_SORT_FLOAT_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -void gsl_sort_float (float * data, const size_t stride, const size_t n); -void gsl_sort2_float (float * data1, const size_t stride1, float * data2, const size_t stride2, const size_t n); -void gsl_sort_float_index (size_t * p, const float * data, const size_t stride, const size_t n); - -int gsl_sort_float_smallest (float * dest, const size_t k, const float * src, const size_t stride, const size_t n); -int gsl_sort_float_smallest_index (size_t * p, const size_t k, const float * src, const size_t stride, const size_t n); - -int gsl_sort_float_largest (float * dest, const size_t k, const float * src, const size_t stride, const size_t n); -int gsl_sort_float_largest_index (size_t * p, const size_t k, const float * src, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_SORT_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_int.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_int.h deleted file mode 100644 index 7aa8d3859..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_int.h +++ /dev/null @@ -1,51 +0,0 @@ -/* sort/gsl_sort_int.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SORT_INT_H__ -#define __GSL_SORT_INT_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -void gsl_sort_int (int * data, const size_t stride, const size_t n); -void gsl_sort2_int (int * data1, const size_t stride1, int * data2, const size_t stride2, const size_t n); -void gsl_sort_int_index (size_t * p, const int * data, const size_t stride, const size_t n); - -int gsl_sort_int_smallest (int * dest, const size_t k, const int * src, const size_t stride, const size_t n); -int gsl_sort_int_smallest_index (size_t * p, const size_t k, const int * src, const size_t stride, const size_t n); - -int gsl_sort_int_largest (int * dest, const size_t k, const int * src, const size_t stride, const size_t n); -int gsl_sort_int_largest_index (size_t * p, const size_t k, const int * src, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_SORT_INT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_long.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_long.h deleted file mode 100644 index 7f4d68929..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_long.h +++ /dev/null @@ -1,51 +0,0 @@ -/* sort/gsl_sort_long.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SORT_LONG_H__ -#define __GSL_SORT_LONG_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -void gsl_sort_long (long * data, const size_t stride, const size_t n); -void gsl_sort2_long (long * data1, const size_t stride1, long * data2, const size_t stride2, const size_t n); -void gsl_sort_long_index (size_t * p, const long * data, const size_t stride, const size_t n); - -int gsl_sort_long_smallest (long * dest, const size_t k, const long * src, const size_t stride, const size_t n); -int gsl_sort_long_smallest_index (size_t * p, const size_t k, const long * src, const size_t stride, const size_t n); - -int gsl_sort_long_largest (long * dest, const size_t k, const long * src, const size_t stride, const size_t n); -int gsl_sort_long_largest_index (size_t * p, const size_t k, const long * src, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_SORT_LONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_long_double.h deleted file mode 100644 index 164fd231e..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_long_double.h +++ /dev/null @@ -1,51 +0,0 @@ -/* sort/gsl_sort_long_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SORT_LONG_DOUBLE_H__ -#define __GSL_SORT_LONG_DOUBLE_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -void gsl_sort_long_double (long double * data, const size_t stride, const size_t n); -void gsl_sort2_long_double (long double * data1, const size_t stride1, long double * data2, const size_t stride2, const size_t n); -void gsl_sort_long_double_index (size_t * p, const long double * data, const size_t stride, const size_t n); - -int gsl_sort_long_double_smallest (long double * dest, const size_t k, const long double * src, const size_t stride, const size_t n); -int gsl_sort_long_double_smallest_index (size_t * p, const size_t k, const long double * src, const size_t stride, const size_t n); - -int gsl_sort_long_double_largest (long double * dest, const size_t k, const long double * src, const size_t stride, const size_t n); -int gsl_sort_long_double_largest_index (size_t * p, const size_t k, const long double * src, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_SORT_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_short.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_short.h deleted file mode 100644 index 4626e9e2e..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_short.h +++ /dev/null @@ -1,51 +0,0 @@ -/* sort/gsl_sort_short.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SORT_SHORT_H__ -#define __GSL_SORT_SHORT_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -void gsl_sort_short (short * data, const size_t stride, const size_t n); -void gsl_sort2_short (short * data1, const size_t stride1, short * data2, const size_t stride2, const size_t n); -void gsl_sort_short_index (size_t * p, const short * data, const size_t stride, const size_t n); - -int gsl_sort_short_smallest (short * dest, const size_t k, const short * src, const size_t stride, const size_t n); -int gsl_sort_short_smallest_index (size_t * p, const size_t k, const short * src, const size_t stride, const size_t n); - -int gsl_sort_short_largest (short * dest, const size_t k, const short * src, const size_t stride, const size_t n); -int gsl_sort_short_largest_index (size_t * p, const size_t k, const short * src, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_SORT_SHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_uchar.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_uchar.h deleted file mode 100644 index 6cd511d53..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_uchar.h +++ /dev/null @@ -1,51 +0,0 @@ -/* sort/gsl_sort_uchar.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SORT_UCHAR_H__ -#define __GSL_SORT_UCHAR_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -void gsl_sort_uchar (unsigned char * data, const size_t stride, const size_t n); -void gsl_sort2_uchar (unsigned char * data1, const size_t stride1, unsigned char * data2, const size_t stride2, const size_t n); -void gsl_sort_uchar_index (size_t * p, const unsigned char * data, const size_t stride, const size_t n); - -int gsl_sort_uchar_smallest (unsigned char * dest, const size_t k, const unsigned char * src, const size_t stride, const size_t n); -int gsl_sort_uchar_smallest_index (size_t * p, const size_t k, const unsigned char * src, const size_t stride, const size_t n); - -int gsl_sort_uchar_largest (unsigned char * dest, const size_t k, const unsigned char * src, const size_t stride, const size_t n); -int gsl_sort_uchar_largest_index (size_t * p, const size_t k, const unsigned char * src, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_SORT_UCHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_uint.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_uint.h deleted file mode 100644 index 639e596f3..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_uint.h +++ /dev/null @@ -1,51 +0,0 @@ -/* sort/gsl_sort_uint.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SORT_UINT_H__ -#define __GSL_SORT_UINT_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -void gsl_sort_uint (unsigned int * data, const size_t stride, const size_t n); -void gsl_sort2_uint (unsigned int * data1, const size_t stride1, unsigned int * data2, const size_t stride2, const size_t n); -void gsl_sort_uint_index (size_t * p, const unsigned int * data, const size_t stride, const size_t n); - -int gsl_sort_uint_smallest (unsigned int * dest, const size_t k, const unsigned int * src, const size_t stride, const size_t n); -int gsl_sort_uint_smallest_index (size_t * p, const size_t k, const unsigned int * src, const size_t stride, const size_t n); - -int gsl_sort_uint_largest (unsigned int * dest, const size_t k, const unsigned int * src, const size_t stride, const size_t n); -int gsl_sort_uint_largest_index (size_t * p, const size_t k, const unsigned int * src, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_SORT_UINT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_ulong.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_ulong.h deleted file mode 100644 index 4f8e41d47..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_ulong.h +++ /dev/null @@ -1,51 +0,0 @@ -/* sort/gsl_sort_ulong.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SORT_ULONG_H__ -#define __GSL_SORT_ULONG_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -void gsl_sort_ulong (unsigned long * data, const size_t stride, const size_t n); -void gsl_sort2_ulong (unsigned long * data1, const size_t stride1, unsigned long * data2, const size_t stride2, const size_t n); -void gsl_sort_ulong_index (size_t * p, const unsigned long * data, const size_t stride, const size_t n); - -int gsl_sort_ulong_smallest (unsigned long * dest, const size_t k, const unsigned long * src, const size_t stride, const size_t n); -int gsl_sort_ulong_smallest_index (size_t * p, const size_t k, const unsigned long * src, const size_t stride, const size_t n); - -int gsl_sort_ulong_largest (unsigned long * dest, const size_t k, const unsigned long * src, const size_t stride, const size_t n); -int gsl_sort_ulong_largest_index (size_t * p, const size_t k, const unsigned long * src, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_SORT_ULONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_ushort.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_ushort.h deleted file mode 100644 index 6da3d107e..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_ushort.h +++ /dev/null @@ -1,51 +0,0 @@ -/* sort/gsl_sort_ushort.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SORT_USHORT_H__ -#define __GSL_SORT_USHORT_H__ - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -void gsl_sort_ushort (unsigned short * data, const size_t stride, const size_t n); -void gsl_sort2_ushort (unsigned short * data1, const size_t stride1, unsigned short * data2, const size_t stride2, const size_t n); -void gsl_sort_ushort_index (size_t * p, const unsigned short * data, const size_t stride, const size_t n); - -int gsl_sort_ushort_smallest (unsigned short * dest, const size_t k, const unsigned short * src, const size_t stride, const size_t n); -int gsl_sort_ushort_smallest_index (size_t * p, const size_t k, const unsigned short * src, const size_t stride, const size_t n); - -int gsl_sort_ushort_largest (unsigned short * dest, const size_t k, const unsigned short * src, const size_t stride, const size_t n); -int gsl_sort_ushort_largest_index (size_t * p, const size_t k, const unsigned short * src, const size_t stride, const size_t n); - -__END_DECLS - -#endif /* __GSL_SORT_USHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector.h deleted file mode 100644 index d65a9ee9b..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __GSL_SORT_VECTOR_H__ -#define __GSL_SORT_VECTOR_H__ - -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include - -#include -#include - -#endif /* __GSL_SORT_VECTOR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_char.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_char.h deleted file mode 100644 index 39721fbdd..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_char.h +++ /dev/null @@ -1,52 +0,0 @@ -/* sort/gsl_sort_vector_char.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SORT_VECTOR_CHAR_H__ -#define __GSL_SORT_VECTOR_CHAR_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -void gsl_sort_vector_char (gsl_vector_char * v); -void gsl_sort_vector2_char (gsl_vector_char * v1, gsl_vector_char * v2); -int gsl_sort_vector_char_index (gsl_permutation * p, const gsl_vector_char * v); - -int gsl_sort_vector_char_smallest (char * dest, const size_t k, const gsl_vector_char * v); -int gsl_sort_vector_char_largest (char * dest, const size_t k, const gsl_vector_char * v); - -int gsl_sort_vector_char_smallest_index (size_t * p, const size_t k, const gsl_vector_char * v); -int gsl_sort_vector_char_largest_index (size_t * p, const size_t k, const gsl_vector_char * v); - -__END_DECLS - -#endif /* __GSL_SORT_VECTOR_CHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_double.h deleted file mode 100644 index f60a7447e..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_double.h +++ /dev/null @@ -1,52 +0,0 @@ -/* sort/gsl_sort_vector_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SORT_VECTOR_DOUBLE_H__ -#define __GSL_SORT_VECTOR_DOUBLE_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -void gsl_sort_vector (gsl_vector * v); -void gsl_sort_vector2 (gsl_vector * v1, gsl_vector * v2); -int gsl_sort_vector_index (gsl_permutation * p, const gsl_vector * v); - -int gsl_sort_vector_smallest (double * dest, const size_t k, const gsl_vector * v); -int gsl_sort_vector_largest (double * dest, const size_t k, const gsl_vector * v); - -int gsl_sort_vector_smallest_index (size_t * p, const size_t k, const gsl_vector * v); -int gsl_sort_vector_largest_index (size_t * p, const size_t k, const gsl_vector * v); - -__END_DECLS - -#endif /* __GSL_SORT_VECTOR_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_float.h deleted file mode 100644 index fe035c3a8..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_float.h +++ /dev/null @@ -1,52 +0,0 @@ -/* sort/gsl_sort_vector_float.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SORT_VECTOR_FLOAT_H__ -#define __GSL_SORT_VECTOR_FLOAT_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -void gsl_sort_vector_float (gsl_vector_float * v); -void gsl_sort_vector2_float (gsl_vector_float * v1, gsl_vector_float * v2); -int gsl_sort_vector_float_index (gsl_permutation * p, const gsl_vector_float * v); - -int gsl_sort_vector_float_smallest (float * dest, const size_t k, const gsl_vector_float * v); -int gsl_sort_vector_float_largest (float * dest, const size_t k, const gsl_vector_float * v); - -int gsl_sort_vector_float_smallest_index (size_t * p, const size_t k, const gsl_vector_float * v); -int gsl_sort_vector_float_largest_index (size_t * p, const size_t k, const gsl_vector_float * v); - -__END_DECLS - -#endif /* __GSL_SORT_VECTOR_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_int.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_int.h deleted file mode 100644 index 3179bca1b..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_int.h +++ /dev/null @@ -1,52 +0,0 @@ -/* sort/gsl_sort_vector_int.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SORT_VECTOR_INT_H__ -#define __GSL_SORT_VECTOR_INT_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -void gsl_sort_vector_int (gsl_vector_int * v); -void gsl_sort_vector2_int (gsl_vector_int * v1, gsl_vector_int * v2); -int gsl_sort_vector_int_index (gsl_permutation * p, const gsl_vector_int * v); - -int gsl_sort_vector_int_smallest (int * dest, const size_t k, const gsl_vector_int * v); -int gsl_sort_vector_int_largest (int * dest, const size_t k, const gsl_vector_int * v); - -int gsl_sort_vector_int_smallest_index (size_t * p, const size_t k, const gsl_vector_int * v); -int gsl_sort_vector_int_largest_index (size_t * p, const size_t k, const gsl_vector_int * v); - -__END_DECLS - -#endif /* __GSL_SORT_VECTOR_INT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_long.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_long.h deleted file mode 100644 index 41eebeca8..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_long.h +++ /dev/null @@ -1,52 +0,0 @@ -/* sort/gsl_sort_vector_long.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SORT_VECTOR_LONG_H__ -#define __GSL_SORT_VECTOR_LONG_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -void gsl_sort_vector_long (gsl_vector_long * v); -void gsl_sort_vector2_long (gsl_vector_long * v1, gsl_vector_long * v2); -int gsl_sort_vector_long_index (gsl_permutation * p, const gsl_vector_long * v); - -int gsl_sort_vector_long_smallest (long * dest, const size_t k, const gsl_vector_long * v); -int gsl_sort_vector_long_largest (long * dest, const size_t k, const gsl_vector_long * v); - -int gsl_sort_vector_long_smallest_index (size_t * p, const size_t k, const gsl_vector_long * v); -int gsl_sort_vector_long_largest_index (size_t * p, const size_t k, const gsl_vector_long * v); - -__END_DECLS - -#endif /* __GSL_SORT_VECTOR_LONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_long_double.h deleted file mode 100644 index 4409d0617..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_long_double.h +++ /dev/null @@ -1,52 +0,0 @@ -/* sort/gsl_sort_vector_long_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SORT_VECTOR_LONG_DOUBLE_H__ -#define __GSL_SORT_VECTOR_LONG_DOUBLE_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -void gsl_sort_vector_long_double (gsl_vector_long_double * v); -void gsl_sort_vector2_long_double (gsl_vector_long_double * v1, gsl_vector_long_double * v2); -int gsl_sort_vector_long_double_index (gsl_permutation * p, const gsl_vector_long_double * v); - -int gsl_sort_vector_long_double_smallest (long double * dest, const size_t k, const gsl_vector_long_double * v); -int gsl_sort_vector_long_double_largest (long double * dest, const size_t k, const gsl_vector_long_double * v); - -int gsl_sort_vector_long_double_smallest_index (size_t * p, const size_t k, const gsl_vector_long_double * v); -int gsl_sort_vector_long_double_largest_index (size_t * p, const size_t k, const gsl_vector_long_double * v); - -__END_DECLS - -#endif /* __GSL_SORT_VECTOR_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_short.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_short.h deleted file mode 100644 index f25e86959..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_short.h +++ /dev/null @@ -1,52 +0,0 @@ -/* sort/gsl_sort_vector_short.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SORT_VECTOR_SHORT_H__ -#define __GSL_SORT_VECTOR_SHORT_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -void gsl_sort_vector_short (gsl_vector_short * v); -void gsl_sort_vector2_short (gsl_vector_short * v1, gsl_vector_short * v2); -int gsl_sort_vector_short_index (gsl_permutation * p, const gsl_vector_short * v); - -int gsl_sort_vector_short_smallest (short * dest, const size_t k, const gsl_vector_short * v); -int gsl_sort_vector_short_largest (short * dest, const size_t k, const gsl_vector_short * v); - -int gsl_sort_vector_short_smallest_index (size_t * p, const size_t k, const gsl_vector_short * v); -int gsl_sort_vector_short_largest_index (size_t * p, const size_t k, const gsl_vector_short * v); - -__END_DECLS - -#endif /* __GSL_SORT_VECTOR_SHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_uchar.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_uchar.h deleted file mode 100644 index edc340853..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_uchar.h +++ /dev/null @@ -1,52 +0,0 @@ -/* sort/gsl_sort_vector_uchar.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SORT_VECTOR_UCHAR_H__ -#define __GSL_SORT_VECTOR_UCHAR_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -void gsl_sort_vector_uchar (gsl_vector_uchar * v); -void gsl_sort_vector2_uchar (gsl_vector_uchar * v1, gsl_vector_uchar * v2); -int gsl_sort_vector_uchar_index (gsl_permutation * p, const gsl_vector_uchar * v); - -int gsl_sort_vector_uchar_smallest (unsigned char * dest, const size_t k, const gsl_vector_uchar * v); -int gsl_sort_vector_uchar_largest (unsigned char * dest, const size_t k, const gsl_vector_uchar * v); - -int gsl_sort_vector_uchar_smallest_index (size_t * p, const size_t k, const gsl_vector_uchar * v); -int gsl_sort_vector_uchar_largest_index (size_t * p, const size_t k, const gsl_vector_uchar * v); - -__END_DECLS - -#endif /* __GSL_SORT_VECTOR_UCHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_uint.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_uint.h deleted file mode 100644 index 6e45b8452..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_uint.h +++ /dev/null @@ -1,52 +0,0 @@ -/* sort/gsl_sort_vector_uint.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SORT_VECTOR_UINT_H__ -#define __GSL_SORT_VECTOR_UINT_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -void gsl_sort_vector_uint (gsl_vector_uint * v); -void gsl_sort_vector2_uint (gsl_vector_uint * v1, gsl_vector_uint * v2); -int gsl_sort_vector_uint_index (gsl_permutation * p, const gsl_vector_uint * v); - -int gsl_sort_vector_uint_smallest (unsigned int * dest, const size_t k, const gsl_vector_uint * v); -int gsl_sort_vector_uint_largest (unsigned int * dest, const size_t k, const gsl_vector_uint * v); - -int gsl_sort_vector_uint_smallest_index (size_t * p, const size_t k, const gsl_vector_uint * v); -int gsl_sort_vector_uint_largest_index (size_t * p, const size_t k, const gsl_vector_uint * v); - -__END_DECLS - -#endif /* __GSL_SORT_VECTOR_UINT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_ulong.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_ulong.h deleted file mode 100644 index e65105752..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_ulong.h +++ /dev/null @@ -1,52 +0,0 @@ -/* sort/gsl_sort_vector_ulong.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SORT_VECTOR_ULONG_H__ -#define __GSL_SORT_VECTOR_ULONG_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -void gsl_sort_vector_ulong (gsl_vector_ulong * v); -void gsl_sort_vector2_ulong (gsl_vector_ulong * v1, gsl_vector_ulong * v2); -int gsl_sort_vector_ulong_index (gsl_permutation * p, const gsl_vector_ulong * v); - -int gsl_sort_vector_ulong_smallest (unsigned long * dest, const size_t k, const gsl_vector_ulong * v); -int gsl_sort_vector_ulong_largest (unsigned long * dest, const size_t k, const gsl_vector_ulong * v); - -int gsl_sort_vector_ulong_smallest_index (size_t * p, const size_t k, const gsl_vector_ulong * v); -int gsl_sort_vector_ulong_largest_index (size_t * p, const size_t k, const gsl_vector_ulong * v); - -__END_DECLS - -#endif /* __GSL_SORT_VECTOR_ULONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_ushort.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_ushort.h deleted file mode 100644 index 09eb0bd12..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sort_vector_ushort.h +++ /dev/null @@ -1,52 +0,0 @@ -/* sort/gsl_sort_vector_ushort.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SORT_VECTOR_USHORT_H__ -#define __GSL_SORT_VECTOR_USHORT_H__ - -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -void gsl_sort_vector_ushort (gsl_vector_ushort * v); -void gsl_sort_vector2_ushort (gsl_vector_ushort * v1, gsl_vector_ushort * v2); -int gsl_sort_vector_ushort_index (gsl_permutation * p, const gsl_vector_ushort * v); - -int gsl_sort_vector_ushort_smallest (unsigned short * dest, const size_t k, const gsl_vector_ushort * v); -int gsl_sort_vector_ushort_largest (unsigned short * dest, const size_t k, const gsl_vector_ushort * v); - -int gsl_sort_vector_ushort_smallest_index (size_t * p, const size_t k, const gsl_vector_ushort * v); -int gsl_sort_vector_ushort_largest_index (size_t * p, const size_t k, const gsl_vector_ushort * v); - -__END_DECLS - -#endif /* __GSL_SORT_VECTOR_USHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_spblas.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_spblas.h deleted file mode 100644 index 9d66088fe..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_spblas.h +++ /dev/null @@ -1,58 +0,0 @@ -/* gsl_spblas.h - * - * Copyright (C) 2012-2014 Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SPBLAS_H__ -#define __GSL_SPBLAS_H__ - -#include - -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -/* - * Prototypes - */ - -int gsl_spblas_dgemv(const CBLAS_TRANSPOSE_t TransA, const double alpha, - const gsl_spmatrix *A, const gsl_vector *x, - const double beta, gsl_vector *y); -int gsl_spblas_dgemm(const double alpha, const gsl_spmatrix *A, - const gsl_spmatrix *B, gsl_spmatrix *C); -size_t gsl_spblas_scatter(const gsl_spmatrix *A, const size_t j, - const double alpha, size_t *w, double *x, - const size_t mark, gsl_spmatrix *C, size_t nz); - -__END_DECLS - -#endif /* __GSL_SPBLAS_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_specfunc.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_specfunc.h deleted file mode 100644 index e07b5aa08..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_specfunc.h +++ /dev/null @@ -1,10 +0,0 @@ -/* Author: G. Jungman */ - - -/* Convenience header */ -#ifndef __GSL_SPECFUNC_H__ -#define __GSL_SPECFUNC_H__ - -#include - -#endif /* __GSL_SPECFUNC_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_splinalg.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_splinalg.h deleted file mode 100644 index 265b6ae60..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_splinalg.h +++ /dev/null @@ -1,79 +0,0 @@ -/* gsl_splinalg.h - * - * Copyright (C) 2012-2014 Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SPLINALG_H__ -#define __GSL_SPLINALG_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -/* iteration solver type */ -typedef struct -{ - const char *name; - void * (*alloc) (const size_t n, const size_t m); - int (*iterate) (const gsl_spmatrix *A, const gsl_vector *b, - const double tol, gsl_vector *x, void *); - double (*normr)(const void *); - void (*free) (void *); -} gsl_splinalg_itersolve_type; - -typedef struct -{ - const gsl_splinalg_itersolve_type * type; - double normr; /* current residual norm || b - A x || */ - void * state; -} gsl_splinalg_itersolve; - -/* available types */ -GSL_VAR const gsl_splinalg_itersolve_type * gsl_splinalg_itersolve_gmres; - -/* - * Prototypes - */ -gsl_splinalg_itersolve * -gsl_splinalg_itersolve_alloc(const gsl_splinalg_itersolve_type *T, - const size_t n, const size_t m); -void gsl_splinalg_itersolve_free(gsl_splinalg_itersolve *w); -const char *gsl_splinalg_itersolve_name(const gsl_splinalg_itersolve *w); -int gsl_splinalg_itersolve_iterate(const gsl_spmatrix *A, - const gsl_vector *b, - const double tol, gsl_vector *x, - gsl_splinalg_itersolve *w); -double gsl_splinalg_itersolve_normr(const gsl_splinalg_itersolve *w); - -__END_DECLS - -#endif /* __GSL_SPLINALG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_spline.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_spline.h deleted file mode 100644 index 08255ca88..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_spline.h +++ /dev/null @@ -1,101 +0,0 @@ -/* interpolation/gsl_spline.h - * - * Copyright (C) 2001, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SPLINE_H__ -#define __GSL_SPLINE_H__ -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* general interpolation object */ -typedef struct { - gsl_interp * interp; - double * x; - double * y; - size_t size; -} gsl_spline; - -gsl_spline * -gsl_spline_alloc(const gsl_interp_type * T, size_t size); - -int -gsl_spline_init(gsl_spline * spline, const double xa[], const double ya[], size_t size); - -const char * gsl_spline_name(const gsl_spline * spline); -unsigned int gsl_spline_min_size(const gsl_spline * spline); - - -int -gsl_spline_eval_e(const gsl_spline * spline, double x, - gsl_interp_accel * a, double * y); - -double -gsl_spline_eval(const gsl_spline * spline, double x, gsl_interp_accel * a); - -int -gsl_spline_eval_deriv_e(const gsl_spline * spline, - double x, - gsl_interp_accel * a, - double * y); - -double -gsl_spline_eval_deriv(const gsl_spline * spline, - double x, - gsl_interp_accel * a); - -int -gsl_spline_eval_deriv2_e(const gsl_spline * spline, - double x, - gsl_interp_accel * a, - double * y); - -double -gsl_spline_eval_deriv2(const gsl_spline * spline, - double x, - gsl_interp_accel * a); - -int -gsl_spline_eval_integ_e(const gsl_spline * spline, - double a, double b, - gsl_interp_accel * acc, - double * y); - -double -gsl_spline_eval_integ(const gsl_spline * spline, - double a, double b, - gsl_interp_accel * acc); - -void -gsl_spline_free(gsl_spline * spline); - -__END_DECLS - -#endif /* __GSL_INTERP_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_spline2d.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_spline2d.h deleted file mode 100644 index a30480001..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_spline2d.h +++ /dev/null @@ -1,113 +0,0 @@ -/* interpolation/gsl_spline2d.h - * - * Copyright 2012 David Zaslavsky - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SPLINE2D_H__ -#define __GSL_SPLINE2D_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - - -/* - * A 2D interpolation object which stores the arrays defining the function. - * In all other respects, this is just like a gsl_interp2d object. - */ -typedef struct -{ - gsl_interp2d interp_object; /* low-level interpolation object */ - double * xarr; /* x data array */ - double * yarr; /* y data array */ - double * zarr; /* z data array */ -} gsl_spline2d; - -gsl_spline2d * gsl_spline2d_alloc(const gsl_interp2d_type * T, size_t xsize, size_t ysize); - -int gsl_spline2d_init(gsl_spline2d * interp, const double xa[], - const double ya[], const double za[], - size_t xsize, size_t ysize); - -void gsl_spline2d_free(gsl_spline2d * interp); - -double gsl_spline2d_eval(const gsl_spline2d * interp, const double x, - const double y, gsl_interp_accel* xa, gsl_interp_accel* ya); - -int gsl_spline2d_eval_e(const gsl_spline2d * interp, const double x, - const double y, gsl_interp_accel* xa, gsl_interp_accel* ya, - double * z); - -double gsl_spline2d_eval_deriv_x(const gsl_spline2d * interp, const double x, - const double y, gsl_interp_accel* xa, gsl_interp_accel* ya); - -int gsl_spline2d_eval_deriv_x_e(const gsl_spline2d * interp, const double x, - const double y, gsl_interp_accel* xa, - gsl_interp_accel* ya, double * z); - -double gsl_spline2d_eval_deriv_y(const gsl_spline2d * interp, const double x, - const double y, gsl_interp_accel* xa, - gsl_interp_accel* ya); - -int gsl_spline2d_eval_deriv_y_e(const gsl_spline2d * interp, const double x, - const double y, gsl_interp_accel* xa, - gsl_interp_accel* ya, double * z); - -double gsl_spline2d_eval_deriv_xx(const gsl_spline2d * interp, const double x, - const double y, gsl_interp_accel* xa, gsl_interp_accel* ya); - -int gsl_spline2d_eval_deriv_xx_e(const gsl_spline2d * interp, const double x, - const double y, gsl_interp_accel* xa, - gsl_interp_accel* ya, double * z); - -double gsl_spline2d_eval_deriv_yy(const gsl_spline2d * interp, const double x, - const double y, gsl_interp_accel* xa, gsl_interp_accel* ya); - -int gsl_spline2d_eval_deriv_yy_e(const gsl_spline2d * interp, const double x, - const double y, gsl_interp_accel* xa, - gsl_interp_accel* ya, double * z); - -double gsl_spline2d_eval_deriv_xy(const gsl_spline2d * interp, const double x, - const double y, gsl_interp_accel* xa, gsl_interp_accel* ya); - -int gsl_spline2d_eval_deriv_xy_e(const gsl_spline2d * interp, const double x, - const double y, gsl_interp_accel* xa, - gsl_interp_accel* ya, double * z); - -size_t gsl_spline2d_min_size(const gsl_spline2d * interp); - -const char * gsl_spline2d_name(const gsl_spline2d * interp); - -int gsl_spline2d_set(const gsl_spline2d * interp, double zarr[], - const size_t i, const size_t j, const double z); -double gsl_spline2d_get(const gsl_spline2d * interp, const double zarr[], - const size_t i, const size_t j); - -__END_DECLS - -#endif /* __GSL_SPLINE2D_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_spmatrix.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_spmatrix.h deleted file mode 100644 index a4f949ba9..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_spmatrix.h +++ /dev/null @@ -1,184 +0,0 @@ -/* gsl_spmatrix.h - * - * Copyright (C) 2012-2014 Patrick Alken - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SPMATRIX_H__ -#define __GSL_SPMATRIX_H__ - -#include - -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -/* - * Binary tree data structure for storing sparse matrix elements - * in triplet format. This is used for efficiently detecting - * duplicates and element retrieval via gsl_spmatrix_get - */ -typedef struct -{ - void *tree; /* tree structure */ - void *node_array; /* preallocated array of tree nodes */ - size_t n; /* number of tree nodes in use (<= nzmax) */ -} gsl_spmatrix_tree; - -/* - * Triplet format: - * - * If data[n] = A_{ij}, then: - * i = A->i[n] - * j = A->p[n] - * - * Compressed column format (CCS): - * - * If data[n] = A_{ij}, then: - * i = A->i[n] - * A->p[j] <= n < A->p[j+1] - * so that column j is stored in - * [ data[p[j]], data[p[j] + 1], ..., data[p[j+1] - 1] ] - * - * Compressed row format (CRS): - * - * If data[n] = A_{ij}, then: - * j = A->i[n] - * A->p[i] <= n < A->p[i+1] - * so that row i is stored in - * [ data[p[i]], data[p[i] + 1], ..., data[p[i+1] - 1] ] - */ - -typedef struct -{ - size_t size1; /* number of rows */ - size_t size2; /* number of columns */ - - /* i (size nzmax) contains: - * - * Triplet/CCS: row indices - * CRS: column indices - */ - size_t *i; - - double *data; /* matrix elements of size nzmax */ - - /* - * p contains the column indices (triplet) or column pointers (compcol) - * - * triplet: p[n] = column number of element data[n] - * CCS: p[j] = index in data of first non-zero element in column j - * CRS: p[i] = index in data of first non-zero element in row i - */ - size_t *p; - - size_t nzmax; /* maximum number of matrix elements */ - size_t nz; /* number of non-zero values in matrix */ - - gsl_spmatrix_tree *tree_data; /* binary tree for sorting triplet data */ - - /* - * workspace of size MAX(size1,size2)*MAX(sizeof(double),sizeof(size_t)) - * used in various routines - */ - union - { - void *work; - size_t *work_sze; - double *work_dbl; - }; - - size_t sptype; /* sparse storage type */ -} gsl_spmatrix; - -#define GSL_SPMATRIX_TRIPLET (0) -#define GSL_SPMATRIX_CCS (1) -#define GSL_SPMATRIX_CRS (2) - -#define GSL_SPMATRIX_ISTRIPLET(m) ((m)->sptype == GSL_SPMATRIX_TRIPLET) -#define GSL_SPMATRIX_ISCCS(m) ((m)->sptype == GSL_SPMATRIX_CCS) -#define GSL_SPMATRIX_ISCRS(m) ((m)->sptype == GSL_SPMATRIX_CRS) - -/* - * Prototypes - */ - -gsl_spmatrix *gsl_spmatrix_alloc(const size_t n1, const size_t n2); -gsl_spmatrix *gsl_spmatrix_alloc_nzmax(const size_t n1, const size_t n2, - const size_t nzmax, const size_t flags); -void gsl_spmatrix_free(gsl_spmatrix *m); -int gsl_spmatrix_realloc(const size_t nzmax, gsl_spmatrix *m); -int gsl_spmatrix_set_zero(gsl_spmatrix *m); -size_t gsl_spmatrix_nnz(const gsl_spmatrix *m); -int gsl_spmatrix_compare_idx(const size_t ia, const size_t ja, - const size_t ib, const size_t jb); -int gsl_spmatrix_tree_rebuild(gsl_spmatrix * m); - -/* spcopy.c */ -int gsl_spmatrix_memcpy(gsl_spmatrix *dest, const gsl_spmatrix *src); - -/* spgetset.c */ -double gsl_spmatrix_get(const gsl_spmatrix *m, const size_t i, - const size_t j); -int gsl_spmatrix_set(gsl_spmatrix *m, const size_t i, const size_t j, - const double x); -double *gsl_spmatrix_ptr(gsl_spmatrix *m, const size_t i, const size_t j); - -/* spcompress.c */ -gsl_spmatrix *gsl_spmatrix_compcol(const gsl_spmatrix *T); -gsl_spmatrix *gsl_spmatrix_ccs(const gsl_spmatrix *T); -gsl_spmatrix *gsl_spmatrix_crs(const gsl_spmatrix *T); -void gsl_spmatrix_cumsum(const size_t n, size_t *c); - -/* spio.c */ -int gsl_spmatrix_fprintf(FILE *stream, const gsl_spmatrix *m, - const char *format); -gsl_spmatrix * gsl_spmatrix_fscanf(FILE *stream); -int gsl_spmatrix_fwrite(FILE *stream, const gsl_spmatrix *m); -int gsl_spmatrix_fread(FILE *stream, gsl_spmatrix *m); - -/* spoper.c */ -int gsl_spmatrix_scale(gsl_spmatrix *m, const double x); -int gsl_spmatrix_minmax(const gsl_spmatrix *m, double *min_out, - double *max_out); -int gsl_spmatrix_add(gsl_spmatrix *c, const gsl_spmatrix *a, - const gsl_spmatrix *b); -int gsl_spmatrix_d2sp(gsl_spmatrix *S, const gsl_matrix *A); -int gsl_spmatrix_sp2d(gsl_matrix *A, const gsl_spmatrix *S); - -/* spprop.c */ -int gsl_spmatrix_equal(const gsl_spmatrix *a, const gsl_spmatrix *b); - -/* spswap.c */ -int gsl_spmatrix_transpose(gsl_spmatrix * m); -int gsl_spmatrix_transpose2(gsl_spmatrix * m); -int gsl_spmatrix_transpose_memcpy(gsl_spmatrix *dest, const gsl_spmatrix *src); - -__END_DECLS - -#endif /* __GSL_SPMATRIX_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics.h deleted file mode 100644 index 9fb414f28..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __GSL_STATISTICS_H__ -#define __GSL_STATISTICS_H__ - -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include - -#include -#include - -#endif /* __GSL_STATISTICS_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_char.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_char.h deleted file mode 100644 index c77d4c423..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_char.h +++ /dev/null @@ -1,96 +0,0 @@ -/* statistics/gsl_statistics_char.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_STATISTICS_CHAR_H__ -#define __GSL_STATISTICS_CHAR_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -double gsl_stats_char_mean (const char data[], const size_t stride, const size_t n); -double gsl_stats_char_variance (const char data[], const size_t stride, const size_t n); -double gsl_stats_char_sd (const char data[], const size_t stride, const size_t n); -double gsl_stats_char_variance_with_fixed_mean (const char data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_char_sd_with_fixed_mean (const char data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_char_tss (const char data[], const size_t stride, const size_t n); -double gsl_stats_char_tss_m (const char data[], const size_t stride, const size_t n, const double mean); - -double gsl_stats_char_absdev (const char data[], const size_t stride, const size_t n); -double gsl_stats_char_skew (const char data[], const size_t stride, const size_t n); -double gsl_stats_char_kurtosis (const char data[], const size_t stride, const size_t n); -double gsl_stats_char_lag1_autocorrelation (const char data[], const size_t stride, const size_t n); - -double gsl_stats_char_covariance (const char data1[], const size_t stride1,const char data2[], const size_t stride2, const size_t n); -double gsl_stats_char_correlation (const char data1[], const size_t stride1,const char data2[], const size_t stride2, const size_t n); -double gsl_stats_char_spearman (const char data1[], const size_t stride1, const char data2[], const size_t stride2, const size_t n, double work[]); - -double gsl_stats_char_variance_m (const char data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_char_sd_m (const char data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_char_absdev_m (const char data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_char_skew_m_sd (const char data[], const size_t stride, const size_t n, const double mean, const double sd); -double gsl_stats_char_kurtosis_m_sd (const char data[], const size_t stride, const size_t n, const double mean, const double sd); -double gsl_stats_char_lag1_autocorrelation_m (const char data[], const size_t stride, const size_t n, const double mean); - -double gsl_stats_char_covariance_m (const char data1[], const size_t stride1,const char data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); - - -double gsl_stats_char_pvariance (const char data1[], const size_t stride1, const size_t n1, const char data2[], const size_t stride2, const size_t n2); -double gsl_stats_char_ttest (const char data1[], const size_t stride1, const size_t n1, const char data2[], const size_t stride2, const size_t n2); - -char gsl_stats_char_max (const char data[], const size_t stride, const size_t n); -char gsl_stats_char_min (const char data[], const size_t stride, const size_t n); -void gsl_stats_char_minmax (char * min, char * max, const char data[], const size_t stride, const size_t n); - -size_t gsl_stats_char_max_index (const char data[], const size_t stride, const size_t n); -size_t gsl_stats_char_min_index (const char data[], const size_t stride, const size_t n); -void gsl_stats_char_minmax_index (size_t * min_index, size_t * max_index, const char data[], const size_t stride, const size_t n); - -char gsl_stats_char_select(char data[], const size_t stride, const size_t n, const size_t k); - -double gsl_stats_char_median_from_sorted_data (const char sorted_data[], const size_t stride, const size_t n) ; -double gsl_stats_char_median (char sorted_data[], const size_t stride, const size_t n); -double gsl_stats_char_quantile_from_sorted_data (const char sorted_data[], const size_t stride, const size_t n, const double f) ; - -double gsl_stats_char_trmean_from_sorted_data (const double trim, const char sorted_data[], const size_t stride, const size_t n) ; -double gsl_stats_char_gastwirth_from_sorted_data (const char sorted_data[], const size_t stride, const size_t n) ; - -double gsl_stats_char_mad0(const char data[], const size_t stride, const size_t n, double work[]); -double gsl_stats_char_mad(const char data[], const size_t stride, const size_t n, double work[]); - -char gsl_stats_char_Sn0_from_sorted_data (const char sorted_data[], const size_t stride, const size_t n, char work[]) ; -double gsl_stats_char_Sn_from_sorted_data (const char sorted_data[], const size_t stride, const size_t n, char work[]) ; - -char gsl_stats_char_Qn0_from_sorted_data (const char sorted_data[], const size_t stride, const size_t n, char work[], int work_int[]) ; -double gsl_stats_char_Qn_from_sorted_data (const char sorted_data[], const size_t stride, const size_t n, char work[], int work_int[]) ; - -__END_DECLS - -#endif /* __GSL_STATISTICS_CHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_double.h deleted file mode 100644 index 9969472ca..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_double.h +++ /dev/null @@ -1,116 +0,0 @@ -/* statistics/gsl_statistics_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_STATISTICS_DOUBLE_H__ -#define __GSL_STATISTICS_DOUBLE_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -double gsl_stats_mean (const double data[], const size_t stride, const size_t n); -double gsl_stats_variance (const double data[], const size_t stride, const size_t n); -double gsl_stats_sd (const double data[], const size_t stride, const size_t n); -double gsl_stats_variance_with_fixed_mean (const double data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_sd_with_fixed_mean (const double data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_tss (const double data[], const size_t stride, const size_t n); -double gsl_stats_tss_m (const double data[], const size_t stride, const size_t n, const double mean); - -double gsl_stats_absdev (const double data[], const size_t stride, const size_t n); -double gsl_stats_skew (const double data[], const size_t stride, const size_t n); -double gsl_stats_kurtosis (const double data[], const size_t stride, const size_t n); -double gsl_stats_lag1_autocorrelation (const double data[], const size_t stride, const size_t n); - -double gsl_stats_covariance (const double data1[], const size_t stride1,const double data2[], const size_t stride2, const size_t n); -double gsl_stats_correlation (const double data1[], const size_t stride1,const double data2[], const size_t stride2, const size_t n); -double gsl_stats_spearman (const double data1[], const size_t stride1, const double data2[], const size_t stride2, const size_t n, double work[]); - -double gsl_stats_variance_m (const double data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_sd_m (const double data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_absdev_m (const double data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_skew_m_sd (const double data[], const size_t stride, const size_t n, const double mean, const double sd); -double gsl_stats_kurtosis_m_sd (const double data[], const size_t stride, const size_t n, const double mean, const double sd); -double gsl_stats_lag1_autocorrelation_m (const double data[], const size_t stride, const size_t n, const double mean); - -double gsl_stats_covariance_m (const double data1[], const size_t stride1,const double data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); - -/* DEFINED FOR FLOATING POINT TYPES ONLY */ - -double gsl_stats_wmean (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n); -double gsl_stats_wvariance (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n); -double gsl_stats_wsd (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n); -double gsl_stats_wvariance_with_fixed_mean (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_wsd_with_fixed_mean (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_wtss (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n); -double gsl_stats_wtss_m (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n, const double wmean); -double gsl_stats_wabsdev (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n); -double gsl_stats_wskew (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n); -double gsl_stats_wkurtosis (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n); - -double gsl_stats_wvariance_m (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n, const double wmean); -double gsl_stats_wsd_m (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n, const double wmean); -double gsl_stats_wabsdev_m (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n, const double wmean); -double gsl_stats_wskew_m_sd (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n, const double wmean, const double wsd); -double gsl_stats_wkurtosis_m_sd (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n, const double wmean, const double wsd); - -/* END OF FLOATING POINT TYPES */ - -double gsl_stats_pvariance (const double data1[], const size_t stride1, const size_t n1, const double data2[], const size_t stride2, const size_t n2); -double gsl_stats_ttest (const double data1[], const size_t stride1, const size_t n1, const double data2[], const size_t stride2, const size_t n2); - -double gsl_stats_max (const double data[], const size_t stride, const size_t n); -double gsl_stats_min (const double data[], const size_t stride, const size_t n); -void gsl_stats_minmax (double * min, double * max, const double data[], const size_t stride, const size_t n); - -size_t gsl_stats_max_index (const double data[], const size_t stride, const size_t n); -size_t gsl_stats_min_index (const double data[], const size_t stride, const size_t n); -void gsl_stats_minmax_index (size_t * min_index, size_t * max_index, const double data[], const size_t stride, const size_t n); - -double gsl_stats_select(double data[], const size_t stride, const size_t n, const size_t k); - -double gsl_stats_median_from_sorted_data (const double sorted_data[], const size_t stride, const size_t n) ; -double gsl_stats_median (double sorted_data[], const size_t stride, const size_t n); -double gsl_stats_quantile_from_sorted_data (const double sorted_data[], const size_t stride, const size_t n, const double f) ; - -double gsl_stats_trmean_from_sorted_data (const double trim, const double sorted_data[], const size_t stride, const size_t n) ; -double gsl_stats_gastwirth_from_sorted_data (const double sorted_data[], const size_t stride, const size_t n) ; - -double gsl_stats_mad0(const double data[], const size_t stride, const size_t n, double work[]); -double gsl_stats_mad(const double data[], const size_t stride, const size_t n, double work[]); - -double gsl_stats_Sn0_from_sorted_data (const double sorted_data[], const size_t stride, const size_t n, double work[]) ; -double gsl_stats_Sn_from_sorted_data (const double sorted_data[], const size_t stride, const size_t n, double work[]) ; - -double gsl_stats_Qn0_from_sorted_data (const double sorted_data[], const size_t stride, const size_t n, double work[], int work_int[]) ; -double gsl_stats_Qn_from_sorted_data (const double sorted_data[], const size_t stride, const size_t n, double work[], int work_int[]) ; - -__END_DECLS - -#endif /* __GSL_STATISTICS_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_float.h deleted file mode 100644 index fa61a4d88..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_float.h +++ /dev/null @@ -1,116 +0,0 @@ -/* statistics/gsl_statistics_float.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_STATISTICS_FLOAT_H__ -#define __GSL_STATISTICS_FLOAT_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -double gsl_stats_float_mean (const float data[], const size_t stride, const size_t n); -double gsl_stats_float_variance (const float data[], const size_t stride, const size_t n); -double gsl_stats_float_sd (const float data[], const size_t stride, const size_t n); -double gsl_stats_float_variance_with_fixed_mean (const float data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_float_sd_with_fixed_mean (const float data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_float_tss (const float data[], const size_t stride, const size_t n); -double gsl_stats_float_tss_m (const float data[], const size_t stride, const size_t n, const double mean); - -double gsl_stats_float_absdev (const float data[], const size_t stride, const size_t n); -double gsl_stats_float_skew (const float data[], const size_t stride, const size_t n); -double gsl_stats_float_kurtosis (const float data[], const size_t stride, const size_t n); -double gsl_stats_float_lag1_autocorrelation (const float data[], const size_t stride, const size_t n); - -double gsl_stats_float_covariance (const float data1[], const size_t stride1,const float data2[], const size_t stride2, const size_t n); -double gsl_stats_float_correlation (const float data1[], const size_t stride1,const float data2[], const size_t stride2, const size_t n); -double gsl_stats_float_spearman (const float data1[], const size_t stride1, const float data2[], const size_t stride2, const size_t n, double work[]); - -double gsl_stats_float_variance_m (const float data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_float_sd_m (const float data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_float_absdev_m (const float data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_float_skew_m_sd (const float data[], const size_t stride, const size_t n, const double mean, const double sd); -double gsl_stats_float_kurtosis_m_sd (const float data[], const size_t stride, const size_t n, const double mean, const double sd); -double gsl_stats_float_lag1_autocorrelation_m (const float data[], const size_t stride, const size_t n, const double mean); - -double gsl_stats_float_covariance_m (const float data1[], const size_t stride1,const float data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); - -/* DEFINED FOR FLOATING POINT TYPES ONLY */ - -double gsl_stats_float_wmean (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n); -double gsl_stats_float_wvariance (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n); -double gsl_stats_float_wsd (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n); -double gsl_stats_float_wvariance_with_fixed_mean (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_float_wsd_with_fixed_mean (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_float_wtss (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n); -double gsl_stats_float_wtss_m (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n, const double wmean); -double gsl_stats_float_wabsdev (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n); -double gsl_stats_float_wskew (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n); -double gsl_stats_float_wkurtosis (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n); - -double gsl_stats_float_wvariance_m (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n, const double wmean); -double gsl_stats_float_wsd_m (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n, const double wmean); -double gsl_stats_float_wabsdev_m (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n, const double wmean); -double gsl_stats_float_wskew_m_sd (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n, const double wmean, const double wsd); -double gsl_stats_float_wkurtosis_m_sd (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n, const double wmean, const double wsd); - -/* END OF FLOATING POINT TYPES */ - -double gsl_stats_float_pvariance (const float data1[], const size_t stride1, const size_t n1, const float data2[], const size_t stride2, const size_t n2); -double gsl_stats_float_ttest (const float data1[], const size_t stride1, const size_t n1, const float data2[], const size_t stride2, const size_t n2); - -float gsl_stats_float_max (const float data[], const size_t stride, const size_t n); -float gsl_stats_float_min (const float data[], const size_t stride, const size_t n); -void gsl_stats_float_minmax (float * min, float * max, const float data[], const size_t stride, const size_t n); - -size_t gsl_stats_float_max_index (const float data[], const size_t stride, const size_t n); -size_t gsl_stats_float_min_index (const float data[], const size_t stride, const size_t n); -void gsl_stats_float_minmax_index (size_t * min_index, size_t * max_index, const float data[], const size_t stride, const size_t n); - -float gsl_stats_float_select(float data[], const size_t stride, const size_t n, const size_t k); - -double gsl_stats_float_median_from_sorted_data (const float sorted_data[], const size_t stride, const size_t n) ; -double gsl_stats_float_median (float sorted_data[], const size_t stride, const size_t n); -double gsl_stats_float_quantile_from_sorted_data (const float sorted_data[], const size_t stride, const size_t n, const double f) ; - -double gsl_stats_float_trmean_from_sorted_data (const double trim, const float sorted_data[], const size_t stride, const size_t n) ; -double gsl_stats_float_gastwirth_from_sorted_data (const float sorted_data[], const size_t stride, const size_t n) ; - -double gsl_stats_float_mad0(const float data[], const size_t stride, const size_t n, double work[]); -double gsl_stats_float_mad(const float data[], const size_t stride, const size_t n, double work[]); - -float gsl_stats_float_Sn0_from_sorted_data (const float sorted_data[], const size_t stride, const size_t n, float work[]) ; -double gsl_stats_float_Sn_from_sorted_data (const float sorted_data[], const size_t stride, const size_t n, float work[]) ; - -float gsl_stats_float_Qn0_from_sorted_data (const float sorted_data[], const size_t stride, const size_t n, float work[], int work_int[]) ; -double gsl_stats_float_Qn_from_sorted_data (const float sorted_data[], const size_t stride, const size_t n, float work[], int work_int[]) ; - -__END_DECLS - -#endif /* __GSL_STATISTICS_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_int.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_int.h deleted file mode 100644 index 1d02b3a6b..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_int.h +++ /dev/null @@ -1,96 +0,0 @@ -/* statistics/gsl_statistics_int.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_STATISTICS_INT_H__ -#define __GSL_STATISTICS_INT_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -double gsl_stats_int_mean (const int data[], const size_t stride, const size_t n); -double gsl_stats_int_variance (const int data[], const size_t stride, const size_t n); -double gsl_stats_int_sd (const int data[], const size_t stride, const size_t n); -double gsl_stats_int_variance_with_fixed_mean (const int data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_int_sd_with_fixed_mean (const int data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_int_tss (const int data[], const size_t stride, const size_t n); -double gsl_stats_int_tss_m (const int data[], const size_t stride, const size_t n, const double mean); - -double gsl_stats_int_absdev (const int data[], const size_t stride, const size_t n); -double gsl_stats_int_skew (const int data[], const size_t stride, const size_t n); -double gsl_stats_int_kurtosis (const int data[], const size_t stride, const size_t n); -double gsl_stats_int_lag1_autocorrelation (const int data[], const size_t stride, const size_t n); - -double gsl_stats_int_covariance (const int data1[], const size_t stride1,const int data2[], const size_t stride2, const size_t n); -double gsl_stats_int_correlation (const int data1[], const size_t stride1,const int data2[], const size_t stride2, const size_t n); -double gsl_stats_int_spearman (const int data1[], const size_t stride1, const int data2[], const size_t stride2, const size_t n, double work[]); - -double gsl_stats_int_variance_m (const int data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_int_sd_m (const int data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_int_absdev_m (const int data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_int_skew_m_sd (const int data[], const size_t stride, const size_t n, const double mean, const double sd); -double gsl_stats_int_kurtosis_m_sd (const int data[], const size_t stride, const size_t n, const double mean, const double sd); -double gsl_stats_int_lag1_autocorrelation_m (const int data[], const size_t stride, const size_t n, const double mean); - -double gsl_stats_int_covariance_m (const int data1[], const size_t stride1,const int data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); - - -double gsl_stats_int_pvariance (const int data1[], const size_t stride1, const size_t n1, const int data2[], const size_t stride2, const size_t n2); -double gsl_stats_int_ttest (const int data1[], const size_t stride1, const size_t n1, const int data2[], const size_t stride2, const size_t n2); - -int gsl_stats_int_max (const int data[], const size_t stride, const size_t n); -int gsl_stats_int_min (const int data[], const size_t stride, const size_t n); -void gsl_stats_int_minmax (int * min, int * max, const int data[], const size_t stride, const size_t n); - -size_t gsl_stats_int_max_index (const int data[], const size_t stride, const size_t n); -size_t gsl_stats_int_min_index (const int data[], const size_t stride, const size_t n); -void gsl_stats_int_minmax_index (size_t * min_index, size_t * max_index, const int data[], const size_t stride, const size_t n); - -int gsl_stats_int_select(int data[], const size_t stride, const size_t n, const size_t k); - -double gsl_stats_int_median_from_sorted_data (const int sorted_data[], const size_t stride, const size_t n) ; -double gsl_stats_int_median (int sorted_data[], const size_t stride, const size_t n); -double gsl_stats_int_quantile_from_sorted_data (const int sorted_data[], const size_t stride, const size_t n, const double f) ; - -double gsl_stats_int_trmean_from_sorted_data (const double trim, const int sorted_data[], const size_t stride, const size_t n) ; -double gsl_stats_int_gastwirth_from_sorted_data (const int sorted_data[], const size_t stride, const size_t n) ; - -double gsl_stats_int_mad0(const int data[], const size_t stride, const size_t n, double work[]); -double gsl_stats_int_mad(const int data[], const size_t stride, const size_t n, double work[]); - -int gsl_stats_int_Sn0_from_sorted_data (const int sorted_data[], const size_t stride, const size_t n, int work[]) ; -double gsl_stats_int_Sn_from_sorted_data (const int sorted_data[], const size_t stride, const size_t n, int work[]) ; - -int gsl_stats_int_Qn0_from_sorted_data (const int sorted_data[], const size_t stride, const size_t n, int work[], int work_int[]) ; -double gsl_stats_int_Qn_from_sorted_data (const int sorted_data[], const size_t stride, const size_t n, int work[], int work_int[]) ; - -__END_DECLS - -#endif /* __GSL_STATISTICS_INT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_long.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_long.h deleted file mode 100644 index 5bc4bbd7c..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_long.h +++ /dev/null @@ -1,96 +0,0 @@ -/* statistics/gsl_statistics_long.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_STATISTICS_LONG_H__ -#define __GSL_STATISTICS_LONG_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -double gsl_stats_long_mean (const long data[], const size_t stride, const size_t n); -double gsl_stats_long_variance (const long data[], const size_t stride, const size_t n); -double gsl_stats_long_sd (const long data[], const size_t stride, const size_t n); -double gsl_stats_long_variance_with_fixed_mean (const long data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_long_sd_with_fixed_mean (const long data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_long_tss (const long data[], const size_t stride, const size_t n); -double gsl_stats_long_tss_m (const long data[], const size_t stride, const size_t n, const double mean); - -double gsl_stats_long_absdev (const long data[], const size_t stride, const size_t n); -double gsl_stats_long_skew (const long data[], const size_t stride, const size_t n); -double gsl_stats_long_kurtosis (const long data[], const size_t stride, const size_t n); -double gsl_stats_long_lag1_autocorrelation (const long data[], const size_t stride, const size_t n); - -double gsl_stats_long_covariance (const long data1[], const size_t stride1,const long data2[], const size_t stride2, const size_t n); -double gsl_stats_long_correlation (const long data1[], const size_t stride1,const long data2[], const size_t stride2, const size_t n); -double gsl_stats_long_spearman (const long data1[], const size_t stride1, const long data2[], const size_t stride2, const size_t n, double work[]); - -double gsl_stats_long_variance_m (const long data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_long_sd_m (const long data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_long_absdev_m (const long data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_long_skew_m_sd (const long data[], const size_t stride, const size_t n, const double mean, const double sd); -double gsl_stats_long_kurtosis_m_sd (const long data[], const size_t stride, const size_t n, const double mean, const double sd); -double gsl_stats_long_lag1_autocorrelation_m (const long data[], const size_t stride, const size_t n, const double mean); - -double gsl_stats_long_covariance_m (const long data1[], const size_t stride1,const long data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); - - -double gsl_stats_long_pvariance (const long data1[], const size_t stride1, const size_t n1, const long data2[], const size_t stride2, const size_t n2); -double gsl_stats_long_ttest (const long data1[], const size_t stride1, const size_t n1, const long data2[], const size_t stride2, const size_t n2); - -long gsl_stats_long_max (const long data[], const size_t stride, const size_t n); -long gsl_stats_long_min (const long data[], const size_t stride, const size_t n); -void gsl_stats_long_minmax (long * min, long * max, const long data[], const size_t stride, const size_t n); - -size_t gsl_stats_long_max_index (const long data[], const size_t stride, const size_t n); -size_t gsl_stats_long_min_index (const long data[], const size_t stride, const size_t n); -void gsl_stats_long_minmax_index (size_t * min_index, size_t * max_index, const long data[], const size_t stride, const size_t n); - -long gsl_stats_long_select(long data[], const size_t stride, const size_t n, const size_t k); - -double gsl_stats_long_median_from_sorted_data (const long sorted_data[], const size_t stride, const size_t n) ; -double gsl_stats_long_median (long sorted_data[], const size_t stride, const size_t n); -double gsl_stats_long_quantile_from_sorted_data (const long sorted_data[], const size_t stride, const size_t n, const double f) ; - -double gsl_stats_long_trmean_from_sorted_data (const double trim, const long sorted_data[], const size_t stride, const size_t n) ; -double gsl_stats_long_gastwirth_from_sorted_data (const long sorted_data[], const size_t stride, const size_t n) ; - -double gsl_stats_long_mad0(const long data[], const size_t stride, const size_t n, double work[]); -double gsl_stats_long_mad(const long data[], const size_t stride, const size_t n, double work[]); - -long gsl_stats_long_Sn0_from_sorted_data (const long sorted_data[], const size_t stride, const size_t n, long work[]) ; -double gsl_stats_long_Sn_from_sorted_data (const long sorted_data[], const size_t stride, const size_t n, long work[]) ; - -long gsl_stats_long_Qn0_from_sorted_data (const long sorted_data[], const size_t stride, const size_t n, long work[], int work_int[]) ; -double gsl_stats_long_Qn_from_sorted_data (const long sorted_data[], const size_t stride, const size_t n, long work[], int work_int[]) ; - -__END_DECLS - -#endif /* __GSL_STATISTICS_LONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_long_double.h deleted file mode 100644 index 6b384271d..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_long_double.h +++ /dev/null @@ -1,116 +0,0 @@ -/* statistics/gsl_statistics_long_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_STATISTICS_LONG_DOUBLE_H__ -#define __GSL_STATISTICS_LONG_DOUBLE_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -double gsl_stats_long_double_mean (const long double data[], const size_t stride, const size_t n); -double gsl_stats_long_double_variance (const long double data[], const size_t stride, const size_t n); -double gsl_stats_long_double_sd (const long double data[], const size_t stride, const size_t n); -double gsl_stats_long_double_variance_with_fixed_mean (const long double data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_long_double_sd_with_fixed_mean (const long double data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_long_double_tss (const long double data[], const size_t stride, const size_t n); -double gsl_stats_long_double_tss_m (const long double data[], const size_t stride, const size_t n, const double mean); - -double gsl_stats_long_double_absdev (const long double data[], const size_t stride, const size_t n); -double gsl_stats_long_double_skew (const long double data[], const size_t stride, const size_t n); -double gsl_stats_long_double_kurtosis (const long double data[], const size_t stride, const size_t n); -double gsl_stats_long_double_lag1_autocorrelation (const long double data[], const size_t stride, const size_t n); - -double gsl_stats_long_double_covariance (const long double data1[], const size_t stride1,const long double data2[], const size_t stride2, const size_t n); -double gsl_stats_long_double_correlation (const long double data1[], const size_t stride1,const long double data2[], const size_t stride2, const size_t n); -double gsl_stats_long_double_spearman (const long double data1[], const size_t stride1, const long double data2[], const size_t stride2, const size_t n, double work[]); - -double gsl_stats_long_double_variance_m (const long double data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_long_double_sd_m (const long double data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_long_double_absdev_m (const long double data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_long_double_skew_m_sd (const long double data[], const size_t stride, const size_t n, const double mean, const double sd); -double gsl_stats_long_double_kurtosis_m_sd (const long double data[], const size_t stride, const size_t n, const double mean, const double sd); -double gsl_stats_long_double_lag1_autocorrelation_m (const long double data[], const size_t stride, const size_t n, const double mean); - -double gsl_stats_long_double_covariance_m (const long double data1[], const size_t stride1,const long double data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); - -/* DEFINED FOR FLOATING POINT TYPES ONLY */ - -double gsl_stats_long_double_wmean (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n); -double gsl_stats_long_double_wvariance (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n); -double gsl_stats_long_double_wsd (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n); -double gsl_stats_long_double_wvariance_with_fixed_mean (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_long_double_wsd_with_fixed_mean (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_long_double_wtss (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n); -double gsl_stats_long_double_wtss_m (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n, const double wmean); -double gsl_stats_long_double_wabsdev (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n); -double gsl_stats_long_double_wskew (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n); -double gsl_stats_long_double_wkurtosis (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n); - -double gsl_stats_long_double_wvariance_m (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n, const double wmean); -double gsl_stats_long_double_wsd_m (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n, const double wmean); -double gsl_stats_long_double_wabsdev_m (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n, const double wmean); -double gsl_stats_long_double_wskew_m_sd (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n, const double wmean, const double wsd); -double gsl_stats_long_double_wkurtosis_m_sd (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n, const double wmean, const double wsd); - -/* END OF FLOATING POINT TYPES */ - -double gsl_stats_long_double_pvariance (const long double data1[], const size_t stride1, const size_t n1, const long double data2[], const size_t stride2, const size_t n2); -double gsl_stats_long_double_ttest (const long double data1[], const size_t stride1, const size_t n1, const long double data2[], const size_t stride2, const size_t n2); - -long double gsl_stats_long_double_max (const long double data[], const size_t stride, const size_t n); -long double gsl_stats_long_double_min (const long double data[], const size_t stride, const size_t n); -void gsl_stats_long_double_minmax (long double * min, long double * max, const long double data[], const size_t stride, const size_t n); - -size_t gsl_stats_long_double_max_index (const long double data[], const size_t stride, const size_t n); -size_t gsl_stats_long_double_min_index (const long double data[], const size_t stride, const size_t n); -void gsl_stats_long_double_minmax_index (size_t * min_index, size_t * max_index, const long double data[], const size_t stride, const size_t n); - -long double gsl_stats_long_double_select(long double data[], const size_t stride, const size_t n, const size_t k); - -double gsl_stats_long_double_median_from_sorted_data (const long double sorted_data[], const size_t stride, const size_t n) ; -double gsl_stats_long_double_median (long double sorted_data[], const size_t stride, const size_t n); -double gsl_stats_long_double_quantile_from_sorted_data (const long double sorted_data[], const size_t stride, const size_t n, const double f) ; - -double gsl_stats_long_double_trmean_from_sorted_data (const double trim, const long double sorted_data[], const size_t stride, const size_t n) ; -double gsl_stats_long_double_gastwirth_from_sorted_data (const long double sorted_data[], const size_t stride, const size_t n) ; - -double gsl_stats_long_double_mad0(const long double data[], const size_t stride, const size_t n, double work[]); -double gsl_stats_long_double_mad(const long double data[], const size_t stride, const size_t n, double work[]); - -long double gsl_stats_long_double_Sn0_from_sorted_data (const long double sorted_data[], const size_t stride, const size_t n, long double work[]) ; -double gsl_stats_long_double_Sn_from_sorted_data (const long double sorted_data[], const size_t stride, const size_t n, long double work[]) ; - -long double gsl_stats_long_double_Qn0_from_sorted_data (const long double sorted_data[], const size_t stride, const size_t n, long double work[], int work_int[]) ; -double gsl_stats_long_double_Qn_from_sorted_data (const long double sorted_data[], const size_t stride, const size_t n, long double work[], int work_int[]) ; - -__END_DECLS - -#endif /* __GSL_STATISTICS_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_short.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_short.h deleted file mode 100644 index 8ecaceeaa..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_short.h +++ /dev/null @@ -1,96 +0,0 @@ -/* statistics/gsl_statistics_short.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_STATISTICS_SHORT_H__ -#define __GSL_STATISTICS_SHORT_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -double gsl_stats_short_mean (const short data[], const size_t stride, const size_t n); -double gsl_stats_short_variance (const short data[], const size_t stride, const size_t n); -double gsl_stats_short_sd (const short data[], const size_t stride, const size_t n); -double gsl_stats_short_variance_with_fixed_mean (const short data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_short_sd_with_fixed_mean (const short data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_short_tss (const short data[], const size_t stride, const size_t n); -double gsl_stats_short_tss_m (const short data[], const size_t stride, const size_t n, const double mean); - -double gsl_stats_short_absdev (const short data[], const size_t stride, const size_t n); -double gsl_stats_short_skew (const short data[], const size_t stride, const size_t n); -double gsl_stats_short_kurtosis (const short data[], const size_t stride, const size_t n); -double gsl_stats_short_lag1_autocorrelation (const short data[], const size_t stride, const size_t n); - -double gsl_stats_short_covariance (const short data1[], const size_t stride1,const short data2[], const size_t stride2, const size_t n); -double gsl_stats_short_correlation (const short data1[], const size_t stride1,const short data2[], const size_t stride2, const size_t n); -double gsl_stats_short_spearman (const short data1[], const size_t stride1, const short data2[], const size_t stride2, const size_t n, double work[]); - -double gsl_stats_short_variance_m (const short data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_short_sd_m (const short data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_short_absdev_m (const short data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_short_skew_m_sd (const short data[], const size_t stride, const size_t n, const double mean, const double sd); -double gsl_stats_short_kurtosis_m_sd (const short data[], const size_t stride, const size_t n, const double mean, const double sd); -double gsl_stats_short_lag1_autocorrelation_m (const short data[], const size_t stride, const size_t n, const double mean); - -double gsl_stats_short_covariance_m (const short data1[], const size_t stride1,const short data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); - - -double gsl_stats_short_pvariance (const short data1[], const size_t stride1, const size_t n1, const short data2[], const size_t stride2, const size_t n2); -double gsl_stats_short_ttest (const short data1[], const size_t stride1, const size_t n1, const short data2[], const size_t stride2, const size_t n2); - -short gsl_stats_short_max (const short data[], const size_t stride, const size_t n); -short gsl_stats_short_min (const short data[], const size_t stride, const size_t n); -void gsl_stats_short_minmax (short * min, short * max, const short data[], const size_t stride, const size_t n); - -size_t gsl_stats_short_max_index (const short data[], const size_t stride, const size_t n); -size_t gsl_stats_short_min_index (const short data[], const size_t stride, const size_t n); -void gsl_stats_short_minmax_index (size_t * min_index, size_t * max_index, const short data[], const size_t stride, const size_t n); - -short gsl_stats_short_select(short data[], const size_t stride, const size_t n, const size_t k); - -double gsl_stats_short_median_from_sorted_data (const short sorted_data[], const size_t stride, const size_t n) ; -double gsl_stats_short_median (short sorted_data[], const size_t stride, const size_t n); -double gsl_stats_short_quantile_from_sorted_data (const short sorted_data[], const size_t stride, const size_t n, const double f) ; - -double gsl_stats_short_trmean_from_sorted_data (const double trim, const short sorted_data[], const size_t stride, const size_t n) ; -double gsl_stats_short_gastwirth_from_sorted_data (const short sorted_data[], const size_t stride, const size_t n) ; - -double gsl_stats_short_mad0(const short data[], const size_t stride, const size_t n, double work[]); -double gsl_stats_short_mad(const short data[], const size_t stride, const size_t n, double work[]); - -short gsl_stats_short_Sn0_from_sorted_data (const short sorted_data[], const size_t stride, const size_t n, short work[]) ; -double gsl_stats_short_Sn_from_sorted_data (const short sorted_data[], const size_t stride, const size_t n, short work[]) ; - -short gsl_stats_short_Qn0_from_sorted_data (const short sorted_data[], const size_t stride, const size_t n, short work[], int work_int[]) ; -double gsl_stats_short_Qn_from_sorted_data (const short sorted_data[], const size_t stride, const size_t n, short work[], int work_int[]) ; - -__END_DECLS - -#endif /* __GSL_STATISTICS_SHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_uchar.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_uchar.h deleted file mode 100644 index e5f549b01..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_uchar.h +++ /dev/null @@ -1,96 +0,0 @@ -/* statistics/gsl_statistics_uchar.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_STATISTICS_UCHAR_H__ -#define __GSL_STATISTICS_UCHAR_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -double gsl_stats_uchar_mean (const unsigned char data[], const size_t stride, const size_t n); -double gsl_stats_uchar_variance (const unsigned char data[], const size_t stride, const size_t n); -double gsl_stats_uchar_sd (const unsigned char data[], const size_t stride, const size_t n); -double gsl_stats_uchar_variance_with_fixed_mean (const unsigned char data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_uchar_sd_with_fixed_mean (const unsigned char data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_uchar_tss (const unsigned char data[], const size_t stride, const size_t n); -double gsl_stats_uchar_tss_m (const unsigned char data[], const size_t stride, const size_t n, const double mean); - -double gsl_stats_uchar_absdev (const unsigned char data[], const size_t stride, const size_t n); -double gsl_stats_uchar_skew (const unsigned char data[], const size_t stride, const size_t n); -double gsl_stats_uchar_kurtosis (const unsigned char data[], const size_t stride, const size_t n); -double gsl_stats_uchar_lag1_autocorrelation (const unsigned char data[], const size_t stride, const size_t n); - -double gsl_stats_uchar_covariance (const unsigned char data1[], const size_t stride1,const unsigned char data2[], const size_t stride2, const size_t n); -double gsl_stats_uchar_correlation (const unsigned char data1[], const size_t stride1,const unsigned char data2[], const size_t stride2, const size_t n); -double gsl_stats_uchar_spearman (const unsigned char data1[], const size_t stride1, const unsigned char data2[], const size_t stride2, const size_t n, double work[]); - -double gsl_stats_uchar_variance_m (const unsigned char data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_uchar_sd_m (const unsigned char data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_uchar_absdev_m (const unsigned char data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_uchar_skew_m_sd (const unsigned char data[], const size_t stride, const size_t n, const double mean, const double sd); -double gsl_stats_uchar_kurtosis_m_sd (const unsigned char data[], const size_t stride, const size_t n, const double mean, const double sd); -double gsl_stats_uchar_lag1_autocorrelation_m (const unsigned char data[], const size_t stride, const size_t n, const double mean); - -double gsl_stats_uchar_covariance_m (const unsigned char data1[], const size_t stride1,const unsigned char data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); - - -double gsl_stats_uchar_pvariance (const unsigned char data1[], const size_t stride1, const size_t n1, const unsigned char data2[], const size_t stride2, const size_t n2); -double gsl_stats_uchar_ttest (const unsigned char data1[], const size_t stride1, const size_t n1, const unsigned char data2[], const size_t stride2, const size_t n2); - -unsigned char gsl_stats_uchar_max (const unsigned char data[], const size_t stride, const size_t n); -unsigned char gsl_stats_uchar_min (const unsigned char data[], const size_t stride, const size_t n); -void gsl_stats_uchar_minmax (unsigned char * min, unsigned char * max, const unsigned char data[], const size_t stride, const size_t n); - -size_t gsl_stats_uchar_max_index (const unsigned char data[], const size_t stride, const size_t n); -size_t gsl_stats_uchar_min_index (const unsigned char data[], const size_t stride, const size_t n); -void gsl_stats_uchar_minmax_index (size_t * min_index, size_t * max_index, const unsigned char data[], const size_t stride, const size_t n); - -unsigned char gsl_stats_uchar_select(unsigned char data[], const size_t stride, const size_t n, const size_t k); - -double gsl_stats_uchar_median_from_sorted_data (const unsigned char sorted_data[], const size_t stride, const size_t n) ; -double gsl_stats_uchar_median (unsigned char sorted_data[], const size_t stride, const size_t n); -double gsl_stats_uchar_quantile_from_sorted_data (const unsigned char sorted_data[], const size_t stride, const size_t n, const double f) ; - -double gsl_stats_uchar_trmean_from_sorted_data (const double trim, const unsigned char sorted_data[], const size_t stride, const size_t n) ; -double gsl_stats_uchar_gastwirth_from_sorted_data (const unsigned char sorted_data[], const size_t stride, const size_t n) ; - -double gsl_stats_uchar_mad0(const unsigned char data[], const size_t stride, const size_t n, double work[]); -double gsl_stats_uchar_mad(const unsigned char data[], const size_t stride, const size_t n, double work[]); - -unsigned char gsl_stats_uchar_Sn0_from_sorted_data (const unsigned char sorted_data[], const size_t stride, const size_t n, unsigned char work[]) ; -double gsl_stats_uchar_Sn_from_sorted_data (const unsigned char sorted_data[], const size_t stride, const size_t n, unsigned char work[]) ; - -unsigned char gsl_stats_uchar_Qn0_from_sorted_data (const unsigned char sorted_data[], const size_t stride, const size_t n, unsigned char work[], int work_int[]) ; -double gsl_stats_uchar_Qn_from_sorted_data (const unsigned char sorted_data[], const size_t stride, const size_t n, unsigned char work[], int work_int[]) ; - -__END_DECLS - -#endif /* __GSL_STATISTICS_UCHAR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_uint.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_uint.h deleted file mode 100644 index fca9e7d5a..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_uint.h +++ /dev/null @@ -1,96 +0,0 @@ -/* statistics/gsl_statistics_uint.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_STATISTICS_UINT_H__ -#define __GSL_STATISTICS_UINT_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -double gsl_stats_uint_mean (const unsigned int data[], const size_t stride, const size_t n); -double gsl_stats_uint_variance (const unsigned int data[], const size_t stride, const size_t n); -double gsl_stats_uint_sd (const unsigned int data[], const size_t stride, const size_t n); -double gsl_stats_uint_variance_with_fixed_mean (const unsigned int data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_uint_sd_with_fixed_mean (const unsigned int data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_uint_tss (const unsigned int data[], const size_t stride, const size_t n); -double gsl_stats_uint_tss_m (const unsigned int data[], const size_t stride, const size_t n, const double mean); - -double gsl_stats_uint_absdev (const unsigned int data[], const size_t stride, const size_t n); -double gsl_stats_uint_skew (const unsigned int data[], const size_t stride, const size_t n); -double gsl_stats_uint_kurtosis (const unsigned int data[], const size_t stride, const size_t n); -double gsl_stats_uint_lag1_autocorrelation (const unsigned int data[], const size_t stride, const size_t n); - -double gsl_stats_uint_covariance (const unsigned int data1[], const size_t stride1,const unsigned int data2[], const size_t stride2, const size_t n); -double gsl_stats_uint_correlation (const unsigned int data1[], const size_t stride1,const unsigned int data2[], const size_t stride2, const size_t n); -double gsl_stats_uint_spearman (const unsigned int data1[], const size_t stride1, const unsigned int data2[], const size_t stride2, const size_t n, double work[]); - -double gsl_stats_uint_variance_m (const unsigned int data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_uint_sd_m (const unsigned int data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_uint_absdev_m (const unsigned int data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_uint_skew_m_sd (const unsigned int data[], const size_t stride, const size_t n, const double mean, const double sd); -double gsl_stats_uint_kurtosis_m_sd (const unsigned int data[], const size_t stride, const size_t n, const double mean, const double sd); -double gsl_stats_uint_lag1_autocorrelation_m (const unsigned int data[], const size_t stride, const size_t n, const double mean); - -double gsl_stats_uint_covariance_m (const unsigned int data1[], const size_t stride1,const unsigned int data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); - - -double gsl_stats_uint_pvariance (const unsigned int data1[], const size_t stride1, const size_t n1, const unsigned int data2[], const size_t stride2, const size_t n2); -double gsl_stats_uint_ttest (const unsigned int data1[], const size_t stride1, const size_t n1, const unsigned int data2[], const size_t stride2, const size_t n2); - -unsigned int gsl_stats_uint_max (const unsigned int data[], const size_t stride, const size_t n); -unsigned int gsl_stats_uint_min (const unsigned int data[], const size_t stride, const size_t n); -void gsl_stats_uint_minmax (unsigned int * min, unsigned int * max, const unsigned int data[], const size_t stride, const size_t n); - -size_t gsl_stats_uint_max_index (const unsigned int data[], const size_t stride, const size_t n); -size_t gsl_stats_uint_min_index (const unsigned int data[], const size_t stride, const size_t n); -void gsl_stats_uint_minmax_index (size_t * min_index, size_t * max_index, const unsigned int data[], const size_t stride, const size_t n); - -unsigned int gsl_stats_uint_select(unsigned int data[], const size_t stride, const size_t n, const size_t k); - -double gsl_stats_uint_median_from_sorted_data (const unsigned int sorted_data[], const size_t stride, const size_t n) ; -double gsl_stats_uint_median (unsigned int sorted_data[], const size_t stride, const size_t n); -double gsl_stats_uint_quantile_from_sorted_data (const unsigned int sorted_data[], const size_t stride, const size_t n, const double f) ; - -double gsl_stats_uint_trmean_from_sorted_data (const double trim, const unsigned int sorted_data[], const size_t stride, const size_t n) ; -double gsl_stats_uint_gastwirth_from_sorted_data (const unsigned int sorted_data[], const size_t stride, const size_t n) ; - -double gsl_stats_uint_mad0(const unsigned int data[], const size_t stride, const size_t n, double work[]); -double gsl_stats_uint_mad(const unsigned int data[], const size_t stride, const size_t n, double work[]); - -unsigned int gsl_stats_uint_Sn0_from_sorted_data (const unsigned int sorted_data[], const size_t stride, const size_t n, unsigned int work[]) ; -double gsl_stats_uint_Sn_from_sorted_data (const unsigned int sorted_data[], const size_t stride, const size_t n, unsigned int work[]) ; - -unsigned int gsl_stats_uint_Qn0_from_sorted_data (const unsigned int sorted_data[], const size_t stride, const size_t n, unsigned int work[], int work_int[]) ; -double gsl_stats_uint_Qn_from_sorted_data (const unsigned int sorted_data[], const size_t stride, const size_t n, unsigned int work[], int work_int[]) ; - -__END_DECLS - -#endif /* __GSL_STATISTICS_UINT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_ulong.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_ulong.h deleted file mode 100644 index 2957fd142..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_ulong.h +++ /dev/null @@ -1,96 +0,0 @@ -/* statistics/gsl_statistics_ulong.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_STATISTICS_ULONG_H__ -#define __GSL_STATISTICS_ULONG_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -double gsl_stats_ulong_mean (const unsigned long data[], const size_t stride, const size_t n); -double gsl_stats_ulong_variance (const unsigned long data[], const size_t stride, const size_t n); -double gsl_stats_ulong_sd (const unsigned long data[], const size_t stride, const size_t n); -double gsl_stats_ulong_variance_with_fixed_mean (const unsigned long data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_ulong_sd_with_fixed_mean (const unsigned long data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_ulong_tss (const unsigned long data[], const size_t stride, const size_t n); -double gsl_stats_ulong_tss_m (const unsigned long data[], const size_t stride, const size_t n, const double mean); - -double gsl_stats_ulong_absdev (const unsigned long data[], const size_t stride, const size_t n); -double gsl_stats_ulong_skew (const unsigned long data[], const size_t stride, const size_t n); -double gsl_stats_ulong_kurtosis (const unsigned long data[], const size_t stride, const size_t n); -double gsl_stats_ulong_lag1_autocorrelation (const unsigned long data[], const size_t stride, const size_t n); - -double gsl_stats_ulong_covariance (const unsigned long data1[], const size_t stride1,const unsigned long data2[], const size_t stride2, const size_t n); -double gsl_stats_ulong_correlation (const unsigned long data1[], const size_t stride1,const unsigned long data2[], const size_t stride2, const size_t n); -double gsl_stats_ulong_spearman (const unsigned long data1[], const size_t stride1, const unsigned long data2[], const size_t stride2, const size_t n, double work[]); - -double gsl_stats_ulong_variance_m (const unsigned long data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_ulong_sd_m (const unsigned long data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_ulong_absdev_m (const unsigned long data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_ulong_skew_m_sd (const unsigned long data[], const size_t stride, const size_t n, const double mean, const double sd); -double gsl_stats_ulong_kurtosis_m_sd (const unsigned long data[], const size_t stride, const size_t n, const double mean, const double sd); -double gsl_stats_ulong_lag1_autocorrelation_m (const unsigned long data[], const size_t stride, const size_t n, const double mean); - -double gsl_stats_ulong_covariance_m (const unsigned long data1[], const size_t stride1,const unsigned long data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); - - -double gsl_stats_ulong_pvariance (const unsigned long data1[], const size_t stride1, const size_t n1, const unsigned long data2[], const size_t stride2, const size_t n2); -double gsl_stats_ulong_ttest (const unsigned long data1[], const size_t stride1, const size_t n1, const unsigned long data2[], const size_t stride2, const size_t n2); - -unsigned long gsl_stats_ulong_max (const unsigned long data[], const size_t stride, const size_t n); -unsigned long gsl_stats_ulong_min (const unsigned long data[], const size_t stride, const size_t n); -void gsl_stats_ulong_minmax (unsigned long * min, unsigned long * max, const unsigned long data[], const size_t stride, const size_t n); - -size_t gsl_stats_ulong_max_index (const unsigned long data[], const size_t stride, const size_t n); -size_t gsl_stats_ulong_min_index (const unsigned long data[], const size_t stride, const size_t n); -void gsl_stats_ulong_minmax_index (size_t * min_index, size_t * max_index, const unsigned long data[], const size_t stride, const size_t n); - -unsigned long gsl_stats_ulong_select(unsigned long data[], const size_t stride, const size_t n, const size_t k); - -double gsl_stats_ulong_median_from_sorted_data (const unsigned long sorted_data[], const size_t stride, const size_t n) ; -double gsl_stats_ulong_median (unsigned long sorted_data[], const size_t stride, const size_t n); -double gsl_stats_ulong_quantile_from_sorted_data (const unsigned long sorted_data[], const size_t stride, const size_t n, const double f) ; - -double gsl_stats_ulong_trmean_from_sorted_data (const double trim, const unsigned long sorted_data[], const size_t stride, const size_t n) ; -double gsl_stats_ulong_gastwirth_from_sorted_data (const unsigned long sorted_data[], const size_t stride, const size_t n) ; - -double gsl_stats_ulong_mad0(const unsigned long data[], const size_t stride, const size_t n, double work[]); -double gsl_stats_ulong_mad(const unsigned long data[], const size_t stride, const size_t n, double work[]); - -unsigned long gsl_stats_ulong_Sn0_from_sorted_data (const unsigned long sorted_data[], const size_t stride, const size_t n, unsigned long work[]) ; -double gsl_stats_ulong_Sn_from_sorted_data (const unsigned long sorted_data[], const size_t stride, const size_t n, unsigned long work[]) ; - -unsigned long gsl_stats_ulong_Qn0_from_sorted_data (const unsigned long sorted_data[], const size_t stride, const size_t n, unsigned long work[], int work_int[]) ; -double gsl_stats_ulong_Qn_from_sorted_data (const unsigned long sorted_data[], const size_t stride, const size_t n, unsigned long work[], int work_int[]) ; - -__END_DECLS - -#endif /* __GSL_STATISTICS_ULONG_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_ushort.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_ushort.h deleted file mode 100644 index 7625f5d47..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_statistics_ushort.h +++ /dev/null @@ -1,96 +0,0 @@ -/* statistics/gsl_statistics_ushort.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_STATISTICS_USHORT_H__ -#define __GSL_STATISTICS_USHORT_H__ - -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -double gsl_stats_ushort_mean (const unsigned short data[], const size_t stride, const size_t n); -double gsl_stats_ushort_variance (const unsigned short data[], const size_t stride, const size_t n); -double gsl_stats_ushort_sd (const unsigned short data[], const size_t stride, const size_t n); -double gsl_stats_ushort_variance_with_fixed_mean (const unsigned short data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_ushort_sd_with_fixed_mean (const unsigned short data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_ushort_tss (const unsigned short data[], const size_t stride, const size_t n); -double gsl_stats_ushort_tss_m (const unsigned short data[], const size_t stride, const size_t n, const double mean); - -double gsl_stats_ushort_absdev (const unsigned short data[], const size_t stride, const size_t n); -double gsl_stats_ushort_skew (const unsigned short data[], const size_t stride, const size_t n); -double gsl_stats_ushort_kurtosis (const unsigned short data[], const size_t stride, const size_t n); -double gsl_stats_ushort_lag1_autocorrelation (const unsigned short data[], const size_t stride, const size_t n); - -double gsl_stats_ushort_covariance (const unsigned short data1[], const size_t stride1,const unsigned short data2[], const size_t stride2, const size_t n); -double gsl_stats_ushort_correlation (const unsigned short data1[], const size_t stride1,const unsigned short data2[], const size_t stride2, const size_t n); -double gsl_stats_ushort_spearman (const unsigned short data1[], const size_t stride1, const unsigned short data2[], const size_t stride2, const size_t n, double work[]); - -double gsl_stats_ushort_variance_m (const unsigned short data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_ushort_sd_m (const unsigned short data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_ushort_absdev_m (const unsigned short data[], const size_t stride, const size_t n, const double mean); -double gsl_stats_ushort_skew_m_sd (const unsigned short data[], const size_t stride, const size_t n, const double mean, const double sd); -double gsl_stats_ushort_kurtosis_m_sd (const unsigned short data[], const size_t stride, const size_t n, const double mean, const double sd); -double gsl_stats_ushort_lag1_autocorrelation_m (const unsigned short data[], const size_t stride, const size_t n, const double mean); - -double gsl_stats_ushort_covariance_m (const unsigned short data1[], const size_t stride1,const unsigned short data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); - - -double gsl_stats_ushort_pvariance (const unsigned short data1[], const size_t stride1, const size_t n1, const unsigned short data2[], const size_t stride2, const size_t n2); -double gsl_stats_ushort_ttest (const unsigned short data1[], const size_t stride1, const size_t n1, const unsigned short data2[], const size_t stride2, const size_t n2); - -unsigned short gsl_stats_ushort_max (const unsigned short data[], const size_t stride, const size_t n); -unsigned short gsl_stats_ushort_min (const unsigned short data[], const size_t stride, const size_t n); -void gsl_stats_ushort_minmax (unsigned short * min, unsigned short * max, const unsigned short data[], const size_t stride, const size_t n); - -size_t gsl_stats_ushort_max_index (const unsigned short data[], const size_t stride, const size_t n); -size_t gsl_stats_ushort_min_index (const unsigned short data[], const size_t stride, const size_t n); -void gsl_stats_ushort_minmax_index (size_t * min_index, size_t * max_index, const unsigned short data[], const size_t stride, const size_t n); - -unsigned short gsl_stats_ushort_select(unsigned short data[], const size_t stride, const size_t n, const size_t k); - -double gsl_stats_ushort_median_from_sorted_data (const unsigned short sorted_data[], const size_t stride, const size_t n) ; -double gsl_stats_ushort_median (unsigned short sorted_data[], const size_t stride, const size_t n); -double gsl_stats_ushort_quantile_from_sorted_data (const unsigned short sorted_data[], const size_t stride, const size_t n, const double f) ; - -double gsl_stats_ushort_trmean_from_sorted_data (const double trim, const unsigned short sorted_data[], const size_t stride, const size_t n) ; -double gsl_stats_ushort_gastwirth_from_sorted_data (const unsigned short sorted_data[], const size_t stride, const size_t n) ; - -double gsl_stats_ushort_mad0(const unsigned short data[], const size_t stride, const size_t n, double work[]); -double gsl_stats_ushort_mad(const unsigned short data[], const size_t stride, const size_t n, double work[]); - -unsigned short gsl_stats_ushort_Sn0_from_sorted_data (const unsigned short sorted_data[], const size_t stride, const size_t n, unsigned short work[]) ; -double gsl_stats_ushort_Sn_from_sorted_data (const unsigned short sorted_data[], const size_t stride, const size_t n, unsigned short work[]) ; - -unsigned short gsl_stats_ushort_Qn0_from_sorted_data (const unsigned short sorted_data[], const size_t stride, const size_t n, unsigned short work[], int work_int[]) ; -double gsl_stats_ushort_Qn_from_sorted_data (const unsigned short sorted_data[], const size_t stride, const size_t n, unsigned short work[], int work_int[]) ; - -__END_DECLS - -#endif /* __GSL_STATISTICS_USHORT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sum.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sum.h deleted file mode 100644 index d9c4da81a..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sum.h +++ /dev/null @@ -1,162 +0,0 @@ -/* sum/gsl_sum.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Author: G. Jungman */ - - -#ifndef __GSL_SUM_H__ -#define __GSL_SUM_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -/* Workspace for Levin U Transform with error estimation, - * - * size = number of terms the workspace can handle - * sum_plain = simple sum of series - * q_num = backward diagonal of numerator; length = size - * q_den = backward diagonal of denominator; length = size - * dq_num = table of numerator derivatives; length = size**2 - * dq_den = table of denominator derivatives; length = size**2 - * dsum = derivative of sum wrt term i; length = size - */ - -typedef struct -{ - size_t size; - size_t i; /* position in array */ - size_t terms_used; /* number of calls */ - double sum_plain; - double *q_num; - double *q_den; - double *dq_num; - double *dq_den; - double *dsum; -} -gsl_sum_levin_u_workspace; - -gsl_sum_levin_u_workspace *gsl_sum_levin_u_alloc (size_t n); -void gsl_sum_levin_u_free (gsl_sum_levin_u_workspace * w); - -/* Basic Levin-u acceleration method. - * - * array = array of series elements - * n = size of array - * sum_accel = result of summation acceleration - * err = estimated error - * - * See [Fessler et al., ACM TOMS 9, 346 (1983) and TOMS-602] - */ - -int gsl_sum_levin_u_accel (const double *array, - const size_t n, - gsl_sum_levin_u_workspace * w, - double *sum_accel, double *abserr); - -/* Basic Levin-u acceleration method with constraints on the terms - * used, - * - * array = array of series elements - * n = size of array - * min_terms = minimum number of terms to sum - * max_terms = maximum number of terms to sum - * sum_accel = result of summation acceleration - * err = estimated error - * - * See [Fessler et al., ACM TOMS 9, 346 (1983) and TOMS-602] - */ - -int gsl_sum_levin_u_minmax (const double *array, - const size_t n, - const size_t min_terms, - const size_t max_terms, - gsl_sum_levin_u_workspace * w, - double *sum_accel, double *abserr); - -/* Basic Levin-u step w/o reference to the array of terms. - * We only need to specify the value of the current term - * to execute the step. See TOMS-745. - * - * sum = t0 + ... + t_{n-1} + term; term = t_{n} - * - * term = value of the series term to be added - * n = position of term in series (starting from 0) - * sum_accel = result of summation acceleration - * sum_plain = simple sum of series - */ - -int -gsl_sum_levin_u_step (const double term, - const size_t n, - const size_t nmax, - gsl_sum_levin_u_workspace * w, - double *sum_accel); - -/* The following functions perform the same calculation without - estimating the errors. They require O(N) storage instead of O(N^2). - This may be useful for summing many similar series where the size - of the error has already been estimated reliably and is not - expected to change. */ - -typedef struct -{ - size_t size; - size_t i; /* position in array */ - size_t terms_used; /* number of calls */ - double sum_plain; - double *q_num; - double *q_den; - double *dsum; -} -gsl_sum_levin_utrunc_workspace; - -gsl_sum_levin_utrunc_workspace *gsl_sum_levin_utrunc_alloc (size_t n); -void gsl_sum_levin_utrunc_free (gsl_sum_levin_utrunc_workspace * w); - -int gsl_sum_levin_utrunc_accel (const double *array, - const size_t n, - gsl_sum_levin_utrunc_workspace * w, - double *sum_accel, double *abserr_trunc); - -int gsl_sum_levin_utrunc_minmax (const double *array, - const size_t n, - const size_t min_terms, - const size_t max_terms, - gsl_sum_levin_utrunc_workspace * w, - double *sum_accel, double *abserr_trunc); - -int gsl_sum_levin_utrunc_step (const double term, - const size_t n, - gsl_sum_levin_utrunc_workspace * w, - double *sum_accel); - -__END_DECLS - -#endif /* __GSL_SUM_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sys.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_sys.h deleted file mode 100644 index 25e134862..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_sys.h +++ /dev/null @@ -1,63 +0,0 @@ -/* sys/gsl_sys.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_SYS_H__ -#define __GSL_SYS_H__ - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -double gsl_log1p (const double x); -double gsl_expm1 (const double x); -double gsl_hypot (const double x, const double y); -double gsl_hypot3 (const double x, const double y, const double z); -double gsl_acosh (const double x); -double gsl_asinh (const double x); -double gsl_atanh (const double x); - -int gsl_isnan (const double x); -int gsl_isinf (const double x); -int gsl_finite (const double x); - -double gsl_nan (void); -double gsl_posinf (void); -double gsl_neginf (void); -double gsl_fdiv (const double x, const double y); - -double gsl_coerce_double (const double x); -float gsl_coerce_float (const float x); -long double gsl_coerce_long_double (const long double x); - -double gsl_ldexp(const double x, const int e); -double gsl_frexp(const double x, int * e); - -int gsl_fcmp (const double x1, const double x2, const double epsilon); - -__END_DECLS - -#endif /* __GSL_SYS_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_test.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_test.h deleted file mode 100644 index bb86896ce..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_test.h +++ /dev/null @@ -1,66 +0,0 @@ -/* err/gsl_test.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_TEST_H__ -#define __GSL_TEST_H__ - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -void - gsl_test (int status, const char *test_description, ...); - -void -gsl_test_rel (double result, double expected, double relative_error, - const char *test_description, ...) ; - -void -gsl_test_abs (double result, double expected, double absolute_error, - const char *test_description, ...) ; - -void -gsl_test_factor (double result, double expected, double factor, - const char *test_description, ...) ; - -void -gsl_test_int (int result, int expected, const char *test_description, ...) ; - -void -gsl_test_str (const char * result, const char * expected, - const char *test_description, ...) ; - -void - gsl_test_verbose (int verbose) ; - -int - gsl_test_summary (void) ; - - -__END_DECLS - -#endif /* __GSL_TEST_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_types.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_types.h deleted file mode 100644 index 0330f551f..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_types.h +++ /dev/null @@ -1,41 +0,0 @@ -/* gsl_types.h - * - * Copyright (C) 2001, 2007 Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_TYPES_H__ -#define __GSL_TYPES_H__ - -#ifndef GSL_VAR - -#ifdef WIN32 -# ifdef GSL_DLL -# ifdef DLL_EXPORT -# define GSL_VAR extern __declspec(dllexport) -# else -# define GSL_VAR extern __declspec(dllimport) -# endif -# else -# define GSL_VAR extern -# endif -#else -# define GSL_VAR extern -#endif - -#endif - -#endif /* __GSL_TYPES_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector.h deleted file mode 100644 index cf762e42f..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __GSL_VECTOR_H__ -#define __GSL_VECTOR_H__ - -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include - -#include -#include - - -#endif /* __GSL_VECTOR_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_char.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_char.h deleted file mode 100644 index ab1107ded..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_char.h +++ /dev/null @@ -1,230 +0,0 @@ -/* vector/gsl_vector_char.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_VECTOR_CHAR_H__ -#define __GSL_VECTOR_CHAR_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size; - size_t stride; - char *data; - gsl_block_char *block; - int owner; -} -gsl_vector_char; - -typedef struct -{ - gsl_vector_char vector; -} _gsl_vector_char_view; - -typedef _gsl_vector_char_view gsl_vector_char_view; - -typedef struct -{ - gsl_vector_char vector; -} _gsl_vector_char_const_view; - -typedef const _gsl_vector_char_const_view gsl_vector_char_const_view; - - -/* Allocation */ - -gsl_vector_char *gsl_vector_char_alloc (const size_t n); -gsl_vector_char *gsl_vector_char_calloc (const size_t n); - -gsl_vector_char *gsl_vector_char_alloc_from_block (gsl_block_char * b, - const size_t offset, - const size_t n, - const size_t stride); - -gsl_vector_char *gsl_vector_char_alloc_from_vector (gsl_vector_char * v, - const size_t offset, - const size_t n, - const size_t stride); - -void gsl_vector_char_free (gsl_vector_char * v); - -/* Views */ - -_gsl_vector_char_view -gsl_vector_char_view_array (char *v, size_t n); - -_gsl_vector_char_view -gsl_vector_char_view_array_with_stride (char *base, - size_t stride, - size_t n); - -_gsl_vector_char_const_view -gsl_vector_char_const_view_array (const char *v, size_t n); - -_gsl_vector_char_const_view -gsl_vector_char_const_view_array_with_stride (const char *base, - size_t stride, - size_t n); - -_gsl_vector_char_view -gsl_vector_char_subvector (gsl_vector_char *v, - size_t i, - size_t n); - -_gsl_vector_char_view -gsl_vector_char_subvector_with_stride (gsl_vector_char *v, - size_t i, - size_t stride, - size_t n); - -_gsl_vector_char_const_view -gsl_vector_char_const_subvector (const gsl_vector_char *v, - size_t i, - size_t n); - -_gsl_vector_char_const_view -gsl_vector_char_const_subvector_with_stride (const gsl_vector_char *v, - size_t i, - size_t stride, - size_t n); - -/* Operations */ - -void gsl_vector_char_set_zero (gsl_vector_char * v); -void gsl_vector_char_set_all (gsl_vector_char * v, char x); -int gsl_vector_char_set_basis (gsl_vector_char * v, size_t i); - -int gsl_vector_char_fread (FILE * stream, gsl_vector_char * v); -int gsl_vector_char_fwrite (FILE * stream, const gsl_vector_char * v); -int gsl_vector_char_fscanf (FILE * stream, gsl_vector_char * v); -int gsl_vector_char_fprintf (FILE * stream, const gsl_vector_char * v, - const char *format); - -int gsl_vector_char_memcpy (gsl_vector_char * dest, const gsl_vector_char * src); - -int gsl_vector_char_reverse (gsl_vector_char * v); - -int gsl_vector_char_swap (gsl_vector_char * v, gsl_vector_char * w); -int gsl_vector_char_swap_elements (gsl_vector_char * v, const size_t i, const size_t j); - -char gsl_vector_char_max (const gsl_vector_char * v); -char gsl_vector_char_min (const gsl_vector_char * v); -void gsl_vector_char_minmax (const gsl_vector_char * v, char * min_out, char * max_out); - -size_t gsl_vector_char_max_index (const gsl_vector_char * v); -size_t gsl_vector_char_min_index (const gsl_vector_char * v); -void gsl_vector_char_minmax_index (const gsl_vector_char * v, size_t * imin, size_t * imax); - -int gsl_vector_char_add (gsl_vector_char * a, const gsl_vector_char * b); -int gsl_vector_char_sub (gsl_vector_char * a, const gsl_vector_char * b); -int gsl_vector_char_mul (gsl_vector_char * a, const gsl_vector_char * b); -int gsl_vector_char_div (gsl_vector_char * a, const gsl_vector_char * b); -int gsl_vector_char_scale (gsl_vector_char * a, const double x); -int gsl_vector_char_add_constant (gsl_vector_char * a, const double x); - -int gsl_vector_char_equal (const gsl_vector_char * u, - const gsl_vector_char * v); - -int gsl_vector_char_isnull (const gsl_vector_char * v); -int gsl_vector_char_ispos (const gsl_vector_char * v); -int gsl_vector_char_isneg (const gsl_vector_char * v); -int gsl_vector_char_isnonneg (const gsl_vector_char * v); - -INLINE_DECL char gsl_vector_char_get (const gsl_vector_char * v, const size_t i); -INLINE_DECL void gsl_vector_char_set (gsl_vector_char * v, const size_t i, char x); -INLINE_DECL char * gsl_vector_char_ptr (gsl_vector_char * v, const size_t i); -INLINE_DECL const char * gsl_vector_char_const_ptr (const gsl_vector_char * v, const size_t i); - -#ifdef HAVE_INLINE - -INLINE_FUN -char -gsl_vector_char_get (const gsl_vector_char * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); - } -#endif - return v->data[i * v->stride]; -} - -INLINE_FUN -void -gsl_vector_char_set (gsl_vector_char * v, const size_t i, char x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VOID ("index out of range", GSL_EINVAL); - } -#endif - v->data[i * v->stride] = x; -} - -INLINE_FUN -char * -gsl_vector_char_ptr (gsl_vector_char * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return (char *) (v->data + i * v->stride); -} - -INLINE_FUN -const char * -gsl_vector_char_const_ptr (const gsl_vector_char * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return (const char *) (v->data + i * v->stride); -} -#endif /* HAVE_INLINE */ - -__END_DECLS - -#endif /* __GSL_VECTOR_CHAR_H__ */ - - diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex.h deleted file mode 100644 index e56d6a616..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __GSL_VECTOR_COMPLEX_H__ -#define __GSL_VECTOR_COMPLEX_H__ - -#define GSL_VECTOR_REAL(z, i) ((z)->data[2*(i)*(z)->stride]) -#define GSL_VECTOR_IMAG(z, i) ((z)->data[2*(i)*(z)->stride + 1]) - -#if GSL_RANGE_CHECK -#define GSL_VECTOR_COMPLEX(zv, i) (((i) >= (zv)->size ? (gsl_error ("index out of range", __FILE__, __LINE__, GSL_EINVAL), 0):0 , *GSL_COMPLEX_AT((zv),(i)))) -#else -#define GSL_VECTOR_COMPLEX(zv, i) (*GSL_COMPLEX_AT((zv),(i))) -#endif - -#define GSL_COMPLEX_AT(zv,i) ((gsl_complex*)&((zv)->data[2*(i)*(zv)->stride])) -#define GSL_COMPLEX_FLOAT_AT(zv,i) ((gsl_complex_float*)&((zv)->data[2*(i)*(zv)->stride])) -#define GSL_COMPLEX_LONG_DOUBLE_AT(zv,i) ((gsl_complex_long_double*)&((zv)->data[2*(i)*(zv)->stride])) - -#endif /* __GSL_VECTOR_COMPLEX_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex_double.h deleted file mode 100644 index 2e5361762..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex_double.h +++ /dev/null @@ -1,251 +0,0 @@ -/* vector/gsl_vector_complex_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_VECTOR_COMPLEX_DOUBLE_H__ -#define __GSL_VECTOR_COMPLEX_DOUBLE_H__ - -#include -#include -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size; - size_t stride; - double *data; - gsl_block_complex *block; - int owner; -} gsl_vector_complex; - -typedef struct -{ - gsl_vector_complex vector; -} _gsl_vector_complex_view; - -typedef _gsl_vector_complex_view gsl_vector_complex_view; - -typedef struct -{ - gsl_vector_complex vector; -} _gsl_vector_complex_const_view; - -typedef const _gsl_vector_complex_const_view gsl_vector_complex_const_view; - -/* Allocation */ - -gsl_vector_complex *gsl_vector_complex_alloc (const size_t n); -gsl_vector_complex *gsl_vector_complex_calloc (const size_t n); - -gsl_vector_complex * -gsl_vector_complex_alloc_from_block (gsl_block_complex * b, - const size_t offset, - const size_t n, - const size_t stride); - -gsl_vector_complex * -gsl_vector_complex_alloc_from_vector (gsl_vector_complex * v, - const size_t offset, - const size_t n, - const size_t stride); - -void gsl_vector_complex_free (gsl_vector_complex * v); - -/* Views */ - -_gsl_vector_complex_view -gsl_vector_complex_view_array (double *base, - size_t n); - -_gsl_vector_complex_view -gsl_vector_complex_view_array_with_stride (double *base, - size_t stride, - size_t n); - -_gsl_vector_complex_const_view -gsl_vector_complex_const_view_array (const double *base, - size_t n); - -_gsl_vector_complex_const_view -gsl_vector_complex_const_view_array_with_stride (const double *base, - size_t stride, - size_t n); - -_gsl_vector_complex_view -gsl_vector_complex_subvector (gsl_vector_complex *base, - size_t i, - size_t n); - - -_gsl_vector_complex_view -gsl_vector_complex_subvector_with_stride (gsl_vector_complex *v, - size_t i, - size_t stride, - size_t n); - -_gsl_vector_complex_const_view -gsl_vector_complex_const_subvector (const gsl_vector_complex *base, - size_t i, - size_t n); - - -_gsl_vector_complex_const_view -gsl_vector_complex_const_subvector_with_stride (const gsl_vector_complex *v, - size_t i, - size_t stride, - size_t n); - -_gsl_vector_view -gsl_vector_complex_real (gsl_vector_complex *v); - -_gsl_vector_view -gsl_vector_complex_imag (gsl_vector_complex *v); - -_gsl_vector_const_view -gsl_vector_complex_const_real (const gsl_vector_complex *v); - -_gsl_vector_const_view -gsl_vector_complex_const_imag (const gsl_vector_complex *v); - - -/* Operations */ - -void gsl_vector_complex_set_zero (gsl_vector_complex * v); -void gsl_vector_complex_set_all (gsl_vector_complex * v, - gsl_complex z); -int gsl_vector_complex_set_basis (gsl_vector_complex * v, size_t i); - -int gsl_vector_complex_fread (FILE * stream, - gsl_vector_complex * v); -int gsl_vector_complex_fwrite (FILE * stream, - const gsl_vector_complex * v); -int gsl_vector_complex_fscanf (FILE * stream, - gsl_vector_complex * v); -int gsl_vector_complex_fprintf (FILE * stream, - const gsl_vector_complex * v, - const char *format); - -int gsl_vector_complex_memcpy (gsl_vector_complex * dest, const gsl_vector_complex * src); - -int gsl_vector_complex_reverse (gsl_vector_complex * v); - -int gsl_vector_complex_swap (gsl_vector_complex * v, gsl_vector_complex * w); -int gsl_vector_complex_swap_elements (gsl_vector_complex * v, const size_t i, const size_t j); - -int gsl_vector_complex_equal (const gsl_vector_complex * u, - const gsl_vector_complex * v); - -int gsl_vector_complex_isnull (const gsl_vector_complex * v); -int gsl_vector_complex_ispos (const gsl_vector_complex * v); -int gsl_vector_complex_isneg (const gsl_vector_complex * v); -int gsl_vector_complex_isnonneg (const gsl_vector_complex * v); - -int gsl_vector_complex_add (gsl_vector_complex * a, const gsl_vector_complex * b); -int gsl_vector_complex_sub (gsl_vector_complex * a, const gsl_vector_complex * b); -int gsl_vector_complex_mul (gsl_vector_complex * a, const gsl_vector_complex * b); -int gsl_vector_complex_div (gsl_vector_complex * a, const gsl_vector_complex * b); -int gsl_vector_complex_scale (gsl_vector_complex * a, const gsl_complex x); -int gsl_vector_complex_add_constant (gsl_vector_complex * a, const gsl_complex x); - -INLINE_DECL gsl_complex gsl_vector_complex_get (const gsl_vector_complex * v, const size_t i); -INLINE_DECL void gsl_vector_complex_set (gsl_vector_complex * v, const size_t i, gsl_complex z); -INLINE_DECL gsl_complex *gsl_vector_complex_ptr (gsl_vector_complex * v, const size_t i); -INLINE_DECL const gsl_complex *gsl_vector_complex_const_ptr (const gsl_vector_complex * v, const size_t i); - -#ifdef HAVE_INLINE - -INLINE_FUN -gsl_complex -gsl_vector_complex_get (const gsl_vector_complex * v, - const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - gsl_complex zero = {{0, 0}}; - GSL_ERROR_VAL ("index out of range", GSL_EINVAL, zero); - } -#endif - return *GSL_COMPLEX_AT (v, i); -} - -INLINE_FUN -void -gsl_vector_complex_set (gsl_vector_complex * v, - const size_t i, gsl_complex z) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VOID ("index out of range", GSL_EINVAL); - } -#endif - *GSL_COMPLEX_AT (v, i) = z; -} - -INLINE_FUN -gsl_complex * -gsl_vector_complex_ptr (gsl_vector_complex * v, - const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return GSL_COMPLEX_AT (v, i); -} - -INLINE_FUN -const gsl_complex * -gsl_vector_complex_const_ptr (const gsl_vector_complex * v, - const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return GSL_COMPLEX_AT (v, i); -} - - -#endif /* HAVE_INLINE */ - -__END_DECLS - -#endif /* __GSL_VECTOR_COMPLEX_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex_float.h deleted file mode 100644 index 182f48742..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex_float.h +++ /dev/null @@ -1,251 +0,0 @@ -/* vector/gsl_vector_complex_float.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_VECTOR_COMPLEX_FLOAT_H__ -#define __GSL_VECTOR_COMPLEX_FLOAT_H__ - -#include -#include -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size; - size_t stride; - float *data; - gsl_block_complex_float *block; - int owner; -} gsl_vector_complex_float; - -typedef struct -{ - gsl_vector_complex_float vector; -} _gsl_vector_complex_float_view; - -typedef _gsl_vector_complex_float_view gsl_vector_complex_float_view; - -typedef struct -{ - gsl_vector_complex_float vector; -} _gsl_vector_complex_float_const_view; - -typedef const _gsl_vector_complex_float_const_view gsl_vector_complex_float_const_view; - -/* Allocation */ - -gsl_vector_complex_float *gsl_vector_complex_float_alloc (const size_t n); -gsl_vector_complex_float *gsl_vector_complex_float_calloc (const size_t n); - -gsl_vector_complex_float * -gsl_vector_complex_float_alloc_from_block (gsl_block_complex_float * b, - const size_t offset, - const size_t n, - const size_t stride); - -gsl_vector_complex_float * -gsl_vector_complex_float_alloc_from_vector (gsl_vector_complex_float * v, - const size_t offset, - const size_t n, - const size_t stride); - -void gsl_vector_complex_float_free (gsl_vector_complex_float * v); - -/* Views */ - -_gsl_vector_complex_float_view -gsl_vector_complex_float_view_array (float *base, - size_t n); - -_gsl_vector_complex_float_view -gsl_vector_complex_float_view_array_with_stride (float *base, - size_t stride, - size_t n); - -_gsl_vector_complex_float_const_view -gsl_vector_complex_float_const_view_array (const float *base, - size_t n); - -_gsl_vector_complex_float_const_view -gsl_vector_complex_float_const_view_array_with_stride (const float *base, - size_t stride, - size_t n); - -_gsl_vector_complex_float_view -gsl_vector_complex_float_subvector (gsl_vector_complex_float *base, - size_t i, - size_t n); - - -_gsl_vector_complex_float_view -gsl_vector_complex_float_subvector_with_stride (gsl_vector_complex_float *v, - size_t i, - size_t stride, - size_t n); - -_gsl_vector_complex_float_const_view -gsl_vector_complex_float_const_subvector (const gsl_vector_complex_float *base, - size_t i, - size_t n); - - -_gsl_vector_complex_float_const_view -gsl_vector_complex_float_const_subvector_with_stride (const gsl_vector_complex_float *v, - size_t i, - size_t stride, - size_t n); - -_gsl_vector_float_view -gsl_vector_complex_float_real (gsl_vector_complex_float *v); - -_gsl_vector_float_view -gsl_vector_complex_float_imag (gsl_vector_complex_float *v); - -_gsl_vector_float_const_view -gsl_vector_complex_float_const_real (const gsl_vector_complex_float *v); - -_gsl_vector_float_const_view -gsl_vector_complex_float_const_imag (const gsl_vector_complex_float *v); - - -/* Operations */ - -void gsl_vector_complex_float_set_zero (gsl_vector_complex_float * v); -void gsl_vector_complex_float_set_all (gsl_vector_complex_float * v, - gsl_complex_float z); -int gsl_vector_complex_float_set_basis (gsl_vector_complex_float * v, size_t i); - -int gsl_vector_complex_float_fread (FILE * stream, - gsl_vector_complex_float * v); -int gsl_vector_complex_float_fwrite (FILE * stream, - const gsl_vector_complex_float * v); -int gsl_vector_complex_float_fscanf (FILE * stream, - gsl_vector_complex_float * v); -int gsl_vector_complex_float_fprintf (FILE * stream, - const gsl_vector_complex_float * v, - const char *format); - -int gsl_vector_complex_float_memcpy (gsl_vector_complex_float * dest, const gsl_vector_complex_float * src); - -int gsl_vector_complex_float_reverse (gsl_vector_complex_float * v); - -int gsl_vector_complex_float_swap (gsl_vector_complex_float * v, gsl_vector_complex_float * w); -int gsl_vector_complex_float_swap_elements (gsl_vector_complex_float * v, const size_t i, const size_t j); - -int gsl_vector_complex_float_equal (const gsl_vector_complex_float * u, - const gsl_vector_complex_float * v); - -int gsl_vector_complex_float_isnull (const gsl_vector_complex_float * v); -int gsl_vector_complex_float_ispos (const gsl_vector_complex_float * v); -int gsl_vector_complex_float_isneg (const gsl_vector_complex_float * v); -int gsl_vector_complex_float_isnonneg (const gsl_vector_complex_float * v); - -int gsl_vector_complex_float_add (gsl_vector_complex_float * a, const gsl_vector_complex_float * b); -int gsl_vector_complex_float_sub (gsl_vector_complex_float * a, const gsl_vector_complex_float * b); -int gsl_vector_complex_float_mul (gsl_vector_complex_float * a, const gsl_vector_complex_float * b); -int gsl_vector_complex_float_div (gsl_vector_complex_float * a, const gsl_vector_complex_float * b); -int gsl_vector_complex_float_scale (gsl_vector_complex_float * a, const gsl_complex_float x); -int gsl_vector_complex_float_add_constant (gsl_vector_complex_float * a, const gsl_complex_float x); - -INLINE_DECL gsl_complex_float gsl_vector_complex_float_get (const gsl_vector_complex_float * v, const size_t i); -INLINE_DECL void gsl_vector_complex_float_set (gsl_vector_complex_float * v, const size_t i, gsl_complex_float z); -INLINE_DECL gsl_complex_float *gsl_vector_complex_float_ptr (gsl_vector_complex_float * v, const size_t i); -INLINE_DECL const gsl_complex_float *gsl_vector_complex_float_const_ptr (const gsl_vector_complex_float * v, const size_t i); - -#ifdef HAVE_INLINE - -INLINE_FUN -gsl_complex_float -gsl_vector_complex_float_get (const gsl_vector_complex_float * v, - const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - gsl_complex_float zero = {{0, 0}}; - GSL_ERROR_VAL ("index out of range", GSL_EINVAL, zero); - } -#endif - return *GSL_COMPLEX_FLOAT_AT (v, i); -} - -INLINE_FUN -void -gsl_vector_complex_float_set (gsl_vector_complex_float * v, - const size_t i, gsl_complex_float z) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VOID ("index out of range", GSL_EINVAL); - } -#endif - *GSL_COMPLEX_FLOAT_AT (v, i) = z; -} - -INLINE_FUN -gsl_complex_float * -gsl_vector_complex_float_ptr (gsl_vector_complex_float * v, - const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return GSL_COMPLEX_FLOAT_AT (v, i); -} - -INLINE_FUN -const gsl_complex_float * -gsl_vector_complex_float_const_ptr (const gsl_vector_complex_float * v, - const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return GSL_COMPLEX_FLOAT_AT (v, i); -} - - -#endif /* HAVE_INLINE */ - -__END_DECLS - -#endif /* __GSL_VECTOR_COMPLEX_FLOAT_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex_long_double.h deleted file mode 100644 index 91755e0cf..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_complex_long_double.h +++ /dev/null @@ -1,251 +0,0 @@ -/* vector/gsl_vector_complex_long_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_VECTOR_COMPLEX_LONG_DOUBLE_H__ -#define __GSL_VECTOR_COMPLEX_LONG_DOUBLE_H__ - -#include -#include -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size; - size_t stride; - long double *data; - gsl_block_complex_long_double *block; - int owner; -} gsl_vector_complex_long_double; - -typedef struct -{ - gsl_vector_complex_long_double vector; -} _gsl_vector_complex_long_double_view; - -typedef _gsl_vector_complex_long_double_view gsl_vector_complex_long_double_view; - -typedef struct -{ - gsl_vector_complex_long_double vector; -} _gsl_vector_complex_long_double_const_view; - -typedef const _gsl_vector_complex_long_double_const_view gsl_vector_complex_long_double_const_view; - -/* Allocation */ - -gsl_vector_complex_long_double *gsl_vector_complex_long_double_alloc (const size_t n); -gsl_vector_complex_long_double *gsl_vector_complex_long_double_calloc (const size_t n); - -gsl_vector_complex_long_double * -gsl_vector_complex_long_double_alloc_from_block (gsl_block_complex_long_double * b, - const size_t offset, - const size_t n, - const size_t stride); - -gsl_vector_complex_long_double * -gsl_vector_complex_long_double_alloc_from_vector (gsl_vector_complex_long_double * v, - const size_t offset, - const size_t n, - const size_t stride); - -void gsl_vector_complex_long_double_free (gsl_vector_complex_long_double * v); - -/* Views */ - -_gsl_vector_complex_long_double_view -gsl_vector_complex_long_double_view_array (long double *base, - size_t n); - -_gsl_vector_complex_long_double_view -gsl_vector_complex_long_double_view_array_with_stride (long double *base, - size_t stride, - size_t n); - -_gsl_vector_complex_long_double_const_view -gsl_vector_complex_long_double_const_view_array (const long double *base, - size_t n); - -_gsl_vector_complex_long_double_const_view -gsl_vector_complex_long_double_const_view_array_with_stride (const long double *base, - size_t stride, - size_t n); - -_gsl_vector_complex_long_double_view -gsl_vector_complex_long_double_subvector (gsl_vector_complex_long_double *base, - size_t i, - size_t n); - - -_gsl_vector_complex_long_double_view -gsl_vector_complex_long_double_subvector_with_stride (gsl_vector_complex_long_double *v, - size_t i, - size_t stride, - size_t n); - -_gsl_vector_complex_long_double_const_view -gsl_vector_complex_long_double_const_subvector (const gsl_vector_complex_long_double *base, - size_t i, - size_t n); - - -_gsl_vector_complex_long_double_const_view -gsl_vector_complex_long_double_const_subvector_with_stride (const gsl_vector_complex_long_double *v, - size_t i, - size_t stride, - size_t n); - -_gsl_vector_long_double_view -gsl_vector_complex_long_double_real (gsl_vector_complex_long_double *v); - -_gsl_vector_long_double_view -gsl_vector_complex_long_double_imag (gsl_vector_complex_long_double *v); - -_gsl_vector_long_double_const_view -gsl_vector_complex_long_double_const_real (const gsl_vector_complex_long_double *v); - -_gsl_vector_long_double_const_view -gsl_vector_complex_long_double_const_imag (const gsl_vector_complex_long_double *v); - - -/* Operations */ - -void gsl_vector_complex_long_double_set_zero (gsl_vector_complex_long_double * v); -void gsl_vector_complex_long_double_set_all (gsl_vector_complex_long_double * v, - gsl_complex_long_double z); -int gsl_vector_complex_long_double_set_basis (gsl_vector_complex_long_double * v, size_t i); - -int gsl_vector_complex_long_double_fread (FILE * stream, - gsl_vector_complex_long_double * v); -int gsl_vector_complex_long_double_fwrite (FILE * stream, - const gsl_vector_complex_long_double * v); -int gsl_vector_complex_long_double_fscanf (FILE * stream, - gsl_vector_complex_long_double * v); -int gsl_vector_complex_long_double_fprintf (FILE * stream, - const gsl_vector_complex_long_double * v, - const char *format); - -int gsl_vector_complex_long_double_memcpy (gsl_vector_complex_long_double * dest, const gsl_vector_complex_long_double * src); - -int gsl_vector_complex_long_double_reverse (gsl_vector_complex_long_double * v); - -int gsl_vector_complex_long_double_swap (gsl_vector_complex_long_double * v, gsl_vector_complex_long_double * w); -int gsl_vector_complex_long_double_swap_elements (gsl_vector_complex_long_double * v, const size_t i, const size_t j); - -int gsl_vector_complex_long_double_equal (const gsl_vector_complex_long_double * u, - const gsl_vector_complex_long_double * v); - -int gsl_vector_complex_long_double_isnull (const gsl_vector_complex_long_double * v); -int gsl_vector_complex_long_double_ispos (const gsl_vector_complex_long_double * v); -int gsl_vector_complex_long_double_isneg (const gsl_vector_complex_long_double * v); -int gsl_vector_complex_long_double_isnonneg (const gsl_vector_complex_long_double * v); - -int gsl_vector_complex_long_double_add (gsl_vector_complex_long_double * a, const gsl_vector_complex_long_double * b); -int gsl_vector_complex_long_double_sub (gsl_vector_complex_long_double * a, const gsl_vector_complex_long_double * b); -int gsl_vector_complex_long_double_mul (gsl_vector_complex_long_double * a, const gsl_vector_complex_long_double * b); -int gsl_vector_complex_long_double_div (gsl_vector_complex_long_double * a, const gsl_vector_complex_long_double * b); -int gsl_vector_complex_long_double_scale (gsl_vector_complex_long_double * a, const gsl_complex_long_double x); -int gsl_vector_complex_long_double_add_constant (gsl_vector_complex_long_double * a, const gsl_complex_long_double x); - -INLINE_DECL gsl_complex_long_double gsl_vector_complex_long_double_get (const gsl_vector_complex_long_double * v, const size_t i); -INLINE_DECL void gsl_vector_complex_long_double_set (gsl_vector_complex_long_double * v, const size_t i, gsl_complex_long_double z); -INLINE_DECL gsl_complex_long_double *gsl_vector_complex_long_double_ptr (gsl_vector_complex_long_double * v, const size_t i); -INLINE_DECL const gsl_complex_long_double *gsl_vector_complex_long_double_const_ptr (const gsl_vector_complex_long_double * v, const size_t i); - -#ifdef HAVE_INLINE - -INLINE_FUN -gsl_complex_long_double -gsl_vector_complex_long_double_get (const gsl_vector_complex_long_double * v, - const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - gsl_complex_long_double zero = {{0, 0}}; - GSL_ERROR_VAL ("index out of range", GSL_EINVAL, zero); - } -#endif - return *GSL_COMPLEX_LONG_DOUBLE_AT (v, i); -} - -INLINE_FUN -void -gsl_vector_complex_long_double_set (gsl_vector_complex_long_double * v, - const size_t i, gsl_complex_long_double z) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VOID ("index out of range", GSL_EINVAL); - } -#endif - *GSL_COMPLEX_LONG_DOUBLE_AT (v, i) = z; -} - -INLINE_FUN -gsl_complex_long_double * -gsl_vector_complex_long_double_ptr (gsl_vector_complex_long_double * v, - const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return GSL_COMPLEX_LONG_DOUBLE_AT (v, i); -} - -INLINE_FUN -const gsl_complex_long_double * -gsl_vector_complex_long_double_const_ptr (const gsl_vector_complex_long_double * v, - const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return GSL_COMPLEX_LONG_DOUBLE_AT (v, i); -} - - -#endif /* HAVE_INLINE */ - -__END_DECLS - -#endif /* __GSL_VECTOR_COMPLEX_LONG_DOUBLE_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_double.h deleted file mode 100644 index 26a12d833..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_double.h +++ /dev/null @@ -1,230 +0,0 @@ -/* vector/gsl_vector_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_VECTOR_DOUBLE_H__ -#define __GSL_VECTOR_DOUBLE_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size; - size_t stride; - double *data; - gsl_block *block; - int owner; -} -gsl_vector; - -typedef struct -{ - gsl_vector vector; -} _gsl_vector_view; - -typedef _gsl_vector_view gsl_vector_view; - -typedef struct -{ - gsl_vector vector; -} _gsl_vector_const_view; - -typedef const _gsl_vector_const_view gsl_vector_const_view; - - -/* Allocation */ - -gsl_vector *gsl_vector_alloc (const size_t n); -gsl_vector *gsl_vector_calloc (const size_t n); - -gsl_vector *gsl_vector_alloc_from_block (gsl_block * b, - const size_t offset, - const size_t n, - const size_t stride); - -gsl_vector *gsl_vector_alloc_from_vector (gsl_vector * v, - const size_t offset, - const size_t n, - const size_t stride); - -void gsl_vector_free (gsl_vector * v); - -/* Views */ - -_gsl_vector_view -gsl_vector_view_array (double *v, size_t n); - -_gsl_vector_view -gsl_vector_view_array_with_stride (double *base, - size_t stride, - size_t n); - -_gsl_vector_const_view -gsl_vector_const_view_array (const double *v, size_t n); - -_gsl_vector_const_view -gsl_vector_const_view_array_with_stride (const double *base, - size_t stride, - size_t n); - -_gsl_vector_view -gsl_vector_subvector (gsl_vector *v, - size_t i, - size_t n); - -_gsl_vector_view -gsl_vector_subvector_with_stride (gsl_vector *v, - size_t i, - size_t stride, - size_t n); - -_gsl_vector_const_view -gsl_vector_const_subvector (const gsl_vector *v, - size_t i, - size_t n); - -_gsl_vector_const_view -gsl_vector_const_subvector_with_stride (const gsl_vector *v, - size_t i, - size_t stride, - size_t n); - -/* Operations */ - -void gsl_vector_set_zero (gsl_vector * v); -void gsl_vector_set_all (gsl_vector * v, double x); -int gsl_vector_set_basis (gsl_vector * v, size_t i); - -int gsl_vector_fread (FILE * stream, gsl_vector * v); -int gsl_vector_fwrite (FILE * stream, const gsl_vector * v); -int gsl_vector_fscanf (FILE * stream, gsl_vector * v); -int gsl_vector_fprintf (FILE * stream, const gsl_vector * v, - const char *format); - -int gsl_vector_memcpy (gsl_vector * dest, const gsl_vector * src); - -int gsl_vector_reverse (gsl_vector * v); - -int gsl_vector_swap (gsl_vector * v, gsl_vector * w); -int gsl_vector_swap_elements (gsl_vector * v, const size_t i, const size_t j); - -double gsl_vector_max (const gsl_vector * v); -double gsl_vector_min (const gsl_vector * v); -void gsl_vector_minmax (const gsl_vector * v, double * min_out, double * max_out); - -size_t gsl_vector_max_index (const gsl_vector * v); -size_t gsl_vector_min_index (const gsl_vector * v); -void gsl_vector_minmax_index (const gsl_vector * v, size_t * imin, size_t * imax); - -int gsl_vector_add (gsl_vector * a, const gsl_vector * b); -int gsl_vector_sub (gsl_vector * a, const gsl_vector * b); -int gsl_vector_mul (gsl_vector * a, const gsl_vector * b); -int gsl_vector_div (gsl_vector * a, const gsl_vector * b); -int gsl_vector_scale (gsl_vector * a, const double x); -int gsl_vector_add_constant (gsl_vector * a, const double x); - -int gsl_vector_equal (const gsl_vector * u, - const gsl_vector * v); - -int gsl_vector_isnull (const gsl_vector * v); -int gsl_vector_ispos (const gsl_vector * v); -int gsl_vector_isneg (const gsl_vector * v); -int gsl_vector_isnonneg (const gsl_vector * v); - -INLINE_DECL double gsl_vector_get (const gsl_vector * v, const size_t i); -INLINE_DECL void gsl_vector_set (gsl_vector * v, const size_t i, double x); -INLINE_DECL double * gsl_vector_ptr (gsl_vector * v, const size_t i); -INLINE_DECL const double * gsl_vector_const_ptr (const gsl_vector * v, const size_t i); - -#ifdef HAVE_INLINE - -INLINE_FUN -double -gsl_vector_get (const gsl_vector * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); - } -#endif - return v->data[i * v->stride]; -} - -INLINE_FUN -void -gsl_vector_set (gsl_vector * v, const size_t i, double x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VOID ("index out of range", GSL_EINVAL); - } -#endif - v->data[i * v->stride] = x; -} - -INLINE_FUN -double * -gsl_vector_ptr (gsl_vector * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return (double *) (v->data + i * v->stride); -} - -INLINE_FUN -const double * -gsl_vector_const_ptr (const gsl_vector * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return (const double *) (v->data + i * v->stride); -} -#endif /* HAVE_INLINE */ - -__END_DECLS - -#endif /* __GSL_VECTOR_DOUBLE_H__ */ - - diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_float.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_float.h deleted file mode 100644 index 2b499c81e..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_float.h +++ /dev/null @@ -1,230 +0,0 @@ -/* vector/gsl_vector_float.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_VECTOR_FLOAT_H__ -#define __GSL_VECTOR_FLOAT_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size; - size_t stride; - float *data; - gsl_block_float *block; - int owner; -} -gsl_vector_float; - -typedef struct -{ - gsl_vector_float vector; -} _gsl_vector_float_view; - -typedef _gsl_vector_float_view gsl_vector_float_view; - -typedef struct -{ - gsl_vector_float vector; -} _gsl_vector_float_const_view; - -typedef const _gsl_vector_float_const_view gsl_vector_float_const_view; - - -/* Allocation */ - -gsl_vector_float *gsl_vector_float_alloc (const size_t n); -gsl_vector_float *gsl_vector_float_calloc (const size_t n); - -gsl_vector_float *gsl_vector_float_alloc_from_block (gsl_block_float * b, - const size_t offset, - const size_t n, - const size_t stride); - -gsl_vector_float *gsl_vector_float_alloc_from_vector (gsl_vector_float * v, - const size_t offset, - const size_t n, - const size_t stride); - -void gsl_vector_float_free (gsl_vector_float * v); - -/* Views */ - -_gsl_vector_float_view -gsl_vector_float_view_array (float *v, size_t n); - -_gsl_vector_float_view -gsl_vector_float_view_array_with_stride (float *base, - size_t stride, - size_t n); - -_gsl_vector_float_const_view -gsl_vector_float_const_view_array (const float *v, size_t n); - -_gsl_vector_float_const_view -gsl_vector_float_const_view_array_with_stride (const float *base, - size_t stride, - size_t n); - -_gsl_vector_float_view -gsl_vector_float_subvector (gsl_vector_float *v, - size_t i, - size_t n); - -_gsl_vector_float_view -gsl_vector_float_subvector_with_stride (gsl_vector_float *v, - size_t i, - size_t stride, - size_t n); - -_gsl_vector_float_const_view -gsl_vector_float_const_subvector (const gsl_vector_float *v, - size_t i, - size_t n); - -_gsl_vector_float_const_view -gsl_vector_float_const_subvector_with_stride (const gsl_vector_float *v, - size_t i, - size_t stride, - size_t n); - -/* Operations */ - -void gsl_vector_float_set_zero (gsl_vector_float * v); -void gsl_vector_float_set_all (gsl_vector_float * v, float x); -int gsl_vector_float_set_basis (gsl_vector_float * v, size_t i); - -int gsl_vector_float_fread (FILE * stream, gsl_vector_float * v); -int gsl_vector_float_fwrite (FILE * stream, const gsl_vector_float * v); -int gsl_vector_float_fscanf (FILE * stream, gsl_vector_float * v); -int gsl_vector_float_fprintf (FILE * stream, const gsl_vector_float * v, - const char *format); - -int gsl_vector_float_memcpy (gsl_vector_float * dest, const gsl_vector_float * src); - -int gsl_vector_float_reverse (gsl_vector_float * v); - -int gsl_vector_float_swap (gsl_vector_float * v, gsl_vector_float * w); -int gsl_vector_float_swap_elements (gsl_vector_float * v, const size_t i, const size_t j); - -float gsl_vector_float_max (const gsl_vector_float * v); -float gsl_vector_float_min (const gsl_vector_float * v); -void gsl_vector_float_minmax (const gsl_vector_float * v, float * min_out, float * max_out); - -size_t gsl_vector_float_max_index (const gsl_vector_float * v); -size_t gsl_vector_float_min_index (const gsl_vector_float * v); -void gsl_vector_float_minmax_index (const gsl_vector_float * v, size_t * imin, size_t * imax); - -int gsl_vector_float_add (gsl_vector_float * a, const gsl_vector_float * b); -int gsl_vector_float_sub (gsl_vector_float * a, const gsl_vector_float * b); -int gsl_vector_float_mul (gsl_vector_float * a, const gsl_vector_float * b); -int gsl_vector_float_div (gsl_vector_float * a, const gsl_vector_float * b); -int gsl_vector_float_scale (gsl_vector_float * a, const double x); -int gsl_vector_float_add_constant (gsl_vector_float * a, const double x); - -int gsl_vector_float_equal (const gsl_vector_float * u, - const gsl_vector_float * v); - -int gsl_vector_float_isnull (const gsl_vector_float * v); -int gsl_vector_float_ispos (const gsl_vector_float * v); -int gsl_vector_float_isneg (const gsl_vector_float * v); -int gsl_vector_float_isnonneg (const gsl_vector_float * v); - -INLINE_DECL float gsl_vector_float_get (const gsl_vector_float * v, const size_t i); -INLINE_DECL void gsl_vector_float_set (gsl_vector_float * v, const size_t i, float x); -INLINE_DECL float * gsl_vector_float_ptr (gsl_vector_float * v, const size_t i); -INLINE_DECL const float * gsl_vector_float_const_ptr (const gsl_vector_float * v, const size_t i); - -#ifdef HAVE_INLINE - -INLINE_FUN -float -gsl_vector_float_get (const gsl_vector_float * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); - } -#endif - return v->data[i * v->stride]; -} - -INLINE_FUN -void -gsl_vector_float_set (gsl_vector_float * v, const size_t i, float x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VOID ("index out of range", GSL_EINVAL); - } -#endif - v->data[i * v->stride] = x; -} - -INLINE_FUN -float * -gsl_vector_float_ptr (gsl_vector_float * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return (float *) (v->data + i * v->stride); -} - -INLINE_FUN -const float * -gsl_vector_float_const_ptr (const gsl_vector_float * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return (const float *) (v->data + i * v->stride); -} -#endif /* HAVE_INLINE */ - -__END_DECLS - -#endif /* __GSL_VECTOR_FLOAT_H__ */ - - diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_int.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_int.h deleted file mode 100644 index de04a449d..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_int.h +++ /dev/null @@ -1,230 +0,0 @@ -/* vector/gsl_vector_int.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_VECTOR_INT_H__ -#define __GSL_VECTOR_INT_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size; - size_t stride; - int *data; - gsl_block_int *block; - int owner; -} -gsl_vector_int; - -typedef struct -{ - gsl_vector_int vector; -} _gsl_vector_int_view; - -typedef _gsl_vector_int_view gsl_vector_int_view; - -typedef struct -{ - gsl_vector_int vector; -} _gsl_vector_int_const_view; - -typedef const _gsl_vector_int_const_view gsl_vector_int_const_view; - - -/* Allocation */ - -gsl_vector_int *gsl_vector_int_alloc (const size_t n); -gsl_vector_int *gsl_vector_int_calloc (const size_t n); - -gsl_vector_int *gsl_vector_int_alloc_from_block (gsl_block_int * b, - const size_t offset, - const size_t n, - const size_t stride); - -gsl_vector_int *gsl_vector_int_alloc_from_vector (gsl_vector_int * v, - const size_t offset, - const size_t n, - const size_t stride); - -void gsl_vector_int_free (gsl_vector_int * v); - -/* Views */ - -_gsl_vector_int_view -gsl_vector_int_view_array (int *v, size_t n); - -_gsl_vector_int_view -gsl_vector_int_view_array_with_stride (int *base, - size_t stride, - size_t n); - -_gsl_vector_int_const_view -gsl_vector_int_const_view_array (const int *v, size_t n); - -_gsl_vector_int_const_view -gsl_vector_int_const_view_array_with_stride (const int *base, - size_t stride, - size_t n); - -_gsl_vector_int_view -gsl_vector_int_subvector (gsl_vector_int *v, - size_t i, - size_t n); - -_gsl_vector_int_view -gsl_vector_int_subvector_with_stride (gsl_vector_int *v, - size_t i, - size_t stride, - size_t n); - -_gsl_vector_int_const_view -gsl_vector_int_const_subvector (const gsl_vector_int *v, - size_t i, - size_t n); - -_gsl_vector_int_const_view -gsl_vector_int_const_subvector_with_stride (const gsl_vector_int *v, - size_t i, - size_t stride, - size_t n); - -/* Operations */ - -void gsl_vector_int_set_zero (gsl_vector_int * v); -void gsl_vector_int_set_all (gsl_vector_int * v, int x); -int gsl_vector_int_set_basis (gsl_vector_int * v, size_t i); - -int gsl_vector_int_fread (FILE * stream, gsl_vector_int * v); -int gsl_vector_int_fwrite (FILE * stream, const gsl_vector_int * v); -int gsl_vector_int_fscanf (FILE * stream, gsl_vector_int * v); -int gsl_vector_int_fprintf (FILE * stream, const gsl_vector_int * v, - const char *format); - -int gsl_vector_int_memcpy (gsl_vector_int * dest, const gsl_vector_int * src); - -int gsl_vector_int_reverse (gsl_vector_int * v); - -int gsl_vector_int_swap (gsl_vector_int * v, gsl_vector_int * w); -int gsl_vector_int_swap_elements (gsl_vector_int * v, const size_t i, const size_t j); - -int gsl_vector_int_max (const gsl_vector_int * v); -int gsl_vector_int_min (const gsl_vector_int * v); -void gsl_vector_int_minmax (const gsl_vector_int * v, int * min_out, int * max_out); - -size_t gsl_vector_int_max_index (const gsl_vector_int * v); -size_t gsl_vector_int_min_index (const gsl_vector_int * v); -void gsl_vector_int_minmax_index (const gsl_vector_int * v, size_t * imin, size_t * imax); - -int gsl_vector_int_add (gsl_vector_int * a, const gsl_vector_int * b); -int gsl_vector_int_sub (gsl_vector_int * a, const gsl_vector_int * b); -int gsl_vector_int_mul (gsl_vector_int * a, const gsl_vector_int * b); -int gsl_vector_int_div (gsl_vector_int * a, const gsl_vector_int * b); -int gsl_vector_int_scale (gsl_vector_int * a, const double x); -int gsl_vector_int_add_constant (gsl_vector_int * a, const double x); - -int gsl_vector_int_equal (const gsl_vector_int * u, - const gsl_vector_int * v); - -int gsl_vector_int_isnull (const gsl_vector_int * v); -int gsl_vector_int_ispos (const gsl_vector_int * v); -int gsl_vector_int_isneg (const gsl_vector_int * v); -int gsl_vector_int_isnonneg (const gsl_vector_int * v); - -INLINE_DECL int gsl_vector_int_get (const gsl_vector_int * v, const size_t i); -INLINE_DECL void gsl_vector_int_set (gsl_vector_int * v, const size_t i, int x); -INLINE_DECL int * gsl_vector_int_ptr (gsl_vector_int * v, const size_t i); -INLINE_DECL const int * gsl_vector_int_const_ptr (const gsl_vector_int * v, const size_t i); - -#ifdef HAVE_INLINE - -INLINE_FUN -int -gsl_vector_int_get (const gsl_vector_int * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); - } -#endif - return v->data[i * v->stride]; -} - -INLINE_FUN -void -gsl_vector_int_set (gsl_vector_int * v, const size_t i, int x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VOID ("index out of range", GSL_EINVAL); - } -#endif - v->data[i * v->stride] = x; -} - -INLINE_FUN -int * -gsl_vector_int_ptr (gsl_vector_int * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return (int *) (v->data + i * v->stride); -} - -INLINE_FUN -const int * -gsl_vector_int_const_ptr (const gsl_vector_int * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return (const int *) (v->data + i * v->stride); -} -#endif /* HAVE_INLINE */ - -__END_DECLS - -#endif /* __GSL_VECTOR_INT_H__ */ - - diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_long.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_long.h deleted file mode 100644 index f844a0277..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_long.h +++ /dev/null @@ -1,230 +0,0 @@ -/* vector/gsl_vector_long.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_VECTOR_LONG_H__ -#define __GSL_VECTOR_LONG_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size; - size_t stride; - long *data; - gsl_block_long *block; - int owner; -} -gsl_vector_long; - -typedef struct -{ - gsl_vector_long vector; -} _gsl_vector_long_view; - -typedef _gsl_vector_long_view gsl_vector_long_view; - -typedef struct -{ - gsl_vector_long vector; -} _gsl_vector_long_const_view; - -typedef const _gsl_vector_long_const_view gsl_vector_long_const_view; - - -/* Allocation */ - -gsl_vector_long *gsl_vector_long_alloc (const size_t n); -gsl_vector_long *gsl_vector_long_calloc (const size_t n); - -gsl_vector_long *gsl_vector_long_alloc_from_block (gsl_block_long * b, - const size_t offset, - const size_t n, - const size_t stride); - -gsl_vector_long *gsl_vector_long_alloc_from_vector (gsl_vector_long * v, - const size_t offset, - const size_t n, - const size_t stride); - -void gsl_vector_long_free (gsl_vector_long * v); - -/* Views */ - -_gsl_vector_long_view -gsl_vector_long_view_array (long *v, size_t n); - -_gsl_vector_long_view -gsl_vector_long_view_array_with_stride (long *base, - size_t stride, - size_t n); - -_gsl_vector_long_const_view -gsl_vector_long_const_view_array (const long *v, size_t n); - -_gsl_vector_long_const_view -gsl_vector_long_const_view_array_with_stride (const long *base, - size_t stride, - size_t n); - -_gsl_vector_long_view -gsl_vector_long_subvector (gsl_vector_long *v, - size_t i, - size_t n); - -_gsl_vector_long_view -gsl_vector_long_subvector_with_stride (gsl_vector_long *v, - size_t i, - size_t stride, - size_t n); - -_gsl_vector_long_const_view -gsl_vector_long_const_subvector (const gsl_vector_long *v, - size_t i, - size_t n); - -_gsl_vector_long_const_view -gsl_vector_long_const_subvector_with_stride (const gsl_vector_long *v, - size_t i, - size_t stride, - size_t n); - -/* Operations */ - -void gsl_vector_long_set_zero (gsl_vector_long * v); -void gsl_vector_long_set_all (gsl_vector_long * v, long x); -int gsl_vector_long_set_basis (gsl_vector_long * v, size_t i); - -int gsl_vector_long_fread (FILE * stream, gsl_vector_long * v); -int gsl_vector_long_fwrite (FILE * stream, const gsl_vector_long * v); -int gsl_vector_long_fscanf (FILE * stream, gsl_vector_long * v); -int gsl_vector_long_fprintf (FILE * stream, const gsl_vector_long * v, - const char *format); - -int gsl_vector_long_memcpy (gsl_vector_long * dest, const gsl_vector_long * src); - -int gsl_vector_long_reverse (gsl_vector_long * v); - -int gsl_vector_long_swap (gsl_vector_long * v, gsl_vector_long * w); -int gsl_vector_long_swap_elements (gsl_vector_long * v, const size_t i, const size_t j); - -long gsl_vector_long_max (const gsl_vector_long * v); -long gsl_vector_long_min (const gsl_vector_long * v); -void gsl_vector_long_minmax (const gsl_vector_long * v, long * min_out, long * max_out); - -size_t gsl_vector_long_max_index (const gsl_vector_long * v); -size_t gsl_vector_long_min_index (const gsl_vector_long * v); -void gsl_vector_long_minmax_index (const gsl_vector_long * v, size_t * imin, size_t * imax); - -int gsl_vector_long_add (gsl_vector_long * a, const gsl_vector_long * b); -int gsl_vector_long_sub (gsl_vector_long * a, const gsl_vector_long * b); -int gsl_vector_long_mul (gsl_vector_long * a, const gsl_vector_long * b); -int gsl_vector_long_div (gsl_vector_long * a, const gsl_vector_long * b); -int gsl_vector_long_scale (gsl_vector_long * a, const double x); -int gsl_vector_long_add_constant (gsl_vector_long * a, const double x); - -int gsl_vector_long_equal (const gsl_vector_long * u, - const gsl_vector_long * v); - -int gsl_vector_long_isnull (const gsl_vector_long * v); -int gsl_vector_long_ispos (const gsl_vector_long * v); -int gsl_vector_long_isneg (const gsl_vector_long * v); -int gsl_vector_long_isnonneg (const gsl_vector_long * v); - -INLINE_DECL long gsl_vector_long_get (const gsl_vector_long * v, const size_t i); -INLINE_DECL void gsl_vector_long_set (gsl_vector_long * v, const size_t i, long x); -INLINE_DECL long * gsl_vector_long_ptr (gsl_vector_long * v, const size_t i); -INLINE_DECL const long * gsl_vector_long_const_ptr (const gsl_vector_long * v, const size_t i); - -#ifdef HAVE_INLINE - -INLINE_FUN -long -gsl_vector_long_get (const gsl_vector_long * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); - } -#endif - return v->data[i * v->stride]; -} - -INLINE_FUN -void -gsl_vector_long_set (gsl_vector_long * v, const size_t i, long x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VOID ("index out of range", GSL_EINVAL); - } -#endif - v->data[i * v->stride] = x; -} - -INLINE_FUN -long * -gsl_vector_long_ptr (gsl_vector_long * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return (long *) (v->data + i * v->stride); -} - -INLINE_FUN -const long * -gsl_vector_long_const_ptr (const gsl_vector_long * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return (const long *) (v->data + i * v->stride); -} -#endif /* HAVE_INLINE */ - -__END_DECLS - -#endif /* __GSL_VECTOR_LONG_H__ */ - - diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_long_double.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_long_double.h deleted file mode 100644 index 836b09a52..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_long_double.h +++ /dev/null @@ -1,230 +0,0 @@ -/* vector/gsl_vector_long_double.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_VECTOR_LONG_DOUBLE_H__ -#define __GSL_VECTOR_LONG_DOUBLE_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size; - size_t stride; - long double *data; - gsl_block_long_double *block; - int owner; -} -gsl_vector_long_double; - -typedef struct -{ - gsl_vector_long_double vector; -} _gsl_vector_long_double_view; - -typedef _gsl_vector_long_double_view gsl_vector_long_double_view; - -typedef struct -{ - gsl_vector_long_double vector; -} _gsl_vector_long_double_const_view; - -typedef const _gsl_vector_long_double_const_view gsl_vector_long_double_const_view; - - -/* Allocation */ - -gsl_vector_long_double *gsl_vector_long_double_alloc (const size_t n); -gsl_vector_long_double *gsl_vector_long_double_calloc (const size_t n); - -gsl_vector_long_double *gsl_vector_long_double_alloc_from_block (gsl_block_long_double * b, - const size_t offset, - const size_t n, - const size_t stride); - -gsl_vector_long_double *gsl_vector_long_double_alloc_from_vector (gsl_vector_long_double * v, - const size_t offset, - const size_t n, - const size_t stride); - -void gsl_vector_long_double_free (gsl_vector_long_double * v); - -/* Views */ - -_gsl_vector_long_double_view -gsl_vector_long_double_view_array (long double *v, size_t n); - -_gsl_vector_long_double_view -gsl_vector_long_double_view_array_with_stride (long double *base, - size_t stride, - size_t n); - -_gsl_vector_long_double_const_view -gsl_vector_long_double_const_view_array (const long double *v, size_t n); - -_gsl_vector_long_double_const_view -gsl_vector_long_double_const_view_array_with_stride (const long double *base, - size_t stride, - size_t n); - -_gsl_vector_long_double_view -gsl_vector_long_double_subvector (gsl_vector_long_double *v, - size_t i, - size_t n); - -_gsl_vector_long_double_view -gsl_vector_long_double_subvector_with_stride (gsl_vector_long_double *v, - size_t i, - size_t stride, - size_t n); - -_gsl_vector_long_double_const_view -gsl_vector_long_double_const_subvector (const gsl_vector_long_double *v, - size_t i, - size_t n); - -_gsl_vector_long_double_const_view -gsl_vector_long_double_const_subvector_with_stride (const gsl_vector_long_double *v, - size_t i, - size_t stride, - size_t n); - -/* Operations */ - -void gsl_vector_long_double_set_zero (gsl_vector_long_double * v); -void gsl_vector_long_double_set_all (gsl_vector_long_double * v, long double x); -int gsl_vector_long_double_set_basis (gsl_vector_long_double * v, size_t i); - -int gsl_vector_long_double_fread (FILE * stream, gsl_vector_long_double * v); -int gsl_vector_long_double_fwrite (FILE * stream, const gsl_vector_long_double * v); -int gsl_vector_long_double_fscanf (FILE * stream, gsl_vector_long_double * v); -int gsl_vector_long_double_fprintf (FILE * stream, const gsl_vector_long_double * v, - const char *format); - -int gsl_vector_long_double_memcpy (gsl_vector_long_double * dest, const gsl_vector_long_double * src); - -int gsl_vector_long_double_reverse (gsl_vector_long_double * v); - -int gsl_vector_long_double_swap (gsl_vector_long_double * v, gsl_vector_long_double * w); -int gsl_vector_long_double_swap_elements (gsl_vector_long_double * v, const size_t i, const size_t j); - -long double gsl_vector_long_double_max (const gsl_vector_long_double * v); -long double gsl_vector_long_double_min (const gsl_vector_long_double * v); -void gsl_vector_long_double_minmax (const gsl_vector_long_double * v, long double * min_out, long double * max_out); - -size_t gsl_vector_long_double_max_index (const gsl_vector_long_double * v); -size_t gsl_vector_long_double_min_index (const gsl_vector_long_double * v); -void gsl_vector_long_double_minmax_index (const gsl_vector_long_double * v, size_t * imin, size_t * imax); - -int gsl_vector_long_double_add (gsl_vector_long_double * a, const gsl_vector_long_double * b); -int gsl_vector_long_double_sub (gsl_vector_long_double * a, const gsl_vector_long_double * b); -int gsl_vector_long_double_mul (gsl_vector_long_double * a, const gsl_vector_long_double * b); -int gsl_vector_long_double_div (gsl_vector_long_double * a, const gsl_vector_long_double * b); -int gsl_vector_long_double_scale (gsl_vector_long_double * a, const double x); -int gsl_vector_long_double_add_constant (gsl_vector_long_double * a, const double x); - -int gsl_vector_long_double_equal (const gsl_vector_long_double * u, - const gsl_vector_long_double * v); - -int gsl_vector_long_double_isnull (const gsl_vector_long_double * v); -int gsl_vector_long_double_ispos (const gsl_vector_long_double * v); -int gsl_vector_long_double_isneg (const gsl_vector_long_double * v); -int gsl_vector_long_double_isnonneg (const gsl_vector_long_double * v); - -INLINE_DECL long double gsl_vector_long_double_get (const gsl_vector_long_double * v, const size_t i); -INLINE_DECL void gsl_vector_long_double_set (gsl_vector_long_double * v, const size_t i, long double x); -INLINE_DECL long double * gsl_vector_long_double_ptr (gsl_vector_long_double * v, const size_t i); -INLINE_DECL const long double * gsl_vector_long_double_const_ptr (const gsl_vector_long_double * v, const size_t i); - -#ifdef HAVE_INLINE - -INLINE_FUN -long double -gsl_vector_long_double_get (const gsl_vector_long_double * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); - } -#endif - return v->data[i * v->stride]; -} - -INLINE_FUN -void -gsl_vector_long_double_set (gsl_vector_long_double * v, const size_t i, long double x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VOID ("index out of range", GSL_EINVAL); - } -#endif - v->data[i * v->stride] = x; -} - -INLINE_FUN -long double * -gsl_vector_long_double_ptr (gsl_vector_long_double * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return (long double *) (v->data + i * v->stride); -} - -INLINE_FUN -const long double * -gsl_vector_long_double_const_ptr (const gsl_vector_long_double * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return (const long double *) (v->data + i * v->stride); -} -#endif /* HAVE_INLINE */ - -__END_DECLS - -#endif /* __GSL_VECTOR_LONG_DOUBLE_H__ */ - - diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_short.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_short.h deleted file mode 100644 index 4f41f7a6f..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_short.h +++ /dev/null @@ -1,230 +0,0 @@ -/* vector/gsl_vector_short.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_VECTOR_SHORT_H__ -#define __GSL_VECTOR_SHORT_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size; - size_t stride; - short *data; - gsl_block_short *block; - int owner; -} -gsl_vector_short; - -typedef struct -{ - gsl_vector_short vector; -} _gsl_vector_short_view; - -typedef _gsl_vector_short_view gsl_vector_short_view; - -typedef struct -{ - gsl_vector_short vector; -} _gsl_vector_short_const_view; - -typedef const _gsl_vector_short_const_view gsl_vector_short_const_view; - - -/* Allocation */ - -gsl_vector_short *gsl_vector_short_alloc (const size_t n); -gsl_vector_short *gsl_vector_short_calloc (const size_t n); - -gsl_vector_short *gsl_vector_short_alloc_from_block (gsl_block_short * b, - const size_t offset, - const size_t n, - const size_t stride); - -gsl_vector_short *gsl_vector_short_alloc_from_vector (gsl_vector_short * v, - const size_t offset, - const size_t n, - const size_t stride); - -void gsl_vector_short_free (gsl_vector_short * v); - -/* Views */ - -_gsl_vector_short_view -gsl_vector_short_view_array (short *v, size_t n); - -_gsl_vector_short_view -gsl_vector_short_view_array_with_stride (short *base, - size_t stride, - size_t n); - -_gsl_vector_short_const_view -gsl_vector_short_const_view_array (const short *v, size_t n); - -_gsl_vector_short_const_view -gsl_vector_short_const_view_array_with_stride (const short *base, - size_t stride, - size_t n); - -_gsl_vector_short_view -gsl_vector_short_subvector (gsl_vector_short *v, - size_t i, - size_t n); - -_gsl_vector_short_view -gsl_vector_short_subvector_with_stride (gsl_vector_short *v, - size_t i, - size_t stride, - size_t n); - -_gsl_vector_short_const_view -gsl_vector_short_const_subvector (const gsl_vector_short *v, - size_t i, - size_t n); - -_gsl_vector_short_const_view -gsl_vector_short_const_subvector_with_stride (const gsl_vector_short *v, - size_t i, - size_t stride, - size_t n); - -/* Operations */ - -void gsl_vector_short_set_zero (gsl_vector_short * v); -void gsl_vector_short_set_all (gsl_vector_short * v, short x); -int gsl_vector_short_set_basis (gsl_vector_short * v, size_t i); - -int gsl_vector_short_fread (FILE * stream, gsl_vector_short * v); -int gsl_vector_short_fwrite (FILE * stream, const gsl_vector_short * v); -int gsl_vector_short_fscanf (FILE * stream, gsl_vector_short * v); -int gsl_vector_short_fprintf (FILE * stream, const gsl_vector_short * v, - const char *format); - -int gsl_vector_short_memcpy (gsl_vector_short * dest, const gsl_vector_short * src); - -int gsl_vector_short_reverse (gsl_vector_short * v); - -int gsl_vector_short_swap (gsl_vector_short * v, gsl_vector_short * w); -int gsl_vector_short_swap_elements (gsl_vector_short * v, const size_t i, const size_t j); - -short gsl_vector_short_max (const gsl_vector_short * v); -short gsl_vector_short_min (const gsl_vector_short * v); -void gsl_vector_short_minmax (const gsl_vector_short * v, short * min_out, short * max_out); - -size_t gsl_vector_short_max_index (const gsl_vector_short * v); -size_t gsl_vector_short_min_index (const gsl_vector_short * v); -void gsl_vector_short_minmax_index (const gsl_vector_short * v, size_t * imin, size_t * imax); - -int gsl_vector_short_add (gsl_vector_short * a, const gsl_vector_short * b); -int gsl_vector_short_sub (gsl_vector_short * a, const gsl_vector_short * b); -int gsl_vector_short_mul (gsl_vector_short * a, const gsl_vector_short * b); -int gsl_vector_short_div (gsl_vector_short * a, const gsl_vector_short * b); -int gsl_vector_short_scale (gsl_vector_short * a, const double x); -int gsl_vector_short_add_constant (gsl_vector_short * a, const double x); - -int gsl_vector_short_equal (const gsl_vector_short * u, - const gsl_vector_short * v); - -int gsl_vector_short_isnull (const gsl_vector_short * v); -int gsl_vector_short_ispos (const gsl_vector_short * v); -int gsl_vector_short_isneg (const gsl_vector_short * v); -int gsl_vector_short_isnonneg (const gsl_vector_short * v); - -INLINE_DECL short gsl_vector_short_get (const gsl_vector_short * v, const size_t i); -INLINE_DECL void gsl_vector_short_set (gsl_vector_short * v, const size_t i, short x); -INLINE_DECL short * gsl_vector_short_ptr (gsl_vector_short * v, const size_t i); -INLINE_DECL const short * gsl_vector_short_const_ptr (const gsl_vector_short * v, const size_t i); - -#ifdef HAVE_INLINE - -INLINE_FUN -short -gsl_vector_short_get (const gsl_vector_short * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); - } -#endif - return v->data[i * v->stride]; -} - -INLINE_FUN -void -gsl_vector_short_set (gsl_vector_short * v, const size_t i, short x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VOID ("index out of range", GSL_EINVAL); - } -#endif - v->data[i * v->stride] = x; -} - -INLINE_FUN -short * -gsl_vector_short_ptr (gsl_vector_short * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return (short *) (v->data + i * v->stride); -} - -INLINE_FUN -const short * -gsl_vector_short_const_ptr (const gsl_vector_short * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return (const short *) (v->data + i * v->stride); -} -#endif /* HAVE_INLINE */ - -__END_DECLS - -#endif /* __GSL_VECTOR_SHORT_H__ */ - - diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_uchar.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_uchar.h deleted file mode 100644 index b27096d95..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_uchar.h +++ /dev/null @@ -1,230 +0,0 @@ -/* vector/gsl_vector_uchar.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_VECTOR_UCHAR_H__ -#define __GSL_VECTOR_UCHAR_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size; - size_t stride; - unsigned char *data; - gsl_block_uchar *block; - int owner; -} -gsl_vector_uchar; - -typedef struct -{ - gsl_vector_uchar vector; -} _gsl_vector_uchar_view; - -typedef _gsl_vector_uchar_view gsl_vector_uchar_view; - -typedef struct -{ - gsl_vector_uchar vector; -} _gsl_vector_uchar_const_view; - -typedef const _gsl_vector_uchar_const_view gsl_vector_uchar_const_view; - - -/* Allocation */ - -gsl_vector_uchar *gsl_vector_uchar_alloc (const size_t n); -gsl_vector_uchar *gsl_vector_uchar_calloc (const size_t n); - -gsl_vector_uchar *gsl_vector_uchar_alloc_from_block (gsl_block_uchar * b, - const size_t offset, - const size_t n, - const size_t stride); - -gsl_vector_uchar *gsl_vector_uchar_alloc_from_vector (gsl_vector_uchar * v, - const size_t offset, - const size_t n, - const size_t stride); - -void gsl_vector_uchar_free (gsl_vector_uchar * v); - -/* Views */ - -_gsl_vector_uchar_view -gsl_vector_uchar_view_array (unsigned char *v, size_t n); - -_gsl_vector_uchar_view -gsl_vector_uchar_view_array_with_stride (unsigned char *base, - size_t stride, - size_t n); - -_gsl_vector_uchar_const_view -gsl_vector_uchar_const_view_array (const unsigned char *v, size_t n); - -_gsl_vector_uchar_const_view -gsl_vector_uchar_const_view_array_with_stride (const unsigned char *base, - size_t stride, - size_t n); - -_gsl_vector_uchar_view -gsl_vector_uchar_subvector (gsl_vector_uchar *v, - size_t i, - size_t n); - -_gsl_vector_uchar_view -gsl_vector_uchar_subvector_with_stride (gsl_vector_uchar *v, - size_t i, - size_t stride, - size_t n); - -_gsl_vector_uchar_const_view -gsl_vector_uchar_const_subvector (const gsl_vector_uchar *v, - size_t i, - size_t n); - -_gsl_vector_uchar_const_view -gsl_vector_uchar_const_subvector_with_stride (const gsl_vector_uchar *v, - size_t i, - size_t stride, - size_t n); - -/* Operations */ - -void gsl_vector_uchar_set_zero (gsl_vector_uchar * v); -void gsl_vector_uchar_set_all (gsl_vector_uchar * v, unsigned char x); -int gsl_vector_uchar_set_basis (gsl_vector_uchar * v, size_t i); - -int gsl_vector_uchar_fread (FILE * stream, gsl_vector_uchar * v); -int gsl_vector_uchar_fwrite (FILE * stream, const gsl_vector_uchar * v); -int gsl_vector_uchar_fscanf (FILE * stream, gsl_vector_uchar * v); -int gsl_vector_uchar_fprintf (FILE * stream, const gsl_vector_uchar * v, - const char *format); - -int gsl_vector_uchar_memcpy (gsl_vector_uchar * dest, const gsl_vector_uchar * src); - -int gsl_vector_uchar_reverse (gsl_vector_uchar * v); - -int gsl_vector_uchar_swap (gsl_vector_uchar * v, gsl_vector_uchar * w); -int gsl_vector_uchar_swap_elements (gsl_vector_uchar * v, const size_t i, const size_t j); - -unsigned char gsl_vector_uchar_max (const gsl_vector_uchar * v); -unsigned char gsl_vector_uchar_min (const gsl_vector_uchar * v); -void gsl_vector_uchar_minmax (const gsl_vector_uchar * v, unsigned char * min_out, unsigned char * max_out); - -size_t gsl_vector_uchar_max_index (const gsl_vector_uchar * v); -size_t gsl_vector_uchar_min_index (const gsl_vector_uchar * v); -void gsl_vector_uchar_minmax_index (const gsl_vector_uchar * v, size_t * imin, size_t * imax); - -int gsl_vector_uchar_add (gsl_vector_uchar * a, const gsl_vector_uchar * b); -int gsl_vector_uchar_sub (gsl_vector_uchar * a, const gsl_vector_uchar * b); -int gsl_vector_uchar_mul (gsl_vector_uchar * a, const gsl_vector_uchar * b); -int gsl_vector_uchar_div (gsl_vector_uchar * a, const gsl_vector_uchar * b); -int gsl_vector_uchar_scale (gsl_vector_uchar * a, const double x); -int gsl_vector_uchar_add_constant (gsl_vector_uchar * a, const double x); - -int gsl_vector_uchar_equal (const gsl_vector_uchar * u, - const gsl_vector_uchar * v); - -int gsl_vector_uchar_isnull (const gsl_vector_uchar * v); -int gsl_vector_uchar_ispos (const gsl_vector_uchar * v); -int gsl_vector_uchar_isneg (const gsl_vector_uchar * v); -int gsl_vector_uchar_isnonneg (const gsl_vector_uchar * v); - -INLINE_DECL unsigned char gsl_vector_uchar_get (const gsl_vector_uchar * v, const size_t i); -INLINE_DECL void gsl_vector_uchar_set (gsl_vector_uchar * v, const size_t i, unsigned char x); -INLINE_DECL unsigned char * gsl_vector_uchar_ptr (gsl_vector_uchar * v, const size_t i); -INLINE_DECL const unsigned char * gsl_vector_uchar_const_ptr (const gsl_vector_uchar * v, const size_t i); - -#ifdef HAVE_INLINE - -INLINE_FUN -unsigned char -gsl_vector_uchar_get (const gsl_vector_uchar * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); - } -#endif - return v->data[i * v->stride]; -} - -INLINE_FUN -void -gsl_vector_uchar_set (gsl_vector_uchar * v, const size_t i, unsigned char x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VOID ("index out of range", GSL_EINVAL); - } -#endif - v->data[i * v->stride] = x; -} - -INLINE_FUN -unsigned char * -gsl_vector_uchar_ptr (gsl_vector_uchar * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return (unsigned char *) (v->data + i * v->stride); -} - -INLINE_FUN -const unsigned char * -gsl_vector_uchar_const_ptr (const gsl_vector_uchar * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return (const unsigned char *) (v->data + i * v->stride); -} -#endif /* HAVE_INLINE */ - -__END_DECLS - -#endif /* __GSL_VECTOR_UCHAR_H__ */ - - diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_uint.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_uint.h deleted file mode 100644 index d2f6cb35e..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_uint.h +++ /dev/null @@ -1,230 +0,0 @@ -/* vector/gsl_vector_uint.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_VECTOR_UINT_H__ -#define __GSL_VECTOR_UINT_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size; - size_t stride; - unsigned int *data; - gsl_block_uint *block; - int owner; -} -gsl_vector_uint; - -typedef struct -{ - gsl_vector_uint vector; -} _gsl_vector_uint_view; - -typedef _gsl_vector_uint_view gsl_vector_uint_view; - -typedef struct -{ - gsl_vector_uint vector; -} _gsl_vector_uint_const_view; - -typedef const _gsl_vector_uint_const_view gsl_vector_uint_const_view; - - -/* Allocation */ - -gsl_vector_uint *gsl_vector_uint_alloc (const size_t n); -gsl_vector_uint *gsl_vector_uint_calloc (const size_t n); - -gsl_vector_uint *gsl_vector_uint_alloc_from_block (gsl_block_uint * b, - const size_t offset, - const size_t n, - const size_t stride); - -gsl_vector_uint *gsl_vector_uint_alloc_from_vector (gsl_vector_uint * v, - const size_t offset, - const size_t n, - const size_t stride); - -void gsl_vector_uint_free (gsl_vector_uint * v); - -/* Views */ - -_gsl_vector_uint_view -gsl_vector_uint_view_array (unsigned int *v, size_t n); - -_gsl_vector_uint_view -gsl_vector_uint_view_array_with_stride (unsigned int *base, - size_t stride, - size_t n); - -_gsl_vector_uint_const_view -gsl_vector_uint_const_view_array (const unsigned int *v, size_t n); - -_gsl_vector_uint_const_view -gsl_vector_uint_const_view_array_with_stride (const unsigned int *base, - size_t stride, - size_t n); - -_gsl_vector_uint_view -gsl_vector_uint_subvector (gsl_vector_uint *v, - size_t i, - size_t n); - -_gsl_vector_uint_view -gsl_vector_uint_subvector_with_stride (gsl_vector_uint *v, - size_t i, - size_t stride, - size_t n); - -_gsl_vector_uint_const_view -gsl_vector_uint_const_subvector (const gsl_vector_uint *v, - size_t i, - size_t n); - -_gsl_vector_uint_const_view -gsl_vector_uint_const_subvector_with_stride (const gsl_vector_uint *v, - size_t i, - size_t stride, - size_t n); - -/* Operations */ - -void gsl_vector_uint_set_zero (gsl_vector_uint * v); -void gsl_vector_uint_set_all (gsl_vector_uint * v, unsigned int x); -int gsl_vector_uint_set_basis (gsl_vector_uint * v, size_t i); - -int gsl_vector_uint_fread (FILE * stream, gsl_vector_uint * v); -int gsl_vector_uint_fwrite (FILE * stream, const gsl_vector_uint * v); -int gsl_vector_uint_fscanf (FILE * stream, gsl_vector_uint * v); -int gsl_vector_uint_fprintf (FILE * stream, const gsl_vector_uint * v, - const char *format); - -int gsl_vector_uint_memcpy (gsl_vector_uint * dest, const gsl_vector_uint * src); - -int gsl_vector_uint_reverse (gsl_vector_uint * v); - -int gsl_vector_uint_swap (gsl_vector_uint * v, gsl_vector_uint * w); -int gsl_vector_uint_swap_elements (gsl_vector_uint * v, const size_t i, const size_t j); - -unsigned int gsl_vector_uint_max (const gsl_vector_uint * v); -unsigned int gsl_vector_uint_min (const gsl_vector_uint * v); -void gsl_vector_uint_minmax (const gsl_vector_uint * v, unsigned int * min_out, unsigned int * max_out); - -size_t gsl_vector_uint_max_index (const gsl_vector_uint * v); -size_t gsl_vector_uint_min_index (const gsl_vector_uint * v); -void gsl_vector_uint_minmax_index (const gsl_vector_uint * v, size_t * imin, size_t * imax); - -int gsl_vector_uint_add (gsl_vector_uint * a, const gsl_vector_uint * b); -int gsl_vector_uint_sub (gsl_vector_uint * a, const gsl_vector_uint * b); -int gsl_vector_uint_mul (gsl_vector_uint * a, const gsl_vector_uint * b); -int gsl_vector_uint_div (gsl_vector_uint * a, const gsl_vector_uint * b); -int gsl_vector_uint_scale (gsl_vector_uint * a, const double x); -int gsl_vector_uint_add_constant (gsl_vector_uint * a, const double x); - -int gsl_vector_uint_equal (const gsl_vector_uint * u, - const gsl_vector_uint * v); - -int gsl_vector_uint_isnull (const gsl_vector_uint * v); -int gsl_vector_uint_ispos (const gsl_vector_uint * v); -int gsl_vector_uint_isneg (const gsl_vector_uint * v); -int gsl_vector_uint_isnonneg (const gsl_vector_uint * v); - -INLINE_DECL unsigned int gsl_vector_uint_get (const gsl_vector_uint * v, const size_t i); -INLINE_DECL void gsl_vector_uint_set (gsl_vector_uint * v, const size_t i, unsigned int x); -INLINE_DECL unsigned int * gsl_vector_uint_ptr (gsl_vector_uint * v, const size_t i); -INLINE_DECL const unsigned int * gsl_vector_uint_const_ptr (const gsl_vector_uint * v, const size_t i); - -#ifdef HAVE_INLINE - -INLINE_FUN -unsigned int -gsl_vector_uint_get (const gsl_vector_uint * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); - } -#endif - return v->data[i * v->stride]; -} - -INLINE_FUN -void -gsl_vector_uint_set (gsl_vector_uint * v, const size_t i, unsigned int x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VOID ("index out of range", GSL_EINVAL); - } -#endif - v->data[i * v->stride] = x; -} - -INLINE_FUN -unsigned int * -gsl_vector_uint_ptr (gsl_vector_uint * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return (unsigned int *) (v->data + i * v->stride); -} - -INLINE_FUN -const unsigned int * -gsl_vector_uint_const_ptr (const gsl_vector_uint * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return (const unsigned int *) (v->data + i * v->stride); -} -#endif /* HAVE_INLINE */ - -__END_DECLS - -#endif /* __GSL_VECTOR_UINT_H__ */ - - diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_ulong.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_ulong.h deleted file mode 100644 index 01bf24294..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_ulong.h +++ /dev/null @@ -1,230 +0,0 @@ -/* vector/gsl_vector_ulong.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_VECTOR_ULONG_H__ -#define __GSL_VECTOR_ULONG_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size; - size_t stride; - unsigned long *data; - gsl_block_ulong *block; - int owner; -} -gsl_vector_ulong; - -typedef struct -{ - gsl_vector_ulong vector; -} _gsl_vector_ulong_view; - -typedef _gsl_vector_ulong_view gsl_vector_ulong_view; - -typedef struct -{ - gsl_vector_ulong vector; -} _gsl_vector_ulong_const_view; - -typedef const _gsl_vector_ulong_const_view gsl_vector_ulong_const_view; - - -/* Allocation */ - -gsl_vector_ulong *gsl_vector_ulong_alloc (const size_t n); -gsl_vector_ulong *gsl_vector_ulong_calloc (const size_t n); - -gsl_vector_ulong *gsl_vector_ulong_alloc_from_block (gsl_block_ulong * b, - const size_t offset, - const size_t n, - const size_t stride); - -gsl_vector_ulong *gsl_vector_ulong_alloc_from_vector (gsl_vector_ulong * v, - const size_t offset, - const size_t n, - const size_t stride); - -void gsl_vector_ulong_free (gsl_vector_ulong * v); - -/* Views */ - -_gsl_vector_ulong_view -gsl_vector_ulong_view_array (unsigned long *v, size_t n); - -_gsl_vector_ulong_view -gsl_vector_ulong_view_array_with_stride (unsigned long *base, - size_t stride, - size_t n); - -_gsl_vector_ulong_const_view -gsl_vector_ulong_const_view_array (const unsigned long *v, size_t n); - -_gsl_vector_ulong_const_view -gsl_vector_ulong_const_view_array_with_stride (const unsigned long *base, - size_t stride, - size_t n); - -_gsl_vector_ulong_view -gsl_vector_ulong_subvector (gsl_vector_ulong *v, - size_t i, - size_t n); - -_gsl_vector_ulong_view -gsl_vector_ulong_subvector_with_stride (gsl_vector_ulong *v, - size_t i, - size_t stride, - size_t n); - -_gsl_vector_ulong_const_view -gsl_vector_ulong_const_subvector (const gsl_vector_ulong *v, - size_t i, - size_t n); - -_gsl_vector_ulong_const_view -gsl_vector_ulong_const_subvector_with_stride (const gsl_vector_ulong *v, - size_t i, - size_t stride, - size_t n); - -/* Operations */ - -void gsl_vector_ulong_set_zero (gsl_vector_ulong * v); -void gsl_vector_ulong_set_all (gsl_vector_ulong * v, unsigned long x); -int gsl_vector_ulong_set_basis (gsl_vector_ulong * v, size_t i); - -int gsl_vector_ulong_fread (FILE * stream, gsl_vector_ulong * v); -int gsl_vector_ulong_fwrite (FILE * stream, const gsl_vector_ulong * v); -int gsl_vector_ulong_fscanf (FILE * stream, gsl_vector_ulong * v); -int gsl_vector_ulong_fprintf (FILE * stream, const gsl_vector_ulong * v, - const char *format); - -int gsl_vector_ulong_memcpy (gsl_vector_ulong * dest, const gsl_vector_ulong * src); - -int gsl_vector_ulong_reverse (gsl_vector_ulong * v); - -int gsl_vector_ulong_swap (gsl_vector_ulong * v, gsl_vector_ulong * w); -int gsl_vector_ulong_swap_elements (gsl_vector_ulong * v, const size_t i, const size_t j); - -unsigned long gsl_vector_ulong_max (const gsl_vector_ulong * v); -unsigned long gsl_vector_ulong_min (const gsl_vector_ulong * v); -void gsl_vector_ulong_minmax (const gsl_vector_ulong * v, unsigned long * min_out, unsigned long * max_out); - -size_t gsl_vector_ulong_max_index (const gsl_vector_ulong * v); -size_t gsl_vector_ulong_min_index (const gsl_vector_ulong * v); -void gsl_vector_ulong_minmax_index (const gsl_vector_ulong * v, size_t * imin, size_t * imax); - -int gsl_vector_ulong_add (gsl_vector_ulong * a, const gsl_vector_ulong * b); -int gsl_vector_ulong_sub (gsl_vector_ulong * a, const gsl_vector_ulong * b); -int gsl_vector_ulong_mul (gsl_vector_ulong * a, const gsl_vector_ulong * b); -int gsl_vector_ulong_div (gsl_vector_ulong * a, const gsl_vector_ulong * b); -int gsl_vector_ulong_scale (gsl_vector_ulong * a, const double x); -int gsl_vector_ulong_add_constant (gsl_vector_ulong * a, const double x); - -int gsl_vector_ulong_equal (const gsl_vector_ulong * u, - const gsl_vector_ulong * v); - -int gsl_vector_ulong_isnull (const gsl_vector_ulong * v); -int gsl_vector_ulong_ispos (const gsl_vector_ulong * v); -int gsl_vector_ulong_isneg (const gsl_vector_ulong * v); -int gsl_vector_ulong_isnonneg (const gsl_vector_ulong * v); - -INLINE_DECL unsigned long gsl_vector_ulong_get (const gsl_vector_ulong * v, const size_t i); -INLINE_DECL void gsl_vector_ulong_set (gsl_vector_ulong * v, const size_t i, unsigned long x); -INLINE_DECL unsigned long * gsl_vector_ulong_ptr (gsl_vector_ulong * v, const size_t i); -INLINE_DECL const unsigned long * gsl_vector_ulong_const_ptr (const gsl_vector_ulong * v, const size_t i); - -#ifdef HAVE_INLINE - -INLINE_FUN -unsigned long -gsl_vector_ulong_get (const gsl_vector_ulong * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); - } -#endif - return v->data[i * v->stride]; -} - -INLINE_FUN -void -gsl_vector_ulong_set (gsl_vector_ulong * v, const size_t i, unsigned long x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VOID ("index out of range", GSL_EINVAL); - } -#endif - v->data[i * v->stride] = x; -} - -INLINE_FUN -unsigned long * -gsl_vector_ulong_ptr (gsl_vector_ulong * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return (unsigned long *) (v->data + i * v->stride); -} - -INLINE_FUN -const unsigned long * -gsl_vector_ulong_const_ptr (const gsl_vector_ulong * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return (const unsigned long *) (v->data + i * v->stride); -} -#endif /* HAVE_INLINE */ - -__END_DECLS - -#endif /* __GSL_VECTOR_ULONG_H__ */ - - diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_ushort.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_ushort.h deleted file mode 100644 index 7b7e66438..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_vector_ushort.h +++ /dev/null @@ -1,230 +0,0 @@ -/* vector/gsl_vector_ushort.h - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_VECTOR_USHORT_H__ -#define __GSL_VECTOR_USHORT_H__ - -#include -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef struct -{ - size_t size; - size_t stride; - unsigned short *data; - gsl_block_ushort *block; - int owner; -} -gsl_vector_ushort; - -typedef struct -{ - gsl_vector_ushort vector; -} _gsl_vector_ushort_view; - -typedef _gsl_vector_ushort_view gsl_vector_ushort_view; - -typedef struct -{ - gsl_vector_ushort vector; -} _gsl_vector_ushort_const_view; - -typedef const _gsl_vector_ushort_const_view gsl_vector_ushort_const_view; - - -/* Allocation */ - -gsl_vector_ushort *gsl_vector_ushort_alloc (const size_t n); -gsl_vector_ushort *gsl_vector_ushort_calloc (const size_t n); - -gsl_vector_ushort *gsl_vector_ushort_alloc_from_block (gsl_block_ushort * b, - const size_t offset, - const size_t n, - const size_t stride); - -gsl_vector_ushort *gsl_vector_ushort_alloc_from_vector (gsl_vector_ushort * v, - const size_t offset, - const size_t n, - const size_t stride); - -void gsl_vector_ushort_free (gsl_vector_ushort * v); - -/* Views */ - -_gsl_vector_ushort_view -gsl_vector_ushort_view_array (unsigned short *v, size_t n); - -_gsl_vector_ushort_view -gsl_vector_ushort_view_array_with_stride (unsigned short *base, - size_t stride, - size_t n); - -_gsl_vector_ushort_const_view -gsl_vector_ushort_const_view_array (const unsigned short *v, size_t n); - -_gsl_vector_ushort_const_view -gsl_vector_ushort_const_view_array_with_stride (const unsigned short *base, - size_t stride, - size_t n); - -_gsl_vector_ushort_view -gsl_vector_ushort_subvector (gsl_vector_ushort *v, - size_t i, - size_t n); - -_gsl_vector_ushort_view -gsl_vector_ushort_subvector_with_stride (gsl_vector_ushort *v, - size_t i, - size_t stride, - size_t n); - -_gsl_vector_ushort_const_view -gsl_vector_ushort_const_subvector (const gsl_vector_ushort *v, - size_t i, - size_t n); - -_gsl_vector_ushort_const_view -gsl_vector_ushort_const_subvector_with_stride (const gsl_vector_ushort *v, - size_t i, - size_t stride, - size_t n); - -/* Operations */ - -void gsl_vector_ushort_set_zero (gsl_vector_ushort * v); -void gsl_vector_ushort_set_all (gsl_vector_ushort * v, unsigned short x); -int gsl_vector_ushort_set_basis (gsl_vector_ushort * v, size_t i); - -int gsl_vector_ushort_fread (FILE * stream, gsl_vector_ushort * v); -int gsl_vector_ushort_fwrite (FILE * stream, const gsl_vector_ushort * v); -int gsl_vector_ushort_fscanf (FILE * stream, gsl_vector_ushort * v); -int gsl_vector_ushort_fprintf (FILE * stream, const gsl_vector_ushort * v, - const char *format); - -int gsl_vector_ushort_memcpy (gsl_vector_ushort * dest, const gsl_vector_ushort * src); - -int gsl_vector_ushort_reverse (gsl_vector_ushort * v); - -int gsl_vector_ushort_swap (gsl_vector_ushort * v, gsl_vector_ushort * w); -int gsl_vector_ushort_swap_elements (gsl_vector_ushort * v, const size_t i, const size_t j); - -unsigned short gsl_vector_ushort_max (const gsl_vector_ushort * v); -unsigned short gsl_vector_ushort_min (const gsl_vector_ushort * v); -void gsl_vector_ushort_minmax (const gsl_vector_ushort * v, unsigned short * min_out, unsigned short * max_out); - -size_t gsl_vector_ushort_max_index (const gsl_vector_ushort * v); -size_t gsl_vector_ushort_min_index (const gsl_vector_ushort * v); -void gsl_vector_ushort_minmax_index (const gsl_vector_ushort * v, size_t * imin, size_t * imax); - -int gsl_vector_ushort_add (gsl_vector_ushort * a, const gsl_vector_ushort * b); -int gsl_vector_ushort_sub (gsl_vector_ushort * a, const gsl_vector_ushort * b); -int gsl_vector_ushort_mul (gsl_vector_ushort * a, const gsl_vector_ushort * b); -int gsl_vector_ushort_div (gsl_vector_ushort * a, const gsl_vector_ushort * b); -int gsl_vector_ushort_scale (gsl_vector_ushort * a, const double x); -int gsl_vector_ushort_add_constant (gsl_vector_ushort * a, const double x); - -int gsl_vector_ushort_equal (const gsl_vector_ushort * u, - const gsl_vector_ushort * v); - -int gsl_vector_ushort_isnull (const gsl_vector_ushort * v); -int gsl_vector_ushort_ispos (const gsl_vector_ushort * v); -int gsl_vector_ushort_isneg (const gsl_vector_ushort * v); -int gsl_vector_ushort_isnonneg (const gsl_vector_ushort * v); - -INLINE_DECL unsigned short gsl_vector_ushort_get (const gsl_vector_ushort * v, const size_t i); -INLINE_DECL void gsl_vector_ushort_set (gsl_vector_ushort * v, const size_t i, unsigned short x); -INLINE_DECL unsigned short * gsl_vector_ushort_ptr (gsl_vector_ushort * v, const size_t i); -INLINE_DECL const unsigned short * gsl_vector_ushort_const_ptr (const gsl_vector_ushort * v, const size_t i); - -#ifdef HAVE_INLINE - -INLINE_FUN -unsigned short -gsl_vector_ushort_get (const gsl_vector_ushort * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); - } -#endif - return v->data[i * v->stride]; -} - -INLINE_FUN -void -gsl_vector_ushort_set (gsl_vector_ushort * v, const size_t i, unsigned short x) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_VOID ("index out of range", GSL_EINVAL); - } -#endif - v->data[i * v->stride] = x; -} - -INLINE_FUN -unsigned short * -gsl_vector_ushort_ptr (gsl_vector_ushort * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return (unsigned short *) (v->data + i * v->stride); -} - -INLINE_FUN -const unsigned short * -gsl_vector_ushort_const_ptr (const gsl_vector_ushort * v, const size_t i) -{ -#if GSL_RANGE_CHECK - if (GSL_RANGE_COND(i >= v->size)) - { - GSL_ERROR_NULL ("index out of range", GSL_EINVAL); - } -#endif - return (const unsigned short *) (v->data + i * v->stride); -} -#endif /* HAVE_INLINE */ - -__END_DECLS - -#endif /* __GSL_VECTOR_USHORT_H__ */ - - diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_version.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_version.h deleted file mode 100644 index 00b29b6a5..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_version.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef __GSL_VERSION_H__ -#define __GSL_VERSION_H__ - -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif -__BEGIN_DECLS - - -#define GSL_VERSION "2.5" -#define GSL_MAJOR_VERSION 2 -#define GSL_MINOR_VERSION 5 - -GSL_VAR const char * gsl_version; - -__END_DECLS - -#endif /* __GSL_VERSION_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_wavelet.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_wavelet.h deleted file mode 100644 index 5e1ec2b22..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_wavelet.h +++ /dev/null @@ -1,100 +0,0 @@ -/* wavelet/gsl_wavelet.h - * - * Copyright (C) 2004 Ivo Alxneit - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_WAVELET_H__ -#define __GSL_WAVELET_H__ -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -typedef enum { - gsl_wavelet_forward = 1, gsl_wavelet_backward = -1 -} -gsl_wavelet_direction; - -typedef struct -{ - const char *name; - int (*init) (const double **h1, const double **g1, - const double **h2, const double **g2, size_t * nc, - size_t * offset, size_t member); -} -gsl_wavelet_type; - -typedef struct -{ - const gsl_wavelet_type *type; - const double *h1; - const double *g1; - const double *h2; - const double *g2; - size_t nc; - size_t offset; -} -gsl_wavelet; - -typedef struct -{ - double *scratch; - size_t n; -} -gsl_wavelet_workspace; - -GSL_VAR const gsl_wavelet_type *gsl_wavelet_daubechies; -GSL_VAR const gsl_wavelet_type *gsl_wavelet_daubechies_centered; -GSL_VAR const gsl_wavelet_type *gsl_wavelet_haar; -GSL_VAR const gsl_wavelet_type *gsl_wavelet_haar_centered; -GSL_VAR const gsl_wavelet_type *gsl_wavelet_bspline; -GSL_VAR const gsl_wavelet_type *gsl_wavelet_bspline_centered; - -gsl_wavelet *gsl_wavelet_alloc (const gsl_wavelet_type * T, size_t k); -void gsl_wavelet_free (gsl_wavelet * w); -const char *gsl_wavelet_name (const gsl_wavelet * w); - -gsl_wavelet_workspace *gsl_wavelet_workspace_alloc (size_t n); -void gsl_wavelet_workspace_free (gsl_wavelet_workspace * work); - -int gsl_wavelet_transform (const gsl_wavelet * w, - double *data, size_t stride, size_t n, - gsl_wavelet_direction dir, - gsl_wavelet_workspace * work); - -int gsl_wavelet_transform_forward (const gsl_wavelet * w, - double *data, size_t stride, size_t n, - gsl_wavelet_workspace * work); - -int gsl_wavelet_transform_inverse (const gsl_wavelet * w, - double *data, size_t stride, size_t n, - gsl_wavelet_workspace * work); - -__END_DECLS - -#endif /* __GSL_WAVELET_H__ */ diff --git a/kmath-gsl/src/nativeMain/resources/gsl/gsl_wavelet2d.h b/kmath-gsl/src/nativeMain/resources/gsl/gsl_wavelet2d.h deleted file mode 100644 index 173f43e2c..000000000 --- a/kmath-gsl/src/nativeMain/resources/gsl/gsl_wavelet2d.h +++ /dev/null @@ -1,107 +0,0 @@ -/* wavelet/gsl_wavelet.h - * - * Copyright (C) 2004 Ivo Alxneit - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __GSL_WAVELET2D_H__ -#define __GSL_WAVELET2D_H__ -#include -#include -#include -#include -#include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -__BEGIN_DECLS - -int gsl_wavelet2d_transform (const gsl_wavelet * w, - double *data, - size_t tda, size_t size1, size_t size2, - gsl_wavelet_direction dir, - gsl_wavelet_workspace * work); - -int gsl_wavelet2d_transform_forward (const gsl_wavelet * w, - double *data, - size_t tda, size_t size1, size_t size2, - gsl_wavelet_workspace * work); - -int gsl_wavelet2d_transform_inverse (const gsl_wavelet * w, - double *data, - size_t tda, size_t size1, size_t size2, - gsl_wavelet_workspace * work); - -int gsl_wavelet2d_nstransform (const gsl_wavelet * w, - double *data, - size_t tda, size_t size1, size_t size2, - gsl_wavelet_direction dir, - gsl_wavelet_workspace * work); - -int gsl_wavelet2d_nstransform_forward (const gsl_wavelet * w, - double *data, - size_t tda, size_t size1, size_t size2, - gsl_wavelet_workspace * work); - -int gsl_wavelet2d_nstransform_inverse (const gsl_wavelet * w, - double *data, - size_t tda, size_t size1, size_t size2, - gsl_wavelet_workspace * work); - -int -gsl_wavelet2d_transform_matrix (const gsl_wavelet * w, - gsl_matrix * a, - gsl_wavelet_direction dir, - gsl_wavelet_workspace * work); - -int -gsl_wavelet2d_transform_matrix_forward (const gsl_wavelet * w, - gsl_matrix * a, - gsl_wavelet_workspace * work); - -int -gsl_wavelet2d_transform_matrix_inverse (const gsl_wavelet * w, - gsl_matrix * a, - gsl_wavelet_workspace * work); - - -int -gsl_wavelet2d_nstransform_matrix (const gsl_wavelet * w, - gsl_matrix * a, - gsl_wavelet_direction dir, - gsl_wavelet_workspace * work); - -int -gsl_wavelet2d_nstransform_matrix_forward (const gsl_wavelet * w, - gsl_matrix * a, - gsl_wavelet_workspace * work); - -int -gsl_wavelet2d_nstransform_matrix_inverse (const gsl_wavelet * w, - gsl_matrix * a, - gsl_wavelet_workspace * work); - -__END_DECLS - -#endif /* __GSL_WAVELET2D_H__ */ From 3c069398a2091248e9edb77cfc27da5a2c5a68bb Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 11 Oct 2020 14:28:59 +0700 Subject: [PATCH 28/76] Add /usr/local/ directory to headers --- kmath-gsl/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index d6503461a..dc8869ad1 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -20,7 +20,7 @@ kotlin { val main by nativeTarget.compilations.getting { cinterops { - val libgsl by creating { includeDirs { headerFilterOnly("/usr/include/") } } + val libgsl by creating { includeDirs { headerFilterOnly("/usr/include/", "/usr/local/") } } } } From 3ae2be06e2dd894d947c86be5d15be3b45d455e7 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 11 Oct 2020 21:24:10 +0700 Subject: [PATCH 29/76] Remove kotlinx-io dependency, use DeferScope to dispose native memory --- build.gradle.kts | 1 - .../kmath/gsl/codegen/matricesCodegen.kt | 9 +-- .../kmath/gsl/codegen/vectorsCodegen.kt | 5 +- kmath-gsl/build.gradle.kts | 9 ++- .../kotlin/kscience/kmath/gsl/GslComplex.kt | 19 ++--- .../kotlin/kscience/kmath/gsl/GslMatrix.kt | 4 +- .../kscience/kmath/gsl/GslMatrixContexts.kt | 42 ++++++----- .../kscience/kmath/gsl/GslMemoryHolder.kt | 10 ++- .../kotlin/kscience/kmath/gsl/GslVector.kt | 4 +- .../kotlin/kscience/kmath/gsl/_Matrices.kt | 72 ++++++++++--------- .../kotlin/kscience/kmath/gsl/_Vectors.kt | 40 ++++++----- kmath-gsl/src/nativeTest/kotlin/RealTest.kt | 52 +++++++------- 12 files changed, 155 insertions(+), 112 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 22ba35d18..56c9986c9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,7 +12,6 @@ allprojects { maven("https://dl.bintray.com/kotlin/kotlin-eap") maven("https://dl.bintray.com/kotlin/kotlinx") maven("https://dl.bintray.com/hotkeytlt/maven") - maven("https://dl.bintray.com/commandertvis/kotlinx-io/") } group = "kscience.kmath" diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt index 92125f835..81324141c 100644 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt @@ -19,8 +19,9 @@ private fun KtPsiFactory.createMatrixClass( @Language("kotlin") val text = """internal class $className( override val nativeHandle: CPointer<$structName>, - features: Set = emptySet() -) : GslMatrix<$kotlinTypeName, $structName>() { + features: Set = emptySet(), + scope: DeferScope +) : GslMatrix<$kotlinTypeName, $structName>(scope) { override val rowNum: Int get() = nativeHandle.pointed.size1.toInt() @@ -30,7 +31,7 @@ private fun KtPsiFactory.createMatrixClass( override val features: Set = features override fun suggestFeature(vararg features: MatrixFeature): $className = - ${className}(nativeHandle, this.features + features) + ${className}(nativeHandle, this.features + features, scope) override operator fun get(i: Int, j: Int): $kotlinTypeName = ${ fn("gsl_matrixRget", cTypeName) @@ -42,7 +43,7 @@ private fun KtPsiFactory.createMatrixClass( override fun copy(): $className { val new = requireNotNull(${fn("gsl_matrixRalloc", cTypeName)}(rowNum.toULong(), colNum.toULong())) ${fn("gsl_matrixRmemcpy", cTypeName)}(new, nativeHandle) - return $className(new, features) + return $className(new, features, scope) } override fun close(): Unit = ${fn("gsl_matrixRfree", cTypeName)}(nativeHandle) diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt index 830e858c4..018d84773 100644 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt @@ -18,7 +18,8 @@ private fun KtPsiFactory.createVectorClass( val structName = sn("gsl_vectorR", cTypeName) @Language("kotlin") val text = - """internal class $className(override val nativeHandle: CPointer<$structName>) : GslVector<$kotlinTypeName, $structName>() { + """internal class $className(override val nativeHandle: CPointer<$structName>, scope: DeferScope) + : GslVector<$kotlinTypeName, $structName>(scope) { override val size: Int get() = nativeHandle.pointed.size.toInt() @@ -30,7 +31,7 @@ private fun KtPsiFactory.createVectorClass( override fun copy(): $className { val new = requireNotNull(${fn("gsl_vectorRalloc", cTypeName)}(size.toULong())) ${fn("gsl_vectorRmemcpy", cTypeName)}(new, nativeHandle) - return ${className}(new) + return ${className}(new, scope) } override fun equals(other: Any?): Boolean { diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index dc8869ad1..e0bf1227d 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -8,6 +8,8 @@ plugins { } kotlin { + explicitApiWarning() + val nativeTarget = when (System.getProperty("os.name")) { "Mac OS X" -> macosX64("native") "Linux" -> linuxX64("native") @@ -20,7 +22,11 @@ kotlin { val main by nativeTarget.compilations.getting { cinterops { - val libgsl by creating { includeDirs { headerFilterOnly("/usr/include/", "/usr/local/") } } + val libgsl by creating { + includeDirs { + headerFilterOnly("/usr/include/", "/usr/local/") + } + } } } @@ -35,7 +41,6 @@ kotlin { dependencies { api(project(":kmath-core")) - api("org.jetbrains.kotlinx:kotlinx-io:0.2.0-tvis-3") } } } diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt index 38d091414..582b1da57 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt @@ -14,8 +14,9 @@ internal fun Complex.toGsl(): CValue = cValue { internal class GslComplexMatrix( override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { + features: Set = emptySet(), + scope: DeferScope +) : GslMatrix(scope) { override val rowNum: Int get() = nativeHandle.pointed.size1.toInt() @@ -25,7 +26,7 @@ internal class GslComplexMatrix( override val features: Set = features override fun suggestFeature(vararg features: MatrixFeature): GslComplexMatrix = - GslComplexMatrix(nativeHandle, this.features + features) + GslComplexMatrix(nativeHandle, this.features + features, scope) override operator fun get(i: Int, j: Int): Complex = gsl_matrix_complex_get(nativeHandle, i.toULong(), j.toULong()).toKMath() @@ -36,7 +37,7 @@ internal class GslComplexMatrix( override fun copy(): GslComplexMatrix { val new = requireNotNull(gsl_matrix_complex_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_complex_memcpy(new, nativeHandle) - return GslComplexMatrix(new, features) + return GslComplexMatrix(new, features, scope) } override fun close(): Unit = gsl_matrix_complex_free(nativeHandle) @@ -47,18 +48,20 @@ internal class GslComplexMatrix( } } -internal class GslComplexVector(override val nativeHandle: CPointer) : - GslVector() { +internal class GslComplexVector(override val nativeHandle: CPointer, scope: DeferScope) : + GslVector(scope) { override val size: Int get() = nativeHandle.pointed.size.toInt() override fun get(index: Int): Complex = gsl_vector_complex_get(nativeHandle, index.toULong()).toKMath() - override fun set(index: Int, value: Complex): Unit = gsl_vector_complex_set(nativeHandle, index.toULong(), value.toGsl()) + + override fun set(index: Int, value: Complex): Unit = + gsl_vector_complex_set(nativeHandle, index.toULong(), value.toGsl()) override fun copy(): GslComplexVector { val new = requireNotNull(gsl_vector_complex_alloc(size.toULong())) gsl_vector_complex_memcpy(new, nativeHandle) - return GslComplexVector(new) + return GslComplexVector(new, scope) } override fun equals(other: Any?): Boolean { diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt index c7323437d..619372eef 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt @@ -1,10 +1,12 @@ package kscience.kmath.gsl import kotlinx.cinterop.CStructVar +import kotlinx.cinterop.DeferScope import kscience.kmath.linear.FeaturedMatrix import kscience.kmath.structures.NDStructure -public abstract class GslMatrix internal constructor(): GslMemoryHolder(), +public abstract class GslMatrix internal constructor(scope: DeferScope) : + GslMemoryHolder(scope), FeaturedMatrix { internal abstract operator fun set(i: Int, j: Int, value: T) internal abstract fun copy(): GslMatrix diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContexts.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContexts.kt index 4428b0185..3ac6582eb 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContexts.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContexts.kt @@ -1,6 +1,7 @@ package kscience.kmath.gsl import kotlinx.cinterop.CStructVar +import kotlinx.cinterop.DeferScope import kotlinx.cinterop.pointed import kscience.kmath.linear.MatrixContext import kscience.kmath.linear.Point @@ -18,8 +19,9 @@ internal inline fun GslMatrix.fill(initializer: internal inline fun GslVector.fill(initializer: (Int) -> T): GslVector = apply { (0 until size).forEach { index -> this[index] = initializer(index) } } -public abstract class GslMatrixContext internal constructor() : - MatrixContext { +public abstract class GslMatrixContext internal constructor( + internal val scope: DeferScope +) : MatrixContext { @Suppress("UNCHECKED_CAST") public fun Matrix.toGsl(): GslMatrix = (if (this is GslMatrix<*, *>) this as GslMatrix @@ -37,19 +39,19 @@ public abstract class GslMatrixContext() { +public class GslRealMatrixContext(scope: DeferScope) : GslMatrixContext(scope) { override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = - GslRealMatrix(requireNotNull(gsl_matrix_alloc(rows.toULong(), columns.toULong()))) + GslRealMatrix(nativeHandle = requireNotNull(gsl_matrix_alloc(rows.toULong(), columns.toULong())), scope = scope) override fun produceDirtyVector(size: Int): GslVector = - GslRealVector(requireNotNull(gsl_vector_alloc(size.toULong()))) + GslRealVector(nativeHandle = requireNotNull(gsl_vector_alloc(size.toULong())), scope = scope) public override fun Matrix.dot(other: Matrix): GslMatrix { val x = toGsl().nativeHandle val a = other.toGsl().nativeHandle val result = requireNotNull(gsl_matrix_calloc(a.pointed.size1, a.pointed.size2)) gsl_blas_dgemm(CblasNoTrans, CblasNoTrans, 1.0, x, a, 1.0, result) - return GslRealMatrix(result) + return GslRealMatrix(result, scope = scope) } public override fun Matrix.dot(vector: Point): GslVector { @@ -57,7 +59,7 @@ public object GslRealMatrixContext : GslMatrixContext.times(value: Double): GslMatrix { @@ -79,19 +81,20 @@ public object GslRealMatrixContext : GslMatrixContext() { +public class GslFloatMatrixContext(scope: DeferScope) : + GslMatrixContext(scope) { override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = - GslFloatMatrix(requireNotNull(gsl_matrix_float_alloc(rows.toULong(), columns.toULong()))) + GslFloatMatrix(requireNotNull(gsl_matrix_float_alloc(rows.toULong(), columns.toULong())), scope = scope) override fun produceDirtyVector(size: Int): GslVector = - GslFloatVector(requireNotNull(gsl_vector_float_alloc(size.toULong()))) + GslFloatVector(requireNotNull(gsl_vector_float_alloc(size.toULong())), scope) public override fun Matrix.dot(other: Matrix): GslMatrix { val x = toGsl().nativeHandle val a = other.toGsl().nativeHandle val result = requireNotNull(gsl_matrix_float_calloc(a.pointed.size1, a.pointed.size2)) gsl_blas_sgemm(CblasNoTrans, CblasNoTrans, 1f, x, a, 1f, result) - return GslFloatMatrix(result) + return GslFloatMatrix(nativeHandle = result, scope = scope) } public override fun Matrix.dot(vector: Point): GslVector { @@ -99,7 +102,7 @@ public object GslFloatMatrixContext : GslMatrixContext.times(value: Float): GslMatrix { @@ -121,19 +124,22 @@ public object GslFloatMatrixContext : GslMatrixContext() { - override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = - GslComplexMatrix(requireNotNull(gsl_matrix_complex_alloc(rows.toULong(), columns.toULong()))) +public class GslComplexMatrixContext(scope: DeferScope) : + GslMatrixContext(scope) { + override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = GslComplexMatrix( + nativeHandle = requireNotNull(gsl_matrix_complex_alloc(rows.toULong(), columns.toULong())), + scope = scope + ) override fun produceDirtyVector(size: Int): GslVector = - GslComplexVector(requireNotNull(gsl_vector_complex_alloc(size.toULong()))) + GslComplexVector(requireNotNull(gsl_vector_complex_alloc(size.toULong())), scope) public override fun Matrix.dot(other: Matrix): GslMatrix { val x = toGsl().nativeHandle val a = other.toGsl().nativeHandle val result = requireNotNull(gsl_matrix_complex_calloc(a.pointed.size1, a.pointed.size2)) gsl_blas_zgemm(CblasNoTrans, CblasNoTrans, ComplexField.one.toGsl(), x, a, ComplexField.one.toGsl(), result) - return GslComplexMatrix(result) + return GslComplexMatrix(nativeHandle = result, scope = scope) } public override fun Matrix.dot(vector: Point): GslVector { @@ -141,7 +147,7 @@ public object GslComplexMatrixContext : GslMatrixContext.times(value: Complex): GslMatrix { diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt index 4c6aa17d7..d3544874d 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt @@ -2,8 +2,14 @@ package kscience.kmath.gsl import kotlinx.cinterop.CPointer import kotlinx.cinterop.CStructVar -import kotlinx.io.Closeable +import kotlinx.cinterop.DeferScope -public abstract class GslMemoryHolder internal constructor() : Closeable { +public abstract class GslMemoryHolder internal constructor(internal val scope: DeferScope) { internal abstract val nativeHandle: CPointer + + init { + scope.defer(::close) + } + + internal abstract fun close() } diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt index 87fbce607..65b81f0d7 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt @@ -1,9 +1,11 @@ package kscience.kmath.gsl import kotlinx.cinterop.CStructVar +import kotlinx.cinterop.DeferScope import kscience.kmath.linear.Point -public abstract class GslVector internal constructor() : GslMemoryHolder(), Point { +public abstract class GslVector internal constructor(scope: DeferScope) : + GslMemoryHolder(scope), Point { internal abstract operator fun set(index: Int, value: T) internal abstract fun copy(): GslVector diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt index 06a9eb75e..a38534515 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt @@ -6,8 +6,9 @@ import org.gnu.gsl.* internal class GslRealMatrix( override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { + features: Set = emptySet(), + scope: DeferScope +) : GslMatrix(scope) { override val rowNum: Int get() = nativeHandle.pointed.size1.toInt() @@ -17,7 +18,7 @@ internal class GslRealMatrix( override val features: Set = features override fun suggestFeature(vararg features: MatrixFeature): GslRealMatrix = - GslRealMatrix(nativeHandle, this.features + features) + GslRealMatrix(nativeHandle, this.features + features, scope) override operator fun get(i: Int, j: Int): Double = gsl_matrix_get(nativeHandle, i.toULong(), j.toULong()) @@ -27,7 +28,7 @@ internal class GslRealMatrix( override fun copy(): GslRealMatrix { val new = requireNotNull(gsl_matrix_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_memcpy(new, nativeHandle) - return GslRealMatrix(new, features) + return GslRealMatrix(new, features, scope) } override fun close(): Unit = gsl_matrix_free(nativeHandle) @@ -40,8 +41,9 @@ internal class GslRealMatrix( internal class GslFloatMatrix( override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { + features: Set = emptySet(), + scope: DeferScope +) : GslMatrix(scope) { override val rowNum: Int get() = nativeHandle.pointed.size1.toInt() @@ -51,7 +53,7 @@ internal class GslFloatMatrix( override val features: Set = features override fun suggestFeature(vararg features: MatrixFeature): GslFloatMatrix = - GslFloatMatrix(nativeHandle, this.features + features) + GslFloatMatrix(nativeHandle, this.features + features, scope) override operator fun get(i: Int, j: Int): Float = gsl_matrix_float_get(nativeHandle, i.toULong(), j.toULong()) @@ -61,7 +63,7 @@ internal class GslFloatMatrix( override fun copy(): GslFloatMatrix { val new = requireNotNull(gsl_matrix_float_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_float_memcpy(new, nativeHandle) - return GslFloatMatrix(new, features) + return GslFloatMatrix(new, features, scope) } override fun close(): Unit = gsl_matrix_float_free(nativeHandle) @@ -74,8 +76,9 @@ internal class GslFloatMatrix( internal class GslShortMatrix( override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { + features: Set = emptySet(), + scope: DeferScope +) : GslMatrix(scope) { override val rowNum: Int get() = nativeHandle.pointed.size1.toInt() @@ -85,7 +88,7 @@ internal class GslShortMatrix( override val features: Set = features override fun suggestFeature(vararg features: MatrixFeature): GslShortMatrix = - GslShortMatrix(nativeHandle, this.features + features) + GslShortMatrix(nativeHandle, this.features + features, scope) override operator fun get(i: Int, j: Int): Short = gsl_matrix_short_get(nativeHandle, i.toULong(), j.toULong()) @@ -95,7 +98,7 @@ internal class GslShortMatrix( override fun copy(): GslShortMatrix { val new = requireNotNull(gsl_matrix_short_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_short_memcpy(new, nativeHandle) - return GslShortMatrix(new, features) + return GslShortMatrix(new, features, scope) } override fun close(): Unit = gsl_matrix_short_free(nativeHandle) @@ -108,8 +111,9 @@ internal class GslShortMatrix( internal class GslUShortMatrix( override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { + features: Set = emptySet(), + scope: DeferScope +) : GslMatrix(scope) { override val rowNum: Int get() = nativeHandle.pointed.size1.toInt() @@ -119,7 +123,7 @@ internal class GslUShortMatrix( override val features: Set = features override fun suggestFeature(vararg features: MatrixFeature): GslUShortMatrix = - GslUShortMatrix(nativeHandle, this.features + features) + GslUShortMatrix(nativeHandle, this.features + features, scope) override operator fun get(i: Int, j: Int): UShort = gsl_matrix_ushort_get(nativeHandle, i.toULong(), j.toULong()) @@ -129,7 +133,7 @@ internal class GslUShortMatrix( override fun copy(): GslUShortMatrix { val new = requireNotNull(gsl_matrix_ushort_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_ushort_memcpy(new, nativeHandle) - return GslUShortMatrix(new, features) + return GslUShortMatrix(new, features, scope) } override fun close(): Unit = gsl_matrix_ushort_free(nativeHandle) @@ -142,8 +146,9 @@ internal class GslUShortMatrix( internal class GslLongMatrix( override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { + features: Set = emptySet(), + scope: DeferScope +) : GslMatrix(scope) { override val rowNum: Int get() = nativeHandle.pointed.size1.toInt() @@ -153,7 +158,7 @@ internal class GslLongMatrix( override val features: Set = features override fun suggestFeature(vararg features: MatrixFeature): GslLongMatrix = - GslLongMatrix(nativeHandle, this.features + features) + GslLongMatrix(nativeHandle, this.features + features, scope) override operator fun get(i: Int, j: Int): Long = gsl_matrix_long_get(nativeHandle, i.toULong(), j.toULong()) @@ -163,7 +168,7 @@ internal class GslLongMatrix( override fun copy(): GslLongMatrix { val new = requireNotNull(gsl_matrix_long_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_long_memcpy(new, nativeHandle) - return GslLongMatrix(new, features) + return GslLongMatrix(new, features, scope) } override fun close(): Unit = gsl_matrix_long_free(nativeHandle) @@ -176,8 +181,9 @@ internal class GslLongMatrix( internal class GslULongMatrix( override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { + features: Set = emptySet(), + scope: DeferScope +) : GslMatrix(scope) { override val rowNum: Int get() = nativeHandle.pointed.size1.toInt() @@ -187,7 +193,7 @@ internal class GslULongMatrix( override val features: Set = features override fun suggestFeature(vararg features: MatrixFeature): GslULongMatrix = - GslULongMatrix(nativeHandle, this.features + features) + GslULongMatrix(nativeHandle, this.features + features, scope) override operator fun get(i: Int, j: Int): ULong = gsl_matrix_ulong_get(nativeHandle, i.toULong(), j.toULong()) @@ -197,7 +203,7 @@ internal class GslULongMatrix( override fun copy(): GslULongMatrix { val new = requireNotNull(gsl_matrix_ulong_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_ulong_memcpy(new, nativeHandle) - return GslULongMatrix(new, features) + return GslULongMatrix(new, features, scope) } override fun close(): Unit = gsl_matrix_ulong_free(nativeHandle) @@ -210,8 +216,9 @@ internal class GslULongMatrix( internal class GslIntMatrix( override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { + features: Set = emptySet(), + scope: DeferScope +) : GslMatrix(scope) { override val rowNum: Int get() = nativeHandle.pointed.size1.toInt() @@ -221,7 +228,7 @@ internal class GslIntMatrix( override val features: Set = features override fun suggestFeature(vararg features: MatrixFeature): GslIntMatrix = - GslIntMatrix(nativeHandle, this.features + features) + GslIntMatrix(nativeHandle, this.features + features, scope) override operator fun get(i: Int, j: Int): Int = gsl_matrix_int_get(nativeHandle, i.toULong(), j.toULong()) @@ -231,7 +238,7 @@ internal class GslIntMatrix( override fun copy(): GslIntMatrix { val new = requireNotNull(gsl_matrix_int_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_int_memcpy(new, nativeHandle) - return GslIntMatrix(new, features) + return GslIntMatrix(new, features, scope) } override fun close(): Unit = gsl_matrix_int_free(nativeHandle) @@ -244,8 +251,9 @@ internal class GslIntMatrix( internal class GslUIntMatrix( override val nativeHandle: CPointer, - features: Set = emptySet() -) : GslMatrix() { + features: Set = emptySet(), + scope: DeferScope +) : GslMatrix(scope) { override val rowNum: Int get() = nativeHandle.pointed.size1.toInt() @@ -255,7 +263,7 @@ internal class GslUIntMatrix( override val features: Set = features override fun suggestFeature(vararg features: MatrixFeature): GslUIntMatrix = - GslUIntMatrix(nativeHandle, this.features + features) + GslUIntMatrix(nativeHandle, this.features + features, scope) override operator fun get(i: Int, j: Int): UInt = gsl_matrix_uint_get(nativeHandle, i.toULong(), j.toULong()) @@ -265,7 +273,7 @@ internal class GslUIntMatrix( override fun copy(): GslUIntMatrix { val new = requireNotNull(gsl_matrix_uint_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_uint_memcpy(new, nativeHandle) - return GslUIntMatrix(new, features) + return GslUIntMatrix(new, features, scope) } override fun close(): Unit = gsl_matrix_uint_free(nativeHandle) diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt index 918fca825..8990416b3 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt @@ -3,7 +3,8 @@ package kscience.kmath.gsl import kotlinx.cinterop.* import org.gnu.gsl.* -internal class GslRealVector(override val nativeHandle: CPointer) : GslVector() { +internal class GslRealVector(override val nativeHandle: CPointer, scope: DeferScope) + : GslVector(scope) { override val size: Int get() = nativeHandle.pointed.size.toInt() @@ -13,7 +14,7 @@ internal class GslRealVector(override val nativeHandle: CPointer) : override fun copy(): GslRealVector { val new = requireNotNull(gsl_vector_alloc(size.toULong())) gsl_vector_memcpy(new, nativeHandle) - return GslRealVector(new) + return GslRealVector(new, scope) } override fun equals(other: Any?): Boolean { @@ -24,7 +25,8 @@ internal class GslRealVector(override val nativeHandle: CPointer) : override fun close(): Unit = gsl_vector_free(nativeHandle) } -internal class GslFloatVector(override val nativeHandle: CPointer) : GslVector() { +internal class GslFloatVector(override val nativeHandle: CPointer, scope: DeferScope) + : GslVector(scope) { override val size: Int get() = nativeHandle.pointed.size.toInt() @@ -34,7 +36,7 @@ internal class GslFloatVector(override val nativeHandle: CPointer) : GslVector() { +internal class GslShortVector(override val nativeHandle: CPointer, scope: DeferScope) + : GslVector(scope) { override val size: Int get() = nativeHandle.pointed.size.toInt() @@ -55,7 +58,7 @@ internal class GslShortVector(override val nativeHandle: CPointer) : GslVector() { +internal class GslUShortVector(override val nativeHandle: CPointer, scope: DeferScope) + : GslVector(scope) { override val size: Int get() = nativeHandle.pointed.size.toInt() @@ -76,7 +80,7 @@ internal class GslUShortVector(override val nativeHandle: CPointer) : GslVector() { +internal class GslLongVector(override val nativeHandle: CPointer, scope: DeferScope) + : GslVector(scope) { override val size: Int get() = nativeHandle.pointed.size.toInt() @@ -97,7 +102,7 @@ internal class GslLongVector(override val nativeHandle: CPointer) : GslVector() { +internal class GslULongVector(override val nativeHandle: CPointer, scope: DeferScope) + : GslVector(scope) { override val size: Int get() = nativeHandle.pointed.size.toInt() @@ -118,7 +124,7 @@ internal class GslULongVector(override val nativeHandle: CPointer) : GslVector() { +internal class GslIntVector(override val nativeHandle: CPointer, scope: DeferScope) + : GslVector(scope) { override val size: Int get() = nativeHandle.pointed.size.toInt() @@ -139,7 +146,7 @@ internal class GslIntVector(override val nativeHandle: CPointer) override fun copy(): GslIntVector { val new = requireNotNull(gsl_vector_int_alloc(size.toULong())) gsl_vector_int_memcpy(new, nativeHandle) - return GslIntVector(new) + return GslIntVector(new, scope) } override fun equals(other: Any?): Boolean { @@ -150,7 +157,8 @@ internal class GslIntVector(override val nativeHandle: CPointer) override fun close(): Unit = gsl_vector_int_free(nativeHandle) } -internal class GslUIntVector(override val nativeHandle: CPointer) : GslVector() { +internal class GslUIntVector(override val nativeHandle: CPointer, scope: DeferScope) + : GslVector(scope) { override val size: Int get() = nativeHandle.pointed.size.toInt() @@ -160,7 +168,7 @@ internal class GslUIntVector(override val nativeHandle: CPointer 0.1 } - val mb = (ma * 20.0) - assertEquals(mb[0, 1], 2.0) - mb.close() - ma.close() + fun testScale() = memScoped { + (GslRealMatrixContext(this)) { + val ma = produce(10, 10) { _, _ -> 0.1 } + val mb = (ma * 20.0) + assertEquals(mb[0, 1], 2.0) + } } @Test - fun testDotOfMatrixAndVector() { - val ma = GslRealMatrixContext.produce(2, 2) { _, _ -> 100.0 } - val vb = RealBuffer(2) { 0.1 } - val res1 = GslRealMatrixContext { ma dot vb } - val res2 = RealMatrixContext { ma dot vb } - println(res1.asSequence().toList()) - println(res2.asSequence().toList()) - assertTrue(res1.contentEquals(res2)) - res1.close() + fun testDotOfMatrixAndVector() = memScoped { + (GslRealMatrixContext(this)) { + val ma = produce(2, 2) { _, _ -> 100.0 } + val vb = RealBuffer(2) { 0.1 } + val res1 = ma dot vb + val res2 = RealMatrixContext { ma dot vb } + println(res1.asSequence().toList()) + println(res2.asSequence().toList()) + assertTrue(res1.contentEquals(res2)) + } } @Test - fun testDotOfMatrixAndMatrix() { - val ma = GslRealMatrixContext.produce(2, 2) { _, _ -> 100.0 } - val mb = GslRealMatrixContext.produce(2, 2) { _, _ -> 100.0 } - val res1 = GslRealMatrixContext { ma dot mb } - val res2 = RealMatrixContext { ma dot mb } - println(res1.rows.asIterable().map { it.asSequence() }.flatMap(Sequence<*>::toList)) - println(res2.rows.asIterable().map { it.asSequence() }.flatMap(Sequence<*>::toList)) - assertEquals(res1, res2) - ma.close() - mb.close() + fun testDotOfMatrixAndMatrix() = memScoped { + (GslRealMatrixContext(this)) { + val ma = produce(2, 2) { _, _ -> 100.0 } + val mb = produce(2, 2) { _, _ -> 100.0 } + val res1 = ma dot mb + val res2 = RealMatrixContext { ma dot mb } + println(res1.rows.asIterable().map { it.asSequence() }.flatMap(Sequence<*>::toList)) + println(res2.rows.asIterable().map { it.asSequence() }.flatMap(Sequence<*>::toList)) + assertEquals(res1, res2) + } } } From 6ab2ebb13f000466678f8ac79d4039c97fc91394 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 11 Oct 2020 22:48:05 +0700 Subject: [PATCH 30/76] Add sudo statement --- .github/workflows/gradle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 4557369bf..80a7100db 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -62,7 +62,7 @@ jobs: key: ${{ runner.os }}-konan-1.4.20-eap-37 restore-keys: ${{ runner.os }}-konan-1.4.20-eap-37 - name: Build with Gradle - run: ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslNative build + run: sudo ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslNative build build-windows: runs-on: windows-latest From 6f3deb6a2454c974ea208f6193252a7d924834ca Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Mon, 12 Oct 2020 18:38:26 +0700 Subject: [PATCH 31/76] Change cached directories, suppress warnings --- .github/workflows/gradle.yml | 14 +++++++------- kmath-prob/build.gradle.kts | 7 +++++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 80a7100db..442be6afe 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -18,8 +18,8 @@ jobs: uses: actions/cache@v2 with: path: | - ~/.gradle/caches - ~/.gradle/wrapper + **/.gradle + **/build key: gradle_6_6_1 restore-keys: gradle_6_6_1 @@ -32,7 +32,7 @@ jobs: key: ${{ runner.os }}-konan-1.4.20-eap-37 restore-keys: ${{ runner.os }}-konan-1.4.20-eap-37 - name: Build with Gradle - run: ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslNative build + run: sudo ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslNative build build-osx: runs-on: macos-latest @@ -48,8 +48,8 @@ jobs: uses: actions/cache@v2 with: path: | - ~/.gradle/caches - ~/.gradle/wrapper + **/.gradle + **/build key: gradle_6_6_1 restore-keys: gradle_6_6_1 @@ -79,8 +79,8 @@ jobs: uses: actions/cache@v2 with: path: | - ~/.gradle/caches - ~/.gradle/wrapper + **/.gradle + **/build key: gradle_6_6_1 restore-keys: gradle_6_6_1 diff --git a/kmath-prob/build.gradle.kts b/kmath-prob/build.gradle.kts index 4c9663e5f..b961cba05 100644 --- a/kmath-prob/build.gradle.kts +++ b/kmath-prob/build.gradle.kts @@ -1,6 +1,13 @@ plugins { id("ru.mipt.npm.mpp") } kotlin.sourceSets { + all { + with(languageSettings) { + useExperimentalAnnotation("kotlinx.coroutines.FlowPreview") + useExperimentalAnnotation("kotlinx.coroutines.ExperimentalCoroutinesApi") + } + } + commonMain { dependencies { api(project(":kmath-coroutines")) From 5460d00f8f542cf46c36824e9b0172557e224620 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Wed, 14 Oct 2020 23:27:59 +0700 Subject: [PATCH 32/76] Change Ubuntu version --- .github/workflows/gradle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 442be6afe..3904119b6 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -4,7 +4,7 @@ on: [ push ] jobs: build-ubuntu: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 From 3602bce1337c446993455fc2832a1a465c61650f Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Wed, 14 Oct 2020 23:43:16 +0700 Subject: [PATCH 33/76] Add Chrome installing action --- .github/workflows/gradle.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 3904119b6..b8de66b6f 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -13,7 +13,13 @@ jobs: with: java-version: 11 - name: Install libgsl-dev - run: sudo apt install libgsl-dev + run: sudo apt install -y libgsl-dev + - name: Install Chrome + run: | + sudo apt install -y libappindicator1 fonts-liberation + cd /temp + wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb + sudo dpkg -i google-chrome*.deb - name: Cache gradle uses: actions/cache@v2 with: From 0740d6034be95777b3e9dfb7b3f223842a999ea2 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Wed, 14 Oct 2020 23:45:30 +0700 Subject: [PATCH 34/76] Remove broken command --- .github/workflows/gradle.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index b8de66b6f..0803d0244 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -17,7 +17,6 @@ jobs: - name: Install Chrome run: | sudo apt install -y libappindicator1 fonts-liberation - cd /temp wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo dpkg -i google-chrome*.deb - name: Cache gradle From 07ad527e0b2dcdec5e4f32ae9a48356f779ce9ee Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Wed, 14 Oct 2020 23:57:35 +0700 Subject: [PATCH 35/76] Remove sudo --- .github/workflows/gradle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 0803d0244..1682e0d45 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -37,7 +37,7 @@ jobs: key: ${{ runner.os }}-konan-1.4.20-eap-37 restore-keys: ${{ runner.os }}-konan-1.4.20-eap-37 - name: Build with Gradle - run: sudo ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslNative build + run: ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslNative build build-osx: runs-on: macos-latest From de964af80d24abbee63250b21407772137ef3fa6 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 15 Oct 2020 13:15:11 +0700 Subject: [PATCH 36/76] Fix header selection issues, update Gradle --- .github/workflows/gradle.yml | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- kmath-gsl/build.gradle.kts | 21 ++++++++++++------- .../src/nativeInterop/cinterop/libgsl.def | 9 ++++---- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 1682e0d45..8697c3a72 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -37,7 +37,7 @@ jobs: key: ${{ runner.os }}-konan-1.4.20-eap-37 restore-keys: ${{ runner.os }}-konan-1.4.20-eap-37 - name: Build with Gradle - run: ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslNative build + run: ./gradlew -Dorg.gradle.daemon=false --build-cache build build-osx: runs-on: macos-latest @@ -67,7 +67,7 @@ jobs: key: ${{ runner.os }}-konan-1.4.20-eap-37 restore-keys: ${{ runner.os }}-konan-1.4.20-eap-37 - name: Build with Gradle - run: sudo ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslNative build + run: sudo ./gradlew -Dorg.gradle.daemon=false --build-cache build build-windows: runs-on: windows-latest diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 12d38de6a..be52383ef 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index e0bf1227d..df1e635be 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -11,8 +11,8 @@ kotlin { explicitApiWarning() val nativeTarget = when (System.getProperty("os.name")) { - "Mac OS X" -> macosX64("native") - "Linux" -> linuxX64("native") + "Mac OS X" -> macosX64() + "Linux" -> linuxX64() else -> { logger.warn("Current OS cannot build any of kmath-gsl targets.") @@ -22,16 +22,14 @@ kotlin { val main by nativeTarget.compilations.getting { cinterops { - val libgsl by creating { - includeDirs { - headerFilterOnly("/usr/include/", "/usr/local/") - } - } + val libgsl by creating } } + val test by nativeTarget.compilations.getting + sourceSets { - val nativeMain by getting { + val nativeMain by creating { val codegen by tasks.creating { matricesCodegen(kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Matrices.kt") vectorsCodegen(kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Vectors.kt") @@ -43,5 +41,12 @@ kotlin { api(project(":kmath-core")) } } + + val nativeTest by creating { + dependsOn(nativeMain) + } + + main.defaultSourceSet.dependsOn(nativeMain) + test.defaultSourceSet.dependsOn(nativeTest) } } diff --git a/kmath-gsl/src/nativeInterop/cinterop/libgsl.def b/kmath-gsl/src/nativeInterop/cinterop/libgsl.def index e626f6690..cf31cd4f4 100644 --- a/kmath-gsl/src/nativeInterop/cinterop/libgsl.def +++ b/kmath-gsl/src/nativeInterop/cinterop/libgsl.def @@ -1,7 +1,6 @@ package=org.gnu.gsl -headers=gsl/gsl_blas.h headerFilter=gsl/** -compilerOpts=-I/usr/include/gsl -linkerOpts=-lgsl -linkerOpts.linux=-L/usr/lib64 -L/usr/lib/x86_64-linux-gnu -linkerOpts.osx=-L/opt/local/lib -L/usr/local/lib +compilerOpts.linux=-I/usr/include/ +compilerOpts.osx=-I/usr/local/ +linkerOpts.linux=-L/usr/lib64 -L/usr/lib/x86_64-linux-gnu -lgsl +linkerOpts.osx=-L/opt/local/lib -L/usr/local/lib -lgsl From 248deb1682d2c06497fc39cdb9e912b7d6035f94 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 15 Oct 2020 13:44:49 +0700 Subject: [PATCH 37/76] Update def file --- kmath-gsl/src/nativeInterop/cinterop/libgsl.def | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kmath-gsl/src/nativeInterop/cinterop/libgsl.def b/kmath-gsl/src/nativeInterop/cinterop/libgsl.def index cf31cd4f4..a398523f1 100644 --- a/kmath-gsl/src/nativeInterop/cinterop/libgsl.def +++ b/kmath-gsl/src/nativeInterop/cinterop/libgsl.def @@ -1,6 +1,6 @@ package=org.gnu.gsl -headerFilter=gsl/** -compilerOpts.linux=-I/usr/include/ -compilerOpts.osx=-I/usr/local/ +headers=gsl/gsl_blas.h +compilerOpts.linux=-I/usr/include +compilerOpts.osx=-I/usr/local linkerOpts.linux=-L/usr/lib64 -L/usr/lib/x86_64-linux-gnu -lgsl linkerOpts.osx=-L/opt/local/lib -L/usr/local/lib -lgsl From 2dab0ce40c1caedf4acc52b392263e96dd5ea7e6 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 15 Oct 2020 14:06:01 +0700 Subject: [PATCH 38/76] Add missing package installation --- .github/workflows/gradle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 8697c3a72..3b912156a 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -13,7 +13,7 @@ jobs: with: java-version: 11 - name: Install libgsl-dev - run: sudo apt install -y libgsl-dev + run: sudo apt install -y libgsl-dev gcc-multilib - name: Install Chrome run: | sudo apt install -y libappindicator1 fonts-liberation From 657dbcb8295b3e520a8a96818c3dedb5eef1a3c6 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 15 Oct 2020 15:24:17 +0700 Subject: [PATCH 39/76] Add missing compiler option --- kmath-gsl/src/nativeInterop/cinterop/libgsl.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kmath-gsl/src/nativeInterop/cinterop/libgsl.def b/kmath-gsl/src/nativeInterop/cinterop/libgsl.def index a398523f1..23ceebf02 100644 --- a/kmath-gsl/src/nativeInterop/cinterop/libgsl.def +++ b/kmath-gsl/src/nativeInterop/cinterop/libgsl.def @@ -1,6 +1,6 @@ package=org.gnu.gsl headers=gsl/gsl_blas.h compilerOpts.linux=-I/usr/include -compilerOpts.osx=-I/usr/local +compilerOpts.osx=-I/usr/local -I/usr/local/include linkerOpts.linux=-L/usr/lib64 -L/usr/lib/x86_64-linux-gnu -lgsl linkerOpts.osx=-L/opt/local/lib -L/usr/local/lib -lgsl From f341d029415515915750c85e5530bc5362f6f431 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 29 Oct 2020 04:23:36 +0700 Subject: [PATCH 40/76] Rename files, improve error handling, minor codegen update --- .../kmath/gsl/codegen/vectorsCodegen.kt | 4 +- kmath-gsl/build.gradle.kts | 10 +- .../kotlin/kscience/kmath/gsl/GslException.kt | 70 ++++++++ .../kscience/kmath/gsl/GslMatrixContext.kt | 168 +++++++++++++++++ .../kscience/kmath/gsl/GslMatrixContexts.kt | 170 ------------------ .../kscience/kmath/gsl/GslMemoryHolder.kt | 1 + .../kotlin/kscience/kmath/gsl/_Vectors.kt | 36 ++-- .../src/nativeTest/kotlin/ErrorHandler.kt | 23 +++ 8 files changed, 288 insertions(+), 194 deletions(-) create mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslException.kt delete mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContexts.kt create mode 100644 kmath-gsl/src/nativeTest/kotlin/ErrorHandler.kt diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt index 018d84773..e227dc721 100644 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt @@ -18,8 +18,8 @@ private fun KtPsiFactory.createVectorClass( val structName = sn("gsl_vectorR", cTypeName) @Language("kotlin") val text = - """internal class $className(override val nativeHandle: CPointer<$structName>, scope: DeferScope) - : GslVector<$kotlinTypeName, $structName>(scope) { + """internal class $className(override val nativeHandle: CPointer<$structName>, scope: DeferScope) : + GslVector<$kotlinTypeName, $structName>(scope) { override val size: Int get() = nativeHandle.pointed.size.toInt() diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index df1e635be..d7d53e797 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -12,7 +12,7 @@ kotlin { val nativeTarget = when (System.getProperty("os.name")) { "Mac OS X" -> macosX64() - "Linux" -> linuxX64() + "Linux" -> linuxX64("native") else -> { logger.warn("Current OS cannot build any of kmath-gsl targets.") @@ -29,7 +29,7 @@ kotlin { val test by nativeTarget.compilations.getting sourceSets { - val nativeMain by creating { + val nativeMain by getting { val codegen by tasks.creating { matricesCodegen(kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Matrices.kt") vectorsCodegen(kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Vectors.kt") @@ -42,11 +42,11 @@ kotlin { } } - val nativeTest by creating { + val nativeTest by getting { dependsOn(nativeMain) } - main.defaultSourceSet.dependsOn(nativeMain) - test.defaultSourceSet.dependsOn(nativeTest) +// main.defaultSourceSet.dependsOn(nativeMain) +// test.defaultSourceSet.dependsOn(nativeTest) } } diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslException.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslException.kt new file mode 100644 index 000000000..65e466015 --- /dev/null +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslException.kt @@ -0,0 +1,70 @@ +package kscience.kmath.gsl + +import kotlinx.cinterop.staticCFunction +import kotlinx.cinterop.toKString +import org.gnu.gsl.gsl_set_error_handler +import org.gnu.gsl.gsl_set_error_handler_off +import kotlin.native.concurrent.AtomicInt + +private object Container { + val isKmathHandlerRegistered = AtomicInt(0) +} + +internal enum class GslErrnoValue(val code: Int, val text: String) { + GSL_SUCCESS(org.gnu.gsl.GSL_SUCCESS, ""), + GSL_FAILURE(org.gnu.gsl.GSL_FAILURE, ""), + GSL_CONTINUE(org.gnu.gsl.GSL_CONTINUE, "iteration has not converged"), + GSL_EDOM(org.gnu.gsl.GSL_EDOM, "input domain error, e.g sqrt(-1)"), + GSL_ERANGE(org.gnu.gsl.GSL_ERANGE, "output range error, e.g. exp(1e100)"), + GSL_EFAULT(org.gnu.gsl.GSL_EFAULT, "invalid pointer"), + GSL_EINVAL(org.gnu.gsl.GSL_EINVAL, "invalid argument supplied by user"), + GSL_EFAILED(org.gnu.gsl.GSL_EFAILED, "generic failure"), + GSL_EFACTOR(org.gnu.gsl.GSL_EFACTOR, "factorization failed"), + GSL_ESANITY(org.gnu.gsl.GSL_ESANITY, "sanity check failed - shouldn't happen"), + GSL_ENOMEM(org.gnu.gsl.GSL_ENOMEM, "malloc failed"), + GSL_EBADFUNC(org.gnu.gsl.GSL_EBADFUNC, "problem with user-supplied function"), + GSL_ERUNAWAY(org.gnu.gsl.GSL_ERUNAWAY, "iterative process is out of control"), + GSL_EMAXITER(org.gnu.gsl.GSL_EMAXITER, "exceeded max number of iterations"), + GSL_EZERODIV(org.gnu.gsl.GSL_EZERODIV, "tried to divide by zero"), + GSL_EBADTOL(org.gnu.gsl.GSL_EBADTOL, "user specified an invalid tolerance"), + GSL_ETOL(org.gnu.gsl.GSL_ETOL, "failed to reach the specified tolerance"), + GSL_EUNDRFLW(org.gnu.gsl.GSL_EUNDRFLW, "underflow"), + GSL_EOVRFLW(org.gnu.gsl.GSL_EOVRFLW, "overflow "), + GSL_ELOSS(org.gnu.gsl.GSL_ELOSS, "loss of accuracy"), + GSL_EROUND(org.gnu.gsl.GSL_EROUND, "failed because of roundoff error"), + GSL_EBADLEN(org.gnu.gsl.GSL_EBADLEN, "matrix, vector lengths are not conformant"), + GSL_ENOTSQR(org.gnu.gsl.GSL_ENOTSQR, "matrix not square"), + GSL_ESING(org.gnu.gsl.GSL_ESING, "apparent singularity detected"), + GSL_EDIVERGE(org.gnu.gsl.GSL_EDIVERGE, "integral or series is divergent"), + GSL_EUNSUP(org.gnu.gsl.GSL_EUNSUP, "requested feature is not supported by the hardware"), + GSL_EUNIMPL(org.gnu.gsl.GSL_EUNIMPL, "requested feature not (yet) implemented"), + GSL_ECACHE(org.gnu.gsl.GSL_ECACHE, "cache limit exceeded"), + GSL_ETABLE(org.gnu.gsl.GSL_ETABLE, "table limit exceeded"), + GSL_ENOPROG(org.gnu.gsl.GSL_ENOPROG, "iteration is not making progress towards solution"), + GSL_ENOPROGJ(org.gnu.gsl.GSL_ENOPROGJ, "jacobian evaluations are not improving the solution"), + GSL_ETOLF(org.gnu.gsl.GSL_ETOLF, "cannot reach the specified tolerance in F"), + GSL_ETOLX(org.gnu.gsl.GSL_ETOLX, "cannot reach the specified tolerance in X"), + GSL_ETOLG(org.gnu.gsl.GSL_ETOLG, "cannot reach the specified tolerance in gradient"), + GSL_EOF(org.gnu.gsl.GSL_EOF, "end of file"); + + override fun toString(): String = "${name}('$text')" + + companion object { + fun valueOf(code: Int): GslErrnoValue? = values().find { it.code == code } + } +} + +internal class GslException internal constructor(file: String, line: Int, reason: String, errno: Int) : + RuntimeException("$file:$line: $reason. errno - $errno, ${GslErrnoValue.valueOf(errno)}") { +} + +internal fun ensureHasGslErrorHandler() { + if (Container.isKmathHandlerRegistered.value == 1) return + gsl_set_error_handler_off() + + gsl_set_error_handler(staticCFunction { reason, file, line, errno -> + throw GslException(checkNotNull(file).toKString(), line, checkNotNull(reason).toKString(), errno) + }) + + Container.isKmathHandlerRegistered.value = 1 +} diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt index 8b0f12883..762cf1252 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt @@ -1,7 +1,175 @@ package kscience.kmath.gsl import kotlinx.cinterop.CStructVar +import kotlinx.cinterop.DeferScope +import kotlinx.cinterop.pointed import kscience.kmath.linear.MatrixContext import kscience.kmath.linear.Point +import kscience.kmath.operations.Complex +import kscience.kmath.operations.ComplexField +import kscience.kmath.operations.toComplex import kscience.kmath.structures.Matrix +import org.gnu.gsl.* +internal inline fun GslMatrix.fill(initializer: (Int, Int) -> T): GslMatrix = + apply { + (0 until rowNum).forEach { row -> (0 until colNum).forEach { col -> this[row, col] = initializer(row, col) } } + } + +internal inline fun GslVector.fill(initializer: (Int) -> T): GslVector = + apply { (0 until size).forEach { index -> this[index] = initializer(index) } } + +public abstract class GslMatrixContext< + T : Any, + H1 : CStructVar, + H2 : CStructVar> internal constructor(internal val scope: DeferScope) : MatrixContext { + init { + ensureHasGslErrorHandler() + } + + @Suppress("UNCHECKED_CAST") + public fun Matrix.toGsl(): GslMatrix = (if (this is GslMatrix<*, *>) + this as GslMatrix + else + produce(rowNum, colNum) { i, j -> this[i, j] }).copy() + + @Suppress("UNCHECKED_CAST") + public fun Point.toGsl(): GslVector = + (if (this is GslVector<*, *>) this as GslVector else produceDirtyVector(size).fill { this[it] }).copy() + + internal abstract fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix + internal abstract fun produceDirtyVector(size: Int): GslVector + + public override fun produce(rows: Int, columns: Int, initializer: (i: Int, j: Int) -> T): GslMatrix = + produceDirtyMatrix(rows, columns).fill(initializer) +} + +public class GslRealMatrixContext(scope: DeferScope) : GslMatrixContext(scope) { + override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = + GslRealMatrix(nativeHandle = requireNotNull(gsl_matrix_alloc(rows.toULong(), columns.toULong())), scope = scope) + + override fun produceDirtyVector(size: Int): GslVector = + GslRealVector(nativeHandle = requireNotNull(gsl_vector_alloc(size.toULong())), scope = scope) + + public override fun Matrix.dot(other: Matrix): GslMatrix { + val x = toGsl().nativeHandle + val a = other.toGsl().nativeHandle + val result = requireNotNull(gsl_matrix_calloc(a.pointed.size1, a.pointed.size2)) + gsl_blas_dgemm(CblasNoTrans, CblasNoTrans, 1.0, x, a, 1.0, result) + return GslRealMatrix(result, scope = scope) + } + + public override fun Matrix.dot(vector: Point): GslVector { + val x = toGsl().nativeHandle + val a = vector.toGsl().nativeHandle + val result = requireNotNull(gsl_vector_calloc(a.pointed.size)) + gsl_blas_dgemv(CblasNoTrans, 1.0, x, a, 1.0, result) + return GslRealVector(result, scope = scope) + } + + public override fun Matrix.times(value: Double): GslMatrix { + val g1 = toGsl() + gsl_matrix_scale(g1.nativeHandle, value) + return g1 + } + + public override fun add(a: Matrix, b: Matrix): GslMatrix { + val g1 = a.toGsl() + gsl_matrix_add(g1.nativeHandle, b.toGsl().nativeHandle) + return g1 + } + + public override fun multiply(a: Matrix, k: Number): GslMatrix { + val g1 = a.toGsl() + gsl_matrix_scale(g1.nativeHandle, k.toDouble()) + return g1 + } +} + +public class GslFloatMatrixContext(scope: DeferScope) : + GslMatrixContext(scope) { + override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = + GslFloatMatrix(requireNotNull(gsl_matrix_float_alloc(rows.toULong(), columns.toULong())), scope = scope) + + override fun produceDirtyVector(size: Int): GslVector = + GslFloatVector(requireNotNull(gsl_vector_float_alloc(size.toULong())), scope) + + public override fun Matrix.dot(other: Matrix): GslMatrix { + val x = toGsl().nativeHandle + val a = other.toGsl().nativeHandle + val result = requireNotNull(gsl_matrix_float_calloc(a.pointed.size1, a.pointed.size2)) + gsl_blas_sgemm(CblasNoTrans, CblasNoTrans, 1f, x, a, 1f, result) + return GslFloatMatrix(nativeHandle = result, scope = scope) + } + + public override fun Matrix.dot(vector: Point): GslVector { + val x = toGsl().nativeHandle + val a = vector.toGsl().nativeHandle + val result = requireNotNull(gsl_vector_float_calloc(a.pointed.size)) + gsl_blas_sgemv(CblasNoTrans, 1f, x, a, 1f, result) + return GslFloatVector(nativeHandle = result, scope = scope) + } + + public override fun Matrix.times(value: Float): GslMatrix { + val g1 = toGsl() + gsl_matrix_float_scale(g1.nativeHandle, value.toDouble()) + return g1 + } + + public override fun add(a: Matrix, b: Matrix): GslMatrix { + val g1 = a.toGsl() + gsl_matrix_float_add(g1.nativeHandle, b.toGsl().nativeHandle) + return g1 + } + + public override fun multiply(a: Matrix, k: Number): GslMatrix { + val g1 = a.toGsl() + gsl_matrix_float_scale(g1.nativeHandle, k.toDouble()) + return g1 + } +} + +public class GslComplexMatrixContext(scope: DeferScope) : + GslMatrixContext(scope) { + override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = GslComplexMatrix( + nativeHandle = requireNotNull(gsl_matrix_complex_alloc(rows.toULong(), columns.toULong())), + scope = scope + ) + + override fun produceDirtyVector(size: Int): GslVector = + GslComplexVector(requireNotNull(gsl_vector_complex_alloc(size.toULong())), scope) + + public override fun Matrix.dot(other: Matrix): GslMatrix { + val x = toGsl().nativeHandle + val a = other.toGsl().nativeHandle + val result = requireNotNull(gsl_matrix_complex_calloc(a.pointed.size1, a.pointed.size2)) + gsl_blas_zgemm(CblasNoTrans, CblasNoTrans, ComplexField.one.toGsl(), x, a, ComplexField.one.toGsl(), result) + return GslComplexMatrix(nativeHandle = result, scope = scope) + } + + public override fun Matrix.dot(vector: Point): GslVector { + val x = toGsl().nativeHandle + val a = vector.toGsl().nativeHandle + val result = requireNotNull(gsl_vector_complex_calloc(a.pointed.size)) + gsl_blas_zgemv(CblasNoTrans, ComplexField.one.toGsl(), x, a, ComplexField.one.toGsl(), result) + return GslComplexVector(result, scope) + } + + public override fun Matrix.times(value: Complex): GslMatrix { + val g1 = toGsl() + gsl_matrix_complex_scale(g1.nativeHandle, value.toGsl()) + return g1 + } + + public override fun add(a: Matrix, b: Matrix): GslMatrix { + val g1 = a.toGsl() + gsl_matrix_complex_add(g1.nativeHandle, b.toGsl().nativeHandle) + return g1 + } + + public override fun multiply(a: Matrix, k: Number): GslMatrix { + val g1 = a.toGsl() + gsl_matrix_complex_scale(g1.nativeHandle, k.toComplex().toGsl()) + return g1 + } +} diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContexts.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContexts.kt deleted file mode 100644 index 3ac6582eb..000000000 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContexts.kt +++ /dev/null @@ -1,170 +0,0 @@ -package kscience.kmath.gsl - -import kotlinx.cinterop.CStructVar -import kotlinx.cinterop.DeferScope -import kotlinx.cinterop.pointed -import kscience.kmath.linear.MatrixContext -import kscience.kmath.linear.Point -import kscience.kmath.operations.Complex -import kscience.kmath.operations.ComplexField -import kscience.kmath.operations.toComplex -import kscience.kmath.structures.Matrix -import org.gnu.gsl.* - -internal inline fun GslMatrix.fill(initializer: (Int, Int) -> T): GslMatrix = - apply { - (0 until rowNum).forEach { row -> (0 until colNum).forEach { col -> this[row, col] = initializer(row, col) } } - } - -internal inline fun GslVector.fill(initializer: (Int) -> T): GslVector = - apply { (0 until size).forEach { index -> this[index] = initializer(index) } } - -public abstract class GslMatrixContext internal constructor( - internal val scope: DeferScope -) : MatrixContext { - @Suppress("UNCHECKED_CAST") - public fun Matrix.toGsl(): GslMatrix = (if (this is GslMatrix<*, *>) - this as GslMatrix - else - produce(rowNum, colNum) { i, j -> this[i, j] }).copy() - - @Suppress("UNCHECKED_CAST") - public fun Point.toGsl(): GslVector = - (if (this is GslVector<*, *>) this as GslVector else produceDirtyVector(size).fill { this[it] }).copy() - - internal abstract fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix - internal abstract fun produceDirtyVector(size: Int): GslVector - - public override fun produce(rows: Int, columns: Int, initializer: (i: Int, j: Int) -> T): GslMatrix = - produceDirtyMatrix(rows, columns).fill(initializer) -} - -public class GslRealMatrixContext(scope: DeferScope) : GslMatrixContext(scope) { - override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = - GslRealMatrix(nativeHandle = requireNotNull(gsl_matrix_alloc(rows.toULong(), columns.toULong())), scope = scope) - - override fun produceDirtyVector(size: Int): GslVector = - GslRealVector(nativeHandle = requireNotNull(gsl_vector_alloc(size.toULong())), scope = scope) - - public override fun Matrix.dot(other: Matrix): GslMatrix { - val x = toGsl().nativeHandle - val a = other.toGsl().nativeHandle - val result = requireNotNull(gsl_matrix_calloc(a.pointed.size1, a.pointed.size2)) - gsl_blas_dgemm(CblasNoTrans, CblasNoTrans, 1.0, x, a, 1.0, result) - return GslRealMatrix(result, scope = scope) - } - - public override fun Matrix.dot(vector: Point): GslVector { - val x = toGsl().nativeHandle - val a = vector.toGsl().nativeHandle - val result = requireNotNull(gsl_vector_calloc(a.pointed.size)) - gsl_blas_dgemv(CblasNoTrans, 1.0, x, a, 1.0, result) - return GslRealVector(result, scope = scope) - } - - public override fun Matrix.times(value: Double): GslMatrix { - val g1 = toGsl() - gsl_matrix_scale(g1.nativeHandle, value) - return g1 - } - - public override fun add(a: Matrix, b: Matrix): GslMatrix { - val g1 = a.toGsl() - gsl_matrix_add(g1.nativeHandle, b.toGsl().nativeHandle) - return g1 - } - - public override fun multiply(a: Matrix, k: Number): GslMatrix { - val g1 = a.toGsl() - gsl_matrix_scale(g1.nativeHandle, k.toDouble()) - return g1 - } -} - -public class GslFloatMatrixContext(scope: DeferScope) : - GslMatrixContext(scope) { - override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = - GslFloatMatrix(requireNotNull(gsl_matrix_float_alloc(rows.toULong(), columns.toULong())), scope = scope) - - override fun produceDirtyVector(size: Int): GslVector = - GslFloatVector(requireNotNull(gsl_vector_float_alloc(size.toULong())), scope) - - public override fun Matrix.dot(other: Matrix): GslMatrix { - val x = toGsl().nativeHandle - val a = other.toGsl().nativeHandle - val result = requireNotNull(gsl_matrix_float_calloc(a.pointed.size1, a.pointed.size2)) - gsl_blas_sgemm(CblasNoTrans, CblasNoTrans, 1f, x, a, 1f, result) - return GslFloatMatrix(nativeHandle = result, scope = scope) - } - - public override fun Matrix.dot(vector: Point): GslVector { - val x = toGsl().nativeHandle - val a = vector.toGsl().nativeHandle - val result = requireNotNull(gsl_vector_float_calloc(a.pointed.size)) - gsl_blas_sgemv(CblasNoTrans, 1f, x, a, 1f, result) - return GslFloatVector(nativeHandle = result, scope = scope) - } - - public override fun Matrix.times(value: Float): GslMatrix { - val g1 = toGsl() - gsl_matrix_float_scale(g1.nativeHandle, value.toDouble()) - return g1 - } - - public override fun add(a: Matrix, b: Matrix): GslMatrix { - val g1 = a.toGsl() - gsl_matrix_float_add(g1.nativeHandle, b.toGsl().nativeHandle) - return g1 - } - - public override fun multiply(a: Matrix, k: Number): GslMatrix { - val g1 = a.toGsl() - gsl_matrix_float_scale(g1.nativeHandle, k.toDouble()) - return g1 - } -} - -public class GslComplexMatrixContext(scope: DeferScope) : - GslMatrixContext(scope) { - override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = GslComplexMatrix( - nativeHandle = requireNotNull(gsl_matrix_complex_alloc(rows.toULong(), columns.toULong())), - scope = scope - ) - - override fun produceDirtyVector(size: Int): GslVector = - GslComplexVector(requireNotNull(gsl_vector_complex_alloc(size.toULong())), scope) - - public override fun Matrix.dot(other: Matrix): GslMatrix { - val x = toGsl().nativeHandle - val a = other.toGsl().nativeHandle - val result = requireNotNull(gsl_matrix_complex_calloc(a.pointed.size1, a.pointed.size2)) - gsl_blas_zgemm(CblasNoTrans, CblasNoTrans, ComplexField.one.toGsl(), x, a, ComplexField.one.toGsl(), result) - return GslComplexMatrix(nativeHandle = result, scope = scope) - } - - public override fun Matrix.dot(vector: Point): GslVector { - val x = toGsl().nativeHandle - val a = vector.toGsl().nativeHandle - val result = requireNotNull(gsl_vector_complex_calloc(a.pointed.size)) - gsl_blas_zgemv(CblasNoTrans, ComplexField.one.toGsl(), x, a, ComplexField.one.toGsl(), result) - return GslComplexVector(result, scope) - } - - public override fun Matrix.times(value: Complex): GslMatrix { - val g1 = toGsl() - gsl_matrix_complex_scale(g1.nativeHandle, value.toGsl()) - return g1 - } - - public override fun add(a: Matrix, b: Matrix): GslMatrix { - val g1 = a.toGsl() - gsl_matrix_complex_add(g1.nativeHandle, b.toGsl().nativeHandle) - return g1 - } - - public override fun multiply(a: Matrix, k: Number): GslMatrix { - val g1 = a.toGsl() - gsl_matrix_complex_scale(g1.nativeHandle, k.toComplex().toGsl()) - return g1 - } -} diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt index d3544874d..d52b78ccc 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt @@ -8,6 +8,7 @@ public abstract class GslMemoryHolder internal constructor(inter internal abstract val nativeHandle: CPointer init { + ensureHasGslErrorHandler() scope.defer(::close) } diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt index 8990416b3..7ef8c24e7 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt @@ -1,10 +1,12 @@ package kscience.kmath.gsl -import kotlinx.cinterop.* +import kotlinx.cinterop.CPointer +import kotlinx.cinterop.DeferScope +import kotlinx.cinterop.pointed import org.gnu.gsl.* -internal class GslRealVector(override val nativeHandle: CPointer, scope: DeferScope) - : GslVector(scope) { +internal class GslRealVector(override val nativeHandle: CPointer, scope: DeferScope) : + GslVector(scope) { override val size: Int get() = nativeHandle.pointed.size.toInt() @@ -25,8 +27,8 @@ internal class GslRealVector(override val nativeHandle: CPointer, sc override fun close(): Unit = gsl_vector_free(nativeHandle) } -internal class GslFloatVector(override val nativeHandle: CPointer, scope: DeferScope) - : GslVector(scope) { +internal class GslFloatVector(override val nativeHandle: CPointer, scope: DeferScope) : + GslVector(scope) { override val size: Int get() = nativeHandle.pointed.size.toInt() @@ -47,8 +49,8 @@ internal class GslFloatVector(override val nativeHandle: CPointer, scope: DeferScope) - : GslVector(scope) { +internal class GslShortVector(override val nativeHandle: CPointer, scope: DeferScope) : + GslVector(scope) { override val size: Int get() = nativeHandle.pointed.size.toInt() @@ -69,8 +71,8 @@ internal class GslShortVector(override val nativeHandle: CPointer, scope: DeferScope) - : GslVector(scope) { +internal class GslUShortVector(override val nativeHandle: CPointer, scope: DeferScope) : + GslVector(scope) { override val size: Int get() = nativeHandle.pointed.size.toInt() @@ -91,8 +93,8 @@ internal class GslUShortVector(override val nativeHandle: CPointer, scope: DeferScope) - : GslVector(scope) { +internal class GslLongVector(override val nativeHandle: CPointer, scope: DeferScope) : + GslVector(scope) { override val size: Int get() = nativeHandle.pointed.size.toInt() @@ -113,8 +115,8 @@ internal class GslLongVector(override val nativeHandle: CPointer, scope: DeferScope) - : GslVector(scope) { +internal class GslULongVector(override val nativeHandle: CPointer, scope: DeferScope) : + GslVector(scope) { override val size: Int get() = nativeHandle.pointed.size.toInt() @@ -135,8 +137,8 @@ internal class GslULongVector(override val nativeHandle: CPointer, scope: DeferScope) - : GslVector(scope) { +internal class GslIntVector(override val nativeHandle: CPointer, scope: DeferScope) : + GslVector(scope) { override val size: Int get() = nativeHandle.pointed.size.toInt() @@ -157,8 +159,8 @@ internal class GslIntVector(override val nativeHandle: CPointer, override fun close(): Unit = gsl_vector_int_free(nativeHandle) } -internal class GslUIntVector(override val nativeHandle: CPointer, scope: DeferScope) - : GslVector(scope) { +internal class GslUIntVector(override val nativeHandle: CPointer, scope: DeferScope) : + GslVector(scope) { override val size: Int get() = nativeHandle.pointed.size.toInt() diff --git a/kmath-gsl/src/nativeTest/kotlin/ErrorHandler.kt b/kmath-gsl/src/nativeTest/kotlin/ErrorHandler.kt new file mode 100644 index 000000000..1259f58b9 --- /dev/null +++ b/kmath-gsl/src/nativeTest/kotlin/ErrorHandler.kt @@ -0,0 +1,23 @@ +package kscience.kmath.gsl + +import kotlinx.cinterop.memScoped +import org.gnu.gsl.gsl_block_calloc +import kotlin.test.Test +import kotlin.test.assertFailsWith + +internal class ErrorHandler { + @Test + fun blockAllocation() { + assertFailsWith { + ensureHasGslErrorHandler() + gsl_block_calloc(ULong.MAX_VALUE) + } + } + + @Test + fun matrixAllocation() { + assertFailsWith { + memScoped { GslRealMatrixContext(this).produce(Int.MAX_VALUE, Int.MAX_VALUE) { _, _ -> 0.0 } } + } + } +} From 4fc8d7b57c3df808e3a3117f69b51265a735e1c2 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 29 Nov 2020 16:12:41 +0700 Subject: [PATCH 41/76] Fix build --- .github/workflows/gradle.yml | 18 +++++++++--------- gradle.properties | 1 + kmath-gsl/build.gradle.kts | 10 +++++----- .../kotlin/kscience/kmath/gsl/_Vectors.kt | 4 +--- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 3b912156a..e20509f7a 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -33,9 +33,9 @@ jobs: with: path: | ~/.konan/dependencies - ~/.konan/kotlin-native-prebuilt-linux-1.4.20-eap-37 - key: ${{ runner.os }}-konan-1.4.20-eap-37 - restore-keys: ${{ runner.os }}-konan-1.4.20-eap-37 + ~/.konan/kotlin-native-prebuilt-linux-1.4.20 + key: ${{ runner.os }}-konan-1.4.20 + restore-keys: ${{ runner.os }}-konan-1.4.20 - name: Build with Gradle run: ./gradlew -Dorg.gradle.daemon=false --build-cache build build-osx: @@ -63,9 +63,9 @@ jobs: with: path: | ~/.konan/dependencies - ~/.konan/kotlin-native-prebuilt-macos-1.4.20-eap-37 - key: ${{ runner.os }}-konan-1.4.20-eap-37 - restore-keys: ${{ runner.os }}-konan-1.4.20-eap-37 + ~/.konan/kotlin-native-prebuilt-macos-1.4.20 + key: ${{ runner.os }}-konan-1.4.20 + restore-keys: ${{ runner.os }}-konan-1.4.20 - name: Build with Gradle run: sudo ./gradlew -Dorg.gradle.daemon=false --build-cache build @@ -94,8 +94,8 @@ jobs: with: path: | ~/.konan/dependencies - ~/.konan/kotlin-native-prebuilt-mingw-1.4.20-eap-37 - key: ${{ runner.os }}-konan-1.4.20-eap-37 - restore-keys: ${{ runner.os }}-konan-1.4.20-eap-37 + ~/.konan/kotlin-native-prebuilt-mingw-1.4.20 + key: ${{ runner.os }}-konan-1.4.20 + restore-keys: ${{ runner.os }}-konan-1.4.20 - name: Build with Gradle run: ./gradlew --build-cache build diff --git a/gradle.properties b/gradle.properties index d25e32240..be3f70ec3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,7 @@ kotlin.code.style=official kotlin.mpp.enableGranularSourceSetsMetadata=true kotlin.mpp.stability.nowarn=true +kotlin.native.enableDependencyPropagation=false kotlin.native.ignoreDisabledTargets=true kotlin.parallel.tasks.in.project=true org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index d7d53e797..df1e635be 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -12,7 +12,7 @@ kotlin { val nativeTarget = when (System.getProperty("os.name")) { "Mac OS X" -> macosX64() - "Linux" -> linuxX64("native") + "Linux" -> linuxX64() else -> { logger.warn("Current OS cannot build any of kmath-gsl targets.") @@ -29,7 +29,7 @@ kotlin { val test by nativeTarget.compilations.getting sourceSets { - val nativeMain by getting { + val nativeMain by creating { val codegen by tasks.creating { matricesCodegen(kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Matrices.kt") vectorsCodegen(kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Vectors.kt") @@ -42,11 +42,11 @@ kotlin { } } - val nativeTest by getting { + val nativeTest by creating { dependsOn(nativeMain) } -// main.defaultSourceSet.dependsOn(nativeMain) -// test.defaultSourceSet.dependsOn(nativeTest) + main.defaultSourceSet.dependsOn(nativeMain) + test.defaultSourceSet.dependsOn(nativeTest) } } diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt index 7ef8c24e7..de2da97da 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt @@ -1,8 +1,6 @@ package kscience.kmath.gsl -import kotlinx.cinterop.CPointer -import kotlinx.cinterop.DeferScope -import kotlinx.cinterop.pointed +import kotlinx.cinterop.* import org.gnu.gsl.* internal class GslRealVector(override val nativeHandle: CPointer, scope: DeferScope) : From f46826f2b1ff313b81dd25bc748c41853f3f4e00 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Wed, 2 Dec 2020 10:12:33 +0700 Subject: [PATCH 42/76] Fix GSL matrix context --- .../kscience/kmath/gsl/GslMatrixContext.kt | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt index 762cf1252..de7e4868e 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt @@ -19,10 +19,9 @@ internal inline fun GslMatrix.fill(initializer: internal inline fun GslVector.fill(initializer: (Int) -> T): GslVector = apply { (0 until size).forEach { index -> this[index] = initializer(index) } } -public abstract class GslMatrixContext< - T : Any, - H1 : CStructVar, - H2 : CStructVar> internal constructor(internal val scope: DeferScope) : MatrixContext { +public abstract class GslMatrixContext internal constructor( + internal val scope: DeferScope +) : MatrixContext> { init { ensureHasGslErrorHandler() } @@ -46,7 +45,10 @@ public abstract class GslMatrixContext< public class GslRealMatrixContext(scope: DeferScope) : GslMatrixContext(scope) { override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = - GslRealMatrix(nativeHandle = requireNotNull(gsl_matrix_alloc(rows.toULong(), columns.toULong())), scope = scope) + GslRealMatrix( + nativeHandle = requireNotNull(gsl_matrix_alloc(rows.toULong(), columns.toULong())), + scope = scope + ) override fun produceDirtyVector(size: Int): GslVector = GslRealVector(nativeHandle = requireNotNull(gsl_vector_alloc(size.toULong())), scope = scope) @@ -131,10 +133,11 @@ public class GslFloatMatrixContext(scope: DeferScope) : public class GslComplexMatrixContext(scope: DeferScope) : GslMatrixContext(scope) { - override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = GslComplexMatrix( - nativeHandle = requireNotNull(gsl_matrix_complex_alloc(rows.toULong(), columns.toULong())), - scope = scope - ) + override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = + GslComplexMatrix( + nativeHandle = requireNotNull(gsl_matrix_complex_alloc(rows.toULong(), columns.toULong())), + scope = scope + ) override fun produceDirtyVector(size: Int): GslVector = GslComplexVector(requireNotNull(gsl_vector_complex_alloc(size.toULong())), scope) From 96957dfa4b2e8b0aeb7c3ecf3ccf16a6532ba809 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Wed, 2 Dec 2020 10:49:47 +0700 Subject: [PATCH 43/76] Add missing experimental annotation --- kmath-stat/build.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/kmath-stat/build.gradle.kts b/kmath-stat/build.gradle.kts index b370eba0b..9efe08880 100644 --- a/kmath-stat/build.gradle.kts +++ b/kmath-stat/build.gradle.kts @@ -7,6 +7,7 @@ kotlin.sourceSets { with(languageSettings) { useExperimentalAnnotation("kotlinx.coroutines.FlowPreview") useExperimentalAnnotation("kotlinx.coroutines.ExperimentalCoroutinesApi") + useExperimentalAnnotation("kotlinx.coroutines.ObsoleteCoroutinesApi") } } From 2f1cfefeac1db63917550b31455c2218fdeb0d1e Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 6 Dec 2020 04:05:36 +0700 Subject: [PATCH 44/76] Update Kotlin, document codegen functions --- buildSrc/build.gradle.kts | 2 +- .../main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt | 3 +++ .../main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 5093b7930..84d1706d5 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -5,5 +5,5 @@ plugins { repositories.jcenter() dependencies { - implementation(kotlin("compiler-embeddable", "1.4.10")) + implementation(kotlin("compiler-embeddable", "1.4.20")) } diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt index 81324141c..56a563f84 100644 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt @@ -57,6 +57,9 @@ private fun KtPsiFactory.createMatrixClass( f += createNewLine(2) } +/** + * Generates matrices source code for kmath-gsl. + */ fun matricesCodegen(outputFile: String, project: Project = createProject()) { val f = KtPsiFactory(project, true).run { createFile("").also { f -> diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt index e227dc721..2f4a06475 100644 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt @@ -46,6 +46,9 @@ private fun KtPsiFactory.createVectorClass( f += createNewLine(2) } +/** + * Generates vectors source code for kmath-gsl. + */ fun vectorsCodegen(outputFile: String, project: Project = createProject()) { val f = KtPsiFactory(project, true).run { createFile("").also { f -> From cdebe2fc4f26fb66477b75b6f0519203791ac7e8 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 20 Dec 2020 00:06:40 +0700 Subject: [PATCH 45/76] Add API documentation, fix hashCode --- .../kotlin/kscience/kmath/gsl/GslException.kt | 7 +++++-- .../kotlin/kscience/kmath/gsl/GslMatrix.kt | 19 +++++++++++++++---- .../kscience/kmath/gsl/GslMatrixContext.kt | 18 ++++++++++++++++++ .../kscience/kmath/gsl/GslMemoryHolder.kt | 6 ++++++ .../kotlin/kscience/kmath/gsl/GslVector.kt | 3 +++ kmath-gsl/src/nativeTest/kotlin/RealTest.kt | 8 +++----- 6 files changed, 50 insertions(+), 11 deletions(-) diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslException.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslException.kt index 65e466015..8897b1427 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslException.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslException.kt @@ -29,7 +29,7 @@ internal enum class GslErrnoValue(val code: Int, val text: String) { GSL_EBADTOL(org.gnu.gsl.GSL_EBADTOL, "user specified an invalid tolerance"), GSL_ETOL(org.gnu.gsl.GSL_ETOL, "failed to reach the specified tolerance"), GSL_EUNDRFLW(org.gnu.gsl.GSL_EUNDRFLW, "underflow"), - GSL_EOVRFLW(org.gnu.gsl.GSL_EOVRFLW, "overflow "), + GSL_EOVRFLW(org.gnu.gsl.GSL_EOVRFLW, "overflow"), GSL_ELOSS(org.gnu.gsl.GSL_ELOSS, "loss of accuracy"), GSL_EROUND(org.gnu.gsl.GSL_EROUND, "failed because of roundoff error"), GSL_EBADLEN(org.gnu.gsl.GSL_EBADLEN, "matrix, vector lengths are not conformant"), @@ -54,7 +54,10 @@ internal enum class GslErrnoValue(val code: Int, val text: String) { } } -internal class GslException internal constructor(file: String, line: Int, reason: String, errno: Int) : +/** + * Wraps all the errors reported by GSL. + */ +public class GslException internal constructor(file: String, line: Int, reason: String, errno: Int) : RuntimeException("$file:$line: $reason. errno - $errno, ${GslErrnoValue.valueOf(errno)}") { } diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt index 619372eef..e08c0c0d1 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt @@ -5,6 +5,9 @@ import kotlinx.cinterop.DeferScope import kscience.kmath.linear.FeaturedMatrix import kscience.kmath.structures.NDStructure +/** + * Wraps gsl_matrix_* objects from GSL. + */ public abstract class GslMatrix internal constructor(scope: DeferScope) : GslMemoryHolder(scope), FeaturedMatrix { @@ -15,9 +18,17 @@ public abstract class GslMatrix internal constructor(sc return NDStructure.equals(this, other as? NDStructure<*> ?: return false) } - public final override fun hashCode(): Int { - var result = nativeHandle.hashCode() - result = 31 * result + features.hashCode() - return result + public override fun hashCode(): Int { + var ret = 7 + val nRows = rowNum + val nCols = colNum + ret = ret * 31 + nRows + ret = ret * 31 + nCols + + for (row in 0 until nRows) + for (col in 0 until nCols) + ret = ret * 31 + (11 * (row + 1) + 17 * (col + 1)) * this[row, col].hashCode() + + return ret } } diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt index de7e4868e..a1f3445ca 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt @@ -19,6 +19,9 @@ internal inline fun GslMatrix.fill(initializer: internal inline fun GslVector.fill(initializer: (Int) -> T): GslVector = apply { (0 until size).forEach { index -> this[index] = initializer(index) } } +/** + * Represents matrix context implementing where all the operations are delegated to GSL. + */ public abstract class GslMatrixContext internal constructor( internal val scope: DeferScope ) : MatrixContext> { @@ -26,12 +29,18 @@ public abstract class GslMatrixContext.toGsl(): GslMatrix = (if (this is GslMatrix<*, *>) this as GslMatrix else produce(rowNum, colNum) { i, j -> this[i, j] }).copy() + /** + * Converts this point to GSL one. + */ @Suppress("UNCHECKED_CAST") public fun Point.toGsl(): GslVector = (if (this is GslVector<*, *>) this as GslVector else produceDirtyVector(size).fill { this[it] }).copy() @@ -43,6 +52,9 @@ public abstract class GslMatrixContext(scope) { override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = GslRealMatrix( @@ -88,6 +100,9 @@ public class GslRealMatrixContext(scope: DeferScope) : GslMatrixContext(scope) { override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = @@ -131,6 +146,9 @@ public class GslFloatMatrixContext(scope: DeferScope) : } } +/** + * Represents [Complex] matrix context implementing where all the operations are delegated to GSL. + */ public class GslComplexMatrixContext(scope: DeferScope) : GslMatrixContext(scope) { override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt index d52b78ccc..15ee384b5 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt @@ -4,6 +4,12 @@ import kotlinx.cinterop.CPointer import kotlinx.cinterop.CStructVar import kotlinx.cinterop.DeferScope +/** + * Represents managed native GSL object. The only property this class holds is pointer to the GSL object. In order to be + * freed this class's object must be added to [DeferScope]. + * + * @param scope the scope where this object is declared. + */ public abstract class GslMemoryHolder internal constructor(internal val scope: DeferScope) { internal abstract val nativeHandle: CPointer diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt index 65b81f0d7..0033c47a1 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt @@ -4,6 +4,9 @@ import kotlinx.cinterop.CStructVar import kotlinx.cinterop.DeferScope import kscience.kmath.linear.Point +/** + * Wraps gsl_vector_* objects from GSL. + */ public abstract class GslVector internal constructor(scope: DeferScope) : GslMemoryHolder(scope), Point { internal abstract operator fun set(index: Int, value: T) diff --git a/kmath-gsl/src/nativeTest/kotlin/RealTest.kt b/kmath-gsl/src/nativeTest/kotlin/RealTest.kt index a2af95dfc..e0a7eadb7 100644 --- a/kmath-gsl/src/nativeTest/kotlin/RealTest.kt +++ b/kmath-gsl/src/nativeTest/kotlin/RealTest.kt @@ -3,9 +3,7 @@ package kscience.kmath.gsl import kotlinx.cinterop.memScoped import kscience.kmath.linear.RealMatrixContext import kscience.kmath.operations.invoke -import kscience.kmath.structures.RealBuffer -import kscience.kmath.structures.asIterable -import kscience.kmath.structures.asSequence +import kscience.kmath.structures.* import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue @@ -38,8 +36,8 @@ internal class RealTest { (GslRealMatrixContext(this)) { val ma = produce(2, 2) { _, _ -> 100.0 } val mb = produce(2, 2) { _, _ -> 100.0 } - val res1 = ma dot mb - val res2 = RealMatrixContext { ma dot mb } + val res1: Matrix = ma dot mb + val res2: Matrix = RealMatrixContext { ma dot mb } println(res1.rows.asIterable().map { it.asSequence() }.flatMap(Sequence<*>::toList)) println(res2.rows.asIterable().map { it.asSequence() }.flatMap(Sequence<*>::toList)) assertEquals(res1, res2) From 20767a3b35f5fce0b2e7b16d4bf4d0daa11472f6 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Wed, 6 Jan 2021 22:46:32 +0700 Subject: [PATCH 46/76] Add convenience scope functions for GSL contexts --- .../kscience/kmath/gsl/GslMatrixContext.kt | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt index a1f3445ca..1df21c4b1 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt @@ -2,6 +2,7 @@ package kscience.kmath.gsl import kotlinx.cinterop.CStructVar import kotlinx.cinterop.DeferScope +import kotlinx.cinterop.memScoped import kotlinx.cinterop.pointed import kscience.kmath.linear.MatrixContext import kscience.kmath.linear.Point @@ -23,7 +24,7 @@ internal inline fun GslVector.fill(initializer: * Represents matrix context implementing where all the operations are delegated to GSL. */ public abstract class GslMatrixContext internal constructor( - internal val scope: DeferScope + internal val scope: DeferScope, ) : MatrixContext> { init { ensureHasGslErrorHandler() @@ -100,6 +101,12 @@ public class GslRealMatrixContext(scope: DeferScope) : GslMatrixContext GslRealMatrixContext(block: GslRealMatrixContext.() -> R): R = + memScoped { GslRealMatrixContext(this).block() } + /** * Represents [Float] matrix context implementing where all the operations are delegated to GSL. */ @@ -146,6 +153,12 @@ public class GslFloatMatrixContext(scope: DeferScope) : } } +/** + * Invokes [block] inside newly created [GslFloatMatrixContext] which is disposed when the block is invoked. + */ +public fun GslFloatMatrixContext(block: GslFloatMatrixContext.() -> R): R = + memScoped { GslFloatMatrixContext(this).block() } + /** * Represents [Complex] matrix context implementing where all the operations are delegated to GSL. */ @@ -194,3 +207,9 @@ public class GslComplexMatrixContext(scope: DeferScope) : return g1 } } + +/** + * Invokes [block] inside newly created [GslComplexMatrixContext] which is disposed when the block is invoked. + */ +public fun GslComplexMatrixContext(block: GslComplexMatrixContext.() -> R): R = + memScoped { GslComplexMatrixContext(this).block() } From c34af4d8bdad77f20cc05168a52302ed2a93e8e8 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Wed, 6 Jan 2021 23:01:05 +0700 Subject: [PATCH 47/76] Update tests of GSL --- .../kscience/kmath/asm/internal/AsmBuilder.kt | 2 +- .../src/nativeTest/kotlin/ErrorHandler.kt | 3 +- kmath-gsl/src/nativeTest/kotlin/RealTest.kt | 77 ++++++++++++------- 3 files changed, 53 insertions(+), 29 deletions(-) diff --git a/kmath-ast/src/jvmMain/kotlin/kscience/kmath/asm/internal/AsmBuilder.kt b/kmath-ast/src/jvmMain/kotlin/kscience/kmath/asm/internal/AsmBuilder.kt index 1edbed28d..93d8d1143 100644 --- a/kmath-ast/src/jvmMain/kotlin/kscience/kmath/asm/internal/AsmBuilder.kt +++ b/kmath-ast/src/jvmMain/kotlin/kscience/kmath/asm/internal/AsmBuilder.kt @@ -191,7 +191,7 @@ internal class AsmBuilder( } val cls = classLoader.defineClass(className, classWriter.toByteArray()) - java.io.File("dump.class").writeBytes(classWriter.toByteArray()) + // java.io.File("dump.class").writeBytes(classWriter.toByteArray()) val l = MethodHandles.publicLookup() if (hasConstants) diff --git a/kmath-gsl/src/nativeTest/kotlin/ErrorHandler.kt b/kmath-gsl/src/nativeTest/kotlin/ErrorHandler.kt index 1259f58b9..0d8fbfbea 100644 --- a/kmath-gsl/src/nativeTest/kotlin/ErrorHandler.kt +++ b/kmath-gsl/src/nativeTest/kotlin/ErrorHandler.kt @@ -1,6 +1,5 @@ package kscience.kmath.gsl -import kotlinx.cinterop.memScoped import org.gnu.gsl.gsl_block_calloc import kotlin.test.Test import kotlin.test.assertFailsWith @@ -17,7 +16,7 @@ internal class ErrorHandler { @Test fun matrixAllocation() { assertFailsWith { - memScoped { GslRealMatrixContext(this).produce(Int.MAX_VALUE, Int.MAX_VALUE) { _, _ -> 0.0 } } + GslRealMatrixContext { produce(Int.MAX_VALUE, Int.MAX_VALUE) { _, _ -> 0.0 } } } } } diff --git a/kmath-gsl/src/nativeTest/kotlin/RealTest.kt b/kmath-gsl/src/nativeTest/kotlin/RealTest.kt index e0a7eadb7..01d9ef90d 100644 --- a/kmath-gsl/src/nativeTest/kotlin/RealTest.kt +++ b/kmath-gsl/src/nativeTest/kotlin/RealTest.kt @@ -1,46 +1,71 @@ package kscience.kmath.gsl -import kotlinx.cinterop.memScoped import kscience.kmath.linear.RealMatrixContext import kscience.kmath.operations.invoke import kscience.kmath.structures.* import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue +import kotlin.time.measureTime internal class RealTest { @Test - fun testScale() = memScoped { - (GslRealMatrixContext(this)) { - val ma = produce(10, 10) { _, _ -> 0.1 } - val mb = (ma * 20.0) - assertEquals(mb[0, 1], 2.0) - } + fun testScale() = GslRealMatrixContext { + val ma = produce(10, 10) { _, _ -> 0.1 } + val mb = (ma * 20.0) + assertEquals(mb[0, 1], 2.0) } @Test - fun testDotOfMatrixAndVector() = memScoped { - (GslRealMatrixContext(this)) { - val ma = produce(2, 2) { _, _ -> 100.0 } - val vb = RealBuffer(2) { 0.1 } - val res1 = ma dot vb - val res2 = RealMatrixContext { ma dot vb } - println(res1.asSequence().toList()) - println(res2.asSequence().toList()) - assertTrue(res1.contentEquals(res2)) - } + fun testDotOfMatrixAndVector() = GslRealMatrixContext { + val ma = produce(2, 2) { _, _ -> 100.0 } + val vb = RealBuffer(2) { 0.1 } + val res1 = ma dot vb + val res2 = RealMatrixContext { ma dot vb } + println(res1.asSequence().toList()) + println(res2.asSequence().toList()) + assertTrue(res1.contentEquals(res2)) } @Test - fun testDotOfMatrixAndMatrix() = memScoped { - (GslRealMatrixContext(this)) { - val ma = produce(2, 2) { _, _ -> 100.0 } - val mb = produce(2, 2) { _, _ -> 100.0 } - val res1: Matrix = ma dot mb - val res2: Matrix = RealMatrixContext { ma dot mb } - println(res1.rows.asIterable().map { it.asSequence() }.flatMap(Sequence<*>::toList)) - println(res2.rows.asIterable().map { it.asSequence() }.flatMap(Sequence<*>::toList)) - assertEquals(res1, res2) + fun testDotOfMatrixAndMatrix() = GslRealMatrixContext { + val ma = produce(2, 2) { _, _ -> 100.0 } + val mb = produce(2, 2) { _, _ -> 100.0 } + val res1: Matrix = ma dot mb + val res2: Matrix = RealMatrixContext { ma dot mb } + println(res1.rows.asIterable().map { it.asSequence() }.flatMap(Sequence<*>::toList)) + println(res2.rows.asIterable().map { it.asSequence() }.flatMap(Sequence<*>::toList)) + assertEquals(res1, res2) + } + + @Test + fun testManyCalls() { + val r1 = GslRealMatrixContext { + var prod = produce(20, 20) { _, _ -> 100.0 } + val mult = produce(20, 20) { _, _ -> 3.0 } + + measureTime { + repeat(100) { + prod = prod dot mult + } + }.also(::println) + + prod } + + val r2 = RealMatrixContext { + var prod = produce(20, 20) { _, _ -> 100.0 } + val mult = produce(20, 20) { _, _ -> 3.0 } + + measureTime { + repeat(100) { + prod = prod dot mult + } + }.also(::println) + + prod + } + + assertTrue(NDStructure.equals(r1, r2)) } } From ff930532e04d9a20a5d98e91974fb81622f755d6 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 7 Jan 2021 02:27:46 +0700 Subject: [PATCH 48/76] Fix failing test --- .../src/nativeTest/kotlin/GslMatrixTest.kt | 13 ++++++ kmath-gsl/src/nativeTest/kotlin/RealTest.kt | 44 +++++++------------ 2 files changed, 29 insertions(+), 28 deletions(-) create mode 100644 kmath-gsl/src/nativeTest/kotlin/GslMatrixTest.kt diff --git a/kmath-gsl/src/nativeTest/kotlin/GslMatrixTest.kt b/kmath-gsl/src/nativeTest/kotlin/GslMatrixTest.kt new file mode 100644 index 000000000..71d951f63 --- /dev/null +++ b/kmath-gsl/src/nativeTest/kotlin/GslMatrixTest.kt @@ -0,0 +1,13 @@ +package kscience.kmath.gsl + +import kotlin.test.Test +import kotlin.test.assertEquals + +internal class GslMatrixTest { + @Test + fun dimensions() = GslRealMatrixContext { + val mat = produce(42, 24) { _, _ -> 0.0 } + assertEquals(42, mat.rowNum) + assertEquals(24, mat.colNum) + } +} diff --git a/kmath-gsl/src/nativeTest/kotlin/RealTest.kt b/kmath-gsl/src/nativeTest/kotlin/RealTest.kt index 01d9ef90d..87c52342a 100644 --- a/kmath-gsl/src/nativeTest/kotlin/RealTest.kt +++ b/kmath-gsl/src/nativeTest/kotlin/RealTest.kt @@ -2,7 +2,11 @@ package kscience.kmath.gsl import kscience.kmath.linear.RealMatrixContext import kscience.kmath.operations.invoke -import kscience.kmath.structures.* +import kscience.kmath.structures.Matrix +import kscience.kmath.structures.NDStructure +import kscience.kmath.structures.RealBuffer +import kscience.kmath.structures.asSequence +import kotlin.random.Random import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue @@ -33,39 +37,23 @@ internal class RealTest { val mb = produce(2, 2) { _, _ -> 100.0 } val res1: Matrix = ma dot mb val res2: Matrix = RealMatrixContext { ma dot mb } - println(res1.rows.asIterable().map { it.asSequence() }.flatMap(Sequence<*>::toList)) - println(res2.rows.asIterable().map { it.asSequence() }.flatMap(Sequence<*>::toList)) assertEquals(res1, res2) } @Test - fun testManyCalls() { - val r1 = GslRealMatrixContext { - var prod = produce(20, 20) { _, _ -> 100.0 } - val mult = produce(20, 20) { _, _ -> 3.0 } - - measureTime { - repeat(100) { - prod = prod dot mult - } - }.also(::println) - + fun testManyCalls() = GslRealMatrixContext { + val expected = RealMatrixContext { + val rng = Random(0) + var prod = produce(20, 20) { _, _ -> rng.nextDouble() } + val mult = produce(20, 20) { _, _ -> rng.nextDouble() } + measureTime { repeat(100) { prod = prod dot mult } }.also(::println) prod } - val r2 = RealMatrixContext { - var prod = produce(20, 20) { _, _ -> 100.0 } - val mult = produce(20, 20) { _, _ -> 3.0 } - - measureTime { - repeat(100) { - prod = prod dot mult - } - }.also(::println) - - prod - } - - assertTrue(NDStructure.equals(r1, r2)) + val rng = Random(0) + var prod = produce(20, 20) { _, _ -> rng.nextDouble() } + val mult = produce(20, 20) { _, _ -> rng.nextDouble() } + measureTime { repeat(100) { prod = prod dot mult } }.also(::println) + assertTrue(NDStructure.equals(expected, prod)) } } From 57328a176e3c63a74ebeda4e7cf6a231ff47bb06 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 7 Jan 2021 02:45:37 +0700 Subject: [PATCH 49/76] Improve tests --- .../kotlin/{GslMatrixTest.kt => GslMatrixRealTest.kt} | 8 +++++++- .../kotlin/{RealTest.kt => GslRealContextTest.kt} | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) rename kmath-gsl/src/nativeTest/kotlin/{GslMatrixTest.kt => GslMatrixRealTest.kt} (60%) rename kmath-gsl/src/nativeTest/kotlin/{RealTest.kt => GslRealContextTest.kt} (98%) diff --git a/kmath-gsl/src/nativeTest/kotlin/GslMatrixTest.kt b/kmath-gsl/src/nativeTest/kotlin/GslMatrixRealTest.kt similarity index 60% rename from kmath-gsl/src/nativeTest/kotlin/GslMatrixTest.kt rename to kmath-gsl/src/nativeTest/kotlin/GslMatrixRealTest.kt index 71d951f63..b4ea4adb2 100644 --- a/kmath-gsl/src/nativeTest/kotlin/GslMatrixTest.kt +++ b/kmath-gsl/src/nativeTest/kotlin/GslMatrixRealTest.kt @@ -3,11 +3,17 @@ package kscience.kmath.gsl import kotlin.test.Test import kotlin.test.assertEquals -internal class GslMatrixTest { +internal class GslMatrixRealTest { @Test fun dimensions() = GslRealMatrixContext { val mat = produce(42, 24) { _, _ -> 0.0 } assertEquals(42, mat.rowNum) assertEquals(24, mat.colNum) } + + @Test + fun get() = GslRealMatrixContext { + val mat = produce(1, 1) { _, _ -> 42.0 } + assertEquals(42.0, mat[0, 0]) + } } diff --git a/kmath-gsl/src/nativeTest/kotlin/RealTest.kt b/kmath-gsl/src/nativeTest/kotlin/GslRealContextTest.kt similarity index 98% rename from kmath-gsl/src/nativeTest/kotlin/RealTest.kt rename to kmath-gsl/src/nativeTest/kotlin/GslRealContextTest.kt index 87c52342a..9ee543a13 100644 --- a/kmath-gsl/src/nativeTest/kotlin/RealTest.kt +++ b/kmath-gsl/src/nativeTest/kotlin/GslRealContextTest.kt @@ -12,7 +12,7 @@ import kotlin.test.assertEquals import kotlin.test.assertTrue import kotlin.time.measureTime -internal class RealTest { +internal class GslRealContextTest { @Test fun testScale() = GslRealMatrixContext { val ma = produce(10, 10) { _, _ -> 0.1 } From f84f71938516192dc66ddc6f9707091dc6a2dbed Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 7 Jan 2021 17:26:16 +0700 Subject: [PATCH 50/76] Add GSL objects disposition check, add missing newline, improve tests --- .../kscience/kmath/gsl/codegen/PsiTestUtil.kt | 2 +- .../kmath/gsl/codegen/matricesCodegen.kt | 18 +-- .../kmath/gsl/codegen/vectorsCodegen.kt | 18 ++- .../kscience/kmath/gsl/GslMemoryHolder.kt | 14 +- .../kotlin/kscience/kmath/gsl/_Matrices.kt | 128 +++++++++--------- .../kotlin/kscience/kmath/gsl/_Vectors.kt | 96 ++++++------- ...{ErrorHandler.kt => ErrorsHandlingTest.kt} | 12 +- .../nativeTest/kotlin/GslMatrixRealTest.kt | 23 ++++ ...extTest.kt => GslRealMatrixContextTest.kt} | 11 +- 9 files changed, 187 insertions(+), 135 deletions(-) rename kmath-gsl/src/nativeTest/kotlin/{ErrorHandler.kt => ErrorsHandlingTest.kt} (50%) rename kmath-gsl/src/nativeTest/kotlin/{GslRealContextTest.kt => GslRealMatrixContextTest.kt} (86%) diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/PsiTestUtil.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/PsiTestUtil.kt index 2981b9502..e38d93323 100644 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/PsiTestUtil.kt +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/PsiTestUtil.kt @@ -70,4 +70,4 @@ internal object PsiTestUtil { if (dummyCopy is PsiFileImpl) dummyCopy.originalFile = file return dummyCopy } -} \ No newline at end of file +} diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt index 56a563f84..84391181c 100644 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt @@ -23,33 +23,35 @@ private fun KtPsiFactory.createMatrixClass( scope: DeferScope ) : GslMatrix<$kotlinTypeName, $structName>(scope) { override val rowNum: Int - get() = nativeHandle.pointed.size1.toInt() + get() = nativeHandleChecked().pointed.size1.toInt() override val colNum: Int - get() = nativeHandle.pointed.size2.toInt() + get() = nativeHandleChecked().pointed.size2.toInt() override val features: Set = features override fun suggestFeature(vararg features: MatrixFeature): $className = - ${className}(nativeHandle, this.features + features, scope) + ${className}(nativeHandleChecked(), this.features + features, scope) override operator fun get(i: Int, j: Int): $kotlinTypeName = ${ fn("gsl_matrixRget", cTypeName) - }(nativeHandle, i.toULong(), j.toULong()) + }(nativeHandleChecked(), i.toULong(), j.toULong()) override operator fun set(i: Int, j: Int, value: ${kotlinTypeName}): Unit = - ${fn("gsl_matrixRset", cTypeName)}(nativeHandle, i.toULong(), j.toULong(), value) + ${fn("gsl_matrixRset", cTypeName)}(nativeHandleChecked(), i.toULong(), j.toULong(), value) override fun copy(): $className { val new = requireNotNull(${fn("gsl_matrixRalloc", cTypeName)}(rowNum.toULong(), colNum.toULong())) - ${fn("gsl_matrixRmemcpy", cTypeName)}(new, nativeHandle) + ${fn("gsl_matrixRmemcpy", cTypeName)}(new, nativeHandleChecked()) return $className(new, features, scope) } - override fun close(): Unit = ${fn("gsl_matrixRfree", cTypeName)}(nativeHandle) + override fun close(): Unit = ${fn("gsl_matrixRfree", cTypeName)}(nativeHandleChecked()) override fun equals(other: Any?): Boolean { - if (other is $className) return ${fn("gsl_matrixRequal", cTypeName)}(nativeHandle, other.nativeHandle) == 1 + if (other is $className) return ${ + fn("gsl_matrixRequal", cTypeName) + }(nativeHandleChecked(), other.nativeHandleChecked()) == 1 return super.equals(other) } }""" diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt index 2f4a06475..2139489d1 100644 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt @@ -21,25 +21,31 @@ private fun KtPsiFactory.createVectorClass( """internal class $className(override val nativeHandle: CPointer<$structName>, scope: DeferScope) : GslVector<$kotlinTypeName, $structName>(scope) { override val size: Int - get() = nativeHandle.pointed.size.toInt() + get() = nativeHandleChecked().pointed.size.toInt() - override fun get(index: Int): $kotlinTypeName = ${fn("gsl_vectorRget", cTypeName)}(nativeHandle, index.toULong()) + override fun get(index: Int): $kotlinTypeName = ${ + fn("gsl_vectorRget", + cTypeName) + }(nativeHandleChecked(), index.toULong()) override fun set(index: Int, value: $kotlinTypeName): Unit = ${ fn("gsl_vectorRset", cTypeName) - }(nativeHandle, index.toULong(), value) + }(nativeHandleChecked(), index.toULong(), value) override fun copy(): $className { val new = requireNotNull(${fn("gsl_vectorRalloc", cTypeName)}(size.toULong())) - ${fn("gsl_vectorRmemcpy", cTypeName)}(new, nativeHandle) + ${fn("gsl_vectorRmemcpy", cTypeName)}(new, nativeHandleChecked()) return ${className}(new, scope) } override fun equals(other: Any?): Boolean { - if (other is $className) return ${fn("gsl_vectorRequal", cTypeName)}(nativeHandle, other.nativeHandle) == 1 + if (other is $className) return ${ + fn("gsl_vectorRequal", + cTypeName) + }(nativeHandleChecked(), other.nativeHandleChecked()) == 1 return super.equals(other) } - override fun close(): Unit = ${fn("gsl_vectorRfree", cTypeName)}(nativeHandle) + override fun close(): Unit = ${fn("gsl_vectorRfree", cTypeName)}(nativeHandleChecked()) }""" f += createClass(text) diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt index 15ee384b5..d68a52a62 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt @@ -8,14 +8,26 @@ import kotlinx.cinterop.DeferScope * Represents managed native GSL object. The only property this class holds is pointer to the GSL object. In order to be * freed this class's object must be added to [DeferScope]. * + * The objects of this type shouldn't be used after being disposed by the scope. + * * @param scope the scope where this object is declared. */ public abstract class GslMemoryHolder internal constructor(internal val scope: DeferScope) { internal abstract val nativeHandle: CPointer + private var isClosed: Boolean = false init { ensureHasGslErrorHandler() - scope.defer(::close) + + scope.defer { + close() + isClosed = true + } + } + + internal fun nativeHandleChecked(): CPointer { + check(!isClosed) { "The use of GSL object that is closed." } + return nativeHandle } internal abstract fun close() diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt index a38534515..e8c98a9fd 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt @@ -10,31 +10,31 @@ internal class GslRealMatrix( scope: DeferScope ) : GslMatrix(scope) { override val rowNum: Int - get() = nativeHandle.pointed.size1.toInt() + get() = nativeHandleChecked().pointed.size1.toInt() override val colNum: Int - get() = nativeHandle.pointed.size2.toInt() + get() = nativeHandleChecked().pointed.size2.toInt() override val features: Set = features override fun suggestFeature(vararg features: MatrixFeature): GslRealMatrix = - GslRealMatrix(nativeHandle, this.features + features, scope) + GslRealMatrix(nativeHandleChecked(), this.features + features, scope) - override operator fun get(i: Int, j: Int): Double = gsl_matrix_get(nativeHandle, i.toULong(), j.toULong()) + override operator fun get(i: Int, j: Int): Double = gsl_matrix_get(nativeHandleChecked(), i.toULong(), j.toULong()) override operator fun set(i: Int, j: Int, value: Double): Unit = - gsl_matrix_set(nativeHandle, i.toULong(), j.toULong(), value) + gsl_matrix_set(nativeHandleChecked(), i.toULong(), j.toULong(), value) override fun copy(): GslRealMatrix { val new = requireNotNull(gsl_matrix_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_memcpy(new, nativeHandle) + gsl_matrix_memcpy(new, nativeHandleChecked()) return GslRealMatrix(new, features, scope) } - override fun close(): Unit = gsl_matrix_free(nativeHandle) + override fun close(): Unit = gsl_matrix_free(nativeHandleChecked()) override fun equals(other: Any?): Boolean { - if (other is GslRealMatrix) return gsl_matrix_equal(nativeHandle, other.nativeHandle) == 1 + if (other is GslRealMatrix) return gsl_matrix_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 return super.equals(other) } } @@ -45,31 +45,31 @@ internal class GslFloatMatrix( scope: DeferScope ) : GslMatrix(scope) { override val rowNum: Int - get() = nativeHandle.pointed.size1.toInt() + get() = nativeHandleChecked().pointed.size1.toInt() override val colNum: Int - get() = nativeHandle.pointed.size2.toInt() + get() = nativeHandleChecked().pointed.size2.toInt() override val features: Set = features override fun suggestFeature(vararg features: MatrixFeature): GslFloatMatrix = - GslFloatMatrix(nativeHandle, this.features + features, scope) + GslFloatMatrix(nativeHandleChecked(), this.features + features, scope) - override operator fun get(i: Int, j: Int): Float = gsl_matrix_float_get(nativeHandle, i.toULong(), j.toULong()) + override operator fun get(i: Int, j: Int): Float = gsl_matrix_float_get(nativeHandleChecked(), i.toULong(), j.toULong()) override operator fun set(i: Int, j: Int, value: Float): Unit = - gsl_matrix_float_set(nativeHandle, i.toULong(), j.toULong(), value) + gsl_matrix_float_set(nativeHandleChecked(), i.toULong(), j.toULong(), value) override fun copy(): GslFloatMatrix { val new = requireNotNull(gsl_matrix_float_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_float_memcpy(new, nativeHandle) + gsl_matrix_float_memcpy(new, nativeHandleChecked()) return GslFloatMatrix(new, features, scope) } - override fun close(): Unit = gsl_matrix_float_free(nativeHandle) + override fun close(): Unit = gsl_matrix_float_free(nativeHandleChecked()) override fun equals(other: Any?): Boolean { - if (other is GslFloatMatrix) return gsl_matrix_float_equal(nativeHandle, other.nativeHandle) == 1 + if (other is GslFloatMatrix) return gsl_matrix_float_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 return super.equals(other) } } @@ -80,31 +80,31 @@ internal class GslShortMatrix( scope: DeferScope ) : GslMatrix(scope) { override val rowNum: Int - get() = nativeHandle.pointed.size1.toInt() + get() = nativeHandleChecked().pointed.size1.toInt() override val colNum: Int - get() = nativeHandle.pointed.size2.toInt() + get() = nativeHandleChecked().pointed.size2.toInt() override val features: Set = features override fun suggestFeature(vararg features: MatrixFeature): GslShortMatrix = - GslShortMatrix(nativeHandle, this.features + features, scope) + GslShortMatrix(nativeHandleChecked(), this.features + features, scope) - override operator fun get(i: Int, j: Int): Short = gsl_matrix_short_get(nativeHandle, i.toULong(), j.toULong()) + override operator fun get(i: Int, j: Int): Short = gsl_matrix_short_get(nativeHandleChecked(), i.toULong(), j.toULong()) override operator fun set(i: Int, j: Int, value: Short): Unit = - gsl_matrix_short_set(nativeHandle, i.toULong(), j.toULong(), value) + gsl_matrix_short_set(nativeHandleChecked(), i.toULong(), j.toULong(), value) override fun copy(): GslShortMatrix { val new = requireNotNull(gsl_matrix_short_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_short_memcpy(new, nativeHandle) + gsl_matrix_short_memcpy(new, nativeHandleChecked()) return GslShortMatrix(new, features, scope) } - override fun close(): Unit = gsl_matrix_short_free(nativeHandle) + override fun close(): Unit = gsl_matrix_short_free(nativeHandleChecked()) override fun equals(other: Any?): Boolean { - if (other is GslShortMatrix) return gsl_matrix_short_equal(nativeHandle, other.nativeHandle) == 1 + if (other is GslShortMatrix) return gsl_matrix_short_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 return super.equals(other) } } @@ -115,31 +115,31 @@ internal class GslUShortMatrix( scope: DeferScope ) : GslMatrix(scope) { override val rowNum: Int - get() = nativeHandle.pointed.size1.toInt() + get() = nativeHandleChecked().pointed.size1.toInt() override val colNum: Int - get() = nativeHandle.pointed.size2.toInt() + get() = nativeHandleChecked().pointed.size2.toInt() override val features: Set = features override fun suggestFeature(vararg features: MatrixFeature): GslUShortMatrix = - GslUShortMatrix(nativeHandle, this.features + features, scope) + GslUShortMatrix(nativeHandleChecked(), this.features + features, scope) - override operator fun get(i: Int, j: Int): UShort = gsl_matrix_ushort_get(nativeHandle, i.toULong(), j.toULong()) + override operator fun get(i: Int, j: Int): UShort = gsl_matrix_ushort_get(nativeHandleChecked(), i.toULong(), j.toULong()) override operator fun set(i: Int, j: Int, value: UShort): Unit = - gsl_matrix_ushort_set(nativeHandle, i.toULong(), j.toULong(), value) + gsl_matrix_ushort_set(nativeHandleChecked(), i.toULong(), j.toULong(), value) override fun copy(): GslUShortMatrix { val new = requireNotNull(gsl_matrix_ushort_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_ushort_memcpy(new, nativeHandle) + gsl_matrix_ushort_memcpy(new, nativeHandleChecked()) return GslUShortMatrix(new, features, scope) } - override fun close(): Unit = gsl_matrix_ushort_free(nativeHandle) + override fun close(): Unit = gsl_matrix_ushort_free(nativeHandleChecked()) override fun equals(other: Any?): Boolean { - if (other is GslUShortMatrix) return gsl_matrix_ushort_equal(nativeHandle, other.nativeHandle) == 1 + if (other is GslUShortMatrix) return gsl_matrix_ushort_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 return super.equals(other) } } @@ -150,31 +150,31 @@ internal class GslLongMatrix( scope: DeferScope ) : GslMatrix(scope) { override val rowNum: Int - get() = nativeHandle.pointed.size1.toInt() + get() = nativeHandleChecked().pointed.size1.toInt() override val colNum: Int - get() = nativeHandle.pointed.size2.toInt() + get() = nativeHandleChecked().pointed.size2.toInt() override val features: Set = features override fun suggestFeature(vararg features: MatrixFeature): GslLongMatrix = - GslLongMatrix(nativeHandle, this.features + features, scope) + GslLongMatrix(nativeHandleChecked(), this.features + features, scope) - override operator fun get(i: Int, j: Int): Long = gsl_matrix_long_get(nativeHandle, i.toULong(), j.toULong()) + override operator fun get(i: Int, j: Int): Long = gsl_matrix_long_get(nativeHandleChecked(), i.toULong(), j.toULong()) override operator fun set(i: Int, j: Int, value: Long): Unit = - gsl_matrix_long_set(nativeHandle, i.toULong(), j.toULong(), value) + gsl_matrix_long_set(nativeHandleChecked(), i.toULong(), j.toULong(), value) override fun copy(): GslLongMatrix { val new = requireNotNull(gsl_matrix_long_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_long_memcpy(new, nativeHandle) + gsl_matrix_long_memcpy(new, nativeHandleChecked()) return GslLongMatrix(new, features, scope) } - override fun close(): Unit = gsl_matrix_long_free(nativeHandle) + override fun close(): Unit = gsl_matrix_long_free(nativeHandleChecked()) override fun equals(other: Any?): Boolean { - if (other is GslLongMatrix) return gsl_matrix_long_equal(nativeHandle, other.nativeHandle) == 1 + if (other is GslLongMatrix) return gsl_matrix_long_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 return super.equals(other) } } @@ -185,31 +185,31 @@ internal class GslULongMatrix( scope: DeferScope ) : GslMatrix(scope) { override val rowNum: Int - get() = nativeHandle.pointed.size1.toInt() + get() = nativeHandleChecked().pointed.size1.toInt() override val colNum: Int - get() = nativeHandle.pointed.size2.toInt() + get() = nativeHandleChecked().pointed.size2.toInt() override val features: Set = features override fun suggestFeature(vararg features: MatrixFeature): GslULongMatrix = - GslULongMatrix(nativeHandle, this.features + features, scope) + GslULongMatrix(nativeHandleChecked(), this.features + features, scope) - override operator fun get(i: Int, j: Int): ULong = gsl_matrix_ulong_get(nativeHandle, i.toULong(), j.toULong()) + override operator fun get(i: Int, j: Int): ULong = gsl_matrix_ulong_get(nativeHandleChecked(), i.toULong(), j.toULong()) override operator fun set(i: Int, j: Int, value: ULong): Unit = - gsl_matrix_ulong_set(nativeHandle, i.toULong(), j.toULong(), value) + gsl_matrix_ulong_set(nativeHandleChecked(), i.toULong(), j.toULong(), value) override fun copy(): GslULongMatrix { val new = requireNotNull(gsl_matrix_ulong_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_ulong_memcpy(new, nativeHandle) + gsl_matrix_ulong_memcpy(new, nativeHandleChecked()) return GslULongMatrix(new, features, scope) } - override fun close(): Unit = gsl_matrix_ulong_free(nativeHandle) + override fun close(): Unit = gsl_matrix_ulong_free(nativeHandleChecked()) override fun equals(other: Any?): Boolean { - if (other is GslULongMatrix) return gsl_matrix_ulong_equal(nativeHandle, other.nativeHandle) == 1 + if (other is GslULongMatrix) return gsl_matrix_ulong_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 return super.equals(other) } } @@ -220,31 +220,31 @@ internal class GslIntMatrix( scope: DeferScope ) : GslMatrix(scope) { override val rowNum: Int - get() = nativeHandle.pointed.size1.toInt() + get() = nativeHandleChecked().pointed.size1.toInt() override val colNum: Int - get() = nativeHandle.pointed.size2.toInt() + get() = nativeHandleChecked().pointed.size2.toInt() override val features: Set = features override fun suggestFeature(vararg features: MatrixFeature): GslIntMatrix = - GslIntMatrix(nativeHandle, this.features + features, scope) + GslIntMatrix(nativeHandleChecked(), this.features + features, scope) - override operator fun get(i: Int, j: Int): Int = gsl_matrix_int_get(nativeHandle, i.toULong(), j.toULong()) + override operator fun get(i: Int, j: Int): Int = gsl_matrix_int_get(nativeHandleChecked(), i.toULong(), j.toULong()) override operator fun set(i: Int, j: Int, value: Int): Unit = - gsl_matrix_int_set(nativeHandle, i.toULong(), j.toULong(), value) + gsl_matrix_int_set(nativeHandleChecked(), i.toULong(), j.toULong(), value) override fun copy(): GslIntMatrix { val new = requireNotNull(gsl_matrix_int_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_int_memcpy(new, nativeHandle) + gsl_matrix_int_memcpy(new, nativeHandleChecked()) return GslIntMatrix(new, features, scope) } - override fun close(): Unit = gsl_matrix_int_free(nativeHandle) + override fun close(): Unit = gsl_matrix_int_free(nativeHandleChecked()) override fun equals(other: Any?): Boolean { - if (other is GslIntMatrix) return gsl_matrix_int_equal(nativeHandle, other.nativeHandle) == 1 + if (other is GslIntMatrix) return gsl_matrix_int_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 return super.equals(other) } } @@ -255,31 +255,31 @@ internal class GslUIntMatrix( scope: DeferScope ) : GslMatrix(scope) { override val rowNum: Int - get() = nativeHandle.pointed.size1.toInt() + get() = nativeHandleChecked().pointed.size1.toInt() override val colNum: Int - get() = nativeHandle.pointed.size2.toInt() + get() = nativeHandleChecked().pointed.size2.toInt() override val features: Set = features override fun suggestFeature(vararg features: MatrixFeature): GslUIntMatrix = - GslUIntMatrix(nativeHandle, this.features + features, scope) + GslUIntMatrix(nativeHandleChecked(), this.features + features, scope) - override operator fun get(i: Int, j: Int): UInt = gsl_matrix_uint_get(nativeHandle, i.toULong(), j.toULong()) + override operator fun get(i: Int, j: Int): UInt = gsl_matrix_uint_get(nativeHandleChecked(), i.toULong(), j.toULong()) override operator fun set(i: Int, j: Int, value: UInt): Unit = - gsl_matrix_uint_set(nativeHandle, i.toULong(), j.toULong(), value) + gsl_matrix_uint_set(nativeHandleChecked(), i.toULong(), j.toULong(), value) override fun copy(): GslUIntMatrix { val new = requireNotNull(gsl_matrix_uint_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_uint_memcpy(new, nativeHandle) + gsl_matrix_uint_memcpy(new, nativeHandleChecked()) return GslUIntMatrix(new, features, scope) } - override fun close(): Unit = gsl_matrix_uint_free(nativeHandle) + override fun close(): Unit = gsl_matrix_uint_free(nativeHandleChecked()) override fun equals(other: Any?): Boolean { - if (other is GslUIntMatrix) return gsl_matrix_uint_equal(nativeHandle, other.nativeHandle) == 1 + if (other is GslUIntMatrix) return gsl_matrix_uint_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 return super.equals(other) } } diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt index de2da97da..fb64773bd 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt @@ -6,176 +6,176 @@ import org.gnu.gsl.* internal class GslRealVector(override val nativeHandle: CPointer, scope: DeferScope) : GslVector(scope) { override val size: Int - get() = nativeHandle.pointed.size.toInt() + get() = nativeHandleChecked().pointed.size.toInt() - override fun get(index: Int): Double = gsl_vector_get(nativeHandle, index.toULong()) - override fun set(index: Int, value: Double): Unit = gsl_vector_set(nativeHandle, index.toULong(), value) + override fun get(index: Int): Double = gsl_vector_get(nativeHandleChecked(), index.toULong()) + override fun set(index: Int, value: Double): Unit = gsl_vector_set(nativeHandleChecked(), index.toULong(), value) override fun copy(): GslRealVector { val new = requireNotNull(gsl_vector_alloc(size.toULong())) - gsl_vector_memcpy(new, nativeHandle) + gsl_vector_memcpy(new, nativeHandleChecked()) return GslRealVector(new, scope) } override fun equals(other: Any?): Boolean { - if (other is GslRealVector) return gsl_vector_equal(nativeHandle, other.nativeHandle) == 1 + if (other is GslRealVector) return gsl_vector_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 return super.equals(other) } - override fun close(): Unit = gsl_vector_free(nativeHandle) + override fun close(): Unit = gsl_vector_free(nativeHandleChecked()) } internal class GslFloatVector(override val nativeHandle: CPointer, scope: DeferScope) : GslVector(scope) { override val size: Int - get() = nativeHandle.pointed.size.toInt() + get() = nativeHandleChecked().pointed.size.toInt() - override fun get(index: Int): Float = gsl_vector_float_get(nativeHandle, index.toULong()) - override fun set(index: Int, value: Float): Unit = gsl_vector_float_set(nativeHandle, index.toULong(), value) + override fun get(index: Int): Float = gsl_vector_float_get(nativeHandleChecked(), index.toULong()) + override fun set(index: Int, value: Float): Unit = gsl_vector_float_set(nativeHandleChecked(), index.toULong(), value) override fun copy(): GslFloatVector { val new = requireNotNull(gsl_vector_float_alloc(size.toULong())) - gsl_vector_float_memcpy(new, nativeHandle) + gsl_vector_float_memcpy(new, nativeHandleChecked()) return GslFloatVector(new, scope) } override fun equals(other: Any?): Boolean { - if (other is GslFloatVector) return gsl_vector_float_equal(nativeHandle, other.nativeHandle) == 1 + if (other is GslFloatVector) return gsl_vector_float_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 return super.equals(other) } - override fun close(): Unit = gsl_vector_float_free(nativeHandle) + override fun close(): Unit = gsl_vector_float_free(nativeHandleChecked()) } internal class GslShortVector(override val nativeHandle: CPointer, scope: DeferScope) : GslVector(scope) { override val size: Int - get() = nativeHandle.pointed.size.toInt() + get() = nativeHandleChecked().pointed.size.toInt() - override fun get(index: Int): Short = gsl_vector_short_get(nativeHandle, index.toULong()) - override fun set(index: Int, value: Short): Unit = gsl_vector_short_set(nativeHandle, index.toULong(), value) + override fun get(index: Int): Short = gsl_vector_short_get(nativeHandleChecked(), index.toULong()) + override fun set(index: Int, value: Short): Unit = gsl_vector_short_set(nativeHandleChecked(), index.toULong(), value) override fun copy(): GslShortVector { val new = requireNotNull(gsl_vector_short_alloc(size.toULong())) - gsl_vector_short_memcpy(new, nativeHandle) + gsl_vector_short_memcpy(new, nativeHandleChecked()) return GslShortVector(new, scope) } override fun equals(other: Any?): Boolean { - if (other is GslShortVector) return gsl_vector_short_equal(nativeHandle, other.nativeHandle) == 1 + if (other is GslShortVector) return gsl_vector_short_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 return super.equals(other) } - override fun close(): Unit = gsl_vector_short_free(nativeHandle) + override fun close(): Unit = gsl_vector_short_free(nativeHandleChecked()) } internal class GslUShortVector(override val nativeHandle: CPointer, scope: DeferScope) : GslVector(scope) { override val size: Int - get() = nativeHandle.pointed.size.toInt() + get() = nativeHandleChecked().pointed.size.toInt() - override fun get(index: Int): UShort = gsl_vector_ushort_get(nativeHandle, index.toULong()) - override fun set(index: Int, value: UShort): Unit = gsl_vector_ushort_set(nativeHandle, index.toULong(), value) + override fun get(index: Int): UShort = gsl_vector_ushort_get(nativeHandleChecked(), index.toULong()) + override fun set(index: Int, value: UShort): Unit = gsl_vector_ushort_set(nativeHandleChecked(), index.toULong(), value) override fun copy(): GslUShortVector { val new = requireNotNull(gsl_vector_ushort_alloc(size.toULong())) - gsl_vector_ushort_memcpy(new, nativeHandle) + gsl_vector_ushort_memcpy(new, nativeHandleChecked()) return GslUShortVector(new, scope) } override fun equals(other: Any?): Boolean { - if (other is GslUShortVector) return gsl_vector_ushort_equal(nativeHandle, other.nativeHandle) == 1 + if (other is GslUShortVector) return gsl_vector_ushort_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 return super.equals(other) } - override fun close(): Unit = gsl_vector_ushort_free(nativeHandle) + override fun close(): Unit = gsl_vector_ushort_free(nativeHandleChecked()) } internal class GslLongVector(override val nativeHandle: CPointer, scope: DeferScope) : GslVector(scope) { override val size: Int - get() = nativeHandle.pointed.size.toInt() + get() = nativeHandleChecked().pointed.size.toInt() - override fun get(index: Int): Long = gsl_vector_long_get(nativeHandle, index.toULong()) - override fun set(index: Int, value: Long): Unit = gsl_vector_long_set(nativeHandle, index.toULong(), value) + override fun get(index: Int): Long = gsl_vector_long_get(nativeHandleChecked(), index.toULong()) + override fun set(index: Int, value: Long): Unit = gsl_vector_long_set(nativeHandleChecked(), index.toULong(), value) override fun copy(): GslLongVector { val new = requireNotNull(gsl_vector_long_alloc(size.toULong())) - gsl_vector_long_memcpy(new, nativeHandle) + gsl_vector_long_memcpy(new, nativeHandleChecked()) return GslLongVector(new, scope) } override fun equals(other: Any?): Boolean { - if (other is GslLongVector) return gsl_vector_long_equal(nativeHandle, other.nativeHandle) == 1 + if (other is GslLongVector) return gsl_vector_long_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 return super.equals(other) } - override fun close(): Unit = gsl_vector_long_free(nativeHandle) + override fun close(): Unit = gsl_vector_long_free(nativeHandleChecked()) } internal class GslULongVector(override val nativeHandle: CPointer, scope: DeferScope) : GslVector(scope) { override val size: Int - get() = nativeHandle.pointed.size.toInt() + get() = nativeHandleChecked().pointed.size.toInt() - override fun get(index: Int): ULong = gsl_vector_ulong_get(nativeHandle, index.toULong()) - override fun set(index: Int, value: ULong): Unit = gsl_vector_ulong_set(nativeHandle, index.toULong(), value) + override fun get(index: Int): ULong = gsl_vector_ulong_get(nativeHandleChecked(), index.toULong()) + override fun set(index: Int, value: ULong): Unit = gsl_vector_ulong_set(nativeHandleChecked(), index.toULong(), value) override fun copy(): GslULongVector { val new = requireNotNull(gsl_vector_ulong_alloc(size.toULong())) - gsl_vector_ulong_memcpy(new, nativeHandle) + gsl_vector_ulong_memcpy(new, nativeHandleChecked()) return GslULongVector(new, scope) } override fun equals(other: Any?): Boolean { - if (other is GslULongVector) return gsl_vector_ulong_equal(nativeHandle, other.nativeHandle) == 1 + if (other is GslULongVector) return gsl_vector_ulong_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 return super.equals(other) } - override fun close(): Unit = gsl_vector_ulong_free(nativeHandle) + override fun close(): Unit = gsl_vector_ulong_free(nativeHandleChecked()) } internal class GslIntVector(override val nativeHandle: CPointer, scope: DeferScope) : GslVector(scope) { override val size: Int - get() = nativeHandle.pointed.size.toInt() + get() = nativeHandleChecked().pointed.size.toInt() - override fun get(index: Int): Int = gsl_vector_int_get(nativeHandle, index.toULong()) - override fun set(index: Int, value: Int): Unit = gsl_vector_int_set(nativeHandle, index.toULong(), value) + override fun get(index: Int): Int = gsl_vector_int_get(nativeHandleChecked(), index.toULong()) + override fun set(index: Int, value: Int): Unit = gsl_vector_int_set(nativeHandleChecked(), index.toULong(), value) override fun copy(): GslIntVector { val new = requireNotNull(gsl_vector_int_alloc(size.toULong())) - gsl_vector_int_memcpy(new, nativeHandle) + gsl_vector_int_memcpy(new, nativeHandleChecked()) return GslIntVector(new, scope) } override fun equals(other: Any?): Boolean { - if (other is GslIntVector) return gsl_vector_int_equal(nativeHandle, other.nativeHandle) == 1 + if (other is GslIntVector) return gsl_vector_int_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 return super.equals(other) } - override fun close(): Unit = gsl_vector_int_free(nativeHandle) + override fun close(): Unit = gsl_vector_int_free(nativeHandleChecked()) } internal class GslUIntVector(override val nativeHandle: CPointer, scope: DeferScope) : GslVector(scope) { override val size: Int - get() = nativeHandle.pointed.size.toInt() + get() = nativeHandleChecked().pointed.size.toInt() - override fun get(index: Int): UInt = gsl_vector_uint_get(nativeHandle, index.toULong()) - override fun set(index: Int, value: UInt): Unit = gsl_vector_uint_set(nativeHandle, index.toULong(), value) + override fun get(index: Int): UInt = gsl_vector_uint_get(nativeHandleChecked(), index.toULong()) + override fun set(index: Int, value: UInt): Unit = gsl_vector_uint_set(nativeHandleChecked(), index.toULong(), value) override fun copy(): GslUIntVector { val new = requireNotNull(gsl_vector_uint_alloc(size.toULong())) - gsl_vector_uint_memcpy(new, nativeHandle) + gsl_vector_uint_memcpy(new, nativeHandleChecked()) return GslUIntVector(new, scope) } override fun equals(other: Any?): Boolean { - if (other is GslUIntVector) return gsl_vector_uint_equal(nativeHandle, other.nativeHandle) == 1 + if (other is GslUIntVector) return gsl_vector_uint_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 return super.equals(other) } - override fun close(): Unit = gsl_vector_uint_free(nativeHandle) + override fun close(): Unit = gsl_vector_uint_free(nativeHandleChecked()) } diff --git a/kmath-gsl/src/nativeTest/kotlin/ErrorHandler.kt b/kmath-gsl/src/nativeTest/kotlin/ErrorsHandlingTest.kt similarity index 50% rename from kmath-gsl/src/nativeTest/kotlin/ErrorHandler.kt rename to kmath-gsl/src/nativeTest/kotlin/ErrorsHandlingTest.kt index 0d8fbfbea..7d97eca85 100644 --- a/kmath-gsl/src/nativeTest/kotlin/ErrorHandler.kt +++ b/kmath-gsl/src/nativeTest/kotlin/ErrorsHandlingTest.kt @@ -4,7 +4,7 @@ import org.gnu.gsl.gsl_block_calloc import kotlin.test.Test import kotlin.test.assertFailsWith -internal class ErrorHandler { +internal class ErrorsHandlingTest { @Test fun blockAllocation() { assertFailsWith { @@ -19,4 +19,14 @@ internal class ErrorHandler { GslRealMatrixContext { produce(Int.MAX_VALUE, Int.MAX_VALUE) { _, _ -> 0.0 } } } } + + @Test + fun useOfClosedObject() { + val mat = GslRealMatrixContext { produce(1, 1) { _, _ -> 0.0 } } + assertFailsWith { mat.colNum } + assertFailsWith { mat.rowNum } + assertFailsWith { mat[0, 0] } + assertFailsWith { mat.copy() } + assertFailsWith { println(mat == mat) } + } } diff --git a/kmath-gsl/src/nativeTest/kotlin/GslMatrixRealTest.kt b/kmath-gsl/src/nativeTest/kotlin/GslMatrixRealTest.kt index b4ea4adb2..b4b446462 100644 --- a/kmath-gsl/src/nativeTest/kotlin/GslMatrixRealTest.kt +++ b/kmath-gsl/src/nativeTest/kotlin/GslMatrixRealTest.kt @@ -1,5 +1,9 @@ package kscience.kmath.gsl +import kscience.kmath.linear.RealMatrixContext +import kscience.kmath.operations.invoke +import kscience.kmath.structures.Matrix +import kotlin.random.Random import kotlin.test.Test import kotlin.test.assertEquals @@ -16,4 +20,23 @@ internal class GslMatrixRealTest { val mat = produce(1, 1) { _, _ -> 42.0 } assertEquals(42.0, mat[0, 0]) } + + @Test + fun copy() = GslRealMatrixContext { + val mat = produce(1, 1) { _, _ -> 42.0 } + assertEquals(mat, mat.copy()) + } + + @Test + fun equals() = GslRealMatrixContext { + var rng = Random(0) + val mat: Matrix = produce(2, 2) { _, _ -> rng.nextDouble() } + rng = Random(0) + val mat2: Matrix = RealMatrixContext { produce(2, 2) { _, _ -> rng.nextDouble() } } + rng = Random(0) + val mat3: Matrix = produce(2, 2) { _, _ -> rng.nextDouble() } + assertEquals(mat, mat2) + assertEquals(mat, mat3) + assertEquals(mat2, mat3) + } } diff --git a/kmath-gsl/src/nativeTest/kotlin/GslRealContextTest.kt b/kmath-gsl/src/nativeTest/kotlin/GslRealMatrixContextTest.kt similarity index 86% rename from kmath-gsl/src/nativeTest/kotlin/GslRealContextTest.kt rename to kmath-gsl/src/nativeTest/kotlin/GslRealMatrixContextTest.kt index 9ee543a13..c73cb2775 100644 --- a/kmath-gsl/src/nativeTest/kotlin/GslRealContextTest.kt +++ b/kmath-gsl/src/nativeTest/kotlin/GslRealMatrixContextTest.kt @@ -3,7 +3,6 @@ package kscience.kmath.gsl import kscience.kmath.linear.RealMatrixContext import kscience.kmath.operations.invoke import kscience.kmath.structures.Matrix -import kscience.kmath.structures.NDStructure import kscience.kmath.structures.RealBuffer import kscience.kmath.structures.asSequence import kotlin.random.Random @@ -12,11 +11,11 @@ import kotlin.test.assertEquals import kotlin.test.assertTrue import kotlin.time.measureTime -internal class GslRealContextTest { +internal class GslRealMatrixContextTest { @Test fun testScale() = GslRealMatrixContext { val ma = produce(10, 10) { _, _ -> 0.1 } - val mb = (ma * 20.0) + val mb = ma * 20.0 assertEquals(mb[0, 1], 2.0) } @@ -42,7 +41,7 @@ internal class GslRealContextTest { @Test fun testManyCalls() = GslRealMatrixContext { - val expected = RealMatrixContext { + val expected: Matrix = RealMatrixContext { val rng = Random(0) var prod = produce(20, 20) { _, _ -> rng.nextDouble() } val mult = produce(20, 20) { _, _ -> rng.nextDouble() } @@ -51,9 +50,9 @@ internal class GslRealContextTest { } val rng = Random(0) - var prod = produce(20, 20) { _, _ -> rng.nextDouble() } + var prod: Matrix = produce(20, 20) { _, _ -> rng.nextDouble() } val mult = produce(20, 20) { _, _ -> rng.nextDouble() } measureTime { repeat(100) { prod = prod dot mult } }.also(::println) - assertTrue(NDStructure.equals(expected, prod)) + assertEquals(expected, prod) } } From a86987362bd6835ee9e8a75e78d5f4a287d369e5 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 7 Jan 2021 17:34:55 +0700 Subject: [PATCH 51/76] Fix access for Complex GSL wrappers --- .../kotlin/kscience/kmath/gsl/GslComplex.kt | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt index 582b1da57..6706bc535 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt @@ -18,32 +18,32 @@ internal class GslComplexMatrix( scope: DeferScope ) : GslMatrix(scope) { override val rowNum: Int - get() = nativeHandle.pointed.size1.toInt() + get() = nativeHandleChecked().pointed.size1.toInt() override val colNum: Int - get() = nativeHandle.pointed.size2.toInt() + get() = nativeHandleChecked().pointed.size2.toInt() override val features: Set = features override fun suggestFeature(vararg features: MatrixFeature): GslComplexMatrix = - GslComplexMatrix(nativeHandle, this.features + features, scope) + GslComplexMatrix(nativeHandleChecked(), this.features + features, scope) override operator fun get(i: Int, j: Int): Complex = - gsl_matrix_complex_get(nativeHandle, i.toULong(), j.toULong()).toKMath() + gsl_matrix_complex_get(nativeHandleChecked(), i.toULong(), j.toULong()).toKMath() override operator fun set(i: Int, j: Int, value: Complex): Unit = - gsl_matrix_complex_set(nativeHandle, i.toULong(), j.toULong(), value.toGsl()) + gsl_matrix_complex_set(nativeHandleChecked(), i.toULong(), j.toULong(), value.toGsl()) override fun copy(): GslComplexMatrix { val new = requireNotNull(gsl_matrix_complex_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_complex_memcpy(new, nativeHandle) + gsl_matrix_complex_memcpy(new, nativeHandleChecked()) return GslComplexMatrix(new, features, scope) } - override fun close(): Unit = gsl_matrix_complex_free(nativeHandle) + override fun close(): Unit = gsl_matrix_complex_free(nativeHandleChecked()) override fun equals(other: Any?): Boolean { - if (other is GslComplexMatrix) return gsl_matrix_complex_equal(nativeHandle, other.nativeHandle) == 1 + if (other is GslComplexMatrix) return gsl_matrix_complex_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 return super.equals(other) } } @@ -51,23 +51,23 @@ internal class GslComplexMatrix( internal class GslComplexVector(override val nativeHandle: CPointer, scope: DeferScope) : GslVector(scope) { override val size: Int - get() = nativeHandle.pointed.size.toInt() + get() = nativeHandleChecked().pointed.size.toInt() - override fun get(index: Int): Complex = gsl_vector_complex_get(nativeHandle, index.toULong()).toKMath() + override fun get(index: Int): Complex = gsl_vector_complex_get(nativeHandleChecked(), index.toULong()).toKMath() override fun set(index: Int, value: Complex): Unit = - gsl_vector_complex_set(nativeHandle, index.toULong(), value.toGsl()) + gsl_vector_complex_set(nativeHandleChecked(), index.toULong(), value.toGsl()) override fun copy(): GslComplexVector { val new = requireNotNull(gsl_vector_complex_alloc(size.toULong())) - gsl_vector_complex_memcpy(new, nativeHandle) + gsl_vector_complex_memcpy(new, nativeHandleChecked()) return GslComplexVector(new, scope) } override fun equals(other: Any?): Boolean { - if (other is GslComplexVector) return gsl_vector_complex_equal(nativeHandle, other.nativeHandle) == 1 + if (other is GslComplexVector) return gsl_vector_complex_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 return super.equals(other) } - override fun close(): Unit = gsl_vector_complex_free(nativeHandle) + override fun close(): Unit = gsl_vector_complex_free(nativeHandleChecked()) } From f7fc327e8c72cb6eb05665ad2f694a23f45388ee Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 7 Jan 2021 18:28:51 +0700 Subject: [PATCH 52/76] Reformat generated APIs --- .../kmath/gsl/codegen/matricesCodegen.kt | 9 +-- .../kmath/gsl/codegen/vectorsCodegen.kt | 4 +- .../kotlin/kscience/kmath/gsl/GslComplex.kt | 10 +++- .../kotlin/kscience/kmath/gsl/_Matrices.kt | 56 +++++++++++++------ .../kotlin/kscience/kmath/gsl/_Vectors.kt | 32 ++++++++--- 5 files changed, 79 insertions(+), 32 deletions(-) diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt index 84391181c..668ecb625 100644 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt @@ -33,9 +33,8 @@ private fun KtPsiFactory.createMatrixClass( override fun suggestFeature(vararg features: MatrixFeature): $className = ${className}(nativeHandleChecked(), this.features + features, scope) - override operator fun get(i: Int, j: Int): $kotlinTypeName = ${ - fn("gsl_matrixRget", cTypeName) - }(nativeHandleChecked(), i.toULong(), j.toULong()) + override operator fun get(i: Int, j: Int): $kotlinTypeName = + ${fn("gsl_matrixRget", cTypeName)}(nativeHandleChecked(), i.toULong(), j.toULong()) override operator fun set(i: Int, j: Int, value: ${kotlinTypeName}): Unit = ${fn("gsl_matrixRset", cTypeName)}(nativeHandleChecked(), i.toULong(), j.toULong(), value) @@ -49,9 +48,11 @@ private fun KtPsiFactory.createMatrixClass( override fun close(): Unit = ${fn("gsl_matrixRfree", cTypeName)}(nativeHandleChecked()) override fun equals(other: Any?): Boolean { - if (other is $className) return ${ + if (other is $className) + return ${ fn("gsl_matrixRequal", cTypeName) }(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return super.equals(other) } }""" diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt index 2139489d1..4a903d9a7 100644 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt @@ -38,10 +38,12 @@ private fun KtPsiFactory.createVectorClass( } override fun equals(other: Any?): Boolean { - if (other is $className) return ${ + if (other is $className) + return ${ fn("gsl_vectorRequal", cTypeName) }(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return super.equals(other) } diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt index 6706bc535..3041ad718 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt @@ -15,7 +15,7 @@ internal fun Complex.toGsl(): CValue = cValue { internal class GslComplexMatrix( override val nativeHandle: CPointer, features: Set = emptySet(), - scope: DeferScope + scope: DeferScope, ) : GslMatrix(scope) { override val rowNum: Int get() = nativeHandleChecked().pointed.size1.toInt() @@ -43,7 +43,9 @@ internal class GslComplexMatrix( override fun close(): Unit = gsl_matrix_complex_free(nativeHandleChecked()) override fun equals(other: Any?): Boolean { - if (other is GslComplexMatrix) return gsl_matrix_complex_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + if (other is GslComplexMatrix) + return gsl_matrix_complex_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return super.equals(other) } } @@ -65,7 +67,9 @@ internal class GslComplexVector(override val nativeHandle: CPointer, sc } override fun equals(other: Any?): Boolean { - if (other is GslRealVector) return gsl_vector_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + if (other is GslRealVector) + return gsl_vector_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return super.equals(other) } @@ -40,7 +42,9 @@ internal class GslFloatVector(override val nativeHandle: CPointer, } override fun equals(other: Any?): Boolean { - if (other is GslIntVector) return gsl_vector_int_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + if (other is GslIntVector) + return gsl_vector_int_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return super.equals(other) } @@ -172,7 +186,9 @@ internal class GslUIntVector(override val nativeHandle: CPointer Date: Thu, 7 Jan 2021 18:38:52 +0700 Subject: [PATCH 53/76] Reformat generated GslVector APIs --- .../kmath/gsl/codegen/vectorsCodegen.kt | 12 ++-- .../kotlin/kscience/kmath/gsl/_Vectors.kt | 56 +++++++++++++------ 2 files changed, 45 insertions(+), 23 deletions(-) diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt index 4a903d9a7..87acd258c 100644 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt @@ -23,13 +23,11 @@ private fun KtPsiFactory.createVectorClass( override val size: Int get() = nativeHandleChecked().pointed.size.toInt() - override fun get(index: Int): $kotlinTypeName = ${ - fn("gsl_vectorRget", - cTypeName) - }(nativeHandleChecked(), index.toULong()) - override fun set(index: Int, value: $kotlinTypeName): Unit = ${ - fn("gsl_vectorRset", cTypeName) - }(nativeHandleChecked(), index.toULong(), value) + override operator fun get(index: Int): $kotlinTypeName = + ${fn("gsl_vectorRget", cTypeName)}(nativeHandleChecked(), index.toULong()) + + override operator fun set(index: Int, value: $kotlinTypeName): Unit = + ${fn("gsl_vectorRset", cTypeName)}(nativeHandleChecked(), index.toULong(), value) override fun copy(): $className { val new = requireNotNull(${fn("gsl_vectorRalloc", cTypeName)}(size.toULong())) diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt index 43c21fb04..d7ed4718b 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt @@ -8,8 +8,11 @@ internal class GslRealVector(override val nativeHandle: CPointer, sc override val size: Int get() = nativeHandleChecked().pointed.size.toInt() - override fun get(index: Int): Double = gsl_vector_get(nativeHandleChecked(), index.toULong()) - override fun set(index: Int, value: Double): Unit = gsl_vector_set(nativeHandleChecked(), index.toULong(), value) + override operator fun get(index: Int): Double = + gsl_vector_get(nativeHandleChecked(), index.toULong()) + + override operator fun set(index: Int, value: Double): Unit = + gsl_vector_set(nativeHandleChecked(), index.toULong(), value) override fun copy(): GslRealVector { val new = requireNotNull(gsl_vector_alloc(size.toULong())) @@ -32,8 +35,11 @@ internal class GslFloatVector(override val nativeHandle: CPointer, override val size: Int get() = nativeHandleChecked().pointed.size.toInt() - override fun get(index: Int): Int = gsl_vector_int_get(nativeHandleChecked(), index.toULong()) - override fun set(index: Int, value: Int): Unit = gsl_vector_int_set(nativeHandleChecked(), index.toULong(), value) + override operator fun get(index: Int): Int = + gsl_vector_int_get(nativeHandleChecked(), index.toULong()) + + override operator fun set(index: Int, value: Int): Unit = + gsl_vector_int_set(nativeHandleChecked(), index.toULong(), value) override fun copy(): GslIntVector { val new = requireNotNull(gsl_vector_int_alloc(size.toULong())) @@ -176,8 +197,11 @@ internal class GslUIntVector(override val nativeHandle: CPointer Date: Thu, 7 Jan 2021 19:38:46 +0700 Subject: [PATCH 54/76] Disable OSX temporarily --- kmath-gsl/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index df1e635be..df405326f 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -11,7 +11,7 @@ kotlin { explicitApiWarning() val nativeTarget = when (System.getProperty("os.name")) { - "Mac OS X" -> macosX64() +// "Mac OS X" -> macosX64() "Linux" -> linuxX64() else -> { From de289afb7ba63e61911ed2ce27ec88eed57be3de Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Fri, 15 Jan 2021 23:01:35 +0700 Subject: [PATCH 55/76] Override point function in GslMatrixContext --- .../nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt index 1df21c4b1..2b0412752 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt @@ -51,6 +51,9 @@ public abstract class GslMatrixContext T): GslMatrix = produceDirtyMatrix(rows, columns).fill(initializer) + + public override fun point(size: Int, initializer: (Int) -> T): Point = + produceDirtyVector(size).fill(initializer) } /** From 1a7bd761524b07179bd937816f7a6d65f55b94ff Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Tue, 19 Jan 2021 20:23:11 +0700 Subject: [PATCH 56/76] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e542d210c..b8ba3773c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ - Coroutine-deterministic Monte-Carlo scope with a random number generator. - Some minor utilities to `kmath-for-real`. - Generic operation result parameter to `MatrixContext` +- Integration with GNU Scientific Library with `kmath-gsl` for Kotlin/Native Linux x64 target. ### Changed - Package changed from `scientifik` to `kscience.kmath`. From d17dbd365c5bf77f76d0c40ebd3850ddf92ce90d Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Wed, 20 Jan 2021 01:03:55 +0700 Subject: [PATCH 57/76] Fix issues related to merge --- .../kmath/gsl/codegen/matricesCodegen.kt | 8 +-- kmath-gsl/build.gradle.kts | 10 +-- .../src/nativeInterop/cinterop/libgsl.def | 2 +- .../kotlin/kscience/kmath/gsl/GslComplex.kt | 15 +---- .../kotlin/kscience/kmath/gsl/GslMatrix.kt | 5 +- .../kscience/kmath/gsl/GslMatrixContext.kt | 64 ++++++++++++------- .../kotlin/kscience/kmath/gsl/_Matrices.kt | 64 +++---------------- 7 files changed, 60 insertions(+), 108 deletions(-) diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt index 668ecb625..0dd880f7b 100644 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt @@ -19,7 +19,6 @@ private fun KtPsiFactory.createMatrixClass( @Language("kotlin") val text = """internal class $className( override val nativeHandle: CPointer<$structName>, - features: Set = emptySet(), scope: DeferScope ) : GslMatrix<$kotlinTypeName, $structName>(scope) { override val rowNum: Int @@ -28,11 +27,6 @@ private fun KtPsiFactory.createMatrixClass( override val colNum: Int get() = nativeHandleChecked().pointed.size2.toInt() - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): $className = - ${className}(nativeHandleChecked(), this.features + features, scope) - override operator fun get(i: Int, j: Int): $kotlinTypeName = ${fn("gsl_matrixRget", cTypeName)}(nativeHandleChecked(), i.toULong(), j.toULong()) @@ -42,7 +36,7 @@ private fun KtPsiFactory.createMatrixClass( override fun copy(): $className { val new = requireNotNull(${fn("gsl_matrixRalloc", cTypeName)}(rowNum.toULong(), colNum.toULong())) ${fn("gsl_matrixRmemcpy", cTypeName)}(new, nativeHandleChecked()) - return $className(new, features, scope) + return $className(new, scope) } override fun close(): Unit = ${fn("gsl_matrixRfree", cTypeName)}(nativeHandleChecked()) diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index df405326f..83859130c 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -12,7 +12,7 @@ kotlin { val nativeTarget = when (System.getProperty("os.name")) { // "Mac OS X" -> macosX64() - "Linux" -> linuxX64() + "Linux" -> linuxX64("native") else -> { logger.warn("Current OS cannot build any of kmath-gsl targets.") @@ -29,7 +29,7 @@ kotlin { val test by nativeTarget.compilations.getting sourceSets { - val nativeMain by creating { + val nativeMain by getting { val codegen by tasks.creating { matricesCodegen(kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Matrices.kt") vectorsCodegen(kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Vectors.kt") @@ -42,11 +42,11 @@ kotlin { } } - val nativeTest by creating { + val nativeTest by getting { dependsOn(nativeMain) } - main.defaultSourceSet.dependsOn(nativeMain) - test.defaultSourceSet.dependsOn(nativeTest) +// main.defaultSourceSet.dependsOn(nativeMain) +// test.defaultSourceSet.dependsOn(nativeTest) } } diff --git a/kmath-gsl/src/nativeInterop/cinterop/libgsl.def b/kmath-gsl/src/nativeInterop/cinterop/libgsl.def index 23ceebf02..bd3a861f0 100644 --- a/kmath-gsl/src/nativeInterop/cinterop/libgsl.def +++ b/kmath-gsl/src/nativeInterop/cinterop/libgsl.def @@ -1,5 +1,5 @@ package=org.gnu.gsl -headers=gsl/gsl_blas.h +headers=gsl/gsl_blas.h gsl/gsl_linalg.h compilerOpts.linux=-I/usr/include compilerOpts.osx=-I/usr/local -I/usr/local/include linkerOpts.linux=-L/usr/lib64 -L/usr/lib/x86_64-linux-gnu -lgsl diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt index 3041ad718..0233ed8bc 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt @@ -1,7 +1,6 @@ package kscience.kmath.gsl import kotlinx.cinterop.* -import kscience.kmath.linear.MatrixFeature import kscience.kmath.operations.Complex import org.gnu.gsl.* @@ -12,22 +11,14 @@ internal fun Complex.toGsl(): CValue = cValue { dat[1] = im } -internal class GslComplexMatrix( - override val nativeHandle: CPointer, - features: Set = emptySet(), - scope: DeferScope, -) : GslMatrix(scope) { +internal class GslComplexMatrix(override val nativeHandle: CPointer, scope: DeferScope) : + GslMatrix(scope) { override val rowNum: Int get() = nativeHandleChecked().pointed.size1.toInt() override val colNum: Int get() = nativeHandleChecked().pointed.size2.toInt() - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslComplexMatrix = - GslComplexMatrix(nativeHandleChecked(), this.features + features, scope) - override operator fun get(i: Int, j: Int): Complex = gsl_matrix_complex_get(nativeHandleChecked(), i.toULong(), j.toULong()).toKMath() @@ -37,7 +28,7 @@ internal class GslComplexMatrix( override fun copy(): GslComplexMatrix { val new = requireNotNull(gsl_matrix_complex_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_complex_memcpy(new, nativeHandleChecked()) - return GslComplexMatrix(new, features, scope) + return GslComplexMatrix(new, scope) } override fun close(): Unit = gsl_matrix_complex_free(nativeHandleChecked()) diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt index e08c0c0d1..13283946e 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt @@ -2,15 +2,14 @@ package kscience.kmath.gsl import kotlinx.cinterop.CStructVar import kotlinx.cinterop.DeferScope -import kscience.kmath.linear.FeaturedMatrix +import kscience.kmath.structures.Matrix import kscience.kmath.structures.NDStructure /** * Wraps gsl_matrix_* objects from GSL. */ public abstract class GslMatrix internal constructor(scope: DeferScope) : - GslMemoryHolder(scope), - FeaturedMatrix { + GslMemoryHolder(scope), Matrix { internal abstract operator fun set(i: Int, j: Int, value: T) internal abstract fun copy(): GslMatrix diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt index 2b0412752..95437c8c7 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt @@ -34,10 +34,10 @@ public abstract class GslMatrixContext.toGsl(): GslMatrix = (if (this is GslMatrix<*, *>) + public fun Matrix.toGsl(): GslMatrix = if (this is GslMatrix<*, *>) this as GslMatrix else - produce(rowNum, colNum) { i, j -> this[i, j] }).copy() + produce(rowNum, colNum) { i, j -> this[i, j] } /** * Converts this point to GSL one. @@ -61,10 +61,7 @@ public abstract class GslMatrixContext(scope) { override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = - GslRealMatrix( - nativeHandle = requireNotNull(gsl_matrix_alloc(rows.toULong(), columns.toULong())), - scope = scope - ) + GslRealMatrix(nativeHandle = requireNotNull(gsl_matrix_alloc(rows.toULong(), columns.toULong())), scope = scope) override fun produceDirtyVector(size: Int): GslVector = GslRealVector(nativeHandle = requireNotNull(gsl_vector_alloc(size.toULong())), scope = scope) @@ -86,22 +83,28 @@ public class GslRealMatrixContext(scope: DeferScope) : GslMatrixContext.times(value: Double): GslMatrix { - val g1 = toGsl() + val g1 = toGsl().copy() gsl_matrix_scale(g1.nativeHandle, value) return g1 } public override fun add(a: Matrix, b: Matrix): GslMatrix { - val g1 = a.toGsl() + val g1 = a.toGsl().copy() gsl_matrix_add(g1.nativeHandle, b.toGsl().nativeHandle) return g1 } public override fun multiply(a: Matrix, k: Number): GslMatrix { - val g1 = a.toGsl() + val g1 = a.toGsl().copy() gsl_matrix_scale(g1.nativeHandle, k.toDouble()) return g1 } + + public override fun Matrix.minus(b: Matrix): Matrix { + val g1 = toGsl().copy() + gsl_matrix_sub(g1.nativeHandle, b.toGsl().nativeHandle) + return g1 + } } /** @@ -115,11 +118,13 @@ public fun GslRealMatrixContext(block: GslRealMatrixContext.() -> R): R = */ public class GslFloatMatrixContext(scope: DeferScope) : GslMatrixContext(scope) { - override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = - GslFloatMatrix(requireNotNull(gsl_matrix_float_alloc(rows.toULong(), columns.toULong())), scope = scope) + override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = GslFloatMatrix( + nativeHandle = requireNotNull(gsl_matrix_float_alloc(rows.toULong(), columns.toULong())), + scope = scope, + ) override fun produceDirtyVector(size: Int): GslVector = - GslFloatVector(requireNotNull(gsl_vector_float_alloc(size.toULong())), scope) + GslFloatVector(nativeHandle = requireNotNull(value = gsl_vector_float_alloc(size.toULong())), scope = scope) public override fun Matrix.dot(other: Matrix): GslMatrix { val x = toGsl().nativeHandle @@ -138,22 +143,28 @@ public class GslFloatMatrixContext(scope: DeferScope) : } public override fun Matrix.times(value: Float): GslMatrix { - val g1 = toGsl() + val g1 = toGsl().copy() gsl_matrix_float_scale(g1.nativeHandle, value.toDouble()) return g1 } public override fun add(a: Matrix, b: Matrix): GslMatrix { - val g1 = a.toGsl() + val g1 = a.toGsl().copy() gsl_matrix_float_add(g1.nativeHandle, b.toGsl().nativeHandle) return g1 } public override fun multiply(a: Matrix, k: Number): GslMatrix { - val g1 = a.toGsl() + val g1 = a.toGsl().copy() gsl_matrix_float_scale(g1.nativeHandle, k.toDouble()) return g1 } + + public override fun Matrix.minus(b: Matrix): Matrix { + val g1 = toGsl().copy() + gsl_matrix_float_sub(g1.nativeHandle, b.toGsl().nativeHandle) + return g1 + } } /** @@ -167,14 +178,13 @@ public fun GslFloatMatrixContext(block: GslFloatMatrixContext.() -> R): R = */ public class GslComplexMatrixContext(scope: DeferScope) : GslMatrixContext(scope) { - override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = - GslComplexMatrix( - nativeHandle = requireNotNull(gsl_matrix_complex_alloc(rows.toULong(), columns.toULong())), - scope = scope - ) + override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = GslComplexMatrix( + nativeHandle = requireNotNull(gsl_matrix_complex_alloc(rows.toULong(), columns.toULong())), + scope = scope, + ) override fun produceDirtyVector(size: Int): GslVector = - GslComplexVector(requireNotNull(gsl_vector_complex_alloc(size.toULong())), scope) + GslComplexVector(nativeHandle = requireNotNull(gsl_vector_complex_alloc(size.toULong())), scope = scope) public override fun Matrix.dot(other: Matrix): GslMatrix { val x = toGsl().nativeHandle @@ -193,22 +203,28 @@ public class GslComplexMatrixContext(scope: DeferScope) : } public override fun Matrix.times(value: Complex): GslMatrix { - val g1 = toGsl() + val g1 = toGsl().copy() gsl_matrix_complex_scale(g1.nativeHandle, value.toGsl()) return g1 } public override fun add(a: Matrix, b: Matrix): GslMatrix { - val g1 = a.toGsl() + val g1 = a.toGsl().copy() gsl_matrix_complex_add(g1.nativeHandle, b.toGsl().nativeHandle) return g1 } public override fun multiply(a: Matrix, k: Number): GslMatrix { - val g1 = a.toGsl() + val g1 = a.toGsl().copy() gsl_matrix_complex_scale(g1.nativeHandle, k.toComplex().toGsl()) return g1 } + + public override fun Matrix.minus(b: Matrix): Matrix { + val g1 = toGsl().copy() + gsl_matrix_complex_sub(g1.nativeHandle, b.toGsl().nativeHandle) + return g1 + } } /** diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt index 6219dc7b6..07bc8af79 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt @@ -6,7 +6,6 @@ import org.gnu.gsl.* internal class GslRealMatrix( override val nativeHandle: CPointer, - features: Set = emptySet(), scope: DeferScope ) : GslMatrix(scope) { override val rowNum: Int @@ -15,11 +14,6 @@ internal class GslRealMatrix( override val colNum: Int get() = nativeHandleChecked().pointed.size2.toInt() - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslRealMatrix = - GslRealMatrix(nativeHandleChecked(), this.features + features, scope) - override operator fun get(i: Int, j: Int): Double = gsl_matrix_get(nativeHandleChecked(), i.toULong(), j.toULong()) @@ -29,7 +23,7 @@ internal class GslRealMatrix( override fun copy(): GslRealMatrix { val new = requireNotNull(gsl_matrix_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_memcpy(new, nativeHandleChecked()) - return GslRealMatrix(new, features, scope) + return GslRealMatrix(new, scope) } override fun close(): Unit = gsl_matrix_free(nativeHandleChecked()) @@ -44,7 +38,6 @@ internal class GslRealMatrix( internal class GslFloatMatrix( override val nativeHandle: CPointer, - features: Set = emptySet(), scope: DeferScope ) : GslMatrix(scope) { override val rowNum: Int @@ -53,11 +46,6 @@ internal class GslFloatMatrix( override val colNum: Int get() = nativeHandleChecked().pointed.size2.toInt() - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslFloatMatrix = - GslFloatMatrix(nativeHandleChecked(), this.features + features, scope) - override operator fun get(i: Int, j: Int): Float = gsl_matrix_float_get(nativeHandleChecked(), i.toULong(), j.toULong()) @@ -67,7 +55,7 @@ internal class GslFloatMatrix( override fun copy(): GslFloatMatrix { val new = requireNotNull(gsl_matrix_float_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_float_memcpy(new, nativeHandleChecked()) - return GslFloatMatrix(new, features, scope) + return GslFloatMatrix(new, scope) } override fun close(): Unit = gsl_matrix_float_free(nativeHandleChecked()) @@ -82,7 +70,6 @@ internal class GslFloatMatrix( internal class GslShortMatrix( override val nativeHandle: CPointer, - features: Set = emptySet(), scope: DeferScope ) : GslMatrix(scope) { override val rowNum: Int @@ -91,11 +78,6 @@ internal class GslShortMatrix( override val colNum: Int get() = nativeHandleChecked().pointed.size2.toInt() - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslShortMatrix = - GslShortMatrix(nativeHandleChecked(), this.features + features, scope) - override operator fun get(i: Int, j: Int): Short = gsl_matrix_short_get(nativeHandleChecked(), i.toULong(), j.toULong()) @@ -105,7 +87,7 @@ internal class GslShortMatrix( override fun copy(): GslShortMatrix { val new = requireNotNull(gsl_matrix_short_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_short_memcpy(new, nativeHandleChecked()) - return GslShortMatrix(new, features, scope) + return GslShortMatrix(new, scope) } override fun close(): Unit = gsl_matrix_short_free(nativeHandleChecked()) @@ -120,7 +102,6 @@ internal class GslShortMatrix( internal class GslUShortMatrix( override val nativeHandle: CPointer, - features: Set = emptySet(), scope: DeferScope ) : GslMatrix(scope) { override val rowNum: Int @@ -129,11 +110,6 @@ internal class GslUShortMatrix( override val colNum: Int get() = nativeHandleChecked().pointed.size2.toInt() - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslUShortMatrix = - GslUShortMatrix(nativeHandleChecked(), this.features + features, scope) - override operator fun get(i: Int, j: Int): UShort = gsl_matrix_ushort_get(nativeHandleChecked(), i.toULong(), j.toULong()) @@ -143,7 +119,7 @@ internal class GslUShortMatrix( override fun copy(): GslUShortMatrix { val new = requireNotNull(gsl_matrix_ushort_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_ushort_memcpy(new, nativeHandleChecked()) - return GslUShortMatrix(new, features, scope) + return GslUShortMatrix(new, scope) } override fun close(): Unit = gsl_matrix_ushort_free(nativeHandleChecked()) @@ -158,7 +134,6 @@ internal class GslUShortMatrix( internal class GslLongMatrix( override val nativeHandle: CPointer, - features: Set = emptySet(), scope: DeferScope ) : GslMatrix(scope) { override val rowNum: Int @@ -167,11 +142,6 @@ internal class GslLongMatrix( override val colNum: Int get() = nativeHandleChecked().pointed.size2.toInt() - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslLongMatrix = - GslLongMatrix(nativeHandleChecked(), this.features + features, scope) - override operator fun get(i: Int, j: Int): Long = gsl_matrix_long_get(nativeHandleChecked(), i.toULong(), j.toULong()) @@ -181,7 +151,7 @@ internal class GslLongMatrix( override fun copy(): GslLongMatrix { val new = requireNotNull(gsl_matrix_long_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_long_memcpy(new, nativeHandleChecked()) - return GslLongMatrix(new, features, scope) + return GslLongMatrix(new, scope) } override fun close(): Unit = gsl_matrix_long_free(nativeHandleChecked()) @@ -196,7 +166,6 @@ internal class GslLongMatrix( internal class GslULongMatrix( override val nativeHandle: CPointer, - features: Set = emptySet(), scope: DeferScope ) : GslMatrix(scope) { override val rowNum: Int @@ -205,11 +174,6 @@ internal class GslULongMatrix( override val colNum: Int get() = nativeHandleChecked().pointed.size2.toInt() - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslULongMatrix = - GslULongMatrix(nativeHandleChecked(), this.features + features, scope) - override operator fun get(i: Int, j: Int): ULong = gsl_matrix_ulong_get(nativeHandleChecked(), i.toULong(), j.toULong()) @@ -219,7 +183,7 @@ internal class GslULongMatrix( override fun copy(): GslULongMatrix { val new = requireNotNull(gsl_matrix_ulong_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_ulong_memcpy(new, nativeHandleChecked()) - return GslULongMatrix(new, features, scope) + return GslULongMatrix(new, scope) } override fun close(): Unit = gsl_matrix_ulong_free(nativeHandleChecked()) @@ -234,7 +198,6 @@ internal class GslULongMatrix( internal class GslIntMatrix( override val nativeHandle: CPointer, - features: Set = emptySet(), scope: DeferScope ) : GslMatrix(scope) { override val rowNum: Int @@ -243,11 +206,6 @@ internal class GslIntMatrix( override val colNum: Int get() = nativeHandleChecked().pointed.size2.toInt() - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslIntMatrix = - GslIntMatrix(nativeHandleChecked(), this.features + features, scope) - override operator fun get(i: Int, j: Int): Int = gsl_matrix_int_get(nativeHandleChecked(), i.toULong(), j.toULong()) @@ -257,7 +215,7 @@ internal class GslIntMatrix( override fun copy(): GslIntMatrix { val new = requireNotNull(gsl_matrix_int_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_int_memcpy(new, nativeHandleChecked()) - return GslIntMatrix(new, features, scope) + return GslIntMatrix(new, scope) } override fun close(): Unit = gsl_matrix_int_free(nativeHandleChecked()) @@ -272,7 +230,6 @@ internal class GslIntMatrix( internal class GslUIntMatrix( override val nativeHandle: CPointer, - features: Set = emptySet(), scope: DeferScope ) : GslMatrix(scope) { override val rowNum: Int @@ -281,11 +238,6 @@ internal class GslUIntMatrix( override val colNum: Int get() = nativeHandleChecked().pointed.size2.toInt() - override val features: Set = features - - override fun suggestFeature(vararg features: MatrixFeature): GslUIntMatrix = - GslUIntMatrix(nativeHandleChecked(), this.features + features, scope) - override operator fun get(i: Int, j: Int): UInt = gsl_matrix_uint_get(nativeHandleChecked(), i.toULong(), j.toULong()) @@ -295,7 +247,7 @@ internal class GslUIntMatrix( override fun copy(): GslUIntMatrix { val new = requireNotNull(gsl_matrix_uint_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_uint_memcpy(new, nativeHandleChecked()) - return GslUIntMatrix(new, features, scope) + return GslUIntMatrix(new, scope) } override fun close(): Unit = gsl_matrix_uint_free(nativeHandleChecked()) From 54d61c016ef1b478e1ee0ba324a1ec196ee764a8 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Wed, 20 Jan 2021 16:53:12 +0700 Subject: [PATCH 58/76] Discard temporary changes --- kmath-gsl/build.gradle.kts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index 83859130c..df405326f 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -12,7 +12,7 @@ kotlin { val nativeTarget = when (System.getProperty("os.name")) { // "Mac OS X" -> macosX64() - "Linux" -> linuxX64("native") + "Linux" -> linuxX64() else -> { logger.warn("Current OS cannot build any of kmath-gsl targets.") @@ -29,7 +29,7 @@ kotlin { val test by nativeTarget.compilations.getting sourceSets { - val nativeMain by getting { + val nativeMain by creating { val codegen by tasks.creating { matricesCodegen(kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Matrices.kt") vectorsCodegen(kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Vectors.kt") @@ -42,11 +42,11 @@ kotlin { } } - val nativeTest by getting { + val nativeTest by creating { dependsOn(nativeMain) } -// main.defaultSourceSet.dependsOn(nativeMain) -// test.defaultSourceSet.dependsOn(nativeTest) + main.defaultSourceSet.dependsOn(nativeMain) + test.defaultSourceSet.dependsOn(nativeTest) } } From d9ebadd22ab0d92f8e98ed1bbec77f90ea9b4ce9 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 24 Jan 2021 01:42:20 +0700 Subject: [PATCH 59/76] Implement LUP decomposition in GSL module --- .../kmath/gsl/codegen/matricesCodegen.kt | 41 ++- .../kmath/gsl/codegen/vectorsCodegen.kt | 20 +- .../kscience/kmath/linear/MatrixContext.kt | 48 ++- .../kscience/kmath/structures/Buffers.kt | 11 + .../src/nativeInterop/cinterop/libgsl.def | 2 +- .../kotlin/kscience/kmath/gsl/GslComplex.kt | 48 ++- .../kotlin/kscience/kmath/gsl/GslMatrix.kt | 25 +- .../kscience/kmath/gsl/GslMatrixContext.kt | 163 +++++++++-- .../kscience/kmath/gsl/GslMemoryHolder.kt | 20 +- .../kotlin/kscience/kmath/gsl/GslVector.kt | 4 +- .../kotlin/kscience/kmath/gsl/_Matrices.kt | 274 +++++++++++++----- .../kotlin/kscience/kmath/gsl/_Vectors.kt | 112 +++---- .../nativeTest/kotlin/GslMatrixRealTest.kt | 20 ++ 13 files changed, 568 insertions(+), 220 deletions(-) diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt index 0dd880f7b..fd00a0255 100644 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt @@ -14,38 +14,53 @@ private fun KtPsiFactory.createMatrixClass( kotlinTypeName: String, kotlinTypeAlias: String = kotlinTypeName ) { + fun fn(pattern: String) = fn(pattern, cTypeName) val className = "Gsl${kotlinTypeAlias}Matrix" val structName = sn("gsl_matrixR", cTypeName) @Language("kotlin") val text = """internal class $className( - override val nativeHandle: CPointer<$structName>, - scope: DeferScope + override val rawNativeHandle: CPointer<$structName>, + scope: AutofreeScope, ) : GslMatrix<$kotlinTypeName, $structName>(scope) { override val rowNum: Int - get() = nativeHandleChecked().pointed.size1.toInt() + get() = nativeHandle.pointed.size1.toInt() override val colNum: Int - get() = nativeHandleChecked().pointed.size2.toInt() + get() = nativeHandle.pointed.size2.toInt() + + override val rows: Buffer> + get() = VirtualBuffer(rowNum) { r -> + Gsl${kotlinTypeAlias}Vector( + ${fn("gsl_matrixRrow")}(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, + scope, + ).apply { shouldBeFreed = false } + } + + override val columns: Buffer> + get() = VirtualBuffer(rowNum) { c -> + Gsl${kotlinTypeAlias}Vector( + ${fn("gsl_matrixRcolumn")}(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, + scope, + ).apply { shouldBeFreed = false } + } override operator fun get(i: Int, j: Int): $kotlinTypeName = - ${fn("gsl_matrixRget", cTypeName)}(nativeHandleChecked(), i.toULong(), j.toULong()) + ${fn("gsl_matrixRget")}(nativeHandle, i.toULong(), j.toULong()) override operator fun set(i: Int, j: Int, value: ${kotlinTypeName}): Unit = - ${fn("gsl_matrixRset", cTypeName)}(nativeHandleChecked(), i.toULong(), j.toULong(), value) + ${fn("gsl_matrixRset")}(nativeHandle, i.toULong(), j.toULong(), value) override fun copy(): $className { - val new = requireNotNull(${fn("gsl_matrixRalloc", cTypeName)}(rowNum.toULong(), colNum.toULong())) - ${fn("gsl_matrixRmemcpy", cTypeName)}(new, nativeHandleChecked()) + val new = requireNotNull(${fn("gsl_matrixRalloc")}(rowNum.toULong(), colNum.toULong())) + ${fn("gsl_matrixRmemcpy")}(new, nativeHandle) return $className(new, scope) } - override fun close(): Unit = ${fn("gsl_matrixRfree", cTypeName)}(nativeHandleChecked()) + override fun close(): Unit = ${fn("gsl_matrixRfree")}(nativeHandle) override fun equals(other: Any?): Boolean { if (other is $className) - return ${ - fn("gsl_matrixRequal", cTypeName) - }(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return ${fn("gsl_matrixRequal")}(nativeHandle, other.nativeHandle) == 1 return super.equals(other) } @@ -64,7 +79,7 @@ fun matricesCodegen(outputFile: String, project: Project = createProject()) { f += createNewLine(2) f += createImportDirective(ImportPath.fromString("kotlinx.cinterop.*")) f += createNewLine(1) - f += createImportDirective(ImportPath.fromString("kscience.kmath.linear.*")) + f += createImportDirective(ImportPath.fromString("kscience.kmath.structures.*")) f += createNewLine(1) f += createImportDirective(ImportPath.fromString("org.gnu.gsl.*")) f += createNewLine(2) diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt index 87acd258c..513d05727 100644 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt @@ -14,38 +14,36 @@ private fun KtPsiFactory.createVectorClass( kotlinTypeName: String, kotlinTypeAlias: String = kotlinTypeName ) { + fun fn(pattern: String) = fn(pattern, cTypeName) val className = "Gsl${kotlinTypeAlias}Vector" val structName = sn("gsl_vectorR", cTypeName) @Language("kotlin") val text = - """internal class $className(override val nativeHandle: CPointer<$structName>, scope: DeferScope) : + """internal class $className(override val rawNativeHandle: CPointer<$structName>, scope: AutofreeScope) : GslVector<$kotlinTypeName, $structName>(scope) { override val size: Int - get() = nativeHandleChecked().pointed.size.toInt() + get() = nativeHandle.pointed.size.toInt() override operator fun get(index: Int): $kotlinTypeName = - ${fn("gsl_vectorRget", cTypeName)}(nativeHandleChecked(), index.toULong()) + ${fn("gsl_vectorRget")}(nativeHandle, index.toULong()) override operator fun set(index: Int, value: $kotlinTypeName): Unit = - ${fn("gsl_vectorRset", cTypeName)}(nativeHandleChecked(), index.toULong(), value) + ${fn("gsl_vectorRset")}(nativeHandle, index.toULong(), value) override fun copy(): $className { - val new = requireNotNull(${fn("gsl_vectorRalloc", cTypeName)}(size.toULong())) - ${fn("gsl_vectorRmemcpy", cTypeName)}(new, nativeHandleChecked()) + val new = requireNotNull(${fn("gsl_vectorRalloc")}(size.toULong())) + ${fn("gsl_vectorRmemcpy")}(new, nativeHandle) return ${className}(new, scope) } override fun equals(other: Any?): Boolean { if (other is $className) - return ${ - fn("gsl_vectorRequal", - cTypeName) - }(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return ${fn("gsl_vectorRequal")}(nativeHandle, other.nativeHandle) == 1 return super.equals(other) } - override fun close(): Unit = ${fn("gsl_vectorRfree", cTypeName)}(nativeHandleChecked()) + override fun close(): Unit = ${fn("gsl_vectorRfree")}(nativeHandle) }""" f += createClass(text) diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt index 40c7cd5a4..ad1674c43 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt @@ -1,5 +1,6 @@ package kscience.kmath.linear +import kscience.kmath.misc.UnstableKMathAPI import kscience.kmath.operations.Ring import kscience.kmath.operations.SpaceOperations import kscience.kmath.operations.invoke @@ -8,18 +9,22 @@ import kscience.kmath.structures.Buffer import kscience.kmath.structures.BufferFactory import kscience.kmath.structures.Matrix import kscience.kmath.structures.asSequence +import kotlin.reflect.KClass /** - * Basic operations on matrices. Operates on [Matrix] + * Basic operations on matrices. Operates on [Matrix]. + * + * @param T the type of items in the matrices. + * @param M the type of operated matrices. */ public interface MatrixContext> : SpaceOperations> { /** - * Produce a matrix with this context and given dimensions + * Produces a matrix with this context and given dimensions. */ public fun produce(rows: Int, columns: Int, initializer: (i: Int, j: Int) -> T): M /** - * Produce a point compatible with matrix space (and possibly optimized for it) + * Produces a point compatible with matrix space (and possibly optimized for it). */ public fun point(size: Int, initializer: (Int) -> T): Point = Buffer.boxing(size, initializer) @@ -66,8 +71,19 @@ public interface MatrixContext> : SpaceOperations): M = m * this - public companion object { + /** + * Gets a feature from the matrix. This function may return some additional features than + * [kscience.kmath.structures.NDStructure.getFeature]. + * + * @param F the type of feature. + * @param m the matrix. + * @param type the [KClass] instance of [F]. + * @return a feature object or `null` if it isn't present. + */ + @UnstableKMathAPI + public fun getFeature(m: Matrix, type: KClass): F? = m.getFeature(type) + public companion object { /** * A structured matrix with custom buffer */ @@ -84,9 +100,31 @@ public interface MatrixContext> : SpaceOperations MatrixContext.getFeature(m: Matrix): F? = + getFeature(m, F::class) + +/** + * Partial implementation of [MatrixContext] for matrices of [Ring]. + * + * @param T the type of items in the matrices. + * @param R the type of ring of matrix elements. + * @param M the type of operated matrices. + */ public interface GenericMatrixContext, out M : Matrix> : MatrixContext { /** - * The ring context for matrix elements + * The ring instance of [T]. */ public val elementContext: R diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/Buffers.kt b/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/Buffers.kt index bfec6f871..ff19a4103 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/Buffers.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/Buffers.kt @@ -241,11 +241,22 @@ public class ArrayBuffer(private val array: Array) : MutableBuffer { override fun copy(): MutableBuffer = ArrayBuffer(array.copyOf()) } + /** * Returns an [ArrayBuffer] that wraps the original array. */ public fun Array.asBuffer(): ArrayBuffer = ArrayBuffer(this) +/** + * Creates a new [ArrayBuffer] with the specified [size], where each element is calculated by calling the specified + * [init] function. + * + * The function [init] is called for each array element sequentially starting from the first one. + * It should return the value for an array element given its index. + */ +public inline fun ArrayBuffer(size: Int, init: (Int) -> T): ArrayBuffer = + Array(size) { i -> init(i) }.asBuffer() + /** * Immutable wrapper for [MutableBuffer]. * diff --git a/kmath-gsl/src/nativeInterop/cinterop/libgsl.def b/kmath-gsl/src/nativeInterop/cinterop/libgsl.def index bd3a861f0..c50dd41cd 100644 --- a/kmath-gsl/src/nativeInterop/cinterop/libgsl.def +++ b/kmath-gsl/src/nativeInterop/cinterop/libgsl.def @@ -1,5 +1,5 @@ package=org.gnu.gsl -headers=gsl/gsl_blas.h gsl/gsl_linalg.h +headers=gsl/gsl_blas.h gsl/gsl_linalg.h gsl/gsl_permute_matrix.h compilerOpts.linux=-I/usr/include compilerOpts.osx=-I/usr/local -I/usr/local/include linkerOpts.linux=-L/usr/lib64 -L/usr/lib/x86_64-linux-gnu -lgsl diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt index 0233ed8bc..6881bb0e4 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt @@ -2,6 +2,8 @@ package kscience.kmath.gsl import kotlinx.cinterop.* import kscience.kmath.operations.Complex +import kscience.kmath.structures.Buffer +import kscience.kmath.structures.VirtualBuffer import org.gnu.gsl.* internal fun CValue.toKMath(): Complex = useContents { Complex(dat[0], dat[1]) } @@ -11,58 +13,74 @@ internal fun Complex.toGsl(): CValue = cValue { dat[1] = im } -internal class GslComplexMatrix(override val nativeHandle: CPointer, scope: DeferScope) : +internal class GslComplexMatrix(override val rawNativeHandle: CPointer, scope: AutofreeScope) : GslMatrix(scope) { override val rowNum: Int - get() = nativeHandleChecked().pointed.size1.toInt() + get() = nativeHandle.pointed.size1.toInt() override val colNum: Int - get() = nativeHandleChecked().pointed.size2.toInt() + get() = nativeHandle.pointed.size2.toInt() + + override val rows: Buffer> + get() = VirtualBuffer(rowNum) { r -> + GslComplexVector( + gsl_matrix_complex_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, + scope, + ).apply { shouldBeFreed = false } + } + + override val columns: Buffer> + get() = VirtualBuffer(rowNum) { c -> + GslComplexVector( + gsl_matrix_complex_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, + scope, + ).apply { shouldBeFreed = false } + } override operator fun get(i: Int, j: Int): Complex = - gsl_matrix_complex_get(nativeHandleChecked(), i.toULong(), j.toULong()).toKMath() + gsl_matrix_complex_get(nativeHandle, i.toULong(), j.toULong()).toKMath() override operator fun set(i: Int, j: Int, value: Complex): Unit = - gsl_matrix_complex_set(nativeHandleChecked(), i.toULong(), j.toULong(), value.toGsl()) + gsl_matrix_complex_set(nativeHandle, i.toULong(), j.toULong(), value.toGsl()) override fun copy(): GslComplexMatrix { val new = requireNotNull(gsl_matrix_complex_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_complex_memcpy(new, nativeHandleChecked()) + gsl_matrix_complex_memcpy(new, nativeHandle) return GslComplexMatrix(new, scope) } - override fun close(): Unit = gsl_matrix_complex_free(nativeHandleChecked()) + override fun close(): Unit = gsl_matrix_complex_free(nativeHandle) override fun equals(other: Any?): Boolean { if (other is GslComplexMatrix) - return gsl_matrix_complex_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return gsl_matrix_complex_equal(nativeHandle, other.nativeHandle) == 1 return super.equals(other) } } -internal class GslComplexVector(override val nativeHandle: CPointer, scope: DeferScope) : +internal class GslComplexVector(override val rawNativeHandle: CPointer, scope: AutofreeScope) : GslVector(scope) { override val size: Int - get() = nativeHandleChecked().pointed.size.toInt() + get() = nativeHandle.pointed.size.toInt() - override fun get(index: Int): Complex = gsl_vector_complex_get(nativeHandleChecked(), index.toULong()).toKMath() + override fun get(index: Int): Complex = gsl_vector_complex_get(nativeHandle, index.toULong()).toKMath() override fun set(index: Int, value: Complex): Unit = - gsl_vector_complex_set(nativeHandleChecked(), index.toULong(), value.toGsl()) + gsl_vector_complex_set(nativeHandle, index.toULong(), value.toGsl()) override fun copy(): GslComplexVector { val new = requireNotNull(gsl_vector_complex_alloc(size.toULong())) - gsl_vector_complex_memcpy(new, nativeHandleChecked()) + gsl_vector_complex_memcpy(new, nativeHandle) return GslComplexVector(new, scope) } override fun equals(other: Any?): Boolean { if (other is GslComplexVector) - return gsl_vector_complex_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return gsl_vector_complex_equal(nativeHandle, other.nativeHandle) == 1 return super.equals(other) } - override fun close(): Unit = gsl_vector_complex_free(nativeHandleChecked()) + override fun close(): Unit = gsl_vector_complex_free(nativeHandle) } diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt index 13283946e..c28236a67 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt @@ -1,33 +1,40 @@ package kscience.kmath.gsl +import kotlinx.cinterop.AutofreeScope import kotlinx.cinterop.CStructVar -import kotlinx.cinterop.DeferScope import kscience.kmath.structures.Matrix import kscience.kmath.structures.NDStructure +import kscience.kmath.structures.asSequence /** * Wraps gsl_matrix_* objects from GSL. */ -public abstract class GslMatrix internal constructor(scope: DeferScope) : +public abstract class GslMatrix internal constructor(scope: AutofreeScope) : GslMemoryHolder(scope), Matrix { internal abstract operator fun set(i: Int, j: Int, value: T) internal abstract fun copy(): GslMatrix public override fun equals(other: Any?): Boolean { - return NDStructure.equals(this, other as? NDStructure<*> ?: return false) + return NDStructure.contentEquals(this, other as? NDStructure<*> ?: return false) } public override fun hashCode(): Int { var ret = 7 - val nRows = rowNum - val nCols = colNum - ret = ret * 31 + nRows - ret = ret * 31 + nCols + ret = ret * 31 + rowNum + ret = ret * 31 + colNum - for (row in 0 until nRows) - for (col in 0 until nCols) + for (row in 0 until rowNum) + for (col in 0 until colNum) ret = ret * 31 + (11 * (row + 1) + 17 * (col + 1)) * this[row, col].hashCode() return ret } + + public override fun toString(): String = if (rowNum <= 5 && colNum <= 5) + "Matrix(rowsNum = $rowNum, colNum = $colNum)\n" + + rows.asSequence().joinToString(prefix = "(", postfix = ")", separator = "\n ") { buffer -> + buffer.asSequence().joinToString(separator = "\t") { it.toString() } + } + else + "Matrix(rowsNum = $rowNum, colNum = $colNum)" } diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt index 95437c8c7..c32d852ba 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt @@ -1,31 +1,33 @@ package kscience.kmath.gsl -import kotlinx.cinterop.CStructVar -import kotlinx.cinterop.DeferScope -import kotlinx.cinterop.memScoped -import kotlinx.cinterop.pointed -import kscience.kmath.linear.MatrixContext -import kscience.kmath.linear.Point +import kotlinx.cinterop.* +import kscience.kmath.linear.* +import kscience.kmath.misc.UnstableKMathAPI import kscience.kmath.operations.Complex import kscience.kmath.operations.ComplexField import kscience.kmath.operations.toComplex import kscience.kmath.structures.Matrix +import kscience.kmath.structures.toList import org.gnu.gsl.* +import kotlin.reflect.KClass +import kotlin.reflect.cast internal inline fun GslMatrix.fill(initializer: (Int, Int) -> T): GslMatrix = apply { - (0 until rowNum).forEach { row -> (0 until colNum).forEach { col -> this[row, col] = initializer(row, col) } } + for (row in 0 until rowNum) { + for (col in 0 until colNum) this[row, col] = initializer(row, col) + } } internal inline fun GslVector.fill(initializer: (Int) -> T): GslVector = - apply { (0 until size).forEach { index -> this[index] = initializer(index) } } + apply { + for (index in 0 until size) this[index] = initializer(index) + } /** * Represents matrix context implementing where all the operations are delegated to GSL. */ -public abstract class GslMatrixContext internal constructor( - internal val scope: DeferScope, -) : MatrixContext> { +public abstract class GslMatrixContext : MatrixContext> { init { ensureHasGslErrorHandler() } @@ -52,19 +54,22 @@ public abstract class GslMatrixContext T): GslMatrix = produceDirtyMatrix(rows, columns).fill(initializer) - public override fun point(size: Int, initializer: (Int) -> T): Point = + public override fun point(size: Int, initializer: (Int) -> T): GslVector = produceDirtyVector(size).fill(initializer) } /** * Represents [Double] matrix context implementing where all the operations are delegated to GSL. */ -public class GslRealMatrixContext(scope: DeferScope) : GslMatrixContext(scope) { - override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = - GslRealMatrix(nativeHandle = requireNotNull(gsl_matrix_alloc(rows.toULong(), columns.toULong())), scope = scope) +public class GslRealMatrixContext(internal val scope: AutofreeScope) : + GslMatrixContext() { + override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = GslRealMatrix( + rawNativeHandle = requireNotNull(gsl_matrix_alloc(rows.toULong(), columns.toULong())), + scope = scope, + ) override fun produceDirtyVector(size: Int): GslVector = - GslRealVector(nativeHandle = requireNotNull(gsl_vector_alloc(size.toULong())), scope = scope) + GslRealVector(rawNativeHandle = requireNotNull(gsl_vector_alloc(size.toULong())), scope = scope) public override fun Matrix.dot(other: Matrix): GslMatrix { val x = toGsl().nativeHandle @@ -105,6 +110,58 @@ public class GslRealMatrixContext(scope: DeferScope) : GslMatrixContext getFeature(m: Matrix, type: KClass): F? = when (type) { + LupDecompositionFeature::class -> object : LupDecompositionFeature { + private val lup by lazy { + val lu = m.toGsl().copy() + val n = lu.rowNum + val perm = gsl_permutation_alloc(n.toULong()) + + memScoped { + val i = alloc() + gsl_linalg_LU_decomp(lu.nativeHandle, perm, i.ptr) + } + + val one = produce(n, n) { i, j -> if (i == j) 1.0 else 0.0 } + val p = produce(n, n) { _, _ -> 0.0 } + + for (j in 0 until perm!!.pointed.size.toInt()) { + println("7 $j") + val k = gsl_permutation_get(perm, j.toULong()).toInt() + val col = one.columns[k] + println(p.toGsl()) + println(col.toList()) + gsl_matrix_set_col(p.nativeHandle, j.toULong(), col.toGsl().nativeHandle) + } + + gsl_permutation_free(perm) + lu to p + } + + override val l by lazy { + VirtualMatrix(lup.first.shape[0], lup.first.shape[1]) { i, j -> + when { + j < i -> lup.first[i, j] + j == i -> 1.0 + else -> 0.0 + } + } + LFeature + } + + override val u by lazy { + VirtualMatrix( + lup.first.shape[0], + lup.first.shape[1], + ) { i, j -> if (j >= i) lup.first[i, j] else 0.0 } + UFeature + } + + override val p by lazy(lup::second) + } + else -> super.getFeature(m, type) + }?.let(type::cast) } /** @@ -116,22 +173,22 @@ public fun GslRealMatrixContext(block: GslRealMatrixContext.() -> R): R = /** * Represents [Float] matrix context implementing where all the operations are delegated to GSL. */ -public class GslFloatMatrixContext(scope: DeferScope) : - GslMatrixContext(scope) { +public class GslFloatMatrixContext(internal val scope: AutofreeScope) : + GslMatrixContext() { override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = GslFloatMatrix( - nativeHandle = requireNotNull(gsl_matrix_float_alloc(rows.toULong(), columns.toULong())), + rawNativeHandle = requireNotNull(gsl_matrix_float_alloc(rows.toULong(), columns.toULong())), scope = scope, ) override fun produceDirtyVector(size: Int): GslVector = - GslFloatVector(nativeHandle = requireNotNull(value = gsl_vector_float_alloc(size.toULong())), scope = scope) + GslFloatVector(rawNativeHandle = requireNotNull(value = gsl_vector_float_alloc(size.toULong())), scope = scope) public override fun Matrix.dot(other: Matrix): GslMatrix { val x = toGsl().nativeHandle val a = other.toGsl().nativeHandle val result = requireNotNull(gsl_matrix_float_calloc(a.pointed.size1, a.pointed.size2)) gsl_blas_sgemm(CblasNoTrans, CblasNoTrans, 1f, x, a, 1f, result) - return GslFloatMatrix(nativeHandle = result, scope = scope) + return GslFloatMatrix(rawNativeHandle = result, scope = scope) } public override fun Matrix.dot(vector: Point): GslVector { @@ -139,7 +196,7 @@ public class GslFloatMatrixContext(scope: DeferScope) : val a = vector.toGsl().nativeHandle val result = requireNotNull(gsl_vector_float_calloc(a.pointed.size)) gsl_blas_sgemv(CblasNoTrans, 1f, x, a, 1f, result) - return GslFloatVector(nativeHandle = result, scope = scope) + return GslFloatVector(rawNativeHandle = result, scope = scope) } public override fun Matrix.times(value: Float): GslMatrix { @@ -176,22 +233,22 @@ public fun GslFloatMatrixContext(block: GslFloatMatrixContext.() -> R): R = /** * Represents [Complex] matrix context implementing where all the operations are delegated to GSL. */ -public class GslComplexMatrixContext(scope: DeferScope) : - GslMatrixContext(scope) { +public class GslComplexMatrixContext(internal val scope: AutofreeScope) : + GslMatrixContext() { override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = GslComplexMatrix( - nativeHandle = requireNotNull(gsl_matrix_complex_alloc(rows.toULong(), columns.toULong())), + rawNativeHandle = requireNotNull(gsl_matrix_complex_alloc(rows.toULong(), columns.toULong())), scope = scope, ) override fun produceDirtyVector(size: Int): GslVector = - GslComplexVector(nativeHandle = requireNotNull(gsl_vector_complex_alloc(size.toULong())), scope = scope) + GslComplexVector(rawNativeHandle = requireNotNull(gsl_vector_complex_alloc(size.toULong())), scope = scope) public override fun Matrix.dot(other: Matrix): GslMatrix { val x = toGsl().nativeHandle val a = other.toGsl().nativeHandle val result = requireNotNull(gsl_matrix_complex_calloc(a.pointed.size1, a.pointed.size2)) gsl_blas_zgemm(CblasNoTrans, CblasNoTrans, ComplexField.one.toGsl(), x, a, ComplexField.one.toGsl(), result) - return GslComplexMatrix(nativeHandle = result, scope = scope) + return GslComplexMatrix(rawNativeHandle = result, scope = scope) } public override fun Matrix.dot(vector: Point): GslVector { @@ -225,6 +282,58 @@ public class GslComplexMatrixContext(scope: DeferScope) : gsl_matrix_complex_sub(g1.nativeHandle, b.toGsl().nativeHandle) return g1 } + + @Suppress("IMPLICIT_CAST_TO_ANY") + @UnstableKMathAPI + public override fun getFeature(m: Matrix, type: KClass): F? = when (type) { + LupDecompositionFeature::class -> object : LupDecompositionFeature { + private val lup by lazy { + val lu = m.toGsl().copy() + val n = lu.rowNum + val perm = gsl_permutation_alloc(n.toULong()) + + memScoped { + val i = alloc() + gsl_linalg_complex_LU_decomp(lu.nativeHandle, perm, i.ptr) + } + + val one = produce(n, n) { i, j -> if (i == j) 1.0.toComplex() else 0.0.toComplex() } + val p = produce(n, n) { _, _ -> 0.0.toComplex() } + + for (j in 0 until perm!!.pointed.size.toInt()) { + println("7 $j") + val k = gsl_permutation_get(perm, j.toULong()).toInt() + val col = one.columns[k] + println(p.toGsl()) + println(col.toList()) + gsl_matrix_complex_set_col(p.nativeHandle, j.toULong(), col.toGsl().nativeHandle) + } + + gsl_permutation_free(perm) + lu to p + } + + override val l by lazy { + VirtualMatrix(lup.first.shape[0], lup.first.shape[1]) { i, j -> + when { + j < i -> lup.first[i, j] + j == i -> 1.0.toComplex() + else -> 0.0.toComplex() + } + } + LFeature + } + + override val u by lazy { + VirtualMatrix( + lup.first.shape[0], + lup.first.shape[1], + ) { i, j -> if (j >= i) lup.first[i, j] else 0.0.toComplex() } + UFeature + } + + override val p by lazy(lup::second) + } + else -> super.getFeature(m, type) + }?.let(type::cast) } /** diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt index d68a52a62..46d1ba60b 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt @@ -1,5 +1,6 @@ package kscience.kmath.gsl +import kotlinx.cinterop.AutofreeScope import kotlinx.cinterop.CPointer import kotlinx.cinterop.CStructVar import kotlinx.cinterop.DeferScope @@ -12,23 +13,26 @@ import kotlinx.cinterop.DeferScope * * @param scope the scope where this object is declared. */ -public abstract class GslMemoryHolder internal constructor(internal val scope: DeferScope) { - internal abstract val nativeHandle: CPointer +public abstract class GslMemoryHolder internal constructor(internal val scope: AutofreeScope) { + internal abstract val rawNativeHandle: CPointer private var isClosed: Boolean = false + internal val nativeHandle: CPointer + get() { + check(!isClosed) { "The use of GSL object that is closed." } + return rawNativeHandle + } + + internal var shouldBeFreed = true + init { ensureHasGslErrorHandler() scope.defer { - close() + if (shouldBeFreed) close() isClosed = true } } - internal fun nativeHandleChecked(): CPointer { - check(!isClosed) { "The use of GSL object that is closed." } - return nativeHandle - } - internal abstract fun close() } diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt index 0033c47a1..8bc1240b4 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt @@ -1,13 +1,13 @@ package kscience.kmath.gsl +import kotlinx.cinterop.AutofreeScope import kotlinx.cinterop.CStructVar -import kotlinx.cinterop.DeferScope import kscience.kmath.linear.Point /** * Wraps gsl_vector_* objects from GSL. */ -public abstract class GslVector internal constructor(scope: DeferScope) : +public abstract class GslVector internal constructor(scope: AutofreeScope) : GslMemoryHolder(scope), Point { internal abstract operator fun set(index: Int, value: T) internal abstract fun copy(): GslVector diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt index 07bc8af79..1a826d493 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt @@ -1,260 +1,388 @@ package kscience.kmath.gsl import kotlinx.cinterop.* -import kscience.kmath.linear.* +import kscience.kmath.structures.* import org.gnu.gsl.* internal class GslRealMatrix( - override val nativeHandle: CPointer, - scope: DeferScope + override val rawNativeHandle: CPointer, + scope: AutofreeScope, ) : GslMatrix(scope) { override val rowNum: Int - get() = nativeHandleChecked().pointed.size1.toInt() + get() = nativeHandle.pointed.size1.toInt() override val colNum: Int - get() = nativeHandleChecked().pointed.size2.toInt() + get() = nativeHandle.pointed.size2.toInt() + + override val rows: Buffer> + get() = VirtualBuffer(rowNum) { r -> + GslRealVector( + gsl_matrix_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, + scope, + ).apply { shouldBeFreed = false } + } + + override val columns: Buffer> + get() = VirtualBuffer(rowNum) { c -> + GslRealVector( + gsl_matrix_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, + scope, + ).apply { shouldBeFreed = false } + } override operator fun get(i: Int, j: Int): Double = - gsl_matrix_get(nativeHandleChecked(), i.toULong(), j.toULong()) + gsl_matrix_get(nativeHandle, i.toULong(), j.toULong()) override operator fun set(i: Int, j: Int, value: Double): Unit = - gsl_matrix_set(nativeHandleChecked(), i.toULong(), j.toULong(), value) + gsl_matrix_set(nativeHandle, i.toULong(), j.toULong(), value) override fun copy(): GslRealMatrix { val new = requireNotNull(gsl_matrix_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_memcpy(new, nativeHandleChecked()) + gsl_matrix_memcpy(new, nativeHandle) return GslRealMatrix(new, scope) } - override fun close(): Unit = gsl_matrix_free(nativeHandleChecked()) + override fun close(): Unit = gsl_matrix_free(nativeHandle) override fun equals(other: Any?): Boolean { if (other is GslRealMatrix) - return gsl_matrix_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return gsl_matrix_equal(nativeHandle, other.nativeHandle) == 1 return super.equals(other) } } internal class GslFloatMatrix( - override val nativeHandle: CPointer, - scope: DeferScope + override val rawNativeHandle: CPointer, + scope: AutofreeScope, ) : GslMatrix(scope) { override val rowNum: Int - get() = nativeHandleChecked().pointed.size1.toInt() + get() = nativeHandle.pointed.size1.toInt() override val colNum: Int - get() = nativeHandleChecked().pointed.size2.toInt() + get() = nativeHandle.pointed.size2.toInt() + + override val rows: Buffer> + get() = VirtualBuffer(rowNum) { r -> + GslFloatVector( + gsl_matrix_float_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, + scope, + ).apply { shouldBeFreed = false } + } + + override val columns: Buffer> + get() = VirtualBuffer(rowNum) { c -> + GslFloatVector( + gsl_matrix_float_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, + scope, + ).apply { shouldBeFreed = false } + } override operator fun get(i: Int, j: Int): Float = - gsl_matrix_float_get(nativeHandleChecked(), i.toULong(), j.toULong()) + gsl_matrix_float_get(nativeHandle, i.toULong(), j.toULong()) override operator fun set(i: Int, j: Int, value: Float): Unit = - gsl_matrix_float_set(nativeHandleChecked(), i.toULong(), j.toULong(), value) + gsl_matrix_float_set(nativeHandle, i.toULong(), j.toULong(), value) override fun copy(): GslFloatMatrix { val new = requireNotNull(gsl_matrix_float_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_float_memcpy(new, nativeHandleChecked()) + gsl_matrix_float_memcpy(new, nativeHandle) return GslFloatMatrix(new, scope) } - override fun close(): Unit = gsl_matrix_float_free(nativeHandleChecked()) + override fun close(): Unit = gsl_matrix_float_free(nativeHandle) override fun equals(other: Any?): Boolean { if (other is GslFloatMatrix) - return gsl_matrix_float_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return gsl_matrix_float_equal(nativeHandle, other.nativeHandle) == 1 return super.equals(other) } } internal class GslShortMatrix( - override val nativeHandle: CPointer, - scope: DeferScope + override val rawNativeHandle: CPointer, + scope: AutofreeScope, ) : GslMatrix(scope) { override val rowNum: Int - get() = nativeHandleChecked().pointed.size1.toInt() + get() = nativeHandle.pointed.size1.toInt() override val colNum: Int - get() = nativeHandleChecked().pointed.size2.toInt() + get() = nativeHandle.pointed.size2.toInt() + + override val rows: Buffer> + get() = VirtualBuffer(rowNum) { r -> + GslShortVector( + gsl_matrix_short_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, + scope, + ).apply { shouldBeFreed = false } + } + + override val columns: Buffer> + get() = VirtualBuffer(rowNum) { c -> + GslShortVector( + gsl_matrix_short_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, + scope, + ).apply { shouldBeFreed = false } + } override operator fun get(i: Int, j: Int): Short = - gsl_matrix_short_get(nativeHandleChecked(), i.toULong(), j.toULong()) + gsl_matrix_short_get(nativeHandle, i.toULong(), j.toULong()) override operator fun set(i: Int, j: Int, value: Short): Unit = - gsl_matrix_short_set(nativeHandleChecked(), i.toULong(), j.toULong(), value) + gsl_matrix_short_set(nativeHandle, i.toULong(), j.toULong(), value) override fun copy(): GslShortMatrix { val new = requireNotNull(gsl_matrix_short_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_short_memcpy(new, nativeHandleChecked()) + gsl_matrix_short_memcpy(new, nativeHandle) return GslShortMatrix(new, scope) } - override fun close(): Unit = gsl_matrix_short_free(nativeHandleChecked()) + override fun close(): Unit = gsl_matrix_short_free(nativeHandle) override fun equals(other: Any?): Boolean { if (other is GslShortMatrix) - return gsl_matrix_short_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return gsl_matrix_short_equal(nativeHandle, other.nativeHandle) == 1 return super.equals(other) } } internal class GslUShortMatrix( - override val nativeHandle: CPointer, - scope: DeferScope + override val rawNativeHandle: CPointer, + scope: AutofreeScope, ) : GslMatrix(scope) { override val rowNum: Int - get() = nativeHandleChecked().pointed.size1.toInt() + get() = nativeHandle.pointed.size1.toInt() override val colNum: Int - get() = nativeHandleChecked().pointed.size2.toInt() + get() = nativeHandle.pointed.size2.toInt() + + override val rows: Buffer> + get() = VirtualBuffer(rowNum) { r -> + GslUShortVector( + gsl_matrix_ushort_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, + scope, + ).apply { shouldBeFreed = false } + } + + override val columns: Buffer> + get() = VirtualBuffer(rowNum) { c -> + GslUShortVector( + gsl_matrix_ushort_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, + scope, + ).apply { shouldBeFreed = false } + } override operator fun get(i: Int, j: Int): UShort = - gsl_matrix_ushort_get(nativeHandleChecked(), i.toULong(), j.toULong()) + gsl_matrix_ushort_get(nativeHandle, i.toULong(), j.toULong()) override operator fun set(i: Int, j: Int, value: UShort): Unit = - gsl_matrix_ushort_set(nativeHandleChecked(), i.toULong(), j.toULong(), value) + gsl_matrix_ushort_set(nativeHandle, i.toULong(), j.toULong(), value) override fun copy(): GslUShortMatrix { val new = requireNotNull(gsl_matrix_ushort_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_ushort_memcpy(new, nativeHandleChecked()) + gsl_matrix_ushort_memcpy(new, nativeHandle) return GslUShortMatrix(new, scope) } - override fun close(): Unit = gsl_matrix_ushort_free(nativeHandleChecked()) + override fun close(): Unit = gsl_matrix_ushort_free(nativeHandle) override fun equals(other: Any?): Boolean { if (other is GslUShortMatrix) - return gsl_matrix_ushort_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return gsl_matrix_ushort_equal(nativeHandle, other.nativeHandle) == 1 return super.equals(other) } } internal class GslLongMatrix( - override val nativeHandle: CPointer, - scope: DeferScope + override val rawNativeHandle: CPointer, + scope: AutofreeScope, ) : GslMatrix(scope) { override val rowNum: Int - get() = nativeHandleChecked().pointed.size1.toInt() + get() = nativeHandle.pointed.size1.toInt() override val colNum: Int - get() = nativeHandleChecked().pointed.size2.toInt() + get() = nativeHandle.pointed.size2.toInt() + + override val rows: Buffer> + get() = VirtualBuffer(rowNum) { r -> + GslLongVector( + gsl_matrix_long_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, + scope, + ).apply { shouldBeFreed = false } + } + + override val columns: Buffer> + get() = VirtualBuffer(rowNum) { c -> + GslLongVector( + gsl_matrix_long_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, + scope, + ).apply { shouldBeFreed = false } + } override operator fun get(i: Int, j: Int): Long = - gsl_matrix_long_get(nativeHandleChecked(), i.toULong(), j.toULong()) + gsl_matrix_long_get(nativeHandle, i.toULong(), j.toULong()) override operator fun set(i: Int, j: Int, value: Long): Unit = - gsl_matrix_long_set(nativeHandleChecked(), i.toULong(), j.toULong(), value) + gsl_matrix_long_set(nativeHandle, i.toULong(), j.toULong(), value) override fun copy(): GslLongMatrix { val new = requireNotNull(gsl_matrix_long_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_long_memcpy(new, nativeHandleChecked()) + gsl_matrix_long_memcpy(new, nativeHandle) return GslLongMatrix(new, scope) } - override fun close(): Unit = gsl_matrix_long_free(nativeHandleChecked()) + override fun close(): Unit = gsl_matrix_long_free(nativeHandle) override fun equals(other: Any?): Boolean { if (other is GslLongMatrix) - return gsl_matrix_long_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return gsl_matrix_long_equal(nativeHandle, other.nativeHandle) == 1 return super.equals(other) } } internal class GslULongMatrix( - override val nativeHandle: CPointer, - scope: DeferScope + override val rawNativeHandle: CPointer, + scope: AutofreeScope, ) : GslMatrix(scope) { override val rowNum: Int - get() = nativeHandleChecked().pointed.size1.toInt() + get() = nativeHandle.pointed.size1.toInt() override val colNum: Int - get() = nativeHandleChecked().pointed.size2.toInt() + get() = nativeHandle.pointed.size2.toInt() + + override val rows: Buffer> + get() = VirtualBuffer(rowNum) { r -> + GslULongVector( + gsl_matrix_ulong_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, + scope, + ).apply { shouldBeFreed = false } + } + + override val columns: Buffer> + get() = VirtualBuffer(rowNum) { c -> + GslULongVector( + gsl_matrix_ulong_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, + scope, + ).apply { shouldBeFreed = false } + } override operator fun get(i: Int, j: Int): ULong = - gsl_matrix_ulong_get(nativeHandleChecked(), i.toULong(), j.toULong()) + gsl_matrix_ulong_get(nativeHandle, i.toULong(), j.toULong()) override operator fun set(i: Int, j: Int, value: ULong): Unit = - gsl_matrix_ulong_set(nativeHandleChecked(), i.toULong(), j.toULong(), value) + gsl_matrix_ulong_set(nativeHandle, i.toULong(), j.toULong(), value) override fun copy(): GslULongMatrix { val new = requireNotNull(gsl_matrix_ulong_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_ulong_memcpy(new, nativeHandleChecked()) + gsl_matrix_ulong_memcpy(new, nativeHandle) return GslULongMatrix(new, scope) } - override fun close(): Unit = gsl_matrix_ulong_free(nativeHandleChecked()) + override fun close(): Unit = gsl_matrix_ulong_free(nativeHandle) override fun equals(other: Any?): Boolean { if (other is GslULongMatrix) - return gsl_matrix_ulong_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return gsl_matrix_ulong_equal(nativeHandle, other.nativeHandle) == 1 return super.equals(other) } } internal class GslIntMatrix( - override val nativeHandle: CPointer, - scope: DeferScope + override val rawNativeHandle: CPointer, + scope: AutofreeScope, ) : GslMatrix(scope) { override val rowNum: Int - get() = nativeHandleChecked().pointed.size1.toInt() + get() = nativeHandle.pointed.size1.toInt() override val colNum: Int - get() = nativeHandleChecked().pointed.size2.toInt() + get() = nativeHandle.pointed.size2.toInt() + + override val rows: Buffer> + get() = VirtualBuffer(rowNum) { r -> + GslIntVector( + gsl_matrix_int_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, + scope, + ).apply { shouldBeFreed = false } + } + + override val columns: Buffer> + get() = VirtualBuffer(rowNum) { c -> + GslIntVector( + gsl_matrix_int_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, + scope, + ).apply { shouldBeFreed = false } + } override operator fun get(i: Int, j: Int): Int = - gsl_matrix_int_get(nativeHandleChecked(), i.toULong(), j.toULong()) + gsl_matrix_int_get(nativeHandle, i.toULong(), j.toULong()) override operator fun set(i: Int, j: Int, value: Int): Unit = - gsl_matrix_int_set(nativeHandleChecked(), i.toULong(), j.toULong(), value) + gsl_matrix_int_set(nativeHandle, i.toULong(), j.toULong(), value) override fun copy(): GslIntMatrix { val new = requireNotNull(gsl_matrix_int_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_int_memcpy(new, nativeHandleChecked()) + gsl_matrix_int_memcpy(new, nativeHandle) return GslIntMatrix(new, scope) } - override fun close(): Unit = gsl_matrix_int_free(nativeHandleChecked()) + override fun close(): Unit = gsl_matrix_int_free(nativeHandle) override fun equals(other: Any?): Boolean { if (other is GslIntMatrix) - return gsl_matrix_int_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return gsl_matrix_int_equal(nativeHandle, other.nativeHandle) == 1 return super.equals(other) } } internal class GslUIntMatrix( - override val nativeHandle: CPointer, - scope: DeferScope + override val rawNativeHandle: CPointer, + scope: AutofreeScope, ) : GslMatrix(scope) { override val rowNum: Int - get() = nativeHandleChecked().pointed.size1.toInt() + get() = nativeHandle.pointed.size1.toInt() override val colNum: Int - get() = nativeHandleChecked().pointed.size2.toInt() + get() = nativeHandle.pointed.size2.toInt() + + override val rows: Buffer> + get() = VirtualBuffer(rowNum) { r -> + GslUIntVector( + gsl_matrix_uint_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, + scope, + ).apply { shouldBeFreed = false } + } + + override val columns: Buffer> + get() = VirtualBuffer(rowNum) { c -> + GslUIntVector( + gsl_matrix_uint_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, + scope, + ).apply { shouldBeFreed = false } + } override operator fun get(i: Int, j: Int): UInt = - gsl_matrix_uint_get(nativeHandleChecked(), i.toULong(), j.toULong()) + gsl_matrix_uint_get(nativeHandle, i.toULong(), j.toULong()) override operator fun set(i: Int, j: Int, value: UInt): Unit = - gsl_matrix_uint_set(nativeHandleChecked(), i.toULong(), j.toULong(), value) + gsl_matrix_uint_set(nativeHandle, i.toULong(), j.toULong(), value) override fun copy(): GslUIntMatrix { val new = requireNotNull(gsl_matrix_uint_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_uint_memcpy(new, nativeHandleChecked()) + gsl_matrix_uint_memcpy(new, nativeHandle) return GslUIntMatrix(new, scope) } - override fun close(): Unit = gsl_matrix_uint_free(nativeHandleChecked()) + override fun close(): Unit = gsl_matrix_uint_free(nativeHandle) override fun equals(other: Any?): Boolean { if (other is GslUIntMatrix) - return gsl_matrix_uint_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return gsl_matrix_uint_equal(nativeHandle, other.nativeHandle) == 1 return super.equals(other) } diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt index d7ed4718b..5b5236242 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt @@ -3,219 +3,219 @@ package kscience.kmath.gsl import kotlinx.cinterop.* import org.gnu.gsl.* -internal class GslRealVector(override val nativeHandle: CPointer, scope: DeferScope) : +internal class GslRealVector(override val rawNativeHandle: CPointer, scope: AutofreeScope) : GslVector(scope) { override val size: Int - get() = nativeHandleChecked().pointed.size.toInt() + get() = nativeHandle.pointed.size.toInt() override operator fun get(index: Int): Double = - gsl_vector_get(nativeHandleChecked(), index.toULong()) + gsl_vector_get(nativeHandle, index.toULong()) override operator fun set(index: Int, value: Double): Unit = - gsl_vector_set(nativeHandleChecked(), index.toULong(), value) + gsl_vector_set(nativeHandle, index.toULong(), value) override fun copy(): GslRealVector { val new = requireNotNull(gsl_vector_alloc(size.toULong())) - gsl_vector_memcpy(new, nativeHandleChecked()) + gsl_vector_memcpy(new, nativeHandle) return GslRealVector(new, scope) } override fun equals(other: Any?): Boolean { if (other is GslRealVector) - return gsl_vector_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return gsl_vector_equal(nativeHandle, other.nativeHandle) == 1 return super.equals(other) } - override fun close(): Unit = gsl_vector_free(nativeHandleChecked()) + override fun close(): Unit = gsl_vector_free(nativeHandle) } -internal class GslFloatVector(override val nativeHandle: CPointer, scope: DeferScope) : +internal class GslFloatVector(override val rawNativeHandle: CPointer, scope: AutofreeScope) : GslVector(scope) { override val size: Int - get() = nativeHandleChecked().pointed.size.toInt() + get() = nativeHandle.pointed.size.toInt() override operator fun get(index: Int): Float = - gsl_vector_float_get(nativeHandleChecked(), index.toULong()) + gsl_vector_float_get(nativeHandle, index.toULong()) override operator fun set(index: Int, value: Float): Unit = - gsl_vector_float_set(nativeHandleChecked(), index.toULong(), value) + gsl_vector_float_set(nativeHandle, index.toULong(), value) override fun copy(): GslFloatVector { val new = requireNotNull(gsl_vector_float_alloc(size.toULong())) - gsl_vector_float_memcpy(new, nativeHandleChecked()) + gsl_vector_float_memcpy(new, nativeHandle) return GslFloatVector(new, scope) } override fun equals(other: Any?): Boolean { if (other is GslFloatVector) - return gsl_vector_float_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return gsl_vector_float_equal(nativeHandle, other.nativeHandle) == 1 return super.equals(other) } - override fun close(): Unit = gsl_vector_float_free(nativeHandleChecked()) + override fun close(): Unit = gsl_vector_float_free(nativeHandle) } -internal class GslShortVector(override val nativeHandle: CPointer, scope: DeferScope) : +internal class GslShortVector(override val rawNativeHandle: CPointer, scope: AutofreeScope) : GslVector(scope) { override val size: Int - get() = nativeHandleChecked().pointed.size.toInt() + get() = nativeHandle.pointed.size.toInt() override operator fun get(index: Int): Short = - gsl_vector_short_get(nativeHandleChecked(), index.toULong()) + gsl_vector_short_get(nativeHandle, index.toULong()) override operator fun set(index: Int, value: Short): Unit = - gsl_vector_short_set(nativeHandleChecked(), index.toULong(), value) + gsl_vector_short_set(nativeHandle, index.toULong(), value) override fun copy(): GslShortVector { val new = requireNotNull(gsl_vector_short_alloc(size.toULong())) - gsl_vector_short_memcpy(new, nativeHandleChecked()) + gsl_vector_short_memcpy(new, nativeHandle) return GslShortVector(new, scope) } override fun equals(other: Any?): Boolean { if (other is GslShortVector) - return gsl_vector_short_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return gsl_vector_short_equal(nativeHandle, other.nativeHandle) == 1 return super.equals(other) } - override fun close(): Unit = gsl_vector_short_free(nativeHandleChecked()) + override fun close(): Unit = gsl_vector_short_free(nativeHandle) } -internal class GslUShortVector(override val nativeHandle: CPointer, scope: DeferScope) : +internal class GslUShortVector(override val rawNativeHandle: CPointer, scope: AutofreeScope) : GslVector(scope) { override val size: Int - get() = nativeHandleChecked().pointed.size.toInt() + get() = nativeHandle.pointed.size.toInt() override operator fun get(index: Int): UShort = - gsl_vector_ushort_get(nativeHandleChecked(), index.toULong()) + gsl_vector_ushort_get(nativeHandle, index.toULong()) override operator fun set(index: Int, value: UShort): Unit = - gsl_vector_ushort_set(nativeHandleChecked(), index.toULong(), value) + gsl_vector_ushort_set(nativeHandle, index.toULong(), value) override fun copy(): GslUShortVector { val new = requireNotNull(gsl_vector_ushort_alloc(size.toULong())) - gsl_vector_ushort_memcpy(new, nativeHandleChecked()) + gsl_vector_ushort_memcpy(new, nativeHandle) return GslUShortVector(new, scope) } override fun equals(other: Any?): Boolean { if (other is GslUShortVector) - return gsl_vector_ushort_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return gsl_vector_ushort_equal(nativeHandle, other.nativeHandle) == 1 return super.equals(other) } - override fun close(): Unit = gsl_vector_ushort_free(nativeHandleChecked()) + override fun close(): Unit = gsl_vector_ushort_free(nativeHandle) } -internal class GslLongVector(override val nativeHandle: CPointer, scope: DeferScope) : +internal class GslLongVector(override val rawNativeHandle: CPointer, scope: AutofreeScope) : GslVector(scope) { override val size: Int - get() = nativeHandleChecked().pointed.size.toInt() + get() = nativeHandle.pointed.size.toInt() override operator fun get(index: Int): Long = - gsl_vector_long_get(nativeHandleChecked(), index.toULong()) + gsl_vector_long_get(nativeHandle, index.toULong()) override operator fun set(index: Int, value: Long): Unit = - gsl_vector_long_set(nativeHandleChecked(), index.toULong(), value) + gsl_vector_long_set(nativeHandle, index.toULong(), value) override fun copy(): GslLongVector { val new = requireNotNull(gsl_vector_long_alloc(size.toULong())) - gsl_vector_long_memcpy(new, nativeHandleChecked()) + gsl_vector_long_memcpy(new, nativeHandle) return GslLongVector(new, scope) } override fun equals(other: Any?): Boolean { if (other is GslLongVector) - return gsl_vector_long_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return gsl_vector_long_equal(nativeHandle, other.nativeHandle) == 1 return super.equals(other) } - override fun close(): Unit = gsl_vector_long_free(nativeHandleChecked()) + override fun close(): Unit = gsl_vector_long_free(nativeHandle) } -internal class GslULongVector(override val nativeHandle: CPointer, scope: DeferScope) : +internal class GslULongVector(override val rawNativeHandle: CPointer, scope: AutofreeScope) : GslVector(scope) { override val size: Int - get() = nativeHandleChecked().pointed.size.toInt() + get() = nativeHandle.pointed.size.toInt() override operator fun get(index: Int): ULong = - gsl_vector_ulong_get(nativeHandleChecked(), index.toULong()) + gsl_vector_ulong_get(nativeHandle, index.toULong()) override operator fun set(index: Int, value: ULong): Unit = - gsl_vector_ulong_set(nativeHandleChecked(), index.toULong(), value) + gsl_vector_ulong_set(nativeHandle, index.toULong(), value) override fun copy(): GslULongVector { val new = requireNotNull(gsl_vector_ulong_alloc(size.toULong())) - gsl_vector_ulong_memcpy(new, nativeHandleChecked()) + gsl_vector_ulong_memcpy(new, nativeHandle) return GslULongVector(new, scope) } override fun equals(other: Any?): Boolean { if (other is GslULongVector) - return gsl_vector_ulong_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return gsl_vector_ulong_equal(nativeHandle, other.nativeHandle) == 1 return super.equals(other) } - override fun close(): Unit = gsl_vector_ulong_free(nativeHandleChecked()) + override fun close(): Unit = gsl_vector_ulong_free(nativeHandle) } -internal class GslIntVector(override val nativeHandle: CPointer, scope: DeferScope) : +internal class GslIntVector(override val rawNativeHandle: CPointer, scope: AutofreeScope) : GslVector(scope) { override val size: Int - get() = nativeHandleChecked().pointed.size.toInt() + get() = nativeHandle.pointed.size.toInt() override operator fun get(index: Int): Int = - gsl_vector_int_get(nativeHandleChecked(), index.toULong()) + gsl_vector_int_get(nativeHandle, index.toULong()) override operator fun set(index: Int, value: Int): Unit = - gsl_vector_int_set(nativeHandleChecked(), index.toULong(), value) + gsl_vector_int_set(nativeHandle, index.toULong(), value) override fun copy(): GslIntVector { val new = requireNotNull(gsl_vector_int_alloc(size.toULong())) - gsl_vector_int_memcpy(new, nativeHandleChecked()) + gsl_vector_int_memcpy(new, nativeHandle) return GslIntVector(new, scope) } override fun equals(other: Any?): Boolean { if (other is GslIntVector) - return gsl_vector_int_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return gsl_vector_int_equal(nativeHandle, other.nativeHandle) == 1 return super.equals(other) } - override fun close(): Unit = gsl_vector_int_free(nativeHandleChecked()) + override fun close(): Unit = gsl_vector_int_free(nativeHandle) } -internal class GslUIntVector(override val nativeHandle: CPointer, scope: DeferScope) : +internal class GslUIntVector(override val rawNativeHandle: CPointer, scope: AutofreeScope) : GslVector(scope) { override val size: Int - get() = nativeHandleChecked().pointed.size.toInt() + get() = nativeHandle.pointed.size.toInt() override operator fun get(index: Int): UInt = - gsl_vector_uint_get(nativeHandleChecked(), index.toULong()) + gsl_vector_uint_get(nativeHandle, index.toULong()) override operator fun set(index: Int, value: UInt): Unit = - gsl_vector_uint_set(nativeHandleChecked(), index.toULong(), value) + gsl_vector_uint_set(nativeHandle, index.toULong(), value) override fun copy(): GslUIntVector { val new = requireNotNull(gsl_vector_uint_alloc(size.toULong())) - gsl_vector_uint_memcpy(new, nativeHandleChecked()) + gsl_vector_uint_memcpy(new, nativeHandle) return GslUIntVector(new, scope) } override fun equals(other: Any?): Boolean { if (other is GslUIntVector) - return gsl_vector_uint_equal(nativeHandleChecked(), other.nativeHandleChecked()) == 1 + return gsl_vector_uint_equal(nativeHandle, other.nativeHandle) == 1 return super.equals(other) } - override fun close(): Unit = gsl_vector_uint_free(nativeHandleChecked()) + override fun close(): Unit = gsl_vector_uint_free(nativeHandle) } diff --git a/kmath-gsl/src/nativeTest/kotlin/GslMatrixRealTest.kt b/kmath-gsl/src/nativeTest/kotlin/GslMatrixRealTest.kt index b4b446462..c171f6d0a 100644 --- a/kmath-gsl/src/nativeTest/kotlin/GslMatrixRealTest.kt +++ b/kmath-gsl/src/nativeTest/kotlin/GslMatrixRealTest.kt @@ -3,6 +3,8 @@ package kscience.kmath.gsl import kscience.kmath.linear.RealMatrixContext import kscience.kmath.operations.invoke import kscience.kmath.structures.Matrix +import kscience.kmath.structures.asIterable +import kscience.kmath.structures.toList import kotlin.random.Random import kotlin.test.Test import kotlin.test.assertEquals @@ -39,4 +41,22 @@ internal class GslMatrixRealTest { assertEquals(mat, mat3) assertEquals(mat2, mat3) } + + @Test + fun rows() = GslRealMatrixContext { + val mat = produce(2, 2) { i, j -> i.toDouble() + j } + + mat.rows.asIterable().zip(listOf(listOf(0.0, 1.0), listOf(1.0, 2.0))).forEach { (a, b) -> + assertEquals(a.toList(), b) + } + } + + @Test + fun columns() = GslRealMatrixContext { + val mat = produce(2, 2) { i, j -> i.toDouble() + j } + + mat.columns.asIterable().zip(listOf(listOf(0.0, 1.0), listOf(1.0, 2.0))).forEach { (a, b) -> + assertEquals(a.toList(), b) + } + } } From 7105b3662f49d92a2b731646497438cf96f68e60 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 24 Jan 2021 02:08:11 +0700 Subject: [PATCH 60/76] Minor: update Kotlin compiler in buildSrc --- buildSrc/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 84d1706d5..62d29d09e 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -5,5 +5,5 @@ plugins { repositories.jcenter() dependencies { - implementation(kotlin("compiler-embeddable", "1.4.20")) + implementation(kotlin("compiler-embeddable", "1.4.21")) } From 472e2bf6714619de0d493633d011a109762b489c Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 24 Jan 2021 14:15:41 +0700 Subject: [PATCH 61/76] Improve LUP decomposition wrapper, add Cholesky decomposition --- .../kscience/kmath/gsl/GslMatrixContext.kt | 117 ++++++++++++------ 1 file changed, 78 insertions(+), 39 deletions(-) diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt index c32d852ba..62e863890 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt @@ -7,7 +7,6 @@ import kscience.kmath.operations.Complex import kscience.kmath.operations.ComplexField import kscience.kmath.operations.toComplex import kscience.kmath.structures.Matrix -import kscience.kmath.structures.toList import org.gnu.gsl.* import kotlin.reflect.KClass import kotlin.reflect.cast @@ -114,37 +113,41 @@ public class GslRealMatrixContext(internal val scope: AutofreeScope) : @Suppress("IMPLICIT_CAST_TO_ANY") @UnstableKMathAPI public override fun getFeature(m: Matrix, type: KClass): F? = when (type) { - LupDecompositionFeature::class -> object : LupDecompositionFeature { - private val lup by lazy { + LupDecompositionFeature::class, DeterminantFeature::class -> object : LupDecompositionFeature, + DeterminantFeature, InverseMatrixFeature { + private val lups by lazy { val lu = m.toGsl().copy() - val n = lu.rowNum + val n = m.rowNum val perm = gsl_permutation_alloc(n.toULong()) + scope.defer { gsl_permutation_free(perm) } - memScoped { + val signum = memScoped { val i = alloc() gsl_linalg_LU_decomp(lu.nativeHandle, perm, i.ptr) + i.value } + Triple(lu, perm, signum) + } + + override val p by lazy { + val n = m.rowNum val one = produce(n, n) { i, j -> if (i == j) 1.0 else 0.0 } - val p = produce(n, n) { _, _ -> 0.0 } + val perm = produce(n, n) { _, _ -> 0.0 } - for (j in 0 until perm!!.pointed.size.toInt()) { - println("7 $j") - val k = gsl_permutation_get(perm, j.toULong()).toInt() + for (j in 0 until lups.second!!.pointed.size.toInt()) { + val k = gsl_permutation_get(lups.second!!, j.toULong()).toInt() val col = one.columns[k] - println(p.toGsl()) - println(col.toList()) - gsl_matrix_set_col(p.nativeHandle, j.toULong(), col.toGsl().nativeHandle) + gsl_matrix_set_col(perm.nativeHandle, j.toULong(), col.toGsl().nativeHandle) } - gsl_permutation_free(perm) - lu to p + perm } override val l by lazy { - VirtualMatrix(lup.first.shape[0], lup.first.shape[1]) { i, j -> + VirtualMatrix(lups.first.shape[0], lups.first.shape[1]) { i, j -> when { - j < i -> lup.first[i, j] + j < i -> lups.first[i, j] j == i -> 1.0 else -> 0.0 } @@ -153,13 +156,28 @@ public class GslRealMatrixContext(internal val scope: AutofreeScope) : override val u by lazy { VirtualMatrix( - lup.first.shape[0], - lup.first.shape[1], - ) { i, j -> if (j >= i) lup.first[i, j] else 0.0 } + UFeature + lups.first.shape[0], + lups.first.shape[1], + ) { i, j -> if (j >= i) lups.first[i, j] else 0.0 } + UFeature } - override val p by lazy(lup::second) + override val determinant by lazy { gsl_linalg_LU_det(lups.first.nativeHandle, lups.third) } + + override val inverse by lazy { + val inv = lups.first.copy() + gsl_linalg_LU_invx(inv.nativeHandle, lups.second) + inv + } } + + CholeskyDecompositionFeature::class -> object : CholeskyDecompositionFeature { + override val l: Matrix by lazy { + val chol = m.toGsl().copy() + gsl_linalg_cholesky_decomp(chol.nativeHandle) + chol + } + } + else -> super.getFeature(m, type) }?.let(type::cast) } @@ -286,37 +304,41 @@ public class GslComplexMatrixContext(internal val scope: AutofreeScope) : @Suppress("IMPLICIT_CAST_TO_ANY") @UnstableKMathAPI public override fun getFeature(m: Matrix, type: KClass): F? = when (type) { - LupDecompositionFeature::class -> object : LupDecompositionFeature { - private val lup by lazy { + LupDecompositionFeature::class, DeterminantFeature::class -> object : LupDecompositionFeature, + DeterminantFeature, InverseMatrixFeature { + private val lups by lazy { val lu = m.toGsl().copy() - val n = lu.rowNum + val n = m.rowNum val perm = gsl_permutation_alloc(n.toULong()) + scope.defer { gsl_permutation_free(perm) } - memScoped { + val signum = memScoped { val i = alloc() gsl_linalg_complex_LU_decomp(lu.nativeHandle, perm, i.ptr) + i.value } + Triple(lu, perm, signum) + } + + override val p by lazy { + val n = m.rowNum val one = produce(n, n) { i, j -> if (i == j) 1.0.toComplex() else 0.0.toComplex() } - val p = produce(n, n) { _, _ -> 0.0.toComplex() } + val perm = produce(n, n) { _, _ -> 0.0.toComplex() } - for (j in 0 until perm!!.pointed.size.toInt()) { - println("7 $j") - val k = gsl_permutation_get(perm, j.toULong()).toInt() + for (j in 0 until lups.second!!.pointed.size.toInt()) { + val k = gsl_permutation_get(lups.second!!, j.toULong()).toInt() val col = one.columns[k] - println(p.toGsl()) - println(col.toList()) - gsl_matrix_complex_set_col(p.nativeHandle, j.toULong(), col.toGsl().nativeHandle) + gsl_matrix_complex_set_col(perm.nativeHandle, j.toULong(), col.toGsl().nativeHandle) } - gsl_permutation_free(perm) - lu to p + perm } override val l by lazy { - VirtualMatrix(lup.first.shape[0], lup.first.shape[1]) { i, j -> + VirtualMatrix(lups.first.shape[0], lups.first.shape[1]) { i, j -> when { - j < i -> lup.first[i, j] + j < i -> lups.first[i, j] j == i -> 1.0.toComplex() else -> 0.0.toComplex() } @@ -325,13 +347,30 @@ public class GslComplexMatrixContext(internal val scope: AutofreeScope) : override val u by lazy { VirtualMatrix( - lup.first.shape[0], - lup.first.shape[1], - ) { i, j -> if (j >= i) lup.first[i, j] else 0.0.toComplex() } + UFeature + lups.first.shape[0], + lups.first.shape[1], + ) { i, j -> if (j >= i) lups.first[i, j] else 0.0.toComplex() } + UFeature } - override val p by lazy(lup::second) + override val determinant by lazy { + gsl_linalg_complex_LU_det(lups.first.nativeHandle, lups.third).toKMath() + } + + override val inverse by lazy { + val inv = lups.first.copy() + gsl_linalg_complex_LU_invx(inv.nativeHandle, lups.second) + inv + } } + + CholeskyDecompositionFeature::class -> object : CholeskyDecompositionFeature { + override val l by lazy { + val chol = m.toGsl().copy() + gsl_linalg_complex_cholesky_decomp(chol.nativeHandle) + chol + } + } + else -> super.getFeature(m, type) }?.let(type::cast) } From c50fab027a0bb00ca28a53db21c05f5ab0e83e01 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 24 Jan 2021 16:13:08 +0700 Subject: [PATCH 62/76] Improve null checking and introduce internal wrapper of permutation object --- .../kmath/gsl/codegen/matricesCodegen.kt | 2 +- .../kmath/gsl/codegen/vectorsCodegen.kt | 2 +- kmath-gsl/build.gradle.kts | 10 ++-- .../kotlin/kscience/kmath/gsl/GslComplex.kt | 4 +- .../kscience/kmath/gsl/GslMatrixContext.kt | 56 ++++++++----------- .../kscience/kmath/gsl/GslPermutation.kt | 16 ++++++ .../kotlin/kscience/kmath/gsl/_Matrices.kt | 16 +++--- .../kotlin/kscience/kmath/gsl/_Vectors.kt | 16 +++--- 8 files changed, 64 insertions(+), 58 deletions(-) create mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslPermutation.kt diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt index fd00a0255..df21a8c06 100644 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt @@ -51,7 +51,7 @@ private fun KtPsiFactory.createMatrixClass( ${fn("gsl_matrixRset")}(nativeHandle, i.toULong(), j.toULong(), value) override fun copy(): $className { - val new = requireNotNull(${fn("gsl_matrixRalloc")}(rowNum.toULong(), colNum.toULong())) + val new = checkNotNull(${fn("gsl_matrixRalloc")}(rowNum.toULong(), colNum.toULong())) ${fn("gsl_matrixRmemcpy")}(new, nativeHandle) return $className(new, scope) } diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt index 513d05727..c39b2b8f6 100644 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt @@ -31,7 +31,7 @@ private fun KtPsiFactory.createVectorClass( ${fn("gsl_vectorRset")}(nativeHandle, index.toULong(), value) override fun copy(): $className { - val new = requireNotNull(${fn("gsl_vectorRalloc")}(size.toULong())) + val new = checkNotNull(${fn("gsl_vectorRalloc")}(size.toULong())) ${fn("gsl_vectorRmemcpy")}(new, nativeHandle) return ${className}(new, scope) } diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index df405326f..83859130c 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -12,7 +12,7 @@ kotlin { val nativeTarget = when (System.getProperty("os.name")) { // "Mac OS X" -> macosX64() - "Linux" -> linuxX64() + "Linux" -> linuxX64("native") else -> { logger.warn("Current OS cannot build any of kmath-gsl targets.") @@ -29,7 +29,7 @@ kotlin { val test by nativeTarget.compilations.getting sourceSets { - val nativeMain by creating { + val nativeMain by getting { val codegen by tasks.creating { matricesCodegen(kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Matrices.kt") vectorsCodegen(kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Vectors.kt") @@ -42,11 +42,11 @@ kotlin { } } - val nativeTest by creating { + val nativeTest by getting { dependsOn(nativeMain) } - main.defaultSourceSet.dependsOn(nativeMain) - test.defaultSourceSet.dependsOn(nativeTest) +// main.defaultSourceSet.dependsOn(nativeMain) +// test.defaultSourceSet.dependsOn(nativeTest) } } diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt index 6881bb0e4..4a48e432a 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt @@ -44,7 +44,7 @@ internal class GslComplexMatrix(override val rawNativeHandle: CPointer() { override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = GslRealMatrix( - rawNativeHandle = requireNotNull(gsl_matrix_alloc(rows.toULong(), columns.toULong())), + rawNativeHandle = checkNotNull(gsl_matrix_alloc(rows.toULong(), columns.toULong())), scope = scope, ) override fun produceDirtyVector(size: Int): GslVector = - GslRealVector(rawNativeHandle = requireNotNull(gsl_vector_alloc(size.toULong())), scope = scope) + GslRealVector(rawNativeHandle = checkNotNull(gsl_vector_alloc(size.toULong())), scope = scope) public override fun Matrix.dot(other: Matrix): GslMatrix { val x = toGsl().nativeHandle val a = other.toGsl().nativeHandle - val result = requireNotNull(gsl_matrix_calloc(a.pointed.size1, a.pointed.size2)) + val result = checkNotNull(gsl_matrix_calloc(a.pointed.size1, a.pointed.size2)) gsl_blas_dgemm(CblasNoTrans, CblasNoTrans, 1.0, x, a, 1.0, result) return GslRealMatrix(result, scope = scope) } @@ -81,7 +81,7 @@ public class GslRealMatrixContext(internal val scope: AutofreeScope) : public override fun Matrix.dot(vector: Point): GslVector { val x = toGsl().nativeHandle val a = vector.toGsl().nativeHandle - val result = requireNotNull(gsl_vector_calloc(a.pointed.size)) + val result = checkNotNull(gsl_vector_calloc(a.pointed.size)) gsl_blas_dgemv(CblasNoTrans, 1.0, x, a, 1.0, result) return GslRealVector(result, scope = scope) } @@ -118,12 +118,11 @@ public class GslRealMatrixContext(internal val scope: AutofreeScope) : private val lups by lazy { val lu = m.toGsl().copy() val n = m.rowNum - val perm = gsl_permutation_alloc(n.toULong()) - scope.defer { gsl_permutation_free(perm) } + val perm = GslPermutation(checkNotNull(gsl_permutation_alloc(n.toULong())), scope) val signum = memScoped { val i = alloc() - gsl_linalg_LU_decomp(lu.nativeHandle, perm, i.ptr) + gsl_linalg_LU_decomp(lu.nativeHandle, perm.nativeHandle, i.ptr) i.value } @@ -135,11 +134,8 @@ public class GslRealMatrixContext(internal val scope: AutofreeScope) : val one = produce(n, n) { i, j -> if (i == j) 1.0 else 0.0 } val perm = produce(n, n) { _, _ -> 0.0 } - for (j in 0 until lups.second!!.pointed.size.toInt()) { - val k = gsl_permutation_get(lups.second!!, j.toULong()).toInt() - val col = one.columns[k] - gsl_matrix_set_col(perm.nativeHandle, j.toULong(), col.toGsl().nativeHandle) - } + for (j in 0 until lups.second.size) + gsl_matrix_set_col(perm.nativeHandle, j.toULong(), one.columns[lups.second[j]].toGsl().nativeHandle) perm } @@ -165,7 +161,7 @@ public class GslRealMatrixContext(internal val scope: AutofreeScope) : override val inverse by lazy { val inv = lups.first.copy() - gsl_linalg_LU_invx(inv.nativeHandle, lups.second) + gsl_linalg_LU_invx(inv.nativeHandle, lups.second.nativeHandle) inv } } @@ -194,17 +190,17 @@ public fun GslRealMatrixContext(block: GslRealMatrixContext.() -> R): R = public class GslFloatMatrixContext(internal val scope: AutofreeScope) : GslMatrixContext() { override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = GslFloatMatrix( - rawNativeHandle = requireNotNull(gsl_matrix_float_alloc(rows.toULong(), columns.toULong())), + rawNativeHandle = checkNotNull(gsl_matrix_float_alloc(rows.toULong(), columns.toULong())), scope = scope, ) override fun produceDirtyVector(size: Int): GslVector = - GslFloatVector(rawNativeHandle = requireNotNull(value = gsl_vector_float_alloc(size.toULong())), scope = scope) + GslFloatVector(rawNativeHandle = checkNotNull(value = gsl_vector_float_alloc(size.toULong())), scope = scope) public override fun Matrix.dot(other: Matrix): GslMatrix { val x = toGsl().nativeHandle val a = other.toGsl().nativeHandle - val result = requireNotNull(gsl_matrix_float_calloc(a.pointed.size1, a.pointed.size2)) + val result = checkNotNull(gsl_matrix_float_calloc(a.pointed.size1, a.pointed.size2)) gsl_blas_sgemm(CblasNoTrans, CblasNoTrans, 1f, x, a, 1f, result) return GslFloatMatrix(rawNativeHandle = result, scope = scope) } @@ -212,7 +208,7 @@ public class GslFloatMatrixContext(internal val scope: AutofreeScope) : public override fun Matrix.dot(vector: Point): GslVector { val x = toGsl().nativeHandle val a = vector.toGsl().nativeHandle - val result = requireNotNull(gsl_vector_float_calloc(a.pointed.size)) + val result = checkNotNull(gsl_vector_float_calloc(a.pointed.size)) gsl_blas_sgemv(CblasNoTrans, 1f, x, a, 1f, result) return GslFloatVector(rawNativeHandle = result, scope = scope) } @@ -254,17 +250,17 @@ public fun GslFloatMatrixContext(block: GslFloatMatrixContext.() -> R): R = public class GslComplexMatrixContext(internal val scope: AutofreeScope) : GslMatrixContext() { override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = GslComplexMatrix( - rawNativeHandle = requireNotNull(gsl_matrix_complex_alloc(rows.toULong(), columns.toULong())), + rawNativeHandle = checkNotNull(gsl_matrix_complex_alloc(rows.toULong(), columns.toULong())), scope = scope, ) override fun produceDirtyVector(size: Int): GslVector = - GslComplexVector(rawNativeHandle = requireNotNull(gsl_vector_complex_alloc(size.toULong())), scope = scope) + GslComplexVector(rawNativeHandle = checkNotNull(gsl_vector_complex_alloc(size.toULong())), scope = scope) public override fun Matrix.dot(other: Matrix): GslMatrix { val x = toGsl().nativeHandle val a = other.toGsl().nativeHandle - val result = requireNotNull(gsl_matrix_complex_calloc(a.pointed.size1, a.pointed.size2)) + val result = checkNotNull(gsl_matrix_complex_calloc(a.pointed.size1, a.pointed.size2)) gsl_blas_zgemm(CblasNoTrans, CblasNoTrans, ComplexField.one.toGsl(), x, a, ComplexField.one.toGsl(), result) return GslComplexMatrix(rawNativeHandle = result, scope = scope) } @@ -272,7 +268,7 @@ public class GslComplexMatrixContext(internal val scope: AutofreeScope) : public override fun Matrix.dot(vector: Point): GslVector { val x = toGsl().nativeHandle val a = vector.toGsl().nativeHandle - val result = requireNotNull(gsl_vector_complex_calloc(a.pointed.size)) + val result = checkNotNull(gsl_vector_complex_calloc(a.pointed.size)) gsl_blas_zgemv(CblasNoTrans, ComplexField.one.toGsl(), x, a, ComplexField.one.toGsl(), result) return GslComplexVector(result, scope) } @@ -309,12 +305,11 @@ public class GslComplexMatrixContext(internal val scope: AutofreeScope) : private val lups by lazy { val lu = m.toGsl().copy() val n = m.rowNum - val perm = gsl_permutation_alloc(n.toULong()) - scope.defer { gsl_permutation_free(perm) } + val perm = GslPermutation(checkNotNull(gsl_permutation_alloc(n.toULong())), scope) val signum = memScoped { val i = alloc() - gsl_linalg_complex_LU_decomp(lu.nativeHandle, perm, i.ptr) + gsl_linalg_complex_LU_decomp(lu.nativeHandle, perm.nativeHandle, i.ptr) i.value } @@ -326,11 +321,8 @@ public class GslComplexMatrixContext(internal val scope: AutofreeScope) : val one = produce(n, n) { i, j -> if (i == j) 1.0.toComplex() else 0.0.toComplex() } val perm = produce(n, n) { _, _ -> 0.0.toComplex() } - for (j in 0 until lups.second!!.pointed.size.toInt()) { - val k = gsl_permutation_get(lups.second!!, j.toULong()).toInt() - val col = one.columns[k] - gsl_matrix_complex_set_col(perm.nativeHandle, j.toULong(), col.toGsl().nativeHandle) - } + for (j in 0 until lups.second.size) + gsl_matrix_complex_set_col(perm.nativeHandle, j.toULong(), one.columns[lups.second[j]].toGsl().nativeHandle) perm } @@ -352,13 +344,11 @@ public class GslComplexMatrixContext(internal val scope: AutofreeScope) : ) { i, j -> if (j >= i) lups.first[i, j] else 0.0.toComplex() } + UFeature } - override val determinant by lazy { - gsl_linalg_complex_LU_det(lups.first.nativeHandle, lups.third).toKMath() - } + override val determinant by lazy { gsl_linalg_complex_LU_det(lups.first.nativeHandle, lups.third).toKMath() } override val inverse by lazy { val inv = lups.first.copy() - gsl_linalg_complex_LU_invx(inv.nativeHandle, lups.second) + gsl_linalg_complex_LU_invx(inv.nativeHandle, lups.second.nativeHandle) inv } } diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslPermutation.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslPermutation.kt new file mode 100644 index 000000000..3d5c4a3a4 --- /dev/null +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslPermutation.kt @@ -0,0 +1,16 @@ +package kscience.kmath.gsl + +import kotlinx.cinterop.AutofreeScope +import kotlinx.cinterop.CPointer +import kotlinx.cinterop.pointed +import org.gnu.gsl.gsl_permutation +import org.gnu.gsl.gsl_permutation_free +import org.gnu.gsl.gsl_permutation_get + +internal class GslPermutation(override val rawNativeHandle: CPointer, scope: AutofreeScope) : + GslMemoryHolder(scope) { + val size get() = nativeHandle.pointed.size.toInt() + + operator fun get(i: Int) = gsl_permutation_get(nativeHandle, i.toULong()).toInt() + override fun close() = gsl_permutation_free(nativeHandle) +} diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt index 1a826d493..7dbab66d7 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt @@ -37,7 +37,7 @@ internal class GslRealMatrix( gsl_matrix_set(nativeHandle, i.toULong(), j.toULong(), value) override fun copy(): GslRealMatrix { - val new = requireNotNull(gsl_matrix_alloc(rowNum.toULong(), colNum.toULong())) + val new = checkNotNull(gsl_matrix_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_memcpy(new, nativeHandle) return GslRealMatrix(new, scope) } @@ -85,7 +85,7 @@ internal class GslFloatMatrix( gsl_matrix_float_set(nativeHandle, i.toULong(), j.toULong(), value) override fun copy(): GslFloatMatrix { - val new = requireNotNull(gsl_matrix_float_alloc(rowNum.toULong(), colNum.toULong())) + val new = checkNotNull(gsl_matrix_float_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_float_memcpy(new, nativeHandle) return GslFloatMatrix(new, scope) } @@ -133,7 +133,7 @@ internal class GslShortMatrix( gsl_matrix_short_set(nativeHandle, i.toULong(), j.toULong(), value) override fun copy(): GslShortMatrix { - val new = requireNotNull(gsl_matrix_short_alloc(rowNum.toULong(), colNum.toULong())) + val new = checkNotNull(gsl_matrix_short_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_short_memcpy(new, nativeHandle) return GslShortMatrix(new, scope) } @@ -181,7 +181,7 @@ internal class GslUShortMatrix( gsl_matrix_ushort_set(nativeHandle, i.toULong(), j.toULong(), value) override fun copy(): GslUShortMatrix { - val new = requireNotNull(gsl_matrix_ushort_alloc(rowNum.toULong(), colNum.toULong())) + val new = checkNotNull(gsl_matrix_ushort_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_ushort_memcpy(new, nativeHandle) return GslUShortMatrix(new, scope) } @@ -229,7 +229,7 @@ internal class GslLongMatrix( gsl_matrix_long_set(nativeHandle, i.toULong(), j.toULong(), value) override fun copy(): GslLongMatrix { - val new = requireNotNull(gsl_matrix_long_alloc(rowNum.toULong(), colNum.toULong())) + val new = checkNotNull(gsl_matrix_long_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_long_memcpy(new, nativeHandle) return GslLongMatrix(new, scope) } @@ -277,7 +277,7 @@ internal class GslULongMatrix( gsl_matrix_ulong_set(nativeHandle, i.toULong(), j.toULong(), value) override fun copy(): GslULongMatrix { - val new = requireNotNull(gsl_matrix_ulong_alloc(rowNum.toULong(), colNum.toULong())) + val new = checkNotNull(gsl_matrix_ulong_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_ulong_memcpy(new, nativeHandle) return GslULongMatrix(new, scope) } @@ -325,7 +325,7 @@ internal class GslIntMatrix( gsl_matrix_int_set(nativeHandle, i.toULong(), j.toULong(), value) override fun copy(): GslIntMatrix { - val new = requireNotNull(gsl_matrix_int_alloc(rowNum.toULong(), colNum.toULong())) + val new = checkNotNull(gsl_matrix_int_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_int_memcpy(new, nativeHandle) return GslIntMatrix(new, scope) } @@ -373,7 +373,7 @@ internal class GslUIntMatrix( gsl_matrix_uint_set(nativeHandle, i.toULong(), j.toULong(), value) override fun copy(): GslUIntMatrix { - val new = requireNotNull(gsl_matrix_uint_alloc(rowNum.toULong(), colNum.toULong())) + val new = checkNotNull(gsl_matrix_uint_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_uint_memcpy(new, nativeHandle) return GslUIntMatrix(new, scope) } diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt index 5b5236242..42ecb2fca 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt @@ -15,7 +15,7 @@ internal class GslRealVector(override val rawNativeHandle: CPointer, gsl_vector_set(nativeHandle, index.toULong(), value) override fun copy(): GslRealVector { - val new = requireNotNull(gsl_vector_alloc(size.toULong())) + val new = checkNotNull(gsl_vector_alloc(size.toULong())) gsl_vector_memcpy(new, nativeHandle) return GslRealVector(new, scope) } @@ -42,7 +42,7 @@ internal class GslFloatVector(override val rawNativeHandle: CPointer Date: Sun, 24 Jan 2021 16:13:30 +0700 Subject: [PATCH 63/76] Rename GslMemoryHolder to GslObject --- kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt | 2 +- .../kscience/kmath/gsl/{GslMemoryHolder.kt => GslObject.kt} | 2 +- .../src/nativeMain/kotlin/kscience/kmath/gsl/GslPermutation.kt | 2 +- kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/{GslMemoryHolder.kt => GslObject.kt} (89%) diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt index c28236a67..fe8aea577 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt @@ -10,7 +10,7 @@ import kscience.kmath.structures.asSequence * Wraps gsl_matrix_* objects from GSL. */ public abstract class GslMatrix internal constructor(scope: AutofreeScope) : - GslMemoryHolder(scope), Matrix { + GslObject(scope), Matrix { internal abstract operator fun set(i: Int, j: Int, value: T) internal abstract fun copy(): GslMatrix diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslObject.kt similarity index 89% rename from kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt rename to kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslObject.kt index 46d1ba60b..8c771a183 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMemoryHolder.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslObject.kt @@ -13,7 +13,7 @@ import kotlinx.cinterop.DeferScope * * @param scope the scope where this object is declared. */ -public abstract class GslMemoryHolder internal constructor(internal val scope: AutofreeScope) { +public abstract class GslObject internal constructor(internal val scope: AutofreeScope) { internal abstract val rawNativeHandle: CPointer private var isClosed: Boolean = false diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslPermutation.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslPermutation.kt index 3d5c4a3a4..49baceb6b 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslPermutation.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslPermutation.kt @@ -8,7 +8,7 @@ import org.gnu.gsl.gsl_permutation_free import org.gnu.gsl.gsl_permutation_get internal class GslPermutation(override val rawNativeHandle: CPointer, scope: AutofreeScope) : - GslMemoryHolder(scope) { + GslObject(scope) { val size get() = nativeHandle.pointed.size.toInt() operator fun get(i: Int) = gsl_permutation_get(nativeHandle, i.toULong()).toInt() diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt index 8bc1240b4..fb8ba53d7 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt @@ -8,7 +8,7 @@ import kscience.kmath.linear.Point * Wraps gsl_vector_* objects from GSL. */ public abstract class GslVector internal constructor(scope: AutofreeScope) : - GslMemoryHolder(scope), Point { + GslObject(scope), Point { internal abstract operator fun set(index: Int, value: T) internal abstract fun copy(): GslVector From e66f169655f1d1bbe3e6f3399e5724502b76f31a Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sat, 30 Jan 2021 17:35:13 +0700 Subject: [PATCH 64/76] Add owned property to all the objects --- .../kmath/gsl/codegen/matricesCodegen.kt | 11 +- .../kmath/gsl/codegen/vectorsCodegen.kt | 20 +-- .../kotlin/kscience/kmath/gsl/GslComplex.kt | 35 ++-- .../kotlin/kscience/kmath/gsl/GslMatrix.kt | 8 +- .../kscience/kmath/gsl/GslMatrixContext.kt | 41 +++-- .../kotlin/kscience/kmath/gsl/GslObject.kt | 6 +- .../kscience/kmath/gsl/GslPermutation.kt | 7 +- .../kotlin/kscience/kmath/gsl/GslVector.kt | 4 +- .../kotlin/kscience/kmath/gsl/_Matrices.kt | 88 ++++++---- .../kotlin/kscience/kmath/gsl/_Vectors.kt | 160 ++++++++---------- .../nativeTest/kotlin/GslMatrixRealTest.kt | 2 +- .../kotlin/GslRealMatrixContextTest.kt | 2 +- 12 files changed, 207 insertions(+), 177 deletions(-) diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt index df21a8c06..763f08814 100644 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt @@ -21,7 +21,8 @@ private fun KtPsiFactory.createMatrixClass( @Language("kotlin") val text = """internal class $className( override val rawNativeHandle: CPointer<$structName>, scope: AutofreeScope, -) : GslMatrix<$kotlinTypeName, $structName>(scope) { + owned: Boolean, +) : GslMatrix<$kotlinTypeName, $structName>(scope, owned) { override val rowNum: Int get() = nativeHandle.pointed.size1.toInt() @@ -33,7 +34,8 @@ private fun KtPsiFactory.createMatrixClass( Gsl${kotlinTypeAlias}Vector( ${fn("gsl_matrixRrow")}(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, scope, - ).apply { shouldBeFreed = false } + false, + ) } override val columns: Buffer> @@ -41,7 +43,8 @@ private fun KtPsiFactory.createMatrixClass( Gsl${kotlinTypeAlias}Vector( ${fn("gsl_matrixRcolumn")}(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, scope, - ).apply { shouldBeFreed = false } + false, + ) } override operator fun get(i: Int, j: Int): $kotlinTypeName = @@ -53,7 +56,7 @@ private fun KtPsiFactory.createMatrixClass( override fun copy(): $className { val new = checkNotNull(${fn("gsl_matrixRalloc")}(rowNum.toULong(), colNum.toULong())) ${fn("gsl_matrixRmemcpy")}(new, nativeHandle) - return $className(new, scope) + return $className(new, scope, true) } override fun close(): Unit = ${fn("gsl_matrixRfree")}(nativeHandle) diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt index c39b2b8f6..67ab77186 100644 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt @@ -19,21 +19,19 @@ private fun KtPsiFactory.createVectorClass( val structName = sn("gsl_vectorR", cTypeName) @Language("kotlin") val text = - """internal class $className(override val rawNativeHandle: CPointer<$structName>, scope: AutofreeScope) : - GslVector<$kotlinTypeName, $structName>(scope) { - override val size: Int - get() = nativeHandle.pointed.size.toInt() - - override operator fun get(index: Int): $kotlinTypeName = - ${fn("gsl_vectorRget")}(nativeHandle, index.toULong()) - - override operator fun set(index: Int, value: $kotlinTypeName): Unit = - ${fn("gsl_vectorRset")}(nativeHandle, index.toULong(), value) + """internal class $className( + override val rawNativeHandle: CPointer<$structName>, + scope: AutofreeScope, + owned: Boolean, +) : GslVector<$kotlinTypeName, $structName>(scope, owned) { + override val size: Int get() = nativeHandle.pointed.size.toInt() + override operator fun get(index: Int): $kotlinTypeName = ${fn("gsl_vectorRget")}(nativeHandle, index.toULong()) + override operator fun set(index: Int, value: $kotlinTypeName): Unit = ${fn("gsl_vectorRset")}(nativeHandle, index.toULong(), value) override fun copy(): $className { val new = checkNotNull(${fn("gsl_vectorRalloc")}(size.toULong())) ${fn("gsl_vectorRmemcpy")}(new, nativeHandle) - return ${className}(new, scope) + return ${className}(new, scope, true) } override fun equals(other: Any?): Boolean { diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt index 4a48e432a..c18c0dfdf 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt @@ -13,20 +13,21 @@ internal fun Complex.toGsl(): CValue = cValue { dat[1] = im } -internal class GslComplexMatrix(override val rawNativeHandle: CPointer, scope: AutofreeScope) : - GslMatrix(scope) { - override val rowNum: Int - get() = nativeHandle.pointed.size1.toInt() - - override val colNum: Int - get() = nativeHandle.pointed.size2.toInt() +internal class GslComplexMatrix( + override val rawNativeHandle: CPointer, + scope: AutofreeScope, + owned: Boolean, +) : GslMatrix(scope, owned) { + override val rowNum: Int get() = nativeHandle.pointed.size1.toInt() + override val colNum: Int get() = nativeHandle.pointed.size2.toInt() override val rows: Buffer> get() = VirtualBuffer(rowNum) { r -> GslComplexVector( gsl_matrix_complex_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, scope, - ).apply { shouldBeFreed = false } + false, + ) } override val columns: Buffer> @@ -34,7 +35,8 @@ internal class GslComplexMatrix(override val rawNativeHandle: CPointer, scope: AutofreeScope) : - GslVector(scope) { - override val size: Int - get() = nativeHandle.pointed.size.toInt() - +internal class GslComplexVector( + override val rawNativeHandle: CPointer, + scope: AutofreeScope, + owned: Boolean, +) : GslVector(scope, owned) { + override val size: Int get() = nativeHandle.pointed.size.toInt() override fun get(index: Int): Complex = gsl_vector_complex_get(nativeHandle, index.toULong()).toKMath() override fun set(index: Int, value: Complex): Unit = @@ -72,7 +75,7 @@ internal class GslComplexVector(override val rawNativeHandle: CPointer internal constructor(scope: AutofreeScope) : - GslObject(scope), Matrix { +public abstract class GslMatrix internal constructor(scope: AutofreeScope, owned: Boolean) : + GslObject(scope, owned), Matrix { internal abstract operator fun set(i: Int, j: Int, value: T) internal abstract fun copy(): GslMatrix diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt index 8e27df060..e86d3676e 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt @@ -6,7 +6,6 @@ import kscience.kmath.misc.UnstableKMathAPI import kscience.kmath.operations.Complex import kscience.kmath.operations.ComplexField import kscience.kmath.operations.toComplex -import kscience.kmath.structures.Matrix import org.gnu.gsl.* import kotlin.reflect.KClass import kotlin.reflect.cast @@ -65,17 +64,18 @@ public class GslRealMatrixContext(internal val scope: AutofreeScope) : override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = GslRealMatrix( rawNativeHandle = checkNotNull(gsl_matrix_alloc(rows.toULong(), columns.toULong())), scope = scope, + owned = true, ) override fun produceDirtyVector(size: Int): GslVector = - GslRealVector(rawNativeHandle = checkNotNull(gsl_vector_alloc(size.toULong())), scope = scope) + GslRealVector(rawNativeHandle = checkNotNull(gsl_vector_alloc(size.toULong())), scope = scope, owned = true) public override fun Matrix.dot(other: Matrix): GslMatrix { val x = toGsl().nativeHandle val a = other.toGsl().nativeHandle val result = checkNotNull(gsl_matrix_calloc(a.pointed.size1, a.pointed.size2)) gsl_blas_dgemm(CblasNoTrans, CblasNoTrans, 1.0, x, a, 1.0, result) - return GslRealMatrix(result, scope = scope) + return GslRealMatrix(rawNativeHandle = result, scope = scope, owned = true) } public override fun Matrix.dot(vector: Point): GslVector { @@ -83,7 +83,7 @@ public class GslRealMatrixContext(internal val scope: AutofreeScope) : val a = vector.toGsl().nativeHandle val result = checkNotNull(gsl_vector_calloc(a.pointed.size)) gsl_blas_dgemv(CblasNoTrans, 1.0, x, a, 1.0, result) - return GslRealVector(result, scope = scope) + return GslRealVector(rawNativeHandle = result, scope = scope, owned = true) } public override fun Matrix.times(value: Double): GslMatrix { @@ -118,7 +118,12 @@ public class GslRealMatrixContext(internal val scope: AutofreeScope) : private val lups by lazy { val lu = m.toGsl().copy() val n = m.rowNum - val perm = GslPermutation(checkNotNull(gsl_permutation_alloc(n.toULong())), scope) + + val perm = GslPermutation( + rawNativeHandle = checkNotNull(gsl_permutation_alloc(n.toULong())), + scope = scope, + owned = true, + ) val signum = memScoped { val i = alloc() @@ -192,17 +197,21 @@ public class GslFloatMatrixContext(internal val scope: AutofreeScope) : override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = GslFloatMatrix( rawNativeHandle = checkNotNull(gsl_matrix_float_alloc(rows.toULong(), columns.toULong())), scope = scope, + owned = true, ) - override fun produceDirtyVector(size: Int): GslVector = - GslFloatVector(rawNativeHandle = checkNotNull(value = gsl_vector_float_alloc(size.toULong())), scope = scope) + override fun produceDirtyVector(size: Int): GslVector = GslFloatVector( + rawNativeHandle = checkNotNull(value = gsl_vector_float_alloc(size.toULong())), + scope = scope, + owned = true, + ) public override fun Matrix.dot(other: Matrix): GslMatrix { val x = toGsl().nativeHandle val a = other.toGsl().nativeHandle val result = checkNotNull(gsl_matrix_float_calloc(a.pointed.size1, a.pointed.size2)) gsl_blas_sgemm(CblasNoTrans, CblasNoTrans, 1f, x, a, 1f, result) - return GslFloatMatrix(rawNativeHandle = result, scope = scope) + return GslFloatMatrix(rawNativeHandle = result, scope = scope, owned = true) } public override fun Matrix.dot(vector: Point): GslVector { @@ -210,7 +219,7 @@ public class GslFloatMatrixContext(internal val scope: AutofreeScope) : val a = vector.toGsl().nativeHandle val result = checkNotNull(gsl_vector_float_calloc(a.pointed.size)) gsl_blas_sgemv(CblasNoTrans, 1f, x, a, 1f, result) - return GslFloatVector(rawNativeHandle = result, scope = scope) + return GslFloatVector(rawNativeHandle = result, scope = scope, owned = true) } public override fun Matrix.times(value: Float): GslMatrix { @@ -305,7 +314,10 @@ public class GslComplexMatrixContext(internal val scope: AutofreeScope) : private val lups by lazy { val lu = m.toGsl().copy() val n = m.rowNum - val perm = GslPermutation(checkNotNull(gsl_permutation_alloc(n.toULong())), scope) + + val perm = GslPermutation(rawNativeHandle = checkNotNull(gsl_permutation_alloc(n.toULong())), + scope = scope, + owned = true) val signum = memScoped { val i = alloc() @@ -322,7 +334,9 @@ public class GslComplexMatrixContext(internal val scope: AutofreeScope) : val perm = produce(n, n) { _, _ -> 0.0.toComplex() } for (j in 0 until lups.second.size) - gsl_matrix_complex_set_col(perm.nativeHandle, j.toULong(), one.columns[lups.second[j]].toGsl().nativeHandle) + gsl_matrix_complex_set_col(perm.nativeHandle, + j.toULong(), + one.columns[lups.second[j]].toGsl().nativeHandle) perm } @@ -344,7 +358,10 @@ public class GslComplexMatrixContext(internal val scope: AutofreeScope) : ) { i, j -> if (j >= i) lups.first[i, j] else 0.0.toComplex() } + UFeature } - override val determinant by lazy { gsl_linalg_complex_LU_det(lups.first.nativeHandle, lups.third).toKMath() } + override val determinant by lazy { + gsl_linalg_complex_LU_det(lups.first.nativeHandle, + lups.third).toKMath() + } override val inverse by lazy { val inv = lups.first.copy() diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslObject.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslObject.kt index 8c771a183..ff4ef96c5 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslObject.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslObject.kt @@ -13,7 +13,7 @@ import kotlinx.cinterop.DeferScope * * @param scope the scope where this object is declared. */ -public abstract class GslObject internal constructor(internal val scope: AutofreeScope) { +public abstract class GslObject internal constructor(internal val scope: AutofreeScope, internal val owned: Boolean) { internal abstract val rawNativeHandle: CPointer private var isClosed: Boolean = false @@ -23,13 +23,11 @@ public abstract class GslObject internal constructor(internal va return rawNativeHandle } - internal var shouldBeFreed = true - init { ensureHasGslErrorHandler() scope.defer { - if (shouldBeFreed) close() + if (owned) close() isClosed = true } } diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslPermutation.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslPermutation.kt index 49baceb6b..6954ceee2 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslPermutation.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslPermutation.kt @@ -7,8 +7,11 @@ import org.gnu.gsl.gsl_permutation import org.gnu.gsl.gsl_permutation_free import org.gnu.gsl.gsl_permutation_get -internal class GslPermutation(override val rawNativeHandle: CPointer, scope: AutofreeScope) : - GslObject(scope) { +internal class GslPermutation( + override val rawNativeHandle: CPointer, + scope: AutofreeScope, + owned: Boolean, +) : GslObject(scope, owned) { val size get() = nativeHandle.pointed.size.toInt() operator fun get(i: Int) = gsl_permutation_get(nativeHandle, i.toULong()).toInt() diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt index fb8ba53d7..14b956aba 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt @@ -7,8 +7,8 @@ import kscience.kmath.linear.Point /** * Wraps gsl_vector_* objects from GSL. */ -public abstract class GslVector internal constructor(scope: AutofreeScope) : - GslObject(scope), Point { +public abstract class GslVector internal constructor(scope: AutofreeScope, owned: Boolean) : + GslObject(scope, owned), Point { internal abstract operator fun set(index: Int, value: T) internal abstract fun copy(): GslVector diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt index 7dbab66d7..a0ed0cdb0 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt @@ -7,7 +7,8 @@ import org.gnu.gsl.* internal class GslRealMatrix( override val rawNativeHandle: CPointer, scope: AutofreeScope, -) : GslMatrix(scope) { + owned: Boolean, +) : GslMatrix(scope, owned) { override val rowNum: Int get() = nativeHandle.pointed.size1.toInt() @@ -19,7 +20,8 @@ internal class GslRealMatrix( GslRealVector( gsl_matrix_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, scope, - ).apply { shouldBeFreed = false } + false, + ) } override val columns: Buffer> @@ -27,7 +29,8 @@ internal class GslRealMatrix( GslRealVector( gsl_matrix_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, scope, - ).apply { shouldBeFreed = false } + false, + ) } override operator fun get(i: Int, j: Int): Double = @@ -39,7 +42,7 @@ internal class GslRealMatrix( override fun copy(): GslRealMatrix { val new = checkNotNull(gsl_matrix_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_memcpy(new, nativeHandle) - return GslRealMatrix(new, scope) + return GslRealMatrix(new, scope, true) } override fun close(): Unit = gsl_matrix_free(nativeHandle) @@ -55,7 +58,8 @@ internal class GslRealMatrix( internal class GslFloatMatrix( override val rawNativeHandle: CPointer, scope: AutofreeScope, -) : GslMatrix(scope) { + owned: Boolean, +) : GslMatrix(scope, owned) { override val rowNum: Int get() = nativeHandle.pointed.size1.toInt() @@ -67,7 +71,8 @@ internal class GslFloatMatrix( GslFloatVector( gsl_matrix_float_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, scope, - ).apply { shouldBeFreed = false } + false, + ) } override val columns: Buffer> @@ -75,7 +80,8 @@ internal class GslFloatMatrix( GslFloatVector( gsl_matrix_float_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, scope, - ).apply { shouldBeFreed = false } + false, + ) } override operator fun get(i: Int, j: Int): Float = @@ -87,7 +93,7 @@ internal class GslFloatMatrix( override fun copy(): GslFloatMatrix { val new = checkNotNull(gsl_matrix_float_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_float_memcpy(new, nativeHandle) - return GslFloatMatrix(new, scope) + return GslFloatMatrix(new, scope, true) } override fun close(): Unit = gsl_matrix_float_free(nativeHandle) @@ -103,7 +109,8 @@ internal class GslFloatMatrix( internal class GslShortMatrix( override val rawNativeHandle: CPointer, scope: AutofreeScope, -) : GslMatrix(scope) { + owned: Boolean, +) : GslMatrix(scope, owned) { override val rowNum: Int get() = nativeHandle.pointed.size1.toInt() @@ -115,7 +122,8 @@ internal class GslShortMatrix( GslShortVector( gsl_matrix_short_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, scope, - ).apply { shouldBeFreed = false } + false, + ) } override val columns: Buffer> @@ -123,7 +131,8 @@ internal class GslShortMatrix( GslShortVector( gsl_matrix_short_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, scope, - ).apply { shouldBeFreed = false } + false, + ) } override operator fun get(i: Int, j: Int): Short = @@ -135,7 +144,7 @@ internal class GslShortMatrix( override fun copy(): GslShortMatrix { val new = checkNotNull(gsl_matrix_short_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_short_memcpy(new, nativeHandle) - return GslShortMatrix(new, scope) + return GslShortMatrix(new, scope, true) } override fun close(): Unit = gsl_matrix_short_free(nativeHandle) @@ -151,7 +160,8 @@ internal class GslShortMatrix( internal class GslUShortMatrix( override val rawNativeHandle: CPointer, scope: AutofreeScope, -) : GslMatrix(scope) { + owned: Boolean, +) : GslMatrix(scope, owned) { override val rowNum: Int get() = nativeHandle.pointed.size1.toInt() @@ -163,7 +173,8 @@ internal class GslUShortMatrix( GslUShortVector( gsl_matrix_ushort_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, scope, - ).apply { shouldBeFreed = false } + false, + ) } override val columns: Buffer> @@ -171,7 +182,8 @@ internal class GslUShortMatrix( GslUShortVector( gsl_matrix_ushort_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, scope, - ).apply { shouldBeFreed = false } + false, + ) } override operator fun get(i: Int, j: Int): UShort = @@ -183,7 +195,7 @@ internal class GslUShortMatrix( override fun copy(): GslUShortMatrix { val new = checkNotNull(gsl_matrix_ushort_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_ushort_memcpy(new, nativeHandle) - return GslUShortMatrix(new, scope) + return GslUShortMatrix(new, scope, true) } override fun close(): Unit = gsl_matrix_ushort_free(nativeHandle) @@ -199,7 +211,8 @@ internal class GslUShortMatrix( internal class GslLongMatrix( override val rawNativeHandle: CPointer, scope: AutofreeScope, -) : GslMatrix(scope) { + owned: Boolean, +) : GslMatrix(scope, owned) { override val rowNum: Int get() = nativeHandle.pointed.size1.toInt() @@ -211,7 +224,8 @@ internal class GslLongMatrix( GslLongVector( gsl_matrix_long_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, scope, - ).apply { shouldBeFreed = false } + false, + ) } override val columns: Buffer> @@ -219,7 +233,8 @@ internal class GslLongMatrix( GslLongVector( gsl_matrix_long_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, scope, - ).apply { shouldBeFreed = false } + false, + ) } override operator fun get(i: Int, j: Int): Long = @@ -231,7 +246,7 @@ internal class GslLongMatrix( override fun copy(): GslLongMatrix { val new = checkNotNull(gsl_matrix_long_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_long_memcpy(new, nativeHandle) - return GslLongMatrix(new, scope) + return GslLongMatrix(new, scope, true) } override fun close(): Unit = gsl_matrix_long_free(nativeHandle) @@ -247,7 +262,8 @@ internal class GslLongMatrix( internal class GslULongMatrix( override val rawNativeHandle: CPointer, scope: AutofreeScope, -) : GslMatrix(scope) { + owned: Boolean, +) : GslMatrix(scope, owned) { override val rowNum: Int get() = nativeHandle.pointed.size1.toInt() @@ -259,7 +275,8 @@ internal class GslULongMatrix( GslULongVector( gsl_matrix_ulong_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, scope, - ).apply { shouldBeFreed = false } + false, + ) } override val columns: Buffer> @@ -267,7 +284,8 @@ internal class GslULongMatrix( GslULongVector( gsl_matrix_ulong_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, scope, - ).apply { shouldBeFreed = false } + false, + ) } override operator fun get(i: Int, j: Int): ULong = @@ -279,7 +297,7 @@ internal class GslULongMatrix( override fun copy(): GslULongMatrix { val new = checkNotNull(gsl_matrix_ulong_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_ulong_memcpy(new, nativeHandle) - return GslULongMatrix(new, scope) + return GslULongMatrix(new, scope, true) } override fun close(): Unit = gsl_matrix_ulong_free(nativeHandle) @@ -295,7 +313,8 @@ internal class GslULongMatrix( internal class GslIntMatrix( override val rawNativeHandle: CPointer, scope: AutofreeScope, -) : GslMatrix(scope) { + owned: Boolean, +) : GslMatrix(scope, owned) { override val rowNum: Int get() = nativeHandle.pointed.size1.toInt() @@ -307,7 +326,8 @@ internal class GslIntMatrix( GslIntVector( gsl_matrix_int_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, scope, - ).apply { shouldBeFreed = false } + false, + ) } override val columns: Buffer> @@ -315,7 +335,8 @@ internal class GslIntMatrix( GslIntVector( gsl_matrix_int_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, scope, - ).apply { shouldBeFreed = false } + false, + ) } override operator fun get(i: Int, j: Int): Int = @@ -327,7 +348,7 @@ internal class GslIntMatrix( override fun copy(): GslIntMatrix { val new = checkNotNull(gsl_matrix_int_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_int_memcpy(new, nativeHandle) - return GslIntMatrix(new, scope) + return GslIntMatrix(new, scope, true) } override fun close(): Unit = gsl_matrix_int_free(nativeHandle) @@ -343,7 +364,8 @@ internal class GslIntMatrix( internal class GslUIntMatrix( override val rawNativeHandle: CPointer, scope: AutofreeScope, -) : GslMatrix(scope) { + owned: Boolean, +) : GslMatrix(scope, owned) { override val rowNum: Int get() = nativeHandle.pointed.size1.toInt() @@ -355,7 +377,8 @@ internal class GslUIntMatrix( GslUIntVector( gsl_matrix_uint_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, scope, - ).apply { shouldBeFreed = false } + false, + ) } override val columns: Buffer> @@ -363,7 +386,8 @@ internal class GslUIntMatrix( GslUIntVector( gsl_matrix_uint_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, scope, - ).apply { shouldBeFreed = false } + false, + ) } override operator fun get(i: Int, j: Int): UInt = @@ -375,7 +399,7 @@ internal class GslUIntMatrix( override fun copy(): GslUIntMatrix { val new = checkNotNull(gsl_matrix_uint_alloc(rowNum.toULong(), colNum.toULong())) gsl_matrix_uint_memcpy(new, nativeHandle) - return GslUIntMatrix(new, scope) + return GslUIntMatrix(new, scope, true) } override fun close(): Unit = gsl_matrix_uint_free(nativeHandle) diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt index 42ecb2fca..922c2ba2f 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt @@ -3,21 +3,19 @@ package kscience.kmath.gsl import kotlinx.cinterop.* import org.gnu.gsl.* -internal class GslRealVector(override val rawNativeHandle: CPointer, scope: AutofreeScope) : - GslVector(scope) { - override val size: Int - get() = nativeHandle.pointed.size.toInt() - - override operator fun get(index: Int): Double = - gsl_vector_get(nativeHandle, index.toULong()) - - override operator fun set(index: Int, value: Double): Unit = - gsl_vector_set(nativeHandle, index.toULong(), value) +internal class GslRealVector( + override val rawNativeHandle: CPointer, + scope: AutofreeScope, + owned: Boolean, +) : GslVector(scope, owned) { + override val size: Int get() = nativeHandle.pointed.size.toInt() + override operator fun get(index: Int): Double = gsl_vector_get(nativeHandle, index.toULong()) + override operator fun set(index: Int, value: Double): Unit = gsl_vector_set(nativeHandle, index.toULong(), value) override fun copy(): GslRealVector { val new = checkNotNull(gsl_vector_alloc(size.toULong())) gsl_vector_memcpy(new, nativeHandle) - return GslRealVector(new, scope) + return GslRealVector(new, scope, true) } override fun equals(other: Any?): Boolean { @@ -30,21 +28,19 @@ internal class GslRealVector(override val rawNativeHandle: CPointer, override fun close(): Unit = gsl_vector_free(nativeHandle) } -internal class GslFloatVector(override val rawNativeHandle: CPointer, scope: AutofreeScope) : - GslVector(scope) { - override val size: Int - get() = nativeHandle.pointed.size.toInt() - - override operator fun get(index: Int): Float = - gsl_vector_float_get(nativeHandle, index.toULong()) - - override operator fun set(index: Int, value: Float): Unit = - gsl_vector_float_set(nativeHandle, index.toULong(), value) +internal class GslFloatVector( + override val rawNativeHandle: CPointer, + scope: AutofreeScope, + owned: Boolean, +) : GslVector(scope, owned) { + override val size: Int get() = nativeHandle.pointed.size.toInt() + override operator fun get(index: Int): Float = gsl_vector_float_get(nativeHandle, index.toULong()) + override operator fun set(index: Int, value: Float): Unit = gsl_vector_float_set(nativeHandle, index.toULong(), value) override fun copy(): GslFloatVector { val new = checkNotNull(gsl_vector_float_alloc(size.toULong())) gsl_vector_float_memcpy(new, nativeHandle) - return GslFloatVector(new, scope) + return GslFloatVector(new, scope, true) } override fun equals(other: Any?): Boolean { @@ -57,21 +53,19 @@ internal class GslFloatVector(override val rawNativeHandle: CPointer, scope: AutofreeScope) : - GslVector(scope) { - override val size: Int - get() = nativeHandle.pointed.size.toInt() - - override operator fun get(index: Int): Short = - gsl_vector_short_get(nativeHandle, index.toULong()) - - override operator fun set(index: Int, value: Short): Unit = - gsl_vector_short_set(nativeHandle, index.toULong(), value) +internal class GslShortVector( + override val rawNativeHandle: CPointer, + scope: AutofreeScope, + owned: Boolean, +) : GslVector(scope, owned) { + override val size: Int get() = nativeHandle.pointed.size.toInt() + override operator fun get(index: Int): Short = gsl_vector_short_get(nativeHandle, index.toULong()) + override operator fun set(index: Int, value: Short): Unit = gsl_vector_short_set(nativeHandle, index.toULong(), value) override fun copy(): GslShortVector { val new = checkNotNull(gsl_vector_short_alloc(size.toULong())) gsl_vector_short_memcpy(new, nativeHandle) - return GslShortVector(new, scope) + return GslShortVector(new, scope, true) } override fun equals(other: Any?): Boolean { @@ -84,21 +78,19 @@ internal class GslShortVector(override val rawNativeHandle: CPointer, scope: AutofreeScope) : - GslVector(scope) { - override val size: Int - get() = nativeHandle.pointed.size.toInt() - - override operator fun get(index: Int): UShort = - gsl_vector_ushort_get(nativeHandle, index.toULong()) - - override operator fun set(index: Int, value: UShort): Unit = - gsl_vector_ushort_set(nativeHandle, index.toULong(), value) +internal class GslUShortVector( + override val rawNativeHandle: CPointer, + scope: AutofreeScope, + owned: Boolean, +) : GslVector(scope, owned) { + override val size: Int get() = nativeHandle.pointed.size.toInt() + override operator fun get(index: Int): UShort = gsl_vector_ushort_get(nativeHandle, index.toULong()) + override operator fun set(index: Int, value: UShort): Unit = gsl_vector_ushort_set(nativeHandle, index.toULong(), value) override fun copy(): GslUShortVector { val new = checkNotNull(gsl_vector_ushort_alloc(size.toULong())) gsl_vector_ushort_memcpy(new, nativeHandle) - return GslUShortVector(new, scope) + return GslUShortVector(new, scope, true) } override fun equals(other: Any?): Boolean { @@ -111,21 +103,19 @@ internal class GslUShortVector(override val rawNativeHandle: CPointer, scope: AutofreeScope) : - GslVector(scope) { - override val size: Int - get() = nativeHandle.pointed.size.toInt() - - override operator fun get(index: Int): Long = - gsl_vector_long_get(nativeHandle, index.toULong()) - - override operator fun set(index: Int, value: Long): Unit = - gsl_vector_long_set(nativeHandle, index.toULong(), value) +internal class GslLongVector( + override val rawNativeHandle: CPointer, + scope: AutofreeScope, + owned: Boolean, +) : GslVector(scope, owned) { + override val size: Int get() = nativeHandle.pointed.size.toInt() + override operator fun get(index: Int): Long = gsl_vector_long_get(nativeHandle, index.toULong()) + override operator fun set(index: Int, value: Long): Unit = gsl_vector_long_set(nativeHandle, index.toULong(), value) override fun copy(): GslLongVector { val new = checkNotNull(gsl_vector_long_alloc(size.toULong())) gsl_vector_long_memcpy(new, nativeHandle) - return GslLongVector(new, scope) + return GslLongVector(new, scope, true) } override fun equals(other: Any?): Boolean { @@ -138,21 +128,19 @@ internal class GslLongVector(override val rawNativeHandle: CPointer, scope: AutofreeScope) : - GslVector(scope) { - override val size: Int - get() = nativeHandle.pointed.size.toInt() - - override operator fun get(index: Int): ULong = - gsl_vector_ulong_get(nativeHandle, index.toULong()) - - override operator fun set(index: Int, value: ULong): Unit = - gsl_vector_ulong_set(nativeHandle, index.toULong(), value) +internal class GslULongVector( + override val rawNativeHandle: CPointer, + scope: AutofreeScope, + owned: Boolean, +) : GslVector(scope, owned) { + override val size: Int get() = nativeHandle.pointed.size.toInt() + override operator fun get(index: Int): ULong = gsl_vector_ulong_get(nativeHandle, index.toULong()) + override operator fun set(index: Int, value: ULong): Unit = gsl_vector_ulong_set(nativeHandle, index.toULong(), value) override fun copy(): GslULongVector { val new = checkNotNull(gsl_vector_ulong_alloc(size.toULong())) gsl_vector_ulong_memcpy(new, nativeHandle) - return GslULongVector(new, scope) + return GslULongVector(new, scope, true) } override fun equals(other: Any?): Boolean { @@ -165,21 +153,19 @@ internal class GslULongVector(override val rawNativeHandle: CPointer, scope: AutofreeScope) : - GslVector(scope) { - override val size: Int - get() = nativeHandle.pointed.size.toInt() - - override operator fun get(index: Int): Int = - gsl_vector_int_get(nativeHandle, index.toULong()) - - override operator fun set(index: Int, value: Int): Unit = - gsl_vector_int_set(nativeHandle, index.toULong(), value) +internal class GslIntVector( + override val rawNativeHandle: CPointer, + scope: AutofreeScope, + owned: Boolean, +) : GslVector(scope, owned) { + override val size: Int get() = nativeHandle.pointed.size.toInt() + override operator fun get(index: Int): Int = gsl_vector_int_get(nativeHandle, index.toULong()) + override operator fun set(index: Int, value: Int): Unit = gsl_vector_int_set(nativeHandle, index.toULong(), value) override fun copy(): GslIntVector { val new = checkNotNull(gsl_vector_int_alloc(size.toULong())) gsl_vector_int_memcpy(new, nativeHandle) - return GslIntVector(new, scope) + return GslIntVector(new, scope, true) } override fun equals(other: Any?): Boolean { @@ -192,21 +178,19 @@ internal class GslIntVector(override val rawNativeHandle: CPointer, scope: AutofreeScope) : - GslVector(scope) { - override val size: Int - get() = nativeHandle.pointed.size.toInt() - - override operator fun get(index: Int): UInt = - gsl_vector_uint_get(nativeHandle, index.toULong()) - - override operator fun set(index: Int, value: UInt): Unit = - gsl_vector_uint_set(nativeHandle, index.toULong(), value) +internal class GslUIntVector( + override val rawNativeHandle: CPointer, + scope: AutofreeScope, + owned: Boolean, +) : GslVector(scope, owned) { + override val size: Int get() = nativeHandle.pointed.size.toInt() + override operator fun get(index: Int): UInt = gsl_vector_uint_get(nativeHandle, index.toULong()) + override operator fun set(index: Int, value: UInt): Unit = gsl_vector_uint_set(nativeHandle, index.toULong(), value) override fun copy(): GslUIntVector { val new = checkNotNull(gsl_vector_uint_alloc(size.toULong())) gsl_vector_uint_memcpy(new, nativeHandle) - return GslUIntVector(new, scope) + return GslUIntVector(new, scope, true) } override fun equals(other: Any?): Boolean { diff --git a/kmath-gsl/src/nativeTest/kotlin/GslMatrixRealTest.kt b/kmath-gsl/src/nativeTest/kotlin/GslMatrixRealTest.kt index c171f6d0a..79ee7e7f1 100644 --- a/kmath-gsl/src/nativeTest/kotlin/GslMatrixRealTest.kt +++ b/kmath-gsl/src/nativeTest/kotlin/GslMatrixRealTest.kt @@ -1,8 +1,8 @@ package kscience.kmath.gsl +import kscience.kmath.linear.Matrix import kscience.kmath.linear.RealMatrixContext import kscience.kmath.operations.invoke -import kscience.kmath.structures.Matrix import kscience.kmath.structures.asIterable import kscience.kmath.structures.toList import kotlin.random.Random diff --git a/kmath-gsl/src/nativeTest/kotlin/GslRealMatrixContextTest.kt b/kmath-gsl/src/nativeTest/kotlin/GslRealMatrixContextTest.kt index c73cb2775..fa35a5346 100644 --- a/kmath-gsl/src/nativeTest/kotlin/GslRealMatrixContextTest.kt +++ b/kmath-gsl/src/nativeTest/kotlin/GslRealMatrixContextTest.kt @@ -1,8 +1,8 @@ package kscience.kmath.gsl +import kscience.kmath.linear.Matrix import kscience.kmath.linear.RealMatrixContext import kscience.kmath.operations.invoke -import kscience.kmath.structures.Matrix import kscience.kmath.structures.RealBuffer import kscience.kmath.structures.asSequence import kotlin.random.Random From 1cfe5a31a77398e9a1f3511017a94cf2a3a1290a Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 31 Jan 2021 00:57:15 +0700 Subject: [PATCH 65/76] Add QR decomposition support in GSL wrapper --- kmath-gsl/build.gradle.kts | 10 +++--- .../kscience/kmath/gsl/GslMatrixContext.kt | 35 +++++++++++++++++-- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index 83859130c..df405326f 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -12,7 +12,7 @@ kotlin { val nativeTarget = when (System.getProperty("os.name")) { // "Mac OS X" -> macosX64() - "Linux" -> linuxX64("native") + "Linux" -> linuxX64() else -> { logger.warn("Current OS cannot build any of kmath-gsl targets.") @@ -29,7 +29,7 @@ kotlin { val test by nativeTarget.compilations.getting sourceSets { - val nativeMain by getting { + val nativeMain by creating { val codegen by tasks.creating { matricesCodegen(kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Matrices.kt") vectorsCodegen(kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Vectors.kt") @@ -42,11 +42,11 @@ kotlin { } } - val nativeTest by getting { + val nativeTest by creating { dependsOn(nativeMain) } -// main.defaultSourceSet.dependsOn(nativeMain) -// test.defaultSourceSet.dependsOn(nativeTest) + main.defaultSourceSet.dependsOn(nativeMain) + test.defaultSourceSet.dependsOn(nativeTest) } } diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt index e86d3676e..cc8bba662 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt @@ -7,6 +7,7 @@ import kscience.kmath.operations.Complex import kscience.kmath.operations.ComplexField import kscience.kmath.operations.toComplex import org.gnu.gsl.* +import kotlin.math.min import kotlin.reflect.KClass import kotlin.reflect.cast @@ -179,6 +180,29 @@ public class GslRealMatrixContext(internal val scope: AutofreeScope) : } } + QRDecompositionFeature::class -> object : QRDecompositionFeature { + private val qr by lazy { + val a = m.toGsl().copy() + val q = produce(m.rowNum, m.rowNum) { _, _ -> 0.0 } + val r = produce(m.rowNum, m.colNum) { _, _ -> 0.0 } + + if (m.rowNum < m.colNum) { + val tau = point(min(m.rowNum, m.colNum)) { 0.0 } + gsl_linalg_QR_decomp(a.nativeHandle, tau.nativeHandle) + gsl_linalg_QR_unpack(a.nativeHandle, tau.nativeHandle, q.nativeHandle, r.nativeHandle) + } else { + val t = produce(m.colNum, m.colNum) { _, _ -> 0.0 } + gsl_linalg_QR_decomp_r(a.nativeHandle, t.nativeHandle) + gsl_linalg_QR_unpack_r(a.nativeHandle, t.nativeHandle, q.nativeHandle, r.nativeHandle) + } + + q to r + } + + override val q: Matrix get() = qr.first + override val r: Matrix get() = qr.second + } + else -> super.getFeature(m, type) }?.let(type::cast) } @@ -261,17 +285,22 @@ public class GslComplexMatrixContext(internal val scope: AutofreeScope) : override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = GslComplexMatrix( rawNativeHandle = checkNotNull(gsl_matrix_complex_alloc(rows.toULong(), columns.toULong())), scope = scope, + owned = true, ) override fun produceDirtyVector(size: Int): GslVector = - GslComplexVector(rawNativeHandle = checkNotNull(gsl_vector_complex_alloc(size.toULong())), scope = scope) + GslComplexVector( + rawNativeHandle = checkNotNull(gsl_vector_complex_alloc(size.toULong())), + scope = scope, + owned = true, + ) public override fun Matrix.dot(other: Matrix): GslMatrix { val x = toGsl().nativeHandle val a = other.toGsl().nativeHandle val result = checkNotNull(gsl_matrix_complex_calloc(a.pointed.size1, a.pointed.size2)) gsl_blas_zgemm(CblasNoTrans, CblasNoTrans, ComplexField.one.toGsl(), x, a, ComplexField.one.toGsl(), result) - return GslComplexMatrix(rawNativeHandle = result, scope = scope) + return GslComplexMatrix(rawNativeHandle = result, scope = scope, owned = true) } public override fun Matrix.dot(vector: Point): GslVector { @@ -279,7 +308,7 @@ public class GslComplexMatrixContext(internal val scope: AutofreeScope) : val a = vector.toGsl().nativeHandle val result = checkNotNull(gsl_vector_complex_calloc(a.pointed.size)) gsl_blas_zgemv(CblasNoTrans, ComplexField.one.toGsl(), x, a, ComplexField.one.toGsl(), result) - return GslComplexVector(result, scope) + return GslComplexVector(rawNativeHandle = result, scope = scope, owned = true) } public override fun Matrix.times(value: Complex): GslMatrix { From a0186844f598e1b211c8033c4255dc7c345e546d Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 31 Jan 2021 15:36:35 +0700 Subject: [PATCH 66/76] Update README files --- README.md | 10 +++++ kmath-ast/README.md | 2 +- kmath-gsl/README.md | 44 +++++++++++++++++++ kmath-gsl/build.gradle.kts | 13 ++++++ kmath-gsl/docs/README-TEMPLATE.md | 7 +++ .../kscience/kmath/gsl/GslMatrixContext.kt | 3 +- 6 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 kmath-gsl/README.md create mode 100644 kmath-gsl/docs/README-TEMPLATE.md diff --git a/README.md b/README.md index 6ab51098d..b040d7aa2 100644 --- a/README.md +++ b/README.md @@ -173,6 +173,16 @@ One can still use generic algebras though. > **Maturity**: PROTOTYPE
+* ### [kmath-gsl](kmath-gsl) +> Linear Algebra classes implemented with GNU Scientific Library +> +> **Maturity**: PROTOTYPE +> +> **Features:** +> - [matrix-contexts](kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt) : Matrix Contexts over Double, Float and Complex implemented with GSL + +
+ * ### [kmath-histograms](kmath-histograms) > > diff --git a/kmath-ast/README.md b/kmath-ast/README.md index 33b118973..8499f7171 100644 --- a/kmath-ast/README.md +++ b/kmath-ast/README.md @@ -61,7 +61,7 @@ For example, the following builder: RealField.mstInField { symbol("x") + 2 }.compile() ``` -… leads to generation of bytecode, which can be decompiled to the following Java class: +… leads to generation of bytecode, which can be decompiled to the following Java class: ```java package kscience.kmath.asm.generated; diff --git a/kmath-gsl/README.md b/kmath-gsl/README.md new file mode 100644 index 000000000..f77474710 --- /dev/null +++ b/kmath-gsl/README.md @@ -0,0 +1,44 @@ +# GNU Scientific Library Integration (`kmath-core`) + +This subproject implements the following features: + + - [matrix-contexts](src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt) : Matrix Contexts over Double, Float and Complex implemented with GSL + + +> #### Artifact: +> +> This module artifact: `kscience.kmath:kmath-gsl:0.2.0-dev-6`. +> +> Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-gsl/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-gsl/_latestVersion) +> +> Bintray development version: [ ![Download](https://api.bintray.com/packages/mipt-npm/dev/kmath-gsl/images/download.svg) ](https://bintray.com/mipt-npm/dev/kmath-gsl/_latestVersion) +> +> **Gradle:** +> +> ```gradle +> repositories { +> maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } +> maven { url 'https://dl.bintray.com/mipt-npm/kscience' } +> maven { url 'https://dl.bintray.com/mipt-npm/dev' } +> maven { url 'https://dl.bintray.com/hotkeytlt/maven' } +> +> } +> +> dependencies { +> implementation 'kscience.kmath:kmath-gsl:0.2.0-dev-6' +> } +> ``` +> **Gradle Kotlin DSL:** +> +> ```kotlin +> repositories { +> maven("https://dl.bintray.com/kotlin/kotlin-eap") +> maven("https://dl.bintray.com/mipt-npm/kscience") +> maven("https://dl.bintray.com/mipt-npm/dev") +> maven("https://dl.bintray.com/hotkeytlt/maven") +> } +> +> dependencies { +> implementation("kscience.kmath:kmath-gsl:0.2.0-dev-6") +> } +> ``` diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index df405326f..8d8923c93 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -2,6 +2,7 @@ import kscience.kmath.gsl.codegen.matricesCodegen import kscience.kmath.gsl.codegen.vectorsCodegen +import ru.mipt.npm.gradle.Maturity plugins { id("ru.mipt.npm.mpp") @@ -50,3 +51,15 @@ kotlin { test.defaultSourceSet.dependsOn(nativeTest) } } + +readme { + description = "Linear Algebra classes implemented with GNU Scientific Library" + maturity = Maturity.PROTOTYPE + propertyByTemplate("artifact", rootProject.file("docs/templates/ARTIFACT-TEMPLATE.md")) + + feature( + id = "matrix-contexts", + description = "Matrix Contexts over Double, Float and Complex implemented with GSL", + ref = "src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt" + ) +} diff --git a/kmath-gsl/docs/README-TEMPLATE.md b/kmath-gsl/docs/README-TEMPLATE.md new file mode 100644 index 000000000..4b6630116 --- /dev/null +++ b/kmath-gsl/docs/README-TEMPLATE.md @@ -0,0 +1,7 @@ +# GNU Scientific Library Integration (`kmath-core`) + +This subproject implements the following features: + +${features} + +${artifact} diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt index cc8bba662..1f8760231 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt @@ -388,8 +388,7 @@ public class GslComplexMatrixContext(internal val scope: AutofreeScope) : } override val determinant by lazy { - gsl_linalg_complex_LU_det(lups.first.nativeHandle, - lups.third).toKMath() + gsl_linalg_complex_LU_det(lups.first.nativeHandle, lups.third).toKMath() } override val inverse by lazy { From 065d7a150a94deca928ece92317a6bc9a0fb7cfc Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 1 Feb 2021 13:20:33 +0300 Subject: [PATCH 67/76] Fix kotlin version bug for GSL codegen --- buildSrc/build.gradle.kts | 2 +- .../main/kotlin/kscience/kmath/gsl/codegen/PsiTestUtil.kt | 4 ++-- kmath-core/api/kmath-core.api | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 62d29d09e..f9e8bc885 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -5,5 +5,5 @@ plugins { repositories.jcenter() dependencies { - implementation(kotlin("compiler-embeddable", "1.4.21")) + implementation(kotlin("compiler-embeddable", "1.4.30-RC")) } diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/PsiTestUtil.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/PsiTestUtil.kt index e38d93323..1a1c284c7 100644 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/PsiTestUtil.kt +++ b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/PsiTestUtil.kt @@ -57,8 +57,8 @@ internal object PsiTestUtil { i++ } - psiTreeMutable = StringUtil.join(psiLines, "\n") - reparsedTreeMutable = StringUtil.join(reparsedLines, "\n") + psiTreeMutable = StringUtil.join(*psiLines, "\n") + reparsedTreeMutable = StringUtil.join(*reparsedLines, "\n") assert(reparsedTreeMutable == psiTreeMutable) } } diff --git a/kmath-core/api/kmath-core.api b/kmath-core/api/kmath-core.api index ab0555932..09afeda58 100644 --- a/kmath-core/api/kmath-core.api +++ b/kmath-core/api/kmath-core.api @@ -562,6 +562,7 @@ public final class kscience/kmath/linear/BufferMatrixContext : kscience/kmath/li public synthetic fun dot (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; public fun dot (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; public fun getElementContext ()Lkscience/kmath/operations/Ring; + public fun getFeature (Lkscience/kmath/nd/Structure2D;Lkotlin/reflect/KClass;)Ljava/lang/Object; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun minus (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/linear/BufferMatrix; public synthetic fun minus (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; @@ -666,6 +667,7 @@ public final class kscience/kmath/linear/GenericMatrixContext$DefaultImpls { public static fun div (Lkscience/kmath/linear/GenericMatrixContext;Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; public static fun dot (Lkscience/kmath/linear/GenericMatrixContext;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; public static fun dot (Lkscience/kmath/linear/GenericMatrixContext;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public static fun getFeature (Lkscience/kmath/linear/GenericMatrixContext;Lkscience/kmath/nd/Structure2D;Lkotlin/reflect/KClass;)Ljava/lang/Object; public static fun minus (Lkscience/kmath/linear/GenericMatrixContext;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; public static fun multiply (Lkscience/kmath/linear/GenericMatrixContext;Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; public static fun plus (Lkscience/kmath/linear/GenericMatrixContext;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; @@ -749,6 +751,7 @@ public abstract interface class kscience/kmath/linear/MatrixContext : kscience/k public abstract fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public abstract fun dot (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; public abstract fun dot (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public abstract fun getFeature (Lkscience/kmath/nd/Structure2D;Lkotlin/reflect/KClass;)Ljava/lang/Object; public abstract fun point (ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/Buffer; public abstract fun produce (IILkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/Structure2D; public abstract fun times (Ljava/lang/Object;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; @@ -764,6 +767,7 @@ public final class kscience/kmath/linear/MatrixContext$DefaultImpls { public static fun binaryOperation (Lkscience/kmath/linear/MatrixContext;Ljava/lang/String;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; public static fun binaryOperationFunction (Lkscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public static fun div (Lkscience/kmath/linear/MatrixContext;Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; + public static fun getFeature (Lkscience/kmath/linear/MatrixContext;Lkscience/kmath/nd/Structure2D;Lkotlin/reflect/KClass;)Ljava/lang/Object; public static fun minus (Lkscience/kmath/linear/MatrixContext;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; public static fun plus (Lkscience/kmath/linear/MatrixContext;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; public static fun point (Lkscience/kmath/linear/MatrixContext;ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/Buffer; @@ -833,6 +837,7 @@ public final class kscience/kmath/linear/RealMatrixContext : kscience/kmath/line public fun dot (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/linear/BufferMatrix; public synthetic fun dot (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; public fun dot (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun getFeature (Lkscience/kmath/nd/Structure2D;Lkotlin/reflect/KClass;)Ljava/lang/Object; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun minus (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; From 1306ee418f3e3b0215da9698265a9ec14b8e7737 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Mon, 1 Feb 2021 21:39:20 +0700 Subject: [PATCH 68/76] Update workflows --- .github/workflows/build.yml | 4 +++- .github/workflows/publish.yml | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e3e6a8f23..0ad65a4db 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,9 @@ jobs: - name: Grant execute permission for gradlew run: chmod +x gradlew - name: Install libgsl-dev - run: sudo apt install -y libgsl-dev gcc-multilib + run: | + sudo apt update + sudo apt install -y libgsl-dev gcc-multilib - name: Install Chrome run: | sudo apt install -y libappindicator1 fonts-liberation diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 40b172908..a088703ee 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,6 +17,10 @@ jobs: java-version: 11 - name: Grant execute permission for gradlew run: chmod +x gradlew + - name: Install libgsl-dev + run: | + sudo apt update + sudo apt install -y libgsl-dev gcc-multilib - name: Install Chrome run: | sudo apt install -y libappindicator1 fonts-liberation @@ -56,6 +60,8 @@ jobs: java-version: 11 - name: Grant execute permission for gradlew run: chmod +x gradlew + - name: Install gsl + run: brew install gsl - name: Cache gradle uses: actions/cache@v2 with: From 53769ede9699331851c1806fbd67894c93e5b353 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 7 Feb 2021 02:48:55 +0700 Subject: [PATCH 69/76] Fix Kotlin version in buildSrc --- buildSrc/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index f9e8bc885..19a6ea6a6 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -5,5 +5,5 @@ plugins { repositories.jcenter() dependencies { - implementation(kotlin("compiler-embeddable", "1.4.30-RC")) + implementation(kotlin("compiler-embeddable", "1.4.30")) } From 15b223a8013aad3c714d951d4b51c7952ceedede Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 11 Feb 2021 18:43:42 +0700 Subject: [PATCH 70/76] Fix compilation issues --- .../src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt | 2 +- .../kotlin/kscience/kmath/gsl/GslMatrixContext.kt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt index c18c0dfdf..bc3ac72a3 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt @@ -1,7 +1,7 @@ package kscience.kmath.gsl import kotlinx.cinterop.* -import kscience.kmath.operations.Complex +import kscience.kmath.complex.Complex import kscience.kmath.structures.Buffer import kscience.kmath.structures.VirtualBuffer import org.gnu.gsl.* diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt index 1f8760231..aa2c21635 100644 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt +++ b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt @@ -3,9 +3,9 @@ package kscience.kmath.gsl import kotlinx.cinterop.* import kscience.kmath.linear.* import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.operations.Complex -import kscience.kmath.operations.ComplexField -import kscience.kmath.operations.toComplex +import kscience.kmath.complex.Complex +import kscience.kmath.complex.ComplexField +import kscience.kmath.complex.toComplex import org.gnu.gsl.* import kotlin.math.min import kotlin.reflect.KClass From 443af750a4d1247a6d2ba0ba6e8fa4ce828116ba Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 11 Feb 2021 18:44:17 +0700 Subject: [PATCH 71/76] Add kmath-complex reference --- kmath-gsl/build.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index 8d8923c93..d49b4b941 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -39,6 +39,7 @@ kotlin { kotlin.srcDirs(files().builtBy(codegen)) dependencies { + api(project(":kmath-complex")) api(project(":kmath-core")) } } From 2a325b4bc8ef19ee05354b99bcbe9e1cc75297fe Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 18 Feb 2021 19:37:12 +0700 Subject: [PATCH 72/76] Add stub of lib downloading --- kmath-gsl/build.gradle.kts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index d49b4b941..4c8b696ea 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -6,14 +6,21 @@ import ru.mipt.npm.gradle.Maturity plugins { id("ru.mipt.npm.mpp") + id("de.undercouch.download") } kotlin { explicitApiWarning() + data class DownloadLinks(val gsl: String) + + lateinit var downloadLinks: DownloadLinks val nativeTarget = when (System.getProperty("os.name")) { // "Mac OS X" -> macosX64() - "Linux" -> linuxX64() + "Linux" -> { + downloadLinks = DownloadLinks(gsl = "") + linuxX64() + } else -> { logger.warn("Current OS cannot build any of kmath-gsl targets.") From e8de7c5fb38bd40e57b2ede5b4ec26c9f1d37d6a Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 18 Feb 2021 19:38:13 +0700 Subject: [PATCH 73/76] Delete GSL module --- buildSrc/build.gradle.kts | 9 - .../kscience/kmath/gsl/codegen/PsiTestUtil.kt | 73 --- .../kmath/gsl/codegen/codegenUtilities.kt | 70 --- .../kmath/gsl/codegen/matricesCodegen.kt | 106 ----- .../kmath/gsl/codegen/vectorsCodegen.kt | 80 ---- kmath-gsl/README.md | 44 -- kmath-gsl/build.gradle.kts | 73 --- kmath-gsl/docs/README-TEMPLATE.md | 7 - .../src/nativeInterop/cinterop/libgsl.def | 6 - .../kotlin/kscience/kmath/gsl/GslComplex.kt | 89 ---- .../kotlin/kscience/kmath/gsl/GslException.kt | 73 --- .../kotlin/kscience/kmath/gsl/GslMatrix.kt | 40 -- .../kscience/kmath/gsl/GslMatrixContext.kt | 417 ------------------ .../kotlin/kscience/kmath/gsl/GslObject.kt | 36 -- .../kscience/kmath/gsl/GslPermutation.kt | 19 - .../kotlin/kscience/kmath/gsl/GslVector.kt | 25 -- .../kotlin/kscience/kmath/gsl/_Matrices.kt | 414 ----------------- .../kotlin/kscience/kmath/gsl/_Vectors.kt | 205 --------- .../nativeTest/kotlin/ErrorsHandlingTest.kt | 32 -- .../nativeTest/kotlin/GslMatrixRealTest.kt | 62 --- .../kotlin/GslRealMatrixContextTest.kt | 58 --- settings.gradle.kts | 1 - 22 files changed, 1939 deletions(-) delete mode 100644 buildSrc/build.gradle.kts delete mode 100644 buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/PsiTestUtil.kt delete mode 100644 buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/codegenUtilities.kt delete mode 100644 buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt delete mode 100644 buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt delete mode 100644 kmath-gsl/README.md delete mode 100644 kmath-gsl/build.gradle.kts delete mode 100644 kmath-gsl/docs/README-TEMPLATE.md delete mode 100644 kmath-gsl/src/nativeInterop/cinterop/libgsl.def delete mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt delete mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslException.kt delete mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt delete mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt delete mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslObject.kt delete mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslPermutation.kt delete mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt delete mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt delete mode 100644 kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt delete mode 100644 kmath-gsl/src/nativeTest/kotlin/ErrorsHandlingTest.kt delete mode 100644 kmath-gsl/src/nativeTest/kotlin/GslMatrixRealTest.kt delete mode 100644 kmath-gsl/src/nativeTest/kotlin/GslRealMatrixContextTest.kt diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts deleted file mode 100644 index 19a6ea6a6..000000000 --- a/buildSrc/build.gradle.kts +++ /dev/null @@ -1,9 +0,0 @@ -plugins { - `kotlin-dsl` -} - -repositories.jcenter() - -dependencies { - implementation(kotlin("compiler-embeddable", "1.4.30")) -} diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/PsiTestUtil.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/PsiTestUtil.kt deleted file mode 100644 index 1a1c284c7..000000000 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/PsiTestUtil.kt +++ /dev/null @@ -1,73 +0,0 @@ -package kscience.kmath.gsl.codegen - -import org.jetbrains.kotlin.com.intellij.openapi.util.text.StringUtil -import org.jetbrains.kotlin.com.intellij.psi.PsiFile -import org.jetbrains.kotlin.com.intellij.psi.impl.DebugUtil -import org.jetbrains.kotlin.com.intellij.psi.impl.source.PsiFileImpl -import org.jetbrains.kotlin.com.intellij.testFramework.LightVirtualFile -import org.jetbrains.kotlin.psi.KtFile -import java.util.regex.Pattern -import kotlin.math.min - -private val EOL_SPLIT_DONT_TRIM_PATTERN: Pattern = Pattern.compile("(\r|\n|\r\n)+") -internal fun splitByLinesDontTrim(string: String): Array = EOL_SPLIT_DONT_TRIM_PATTERN.split(string) - -internal object PsiTestUtil { - fun checkFileStructure(file: KtFile) { - compareFromAllRoots(file) { f -> DebugUtil.psiTreeToString(f, false) } - } - - private fun compareFromAllRoots( - file: KtFile, - function: (PsiFile) -> String - ) { - val dummyFile = createDummyCopy(file) - - val psiTree = StringUtil.join( - file.viewProvider.allFiles, - { param -> function(param) }, - "\n" - ) - - val reparsedTree = StringUtil.join( - dummyFile.viewProvider.allFiles, - { param -> function(param) }, - "\n" - ) - - assertPsiTextTreeConsistency(psiTree, reparsedTree) - } - - private fun assertPsiTextTreeConsistency(psiTree: String, reparsedTree: String) { - var psiTreeMutable = psiTree - var reparsedTreeMutable = reparsedTree - - if (psiTreeMutable != reparsedTreeMutable) { - val psiLines = splitByLinesDontTrim(psiTreeMutable) - val reparsedLines = splitByLinesDontTrim(reparsedTreeMutable) - var i = 0 - - while (true) { - if (i >= psiLines.size || i >= reparsedLines.size || psiLines[i] != reparsedLines[i]) { - psiLines[min(i, psiLines.size - 1)] += " // in PSI structure" - reparsedLines[min(i, reparsedLines.size - 1)] += " // re-created from text" - break - } - - i++ - } - - psiTreeMutable = StringUtil.join(*psiLines, "\n") - reparsedTreeMutable = StringUtil.join(*reparsedLines, "\n") - assert(reparsedTreeMutable == psiTreeMutable) - } - } - - private fun createDummyCopy(file: KtFile): PsiFile { - val copy = LightVirtualFile(file.name, file.text) - copy.originalFile = file.viewProvider.virtualFile - val dummyCopy = requireNotNull(file.manager.findFile(copy)) - if (dummyCopy is PsiFileImpl) dummyCopy.originalFile = file - return dummyCopy - } -} diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/codegenUtilities.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/codegenUtilities.kt deleted file mode 100644 index 7f930324f..000000000 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/codegenUtilities.kt +++ /dev/null @@ -1,70 +0,0 @@ -package kscience.kmath.gsl.codegen - -import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys -import org.jetbrains.kotlin.cli.common.messages.MessageCollector -import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles -import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment -import org.jetbrains.kotlin.com.intellij.mock.MockProject -import org.jetbrains.kotlin.com.intellij.openapi.extensions.ExtensionPoint -import org.jetbrains.kotlin.com.intellij.openapi.extensions.Extensions -import org.jetbrains.kotlin.com.intellij.openapi.util.UserDataHolderBase -import org.jetbrains.kotlin.com.intellij.pom.PomModel -import org.jetbrains.kotlin.com.intellij.pom.PomModelAspect -import org.jetbrains.kotlin.com.intellij.pom.PomTransaction -import org.jetbrains.kotlin.com.intellij.pom.impl.PomTransactionBase -import org.jetbrains.kotlin.com.intellij.pom.tree.TreeAspect -import org.jetbrains.kotlin.com.intellij.psi.PsiElement -import org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.TreeCopyHandler -import org.jetbrains.kotlin.config.CompilerConfiguration -import sun.reflect.ReflectionFactory - -internal fun createProject(): MockProject { - val project = KotlinCoreEnvironment.createForProduction( - {}, - CompilerConfiguration().apply { put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, MessageCollector.NONE) }, - EnvironmentConfigFiles.JVM_CONFIG_FILES - ).project as MockProject - - val extensionPoint = "org.jetbrains.kotlin.com.intellij.treeCopyHandler" - - arrayOf(project.extensionArea, Extensions.getRootArea()) - .asSequence() - .filterNot { it.hasExtensionPoint(extensionPoint) } - .forEach { - it.registerExtensionPoint(extensionPoint, TreeCopyHandler::class.java.name, ExtensionPoint.Kind.INTERFACE) - } - - project.registerService(PomModel::class.java, object : UserDataHolderBase(), PomModel { - override fun runTransaction(transaction: PomTransaction) = (transaction as PomTransactionBase).run() - - @Suppress("UNCHECKED_CAST") - override fun getModelAspect(aspect: Class): T? { - if (aspect == TreeAspect::class.java) { - val constructor = ReflectionFactory.getReflectionFactory().newConstructorForSerialization( - aspect, - Any::class.java.getDeclaredConstructor(*arrayOfNulls(0)) - ) - - return constructor.newInstance() as T - } - - return null - } - }) - - return project -} - -internal operator fun PsiElement.plusAssign(e: PsiElement) { - add(e) -} - -internal fun fn(pattern: String, type: String): String { - if (type == "double") return pattern.replace("R", "_") - return pattern.replace("R", "_${type}_") -} - -internal fun sn(pattern: String, type: String): String { - if (type == "double") return pattern.replace("R", "") - return pattern.replace("R", "_$type") -} diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt deleted file mode 100644 index 763f08814..000000000 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/matricesCodegen.kt +++ /dev/null @@ -1,106 +0,0 @@ -package kscience.kmath.gsl.codegen - -import org.intellij.lang.annotations.Language -import org.jetbrains.kotlin.com.intellij.openapi.project.Project -import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.psi.KtFile -import org.jetbrains.kotlin.psi.KtPsiFactory -import org.jetbrains.kotlin.resolve.ImportPath -import java.io.File - -private fun KtPsiFactory.createMatrixClass( - f: KtFile, - cTypeName: String, - kotlinTypeName: String, - kotlinTypeAlias: String = kotlinTypeName -) { - fun fn(pattern: String) = fn(pattern, cTypeName) - val className = "Gsl${kotlinTypeAlias}Matrix" - val structName = sn("gsl_matrixR", cTypeName) - - @Language("kotlin") val text = """internal class $className( - override val rawNativeHandle: CPointer<$structName>, - scope: AutofreeScope, - owned: Boolean, -) : GslMatrix<$kotlinTypeName, $structName>(scope, owned) { - override val rowNum: Int - get() = nativeHandle.pointed.size1.toInt() - - override val colNum: Int - get() = nativeHandle.pointed.size2.toInt() - - override val rows: Buffer> - get() = VirtualBuffer(rowNum) { r -> - Gsl${kotlinTypeAlias}Vector( - ${fn("gsl_matrixRrow")}(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, - scope, - false, - ) - } - - override val columns: Buffer> - get() = VirtualBuffer(rowNum) { c -> - Gsl${kotlinTypeAlias}Vector( - ${fn("gsl_matrixRcolumn")}(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, - scope, - false, - ) - } - - override operator fun get(i: Int, j: Int): $kotlinTypeName = - ${fn("gsl_matrixRget")}(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: ${kotlinTypeName}): Unit = - ${fn("gsl_matrixRset")}(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): $className { - val new = checkNotNull(${fn("gsl_matrixRalloc")}(rowNum.toULong(), colNum.toULong())) - ${fn("gsl_matrixRmemcpy")}(new, nativeHandle) - return $className(new, scope, true) - } - - override fun close(): Unit = ${fn("gsl_matrixRfree")}(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is $className) - return ${fn("gsl_matrixRequal")}(nativeHandle, other.nativeHandle) == 1 - - return super.equals(other) - } -}""" - f += createClass(text) - f += createNewLine(2) -} - -/** - * Generates matrices source code for kmath-gsl. - */ -fun matricesCodegen(outputFile: String, project: Project = createProject()) { - val f = KtPsiFactory(project, true).run { - createFile("").also { f -> - f += createPackageDirective(FqName("kscience.kmath.gsl")) - f += createNewLine(2) - f += createImportDirective(ImportPath.fromString("kotlinx.cinterop.*")) - f += createNewLine(1) - f += createImportDirective(ImportPath.fromString("kscience.kmath.structures.*")) - f += createNewLine(1) - f += createImportDirective(ImportPath.fromString("org.gnu.gsl.*")) - f += createNewLine(2) - createMatrixClass(f, "double", "Double", "Real") - createMatrixClass(f, "float", "Float") - createMatrixClass(f, "short", "Short") - createMatrixClass(f, "ushort", "UShort") - createMatrixClass(f, "long", "Long") - createMatrixClass(f, "ulong", "ULong") - createMatrixClass(f, "int", "Int") - createMatrixClass(f, "uint", "UInt") - } - } - - PsiTestUtil.checkFileStructure(f) - - File(outputFile).apply { - parentFile.mkdirs() - writeText(f.text) - } -} diff --git a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt b/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt deleted file mode 100644 index 67ab77186..000000000 --- a/buildSrc/src/main/kotlin/kscience/kmath/gsl/codegen/vectorsCodegen.kt +++ /dev/null @@ -1,80 +0,0 @@ -package kscience.kmath.gsl.codegen - -import org.intellij.lang.annotations.Language -import org.jetbrains.kotlin.com.intellij.openapi.project.Project -import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.psi.KtFile -import org.jetbrains.kotlin.psi.KtPsiFactory -import org.jetbrains.kotlin.resolve.ImportPath -import java.io.File - -private fun KtPsiFactory.createVectorClass( - f: KtFile, - cTypeName: String, - kotlinTypeName: String, - kotlinTypeAlias: String = kotlinTypeName -) { - fun fn(pattern: String) = fn(pattern, cTypeName) - val className = "Gsl${kotlinTypeAlias}Vector" - val structName = sn("gsl_vectorR", cTypeName) - - @Language("kotlin") val text = - """internal class $className( - override val rawNativeHandle: CPointer<$structName>, - scope: AutofreeScope, - owned: Boolean, -) : GslVector<$kotlinTypeName, $structName>(scope, owned) { - override val size: Int get() = nativeHandle.pointed.size.toInt() - override operator fun get(index: Int): $kotlinTypeName = ${fn("gsl_vectorRget")}(nativeHandle, index.toULong()) - override operator fun set(index: Int, value: $kotlinTypeName): Unit = ${fn("gsl_vectorRset")}(nativeHandle, index.toULong(), value) - - override fun copy(): $className { - val new = checkNotNull(${fn("gsl_vectorRalloc")}(size.toULong())) - ${fn("gsl_vectorRmemcpy")}(new, nativeHandle) - return ${className}(new, scope, true) - } - - override fun equals(other: Any?): Boolean { - if (other is $className) - return ${fn("gsl_vectorRequal")}(nativeHandle, other.nativeHandle) == 1 - - return super.equals(other) - } - - override fun close(): Unit = ${fn("gsl_vectorRfree")}(nativeHandle) -}""" - - f += createClass(text) - f += createNewLine(2) -} - -/** - * Generates vectors source code for kmath-gsl. - */ -fun vectorsCodegen(outputFile: String, project: Project = createProject()) { - val f = KtPsiFactory(project, true).run { - createFile("").also { f -> - f += createPackageDirective(FqName("kscience.kmath.gsl")) - f += createNewLine(2) - f += createImportDirective(ImportPath.fromString("kotlinx.cinterop.*")) - f += createNewLine(1) - f += createImportDirective(ImportPath.fromString("org.gnu.gsl.*")) - f += createNewLine(2) - createVectorClass(f, "double", "Double", "Real") - createVectorClass(f, "float", "Float") - createVectorClass(f, "short", "Short") - createVectorClass(f, "ushort", "UShort") - createVectorClass(f, "long", "Long") - createVectorClass(f, "ulong", "ULong") - createVectorClass(f, "int", "Int") - createVectorClass(f, "uint", "UInt") - } - } - - PsiTestUtil.checkFileStructure(f) - - File(outputFile).apply { - parentFile.mkdirs() - writeText(f.text) - } -} diff --git a/kmath-gsl/README.md b/kmath-gsl/README.md deleted file mode 100644 index f77474710..000000000 --- a/kmath-gsl/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# GNU Scientific Library Integration (`kmath-core`) - -This subproject implements the following features: - - - [matrix-contexts](src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt) : Matrix Contexts over Double, Float and Complex implemented with GSL - - -> #### Artifact: -> -> This module artifact: `kscience.kmath:kmath-gsl:0.2.0-dev-6`. -> -> Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-gsl/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-gsl/_latestVersion) -> -> Bintray development version: [ ![Download](https://api.bintray.com/packages/mipt-npm/dev/kmath-gsl/images/download.svg) ](https://bintray.com/mipt-npm/dev/kmath-gsl/_latestVersion) -> -> **Gradle:** -> -> ```gradle -> repositories { -> maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } -> maven { url 'https://dl.bintray.com/mipt-npm/kscience' } -> maven { url 'https://dl.bintray.com/mipt-npm/dev' } -> maven { url 'https://dl.bintray.com/hotkeytlt/maven' } -> -> } -> -> dependencies { -> implementation 'kscience.kmath:kmath-gsl:0.2.0-dev-6' -> } -> ``` -> **Gradle Kotlin DSL:** -> -> ```kotlin -> repositories { -> maven("https://dl.bintray.com/kotlin/kotlin-eap") -> maven("https://dl.bintray.com/mipt-npm/kscience") -> maven("https://dl.bintray.com/mipt-npm/dev") -> maven("https://dl.bintray.com/hotkeytlt/maven") -> } -> -> dependencies { -> implementation("kscience.kmath:kmath-gsl:0.2.0-dev-6") -> } -> ``` diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts deleted file mode 100644 index 4c8b696ea..000000000 --- a/kmath-gsl/build.gradle.kts +++ /dev/null @@ -1,73 +0,0 @@ -@file:Suppress("UNUSED_VARIABLE") - -import kscience.kmath.gsl.codegen.matricesCodegen -import kscience.kmath.gsl.codegen.vectorsCodegen -import ru.mipt.npm.gradle.Maturity - -plugins { - id("ru.mipt.npm.mpp") - id("de.undercouch.download") -} - -kotlin { - explicitApiWarning() - data class DownloadLinks(val gsl: String) - - lateinit var downloadLinks: DownloadLinks - - val nativeTarget = when (System.getProperty("os.name")) { -// "Mac OS X" -> macosX64() - "Linux" -> { - downloadLinks = DownloadLinks(gsl = "") - linuxX64() - } - - else -> { - logger.warn("Current OS cannot build any of kmath-gsl targets.") - return@kotlin - } - } - - val main by nativeTarget.compilations.getting { - cinterops { - val libgsl by creating - } - } - - val test by nativeTarget.compilations.getting - - sourceSets { - val nativeMain by creating { - val codegen by tasks.creating { - matricesCodegen(kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Matrices.kt") - vectorsCodegen(kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Vectors.kt") - } - - kotlin.srcDirs(files().builtBy(codegen)) - - dependencies { - api(project(":kmath-complex")) - api(project(":kmath-core")) - } - } - - val nativeTest by creating { - dependsOn(nativeMain) - } - - main.defaultSourceSet.dependsOn(nativeMain) - test.defaultSourceSet.dependsOn(nativeTest) - } -} - -readme { - description = "Linear Algebra classes implemented with GNU Scientific Library" - maturity = Maturity.PROTOTYPE - propertyByTemplate("artifact", rootProject.file("docs/templates/ARTIFACT-TEMPLATE.md")) - - feature( - id = "matrix-contexts", - description = "Matrix Contexts over Double, Float and Complex implemented with GSL", - ref = "src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt" - ) -} diff --git a/kmath-gsl/docs/README-TEMPLATE.md b/kmath-gsl/docs/README-TEMPLATE.md deleted file mode 100644 index 4b6630116..000000000 --- a/kmath-gsl/docs/README-TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ -# GNU Scientific Library Integration (`kmath-core`) - -This subproject implements the following features: - -${features} - -${artifact} diff --git a/kmath-gsl/src/nativeInterop/cinterop/libgsl.def b/kmath-gsl/src/nativeInterop/cinterop/libgsl.def deleted file mode 100644 index c50dd41cd..000000000 --- a/kmath-gsl/src/nativeInterop/cinterop/libgsl.def +++ /dev/null @@ -1,6 +0,0 @@ -package=org.gnu.gsl -headers=gsl/gsl_blas.h gsl/gsl_linalg.h gsl/gsl_permute_matrix.h -compilerOpts.linux=-I/usr/include -compilerOpts.osx=-I/usr/local -I/usr/local/include -linkerOpts.linux=-L/usr/lib64 -L/usr/lib/x86_64-linux-gnu -lgsl -linkerOpts.osx=-L/opt/local/lib -L/usr/local/lib -lgsl diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt deleted file mode 100644 index bc3ac72a3..000000000 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslComplex.kt +++ /dev/null @@ -1,89 +0,0 @@ -package kscience.kmath.gsl - -import kotlinx.cinterop.* -import kscience.kmath.complex.Complex -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.VirtualBuffer -import org.gnu.gsl.* - -internal fun CValue.toKMath(): Complex = useContents { Complex(dat[0], dat[1]) } - -internal fun Complex.toGsl(): CValue = cValue { - dat[0] = re - dat[1] = im -} - -internal class GslComplexMatrix( - override val rawNativeHandle: CPointer, - scope: AutofreeScope, - owned: Boolean, -) : GslMatrix(scope, owned) { - override val rowNum: Int get() = nativeHandle.pointed.size1.toInt() - override val colNum: Int get() = nativeHandle.pointed.size2.toInt() - - override val rows: Buffer> - get() = VirtualBuffer(rowNum) { r -> - GslComplexVector( - gsl_matrix_complex_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, - scope, - false, - ) - } - - override val columns: Buffer> - get() = VirtualBuffer(rowNum) { c -> - GslComplexVector( - gsl_matrix_complex_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, - scope, - false, - ) - } - - override operator fun get(i: Int, j: Int): Complex = - gsl_matrix_complex_get(nativeHandle, i.toULong(), j.toULong()).toKMath() - - override operator fun set(i: Int, j: Int, value: Complex): Unit = - gsl_matrix_complex_set(nativeHandle, i.toULong(), j.toULong(), value.toGsl()) - - override fun copy(): GslComplexMatrix { - val new = checkNotNull(gsl_matrix_complex_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_complex_memcpy(new, nativeHandle) - return GslComplexMatrix(new, scope, true) - } - - override fun close(): Unit = gsl_matrix_complex_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslComplexMatrix) - return gsl_matrix_complex_equal(nativeHandle, other.nativeHandle) == 1 - - return super.equals(other) - } -} - -internal class GslComplexVector( - override val rawNativeHandle: CPointer, - scope: AutofreeScope, - owned: Boolean, -) : GslVector(scope, owned) { - override val size: Int get() = nativeHandle.pointed.size.toInt() - override fun get(index: Int): Complex = gsl_vector_complex_get(nativeHandle, index.toULong()).toKMath() - - override fun set(index: Int, value: Complex): Unit = - gsl_vector_complex_set(nativeHandle, index.toULong(), value.toGsl()) - - override fun copy(): GslComplexVector { - val new = checkNotNull(gsl_vector_complex_alloc(size.toULong())) - gsl_vector_complex_memcpy(new, nativeHandle) - return GslComplexVector(new, scope, true) - } - - override fun equals(other: Any?): Boolean { - if (other is GslComplexVector) - return gsl_vector_complex_equal(nativeHandle, other.nativeHandle) == 1 - - return super.equals(other) - } - - override fun close(): Unit = gsl_vector_complex_free(nativeHandle) -} diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslException.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslException.kt deleted file mode 100644 index 8897b1427..000000000 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslException.kt +++ /dev/null @@ -1,73 +0,0 @@ -package kscience.kmath.gsl - -import kotlinx.cinterop.staticCFunction -import kotlinx.cinterop.toKString -import org.gnu.gsl.gsl_set_error_handler -import org.gnu.gsl.gsl_set_error_handler_off -import kotlin.native.concurrent.AtomicInt - -private object Container { - val isKmathHandlerRegistered = AtomicInt(0) -} - -internal enum class GslErrnoValue(val code: Int, val text: String) { - GSL_SUCCESS(org.gnu.gsl.GSL_SUCCESS, ""), - GSL_FAILURE(org.gnu.gsl.GSL_FAILURE, ""), - GSL_CONTINUE(org.gnu.gsl.GSL_CONTINUE, "iteration has not converged"), - GSL_EDOM(org.gnu.gsl.GSL_EDOM, "input domain error, e.g sqrt(-1)"), - GSL_ERANGE(org.gnu.gsl.GSL_ERANGE, "output range error, e.g. exp(1e100)"), - GSL_EFAULT(org.gnu.gsl.GSL_EFAULT, "invalid pointer"), - GSL_EINVAL(org.gnu.gsl.GSL_EINVAL, "invalid argument supplied by user"), - GSL_EFAILED(org.gnu.gsl.GSL_EFAILED, "generic failure"), - GSL_EFACTOR(org.gnu.gsl.GSL_EFACTOR, "factorization failed"), - GSL_ESANITY(org.gnu.gsl.GSL_ESANITY, "sanity check failed - shouldn't happen"), - GSL_ENOMEM(org.gnu.gsl.GSL_ENOMEM, "malloc failed"), - GSL_EBADFUNC(org.gnu.gsl.GSL_EBADFUNC, "problem with user-supplied function"), - GSL_ERUNAWAY(org.gnu.gsl.GSL_ERUNAWAY, "iterative process is out of control"), - GSL_EMAXITER(org.gnu.gsl.GSL_EMAXITER, "exceeded max number of iterations"), - GSL_EZERODIV(org.gnu.gsl.GSL_EZERODIV, "tried to divide by zero"), - GSL_EBADTOL(org.gnu.gsl.GSL_EBADTOL, "user specified an invalid tolerance"), - GSL_ETOL(org.gnu.gsl.GSL_ETOL, "failed to reach the specified tolerance"), - GSL_EUNDRFLW(org.gnu.gsl.GSL_EUNDRFLW, "underflow"), - GSL_EOVRFLW(org.gnu.gsl.GSL_EOVRFLW, "overflow"), - GSL_ELOSS(org.gnu.gsl.GSL_ELOSS, "loss of accuracy"), - GSL_EROUND(org.gnu.gsl.GSL_EROUND, "failed because of roundoff error"), - GSL_EBADLEN(org.gnu.gsl.GSL_EBADLEN, "matrix, vector lengths are not conformant"), - GSL_ENOTSQR(org.gnu.gsl.GSL_ENOTSQR, "matrix not square"), - GSL_ESING(org.gnu.gsl.GSL_ESING, "apparent singularity detected"), - GSL_EDIVERGE(org.gnu.gsl.GSL_EDIVERGE, "integral or series is divergent"), - GSL_EUNSUP(org.gnu.gsl.GSL_EUNSUP, "requested feature is not supported by the hardware"), - GSL_EUNIMPL(org.gnu.gsl.GSL_EUNIMPL, "requested feature not (yet) implemented"), - GSL_ECACHE(org.gnu.gsl.GSL_ECACHE, "cache limit exceeded"), - GSL_ETABLE(org.gnu.gsl.GSL_ETABLE, "table limit exceeded"), - GSL_ENOPROG(org.gnu.gsl.GSL_ENOPROG, "iteration is not making progress towards solution"), - GSL_ENOPROGJ(org.gnu.gsl.GSL_ENOPROGJ, "jacobian evaluations are not improving the solution"), - GSL_ETOLF(org.gnu.gsl.GSL_ETOLF, "cannot reach the specified tolerance in F"), - GSL_ETOLX(org.gnu.gsl.GSL_ETOLX, "cannot reach the specified tolerance in X"), - GSL_ETOLG(org.gnu.gsl.GSL_ETOLG, "cannot reach the specified tolerance in gradient"), - GSL_EOF(org.gnu.gsl.GSL_EOF, "end of file"); - - override fun toString(): String = "${name}('$text')" - - companion object { - fun valueOf(code: Int): GslErrnoValue? = values().find { it.code == code } - } -} - -/** - * Wraps all the errors reported by GSL. - */ -public class GslException internal constructor(file: String, line: Int, reason: String, errno: Int) : - RuntimeException("$file:$line: $reason. errno - $errno, ${GslErrnoValue.valueOf(errno)}") { -} - -internal fun ensureHasGslErrorHandler() { - if (Container.isKmathHandlerRegistered.value == 1) return - gsl_set_error_handler_off() - - gsl_set_error_handler(staticCFunction { reason, file, line, errno -> - throw GslException(checkNotNull(file).toKString(), line, checkNotNull(reason).toKString(), errno) - }) - - Container.isKmathHandlerRegistered.value = 1 -} diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt deleted file mode 100644 index a2a073a63..000000000 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrix.kt +++ /dev/null @@ -1,40 +0,0 @@ -package kscience.kmath.gsl - -import kotlinx.cinterop.AutofreeScope -import kotlinx.cinterop.CStructVar -import kscience.kmath.linear.Matrix -import kscience.kmath.nd.NDStructure -import kscience.kmath.structures.asSequence - -/** - * Wraps gsl_matrix_* objects from GSL. - */ -public abstract class GslMatrix internal constructor(scope: AutofreeScope, owned: Boolean) : - GslObject(scope, owned), Matrix { - internal abstract operator fun set(i: Int, j: Int, value: T) - internal abstract fun copy(): GslMatrix - - public override fun equals(other: Any?): Boolean { - return NDStructure.contentEquals(this, other as? NDStructure<*> ?: return false) - } - - public override fun hashCode(): Int { - var ret = 7 - ret = ret * 31 + rowNum - ret = ret * 31 + colNum - - for (row in 0 until rowNum) - for (col in 0 until colNum) - ret = ret * 31 + (11 * (row + 1) + 17 * (col + 1)) * this[row, col].hashCode() - - return ret - } - - public override fun toString(): String = if (rowNum <= 5 && colNum <= 5) - "Matrix(rowsNum = $rowNum, colNum = $colNum)\n" + - rows.asSequence().joinToString(prefix = "(", postfix = ")", separator = "\n ") { buffer -> - buffer.asSequence().joinToString(separator = "\t") { it.toString() } - } - else - "Matrix(rowsNum = $rowNum, colNum = $colNum)" -} diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt deleted file mode 100644 index aa2c21635..000000000 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt +++ /dev/null @@ -1,417 +0,0 @@ -package kscience.kmath.gsl - -import kotlinx.cinterop.* -import kscience.kmath.linear.* -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.complex.Complex -import kscience.kmath.complex.ComplexField -import kscience.kmath.complex.toComplex -import org.gnu.gsl.* -import kotlin.math.min -import kotlin.reflect.KClass -import kotlin.reflect.cast - -internal inline fun GslMatrix.fill(initializer: (Int, Int) -> T): GslMatrix = - apply { - for (row in 0 until rowNum) { - for (col in 0 until colNum) this[row, col] = initializer(row, col) - } - } - -internal inline fun GslVector.fill(initializer: (Int) -> T): GslVector = - apply { - for (index in 0 until size) this[index] = initializer(index) - } - -/** - * Represents matrix context implementing where all the operations are delegated to GSL. - */ -public abstract class GslMatrixContext : MatrixContext> { - init { - ensureHasGslErrorHandler() - } - - /** - * Converts this matrix to GSL one. - */ - @Suppress("UNCHECKED_CAST") - public fun Matrix.toGsl(): GslMatrix = if (this is GslMatrix<*, *>) - this as GslMatrix - else - produce(rowNum, colNum) { i, j -> this[i, j] } - - /** - * Converts this point to GSL one. - */ - @Suppress("UNCHECKED_CAST") - public fun Point.toGsl(): GslVector = - (if (this is GslVector<*, *>) this as GslVector else produceDirtyVector(size).fill { this[it] }).copy() - - internal abstract fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix - internal abstract fun produceDirtyVector(size: Int): GslVector - - public override fun produce(rows: Int, columns: Int, initializer: (i: Int, j: Int) -> T): GslMatrix = - produceDirtyMatrix(rows, columns).fill(initializer) - - public override fun point(size: Int, initializer: (Int) -> T): GslVector = - produceDirtyVector(size).fill(initializer) -} - -/** - * Represents [Double] matrix context implementing where all the operations are delegated to GSL. - */ -public class GslRealMatrixContext(internal val scope: AutofreeScope) : - GslMatrixContext() { - override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = GslRealMatrix( - rawNativeHandle = checkNotNull(gsl_matrix_alloc(rows.toULong(), columns.toULong())), - scope = scope, - owned = true, - ) - - override fun produceDirtyVector(size: Int): GslVector = - GslRealVector(rawNativeHandle = checkNotNull(gsl_vector_alloc(size.toULong())), scope = scope, owned = true) - - public override fun Matrix.dot(other: Matrix): GslMatrix { - val x = toGsl().nativeHandle - val a = other.toGsl().nativeHandle - val result = checkNotNull(gsl_matrix_calloc(a.pointed.size1, a.pointed.size2)) - gsl_blas_dgemm(CblasNoTrans, CblasNoTrans, 1.0, x, a, 1.0, result) - return GslRealMatrix(rawNativeHandle = result, scope = scope, owned = true) - } - - public override fun Matrix.dot(vector: Point): GslVector { - val x = toGsl().nativeHandle - val a = vector.toGsl().nativeHandle - val result = checkNotNull(gsl_vector_calloc(a.pointed.size)) - gsl_blas_dgemv(CblasNoTrans, 1.0, x, a, 1.0, result) - return GslRealVector(rawNativeHandle = result, scope = scope, owned = true) - } - - public override fun Matrix.times(value: Double): GslMatrix { - val g1 = toGsl().copy() - gsl_matrix_scale(g1.nativeHandle, value) - return g1 - } - - public override fun add(a: Matrix, b: Matrix): GslMatrix { - val g1 = a.toGsl().copy() - gsl_matrix_add(g1.nativeHandle, b.toGsl().nativeHandle) - return g1 - } - - public override fun multiply(a: Matrix, k: Number): GslMatrix { - val g1 = a.toGsl().copy() - gsl_matrix_scale(g1.nativeHandle, k.toDouble()) - return g1 - } - - public override fun Matrix.minus(b: Matrix): Matrix { - val g1 = toGsl().copy() - gsl_matrix_sub(g1.nativeHandle, b.toGsl().nativeHandle) - return g1 - } - - @Suppress("IMPLICIT_CAST_TO_ANY") - @UnstableKMathAPI - public override fun getFeature(m: Matrix, type: KClass): F? = when (type) { - LupDecompositionFeature::class, DeterminantFeature::class -> object : LupDecompositionFeature, - DeterminantFeature, InverseMatrixFeature { - private val lups by lazy { - val lu = m.toGsl().copy() - val n = m.rowNum - - val perm = GslPermutation( - rawNativeHandle = checkNotNull(gsl_permutation_alloc(n.toULong())), - scope = scope, - owned = true, - ) - - val signum = memScoped { - val i = alloc() - gsl_linalg_LU_decomp(lu.nativeHandle, perm.nativeHandle, i.ptr) - i.value - } - - Triple(lu, perm, signum) - } - - override val p by lazy { - val n = m.rowNum - val one = produce(n, n) { i, j -> if (i == j) 1.0 else 0.0 } - val perm = produce(n, n) { _, _ -> 0.0 } - - for (j in 0 until lups.second.size) - gsl_matrix_set_col(perm.nativeHandle, j.toULong(), one.columns[lups.second[j]].toGsl().nativeHandle) - - perm - } - - override val l by lazy { - VirtualMatrix(lups.first.shape[0], lups.first.shape[1]) { i, j -> - when { - j < i -> lups.first[i, j] - j == i -> 1.0 - else -> 0.0 - } - } + LFeature - } - - override val u by lazy { - VirtualMatrix( - lups.first.shape[0], - lups.first.shape[1], - ) { i, j -> if (j >= i) lups.first[i, j] else 0.0 } + UFeature - } - - override val determinant by lazy { gsl_linalg_LU_det(lups.first.nativeHandle, lups.third) } - - override val inverse by lazy { - val inv = lups.first.copy() - gsl_linalg_LU_invx(inv.nativeHandle, lups.second.nativeHandle) - inv - } - } - - CholeskyDecompositionFeature::class -> object : CholeskyDecompositionFeature { - override val l: Matrix by lazy { - val chol = m.toGsl().copy() - gsl_linalg_cholesky_decomp(chol.nativeHandle) - chol - } - } - - QRDecompositionFeature::class -> object : QRDecompositionFeature { - private val qr by lazy { - val a = m.toGsl().copy() - val q = produce(m.rowNum, m.rowNum) { _, _ -> 0.0 } - val r = produce(m.rowNum, m.colNum) { _, _ -> 0.0 } - - if (m.rowNum < m.colNum) { - val tau = point(min(m.rowNum, m.colNum)) { 0.0 } - gsl_linalg_QR_decomp(a.nativeHandle, tau.nativeHandle) - gsl_linalg_QR_unpack(a.nativeHandle, tau.nativeHandle, q.nativeHandle, r.nativeHandle) - } else { - val t = produce(m.colNum, m.colNum) { _, _ -> 0.0 } - gsl_linalg_QR_decomp_r(a.nativeHandle, t.nativeHandle) - gsl_linalg_QR_unpack_r(a.nativeHandle, t.nativeHandle, q.nativeHandle, r.nativeHandle) - } - - q to r - } - - override val q: Matrix get() = qr.first - override val r: Matrix get() = qr.second - } - - else -> super.getFeature(m, type) - }?.let(type::cast) -} - -/** - * Invokes [block] inside newly created [GslRealMatrixContext] which is disposed when the block is invoked. - */ -public fun GslRealMatrixContext(block: GslRealMatrixContext.() -> R): R = - memScoped { GslRealMatrixContext(this).block() } - -/** - * Represents [Float] matrix context implementing where all the operations are delegated to GSL. - */ -public class GslFloatMatrixContext(internal val scope: AutofreeScope) : - GslMatrixContext() { - override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = GslFloatMatrix( - rawNativeHandle = checkNotNull(gsl_matrix_float_alloc(rows.toULong(), columns.toULong())), - scope = scope, - owned = true, - ) - - override fun produceDirtyVector(size: Int): GslVector = GslFloatVector( - rawNativeHandle = checkNotNull(value = gsl_vector_float_alloc(size.toULong())), - scope = scope, - owned = true, - ) - - public override fun Matrix.dot(other: Matrix): GslMatrix { - val x = toGsl().nativeHandle - val a = other.toGsl().nativeHandle - val result = checkNotNull(gsl_matrix_float_calloc(a.pointed.size1, a.pointed.size2)) - gsl_blas_sgemm(CblasNoTrans, CblasNoTrans, 1f, x, a, 1f, result) - return GslFloatMatrix(rawNativeHandle = result, scope = scope, owned = true) - } - - public override fun Matrix.dot(vector: Point): GslVector { - val x = toGsl().nativeHandle - val a = vector.toGsl().nativeHandle - val result = checkNotNull(gsl_vector_float_calloc(a.pointed.size)) - gsl_blas_sgemv(CblasNoTrans, 1f, x, a, 1f, result) - return GslFloatVector(rawNativeHandle = result, scope = scope, owned = true) - } - - public override fun Matrix.times(value: Float): GslMatrix { - val g1 = toGsl().copy() - gsl_matrix_float_scale(g1.nativeHandle, value.toDouble()) - return g1 - } - - public override fun add(a: Matrix, b: Matrix): GslMatrix { - val g1 = a.toGsl().copy() - gsl_matrix_float_add(g1.nativeHandle, b.toGsl().nativeHandle) - return g1 - } - - public override fun multiply(a: Matrix, k: Number): GslMatrix { - val g1 = a.toGsl().copy() - gsl_matrix_float_scale(g1.nativeHandle, k.toDouble()) - return g1 - } - - public override fun Matrix.minus(b: Matrix): Matrix { - val g1 = toGsl().copy() - gsl_matrix_float_sub(g1.nativeHandle, b.toGsl().nativeHandle) - return g1 - } -} - -/** - * Invokes [block] inside newly created [GslFloatMatrixContext] which is disposed when the block is invoked. - */ -public fun GslFloatMatrixContext(block: GslFloatMatrixContext.() -> R): R = - memScoped { GslFloatMatrixContext(this).block() } - -/** - * Represents [Complex] matrix context implementing where all the operations are delegated to GSL. - */ -public class GslComplexMatrixContext(internal val scope: AutofreeScope) : - GslMatrixContext() { - override fun produceDirtyMatrix(rows: Int, columns: Int): GslMatrix = GslComplexMatrix( - rawNativeHandle = checkNotNull(gsl_matrix_complex_alloc(rows.toULong(), columns.toULong())), - scope = scope, - owned = true, - ) - - override fun produceDirtyVector(size: Int): GslVector = - GslComplexVector( - rawNativeHandle = checkNotNull(gsl_vector_complex_alloc(size.toULong())), - scope = scope, - owned = true, - ) - - public override fun Matrix.dot(other: Matrix): GslMatrix { - val x = toGsl().nativeHandle - val a = other.toGsl().nativeHandle - val result = checkNotNull(gsl_matrix_complex_calloc(a.pointed.size1, a.pointed.size2)) - gsl_blas_zgemm(CblasNoTrans, CblasNoTrans, ComplexField.one.toGsl(), x, a, ComplexField.one.toGsl(), result) - return GslComplexMatrix(rawNativeHandle = result, scope = scope, owned = true) - } - - public override fun Matrix.dot(vector: Point): GslVector { - val x = toGsl().nativeHandle - val a = vector.toGsl().nativeHandle - val result = checkNotNull(gsl_vector_complex_calloc(a.pointed.size)) - gsl_blas_zgemv(CblasNoTrans, ComplexField.one.toGsl(), x, a, ComplexField.one.toGsl(), result) - return GslComplexVector(rawNativeHandle = result, scope = scope, owned = true) - } - - public override fun Matrix.times(value: Complex): GslMatrix { - val g1 = toGsl().copy() - gsl_matrix_complex_scale(g1.nativeHandle, value.toGsl()) - return g1 - } - - public override fun add(a: Matrix, b: Matrix): GslMatrix { - val g1 = a.toGsl().copy() - gsl_matrix_complex_add(g1.nativeHandle, b.toGsl().nativeHandle) - return g1 - } - - public override fun multiply(a: Matrix, k: Number): GslMatrix { - val g1 = a.toGsl().copy() - gsl_matrix_complex_scale(g1.nativeHandle, k.toComplex().toGsl()) - return g1 - } - - public override fun Matrix.minus(b: Matrix): Matrix { - val g1 = toGsl().copy() - gsl_matrix_complex_sub(g1.nativeHandle, b.toGsl().nativeHandle) - return g1 - } - - @Suppress("IMPLICIT_CAST_TO_ANY") - @UnstableKMathAPI - public override fun getFeature(m: Matrix, type: KClass): F? = when (type) { - LupDecompositionFeature::class, DeterminantFeature::class -> object : LupDecompositionFeature, - DeterminantFeature, InverseMatrixFeature { - private val lups by lazy { - val lu = m.toGsl().copy() - val n = m.rowNum - - val perm = GslPermutation(rawNativeHandle = checkNotNull(gsl_permutation_alloc(n.toULong())), - scope = scope, - owned = true) - - val signum = memScoped { - val i = alloc() - gsl_linalg_complex_LU_decomp(lu.nativeHandle, perm.nativeHandle, i.ptr) - i.value - } - - Triple(lu, perm, signum) - } - - override val p by lazy { - val n = m.rowNum - val one = produce(n, n) { i, j -> if (i == j) 1.0.toComplex() else 0.0.toComplex() } - val perm = produce(n, n) { _, _ -> 0.0.toComplex() } - - for (j in 0 until lups.second.size) - gsl_matrix_complex_set_col(perm.nativeHandle, - j.toULong(), - one.columns[lups.second[j]].toGsl().nativeHandle) - - perm - } - - override val l by lazy { - VirtualMatrix(lups.first.shape[0], lups.first.shape[1]) { i, j -> - when { - j < i -> lups.first[i, j] - j == i -> 1.0.toComplex() - else -> 0.0.toComplex() - } - } + LFeature - } - - override val u by lazy { - VirtualMatrix( - lups.first.shape[0], - lups.first.shape[1], - ) { i, j -> if (j >= i) lups.first[i, j] else 0.0.toComplex() } + UFeature - } - - override val determinant by lazy { - gsl_linalg_complex_LU_det(lups.first.nativeHandle, lups.third).toKMath() - } - - override val inverse by lazy { - val inv = lups.first.copy() - gsl_linalg_complex_LU_invx(inv.nativeHandle, lups.second.nativeHandle) - inv - } - } - - CholeskyDecompositionFeature::class -> object : CholeskyDecompositionFeature { - override val l by lazy { - val chol = m.toGsl().copy() - gsl_linalg_complex_cholesky_decomp(chol.nativeHandle) - chol - } - } - - else -> super.getFeature(m, type) - }?.let(type::cast) -} - -/** - * Invokes [block] inside newly created [GslComplexMatrixContext] which is disposed when the block is invoked. - */ -public fun GslComplexMatrixContext(block: GslComplexMatrixContext.() -> R): R = - memScoped { GslComplexMatrixContext(this).block() } diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslObject.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslObject.kt deleted file mode 100644 index ff4ef96c5..000000000 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslObject.kt +++ /dev/null @@ -1,36 +0,0 @@ -package kscience.kmath.gsl - -import kotlinx.cinterop.AutofreeScope -import kotlinx.cinterop.CPointer -import kotlinx.cinterop.CStructVar -import kotlinx.cinterop.DeferScope - -/** - * Represents managed native GSL object. The only property this class holds is pointer to the GSL object. In order to be - * freed this class's object must be added to [DeferScope]. - * - * The objects of this type shouldn't be used after being disposed by the scope. - * - * @param scope the scope where this object is declared. - */ -public abstract class GslObject internal constructor(internal val scope: AutofreeScope, internal val owned: Boolean) { - internal abstract val rawNativeHandle: CPointer - private var isClosed: Boolean = false - - internal val nativeHandle: CPointer - get() { - check(!isClosed) { "The use of GSL object that is closed." } - return rawNativeHandle - } - - init { - ensureHasGslErrorHandler() - - scope.defer { - if (owned) close() - isClosed = true - } - } - - internal abstract fun close() -} diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslPermutation.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslPermutation.kt deleted file mode 100644 index 6954ceee2..000000000 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslPermutation.kt +++ /dev/null @@ -1,19 +0,0 @@ -package kscience.kmath.gsl - -import kotlinx.cinterop.AutofreeScope -import kotlinx.cinterop.CPointer -import kotlinx.cinterop.pointed -import org.gnu.gsl.gsl_permutation -import org.gnu.gsl.gsl_permutation_free -import org.gnu.gsl.gsl_permutation_get - -internal class GslPermutation( - override val rawNativeHandle: CPointer, - scope: AutofreeScope, - owned: Boolean, -) : GslObject(scope, owned) { - val size get() = nativeHandle.pointed.size.toInt() - - operator fun get(i: Int) = gsl_permutation_get(nativeHandle, i.toULong()).toInt() - override fun close() = gsl_permutation_free(nativeHandle) -} diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt deleted file mode 100644 index 14b956aba..000000000 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslVector.kt +++ /dev/null @@ -1,25 +0,0 @@ -package kscience.kmath.gsl - -import kotlinx.cinterop.AutofreeScope -import kotlinx.cinterop.CStructVar -import kscience.kmath.linear.Point - -/** - * Wraps gsl_vector_* objects from GSL. - */ -public abstract class GslVector internal constructor(scope: AutofreeScope, owned: Boolean) : - GslObject(scope, owned), Point { - internal abstract operator fun set(index: Int, value: T) - internal abstract fun copy(): GslVector - - public final override fun iterator(): Iterator = object : Iterator { - private var cursor = 0 - - override fun hasNext(): Boolean = cursor < size - - override fun next(): T { - cursor++ - return this@GslVector[cursor - 1] - } - } -} diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt deleted file mode 100644 index a0ed0cdb0..000000000 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Matrices.kt +++ /dev/null @@ -1,414 +0,0 @@ -package kscience.kmath.gsl - -import kotlinx.cinterop.* -import kscience.kmath.structures.* -import org.gnu.gsl.* - -internal class GslRealMatrix( - override val rawNativeHandle: CPointer, - scope: AutofreeScope, - owned: Boolean, -) : GslMatrix(scope, owned) { - override val rowNum: Int - get() = nativeHandle.pointed.size1.toInt() - - override val colNum: Int - get() = nativeHandle.pointed.size2.toInt() - - override val rows: Buffer> - get() = VirtualBuffer(rowNum) { r -> - GslRealVector( - gsl_matrix_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, - scope, - false, - ) - } - - override val columns: Buffer> - get() = VirtualBuffer(rowNum) { c -> - GslRealVector( - gsl_matrix_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, - scope, - false, - ) - } - - override operator fun get(i: Int, j: Int): Double = - gsl_matrix_get(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: Double): Unit = - gsl_matrix_set(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): GslRealMatrix { - val new = checkNotNull(gsl_matrix_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_memcpy(new, nativeHandle) - return GslRealMatrix(new, scope, true) - } - - override fun close(): Unit = gsl_matrix_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslRealMatrix) - return gsl_matrix_equal(nativeHandle, other.nativeHandle) == 1 - - return super.equals(other) - } -} - -internal class GslFloatMatrix( - override val rawNativeHandle: CPointer, - scope: AutofreeScope, - owned: Boolean, -) : GslMatrix(scope, owned) { - override val rowNum: Int - get() = nativeHandle.pointed.size1.toInt() - - override val colNum: Int - get() = nativeHandle.pointed.size2.toInt() - - override val rows: Buffer> - get() = VirtualBuffer(rowNum) { r -> - GslFloatVector( - gsl_matrix_float_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, - scope, - false, - ) - } - - override val columns: Buffer> - get() = VirtualBuffer(rowNum) { c -> - GslFloatVector( - gsl_matrix_float_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, - scope, - false, - ) - } - - override operator fun get(i: Int, j: Int): Float = - gsl_matrix_float_get(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: Float): Unit = - gsl_matrix_float_set(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): GslFloatMatrix { - val new = checkNotNull(gsl_matrix_float_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_float_memcpy(new, nativeHandle) - return GslFloatMatrix(new, scope, true) - } - - override fun close(): Unit = gsl_matrix_float_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslFloatMatrix) - return gsl_matrix_float_equal(nativeHandle, other.nativeHandle) == 1 - - return super.equals(other) - } -} - -internal class GslShortMatrix( - override val rawNativeHandle: CPointer, - scope: AutofreeScope, - owned: Boolean, -) : GslMatrix(scope, owned) { - override val rowNum: Int - get() = nativeHandle.pointed.size1.toInt() - - override val colNum: Int - get() = nativeHandle.pointed.size2.toInt() - - override val rows: Buffer> - get() = VirtualBuffer(rowNum) { r -> - GslShortVector( - gsl_matrix_short_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, - scope, - false, - ) - } - - override val columns: Buffer> - get() = VirtualBuffer(rowNum) { c -> - GslShortVector( - gsl_matrix_short_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, - scope, - false, - ) - } - - override operator fun get(i: Int, j: Int): Short = - gsl_matrix_short_get(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: Short): Unit = - gsl_matrix_short_set(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): GslShortMatrix { - val new = checkNotNull(gsl_matrix_short_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_short_memcpy(new, nativeHandle) - return GslShortMatrix(new, scope, true) - } - - override fun close(): Unit = gsl_matrix_short_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslShortMatrix) - return gsl_matrix_short_equal(nativeHandle, other.nativeHandle) == 1 - - return super.equals(other) - } -} - -internal class GslUShortMatrix( - override val rawNativeHandle: CPointer, - scope: AutofreeScope, - owned: Boolean, -) : GslMatrix(scope, owned) { - override val rowNum: Int - get() = nativeHandle.pointed.size1.toInt() - - override val colNum: Int - get() = nativeHandle.pointed.size2.toInt() - - override val rows: Buffer> - get() = VirtualBuffer(rowNum) { r -> - GslUShortVector( - gsl_matrix_ushort_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, - scope, - false, - ) - } - - override val columns: Buffer> - get() = VirtualBuffer(rowNum) { c -> - GslUShortVector( - gsl_matrix_ushort_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, - scope, - false, - ) - } - - override operator fun get(i: Int, j: Int): UShort = - gsl_matrix_ushort_get(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: UShort): Unit = - gsl_matrix_ushort_set(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): GslUShortMatrix { - val new = checkNotNull(gsl_matrix_ushort_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_ushort_memcpy(new, nativeHandle) - return GslUShortMatrix(new, scope, true) - } - - override fun close(): Unit = gsl_matrix_ushort_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslUShortMatrix) - return gsl_matrix_ushort_equal(nativeHandle, other.nativeHandle) == 1 - - return super.equals(other) - } -} - -internal class GslLongMatrix( - override val rawNativeHandle: CPointer, - scope: AutofreeScope, - owned: Boolean, -) : GslMatrix(scope, owned) { - override val rowNum: Int - get() = nativeHandle.pointed.size1.toInt() - - override val colNum: Int - get() = nativeHandle.pointed.size2.toInt() - - override val rows: Buffer> - get() = VirtualBuffer(rowNum) { r -> - GslLongVector( - gsl_matrix_long_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, - scope, - false, - ) - } - - override val columns: Buffer> - get() = VirtualBuffer(rowNum) { c -> - GslLongVector( - gsl_matrix_long_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, - scope, - false, - ) - } - - override operator fun get(i: Int, j: Int): Long = - gsl_matrix_long_get(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: Long): Unit = - gsl_matrix_long_set(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): GslLongMatrix { - val new = checkNotNull(gsl_matrix_long_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_long_memcpy(new, nativeHandle) - return GslLongMatrix(new, scope, true) - } - - override fun close(): Unit = gsl_matrix_long_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslLongMatrix) - return gsl_matrix_long_equal(nativeHandle, other.nativeHandle) == 1 - - return super.equals(other) - } -} - -internal class GslULongMatrix( - override val rawNativeHandle: CPointer, - scope: AutofreeScope, - owned: Boolean, -) : GslMatrix(scope, owned) { - override val rowNum: Int - get() = nativeHandle.pointed.size1.toInt() - - override val colNum: Int - get() = nativeHandle.pointed.size2.toInt() - - override val rows: Buffer> - get() = VirtualBuffer(rowNum) { r -> - GslULongVector( - gsl_matrix_ulong_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, - scope, - false, - ) - } - - override val columns: Buffer> - get() = VirtualBuffer(rowNum) { c -> - GslULongVector( - gsl_matrix_ulong_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, - scope, - false, - ) - } - - override operator fun get(i: Int, j: Int): ULong = - gsl_matrix_ulong_get(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: ULong): Unit = - gsl_matrix_ulong_set(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): GslULongMatrix { - val new = checkNotNull(gsl_matrix_ulong_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_ulong_memcpy(new, nativeHandle) - return GslULongMatrix(new, scope, true) - } - - override fun close(): Unit = gsl_matrix_ulong_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslULongMatrix) - return gsl_matrix_ulong_equal(nativeHandle, other.nativeHandle) == 1 - - return super.equals(other) - } -} - -internal class GslIntMatrix( - override val rawNativeHandle: CPointer, - scope: AutofreeScope, - owned: Boolean, -) : GslMatrix(scope, owned) { - override val rowNum: Int - get() = nativeHandle.pointed.size1.toInt() - - override val colNum: Int - get() = nativeHandle.pointed.size2.toInt() - - override val rows: Buffer> - get() = VirtualBuffer(rowNum) { r -> - GslIntVector( - gsl_matrix_int_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, - scope, - false, - ) - } - - override val columns: Buffer> - get() = VirtualBuffer(rowNum) { c -> - GslIntVector( - gsl_matrix_int_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, - scope, - false, - ) - } - - override operator fun get(i: Int, j: Int): Int = - gsl_matrix_int_get(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: Int): Unit = - gsl_matrix_int_set(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): GslIntMatrix { - val new = checkNotNull(gsl_matrix_int_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_int_memcpy(new, nativeHandle) - return GslIntMatrix(new, scope, true) - } - - override fun close(): Unit = gsl_matrix_int_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslIntMatrix) - return gsl_matrix_int_equal(nativeHandle, other.nativeHandle) == 1 - - return super.equals(other) - } -} - -internal class GslUIntMatrix( - override val rawNativeHandle: CPointer, - scope: AutofreeScope, - owned: Boolean, -) : GslMatrix(scope, owned) { - override val rowNum: Int - get() = nativeHandle.pointed.size1.toInt() - - override val colNum: Int - get() = nativeHandle.pointed.size2.toInt() - - override val rows: Buffer> - get() = VirtualBuffer(rowNum) { r -> - GslUIntVector( - gsl_matrix_uint_row(nativeHandle, r.toULong()).placeTo(scope).pointed.vector.ptr, - scope, - false, - ) - } - - override val columns: Buffer> - get() = VirtualBuffer(rowNum) { c -> - GslUIntVector( - gsl_matrix_uint_column(nativeHandle, c.toULong()).placeTo(scope).pointed.vector.ptr, - scope, - false, - ) - } - - override operator fun get(i: Int, j: Int): UInt = - gsl_matrix_uint_get(nativeHandle, i.toULong(), j.toULong()) - - override operator fun set(i: Int, j: Int, value: UInt): Unit = - gsl_matrix_uint_set(nativeHandle, i.toULong(), j.toULong(), value) - - override fun copy(): GslUIntMatrix { - val new = checkNotNull(gsl_matrix_uint_alloc(rowNum.toULong(), colNum.toULong())) - gsl_matrix_uint_memcpy(new, nativeHandle) - return GslUIntMatrix(new, scope, true) - } - - override fun close(): Unit = gsl_matrix_uint_free(nativeHandle) - - override fun equals(other: Any?): Boolean { - if (other is GslUIntMatrix) - return gsl_matrix_uint_equal(nativeHandle, other.nativeHandle) == 1 - - return super.equals(other) - } -} - diff --git a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt b/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt deleted file mode 100644 index 922c2ba2f..000000000 --- a/kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/_Vectors.kt +++ /dev/null @@ -1,205 +0,0 @@ -package kscience.kmath.gsl - -import kotlinx.cinterop.* -import org.gnu.gsl.* - -internal class GslRealVector( - override val rawNativeHandle: CPointer, - scope: AutofreeScope, - owned: Boolean, -) : GslVector(scope, owned) { - override val size: Int get() = nativeHandle.pointed.size.toInt() - override operator fun get(index: Int): Double = gsl_vector_get(nativeHandle, index.toULong()) - override operator fun set(index: Int, value: Double): Unit = gsl_vector_set(nativeHandle, index.toULong(), value) - - override fun copy(): GslRealVector { - val new = checkNotNull(gsl_vector_alloc(size.toULong())) - gsl_vector_memcpy(new, nativeHandle) - return GslRealVector(new, scope, true) - } - - override fun equals(other: Any?): Boolean { - if (other is GslRealVector) - return gsl_vector_equal(nativeHandle, other.nativeHandle) == 1 - - return super.equals(other) - } - - override fun close(): Unit = gsl_vector_free(nativeHandle) -} - -internal class GslFloatVector( - override val rawNativeHandle: CPointer, - scope: AutofreeScope, - owned: Boolean, -) : GslVector(scope, owned) { - override val size: Int get() = nativeHandle.pointed.size.toInt() - override operator fun get(index: Int): Float = gsl_vector_float_get(nativeHandle, index.toULong()) - override operator fun set(index: Int, value: Float): Unit = gsl_vector_float_set(nativeHandle, index.toULong(), value) - - override fun copy(): GslFloatVector { - val new = checkNotNull(gsl_vector_float_alloc(size.toULong())) - gsl_vector_float_memcpy(new, nativeHandle) - return GslFloatVector(new, scope, true) - } - - override fun equals(other: Any?): Boolean { - if (other is GslFloatVector) - return gsl_vector_float_equal(nativeHandle, other.nativeHandle) == 1 - - return super.equals(other) - } - - override fun close(): Unit = gsl_vector_float_free(nativeHandle) -} - -internal class GslShortVector( - override val rawNativeHandle: CPointer, - scope: AutofreeScope, - owned: Boolean, -) : GslVector(scope, owned) { - override val size: Int get() = nativeHandle.pointed.size.toInt() - override operator fun get(index: Int): Short = gsl_vector_short_get(nativeHandle, index.toULong()) - override operator fun set(index: Int, value: Short): Unit = gsl_vector_short_set(nativeHandle, index.toULong(), value) - - override fun copy(): GslShortVector { - val new = checkNotNull(gsl_vector_short_alloc(size.toULong())) - gsl_vector_short_memcpy(new, nativeHandle) - return GslShortVector(new, scope, true) - } - - override fun equals(other: Any?): Boolean { - if (other is GslShortVector) - return gsl_vector_short_equal(nativeHandle, other.nativeHandle) == 1 - - return super.equals(other) - } - - override fun close(): Unit = gsl_vector_short_free(nativeHandle) -} - -internal class GslUShortVector( - override val rawNativeHandle: CPointer, - scope: AutofreeScope, - owned: Boolean, -) : GslVector(scope, owned) { - override val size: Int get() = nativeHandle.pointed.size.toInt() - override operator fun get(index: Int): UShort = gsl_vector_ushort_get(nativeHandle, index.toULong()) - override operator fun set(index: Int, value: UShort): Unit = gsl_vector_ushort_set(nativeHandle, index.toULong(), value) - - override fun copy(): GslUShortVector { - val new = checkNotNull(gsl_vector_ushort_alloc(size.toULong())) - gsl_vector_ushort_memcpy(new, nativeHandle) - return GslUShortVector(new, scope, true) - } - - override fun equals(other: Any?): Boolean { - if (other is GslUShortVector) - return gsl_vector_ushort_equal(nativeHandle, other.nativeHandle) == 1 - - return super.equals(other) - } - - override fun close(): Unit = gsl_vector_ushort_free(nativeHandle) -} - -internal class GslLongVector( - override val rawNativeHandle: CPointer, - scope: AutofreeScope, - owned: Boolean, -) : GslVector(scope, owned) { - override val size: Int get() = nativeHandle.pointed.size.toInt() - override operator fun get(index: Int): Long = gsl_vector_long_get(nativeHandle, index.toULong()) - override operator fun set(index: Int, value: Long): Unit = gsl_vector_long_set(nativeHandle, index.toULong(), value) - - override fun copy(): GslLongVector { - val new = checkNotNull(gsl_vector_long_alloc(size.toULong())) - gsl_vector_long_memcpy(new, nativeHandle) - return GslLongVector(new, scope, true) - } - - override fun equals(other: Any?): Boolean { - if (other is GslLongVector) - return gsl_vector_long_equal(nativeHandle, other.nativeHandle) == 1 - - return super.equals(other) - } - - override fun close(): Unit = gsl_vector_long_free(nativeHandle) -} - -internal class GslULongVector( - override val rawNativeHandle: CPointer, - scope: AutofreeScope, - owned: Boolean, -) : GslVector(scope, owned) { - override val size: Int get() = nativeHandle.pointed.size.toInt() - override operator fun get(index: Int): ULong = gsl_vector_ulong_get(nativeHandle, index.toULong()) - override operator fun set(index: Int, value: ULong): Unit = gsl_vector_ulong_set(nativeHandle, index.toULong(), value) - - override fun copy(): GslULongVector { - val new = checkNotNull(gsl_vector_ulong_alloc(size.toULong())) - gsl_vector_ulong_memcpy(new, nativeHandle) - return GslULongVector(new, scope, true) - } - - override fun equals(other: Any?): Boolean { - if (other is GslULongVector) - return gsl_vector_ulong_equal(nativeHandle, other.nativeHandle) == 1 - - return super.equals(other) - } - - override fun close(): Unit = gsl_vector_ulong_free(nativeHandle) -} - -internal class GslIntVector( - override val rawNativeHandle: CPointer, - scope: AutofreeScope, - owned: Boolean, -) : GslVector(scope, owned) { - override val size: Int get() = nativeHandle.pointed.size.toInt() - override operator fun get(index: Int): Int = gsl_vector_int_get(nativeHandle, index.toULong()) - override operator fun set(index: Int, value: Int): Unit = gsl_vector_int_set(nativeHandle, index.toULong(), value) - - override fun copy(): GslIntVector { - val new = checkNotNull(gsl_vector_int_alloc(size.toULong())) - gsl_vector_int_memcpy(new, nativeHandle) - return GslIntVector(new, scope, true) - } - - override fun equals(other: Any?): Boolean { - if (other is GslIntVector) - return gsl_vector_int_equal(nativeHandle, other.nativeHandle) == 1 - - return super.equals(other) - } - - override fun close(): Unit = gsl_vector_int_free(nativeHandle) -} - -internal class GslUIntVector( - override val rawNativeHandle: CPointer, - scope: AutofreeScope, - owned: Boolean, -) : GslVector(scope, owned) { - override val size: Int get() = nativeHandle.pointed.size.toInt() - override operator fun get(index: Int): UInt = gsl_vector_uint_get(nativeHandle, index.toULong()) - override operator fun set(index: Int, value: UInt): Unit = gsl_vector_uint_set(nativeHandle, index.toULong(), value) - - override fun copy(): GslUIntVector { - val new = checkNotNull(gsl_vector_uint_alloc(size.toULong())) - gsl_vector_uint_memcpy(new, nativeHandle) - return GslUIntVector(new, scope, true) - } - - override fun equals(other: Any?): Boolean { - if (other is GslUIntVector) - return gsl_vector_uint_equal(nativeHandle, other.nativeHandle) == 1 - - return super.equals(other) - } - - override fun close(): Unit = gsl_vector_uint_free(nativeHandle) -} - diff --git a/kmath-gsl/src/nativeTest/kotlin/ErrorsHandlingTest.kt b/kmath-gsl/src/nativeTest/kotlin/ErrorsHandlingTest.kt deleted file mode 100644 index 7d97eca85..000000000 --- a/kmath-gsl/src/nativeTest/kotlin/ErrorsHandlingTest.kt +++ /dev/null @@ -1,32 +0,0 @@ -package kscience.kmath.gsl - -import org.gnu.gsl.gsl_block_calloc -import kotlin.test.Test -import kotlin.test.assertFailsWith - -internal class ErrorsHandlingTest { - @Test - fun blockAllocation() { - assertFailsWith { - ensureHasGslErrorHandler() - gsl_block_calloc(ULong.MAX_VALUE) - } - } - - @Test - fun matrixAllocation() { - assertFailsWith { - GslRealMatrixContext { produce(Int.MAX_VALUE, Int.MAX_VALUE) { _, _ -> 0.0 } } - } - } - - @Test - fun useOfClosedObject() { - val mat = GslRealMatrixContext { produce(1, 1) { _, _ -> 0.0 } } - assertFailsWith { mat.colNum } - assertFailsWith { mat.rowNum } - assertFailsWith { mat[0, 0] } - assertFailsWith { mat.copy() } - assertFailsWith { println(mat == mat) } - } -} diff --git a/kmath-gsl/src/nativeTest/kotlin/GslMatrixRealTest.kt b/kmath-gsl/src/nativeTest/kotlin/GslMatrixRealTest.kt deleted file mode 100644 index 79ee7e7f1..000000000 --- a/kmath-gsl/src/nativeTest/kotlin/GslMatrixRealTest.kt +++ /dev/null @@ -1,62 +0,0 @@ -package kscience.kmath.gsl - -import kscience.kmath.linear.Matrix -import kscience.kmath.linear.RealMatrixContext -import kscience.kmath.operations.invoke -import kscience.kmath.structures.asIterable -import kscience.kmath.structures.toList -import kotlin.random.Random -import kotlin.test.Test -import kotlin.test.assertEquals - -internal class GslMatrixRealTest { - @Test - fun dimensions() = GslRealMatrixContext { - val mat = produce(42, 24) { _, _ -> 0.0 } - assertEquals(42, mat.rowNum) - assertEquals(24, mat.colNum) - } - - @Test - fun get() = GslRealMatrixContext { - val mat = produce(1, 1) { _, _ -> 42.0 } - assertEquals(42.0, mat[0, 0]) - } - - @Test - fun copy() = GslRealMatrixContext { - val mat = produce(1, 1) { _, _ -> 42.0 } - assertEquals(mat, mat.copy()) - } - - @Test - fun equals() = GslRealMatrixContext { - var rng = Random(0) - val mat: Matrix = produce(2, 2) { _, _ -> rng.nextDouble() } - rng = Random(0) - val mat2: Matrix = RealMatrixContext { produce(2, 2) { _, _ -> rng.nextDouble() } } - rng = Random(0) - val mat3: Matrix = produce(2, 2) { _, _ -> rng.nextDouble() } - assertEquals(mat, mat2) - assertEquals(mat, mat3) - assertEquals(mat2, mat3) - } - - @Test - fun rows() = GslRealMatrixContext { - val mat = produce(2, 2) { i, j -> i.toDouble() + j } - - mat.rows.asIterable().zip(listOf(listOf(0.0, 1.0), listOf(1.0, 2.0))).forEach { (a, b) -> - assertEquals(a.toList(), b) - } - } - - @Test - fun columns() = GslRealMatrixContext { - val mat = produce(2, 2) { i, j -> i.toDouble() + j } - - mat.columns.asIterable().zip(listOf(listOf(0.0, 1.0), listOf(1.0, 2.0))).forEach { (a, b) -> - assertEquals(a.toList(), b) - } - } -} diff --git a/kmath-gsl/src/nativeTest/kotlin/GslRealMatrixContextTest.kt b/kmath-gsl/src/nativeTest/kotlin/GslRealMatrixContextTest.kt deleted file mode 100644 index fa35a5346..000000000 --- a/kmath-gsl/src/nativeTest/kotlin/GslRealMatrixContextTest.kt +++ /dev/null @@ -1,58 +0,0 @@ -package kscience.kmath.gsl - -import kscience.kmath.linear.Matrix -import kscience.kmath.linear.RealMatrixContext -import kscience.kmath.operations.invoke -import kscience.kmath.structures.RealBuffer -import kscience.kmath.structures.asSequence -import kotlin.random.Random -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertTrue -import kotlin.time.measureTime - -internal class GslRealMatrixContextTest { - @Test - fun testScale() = GslRealMatrixContext { - val ma = produce(10, 10) { _, _ -> 0.1 } - val mb = ma * 20.0 - assertEquals(mb[0, 1], 2.0) - } - - @Test - fun testDotOfMatrixAndVector() = GslRealMatrixContext { - val ma = produce(2, 2) { _, _ -> 100.0 } - val vb = RealBuffer(2) { 0.1 } - val res1 = ma dot vb - val res2 = RealMatrixContext { ma dot vb } - println(res1.asSequence().toList()) - println(res2.asSequence().toList()) - assertTrue(res1.contentEquals(res2)) - } - - @Test - fun testDotOfMatrixAndMatrix() = GslRealMatrixContext { - val ma = produce(2, 2) { _, _ -> 100.0 } - val mb = produce(2, 2) { _, _ -> 100.0 } - val res1: Matrix = ma dot mb - val res2: Matrix = RealMatrixContext { ma dot mb } - assertEquals(res1, res2) - } - - @Test - fun testManyCalls() = GslRealMatrixContext { - val expected: Matrix = RealMatrixContext { - val rng = Random(0) - var prod = produce(20, 20) { _, _ -> rng.nextDouble() } - val mult = produce(20, 20) { _, _ -> rng.nextDouble() } - measureTime { repeat(100) { prod = prod dot mult } }.also(::println) - prod - } - - val rng = Random(0) - var prod: Matrix = produce(20, 20) { _, _ -> rng.nextDouble() } - val mult = produce(20, 20) { _, _ -> rng.nextDouble() } - measureTime { repeat(100) { prod = prod dot mult } }.also(::println) - assertEquals(expected, prod) - } -} diff --git a/settings.gradle.kts b/settings.gradle.kts index a53bcd301..806419bcd 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -41,6 +41,5 @@ include( ":kmath-ast", ":kmath-ejml", ":kmath-kotlingrad", - ":kmath-gsl", ":examples" ) From 48545bae23fc7df6da3d75525d50709ad861bd22 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 18 Feb 2021 19:38:39 +0700 Subject: [PATCH 74/76] Remove changelog changes --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14b193be2..2396c6b27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,6 @@ - Generic operation result parameter to `MatrixContext` - New `MatrixFeature` interfaces for matrix decompositions - Basic Quaternion vector support in `kmath-complex`. -- Integration with GNU Scientific Library with `kmath-gsl` for Kotlin/Native Linux x64 target. ### Changed - Package changed from `scientifik` to `kscience.kmath` From 69cdfc9500ad01eb9ad56355d564d250749dddf6 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 18 Feb 2021 19:39:25 +0700 Subject: [PATCH 75/76] Regenerate README, undo workflows changes --- .github/workflows/build.yml | 6 ------ .github/workflows/publish.yml | 6 ------ README.md | 10 ---------- 3 files changed, 22 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0ad65a4db..626062abf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,10 +14,6 @@ jobs: java-version: 11 - name: Grant execute permission for gradlew run: chmod +x gradlew - - name: Install libgsl-dev - run: | - sudo apt update - sudo apt install -y libgsl-dev gcc-multilib - name: Install Chrome run: | sudo apt install -y libappindicator1 fonts-liberation @@ -55,8 +51,6 @@ jobs: java-version: 11 - name: Grant execute permission for gradlew run: chmod +x gradlew - - name: Install gsl - run: brew install gsl - name: Cache gradle uses: actions/cache@v2 with: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a088703ee..40b172908 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,10 +17,6 @@ jobs: java-version: 11 - name: Grant execute permission for gradlew run: chmod +x gradlew - - name: Install libgsl-dev - run: | - sudo apt update - sudo apt install -y libgsl-dev gcc-multilib - name: Install Chrome run: | sudo apt install -y libappindicator1 fonts-liberation @@ -60,8 +56,6 @@ jobs: java-version: 11 - name: Grant execute permission for gradlew run: chmod +x gradlew - - name: Install gsl - run: brew install gsl - name: Cache gradle uses: actions/cache@v2 with: diff --git a/README.md b/README.md index db7aac730..586d2185f 100644 --- a/README.md +++ b/README.md @@ -184,16 +184,6 @@ One can still use generic algebras though. > **Maturity**: PROTOTYPE
-* ### [kmath-gsl](kmath-gsl) -> Linear Algebra classes implemented with GNU Scientific Library -> -> **Maturity**: PROTOTYPE -> -> **Features:** -> - [matrix-contexts](kmath-gsl/src/nativeMain/kotlin/kscience/kmath/gsl/GslMatrixContext.kt) : Matrix Contexts over Double, Float and Complex implemented with GSL - -
- * ### [kmath-histograms](kmath-histograms) > > From ef97386033b4c565589158fb84cc0425f0fb2ded Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Fri, 19 Feb 2021 17:33:20 +0700 Subject: [PATCH 76/76] Fix typo --- .../kotlin/kscience/kmath/linear/MatrixContext.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt index b07587752..ab7ea9a22 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt @@ -71,8 +71,8 @@ public interface MatrixContext> : SpaceOperations): M = m * this /** - * Gets a feature from the matrix. This function may return some additional features than - * [kscience.kmath.structures.NDStructure.getFeature]. + * Gets a feature from the matrix. This function may return some additional features to + * [kscience.kmath.nd.NDStructure.getFeature]. * * @param F the type of feature. * @param m the matrix. @@ -101,8 +101,8 @@ public interface MatrixContext> : SpaceOperations