From 9e277a7de361c57fd6e8ff8244e3ce57ad5bf050 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 4 Oct 2020 12:45:35 +0700 Subject: [PATCH 001/150] 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 002/150] 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 003/150] 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 004/150] 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 005/150] 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 006/150] 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 007/150] 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 008/150] 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 009/150] 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 010/150] 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 011/150] 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 012/150] 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 013/150] 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 014/150] 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 015/150] 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 016/150] 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 017/150] 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 018/150] 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 019/150] 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 020/150] 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 021/150] 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 022/150] 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 023/150] 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 024/150] 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 025/150] 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 026/150] 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 027/150] 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 028/150] 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 029/150] 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 030/150] 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 031/150] 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 032/150] 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 033/150] 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 034/150] 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 035/150] 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 036/150] 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 037/150] 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 038/150] 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 039/150] 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 040/150] 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 041/150] 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 042/150] 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 043/150] 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 044/150] 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 045/150] 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 046/150] 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 047/150] 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 048/150] 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 049/150] 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 050/150] 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 051/150] 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 052/150] 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 053/150] 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 054/150] 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 055/150] 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 056/150] 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 057/150] 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 058/150] 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 059/150] 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 060/150] 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 061/150] 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 062/150] 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 063/150] 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 064/150] 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 065/150] 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 066/150] 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 067/150] 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 068/150] 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 069/150] 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 a384b323c3cc0002fb9b9475c8688353313c153f Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Thu, 11 Feb 2021 11:17:44 +0300 Subject: [PATCH 070/150] Update examples to use `with` instead of `invoke` on algebras --- .../kscience/kmath/benchmarks/LinearAlgebraBenchmark.kt | 5 ++--- .../kotlin/kscience/kmath/benchmarks/NDFieldBenchmark.kt | 7 +++---- .../kotlin/kscience/kmath/benchmarks/ViktorBenchmark.kt | 7 +++---- .../kotlin/kscience/kmath/benchmarks/ViktorLogBenchmark.kt | 5 ++--- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/LinearAlgebraBenchmark.kt b/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/LinearAlgebraBenchmark.kt index b54cff926..2ebfee2e7 100644 --- a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/LinearAlgebraBenchmark.kt +++ b/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/LinearAlgebraBenchmark.kt @@ -10,7 +10,6 @@ import kscience.kmath.linear.Matrix import kscience.kmath.linear.MatrixContext import kscience.kmath.linear.inverseWithLup import kscience.kmath.linear.real -import kscience.kmath.operations.invoke import org.openjdk.jmh.annotations.Scope import org.openjdk.jmh.annotations.State import kotlin.random.Random @@ -34,14 +33,14 @@ internal class LinearAlgebraBenchmark { @Benchmark fun cmLUPInversion() { - CMMatrixContext { + with(CMMatrixContext) { inverse(matrix) } } @Benchmark fun ejmlInverse() { - EjmlMatrixContext { + with(EjmlMatrixContext) { inverse(matrix) } } diff --git a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/NDFieldBenchmark.kt b/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/NDFieldBenchmark.kt index 5f7559d02..caebf0497 100644 --- a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/NDFieldBenchmark.kt +++ b/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/NDFieldBenchmark.kt @@ -2,7 +2,6 @@ package kscience.kmath.benchmarks import kscience.kmath.nd.* import kscience.kmath.operations.RealField -import kscience.kmath.operations.invoke import kscience.kmath.structures.Buffer import org.openjdk.jmh.annotations.Benchmark import org.openjdk.jmh.annotations.Scope @@ -12,7 +11,7 @@ import org.openjdk.jmh.annotations.State internal class NDFieldBenchmark { @Benchmark fun autoFieldAdd() { - autoField { + with(autoField) { var res: NDStructure = one repeat(n) { res += one } } @@ -20,7 +19,7 @@ internal class NDFieldBenchmark { @Benchmark fun specializedFieldAdd() { - specializedField { + with(specializedField) { var res: NDStructure = one repeat(n) { res += 1.0 } } @@ -29,7 +28,7 @@ internal class NDFieldBenchmark { @Benchmark fun boxingFieldAdd() { - genericField { + with(genericField) { var res: NDStructure = one repeat(n) { res += 1.0 } } diff --git a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/ViktorBenchmark.kt b/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/ViktorBenchmark.kt index 5cf6c2ab8..3f08481b3 100644 --- a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/ViktorBenchmark.kt +++ b/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/ViktorBenchmark.kt @@ -2,7 +2,6 @@ package kscience.kmath.benchmarks import kscience.kmath.nd.* import kscience.kmath.operations.RealField -import kscience.kmath.operations.invoke import kscience.kmath.viktor.ViktorNDField import org.jetbrains.bio.viktor.F64Array import org.openjdk.jmh.annotations.Benchmark @@ -21,7 +20,7 @@ internal class ViktorBenchmark { @Benchmark fun automaticFieldAddition() { - autoField { + with(autoField) { var res: NDStructure = one repeat(n) { res += 1.0 } } @@ -29,7 +28,7 @@ internal class ViktorBenchmark { @Benchmark fun realFieldAddition() { - realField { + with(realField) { var res: NDStructure = one repeat(n) { res += 1.0 } } @@ -37,7 +36,7 @@ internal class ViktorBenchmark { @Benchmark fun viktorFieldAddition() { - viktorField { + with(viktorField) { var res = one repeat(n) { res += 1.0 } } diff --git a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/ViktorLogBenchmark.kt b/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/ViktorLogBenchmark.kt index 914584b8e..57f556e9e 100644 --- a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/ViktorLogBenchmark.kt +++ b/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/ViktorLogBenchmark.kt @@ -2,7 +2,6 @@ package kscience.kmath.benchmarks import kscience.kmath.nd.* import kscience.kmath.operations.RealField -import kscience.kmath.operations.invoke import kscience.kmath.viktor.ViktorNDField import org.jetbrains.bio.viktor.F64Array import org.openjdk.jmh.annotations.Benchmark @@ -22,7 +21,7 @@ internal class ViktorLogBenchmark { @Benchmark fun realFieldLog() { - realField { + with(realField) { val fortyTwo = produce { 42.0 } var res = one repeat(n) { res = ln(fortyTwo) } @@ -31,7 +30,7 @@ internal class ViktorLogBenchmark { @Benchmark fun viktorFieldLog() { - viktorField { + with(viktorField) { val fortyTwo = produce { 42.0 } var res = one repeat(n) { res = ln(fortyTwo) } From 2fdba53911633722677fe8eade648dc7cbacd242 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Thu, 11 Feb 2021 11:18:16 +0300 Subject: [PATCH 071/150] WIP histograms refactor --- kmath-histograms/build.gradle.kts | 12 +- .../kscience/kmath/histogram/Counters.kt | 47 ++++- .../kscience/kmath/histogram/Histogram.kt | 18 +- .../kscience/kmath/histogram/RealHistogram.kt | 13 +- .../histogram/MultivariateHistogramTest.kt | 4 +- .../kscience/kmath/histogram/Counters.kt | 37 ---- .../histogram/AbstractUnivariateHistogram.kt | 33 ++++ .../kscience/kmath/histogram/Counters.kt | 7 - .../kmath/histogram/UnivariateHistogram.kt | 133 ++++--------- .../histogram/UnivariateHistogramSpace.kt | 176 +++++++++++++++++- 10 files changed, 298 insertions(+), 182 deletions(-) delete mode 100644 kmath-histograms/src/jsMain/kotlin/kscience/kmath/histogram/Counters.kt create mode 100644 kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/AbstractUnivariateHistogram.kt delete mode 100644 kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/Counters.kt diff --git a/kmath-histograms/build.gradle.kts b/kmath-histograms/build.gradle.kts index 40196416e..6031b3e85 100644 --- a/kmath-histograms/build.gradle.kts +++ b/kmath-histograms/build.gradle.kts @@ -1,4 +1,10 @@ -plugins { id("ru.mipt.npm.mpp") } +plugins { + id("ru.mipt.npm.mpp") +} + +kscience { + useAtomic() +} kotlin.sourceSets { commonMain { @@ -6,8 +12,8 @@ kotlin.sourceSets { api(project(":kmath-core")) } } - commonTest{ - dependencies{ + commonTest { + dependencies { implementation(project(":kmath-for-real")) } } diff --git a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/Counters.kt b/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/Counters.kt index 7a263a9fc..a7a42873f 100644 --- a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/Counters.kt +++ b/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/Counters.kt @@ -1,20 +1,47 @@ package kscience.kmath.histogram +import kotlinx.atomicfu.atomic +import kotlinx.atomicfu.getAndUpdate +import kscience.kmath.operations.Space + /* * Common representation for atomic counters * TODO replace with atomics */ -public expect class LongCounter() { - public fun decrement() - public fun increment() - public fun reset() - public fun sum(): Long - public fun add(l: Long) +public interface Counter { + public fun add(delta: T) + public val value: T } -public expect class DoubleCounter() { - public fun reset() - public fun sum(): Double - public fun add(d: Double) +public class IntCounter : Counter { + private val innerValue = atomic(0) + + override fun add(delta: Int) { + innerValue += delta + } + + override val value: Int get() = innerValue.value } + +public class LongCounter : Counter { + private val innerValue = atomic(0L) + + override fun add(delta: Long) { + innerValue += delta + } + + override val value: Long get() = innerValue.value +} + +public class ObjectCounter(public val space: Space) : Counter { + private val innerValue = atomic(space.zero) + + override fun add(delta: T) { + innerValue.getAndUpdate { space.run { it + delta } } + } + + override val value: T get() = innerValue.value +} + + diff --git a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/Histogram.kt b/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/Histogram.kt index 370a01215..2bc40af85 100644 --- a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/Histogram.kt +++ b/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/Histogram.kt @@ -6,7 +6,7 @@ import kscience.kmath.structures.ArrayBuffer import kscience.kmath.structures.RealBuffer /** - * The bin in the histogram. The histogram is by definition always done in the real space + * The binned data element. Could be a histogram bin with a number of counts or an artificial construct */ public interface Bin : Domain { /** @@ -17,7 +17,7 @@ public interface Bin : Domain { public val center: Point } -public interface Histogram> : Iterable { +public interface Histogram> { /** * Find existing bin, corresponding to given coordinates */ @@ -27,9 +27,11 @@ public interface Histogram> : Iterable { * Dimension of the histogram */ public val dimension: Int + + public val bins: Collection } -public interface MutableHistogram> : Histogram { +public interface HistogramBuilder> : Histogram { /** * Increment appropriate bin @@ -39,16 +41,16 @@ public interface MutableHistogram> : Histogram { public fun put(point: Point): Unit = putWithWeight(point, 1.0) } -public fun MutableHistogram.put(vararg point: T): Unit = put(ArrayBuffer(point)) +public fun HistogramBuilder.put(vararg point: T): Unit = put(ArrayBuffer(point)) -public fun MutableHistogram.put(vararg point: Number): Unit = +public fun HistogramBuilder.put(vararg point: Number): Unit = put(RealBuffer(point.map { it.toDouble() }.toDoubleArray())) -public fun MutableHistogram.put(vararg point: Double): Unit = put(RealBuffer(point)) -public fun MutableHistogram.fill(sequence: Iterable>): Unit = sequence.forEach { put(it) } +public fun HistogramBuilder.put(vararg point: Double): Unit = put(RealBuffer(point)) +public fun HistogramBuilder.fill(sequence: Iterable>): Unit = sequence.forEach { put(it) } /** * Pass a sequence builder into histogram */ -public fun MutableHistogram.fill(block: suspend SequenceScope>.() -> Unit): Unit = +public fun HistogramBuilder.fill(block: suspend SequenceScope>.() -> Unit): Unit = fill(sequence(block).asIterable()) diff --git a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/RealHistogram.kt b/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/RealHistogram.kt index 21d873806..c8f9958e0 100644 --- a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/RealHistogram.kt +++ b/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/RealHistogram.kt @@ -43,7 +43,7 @@ public class RealHistogram( private val lower: Buffer, private val upper: Buffer, private val binNums: IntArray = IntArray(lower.size) { 20 }, -) : MutableHistogram> { +) : HistogramBuilder> { private val strides = DefaultStrides(IntArray(binNums.size) { binNums[it] + 2 }) private val counts: NDStructure = NDStructure.auto(strides) { LongCounter() } private val values: NDStructure = NDStructure.auto(strides) { DoubleCounter() } @@ -88,11 +88,12 @@ public class RealHistogram( return MultivariateBinDefinition(RealBufferFieldOperations, center, binSize) } - public fun getBinDefinition(point: Buffer): MultivariateBinDefinition = getBinDefinition(getIndex(point)) + public fun getBinDefinition(point: Buffer): MultivariateBinDefinition = + getBinDefinition(getIndex(point)) public override operator fun get(point: Buffer): MultivariateBin? { val index = getIndex(point) - return MultivariateBin(getBinDefinition(index), getCount(index),getValue(index)) + return MultivariateBin(getBinDefinition(index), getCount(index), getValue(index)) } // fun put(point: Point){ @@ -106,10 +107,10 @@ public class RealHistogram( values[index].add(weight) } - public override operator fun iterator(): Iterator> = - strides.indices().map { index-> + override val bins: Collection> + get() = strides.indices().map { index -> MultivariateBin(getBinDefinition(index), counts[index].sum(), values[index].sum()) - }.iterator() + }.toList() /** * NDStructure containing number of events in bins without weights diff --git a/kmath-histograms/src/commonTest/kotlin/scietifik/kmath/histogram/MultivariateHistogramTest.kt b/kmath-histograms/src/commonTest/kotlin/scietifik/kmath/histogram/MultivariateHistogramTest.kt index 87a2b3e68..ef2c1445a 100644 --- a/kmath-histograms/src/commonTest/kotlin/scietifik/kmath/histogram/MultivariateHistogramTest.kt +++ b/kmath-histograms/src/commonTest/kotlin/scietifik/kmath/histogram/MultivariateHistogramTest.kt @@ -16,7 +16,7 @@ internal class MultivariateHistogramTest { (-1.0..1.0) ) histogram.put(0.55, 0.55) - val bin = histogram.find { it.value.toInt() > 0 } ?: fail() + val bin = histogram.bins.find { it.value.toInt() > 0 } ?: fail() assertTrue { bin.contains(RealVector(0.55, 0.55)) } assertTrue { bin.contains(RealVector(0.6, 0.5)) } assertFalse { bin.contains(RealVector(-0.55, 0.55)) } @@ -40,6 +40,6 @@ internal class MultivariateHistogramTest { yield(RealVector(nextDouble(), nextDouble(), nextDouble())) } } - assertEquals(n, histogram.sumBy { it.value.toInt() }) + assertEquals(n, histogram.bins.sumBy { it.value.toInt() }) } } \ No newline at end of file diff --git a/kmath-histograms/src/jsMain/kotlin/kscience/kmath/histogram/Counters.kt b/kmath-histograms/src/jsMain/kotlin/kscience/kmath/histogram/Counters.kt deleted file mode 100644 index d0fa1f4c2..000000000 --- a/kmath-histograms/src/jsMain/kotlin/kscience/kmath/histogram/Counters.kt +++ /dev/null @@ -1,37 +0,0 @@ -package kscience.kmath.histogram - -public actual class LongCounter { - private var sum: Long = 0L - - public actual fun decrement() { - sum-- - } - - public actual fun increment() { - sum++ - } - - public actual fun reset() { - sum = 0 - } - - public actual fun sum(): Long = sum - - public actual fun add(l: Long) { - sum += l - } -} - -public actual class DoubleCounter { - private var sum: Double = 0.0 - - public actual fun reset() { - sum = 0.0 - } - - public actual fun sum(): Double = sum - - public actual fun add(d: Double) { - sum += d - } -} diff --git a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/AbstractUnivariateHistogram.kt b/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/AbstractUnivariateHistogram.kt new file mode 100644 index 000000000..efc6e92de --- /dev/null +++ b/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/AbstractUnivariateHistogram.kt @@ -0,0 +1,33 @@ +package kscience.kmath.histogram + + +/** + * Univariate histogram with log(n) bin search speed + */ +//private abstract class AbstractUnivariateHistogram{ +// +// public abstract val bins: TreeMap +// +// public open operator fun get(value: Double): B? { +// // check ceiling entry and return it if it is what needed +// val ceil = bins.ceilingEntry(value)?.value +// if (ceil != null && value in ceil) return ceil +// //check floor entry +// val floor = bins.floorEntry(value)?.value +// if (floor != null && value in floor) return floor +// //neither is valid, not found +// return null +// } + +// public override operator fun get(point: Buffer): B? = get(point[0]) +// +// public override val dimension: Int get() = 1 +// +// public override operator fun iterator(): Iterator = bins.values.iterator() +// +// public companion object { + +// } +//} + + diff --git a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/Counters.kt b/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/Counters.kt deleted file mode 100644 index efbd185ef..000000000 --- a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/Counters.kt +++ /dev/null @@ -1,7 +0,0 @@ -package kscience.kmath.histogram - -import java.util.concurrent.atomic.DoubleAdder -import java.util.concurrent.atomic.LongAdder - -public actual typealias LongCounter = LongAdder -public actual typealias DoubleCounter = DoubleAdder diff --git a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogram.kt b/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogram.kt index 10aa9f8ca..1fb5172ce 100644 --- a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogram.kt +++ b/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogram.kt @@ -6,71 +6,47 @@ import kscience.kmath.operations.SpaceElement import kscience.kmath.structures.Buffer import kscience.kmath.structures.asBuffer import kscience.kmath.structures.asSequence -import java.util.* -import kotlin.math.floor -//TODO move to common +public data class UnivariateHistogramBinDefinition( + val position: Double, + val size: Double, +) : Comparable { + override fun compareTo(other: UnivariateHistogramBinDefinition): Int = this.position.compareTo(other.position) +} -public class UnivariateBin( - public val position: Double, - public val size: Double, -) : Bin { - //internal mutation operations - internal val counter: LongCounter = LongCounter() - internal val weightCounter: DoubleCounter = DoubleCounter() +public interface UnivariateBin : Bin { + public val def: UnivariateHistogramBinDefinition - /** - * The precise number of events ignoring weighting - */ - public val count: Long get() = counter.sum() + public val position: Double get() = def.position + public val size: Double get() = def.size /** * The value of histogram including weighting */ - public override val value: Double get() = weightCounter.sum() + public override val value: Double + + /** + * Standard deviation of the bin value. Zero if not applicable + */ + public val standardDeviation: Double public override val center: Point get() = doubleArrayOf(position).asBuffer() + public override val dimension: Int get() = 1 - public operator fun contains(value: Double): Boolean = value in (position - size / 2)..(position + size / 2) public override fun contains(point: Buffer): Boolean = contains(point[0]) } -/** - * Univariate histogram with log(n) bin search speed - */ +public operator fun UnivariateBin.contains(value: Double): Boolean = + value in (position - size / 2)..(position + size / 2) + @OptIn(UnstableKMathAPI::class) -public abstract class UnivariateHistogram protected constructor( - protected val bins: TreeMap = TreeMap(), -) : Histogram, SpaceElement { - - public operator fun get(value: Double): UnivariateBin? { - // check ceiling entry and return it if it is what needed - val ceil = bins.ceilingEntry(value)?.value - if (ceil != null && value in ceil) return ceil - //check floor entry - val floor = bins.floorEntry(value)?.value - if (floor != null && value in floor) return floor - //neither is valid, not found - return null - } - +public interface UnivariateHistogram : Histogram, + SpaceElement { + public operator fun get(value: Double): UnivariateBin? public override operator fun get(point: Buffer): UnivariateBin? = get(point[0]) - public override val dimension: Int get() = 1 - - public override operator fun iterator(): Iterator = bins.values.iterator() - public companion object { - /** - * Build a histogram with a uniform binning with a start at [start] and a bin size of [binSize] - */ - public fun uniformBuilder(binSize: Double, start: Double = 0.0): UnivariateHistogramBuilder = - UnivariateHistogramSpace { value -> - val center = start + binSize * floor((value - start) / binSize + 0.5) - UnivariateBin(center, binSize) - }.builder() - /** * Build and fill a [UnivariateHistogram]. Returns a read-only histogram. */ @@ -78,35 +54,7 @@ public abstract class UnivariateHistogram protected constructor( binSize: Double, start: Double = 0.0, builder: UnivariateHistogramBuilder.() -> Unit, - ): UnivariateHistogram = uniformBuilder(binSize, start).apply(builder) - - /** - * Create a histogram with custom cell borders - */ - public fun customBuilder(borders: DoubleArray): UnivariateHistogramBuilder { - val sorted = borders.sortedArray() - - return UnivariateHistogramSpace { value -> - when { - value < sorted.first() -> UnivariateBin( - Double.NEGATIVE_INFINITY, - Double.MAX_VALUE - ) - - value > sorted.last() -> UnivariateBin( - Double.POSITIVE_INFINITY, - Double.MAX_VALUE - ) - - else -> { - val index = sorted.indices.first { value > sorted[it] } - val left = sorted[index] - val right = sorted[index + 1] - UnivariateBin((left + right) / 2, (right - left)) - } - } - }.builder() - } + ): UnivariateHistogram = UnivariateHistogramSpace.uniform(binSize, start).produce(builder) /** * Build and fill a histogram with custom borders. Returns a read-only histogram. @@ -114,41 +62,24 @@ public abstract class UnivariateHistogram protected constructor( public fun custom( borders: DoubleArray, builder: UnivariateHistogramBuilder.() -> Unit, - ): UnivariateHistogram = customBuilder(borders).apply(builder) + ): UnivariateHistogram = UnivariateHistogramSpace.custom(borders).produce(builder) + } } -public class UnivariateHistogramBuilder internal constructor( - override val context: UnivariateHistogramSpace, -) : UnivariateHistogram(), MutableHistogram { - - private fun createBin(value: Double): UnivariateBin = context.binFactory(value).also { - synchronized(this) { bins[it.position] = it } - } - +public interface UnivariateHistogramBuilder { /** * Thread safe put operation */ - public fun put(value: Double, weight: Double = 1.0) { - (get(value) ?: createBin(value)).apply { - counter.increment() - weightCounter.add(weight) - } - } - - override fun putWithWeight(point: Buffer, weight: Double) { - put(point[0], weight) - } + public fun put(value: Double, weight: Double = 1.0) + public fun putWithWeight(point: Buffer, weight: Double) /** * Put several items into a single bin */ - public fun putMany(value: Double, count: Int, weight: Double = count.toDouble()) { - (get(value) ?: createBin(value)).apply { - counter.add(count.toLong()) - weightCounter.add(weight) - } - } + public fun putMany(value: Double, count: Int, weight: Double = count.toDouble()) + + public fun build(): UnivariateHistogram } @UnstableKMathAPI diff --git a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogramSpace.kt b/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogramSpace.kt index 0deeb0a97..b18835b7b 100644 --- a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogramSpace.kt +++ b/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogramSpace.kt @@ -1,25 +1,185 @@ package kscience.kmath.histogram import kscience.kmath.operations.Space +import kscience.kmath.structures.Buffer +import java.util.* +import kotlin.math.abs +import kotlin.math.sqrt -public class UnivariateHistogramSpace(public val binFactory: (Double) -> UnivariateBin) : Space { +private fun TreeMap.getBin(value: Double): B? { + // check ceiling entry and return it if it is what needed + val ceil = ceilingEntry(value)?.value + if (ceil != null && value in ceil) return ceil + //check floor entry + val floor = floorEntry(value)?.value + if (floor != null && value in floor) return floor + //neither is valid, not found + return null +} - public fun builder(): UnivariateHistogramBuilder = UnivariateHistogramBuilder(this) - public fun produce(builder: UnivariateHistogramBuilder.() -> Unit): UnivariateHistogram = builder().apply(builder) +private class UnivariateHistogramImpl( + override val context: UnivariateHistogramSpace, + val binMap: TreeMap, +) : UnivariateHistogram { + override fun get(value: Double): UnivariateBin? = binMap.getBin(value) + override val dimension: Int get() = 1 + override val bins: Collection get() = binMap.values +} + +private class UnivariateBinCounter( + override val def: UnivariateHistogramBinDefinition, +) : UnivariateBin { + val counter: LongCounter = LongCounter() + val valueCounter: DoubleCounter = DoubleCounter() + + /** + * The precise number of events ignoring weighting + */ + val count: Long get() = counter.sum() + + override val standardDeviation: Double get() = sqrt(count.toDouble()) / count * value + + /** + * The value of histogram including weighting + */ + override val value: Double get() = valueCounter.sum() + + public fun increment(count: Long, value: Double) { + counter.add(count) + valueCounter.add(value) + } +} + +private class UnivariateBinValue( + override val def: UnivariateHistogramBinDefinition, + override val value: Double, + override val standardDeviation: Double, +) : UnivariateBin + + +public class UnivariateHistogramSpace( + public val binFactory: (Double) -> UnivariateHistogramBinDefinition, +) : Space { + + private inner class UnivariateHistogramBuilderImpl : UnivariateHistogramBuilder { + + val bins: TreeMap = TreeMap() + fun get(value: Double): UnivariateBinCounter? = bins.getBin(value) + + private fun createBin(value: Double): UnivariateBinCounter { + val binDefinition = binFactory(value) + val newBin = UnivariateBinCounter(binDefinition) + synchronized(this) { bins[binDefinition.position] = newBin } + return newBin + } + + /** + * Thread safe put operation + */ + override fun put(value: Double, weight: Double) { + (get(value) ?: createBin(value)).apply { + increment(1, weight) + } + } + + override fun putWithWeight(point: Buffer, weight: Double) { + put(point[0], weight) + } + + /** + * Put several items into a single bin + */ + override fun putMany(value: Double, count: Int, weight: Double) { + (get(value) ?: createBin(value)).apply { + increment(count.toLong(), weight) + } + } + + override fun build(): UnivariateHistogram = UnivariateHistogramImpl(this@UnivariateHistogramSpace, bins) + } + + + public fun builder(): UnivariateHistogramBuilder = UnivariateHistogramBuilderImpl() + + public fun produce(builder: UnivariateHistogramBuilder.() -> Unit): UnivariateHistogram = + UnivariateHistogramBuilderImpl().apply(builder).build() override fun add( a: UnivariateHistogram, b: UnivariateHistogram, ): UnivariateHistogram { - require(a.context == this){"Histogram $a does not belong to this context"} - require(b.context == this){"Histogram $b does not belong to this context"} - TODO() + require(a.context == this) { "Histogram $a does not belong to this context" } + require(b.context == this) { "Histogram $b does not belong to this context" } + val bins = TreeMap().apply { + (a.bins.map { it.def } union b.bins.map { it.def }).forEach { def -> + val newBin = UnivariateBinValue( + def, + value = (a[def.position]?.value ?: 0.0) + (b[def.position]?.value ?: 0.0), + standardDeviation = (a[def.position]?.standardDeviation + ?: 0.0) + (b[def.position]?.standardDeviation ?: 0.0) + ) + } + } + return UnivariateHistogramImpl(this, bins) } override fun multiply(a: UnivariateHistogram, k: Number): UnivariateHistogram { - TODO("Not yet implemented") + val bins = TreeMap().apply { + a.bins.forEach { bin -> + put(bin.position, + UnivariateBinValue( + bin.def, + value = bin.value * k.toDouble(), + standardDeviation = abs(bin.standardDeviation * k.toDouble()) + ) + ) + } + } + + return UnivariateHistogramImpl(this, bins) } - override val zero: UnivariateHistogram = produce { } + override val zero: UnivariateHistogram = produce { } + + public companion object { + /** + * Build and fill a [UnivariateHistogram]. Returns a read-only histogram. + */ + public fun uniform( + binSize: Double, + start: Double = 0.0 + ): UnivariateHistogramSpace = UnivariateHistogramSpace { value -> + val center = start + binSize * Math.floor((value - start) / binSize + 0.5) + UnivariateHistogramBinDefinition(center, binSize) + } + + /** + * Create a histogram with custom cell borders + */ + public fun custom(borders: DoubleArray): UnivariateHistogramSpace { + val sorted = borders.sortedArray() + + return UnivariateHistogramSpace { value -> + when { + value < sorted.first() -> UnivariateHistogramBinDefinition( + Double.NEGATIVE_INFINITY, + Double.MAX_VALUE + ) + + value > sorted.last() -> UnivariateHistogramBinDefinition( + Double.POSITIVE_INFINITY, + Double.MAX_VALUE + ) + + else -> { + val index = sorted.indices.first { value > sorted[it] } + val left = sorted[index] + val right = sorted[index + 1] + UnivariateHistogramBinDefinition((left + right) / 2, (right - left)) + } + } + } + } + } } \ No newline at end of file From 15b223a8013aad3c714d951d4b51c7952ceedede Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 11 Feb 2021 18:43:42 +0700 Subject: [PATCH 072/150] 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 073/150] 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 987997cc02b4e8c73033b437cfbef1adcd6f3334 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Fri, 12 Feb 2021 22:43:35 +0300 Subject: [PATCH 074/150] Histograms refactor --- CHANGELOG.md | 1 + examples/build.gradle.kts | 8 + .../kscience/kmath/ast/MstExpression.kt | 13 +- kmath-core/api/kmath-core.api | 2 +- .../kmath/domains/HyperSquareDomain.kt | 11 +- .../kotlin/kscience/kmath/nd/NDStructure.kt | 15 +- .../kscience/kmath/structures/Buffer.kt | 2 +- .../kscience/kmath/histogram/Counters.kt | 8 +- .../kscience/kmath/histogram/Histogram.kt | 21 ++- .../kmath/histogram/IndexedHistogramSpace.kt | 76 ++++++++ .../kscience/kmath/histogram/RealHistogram.kt | 166 ------------------ .../kmath/histogram/RealHistogramSpace.kt | 121 +++++++++++++ .../histogram/MultivariateHistogramTest.kt | 19 +- .../kmath/histogram/UnivariateHistogram.kt | 10 +- .../histogram/UnivariateHistogramSpace.kt | 10 +- 15 files changed, 267 insertions(+), 216 deletions(-) create mode 100644 kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/IndexedHistogramSpace.kt delete mode 100644 kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/RealHistogram.kt create mode 100644 kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/RealHistogramSpace.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 2396c6b27..f4d279362 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ - Refactor histograms. They are marked as prototype - `Complex` and related features moved to a separate module `kmath-complex` - Refactor AlgebraElement +- Add `out` projection to `Buffer` generic ### Deprecated diff --git a/examples/build.gradle.kts b/examples/build.gradle.kts index 054945eb7..5439d46dc 100644 --- a/examples/build.gradle.kts +++ b/examples/build.gradle.kts @@ -76,6 +76,14 @@ benchmark { iterationTimeUnit = "ms" // time unity for iterationTime, default is seconds include("DotBenchmark") } + + configurations.register("expressions") { + warmups = 1 // number of warmup iterations + iterations = 3 // number of iterations + iterationTime = 500 // time in seconds per iteration + iterationTimeUnit = "ms" // time unity for iterationTime, default is seconds + include("ExpressionsInterpretersBenchmark") + } } kotlin.sourceSets.all { diff --git a/kmath-ast/src/commonMain/kotlin/kscience/kmath/ast/MstExpression.kt b/kmath-ast/src/commonMain/kotlin/kscience/kmath/ast/MstExpression.kt index 03d33aa2b..8da96f770 100644 --- a/kmath-ast/src/commonMain/kotlin/kscience/kmath/ast/MstExpression.kt +++ b/kmath-ast/src/commonMain/kotlin/kscience/kmath/ast/MstExpression.kt @@ -21,8 +21,17 @@ public class MstExpression>(public val algebra: A, public null } ?: arguments.getValue(StringSymbol(value)) - override fun unaryOperationFunction(operation: String): (arg: T) -> T = algebra.unaryOperationFunction(operation) - override fun binaryOperationFunction(operation: String): (left: T, right: T) -> T = algebra.binaryOperationFunction(operation) + override fun unaryOperation(operation: String, arg: T): T = + algebra.unaryOperation(operation, arg) + + override fun binaryOperation(operation: String, left: T, right: T): T = + algebra.binaryOperation(operation, left, right) + + override fun unaryOperationFunction(operation: String): (arg: T) -> T = + algebra.unaryOperationFunction(operation) + + override fun binaryOperationFunction(operation: String): (left: T, right: T) -> T = + algebra.binaryOperationFunction(operation) @Suppress("UNCHECKED_CAST") override fun number(value: Number): T = if (algebra is NumericAlgebra<*>) diff --git a/kmath-core/api/kmath-core.api b/kmath-core/api/kmath-core.api index e58e5d45d..1bfc13c3b 100644 --- a/kmath-core/api/kmath-core.api +++ b/kmath-core/api/kmath-core.api @@ -4,7 +4,7 @@ public abstract interface class kscience/kmath/domains/Domain { } public final class kscience/kmath/domains/HyperSquareDomain : kscience/kmath/domains/RealDomain { - public synthetic fun ([D[DLkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)V public fun contains (Lkscience/kmath/structures/Buffer;)Z public fun getDimension ()I public fun getLowerBound (I)Ljava/lang/Double; diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/domains/HyperSquareDomain.kt b/kmath-core/src/commonMain/kotlin/kscience/kmath/domains/HyperSquareDomain.kt index b45cf6bf5..20f19864f 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/domains/HyperSquareDomain.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/domains/HyperSquareDomain.kt @@ -16,6 +16,7 @@ package kscience.kmath.domains import kscience.kmath.linear.Point +import kscience.kmath.structures.Buffer import kscience.kmath.structures.RealBuffer import kscience.kmath.structures.indices @@ -25,20 +26,20 @@ import kscience.kmath.structures.indices * * @author Alexander Nozik */ -public class HyperSquareDomain(private val lower: RealBuffer, private val upper: RealBuffer) : RealDomain { +public class HyperSquareDomain(private val lower: Buffer, private val upper: Buffer) : RealDomain { public override val dimension: Int get() = lower.size public override operator fun contains(point: Point): Boolean = point.indices.all { i -> point[i] in lower[i]..upper[i] } - public override fun getLowerBound(num: Int, point: Point): Double? = lower[num] + public override fun getLowerBound(num: Int, point: Point): Double = lower[num] - public override fun getLowerBound(num: Int): Double? = lower[num] + public override fun getLowerBound(num: Int): Double = lower[num] - public override fun getUpperBound(num: Int, point: Point): Double? = upper[num] + public override fun getUpperBound(num: Int, point: Point): Double = upper[num] - public override fun getUpperBound(num: Int): Double? = upper[num] + public override fun getUpperBound(num: Int): Double = upper[num] public override fun nearestInDomain(point: Point): Point { val res = DoubleArray(point.size) { i -> diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/nd/NDStructure.kt b/kmath-core/src/commonMain/kotlin/kscience/kmath/nd/NDStructure.kt index 4aa1c7d52..c3de02925 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/nd/NDStructure.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/nd/NDStructure.kt @@ -78,8 +78,7 @@ public interface NDStructure { strides: Strides, bufferFactory: BufferFactory = Buffer.Companion::boxing, initializer: (IntArray) -> T, - ): NDBuffer = - NDBuffer(strides, bufferFactory(strides.linearSize) { i -> initializer(strides.index(i)) }) + ): NDBuffer = NDBuffer(strides, bufferFactory(strides.linearSize) { i -> initializer(strides.index(i)) }) /** * Inline create NDStructure with non-boxing buffer implementation if it is possible @@ -87,15 +86,13 @@ public interface NDStructure { public inline fun auto( strides: Strides, crossinline initializer: (IntArray) -> T, - ): NDBuffer = - NDBuffer(strides, Buffer.auto(strides.linearSize) { i -> initializer(strides.index(i)) }) + ): NDBuffer = NDBuffer(strides, Buffer.auto(strides.linearSize) { i -> initializer(strides.index(i)) }) public inline fun auto( type: KClass, strides: Strides, crossinline initializer: (IntArray) -> T, - ): NDBuffer = - NDBuffer(strides, Buffer.auto(type, strides.linearSize) { i -> initializer(strides.index(i)) }) + ): NDBuffer = NDBuffer(strides, Buffer.auto(type, strides.linearSize) { i -> initializer(strides.index(i)) }) public fun build( shape: IntArray, @@ -106,8 +103,7 @@ public interface NDStructure { public inline fun auto( shape: IntArray, crossinline initializer: (IntArray) -> T, - ): NDBuffer = - auto(DefaultStrides(shape), initializer) + ): NDBuffer = auto(DefaultStrides(shape), initializer) @JvmName("autoVarArg") public inline fun auto( @@ -120,8 +116,7 @@ public interface NDStructure { type: KClass, vararg shape: Int, crossinline initializer: (IntArray) -> T, - ): NDBuffer = - auto(type, DefaultStrides(shape), initializer) + ): NDBuffer = auto(type, DefaultStrides(shape), initializer) } } diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/Buffer.kt b/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/Buffer.kt index be48055c7..d214eeba1 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/Buffer.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/Buffer.kt @@ -21,7 +21,7 @@ public typealias MutableBufferFactory = (Int, (Int) -> T) -> MutableBuffer * * @param T the type of elements contained in the buffer. */ -public interface Buffer { +public interface Buffer { /** * The size of this buffer. */ diff --git a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/Counters.kt b/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/Counters.kt index a7a42873f..bdc03cc1d 100644 --- a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/Counters.kt +++ b/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/Counters.kt @@ -2,16 +2,18 @@ package kscience.kmath.histogram import kotlinx.atomicfu.atomic import kotlinx.atomicfu.getAndUpdate +import kscience.kmath.operations.RealField import kscience.kmath.operations.Space -/* +/** * Common representation for atomic counters - * TODO replace with atomics */ - public interface Counter { public fun add(delta: T) public val value: T + public companion object{ + public fun real(): ObjectCounter = ObjectCounter(RealField) + } } public class IntCounter : Counter { diff --git a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/Histogram.kt b/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/Histogram.kt index 2bc40af85..91032fc31 100644 --- a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/Histogram.kt +++ b/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/Histogram.kt @@ -13,8 +13,6 @@ public interface Bin : Domain { * The value of this bin. */ public val value: Number - - public val center: Point } public interface Histogram> { @@ -28,29 +26,30 @@ public interface Histogram> { */ public val dimension: Int - public val bins: Collection + public val bins: Iterable } -public interface HistogramBuilder> : Histogram { +public fun interface HistogramBuilder { /** * Increment appropriate bin */ - public fun putWithWeight(point: Point, weight: Double) + public fun putValue(point: Point, value: Number) - public fun put(point: Point): Unit = putWithWeight(point, 1.0) } -public fun HistogramBuilder.put(vararg point: T): Unit = put(ArrayBuffer(point)) +public fun > HistogramBuilder.put(point: Point): Unit = putValue(point, 1.0) -public fun HistogramBuilder.put(vararg point: Number): Unit = +public fun HistogramBuilder.put(vararg point: T): Unit = put(ArrayBuffer(point)) + +public fun HistogramBuilder.put(vararg point: Number): Unit = put(RealBuffer(point.map { it.toDouble() }.toDoubleArray())) -public fun HistogramBuilder.put(vararg point: Double): Unit = put(RealBuffer(point)) -public fun HistogramBuilder.fill(sequence: Iterable>): Unit = sequence.forEach { put(it) } +public fun HistogramBuilder.put(vararg point: Double): Unit = put(RealBuffer(point)) +public fun HistogramBuilder.fill(sequence: Iterable>): Unit = sequence.forEach { put(it) } /** * Pass a sequence builder into histogram */ -public fun HistogramBuilder.fill(block: suspend SequenceScope>.() -> Unit): Unit = +public fun HistogramBuilder.fill(block: suspend SequenceScope>.() -> Unit): Unit = fill(sequence(block).asIterable()) diff --git a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/IndexedHistogramSpace.kt b/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/IndexedHistogramSpace.kt new file mode 100644 index 000000000..53761452f --- /dev/null +++ b/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/IndexedHistogramSpace.kt @@ -0,0 +1,76 @@ +package kscience.kmath.histogram + +import kscience.kmath.domains.Domain +import kscience.kmath.linear.Point +import kscience.kmath.misc.UnstableKMathAPI +import kscience.kmath.nd.NDSpace +import kscience.kmath.nd.NDStructure +import kscience.kmath.nd.Strides +import kscience.kmath.operations.Space +import kscience.kmath.operations.SpaceElement +import kscience.kmath.operations.invoke + +/** + * A simple histogram bin based on domain + */ +public data class DomainBin>( + public val domain: Domain, + public override val value: Number, +) : Bin, Domain by domain + +@OptIn(UnstableKMathAPI::class) +public class IndexedHistogram, V : Any>( + override val context: IndexedHistogramSpace, + public val values: NDStructure, +) : Histogram>, SpaceElement, IndexedHistogramSpace> { + + override fun get(point: Point): Bin? { + val index = context.getIndex(point) ?: return null + return context.produceBin(index, values[index]) + } + + override val dimension: Int get() = context.strides.shape.size + + override val bins: Iterable> + get() = context.strides.indices().map { + context.produceBin(it, values[it]) + }.asIterable() + +} + +/** + * A space for producing histograms with values in a NDStructure + */ +public interface IndexedHistogramSpace, V : Any> : Space> { + //public val valueSpace: Space + public val strides: Strides + public val histogramValueSpace: NDSpace //= NDAlgebra.space(valueSpace, Buffer.Companion::boxing, *shape), + + /** + * Resolve index of the bin including given [point] + */ + public fun getIndex(point: Point): IntArray? + + /** + * Get a bin domain represented by given index + */ + public fun getDomain(index: IntArray): Domain? + + public fun produceBin(index: IntArray, value: V): Bin + + public fun produce(builder: HistogramBuilder.() -> Unit): IndexedHistogram + + override fun add(a: IndexedHistogram, b: IndexedHistogram): IndexedHistogram { + require(a.context == this) { "Can't operate on a histogram produced by external space" } + require(b.context == this) { "Can't operate on a histogram produced by external space" } + return IndexedHistogram(this, histogramValueSpace.invoke { a.values + b.values }) + } + + override fun multiply(a: IndexedHistogram, k: Number): IndexedHistogram { + require(a.context == this) { "Can't operate on a histogram produced by external space" } + return IndexedHistogram(this, histogramValueSpace.invoke { a.values * k }) + } + + override val zero: IndexedHistogram get() = produce { } +} + diff --git a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/RealHistogram.kt b/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/RealHistogram.kt deleted file mode 100644 index c8f9958e0..000000000 --- a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/RealHistogram.kt +++ /dev/null @@ -1,166 +0,0 @@ -package kscience.kmath.histogram - -import kscience.kmath.linear.Point -import kscience.kmath.nd.DefaultStrides -import kscience.kmath.nd.NDStructure -import kscience.kmath.operations.SpaceOperations -import kscience.kmath.operations.invoke -import kscience.kmath.structures.* -import kotlin.math.floor - -public data class MultivariateBinDefinition>( - public val space: SpaceOperations>, - public val center: Point, - public val sizes: Point, -) { - public fun contains(vector: Point): Boolean { - require(vector.size == center.size) { "Dimension mismatch for input vector. Expected ${center.size}, but found ${vector.size}" } - val upper = space { center + sizes / 2.0 } - val lower = space { center - sizes / 2.0 } - return vector.asSequence().mapIndexed { i, value -> value in lower[i]..upper[i] }.all { it } - } -} - - -public class MultivariateBin>( - public val definition: MultivariateBinDefinition, - public val count: Long, - public override val value: Double, -) : Bin { - public override val dimension: Int - get() = definition.center.size - - public override val center: Point - get() = definition.center - - public override operator fun contains(point: Point): Boolean = definition.contains(point) -} - -/** - * Uniform multivariate histogram with fixed borders. Based on NDStructure implementation with complexity of m for bin search, where m is the number of dimensions. - */ -public class RealHistogram( - private val lower: Buffer, - private val upper: Buffer, - private val binNums: IntArray = IntArray(lower.size) { 20 }, -) : HistogramBuilder> { - private val strides = DefaultStrides(IntArray(binNums.size) { binNums[it] + 2 }) - private val counts: NDStructure = NDStructure.auto(strides) { LongCounter() } - private val values: NDStructure = NDStructure.auto(strides) { DoubleCounter() } - public override val dimension: Int get() = lower.size - private val binSize = RealBuffer(dimension) { (upper[it] - lower[it]) / binNums[it] } - - init { - // argument checks - require(lower.size == upper.size) { "Dimension mismatch in histogram lower and upper limits." } - require(lower.size == binNums.size) { "Dimension mismatch in bin count." } - require(!(0 until dimension).any { upper[it] - lower[it] < 0 }) { "Range for one of axis is not strictly positive" } - } - - /** - * Get internal [NDStructure] bin index for given axis - */ - private fun getIndex(axis: Int, value: Double): Int = when { - value >= upper[axis] -> binNums[axis] + 1 // overflow - value < lower[axis] -> 0 // underflow - else -> floor((value - lower[axis]) / binSize[axis]).toInt() + 1 - } - - private fun getIndex(point: Buffer): IntArray = IntArray(dimension) { getIndex(it, point[it]) } - - private fun getCount(index: IntArray): Long = counts[index].sum() - - public fun getCount(point: Buffer): Long = getCount(getIndex(point)) - - private fun getValue(index: IntArray): Double = values[index].sum() - - public fun getValue(point: Buffer): Double = getValue(getIndex(point)) - - private fun getBinDefinition(index: IntArray): MultivariateBinDefinition { - val center = index.mapIndexed { axis, i -> - when (i) { - 0 -> Double.NEGATIVE_INFINITY - strides.shape[axis] - 1 -> Double.POSITIVE_INFINITY - else -> lower[axis] + (i.toDouble() - 0.5) * binSize[axis] - } - }.asBuffer() - - return MultivariateBinDefinition(RealBufferFieldOperations, center, binSize) - } - - public fun getBinDefinition(point: Buffer): MultivariateBinDefinition = - getBinDefinition(getIndex(point)) - - public override operator fun get(point: Buffer): MultivariateBin? { - val index = getIndex(point) - return MultivariateBin(getBinDefinition(index), getCount(index), getValue(index)) - } - -// fun put(point: Point){ -// val index = getIndex(point) -// values[index].increment() -// } - - public override fun putWithWeight(point: Buffer, weight: Double) { - val index = getIndex(point) - counts[index].increment() - values[index].add(weight) - } - - override val bins: Collection> - get() = strides.indices().map { index -> - MultivariateBin(getBinDefinition(index), counts[index].sum(), values[index].sum()) - }.toList() - - /** - * NDStructure containing number of events in bins without weights - */ - public fun counts(): NDStructure = NDStructure.auto(counts.shape) { counts[it].sum() } - - /** - * NDStructure containing values of bins including weights - */ - public fun values(): NDStructure = NDStructure.auto(values.shape) { values[it].sum() } - - public companion object { - /** - * Use it like - * ``` - *FastHistogram.fromRanges( - * (-1.0..1.0), - * (-1.0..1.0) - *) - *``` - */ - public fun fromRanges(vararg ranges: ClosedFloatingPointRange): RealHistogram = RealHistogram( - ranges.map(ClosedFloatingPointRange::start).asBuffer(), - ranges.map(ClosedFloatingPointRange::endInclusive).asBuffer() - ) - - /** - * Use it like - * ``` - *FastHistogram.fromRanges( - * (-1.0..1.0) to 50, - * (-1.0..1.0) to 32 - *) - *``` - */ - public fun fromRanges(vararg ranges: Pair, Int>): RealHistogram = - RealHistogram( - ListBuffer( - ranges - .map(Pair, Int>::first) - .map(ClosedFloatingPointRange::start) - ), - - ListBuffer( - ranges - .map(Pair, Int>::first) - .map(ClosedFloatingPointRange::endInclusive) - ), - - ranges.map(Pair, Int>::second).toIntArray() - ) - } -} diff --git a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/RealHistogramSpace.kt b/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/RealHistogramSpace.kt new file mode 100644 index 000000000..ef2d9771b --- /dev/null +++ b/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/RealHistogramSpace.kt @@ -0,0 +1,121 @@ +package kscience.kmath.histogram + +import kscience.kmath.domains.Domain +import kscience.kmath.domains.HyperSquareDomain +import kscience.kmath.nd.* +import kscience.kmath.structures.* +import kotlin.math.floor + +public class RealHistogramSpace( + private val lower: Buffer, + private val upper: Buffer, + private val binNums: IntArray = IntArray(lower.size) { 20 }, +) : IndexedHistogramSpace { + + init { + // argument checks + require(lower.size == upper.size) { "Dimension mismatch in histogram lower and upper limits." } + require(lower.size == binNums.size) { "Dimension mismatch in bin count." } + require(!lower.indices.any { upper[it] - lower[it] < 0 }) { "Range for one of axis is not strictly positive" } + } + + public val dimension: Int get() = lower.size + + private val shape = IntArray(binNums.size) { binNums[it] + 2 } + override val histogramValueSpace: RealNDField = NDAlgebra.real(*shape) + + override val strides: Strides get() = histogramValueSpace.strides + private val binSize = RealBuffer(dimension) { (upper[it] - lower[it]) / binNums[it] } + + /** + * Get internal [NDStructure] bin index for given axis + */ + private fun getIndex(axis: Int, value: Double): Int = when { + value >= upper[axis] -> binNums[axis] + 1 // overflow + value < lower[axis] -> 0 // underflow + else -> floor((value - lower[axis]) / binSize[axis]).toInt() + } + + override fun getIndex(point: Buffer): IntArray = IntArray(dimension) { + getIndex(it, point[it]) + } + + override fun getDomain(index: IntArray): Domain { + val lowerBoundary = index.mapIndexed { axis, i -> + when (i) { + 0 -> Double.NEGATIVE_INFINITY + strides.shape[axis] - 1 -> upper[axis] + else -> lower[axis] + (i.toDouble()) * binSize[axis] + } + }.asBuffer() + + val upperBoundary = index.mapIndexed { axis, i -> + when (i) { + 0 -> lower[axis] + strides.shape[axis] - 1 -> Double.POSITIVE_INFINITY + else -> lower[axis] + (i.toDouble() + 1) * binSize[axis] + } + }.asBuffer() + + return HyperSquareDomain(lowerBoundary, upperBoundary) + } + + + override fun produceBin(index: IntArray, value: Double): Bin { + val domain = getDomain(index) + return DomainBin(domain, value) + } + + override fun produce(builder: HistogramBuilder.() -> Unit): IndexedHistogram { + val ndCounter = NDStructure.auto(strides) { Counter.real() } + val hBuilder = HistogramBuilder { point, value -> + val index = getIndex(point) + ndCounter[index].add(1.0) + } + hBuilder.apply(builder) + val values: NDBuffer = ndCounter.mapToBuffer { it.value } + return IndexedHistogram(this, values) + } + + public companion object{ + /** + * Use it like + * ``` + *FastHistogram.fromRanges( + * (-1.0..1.0), + * (-1.0..1.0) + *) + *``` + */ + public fun fromRanges(vararg ranges: ClosedFloatingPointRange): RealHistogramSpace = RealHistogramSpace( + ranges.map(ClosedFloatingPointRange::start).asBuffer(), + ranges.map(ClosedFloatingPointRange::endInclusive).asBuffer() + ) + + /** + * Use it like + * ``` + *FastHistogram.fromRanges( + * (-1.0..1.0) to 50, + * (-1.0..1.0) to 32 + *) + *``` + */ + public fun fromRanges(vararg ranges: Pair, Int>): RealHistogramSpace = + RealHistogramSpace( + ListBuffer( + ranges + .map(Pair, Int>::first) + .map(ClosedFloatingPointRange::start) + ), + + ListBuffer( + ranges + .map(Pair, Int>::first) + .map(ClosedFloatingPointRange::endInclusive) + ), + + ranges.map(Pair, Int>::second).toIntArray() + ) + } +} \ No newline at end of file diff --git a/kmath-histograms/src/commonTest/kotlin/scietifik/kmath/histogram/MultivariateHistogramTest.kt b/kmath-histograms/src/commonTest/kotlin/scietifik/kmath/histogram/MultivariateHistogramTest.kt index ef2c1445a..860b047ae 100644 --- a/kmath-histograms/src/commonTest/kotlin/scietifik/kmath/histogram/MultivariateHistogramTest.kt +++ b/kmath-histograms/src/commonTest/kotlin/scietifik/kmath/histogram/MultivariateHistogramTest.kt @@ -1,6 +1,6 @@ package scietifik.kmath.histogram -import kscience.kmath.histogram.RealHistogram +import kscience.kmath.histogram.RealHistogramSpace import kscience.kmath.histogram.fill import kscience.kmath.histogram.put import kscience.kmath.real.RealVector @@ -11,11 +11,13 @@ import kotlin.test.* internal class MultivariateHistogramTest { @Test fun testSinglePutHistogram() { - val histogram = RealHistogram.fromRanges( + val hSpace = RealHistogramSpace.fromRanges( (-1.0..1.0), (-1.0..1.0) ) - histogram.put(0.55, 0.55) + val histogram = hSpace.produce { + put(0.55, 0.55) + } val bin = histogram.bins.find { it.value.toInt() > 0 } ?: fail() assertTrue { bin.contains(RealVector(0.55, 0.55)) } assertTrue { bin.contains(RealVector(0.6, 0.5)) } @@ -24,7 +26,7 @@ internal class MultivariateHistogramTest { @Test fun testSequentialPut() { - val histogram = RealHistogram.fromRanges( + val hSpace = RealHistogramSpace.fromRanges( (-1.0..1.0), (-1.0..1.0), (-1.0..1.0) @@ -34,10 +36,11 @@ internal class MultivariateHistogramTest { fun nextDouble() = random.nextDouble(-1.0, 1.0) val n = 10000 - - histogram.fill { - repeat(n) { - yield(RealVector(nextDouble(), nextDouble(), nextDouble())) + val histogram = hSpace.produce { + fill { + repeat(n) { + yield(RealVector(nextDouble(), nextDouble(), nextDouble())) + } } } assertEquals(n, histogram.bins.sumBy { it.value.toInt() }) diff --git a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogram.kt b/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogram.kt index 1fb5172ce..7d8f874a2 100644 --- a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogram.kt +++ b/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogram.kt @@ -30,7 +30,7 @@ public interface UnivariateBin : Bin { */ public val standardDeviation: Double - public override val center: Point get() = doubleArrayOf(position).asBuffer() + public val center: Point get() = doubleArrayOf(position).asBuffer() public override val dimension: Int get() = 1 @@ -44,7 +44,7 @@ public operator fun UnivariateBin.contains(value: Double): Boolean = public interface UnivariateHistogram : Histogram, SpaceElement { public operator fun get(value: Double): UnivariateBin? - public override operator fun get(point: Buffer): UnivariateBin? = get(point[0]) + public override operator fun get(point: Buffer): UnivariateBin? = get(point[0]) public companion object { /** @@ -67,12 +67,14 @@ public interface UnivariateHistogram : Histogram, } } -public interface UnivariateHistogramBuilder { +public interface UnivariateHistogramBuilder: HistogramBuilder { + /** * Thread safe put operation */ public fun put(value: Double, weight: Double = 1.0) - public fun putWithWeight(point: Buffer, weight: Double) + + override fun putValue(point: Buffer, value: Number) /** * Put several items into a single bin diff --git a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogramSpace.kt b/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogramSpace.kt index b18835b7b..3d1bd20c0 100644 --- a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogramSpace.kt +++ b/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogramSpace.kt @@ -31,19 +31,19 @@ private class UnivariateBinCounter( override val def: UnivariateHistogramBinDefinition, ) : UnivariateBin { val counter: LongCounter = LongCounter() - val valueCounter: DoubleCounter = DoubleCounter() + val valueCounter: ObjectCounter = Counter.real() /** * The precise number of events ignoring weighting */ - val count: Long get() = counter.sum() + val count: Long get() = counter.value override val standardDeviation: Double get() = sqrt(count.toDouble()) / count * value /** * The value of histogram including weighting */ - override val value: Double get() = valueCounter.sum() + override val value: Double get() = valueCounter.value public fun increment(count: Long, value: Double) { counter.add(count) @@ -83,8 +83,8 @@ public class UnivariateHistogramSpace( } } - override fun putWithWeight(point: Buffer, weight: Double) { - put(point[0], weight) + override fun putValue(point: Buffer, value: Number) { + put(point[0], value.toDouble()) } /** From acfff40d965634c19d42462295daa1f778e8c89f Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sat, 13 Feb 2021 21:05:01 +0700 Subject: [PATCH 075/150] Fix my mistakes in descriptions of core algebraic structures --- .../kscience/kmath/operations/Algebra.kt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt b/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt index f3a87d644..14006ea10 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt @@ -95,8 +95,8 @@ public interface Algebra { public inline operator fun , R> A.invoke(block: A.() -> R): R = run(block) /** - * Represents "semispace", i.e. algebraic structure with associative binary operation called "addition" as well as - * multiplication by scalars. + * Represents linear space without neutral element, i.e. algebraic structure with associative, binary operation [add] + * and scalar multiplication [multiply]. * * @param T the type of element of this semispace. */ @@ -208,10 +208,10 @@ public interface SpaceOperations : Algebra { } /** - * Represents linear space, i.e. algebraic structure with associative binary operation called "addition" and its neutral - * element as well as multiplication by scalars. + * Represents linear space with neutral element, i.e. algebraic structure with associative, binary operation [add] and + * scalar multiplication [multiply]. * - * @param T the type of element of this group. + * @param T the type of element of this semispace. */ public interface Space : SpaceOperations { /** @@ -221,8 +221,8 @@ public interface Space : SpaceOperations { } /** - * Represents semiring, i.e. algebraic structure with two associative binary operations called "addition" and - * "multiplication". + * Represents rng, i.e. algebraic structure with associative, binary, commutative operation [add] and associative, + * operation [multiply] distributive over [add]. * * @param T the type of element of this semiring. */ @@ -270,8 +270,8 @@ public interface Ring : Space, RingOperations { } /** - * Represents semifield, i.e. algebraic structure with three operations: associative "addition" and "multiplication", - * and "division". + * Represents field without identity elements, i.e. algebraic structure with associative, binary, commutative operations + * [add] and [multiply]; binary operation [divide] as multiplication of left operand by reciprocal of right one. * * @param T the type of element of this semifield. */ From ce18e85a0afebc1ab105a7e02129897e0595d0e0 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 14 Feb 2021 22:44:05 +0300 Subject: [PATCH 076/150] Histograms refactor --- .../kmath/histogram/RealHistogramSpace.kt | 2 +- .../histogram/MultivariateHistogramTest.kt | 42 +++- .../histogram/AbstractUnivariateHistogram.kt | 33 ---- .../kmath/histogram/TreeHistogramSpace.kt | 156 +++++++++++++++ .../kmath/histogram/UnivariateHistogram.kt | 52 ++--- .../histogram/UnivariateHistogramSpace.kt | 185 ------------------ 6 files changed, 211 insertions(+), 259 deletions(-) delete mode 100644 kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/AbstractUnivariateHistogram.kt create mode 100644 kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/TreeHistogramSpace.kt delete mode 100644 kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogramSpace.kt diff --git a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/RealHistogramSpace.kt b/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/RealHistogramSpace.kt index ef2d9771b..c9beb3a73 100644 --- a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/RealHistogramSpace.kt +++ b/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/RealHistogramSpace.kt @@ -77,7 +77,7 @@ public class RealHistogramSpace( return IndexedHistogram(this, values) } - public companion object{ + public companion object { /** * Use it like * ``` diff --git a/kmath-histograms/src/commonTest/kotlin/scietifik/kmath/histogram/MultivariateHistogramTest.kt b/kmath-histograms/src/commonTest/kotlin/scietifik/kmath/histogram/MultivariateHistogramTest.kt index 860b047ae..44b9410d2 100644 --- a/kmath-histograms/src/commonTest/kotlin/scietifik/kmath/histogram/MultivariateHistogramTest.kt +++ b/kmath-histograms/src/commonTest/kotlin/scietifik/kmath/histogram/MultivariateHistogramTest.kt @@ -1,8 +1,8 @@ package scietifik.kmath.histogram import kscience.kmath.histogram.RealHistogramSpace -import kscience.kmath.histogram.fill import kscience.kmath.histogram.put +import kscience.kmath.operations.invoke import kscience.kmath.real.RealVector import kscience.kmath.real.invoke import kotlin.random.Random @@ -37,12 +37,44 @@ internal class MultivariateHistogramTest { val n = 10000 val histogram = hSpace.produce { - fill { - repeat(n) { - yield(RealVector(nextDouble(), nextDouble(), nextDouble())) - } + repeat(n) { + put(nextDouble(), nextDouble(), nextDouble()) } } assertEquals(n, histogram.bins.sumBy { it.value.toInt() }) } + + @Test + fun testHistogramAlgebra() { + val hSpace = RealHistogramSpace.fromRanges( + (-1.0..1.0), + (-1.0..1.0), + (-1.0..1.0) + ).invoke { + val random = Random(1234) + + fun nextDouble() = random.nextDouble(-1.0, 1.0) + val n = 10000 + val histogram1 = produce { + repeat(n) { + put(nextDouble(), nextDouble(), nextDouble()) + } + } + val histogram2 = produce { + repeat(n) { + put(nextDouble(), nextDouble(), nextDouble()) + } + } + val res = histogram1 - histogram2 + assertTrue { + strides.indices().all { index -> + res.values[index] <= histogram1.values[index] + } + } + assertTrue { + res.bins.count() >= histogram1.bins.count() + } + assertEquals(0.0, res.bins.sumByDouble { it.value.toDouble() }) + } + } } \ No newline at end of file diff --git a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/AbstractUnivariateHistogram.kt b/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/AbstractUnivariateHistogram.kt deleted file mode 100644 index efc6e92de..000000000 --- a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/AbstractUnivariateHistogram.kt +++ /dev/null @@ -1,33 +0,0 @@ -package kscience.kmath.histogram - - -/** - * Univariate histogram with log(n) bin search speed - */ -//private abstract class AbstractUnivariateHistogram{ -// -// public abstract val bins: TreeMap -// -// public open operator fun get(value: Double): B? { -// // check ceiling entry and return it if it is what needed -// val ceil = bins.ceilingEntry(value)?.value -// if (ceil != null && value in ceil) return ceil -// //check floor entry -// val floor = bins.floorEntry(value)?.value -// if (floor != null && value in floor) return floor -// //neither is valid, not found -// return null -// } - -// public override operator fun get(point: Buffer): B? = get(point[0]) -// -// public override val dimension: Int get() = 1 -// -// public override operator fun iterator(): Iterator = bins.values.iterator() -// -// public companion object { - -// } -//} - - diff --git a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/TreeHistogramSpace.kt b/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/TreeHistogramSpace.kt new file mode 100644 index 000000000..b5872c601 --- /dev/null +++ b/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/TreeHistogramSpace.kt @@ -0,0 +1,156 @@ +package kscience.kmath.histogram + +import kscience.kmath.domains.UnivariateDomain +import kscience.kmath.misc.UnstableKMathAPI +import kscience.kmath.operations.Space +import kscience.kmath.structures.Buffer +import java.util.* +import kotlin.math.abs +import kotlin.math.sqrt + +internal fun > TreeMap.getBin(value: Double): B? { + // check ceiling entry and return it if it is what needed + val ceil = ceilingEntry(value)?.value + if (ceil != null && value in ceil) return ceil + //check floor entry + val floor = floorEntry(value)?.value + if (floor != null && value in floor) return floor + //neither is valid, not found + return null +} + +@UnstableKMathAPI +public class TreeHistogram( + override val context: TreeHistogramSpace, + private val binMap: TreeMap, +) : UnivariateHistogram { + override fun get(value: Double): UnivariateBin? = binMap.getBin(value) + override val dimension: Int get() = 1 + override val bins: Collection get() = binMap.values +} + +private class UnivariateBinValue( + override val domain: UnivariateDomain, + override val value: Double, + override val standardDeviation: Double, +) : UnivariateBin, ClosedFloatingPointRange by domain.range + +@UnstableKMathAPI +public class TreeHistogramSpace( + public val binFactory: (Double) -> UnivariateDomain, +) : Space { + + private class BinCounter(val domain: UnivariateDomain, val counter: Counter = Counter.real()) : + ClosedFloatingPointRange by domain.range + + public fun produce(builder: UnivariateHistogramBuilder.() -> Unit): UnivariateHistogram { + val bins: TreeMap = TreeMap() + val hBuilder = object : UnivariateHistogramBuilder { + + fun get(value: Double): BinCounter? = bins.getBin(value) + + fun createBin(value: Double): BinCounter { + val binDefinition = binFactory(value) + val newBin = BinCounter(binDefinition) + synchronized(this) { bins[binDefinition.center] = newBin } + return newBin + } + + /** + * Thread safe put operation + */ + override fun putValue(at: Double, value: Double) { + (get(at) ?: createBin(at)).apply { + counter.add(value) + } + } + + override fun putValue(point: Buffer, value: Number) { + put(point[0], value.toDouble()) + } + } + hBuilder.apply(builder) + val resBins = TreeMap() + bins.forEach { key, binCounter -> + val count = binCounter.counter.value + resBins[key] = UnivariateBinValue(binCounter.domain, count, sqrt(count)) + } + return TreeHistogram(this, resBins) + } + + override fun add( + a: UnivariateHistogram, + b: UnivariateHistogram, + ): UnivariateHistogram { + require(a.context == this) { "Histogram $a does not belong to this context" } + require(b.context == this) { "Histogram $b does not belong to this context" } + val bins = TreeMap().apply { + (a.bins.map { it.domain } union b.bins.map { it.domain }).forEach { def -> + val newBin = UnivariateBinValue( + def, + value = (a[def.center]?.value ?: 0.0) + (b[def.center]?.value ?: 0.0), + standardDeviation = (a[def.center]?.standardDeviation + ?: 0.0) + (b[def.center]?.standardDeviation ?: 0.0) + ) + } + } + return TreeHistogram(this, bins) + } + + override fun multiply(a: UnivariateHistogram, k: Number): UnivariateHistogram { + val bins = TreeMap().apply { + a.bins.forEach { bin -> + put(bin.domain.center, + UnivariateBinValue( + bin.domain, + value = bin.value * k.toDouble(), + standardDeviation = abs(bin.standardDeviation * k.toDouble()) + ) + ) + } + } + + return TreeHistogram(this, bins) + } + + override val zero: UnivariateHistogram = produce { } + + public companion object { + /** + * Build and fill a [UnivariateHistogram]. Returns a read-only histogram. + */ + public fun uniform( + binSize: Double, + start: Double = 0.0, + ): TreeHistogramSpace = TreeHistogramSpace { value -> + val center = start + binSize * Math.floor((value - start) / binSize + 0.5) + UnivariateDomain((center - binSize / 2)..(center + binSize / 2)) + } + + /** + * Create a histogram with custom cell borders + */ + public fun custom(borders: DoubleArray): TreeHistogramSpace { + val sorted = borders.sortedArray() + + return TreeHistogramSpace { value -> + when { + value < sorted.first() -> UnivariateDomain( + Double.NEGATIVE_INFINITY..sorted.first() + ) + + value > sorted.last() -> UnivariateDomain( + sorted.last()..Double.POSITIVE_INFINITY + ) + + else -> { + val index = sorted.indices.first { value > sorted[it] } + val left = sorted[index] + val right = sorted[index + 1] + UnivariateDomain(left..right) + } + } + } + } + } +} \ No newline at end of file diff --git a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogram.kt b/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogram.kt index 7d8f874a2..87c56cf79 100644 --- a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogram.kt +++ b/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogram.kt @@ -1,24 +1,17 @@ package kscience.kmath.histogram -import kscience.kmath.linear.Point +import kscience.kmath.domains.UnivariateDomain import kscience.kmath.misc.UnstableKMathAPI +import kscience.kmath.operations.Space import kscience.kmath.operations.SpaceElement import kscience.kmath.structures.Buffer -import kscience.kmath.structures.asBuffer import kscience.kmath.structures.asSequence -public data class UnivariateHistogramBinDefinition( - val position: Double, - val size: Double, -) : Comparable { - override fun compareTo(other: UnivariateHistogramBinDefinition): Int = this.position.compareTo(other.position) -} -public interface UnivariateBin : Bin { - public val def: UnivariateHistogramBinDefinition +public val UnivariateDomain.center: Double get() = (range.endInclusive - range.start) / 2 - public val position: Double get() = def.position - public val size: Double get() = def.size +public interface UnivariateBin : Bin, ClosedFloatingPointRange { + public val domain: UnivariateDomain /** * The value of histogram including weighting @@ -30,19 +23,15 @@ public interface UnivariateBin : Bin { */ public val standardDeviation: Double - public val center: Point get() = doubleArrayOf(position).asBuffer() - public override val dimension: Int get() = 1 - public override fun contains(point: Buffer): Boolean = contains(point[0]) + public override fun contains(point: Buffer): Boolean = point.size == 1 && contains(point[0]) + } -public operator fun UnivariateBin.contains(value: Double): Boolean = - value in (position - size / 2)..(position + size / 2) - -@OptIn(UnstableKMathAPI::class) +@UnstableKMathAPI public interface UnivariateHistogram : Histogram, - SpaceElement { + SpaceElement> { public operator fun get(value: Double): UnivariateBin? public override operator fun get(point: Buffer): UnivariateBin? = get(point[0]) @@ -54,7 +43,7 @@ public interface UnivariateHistogram : Histogram, binSize: Double, start: Double = 0.0, builder: UnivariateHistogramBuilder.() -> Unit, - ): UnivariateHistogram = UnivariateHistogramSpace.uniform(binSize, start).produce(builder) + ): UnivariateHistogram = TreeHistogramSpace.uniform(binSize, start).produce(builder) /** * Build and fill a histogram with custom borders. Returns a read-only histogram. @@ -62,33 +51,26 @@ public interface UnivariateHistogram : Histogram, public fun custom( borders: DoubleArray, builder: UnivariateHistogramBuilder.() -> Unit, - ): UnivariateHistogram = UnivariateHistogramSpace.custom(borders).produce(builder) + ): UnivariateHistogram = TreeHistogramSpace.custom(borders).produce(builder) } } -public interface UnivariateHistogramBuilder: HistogramBuilder { - +@UnstableKMathAPI +public interface UnivariateHistogramBuilder : HistogramBuilder { /** * Thread safe put operation */ - public fun put(value: Double, weight: Double = 1.0) + public fun putValue(at: Double, value: Double = 1.0) override fun putValue(point: Buffer, value: Number) - - /** - * Put several items into a single bin - */ - public fun putMany(value: Double, count: Int, weight: Double = count.toDouble()) - - public fun build(): UnivariateHistogram } @UnstableKMathAPI -public fun UnivariateHistogramBuilder.fill(items: Iterable): Unit = items.forEach(::put) +public fun UnivariateHistogramBuilder.fill(items: Iterable): Unit = items.forEach(this::putValue) @UnstableKMathAPI -public fun UnivariateHistogramBuilder.fill(array: DoubleArray): Unit = array.forEach(::put) +public fun UnivariateHistogramBuilder.fill(array: DoubleArray): Unit = array.forEach(this::putValue) @UnstableKMathAPI -public fun UnivariateHistogramBuilder.fill(buffer: Buffer): Unit = buffer.asSequence().forEach(::put) \ No newline at end of file +public fun UnivariateHistogramBuilder.fill(buffer: Buffer): Unit = buffer.asSequence().forEach(this::putValue) \ No newline at end of file diff --git a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogramSpace.kt b/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogramSpace.kt deleted file mode 100644 index 3d1bd20c0..000000000 --- a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogramSpace.kt +++ /dev/null @@ -1,185 +0,0 @@ -package kscience.kmath.histogram - -import kscience.kmath.operations.Space -import kscience.kmath.structures.Buffer -import java.util.* -import kotlin.math.abs -import kotlin.math.sqrt - -private fun TreeMap.getBin(value: Double): B? { - // check ceiling entry and return it if it is what needed - val ceil = ceilingEntry(value)?.value - if (ceil != null && value in ceil) return ceil - //check floor entry - val floor = floorEntry(value)?.value - if (floor != null && value in floor) return floor - //neither is valid, not found - return null -} - - -private class UnivariateHistogramImpl( - override val context: UnivariateHistogramSpace, - val binMap: TreeMap, -) : UnivariateHistogram { - override fun get(value: Double): UnivariateBin? = binMap.getBin(value) - override val dimension: Int get() = 1 - override val bins: Collection get() = binMap.values -} - -private class UnivariateBinCounter( - override val def: UnivariateHistogramBinDefinition, -) : UnivariateBin { - val counter: LongCounter = LongCounter() - val valueCounter: ObjectCounter = Counter.real() - - /** - * The precise number of events ignoring weighting - */ - val count: Long get() = counter.value - - override val standardDeviation: Double get() = sqrt(count.toDouble()) / count * value - - /** - * The value of histogram including weighting - */ - override val value: Double get() = valueCounter.value - - public fun increment(count: Long, value: Double) { - counter.add(count) - valueCounter.add(value) - } -} - -private class UnivariateBinValue( - override val def: UnivariateHistogramBinDefinition, - override val value: Double, - override val standardDeviation: Double, -) : UnivariateBin - - -public class UnivariateHistogramSpace( - public val binFactory: (Double) -> UnivariateHistogramBinDefinition, -) : Space { - - private inner class UnivariateHistogramBuilderImpl : UnivariateHistogramBuilder { - - val bins: TreeMap = TreeMap() - fun get(value: Double): UnivariateBinCounter? = bins.getBin(value) - - private fun createBin(value: Double): UnivariateBinCounter { - val binDefinition = binFactory(value) - val newBin = UnivariateBinCounter(binDefinition) - synchronized(this) { bins[binDefinition.position] = newBin } - return newBin - } - - /** - * Thread safe put operation - */ - override fun put(value: Double, weight: Double) { - (get(value) ?: createBin(value)).apply { - increment(1, weight) - } - } - - override fun putValue(point: Buffer, value: Number) { - put(point[0], value.toDouble()) - } - - /** - * Put several items into a single bin - */ - override fun putMany(value: Double, count: Int, weight: Double) { - (get(value) ?: createBin(value)).apply { - increment(count.toLong(), weight) - } - } - - override fun build(): UnivariateHistogram = UnivariateHistogramImpl(this@UnivariateHistogramSpace, bins) - } - - - public fun builder(): UnivariateHistogramBuilder = UnivariateHistogramBuilderImpl() - - public fun produce(builder: UnivariateHistogramBuilder.() -> Unit): UnivariateHistogram = - UnivariateHistogramBuilderImpl().apply(builder).build() - - override fun add( - a: UnivariateHistogram, - b: UnivariateHistogram, - ): UnivariateHistogram { - require(a.context == this) { "Histogram $a does not belong to this context" } - require(b.context == this) { "Histogram $b does not belong to this context" } - val bins = TreeMap().apply { - (a.bins.map { it.def } union b.bins.map { it.def }).forEach { def -> - val newBin = UnivariateBinValue( - def, - value = (a[def.position]?.value ?: 0.0) + (b[def.position]?.value ?: 0.0), - standardDeviation = (a[def.position]?.standardDeviation - ?: 0.0) + (b[def.position]?.standardDeviation ?: 0.0) - ) - } - } - return UnivariateHistogramImpl(this, bins) - } - - override fun multiply(a: UnivariateHistogram, k: Number): UnivariateHistogram { - val bins = TreeMap().apply { - a.bins.forEach { bin -> - put(bin.position, - UnivariateBinValue( - bin.def, - value = bin.value * k.toDouble(), - standardDeviation = abs(bin.standardDeviation * k.toDouble()) - ) - ) - } - } - - return UnivariateHistogramImpl(this, bins) - } - - override val zero: UnivariateHistogram = produce { } - - public companion object { - /** - * Build and fill a [UnivariateHistogram]. Returns a read-only histogram. - */ - public fun uniform( - binSize: Double, - start: Double = 0.0 - ): UnivariateHistogramSpace = UnivariateHistogramSpace { value -> - val center = start + binSize * Math.floor((value - start) / binSize + 0.5) - UnivariateHistogramBinDefinition(center, binSize) - } - - /** - * Create a histogram with custom cell borders - */ - public fun custom(borders: DoubleArray): UnivariateHistogramSpace { - val sorted = borders.sortedArray() - - return UnivariateHistogramSpace { value -> - when { - value < sorted.first() -> UnivariateHistogramBinDefinition( - Double.NEGATIVE_INFINITY, - Double.MAX_VALUE - ) - - value > sorted.last() -> UnivariateHistogramBinDefinition( - Double.POSITIVE_INFINITY, - Double.MAX_VALUE - ) - - else -> { - val index = sorted.indices.first { value > sorted[it] } - val left = sorted[index] - val right = sorted[index + 1] - UnivariateHistogramBinDefinition((left + right) / 2, (right - left)) - } - } - } - } - } -} \ No newline at end of file From d1b4d1ac115ef5de448bec5ae358475f2f9029a4 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 15 Feb 2021 09:32:25 +0300 Subject: [PATCH 077/150] Histograms refactor --- .../kmath/histogram/TreeHistogramSpace.kt | 27 +++++++++---------- .../kmath/histogram/UnivariateHistogram.kt | 25 ++++++++--------- 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/TreeHistogramSpace.kt b/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/TreeHistogramSpace.kt index b5872c601..67964fbeb 100644 --- a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/TreeHistogramSpace.kt +++ b/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/TreeHistogramSpace.kt @@ -8,7 +8,7 @@ import java.util.* import kotlin.math.abs import kotlin.math.sqrt -internal fun > TreeMap.getBin(value: Double): B? { +private fun > TreeMap.getBin(value: Double): B? { // check ceiling entry and return it if it is what needed val ceil = ceilingEntry(value)?.value if (ceil != null && value in ceil) return ceil @@ -29,12 +29,9 @@ public class TreeHistogram( override val bins: Collection get() = binMap.values } -private class UnivariateBinValue( - override val domain: UnivariateDomain, - override val value: Double, - override val standardDeviation: Double, -) : UnivariateBin, ClosedFloatingPointRange by domain.range - +/** + * A space for univariate histograms with variable bin borders based on a tree map + */ @UnstableKMathAPI public class TreeHistogramSpace( public val binFactory: (Double) -> UnivariateDomain, @@ -73,7 +70,7 @@ public class TreeHistogramSpace( val resBins = TreeMap() bins.forEach { key, binCounter -> val count = binCounter.counter.value - resBins[key] = UnivariateBinValue(binCounter.domain, count, sqrt(count)) + resBins[key] = UnivariateBin(binCounter.domain, count, sqrt(count)) } return TreeHistogram(this, resBins) } @@ -86,11 +83,13 @@ public class TreeHistogramSpace( require(b.context == this) { "Histogram $b does not belong to this context" } val bins = TreeMap().apply { (a.bins.map { it.domain } union b.bins.map { it.domain }).forEach { def -> - val newBin = UnivariateBinValue( - def, - value = (a[def.center]?.value ?: 0.0) + (b[def.center]?.value ?: 0.0), - standardDeviation = (a[def.center]?.standardDeviation - ?: 0.0) + (b[def.center]?.standardDeviation ?: 0.0) + put(def.center, + UnivariateBin( + def, + value = (a[def.center]?.value ?: 0.0) + (b[def.center]?.value ?: 0.0), + standardDeviation = (a[def.center]?.standardDeviation + ?: 0.0) + (b[def.center]?.standardDeviation ?: 0.0) + ) ) } } @@ -101,7 +100,7 @@ public class TreeHistogramSpace( val bins = TreeMap().apply { a.bins.forEach { bin -> put(bin.domain.center, - UnivariateBinValue( + UnivariateBin( bin.domain, value = bin.value * k.toDouble(), standardDeviation = abs(bin.standardDeviation * k.toDouble()) diff --git a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogram.kt b/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogram.kt index 87c56cf79..68b9019d0 100644 --- a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogram.kt +++ b/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogram.kt @@ -10,26 +10,23 @@ import kscience.kmath.structures.asSequence public val UnivariateDomain.center: Double get() = (range.endInclusive - range.start) / 2 -public interface UnivariateBin : Bin, ClosedFloatingPointRange { - public val domain: UnivariateDomain - - /** - * The value of histogram including weighting - */ - public override val value: Double - - /** - * Standard deviation of the bin value. Zero if not applicable - */ - public val standardDeviation: Double +/** + * A univariate bin based an a range + * @param value The value of histogram including weighting + * @param standardDeviation Standard deviation of the bin value. Zero or negative if not applicable + */ +public class UnivariateBin( + public val domain: UnivariateDomain, + override val value: Double, + public val standardDeviation: Double, +) : Bin, ClosedFloatingPointRange by domain.range { public override val dimension: Int get() = 1 public override fun contains(point: Buffer): Boolean = point.size == 1 && contains(point[0]) - } -@UnstableKMathAPI +@OptIn(UnstableKMathAPI::class) public interface UnivariateHistogram : Histogram, SpaceElement> { public operator fun get(value: Double): UnivariateBin? From 8485d28872b317a5439f620c47d2ac6340271419 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Thu, 18 Feb 2021 11:17:28 +0300 Subject: [PATCH 078/150] Change package name to space.kscience --- CHANGELOG.md | 7 +- build.gradle.kts | 6 +- docs/algebra.md | 8 +- examples/build.gradle.kts | 8 + .../kmath/benchmarks/ArrayBenchmark.kt | 34 - .../kmath/benchmarks/ArrayBenchmark.kt | 34 + .../kmath/benchmarks/BufferBenchmark.kt | 10 +- .../kscience/kmath/benchmarks/DotBenchmark.kt | 18 +- .../ExpressionsInterpretersBenchmark.kt | 38 +- .../benchmarks/LinearAlgebraBenchmark.kt | 20 +- .../kmath/benchmarks/NDFieldBenchmark.kt | 8 +- .../kmath/benchmarks/ViktorBenchmark.kt | 8 +- .../kmath/benchmarks/ViktorLogBenchmark.kt | 8 +- .../space/kscience/kmath/ast/expressions.kt | 15 + .../kscience/kmath/ast/kotlingradSupport.kt} | 14 +- .../kmath/commons/fit/fitWithAutoDiff.kt | 22 +- .../kscience/kmath/operations/BigIntDemo.kt | 2 +- .../kscience/kmath/operations/ComplexDemo.kt | 8 +- .../kmath/stat/DistributionBenchmark.kt | 2 +- .../kscience/kmath/stat/DistributionDemo.kt | 6 +- .../kscience/kmath/structures/ComplexND.kt | 16 +- .../kscience/kmath/structures/NDField.kt | 12 +- .../kmath/structures/ParallelRealNDField.kt | 12 +- .../structures/StructureReadBenchmark.kt | 6 +- .../structures/StructureWriteBenchmark.kt | 6 +- .../kmath/structures/typeSafeDimensions.kt | 10 +- kmath-ast/README.md | 6 +- kmath-ast/docs/README-TEMPLATE.md | 6 +- .../{ => space}/kscience/kmath/ast/MST.kt | 8 +- .../kscience/kmath/ast/MstAlgebra.kt | 16 +- .../kscience/kmath/ast/MstExpression.kt | 10 +- .../internal/astring/astring.typealises.kt | 3 - .../kmath/estree/internal/stream/stream.kt | 7 - .../kscience/kmath/estree/estree.kt | 20 +- .../kmath/estree/internal/ESTreeBuilder.kt | 10 +- .../kmath/estree/internal/astring/astring.kt | 4 +- .../internal/astring/astring.typealises.kt | 3 + .../kmath/estree/internal/emitter/emitter.kt | 2 +- .../internal/estree/estree.extensions.kt | 2 +- .../kmath/estree/internal/estree/estree.kt | 2 +- .../kmath/estree/internal/stream/stream.kt | 7 + .../internal/tsstdlib/lib.es2015.iterable.kt | 2 +- .../kmath/estree/internal/tsstdlib/lib.es5.kt | 2 +- .../TestESTreeConsistencyWithInterpreter.kt | 30 +- .../estree/TestESTreeOperationsSupport.kt | 20 +- .../kmath/estree/TestESTreeSpecialization.kt | 22 +- .../kmath/estree/TestESTreeVariables.kt | 12 +- .../{ => space}/kscience/kmath/asm/asm.kt | 20 +- .../kscience/kmath/asm/internal/AsmBuilder.kt | 15 +- .../kmath/asm/internal/codegenUtils.kt | 6 +- .../kmath/asm/internal/mapIntrinsics.kt | 6 +- .../{ => space}/kscience/kmath/ast/parser.kt | 10 +- .../asm/TestAsmConsistencyWithInterpreter.kt | 29 +- .../kmath/asm/TestAsmOperationsSupport.kt | 20 +- .../kmath/asm/TestAsmSpecialization.kt | 22 +- .../kscience/kmath/asm/TestAsmVariables.kt | 12 +- .../kmath/ast/ParserPrecedenceTest.kt | 6 +- .../kscience/kmath/ast/ParserTest.kt | 14 +- .../DerivativeStructureExpression.kt | 14 +- .../kscience/kmath/commons/linear/CMMatrix.kt | 8 +- .../kscience/kmath/commons/linear/CMSolver.kt | 6 +- .../optimization/CMOptimizationProblem.kt | 12 +- .../kmath/commons/optimization/cmFit.kt | 20 +- .../random/CMRandomGeneratorWrapper.kt | 4 +- .../commons/transform/Transformations.kt | 10 +- .../DerivativeStructureExpressionTest.kt | 6 +- .../commons/optimization/OptimizeTest.kt | 16 +- .../kscience/kmath/complex/Complex.kt | 26 +- .../kscience/kmath/complex/ComplexNDField.kt | 17 +- .../kscience/kmath/complex/Quaternion.kt | 22 +- .../kmath/complex/ComplexBufferSpecTest.kt | 4 +- .../kmath/complex/ComplexFieldTest.kt | 4 +- .../kscience/kmath/complex/ComplexTest.kt | 4 +- .../complex/ExpressionFieldForComplexTest.kt | 14 +- .../kmath/complex/QuaternionFieldTest.kt | 4 +- kmath-core/api/kmath-core.api | 2745 +++++++++-------- .../kscience/kmath/domains/Domain.kt | 4 +- .../kmath/domains/HyperSquareDomain.kt | 8 +- .../kscience/kmath/domains/RealDomain.kt | 4 +- .../kmath/domains/UnconstrainedDomain.kt | 4 +- .../kmath/domains/UnivariateDomain.kt | 6 +- .../expressions/DifferentiableExpression.kt | 2 +- .../kscience/kmath/expressions/Expression.kt | 14 +- .../FunctionalExpressionAlgebra.kt | 6 +- .../kmath/expressions/SimpleAutoDiff.kt | 12 +- .../kmath/expressions/SymbolIndexer.kt | 10 +- .../kmath/expressions/expressionBuilders.kt | 10 +- .../kscience/kmath/linear/BufferMatrix.kt | 16 +- .../kscience/kmath/linear/LinearAlgebra.kt | 6 +- .../kscience/kmath/linear/LupDecomposition.kt | 13 +- .../kscience/kmath/linear/MatrixBuilder.kt | 10 +- .../kscience/kmath/linear/MatrixContext.kt | 16 +- .../kscience/kmath/linear/MatrixFeatures.kt | 2 +- .../kscience/kmath/linear/MatrixWrapper.kt | 12 +- .../kmath/linear/RealMatrixContext.kt | 4 +- .../kscience/kmath/linear/VectorSpace.kt | 12 +- .../kscience/kmath/linear/VirtualMatrix.kt | 2 +- .../kscience/kmath/misc/annotations.kt | 2 +- .../kscience/kmath/misc/cumulative.kt | 6 +- .../kscience/kmath/nd/BufferNDAlgebra.kt | 12 +- .../kscience/kmath/nd/NDAlgebra.kt | 10 +- .../kscience/kmath/nd/NDStructure.kt | 12 +- .../kscience/kmath/nd/RealNDField.kt | 14 +- .../kscience/kmath/nd/ShortNDRing.kt | 12 +- .../kscience/kmath/nd/Structure1D.kt | 6 +- .../kscience/kmath/nd/Structure2D.kt | 10 +- .../kscience/kmath/operations/Algebra.kt | 8 +- .../kmath/operations/AlgebraElements.kt | 4 +- .../kscience/kmath/operations/BigInt.kt | 16 +- .../kmath/operations/NumericAlgebra.kt | 4 +- .../kmath/operations/OptionalOperations.kt | 4 +- .../kmath/operations/algebraExtensions.kt | 2 +- .../kscience/kmath/operations/numbers.kt | 2 +- .../kscience/kmath/structures/Buffer.kt | 2 +- .../kmath/structures/BufferAccessor2D.kt | 10 +- .../kmath/structures/FlaggedBuffer.kt | 2 +- .../kscience/kmath/structures/FloatBuffer.kt | 2 +- .../kscience/kmath/structures/IntBuffer.kt | 2 +- .../kscience/kmath/structures/LongBuffer.kt | 2 +- .../kscience/kmath/structures/MemoryBuffer.kt | 4 +- .../kscience/kmath/structures/RealBuffer.kt | 2 +- .../kmath/structures/RealBufferField.kt | 6 +- .../kscience/kmath/structures/ShortBuffer.kt | 2 +- .../kmath/expressions/ExpressionFieldTest.kt | 6 +- .../kmath/expressions/SimpleAutoDiffTest.kt | 22 +- .../kscience/kmath/linear/MatrixTest.kt | 8 +- .../kscience/kmath/linear/RealLUSolverTest.kt | 2 +- .../kscience/kmath/linear/VectorSpaceTest.kt | 0 .../kscience/kmath/misc/CumulativeKtTest.kt | 2 +- .../kmath/operations/BigIntAlgebraTest.kt | 4 +- .../kmath/operations/BigIntConstructorTest.kt | 2 +- .../kmath/operations/BigIntConversionsTest.kt | 2 +- .../kmath/operations/BigIntOperationsTest.kt | 2 +- .../kmath/operations/RealFieldTest.kt | 4 +- .../kscience/kmath/structures/NDFieldTest.kt | 12 +- .../kmath/structures/NumberNDFieldTest.kt | 8 +- .../kmath/testutils/AlgebraicVerifier.kt | 4 +- .../kscience/kmath/testutils/FieldVerifier.kt | 6 +- .../kscience/kmath/testutils/RingVerifier.kt | 6 +- .../kscience/kmath/testutils/SpaceVerifier.kt | 6 +- .../kscience/kmath/operations/BigNumbers.kt | 2 +- .../kscience/kmath/chains/BlockingIntChain.kt | 2 +- .../kmath/chains/BlockingRealChain.kt | 2 +- .../kscience/kmath/chains/Chain.kt | 2 +- .../kscience/kmath/chains/flowExtra.kt | 8 +- .../kmath/coroutines/coroutinesExtra.kt | 2 +- .../kscience/kmath/streaming/BufferFlow.kt | 12 +- .../kscience/kmath/streaming/RingBuffer.kt | 8 +- .../kscience/kmath/chains/ChainExt.kt | 2 +- .../kmath/structures/LazyNDStructure.kt | 8 +- .../kmath/streaming/BufferFlowTest.kt | 8 +- .../kmath/streaming/RingBufferTest.kt | 4 +- .../kscience/kmath/dimensions/Dimensions.kt | 2 +- .../kscience/kmath/dimensions/Wrappers.kt | 8 +- .../kscience/dimensions/DMatrixContextTest.kt | 8 +- .../kscience/kmath/dimensions/dimJs.kt | 2 +- .../kscience/kmath/dimensions/dimJvm.kt | 2 +- .../kscience/kmath/dimensions/dimNative.kt | 2 +- .../kscience/kmath/ejml/EjmlMatrix.kt | 10 +- .../kscience/kmath/ejml/EjmlMatrixContext.kt | 8 +- .../kscience/kmath/ejml/EjmlVector.kt | 6 +- .../kscience/kmath/ejml/EjmlMatrixTest.kt | 14 +- .../kscience/kmath/ejml/EjmlVectorTest.kt | 2 +- .../kscience/kmath/real/RealMatrix.kt | 12 +- .../kscience/kmath/real/RealVector.kt | 12 +- .../{ => space}/kscience/kmath/real/dot.kt | 8 +- .../{ => space}/kscience/kmath/real/grids.kt | 4 +- .../{ => space}/kscience/kmath/real/realND.kt | 8 +- .../kotlin/kaceince/kmath/real/GridTest.kt | 2 +- .../kaceince/kmath/real/RealMatrixTest.kt | 10 +- .../kaceince/kmath/real/RealVectorTest.kt | 12 +- .../kscience/kmath/functions/Piecewise.kt | 4 +- .../kscience/kmath/functions/Polynomial.kt | 8 +- .../kmath/interpolation/Interpolator.kt | 12 +- .../kmath/interpolation/LinearInterpolator.kt | 12 +- .../kmath/interpolation/LoessInterpolator.kt | 8 +- .../kmath/interpolation/SplineInterpolator.kt | 14 +- .../kmath/interpolation/XYPointSet.kt | 6 +- .../interpolation/LinearInterpolatorTest.kt | 8 +- .../kscience/kmath/geometry/ReferenceFrame.kt | 3 - .../kmath/geometry/Euclidean2DSpace.kt | 10 +- .../kmath/geometry/Euclidean3DSpace.kt | 10 +- .../kscience/kmath/geometry/GeometrySpace.kt | 4 +- .../kscience/kmath/geometry/Line.kt | 2 +- .../kscience/kmath/geometry/ReferenceFrame.kt | 3 + .../kscience/kmath/histogram/Counters.kt | 2 +- .../kscience/kmath/histogram/Histogram.kt | 10 +- .../kscience/kmath/histogram/RealHistogram.kt | 14 +- .../histogram/MultivariateHistogramTest.kt | 10 +- .../kscience/kmath/histogram/Counters.kt | 2 +- .../kscience/kmath/histogram/Counters.kt | 2 +- .../kmath/histogram/UnivariateHistogram.kt | 14 +- .../histogram/UnivariateHistogramSpace.kt | 4 +- .../kotlingrad/DifferentiableMstExpression.kt | 16 +- .../kscience/kmath/kotlingrad/KMathNumber.kt | 4 +- .../kmath/kotlingrad/ScalarsAdapters.kt | 16 +- .../kmath/kotlingrad/AdaptingTests.kt | 20 +- kmath-memory/api/kmath-memory.api | 62 +- .../kscience/kmath/memory/Memory.kt | 2 +- .../kscience/kmath/memory/MemorySpec.kt | 2 +- .../kscience/kmath/memory/DataViewMemory.kt | 2 +- .../kscience/kmath/memory/ByteBufferMemory.kt | 2 +- .../kscience/kmath/memory/NativeMemory.kt | 2 +- .../kscience/kmath/nd4j}/Nd4jArrayAlgebra.kt | 10 +- .../kscience/kmath/nd4j}/Nd4jArrayIterator.kt | 2 +- .../kmath/nd4j}/Nd4jArrayStructure.kt | 6 +- .../kscience/kmath/nd4j}/arrays.kt | 2 +- .../kmath/nd4j/Nd4jArrayAlgebraTest.kt | 9 +- .../kmath/nd4j/Nd4jArrayStructureTest.kt | 4 +- .../kscience/kmath/stat/Distribution.kt | 10 +- .../kmath/stat/FactorizedDistribution.kt | 6 +- .../kscience/kmath/stat/Fitting.kt | 10 +- .../kscience/kmath/stat/MCScope.kt | 2 +- .../kmath/stat/OptimizationProblem.kt | 8 +- .../kscience/kmath/stat/RandomChain.kt | 4 +- .../kscience/kmath/stat/RandomGenerator.kt | 2 +- .../kscience/kmath/stat/SamplerAlgebra.kt | 14 +- .../kscience/kmath/stat/Statistic.kt | 12 +- .../kmath/stat/UniformDistribution.kt | 6 +- .../kmath/stat/RandomSourceGenerator.kt | 2 +- .../kscience/kmath/stat/distributions.kt | 8 +- .../kmath/stat/CommonsDistributionsTest.kt | 2 +- .../kscience/kmath/stat/MCScopeTest.kt | 3 +- .../kscience/kmath/stat/SamplerTest.kt | 2 +- .../kscience/kmath/stat/StatisticTest.kt | 4 +- kmath-viktor/api/kmath-viktor.api | 168 +- .../kscience/kmath/viktor/ViktorBuffer.kt | 4 +- .../kmath/viktor/ViktorNDStructure.kt | 12 +- settings.gradle.kts | 2 +- 229 files changed, 2446 insertions(+), 2405 deletions(-) delete mode 100644 examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/ArrayBenchmark.kt create mode 100644 examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ArrayBenchmark.kt rename examples/src/benchmarks/kotlin/{ => space}/kscience/kmath/benchmarks/BufferBenchmark.kt (74%) rename examples/src/benchmarks/kotlin/{ => space}/kscience/kmath/benchmarks/DotBenchmark.kt (76%) rename examples/src/benchmarks/kotlin/{ => space}/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt (50%) rename examples/src/benchmarks/kotlin/{ => space}/kscience/kmath/benchmarks/LinearAlgebraBenchmark.kt (64%) rename examples/src/benchmarks/kotlin/{ => space}/kscience/kmath/benchmarks/NDFieldBenchmark.kt (85%) rename examples/src/benchmarks/kotlin/{ => space}/kscience/kmath/benchmarks/ViktorBenchmark.kt (87%) rename examples/src/benchmarks/kotlin/{ => space}/kscience/kmath/benchmarks/ViktorLogBenchmark.kt (87%) create mode 100644 examples/src/main/kotlin/space/kscience/kmath/ast/expressions.kt rename examples/src/main/kotlin/{kscience/kmath/ast/KotlingradSupport.kt => space/kscience/kmath/ast/kotlingradSupport.kt} (60%) rename examples/src/main/kotlin/{ => space}/kscience/kmath/commons/fit/fitWithAutoDiff.kt (83%) rename examples/src/main/kotlin/{ => space}/kscience/kmath/operations/BigIntDemo.kt (67%) rename examples/src/main/kotlin/{ => space}/kscience/kmath/operations/ComplexDemo.kt (71%) rename examples/src/main/kotlin/{ => space}/kscience/kmath/stat/DistributionBenchmark.kt (98%) rename examples/src/main/kotlin/{ => space}/kscience/kmath/stat/DistributionDemo.kt (85%) rename examples/src/main/kotlin/{ => space}/kscience/kmath/structures/ComplexND.kt (80%) rename examples/src/main/kotlin/{ => space}/kscience/kmath/structures/NDField.kt (90%) rename examples/src/main/kotlin/{ => space}/kscience/kmath/structures/ParallelRealNDField.kt (92%) rename examples/src/main/kotlin/{ => space}/kscience/kmath/structures/StructureReadBenchmark.kt (87%) rename examples/src/main/kotlin/{ => space}/kscience/kmath/structures/StructureWriteBenchmark.kt (87%) rename examples/src/main/kotlin/{ => space}/kscience/kmath/structures/typeSafeDimensions.kt (73%) rename kmath-ast/src/commonMain/kotlin/{ => space}/kscience/kmath/ast/MST.kt (93%) rename kmath-ast/src/commonMain/kotlin/{ => space}/kscience/kmath/ast/MstAlgebra.kt (92%) rename kmath-ast/src/commonMain/kotlin/{ => space}/kscience/kmath/ast/MstExpression.kt (95%) delete mode 100644 kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/astring/astring.typealises.kt delete mode 100644 kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/stream/stream.kt rename kmath-ast/src/jsMain/kotlin/{ => space}/kscience/kmath/estree/estree.kt (82%) rename kmath-ast/src/jsMain/kotlin/{ => space}/kscience/kmath/estree/internal/ESTreeBuilder.kt (90%) rename kmath-ast/src/jsMain/kotlin/{ => space}/kscience/kmath/estree/internal/astring/astring.kt (88%) create mode 100644 kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/astring/astring.typealises.kt rename kmath-ast/src/jsMain/kotlin/{ => space}/kscience/kmath/estree/internal/emitter/emitter.kt (87%) rename kmath-ast/src/jsMain/kotlin/{ => space}/kscience/kmath/estree/internal/estree/estree.extensions.kt (97%) rename kmath-ast/src/jsMain/kotlin/{ => space}/kscience/kmath/estree/internal/estree/estree.kt (99%) create mode 100644 kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/stream/stream.kt rename kmath-ast/src/jsMain/kotlin/{ => space}/kscience/kmath/estree/internal/tsstdlib/lib.es2015.iterable.kt (93%) rename kmath-ast/src/jsMain/kotlin/{ => space}/kscience/kmath/estree/internal/tsstdlib/lib.es5.kt (97%) rename kmath-ast/src/jsTest/kotlin/{ => space}/kscience/kmath/estree/TestESTreeConsistencyWithInterpreter.kt (76%) rename kmath-ast/src/jsTest/kotlin/{ => space}/kscience/kmath/estree/TestESTreeOperationsSupport.kt (50%) rename kmath-ast/src/jsTest/kotlin/{ => space}/kscience/kmath/estree/TestESTreeSpecialization.kt (68%) rename kmath-ast/src/jsTest/kotlin/{ => space}/kscience/kmath/estree/TestESTreeVariables.kt (52%) rename kmath-ast/src/jvmMain/kotlin/{ => space}/kscience/kmath/asm/asm.kt (84%) rename kmath-ast/src/jvmMain/kotlin/{ => space}/kscience/kmath/asm/internal/AsmBuilder.kt (95%) rename kmath-ast/src/jvmMain/kotlin/{ => space}/kscience/kmath/asm/internal/codegenUtils.kt (95%) rename kmath-ast/src/jvmMain/kotlin/{ => space}/kscience/kmath/asm/internal/mapIntrinsics.kt (64%) rename kmath-ast/src/jvmMain/kotlin/{ => space}/kscience/kmath/ast/parser.kt (93%) rename kmath-ast/src/jvmTest/kotlin/{ => space}/kscience/kmath/asm/TestAsmConsistencyWithInterpreter.kt (76%) rename kmath-ast/src/jvmTest/kotlin/{ => space}/kscience/kmath/asm/TestAsmOperationsSupport.kt (50%) rename kmath-ast/src/jvmTest/kotlin/{ => space}/kscience/kmath/asm/TestAsmSpecialization.kt (68%) rename kmath-ast/src/jvmTest/kotlin/{ => space}/kscience/kmath/asm/TestAsmVariables.kt (52%) rename kmath-ast/src/jvmTest/kotlin/{ => space}/kscience/kmath/ast/ParserPrecedenceTest.kt (86%) rename kmath-ast/src/jvmTest/kotlin/{ => space}/kscience/kmath/ast/ParserTest.kt (81%) rename kmath-commons/src/main/kotlin/{ => space}/kscience/kmath/commons/expressions/DerivativeStructureExpression.kt (92%) rename kmath-commons/src/main/kotlin/{ => space}/kscience/kmath/commons/linear/CMMatrix.kt (96%) rename kmath-commons/src/main/kotlin/{ => space}/kscience/kmath/commons/linear/CMSolver.kt (90%) rename kmath-commons/src/main/kotlin/{ => space}/kscience/kmath/commons/optimization/CMOptimizationProblem.kt (93%) rename kmath-commons/src/main/kotlin/{ => space}/kscience/kmath/commons/optimization/cmFit.kt (80%) rename kmath-commons/src/main/kotlin/{ => space}/kscience/kmath/commons/random/CMRandomGeneratorWrapper.kt (91%) rename kmath-commons/src/main/kotlin/{ => space}/kscience/kmath/commons/transform/Transformations.kt (93%) rename kmath-commons/src/test/kotlin/{ => space}/kscience/kmath/commons/expressions/DerivativeStructureExpressionTest.kt (91%) rename kmath-commons/src/test/kotlin/{ => space}/kscience/kmath/commons/optimization/OptimizeTest.kt (79%) rename kmath-complex/src/commonMain/kotlin/{ => space}/kscience/kmath/complex/Complex.kt (89%) rename kmath-complex/src/commonMain/kotlin/{ => space}/kscience/kmath/complex/ComplexNDField.kt (91%) rename kmath-complex/src/commonMain/kotlin/{ => space}/kscience/kmath/complex/Quaternion.kt (93%) rename kmath-complex/src/commonTest/kotlin/{ => space}/kscience/kmath/complex/ComplexBufferSpecTest.kt (76%) rename kmath-complex/src/commonTest/kotlin/{ => space}/kscience/kmath/complex/ComplexFieldTest.kt (96%) rename kmath-complex/src/commonTest/kotlin/{ => space}/kscience/kmath/complex/ComplexTest.kt (91%) rename kmath-complex/src/commonTest/kotlin/{ => space}/kscience/kmath/complex/ExpressionFieldForComplexTest.kt (57%) rename kmath-complex/src/commonTest/kotlin/{ => space}/kscience/kmath/complex/QuaternionFieldTest.kt (95%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/domains/Domain.kt (82%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/domains/HyperSquareDomain.kt (91%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/domains/RealDomain.kt (95%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/domains/UnconstrainedDomain.kt (94%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/domains/UnivariateDomain.kt (91%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/expressions/DifferentiableExpression.kt (97%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/expressions/Expression.kt (84%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/expressions/FunctionalExpressionAlgebra.kt (97%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/expressions/SimpleAutoDiff.kt (97%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/expressions/SymbolIndexer.kt (89%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/expressions/expressionBuilders.kt (85%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/linear/BufferMatrix.kt (92%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/linear/LinearAlgebra.kt (84%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/linear/LupDecomposition.kt (95%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/linear/MatrixBuilder.kt (86%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/linear/MatrixContext.kt (92%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/linear/MatrixFeatures.kt (99%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/linear/MatrixWrapper.kt (92%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/linear/RealMatrixContext.kt (97%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/linear/VectorSpace.kt (88%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/linear/VirtualMatrix.kt (96%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/misc/annotations.kt (80%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/misc/cumulative.kt (95%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/nd/BufferNDAlgebra.kt (93%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/nd/NDAlgebra.kt (97%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/nd/NDStructure.kt (97%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/nd/RealNDField.kt (92%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/nd/ShortNDRing.kt (79%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/nd/Structure1D.kt (93%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/nd/Structure2D.kt (91%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/operations/Algebra.kt (97%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/operations/AlgebraElements.kt (95%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/operations/BigInt.kt (97%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/operations/NumericAlgebra.kt (98%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/operations/OptionalOperations.kt (98%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/operations/algebraExtensions.kt (98%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/operations/numbers.kt (99%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/structures/Buffer.kt (99%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/structures/BufferAccessor2D.kt (88%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/structures/FlaggedBuffer.kt (98%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/structures/FloatBuffer.kt (97%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/structures/IntBuffer.kt (97%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/structures/LongBuffer.kt (97%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/structures/MemoryBuffer.kt (96%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/structures/RealBuffer.kt (97%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/structures/RealBufferField.kt (98%) rename kmath-core/src/commonMain/kotlin/{ => space}/kscience/kmath/structures/ShortBuffer.kt (97%) rename kmath-core/src/commonTest/kotlin/{ => space}/kscience/kmath/expressions/ExpressionFieldTest.kt (89%) rename kmath-core/src/commonTest/kotlin/{ => space}/kscience/kmath/expressions/SimpleAutoDiffTest.kt (95%) rename kmath-core/src/commonTest/kotlin/{ => space}/kscience/kmath/linear/MatrixTest.kt (91%) rename kmath-core/src/commonTest/kotlin/{ => space}/kscience/kmath/linear/RealLUSolverTest.kt (96%) rename kmath-core/src/commonTest/kotlin/{ => space}/kscience/kmath/linear/VectorSpaceTest.kt (100%) rename kmath-core/src/commonTest/kotlin/{ => space}/kscience/kmath/misc/CumulativeKtTest.kt (89%) rename kmath-core/src/commonTest/kotlin/{ => space}/kscience/kmath/operations/BigIntAlgebraTest.kt (94%) rename kmath-core/src/commonTest/kotlin/{ => space}/kscience/kmath/operations/BigIntConstructorTest.kt (93%) rename kmath-core/src/commonTest/kotlin/{ => space}/kscience/kmath/operations/BigIntConversionsTest.kt (96%) rename kmath-core/src/commonTest/kotlin/{ => space}/kscience/kmath/operations/BigIntOperationsTest.kt (99%) rename kmath-core/src/commonTest/kotlin/{ => space}/kscience/kmath/operations/RealFieldTest.kt (76%) rename kmath-core/src/commonTest/kotlin/{ => space}/kscience/kmath/structures/NDFieldTest.kt (60%) rename kmath-core/src/commonTest/kotlin/{ => space}/kscience/kmath/structures/NumberNDFieldTest.kt (92%) rename kmath-core/src/commonTest/kotlin/{ => space}/kscience/kmath/testutils/AlgebraicVerifier.kt (56%) rename kmath-core/src/commonTest/kotlin/{ => space}/kscience/kmath/testutils/FieldVerifier.kt (89%) rename kmath-core/src/commonTest/kotlin/{ => space}/kscience/kmath/testutils/RingVerifier.kt (92%) rename kmath-core/src/commonTest/kotlin/{ => space}/kscience/kmath/testutils/SpaceVerifier.kt (91%) rename kmath-core/src/jvmMain/kotlin/{ => space}/kscience/kmath/operations/BigNumbers.kt (98%) rename kmath-coroutines/src/commonMain/kotlin/{ => space}/kscience/kmath/chains/BlockingIntChain.kt (88%) rename kmath-coroutines/src/commonMain/kotlin/{ => space}/kscience/kmath/chains/BlockingRealChain.kt (89%) rename kmath-coroutines/src/commonMain/kotlin/{ => space}/kscience/kmath/chains/Chain.kt (99%) rename kmath-coroutines/src/commonMain/kotlin/{ => space}/kscience/kmath/chains/flowExtra.kt (79%) rename kmath-coroutines/src/commonMain/kotlin/{ => space}/kscience/kmath/coroutines/coroutinesExtra.kt (98%) rename kmath-coroutines/src/commonMain/kotlin/{ => space}/kscience/kmath/streaming/BufferFlow.kt (88%) rename kmath-coroutines/src/commonMain/kotlin/{ => space}/kscience/kmath/streaming/RingBuffer.kt (92%) rename kmath-coroutines/src/jvmMain/kotlin/{ => space}/kscience/kmath/chains/ChainExt.kt (92%) rename kmath-coroutines/src/jvmMain/kotlin/{ => space}/kscience/kmath/structures/LazyNDStructure.kt (92%) rename kmath-coroutines/src/jvmTest/kotlin/{ => space}/kscience/kmath/streaming/BufferFlowTest.kt (87%) rename kmath-coroutines/src/jvmTest/kotlin/{ => space}/kscience/kmath/streaming/RingBufferTest.kt (90%) rename kmath-dimensions/src/commonMain/kotlin/{ => space}/kscience/kmath/dimensions/Dimensions.kt (96%) rename kmath-dimensions/src/commonMain/kotlin/{ => space}/kscience/kmath/dimensions/Wrappers.kt (97%) rename kmath-dimensions/src/jsMain/kotlin/{ => space}/kscience/kmath/dimensions/dimJs.kt (93%) rename kmath-dimensions/src/jvmMain/kotlin/{ => space}/kscience/kmath/dimensions/dimJvm.kt (90%) rename kmath-dimensions/src/nativeMain/kotlin/{ => space}/kscience/kmath/dimensions/dimNative.kt (94%) rename kmath-ejml/src/main/kotlin/{ => space}/kscience/kmath/ejml/EjmlMatrix.kt (94%) rename kmath-ejml/src/main/kotlin/{ => space}/kscience/kmath/ejml/EjmlMatrixContext.kt (94%) rename kmath-ejml/src/main/kotlin/{ => space}/kscience/kmath/ejml/EjmlVector.kt (90%) rename kmath-ejml/src/test/kotlin/{ => space}/kscience/kmath/ejml/EjmlMatrixTest.kt (86%) rename kmath-ejml/src/test/kotlin/{ => space}/kscience/kmath/ejml/EjmlVectorTest.kt (96%) rename kmath-for-real/src/commonMain/kotlin/{ => space}/kscience/kmath/real/RealMatrix.kt (95%) rename kmath-for-real/src/commonMain/kotlin/{ => space}/kscience/kmath/real/RealVector.kt (92%) rename kmath-for-real/src/commonMain/kotlin/{ => space}/kscience/kmath/real/dot.kt (83%) rename kmath-for-real/src/commonMain/kotlin/{ => space}/kscience/kmath/real/grids.kt (94%) rename kmath-for-real/src/commonMain/kotlin/{ => space}/kscience/kmath/real/realND.kt (81%) rename kmath-functions/src/commonMain/kotlin/{ => space}/kscience/kmath/functions/Piecewise.kt (92%) rename kmath-functions/src/commonMain/kotlin/{ => space}/kscience/kmath/functions/Polynomial.kt (92%) rename kmath-functions/src/commonMain/kotlin/{ => space}/kscience/kmath/interpolation/Interpolator.kt (82%) rename kmath-functions/src/commonMain/kotlin/{ => space}/kscience/kmath/interpolation/LinearInterpolator.kt (74%) rename kmath-functions/src/commonMain/kotlin/{ => space}/kscience/kmath/interpolation/LoessInterpolator.kt (98%) rename kmath-functions/src/commonMain/kotlin/{ => space}/kscience/kmath/interpolation/SplineInterpolator.kt (85%) rename kmath-functions/src/commonMain/kotlin/{ => space}/kscience/kmath/interpolation/XYPointSet.kt (92%) rename kmath-functions/src/commonTest/kotlin/{ => space}/kscience/kmath/interpolation/LinearInterpolatorTest.kt (75%) delete mode 100644 kmath-geometry/src/commonMain/kotlin/kscience/kmath/geometry/ReferenceFrame.kt rename kmath-geometry/src/commonMain/kotlin/{ => space}/kscience/kmath/geometry/Euclidean2DSpace.kt (86%) rename kmath-geometry/src/commonMain/kotlin/{ => space}/kscience/kmath/geometry/Euclidean3DSpace.kt (87%) rename kmath-geometry/src/commonMain/kotlin/{ => space}/kscience/kmath/geometry/GeometrySpace.kt (74%) rename kmath-geometry/src/commonMain/kotlin/{ => space}/kscience/kmath/geometry/Line.kt (79%) create mode 100644 kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/ReferenceFrame.kt rename kmath-histograms/src/commonMain/kotlin/{ => space}/kscience/kmath/histogram/Counters.kt (90%) rename kmath-histograms/src/commonMain/kotlin/{ => space}/kscience/kmath/histogram/Histogram.kt (86%) rename kmath-histograms/src/commonMain/kotlin/{ => space}/kscience/kmath/histogram/RealHistogram.kt (95%) rename kmath-histograms/src/jsMain/kotlin/{ => space}/kscience/kmath/histogram/Counters.kt (93%) rename kmath-histograms/src/jvmMain/kotlin/{ => space}/kscience/kmath/histogram/Counters.kt (83%) rename kmath-histograms/src/jvmMain/kotlin/{ => space}/kscience/kmath/histogram/UnivariateHistogram.kt (93%) rename kmath-histograms/src/jvmMain/kotlin/{ => space}/kscience/kmath/histogram/UnivariateHistogramSpace.kt (90%) rename kmath-kotlingrad/src/main/kotlin/{ => space}/kscience/kmath/kotlingrad/DifferentiableMstExpression.kt (80%) rename kmath-kotlingrad/src/main/kotlin/{ => space}/kscience/kmath/kotlingrad/KMathNumber.kt (86%) rename kmath-kotlingrad/src/main/kotlin/{ => space}/kscience/kmath/kotlingrad/ScalarsAdapters.kt (92%) rename kmath-kotlingrad/src/test/kotlin/{ => space}/kscience/kmath/kotlingrad/AdaptingTests.kt (79%) rename kmath-memory/src/commonMain/kotlin/{ => space}/kscience/kmath/memory/Memory.kt (98%) rename kmath-memory/src/commonMain/kotlin/{ => space}/kscience/kmath/memory/MemorySpec.kt (97%) rename kmath-memory/src/jsMain/kotlin/{ => space}/kscience/kmath/memory/DataViewMemory.kt (98%) rename kmath-memory/src/jvmMain/kotlin/{ => space}/kscience/kmath/memory/ByteBufferMemory.kt (99%) rename kmath-memory/src/nativeMain/kotlin/{ => space}/kscience/kmath/memory/NativeMemory.kt (98%) rename kmath-nd4j/src/main/kotlin/{kscience.kmath.nd4j => space/kscience/kmath/nd4j}/Nd4jArrayAlgebra.kt (98%) rename kmath-nd4j/src/main/kotlin/{kscience.kmath.nd4j => space/kscience/kmath/nd4j}/Nd4jArrayIterator.kt (98%) rename kmath-nd4j/src/main/kotlin/{kscience.kmath.nd4j => space/kscience/kmath/nd4j}/Nd4jArrayStructure.kt (95%) rename kmath-nd4j/src/main/kotlin/{kscience.kmath.nd4j => space/kscience/kmath/nd4j}/arrays.kt (83%) rename kmath-nd4j/src/test/kotlin/{ => space}/kscience/kmath/nd4j/Nd4jArrayAlgebraTest.kt (77%) rename kmath-nd4j/src/test/kotlin/{ => space}/kscience/kmath/nd4j/Nd4jArrayStructureTest.kt (96%) rename kmath-stat/src/commonMain/kotlin/{ => space}/kscience/kmath/stat/Distribution.kt (90%) rename kmath-stat/src/commonMain/kotlin/{ => space}/kscience/kmath/stat/FactorizedDistribution.kt (92%) rename kmath-stat/src/commonMain/kotlin/{ => space}/kscience/kmath/stat/Fitting.kt (89%) rename kmath-stat/src/commonMain/kotlin/{ => space}/kscience/kmath/stat/MCScope.kt (98%) rename kmath-stat/src/commonMain/kotlin/{ => space}/kscience/kmath/stat/OptimizationProblem.kt (93%) rename kmath-stat/src/commonMain/kotlin/{ => space}/kscience/kmath/stat/RandomChain.kt (85%) rename kmath-stat/src/commonMain/kotlin/{ => space}/kscience/kmath/stat/RandomGenerator.kt (99%) rename kmath-stat/src/commonMain/kotlin/{ => space}/kscience/kmath/stat/SamplerAlgebra.kt (77%) rename kmath-stat/src/commonMain/kotlin/{ => space}/kscience/kmath/stat/Statistic.kt (92%) rename kmath-stat/src/commonMain/kotlin/{ => space}/kscience/kmath/stat/UniformDistribution.kt (85%) rename kmath-stat/src/jvmMain/kotlin/{ => space}/kscience/kmath/stat/RandomSourceGenerator.kt (98%) rename kmath-stat/src/jvmMain/kotlin/{ => space}/kscience/kmath/stat/distributions.kt (95%) rename kmath-stat/src/jvmTest/kotlin/{ => space}/kscience/kmath/stat/CommonsDistributionsTest.kt (96%) rename kmath-stat/src/jvmTest/kotlin/{ => space}/kscience/kmath/stat/MCScopeTest.kt (97%) rename kmath-stat/src/jvmTest/kotlin/{ => space}/kscience/kmath/stat/SamplerTest.kt (91%) rename kmath-stat/src/jvmTest/kotlin/{ => space}/kscience/kmath/stat/StatisticTest.kt (90%) rename kmath-viktor/src/main/kotlin/{ => space}/kscience/kmath/viktor/ViktorBuffer.kt (87%) rename kmath-viktor/src/main/kotlin/{ => space}/kscience/kmath/viktor/ViktorNDStructure.kt (94%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2396c6b27..8bd7c1057 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,11 +21,11 @@ - Basic Quaternion vector support in `kmath-complex`. ### Changed -- Package changed from `scientifik` to `kscience.kmath` -- Gradle version: 6.6 -> 6.8 +- Package changed from `scientifik` to `space.kscience` +- Gradle version: 6.6 -> 6.8.2 - Minor exceptions refactor (throwing `IllegalArgumentException` by argument checks instead of `IllegalStateException`) - `Polynomial` secondary constructor made function -- Kotlin version: 1.3.72 -> 1.4.21 +- Kotlin version: 1.3.72 -> 1.4.30 - `kmath-ast` doesn't depend on heavy `kotlin-reflect` library - Full autodiff refactoring based on `Symbol` - `kmath-prob` renamed to `kmath-stat` @@ -41,6 +41,7 @@ - Refactor histograms. They are marked as prototype - `Complex` and related features moved to a separate module `kmath-complex` - Refactor AlgebraElement +- `symbol` method in `Algebra` renamed to `bindSymbol` to avoid ambiguity ### Deprecated diff --git a/build.gradle.kts b/build.gradle.kts index 7fe132315..783c9ca56 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,8 +5,6 @@ plugins { } internal val kmathVersion: String by extra("0.2.0-dev-7") -internal val bintrayRepo: String by extra("kscience") -internal val githubProject: String by extra("kmath") allprojects { repositories { @@ -23,7 +21,7 @@ allprojects { mavenCentral() } - group = "kscience.kmath" + group = "space.kscience" version = kmathVersion } @@ -37,4 +35,6 @@ readme { ksciencePublish { spaceRepo = "https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven" + bintrayRepo = "kscience" + githubProject = "kmath" } \ No newline at end of file diff --git a/docs/algebra.md b/docs/algebra.md index c3227517f..6bfcde043 100644 --- a/docs/algebra.md +++ b/docs/algebra.md @@ -5,7 +5,7 @@ operation, say `+`, one needs two objects of a type `T` and an algebra context, say `Space`. Next one needs to run the actual operation in the context: ```kotlin -import kscience.kmath.operations.* +import space.kscience.kmath.operations.* val a: T = ... val b: T = ... @@ -47,7 +47,7 @@ but it also holds reference to the `ComplexField` singleton, which allows perfor numbers without explicit involving the context like: ```kotlin -import kscience.kmath.operations.* +import space.kscience.kmath.operations.* // Using elements val c1 = Complex(1.0, 1.0) @@ -82,7 +82,7 @@ operations in all performance-critical places. The performance of element operat KMath submits both contexts and elements for builtin algebraic structures: ```kotlin -import kscience.kmath.operations.* +import space.kscience.kmath.operations.* val c1 = Complex(1.0, 2.0) val c2 = ComplexField.i @@ -95,7 +95,7 @@ val c3 = ComplexField { c1 + c2 } Also, `ComplexField` features special operations to mix complex and real numbers, for example: ```kotlin -import kscience.kmath.operations.* +import space.kscience.kmath.operations.* val c1 = Complex(1.0, 2.0) val c2 = ComplexField { c1 - 1.0 } // Returns: Complex(re=0.0, im=2.0) diff --git a/examples/build.gradle.kts b/examples/build.gradle.kts index 054945eb7..5439d46dc 100644 --- a/examples/build.gradle.kts +++ b/examples/build.gradle.kts @@ -76,6 +76,14 @@ benchmark { iterationTimeUnit = "ms" // time unity for iterationTime, default is seconds include("DotBenchmark") } + + configurations.register("expressions") { + warmups = 1 // number of warmup iterations + iterations = 3 // number of iterations + iterationTime = 500 // time in seconds per iteration + iterationTimeUnit = "ms" // time unity for iterationTime, default is seconds + include("ExpressionsInterpretersBenchmark") + } } kotlin.sourceSets.all { diff --git a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/ArrayBenchmark.kt b/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/ArrayBenchmark.kt deleted file mode 100644 index ebf31a590..000000000 --- a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/ArrayBenchmark.kt +++ /dev/null @@ -1,34 +0,0 @@ -package kscience.kmath.benchmarks - -import org.openjdk.jmh.annotations.Benchmark -import org.openjdk.jmh.annotations.Scope -import org.openjdk.jmh.annotations.State -import java.nio.IntBuffer - -@State(Scope.Benchmark) -internal class ArrayBenchmark { - @Benchmark - fun benchmarkArrayRead() { - var res = 0 - for (i in 1..size) res += array[size - i] - } - - @Benchmark - fun benchmarkBufferRead() { - var res = 0 - for (i in 1..size) res += arrayBuffer[size - i] - } - - @Benchmark - fun nativeBufferRead() { - var res = 0 - for (i in 1..size) res += nativeBuffer[size - i] - } - - companion object { - const val size: Int = 1000 - val array: IntArray = IntArray(size) { it } - val arrayBuffer: IntBuffer = IntBuffer.wrap(array) - val nativeBuffer: IntBuffer = IntBuffer.allocate(size).also { for (i in 0 until size) it.put(i, i) } - } -} diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ArrayBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ArrayBenchmark.kt new file mode 100644 index 000000000..535778844 --- /dev/null +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ArrayBenchmark.kt @@ -0,0 +1,34 @@ +package space.kscience.kmath.benchmarks + +import org.openjdk.jmh.annotations.Benchmark +import org.openjdk.jmh.annotations.Scope +import org.openjdk.jmh.annotations.State +import java.nio.IntBuffer + +@State(Scope.Benchmark) +internal class ArrayBenchmark { + @Benchmark + fun benchmarkArrayRead() { + var res = 0 + for (i in 1..space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.size) res += space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.array[space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.size - i] + } + + @Benchmark + fun benchmarkBufferRead() { + var res = 0 + for (i in 1..space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.size) res += space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.arrayBuffer[space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.size - i] + } + + @Benchmark + fun nativeBufferRead() { + var res = 0 + for (i in 1..space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.size) res += space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.nativeBuffer[space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.size - i] + } + + companion object { + const val size: Int = 1000 + val array: IntArray = IntArray(space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.size) { it } + val arrayBuffer: IntBuffer = IntBuffer.wrap(space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.array) + val nativeBuffer: IntBuffer = IntBuffer.allocate(space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.size).also { for (i in 0 until space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.size) it.put(i, i) } + } +} diff --git a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/BufferBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/BufferBenchmark.kt similarity index 74% rename from examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/BufferBenchmark.kt rename to examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/BufferBenchmark.kt index e14b393e2..1afb4e52c 100644 --- a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/BufferBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/BufferBenchmark.kt @@ -1,12 +1,12 @@ -package kscience.kmath.benchmarks +package space.kscience.kmath.benchmarks -import kscience.kmath.complex.Complex -import kscience.kmath.complex.complex -import kscience.kmath.structures.MutableBuffer -import kscience.kmath.structures.RealBuffer import org.openjdk.jmh.annotations.Benchmark import org.openjdk.jmh.annotations.Scope import org.openjdk.jmh.annotations.State +import space.kscience.kmath.complex.Complex +import space.kscience.kmath.complex.complex +import space.kscience.kmath.structures.MutableBuffer +import space.kscience.kmath.structures.RealBuffer @State(Scope.Benchmark) internal class BufferBenchmark { diff --git a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/DotBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt similarity index 76% rename from examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/DotBenchmark.kt rename to examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt index 48be30cef..39eeb24d3 100644 --- a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/DotBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt @@ -1,16 +1,16 @@ -package kscience.kmath.benchmarks +package space.kscience.kmath.benchmarks import kotlinx.benchmark.Benchmark -import kscience.kmath.commons.linear.CMMatrixContext -import kscience.kmath.ejml.EjmlMatrixContext -import kscience.kmath.linear.BufferMatrixContext -import kscience.kmath.linear.Matrix -import kscience.kmath.linear.RealMatrixContext -import kscience.kmath.operations.RealField -import kscience.kmath.operations.invoke -import kscience.kmath.structures.Buffer import org.openjdk.jmh.annotations.Scope import org.openjdk.jmh.annotations.State +import space.kscience.kmath.commons.linear.CMMatrixContext +import space.kscience.kmath.ejml.EjmlMatrixContext +import space.kscience.kmath.linear.BufferMatrixContext +import space.kscience.kmath.linear.Matrix +import space.kscience.kmath.linear.RealMatrixContext +import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.invoke +import space.kscience.kmath.structures.Buffer import kotlin.random.Random @State(Scope.Benchmark) diff --git a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt similarity index 50% rename from examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt rename to examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt index 9607dd499..a9c0fe703 100644 --- a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt @@ -1,27 +1,29 @@ -package kscience.kmath.benchmarks +package space.kscience.kmath.benchmarks -import kscience.kmath.asm.compile -import kscience.kmath.ast.MstField -import kscience.kmath.ast.mstInField -import kscience.kmath.expressions.Expression -import kscience.kmath.expressions.expressionInField -import kscience.kmath.expressions.invoke -import kscience.kmath.expressions.symbol -import kscience.kmath.operations.Field -import kscience.kmath.operations.RealField import org.openjdk.jmh.annotations.Benchmark import org.openjdk.jmh.annotations.Scope import org.openjdk.jmh.annotations.State +import space.kscience.kmath.asm.compile +import space.kscience.kmath.ast.mstInField +import space.kscience.kmath.expressions.Expression +import space.kscience.kmath.expressions.expressionInField +import space.kscience.kmath.expressions.invoke +import space.kscience.kmath.expressions.symbol +import space.kscience.kmath.operations.Field +import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.bindSymbol import kotlin.random.Random @State(Scope.Benchmark) internal class ExpressionsInterpretersBenchmark { private val algebra: Field = RealField + val x by symbol @Benchmark fun functionalExpression() { val expr = algebra.expressionInField { - symbol("x") * const(2.0) + const(2.0) / symbol("x") - const(16.0) + val x = bindSymbol(x) + x * const(2.0) + const(2.0) / x - const(16.0) } invokeAndSum(expr) @@ -30,7 +32,8 @@ internal class ExpressionsInterpretersBenchmark { @Benchmark fun mstExpression() { val expr = algebra.mstInField { - symbol("x") * 2.0 + 2.0 / symbol("x") - 16.0 + val x = bindSymbol(x) + x * 2.0 + 2.0 / x - 16.0 } invokeAndSum(expr) @@ -39,7 +42,8 @@ internal class ExpressionsInterpretersBenchmark { @Benchmark fun asmExpression() { val expr = algebra.mstInField { - MstField.symbol("x") * 2.0 + 2.0 / MstField.symbol("x") - 16.0 + val x = bindSymbol(x) + x * 2.0 + 2.0 / x - 16.0 }.compile() invokeAndSum(expr) @@ -47,8 +51,10 @@ internal class ExpressionsInterpretersBenchmark { @Benchmark fun rawExpression() { - val x by symbol - val expr = Expression { args -> args.getValue(x) * 2.0 + 2.0 / args.getValue(x) - 16.0 } + val expr = Expression { args -> + val x = args.getValue(x) + x * 2.0 + 2.0 / x - 16.0 + } invokeAndSum(expr) } @@ -57,7 +63,7 @@ internal class ExpressionsInterpretersBenchmark { var sum = 0.0 repeat(1000000) { - sum += expr("x" to random.nextDouble()) + sum += expr(x to random.nextDouble()) } println(sum) diff --git a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/LinearAlgebraBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/LinearAlgebraBenchmark.kt similarity index 64% rename from examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/LinearAlgebraBenchmark.kt rename to examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/LinearAlgebraBenchmark.kt index 2ebfee2e7..22e735e12 100644 --- a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/LinearAlgebraBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/LinearAlgebraBenchmark.kt @@ -1,17 +1,17 @@ -package kscience.kmath.benchmarks +package space.kscience.kmath.benchmarks import kotlinx.benchmark.Benchmark -import kscience.kmath.commons.linear.CMMatrixContext -import kscience.kmath.commons.linear.CMMatrixContext.dot -import kscience.kmath.commons.linear.inverse -import kscience.kmath.ejml.EjmlMatrixContext -import kscience.kmath.ejml.inverse -import kscience.kmath.linear.Matrix -import kscience.kmath.linear.MatrixContext -import kscience.kmath.linear.inverseWithLup -import kscience.kmath.linear.real import org.openjdk.jmh.annotations.Scope import org.openjdk.jmh.annotations.State +import space.kscience.kmath.commons.linear.CMMatrixContext +import space.kscience.kmath.commons.linear.CMMatrixContext.dot +import space.kscience.kmath.commons.linear.inverse +import space.kscience.kmath.ejml.EjmlMatrixContext +import space.kscience.kmath.ejml.inverse +import space.kscience.kmath.linear.Matrix +import space.kscience.kmath.linear.MatrixContext +import space.kscience.kmath.linear.inverseWithLup +import space.kscience.kmath.linear.real import kotlin.random.Random @State(Scope.Benchmark) diff --git a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/NDFieldBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/NDFieldBenchmark.kt similarity index 85% rename from examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/NDFieldBenchmark.kt rename to examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/NDFieldBenchmark.kt index caebf0497..5bcc09cdb 100644 --- a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/NDFieldBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/NDFieldBenchmark.kt @@ -1,11 +1,11 @@ -package kscience.kmath.benchmarks +package space.kscience.kmath.benchmarks -import kscience.kmath.nd.* -import kscience.kmath.operations.RealField -import kscience.kmath.structures.Buffer import org.openjdk.jmh.annotations.Benchmark import org.openjdk.jmh.annotations.Scope import org.openjdk.jmh.annotations.State +import space.kscience.kmath.nd.* +import space.kscience.kmath.operations.RealField +import space.kscience.kmath.structures.Buffer @State(Scope.Benchmark) internal class NDFieldBenchmark { diff --git a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/ViktorBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorBenchmark.kt similarity index 87% rename from examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/ViktorBenchmark.kt rename to examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorBenchmark.kt index 3f08481b3..370258bc6 100644 --- a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/ViktorBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorBenchmark.kt @@ -1,12 +1,12 @@ -package kscience.kmath.benchmarks +package space.kscience.kmath.benchmarks -import kscience.kmath.nd.* -import kscience.kmath.operations.RealField -import kscience.kmath.viktor.ViktorNDField import org.jetbrains.bio.viktor.F64Array import org.openjdk.jmh.annotations.Benchmark import org.openjdk.jmh.annotations.Scope import org.openjdk.jmh.annotations.State +import space.kscience.kmath.nd.* +import space.kscience.kmath.operations.RealField +import space.kscience.kmath.viktor.ViktorNDField @State(Scope.Benchmark) internal class ViktorBenchmark { diff --git a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/ViktorLogBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt similarity index 87% rename from examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/ViktorLogBenchmark.kt rename to examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt index 57f556e9e..9f99b002a 100644 --- a/examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/ViktorLogBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt @@ -1,12 +1,12 @@ -package kscience.kmath.benchmarks +package space.kscience.kmath.benchmarks -import kscience.kmath.nd.* -import kscience.kmath.operations.RealField -import kscience.kmath.viktor.ViktorNDField import org.jetbrains.bio.viktor.F64Array import org.openjdk.jmh.annotations.Benchmark import org.openjdk.jmh.annotations.Scope import org.openjdk.jmh.annotations.State +import space.kscience.kmath.nd.* +import space.kscience.kmath.operations.RealField +import space.kscience.kmath.viktor.ViktorNDField @State(Scope.Benchmark) internal class ViktorLogBenchmark { diff --git a/examples/src/main/kotlin/space/kscience/kmath/ast/expressions.kt b/examples/src/main/kotlin/space/kscience/kmath/ast/expressions.kt new file mode 100644 index 000000000..ee0f4a492 --- /dev/null +++ b/examples/src/main/kotlin/space/kscience/kmath/ast/expressions.kt @@ -0,0 +1,15 @@ +package space.kscience.kmath.ast + +import space.kscience.kmath.expressions.invoke +import space.kscience.kmath.operations.RealField + +fun main() { + val expr = RealField.mstInField { + val x = bindSymbol("x") + x * 2.0 + 2.0 / x - 16.0 + } + + repeat(10000000){ + expr.invoke("x" to 1.0) + } +} \ No newline at end of file diff --git a/examples/src/main/kotlin/kscience/kmath/ast/KotlingradSupport.kt b/examples/src/main/kotlin/space/kscience/kmath/ast/kotlingradSupport.kt similarity index 60% rename from examples/src/main/kotlin/kscience/kmath/ast/KotlingradSupport.kt rename to examples/src/main/kotlin/space/kscience/kmath/ast/kotlingradSupport.kt index b3c827503..16304a458 100644 --- a/examples/src/main/kotlin/kscience/kmath/ast/KotlingradSupport.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/ast/kotlingradSupport.kt @@ -1,11 +1,11 @@ -package kscience.kmath.ast +package space.kscience.kmath.ast -import kscience.kmath.asm.compile -import kscience.kmath.expressions.derivative -import kscience.kmath.expressions.invoke -import kscience.kmath.expressions.symbol -import kscience.kmath.kotlingrad.differentiable -import kscience.kmath.operations.RealField +import space.kscience.kmath.asm.compile +import space.kscience.kmath.expressions.derivative +import space.kscience.kmath.expressions.invoke +import space.kscience.kmath.expressions.symbol +import space.kscience.kmath.kotlingrad.differentiable +import space.kscience.kmath.operations.RealField /** * In this example, x^2-4*x-44 function is differentiated with Kotlin∇, and the autodiff result is compared with diff --git a/examples/src/main/kotlin/kscience/kmath/commons/fit/fitWithAutoDiff.kt b/examples/src/main/kotlin/space/kscience/kmath/commons/fit/fitWithAutoDiff.kt similarity index 83% rename from examples/src/main/kotlin/kscience/kmath/commons/fit/fitWithAutoDiff.kt rename to examples/src/main/kotlin/space/kscience/kmath/commons/fit/fitWithAutoDiff.kt index c0cd9dc5c..63b819dc9 100644 --- a/examples/src/main/kotlin/kscience/kmath/commons/fit/fitWithAutoDiff.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/commons/fit/fitWithAutoDiff.kt @@ -1,19 +1,19 @@ -package kscience.kmath.commons.fit +package space.kscience.kmath.commons.fit import kotlinx.html.br import kotlinx.html.h3 -import kscience.kmath.commons.optimization.chiSquared -import kscience.kmath.commons.optimization.minimize -import kscience.kmath.expressions.symbol -import kscience.kmath.real.RealVector -import kscience.kmath.real.map -import kscience.kmath.real.step -import kscience.kmath.stat.* -import kscience.kmath.structures.asIterable -import kscience.kmath.structures.toList import kscience.plotly.* import kscience.plotly.models.ScatterMode import kscience.plotly.models.TraceValues +import space.kscience.kmath.commons.optimization.chiSquared +import space.kscience.kmath.commons.optimization.minimize +import space.kscience.kmath.expressions.symbol +import space.kscience.kmath.real.RealVector +import space.kscience.kmath.real.map +import space.kscience.kmath.real.step +import space.kscience.kmath.stat.* +import space.kscience.kmath.structures.asIterable +import space.kscience.kmath.structures.toList import kotlin.math.pow import kotlin.math.sqrt @@ -63,7 +63,7 @@ fun main() { val a = bind(a) val b = bind(b) //Include default value for c if it is not provided as a parameter - val c = bindOrNull(c) ?: one + val c = bindSymbolOrNull(c) ?: one a * x1.pow(2) + b * x1 + c } diff --git a/examples/src/main/kotlin/kscience/kmath/operations/BigIntDemo.kt b/examples/src/main/kotlin/space/kscience/kmath/operations/BigIntDemo.kt similarity index 67% rename from examples/src/main/kotlin/kscience/kmath/operations/BigIntDemo.kt rename to examples/src/main/kotlin/space/kscience/kmath/operations/BigIntDemo.kt index 0e9811ff8..6d5903cae 100644 --- a/examples/src/main/kotlin/kscience/kmath/operations/BigIntDemo.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/operations/BigIntDemo.kt @@ -1,4 +1,4 @@ -package kscience.kmath.operations +package space.kscience.kmath.operations fun main() { val res = BigIntField { number(1) * 2 } diff --git a/examples/src/main/kotlin/kscience/kmath/operations/ComplexDemo.kt b/examples/src/main/kotlin/space/kscience/kmath/operations/ComplexDemo.kt similarity index 71% rename from examples/src/main/kotlin/kscience/kmath/operations/ComplexDemo.kt rename to examples/src/main/kotlin/space/kscience/kmath/operations/ComplexDemo.kt index 6641aad85..5330d9e40 100644 --- a/examples/src/main/kotlin/kscience/kmath/operations/ComplexDemo.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/operations/ComplexDemo.kt @@ -1,8 +1,8 @@ -package kscience.kmath.operations +package space.kscience.kmath.operations -import kscience.kmath.complex.Complex -import kscience.kmath.complex.complex -import kscience.kmath.nd.NDAlgebra +import space.kscience.kmath.complex.Complex +import space.kscience.kmath.complex.complex +import space.kscience.kmath.nd.NDAlgebra fun main() { // 2d element diff --git a/examples/src/main/kotlin/kscience/kmath/stat/DistributionBenchmark.kt b/examples/src/main/kotlin/space/kscience/kmath/stat/DistributionBenchmark.kt similarity index 98% rename from examples/src/main/kotlin/kscience/kmath/stat/DistributionBenchmark.kt rename to examples/src/main/kotlin/space/kscience/kmath/stat/DistributionBenchmark.kt index 99d3cd504..1761ed1b5 100644 --- a/examples/src/main/kotlin/kscience/kmath/stat/DistributionBenchmark.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/stat/DistributionBenchmark.kt @@ -3,9 +3,9 @@ package kscience.kmath.commons.prob import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.async import kotlinx.coroutines.runBlocking -import kscience.kmath.stat.* import org.apache.commons.rng.sampling.distribution.ZigguratNormalizedGaussianSampler import org.apache.commons.rng.simple.RandomSource +import space.kscience.kmath.stat.* import java.time.Duration import java.time.Instant diff --git a/examples/src/main/kotlin/kscience/kmath/stat/DistributionDemo.kt b/examples/src/main/kotlin/space/kscience/kmath/stat/DistributionDemo.kt similarity index 85% rename from examples/src/main/kotlin/kscience/kmath/stat/DistributionDemo.kt rename to examples/src/main/kotlin/space/kscience/kmath/stat/DistributionDemo.kt index 24a4cb1a7..47b8d8111 100644 --- a/examples/src/main/kotlin/kscience/kmath/stat/DistributionDemo.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/stat/DistributionDemo.kt @@ -1,8 +1,8 @@ -package kscience.kmath.stat +package space.kscience.kmath.stat import kotlinx.coroutines.runBlocking -import kscience.kmath.chains.Chain -import kscience.kmath.chains.collectWithState +import space.kscience.kmath.chains.Chain +import space.kscience.kmath.chains.collectWithState /** * The state of distribution averager diff --git a/examples/src/main/kotlin/kscience/kmath/structures/ComplexND.kt b/examples/src/main/kotlin/space/kscience/kmath/structures/ComplexND.kt similarity index 80% rename from examples/src/main/kotlin/kscience/kmath/structures/ComplexND.kt rename to examples/src/main/kotlin/space/kscience/kmath/structures/ComplexND.kt index 2c0254139..b8cbc9a57 100644 --- a/examples/src/main/kotlin/kscience/kmath/structures/ComplexND.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/structures/ComplexND.kt @@ -1,14 +1,14 @@ @file:Suppress("unused") -package kscience.kmath.structures +package space.kscience.kmath.structures -import kscience.kmath.complex.* -import kscience.kmath.linear.transpose -import kscience.kmath.nd.NDAlgebra -import kscience.kmath.nd.NDStructure -import kscience.kmath.nd.as2D -import kscience.kmath.nd.real -import kscience.kmath.operations.invoke +import space.kscience.kmath.complex.* +import space.kscience.kmath.linear.transpose +import space.kscience.kmath.nd.NDAlgebra +import space.kscience.kmath.nd.NDStructure +import space.kscience.kmath.nd.as2D +import space.kscience.kmath.nd.real +import space.kscience.kmath.operations.invoke import kotlin.system.measureTimeMillis fun main() { diff --git a/examples/src/main/kotlin/kscience/kmath/structures/NDField.kt b/examples/src/main/kotlin/space/kscience/kmath/structures/NDField.kt similarity index 90% rename from examples/src/main/kotlin/kscience/kmath/structures/NDField.kt rename to examples/src/main/kotlin/space/kscience/kmath/structures/NDField.kt index 1e7a19cf8..10fb3cb3d 100644 --- a/examples/src/main/kotlin/kscience/kmath/structures/NDField.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/structures/NDField.kt @@ -1,12 +1,12 @@ -package kscience.kmath.structures +package space.kscience.kmath.structures import kotlinx.coroutines.GlobalScope -import kscience.kmath.nd.* -import kscience.kmath.nd4j.Nd4jArrayField -import kscience.kmath.operations.RealField -import kscience.kmath.operations.invoke -import kscience.kmath.viktor.ViktorNDField import org.nd4j.linalg.factory.Nd4j +import space.kscience.kmath.nd.* +import space.kscience.kmath.nd4j.Nd4jArrayField +import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.invoke +import space.kscience.kmath.viktor.ViktorNDField import kotlin.contracts.InvocationKind import kotlin.contracts.contract import kotlin.system.measureTimeMillis diff --git a/examples/src/main/kotlin/kscience/kmath/structures/ParallelRealNDField.kt b/examples/src/main/kotlin/space/kscience/kmath/structures/ParallelRealNDField.kt similarity index 92% rename from examples/src/main/kotlin/kscience/kmath/structures/ParallelRealNDField.kt rename to examples/src/main/kotlin/space/kscience/kmath/structures/ParallelRealNDField.kt index 48286c140..111cfec80 100644 --- a/examples/src/main/kotlin/kscience/kmath/structures/ParallelRealNDField.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/structures/ParallelRealNDField.kt @@ -1,10 +1,10 @@ -package kscience.kmath.structures +package space.kscience.kmath.structures -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.nd.* -import kscience.kmath.operations.ExtendedField -import kscience.kmath.operations.RealField -import kscience.kmath.operations.RingWithNumbers +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.nd.* +import space.kscience.kmath.operations.ExtendedField +import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.RingWithNumbers import java.util.* import java.util.stream.IntStream diff --git a/examples/src/main/kotlin/kscience/kmath/structures/StructureReadBenchmark.kt b/examples/src/main/kotlin/space/kscience/kmath/structures/StructureReadBenchmark.kt similarity index 87% rename from examples/src/main/kotlin/kscience/kmath/structures/StructureReadBenchmark.kt rename to examples/src/main/kotlin/space/kscience/kmath/structures/StructureReadBenchmark.kt index ba7bcb5f2..cfb3bdf7f 100644 --- a/examples/src/main/kotlin/kscience/kmath/structures/StructureReadBenchmark.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/structures/StructureReadBenchmark.kt @@ -1,7 +1,7 @@ -package kscience.kmath.structures +package space.kscience.kmath.structures -import kscience.kmath.nd.DefaultStrides -import kscience.kmath.nd.NDBuffer +import space.kscience.kmath.nd.DefaultStrides +import space.kscience.kmath.nd.NDBuffer import kotlin.system.measureTimeMillis fun main() { diff --git a/examples/src/main/kotlin/kscience/kmath/structures/StructureWriteBenchmark.kt b/examples/src/main/kotlin/space/kscience/kmath/structures/StructureWriteBenchmark.kt similarity index 87% rename from examples/src/main/kotlin/kscience/kmath/structures/StructureWriteBenchmark.kt rename to examples/src/main/kotlin/space/kscience/kmath/structures/StructureWriteBenchmark.kt index 307b068df..c0d97f9ab 100644 --- a/examples/src/main/kotlin/kscience/kmath/structures/StructureWriteBenchmark.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/structures/StructureWriteBenchmark.kt @@ -1,7 +1,7 @@ -package kscience.kmath.structures +package space.kscience.kmath.structures -import kscience.kmath.nd.NDStructure -import kscience.kmath.nd.mapToBuffer +import space.kscience.kmath.nd.NDStructure +import space.kscience.kmath.nd.mapToBuffer import kotlin.system.measureTimeMillis fun main() { diff --git a/examples/src/main/kotlin/kscience/kmath/structures/typeSafeDimensions.kt b/examples/src/main/kotlin/space/kscience/kmath/structures/typeSafeDimensions.kt similarity index 73% rename from examples/src/main/kotlin/kscience/kmath/structures/typeSafeDimensions.kt rename to examples/src/main/kotlin/space/kscience/kmath/structures/typeSafeDimensions.kt index 96684f7dc..fdd631238 100644 --- a/examples/src/main/kotlin/kscience/kmath/structures/typeSafeDimensions.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/structures/typeSafeDimensions.kt @@ -1,9 +1,9 @@ -package kscience.kmath.structures +package space.kscience.kmath.structures -import kscience.kmath.dimensions.D2 -import kscience.kmath.dimensions.D3 -import kscience.kmath.dimensions.DMatrixContext -import kscience.kmath.dimensions.Dimension +import space.kscience.kmath.dimensions.D2 +import space.kscience.kmath.dimensions.D3 +import space.kscience.kmath.dimensions.DMatrixContext +import space.kscience.kmath.dimensions.Dimension private fun DMatrixContext.simple() { val m1 = produce { i, j -> (i + j).toDouble() } diff --git a/kmath-ast/README.md b/kmath-ast/README.md index c54c4afb1..f5d6a3ea5 100644 --- a/kmath-ast/README.md +++ b/kmath-ast/README.md @@ -68,9 +68,9 @@ package kscience.kmath.asm.generated; import java.util.Map; import kotlin.jvm.functions.Function2; -import kscience.kmath.asm.internal.MapIntrinsics; -import kscience.kmath.expressions.Expression; -import kscience.kmath.expressions.Symbol; +import space.kscience.kmath.asm.internal.MapIntrinsics; +import space.kscience.kmath.expressions.Expression; +import space.kscience.kmath.expressions.Symbol; public final class AsmCompiledExpression_45045_0 implements Expression { private final Object[] constants; diff --git a/kmath-ast/docs/README-TEMPLATE.md b/kmath-ast/docs/README-TEMPLATE.md index ebaa6246a..d44d09bc5 100644 --- a/kmath-ast/docs/README-TEMPLATE.md +++ b/kmath-ast/docs/README-TEMPLATE.md @@ -26,9 +26,9 @@ package kscience.kmath.asm.generated; import java.util.Map; import kotlin.jvm.functions.Function2; -import kscience.kmath.asm.internal.MapIntrinsics; -import kscience.kmath.expressions.Expression; -import kscience.kmath.expressions.Symbol; +import space.kscience.kmath.asm.internal.MapIntrinsics; +import space.kscience.kmath.expressions.Expression; +import space.kscience.kmath.expressions.Symbol; public final class AsmCompiledExpression_45045_0 implements Expression { private final Object[] constants; diff --git a/kmath-ast/src/commonMain/kotlin/kscience/kmath/ast/MST.kt b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MST.kt similarity index 93% rename from kmath-ast/src/commonMain/kotlin/kscience/kmath/ast/MST.kt rename to kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MST.kt index 212fd0d0b..c459d7ff5 100644 --- a/kmath-ast/src/commonMain/kotlin/kscience/kmath/ast/MST.kt +++ b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MST.kt @@ -1,7 +1,7 @@ -package kscience.kmath.ast +package space.kscience.kmath.ast -import kscience.kmath.operations.Algebra -import kscience.kmath.operations.NumericAlgebra +import space.kscience.kmath.operations.Algebra +import space.kscience.kmath.operations.NumericAlgebra /** * A Mathematical Syntax Tree (MST) node for mathematical expressions. @@ -55,7 +55,7 @@ public fun Algebra.evaluate(node: MST): T = when (node) { is MST.Numeric -> (this as? NumericAlgebra)?.number(node.value) ?: error("Numeric nodes are not supported by $this") - is MST.Symbolic -> symbol(node.value) + is MST.Symbolic -> bindSymbol(node.value) is MST.Unary -> when { this is NumericAlgebra && node.value is MST.Numeric -> unaryOperationFunction(node.operation)(number(node.value.value)) diff --git a/kmath-ast/src/commonMain/kotlin/kscience/kmath/ast/MstAlgebra.kt b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt similarity index 92% rename from kmath-ast/src/commonMain/kotlin/kscience/kmath/ast/MstAlgebra.kt rename to kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt index eadbc85ee..7bea65684 100644 --- a/kmath-ast/src/commonMain/kotlin/kscience/kmath/ast/MstAlgebra.kt +++ b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt @@ -1,14 +1,14 @@ -package kscience.kmath.ast +package space.kscience.kmath.ast -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.operations.* +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.operations.* /** * [Algebra] over [MST] nodes. */ public object MstAlgebra : NumericAlgebra { public override fun number(value: Number): MST.Numeric = MST.Numeric(value) - public override fun symbol(value: String): MST.Symbolic = MST.Symbolic(value) + public override fun bindSymbol(value: String): MST.Symbolic = MST.Symbolic(value) public override fun unaryOperationFunction(operation: String): (arg: MST) -> MST.Unary = { arg -> MST.Unary(operation, arg) } @@ -24,7 +24,7 @@ public object MstSpace : Space, NumericAlgebra { public override val zero: MST.Numeric by lazy { number(0.0) } public override fun number(value: Number): MST.Numeric = MstAlgebra.number(value) - public override fun symbol(value: String): MST.Symbolic = MstAlgebra.symbol(value) + public override fun bindSymbol(value: String): MST.Symbolic = MstAlgebra.bindSymbol(value) public override fun add(a: MST, b: MST): MST.Binary = binaryOperationFunction(SpaceOperations.PLUS_OPERATION)(a, b) public override operator fun MST.unaryPlus(): MST.Unary = unaryOperationFunction(SpaceOperations.PLUS_OPERATION)(this) @@ -56,7 +56,7 @@ public object MstRing : Ring, RingWithNumbers { public override val one: MST.Numeric by lazy { number(1.0) } public override fun number(value: Number): MST.Numeric = MstSpace.number(value) - public override fun symbol(value: String): MST.Symbolic = MstSpace.symbol(value) + public override fun bindSymbol(value: String): MST.Symbolic = MstSpace.bindSymbol(value) public override fun add(a: MST, b: MST): MST.Binary = MstSpace.add(a, b) public override fun multiply(a: MST, k: Number): MST.Binary = MstSpace.multiply(a, k) public override fun multiply(a: MST, b: MST): MST.Binary = @@ -84,7 +84,7 @@ public object MstField : Field, RingWithNumbers { public override val one: MST.Numeric get() = MstRing.one - public override fun symbol(value: String): MST.Symbolic = MstRing.symbol(value) + public override fun bindSymbol(value: String): MST.Symbolic = MstRing.bindSymbol(value) public override fun number(value: Number): MST.Numeric = MstRing.number(value) public override fun add(a: MST, b: MST): MST.Binary = MstRing.add(a, b) public override fun multiply(a: MST, k: Number): MST.Binary = MstRing.multiply(a, k) @@ -113,7 +113,7 @@ public object MstExtendedField : ExtendedField, NumericAlgebra { public override val one: MST.Numeric get() = MstField.one - public override fun symbol(value: String): MST.Symbolic = MstField.symbol(value) + public override fun bindSymbol(value: String): MST.Symbolic = MstField.bindSymbol(value) public override fun number(value: Number): MST.Numeric = MstRing.number(value) public override fun sin(arg: MST): MST.Unary = unaryOperationFunction(TrigonometricOperations.SIN_OPERATION)(arg) public override fun cos(arg: MST): MST.Unary = unaryOperationFunction(TrigonometricOperations.COS_OPERATION)(arg) diff --git a/kmath-ast/src/commonMain/kotlin/kscience/kmath/ast/MstExpression.kt b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstExpression.kt similarity index 95% rename from kmath-ast/src/commonMain/kotlin/kscience/kmath/ast/MstExpression.kt rename to kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstExpression.kt index 03d33aa2b..39650036f 100644 --- a/kmath-ast/src/commonMain/kotlin/kscience/kmath/ast/MstExpression.kt +++ b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstExpression.kt @@ -1,7 +1,7 @@ -package kscience.kmath.ast +package space.kscience.kmath.ast -import kscience.kmath.expressions.* -import kscience.kmath.operations.* +import space.kscience.kmath.expressions.* +import space.kscience.kmath.operations.* import kotlin.contracts.InvocationKind import kotlin.contracts.contract @@ -15,8 +15,8 @@ import kotlin.contracts.contract */ public class MstExpression>(public val algebra: A, public val mst: MST) : Expression { private inner class InnerAlgebra(val arguments: Map) : NumericAlgebra { - override fun symbol(value: String): T = try { - algebra.symbol(value) + override fun bindSymbol(value: String): T = try { + algebra.bindSymbol(value) } catch (ignored: IllegalStateException) { null } ?: arguments.getValue(StringSymbol(value)) diff --git a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/astring/astring.typealises.kt b/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/astring/astring.typealises.kt deleted file mode 100644 index 5a7fe4f16..000000000 --- a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/astring/astring.typealises.kt +++ /dev/null @@ -1,3 +0,0 @@ -package kscience.kmath.estree.internal.astring - -internal typealias Generator = Any diff --git a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/stream/stream.kt b/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/stream/stream.kt deleted file mode 100644 index b3c65a758..000000000 --- a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/stream/stream.kt +++ /dev/null @@ -1,7 +0,0 @@ -package kscience.kmath.estree.internal.stream - -import kscience.kmath.estree.internal.emitter.Emitter - -internal open external class Stream : Emitter { - open fun pipe(dest: Any, options: Any): Any -} diff --git a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/estree.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/estree.kt similarity index 82% rename from kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/estree.kt rename to kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/estree.kt index 5c08ada31..0bd9a386d 100644 --- a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/estree.kt +++ b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/estree.kt @@ -1,20 +1,20 @@ -package kscience.kmath.estree +package space.kscience.kmath.estree -import kscience.kmath.ast.MST -import kscience.kmath.ast.MST.* -import kscience.kmath.ast.MstExpression -import kscience.kmath.estree.internal.ESTreeBuilder -import kscience.kmath.estree.internal.estree.BaseExpression -import kscience.kmath.expressions.Expression -import kscience.kmath.operations.Algebra -import kscience.kmath.operations.NumericAlgebra +import space.kscience.kmath.ast.MST +import space.kscience.kmath.ast.MST.* +import space.kscience.kmath.ast.MstExpression +import space.kscience.kmath.estree.internal.ESTreeBuilder +import space.kscience.kmath.estree.internal.estree.BaseExpression +import space.kscience.kmath.expressions.Expression +import space.kscience.kmath.operations.Algebra +import space.kscience.kmath.operations.NumericAlgebra @PublishedApi internal fun MST.compileWith(algebra: Algebra): Expression { fun ESTreeBuilder.visit(node: MST): BaseExpression = when (node) { is Symbolic -> { val symbol = try { - algebra.symbol(node.value) + algebra.bindSymbol(node.value) } catch (ignored: IllegalStateException) { null } diff --git a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/ESTreeBuilder.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/ESTreeBuilder.kt similarity index 90% rename from kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/ESTreeBuilder.kt rename to kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/ESTreeBuilder.kt index e1823813a..b4de9968d 100644 --- a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/ESTreeBuilder.kt +++ b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/ESTreeBuilder.kt @@ -1,9 +1,9 @@ -package kscience.kmath.estree.internal +package space.kscience.kmath.estree.internal -import kscience.kmath.estree.internal.astring.generate -import kscience.kmath.estree.internal.estree.* -import kscience.kmath.expressions.Expression -import kscience.kmath.expressions.Symbol +import space.kscience.kmath.estree.internal.astring.generate +import space.kscience.kmath.estree.internal.estree.* +import space.kscience.kmath.expressions.Expression +import space.kscience.kmath.expressions.Symbol internal class ESTreeBuilder(val bodyCallback: ESTreeBuilder.() -> BaseExpression) { private class GeneratedExpression(val executable: dynamic, val constants: Array) : Expression { diff --git a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/astring/astring.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/astring/astring.kt similarity index 88% rename from kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/astring/astring.kt rename to kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/astring/astring.kt index cf0a8de25..1b7500ddb 100644 --- a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/astring/astring.kt +++ b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/astring/astring.kt @@ -1,9 +1,9 @@ @file:JsModule("astring") @file:JsNonModule -package kscience.kmath.estree.internal.astring +package space.kscience.kmath.estree.internal.astring -import kscience.kmath.estree.internal.estree.BaseNode +import space.kscience.kmath.estree.internal.estree.BaseNode internal external interface Options { var indent: String? diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/astring/astring.typealises.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/astring/astring.typealises.kt new file mode 100644 index 000000000..9e75a97c7 --- /dev/null +++ b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/astring/astring.typealises.kt @@ -0,0 +1,3 @@ +package space.kscience.kmath.estree.internal.astring + +internal typealias Generator = Any diff --git a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/emitter/emitter.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/emitter/emitter.kt similarity index 87% rename from kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/emitter/emitter.kt rename to kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/emitter/emitter.kt index 1e0a95a16..3028656f5 100644 --- a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/emitter/emitter.kt +++ b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/emitter/emitter.kt @@ -1,4 +1,4 @@ -package kscience.kmath.estree.internal.emitter +package space.kscience.kmath.estree.internal.emitter internal open external class Emitter { constructor(obj: Any) diff --git a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/estree/estree.extensions.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/estree/estree.extensions.kt similarity index 97% rename from kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/estree/estree.extensions.kt rename to kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/estree/estree.extensions.kt index 5bc197d0c..0e088c717 100644 --- a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/estree/estree.extensions.kt +++ b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/estree/estree.extensions.kt @@ -1,4 +1,4 @@ -package kscience.kmath.estree.internal.estree +package space.kscience.kmath.estree.internal.estree internal fun Program(sourceType: String, vararg body: dynamic) = object : Program { override var type = "Program" diff --git a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/estree/estree.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/estree/estree.kt similarity index 99% rename from kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/estree/estree.kt rename to kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/estree/estree.kt index a5385d1ee..4dc1bfc10 100644 --- a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/estree/estree.kt +++ b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/estree/estree.kt @@ -1,4 +1,4 @@ -package kscience.kmath.estree.internal.estree +package space.kscience.kmath.estree.internal.estree import kotlin.js.RegExp diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/stream/stream.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/stream/stream.kt new file mode 100644 index 000000000..c3477c482 --- /dev/null +++ b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/stream/stream.kt @@ -0,0 +1,7 @@ +package space.kscience.kmath.estree.internal.stream + +import space.kscience.kmath.estree.internal.emitter.Emitter + +internal open external class Stream : Emitter { + open fun pipe(dest: Any, options: Any): Any +} diff --git a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/tsstdlib/lib.es2015.iterable.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/tsstdlib/lib.es2015.iterable.kt similarity index 93% rename from kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/tsstdlib/lib.es2015.iterable.kt rename to kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/tsstdlib/lib.es2015.iterable.kt index 22d4dd8e0..7f2975219 100644 --- a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/tsstdlib/lib.es2015.iterable.kt +++ b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/tsstdlib/lib.es2015.iterable.kt @@ -1,4 +1,4 @@ -package kscience.kmath.estree.internal.tsstdlib +package space.kscience.kmath.estree.internal.tsstdlib internal external interface IteratorYieldResult { var done: Boolean? diff --git a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/tsstdlib/lib.es5.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/tsstdlib/lib.es5.kt similarity index 97% rename from kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/tsstdlib/lib.es5.kt rename to kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/tsstdlib/lib.es5.kt index 70f6d9702..7286b4a20 100644 --- a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/tsstdlib/lib.es5.kt +++ b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/tsstdlib/lib.es5.kt @@ -1,6 +1,6 @@ @file:Suppress("UNUSED_TYPEALIAS_PARAMETER", "DEPRECATION") -package kscience.kmath.estree.internal.tsstdlib +package space.kscience.kmath.estree.internal.tsstdlib import kotlin.js.RegExp diff --git a/kmath-ast/src/jsTest/kotlin/kscience/kmath/estree/TestESTreeConsistencyWithInterpreter.kt b/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeConsistencyWithInterpreter.kt similarity index 76% rename from kmath-ast/src/jsTest/kotlin/kscience/kmath/estree/TestESTreeConsistencyWithInterpreter.kt rename to kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeConsistencyWithInterpreter.kt index ff10c8a43..492a5d11f 100644 --- a/kmath-ast/src/jsTest/kotlin/kscience/kmath/estree/TestESTreeConsistencyWithInterpreter.kt +++ b/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeConsistencyWithInterpreter.kt @@ -1,11 +1,11 @@ -package kscience.kmath.estree +package space.kscience.kmath.estree -import kscience.kmath.ast.* -import kscience.kmath.complex.ComplexField -import kscience.kmath.complex.toComplex -import kscience.kmath.expressions.invoke -import kscience.kmath.operations.ByteRing -import kscience.kmath.operations.RealField +import space.kscience.kmath.ast.* +import space.kscience.kmath.complex.ComplexField +import space.kscience.kmath.complex.toComplex +import space.kscience.kmath.expressions.invoke +import space.kscience.kmath.operations.ByteRing +import space.kscience.kmath.operations.RealField import kotlin.test.Test import kotlin.test.assertEquals @@ -22,7 +22,7 @@ internal class TestESTreeConsistencyWithInterpreter { ), number(1) - ) + symbol("x") + zero + ) + bindSymbol("x") + zero }("x" to MST.Numeric(2)) val res2 = MstSpace.mstInSpace { @@ -35,7 +35,7 @@ internal class TestESTreeConsistencyWithInterpreter { ), number(1) - ) + symbol("x") + zero + ) + bindSymbol("x") + zero }.compile()("x" to MST.Numeric(2)) assertEquals(res1, res2) @@ -46,7 +46,7 @@ internal class TestESTreeConsistencyWithInterpreter { val res1 = ByteRing.mstInRing { binaryOperationFunction("+")( unaryOperationFunction("+")( - (symbol("x") - (2.toByte() + (multiply( + (bindSymbol("x") - (2.toByte() + (multiply( add(number(1), number(1)), 2 ) + 1.toByte()))) * 3.0 - 1.toByte() @@ -59,7 +59,7 @@ internal class TestESTreeConsistencyWithInterpreter { val res2 = ByteRing.mstInRing { binaryOperationFunction("+")( unaryOperationFunction("+")( - (symbol("x") - (2.toByte() + (multiply( + (bindSymbol("x") - (2.toByte() + (multiply( add(number(1), number(1)), 2 ) + 1.toByte()))) * 3.0 - 1.toByte() @@ -75,7 +75,7 @@ internal class TestESTreeConsistencyWithInterpreter { fun realField() { val res1 = RealField.mstInField { +(3 - 2 + 2 * number(1) + 1.0) + binaryOperationFunction("+")( - (3.0 - (symbol("x") + (multiply(add(number(1.0), number(1.0)), 2) + 1.0))) * 3 - 1.0 + (3.0 - (bindSymbol("x") + (multiply(add(number(1.0), number(1.0)), 2) + 1.0))) * 3 - 1.0 + number(1), number(1) / 2 + number(2.0) * one ) + zero @@ -83,7 +83,7 @@ internal class TestESTreeConsistencyWithInterpreter { val res2 = RealField.mstInField { +(3 - 2 + 2 * number(1) + 1.0) + binaryOperationFunction("+")( - (3.0 - (symbol("x") + (multiply(add(number(1.0), number(1.0)), 2) + 1.0))) * 3 - 1.0 + (3.0 - (bindSymbol("x") + (multiply(add(number(1.0), number(1.0)), 2) + 1.0))) * 3 - 1.0 + number(1), number(1) / 2 + number(2.0) * one ) + zero @@ -96,7 +96,7 @@ internal class TestESTreeConsistencyWithInterpreter { fun complexField() { val res1 = ComplexField.mstInField { +(3 - 2 + 2 * number(1) + 1.0) + binaryOperationFunction("+")( - (3.0 - (symbol("x") + (multiply(add(number(1.0), number(1.0)), 2) + 1.0))) * 3 - 1.0 + (3.0 - (bindSymbol("x") + (multiply(add(number(1.0), number(1.0)), 2) + 1.0))) * 3 - 1.0 + number(1), number(1) / 2 + number(2.0) * one ) + zero @@ -104,7 +104,7 @@ internal class TestESTreeConsistencyWithInterpreter { val res2 = ComplexField.mstInField { +(3 - 2 + 2 * number(1) + 1.0) + binaryOperationFunction("+")( - (3.0 - (symbol("x") + (multiply(add(number(1.0), number(1.0)), 2) + 1.0))) * 3 - 1.0 + (3.0 - (bindSymbol("x") + (multiply(add(number(1.0), number(1.0)), 2) + 1.0))) * 3 - 1.0 + number(1), number(1) / 2 + number(2.0) * one ) + zero diff --git a/kmath-ast/src/jsTest/kotlin/kscience/kmath/estree/TestESTreeOperationsSupport.kt b/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeOperationsSupport.kt similarity index 50% rename from kmath-ast/src/jsTest/kotlin/kscience/kmath/estree/TestESTreeOperationsSupport.kt rename to kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeOperationsSupport.kt index 72a4669d9..6e2f85327 100644 --- a/kmath-ast/src/jsTest/kotlin/kscience/kmath/estree/TestESTreeOperationsSupport.kt +++ b/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeOperationsSupport.kt @@ -1,10 +1,10 @@ -package kscience.kmath.estree +package space.kscience.kmath.estree -import kscience.kmath.ast.mstInExtendedField -import kscience.kmath.ast.mstInField -import kscience.kmath.ast.mstInSpace -import kscience.kmath.expressions.invoke -import kscience.kmath.operations.RealField +import space.kscience.kmath.ast.mstInExtendedField +import space.kscience.kmath.ast.mstInField +import space.kscience.kmath.ast.mstInSpace +import space.kscience.kmath.expressions.invoke +import space.kscience.kmath.operations.RealField import kotlin.random.Random import kotlin.test.Test import kotlin.test.assertEquals @@ -12,27 +12,27 @@ import kotlin.test.assertEquals internal class TestESTreeOperationsSupport { @Test fun testUnaryOperationInvocation() { - val expression = RealField.mstInSpace { -symbol("x") }.compile() + val expression = RealField.mstInSpace { -bindSymbol("x") }.compile() val res = expression("x" to 2.0) assertEquals(-2.0, res) } @Test fun testBinaryOperationInvocation() { - val expression = RealField.mstInSpace { -symbol("x") + number(1.0) }.compile() + val expression = RealField.mstInSpace { -bindSymbol("x") + number(1.0) }.compile() val res = expression("x" to 2.0) assertEquals(-1.0, res) } @Test fun testConstProductInvocation() { - val res = RealField.mstInField { symbol("x") * 2 }("x" to 2.0) + val res = RealField.mstInField { bindSymbol("x") * 2 }("x" to 2.0) assertEquals(4.0, res) } @Test fun testMultipleCalls() { - val e = RealField.mstInExtendedField { sin(symbol("x")).pow(4) - 6 * symbol("x") / tanh(symbol("x")) }.compile() + val e = RealField.mstInExtendedField { sin(bindSymbol("x")).pow(4) - 6 * bindSymbol("x") / tanh(bindSymbol("x")) }.compile() val r = Random(0) var s = 0.0 repeat(1000000) { s += e("x" to r.nextDouble()) } diff --git a/kmath-ast/src/jsTest/kotlin/kscience/kmath/estree/TestESTreeSpecialization.kt b/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeSpecialization.kt similarity index 68% rename from kmath-ast/src/jsTest/kotlin/kscience/kmath/estree/TestESTreeSpecialization.kt rename to kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeSpecialization.kt index 9d0d17e58..c5e43241a 100644 --- a/kmath-ast/src/jsTest/kotlin/kscience/kmath/estree/TestESTreeSpecialization.kt +++ b/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeSpecialization.kt @@ -1,52 +1,52 @@ -package kscience.kmath.estree +package space.kscience.kmath.estree -import kscience.kmath.ast.mstInField -import kscience.kmath.expressions.invoke -import kscience.kmath.operations.RealField +import space.kscience.kmath.ast.mstInField +import space.kscience.kmath.expressions.invoke +import space.kscience.kmath.operations.RealField import kotlin.test.Test import kotlin.test.assertEquals internal class TestESTreeSpecialization { @Test fun testUnaryPlus() { - val expr = RealField.mstInField { unaryOperationFunction("+")(symbol("x")) }.compile() + val expr = RealField.mstInField { unaryOperationFunction("+")(bindSymbol("x")) }.compile() assertEquals(2.0, expr("x" to 2.0)) } @Test fun testUnaryMinus() { - val expr = RealField.mstInField { unaryOperationFunction("-")(symbol("x")) }.compile() + val expr = RealField.mstInField { unaryOperationFunction("-")(bindSymbol("x")) }.compile() assertEquals(-2.0, expr("x" to 2.0)) } @Test fun testAdd() { - val expr = RealField.mstInField { binaryOperationFunction("+")(symbol("x"), symbol("x")) }.compile() + val expr = RealField.mstInField { binaryOperationFunction("+")(bindSymbol("x"), bindSymbol("x")) }.compile() assertEquals(4.0, expr("x" to 2.0)) } @Test fun testSine() { - val expr = RealField.mstInField { unaryOperationFunction("sin")(symbol("x")) }.compile() + val expr = RealField.mstInField { unaryOperationFunction("sin")(bindSymbol("x")) }.compile() assertEquals(0.0, expr("x" to 0.0)) } @Test fun testMinus() { - val expr = RealField.mstInField { binaryOperationFunction("-")(symbol("x"), symbol("x")) }.compile() + val expr = RealField.mstInField { binaryOperationFunction("-")(bindSymbol("x"), bindSymbol("x")) }.compile() assertEquals(0.0, expr("x" to 2.0)) } @Test fun testDivide() { - val expr = RealField.mstInField { binaryOperationFunction("/")(symbol("x"), symbol("x")) }.compile() + val expr = RealField.mstInField { binaryOperationFunction("/")(bindSymbol("x"), bindSymbol("x")) }.compile() assertEquals(1.0, expr("x" to 2.0)) } @Test fun testPower() { val expr = RealField - .mstInField { binaryOperationFunction("pow")(symbol("x"), number(2)) } + .mstInField { binaryOperationFunction("pow")(bindSymbol("x"), number(2)) } .compile() assertEquals(4.0, expr("x" to 2.0)) diff --git a/kmath-ast/src/jsTest/kotlin/kscience/kmath/estree/TestESTreeVariables.kt b/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeVariables.kt similarity index 52% rename from kmath-ast/src/jsTest/kotlin/kscience/kmath/estree/TestESTreeVariables.kt rename to kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeVariables.kt index 846120ee2..ee8f4c6f5 100644 --- a/kmath-ast/src/jsTest/kotlin/kscience/kmath/estree/TestESTreeVariables.kt +++ b/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeVariables.kt @@ -1,8 +1,8 @@ -package kscience.kmath.estree +package space.kscience.kmath.estree -import kscience.kmath.ast.mstInRing -import kscience.kmath.expressions.invoke -import kscience.kmath.operations.ByteRing +import space.kscience.kmath.ast.mstInRing +import space.kscience.kmath.expressions.invoke +import space.kscience.kmath.operations.ByteRing import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFailsWith @@ -10,13 +10,13 @@ import kotlin.test.assertFailsWith internal class TestESTreeVariables { @Test fun testVariable() { - val expr = ByteRing.mstInRing { symbol("x") }.compile() + val expr = ByteRing.mstInRing { bindSymbol("x") }.compile() assertEquals(1.toByte(), expr("x" to 1.toByte())) } @Test fun testUndefinedVariableFails() { - val expr = ByteRing.mstInRing { symbol("x") }.compile() + val expr = ByteRing.mstInRing { bindSymbol("x") }.compile() assertFailsWith { expr() } } } diff --git a/kmath-ast/src/jvmMain/kotlin/kscience/kmath/asm/asm.kt b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/asm.kt similarity index 84% rename from kmath-ast/src/jvmMain/kotlin/kscience/kmath/asm/asm.kt rename to kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/asm.kt index 55cdec243..8875bd715 100644 --- a/kmath-ast/src/jvmMain/kotlin/kscience/kmath/asm/asm.kt +++ b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/asm.kt @@ -1,13 +1,13 @@ -package kscience.kmath.asm +package space.kscience.kmath.asm -import kscience.kmath.asm.internal.AsmBuilder -import kscience.kmath.asm.internal.buildName -import kscience.kmath.ast.MST -import kscience.kmath.ast.MST.* -import kscience.kmath.ast.MstExpression -import kscience.kmath.expressions.Expression -import kscience.kmath.operations.Algebra -import kscience.kmath.operations.NumericAlgebra +import space.kscience.kmath.asm.internal.AsmBuilder +import space.kscience.kmath.asm.internal.buildName +import space.kscience.kmath.ast.MST +import space.kscience.kmath.ast.MST.* +import space.kscience.kmath.ast.MstExpression +import space.kscience.kmath.expressions.Expression +import space.kscience.kmath.operations.Algebra +import space.kscience.kmath.operations.NumericAlgebra /** * Compiles given MST to an Expression using AST compiler. @@ -22,7 +22,7 @@ internal fun MST.compileWith(type: Class, algebra: Algebra): Exp fun AsmBuilder.visit(node: MST): Unit = when (node) { is Symbolic -> { val symbol = try { - algebra.symbol(node.value) + algebra.bindSymbol(node.value) } catch (ignored: IllegalStateException) { null } diff --git a/kmath-ast/src/jvmMain/kotlin/kscience/kmath/asm/internal/AsmBuilder.kt b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/AsmBuilder.kt similarity index 95% rename from kmath-ast/src/jvmMain/kotlin/kscience/kmath/asm/internal/AsmBuilder.kt rename to kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/AsmBuilder.kt index cd1236b70..a03af5bf9 100644 --- a/kmath-ast/src/jvmMain/kotlin/kscience/kmath/asm/internal/AsmBuilder.kt +++ b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/AsmBuilder.kt @@ -1,15 +1,14 @@ -package kscience.kmath.asm.internal +package space.kscience.kmath.asm.internal -import kscience.kmath.asm.internal.AsmBuilder.ClassLoader -import kscience.kmath.ast.MST -import kscience.kmath.expressions.Expression import org.objectweb.asm.* import org.objectweb.asm.Opcodes.* import org.objectweb.asm.Type.* import org.objectweb.asm.commons.InstructionAdapter +import space.kscience.kmath.asm.internal.AsmBuilder.ClassLoader +import space.kscience.kmath.ast.MST +import space.kscience.kmath.expressions.Expression import java.lang.invoke.MethodHandles import java.lang.invoke.MethodType -import java.lang.reflect.Modifier import java.util.stream.Collectors.toMap import kotlin.contracts.InvocationKind import kotlin.contracts.contract @@ -310,7 +309,7 @@ internal class AsmBuilder( /** * ASM type for [Expression]. */ - val EXPRESSION_TYPE: Type by lazy { getObjectType("kscience/kmath/expressions/Expression") } + val EXPRESSION_TYPE: Type by lazy { getObjectType("space/kscience/kmath/expressions/Expression") } /** * ASM type for [java.util.Map]. @@ -335,11 +334,11 @@ internal class AsmBuilder( /** * ASM type for MapIntrinsics. */ - val MAP_INTRINSICS_TYPE: Type by lazy { getObjectType("kscience/kmath/asm/internal/MapIntrinsics") } + val MAP_INTRINSICS_TYPE: Type by lazy { getObjectType("space/kscience/kmath/asm/internal/MapIntrinsics") } /** * ASM Type for [kscience.kmath.expressions.Symbol]. */ - val SYMBOL_TYPE: Type by lazy { getObjectType("kscience/kmath/expressions/Symbol") } + val SYMBOL_TYPE: Type by lazy { getObjectType("space/kscience/kmath/expressions/Symbol") } } } diff --git a/kmath-ast/src/jvmMain/kotlin/kscience/kmath/asm/internal/codegenUtils.kt b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/codegenUtils.kt similarity index 95% rename from kmath-ast/src/jvmMain/kotlin/kscience/kmath/asm/internal/codegenUtils.kt rename to kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/codegenUtils.kt index 6d5d19d42..1124a860f 100644 --- a/kmath-ast/src/jvmMain/kotlin/kscience/kmath/asm/internal/codegenUtils.kt +++ b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/codegenUtils.kt @@ -1,9 +1,9 @@ -package kscience.kmath.asm.internal +package space.kscience.kmath.asm.internal -import kscience.kmath.ast.MST -import kscience.kmath.expressions.Expression import org.objectweb.asm.* import org.objectweb.asm.commons.InstructionAdapter +import space.kscience.kmath.ast.MST +import space.kscience.kmath.expressions.Expression import kotlin.contracts.InvocationKind import kotlin.contracts.contract diff --git a/kmath-ast/src/jvmMain/kotlin/kscience/kmath/asm/internal/mapIntrinsics.kt b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/mapIntrinsics.kt similarity index 64% rename from kmath-ast/src/jvmMain/kotlin/kscience/kmath/asm/internal/mapIntrinsics.kt rename to kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/mapIntrinsics.kt index 588b9611a..f54bc070c 100644 --- a/kmath-ast/src/jvmMain/kotlin/kscience/kmath/asm/internal/mapIntrinsics.kt +++ b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/mapIntrinsics.kt @@ -1,9 +1,9 @@ @file:JvmName("MapIntrinsics") -package kscience.kmath.asm.internal +package space.kscience.kmath.asm.internal -import kscience.kmath.expressions.StringSymbol -import kscience.kmath.expressions.Symbol +import space.kscience.kmath.expressions.StringSymbol +import space.kscience.kmath.expressions.Symbol /** * Gets value with given [key] or throws [NoSuchElementException] whenever it is not present. diff --git a/kmath-ast/src/jvmMain/kotlin/kscience/kmath/ast/parser.kt b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/ast/parser.kt similarity index 93% rename from kmath-ast/src/jvmMain/kotlin/kscience/kmath/ast/parser.kt rename to kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/ast/parser.kt index 0b66e2c31..4d8204383 100644 --- a/kmath-ast/src/jvmMain/kotlin/kscience/kmath/ast/parser.kt +++ b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/ast/parser.kt @@ -1,6 +1,6 @@ // TODO move to common when https://github.com/h0tk3y/better-parse/pull/33 is merged -package kscience.kmath.ast +package space.kscience.kmath.ast import com.github.h0tk3y.betterParse.combinators.* import com.github.h0tk3y.betterParse.grammar.Grammar @@ -13,10 +13,10 @@ import com.github.h0tk3y.betterParse.lexer.literalToken import com.github.h0tk3y.betterParse.lexer.regexToken import com.github.h0tk3y.betterParse.parser.ParseResult import com.github.h0tk3y.betterParse.parser.Parser -import kscience.kmath.operations.FieldOperations -import kscience.kmath.operations.PowerOperations -import kscience.kmath.operations.RingOperations -import kscience.kmath.operations.SpaceOperations +import space.kscience.kmath.operations.FieldOperations +import space.kscience.kmath.operations.PowerOperations +import space.kscience.kmath.operations.RingOperations +import space.kscience.kmath.operations.SpaceOperations /** * better-parse implementation of grammar defined in the ArithmeticsEvaluator.g4. diff --git a/kmath-ast/src/jvmTest/kotlin/kscience/kmath/asm/TestAsmConsistencyWithInterpreter.kt b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmConsistencyWithInterpreter.kt similarity index 76% rename from kmath-ast/src/jvmTest/kotlin/kscience/kmath/asm/TestAsmConsistencyWithInterpreter.kt rename to kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmConsistencyWithInterpreter.kt index 4091aa8ed..0f2328db6 100644 --- a/kmath-ast/src/jvmTest/kotlin/kscience/kmath/asm/TestAsmConsistencyWithInterpreter.kt +++ b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmConsistencyWithInterpreter.kt @@ -1,10 +1,11 @@ -package kscience.kmath.asm +package space.kscience.kmath.asm -import kscience.kmath.ast.* -import kscience.kmath.complex.* -import kscience.kmath.expressions.invoke -import kscience.kmath.operations.ByteRing -import kscience.kmath.operations.RealField +import space.kscience.kmath.ast.* +import space.kscience.kmath.complex.ComplexField +import space.kscience.kmath.complex.toComplex +import space.kscience.kmath.expressions.invoke +import space.kscience.kmath.operations.ByteRing +import space.kscience.kmath.operations.RealField import kotlin.test.Test import kotlin.test.assertEquals @@ -21,7 +22,7 @@ internal class TestAsmConsistencyWithInterpreter { ), number(1) - ) + symbol("x") + zero + ) + bindSymbol("x") + zero }("x" to MST.Numeric(2)) val res2 = MstSpace.mstInSpace { @@ -34,7 +35,7 @@ internal class TestAsmConsistencyWithInterpreter { ), number(1) - ) + symbol("x") + zero + ) + bindSymbol("x") + zero }.compile()("x" to MST.Numeric(2)) assertEquals(res1, res2) @@ -45,7 +46,7 @@ internal class TestAsmConsistencyWithInterpreter { val res1 = ByteRing.mstInRing { binaryOperationFunction("+")( unaryOperationFunction("+")( - (symbol("x") - (2.toByte() + (multiply( + (bindSymbol("x") - (2.toByte() + (multiply( add(number(1), number(1)), 2 ) + 1.toByte()))) * 3.0 - 1.toByte() @@ -58,7 +59,7 @@ internal class TestAsmConsistencyWithInterpreter { val res2 = ByteRing.mstInRing { binaryOperationFunction("+")( unaryOperationFunction("+")( - (symbol("x") - (2.toByte() + (multiply( + (bindSymbol("x") - (2.toByte() + (multiply( add(number(1), number(1)), 2 ) + 1.toByte()))) * 3.0 - 1.toByte() @@ -74,7 +75,7 @@ internal class TestAsmConsistencyWithInterpreter { fun realField() { val res1 = RealField.mstInField { +(3 - 2 + 2 * number(1) + 1.0) + binaryOperationFunction("+")( - (3.0 - (symbol("x") + (multiply(add(number(1.0), number(1.0)), 2) + 1.0))) * 3 - 1.0 + (3.0 - (bindSymbol("x") + (multiply(add(number(1.0), number(1.0)), 2) + 1.0))) * 3 - 1.0 + number(1), number(1) / 2 + number(2.0) * one ) + zero @@ -82,7 +83,7 @@ internal class TestAsmConsistencyWithInterpreter { val res2 = RealField.mstInField { +(3 - 2 + 2 * number(1) + 1.0) + binaryOperationFunction("+")( - (3.0 - (symbol("x") + (multiply(add(number(1.0), number(1.0)), 2) + 1.0))) * 3 - 1.0 + (3.0 - (bindSymbol("x") + (multiply(add(number(1.0), number(1.0)), 2) + 1.0))) * 3 - 1.0 + number(1), number(1) / 2 + number(2.0) * one ) + zero @@ -95,7 +96,7 @@ internal class TestAsmConsistencyWithInterpreter { fun complexField() { val res1 = ComplexField.mstInField { +(3 - 2 + 2 * number(1) + 1.0) + binaryOperationFunction("+")( - (3.0 - (symbol("x") + (multiply(add(number(1.0), number(1.0)), 2) + 1.0))) * 3 - 1.0 + (3.0 - (bindSymbol("x") + (multiply(add(number(1.0), number(1.0)), 2) + 1.0))) * 3 - 1.0 + number(1), number(1) / 2 + number(2.0) * one ) + zero @@ -103,7 +104,7 @@ internal class TestAsmConsistencyWithInterpreter { val res2 = ComplexField.mstInField { +(3 - 2 + 2 * number(1) + 1.0) + binaryOperationFunction("+")( - (3.0 - (symbol("x") + (multiply(add(number(1.0), number(1.0)), 2) + 1.0))) * 3 - 1.0 + (3.0 - (bindSymbol("x") + (multiply(add(number(1.0), number(1.0)), 2) + 1.0))) * 3 - 1.0 + number(1), number(1) / 2 + number(2.0) * one ) + zero diff --git a/kmath-ast/src/jvmTest/kotlin/kscience/kmath/asm/TestAsmOperationsSupport.kt b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmOperationsSupport.kt similarity index 50% rename from kmath-ast/src/jvmTest/kotlin/kscience/kmath/asm/TestAsmOperationsSupport.kt rename to kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmOperationsSupport.kt index 2ce52aa87..e3adc4629 100644 --- a/kmath-ast/src/jvmTest/kotlin/kscience/kmath/asm/TestAsmOperationsSupport.kt +++ b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmOperationsSupport.kt @@ -1,10 +1,10 @@ -package kscience.kmath.asm +package space.kscience.kmath.asm -import kscience.kmath.ast.mstInExtendedField -import kscience.kmath.ast.mstInField -import kscience.kmath.ast.mstInSpace -import kscience.kmath.expressions.invoke -import kscience.kmath.operations.RealField +import space.kscience.kmath.ast.mstInExtendedField +import space.kscience.kmath.ast.mstInField +import space.kscience.kmath.ast.mstInSpace +import space.kscience.kmath.expressions.invoke +import space.kscience.kmath.operations.RealField import kotlin.random.Random import kotlin.test.Test import kotlin.test.assertEquals @@ -12,27 +12,27 @@ import kotlin.test.assertEquals internal class TestAsmOperationsSupport { @Test fun testUnaryOperationInvocation() { - val expression = RealField.mstInSpace { -symbol("x") }.compile() + val expression = RealField.mstInSpace { -bindSymbol("x") }.compile() val res = expression("x" to 2.0) assertEquals(-2.0, res) } @Test fun testBinaryOperationInvocation() { - val expression = RealField.mstInSpace { -symbol("x") + number(1.0) }.compile() + val expression = RealField.mstInSpace { -bindSymbol("x") + number(1.0) }.compile() val res = expression("x" to 2.0) assertEquals(-1.0, res) } @Test fun testConstProductInvocation() { - val res = RealField.mstInField { symbol("x") * 2 }("x" to 2.0) + val res = RealField.mstInField { bindSymbol("x") * 2 }("x" to 2.0) assertEquals(4.0, res) } @Test fun testMultipleCalls() { - val e = RealField.mstInExtendedField { sin(symbol("x")).pow(4) - 6 * symbol("x") / tanh(symbol("x")) }.compile() + val e = RealField.mstInExtendedField { sin(bindSymbol("x")).pow(4) - 6 * bindSymbol("x") / tanh(bindSymbol("x")) }.compile() val r = Random(0) var s = 0.0 repeat(1000000) { s += e("x" to r.nextDouble()) } diff --git a/kmath-ast/src/jvmTest/kotlin/kscience/kmath/asm/TestAsmSpecialization.kt b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmSpecialization.kt similarity index 68% rename from kmath-ast/src/jvmTest/kotlin/kscience/kmath/asm/TestAsmSpecialization.kt rename to kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmSpecialization.kt index 602c54651..a214ca4ad 100644 --- a/kmath-ast/src/jvmTest/kotlin/kscience/kmath/asm/TestAsmSpecialization.kt +++ b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmSpecialization.kt @@ -1,52 +1,52 @@ -package kscience.kmath.asm +package space.kscience.kmath.asm -import kscience.kmath.ast.mstInField -import kscience.kmath.expressions.invoke -import kscience.kmath.operations.RealField +import space.kscience.kmath.ast.mstInField +import space.kscience.kmath.expressions.invoke +import space.kscience.kmath.operations.RealField import kotlin.test.Test import kotlin.test.assertEquals internal class TestAsmSpecialization { @Test fun testUnaryPlus() { - val expr = RealField.mstInField { unaryOperationFunction("+")(symbol("x")) }.compile() + val expr = RealField.mstInField { unaryOperationFunction("+")(bindSymbol("x")) }.compile() assertEquals(2.0, expr("x" to 2.0)) } @Test fun testUnaryMinus() { - val expr = RealField.mstInField { unaryOperationFunction("-")(symbol("x")) }.compile() + val expr = RealField.mstInField { unaryOperationFunction("-")(bindSymbol("x")) }.compile() assertEquals(-2.0, expr("x" to 2.0)) } @Test fun testAdd() { - val expr = RealField.mstInField { binaryOperationFunction("+")(symbol("x"), symbol("x")) }.compile() + val expr = RealField.mstInField { binaryOperationFunction("+")(bindSymbol("x"), bindSymbol("x")) }.compile() assertEquals(4.0, expr("x" to 2.0)) } @Test fun testSine() { - val expr = RealField.mstInField { unaryOperationFunction("sin")(symbol("x")) }.compile() + val expr = RealField.mstInField { unaryOperationFunction("sin")(bindSymbol("x")) }.compile() assertEquals(0.0, expr("x" to 0.0)) } @Test fun testMinus() { - val expr = RealField.mstInField { binaryOperationFunction("-")(symbol("x"), symbol("x")) }.compile() + val expr = RealField.mstInField { binaryOperationFunction("-")(bindSymbol("x"), bindSymbol("x")) }.compile() assertEquals(0.0, expr("x" to 2.0)) } @Test fun testDivide() { - val expr = RealField.mstInField { binaryOperationFunction("/")(symbol("x"), symbol("x")) }.compile() + val expr = RealField.mstInField { binaryOperationFunction("/")(bindSymbol("x"), bindSymbol("x")) }.compile() assertEquals(1.0, expr("x" to 2.0)) } @Test fun testPower() { val expr = RealField - .mstInField { binaryOperationFunction("pow")(symbol("x"), number(2)) } + .mstInField { binaryOperationFunction("pow")(bindSymbol("x"), number(2)) } .compile() assertEquals(4.0, expr("x" to 2.0)) diff --git a/kmath-ast/src/jvmTest/kotlin/kscience/kmath/asm/TestAsmVariables.kt b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmVariables.kt similarity index 52% rename from kmath-ast/src/jvmTest/kotlin/kscience/kmath/asm/TestAsmVariables.kt rename to kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmVariables.kt index c91568dbf..d1aaefffe 100644 --- a/kmath-ast/src/jvmTest/kotlin/kscience/kmath/asm/TestAsmVariables.kt +++ b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmVariables.kt @@ -1,8 +1,8 @@ -package kscience.kmath.asm +package space.kscience.kmath.asm -import kscience.kmath.ast.mstInRing -import kscience.kmath.expressions.invoke -import kscience.kmath.operations.ByteRing +import space.kscience.kmath.ast.mstInRing +import space.kscience.kmath.expressions.invoke +import space.kscience.kmath.operations.ByteRing import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFailsWith @@ -10,13 +10,13 @@ import kotlin.test.assertFailsWith internal class TestAsmVariables { @Test fun testVariable() { - val expr = ByteRing.mstInRing { symbol("x") }.compile() + val expr = ByteRing.mstInRing { bindSymbol("x") }.compile() assertEquals(1.toByte(), expr("x" to 1.toByte())) } @Test fun testUndefinedVariableFails() { - val expr = ByteRing.mstInRing { symbol("x") }.compile() + val expr = ByteRing.mstInRing { bindSymbol("x") }.compile() assertFailsWith { expr() } } } diff --git a/kmath-ast/src/jvmTest/kotlin/kscience/kmath/ast/ParserPrecedenceTest.kt b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/ast/ParserPrecedenceTest.kt similarity index 86% rename from kmath-ast/src/jvmTest/kotlin/kscience/kmath/ast/ParserPrecedenceTest.kt rename to kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/ast/ParserPrecedenceTest.kt index 561fe51bd..7153f4bfc 100644 --- a/kmath-ast/src/jvmTest/kotlin/kscience/kmath/ast/ParserPrecedenceTest.kt +++ b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/ast/ParserPrecedenceTest.kt @@ -1,7 +1,7 @@ -package kscience.kmath.ast +package space.kscience.kmath.ast -import kscience.kmath.operations.Field -import kscience.kmath.operations.RealField +import space.kscience.kmath.operations.Field +import space.kscience.kmath.operations.RealField import kotlin.test.Test import kotlin.test.assertEquals diff --git a/kmath-ast/src/jvmTest/kotlin/kscience/kmath/ast/ParserTest.kt b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/ast/ParserTest.kt similarity index 81% rename from kmath-ast/src/jvmTest/kotlin/kscience/kmath/ast/ParserTest.kt rename to kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/ast/ParserTest.kt index ffc4732ff..6807d5c5d 100644 --- a/kmath-ast/src/jvmTest/kotlin/kscience/kmath/ast/ParserTest.kt +++ b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/ast/ParserTest.kt @@ -1,10 +1,10 @@ -package kscience.kmath.ast +package space.kscience.kmath.ast -import kscience.kmath.complex.Complex -import kscience.kmath.complex.ComplexField -import kscience.kmath.expressions.invoke -import kscience.kmath.operations.Algebra -import kscience.kmath.operations.RealField +import space.kscience.kmath.complex.Complex +import space.kscience.kmath.complex.ComplexField +import space.kscience.kmath.expressions.invoke +import space.kscience.kmath.operations.Algebra +import space.kscience.kmath.operations.RealField import kotlin.test.Test import kotlin.test.assertEquals @@ -40,7 +40,7 @@ internal class ParserTest { @Test fun `evaluate MST with binary function`() { val magicalAlgebra = object : Algebra { - override fun symbol(value: String): String = value + override fun bindSymbol(value: String): String = value override fun unaryOperationFunction(operation: String): (arg: String) -> String { throw NotImplementedError() diff --git a/kmath-commons/src/main/kotlin/kscience/kmath/commons/expressions/DerivativeStructureExpression.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpression.kt similarity index 92% rename from kmath-commons/src/main/kotlin/kscience/kmath/commons/expressions/DerivativeStructureExpression.kt rename to kmath-commons/src/main/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpression.kt index 2912ddc4c..8342a8071 100644 --- a/kmath-commons/src/main/kotlin/kscience/kmath/commons/expressions/DerivativeStructureExpression.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpression.kt @@ -1,10 +1,10 @@ -package kscience.kmath.commons.expressions +package space.kscience.kmath.commons.expressions -import kscience.kmath.expressions.* -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.operations.ExtendedField -import kscience.kmath.operations.RingWithNumbers import org.apache.commons.math3.analysis.differentiation.DerivativeStructure +import space.kscience.kmath.expressions.* +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.operations.ExtendedField +import space.kscience.kmath.operations.RingWithNumbers /** * A field over commons-math [DerivativeStructure]. @@ -48,11 +48,11 @@ public class DerivativeStructureField( override fun const(value: Double): DerivativeStructure = DerivativeStructure(numberOfVariables, order, value) - public override fun bindOrNull(symbol: Symbol): DerivativeStructureSymbol? = variables[symbol.identity] + public override fun bindSymbolOrNull(symbol: Symbol): DerivativeStructureSymbol? = variables[symbol.identity] public fun bind(symbol: Symbol): DerivativeStructureSymbol = variables.getValue(symbol.identity) - override fun symbol(value: String): DerivativeStructureSymbol = bind(StringSymbol(value)) + override fun bindSymbol(value: String): DerivativeStructureSymbol = bind(StringSymbol(value)) public fun DerivativeStructure.derivative(symbols: List): Double { require(symbols.size <= order) { "The order of derivative ${symbols.size} exceeds computed order $order" } diff --git a/kmath-commons/src/main/kotlin/kscience/kmath/commons/linear/CMMatrix.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt similarity index 96% rename from kmath-commons/src/main/kotlin/kscience/kmath/commons/linear/CMMatrix.kt rename to kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt index 811c0c2d5..3638b9808 100644 --- a/kmath-commons/src/main/kotlin/kscience/kmath/commons/linear/CMMatrix.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt @@ -1,9 +1,9 @@ -package kscience.kmath.commons.linear +package space.kscience.kmath.commons.linear -import kscience.kmath.linear.* -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.structures.RealBuffer import org.apache.commons.math3.linear.* +import space.kscience.kmath.linear.* +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.structures.RealBuffer import kotlin.reflect.KClass import kotlin.reflect.cast diff --git a/kmath-commons/src/main/kotlin/kscience/kmath/commons/linear/CMSolver.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMSolver.kt similarity index 90% rename from kmath-commons/src/main/kotlin/kscience/kmath/commons/linear/CMSolver.kt rename to kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMSolver.kt index 1c0896597..3ce7ca9e6 100644 --- a/kmath-commons/src/main/kotlin/kscience/kmath/commons/linear/CMSolver.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMSolver.kt @@ -1,8 +1,8 @@ -package kscience.kmath.commons.linear +package space.kscience.kmath.commons.linear -import kscience.kmath.linear.Matrix -import kscience.kmath.linear.Point import org.apache.commons.math3.linear.* +import space.kscience.kmath.linear.Matrix +import space.kscience.kmath.linear.Point public enum class CMDecomposition { LUP, diff --git a/kmath-commons/src/main/kotlin/kscience/kmath/commons/optimization/CMOptimizationProblem.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/CMOptimizationProblem.kt similarity index 93% rename from kmath-commons/src/main/kotlin/kscience/kmath/commons/optimization/CMOptimizationProblem.kt rename to kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/CMOptimizationProblem.kt index d6f79529a..d655b4f61 100644 --- a/kmath-commons/src/main/kotlin/kscience/kmath/commons/optimization/CMOptimizationProblem.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/CMOptimizationProblem.kt @@ -1,10 +1,5 @@ -package kscience.kmath.commons.optimization +package space.kscience.kmath.commons.optimization -import kscience.kmath.expressions.* -import kscience.kmath.stat.OptimizationFeature -import kscience.kmath.stat.OptimizationProblem -import kscience.kmath.stat.OptimizationProblemFactory -import kscience.kmath.stat.OptimizationResult import org.apache.commons.math3.optim.* import org.apache.commons.math3.optim.nonlinear.scalar.GoalType import org.apache.commons.math3.optim.nonlinear.scalar.MultivariateOptimizer @@ -14,6 +9,11 @@ import org.apache.commons.math3.optim.nonlinear.scalar.gradient.NonLinearConjuga import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.AbstractSimplex import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.NelderMeadSimplex import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.SimplexOptimizer +import space.kscience.kmath.expressions.* +import space.kscience.kmath.stat.OptimizationFeature +import space.kscience.kmath.stat.OptimizationProblem +import space.kscience.kmath.stat.OptimizationProblemFactory +import space.kscience.kmath.stat.OptimizationResult import kotlin.reflect.KClass public operator fun PointValuePair.component1(): DoubleArray = point diff --git a/kmath-commons/src/main/kotlin/kscience/kmath/commons/optimization/cmFit.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/cmFit.kt similarity index 80% rename from kmath-commons/src/main/kotlin/kscience/kmath/commons/optimization/cmFit.kt rename to kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/cmFit.kt index b8e8bfd4b..5ecd5b756 100644 --- a/kmath-commons/src/main/kotlin/kscience/kmath/commons/optimization/cmFit.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/cmFit.kt @@ -1,16 +1,16 @@ -package kscience.kmath.commons.optimization +package space.kscience.kmath.commons.optimization -import kscience.kmath.commons.expressions.DerivativeStructureField -import kscience.kmath.expressions.DifferentiableExpression -import kscience.kmath.expressions.Expression -import kscience.kmath.expressions.Symbol -import kscience.kmath.stat.Fitting -import kscience.kmath.stat.OptimizationResult -import kscience.kmath.stat.optimizeWith -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.asBuffer import org.apache.commons.math3.analysis.differentiation.DerivativeStructure import org.apache.commons.math3.optim.nonlinear.scalar.GoalType +import space.kscience.kmath.commons.expressions.DerivativeStructureField +import space.kscience.kmath.expressions.DifferentiableExpression +import space.kscience.kmath.expressions.Expression +import space.kscience.kmath.expressions.Symbol +import space.kscience.kmath.stat.Fitting +import space.kscience.kmath.stat.OptimizationResult +import space.kscience.kmath.stat.optimizeWith +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.asBuffer /** * Generate a chi squared expression from given x-y-sigma data and inline model. Provides automatic differentiation diff --git a/kmath-commons/src/main/kotlin/kscience/kmath/commons/random/CMRandomGeneratorWrapper.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/random/CMRandomGeneratorWrapper.kt similarity index 91% rename from kmath-commons/src/main/kotlin/kscience/kmath/commons/random/CMRandomGeneratorWrapper.kt rename to kmath-commons/src/main/kotlin/space/kscience/kmath/commons/random/CMRandomGeneratorWrapper.kt index 1eab5f2bd..3fd98d097 100644 --- a/kmath-commons/src/main/kotlin/kscience/kmath/commons/random/CMRandomGeneratorWrapper.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/random/CMRandomGeneratorWrapper.kt @@ -1,6 +1,6 @@ -package kscience.kmath.commons.random +package space.kscience.kmath.commons.random -import kscience.kmath.stat.RandomGenerator +import space.kscience.kmath.stat.RandomGenerator public class CMRandomGeneratorWrapper( public val factory: (IntArray) -> RandomGenerator, diff --git a/kmath-commons/src/main/kotlin/kscience/kmath/commons/transform/Transformations.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/transform/Transformations.kt similarity index 93% rename from kmath-commons/src/main/kotlin/kscience/kmath/commons/transform/Transformations.kt rename to kmath-commons/src/main/kotlin/space/kscience/kmath/commons/transform/Transformations.kt index 4c83eb99f..e174a237f 100644 --- a/kmath-commons/src/main/kotlin/kscience/kmath/commons/transform/Transformations.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/transform/Transformations.kt @@ -1,13 +1,13 @@ -package kscience.kmath.commons.transform +package space.kscience.kmath.commons.transform import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map -import kscience.kmath.complex.* -import kscience.kmath.streaming.chunked -import kscience.kmath.streaming.spread -import kscience.kmath.structures.* import org.apache.commons.math3.transform.* +import space.kscience.kmath.complex.Complex +import space.kscience.kmath.streaming.chunked +import space.kscience.kmath.streaming.spread +import space.kscience.kmath.structures.* /** diff --git a/kmath-commons/src/test/kotlin/kscience/kmath/commons/expressions/DerivativeStructureExpressionTest.kt b/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpressionTest.kt similarity index 91% rename from kmath-commons/src/test/kotlin/kscience/kmath/commons/expressions/DerivativeStructureExpressionTest.kt rename to kmath-commons/src/test/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpressionTest.kt index 7511a38ed..19b6e28da 100644 --- a/kmath-commons/src/test/kotlin/kscience/kmath/commons/expressions/DerivativeStructureExpressionTest.kt +++ b/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpressionTest.kt @@ -1,6 +1,6 @@ -package kscience.kmath.commons.expressions +package space.kscience.kmath.commons.expressions -import kscience.kmath.expressions.* +import space.kscience.kmath.expressions.* import kotlin.contracts.InvocationKind import kotlin.contracts.contract import kotlin.test.Test @@ -24,7 +24,7 @@ internal class AutoDiffTest { fun derivativeStructureFieldTest() { diff(2, x to 1.0, y to 1.0) { val x = bind(x)//by binding() - val y = symbol("y") + val y = bindSymbol("y") val z = x * (-sin(x * y) + y) + 2.0 println(z.derivative(x)) println(z.derivative(y,x)) diff --git a/kmath-commons/src/test/kotlin/kscience/kmath/commons/optimization/OptimizeTest.kt b/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/optimization/OptimizeTest.kt similarity index 79% rename from kmath-commons/src/test/kotlin/kscience/kmath/commons/optimization/OptimizeTest.kt rename to kmath-commons/src/test/kotlin/space/kscience/kmath/commons/optimization/OptimizeTest.kt index 3290c8f32..d29934a4d 100644 --- a/kmath-commons/src/test/kotlin/kscience/kmath/commons/optimization/OptimizeTest.kt +++ b/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/optimization/OptimizeTest.kt @@ -1,12 +1,12 @@ -package kscience.kmath.commons.optimization +package space.kscience.kmath.commons.optimization -import kscience.kmath.commons.expressions.DerivativeStructureExpression -import kscience.kmath.expressions.symbol -import kscience.kmath.stat.Distribution -import kscience.kmath.stat.Fitting -import kscience.kmath.stat.RandomGenerator -import kscience.kmath.stat.normal import org.junit.jupiter.api.Test +import space.kscience.kmath.commons.expressions.DerivativeStructureExpression +import space.kscience.kmath.expressions.symbol +import space.kscience.kmath.stat.Distribution +import space.kscience.kmath.stat.Fitting +import space.kscience.kmath.stat.RandomGenerator +import space.kscience.kmath.stat.normal import kotlin.math.pow internal class OptimizeTest { @@ -56,7 +56,7 @@ internal class OptimizeTest { val yErr = List(x.size) { sigma } val chi2 = Fitting.chiSquared(x, y, yErr) { x1 -> - val cWithDefault = bindOrNull(c) ?: one + val cWithDefault = bindSymbolOrNull(c) ?: one bind(a) * x1.pow(2) + bind(b) * x1 + cWithDefault } diff --git a/kmath-complex/src/commonMain/kotlin/kscience/kmath/complex/Complex.kt b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Complex.kt similarity index 89% rename from kmath-complex/src/commonMain/kotlin/kscience/kmath/complex/Complex.kt rename to kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Complex.kt index f6914d3a0..6d2c04c39 100644 --- a/kmath-complex/src/commonMain/kotlin/kscience/kmath/complex/Complex.kt +++ b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Complex.kt @@ -1,16 +1,16 @@ -package kscience.kmath.complex +package space.kscience.kmath.complex -import kscience.kmath.memory.MemoryReader -import kscience.kmath.memory.MemorySpec -import kscience.kmath.memory.MemoryWriter -import kscience.kmath.operations.ExtendedField -import kscience.kmath.operations.FieldElement -import kscience.kmath.operations.Norm -import kscience.kmath.operations.RingWithNumbers -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.MemoryBuffer -import kscience.kmath.structures.MutableBuffer -import kscience.kmath.structures.MutableMemoryBuffer +import space.kscience.kmath.memory.MemoryReader +import space.kscience.kmath.memory.MemorySpec +import space.kscience.kmath.memory.MemoryWriter +import space.kscience.kmath.operations.ExtendedField +import space.kscience.kmath.operations.FieldElement +import space.kscience.kmath.operations.Norm +import space.kscience.kmath.operations.RingWithNumbers +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.MemoryBuffer +import space.kscience.kmath.structures.MutableBuffer +import space.kscience.kmath.structures.MutableMemoryBuffer import kotlin.math.* /** @@ -157,7 +157,7 @@ public object ComplexField : ExtendedField, Norm, Rin public override fun norm(arg: Complex): Complex = sqrt(arg.conjugate * arg) - public override fun symbol(value: String): Complex = if (value == "i") i else super.symbol(value) + public override fun bindSymbol(value: String): Complex = if (value == "i") i else super.bindSymbol(value) } /** diff --git a/kmath-complex/src/commonMain/kotlin/kscience/kmath/complex/ComplexNDField.kt b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/ComplexNDField.kt similarity index 91% rename from kmath-complex/src/commonMain/kotlin/kscience/kmath/complex/ComplexNDField.kt rename to kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/ComplexNDField.kt index 5648ccee1..11cfea263 100644 --- a/kmath-complex/src/commonMain/kotlin/kscience/kmath/complex/ComplexNDField.kt +++ b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/ComplexNDField.kt @@ -1,12 +1,13 @@ -package kscience.kmath.complex +package space.kscience.kmath.complex -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.nd.BufferedNDField -import kscience.kmath.nd.NDAlgebra -import kscience.kmath.nd.NDBuffer -import kscience.kmath.nd.NDStructure -import kscience.kmath.operations.* -import kscience.kmath.structures.Buffer +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.nd.BufferedNDField +import space.kscience.kmath.nd.NDAlgebra +import space.kscience.kmath.nd.NDBuffer +import space.kscience.kmath.nd.NDStructure +import space.kscience.kmath.operations.ExtendedField +import space.kscience.kmath.operations.RingWithNumbers +import space.kscience.kmath.structures.Buffer import kotlin.contracts.InvocationKind import kotlin.contracts.contract diff --git a/kmath-complex/src/commonMain/kotlin/kscience/kmath/complex/Quaternion.kt b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt similarity index 93% rename from kmath-complex/src/commonMain/kotlin/kscience/kmath/complex/Quaternion.kt rename to kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt index a0ad47b90..848ac728f 100644 --- a/kmath-complex/src/commonMain/kotlin/kscience/kmath/complex/Quaternion.kt +++ b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt @@ -1,13 +1,13 @@ -package kscience.kmath.complex +package space.kscience.kmath.complex -import kscience.kmath.memory.MemoryReader -import kscience.kmath.memory.MemorySpec -import kscience.kmath.memory.MemoryWriter -import kscience.kmath.operations.* -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.MemoryBuffer -import kscience.kmath.structures.MutableBuffer -import kscience.kmath.structures.MutableMemoryBuffer +import space.kscience.kmath.memory.MemoryReader +import space.kscience.kmath.memory.MemorySpec +import space.kscience.kmath.memory.MemoryWriter +import space.kscience.kmath.operations.* +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.MemoryBuffer +import space.kscience.kmath.structures.MutableBuffer +import space.kscience.kmath.structures.MutableMemoryBuffer import kotlin.math.* /** @@ -165,11 +165,11 @@ public object QuaternionField : Field, Norm, public override fun Quaternion.unaryMinus(): Quaternion = Quaternion(-w, -x, -y, -z) public override fun norm(arg: Quaternion): Quaternion = sqrt(arg.conjugate * arg) - public override fun symbol(value: String): Quaternion = when (value) { + public override fun bindSymbol(value: String): Quaternion = when (value) { "i" -> i "j" -> j "k" -> k - else -> super.symbol(value) + else -> super.bindSymbol(value) } } diff --git a/kmath-complex/src/commonTest/kotlin/kscience/kmath/complex/ComplexBufferSpecTest.kt b/kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/ComplexBufferSpecTest.kt similarity index 76% rename from kmath-complex/src/commonTest/kotlin/kscience/kmath/complex/ComplexBufferSpecTest.kt rename to kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/ComplexBufferSpecTest.kt index a19ce8b95..e265e5896 100644 --- a/kmath-complex/src/commonTest/kotlin/kscience/kmath/complex/ComplexBufferSpecTest.kt +++ b/kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/ComplexBufferSpecTest.kt @@ -1,6 +1,6 @@ -package kscience.kmath.complex +package space.kscience.kmath.complex -import kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.Buffer import kotlin.test.Test import kotlin.test.assertEquals diff --git a/kmath-complex/src/commonTest/kotlin/kscience/kmath/complex/ComplexFieldTest.kt b/kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/ComplexFieldTest.kt similarity index 96% rename from kmath-complex/src/commonTest/kotlin/kscience/kmath/complex/ComplexFieldTest.kt rename to kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/ComplexFieldTest.kt index aa25f6b4b..e00b92077 100644 --- a/kmath-complex/src/commonTest/kotlin/kscience/kmath/complex/ComplexFieldTest.kt +++ b/kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/ComplexFieldTest.kt @@ -1,6 +1,6 @@ -package kscience.kmath.complex +package space.kscience.kmath.complex -import kscience.kmath.operations.invoke +import space.kscience.kmath.operations.invoke import kotlin.math.PI import kotlin.math.abs import kotlin.test.Test diff --git a/kmath-complex/src/commonTest/kotlin/kscience/kmath/complex/ComplexTest.kt b/kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/ComplexTest.kt similarity index 91% rename from kmath-complex/src/commonTest/kotlin/kscience/kmath/complex/ComplexTest.kt rename to kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/ComplexTest.kt index 6b7364c59..e272f502f 100644 --- a/kmath-complex/src/commonTest/kotlin/kscience/kmath/complex/ComplexTest.kt +++ b/kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/ComplexTest.kt @@ -1,6 +1,6 @@ -package kscience.kmath.complex +package space.kscience.kmath.complex -import kscience.kmath.operations.invoke +import space.kscience.kmath.operations.invoke import kotlin.math.sqrt import kotlin.test.Test import kotlin.test.assertEquals diff --git a/kmath-complex/src/commonTest/kotlin/kscience/kmath/complex/ExpressionFieldForComplexTest.kt b/kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/ExpressionFieldForComplexTest.kt similarity index 57% rename from kmath-complex/src/commonTest/kotlin/kscience/kmath/complex/ExpressionFieldForComplexTest.kt rename to kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/ExpressionFieldForComplexTest.kt index 1a3a55047..43560b35a 100644 --- a/kmath-complex/src/commonTest/kotlin/kscience/kmath/complex/ExpressionFieldForComplexTest.kt +++ b/kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/ExpressionFieldForComplexTest.kt @@ -1,10 +1,10 @@ -package kscience.kmath.complex +package space.kscience.kmath.complex -import kscience.kmath.expressions.FunctionalExpressionField -import kscience.kmath.expressions.bind -import kscience.kmath.expressions.invoke -import kscience.kmath.expressions.symbol -import kscience.kmath.operations.invoke +import space.kscience.kmath.expressions.FunctionalExpressionField +import space.kscience.kmath.expressions.bindSymbol +import space.kscience.kmath.expressions.invoke +import space.kscience.kmath.expressions.symbol +import space.kscience.kmath.operations.invoke import kotlin.test.Test import kotlin.test.assertEquals @@ -16,7 +16,7 @@ internal class ExpressionFieldForComplexTest { val context = FunctionalExpressionField(ComplexField) val expression = context { - val x = bind(x) + val x = bindSymbol(x) x * x + 2 * x + one } diff --git a/kmath-complex/src/commonTest/kotlin/kscience/kmath/complex/QuaternionFieldTest.kt b/kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/QuaternionFieldTest.kt similarity index 95% rename from kmath-complex/src/commonTest/kotlin/kscience/kmath/complex/QuaternionFieldTest.kt rename to kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/QuaternionFieldTest.kt index df690cfc4..5ce81a251 100644 --- a/kmath-complex/src/commonTest/kotlin/kscience/kmath/complex/QuaternionFieldTest.kt +++ b/kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/QuaternionFieldTest.kt @@ -1,6 +1,6 @@ -package kscience.kmath.complex +package space.kscience.kmath.complex -import kscience.kmath.operations.invoke +import space.kscience.kmath.operations.invoke import kotlin.test.Test import kotlin.test.assertEquals diff --git a/kmath-core/api/kmath-core.api b/kmath-core/api/kmath-core.api index e58e5d45d..ba063c94d 100644 --- a/kmath-core/api/kmath-core.api +++ b/kmath-core/api/kmath-core.api @@ -1,65 +1,65 @@ -public abstract interface class kscience/kmath/domains/Domain { - public abstract fun contains (Lkscience/kmath/structures/Buffer;)Z +public abstract interface class space/kscience/kmath/domains/Domain { + public abstract fun contains (Lspace/kscience/kmath/structures/Buffer;)Z public abstract fun getDimension ()I } -public final class kscience/kmath/domains/HyperSquareDomain : kscience/kmath/domains/RealDomain { +public final class space/kscience/kmath/domains/HyperSquareDomain : space/kscience/kmath/domains/RealDomain { public synthetic fun ([D[DLkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun contains (Lkscience/kmath/structures/Buffer;)Z + public fun contains (Lspace/kscience/kmath/structures/Buffer;)Z public fun getDimension ()I public fun getLowerBound (I)Ljava/lang/Double; - public fun getLowerBound (ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; + public fun getLowerBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; public fun getUpperBound (I)Ljava/lang/Double; - public fun getUpperBound (ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; - public fun nearestInDomain (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun getUpperBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; + public fun nearestInDomain (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun volume ()D } -public abstract interface class kscience/kmath/domains/RealDomain : kscience/kmath/domains/Domain { +public abstract interface class space/kscience/kmath/domains/RealDomain : space/kscience/kmath/domains/Domain { public abstract fun getLowerBound (I)Ljava/lang/Double; - public abstract fun getLowerBound (ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; + public abstract fun getLowerBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; public abstract fun getUpperBound (I)Ljava/lang/Double; - public abstract fun getUpperBound (ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; - public abstract fun nearestInDomain (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public abstract fun getUpperBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; + public abstract fun nearestInDomain (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public abstract fun volume ()D } -public final class kscience/kmath/domains/UnconstrainedDomain : kscience/kmath/domains/RealDomain { +public final class space/kscience/kmath/domains/UnconstrainedDomain : space/kscience/kmath/domains/RealDomain { public fun (I)V - public fun contains (Lkscience/kmath/structures/Buffer;)Z + public fun contains (Lspace/kscience/kmath/structures/Buffer;)Z public fun getDimension ()I public fun getLowerBound (I)Ljava/lang/Double; - public fun getLowerBound (ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; + public fun getLowerBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; public fun getUpperBound (I)Ljava/lang/Double; - public fun getUpperBound (ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; - public fun nearestInDomain (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun getUpperBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; + public fun nearestInDomain (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun volume ()D } -public final class kscience/kmath/domains/UnivariateDomain : kscience/kmath/domains/RealDomain { - public static final synthetic fun box-impl (Lkotlin/ranges/ClosedFloatingPointRange;)Lkscience/kmath/domains/UnivariateDomain; +public final class space/kscience/kmath/domains/UnivariateDomain : space/kscience/kmath/domains/RealDomain { + public static final synthetic fun box-impl (Lkotlin/ranges/ClosedFloatingPointRange;)Lspace/kscience/kmath/domains/UnivariateDomain; public static fun constructor-impl (Lkotlin/ranges/ClosedFloatingPointRange;)Lkotlin/ranges/ClosedFloatingPointRange; - public fun contains (Lkscience/kmath/structures/Buffer;)Z + public fun contains (Lspace/kscience/kmath/structures/Buffer;)Z public static final fun contains-impl (Lkotlin/ranges/ClosedFloatingPointRange;D)Z - public static fun contains-impl (Lkotlin/ranges/ClosedFloatingPointRange;Lkscience/kmath/structures/Buffer;)Z + public static fun contains-impl (Lkotlin/ranges/ClosedFloatingPointRange;Lspace/kscience/kmath/structures/Buffer;)Z public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Lkotlin/ranges/ClosedFloatingPointRange;Ljava/lang/Object;)Z public static final fun equals-impl0 (Lkotlin/ranges/ClosedFloatingPointRange;Lkotlin/ranges/ClosedFloatingPointRange;)Z public fun getDimension ()I public static fun getDimension-impl (Lkotlin/ranges/ClosedFloatingPointRange;)I public fun getLowerBound (I)Ljava/lang/Double; - public fun getLowerBound (ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; + public fun getLowerBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; public static fun getLowerBound-impl (Lkotlin/ranges/ClosedFloatingPointRange;I)Ljava/lang/Double; - public static fun getLowerBound-impl (Lkotlin/ranges/ClosedFloatingPointRange;ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; + public static fun getLowerBound-impl (Lkotlin/ranges/ClosedFloatingPointRange;ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; public final fun getRange ()Lkotlin/ranges/ClosedFloatingPointRange; public fun getUpperBound (I)Ljava/lang/Double; - public fun getUpperBound (ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; + public fun getUpperBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; public static fun getUpperBound-impl (Lkotlin/ranges/ClosedFloatingPointRange;I)Ljava/lang/Double; - public static fun getUpperBound-impl (Lkotlin/ranges/ClosedFloatingPointRange;ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; + public static fun getUpperBound-impl (Lkotlin/ranges/ClosedFloatingPointRange;ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; public fun hashCode ()I public static fun hashCode-impl (Lkotlin/ranges/ClosedFloatingPointRange;)I - public fun nearestInDomain (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static fun nearestInDomain-impl (Lkotlin/ranges/ClosedFloatingPointRange;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun nearestInDomain (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun nearestInDomain-impl (Lkotlin/ranges/ClosedFloatingPointRange;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun toString ()Ljava/lang/String; public static fun toString-impl (Lkotlin/ranges/ClosedFloatingPointRange;)Ljava/lang/String; public final synthetic fun unbox-impl ()Lkotlin/ranges/ClosedFloatingPointRange; @@ -67,384 +67,384 @@ public final class kscience/kmath/domains/UnivariateDomain : kscience/kmath/doma public static fun volume-impl (Lkotlin/ranges/ClosedFloatingPointRange;)D } -public abstract interface class kscience/kmath/expressions/AutoDiffProcessor { - public abstract fun process (Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/DifferentiableExpression; +public abstract interface class space/kscience/kmath/expressions/AutoDiffProcessor { + public abstract fun process (Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/DifferentiableExpression; } -public class kscience/kmath/expressions/AutoDiffValue { +public class space/kscience/kmath/expressions/AutoDiffValue { public fun (Ljava/lang/Object;)V public final fun getValue ()Ljava/lang/Object; } -public final class kscience/kmath/expressions/DerivationResult { - public fun (Ljava/lang/Object;Ljava/util/Map;Lkscience/kmath/operations/Field;)V - public final fun derivative (Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; +public final class space/kscience/kmath/expressions/DerivationResult { + public fun (Ljava/lang/Object;Ljava/util/Map;Lspace/kscience/kmath/operations/Field;)V + public final fun derivative (Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; public final fun div ()Ljava/lang/Object; - public final fun getContext ()Lkscience/kmath/operations/Field; + public final fun getContext ()Lspace/kscience/kmath/operations/Field; public final fun getValue ()Ljava/lang/Object; } -public abstract interface class kscience/kmath/expressions/DifferentiableExpression : kscience/kmath/expressions/Expression { - public abstract fun derivativeOrNull (Ljava/util/List;)Lkscience/kmath/expressions/Expression; +public abstract interface class space/kscience/kmath/expressions/DifferentiableExpression : space/kscience/kmath/expressions/Expression { + public abstract fun derivativeOrNull (Ljava/util/List;)Lspace/kscience/kmath/expressions/Expression; } -public final class kscience/kmath/expressions/DifferentiableExpressionKt { - public static final fun derivative (Lkscience/kmath/expressions/DifferentiableExpression;Ljava/lang/String;)Lkscience/kmath/expressions/Expression; - public static final fun derivative (Lkscience/kmath/expressions/DifferentiableExpression;Ljava/util/List;)Lkscience/kmath/expressions/Expression; - public static final fun derivative (Lkscience/kmath/expressions/DifferentiableExpression;[Lkscience/kmath/expressions/Symbol;)Lkscience/kmath/expressions/Expression; +public final class space/kscience/kmath/expressions/DifferentiableExpressionKt { + public static final fun derivative (Lspace/kscience/kmath/expressions/DifferentiableExpression;Ljava/lang/String;)Lspace/kscience/kmath/expressions/Expression; + public static final fun derivative (Lspace/kscience/kmath/expressions/DifferentiableExpression;Ljava/util/List;)Lspace/kscience/kmath/expressions/Expression; + public static final fun derivative (Lspace/kscience/kmath/expressions/DifferentiableExpression;[Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/expressions/Expression; } -public abstract interface class kscience/kmath/expressions/Expression { +public abstract interface class space/kscience/kmath/expressions/Expression { public abstract fun invoke (Ljava/util/Map;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/expressions/ExpressionAlgebra : kscience/kmath/operations/Algebra { - public abstract fun bindOrNull (Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; +public abstract interface class space/kscience/kmath/expressions/ExpressionAlgebra : space/kscience/kmath/operations/Algebra { + public abstract fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public abstract fun bindSymbolOrNull (Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; public abstract fun const (Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun symbol (Ljava/lang/String;)Ljava/lang/Object; } -public final class kscience/kmath/expressions/ExpressionAlgebra$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun symbol (Lkscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; +public final class space/kscience/kmath/expressions/ExpressionAlgebra$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/expressions/ExpressionBuildersKt { - public static final fun extendedFieldExpression (Lkscience/kmath/operations/ExtendedField;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/Expression; - public static final fun fieldExpression (Lkscience/kmath/operations/Field;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/Expression; - public static final fun ringExpression (Lkscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/Expression; - public static final fun spaceExpression (Lkscience/kmath/operations/Space;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/Expression; +public final class space/kscience/kmath/expressions/ExpressionBuildersKt { + public static final fun extendedFieldExpression (Lspace/kscience/kmath/operations/ExtendedField;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; + public static final fun fieldExpression (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; + public static final fun ringExpression (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; + public static final fun spaceExpression (Lspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; } -public final class kscience/kmath/expressions/ExpressionKt { - public static final fun bind (Lkscience/kmath/expressions/ExpressionAlgebra;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static final fun binding (Lkscience/kmath/expressions/ExpressionAlgebra;)Lkotlin/properties/ReadOnlyProperty; - public static final fun callByString (Lkscience/kmath/expressions/Expression;[Lkotlin/Pair;)Ljava/lang/Object; - public static final fun callBySymbol (Lkscience/kmath/expressions/Expression;[Lkotlin/Pair;)Ljava/lang/Object; +public final class space/kscience/kmath/expressions/ExpressionKt { + public static final fun bindSymbol (Lspace/kscience/kmath/expressions/ExpressionAlgebra;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static final fun binding (Lspace/kscience/kmath/expressions/ExpressionAlgebra;)Lkotlin/properties/ReadOnlyProperty; + public static final fun callByString (Lspace/kscience/kmath/expressions/Expression;[Lkotlin/Pair;)Ljava/lang/Object; + public static final fun callBySymbol (Lspace/kscience/kmath/expressions/Expression;[Lkotlin/Pair;)Ljava/lang/Object; public static final fun getSymbol ()Lkotlin/properties/ReadOnlyProperty; - public static final fun invoke (Lkscience/kmath/expressions/Expression;)Ljava/lang/Object; + public static final fun invoke (Lspace/kscience/kmath/expressions/Expression;)Ljava/lang/Object; } -public abstract class kscience/kmath/expressions/FirstDerivativeExpression : kscience/kmath/expressions/DifferentiableExpression { +public abstract class space/kscience/kmath/expressions/FirstDerivativeExpression : space/kscience/kmath/expressions/DifferentiableExpression { public fun ()V - public final fun derivativeOrNull (Ljava/util/List;)Lkscience/kmath/expressions/Expression; - public abstract fun derivativeOrNull (Lkscience/kmath/expressions/Symbol;)Lkscience/kmath/expressions/Expression; + public final fun derivativeOrNull (Ljava/util/List;)Lspace/kscience/kmath/expressions/Expression; + public abstract fun derivativeOrNull (Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/expressions/Expression; } -public abstract class kscience/kmath/expressions/FunctionalExpressionAlgebra : kscience/kmath/expressions/ExpressionAlgebra { - public fun (Lkscience/kmath/operations/Algebra;)V +public abstract class space/kscience/kmath/expressions/FunctionalExpressionAlgebra : space/kscience/kmath/expressions/ExpressionAlgebra { + public fun (Lspace/kscience/kmath/operations/Algebra;)V public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/expressions/Expression;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun bindOrNull (Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public fun bindOrNull (Lkscience/kmath/expressions/Symbol;)Lkscience/kmath/expressions/Expression; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/expressions/Expression; + public synthetic fun bindSymbolOrNull (Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public fun bindSymbolOrNull (Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun const (Ljava/lang/Object;)Ljava/lang/Object; - public fun const (Ljava/lang/Object;)Lkscience/kmath/expressions/Expression; - public final fun getAlgebra ()Lkscience/kmath/operations/Algebra; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/expressions/Expression; + public fun const (Ljava/lang/Object;)Lspace/kscience/kmath/expressions/Expression; + public final fun getAlgebra ()Lspace/kscience/kmath/operations/Algebra; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/expressions/FunctionalExpressionAlgebraKt { - public static final fun expressionInExtendedField (Lkscience/kmath/operations/ExtendedField;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/Expression; - public static final fun expressionInField (Lkscience/kmath/operations/Field;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/Expression; - public static final fun expressionInRing (Lkscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/Expression; - public static final fun expressionInSpace (Lkscience/kmath/operations/Space;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/Expression; +public final class space/kscience/kmath/expressions/FunctionalExpressionAlgebraKt { + public static final fun expressionInExtendedField (Lspace/kscience/kmath/operations/ExtendedField;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; + public static final fun expressionInField (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; + public static final fun expressionInRing (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; + public static final fun expressionInSpace (Lspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; } -public class kscience/kmath/expressions/FunctionalExpressionExtendedField : kscience/kmath/expressions/FunctionalExpressionField, kscience/kmath/operations/ExtendedField { - public fun (Lkscience/kmath/operations/ExtendedField;)V +public class space/kscience/kmath/expressions/FunctionalExpressionExtendedField : space/kscience/kmath/expressions/FunctionalExpressionField, space/kscience/kmath/operations/ExtendedField { + public fun (Lspace/kscience/kmath/operations/ExtendedField;)V public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; - public fun acos (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun acos (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun acosh (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun acosh (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; - public fun asin (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun asin (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun asinh (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun asinh (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; - public fun atan (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun atan (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun atanh (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun atanh (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; - public fun cos (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun cos (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun cosh (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun cosh (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; - public fun exp (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun exp (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; - public fun ln (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun ln (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number (Ljava/lang/Number;)Lkscience/kmath/expressions/Expression; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun pow (Lkscience/kmath/expressions/Expression;Ljava/lang/Number;)Lkscience/kmath/expressions/Expression; + public fun pow (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun power (Lkscience/kmath/expressions/Expression;Ljava/lang/Number;)Lkscience/kmath/expressions/Expression; + public fun power (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lkscience/kmath/expressions/Expression;Ljava/lang/Number;)Lkscience/kmath/expressions/Expression; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; - public fun sin (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun sin (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun sinh (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun sinh (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun sqrt (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun sqrt (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; - public fun tan (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun tan (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun tanh (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun tanh (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public class kscience/kmath/expressions/FunctionalExpressionField : kscience/kmath/expressions/FunctionalExpressionRing, kscience/kmath/operations/Field { - public fun (Lkscience/kmath/operations/Field;)V +public class space/kscience/kmath/expressions/FunctionalExpressionField : space/kscience/kmath/expressions/FunctionalExpressionRing, space/kscience/kmath/operations/Field { + public fun (Lspace/kscience/kmath/operations/Field;)V public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Number;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun div (Ljava/lang/Number;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public final fun div (Ljava/lang/Object;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; - public final fun div (Lkscience/kmath/expressions/Expression;Ljava/lang/Object;)Lkscience/kmath/expressions/Expression; - public fun div (Lkscience/kmath/expressions/Expression;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public final fun div (Ljava/lang/Object;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; + public final fun div (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Object;)Lspace/kscience/kmath/expressions/Expression; + public fun div (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide (Lkscience/kmath/expressions/Expression;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun divide (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public class kscience/kmath/expressions/FunctionalExpressionRing : kscience/kmath/expressions/FunctionalExpressionSpace, kscience/kmath/operations/Ring { - public fun (Lkscience/kmath/operations/Ring;)V +public class space/kscience/kmath/expressions/FunctionalExpressionRing : space/kscience/kmath/expressions/FunctionalExpressionSpace, space/kscience/kmath/operations/Ring { + public fun (Lspace/kscience/kmath/operations/Ring;)V public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lkscience/kmath/expressions/Expression; + public fun getOne ()Lspace/kscience/kmath/expressions/Expression; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/expressions/Expression;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun multiply (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public final fun times (Ljava/lang/Object;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; - public final fun times (Lkscience/kmath/expressions/Expression;Ljava/lang/Object;)Lkscience/kmath/expressions/Expression; - public fun times (Lkscience/kmath/expressions/Expression;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public final fun times (Ljava/lang/Object;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; + public final fun times (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Object;)Lspace/kscience/kmath/expressions/Expression; + public fun times (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public class kscience/kmath/expressions/FunctionalExpressionSpace : kscience/kmath/expressions/FunctionalExpressionAlgebra, kscience/kmath/operations/Space { - public fun (Lkscience/kmath/operations/Space;)V +public class space/kscience/kmath/expressions/FunctionalExpressionSpace : space/kscience/kmath/expressions/FunctionalExpressionAlgebra, space/kscience/kmath/operations/Space { + public fun (Lspace/kscience/kmath/operations/Space;)V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lkscience/kmath/expressions/Expression;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun add (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun div (Lkscience/kmath/expressions/Expression;Ljava/lang/Number;)Lkscience/kmath/expressions/Expression; + public fun div (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lkscience/kmath/expressions/Expression; + public fun getZero ()Lspace/kscience/kmath/expressions/Expression; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public final fun minus (Ljava/lang/Object;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; - public final fun minus (Lkscience/kmath/expressions/Expression;Ljava/lang/Object;)Lkscience/kmath/expressions/Expression; - public fun minus (Lkscience/kmath/expressions/Expression;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public final fun minus (Ljava/lang/Object;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; + public final fun minus (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Object;)Lspace/kscience/kmath/expressions/Expression; + public fun minus (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/expressions/Expression;Ljava/lang/Number;)Lkscience/kmath/expressions/Expression; + public fun multiply (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public final fun plus (Ljava/lang/Object;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; - public final fun plus (Lkscience/kmath/expressions/Expression;Ljava/lang/Object;)Lkscience/kmath/expressions/Expression; - public fun plus (Lkscience/kmath/expressions/Expression;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public final fun plus (Ljava/lang/Object;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; + public final fun plus (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Object;)Lspace/kscience/kmath/expressions/Expression; + public fun plus (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun times (Lkscience/kmath/expressions/Expression;Ljava/lang/Number;)Lkscience/kmath/expressions/Expression; + public fun times (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun unaryMinus (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun unaryPlus (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; } -public final class kscience/kmath/expressions/SimpleAutoDiffExpression : kscience/kmath/expressions/FirstDerivativeExpression { - public fun (Lkscience/kmath/operations/Field;Lkotlin/jvm/functions/Function1;)V - public fun derivativeOrNull (Lkscience/kmath/expressions/Symbol;)Lkscience/kmath/expressions/Expression; - public final fun getField ()Lkscience/kmath/operations/Field; +public final class space/kscience/kmath/expressions/SimpleAutoDiffExpression : space/kscience/kmath/expressions/FirstDerivativeExpression { + public fun (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function1;)V + public fun derivativeOrNull (Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/expressions/Expression; + public final fun getField ()Lspace/kscience/kmath/operations/Field; public final fun getFunction ()Lkotlin/jvm/functions/Function1; public fun invoke (Ljava/util/Map;)Ljava/lang/Object; } -public final class kscience/kmath/expressions/SimpleAutoDiffExtendedField : kscience/kmath/expressions/SimpleAutoDiffField, kscience/kmath/operations/ExtendedField { - public fun (Lkscience/kmath/operations/ExtendedField;Ljava/util/Map;)V +public final class space/kscience/kmath/expressions/SimpleAutoDiffExtendedField : space/kscience/kmath/expressions/SimpleAutoDiffField, space/kscience/kmath/operations/ExtendedField { + public fun (Lspace/kscience/kmath/operations/ExtendedField;Ljava/util/Map;)V public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; - public fun acos (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun acos (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun acosh (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun acosh (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; - public fun asin (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun asin (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun asinh (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun asinh (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; - public fun atan (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun atan (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun atanh (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun atanh (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; - public fun cos (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun cos (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun cosh (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun cosh (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; - public fun exp (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun exp (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; - public fun ln (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun ln (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun pow (Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; - public final fun pow (Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun pow (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public final fun pow (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun power (Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; + public fun power (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; - public fun sin (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun sin (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun sinh (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public final fun sqr (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun sinh (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public final fun sqr (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun sqrt (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun sqrt (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; - public fun tan (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun tan (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun tanh (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun tanh (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public class kscience/kmath/expressions/SimpleAutoDiffField : kscience/kmath/expressions/ExpressionAlgebra, kscience/kmath/operations/Field, kscience/kmath/operations/RingWithNumbers { - public fun (Lkscience/kmath/operations/Field;Ljava/util/Map;)V +public class space/kscience/kmath/expressions/SimpleAutoDiffField : space/kscience/kmath/expressions/ExpressionAlgebra, space/kscience/kmath/operations/Field, space/kscience/kmath/operations/RingWithNumbers { + public fun (Lspace/kscience/kmath/operations/Field;Ljava/util/Map;)V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun add (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun bindOrNull (Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public fun bindOrNull (Lkscience/kmath/expressions/Symbol;)Lkscience/kmath/expressions/AutoDiffValue; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public synthetic fun bindSymbolOrNull (Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public fun bindSymbolOrNull (Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun const (Ljava/lang/Object;)Ljava/lang/Object; - public fun const (Ljava/lang/Object;)Lkscience/kmath/expressions/AutoDiffValue; - public final fun const (Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/AutoDiffValue; + public fun const (Ljava/lang/Object;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public final fun const (Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/AutoDiffValue; public final fun derive (Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Number;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun div (Ljava/lang/Number;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; - public fun div (Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun div (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public fun div (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide (Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public final fun getContext ()Lkscience/kmath/operations/Field; - public final fun getD (Lkscience/kmath/expressions/AutoDiffValue;)Ljava/lang/Object; + public fun divide (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public final fun getContext ()Lspace/kscience/kmath/operations/Field; + public final fun getD (Lspace/kscience/kmath/expressions/AutoDiffValue;)Ljava/lang/Object; public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lkscience/kmath/expressions/AutoDiffValue; + public fun getOne ()Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lkscience/kmath/expressions/AutoDiffValue; + public fun getZero ()Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Ljava/lang/Number;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun minus (Ljava/lang/Number;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; - public fun minus (Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun minus (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public fun minus (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; - public fun multiply (Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun multiply (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public fun multiply (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number (Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Ljava/lang/Number;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun plus (Ljava/lang/Number;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; - public fun plus (Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun plus (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public fun plus (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public final fun setD (Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Object;)V - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/expressions/AutoDiffValue; + public final fun setD (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Object;)V public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; - public fun times (Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun times (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public fun times (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun unaryMinus (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun unaryPlus (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; } -public final class kscience/kmath/expressions/SimpleAutoDiffKt { - public static final fun acos (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun acosh (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun asin (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun asinh (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun atan (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun atanh (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun cos (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun cosh (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun exp (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun grad (Lkscience/kmath/expressions/DerivationResult;[Lkscience/kmath/expressions/Symbol;)Lkscience/kmath/structures/Buffer; - public static final fun ln (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun pow (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;D)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun pow (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;I)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun pow (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun simpleAutoDiff (Lkscience/kmath/operations/Field;)Lkscience/kmath/expressions/AutoDiffProcessor; - public static final fun simpleAutoDiff (Lkscience/kmath/operations/Field;Ljava/util/Map;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/DerivationResult; - public static final fun simpleAutoDiff (Lkscience/kmath/operations/Field;[Lkotlin/Pair;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/DerivationResult; - public static final fun sin (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun sinh (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun sqr (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun sqrt (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun tan (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun tanh (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; +public final class space/kscience/kmath/expressions/SimpleAutoDiffKt { + public static final fun acos (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun acosh (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun asin (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun asinh (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun atan (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun atanh (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun cos (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun cosh (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun exp (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun grad (Lspace/kscience/kmath/expressions/DerivationResult;[Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/structures/Buffer; + public static final fun ln (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun pow (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;D)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun pow (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;I)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun pow (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun simpleAutoDiff (Lspace/kscience/kmath/operations/Field;)Lspace/kscience/kmath/expressions/AutoDiffProcessor; + public static final fun simpleAutoDiff (Lspace/kscience/kmath/operations/Field;Ljava/util/Map;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/DerivationResult; + public static final fun simpleAutoDiff (Lspace/kscience/kmath/operations/Field;[Lkotlin/Pair;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/DerivationResult; + public static final fun sin (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun sinh (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun sqr (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun sqrt (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun tan (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun tanh (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; } -public final class kscience/kmath/expressions/SimpleSymbolIndexer : kscience/kmath/expressions/SymbolIndexer { - public static final synthetic fun box-impl (Ljava/util/List;)Lkscience/kmath/expressions/SimpleSymbolIndexer; +public final class space/kscience/kmath/expressions/SimpleSymbolIndexer : space/kscience/kmath/expressions/SymbolIndexer { + public static final synthetic fun box-impl (Ljava/util/List;)Lspace/kscience/kmath/expressions/SimpleSymbolIndexer; public static fun constructor-impl (Ljava/util/List;)Ljava/util/List; public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Ljava/util/List;Ljava/lang/Object;)Z public static final fun equals-impl0 (Ljava/util/List;Ljava/util/List;)Z - public fun get (Ljava/util/List;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public fun get (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/expressions/Symbol;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public fun get (Lkscience/kmath/structures/Buffer;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public fun get ([DLkscience/kmath/expressions/Symbol;)D - public fun get ([Ljava/lang/Object;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get-impl (Ljava/util/List;Ljava/util/List;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get-impl (Ljava/util/List;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/expressions/Symbol;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get-impl (Ljava/util/List;Lkscience/kmath/structures/Buffer;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get-impl (Ljava/util/List;[DLkscience/kmath/expressions/Symbol;)D - public static fun get-impl (Ljava/util/List;[Ljava/lang/Object;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public fun get (Ljava/util/List;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public fun get (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/expressions/Symbol;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public fun get (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public fun get ([DLspace/kscience/kmath/expressions/Symbol;)D + public fun get ([Ljava/lang/Object;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static fun get-impl (Ljava/util/List;Ljava/util/List;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static fun get-impl (Ljava/util/List;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/expressions/Symbol;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static fun get-impl (Ljava/util/List;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static fun get-impl (Ljava/util/List;[DLspace/kscience/kmath/expressions/Symbol;)D + public static fun get-impl (Ljava/util/List;[Ljava/lang/Object;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; public fun getSymbols ()Ljava/util/List; public fun hashCode ()I public static fun hashCode-impl (Ljava/util/List;)I - public fun indexOf (Lkscience/kmath/expressions/Symbol;)I - public static fun indexOf-impl (Ljava/util/List;Lkscience/kmath/expressions/Symbol;)I + public fun indexOf (Lspace/kscience/kmath/expressions/Symbol;)I + public static fun indexOf-impl (Ljava/util/List;Lspace/kscience/kmath/expressions/Symbol;)I public fun toDoubleArray (Ljava/util/Map;)[D public static fun toDoubleArray-impl (Ljava/util/List;Ljava/util/Map;)[D public fun toList (Ljava/util/Map;)Ljava/util/List; public static fun toList-impl (Ljava/util/List;Ljava/util/Map;)Ljava/util/List; public fun toMap ([D)Ljava/util/Map; public static fun toMap-impl (Ljava/util/List;[D)Ljava/util/Map; - public fun toPoint (Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/structures/Buffer; - public static fun toPoint-impl (Ljava/util/List;Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/structures/Buffer; + public fun toPoint (Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; + public static fun toPoint-impl (Ljava/util/List;Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; public fun toString ()Ljava/lang/String; public static fun toString-impl (Ljava/util/List;)Ljava/lang/String; public final synthetic fun unbox-impl ()Ljava/util/List; } -public final class kscience/kmath/expressions/StringSymbol : kscience/kmath/expressions/Symbol { - public static final synthetic fun box-impl (Ljava/lang/String;)Lkscience/kmath/expressions/StringSymbol; +public final class space/kscience/kmath/expressions/StringSymbol : space/kscience/kmath/expressions/Symbol { + public static final synthetic fun box-impl (Ljava/lang/String;)Lspace/kscience/kmath/expressions/StringSymbol; public static fun constructor-impl (Ljava/lang/String;)Ljava/lang/String; public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Ljava/lang/String;Ljava/lang/Object;)Z @@ -457,463 +457,463 @@ public final class kscience/kmath/expressions/StringSymbol : kscience/kmath/expr public final synthetic fun unbox-impl ()Ljava/lang/String; } -public abstract interface class kscience/kmath/expressions/Symbol { +public abstract interface class space/kscience/kmath/expressions/Symbol { public abstract fun getIdentity ()Ljava/lang/String; } -public abstract interface class kscience/kmath/expressions/SymbolIndexer { - public abstract fun get (Ljava/util/List;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public abstract fun get (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/expressions/Symbol;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public abstract fun get (Lkscience/kmath/structures/Buffer;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public abstract fun get ([DLkscience/kmath/expressions/Symbol;)D - public abstract fun get ([Ljava/lang/Object;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; +public abstract interface class space/kscience/kmath/expressions/SymbolIndexer { + public abstract fun get (Ljava/util/List;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public abstract fun get (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/expressions/Symbol;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public abstract fun get (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public abstract fun get ([DLspace/kscience/kmath/expressions/Symbol;)D + public abstract fun get ([Ljava/lang/Object;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; public abstract fun getSymbols ()Ljava/util/List; - public abstract fun indexOf (Lkscience/kmath/expressions/Symbol;)I + public abstract fun indexOf (Lspace/kscience/kmath/expressions/Symbol;)I public abstract fun toDoubleArray (Ljava/util/Map;)[D public abstract fun toList (Ljava/util/Map;)Ljava/util/List; public abstract fun toMap ([D)Ljava/util/Map; - public abstract fun toPoint (Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/structures/Buffer; + public abstract fun toPoint (Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; } -public final class kscience/kmath/expressions/SymbolIndexer$DefaultImpls { - public static fun get (Lkscience/kmath/expressions/SymbolIndexer;Ljava/util/List;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get (Lkscience/kmath/expressions/SymbolIndexer;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/expressions/Symbol;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get (Lkscience/kmath/expressions/SymbolIndexer;Lkscience/kmath/structures/Buffer;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get (Lkscience/kmath/expressions/SymbolIndexer;[DLkscience/kmath/expressions/Symbol;)D - public static fun get (Lkscience/kmath/expressions/SymbolIndexer;[Ljava/lang/Object;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun indexOf (Lkscience/kmath/expressions/SymbolIndexer;Lkscience/kmath/expressions/Symbol;)I - public static fun toDoubleArray (Lkscience/kmath/expressions/SymbolIndexer;Ljava/util/Map;)[D - public static fun toList (Lkscience/kmath/expressions/SymbolIndexer;Ljava/util/Map;)Ljava/util/List; - public static fun toMap (Lkscience/kmath/expressions/SymbolIndexer;[D)Ljava/util/Map; - public static fun toPoint (Lkscience/kmath/expressions/SymbolIndexer;Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/structures/Buffer; +public final class space/kscience/kmath/expressions/SymbolIndexer$DefaultImpls { + public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;Ljava/util/List;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/expressions/Symbol;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;[DLspace/kscience/kmath/expressions/Symbol;)D + public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;[Ljava/lang/Object;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static fun indexOf (Lspace/kscience/kmath/expressions/SymbolIndexer;Lspace/kscience/kmath/expressions/Symbol;)I + public static fun toDoubleArray (Lspace/kscience/kmath/expressions/SymbolIndexer;Ljava/util/Map;)[D + public static fun toList (Lspace/kscience/kmath/expressions/SymbolIndexer;Ljava/util/Map;)Ljava/util/List; + public static fun toMap (Lspace/kscience/kmath/expressions/SymbolIndexer;[D)Ljava/util/Map; + public static fun toPoint (Lspace/kscience/kmath/expressions/SymbolIndexer;Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; } -public final class kscience/kmath/expressions/SymbolIndexerKt { +public final class space/kscience/kmath/expressions/SymbolIndexerKt { public static final fun withSymbols (Ljava/util/Collection;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun withSymbols ([Lkscience/kmath/expressions/Symbol;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final fun withSymbols ([Lspace/kscience/kmath/expressions/Symbol;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; } -public final class kscience/kmath/linear/BufferMatrix : kscience/kmath/nd/Structure2D { - public fun (IILkscience/kmath/structures/Buffer;)V +public final class space/kscience/kmath/linear/BufferMatrix : space/kscience/kmath/nd/Structure2D { + public fun (IILspace/kscience/kmath/structures/Buffer;)V public fun elements ()Lkotlin/sequences/Sequence; public fun equals (Ljava/lang/Object;)Z public fun get (II)Ljava/lang/Object; public fun get ([I)Ljava/lang/Object; - public final fun getBuffer ()Lkscience/kmath/structures/Buffer; + public final fun getBuffer ()Lspace/kscience/kmath/structures/Buffer; public fun getColNum ()I - public fun getColumns ()Lkscience/kmath/structures/Buffer; + public fun getColumns ()Lspace/kscience/kmath/structures/Buffer; public fun getDimension ()I public fun getFeature (Lkotlin/reflect/KClass;)Ljava/lang/Object; public fun getRowNum ()I - public fun getRows ()Lkscience/kmath/structures/Buffer; + public fun getRows ()Lspace/kscience/kmath/structures/Buffer; public fun getShape ()[I public fun hashCode ()I public fun toString ()Ljava/lang/String; } -public final class kscience/kmath/linear/BufferMatrixContext : kscience/kmath/linear/GenericMatrixContext { - public static final field Companion Lkscience/kmath/linear/BufferMatrixContext$Companion; - public fun (Lkscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V +public final class space/kscience/kmath/linear/BufferMatrixContext : space/kscience/kmath/linear/GenericMatrixContext { + public static final field Companion Lspace/kscience/kmath/linear/BufferMatrixContext$Companion; + public fun (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/linear/BufferMatrix; - public synthetic fun add (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun add (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun add (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun div (Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; - 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 getElementContext ()Lkscience/kmath/operations/Ring; + public fun div (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public fun getElementContext ()Lspace/kscience/kmath/operations/Ring; 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; + public fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/linear/BufferMatrix; - public synthetic fun multiply (Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; - public final fun one (II)Lkscience/kmath/nd/Structure2D; + public fun multiply (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun multiply (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public final fun one (II)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public fun point (ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/Buffer; - public fun produce (IILkotlin/jvm/functions/Function2;)Lkscience/kmath/linear/BufferMatrix; - public synthetic fun produce (IILkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/Structure2D; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/nd/Structure2D; + public fun plus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun point (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun times (Ljava/lang/Object;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/linear/BufferMatrix; - public synthetic fun times (Ljava/lang/Object;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public fun times (Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; - public fun times (Lkscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lkscience/kmath/linear/BufferMatrix; - public synthetic fun times (Lkscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; + public fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/linear/BufferMatrix; - public synthetic fun unaryMinus (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun unaryMinus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun unaryMinus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun unaryPlus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/BufferMatrixContext$Companion { +public final class space/kscience/kmath/linear/BufferMatrixContext$Companion { } -public final class kscience/kmath/linear/BufferVectorSpace : kscience/kmath/linear/VectorSpace { - public fun (ILkscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;)V +public final class space/kscience/kmath/linear/BufferVectorSpace : space/kscience/kmath/linear/VectorSpace { + public fun (ILspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;)V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun add (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun div (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; + public fun div (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public final fun getBufferFactory ()Lkotlin/jvm/functions/Function2; public fun getSize ()I - public fun getSpace ()Lkscience/kmath/operations/Space; + public fun getSpace ()Lspace/kscience/kmath/operations/Space; public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lkscience/kmath/structures/Buffer; + public fun getZero ()Lspace/kscience/kmath/structures/Buffer; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun minus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; + public fun multiply (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/structures/Buffer; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/structures/Buffer; + public fun plus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun times (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; + public fun times (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryPlus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; } -public abstract interface class kscience/kmath/linear/CholeskyDecompositionFeature : kscience/kmath/linear/MatrixFeature { - public abstract fun getL ()Lkscience/kmath/nd/Structure2D; +public abstract interface class space/kscience/kmath/linear/CholeskyDecompositionFeature : space/kscience/kmath/linear/MatrixFeature { + public abstract fun getL ()Lspace/kscience/kmath/nd/Structure2D; } -public abstract interface class kscience/kmath/linear/DeterminantFeature : kscience/kmath/linear/MatrixFeature { +public abstract interface class space/kscience/kmath/linear/DeterminantFeature : space/kscience/kmath/linear/MatrixFeature { public abstract fun getDeterminant ()Ljava/lang/Object; } -public abstract interface class kscience/kmath/linear/DiagonalFeature : kscience/kmath/linear/MatrixFeature { - public static final field Companion Lkscience/kmath/linear/DiagonalFeature$Companion; +public abstract interface class space/kscience/kmath/linear/DiagonalFeature : space/kscience/kmath/linear/MatrixFeature { + public static final field Companion Lspace/kscience/kmath/linear/DiagonalFeature$Companion; } -public final class kscience/kmath/linear/DiagonalFeature$Companion : kscience/kmath/linear/DiagonalFeature { +public final class space/kscience/kmath/linear/DiagonalFeature$Companion : space/kscience/kmath/linear/DiagonalFeature { } -public abstract interface class kscience/kmath/linear/GenericMatrixContext : kscience/kmath/linear/MatrixContext { - public abstract fun add (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - 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 getElementContext ()Lkscience/kmath/operations/Ring; - public abstract fun minus (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public abstract fun multiply (Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; - public abstract fun times (Lkscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; - public abstract fun unaryMinus (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; +public abstract interface class space/kscience/kmath/linear/GenericMatrixContext : space/kscience/kmath/linear/MatrixContext { + public abstract fun add (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public abstract fun getElementContext ()Lspace/kscience/kmath/operations/Ring; + public abstract fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun multiply (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun unaryMinus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/GenericMatrixContext$DefaultImpls { - public static fun add (Lkscience/kmath/linear/GenericMatrixContext;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun binaryOperation (Lkscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun binaryOperationFunction (Lkscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - 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 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; - public static fun point (Lkscience/kmath/linear/GenericMatrixContext;ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/Buffer; - public static fun symbol (Lkscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lkscience/kmath/nd/Structure2D; - public static fun times (Lkscience/kmath/linear/GenericMatrixContext;Ljava/lang/Number;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun times (Lkscience/kmath/linear/GenericMatrixContext;Ljava/lang/Object;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun times (Lkscience/kmath/linear/GenericMatrixContext;Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; - public static fun times (Lkscience/kmath/linear/GenericMatrixContext;Lkscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; - public static fun unaryMinus (Lkscience/kmath/linear/GenericMatrixContext;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun unaryOperation (Lkscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun unaryOperationFunction (Lkscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/linear/GenericMatrixContext;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; +public final class space/kscience/kmath/linear/GenericMatrixContext$DefaultImpls { + public static fun add (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun binaryOperation (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun binaryOperationFunction (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lspace/kscience/kmath/nd/Structure2D; + public static fun div (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public static fun dot (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun dot (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun minus (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun multiply (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public static fun plus (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun point (Lspace/kscience/kmath/linear/GenericMatrixContext;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public static fun times (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/Number;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun times (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun times (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public static fun times (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; + public static fun unaryMinus (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun unaryOperation (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun unaryOperationFunction (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; } -public abstract interface class kscience/kmath/linear/InverseMatrixFeature : kscience/kmath/linear/MatrixFeature { - public abstract fun getInverse ()Lkscience/kmath/nd/Structure2D; +public abstract interface class space/kscience/kmath/linear/InverseMatrixFeature : space/kscience/kmath/linear/MatrixFeature { + public abstract fun getInverse ()Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/LFeature : kscience/kmath/linear/MatrixFeature { - public static final field INSTANCE Lkscience/kmath/linear/LFeature; +public final class space/kscience/kmath/linear/LFeature : space/kscience/kmath/linear/MatrixFeature { + public static final field INSTANCE Lspace/kscience/kmath/linear/LFeature; } -public final class kscience/kmath/linear/LinearAlgebraKt { - public static final fun asMatrix (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/linear/VirtualMatrix; - public static final fun asPoint (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/structures/Buffer; +public final class space/kscience/kmath/linear/LinearAlgebraKt { + public static final fun asMatrix (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/linear/VirtualMatrix; + public static final fun asPoint (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/structures/Buffer; } -public abstract interface class kscience/kmath/linear/LinearSolver { - public abstract fun inverse (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public abstract fun solve (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public abstract fun solve (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; +public abstract interface class space/kscience/kmath/linear/LinearSolver { + public abstract fun inverse (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun solve (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun solve (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; } -public final class kscience/kmath/linear/LinearSolver$DefaultImpls { - public static fun solve (Lkscience/kmath/linear/LinearSolver;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; +public final class space/kscience/kmath/linear/LinearSolver$DefaultImpls { + public static fun solve (Lspace/kscience/kmath/linear/LinearSolver;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; } -public final class kscience/kmath/linear/LupDecomposition : kscience/kmath/linear/DeterminantFeature, kscience/kmath/linear/LupDecompositionFeature { - public fun (Lkscience/kmath/linear/MatrixContext;Lkscience/kmath/operations/Field;Lkscience/kmath/nd/Structure2D;[IZ)V - public final fun getContext ()Lkscience/kmath/linear/MatrixContext; +public final class space/kscience/kmath/linear/LupDecomposition : space/kscience/kmath/linear/DeterminantFeature, space/kscience/kmath/linear/LupDecompositionFeature { + public fun (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/operations/Field;Lspace/kscience/kmath/nd/Structure2D;[IZ)V + public final fun getContext ()Lspace/kscience/kmath/linear/MatrixContext; public fun getDeterminant ()Ljava/lang/Object; - public final fun getElementContext ()Lkscience/kmath/operations/Field; - public fun getL ()Lkscience/kmath/nd/Structure2D; - public final fun getLu ()Lkscience/kmath/nd/Structure2D; - public fun getP ()Lkscience/kmath/nd/Structure2D; + public final fun getElementContext ()Lspace/kscience/kmath/operations/Field; + public fun getL ()Lspace/kscience/kmath/nd/Structure2D; + public final fun getLu ()Lspace/kscience/kmath/nd/Structure2D; + public fun getP ()Lspace/kscience/kmath/nd/Structure2D; public final fun getPivot ()[I - public fun getU ()Lkscience/kmath/nd/Structure2D; + public fun getU ()Lspace/kscience/kmath/nd/Structure2D; } -public abstract interface class kscience/kmath/linear/LupDecompositionFeature : kscience/kmath/linear/MatrixFeature { - public abstract fun getL ()Lkscience/kmath/nd/Structure2D; - public abstract fun getP ()Lkscience/kmath/nd/Structure2D; - public abstract fun getU ()Lkscience/kmath/nd/Structure2D; +public abstract interface class space/kscience/kmath/linear/LupDecompositionFeature : space/kscience/kmath/linear/MatrixFeature { + public abstract fun getL ()Lspace/kscience/kmath/nd/Structure2D; + public abstract fun getP ()Lspace/kscience/kmath/nd/Structure2D; + public abstract fun getU ()Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/LupDecompositionKt { - public static final fun abs (Lkscience/kmath/linear/GenericMatrixContext;Ljava/lang/Comparable;)Ljava/lang/Comparable; - public static final fun inverseWithLup (Lkscience/kmath/linear/RealMatrixContext;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static final fun lup (Lkscience/kmath/linear/MatrixContext;Lkotlin/jvm/functions/Function2;Lkscience/kmath/operations/Field;Lkscience/kmath/nd/Structure2D;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/linear/LupDecomposition; - public static final fun lup (Lkscience/kmath/linear/MatrixContext;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/linear/LupDecomposition; - public static final fun solveWithLup (Lkscience/kmath/linear/LupDecomposition;Lkotlin/jvm/functions/Function2;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static final fun solveWithLup (Lkscience/kmath/linear/RealMatrixContext;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; +public final class space/kscience/kmath/linear/LupDecompositionKt { + public static final fun abs (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/Comparable;)Ljava/lang/Comparable; + public static final fun inverseWithLup (Lspace/kscience/kmath/linear/RealMatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static final fun lup (Lspace/kscience/kmath/linear/MatrixContext;Lkotlin/jvm/functions/Function2;Lspace/kscience/kmath/operations/Field;Lspace/kscience/kmath/nd/Structure2D;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/linear/LupDecomposition; + public static final fun lup (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/LupDecomposition; + public static final fun solveWithLup (Lspace/kscience/kmath/linear/LupDecomposition;Lkotlin/jvm/functions/Function2;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static final fun solveWithLup (Lspace/kscience/kmath/linear/RealMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/MatrixBuilder { +public final class space/kscience/kmath/linear/MatrixBuilder { public fun (II)V public final fun getColumns ()I public final fun getRows ()I - public final fun invoke ([Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; + public final fun invoke ([Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/MatrixBuilderKt { - public static final fun build (Lkscience/kmath/nd/Structure2D$Companion;II)Lkscience/kmath/linear/MatrixBuilder; - public static final fun column (Lkscience/kmath/nd/Structure2D$Companion;[Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; - public static final fun row (Lkscience/kmath/nd/Structure2D$Companion;[Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; +public final class space/kscience/kmath/linear/MatrixBuilderKt { + public static final fun build (Lspace/kscience/kmath/nd/Structure2D$Companion;II)Lspace/kscience/kmath/linear/MatrixBuilder; + public static final fun column (Lspace/kscience/kmath/nd/Structure2D$Companion;[Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; + public static final fun row (Lspace/kscience/kmath/nd/Structure2D$Companion;[Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; } -public abstract interface class kscience/kmath/linear/MatrixContext : kscience/kmath/operations/SpaceOperations { - public static final field Companion Lkscience/kmath/linear/MatrixContext$Companion; +public abstract interface class space/kscience/kmath/linear/MatrixContext : space/kscience/kmath/operations/SpaceOperations { + public static final field Companion Lspace/kscience/kmath/linear/MatrixContext$Companion; 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 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; - public abstract fun times (Lkscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; + public abstract fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public abstract fun point (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public abstract fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/MatrixContext$Companion { - public final fun buffered (Lkscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/linear/GenericMatrixContext; - public static synthetic fun buffered$default (Lkscience/kmath/linear/MatrixContext$Companion;Lkscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkscience/kmath/linear/GenericMatrixContext; +public final class space/kscience/kmath/linear/MatrixContext$Companion { + public final fun buffered (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/GenericMatrixContext; + public static synthetic fun buffered$default (Lspace/kscience/kmath/linear/MatrixContext$Companion;Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lspace/kscience/kmath/linear/GenericMatrixContext; } -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 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; - public static fun symbol (Lkscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lkscience/kmath/nd/Structure2D; - public static fun times (Lkscience/kmath/linear/MatrixContext;Ljava/lang/Number;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun times (Lkscience/kmath/linear/MatrixContext;Ljava/lang/Object;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun times (Lkscience/kmath/linear/MatrixContext;Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; - public static fun unaryMinus (Lkscience/kmath/linear/MatrixContext;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun unaryOperation (Lkscience/kmath/linear/MatrixContext;Ljava/lang/String;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun unaryOperationFunction (Lkscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/linear/MatrixContext;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; +public final class space/kscience/kmath/linear/MatrixContext$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun binaryOperationFunction (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lspace/kscience/kmath/nd/Structure2D; + public static fun div (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public static fun minus (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun plus (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun point (Lspace/kscience/kmath/linear/MatrixContext;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public static fun times (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/Number;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun times (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun times (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public static fun unaryMinus (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun unaryOperation (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun unaryOperationFunction (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; } -public abstract interface class kscience/kmath/linear/MatrixFeature { +public abstract interface class space/kscience/kmath/linear/MatrixFeature { } -public final class kscience/kmath/linear/MatrixFeaturesKt { - public static final fun DeterminantFeature (Ljava/lang/Object;)Lkscience/kmath/linear/DeterminantFeature; +public final class space/kscience/kmath/linear/MatrixFeaturesKt { + public static final fun DeterminantFeature (Ljava/lang/Object;)Lspace/kscience/kmath/linear/DeterminantFeature; } -public final class kscience/kmath/linear/MatrixWrapper : kscience/kmath/nd/Structure2D { +public final class space/kscience/kmath/linear/MatrixWrapper : space/kscience/kmath/nd/Structure2D { public fun elements ()Lkotlin/sequences/Sequence; public fun equals (Ljava/lang/Object;)Z public fun get (II)Ljava/lang/Object; public fun get ([I)Ljava/lang/Object; public fun getColNum ()I - public fun getColumns ()Lkscience/kmath/structures/Buffer; + public fun getColumns ()Lspace/kscience/kmath/structures/Buffer; public fun getDimension ()I public fun getFeature (Lkotlin/reflect/KClass;)Ljava/lang/Object; public final fun getFeatures ()Ljava/util/Set; - public final fun getOrigin ()Lkscience/kmath/nd/Structure2D; + public final fun getOrigin ()Lspace/kscience/kmath/nd/Structure2D; public fun getRowNum ()I - public fun getRows ()Lkscience/kmath/structures/Buffer; + public fun getRows ()Lspace/kscience/kmath/structures/Buffer; public fun getShape ()[I public fun hashCode ()I public fun toString ()Ljava/lang/String; } -public final class kscience/kmath/linear/MatrixWrapperKt { - public static final fun getOrigin (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static final fun one (Lkscience/kmath/linear/GenericMatrixContext;II)Lkscience/kmath/nd/Structure2D; - public static final fun plus (Lkscience/kmath/nd/Structure2D;Ljava/util/Collection;)Lkscience/kmath/linear/MatrixWrapper; - public static final fun plus (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/linear/MatrixFeature;)Lkscience/kmath/linear/MatrixWrapper; - public static final fun square (Lkscience/kmath/nd/Structure2D$Companion;[Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; - public static final fun transpose (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static final fun zero (Lkscience/kmath/linear/GenericMatrixContext;II)Lkscience/kmath/nd/Structure2D; +public final class space/kscience/kmath/linear/MatrixWrapperKt { + public static final fun getOrigin (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static final fun one (Lspace/kscience/kmath/linear/GenericMatrixContext;II)Lspace/kscience/kmath/nd/Structure2D; + public static final fun plus (Lspace/kscience/kmath/nd/Structure2D;Ljava/util/Collection;)Lspace/kscience/kmath/linear/MatrixWrapper; + public static final fun plus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/linear/MatrixFeature;)Lspace/kscience/kmath/linear/MatrixWrapper; + public static final fun square (Lspace/kscience/kmath/nd/Structure2D$Companion;[Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; + public static final fun transpose (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static final fun zero (Lspace/kscience/kmath/linear/GenericMatrixContext;II)Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/OrthogonalFeature : kscience/kmath/linear/MatrixFeature { - public static final field INSTANCE Lkscience/kmath/linear/OrthogonalFeature; +public final class space/kscience/kmath/linear/OrthogonalFeature : space/kscience/kmath/linear/MatrixFeature { + public static final field INSTANCE Lspace/kscience/kmath/linear/OrthogonalFeature; } -public abstract interface class kscience/kmath/linear/QRDecompositionFeature : kscience/kmath/linear/MatrixFeature { - public abstract fun getQ ()Lkscience/kmath/nd/Structure2D; - public abstract fun getR ()Lkscience/kmath/nd/Structure2D; +public abstract interface class space/kscience/kmath/linear/QRDecompositionFeature : space/kscience/kmath/linear/MatrixFeature { + public abstract fun getQ ()Lspace/kscience/kmath/nd/Structure2D; + public abstract fun getR ()Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/RealMatrixContext : kscience/kmath/linear/MatrixContext { - public static final field INSTANCE Lkscience/kmath/linear/RealMatrixContext; +public final class space/kscience/kmath/linear/RealMatrixContext : space/kscience/kmath/linear/MatrixContext { + public static final field INSTANCE Lspace/kscience/kmath/linear/RealMatrixContext; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/linear/BufferMatrix; + public fun add (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun div (Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; - 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 div (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; 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 fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/linear/BufferMatrix; - public final fun one (II)Lkscience/kmath/nd/Structure2D; + public fun multiply (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/linear/BufferMatrix; + public final fun one (II)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public fun point (ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/Buffer; - public fun produce (IILkotlin/jvm/functions/Function2;)Lkscience/kmath/linear/BufferMatrix; - public synthetic fun produce (IILkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/Structure2D; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/nd/Structure2D; - public fun times (DLkscience/kmath/nd/Structure2D;)Lkscience/kmath/linear/BufferMatrix; + public fun plus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun point (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/Structure2D; + public fun times (DLspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public synthetic fun times (Ljava/lang/Object;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public fun times (Lkscience/kmath/nd/Structure2D;D)Lkscience/kmath/linear/BufferMatrix; - public fun times (Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; - public synthetic fun times (Lkscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; - public final fun toBufferMatrix (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/linear/BufferMatrix; + public synthetic fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun times (Lspace/kscience/kmath/nd/Structure2D;D)Lspace/kscience/kmath/linear/BufferMatrix; + public fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public synthetic fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; + public final fun toBufferMatrix (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun unaryMinus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun unaryPlus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/RealMatrixContextKt { - public static final fun getReal (Lkscience/kmath/linear/MatrixContext$Companion;)Lkscience/kmath/linear/RealMatrixContext; +public final class space/kscience/kmath/linear/RealMatrixContextKt { + public static final fun getReal (Lspace/kscience/kmath/linear/MatrixContext$Companion;)Lspace/kscience/kmath/linear/RealMatrixContext; } -public abstract interface class kscience/kmath/linear/SingularValueDecompositionFeature : kscience/kmath/linear/MatrixFeature { - public abstract fun getS ()Lkscience/kmath/nd/Structure2D; - public abstract fun getSingularValues ()Lkscience/kmath/structures/Buffer; - public abstract fun getU ()Lkscience/kmath/nd/Structure2D; - public abstract fun getV ()Lkscience/kmath/nd/Structure2D; +public abstract interface class space/kscience/kmath/linear/SingularValueDecompositionFeature : space/kscience/kmath/linear/MatrixFeature { + public abstract fun getS ()Lspace/kscience/kmath/nd/Structure2D; + public abstract fun getSingularValues ()Lspace/kscience/kmath/structures/Buffer; + public abstract fun getU ()Lspace/kscience/kmath/nd/Structure2D; + public abstract fun getV ()Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/TransposedFeature : kscience/kmath/linear/MatrixFeature { - public fun (Lkscience/kmath/nd/Structure2D;)V - public final fun getOriginal ()Lkscience/kmath/nd/Structure2D; +public final class space/kscience/kmath/linear/TransposedFeature : space/kscience/kmath/linear/MatrixFeature { + public fun (Lspace/kscience/kmath/nd/Structure2D;)V + public final fun getOriginal ()Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/UFeature : kscience/kmath/linear/MatrixFeature { - public static final field INSTANCE Lkscience/kmath/linear/UFeature; +public final class space/kscience/kmath/linear/UFeature : space/kscience/kmath/linear/MatrixFeature { + public static final field INSTANCE Lspace/kscience/kmath/linear/UFeature; } -public final class kscience/kmath/linear/UnitFeature : kscience/kmath/linear/DiagonalFeature { - public static final field INSTANCE Lkscience/kmath/linear/UnitFeature; +public final class space/kscience/kmath/linear/UnitFeature : space/kscience/kmath/linear/DiagonalFeature { + public static final field INSTANCE Lspace/kscience/kmath/linear/UnitFeature; } -public abstract interface class kscience/kmath/linear/VectorSpace : kscience/kmath/operations/Space { - public static final field Companion Lkscience/kmath/linear/VectorSpace$Companion; - public abstract fun add (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; +public abstract interface class space/kscience/kmath/linear/VectorSpace : space/kscience/kmath/operations/Space { + public static final field Companion Lspace/kscience/kmath/linear/VectorSpace$Companion; + public abstract fun add (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public abstract fun getSize ()I - public abstract fun getSpace ()Lkscience/kmath/operations/Space; - public abstract fun getZero ()Lkscience/kmath/structures/Buffer; - public abstract fun multiply (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; - public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/structures/Buffer; + public abstract fun getSpace ()Lspace/kscience/kmath/operations/Space; + public abstract fun getZero ()Lspace/kscience/kmath/structures/Buffer; + public abstract fun multiply (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; } -public final class kscience/kmath/linear/VectorSpace$Companion { - public final fun buffered (ILkscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/linear/BufferVectorSpace; - public static synthetic fun buffered$default (Lkscience/kmath/linear/VectorSpace$Companion;ILkscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkscience/kmath/linear/BufferVectorSpace; - public final fun real (I)Lkscience/kmath/linear/BufferVectorSpace; +public final class space/kscience/kmath/linear/VectorSpace$Companion { + public final fun buffered (ILspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferVectorSpace; + public static synthetic fun buffered$default (Lspace/kscience/kmath/linear/VectorSpace$Companion;ILspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lspace/kscience/kmath/linear/BufferVectorSpace; + public final fun real (I)Lspace/kscience/kmath/linear/BufferVectorSpace; } -public final class kscience/kmath/linear/VectorSpace$DefaultImpls { - public static fun add (Lkscience/kmath/linear/VectorSpace;Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static fun binaryOperation (Lkscience/kmath/linear/VectorSpace;Ljava/lang/String;Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static fun binaryOperationFunction (Lkscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/linear/VectorSpace;Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; - public static fun getZero (Lkscience/kmath/linear/VectorSpace;)Lkscience/kmath/structures/Buffer; - public static fun minus (Lkscience/kmath/linear/VectorSpace;Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static fun multiply (Lkscience/kmath/linear/VectorSpace;Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; - public static fun plus (Lkscience/kmath/linear/VectorSpace;Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static fun symbol (Lkscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lkscience/kmath/structures/Buffer; - public static fun times (Lkscience/kmath/linear/VectorSpace;Ljava/lang/Number;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static fun times (Lkscience/kmath/linear/VectorSpace;Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; - public static fun unaryMinus (Lkscience/kmath/linear/VectorSpace;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static fun unaryOperation (Lkscience/kmath/linear/VectorSpace;Ljava/lang/String;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static fun unaryOperationFunction (Lkscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/linear/VectorSpace;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; +public final class space/kscience/kmath/linear/VectorSpace$DefaultImpls { + public static fun add (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun binaryOperation (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun binaryOperationFunction (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lspace/kscience/kmath/structures/Buffer; + public static fun div (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public static fun getZero (Lspace/kscience/kmath/linear/VectorSpace;)Lspace/kscience/kmath/structures/Buffer; + public static fun minus (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun multiply (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public static fun plus (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun times (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun times (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public static fun unaryMinus (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun unaryOperation (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun unaryOperationFunction (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; } -public final class kscience/kmath/linear/VirtualMatrix : kscience/kmath/nd/Structure2D { +public final class space/kscience/kmath/linear/VirtualMatrix : space/kscience/kmath/nd/Structure2D { public fun (IILkotlin/jvm/functions/Function2;)V public fun elements ()Lkotlin/sequences/Sequence; public fun equals (Ljava/lang/Object;)Z public fun get (II)Ljava/lang/Object; public fun get ([I)Ljava/lang/Object; public fun getColNum ()I - public fun getColumns ()Lkscience/kmath/structures/Buffer; + public fun getColumns ()Lspace/kscience/kmath/structures/Buffer; public fun getDimension ()I public fun getFeature (Lkotlin/reflect/KClass;)Ljava/lang/Object; public final fun getGenerator ()Lkotlin/jvm/functions/Function2; public fun getRowNum ()I - public fun getRows ()Lkscience/kmath/structures/Buffer; + public fun getRows ()Lspace/kscience/kmath/structures/Buffer; public fun getShape ()[I public fun hashCode ()I } -public final class kscience/kmath/linear/ZeroFeature : kscience/kmath/linear/DiagonalFeature { - public static final field INSTANCE Lkscience/kmath/linear/ZeroFeature; +public final class space/kscience/kmath/linear/ZeroFeature : space/kscience/kmath/linear/DiagonalFeature { + public static final field INSTANCE Lspace/kscience/kmath/linear/ZeroFeature; } -public final class kscience/kmath/misc/CumulativeKt { +public final class space/kscience/kmath/misc/CumulativeKt { public static final fun cumulative (Ljava/lang/Iterable;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/lang/Iterable; public static final fun cumulative (Ljava/util/Iterator;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/util/Iterator; public static final fun cumulative (Ljava/util/List;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/util/List; public static final fun cumulative (Lkotlin/sequences/Sequence;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Lkotlin/sequences/Sequence; - public static final fun cumulativeSum (Ljava/lang/Iterable;Lkscience/kmath/operations/Space;)Ljava/lang/Iterable; - public static final fun cumulativeSum (Ljava/util/List;Lkscience/kmath/operations/Space;)Ljava/util/List; - public static final fun cumulativeSum (Lkotlin/sequences/Sequence;Lkscience/kmath/operations/Space;)Lkotlin/sequences/Sequence; + public static final fun cumulativeSum (Ljava/lang/Iterable;Lspace/kscience/kmath/operations/Space;)Ljava/lang/Iterable; + public static final fun cumulativeSum (Ljava/util/List;Lspace/kscience/kmath/operations/Space;)Ljava/util/List; + public static final fun cumulativeSum (Lkotlin/sequences/Sequence;Lspace/kscience/kmath/operations/Space;)Lkotlin/sequences/Sequence; public static final fun cumulativeSumOfDouble (Ljava/lang/Iterable;)Ljava/lang/Iterable; public static final fun cumulativeSumOfDouble (Ljava/util/List;)Ljava/util/List; public static final fun cumulativeSumOfDouble (Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence; @@ -925,116 +925,116 @@ public final class kscience/kmath/misc/CumulativeKt { public static final fun cumulativeSumOfLong (Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence; } -public abstract interface annotation class kscience/kmath/misc/UnstableKMathAPI : java/lang/annotation/Annotation { +public abstract interface annotation class space/kscience/kmath/misc/UnstableKMathAPI : java/lang/annotation/Annotation { } -public abstract interface class kscience/kmath/nd/BufferNDAlgebra : kscience/kmath/nd/NDAlgebra { - public abstract fun combine (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDBuffer; - public abstract fun getBuffer (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/structures/Buffer; +public abstract interface class space/kscience/kmath/nd/BufferNDAlgebra : space/kscience/kmath/nd/NDAlgebra { + public abstract fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public abstract fun getBuffer (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/structures/Buffer; public abstract fun getBufferFactory ()Lkotlin/jvm/functions/Function2; - public abstract fun getStrides ()Lkscience/kmath/nd/Strides; - public abstract fun map (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; - public abstract fun mapIndexed (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDBuffer; - public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; + public abstract fun getStrides ()Lspace/kscience/kmath/nd/Strides; + public abstract fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public abstract fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; } -public final class kscience/kmath/nd/BufferNDAlgebra$DefaultImpls { - public static fun combine (Lkscience/kmath/nd/BufferNDAlgebra;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDBuffer; - public static fun getBuffer (Lkscience/kmath/nd/BufferNDAlgebra;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/structures/Buffer; - public static fun invoke (Lkscience/kmath/nd/BufferNDAlgebra;Lkotlin/jvm/functions/Function1;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun map (Lkscience/kmath/nd/BufferNDAlgebra;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; - public static fun mapIndexed (Lkscience/kmath/nd/BufferNDAlgebra;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDBuffer; - public static fun produce (Lkscience/kmath/nd/BufferNDAlgebra;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; +public final class space/kscience/kmath/nd/BufferNDAlgebra$DefaultImpls { + public static fun combine (Lspace/kscience/kmath/nd/BufferNDAlgebra;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public static fun getBuffer (Lspace/kscience/kmath/nd/BufferNDAlgebra;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/structures/Buffer; + public static fun invoke (Lspace/kscience/kmath/nd/BufferNDAlgebra;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun map (Lspace/kscience/kmath/nd/BufferNDAlgebra;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public static fun mapIndexed (Lspace/kscience/kmath/nd/BufferNDAlgebra;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public static fun produce (Lspace/kscience/kmath/nd/BufferNDAlgebra;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; } -public final class kscience/kmath/nd/BufferNDAlgebraKt { - public static final fun field (Lkscience/kmath/nd/NDAlgebra$Companion;Lkscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;[I)Lkscience/kmath/nd/BufferedNDField; - public static final fun ndField (Lkscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun ndRing (Lkscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun ndSpace (Lkscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun ring (Lkscience/kmath/nd/NDAlgebra$Companion;Lkscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[I)Lkscience/kmath/nd/BufferedNDRing; - public static final fun space (Lkscience/kmath/nd/NDAlgebra$Companion;Lkscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;[I)Lkscience/kmath/nd/BufferedNDSpace; +public final class space/kscience/kmath/nd/BufferNDAlgebraKt { + public static final fun field (Lspace/kscience/kmath/nd/NDAlgebra$Companion;Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedNDField; + public static final fun ndField (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final fun ndRing (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final fun ndSpace (Lspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final fun ring (Lspace/kscience/kmath/nd/NDAlgebra$Companion;Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedNDRing; + public static final fun space (Lspace/kscience/kmath/nd/NDAlgebra$Companion;Lspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedNDSpace; } -public class kscience/kmath/nd/BufferedNDField : kscience/kmath/nd/BufferedNDRing, kscience/kmath/nd/NDField { - public fun ([ILkscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;)V +public class space/kscience/kmath/nd/BufferedNDField : space/kscience/kmath/nd/BufferedNDRing, space/kscience/kmath/nd/NDField { + public fun ([ILspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;)V public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun div (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun div (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public fun div (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun div (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun div (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public fun div (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun divide (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public class kscience/kmath/nd/BufferedNDRing : kscience/kmath/nd/BufferedNDSpace, kscience/kmath/nd/NDRing { - public fun ([ILkscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V +public class space/kscience/kmath/nd/BufferedNDRing : space/kscience/kmath/nd/BufferedNDSpace, space/kscience/kmath/nd/NDRing { + public fun ([ILspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lkscience/kmath/nd/NDBuffer; + public fun getOne ()Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun multiply (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun times (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public fun times (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun times (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public fun times (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public class kscience/kmath/nd/BufferedNDSpace : kscience/kmath/nd/BufferNDAlgebra, kscience/kmath/nd/NDSpace { - public fun ([ILkscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;)V +public class space/kscience/kmath/nd/BufferedNDSpace : space/kscience/kmath/nd/BufferNDAlgebra, space/kscience/kmath/nd/NDSpace { + public fun ([ILspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;)V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun add (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public fun combine (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun combine (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDStructure; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/nd/NDStructure; + public fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun div (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public fun getBuffer (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/structures/Buffer; + public fun div (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public fun getBuffer (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/structures/Buffer; public final fun getBufferFactory ()Lkotlin/jvm/functions/Function2; public synthetic fun getElementContext ()Ljava/lang/Object; - public final fun getElementContext ()Lkscience/kmath/operations/Space; + public final fun getElementContext ()Lspace/kscience/kmath/operations/Space; public final fun getShape ()[I - public fun getStrides ()Lkscience/kmath/nd/Strides; + public fun getStrides ()Lspace/kscience/kmath/nd/Strides; public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lkscience/kmath/nd/NDBuffer; - public fun invoke (Lkotlin/jvm/functions/Function1;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun map (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun map (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDStructure; - public fun mapIndexed (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun mapIndexed (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDStructure; + public fun getZero ()Lspace/kscience/kmath/nd/NDBuffer; + public fun invoke (Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; + public fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun minus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public fun minus (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun minus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public fun minus (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun multiply (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun plus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public fun plus (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDStructure; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/nd/NDStructure; + public fun plus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun plus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public fun plus (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun times (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun times (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun unaryMinus (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun unaryPlus (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public final class kscience/kmath/nd/DefaultStrides : kscience/kmath/nd/Strides { - public static final field Companion Lkscience/kmath/nd/DefaultStrides$Companion; +public final class space/kscience/kmath/nd/DefaultStrides : space/kscience/kmath/nd/Strides { + public static final field Companion Lspace/kscience/kmath/nd/DefaultStrides$Companion; public synthetic fun ([ILkotlin/jvm/internal/DefaultConstructorMarker;)V public fun equals (Ljava/lang/Object;)Z public fun getLinearSize ()I @@ -1046,168 +1046,168 @@ public final class kscience/kmath/nd/DefaultStrides : kscience/kmath/nd/Strides public fun offset ([I)I } -public final class kscience/kmath/nd/DefaultStrides$Companion { - public final fun invoke ([I)Lkscience/kmath/nd/Strides; +public final class space/kscience/kmath/nd/DefaultStrides$Companion { + public final fun invoke ([I)Lspace/kscience/kmath/nd/Strides; } -public final class kscience/kmath/nd/MutableNDBuffer : kscience/kmath/nd/NDBuffer, kscience/kmath/nd/MutableNDStructure { - public fun (Lkscience/kmath/nd/Strides;Lkscience/kmath/structures/MutableBuffer;)V - public synthetic fun getBuffer ()Lkscience/kmath/structures/Buffer; - public fun getBuffer ()Lkscience/kmath/structures/MutableBuffer; +public final class space/kscience/kmath/nd/MutableNDBuffer : space/kscience/kmath/nd/NDBuffer, space/kscience/kmath/nd/MutableNDStructure { + public fun (Lspace/kscience/kmath/nd/Strides;Lspace/kscience/kmath/structures/MutableBuffer;)V + public synthetic fun getBuffer ()Lspace/kscience/kmath/structures/Buffer; + public fun getBuffer ()Lspace/kscience/kmath/structures/MutableBuffer; public fun set ([ILjava/lang/Object;)V } -public abstract interface class kscience/kmath/nd/MutableNDStructure : kscience/kmath/nd/NDStructure { +public abstract interface class space/kscience/kmath/nd/MutableNDStructure : space/kscience/kmath/nd/NDStructure { public abstract fun set ([ILjava/lang/Object;)V } -public final class kscience/kmath/nd/MutableNDStructure$DefaultImpls { - public static fun getDimension (Lkscience/kmath/nd/MutableNDStructure;)I - public static fun getFeature (Lkscience/kmath/nd/MutableNDStructure;Lkotlin/reflect/KClass;)Ljava/lang/Object; +public final class space/kscience/kmath/nd/MutableNDStructure$DefaultImpls { + public static fun getDimension (Lspace/kscience/kmath/nd/MutableNDStructure;)I + public static fun getFeature (Lspace/kscience/kmath/nd/MutableNDStructure;Lkotlin/reflect/KClass;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/nd/NDAlgebra { - public static final field Companion Lkscience/kmath/nd/NDAlgebra$Companion; - public abstract fun combine (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDStructure; +public abstract interface class space/kscience/kmath/nd/NDAlgebra { + public static final field Companion Lspace/kscience/kmath/nd/NDAlgebra$Companion; + public abstract fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; public abstract fun getElementContext ()Ljava/lang/Object; public abstract fun getShape ()[I - public abstract fun invoke (Lkotlin/jvm/functions/Function1;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public abstract fun map (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDStructure; - public abstract fun mapIndexed (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDStructure; - public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDStructure; + public abstract fun invoke (Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; } -public final class kscience/kmath/nd/NDAlgebra$Companion { +public final class space/kscience/kmath/nd/NDAlgebra$Companion { } -public final class kscience/kmath/nd/NDAlgebra$DefaultImpls { - public static fun invoke (Lkscience/kmath/nd/NDAlgebra;Lkotlin/jvm/functions/Function1;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; +public final class space/kscience/kmath/nd/NDAlgebra$DefaultImpls { + public static fun invoke (Lspace/kscience/kmath/nd/NDAlgebra;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public class kscience/kmath/nd/NDBuffer : kscience/kmath/nd/NDStructure { - public fun (Lkscience/kmath/nd/Strides;Lkscience/kmath/structures/Buffer;)V +public class space/kscience/kmath/nd/NDBuffer : space/kscience/kmath/nd/NDStructure { + public fun (Lspace/kscience/kmath/nd/Strides;Lspace/kscience/kmath/structures/Buffer;)V public fun elements ()Lkotlin/sequences/Sequence; public fun equals (Ljava/lang/Object;)Z public fun get ([I)Ljava/lang/Object; - public fun getBuffer ()Lkscience/kmath/structures/Buffer; + public fun getBuffer ()Lspace/kscience/kmath/structures/Buffer; public fun getDimension ()I public fun getFeature (Lkotlin/reflect/KClass;)Ljava/lang/Object; public fun getShape ()[I - public final fun getStrides ()Lkscience/kmath/nd/Strides; + public final fun getStrides ()Lspace/kscience/kmath/nd/Strides; public fun hashCode ()I public fun toString ()Ljava/lang/String; } -public abstract interface class kscience/kmath/nd/NDField : kscience/kmath/nd/NDRing, kscience/kmath/operations/Field { - public abstract fun div (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public abstract fun div (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public abstract fun divide (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; +public abstract interface class space/kscience/kmath/nd/NDField : space/kscience/kmath/nd/NDRing, space/kscience/kmath/operations/Field { + public abstract fun div (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun div (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun divide (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public final class kscience/kmath/nd/NDField$DefaultImpls { - public static fun add (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun binaryOperation (Lkscience/kmath/nd/NDField;Ljava/lang/String;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun binaryOperationFunction (Lkscience/kmath/nd/NDField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/nd/NDField;Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun div (Lkscience/kmath/nd/NDField;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun div (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun div (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun div (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun divide (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun invoke (Lkscience/kmath/nd/NDField;Lkotlin/jvm/functions/Function1;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDField;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun multiply (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun multiply (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDField;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun symbol (Lkscience/kmath/nd/NDField;Ljava/lang/String;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDField;Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDField;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun unaryMinus (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun unaryOperation (Lkscience/kmath/nd/NDField;Ljava/lang/String;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun unaryOperationFunction (Lkscience/kmath/nd/NDField;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; +public final class space/kscience/kmath/nd/NDField$DefaultImpls { + public static fun add (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun binaryOperation (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun binaryOperationFunction (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;)Lspace/kscience/kmath/nd/NDStructure; + public static fun div (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun div (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun div (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun div (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun div (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun divide (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun invoke (Lspace/kscience/kmath/nd/NDField;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun multiply (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun multiply (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryMinus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryOperation (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryOperationFunction (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public abstract interface class kscience/kmath/nd/NDRing : kscience/kmath/nd/NDSpace, kscience/kmath/operations/Ring { - public static final field Companion Lkscience/kmath/nd/NDRing$Companion; - public abstract fun multiply (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public abstract fun times (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public abstract fun times (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; +public abstract interface class space/kscience/kmath/nd/NDRing : space/kscience/kmath/nd/NDSpace, space/kscience/kmath/operations/Ring { + public static final field Companion Lspace/kscience/kmath/nd/NDRing$Companion; + public abstract fun multiply (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun times (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; } -public final class kscience/kmath/nd/NDRing$Companion { +public final class space/kscience/kmath/nd/NDRing$Companion { } -public final class kscience/kmath/nd/NDRing$DefaultImpls { - public static fun add (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun binaryOperation (Lkscience/kmath/nd/NDRing;Ljava/lang/String;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun binaryOperationFunction (Lkscience/kmath/nd/NDRing;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun invoke (Lkscience/kmath/nd/NDRing;Lkotlin/jvm/functions/Function1;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDRing;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun multiply (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun multiply (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDRing;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun symbol (Lkscience/kmath/nd/NDRing;Ljava/lang/String;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDRing;Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDRing;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun unaryMinus (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun unaryOperation (Lkscience/kmath/nd/NDRing;Ljava/lang/String;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun unaryOperationFunction (Lkscience/kmath/nd/NDRing;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; +public final class space/kscience/kmath/nd/NDRing$DefaultImpls { + public static fun add (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun binaryOperation (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun binaryOperationFunction (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;)Lspace/kscience/kmath/nd/NDStructure; + public static fun div (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun invoke (Lspace/kscience/kmath/nd/NDRing;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun multiply (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun multiply (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryMinus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryOperation (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryOperationFunction (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public abstract interface class kscience/kmath/nd/NDSpace : kscience/kmath/nd/NDAlgebra, kscience/kmath/operations/Space { - public static final field Companion Lkscience/kmath/nd/NDSpace$Companion; - public abstract fun add (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public abstract fun minus (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public abstract fun minus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public abstract fun multiply (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public abstract fun plus (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public abstract fun plus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; +public abstract interface class space/kscience/kmath/nd/NDSpace : space/kscience/kmath/nd/NDAlgebra, space/kscience/kmath/operations/Space { + public static final field Companion Lspace/kscience/kmath/nd/NDSpace$Companion; + public abstract fun add (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun minus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun multiply (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun plus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun plus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; } -public final class kscience/kmath/nd/NDSpace$Companion { +public final class space/kscience/kmath/nd/NDSpace$Companion { } -public final class kscience/kmath/nd/NDSpace$DefaultImpls { - public static fun add (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun binaryOperation (Lkscience/kmath/nd/NDSpace;Ljava/lang/String;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun binaryOperationFunction (Lkscience/kmath/nd/NDSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun invoke (Lkscience/kmath/nd/NDSpace;Lkotlin/jvm/functions/Function1;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDSpace;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun multiply (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDSpace;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun symbol (Lkscience/kmath/nd/NDSpace;Ljava/lang/String;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDSpace;Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun unaryMinus (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun unaryOperation (Lkscience/kmath/nd/NDSpace;Ljava/lang/String;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun unaryOperationFunction (Lkscience/kmath/nd/NDSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; +public final class space/kscience/kmath/nd/NDSpace$DefaultImpls { + public static fun add (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun binaryOperation (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun binaryOperationFunction (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;)Lspace/kscience/kmath/nd/NDStructure; + public static fun div (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun invoke (Lspace/kscience/kmath/nd/NDSpace;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun multiply (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryMinus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryOperation (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryOperationFunction (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public abstract interface class kscience/kmath/nd/NDStructure { - public static final field Companion Lkscience/kmath/nd/NDStructure$Companion; +public abstract interface class space/kscience/kmath/nd/NDStructure { + public static final field Companion Lspace/kscience/kmath/nd/NDStructure$Companion; public abstract fun elements ()Lkotlin/sequences/Sequence; public abstract fun equals (Ljava/lang/Object;)Z public abstract fun get ([I)Ljava/lang/Object; @@ -1217,136 +1217,136 @@ public abstract interface class kscience/kmath/nd/NDStructure { public abstract fun hashCode ()I } -public final class kscience/kmath/nd/NDStructure$Companion { - public final fun auto (Lkotlin/reflect/KClass;Lkscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/nd/NDBuffer; - public final fun auto (Lkotlin/reflect/KClass;[ILkotlin/jvm/functions/Function1;)Lkscience/kmath/nd/NDBuffer; - public final fun build (Lkscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/nd/NDBuffer; - public final fun build ([ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/nd/NDBuffer; - public static synthetic fun build$default (Lkscience/kmath/nd/NDStructure$Companion;Lkscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lkscience/kmath/nd/NDBuffer; - public static synthetic fun build$default (Lkscience/kmath/nd/NDStructure$Companion;[ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lkscience/kmath/nd/NDBuffer; - public final fun contentEquals (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Z +public final class space/kscience/kmath/nd/NDStructure$Companion { + public final fun auto (Lkotlin/reflect/KClass;Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; + public final fun auto (Lkotlin/reflect/KClass;[ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; + public final fun build (Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; + public final fun build ([ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; + public static synthetic fun build$default (Lspace/kscience/kmath/nd/NDStructure$Companion;Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/kmath/nd/NDBuffer; + public static synthetic fun build$default (Lspace/kscience/kmath/nd/NDStructure$Companion;[ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/kmath/nd/NDBuffer; + public final fun contentEquals (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Z } -public final class kscience/kmath/nd/NDStructure$DefaultImpls { - public static fun getDimension (Lkscience/kmath/nd/NDStructure;)I - public static fun getFeature (Lkscience/kmath/nd/NDStructure;Lkotlin/reflect/KClass;)Ljava/lang/Object; +public final class space/kscience/kmath/nd/NDStructure$DefaultImpls { + public static fun getDimension (Lspace/kscience/kmath/nd/NDStructure;)I + public static fun getFeature (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/reflect/KClass;)Ljava/lang/Object; } -public final class kscience/kmath/nd/NDStructureKt { - public static final fun get (Lkscience/kmath/nd/NDStructure;[I)Ljava/lang/Object; - public static final fun mapInPlace (Lkscience/kmath/nd/MutableNDStructure;Lkotlin/jvm/functions/Function2;)V +public final class space/kscience/kmath/nd/NDStructureKt { + public static final fun get (Lspace/kscience/kmath/nd/NDStructure;[I)Ljava/lang/Object; + public static final fun mapInPlace (Lspace/kscience/kmath/nd/MutableNDStructure;Lkotlin/jvm/functions/Function2;)V } -public final class kscience/kmath/nd/RealNDField : kscience/kmath/nd/BufferedNDField, kscience/kmath/operations/ExtendedField, kscience/kmath/operations/RingWithNumbers { +public final class space/kscience/kmath/nd/RealNDField : space/kscience/kmath/nd/BufferedNDField, space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/RingWithNumbers { public fun ([I)V public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; - public fun acos (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun acos (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun acosh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun acosh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; - public fun asin (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun asin (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun asinh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun asinh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; - public fun atan (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun atan (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun atanh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; - public fun combine (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun combine (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDStructure; + public fun atanh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; + public fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; - public fun cos (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun cos (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun cosh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun cosh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; - public fun exp (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun getBuffer (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/structures/Buffer; - public fun getBuffer-JVEF3vg (Lkscience/kmath/nd/NDStructure;)[D + public fun exp (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun getBuffer (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/structures/Buffer; + public fun getBuffer-LGjt3BI (Lspace/kscience/kmath/nd/NDStructure;)[D public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lkscience/kmath/nd/NDBuffer; + public fun getOne ()Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lkscience/kmath/nd/NDBuffer; + public fun getZero ()Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; - public fun ln (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; - public fun map (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun map (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDStructure; - public fun mapIndexed (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun mapIndexed (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDStructure; + public fun ln (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; + public fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; + public fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun minus (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun minus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number (Ljava/lang/Number;)Lkscience/kmath/nd/NDBuffer; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun plus (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun plus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun pow (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun pow (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun power (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDBuffer; - public fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDStructure; + public fun power (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDBuffer; + public fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; - public fun sin (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun sin (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun sinh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun sinh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun sqrt (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun sqrt (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; - public fun tan (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun tan (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun tanh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun tanh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/nd/RealNDFieldKt { - public static final fun nd (Lkscience/kmath/operations/RealField;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun real (Lkscience/kmath/nd/NDAlgebra$Companion;[I)Lkscience/kmath/nd/RealNDField; +public final class space/kscience/kmath/nd/RealNDFieldKt { + public static final fun nd (Lspace/kscience/kmath/operations/RealField;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final fun real (Lspace/kscience/kmath/nd/NDAlgebra$Companion;[I)Lspace/kscience/kmath/nd/RealNDField; } -public final class kscience/kmath/nd/ShapeMismatchException : java/lang/RuntimeException { +public final class space/kscience/kmath/nd/ShapeMismatchException : java/lang/RuntimeException { public fun ([I[I)V public final fun getActual ()[I public final fun getExpected ()[I } -public final class kscience/kmath/nd/ShortNDRing : kscience/kmath/nd/BufferedNDRing, kscience/kmath/operations/RingWithNumbers { +public final class space/kscience/kmath/nd/ShortNDRing : space/kscience/kmath/nd/BufferedNDRing, space/kscience/kmath/operations/RingWithNumbers { public fun ([I)V public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lkscience/kmath/nd/NDBuffer; + public fun getOne ()Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lkscience/kmath/nd/NDBuffer; + public fun getZero ()Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun minus (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun minus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number (Ljava/lang/Number;)Lkscience/kmath/nd/NDBuffer; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun plus (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun plus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; } -public final class kscience/kmath/nd/ShortNDRingKt { - public static final fun nd (Lkscience/kmath/operations/ShortRing;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun produceInline (Lkscience/kmath/nd/BufferedNDRing;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; +public final class space/kscience/kmath/nd/ShortNDRingKt { + public static final fun nd (Lspace/kscience/kmath/operations/ShortRing;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final fun produceInline (Lspace/kscience/kmath/nd/BufferedNDRing;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; } -public abstract interface class kscience/kmath/nd/Strides { +public abstract interface class space/kscience/kmath/nd/Strides { public abstract fun getLinearSize ()I public abstract fun getShape ()[I public abstract fun getStrides ()Ljava/util/List; @@ -1355,222 +1355,225 @@ public abstract interface class kscience/kmath/nd/Strides { public abstract fun offset ([I)I } -public final class kscience/kmath/nd/Strides$DefaultImpls { - public static fun indices (Lkscience/kmath/nd/Strides;)Lkotlin/sequences/Sequence; +public final class space/kscience/kmath/nd/Strides$DefaultImpls { + public static fun indices (Lspace/kscience/kmath/nd/Strides;)Lkotlin/sequences/Sequence; } -public abstract interface class kscience/kmath/nd/Structure1D : kscience/kmath/nd/NDStructure, kscience/kmath/structures/Buffer { +public abstract interface class space/kscience/kmath/nd/Structure1D : space/kscience/kmath/nd/NDStructure, space/kscience/kmath/structures/Buffer { public abstract fun get ([I)Ljava/lang/Object; public abstract fun getDimension ()I public abstract fun iterator ()Ljava/util/Iterator; } -public final class kscience/kmath/nd/Structure1D$DefaultImpls { - public static fun contentEquals (Lkscience/kmath/nd/Structure1D;Lkscience/kmath/structures/Buffer;)Z - public static fun get (Lkscience/kmath/nd/Structure1D;[I)Ljava/lang/Object; - public static fun getDimension (Lkscience/kmath/nd/Structure1D;)I - public static fun getFeature (Lkscience/kmath/nd/Structure1D;Lkotlin/reflect/KClass;)Ljava/lang/Object; - public static fun iterator (Lkscience/kmath/nd/Structure1D;)Ljava/util/Iterator; +public final class space/kscience/kmath/nd/Structure1D$DefaultImpls { + public static fun contentEquals (Lspace/kscience/kmath/nd/Structure1D;Lspace/kscience/kmath/structures/Buffer;)Z + public static fun get (Lspace/kscience/kmath/nd/Structure1D;[I)Ljava/lang/Object; + public static fun getDimension (Lspace/kscience/kmath/nd/Structure1D;)I + public static fun getFeature (Lspace/kscience/kmath/nd/Structure1D;Lkotlin/reflect/KClass;)Ljava/lang/Object; + public static fun iterator (Lspace/kscience/kmath/nd/Structure1D;)Ljava/util/Iterator; } -public final class kscience/kmath/nd/Structure1DKt { - public static final fun as1D (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/Structure1D; - public static final fun asND (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/nd/Structure1D; +public final class space/kscience/kmath/nd/Structure1DKt { + public static final fun as1D (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/Structure1D; + public static final fun asND (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/nd/Structure1D; } -public abstract interface class kscience/kmath/nd/Structure2D : kscience/kmath/nd/NDStructure { - public static final field Companion Lkscience/kmath/nd/Structure2D$Companion; +public abstract interface class space/kscience/kmath/nd/Structure2D : space/kscience/kmath/nd/NDStructure { + public static final field Companion Lspace/kscience/kmath/nd/Structure2D$Companion; public abstract fun elements ()Lkotlin/sequences/Sequence; public abstract fun get (II)Ljava/lang/Object; public abstract fun get ([I)Ljava/lang/Object; public abstract fun getColNum ()I - public abstract fun getColumns ()Lkscience/kmath/structures/Buffer; + public abstract fun getColumns ()Lspace/kscience/kmath/structures/Buffer; public abstract fun getRowNum ()I - public abstract fun getRows ()Lkscience/kmath/structures/Buffer; + public abstract fun getRows ()Lspace/kscience/kmath/structures/Buffer; public abstract fun getShape ()[I } -public final class kscience/kmath/nd/Structure2D$Companion { - public final fun real (IILkotlin/jvm/functions/Function2;)Lkscience/kmath/linear/BufferMatrix; +public final class space/kscience/kmath/nd/Structure2D$Companion { + public final fun real (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferMatrix; } -public final class kscience/kmath/nd/Structure2D$DefaultImpls { - public static fun elements (Lkscience/kmath/nd/Structure2D;)Lkotlin/sequences/Sequence; - public static fun get (Lkscience/kmath/nd/Structure2D;[I)Ljava/lang/Object; - public static fun getColumns (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/structures/Buffer; - public static fun getDimension (Lkscience/kmath/nd/Structure2D;)I - public static fun getFeature (Lkscience/kmath/nd/Structure2D;Lkotlin/reflect/KClass;)Ljava/lang/Object; - public static fun getRows (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/structures/Buffer; - public static fun getShape (Lkscience/kmath/nd/Structure2D;)[I +public final class space/kscience/kmath/nd/Structure2D$DefaultImpls { + public static fun elements (Lspace/kscience/kmath/nd/Structure2D;)Lkotlin/sequences/Sequence; + public static fun get (Lspace/kscience/kmath/nd/Structure2D;[I)Ljava/lang/Object; + public static fun getColumns (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/structures/Buffer; + public static fun getDimension (Lspace/kscience/kmath/nd/Structure2D;)I + public static fun getFeature (Lspace/kscience/kmath/nd/Structure2D;Lkotlin/reflect/KClass;)Ljava/lang/Object; + public static fun getRows (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/structures/Buffer; + public static fun getShape (Lspace/kscience/kmath/nd/Structure2D;)[I } -public final class kscience/kmath/nd/Structure2DKt { - public static final fun as2D (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/Structure2D; +public final class space/kscience/kmath/nd/Structure2DKt { + public static final fun as2D (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/Structure2D; } -public abstract interface class kscience/kmath/operations/Algebra { +public abstract interface class space/kscience/kmath/operations/Algebra { public abstract fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public abstract fun symbol (Ljava/lang/String;)Ljava/lang/Object; + public abstract fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public abstract fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/operations/Algebra$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/Algebra;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/Algebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun symbol (Lkscience/kmath/operations/Algebra;Ljava/lang/String;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/Algebra;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/Algebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; +public final class space/kscience/kmath/operations/Algebra$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/Algebra;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/Algebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/Algebra;Ljava/lang/String;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/Algebra;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/Algebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public abstract interface class kscience/kmath/operations/AlgebraElement { - public abstract fun getContext ()Lkscience/kmath/operations/Algebra; +public abstract interface class space/kscience/kmath/operations/AlgebraElement { + public abstract fun getContext ()Lspace/kscience/kmath/operations/Algebra; } -public final class kscience/kmath/operations/AlgebraElementsKt { - public static final fun div (Lkscience/kmath/operations/AlgebraElement;Ljava/lang/Number;)Lkscience/kmath/operations/AlgebraElement; - public static final fun div (Lkscience/kmath/operations/AlgebraElement;Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun minus (Lkscience/kmath/operations/AlgebraElement;Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun plus (Lkscience/kmath/operations/AlgebraElement;Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun times (Ljava/lang/Number;Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun times (Lkscience/kmath/operations/AlgebraElement;Ljava/lang/Number;)Lkscience/kmath/operations/AlgebraElement; - public static final fun times (Lkscience/kmath/operations/AlgebraElement;Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; +public final class space/kscience/kmath/operations/AlgebraElementsKt { + public static final fun div (Lspace/kscience/kmath/operations/AlgebraElement;Ljava/lang/Number;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun div (Lspace/kscience/kmath/operations/AlgebraElement;Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun minus (Lspace/kscience/kmath/operations/AlgebraElement;Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun plus (Lspace/kscience/kmath/operations/AlgebraElement;Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun times (Ljava/lang/Number;Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun times (Lspace/kscience/kmath/operations/AlgebraElement;Ljava/lang/Number;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun times (Lspace/kscience/kmath/operations/AlgebraElement;Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; } -public final class kscience/kmath/operations/AlgebraExtensionsKt { - public static final fun abs (Lkscience/kmath/operations/Space;Ljava/lang/Comparable;)Ljava/lang/Comparable; - public static final fun average (Lkscience/kmath/operations/Space;Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun average (Lkscience/kmath/operations/Space;Lkotlin/sequences/Sequence;)Ljava/lang/Object; - public static final fun averageWith (Ljava/lang/Iterable;Lkscience/kmath/operations/Space;)Ljava/lang/Object; - public static final fun averageWith (Lkotlin/sequences/Sequence;Lkscience/kmath/operations/Space;)Ljava/lang/Object; - public static final fun power (Lkscience/kmath/operations/Field;Ljava/lang/Object;I)Ljava/lang/Object; - public static final fun power (Lkscience/kmath/operations/Ring;Ljava/lang/Object;I)Ljava/lang/Object; - public static final fun sum (Lkscience/kmath/operations/Space;Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun sum (Lkscience/kmath/operations/Space;Lkotlin/sequences/Sequence;)Ljava/lang/Object; - public static final fun sumWith (Ljava/lang/Iterable;Lkscience/kmath/operations/Space;)Ljava/lang/Object; - public static final fun sumWith (Lkotlin/sequences/Sequence;Lkscience/kmath/operations/Space;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/AlgebraExtensionsKt { + public static final fun abs (Lspace/kscience/kmath/operations/Space;Ljava/lang/Comparable;)Ljava/lang/Comparable; + public static final fun average (Lspace/kscience/kmath/operations/Space;Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun average (Lspace/kscience/kmath/operations/Space;Lkotlin/sequences/Sequence;)Ljava/lang/Object; + public static final fun averageWith (Ljava/lang/Iterable;Lspace/kscience/kmath/operations/Space;)Ljava/lang/Object; + public static final fun averageWith (Lkotlin/sequences/Sequence;Lspace/kscience/kmath/operations/Space;)Ljava/lang/Object; + public static final fun power (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;I)Ljava/lang/Object; + public static final fun power (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;I)Ljava/lang/Object; + public static final fun sum (Lspace/kscience/kmath/operations/Space;Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun sum (Lspace/kscience/kmath/operations/Space;Lkotlin/sequences/Sequence;)Ljava/lang/Object; + public static final fun sumWith (Ljava/lang/Iterable;Lspace/kscience/kmath/operations/Space;)Ljava/lang/Object; + public static final fun sumWith (Lkotlin/sequences/Sequence;Lspace/kscience/kmath/operations/Space;)Ljava/lang/Object; } -public final class kscience/kmath/operations/AlgebraKt { - public static final fun invoke (Lkscience/kmath/operations/Algebra;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/AlgebraKt { + public static final fun bindSymbol (Lspace/kscience/kmath/operations/Algebra;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static final fun invoke (Lspace/kscience/kmath/operations/Algebra;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; } -public final class kscience/kmath/operations/BigInt : java/lang/Comparable { +public final class space/kscience/kmath/operations/BigInt : java/lang/Comparable { public static final field BASE J public static final field BASE_SIZE I - public static final field Companion Lkscience/kmath/operations/BigInt$Companion; - public final fun abs ()Lkscience/kmath/operations/BigInt; - public final fun and (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public static final field Companion Lspace/kscience/kmath/operations/BigInt$Companion; + public final fun abs ()Lspace/kscience/kmath/operations/BigInt; + public final fun and (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun compareTo (Ljava/lang/Object;)I - public fun compareTo (Lkscience/kmath/operations/BigInt;)I - public final fun div (I)Lkscience/kmath/operations/BigInt; - public final fun div (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; - public final fun div-WZ4Q5Ns (I)Lkscience/kmath/operations/BigInt; + public fun compareTo (Lspace/kscience/kmath/operations/BigInt;)I + public final fun div (I)Lspace/kscience/kmath/operations/BigInt; + public final fun div (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; + public final fun div-WZ4Q5Ns (I)Lspace/kscience/kmath/operations/BigInt; public fun equals (Ljava/lang/Object;)Z public fun hashCode ()I - public final fun minus (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; - public final fun modPow (Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; - public final fun or (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; - public final fun plus (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public final fun minus (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; + public final fun modPow (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; + public final fun or (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; + public final fun plus (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public final fun rem (I)I - public final fun rem (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; - public final fun shl (I)Lkscience/kmath/operations/BigInt; - public final fun shr (I)Lkscience/kmath/operations/BigInt; - public final fun times (I)Lkscience/kmath/operations/BigInt; - public final fun times (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; - public final fun times-WZ4Q5Ns (I)Lkscience/kmath/operations/BigInt; + public final fun rem (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; + public final fun shl (I)Lspace/kscience/kmath/operations/BigInt; + public final fun shr (I)Lspace/kscience/kmath/operations/BigInt; + public final fun times (I)Lspace/kscience/kmath/operations/BigInt; + public final fun times (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; + public final fun times-WZ4Q5Ns (I)Lspace/kscience/kmath/operations/BigInt; public fun toString ()Ljava/lang/String; - public final fun unaryMinus ()Lkscience/kmath/operations/BigInt; + public final fun unaryMinus ()Lspace/kscience/kmath/operations/BigInt; } -public final class kscience/kmath/operations/BigInt$Companion { - public final fun getONE ()Lkscience/kmath/operations/BigInt; - public final fun getZERO ()Lkscience/kmath/operations/BigInt; +public final class space/kscience/kmath/operations/BigInt$Companion { + public final fun getONE ()Lspace/kscience/kmath/operations/BigInt; + public final fun getZERO ()Lspace/kscience/kmath/operations/BigInt; } -public final class kscience/kmath/operations/BigIntField : kscience/kmath/operations/Field, kscience/kmath/operations/RingWithNumbers { - public static final field INSTANCE Lkscience/kmath/operations/BigIntField; +public final class space/kscience/kmath/operations/BigIntField : space/kscience/kmath/operations/Field, space/kscience/kmath/operations/RingWithNumbers { + public static final field INSTANCE Lspace/kscience/kmath/operations/BigIntField; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun add (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Number;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun div (Ljava/lang/Number;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Lkscience/kmath/operations/BigInt;Ljava/lang/Number;)Lkscience/kmath/operations/BigInt; - public fun div (Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun div (Lspace/kscience/kmath/operations/BigInt;Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; + public fun div (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide (Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun divide (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lkscience/kmath/operations/BigInt; + public fun getOne ()Lspace/kscience/kmath/operations/BigInt; public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lkscience/kmath/operations/BigInt; + public fun getZero ()Lspace/kscience/kmath/operations/BigInt; public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Ljava/lang/Number;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun minus (Ljava/lang/Number;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Lkscience/kmath/operations/BigInt;Ljava/lang/Number;)Lkscience/kmath/operations/BigInt; - public fun minus (Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun minus (Lspace/kscience/kmath/operations/BigInt;Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; + public fun minus (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/operations/BigInt;Ljava/lang/Number;)Lkscience/kmath/operations/BigInt; - public fun multiply (Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun multiply (Lspace/kscience/kmath/operations/BigInt;Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; + public fun multiply (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number (Ljava/lang/Number;)Lkscience/kmath/operations/BigInt; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Ljava/lang/Number;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun plus (Ljava/lang/Number;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/operations/BigInt;Ljava/lang/Number;)Lkscience/kmath/operations/BigInt; - public fun plus (Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun plus (Lspace/kscience/kmath/operations/BigInt;Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; + public fun plus (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lkscience/kmath/operations/BigInt;Ljava/lang/Number;)Lkscience/kmath/operations/BigInt; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/operations/BigInt;Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/operations/BigInt; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Lkscience/kmath/operations/BigInt;Ljava/lang/Number;)Lkscience/kmath/operations/BigInt; - public fun times (Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun times (Lspace/kscience/kmath/operations/BigInt;Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; + public fun times (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public final fun unaryMinus (Ljava/lang/String;)Lkscience/kmath/operations/BigInt; - public fun unaryMinus (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public final fun unaryMinus (Ljava/lang/String;)Lspace/kscience/kmath/operations/BigInt; + public fun unaryMinus (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public final fun unaryPlus (Ljava/lang/String;)Lkscience/kmath/operations/BigInt; - public fun unaryPlus (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public final fun unaryPlus (Ljava/lang/String;)Lspace/kscience/kmath/operations/BigInt; + public fun unaryPlus (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; } -public final class kscience/kmath/operations/BigIntKt { - public static final fun abs (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; - public static final fun bigInt (Lkscience/kmath/nd/NDAlgebra$Companion;[I)Lkscience/kmath/nd/BufferedNDRing; - public static final fun bigInt (Lkscience/kmath/structures/Buffer$Companion;ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/Buffer; - public static final fun bigInt (Lkscience/kmath/structures/MutableBuffer$Companion;ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/MutableBuffer; - public static final fun parseBigInteger (Ljava/lang/String;)Lkscience/kmath/operations/BigInt; - public static final fun toBigInt (I)Lkscience/kmath/operations/BigInt; - public static final fun toBigInt (J)Lkscience/kmath/operations/BigInt; - public static final fun toBigInt-LpG4sQ0 ([IB)Lkscience/kmath/operations/BigInt; - public static final fun toBigInt-VKZWuLQ (J)Lkscience/kmath/operations/BigInt; - public static final fun toBigInt-WZ4Q5Ns (I)Lkscience/kmath/operations/BigInt; +public final class space/kscience/kmath/operations/BigIntKt { + public static final fun abs (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; + public static final fun bigInt (Lspace/kscience/kmath/nd/NDAlgebra$Companion;[I)Lspace/kscience/kmath/nd/BufferedNDRing; + public static final fun bigInt (Lspace/kscience/kmath/structures/Buffer$Companion;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public static final fun bigInt (Lspace/kscience/kmath/structures/MutableBuffer$Companion;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/MutableBuffer; + public static final fun parseBigInteger (Ljava/lang/String;)Lspace/kscience/kmath/operations/BigInt; + public static final fun toBigInt (I)Lspace/kscience/kmath/operations/BigInt; + public static final fun toBigInt (J)Lspace/kscience/kmath/operations/BigInt; + public static final fun toBigInt-LpG4sQ0 ([IB)Lspace/kscience/kmath/operations/BigInt; + public static final fun toBigInt-VKZWuLQ (J)Lspace/kscience/kmath/operations/BigInt; + public static final fun toBigInt-WZ4Q5Ns (I)Lspace/kscience/kmath/operations/BigInt; } -public final class kscience/kmath/operations/ByteRing : kscience/kmath/operations/Norm, kscience/kmath/operations/NumericAlgebra, kscience/kmath/operations/Ring { - public static final field INSTANCE Lkscience/kmath/operations/ByteRing; +public final class space/kscience/kmath/operations/ByteRing : space/kscience/kmath/operations/Norm, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/Ring { + public static final field INSTANCE Lspace/kscience/kmath/operations/ByteRing; public fun add (BB)Ljava/lang/Byte; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperation (Ljava/lang/String;BB)Ljava/lang/Byte; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public fun bindSymbol (Ljava/lang/String;)Ljava/lang/Byte; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun div (BLjava/lang/Number;)Ljava/lang/Byte; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun getOne ()Ljava/lang/Byte; @@ -1595,8 +1598,6 @@ public final class kscience/kmath/operations/ByteRing : kscience/kmath/operation public fun rightSideNumberOperation (Ljava/lang/String;BLjava/lang/Number;)Ljava/lang/Byte; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public fun symbol (Ljava/lang/String;)Ljava/lang/Byte; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; public fun times (BB)Ljava/lang/Byte; public fun times (BLjava/lang/Number;)Ljava/lang/Byte; public fun times (Ljava/lang/Number;B)Ljava/lang/Byte; @@ -1612,28 +1613,28 @@ public final class kscience/kmath/operations/ByteRing : kscience/kmath/operation public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/ExponentialOperations : kscience/kmath/operations/Algebra { - public static final field Companion Lkscience/kmath/operations/ExponentialOperations$Companion; +public abstract interface class space/kscience/kmath/operations/ExponentialOperations : space/kscience/kmath/operations/Algebra { + public static final field Companion Lspace/kscience/kmath/operations/ExponentialOperations$Companion; public static final field EXP_OPERATION Ljava/lang/String; public static final field LN_OPERATION Ljava/lang/String; public abstract fun exp (Ljava/lang/Object;)Ljava/lang/Object; public abstract fun ln (Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/ExponentialOperations$Companion { +public final class space/kscience/kmath/operations/ExponentialOperations$Companion { public static final field EXP_OPERATION Ljava/lang/String; public static final field LN_OPERATION Ljava/lang/String; } -public final class kscience/kmath/operations/ExponentialOperations$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/ExponentialOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/ExponentialOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun symbol (Lkscience/kmath/operations/ExponentialOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/ExponentialOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/ExponentialOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; +public final class space/kscience/kmath/operations/ExponentialOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/ExponentialOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/ExponentialOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/ExponentialOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/ExponentialOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/ExponentialOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public abstract interface class kscience/kmath/operations/ExtendedField : kscience/kmath/operations/ExtendedFieldOperations, kscience/kmath/operations/Field, kscience/kmath/operations/NumericAlgebra { +public abstract interface class space/kscience/kmath/operations/ExtendedField : space/kscience/kmath/operations/ExtendedFieldOperations, space/kscience/kmath/operations/Field, space/kscience/kmath/operations/NumericAlgebra { public abstract fun acosh (Ljava/lang/Object;)Ljava/lang/Object; public abstract fun asinh (Ljava/lang/Object;)Ljava/lang/Object; public abstract fun atanh (Ljava/lang/Object;)Ljava/lang/Object; @@ -1643,120 +1644,120 @@ public abstract interface class kscience/kmath/operations/ExtendedField : kscien public abstract fun tanh (Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/ExtendedField$DefaultImpls { - public static fun acosh (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun asinh (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun atanh (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperation (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun cosh (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun div (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun div (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun div (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun leftSideNumberOperation (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun leftSideNumberOperationFunction (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun minus (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun pow (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun rightSideNumberOperation (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun rightSideNumberOperationFunction (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun sinh (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun sqrt (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;)Ljava/lang/Object; - public static fun tan (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun tanh (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/ExtendedField$DefaultImpls { + public static fun acosh (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun asinh (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun atanh (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperation (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;)Ljava/lang/Object; + public static fun cosh (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun leftSideNumberOperation (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun leftSideNumberOperationFunction (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun minus (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun pow (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun rightSideNumberOperation (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun rightSideNumberOperationFunction (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun sinh (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun sqrt (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun tan (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun tanh (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/ExtendedFieldOperations : kscience/kmath/operations/ExponentialOperations, kscience/kmath/operations/FieldOperations, kscience/kmath/operations/HyperbolicOperations, kscience/kmath/operations/PowerOperations, kscience/kmath/operations/TrigonometricOperations { +public abstract interface class space/kscience/kmath/operations/ExtendedFieldOperations : space/kscience/kmath/operations/ExponentialOperations, space/kscience/kmath/operations/FieldOperations, space/kscience/kmath/operations/HyperbolicOperations, space/kscience/kmath/operations/PowerOperations, space/kscience/kmath/operations/TrigonometricOperations { public abstract fun tan (Ljava/lang/Object;)Ljava/lang/Object; public abstract fun tanh (Ljava/lang/Object;)Ljava/lang/Object; public abstract fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/operations/ExtendedFieldOperations$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun div (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun pow (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun sqrt (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun tan (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun tanh (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/ExtendedFieldOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun pow (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun sqrt (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; + public static fun tan (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; + public static fun tanh (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/Field : kscience/kmath/operations/FieldOperations, kscience/kmath/operations/Ring { +public abstract interface class space/kscience/kmath/operations/Field : space/kscience/kmath/operations/FieldOperations, space/kscience/kmath/operations/Ring { public abstract fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/Field$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/Field;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/Field;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/operations/Field;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun div (Lkscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun div (Lkscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/Field;Ljava/lang/String;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/Field;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/Field;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/Field;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/Field;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/Field;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/Field$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/Field;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/Field;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/Field;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/Field;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/Field;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/Field;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/Field;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/FieldElement : kscience/kmath/operations/RingElement { +public abstract interface class space/kscience/kmath/operations/FieldElement : space/kscience/kmath/operations/RingElement { } -public abstract interface class kscience/kmath/operations/FieldOperations : kscience/kmath/operations/RingOperations { - public static final field Companion Lkscience/kmath/operations/FieldOperations$Companion; +public abstract interface class space/kscience/kmath/operations/FieldOperations : space/kscience/kmath/operations/RingOperations { + public static final field Companion Lspace/kscience/kmath/operations/FieldOperations$Companion; public static final field DIV_OPERATION Ljava/lang/String; public abstract fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public abstract fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/FieldOperations$Companion { +public final class space/kscience/kmath/operations/FieldOperations$Companion { public static final field DIV_OPERATION Ljava/lang/String; } -public final class kscience/kmath/operations/FieldOperations$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/FieldOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/FieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun div (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/FieldOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/FieldOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/FieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/FieldOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/FloatField : kscience/kmath/operations/ExtendedField, kscience/kmath/operations/Norm { - public static final field INSTANCE Lkscience/kmath/operations/FloatField; +public final class space/kscience/kmath/operations/FloatField : space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/Norm { + public static final field INSTANCE Lspace/kscience/kmath/operations/FloatField; public fun acos (F)Ljava/lang/Float; public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; public fun acosh (F)Ljava/lang/Float; @@ -1774,6 +1775,8 @@ public final class kscience/kmath/operations/FloatField : kscience/kmath/operati public fun binaryOperation (Ljava/lang/String;FF)Ljava/lang/Float; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public fun bindSymbol (Ljava/lang/String;)Ljava/lang/Float; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun cos (F)Ljava/lang/Float; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; public fun cosh (F)Ljava/lang/Float; @@ -1822,8 +1825,6 @@ public final class kscience/kmath/operations/FloatField : kscience/kmath/operati public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; public fun sqrt (F)Ljava/lang/Float; public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Ljava/lang/Float; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; public fun tan (F)Ljava/lang/Float; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; public fun tanh (F)Ljava/lang/Float; @@ -1843,12 +1844,12 @@ public final class kscience/kmath/operations/FloatField : kscience/kmath/operati public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/HyperbolicOperations : kscience/kmath/operations/Algebra { +public abstract interface class space/kscience/kmath/operations/HyperbolicOperations : space/kscience/kmath/operations/Algebra { public static final field ACOSH_OPERATION Ljava/lang/String; public static final field ASINH_OPERATION Ljava/lang/String; public static final field ATANH_OPERATION Ljava/lang/String; public static final field COSH_OPERATION Ljava/lang/String; - public static final field Companion Lkscience/kmath/operations/HyperbolicOperations$Companion; + public static final field Companion Lspace/kscience/kmath/operations/HyperbolicOperations$Companion; public static final field SINH_OPERATION Ljava/lang/String; public static final field TANH_OPERATION Ljava/lang/String; public abstract fun acosh (Ljava/lang/Object;)Ljava/lang/Object; @@ -1859,7 +1860,7 @@ public abstract interface class kscience/kmath/operations/HyperbolicOperations : public abstract fun tanh (Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/HyperbolicOperations$Companion { +public final class space/kscience/kmath/operations/HyperbolicOperations$Companion { public static final field ACOSH_OPERATION Ljava/lang/String; public static final field ASINH_OPERATION Ljava/lang/String; public static final field ATANH_OPERATION Ljava/lang/String; @@ -1868,21 +1869,23 @@ public final class kscience/kmath/operations/HyperbolicOperations$Companion { public static final field TANH_OPERATION Ljava/lang/String; } -public final class kscience/kmath/operations/HyperbolicOperations$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun symbol (Lkscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; +public final class space/kscience/kmath/operations/HyperbolicOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/operations/IntRing : kscience/kmath/operations/Norm, kscience/kmath/operations/NumericAlgebra, kscience/kmath/operations/Ring { - public static final field INSTANCE Lkscience/kmath/operations/IntRing; +public final class space/kscience/kmath/operations/IntRing : space/kscience/kmath/operations/Norm, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/Ring { + public static final field INSTANCE Lspace/kscience/kmath/operations/IntRing; public fun add (II)Ljava/lang/Integer; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperation (Ljava/lang/String;II)Ljava/lang/Integer; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public fun bindSymbol (Ljava/lang/String;)Ljava/lang/Integer; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun div (ILjava/lang/Number;)Ljava/lang/Integer; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun getOne ()Ljava/lang/Integer; @@ -1907,8 +1910,6 @@ public final class kscience/kmath/operations/IntRing : kscience/kmath/operations public fun rightSideNumberOperation (Ljava/lang/String;ILjava/lang/Number;)Ljava/lang/Integer; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public fun symbol (Ljava/lang/String;)Ljava/lang/Integer; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; public fun times (II)Ljava/lang/Integer; public fun times (ILjava/lang/Number;)Ljava/lang/Integer; public fun times (Ljava/lang/Number;I)Ljava/lang/Integer; @@ -1924,23 +1925,25 @@ public final class kscience/kmath/operations/IntRing : kscience/kmath/operations public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/JBigDecimalField : kscience/kmath/operations/JBigDecimalFieldBase { - public static final field Companion Lkscience/kmath/operations/JBigDecimalField$Companion; +public final class space/kscience/kmath/operations/JBigDecimalField : space/kscience/kmath/operations/JBigDecimalFieldBase { + public static final field Companion Lspace/kscience/kmath/operations/JBigDecimalField$Companion; public fun ()V public fun (Ljava/math/MathContext;)V public synthetic fun (Ljava/math/MathContext;ILkotlin/jvm/internal/DefaultConstructorMarker;)V } -public final class kscience/kmath/operations/JBigDecimalField$Companion : kscience/kmath/operations/JBigDecimalFieldBase { +public final class space/kscience/kmath/operations/JBigDecimalField$Companion : space/kscience/kmath/operations/JBigDecimalFieldBase { } -public abstract class kscience/kmath/operations/JBigDecimalFieldBase : kscience/kmath/operations/Field, kscience/kmath/operations/NumericAlgebra, kscience/kmath/operations/PowerOperations { +public abstract class space/kscience/kmath/operations/JBigDecimalFieldBase : space/kscience/kmath/operations/Field, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/PowerOperations { public fun ()V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun add (Ljava/math/BigDecimal;Ljava/math/BigDecimal;)Ljava/math/BigDecimal; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperation (Ljava/lang/String;Ljava/math/BigDecimal;Ljava/math/BigDecimal;)Ljava/math/BigDecimal; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Ljava/math/BigDecimal; public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public fun div (Ljava/lang/Number;Ljava/math/BigDecimal;)Ljava/math/BigDecimal; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; @@ -1975,8 +1978,6 @@ public abstract class kscience/kmath/operations/JBigDecimalFieldBase : kscience/ public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; public fun sqrt (Ljava/math/BigDecimal;)Ljava/math/BigDecimal; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Ljava/math/BigDecimal; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public fun times (Ljava/lang/Number;Ljava/math/BigDecimal;)Ljava/math/BigDecimal; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; @@ -1992,13 +1993,15 @@ public abstract class kscience/kmath/operations/JBigDecimalFieldBase : kscience/ public fun unaryPlus (Ljava/math/BigDecimal;)Ljava/math/BigDecimal; } -public final class kscience/kmath/operations/JBigIntegerField : kscience/kmath/operations/Field, kscience/kmath/operations/NumericAlgebra { - public static final field INSTANCE Lkscience/kmath/operations/JBigIntegerField; +public final class space/kscience/kmath/operations/JBigIntegerField : space/kscience/kmath/operations/Field, space/kscience/kmath/operations/NumericAlgebra { + public static final field INSTANCE Lspace/kscience/kmath/operations/JBigIntegerField; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun add (Ljava/math/BigInteger;Ljava/math/BigInteger;)Ljava/math/BigInteger; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperation (Ljava/lang/String;Ljava/math/BigInteger;Ljava/math/BigInteger;)Ljava/math/BigInteger; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Ljava/math/BigInteger; public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public fun div (Ljava/lang/Number;Ljava/math/BigInteger;)Ljava/math/BigInteger; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; @@ -2027,8 +2030,6 @@ public final class kscience/kmath/operations/JBigIntegerField : kscience/kmath/o public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperation (Ljava/lang/String;Ljava/math/BigInteger;Ljava/lang/Number;)Ljava/math/BigInteger; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Ljava/math/BigInteger; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public fun times (Ljava/lang/Number;Ljava/math/BigInteger;)Ljava/math/BigInteger; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; @@ -2044,16 +2045,18 @@ public final class kscience/kmath/operations/JBigIntegerField : kscience/kmath/o public fun unaryPlus (Ljava/math/BigInteger;)Ljava/math/BigInteger; } -public abstract interface annotation class kscience/kmath/operations/KMathContext : java/lang/annotation/Annotation { +public abstract interface annotation class space/kscience/kmath/operations/KMathContext : java/lang/annotation/Annotation { } -public final class kscience/kmath/operations/LongRing : kscience/kmath/operations/Norm, kscience/kmath/operations/NumericAlgebra, kscience/kmath/operations/Ring { - public static final field INSTANCE Lkscience/kmath/operations/LongRing; +public final class space/kscience/kmath/operations/LongRing : space/kscience/kmath/operations/Norm, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/Ring { + public static final field INSTANCE Lspace/kscience/kmath/operations/LongRing; public fun add (JJ)Ljava/lang/Long; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperation (Ljava/lang/String;JJ)Ljava/lang/Long; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public fun bindSymbol (Ljava/lang/String;)Ljava/lang/Long; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun div (JLjava/lang/Number;)Ljava/lang/Long; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun getOne ()Ljava/lang/Long; @@ -2078,8 +2081,6 @@ public final class kscience/kmath/operations/LongRing : kscience/kmath/operation public fun rightSideNumberOperation (Ljava/lang/String;JLjava/lang/Number;)Ljava/lang/Long; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public fun symbol (Ljava/lang/String;)Ljava/lang/Long; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; public fun times (JJ)Ljava/lang/Long; public fun times (JLjava/lang/Number;)Ljava/lang/Long; public fun times (Ljava/lang/Number;J)Ljava/lang/Long; @@ -2095,11 +2096,11 @@ public final class kscience/kmath/operations/LongRing : kscience/kmath/operation public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/Norm { +public abstract interface class space/kscience/kmath/operations/Norm { public abstract fun norm (Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/NumericAlgebra : kscience/kmath/operations/Algebra { +public abstract interface class space/kscience/kmath/operations/NumericAlgebra : space/kscience/kmath/operations/Algebra { public abstract fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public abstract fun number (Ljava/lang/Number;)Ljava/lang/Object; @@ -2107,41 +2108,41 @@ public abstract interface class kscience/kmath/operations/NumericAlgebra : kscie public abstract fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; } -public final class kscience/kmath/operations/NumericAlgebra$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun leftSideNumberOperation (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun leftSideNumberOperationFunction (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun rightSideNumberOperation (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun rightSideNumberOperationFunction (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun symbol (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; +public final class space/kscience/kmath/operations/NumericAlgebra$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Ljava/lang/Object; + public static fun leftSideNumberOperation (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun leftSideNumberOperationFunction (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun rightSideNumberOperation (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun rightSideNumberOperationFunction (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun unaryOperation (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/operations/OptionalOperationsKt { - public static final fun acos (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun acosh (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun asin (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun asinh (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun atan (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun atanh (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun cos (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun cosh (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun exp (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun ln (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun norm (Lkscience/kmath/operations/AlgebraElement;)Ljava/lang/Object; - public static final fun pow (Lkscience/kmath/operations/AlgebraElement;D)Lkscience/kmath/operations/AlgebraElement; - public static final fun sin (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun sinh (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun sqr (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun sqrt (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun tan (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun tanh (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; +public final class space/kscience/kmath/operations/OptionalOperationsKt { + public static final fun acos (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun acosh (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun asin (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun asinh (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun atan (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun atanh (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun cos (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun cosh (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun exp (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun ln (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun norm (Lspace/kscience/kmath/operations/AlgebraElement;)Ljava/lang/Object; + public static final fun pow (Lspace/kscience/kmath/operations/AlgebraElement;D)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun sin (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun sinh (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun sqr (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun sqrt (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun tan (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun tanh (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; } -public abstract interface class kscience/kmath/operations/PowerOperations : kscience/kmath/operations/Algebra { - public static final field Companion Lkscience/kmath/operations/PowerOperations$Companion; +public abstract interface class space/kscience/kmath/operations/PowerOperations : space/kscience/kmath/operations/Algebra { + public static final field Companion Lspace/kscience/kmath/operations/PowerOperations$Companion; public static final field POW_OPERATION Ljava/lang/String; public static final field SQRT_OPERATION Ljava/lang/String; public abstract fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; @@ -2149,23 +2150,23 @@ public abstract interface class kscience/kmath/operations/PowerOperations : ksci public abstract fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/PowerOperations$Companion { +public final class space/kscience/kmath/operations/PowerOperations$Companion { public static final field POW_OPERATION Ljava/lang/String; public static final field SQRT_OPERATION Ljava/lang/String; } -public final class kscience/kmath/operations/PowerOperations$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/PowerOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/PowerOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun pow (Lkscience/kmath/operations/PowerOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun sqrt (Lkscience/kmath/operations/PowerOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/PowerOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/PowerOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/PowerOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; +public final class space/kscience/kmath/operations/PowerOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/PowerOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/PowerOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/PowerOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun pow (Lspace/kscience/kmath/operations/PowerOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun sqrt (Lspace/kscience/kmath/operations/PowerOperations;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/PowerOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/PowerOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/operations/RealField : kscience/kmath/operations/ExtendedField, kscience/kmath/operations/Norm { - public static final field INSTANCE Lkscience/kmath/operations/RealField; +public final class space/kscience/kmath/operations/RealField : space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/Norm { + public static final field INSTANCE Lspace/kscience/kmath/operations/RealField; public fun acos (D)Ljava/lang/Double; public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; public fun acosh (D)Ljava/lang/Double; @@ -2183,6 +2184,8 @@ public final class kscience/kmath/operations/RealField : kscience/kmath/operatio public fun binaryOperation (Ljava/lang/String;DD)Ljava/lang/Double; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public fun bindSymbol (Ljava/lang/String;)Ljava/lang/Double; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun cos (D)Ljava/lang/Double; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; public fun cosh (D)Ljava/lang/Double; @@ -2231,8 +2234,6 @@ public final class kscience/kmath/operations/RealField : kscience/kmath/operatio public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; public fun sqrt (D)Ljava/lang/Double; public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Ljava/lang/Double; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; public fun tan (D)Ljava/lang/Double; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; public fun tanh (D)Ljava/lang/Double; @@ -2252,58 +2253,58 @@ public final class kscience/kmath/operations/RealField : kscience/kmath/operatio public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/Ring : kscience/kmath/operations/RingOperations, kscience/kmath/operations/Space { +public abstract interface class space/kscience/kmath/operations/Ring : space/kscience/kmath/operations/RingOperations, space/kscience/kmath/operations/Space { public abstract fun getOne ()Ljava/lang/Object; } -public final class kscience/kmath/operations/Ring$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/Ring;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/Ring;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/Ring;Ljava/lang/String;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/Ring;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/Ring;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/Ring;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/Ring;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/Ring;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/Ring$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/Ring;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/Ring;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/Ring;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/Ring;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/Ring;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/RingElement : kscience/kmath/operations/SpaceElement { +public abstract interface class space/kscience/kmath/operations/RingElement : space/kscience/kmath/operations/SpaceElement { } -public abstract interface class kscience/kmath/operations/RingOperations : kscience/kmath/operations/SpaceOperations { - public static final field Companion Lkscience/kmath/operations/RingOperations$Companion; +public abstract interface class space/kscience/kmath/operations/RingOperations : space/kscience/kmath/operations/SpaceOperations { + public static final field Companion Lspace/kscience/kmath/operations/RingOperations$Companion; public static final field TIMES_OPERATION Ljava/lang/String; public abstract fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public abstract fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/RingOperations$Companion { +public final class space/kscience/kmath/operations/RingOperations$Companion { public static final field TIMES_OPERATION Ljava/lang/String; } -public final class kscience/kmath/operations/RingOperations$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/RingOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/RingOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/RingOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/RingOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/RingOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/RingOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/RingOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/RingOperations;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/RingOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/RingWithNumbers : kscience/kmath/operations/NumericAlgebra, kscience/kmath/operations/Ring { +public abstract interface class space/kscience/kmath/operations/RingWithNumbers : space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/Ring { public abstract fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public abstract fun number (Ljava/lang/Number;)Ljava/lang/Object; @@ -2311,38 +2312,40 @@ public abstract interface class kscience/kmath/operations/RingWithNumbers : ksci public abstract fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; } -public final class kscience/kmath/operations/RingWithNumbers$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun leftSideNumberOperation (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun leftSideNumberOperationFunction (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun minus (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun number (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun rightSideNumberOperation (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun rightSideNumberOperationFunction (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun symbol (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/RingWithNumbers$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun leftSideNumberOperation (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun leftSideNumberOperationFunction (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun minus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun number (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun rightSideNumberOperation (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun rightSideNumberOperationFunction (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun times (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/ShortRing : kscience/kmath/operations/Norm, kscience/kmath/operations/NumericAlgebra, kscience/kmath/operations/Ring { - public static final field INSTANCE Lkscience/kmath/operations/ShortRing; +public final class space/kscience/kmath/operations/ShortRing : space/kscience/kmath/operations/Norm, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/Ring { + public static final field INSTANCE Lspace/kscience/kmath/operations/ShortRing; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun add (SS)Ljava/lang/Short; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperation (Ljava/lang/String;SS)Ljava/lang/Short; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Ljava/lang/Short; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun div (SLjava/lang/Number;)Ljava/lang/Short; public synthetic fun getOne ()Ljava/lang/Object; @@ -2367,8 +2370,6 @@ public final class kscience/kmath/operations/ShortRing : kscience/kmath/operatio public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperation (Ljava/lang/String;SLjava/lang/Number;)Ljava/lang/Short; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Ljava/lang/Short; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public fun times (Ljava/lang/Number;S)Ljava/lang/Short; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; @@ -2384,30 +2385,30 @@ public final class kscience/kmath/operations/ShortRing : kscience/kmath/operatio public fun unaryPlus (S)Ljava/lang/Short; } -public abstract interface class kscience/kmath/operations/Space : kscience/kmath/operations/SpaceOperations { +public abstract interface class space/kscience/kmath/operations/Space : space/kscience/kmath/operations/SpaceOperations { public abstract fun getZero ()Ljava/lang/Object; } -public final class kscience/kmath/operations/Space$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/Space;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/Space;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/Space;Ljava/lang/String;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/Space;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/Space;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/Space;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/Space;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/Space;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/Space$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/Space;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/SpaceElement : kscience/kmath/operations/AlgebraElement { +public abstract interface class space/kscience/kmath/operations/SpaceElement : space/kscience/kmath/operations/AlgebraElement { } -public abstract interface class kscience/kmath/operations/SpaceOperations : kscience/kmath/operations/Algebra { - public static final field Companion Lkscience/kmath/operations/SpaceOperations$Companion; +public abstract interface class space/kscience/kmath/operations/SpaceOperations : space/kscience/kmath/operations/Algebra { + public static final field Companion Lspace/kscience/kmath/operations/SpaceOperations$Companion; public static final field MINUS_OPERATION Ljava/lang/String; public static final field PLUS_OPERATION Ljava/lang/String; public abstract fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; @@ -2423,32 +2424,32 @@ public abstract interface class kscience/kmath/operations/SpaceOperations : ksci public abstract fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/SpaceOperations$Companion { +public final class space/kscience/kmath/operations/SpaceOperations$Companion { public static final field MINUS_OPERATION Ljava/lang/String; public static final field PLUS_OPERATION Ljava/lang/String; } -public final class kscience/kmath/operations/SpaceOperations$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/SpaceOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/TrigonometricOperations : kscience/kmath/operations/Algebra { +public abstract interface class space/kscience/kmath/operations/TrigonometricOperations : space/kscience/kmath/operations/Algebra { public static final field ACOS_OPERATION Ljava/lang/String; public static final field ASIN_OPERATION Ljava/lang/String; public static final field ATAN_OPERATION Ljava/lang/String; public static final field COS_OPERATION Ljava/lang/String; - public static final field Companion Lkscience/kmath/operations/TrigonometricOperations$Companion; + public static final field Companion Lspace/kscience/kmath/operations/TrigonometricOperations$Companion; public static final field SIN_OPERATION Ljava/lang/String; public static final field TAN_OPERATION Ljava/lang/String; public abstract fun acos (Ljava/lang/Object;)Ljava/lang/Object; @@ -2459,7 +2460,7 @@ public abstract interface class kscience/kmath/operations/TrigonometricOperation public abstract fun tan (Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/TrigonometricOperations$Companion { +public final class space/kscience/kmath/operations/TrigonometricOperations$Companion { public static final field ACOS_OPERATION Ljava/lang/String; public static final field ASIN_OPERATION Ljava/lang/String; public static final field ATAN_OPERATION Ljava/lang/String; @@ -2468,71 +2469,71 @@ public final class kscience/kmath/operations/TrigonometricOperations$Companion { public static final field TAN_OPERATION Ljava/lang/String; } -public final class kscience/kmath/operations/TrigonometricOperations$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun symbol (Lkscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; +public final class space/kscience/kmath/operations/TrigonometricOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/structures/ArrayBuffer : kscience/kmath/structures/MutableBuffer { +public final class space/kscience/kmath/structures/ArrayBuffer : space/kscience/kmath/structures/MutableBuffer { public fun ([Ljava/lang/Object;)V - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public fun copy ()Lkscience/kmath/structures/MutableBuffer; + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; public fun get (I)Ljava/lang/Object; public fun getSize ()I public fun iterator ()Ljava/util/Iterator; public fun set (ILjava/lang/Object;)V } -public abstract interface class kscience/kmath/structures/Buffer { - public static final field Companion Lkscience/kmath/structures/Buffer$Companion; - public abstract fun contentEquals (Lkscience/kmath/structures/Buffer;)Z +public abstract interface class space/kscience/kmath/structures/Buffer { + public static final field Companion Lspace/kscience/kmath/structures/Buffer$Companion; + public abstract fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z public abstract fun get (I)Ljava/lang/Object; public abstract fun getSize ()I public abstract fun iterator ()Ljava/util/Iterator; } -public final class kscience/kmath/structures/Buffer$Companion { - public final fun auto (Lkotlin/reflect/KClass;ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/Buffer; - public final fun boxing (ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/Buffer; - public final fun real-4n5bU9U (ILkotlin/jvm/functions/Function1;)[D +public final class space/kscience/kmath/structures/Buffer$Companion { + public final fun auto (Lkotlin/reflect/KClass;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public final fun boxing (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public final fun real-8hrHhI4 (ILkotlin/jvm/functions/Function1;)[D } -public final class kscience/kmath/structures/Buffer$DefaultImpls { - public static fun contentEquals (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Z +public final class space/kscience/kmath/structures/Buffer$DefaultImpls { + public static fun contentEquals (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Z } -public final class kscience/kmath/structures/BufferKt { +public final class space/kscience/kmath/structures/BufferKt { public static final fun ListBuffer (ILkotlin/jvm/functions/Function1;)Ljava/util/List; public static final fun asBuffer (Ljava/util/List;)Ljava/util/List; - public static final fun asBuffer ([Ljava/lang/Object;)Lkscience/kmath/structures/ArrayBuffer; - public static final fun asIterable (Lkscience/kmath/structures/Buffer;)Ljava/lang/Iterable; - public static final fun asReadOnly (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static final fun asSequence (Lkscience/kmath/structures/Buffer;)Lkotlin/sequences/Sequence; - public static final fun getIndices (Lkscience/kmath/structures/Buffer;)Lkotlin/ranges/IntRange; - public static final fun toList (Lkscience/kmath/structures/Buffer;)Ljava/util/List; + public static final fun asBuffer ([Ljava/lang/Object;)Lspace/kscience/kmath/structures/ArrayBuffer; + public static final fun asIterable (Lspace/kscience/kmath/structures/Buffer;)Ljava/lang/Iterable; + public static final fun asReadOnly (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static final fun asSequence (Lspace/kscience/kmath/structures/Buffer;)Lkotlin/sequences/Sequence; + public static final fun getIndices (Lspace/kscience/kmath/structures/Buffer;)Lkotlin/ranges/IntRange; + public static final fun toList (Lspace/kscience/kmath/structures/Buffer;)Ljava/util/List; } -public abstract interface class kscience/kmath/structures/FlaggedBuffer : kscience/kmath/structures/Buffer { +public abstract interface class space/kscience/kmath/structures/FlaggedBuffer : space/kscience/kmath/structures/Buffer { public abstract fun getFlag (I)B } -public final class kscience/kmath/structures/FlaggedBuffer$DefaultImpls { - public static fun contentEquals (Lkscience/kmath/structures/FlaggedBuffer;Lkscience/kmath/structures/Buffer;)Z +public final class space/kscience/kmath/structures/FlaggedBuffer$DefaultImpls { + public static fun contentEquals (Lspace/kscience/kmath/structures/FlaggedBuffer;Lspace/kscience/kmath/structures/Buffer;)Z } -public final class kscience/kmath/structures/FlaggedBufferKt { - public static final fun forEachValid (Lkscience/kmath/structures/FlaggedRealBuffer;Lkotlin/jvm/functions/Function1;)V - public static final fun hasFlag (Lkscience/kmath/structures/FlaggedBuffer;ILkscience/kmath/structures/ValueFlag;)Z - public static final fun isMissing (Lkscience/kmath/structures/FlaggedBuffer;I)Z - public static final fun isValid (Lkscience/kmath/structures/FlaggedBuffer;I)Z +public final class space/kscience/kmath/structures/FlaggedBufferKt { + public static final fun forEachValid (Lspace/kscience/kmath/structures/FlaggedRealBuffer;Lkotlin/jvm/functions/Function1;)V + public static final fun hasFlag (Lspace/kscience/kmath/structures/FlaggedBuffer;ILspace/kscience/kmath/structures/ValueFlag;)Z + public static final fun isMissing (Lspace/kscience/kmath/structures/FlaggedBuffer;I)Z + public static final fun isValid (Lspace/kscience/kmath/structures/FlaggedBuffer;I)Z } -public final class kscience/kmath/structures/FlaggedRealBuffer : kscience/kmath/structures/Buffer, kscience/kmath/structures/FlaggedBuffer { +public final class space/kscience/kmath/structures/FlaggedRealBuffer : space/kscience/kmath/structures/Buffer, space/kscience/kmath/structures/FlaggedBuffer { public fun ([D[B)V - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z public fun get (I)Ljava/lang/Double; public synthetic fun get (I)Ljava/lang/Object; public fun getFlag (I)B @@ -2542,13 +2543,13 @@ public final class kscience/kmath/structures/FlaggedRealBuffer : kscience/kmath/ public fun iterator ()Ljava/util/Iterator; } -public final class kscience/kmath/structures/FloatBuffer : kscience/kmath/structures/MutableBuffer { - public static final synthetic fun box-impl ([F)Lkscience/kmath/structures/FloatBuffer; +public final class space/kscience/kmath/structures/FloatBuffer : space/kscience/kmath/structures/MutableBuffer { + public static final synthetic fun box-impl ([F)Lspace/kscience/kmath/structures/FloatBuffer; public static fun constructor-impl ([F)[F - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl ([FLkscience/kmath/structures/Buffer;)Z - public fun copy ()Lkscience/kmath/structures/MutableBuffer; - public static fun copy-impl ([F)Lkscience/kmath/structures/MutableBuffer; + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl ([FLspace/kscience/kmath/structures/Buffer;)Z + public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; + public static fun copy-impl ([F)Lspace/kscience/kmath/structures/MutableBuffer; public fun equals (Ljava/lang/Object;)Z public static fun equals-impl ([FLjava/lang/Object;)Z public static final fun equals-impl0 ([F[F)Z @@ -2571,20 +2572,20 @@ public final class kscience/kmath/structures/FloatBuffer : kscience/kmath/struct public final synthetic fun unbox-impl ()[F } -public final class kscience/kmath/structures/FloatBufferKt { +public final class space/kscience/kmath/structures/FloatBufferKt { public static final fun FloatBuffer (ILkotlin/jvm/functions/Function1;)[F public static final fun FloatBuffer ([F)[F public static final fun asBuffer ([F)[F - public static final fun getArray (Lkscience/kmath/structures/MutableBuffer;)[F + public static final fun getArray (Lspace/kscience/kmath/structures/MutableBuffer;)[F } -public final class kscience/kmath/structures/IntBuffer : kscience/kmath/structures/MutableBuffer { - public static final synthetic fun box-impl ([I)Lkscience/kmath/structures/IntBuffer; +public final class space/kscience/kmath/structures/IntBuffer : space/kscience/kmath/structures/MutableBuffer { + public static final synthetic fun box-impl ([I)Lspace/kscience/kmath/structures/IntBuffer; public static fun constructor-impl ([I)[I - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl ([ILkscience/kmath/structures/Buffer;)Z - public fun copy ()Lkscience/kmath/structures/MutableBuffer; - public static fun copy-impl ([I)Lkscience/kmath/structures/MutableBuffer; + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl ([ILspace/kscience/kmath/structures/Buffer;)Z + public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; + public static fun copy-impl ([I)Lspace/kscience/kmath/structures/MutableBuffer; public fun equals (Ljava/lang/Object;)Z public static fun equals-impl ([ILjava/lang/Object;)Z public static final fun equals-impl0 ([I[I)Z @@ -2607,18 +2608,18 @@ public final class kscience/kmath/structures/IntBuffer : kscience/kmath/structur public final synthetic fun unbox-impl ()[I } -public final class kscience/kmath/structures/IntBufferKt { +public final class space/kscience/kmath/structures/IntBufferKt { public static final fun IntBuffer (ILkotlin/jvm/functions/Function1;)[I public static final fun IntBuffer ([I)[I public static final fun asBuffer ([I)[I - public static final fun getArray (Lkscience/kmath/structures/MutableBuffer;)[I + public static final fun getArray (Lspace/kscience/kmath/structures/MutableBuffer;)[I } -public final class kscience/kmath/structures/ListBuffer : kscience/kmath/structures/Buffer { - public static final synthetic fun box-impl (Ljava/util/List;)Lkscience/kmath/structures/ListBuffer; +public final class space/kscience/kmath/structures/ListBuffer : space/kscience/kmath/structures/Buffer { + public static final synthetic fun box-impl (Ljava/util/List;)Lspace/kscience/kmath/structures/ListBuffer; public static fun constructor-impl (Ljava/util/List;)Ljava/util/List; - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl (Ljava/util/List;Lkscience/kmath/structures/Buffer;)Z + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl (Ljava/util/List;Lspace/kscience/kmath/structures/Buffer;)Z public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Ljava/util/List;Ljava/lang/Object;)Z public static final fun equals-impl0 (Ljava/util/List;Ljava/util/List;)Z @@ -2636,13 +2637,13 @@ public final class kscience/kmath/structures/ListBuffer : kscience/kmath/structu public final synthetic fun unbox-impl ()Ljava/util/List; } -public final class kscience/kmath/structures/LongBuffer : kscience/kmath/structures/MutableBuffer { - public static final synthetic fun box-impl ([J)Lkscience/kmath/structures/LongBuffer; +public final class space/kscience/kmath/structures/LongBuffer : space/kscience/kmath/structures/MutableBuffer { + public static final synthetic fun box-impl ([J)Lspace/kscience/kmath/structures/LongBuffer; public static fun constructor-impl ([J)[J - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl ([JLkscience/kmath/structures/Buffer;)Z - public fun copy ()Lkscience/kmath/structures/MutableBuffer; - public static fun copy-impl ([J)Lkscience/kmath/structures/MutableBuffer; + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl ([JLspace/kscience/kmath/structures/Buffer;)Z + public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; + public static fun copy-impl ([J)Lspace/kscience/kmath/structures/MutableBuffer; public fun equals (Ljava/lang/Object;)Z public static fun equals-impl ([JLjava/lang/Object;)Z public static final fun equals-impl0 ([J[J)Z @@ -2665,52 +2666,52 @@ public final class kscience/kmath/structures/LongBuffer : kscience/kmath/structu public final synthetic fun unbox-impl ()[J } -public final class kscience/kmath/structures/LongBufferKt { +public final class space/kscience/kmath/structures/LongBufferKt { public static final fun LongBuffer (ILkotlin/jvm/functions/Function1;)[J public static final fun LongBuffer ([J)[J public static final fun asBuffer ([J)[J - public static final fun getArray (Lkscience/kmath/structures/MutableBuffer;)[J + public static final fun getArray (Lspace/kscience/kmath/structures/MutableBuffer;)[J } -public class kscience/kmath/structures/MemoryBuffer : kscience/kmath/structures/Buffer { - public static final field Companion Lkscience/kmath/structures/MemoryBuffer$Companion; - public fun (Lkscience/kmath/memory/Memory;Lkscience/kmath/memory/MemorySpec;)V - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z +public class space/kscience/kmath/structures/MemoryBuffer : space/kscience/kmath/structures/Buffer { + public static final field Companion Lspace/kscience/kmath/structures/MemoryBuffer$Companion; + public fun (Lspace/kscience/kmath/memory/Memory;Lspace/kscience/kmath/memory/MemorySpec;)V + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z public fun get (I)Ljava/lang/Object; - protected final fun getMemory ()Lkscience/kmath/memory/Memory; + protected final fun getMemory ()Lspace/kscience/kmath/memory/Memory; public fun getSize ()I - protected final fun getSpec ()Lkscience/kmath/memory/MemorySpec; + protected final fun getSpec ()Lspace/kscience/kmath/memory/MemorySpec; public fun iterator ()Ljava/util/Iterator; } -public final class kscience/kmath/structures/MemoryBuffer$Companion { - public final fun create (Lkscience/kmath/memory/MemorySpec;I)Lkscience/kmath/structures/MemoryBuffer; - public final fun create (Lkscience/kmath/memory/MemorySpec;ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/MemoryBuffer; +public final class space/kscience/kmath/structures/MemoryBuffer$Companion { + public final fun create (Lspace/kscience/kmath/memory/MemorySpec;I)Lspace/kscience/kmath/structures/MemoryBuffer; + public final fun create (Lspace/kscience/kmath/memory/MemorySpec;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/MemoryBuffer; } -public abstract interface class kscience/kmath/structures/MutableBuffer : kscience/kmath/structures/Buffer { - public static final field Companion Lkscience/kmath/structures/MutableBuffer$Companion; - public abstract fun copy ()Lkscience/kmath/structures/MutableBuffer; +public abstract interface class space/kscience/kmath/structures/MutableBuffer : space/kscience/kmath/structures/Buffer { + public static final field Companion Lspace/kscience/kmath/structures/MutableBuffer$Companion; + public abstract fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; public abstract fun set (ILjava/lang/Object;)V } -public final class kscience/kmath/structures/MutableBuffer$Companion { - public final fun auto (Lkotlin/reflect/KClass;ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/MutableBuffer; - public final fun boxing (ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/MutableBuffer; - public final fun real-4n5bU9U (ILkotlin/jvm/functions/Function1;)[D +public final class space/kscience/kmath/structures/MutableBuffer$Companion { + public final fun auto (Lkotlin/reflect/KClass;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/MutableBuffer; + public final fun boxing (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/MutableBuffer; + public final fun real-8hrHhI4 (ILkotlin/jvm/functions/Function1;)[D } -public final class kscience/kmath/structures/MutableBuffer$DefaultImpls { - public static fun contentEquals (Lkscience/kmath/structures/MutableBuffer;Lkscience/kmath/structures/Buffer;)Z +public final class space/kscience/kmath/structures/MutableBuffer$DefaultImpls { + public static fun contentEquals (Lspace/kscience/kmath/structures/MutableBuffer;Lspace/kscience/kmath/structures/Buffer;)Z } -public final class kscience/kmath/structures/MutableListBuffer : kscience/kmath/structures/MutableBuffer { - public static final synthetic fun box-impl (Ljava/util/List;)Lkscience/kmath/structures/MutableListBuffer; +public final class space/kscience/kmath/structures/MutableListBuffer : space/kscience/kmath/structures/MutableBuffer { + public static final synthetic fun box-impl (Ljava/util/List;)Lspace/kscience/kmath/structures/MutableListBuffer; public static fun constructor-impl (Ljava/util/List;)Ljava/util/List; - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl (Ljava/util/List;Lkscience/kmath/structures/Buffer;)Z - public fun copy ()Lkscience/kmath/structures/MutableBuffer; - public static fun copy-impl (Ljava/util/List;)Lkscience/kmath/structures/MutableBuffer; + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl (Ljava/util/List;Lspace/kscience/kmath/structures/Buffer;)Z + public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; + public static fun copy-impl (Ljava/util/List;)Lspace/kscience/kmath/structures/MutableBuffer; public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Ljava/util/List;Ljava/lang/Object;)Z public static final fun equals-impl0 (Ljava/util/List;Ljava/util/List;)Z @@ -2730,48 +2731,48 @@ public final class kscience/kmath/structures/MutableListBuffer : kscience/kmath/ public final synthetic fun unbox-impl ()Ljava/util/List; } -public final class kscience/kmath/structures/MutableMemoryBuffer : kscience/kmath/structures/MemoryBuffer, kscience/kmath/structures/MutableBuffer { - public static final field Companion Lkscience/kmath/structures/MutableMemoryBuffer$Companion; - public fun (Lkscience/kmath/memory/Memory;Lkscience/kmath/memory/MemorySpec;)V - public fun copy ()Lkscience/kmath/structures/MutableBuffer; +public final class space/kscience/kmath/structures/MutableMemoryBuffer : space/kscience/kmath/structures/MemoryBuffer, space/kscience/kmath/structures/MutableBuffer { + public static final field Companion Lspace/kscience/kmath/structures/MutableMemoryBuffer$Companion; + public fun (Lspace/kscience/kmath/memory/Memory;Lspace/kscience/kmath/memory/MemorySpec;)V + public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; public fun set (ILjava/lang/Object;)V } -public final class kscience/kmath/structures/MutableMemoryBuffer$Companion { - public final fun create (Lkscience/kmath/memory/MemorySpec;I)Lkscience/kmath/structures/MutableMemoryBuffer; - public final fun create (Lkscience/kmath/memory/MemorySpec;ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/MutableMemoryBuffer; +public final class space/kscience/kmath/structures/MutableMemoryBuffer$Companion { + public final fun create (Lspace/kscience/kmath/memory/MemorySpec;I)Lspace/kscience/kmath/structures/MutableMemoryBuffer; + public final fun create (Lspace/kscience/kmath/memory/MemorySpec;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/MutableMemoryBuffer; } -public final class kscience/kmath/structures/ReadOnlyBuffer : kscience/kmath/structures/Buffer { - public static final synthetic fun box-impl (Lkscience/kmath/structures/MutableBuffer;)Lkscience/kmath/structures/ReadOnlyBuffer; - public static fun constructor-impl (Lkscience/kmath/structures/MutableBuffer;)Lkscience/kmath/structures/MutableBuffer; - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl (Lkscience/kmath/structures/MutableBuffer;Lkscience/kmath/structures/Buffer;)Z +public final class space/kscience/kmath/structures/ReadOnlyBuffer : space/kscience/kmath/structures/Buffer { + public static final synthetic fun box-impl (Lspace/kscience/kmath/structures/MutableBuffer;)Lspace/kscience/kmath/structures/ReadOnlyBuffer; + public static fun constructor-impl (Lspace/kscience/kmath/structures/MutableBuffer;)Lspace/kscience/kmath/structures/MutableBuffer; + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl (Lspace/kscience/kmath/structures/MutableBuffer;Lspace/kscience/kmath/structures/Buffer;)Z public fun equals (Ljava/lang/Object;)Z - public static fun equals-impl (Lkscience/kmath/structures/MutableBuffer;Ljava/lang/Object;)Z - public static final fun equals-impl0 (Lkscience/kmath/structures/MutableBuffer;Lkscience/kmath/structures/MutableBuffer;)Z + public static fun equals-impl (Lspace/kscience/kmath/structures/MutableBuffer;Ljava/lang/Object;)Z + public static final fun equals-impl0 (Lspace/kscience/kmath/structures/MutableBuffer;Lspace/kscience/kmath/structures/MutableBuffer;)Z public fun get (I)Ljava/lang/Object; - public static fun get-impl (Lkscience/kmath/structures/MutableBuffer;I)Ljava/lang/Object; - public final fun getBuffer ()Lkscience/kmath/structures/MutableBuffer; + public static fun get-impl (Lspace/kscience/kmath/structures/MutableBuffer;I)Ljava/lang/Object; + public final fun getBuffer ()Lspace/kscience/kmath/structures/MutableBuffer; public fun getSize ()I - public static fun getSize-impl (Lkscience/kmath/structures/MutableBuffer;)I + public static fun getSize-impl (Lspace/kscience/kmath/structures/MutableBuffer;)I public fun hashCode ()I - public static fun hashCode-impl (Lkscience/kmath/structures/MutableBuffer;)I + public static fun hashCode-impl (Lspace/kscience/kmath/structures/MutableBuffer;)I public fun iterator ()Ljava/util/Iterator; - public static fun iterator-impl (Lkscience/kmath/structures/MutableBuffer;)Ljava/util/Iterator; + public static fun iterator-impl (Lspace/kscience/kmath/structures/MutableBuffer;)Ljava/util/Iterator; public fun toString ()Ljava/lang/String; - public static fun toString-impl (Lkscience/kmath/structures/MutableBuffer;)Ljava/lang/String; - public final synthetic fun unbox-impl ()Lkscience/kmath/structures/MutableBuffer; + public static fun toString-impl (Lspace/kscience/kmath/structures/MutableBuffer;)Ljava/lang/String; + public final synthetic fun unbox-impl ()Lspace/kscience/kmath/structures/MutableBuffer; } -public final class kscience/kmath/structures/RealBuffer : kscience/kmath/structures/MutableBuffer { - public static final synthetic fun box-impl ([D)Lkscience/kmath/structures/RealBuffer; +public final class space/kscience/kmath/structures/RealBuffer : space/kscience/kmath/structures/MutableBuffer { + public static final synthetic fun box-impl ([D)Lspace/kscience/kmath/structures/RealBuffer; public static fun constructor-impl ([D)[D - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl ([DLkscience/kmath/structures/Buffer;)Z - public synthetic fun copy ()Lkscience/kmath/structures/MutableBuffer; - public fun copy-H8_hoUg ()[D - public static fun copy-H8_hoUg ([D)[D + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl ([DLspace/kscience/kmath/structures/Buffer;)Z + public synthetic fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; + public fun copy-88GwAag ()[D + public static fun copy-88GwAag ([D)[D public fun equals (Ljava/lang/Object;)Z public static fun equals-impl ([DLjava/lang/Object;)Z public static final fun equals-impl0 ([D[D)Z @@ -2794,180 +2795,180 @@ public final class kscience/kmath/structures/RealBuffer : kscience/kmath/structu public final synthetic fun unbox-impl ()[D } -public final class kscience/kmath/structures/RealBufferField : kscience/kmath/operations/ExtendedField { +public final class space/kscience/kmath/structures/RealBufferField : space/kscience/kmath/operations/ExtendedField { public fun (I)V public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; - public fun acos-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun acos-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun acosh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun acosh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add-4n5bU9U (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)[D + public fun add-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; - public fun asin-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun asin-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun asinh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun asinh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; - public fun atan-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun atan-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun atanh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun atanh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; - public fun cos-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun cos-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun cosh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun cosh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Number;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun div (Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; - public fun div (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun div (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public fun div (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide-4n5bU9U (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)[D + public fun divide-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; - public fun exp-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun exp-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lkscience/kmath/structures/Buffer; + public fun getOne ()Lspace/kscience/kmath/structures/Buffer; public final fun getSize ()I public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lkscience/kmath/structures/Buffer; + public fun getZero ()Lspace/kscience/kmath/structures/Buffer; public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; - public fun ln-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun ln-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun minus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply-4n5bU9U (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)[D - public fun multiply-4n5bU9U (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)[D + public fun multiply-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)[D + public fun multiply-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number (Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun plus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun pow (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; + public fun pow (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun power-4n5bU9U (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)[D + public fun power-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)[D public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; - public fun sin-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun sin-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun sinh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun sinh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun sqrt (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/structures/Buffer; + public fun sqrt (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; - public fun tan-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun tan-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun tanh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun tanh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; - public fun times (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun times (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public fun times (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryPlus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; } -public final class kscience/kmath/structures/RealBufferFieldOperations : kscience/kmath/operations/ExtendedFieldOperations { - public static final field INSTANCE Lkscience/kmath/structures/RealBufferFieldOperations; +public final class space/kscience/kmath/structures/RealBufferFieldOperations : space/kscience/kmath/operations/ExtendedFieldOperations { + public static final field INSTANCE Lspace/kscience/kmath/structures/RealBufferFieldOperations; public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; - public fun acos-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun acos-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun acosh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun acosh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add-4n5bU9U (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)[D + public fun add-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; - public fun asin-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun asin-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun asinh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun asinh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; - public fun atan-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun atan-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun atanh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun atanh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; - public fun cos-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun cos-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun cosh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun cosh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; - public fun div (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun div (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public fun div (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide-4n5bU9U (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)[D + public fun divide-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; - public fun exp-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun exp-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; - public fun ln-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun ln-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun minus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply-4n5bU9U (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)[D - public fun multiply-4n5bU9U (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)[D + public fun multiply-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)[D + public fun multiply-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun plus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun pow (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; + public fun pow (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun power-4n5bU9U (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)[D + public fun power-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)[D public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; - public fun sin-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun sin-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun sinh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun sinh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun sqrt (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/structures/Buffer; + public fun sqrt (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; - public fun tan-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun tan-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun tanh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun tanh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; - public fun times (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun times (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public fun times (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryPlus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; } -public final class kscience/kmath/structures/RealBufferKt { +public final class space/kscience/kmath/structures/RealBufferKt { public static final fun RealBuffer (ILkotlin/jvm/functions/Function1;)[D public static final fun RealBuffer ([D)[D public static final fun asBuffer ([D)[D - public static final fun contentEquals-KRld2r8 ([D[D)Z - public static final fun getArray (Lkscience/kmath/structures/MutableBuffer;)[D + public static final fun contentEquals-2uVC2J0 ([D[D)Z + public static final fun getArray (Lspace/kscience/kmath/structures/MutableBuffer;)[D } -public final class kscience/kmath/structures/ShortBuffer : kscience/kmath/structures/MutableBuffer { - public static final synthetic fun box-impl ([S)Lkscience/kmath/structures/ShortBuffer; +public final class space/kscience/kmath/structures/ShortBuffer : space/kscience/kmath/structures/MutableBuffer { + public static final synthetic fun box-impl ([S)Lspace/kscience/kmath/structures/ShortBuffer; public static fun constructor-impl ([S)[S - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl ([SLkscience/kmath/structures/Buffer;)Z - public fun copy ()Lkscience/kmath/structures/MutableBuffer; - public static fun copy-impl ([S)Lkscience/kmath/structures/MutableBuffer; + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl ([SLspace/kscience/kmath/structures/Buffer;)Z + public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; + public static fun copy-impl ([S)Lspace/kscience/kmath/structures/MutableBuffer; public fun equals (Ljava/lang/Object;)Z public static fun equals-impl ([SLjava/lang/Object;)Z public static final fun equals-impl0 ([S[S)Z @@ -2990,26 +2991,26 @@ public final class kscience/kmath/structures/ShortBuffer : kscience/kmath/struct public final synthetic fun unbox-impl ()[S } -public final class kscience/kmath/structures/ShortBufferKt { +public final class space/kscience/kmath/structures/ShortBufferKt { public static final fun ShortBuffer (ILkotlin/jvm/functions/Function1;)[S public static final fun ShortBuffer ([S)[S public static final fun asBuffer ([S)[S - public static final fun getArray (Lkscience/kmath/structures/MutableBuffer;)[S + public static final fun getArray (Lspace/kscience/kmath/structures/MutableBuffer;)[S } -public final class kscience/kmath/structures/ValueFlag : java/lang/Enum { - public static final field MISSING Lkscience/kmath/structures/ValueFlag; - public static final field NAN Lkscience/kmath/structures/ValueFlag; - public static final field NEGATIVE_INFINITY Lkscience/kmath/structures/ValueFlag; - public static final field POSITIVE_INFINITY Lkscience/kmath/structures/ValueFlag; +public final class space/kscience/kmath/structures/ValueFlag : java/lang/Enum { + public static final field MISSING Lspace/kscience/kmath/structures/ValueFlag; + public static final field NAN Lspace/kscience/kmath/structures/ValueFlag; + public static final field NEGATIVE_INFINITY Lspace/kscience/kmath/structures/ValueFlag; + public static final field POSITIVE_INFINITY Lspace/kscience/kmath/structures/ValueFlag; public final fun getMask ()B - public static fun valueOf (Ljava/lang/String;)Lkscience/kmath/structures/ValueFlag; - public static fun values ()[Lkscience/kmath/structures/ValueFlag; + public static fun valueOf (Ljava/lang/String;)Lspace/kscience/kmath/structures/ValueFlag; + public static fun values ()[Lspace/kscience/kmath/structures/ValueFlag; } -public final class kscience/kmath/structures/VirtualBuffer : kscience/kmath/structures/Buffer { +public final class space/kscience/kmath/structures/VirtualBuffer : space/kscience/kmath/structures/Buffer { public fun (ILkotlin/jvm/functions/Function1;)V - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z public fun get (I)Ljava/lang/Object; public fun getSize ()I public fun iterator ()Ljava/util/Iterator; diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/domains/Domain.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/Domain.kt similarity index 82% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/domains/Domain.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/Domain.kt index 5c3cff2c5..edf19de55 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/domains/Domain.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/Domain.kt @@ -1,6 +1,6 @@ -package kscience.kmath.domains +package space.kscience.kmath.domains -import kscience.kmath.linear.Point +import space.kscience.kmath.linear.Point /** * A simple geometric domain. diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/domains/HyperSquareDomain.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/HyperSquareDomain.kt similarity index 91% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/domains/HyperSquareDomain.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/HyperSquareDomain.kt index b45cf6bf5..b086953fb 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/domains/HyperSquareDomain.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/HyperSquareDomain.kt @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package kscience.kmath.domains +package space.kscience.kmath.domains -import kscience.kmath.linear.Point -import kscience.kmath.structures.RealBuffer -import kscience.kmath.structures.indices +import space.kscience.kmath.linear.Point +import space.kscience.kmath.structures.RealBuffer +import space.kscience.kmath.structures.indices /** * diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/domains/RealDomain.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/RealDomain.kt similarity index 95% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/domains/RealDomain.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/RealDomain.kt index 369b093bb..13555dad9 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/domains/RealDomain.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/RealDomain.kt @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package kscience.kmath.domains +package space.kscience.kmath.domains -import kscience.kmath.linear.Point +import space.kscience.kmath.linear.Point /** * n-dimensional volume diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/domains/UnconstrainedDomain.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/UnconstrainedDomain.kt similarity index 94% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/domains/UnconstrainedDomain.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/UnconstrainedDomain.kt index e2efb51ab..f1bcc50ad 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/domains/UnconstrainedDomain.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/UnconstrainedDomain.kt @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package kscience.kmath.domains +package space.kscience.kmath.domains -import kscience.kmath.linear.Point +import space.kscience.kmath.linear.Point public class UnconstrainedDomain(public override val dimension: Int) : RealDomain { public override operator fun contains(point: Point): Boolean = true diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/domains/UnivariateDomain.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/UnivariateDomain.kt similarity index 91% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/domains/UnivariateDomain.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/UnivariateDomain.kt index bf090f2e5..36cd4afa7 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/domains/UnivariateDomain.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/UnivariateDomain.kt @@ -1,7 +1,7 @@ -package kscience.kmath.domains +package space.kscience.kmath.domains -import kscience.kmath.linear.Point -import kscience.kmath.structures.asBuffer +import space.kscience.kmath.linear.Point +import space.kscience.kmath.structures.asBuffer public inline class UnivariateDomain(public val range: ClosedFloatingPointRange) : RealDomain { public override val dimension: Int diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/expressions/DifferentiableExpression.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/DifferentiableExpression.kt similarity index 97% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/expressions/DifferentiableExpression.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/DifferentiableExpression.kt index abce9c4ec..508a62aca 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/expressions/DifferentiableExpression.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/DifferentiableExpression.kt @@ -1,4 +1,4 @@ -package kscience.kmath.expressions +package space.kscience.kmath.expressions /** * Represents expression which structure can be differentiated. diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/expressions/Expression.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/Expression.kt similarity index 84% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/expressions/Expression.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/Expression.kt index 19f4eeffd..231bbdab1 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/expressions/Expression.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/Expression.kt @@ -1,6 +1,6 @@ -package kscience.kmath.expressions +package space.kscience.kmath.expressions -import kscience.kmath.operations.Algebra +import space.kscience.kmath.operations.Algebra import kotlin.jvm.JvmName import kotlin.properties.ReadOnlyProperty @@ -73,12 +73,12 @@ public interface ExpressionAlgebra : Algebra { /** * Bind a given [Symbol] to this context variable and produce context-specific object. Return null if symbol could not be bound in current context. */ - public fun bindOrNull(symbol: Symbol): E? + public fun bindSymbolOrNull(symbol: Symbol): E? /** * Bind a string to a context using [StringSymbol] */ - override fun symbol(value: String): E = bind(StringSymbol(value)) + override fun bindSymbol(value: String): E = bindSymbol(StringSymbol(value)) /** * A constant expression which does not depend on arguments @@ -89,8 +89,8 @@ public interface ExpressionAlgebra : Algebra { /** * Bind a given [Symbol] to this context variable and produce context-specific object. */ -public fun ExpressionAlgebra.bind(symbol: Symbol): E = - bindOrNull(symbol) ?: error("Symbol $symbol could not be bound to $this") +public fun ExpressionAlgebra.bindSymbol(symbol: Symbol): E = + bindSymbolOrNull(symbol) ?: error("Symbol $symbol could not be bound to $this") /** * A delegate to create a symbol with a string identity in this scope @@ -103,5 +103,5 @@ public val symbol: ReadOnlyProperty = ReadOnlyProperty { _, prope * Bind a symbol by name inside the [ExpressionAlgebra] */ public fun ExpressionAlgebra.binding(): ReadOnlyProperty = ReadOnlyProperty { _, property -> - bind(StringSymbol(property.name)) ?: error("A variable with name ${property.name} does not exist") + bindSymbol(StringSymbol(property.name)) ?: error("A variable with name ${property.name} does not exist") } diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/expressions/FunctionalExpressionAlgebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/FunctionalExpressionAlgebra.kt similarity index 97% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/expressions/FunctionalExpressionAlgebra.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/FunctionalExpressionAlgebra.kt index 1a3668855..5177bc868 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/expressions/FunctionalExpressionAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/FunctionalExpressionAlgebra.kt @@ -1,6 +1,6 @@ -package kscience.kmath.expressions +package space.kscience.kmath.expressions -import kscience.kmath.operations.* +import space.kscience.kmath.operations.* /** * A context class for [Expression] construction. @@ -18,7 +18,7 @@ public abstract class FunctionalExpressionAlgebra>( /** * Builds an Expression to access a variable. */ - public override fun bindOrNull(symbol: Symbol): Expression? = Expression { arguments -> + public override fun bindSymbolOrNull(symbol: Symbol): Expression? = Expression { arguments -> arguments[symbol] ?: error("Argument not found: $symbol") } diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/expressions/SimpleAutoDiff.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SimpleAutoDiff.kt similarity index 97% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/expressions/SimpleAutoDiff.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SimpleAutoDiff.kt index 0621e82bd..c710ba679 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/expressions/SimpleAutoDiff.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SimpleAutoDiff.kt @@ -1,9 +1,9 @@ -package kscience.kmath.expressions +package space.kscience.kmath.expressions -import kscience.kmath.linear.Point -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.operations.* -import kscience.kmath.structures.asBuffer +import space.kscience.kmath.linear.Point +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.operations.* +import space.kscience.kmath.structures.asBuffer import kotlin.contracts.InvocationKind import kotlin.contracts.contract @@ -117,7 +117,7 @@ public open class SimpleAutoDiffField>( override fun hashCode(): Int = identity.hashCode() } - public override fun bindOrNull(symbol: Symbol): AutoDiffValue? = bindings[symbol.identity] + public override fun bindSymbolOrNull(symbol: Symbol): AutoDiffValue? = bindings[symbol.identity] private fun getDerivative(variable: AutoDiffValue): T = (variable as? AutoDiffVariableWithDerivative)?.d ?: derivatives[variable] ?: context.zero diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/expressions/SymbolIndexer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SymbolIndexer.kt similarity index 89% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/expressions/SymbolIndexer.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SymbolIndexer.kt index fd0661080..580acaafb 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/expressions/SymbolIndexer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SymbolIndexer.kt @@ -1,12 +1,12 @@ -package kscience.kmath.expressions +package space.kscience.kmath.expressions -import kscience.kmath.linear.Point -import kscience.kmath.nd.Structure2D -import kscience.kmath.structures.BufferFactory +import space.kscience.kmath.linear.Point +import space.kscience.kmath.nd.Structure2D +import space.kscience.kmath.structures.BufferFactory /** * An environment to easy transform indexed variables to symbols and back. - * TODO requires multi-receivers to be beutiful + * TODO requires multi-receivers to be beautiful */ public interface SymbolIndexer { public val symbols: List diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/expressions/expressionBuilders.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/expressionBuilders.kt similarity index 85% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/expressions/expressionBuilders.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/expressionBuilders.kt index 1603bc21d..0ef6803d6 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/expressions/expressionBuilders.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/expressionBuilders.kt @@ -1,9 +1,9 @@ -package kscience.kmath.expressions +package space.kscience.kmath.expressions -import kscience.kmath.operations.ExtendedField -import kscience.kmath.operations.Field -import kscience.kmath.operations.Ring -import kscience.kmath.operations.Space +import space.kscience.kmath.operations.ExtendedField +import space.kscience.kmath.operations.Field +import space.kscience.kmath.operations.Ring +import space.kscience.kmath.operations.Space import kotlin.contracts.InvocationKind import kotlin.contracts.contract diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/BufferMatrix.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferMatrix.kt similarity index 92% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/linear/BufferMatrix.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferMatrix.kt index 6a66e91c8..63f6f77cd 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/BufferMatrix.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferMatrix.kt @@ -1,12 +1,12 @@ -package kscience.kmath.linear +package space.kscience.kmath.linear -import kscience.kmath.nd.NDStructure -import kscience.kmath.nd.Structure2D -import kscience.kmath.operations.Ring -import kscience.kmath.operations.invoke -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.BufferFactory -import kscience.kmath.structures.asSequence +import space.kscience.kmath.nd.NDStructure +import space.kscience.kmath.nd.Structure2D +import space.kscience.kmath.operations.Ring +import space.kscience.kmath.operations.invoke +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.BufferFactory +import space.kscience.kmath.structures.asSequence /** * Alias for [Structure2D] with more familiar name. diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/LinearAlgebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearAlgebra.kt similarity index 84% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/linear/LinearAlgebra.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearAlgebra.kt index d9201d0f1..ea871ccba 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/LinearAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearAlgebra.kt @@ -1,7 +1,7 @@ -package kscience.kmath.linear +package space.kscience.kmath.linear -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.VirtualBuffer +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.VirtualBuffer public typealias Point = Buffer diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/LupDecomposition.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LupDecomposition.kt similarity index 95% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/linear/LupDecomposition.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LupDecomposition.kt index 7c7422c94..a3d4cbc47 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/LupDecomposition.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LupDecomposition.kt @@ -1,9 +1,12 @@ -package kscience.kmath.linear +package space.kscience.kmath.linear -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.nd.getFeature -import kscience.kmath.operations.* -import kscience.kmath.structures.* +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.nd.getFeature +import space.kscience.kmath.operations.* +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.BufferAccessor2D +import space.kscience.kmath.structures.MutableBuffer +import space.kscience.kmath.structures.MutableBufferFactory /** * Common implementation of [LupDecompositionFeature]. diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixBuilder.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixBuilder.kt similarity index 86% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixBuilder.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixBuilder.kt index cb01939cc..c96834360 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixBuilder.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixBuilder.kt @@ -1,9 +1,9 @@ -package kscience.kmath.linear +package space.kscience.kmath.linear -import kscience.kmath.nd.Structure2D -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.BufferFactory -import kscience.kmath.structures.asBuffer +import space.kscience.kmath.nd.Structure2D +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.BufferFactory +import space.kscience.kmath.structures.asBuffer public class MatrixBuilder(public val rows: Int, public val columns: Int) { public operator fun invoke(vararg elements: T): Matrix { diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixContext.kt similarity index 92% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixContext.kt index 234435b29..957c111f3 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixContext.kt @@ -1,12 +1,12 @@ -package kscience.kmath.linear +package space.kscience.kmath.linear -import kscience.kmath.operations.Ring -import kscience.kmath.operations.SpaceOperations -import kscience.kmath.operations.invoke -import kscience.kmath.operations.sum -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.BufferFactory -import kscience.kmath.structures.asSequence +import space.kscience.kmath.operations.Ring +import space.kscience.kmath.operations.SpaceOperations +import space.kscience.kmath.operations.invoke +import space.kscience.kmath.operations.sum +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.BufferFactory +import space.kscience.kmath.structures.asSequence /** * Basic operations on matrices. Operates on [Matrix]. diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixFeatures.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixFeatures.kt similarity index 99% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixFeatures.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixFeatures.kt index 196c46623..6b97e89ef 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixFeatures.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixFeatures.kt @@ -1,4 +1,4 @@ -package kscience.kmath.linear +package space.kscience.kmath.linear /** * A marker interface representing some properties of matrices or additional transformations of them. Features are used diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixWrapper.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixWrapper.kt similarity index 92% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixWrapper.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixWrapper.kt index df967e3c1..86ec0de88 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixWrapper.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixWrapper.kt @@ -1,10 +1,10 @@ -package kscience.kmath.linear +package space.kscience.kmath.linear -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.nd.Structure2D -import kscience.kmath.nd.getFeature -import kscience.kmath.operations.Ring -import kscience.kmath.structures.asBuffer +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.nd.Structure2D +import space.kscience.kmath.nd.getFeature +import space.kscience.kmath.operations.Ring +import space.kscience.kmath.structures.asBuffer import kotlin.math.sqrt import kotlin.reflect.KClass import kotlin.reflect.safeCast diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/RealMatrixContext.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealMatrixContext.kt similarity index 97% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/linear/RealMatrixContext.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealMatrixContext.kt index da795f56b..5f28e6f4c 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/RealMatrixContext.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealMatrixContext.kt @@ -1,6 +1,6 @@ -package kscience.kmath.linear +package space.kscience.kmath.linear -import kscience.kmath.structures.RealBuffer +import space.kscience.kmath.structures.RealBuffer public object RealMatrixContext : MatrixContext> { diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/VectorSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VectorSpace.kt similarity index 88% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/linear/VectorSpace.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VectorSpace.kt index 2a3b8f5d1..310c1350c 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/VectorSpace.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VectorSpace.kt @@ -1,10 +1,10 @@ -package kscience.kmath.linear +package space.kscience.kmath.linear -import kscience.kmath.operations.RealField -import kscience.kmath.operations.Space -import kscience.kmath.operations.invoke -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.BufferFactory +import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.Space +import space.kscience.kmath.operations.invoke +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.BufferFactory /** * A linear space for vectors. diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/VirtualMatrix.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VirtualMatrix.kt similarity index 96% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/linear/VirtualMatrix.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VirtualMatrix.kt index c96e55be6..26b1899a1 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/linear/VirtualMatrix.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VirtualMatrix.kt @@ -1,4 +1,4 @@ -package kscience.kmath.linear +package space.kscience.kmath.linear /** * The matrix where each element is evaluated each time when is being accessed. diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/misc/annotations.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/annotations.kt similarity index 80% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/misc/annotations.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/annotations.kt index 06248a166..7fd7b433d 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/misc/annotations.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/annotations.kt @@ -1,4 +1,4 @@ -package kscience.kmath.misc +package space.kscience.kmath.misc @RequiresOptIn("This API is unstable and could change in future", RequiresOptIn.Level.WARNING) public annotation class UnstableKMathAPI diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/misc/cumulative.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/cumulative.kt similarity index 95% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/misc/cumulative.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/cumulative.kt index 72d2f2388..380723095 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/misc/cumulative.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/cumulative.kt @@ -1,7 +1,7 @@ -package kscience.kmath.misc +package space.kscience.kmath.misc -import kscience.kmath.operations.Space -import kscience.kmath.operations.invoke +import space.kscience.kmath.operations.Space +import space.kscience.kmath.operations.invoke import kotlin.jvm.JvmName /** diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/nd/BufferNDAlgebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferNDAlgebra.kt similarity index 93% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/nd/BufferNDAlgebra.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferNDAlgebra.kt index 2d72162a6..71c7d444c 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/nd/BufferNDAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferNDAlgebra.kt @@ -1,9 +1,11 @@ -package kscience.kmath.nd +package space.kscience.kmath.nd -import kscience.kmath.nd.* -import kscience.kmath.operations.* -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.BufferFactory +import space.kscience.kmath.operations.Field +import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.Ring +import space.kscience.kmath.operations.Space +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.BufferFactory import kotlin.contracts.InvocationKind import kotlin.contracts.contract diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/nd/NDAlgebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDAlgebra.kt similarity index 97% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/nd/NDAlgebra.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDAlgebra.kt index 749fb1a13..af154d3cd 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/nd/NDAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDAlgebra.kt @@ -1,9 +1,9 @@ -package kscience.kmath.nd +package space.kscience.kmath.nd -import kscience.kmath.operations.Field -import kscience.kmath.operations.Ring -import kscience.kmath.operations.Space -import kscience.kmath.structures.* +import space.kscience.kmath.operations.Field +import space.kscience.kmath.operations.Ring +import space.kscience.kmath.operations.Space +import space.kscience.kmath.structures.* /** * An exception is thrown when the expected ans actual shape of NDArray differs. diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/nd/NDStructure.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDStructure.kt similarity index 97% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/nd/NDStructure.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDStructure.kt index 4aa1c7d52..09096fcc7 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/nd/NDStructure.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDStructure.kt @@ -1,10 +1,10 @@ -package kscience.kmath.nd +package space.kscience.kmath.nd -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.BufferFactory -import kscience.kmath.structures.MutableBuffer -import kscience.kmath.structures.asSequence +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.BufferFactory +import space.kscience.kmath.structures.MutableBuffer +import space.kscience.kmath.structures.asSequence import kotlin.jvm.JvmName import kotlin.native.concurrent.ThreadLocal import kotlin.reflect.KClass diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/nd/RealNDField.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/RealNDField.kt similarity index 92% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/nd/RealNDField.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/RealNDField.kt index 8e0f9e171..73ba337ae 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/nd/RealNDField.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/RealNDField.kt @@ -1,11 +1,11 @@ -package kscience.kmath.nd +package space.kscience.kmath.nd -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.operations.ExtendedField -import kscience.kmath.operations.RealField -import kscience.kmath.operations.RingWithNumbers -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.RealBuffer +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.operations.ExtendedField +import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.RingWithNumbers +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.RealBuffer import kotlin.contracts.InvocationKind import kotlin.contracts.contract diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/nd/ShortNDRing.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/ShortNDRing.kt similarity index 79% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/nd/ShortNDRing.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/ShortNDRing.kt index 7ffe688cb..30960a090 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/nd/ShortNDRing.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/ShortNDRing.kt @@ -1,10 +1,10 @@ -package kscience.kmath.nd +package space.kscience.kmath.nd -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.operations.RingWithNumbers -import kscience.kmath.operations.ShortRing -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.ShortBuffer +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.operations.RingWithNumbers +import space.kscience.kmath.operations.ShortRing +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.ShortBuffer import kotlin.contracts.InvocationKind import kotlin.contracts.contract diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/nd/Structure1D.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt similarity index 93% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/nd/Structure1D.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt index d69c23fb4..e83485ff0 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/nd/Structure1D.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt @@ -1,7 +1,7 @@ -package kscience.kmath.nd +package space.kscience.kmath.nd -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.asSequence +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.asSequence /** * A structure that is guaranteed to be one-dimensional diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/nd/Structure2D.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt similarity index 91% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/nd/Structure2D.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt index e2694309a..fcc8c0d7e 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/nd/Structure2D.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt @@ -1,9 +1,9 @@ -package kscience.kmath.nd +package space.kscience.kmath.nd -import kscience.kmath.linear.BufferMatrix -import kscience.kmath.linear.RealMatrixContext -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.VirtualBuffer +import space.kscience.kmath.linear.BufferMatrix +import space.kscience.kmath.linear.RealMatrixContext +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.VirtualBuffer /** * A structure that is guaranteed to be two-dimensional. diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt similarity index 97% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt index 14006ea10..201e39314 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt @@ -1,4 +1,6 @@ -package kscience.kmath.operations +package space.kscience.kmath.operations + +import space.kscience.kmath.expressions.Symbol /** * Stub for DSL the [Algebra] is. @@ -24,7 +26,7 @@ public interface Algebra { * @param value the raw string. * @return an object. */ - public fun symbol(value: String): T = error("Wrapping of '$value' is not supported in $this") + public fun bindSymbol(value: String): T = error("Wrapping of '$value' is not supported in $this") /** * Dynamically dispatches an unary operation with the certain name. @@ -88,6 +90,8 @@ public interface Algebra { public fun binaryOperation(operation: String, left: T, right: T): T = binaryOperationFunction(operation)(left, right) } +public fun Algebra.bindSymbol(symbol: Symbol): T = bindSymbol(symbol.identity) + /** * Call a block with an [Algebra] as receiver. */ diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/AlgebraElements.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/AlgebraElements.kt similarity index 95% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/operations/AlgebraElements.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/AlgebraElements.kt index eb55678b9..629c4de1b 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/AlgebraElements.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/AlgebraElements.kt @@ -1,6 +1,6 @@ -package kscience.kmath.operations +package space.kscience.kmath.operations -import kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.misc.UnstableKMathAPI /** * The generic mathematics elements which is able to store its context diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/BigInt.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/BigInt.kt similarity index 97% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/operations/BigInt.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/BigInt.kt index e0bf817ef..fd365042b 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/BigInt.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/BigInt.kt @@ -1,12 +1,12 @@ -package kscience.kmath.operations +package space.kscience.kmath.operations -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.nd.BufferedNDRing -import kscience.kmath.nd.NDAlgebra -import kscience.kmath.operations.BigInt.Companion.BASE -import kscience.kmath.operations.BigInt.Companion.BASE_SIZE -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.MutableBuffer +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.nd.BufferedNDRing +import space.kscience.kmath.nd.NDAlgebra +import space.kscience.kmath.operations.BigInt.Companion.BASE +import space.kscience.kmath.operations.BigInt.Companion.BASE_SIZE +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.MutableBuffer import kotlin.math.log2 import kotlin.math.max import kotlin.math.min diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/NumericAlgebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/NumericAlgebra.kt similarity index 98% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/operations/NumericAlgebra.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/NumericAlgebra.kt index 26f93fae8..81f4c1fdf 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/NumericAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/NumericAlgebra.kt @@ -1,6 +1,6 @@ -package kscience.kmath.operations +package space.kscience.kmath.operations -import kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.misc.UnstableKMathAPI /** * An algebraic structure where elements can have numeric representation. diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/OptionalOperations.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/OptionalOperations.kt similarity index 98% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/operations/OptionalOperations.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/OptionalOperations.kt index 3d809e6a5..6cb329695 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/OptionalOperations.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/OptionalOperations.kt @@ -1,6 +1,6 @@ -package kscience.kmath.operations +package space.kscience.kmath.operations -import kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.misc.UnstableKMathAPI /** * A container for trigonometric operations for specific type. diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/algebraExtensions.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/algebraExtensions.kt similarity index 98% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/operations/algebraExtensions.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/algebraExtensions.kt index 4527a2a42..ae1267d2b 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/algebraExtensions.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/algebraExtensions.kt @@ -1,4 +1,4 @@ -package kscience.kmath.operations +package space.kscience.kmath.operations /** * Returns the sum of all elements in the iterable in this [Space]. diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/numbers.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/numbers.kt similarity index 99% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/operations/numbers.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/numbers.kt index a5c4cfff9..aa62715d1 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/numbers.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/numbers.kt @@ -1,4 +1,4 @@ -package kscience.kmath.operations +package space.kscience.kmath.operations import kotlin.math.pow as kpow diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/Buffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt similarity index 99% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/structures/Buffer.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt index be48055c7..648d441a8 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/Buffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt @@ -1,4 +1,4 @@ -package kscience.kmath.structures +package space.kscience.kmath.structures import kotlin.reflect.KClass diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/BufferAccessor2D.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/BufferAccessor2D.kt similarity index 88% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/structures/BufferAccessor2D.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/BufferAccessor2D.kt index 3c53d6c51..fd440a344 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/BufferAccessor2D.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/BufferAccessor2D.kt @@ -1,9 +1,9 @@ -package kscience.kmath.structures +package space.kscience.kmath.structures -import kscience.kmath.nd.DefaultStrides -import kscience.kmath.nd.NDStructure -import kscience.kmath.nd.Structure2D -import kscience.kmath.nd.as2D +import space.kscience.kmath.nd.DefaultStrides +import space.kscience.kmath.nd.NDStructure +import space.kscience.kmath.nd.Structure2D +import space.kscience.kmath.nd.as2D /** * A context that allows to operate on a [MutableBuffer] as on 2d array diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/FlaggedBuffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/FlaggedBuffer.kt similarity index 98% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/structures/FlaggedBuffer.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/FlaggedBuffer.kt index 4965e37cf..3326c1491 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/FlaggedBuffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/FlaggedBuffer.kt @@ -1,4 +1,4 @@ -package kscience.kmath.structures +package space.kscience.kmath.structures import kotlin.experimental.and diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/FloatBuffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/FloatBuffer.kt similarity index 97% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/structures/FloatBuffer.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/FloatBuffer.kt index e96c45572..3839be8e1 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/FloatBuffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/FloatBuffer.kt @@ -1,4 +1,4 @@ -package kscience.kmath.structures +package space.kscience.kmath.structures /** * Specialized [MutableBuffer] implementation over [FloatArray]. diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/IntBuffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/IntBuffer.kt similarity index 97% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/structures/IntBuffer.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/IntBuffer.kt index 0fe68803b..df3289a3e 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/IntBuffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/IntBuffer.kt @@ -1,4 +1,4 @@ -package kscience.kmath.structures +package space.kscience.kmath.structures /** * Specialized [MutableBuffer] implementation over [IntArray]. diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/LongBuffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/LongBuffer.kt similarity index 97% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/structures/LongBuffer.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/LongBuffer.kt index 87853c251..d07d44799 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/LongBuffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/LongBuffer.kt @@ -1,4 +1,4 @@ -package kscience.kmath.structures +package space.kscience.kmath.structures /** * Specialized [MutableBuffer] implementation over [LongArray]. diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/MemoryBuffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/MemoryBuffer.kt similarity index 96% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/structures/MemoryBuffer.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/MemoryBuffer.kt index 3a98ce941..418adb537 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/MemoryBuffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/MemoryBuffer.kt @@ -1,6 +1,6 @@ -package kscience.kmath.structures +package space.kscience.kmath.structures -import kscience.kmath.memory.* +import space.kscience.kmath.memory.* /** * A non-boxing buffer over [Memory] object. diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/RealBuffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBuffer.kt similarity index 97% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/structures/RealBuffer.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBuffer.kt index 769c445d6..b06efb3fc 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/RealBuffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBuffer.kt @@ -1,4 +1,4 @@ -package kscience.kmath.structures +package space.kscience.kmath.structures /** * Specialized [MutableBuffer] implementation over [DoubleArray]. diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/RealBufferField.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBufferField.kt similarity index 98% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/structures/RealBufferField.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBufferField.kt index 3f4d15c4d..7351881ee 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/RealBufferField.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBufferField.kt @@ -1,7 +1,7 @@ -package kscience.kmath.structures +package space.kscience.kmath.structures -import kscience.kmath.operations.ExtendedField -import kscience.kmath.operations.ExtendedFieldOperations +import space.kscience.kmath.operations.ExtendedField +import space.kscience.kmath.operations.ExtendedFieldOperations import kotlin.math.* /** diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/ShortBuffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/ShortBuffer.kt similarity index 97% rename from kmath-core/src/commonMain/kotlin/kscience/kmath/structures/ShortBuffer.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/ShortBuffer.kt index 0d9222320..afc472b72 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/structures/ShortBuffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/ShortBuffer.kt @@ -1,4 +1,4 @@ -package kscience.kmath.structures +package space.kscience.kmath.structures /** * Specialized [MutableBuffer] implementation over [ShortArray]. diff --git a/kmath-core/src/commonTest/kotlin/kscience/kmath/expressions/ExpressionFieldTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/ExpressionFieldTest.kt similarity index 89% rename from kmath-core/src/commonTest/kotlin/kscience/kmath/expressions/ExpressionFieldTest.kt rename to kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/ExpressionFieldTest.kt index 0d31c8691..c13850193 100644 --- a/kmath-core/src/commonTest/kotlin/kscience/kmath/expressions/ExpressionFieldTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/ExpressionFieldTest.kt @@ -1,7 +1,7 @@ -package kscience.kmath.expressions +package space.kscience.kmath.expressions -import kscience.kmath.operations.RealField -import kscience.kmath.operations.invoke +import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.invoke import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFails diff --git a/kmath-core/src/commonTest/kotlin/kscience/kmath/expressions/SimpleAutoDiffTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/SimpleAutoDiffTest.kt similarity index 95% rename from kmath-core/src/commonTest/kotlin/kscience/kmath/expressions/SimpleAutoDiffTest.kt rename to kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/SimpleAutoDiffTest.kt index 510ed23a9..ee7fffa4c 100644 --- a/kmath-core/src/commonTest/kotlin/kscience/kmath/expressions/SimpleAutoDiffTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/SimpleAutoDiffTest.kt @@ -1,7 +1,7 @@ -package kscience.kmath.expressions +package space.kscience.kmath.expressions -import kscience.kmath.operations.RealField -import kscience.kmath.structures.asBuffer +import space.kscience.kmath.operations.RealField +import space.kscience.kmath.structures.asBuffer import kotlin.math.E import kotlin.math.PI import kotlin.math.pow @@ -15,14 +15,14 @@ class SimpleAutoDiffTest { fun dx( xBinding: Pair, body: SimpleAutoDiffField.(x: AutoDiffValue) -> AutoDiffValue, - ): DerivationResult = RealField.simpleAutoDiff(xBinding) { body(bind(xBinding.first)) } + ): DerivationResult = RealField.simpleAutoDiff(xBinding) { body(bindSymbol(xBinding.first)) } fun dxy( xBinding: Pair, yBinding: Pair, body: SimpleAutoDiffField.(x: AutoDiffValue, y: AutoDiffValue) -> AutoDiffValue, ): DerivationResult = RealField.simpleAutoDiff(xBinding, yBinding) { - body(bind(xBinding.first), bind(yBinding.first)) + body(bindSymbol(xBinding.first), bindSymbol(yBinding.first)) } fun diff(block: SimpleAutoDiffField.() -> AutoDiffValue): SimpleAutoDiffExpression { @@ -37,7 +37,7 @@ class SimpleAutoDiffTest { fun testPlusX2() { val y = RealField.simpleAutoDiff(x to 3.0) { // diff w.r.t this x at 3 - val x = bind(x) + val x = bindSymbol(x) x + x } assertEquals(6.0, y.value) // y = x + x = 6 @@ -47,7 +47,7 @@ class SimpleAutoDiffTest { @Test fun testPlusX2Expr() { val expr = diff { - val x = bind(x) + val x = bindSymbol(x) x + x } assertEquals(6.0, expr(x to 3.0)) // y = x + x = 6 @@ -59,8 +59,8 @@ class SimpleAutoDiffTest { fun testPlus() { // two variables val z = RealField.simpleAutoDiff(x to 2.0, y to 3.0) { - val x = bind(x) - val y = bind(y) + val x = bindSymbol(x) + val y = bindSymbol(y) x + y } assertEquals(5.0, z.value) // z = x + y = 5 @@ -72,8 +72,8 @@ class SimpleAutoDiffTest { fun testMinus() { // two variables val z = RealField.simpleAutoDiff(x to 7.0, y to 3.0) { - val x = bind(x) - val y = bind(y) + val x = bindSymbol(x) + val y = bindSymbol(y) x - y } diff --git a/kmath-core/src/commonTest/kotlin/kscience/kmath/linear/MatrixTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt similarity index 91% rename from kmath-core/src/commonTest/kotlin/kscience/kmath/linear/MatrixTest.kt rename to kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt index a0ac92172..75967f024 100644 --- a/kmath-core/src/commonTest/kotlin/kscience/kmath/linear/MatrixTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt @@ -1,8 +1,8 @@ -package kscience.kmath.linear +package space.kscience.kmath.linear -import kscience.kmath.nd.NDStructure -import kscience.kmath.nd.as2D -import kscience.kmath.operations.invoke +import space.kscience.kmath.nd.NDStructure +import space.kscience.kmath.nd.as2D +import space.kscience.kmath.operations.invoke import kotlin.test.Test import kotlin.test.assertEquals diff --git a/kmath-core/src/commonTest/kotlin/kscience/kmath/linear/RealLUSolverTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt similarity index 96% rename from kmath-core/src/commonTest/kotlin/kscience/kmath/linear/RealLUSolverTest.kt rename to kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt index b22da96dd..f1289801a 100644 --- a/kmath-core/src/commonTest/kotlin/kscience/kmath/linear/RealLUSolverTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt @@ -1,4 +1,4 @@ -package kscience.kmath.linear +package space.kscience.kmath.linear import kotlin.test.Test import kotlin.test.assertEquals diff --git a/kmath-core/src/commonTest/kotlin/kscience/kmath/linear/VectorSpaceTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/VectorSpaceTest.kt similarity index 100% rename from kmath-core/src/commonTest/kotlin/kscience/kmath/linear/VectorSpaceTest.kt rename to kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/VectorSpaceTest.kt diff --git a/kmath-core/src/commonTest/kotlin/kscience/kmath/misc/CumulativeKtTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/misc/CumulativeKtTest.kt similarity index 89% rename from kmath-core/src/commonTest/kotlin/kscience/kmath/misc/CumulativeKtTest.kt rename to kmath-core/src/commonTest/kotlin/space/kscience/kmath/misc/CumulativeKtTest.kt index 1e6d2fd5d..dfdd3e18e 100644 --- a/kmath-core/src/commonTest/kotlin/kscience/kmath/misc/CumulativeKtTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/misc/CumulativeKtTest.kt @@ -1,4 +1,4 @@ -package kscience.kmath.misc +package space.kscience.kmath.misc import kotlin.test.Test import kotlin.test.assertEquals diff --git a/kmath-core/src/commonTest/kotlin/kscience/kmath/operations/BigIntAlgebraTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/operations/BigIntAlgebraTest.kt similarity index 94% rename from kmath-core/src/commonTest/kotlin/kscience/kmath/operations/BigIntAlgebraTest.kt rename to kmath-core/src/commonTest/kotlin/space/kscience/kmath/operations/BigIntAlgebraTest.kt index f81bd7e67..93237c7eb 100644 --- a/kmath-core/src/commonTest/kotlin/kscience/kmath/operations/BigIntAlgebraTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/operations/BigIntAlgebraTest.kt @@ -1,6 +1,6 @@ -package kscience.kmath.operations +package space.kscience.kmath.operations -import kscience.kmath.testutils.RingVerifier +import space.kscience.kmath.testutils.RingVerifier import kotlin.test.Test import kotlin.test.assertEquals diff --git a/kmath-core/src/commonTest/kotlin/kscience/kmath/operations/BigIntConstructorTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/operations/BigIntConstructorTest.kt similarity index 93% rename from kmath-core/src/commonTest/kotlin/kscience/kmath/operations/BigIntConstructorTest.kt rename to kmath-core/src/commonTest/kotlin/space/kscience/kmath/operations/BigIntConstructorTest.kt index ba2582bbf..59fd7e383 100644 --- a/kmath-core/src/commonTest/kotlin/kscience/kmath/operations/BigIntConstructorTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/operations/BigIntConstructorTest.kt @@ -1,4 +1,4 @@ -package kscience.kmath.operations +package space.kscience.kmath.operations import kotlin.test.Test import kotlin.test.assertEquals diff --git a/kmath-core/src/commonTest/kotlin/kscience/kmath/operations/BigIntConversionsTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/operations/BigIntConversionsTest.kt similarity index 96% rename from kmath-core/src/commonTest/kotlin/kscience/kmath/operations/BigIntConversionsTest.kt rename to kmath-core/src/commonTest/kotlin/space/kscience/kmath/operations/BigIntConversionsTest.kt index 0b433c436..ce599e1d1 100644 --- a/kmath-core/src/commonTest/kotlin/kscience/kmath/operations/BigIntConversionsTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/operations/BigIntConversionsTest.kt @@ -1,4 +1,4 @@ -package kscience.kmath.operations +package space.kscience.kmath.operations import kotlin.test.Test import kotlin.test.assertEquals diff --git a/kmath-core/src/commonTest/kotlin/kscience/kmath/operations/BigIntOperationsTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/operations/BigIntOperationsTest.kt similarity index 99% rename from kmath-core/src/commonTest/kotlin/kscience/kmath/operations/BigIntOperationsTest.kt rename to kmath-core/src/commonTest/kotlin/space/kscience/kmath/operations/BigIntOperationsTest.kt index a3ed85c7b..26e0c1d98 100644 --- a/kmath-core/src/commonTest/kotlin/kscience/kmath/operations/BigIntOperationsTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/operations/BigIntOperationsTest.kt @@ -1,4 +1,4 @@ -package kscience.kmath.operations +package space.kscience.kmath.operations import kotlin.test.Test import kotlin.test.assertEquals diff --git a/kmath-core/src/commonTest/kotlin/kscience/kmath/operations/RealFieldTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/operations/RealFieldTest.kt similarity index 76% rename from kmath-core/src/commonTest/kotlin/kscience/kmath/operations/RealFieldTest.kt rename to kmath-core/src/commonTest/kotlin/space/kscience/kmath/operations/RealFieldTest.kt index 93f72413e..bba612d12 100644 --- a/kmath-core/src/commonTest/kotlin/kscience/kmath/operations/RealFieldTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/operations/RealFieldTest.kt @@ -1,6 +1,6 @@ -package kscience.kmath.operations +package space.kscience.kmath.operations -import kscience.kmath.testutils.FieldVerifier +import space.kscience.kmath.testutils.FieldVerifier import kotlin.test.Test import kotlin.test.assertEquals diff --git a/kmath-core/src/commonTest/kotlin/kscience/kmath/structures/NDFieldTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/structures/NDFieldTest.kt similarity index 60% rename from kmath-core/src/commonTest/kotlin/kscience/kmath/structures/NDFieldTest.kt rename to kmath-core/src/commonTest/kotlin/space/kscience/kmath/structures/NDFieldTest.kt index 1c0d5a555..3c84d7b4b 100644 --- a/kmath-core/src/commonTest/kotlin/kscience/kmath/structures/NDFieldTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/structures/NDFieldTest.kt @@ -1,12 +1,12 @@ -package kscience.kmath.structures +package space.kscience.kmath.structures -import kscience.kmath.nd.NDAlgebra -import kscience.kmath.nd.get -import kscience.kmath.nd.real -import kscience.kmath.testutils.FieldVerifier +import space.kscience.kmath.nd.NDAlgebra +import space.kscience.kmath.nd.get +import space.kscience.kmath.nd.real +import space.kscience.kmath.operations.invoke +import space.kscience.kmath.testutils.FieldVerifier import kotlin.test.Test import kotlin.test.assertEquals -import kscience.kmath.operations.invoke internal class NDFieldTest { @Test diff --git a/kmath-core/src/commonTest/kotlin/kscience/kmath/structures/NumberNDFieldTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/structures/NumberNDFieldTest.kt similarity index 92% rename from kmath-core/src/commonTest/kotlin/kscience/kmath/structures/NumberNDFieldTest.kt rename to kmath-core/src/commonTest/kotlin/space/kscience/kmath/structures/NumberNDFieldTest.kt index 4f0c9fc6d..23b0e7348 100644 --- a/kmath-core/src/commonTest/kotlin/kscience/kmath/structures/NumberNDFieldTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/structures/NumberNDFieldTest.kt @@ -1,8 +1,8 @@ -package kscience.kmath.structures +package space.kscience.kmath.structures -import kscience.kmath.nd.* -import kscience.kmath.operations.Norm -import kscience.kmath.operations.invoke +import space.kscience.kmath.nd.* +import space.kscience.kmath.operations.Norm +import space.kscience.kmath.operations.invoke import kotlin.math.abs import kotlin.math.pow import kotlin.test.Test diff --git a/kmath-core/src/commonTest/kotlin/kscience/kmath/testutils/AlgebraicVerifier.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/AlgebraicVerifier.kt similarity index 56% rename from kmath-core/src/commonTest/kotlin/kscience/kmath/testutils/AlgebraicVerifier.kt rename to kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/AlgebraicVerifier.kt index dea4697e7..7474aae8f 100644 --- a/kmath-core/src/commonTest/kotlin/kscience/kmath/testutils/AlgebraicVerifier.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/AlgebraicVerifier.kt @@ -1,6 +1,6 @@ -package kscience.kmath.testutils +package space.kscience.kmath.testutils -import kscience.kmath.operations.Algebra +import space.kscience.kmath.operations.Algebra internal interface AlgebraicVerifier where A : Algebra { val algebra: A diff --git a/kmath-core/src/commonTest/kotlin/kscience/kmath/testutils/FieldVerifier.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/FieldVerifier.kt similarity index 89% rename from kmath-core/src/commonTest/kotlin/kscience/kmath/testutils/FieldVerifier.kt rename to kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/FieldVerifier.kt index 4fe134fe5..2aef6b27f 100644 --- a/kmath-core/src/commonTest/kotlin/kscience/kmath/testutils/FieldVerifier.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/FieldVerifier.kt @@ -1,7 +1,7 @@ -package kscience.kmath.testutils +package space.kscience.kmath.testutils -import kscience.kmath.operations.Field -import kscience.kmath.operations.invoke +import space.kscience.kmath.operations.Field +import space.kscience.kmath.operations.invoke import kotlin.test.assertEquals import kotlin.test.assertNotEquals diff --git a/kmath-core/src/commonTest/kotlin/kscience/kmath/testutils/RingVerifier.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/RingVerifier.kt similarity index 92% rename from kmath-core/src/commonTest/kotlin/kscience/kmath/testutils/RingVerifier.kt rename to kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/RingVerifier.kt index 2149c6ec0..dd8841806 100644 --- a/kmath-core/src/commonTest/kotlin/kscience/kmath/testutils/RingVerifier.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/RingVerifier.kt @@ -1,7 +1,7 @@ -package kscience.kmath.testutils +package space.kscience.kmath.testutils -import kscience.kmath.operations.Ring -import kscience.kmath.operations.invoke +import space.kscience.kmath.operations.Ring +import space.kscience.kmath.operations.invoke import kotlin.test.assertEquals internal open class RingVerifier(override val algebra: Ring, a: T, b: T, c: T, x: Number) : diff --git a/kmath-core/src/commonTest/kotlin/kscience/kmath/testutils/SpaceVerifier.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/SpaceVerifier.kt similarity index 91% rename from kmath-core/src/commonTest/kotlin/kscience/kmath/testutils/SpaceVerifier.kt rename to kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/SpaceVerifier.kt index 4282dad2f..f7a25b593 100644 --- a/kmath-core/src/commonTest/kotlin/kscience/kmath/testutils/SpaceVerifier.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/SpaceVerifier.kt @@ -1,7 +1,7 @@ -package kscience.kmath.testutils +package space.kscience.kmath.testutils -import kscience.kmath.operations.Space -import kscience.kmath.operations.invoke +import space.kscience.kmath.operations.Space +import space.kscience.kmath.operations.invoke import kotlin.test.assertEquals import kotlin.test.assertNotEquals diff --git a/kmath-core/src/jvmMain/kotlin/kscience/kmath/operations/BigNumbers.kt b/kmath-core/src/jvmMain/kotlin/space/kscience/kmath/operations/BigNumbers.kt similarity index 98% rename from kmath-core/src/jvmMain/kotlin/kscience/kmath/operations/BigNumbers.kt rename to kmath-core/src/jvmMain/kotlin/space/kscience/kmath/operations/BigNumbers.kt index 9bd6a9fc4..8f8b31ed9 100644 --- a/kmath-core/src/jvmMain/kotlin/kscience/kmath/operations/BigNumbers.kt +++ b/kmath-core/src/jvmMain/kotlin/space/kscience/kmath/operations/BigNumbers.kt @@ -1,4 +1,4 @@ -package kscience.kmath.operations +package space.kscience.kmath.operations import java.math.BigDecimal import java.math.BigInteger diff --git a/kmath-coroutines/src/commonMain/kotlin/kscience/kmath/chains/BlockingIntChain.kt b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/BlockingIntChain.kt similarity index 88% rename from kmath-coroutines/src/commonMain/kotlin/kscience/kmath/chains/BlockingIntChain.kt rename to kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/BlockingIntChain.kt index 6088267a2..11da7e503 100644 --- a/kmath-coroutines/src/commonMain/kotlin/kscience/kmath/chains/BlockingIntChain.kt +++ b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/BlockingIntChain.kt @@ -1,4 +1,4 @@ -package kscience.kmath.chains +package space.kscience.kmath.chains /** * Performance optimized chain for integer values diff --git a/kmath-coroutines/src/commonMain/kotlin/kscience/kmath/chains/BlockingRealChain.kt b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/BlockingRealChain.kt similarity index 89% rename from kmath-coroutines/src/commonMain/kotlin/kscience/kmath/chains/BlockingRealChain.kt rename to kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/BlockingRealChain.kt index 718b3a18b..ac6b117dc 100644 --- a/kmath-coroutines/src/commonMain/kotlin/kscience/kmath/chains/BlockingRealChain.kt +++ b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/BlockingRealChain.kt @@ -1,4 +1,4 @@ -package kscience.kmath.chains +package space.kscience.kmath.chains /** * Performance optimized chain for real values diff --git a/kmath-coroutines/src/commonMain/kotlin/kscience/kmath/chains/Chain.kt b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/Chain.kt similarity index 99% rename from kmath-coroutines/src/commonMain/kotlin/kscience/kmath/chains/Chain.kt rename to kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/Chain.kt index 7ff7b7aae..5375113fe 100644 --- a/kmath-coroutines/src/commonMain/kotlin/kscience/kmath/chains/Chain.kt +++ b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/Chain.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package kscience.kmath.chains +package space.kscience.kmath.chains import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.FlowCollector diff --git a/kmath-coroutines/src/commonMain/kotlin/kscience/kmath/chains/flowExtra.kt b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/flowExtra.kt similarity index 79% rename from kmath-coroutines/src/commonMain/kotlin/kscience/kmath/chains/flowExtra.kt rename to kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/flowExtra.kt index 6b14057fe..489cca8c1 100644 --- a/kmath-coroutines/src/commonMain/kotlin/kscience/kmath/chains/flowExtra.kt +++ b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/flowExtra.kt @@ -1,13 +1,13 @@ -package kscience.kmath.chains +package space.kscience.kmath.chains import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.runningReduce import kotlinx.coroutines.flow.scan -import kscience.kmath.operations.Space -import kscience.kmath.operations.SpaceOperations -import kscience.kmath.operations.invoke +import space.kscience.kmath.operations.Space +import space.kscience.kmath.operations.SpaceOperations +import space.kscience.kmath.operations.invoke @ExperimentalCoroutinesApi public fun Flow.cumulativeSum(space: SpaceOperations): Flow = diff --git a/kmath-coroutines/src/commonMain/kotlin/kscience/kmath/coroutines/coroutinesExtra.kt b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/coroutines/coroutinesExtra.kt similarity index 98% rename from kmath-coroutines/src/commonMain/kotlin/kscience/kmath/coroutines/coroutinesExtra.kt rename to kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/coroutines/coroutinesExtra.kt index 7dcdc0d62..6578af0e9 100644 --- a/kmath-coroutines/src/commonMain/kotlin/kscience/kmath/coroutines/coroutinesExtra.kt +++ b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/coroutines/coroutinesExtra.kt @@ -1,4 +1,4 @@ -package kscience.kmath.coroutines +package space.kscience.kmath.coroutines import kotlinx.coroutines.* import kotlinx.coroutines.channels.produce diff --git a/kmath-coroutines/src/commonMain/kotlin/kscience/kmath/streaming/BufferFlow.kt b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/streaming/BufferFlow.kt similarity index 88% rename from kmath-coroutines/src/commonMain/kotlin/kscience/kmath/streaming/BufferFlow.kt rename to kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/streaming/BufferFlow.kt index 328a7807c..262978306 100644 --- a/kmath-coroutines/src/commonMain/kotlin/kscience/kmath/streaming/BufferFlow.kt +++ b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/streaming/BufferFlow.kt @@ -1,12 +1,12 @@ -package kscience.kmath.streaming +package space.kscience.kmath.streaming import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.* -import kscience.kmath.chains.BlockingRealChain -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.BufferFactory -import kscience.kmath.structures.RealBuffer -import kscience.kmath.structures.asBuffer +import space.kscience.kmath.chains.BlockingRealChain +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.BufferFactory +import space.kscience.kmath.structures.RealBuffer +import space.kscience.kmath.structures.asBuffer /** * Create a [Flow] from buffer diff --git a/kmath-coroutines/src/commonMain/kotlin/kscience/kmath/streaming/RingBuffer.kt b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/streaming/RingBuffer.kt similarity index 92% rename from kmath-coroutines/src/commonMain/kotlin/kscience/kmath/streaming/RingBuffer.kt rename to kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/streaming/RingBuffer.kt index 385bbaae2..efed41112 100644 --- a/kmath-coroutines/src/commonMain/kotlin/kscience/kmath/streaming/RingBuffer.kt +++ b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/streaming/RingBuffer.kt @@ -1,10 +1,10 @@ -package kscience.kmath.streaming +package space.kscience.kmath.streaming import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.MutableBuffer -import kscience.kmath.structures.VirtualBuffer +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.MutableBuffer +import space.kscience.kmath.structures.VirtualBuffer /** * Thread-safe ring buffer diff --git a/kmath-coroutines/src/jvmMain/kotlin/kscience/kmath/chains/ChainExt.kt b/kmath-coroutines/src/jvmMain/kotlin/space/kscience/kmath/chains/ChainExt.kt similarity index 92% rename from kmath-coroutines/src/jvmMain/kotlin/kscience/kmath/chains/ChainExt.kt rename to kmath-coroutines/src/jvmMain/kotlin/space/kscience/kmath/chains/ChainExt.kt index 3dfeddbac..c62785060 100644 --- a/kmath-coroutines/src/jvmMain/kotlin/kscience/kmath/chains/ChainExt.kt +++ b/kmath-coroutines/src/jvmMain/kotlin/space/kscience/kmath/chains/ChainExt.kt @@ -1,4 +1,4 @@ -package kscience.kmath.chains +package space.kscience.kmath.chains import kotlinx.coroutines.runBlocking diff --git a/kmath-coroutines/src/jvmMain/kotlin/kscience/kmath/structures/LazyNDStructure.kt b/kmath-coroutines/src/jvmMain/kotlin/space/kscience/kmath/structures/LazyNDStructure.kt similarity index 92% rename from kmath-coroutines/src/jvmMain/kotlin/kscience/kmath/structures/LazyNDStructure.kt rename to kmath-coroutines/src/jvmMain/kotlin/space/kscience/kmath/structures/LazyNDStructure.kt index 3933ef28b..51a79f44a 100644 --- a/kmath-coroutines/src/jvmMain/kotlin/kscience/kmath/structures/LazyNDStructure.kt +++ b/kmath-coroutines/src/jvmMain/kotlin/space/kscience/kmath/structures/LazyNDStructure.kt @@ -1,9 +1,9 @@ -package kscience.kmath.structures +package space.kscience.kmath.structures import kotlinx.coroutines.* -import kscience.kmath.coroutines.Math -import kscience.kmath.nd.DefaultStrides -import kscience.kmath.nd.NDStructure +import space.kscience.kmath.coroutines.Math +import space.kscience.kmath.nd.DefaultStrides +import space.kscience.kmath.nd.NDStructure public class LazyNDStructure( public val scope: CoroutineScope, diff --git a/kmath-coroutines/src/jvmTest/kotlin/kscience/kmath/streaming/BufferFlowTest.kt b/kmath-coroutines/src/jvmTest/kotlin/space/kscience/kmath/streaming/BufferFlowTest.kt similarity index 87% rename from kmath-coroutines/src/jvmTest/kotlin/kscience/kmath/streaming/BufferFlowTest.kt rename to kmath-coroutines/src/jvmTest/kotlin/space/kscience/kmath/streaming/BufferFlowTest.kt index a9bf38c12..589456843 100644 --- a/kmath-coroutines/src/jvmTest/kotlin/kscience/kmath/streaming/BufferFlowTest.kt +++ b/kmath-coroutines/src/jvmTest/kotlin/space/kscience/kmath/streaming/BufferFlowTest.kt @@ -1,12 +1,12 @@ -package kscience.kmath.streaming +package space.kscience.kmath.streaming import kotlinx.coroutines.* import kotlinx.coroutines.flow.asFlow import kotlinx.coroutines.flow.collect -import kscience.kmath.coroutines.async -import kscience.kmath.coroutines.collect -import kscience.kmath.coroutines.mapParallel import org.junit.jupiter.api.Timeout +import space.kscience.kmath.coroutines.async +import space.kscience.kmath.coroutines.collect +import space.kscience.kmath.coroutines.mapParallel import java.util.concurrent.Executors import kotlin.test.Test diff --git a/kmath-coroutines/src/jvmTest/kotlin/kscience/kmath/streaming/RingBufferTest.kt b/kmath-coroutines/src/jvmTest/kotlin/space/kscience/kmath/streaming/RingBufferTest.kt similarity index 90% rename from kmath-coroutines/src/jvmTest/kotlin/kscience/kmath/streaming/RingBufferTest.kt rename to kmath-coroutines/src/jvmTest/kotlin/space/kscience/kmath/streaming/RingBufferTest.kt index 5bb0c1d40..3d037cbf9 100644 --- a/kmath-coroutines/src/jvmTest/kotlin/kscience/kmath/streaming/RingBufferTest.kt +++ b/kmath-coroutines/src/jvmTest/kotlin/space/kscience/kmath/streaming/RingBufferTest.kt @@ -1,8 +1,8 @@ -package kscience.kmath.streaming +package space.kscience.kmath.streaming import kotlinx.coroutines.flow.* import kotlinx.coroutines.runBlocking -import kscience.kmath.structures.asSequence +import space.kscience.kmath.structures.asSequence import kotlin.test.Test import kotlin.test.assertEquals diff --git a/kmath-dimensions/src/commonMain/kotlin/kscience/kmath/dimensions/Dimensions.kt b/kmath-dimensions/src/commonMain/kotlin/space/kscience/kmath/dimensions/Dimensions.kt similarity index 96% rename from kmath-dimensions/src/commonMain/kotlin/kscience/kmath/dimensions/Dimensions.kt rename to kmath-dimensions/src/commonMain/kotlin/space/kscience/kmath/dimensions/Dimensions.kt index 9450f9174..9f0d868f2 100644 --- a/kmath-dimensions/src/commonMain/kotlin/kscience/kmath/dimensions/Dimensions.kt +++ b/kmath-dimensions/src/commonMain/kotlin/space/kscience/kmath/dimensions/Dimensions.kt @@ -1,4 +1,4 @@ -package kscience.kmath.dimensions +package space.kscience.kmath.dimensions import kotlin.reflect.KClass diff --git a/kmath-dimensions/src/commonMain/kotlin/kscience/kmath/dimensions/Wrappers.kt b/kmath-dimensions/src/commonMain/kotlin/space/kscience/kmath/dimensions/Wrappers.kt similarity index 97% rename from kmath-dimensions/src/commonMain/kotlin/kscience/kmath/dimensions/Wrappers.kt rename to kmath-dimensions/src/commonMain/kotlin/space/kscience/kmath/dimensions/Wrappers.kt index 52443da0e..237824a39 100644 --- a/kmath-dimensions/src/commonMain/kotlin/kscience/kmath/dimensions/Wrappers.kt +++ b/kmath-dimensions/src/commonMain/kotlin/space/kscience/kmath/dimensions/Wrappers.kt @@ -1,8 +1,8 @@ -package kscience.kmath.dimensions +package space.kscience.kmath.dimensions -import kscience.kmath.linear.* -import kscience.kmath.nd.Structure2D -import kscience.kmath.operations.invoke +import space.kscience.kmath.linear.* +import space.kscience.kmath.nd.Structure2D +import space.kscience.kmath.operations.invoke /** * A matrix with compile-time controlled dimension diff --git a/kmath-dimensions/src/commonTest/kotlin/kscience/dimensions/DMatrixContextTest.kt b/kmath-dimensions/src/commonTest/kotlin/kscience/dimensions/DMatrixContextTest.kt index b9193d4dd..e2a9628ac 100644 --- a/kmath-dimensions/src/commonTest/kotlin/kscience/dimensions/DMatrixContextTest.kt +++ b/kmath-dimensions/src/commonTest/kotlin/kscience/dimensions/DMatrixContextTest.kt @@ -1,9 +1,9 @@ package kscience.dimensions -import kscience.kmath.dimensions.D2 -import kscience.kmath.dimensions.D3 -import kscience.kmath.dimensions.DMatrixContext -import kscience.kmath.dimensions.one +import space.kscience.kmath.dimensions.D2 +import space.kscience.kmath.dimensions.D3 +import space.kscience.kmath.dimensions.DMatrixContext +import space.kscience.kmath.dimensions.one import kotlin.test.Test @Suppress("UNUSED_VARIABLE") diff --git a/kmath-dimensions/src/jsMain/kotlin/kscience/kmath/dimensions/dimJs.kt b/kmath-dimensions/src/jsMain/kotlin/space/kscience/kmath/dimensions/dimJs.kt similarity index 93% rename from kmath-dimensions/src/jsMain/kotlin/kscience/kmath/dimensions/dimJs.kt rename to kmath-dimensions/src/jsMain/kotlin/space/kscience/kmath/dimensions/dimJs.kt index 4230da156..40c1148cb 100644 --- a/kmath-dimensions/src/jsMain/kotlin/kscience/kmath/dimensions/dimJs.kt +++ b/kmath-dimensions/src/jsMain/kotlin/space/kscience/kmath/dimensions/dimJs.kt @@ -1,4 +1,4 @@ -package kscience.kmath.dimensions +package space.kscience.kmath.dimensions import kotlin.reflect.KClass diff --git a/kmath-dimensions/src/jvmMain/kotlin/kscience/kmath/dimensions/dimJvm.kt b/kmath-dimensions/src/jvmMain/kotlin/space/kscience/kmath/dimensions/dimJvm.kt similarity index 90% rename from kmath-dimensions/src/jvmMain/kotlin/kscience/kmath/dimensions/dimJvm.kt rename to kmath-dimensions/src/jvmMain/kotlin/space/kscience/kmath/dimensions/dimJvm.kt index dec3979ef..87df1c097 100644 --- a/kmath-dimensions/src/jvmMain/kotlin/kscience/kmath/dimensions/dimJvm.kt +++ b/kmath-dimensions/src/jvmMain/kotlin/space/kscience/kmath/dimensions/dimJvm.kt @@ -1,4 +1,4 @@ -package kscience.kmath.dimensions +package space.kscience.kmath.dimensions import kotlin.reflect.KClass diff --git a/kmath-dimensions/src/nativeMain/kotlin/kscience/kmath/dimensions/dimNative.kt b/kmath-dimensions/src/nativeMain/kotlin/space/kscience/kmath/dimensions/dimNative.kt similarity index 94% rename from kmath-dimensions/src/nativeMain/kotlin/kscience/kmath/dimensions/dimNative.kt rename to kmath-dimensions/src/nativeMain/kotlin/space/kscience/kmath/dimensions/dimNative.kt index aeaeaf759..3b9728328 100644 --- a/kmath-dimensions/src/nativeMain/kotlin/kscience/kmath/dimensions/dimNative.kt +++ b/kmath-dimensions/src/nativeMain/kotlin/space/kscience/kmath/dimensions/dimNative.kt @@ -1,4 +1,4 @@ -package kscience.kmath.dimensions +package space.kscience.kmath.dimensions import kotlin.native.concurrent.ThreadLocal import kotlin.reflect.KClass diff --git a/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrix.kt b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt similarity index 94% rename from kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrix.kt rename to kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt index 3587823a7..d23e613e4 100644 --- a/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrix.kt +++ b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt @@ -1,11 +1,11 @@ -package kscience.kmath.ejml +package space.kscience.kmath.ejml -import kscience.kmath.linear.* -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.nd.NDStructure -import kscience.kmath.structures.RealBuffer import org.ejml.dense.row.factory.DecompositionFactory_DDRM import org.ejml.simple.SimpleMatrix +import space.kscience.kmath.linear.* +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.nd.NDStructure +import space.kscience.kmath.structures.RealBuffer import kotlin.reflect.KClass import kotlin.reflect.cast diff --git a/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrixContext.kt b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrixContext.kt similarity index 94% rename from kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrixContext.kt rename to kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrixContext.kt index eb126e00a..80b0756c0 100644 --- a/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrixContext.kt +++ b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrixContext.kt @@ -1,9 +1,9 @@ -package kscience.kmath.ejml +package space.kscience.kmath.ejml -import kscience.kmath.linear.* -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.nd.getFeature import org.ejml.simple.SimpleMatrix +import space.kscience.kmath.linear.* +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.nd.getFeature /** * Represents context of basic operations operating with [EjmlMatrix]. diff --git a/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlVector.kt b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlVector.kt similarity index 90% rename from kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlVector.kt rename to kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlVector.kt index f7cd1b66d..efa1f6128 100644 --- a/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlVector.kt +++ b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlVector.kt @@ -1,8 +1,8 @@ -package kscience.kmath.ejml +package space.kscience.kmath.ejml import org.ejml.simple.SimpleMatrix -import kscience.kmath.linear.Point -import kscience.kmath.structures.Buffer +import space.kscience.kmath.linear.Point +import space.kscience.kmath.structures.Buffer /** * Represents point over EJML [SimpleMatrix]. diff --git a/kmath-ejml/src/test/kotlin/kscience/kmath/ejml/EjmlMatrixTest.kt b/kmath-ejml/src/test/kotlin/space/kscience/kmath/ejml/EjmlMatrixTest.kt similarity index 86% rename from kmath-ejml/src/test/kotlin/kscience/kmath/ejml/EjmlMatrixTest.kt rename to kmath-ejml/src/test/kotlin/space/kscience/kmath/ejml/EjmlMatrixTest.kt index 6af70b6f5..7f31d2f93 100644 --- a/kmath-ejml/src/test/kotlin/kscience/kmath/ejml/EjmlMatrixTest.kt +++ b/kmath-ejml/src/test/kotlin/space/kscience/kmath/ejml/EjmlMatrixTest.kt @@ -1,13 +1,13 @@ -package kscience.kmath.ejml +package space.kscience.kmath.ejml -import kscience.kmath.linear.DeterminantFeature -import kscience.kmath.linear.LupDecompositionFeature -import kscience.kmath.linear.MatrixFeature -import kscience.kmath.linear.plus -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.nd.getFeature import org.ejml.dense.row.factory.DecompositionFactory_DDRM import org.ejml.simple.SimpleMatrix +import space.kscience.kmath.linear.DeterminantFeature +import space.kscience.kmath.linear.LupDecompositionFeature +import space.kscience.kmath.linear.MatrixFeature +import space.kscience.kmath.linear.plus +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.nd.getFeature import kotlin.random.Random import kotlin.random.asJavaRandom import kotlin.test.* diff --git a/kmath-ejml/src/test/kotlin/kscience/kmath/ejml/EjmlVectorTest.kt b/kmath-ejml/src/test/kotlin/space/kscience/kmath/ejml/EjmlVectorTest.kt similarity index 96% rename from kmath-ejml/src/test/kotlin/kscience/kmath/ejml/EjmlVectorTest.kt rename to kmath-ejml/src/test/kotlin/space/kscience/kmath/ejml/EjmlVectorTest.kt index e27f977d2..1924696fb 100644 --- a/kmath-ejml/src/test/kotlin/kscience/kmath/ejml/EjmlVectorTest.kt +++ b/kmath-ejml/src/test/kotlin/space/kscience/kmath/ejml/EjmlVectorTest.kt @@ -1,4 +1,4 @@ -package kscience.kmath.ejml +package space.kscience.kmath.ejml import org.ejml.simple.SimpleMatrix import kotlin.random.Random diff --git a/kmath-for-real/src/commonMain/kotlin/kscience/kmath/real/RealMatrix.kt b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealMatrix.kt similarity index 95% rename from kmath-for-real/src/commonMain/kotlin/kscience/kmath/real/RealMatrix.kt rename to kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealMatrix.kt index d0e4a7325..30d002498 100644 --- a/kmath-for-real/src/commonMain/kotlin/kscience/kmath/real/RealMatrix.kt +++ b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealMatrix.kt @@ -1,10 +1,10 @@ -package kscience.kmath.real +package space.kscience.kmath.real -import kscience.kmath.linear.* -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.RealBuffer -import kscience.kmath.structures.asIterable +import space.kscience.kmath.linear.* +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.RealBuffer +import space.kscience.kmath.structures.asIterable import kotlin.math.pow /* diff --git a/kmath-for-real/src/commonMain/kotlin/kscience/kmath/real/RealVector.kt b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealVector.kt similarity index 92% rename from kmath-for-real/src/commonMain/kotlin/kscience/kmath/real/RealVector.kt rename to kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealVector.kt index ee2a960a1..ca892fa7e 100644 --- a/kmath-for-real/src/commonMain/kotlin/kscience/kmath/real/RealVector.kt +++ b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealVector.kt @@ -1,10 +1,10 @@ -package kscience.kmath.real +package space.kscience.kmath.real -import kscience.kmath.linear.Point -import kscience.kmath.operations.Norm -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.asBuffer -import kscience.kmath.structures.asIterable +import space.kscience.kmath.linear.Point +import space.kscience.kmath.operations.Norm +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.asBuffer +import space.kscience.kmath.structures.asIterable import kotlin.math.pow import kotlin.math.sqrt diff --git a/kmath-for-real/src/commonMain/kotlin/kscience/kmath/real/dot.kt b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/dot.kt similarity index 83% rename from kmath-for-real/src/commonMain/kotlin/kscience/kmath/real/dot.kt rename to kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/dot.kt index 9beffe6bb..68ce917fc 100644 --- a/kmath-for-real/src/commonMain/kotlin/kscience/kmath/real/dot.kt +++ b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/dot.kt @@ -1,8 +1,8 @@ -package kscience.kmath.real +package space.kscience.kmath.real -import kscience.kmath.linear.BufferMatrix -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.RealBuffer +import space.kscience.kmath.linear.BufferMatrix +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.RealBuffer /** diff --git a/kmath-for-real/src/commonMain/kotlin/kscience/kmath/real/grids.kt b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/grids.kt similarity index 94% rename from kmath-for-real/src/commonMain/kotlin/kscience/kmath/real/grids.kt rename to kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/grids.kt index 69a149fb8..8b4f1cd96 100644 --- a/kmath-for-real/src/commonMain/kotlin/kscience/kmath/real/grids.kt +++ b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/grids.kt @@ -1,6 +1,6 @@ -package kscience.kmath.real +package space.kscience.kmath.real -import kscience.kmath.structures.asBuffer +import space.kscience.kmath.structures.asBuffer import kotlin.math.abs /** diff --git a/kmath-for-real/src/commonMain/kotlin/kscience/kmath/real/realND.kt b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/realND.kt similarity index 81% rename from kmath-for-real/src/commonMain/kotlin/kscience/kmath/real/realND.kt rename to kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/realND.kt index f8757b132..492e40922 100644 --- a/kmath-for-real/src/commonMain/kotlin/kscience/kmath/real/realND.kt +++ b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/realND.kt @@ -1,8 +1,8 @@ -package kscience.kmath.real +package space.kscience.kmath.real -import kscience.kmath.nd.NDBuffer -import kscience.kmath.operations.RealField -import kscience.kmath.structures.RealBuffer +import space.kscience.kmath.nd.NDBuffer +import space.kscience.kmath.operations.RealField +import space.kscience.kmath.structures.RealBuffer /** * Map one [NDBuffer] using function without indices. diff --git a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/GridTest.kt b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/GridTest.kt index 5f19e94b7..c538a2d99 100644 --- a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/GridTest.kt +++ b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/GridTest.kt @@ -1,6 +1,6 @@ package kaceince.kmath.real -import kscience.kmath.real.step +import space.kscience.kmath.real.step import kotlin.test.Test import kotlin.test.assertEquals diff --git a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealMatrixTest.kt b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealMatrixTest.kt index 7c3540a2e..9e2778be9 100644 --- a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealMatrixTest.kt +++ b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealMatrixTest.kt @@ -1,10 +1,10 @@ package kaceince.kmath.real -import kscience.kmath.linear.Matrix -import kscience.kmath.linear.build -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.real.* -import kscience.kmath.structures.contentEquals +import space.kscience.kmath.linear.Matrix +import space.kscience.kmath.linear.build +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.real.* +import space.kscience.kmath.structures.contentEquals import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue diff --git a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealVectorTest.kt b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealVectorTest.kt index 6215ba5e8..463c68681 100644 --- a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealVectorTest.kt +++ b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealVectorTest.kt @@ -1,10 +1,12 @@ package kaceince.kmath.real -import kscience.kmath.linear.* -import kscience.kmath.operations.invoke -import kscience.kmath.real.RealVector -import kscience.kmath.real.plus -import kscience.kmath.structures.Buffer +import space.kscience.kmath.linear.MatrixContext +import space.kscience.kmath.linear.asMatrix +import space.kscience.kmath.linear.real +import space.kscience.kmath.linear.transpose +import space.kscience.kmath.operations.invoke +import space.kscience.kmath.real.plus +import space.kscience.kmath.structures.Buffer import kotlin.test.Test import kotlin.test.assertEquals diff --git a/kmath-functions/src/commonMain/kotlin/kscience/kmath/functions/Piecewise.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Piecewise.kt similarity index 92% rename from kmath-functions/src/commonMain/kotlin/kscience/kmath/functions/Piecewise.kt rename to kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Piecewise.kt index 8394ab39d..d2470a4b4 100644 --- a/kmath-functions/src/commonMain/kotlin/kscience/kmath/functions/Piecewise.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Piecewise.kt @@ -1,6 +1,6 @@ -package kscience.kmath.functions +package space.kscience.kmath.functions -import kscience.kmath.operations.Ring +import space.kscience.kmath.operations.Ring public fun interface Piecewise { public fun findPiece(arg: T): R? diff --git a/kmath-functions/src/commonMain/kotlin/kscience/kmath/functions/Polynomial.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt similarity index 92% rename from kmath-functions/src/commonMain/kotlin/kscience/kmath/functions/Polynomial.kt rename to kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt index 820076c4c..b1e47f34c 100644 --- a/kmath-functions/src/commonMain/kotlin/kscience/kmath/functions/Polynomial.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt @@ -1,8 +1,8 @@ -package kscience.kmath.functions +package space.kscience.kmath.functions -import kscience.kmath.operations.Ring -import kscience.kmath.operations.Space -import kscience.kmath.operations.invoke +import space.kscience.kmath.operations.Ring +import space.kscience.kmath.operations.Space +import space.kscience.kmath.operations.invoke import kotlin.contracts.InvocationKind import kotlin.contracts.contract import kotlin.math.max diff --git a/kmath-functions/src/commonMain/kotlin/kscience/kmath/interpolation/Interpolator.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/Interpolator.kt similarity index 82% rename from kmath-functions/src/commonMain/kotlin/kscience/kmath/interpolation/Interpolator.kt rename to kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/Interpolator.kt index 0620b4aa8..dc5227f8b 100644 --- a/kmath-functions/src/commonMain/kotlin/kscience/kmath/interpolation/Interpolator.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/Interpolator.kt @@ -1,10 +1,10 @@ -package kscience.kmath.interpolation +package space.kscience.kmath.interpolation -import kscience.kmath.functions.PiecewisePolynomial -import kscience.kmath.functions.value -import kscience.kmath.operations.Ring -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.asBuffer +import space.kscience.kmath.functions.PiecewisePolynomial +import space.kscience.kmath.functions.value +import space.kscience.kmath.operations.Ring +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.asBuffer public fun interface Interpolator { public fun interpolate(points: XYPointSet): (X) -> Y diff --git a/kmath-functions/src/commonMain/kotlin/kscience/kmath/interpolation/LinearInterpolator.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/LinearInterpolator.kt similarity index 74% rename from kmath-functions/src/commonMain/kotlin/kscience/kmath/interpolation/LinearInterpolator.kt rename to kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/LinearInterpolator.kt index 377aa1fbe..c939384e3 100644 --- a/kmath-functions/src/commonMain/kotlin/kscience/kmath/interpolation/LinearInterpolator.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/LinearInterpolator.kt @@ -1,10 +1,10 @@ -package kscience.kmath.interpolation +package space.kscience.kmath.interpolation -import kscience.kmath.functions.OrderedPiecewisePolynomial -import kscience.kmath.functions.PiecewisePolynomial -import kscience.kmath.functions.Polynomial -import kscience.kmath.operations.Field -import kscience.kmath.operations.invoke +import space.kscience.kmath.functions.OrderedPiecewisePolynomial +import space.kscience.kmath.functions.PiecewisePolynomial +import space.kscience.kmath.functions.Polynomial +import space.kscience.kmath.operations.Field +import space.kscience.kmath.operations.invoke /** * Reference JVM implementation: https://github.com/apache/commons-math/blob/master/src/main/java/org/apache/commons/math4/analysis/interpolation/LinearInterpolator.java diff --git a/kmath-functions/src/commonMain/kotlin/kscience/kmath/interpolation/LoessInterpolator.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/LoessInterpolator.kt similarity index 98% rename from kmath-functions/src/commonMain/kotlin/kscience/kmath/interpolation/LoessInterpolator.kt rename to kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/LoessInterpolator.kt index 6931857b1..26e7a4072 100644 --- a/kmath-functions/src/commonMain/kotlin/kscience/kmath/interpolation/LoessInterpolator.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/LoessInterpolator.kt @@ -1,8 +1,8 @@ -package kscience.kmath.interpolation +package space.kscience.kmath.interpolation // -//import kscience.kmath.functions.PiecewisePolynomial -//import kscience.kmath.operations.Ring -//import kscience.kmath.structures.Buffer +//import space.kscience.kmath.functions.PiecewisePolynomial +//import space.kscience.kmath.operations.Ring +//import space.kscience.kmath.structures.Buffer //import kotlin.math.abs //import kotlin.math.sqrt // diff --git a/kmath-functions/src/commonMain/kotlin/kscience/kmath/interpolation/SplineInterpolator.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt similarity index 85% rename from kmath-functions/src/commonMain/kotlin/kscience/kmath/interpolation/SplineInterpolator.kt rename to kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt index 6cda45f72..34fd25ad4 100644 --- a/kmath-functions/src/commonMain/kotlin/kscience/kmath/interpolation/SplineInterpolator.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt @@ -1,11 +1,11 @@ -package kscience.kmath.interpolation +package space.kscience.kmath.interpolation -import kscience.kmath.functions.OrderedPiecewisePolynomial -import kscience.kmath.functions.PiecewisePolynomial -import kscience.kmath.functions.Polynomial -import kscience.kmath.operations.Field -import kscience.kmath.operations.invoke -import kscience.kmath.structures.MutableBufferFactory +import space.kscience.kmath.functions.OrderedPiecewisePolynomial +import space.kscience.kmath.functions.PiecewisePolynomial +import space.kscience.kmath.functions.Polynomial +import space.kscience.kmath.operations.Field +import space.kscience.kmath.operations.invoke +import space.kscience.kmath.structures.MutableBufferFactory /** * Generic spline interpolator. Not recommended for performance critical places, use platform-specific and type specific ones. diff --git a/kmath-functions/src/commonMain/kotlin/kscience/kmath/interpolation/XYPointSet.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/XYPointSet.kt similarity index 92% rename from kmath-functions/src/commonMain/kotlin/kscience/kmath/interpolation/XYPointSet.kt rename to kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/XYPointSet.kt index bdece28e7..c3bcad846 100644 --- a/kmath-functions/src/commonMain/kotlin/kscience/kmath/interpolation/XYPointSet.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/XYPointSet.kt @@ -1,7 +1,7 @@ -package kscience.kmath.interpolation +package space.kscience.kmath.interpolation -import kscience.kmath.nd.Structure2D -import kscience.kmath.structures.Buffer +import space.kscience.kmath.nd.Structure2D +import space.kscience.kmath.structures.Buffer public interface XYPointSet { public val size: Int diff --git a/kmath-functions/src/commonTest/kotlin/kscience/kmath/interpolation/LinearInterpolatorTest.kt b/kmath-functions/src/commonTest/kotlin/space/kscience/kmath/interpolation/LinearInterpolatorTest.kt similarity index 75% rename from kmath-functions/src/commonTest/kotlin/kscience/kmath/interpolation/LinearInterpolatorTest.kt rename to kmath-functions/src/commonTest/kotlin/space/kscience/kmath/interpolation/LinearInterpolatorTest.kt index 303615676..0b7b62147 100644 --- a/kmath-functions/src/commonTest/kotlin/kscience/kmath/interpolation/LinearInterpolatorTest.kt +++ b/kmath-functions/src/commonTest/kotlin/space/kscience/kmath/interpolation/LinearInterpolatorTest.kt @@ -1,8 +1,8 @@ -package kscience.kmath.interpolation +package space.kscience.kmath.interpolation -import kscience.kmath.functions.PiecewisePolynomial -import kscience.kmath.functions.asFunction -import kscience.kmath.operations.RealField +import space.kscience.kmath.functions.PiecewisePolynomial +import space.kscience.kmath.functions.asFunction +import space.kscience.kmath.operations.RealField import kotlin.test.Test import kotlin.test.assertEquals diff --git a/kmath-geometry/src/commonMain/kotlin/kscience/kmath/geometry/ReferenceFrame.kt b/kmath-geometry/src/commonMain/kotlin/kscience/kmath/geometry/ReferenceFrame.kt deleted file mode 100644 index f9de7b51f..000000000 --- a/kmath-geometry/src/commonMain/kotlin/kscience/kmath/geometry/ReferenceFrame.kt +++ /dev/null @@ -1,3 +0,0 @@ -package kscience.kmath.geometry - -public interface ReferenceFrame diff --git a/kmath-geometry/src/commonMain/kotlin/kscience/kmath/geometry/Euclidean2DSpace.kt b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/Euclidean2DSpace.kt similarity index 86% rename from kmath-geometry/src/commonMain/kotlin/kscience/kmath/geometry/Euclidean2DSpace.kt rename to kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/Euclidean2DSpace.kt index 7714dc939..609274d7d 100644 --- a/kmath-geometry/src/commonMain/kotlin/kscience/kmath/geometry/Euclidean2DSpace.kt +++ b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/Euclidean2DSpace.kt @@ -1,9 +1,9 @@ -package kscience.kmath.geometry +package space.kscience.kmath.geometry -import kscience.kmath.linear.Point -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.operations.SpaceElement -import kscience.kmath.operations.invoke +import space.kscience.kmath.linear.Point +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.operations.SpaceElement +import space.kscience.kmath.operations.invoke import kotlin.math.sqrt @OptIn(UnstableKMathAPI::class) diff --git a/kmath-geometry/src/commonMain/kotlin/kscience/kmath/geometry/Euclidean3DSpace.kt b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/Euclidean3DSpace.kt similarity index 87% rename from kmath-geometry/src/commonMain/kotlin/kscience/kmath/geometry/Euclidean3DSpace.kt rename to kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/Euclidean3DSpace.kt index 00daa2d75..906f5df03 100644 --- a/kmath-geometry/src/commonMain/kotlin/kscience/kmath/geometry/Euclidean3DSpace.kt +++ b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/Euclidean3DSpace.kt @@ -1,9 +1,9 @@ -package kscience.kmath.geometry +package space.kscience.kmath.geometry -import kscience.kmath.linear.Point -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.operations.SpaceElement -import kscience.kmath.operations.invoke +import space.kscience.kmath.linear.Point +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.operations.SpaceElement +import space.kscience.kmath.operations.invoke import kotlin.math.sqrt @OptIn(UnstableKMathAPI::class) diff --git a/kmath-geometry/src/commonMain/kotlin/kscience/kmath/geometry/GeometrySpace.kt b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/GeometrySpace.kt similarity index 74% rename from kmath-geometry/src/commonMain/kotlin/kscience/kmath/geometry/GeometrySpace.kt rename to kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/GeometrySpace.kt index 54d2510cf..392156e9f 100644 --- a/kmath-geometry/src/commonMain/kotlin/kscience/kmath/geometry/GeometrySpace.kt +++ b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/GeometrySpace.kt @@ -1,6 +1,6 @@ -package kscience.kmath.geometry +package space.kscience.kmath.geometry -import kscience.kmath.operations.Space +import space.kscience.kmath.operations.Space public interface Vector diff --git a/kmath-geometry/src/commonMain/kotlin/kscience/kmath/geometry/Line.kt b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/Line.kt similarity index 79% rename from kmath-geometry/src/commonMain/kotlin/kscience/kmath/geometry/Line.kt rename to kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/Line.kt index ec2ce31ca..89cc46958 100644 --- a/kmath-geometry/src/commonMain/kotlin/kscience/kmath/geometry/Line.kt +++ b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/Line.kt @@ -1,4 +1,4 @@ -package kscience.kmath.geometry +package space.kscience.kmath.geometry public data class Line(val base: V, val direction: V) diff --git a/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/ReferenceFrame.kt b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/ReferenceFrame.kt new file mode 100644 index 000000000..9197cfed7 --- /dev/null +++ b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/ReferenceFrame.kt @@ -0,0 +1,3 @@ +package space.kscience.kmath.geometry + +public interface ReferenceFrame diff --git a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/Counters.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counters.kt similarity index 90% rename from kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/Counters.kt rename to kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counters.kt index 7a263a9fc..99613193a 100644 --- a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/Counters.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counters.kt @@ -1,4 +1,4 @@ -package kscience.kmath.histogram +package space.kscience.kmath.histogram /* * Common representation for atomic counters diff --git a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/Histogram.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Histogram.kt similarity index 86% rename from kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/Histogram.kt rename to kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Histogram.kt index 370a01215..ea8e16651 100644 --- a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/Histogram.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Histogram.kt @@ -1,9 +1,9 @@ -package kscience.kmath.histogram +package space.kscience.kmath.histogram -import kscience.kmath.domains.Domain -import kscience.kmath.linear.Point -import kscience.kmath.structures.ArrayBuffer -import kscience.kmath.structures.RealBuffer +import space.kscience.kmath.domains.Domain +import space.kscience.kmath.linear.Point +import space.kscience.kmath.structures.ArrayBuffer +import space.kscience.kmath.structures.RealBuffer /** * The bin in the histogram. The histogram is by definition always done in the real space diff --git a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/RealHistogram.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/RealHistogram.kt similarity index 95% rename from kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/RealHistogram.kt rename to kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/RealHistogram.kt index 21d873806..0efd862a5 100644 --- a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/RealHistogram.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/RealHistogram.kt @@ -1,11 +1,11 @@ -package kscience.kmath.histogram +package space.kscience.kmath.histogram -import kscience.kmath.linear.Point -import kscience.kmath.nd.DefaultStrides -import kscience.kmath.nd.NDStructure -import kscience.kmath.operations.SpaceOperations -import kscience.kmath.operations.invoke -import kscience.kmath.structures.* +import space.kscience.kmath.linear.Point +import space.kscience.kmath.nd.DefaultStrides +import space.kscience.kmath.nd.NDStructure +import space.kscience.kmath.operations.SpaceOperations +import space.kscience.kmath.operations.invoke +import space.kscience.kmath.structures.* import kotlin.math.floor public data class MultivariateBinDefinition>( diff --git a/kmath-histograms/src/commonTest/kotlin/scietifik/kmath/histogram/MultivariateHistogramTest.kt b/kmath-histograms/src/commonTest/kotlin/scietifik/kmath/histogram/MultivariateHistogramTest.kt index 87a2b3e68..e19aaa296 100644 --- a/kmath-histograms/src/commonTest/kotlin/scietifik/kmath/histogram/MultivariateHistogramTest.kt +++ b/kmath-histograms/src/commonTest/kotlin/scietifik/kmath/histogram/MultivariateHistogramTest.kt @@ -1,10 +1,10 @@ package scietifik.kmath.histogram -import kscience.kmath.histogram.RealHistogram -import kscience.kmath.histogram.fill -import kscience.kmath.histogram.put -import kscience.kmath.real.RealVector -import kscience.kmath.real.invoke +import space.kscience.kmath.histogram.RealHistogram +import space.kscience.kmath.histogram.fill +import space.kscience.kmath.histogram.put +import space.kscience.kmath.real.RealVector +import space.kscience.kmath.real.invoke import kotlin.random.Random import kotlin.test.* diff --git a/kmath-histograms/src/jsMain/kotlin/kscience/kmath/histogram/Counters.kt b/kmath-histograms/src/jsMain/kotlin/space/kscience/kmath/histogram/Counters.kt similarity index 93% rename from kmath-histograms/src/jsMain/kotlin/kscience/kmath/histogram/Counters.kt rename to kmath-histograms/src/jsMain/kotlin/space/kscience/kmath/histogram/Counters.kt index d0fa1f4c2..72eedd0c5 100644 --- a/kmath-histograms/src/jsMain/kotlin/kscience/kmath/histogram/Counters.kt +++ b/kmath-histograms/src/jsMain/kotlin/space/kscience/kmath/histogram/Counters.kt @@ -1,4 +1,4 @@ -package kscience.kmath.histogram +package space.kscience.kmath.histogram public actual class LongCounter { private var sum: Long = 0L diff --git a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/Counters.kt b/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/Counters.kt similarity index 83% rename from kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/Counters.kt rename to kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/Counters.kt index efbd185ef..48e2e597d 100644 --- a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/Counters.kt +++ b/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/Counters.kt @@ -1,4 +1,4 @@ -package kscience.kmath.histogram +package space.kscience.kmath.histogram import java.util.concurrent.atomic.DoubleAdder import java.util.concurrent.atomic.LongAdder diff --git a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogram.kt b/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogram.kt similarity index 93% rename from kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogram.kt rename to kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogram.kt index 10aa9f8ca..b39f6f200 100644 --- a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogram.kt +++ b/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogram.kt @@ -1,11 +1,11 @@ -package kscience.kmath.histogram +package space.kscience.kmath.histogram -import kscience.kmath.linear.Point -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.operations.SpaceElement -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.asBuffer -import kscience.kmath.structures.asSequence +import space.kscience.kmath.linear.Point +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.operations.SpaceElement +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.asBuffer +import space.kscience.kmath.structures.asSequence import java.util.* import kotlin.math.floor diff --git a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogramSpace.kt b/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogramSpace.kt similarity index 90% rename from kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogramSpace.kt rename to kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogramSpace.kt index 0deeb0a97..13f8bfb07 100644 --- a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/UnivariateHistogramSpace.kt +++ b/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogramSpace.kt @@ -1,6 +1,6 @@ -package kscience.kmath.histogram +package space.kscience.kmath.histogram -import kscience.kmath.operations.Space +import space.kscience.kmath.operations.Space public class UnivariateHistogramSpace(public val binFactory: (Double) -> UnivariateBin) : Space { diff --git a/kmath-kotlingrad/src/main/kotlin/kscience/kmath/kotlingrad/DifferentiableMstExpression.kt b/kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/DifferentiableMstExpression.kt similarity index 80% rename from kmath-kotlingrad/src/main/kotlin/kscience/kmath/kotlingrad/DifferentiableMstExpression.kt rename to kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/DifferentiableMstExpression.kt index abde9e54d..39a7248b4 100644 --- a/kmath-kotlingrad/src/main/kotlin/kscience/kmath/kotlingrad/DifferentiableMstExpression.kt +++ b/kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/DifferentiableMstExpression.kt @@ -1,12 +1,12 @@ -package kscience.kmath.kotlingrad +package space.kscience.kmath.kotlingrad import edu.umontreal.kotlingrad.api.SFun -import kscience.kmath.ast.MST -import kscience.kmath.ast.MstAlgebra -import kscience.kmath.ast.MstExpression -import kscience.kmath.expressions.DifferentiableExpression -import kscience.kmath.expressions.Symbol -import kscience.kmath.operations.NumericAlgebra +import space.kscience.kmath.ast.MST +import space.kscience.kmath.ast.MstAlgebra +import space.kscience.kmath.ast.MstExpression +import space.kscience.kmath.expressions.DifferentiableExpression +import space.kscience.kmath.expressions.Symbol +import space.kscience.kmath.operations.NumericAlgebra /** * Represents wrapper of [MstExpression] implementing [DifferentiableExpression]. @@ -39,7 +39,7 @@ public inline class DifferentiableMstExpression(public val expr: MstExpres public override fun derivativeOrNull(symbols: List): MstExpression = MstExpression( algebra, symbols.map(Symbol::identity) - .map(MstAlgebra::symbol) + .map(MstAlgebra::bindSymbol) .map { it.toSVar>() } .fold(mst.toSFun(), SFun>::d) .toMst(), diff --git a/kmath-kotlingrad/src/main/kotlin/kscience/kmath/kotlingrad/KMathNumber.kt b/kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/KMathNumber.kt similarity index 86% rename from kmath-kotlingrad/src/main/kotlin/kscience/kmath/kotlingrad/KMathNumber.kt rename to kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/KMathNumber.kt index 2a4db4258..d2edb4376 100644 --- a/kmath-kotlingrad/src/main/kotlin/kscience/kmath/kotlingrad/KMathNumber.kt +++ b/kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/KMathNumber.kt @@ -1,8 +1,8 @@ -package kscience.kmath.kotlingrad +package space.kscience.kmath.kotlingrad import edu.umontreal.kotlingrad.api.RealNumber import edu.umontreal.kotlingrad.api.SConst -import kscience.kmath.operations.NumericAlgebra +import space.kscience.kmath.operations.NumericAlgebra /** * Implements [RealNumber] by delegating its functionality to [NumericAlgebra]. diff --git a/kmath-kotlingrad/src/main/kotlin/kscience/kmath/kotlingrad/ScalarsAdapters.kt b/kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/ScalarsAdapters.kt similarity index 92% rename from kmath-kotlingrad/src/main/kotlin/kscience/kmath/kotlingrad/ScalarsAdapters.kt rename to kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/ScalarsAdapters.kt index 8dc1d3958..6ca6bc113 100644 --- a/kmath-kotlingrad/src/main/kotlin/kscience/kmath/kotlingrad/ScalarsAdapters.kt +++ b/kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/ScalarsAdapters.kt @@ -1,11 +1,11 @@ -package kscience.kmath.kotlingrad +package space.kscience.kmath.kotlingrad import edu.umontreal.kotlingrad.api.* -import kscience.kmath.ast.MST -import kscience.kmath.ast.MstAlgebra -import kscience.kmath.ast.MstExtendedField -import kscience.kmath.ast.MstExtendedField.unaryMinus -import kscience.kmath.operations.* +import space.kscience.kmath.ast.MST +import space.kscience.kmath.ast.MstAlgebra +import space.kscience.kmath.ast.MstExtendedField +import space.kscience.kmath.ast.MstExtendedField.unaryMinus +import space.kscience.kmath.operations.* /** * Maps [SVar] to [MST.Symbolic] directly. @@ -13,7 +13,7 @@ import kscience.kmath.operations.* * @receiver the variable. * @return a node. */ -public fun > SVar.toMst(): MST.Symbolic = MstAlgebra.symbol(name) +public fun > SVar.toMst(): MST.Symbolic = MstAlgebra.bindSymbol(name) /** * Maps [SVar] to [MST.Numeric] directly. @@ -29,7 +29,7 @@ public fun > SConst.toMst(): MST.Numeric = MstAlgebra.number(doub * * Detailed mapping is: * - * - [SVar] -> [MstExtendedField.symbol]; + * - [SVar] -> [MstExtendedField.bindSymbol]; * - [SConst] -> [MstExtendedField.number]; * - [Sum] -> [MstExtendedField.add]; * - [Prod] -> [MstExtendedField.multiply]; diff --git a/kmath-kotlingrad/src/test/kotlin/kscience/kmath/kotlingrad/AdaptingTests.kt b/kmath-kotlingrad/src/test/kotlin/space/kscience/kmath/kotlingrad/AdaptingTests.kt similarity index 79% rename from kmath-kotlingrad/src/test/kotlin/kscience/kmath/kotlingrad/AdaptingTests.kt rename to kmath-kotlingrad/src/test/kotlin/space/kscience/kmath/kotlingrad/AdaptingTests.kt index aa4ddd703..ffdabaffb 100644 --- a/kmath-kotlingrad/src/test/kotlin/kscience/kmath/kotlingrad/AdaptingTests.kt +++ b/kmath-kotlingrad/src/test/kotlin/space/kscience/kmath/kotlingrad/AdaptingTests.kt @@ -1,12 +1,12 @@ -package kscience.kmath.kotlingrad +package space.kscience.kmath.kotlingrad import edu.umontreal.kotlingrad.api.* -import kscience.kmath.asm.compile -import kscience.kmath.ast.MstAlgebra -import kscience.kmath.ast.MstExpression -import kscience.kmath.ast.parseMath -import kscience.kmath.expressions.invoke -import kscience.kmath.operations.RealField +import space.kscience.kmath.asm.compile +import space.kscience.kmath.ast.MstAlgebra +import space.kscience.kmath.ast.MstExpression +import space.kscience.kmath.ast.parseMath +import space.kscience.kmath.expressions.invoke +import space.kscience.kmath.operations.RealField import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue @@ -15,7 +15,7 @@ import kotlin.test.fail internal class AdaptingTests { @Test fun symbol() { - val c1 = MstAlgebra.symbol("x") + val c1 = MstAlgebra.bindSymbol("x") assertTrue(c1.toSVar>().name == "x") val c2 = "kitten".parseMath().toSFun>() if (c2 is SVar) assertTrue(c2.name == "kitten") else fail() @@ -41,7 +41,7 @@ internal class AdaptingTests { @Test fun simpleFunctionDerivative() { - val x = MstAlgebra.symbol("x").toSVar>() + val x = MstAlgebra.bindSymbol("x").toSVar>() val quadratic = "x^2-4*x-44".parseMath().toSFun>() val actualDerivative = MstExpression(RealField, quadratic.d(x).toMst()).compile() val expectedDerivative = MstExpression(RealField, "2*x-4".parseMath()).compile() @@ -50,7 +50,7 @@ internal class AdaptingTests { @Test fun moreComplexDerivative() { - val x = MstAlgebra.symbol("x").toSVar>() + val x = MstAlgebra.bindSymbol("x").toSVar>() val composition = "-sqrt(sin(x^2)-cos(x)^2-16*x)".parseMath().toSFun>() val actualDerivative = MstExpression(RealField, composition.d(x).toMst()).compile() diff --git a/kmath-memory/api/kmath-memory.api b/kmath-memory/api/kmath-memory.api index 88b6be1d4..9c9641461 100644 --- a/kmath-memory/api/kmath-memory.api +++ b/kmath-memory/api/kmath-memory.api @@ -1,43 +1,43 @@ -public final class kscience/kmath/memory/ByteBufferMemory : kscience/kmath/memory/Memory { +public final class space/kscience/kmath/memory/ByteBufferMemory : space/kscience/kmath/memory/Memory { public fun (Ljava/nio/ByteBuffer;II)V public synthetic fun (Ljava/nio/ByteBuffer;IIILkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun copy ()Lkscience/kmath/memory/Memory; + public fun copy ()Lspace/kscience/kmath/memory/Memory; public final fun getBuffer ()Ljava/nio/ByteBuffer; public fun getSize ()I public final fun getStartOffset ()I - public fun reader ()Lkscience/kmath/memory/MemoryReader; - public fun view (II)Lkscience/kmath/memory/Memory; - public fun writer ()Lkscience/kmath/memory/MemoryWriter; + public fun reader ()Lspace/kscience/kmath/memory/MemoryReader; + public fun view (II)Lspace/kscience/kmath/memory/Memory; + public fun writer ()Lspace/kscience/kmath/memory/MemoryWriter; } -public final class kscience/kmath/memory/ByteBufferMemoryKt { - public static final fun allocate (Lkscience/kmath/memory/Memory$Companion;I)Lkscience/kmath/memory/Memory; - public static final fun asMemory (Ljava/nio/ByteBuffer;II)Lkscience/kmath/memory/Memory; - public static synthetic fun asMemory$default (Ljava/nio/ByteBuffer;IIILjava/lang/Object;)Lkscience/kmath/memory/Memory; +public final class space/kscience/kmath/memory/ByteBufferMemoryKt { + public static final fun allocate (Lspace/kscience/kmath/memory/Memory$Companion;I)Lspace/kscience/kmath/memory/Memory; + public static final fun asMemory (Ljava/nio/ByteBuffer;II)Lspace/kscience/kmath/memory/Memory; + public static synthetic fun asMemory$default (Ljava/nio/ByteBuffer;IIILjava/lang/Object;)Lspace/kscience/kmath/memory/Memory; public static final fun readAsMemory (Ljava/nio/file/Path;JJLkotlin/jvm/functions/Function1;)Ljava/lang/Object; public static synthetic fun readAsMemory$default (Ljava/nio/file/Path;JJLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/Object; - public static final fun wrap (Lkscience/kmath/memory/Memory$Companion;[B)Lkscience/kmath/memory/Memory; + public static final fun wrap (Lspace/kscience/kmath/memory/Memory$Companion;[B)Lspace/kscience/kmath/memory/Memory; } -public abstract interface class kscience/kmath/memory/Memory { - public static final field Companion Lkscience/kmath/memory/Memory$Companion; - public abstract fun copy ()Lkscience/kmath/memory/Memory; +public abstract interface class space/kscience/kmath/memory/Memory { + public static final field Companion Lspace/kscience/kmath/memory/Memory$Companion; + public abstract fun copy ()Lspace/kscience/kmath/memory/Memory; public abstract fun getSize ()I - public abstract fun reader ()Lkscience/kmath/memory/MemoryReader; - public abstract fun view (II)Lkscience/kmath/memory/Memory; - public abstract fun writer ()Lkscience/kmath/memory/MemoryWriter; + public abstract fun reader ()Lspace/kscience/kmath/memory/MemoryReader; + public abstract fun view (II)Lspace/kscience/kmath/memory/Memory; + public abstract fun writer ()Lspace/kscience/kmath/memory/MemoryWriter; } -public final class kscience/kmath/memory/Memory$Companion { +public final class space/kscience/kmath/memory/Memory$Companion { } -public final class kscience/kmath/memory/MemoryKt { - public static final fun read (Lkscience/kmath/memory/Memory;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun write (Lkscience/kmath/memory/Memory;Lkotlin/jvm/functions/Function1;)V +public final class space/kscience/kmath/memory/MemoryKt { + public static final fun read (Lspace/kscience/kmath/memory/Memory;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final fun write (Lspace/kscience/kmath/memory/Memory;Lkotlin/jvm/functions/Function1;)V } -public abstract interface class kscience/kmath/memory/MemoryReader { - public abstract fun getMemory ()Lkscience/kmath/memory/Memory; +public abstract interface class space/kscience/kmath/memory/MemoryReader { + public abstract fun getMemory ()Lspace/kscience/kmath/memory/Memory; public abstract fun readByte (I)B public abstract fun readDouble (I)D public abstract fun readFloat (I)F @@ -47,20 +47,20 @@ public abstract interface class kscience/kmath/memory/MemoryReader { public abstract fun release ()V } -public abstract interface class kscience/kmath/memory/MemorySpec { +public abstract interface class space/kscience/kmath/memory/MemorySpec { public abstract fun getObjectSize ()I - public abstract fun read (Lkscience/kmath/memory/MemoryReader;I)Ljava/lang/Object; - public abstract fun write (Lkscience/kmath/memory/MemoryWriter;ILjava/lang/Object;)V + public abstract fun read (Lspace/kscience/kmath/memory/MemoryReader;I)Ljava/lang/Object; + public abstract fun write (Lspace/kscience/kmath/memory/MemoryWriter;ILjava/lang/Object;)V } -public final class kscience/kmath/memory/MemorySpecKt { - public static final fun read (Lkscience/kmath/memory/MemoryReader;Lkscience/kmath/memory/MemorySpec;I)Ljava/lang/Object; - public static final fun write (Lkscience/kmath/memory/MemoryWriter;Lkscience/kmath/memory/MemorySpec;ILjava/lang/Object;)V - public static final fun writeArray (Lkscience/kmath/memory/MemoryWriter;Lkscience/kmath/memory/MemorySpec;I[Ljava/lang/Object;)V +public final class space/kscience/kmath/memory/MemorySpecKt { + public static final fun read (Lspace/kscience/kmath/memory/MemoryReader;Lspace/kscience/kmath/memory/MemorySpec;I)Ljava/lang/Object; + public static final fun write (Lspace/kscience/kmath/memory/MemoryWriter;Lspace/kscience/kmath/memory/MemorySpec;ILjava/lang/Object;)V + public static final fun writeArray (Lspace/kscience/kmath/memory/MemoryWriter;Lspace/kscience/kmath/memory/MemorySpec;I[Ljava/lang/Object;)V } -public abstract interface class kscience/kmath/memory/MemoryWriter { - public abstract fun getMemory ()Lkscience/kmath/memory/Memory; +public abstract interface class space/kscience/kmath/memory/MemoryWriter { + public abstract fun getMemory ()Lspace/kscience/kmath/memory/Memory; public abstract fun release ()V public abstract fun writeByte (IB)V public abstract fun writeDouble (ID)V diff --git a/kmath-memory/src/commonMain/kotlin/kscience/kmath/memory/Memory.kt b/kmath-memory/src/commonMain/kotlin/space/kscience/kmath/memory/Memory.kt similarity index 98% rename from kmath-memory/src/commonMain/kotlin/kscience/kmath/memory/Memory.kt rename to kmath-memory/src/commonMain/kotlin/space/kscience/kmath/memory/Memory.kt index 344a1f1d3..a18d25f7b 100644 --- a/kmath-memory/src/commonMain/kotlin/kscience/kmath/memory/Memory.kt +++ b/kmath-memory/src/commonMain/kotlin/space/kscience/kmath/memory/Memory.kt @@ -1,4 +1,4 @@ -package kscience.kmath.memory +package space.kscience.kmath.memory import kotlin.contracts.InvocationKind import kotlin.contracts.contract diff --git a/kmath-memory/src/commonMain/kotlin/kscience/kmath/memory/MemorySpec.kt b/kmath-memory/src/commonMain/kotlin/space/kscience/kmath/memory/MemorySpec.kt similarity index 97% rename from kmath-memory/src/commonMain/kotlin/kscience/kmath/memory/MemorySpec.kt rename to kmath-memory/src/commonMain/kotlin/space/kscience/kmath/memory/MemorySpec.kt index 572dab0fa..7c68e3abb 100644 --- a/kmath-memory/src/commonMain/kotlin/kscience/kmath/memory/MemorySpec.kt +++ b/kmath-memory/src/commonMain/kotlin/space/kscience/kmath/memory/MemorySpec.kt @@ -1,4 +1,4 @@ -package kscience.kmath.memory +package space.kscience.kmath.memory /** * A specification to read or write custom objects with fixed size in bytes. diff --git a/kmath-memory/src/jsMain/kotlin/kscience/kmath/memory/DataViewMemory.kt b/kmath-memory/src/jsMain/kotlin/space/kscience/kmath/memory/DataViewMemory.kt similarity index 98% rename from kmath-memory/src/jsMain/kotlin/kscience/kmath/memory/DataViewMemory.kt rename to kmath-memory/src/jsMain/kotlin/space/kscience/kmath/memory/DataViewMemory.kt index 2146cd4e1..38ea8a62e 100644 --- a/kmath-memory/src/jsMain/kotlin/kscience/kmath/memory/DataViewMemory.kt +++ b/kmath-memory/src/jsMain/kotlin/space/kscience/kmath/memory/DataViewMemory.kt @@ -1,4 +1,4 @@ -package kscience.kmath.memory +package space.kscience.kmath.memory import org.khronos.webgl.ArrayBuffer import org.khronos.webgl.DataView diff --git a/kmath-memory/src/jvmMain/kotlin/kscience/kmath/memory/ByteBufferMemory.kt b/kmath-memory/src/jvmMain/kotlin/space/kscience/kmath/memory/ByteBufferMemory.kt similarity index 99% rename from kmath-memory/src/jvmMain/kotlin/kscience/kmath/memory/ByteBufferMemory.kt rename to kmath-memory/src/jvmMain/kotlin/space/kscience/kmath/memory/ByteBufferMemory.kt index 7a75b423e..5145b1ed4 100644 --- a/kmath-memory/src/jvmMain/kotlin/kscience/kmath/memory/ByteBufferMemory.kt +++ b/kmath-memory/src/jvmMain/kotlin/space/kscience/kmath/memory/ByteBufferMemory.kt @@ -1,4 +1,4 @@ -package kscience.kmath.memory +package space.kscience.kmath.memory import java.io.IOException import java.nio.ByteBuffer diff --git a/kmath-memory/src/nativeMain/kotlin/kscience/kmath/memory/NativeMemory.kt b/kmath-memory/src/nativeMain/kotlin/space/kscience/kmath/memory/NativeMemory.kt similarity index 98% rename from kmath-memory/src/nativeMain/kotlin/kscience/kmath/memory/NativeMemory.kt rename to kmath-memory/src/nativeMain/kotlin/space/kscience/kmath/memory/NativeMemory.kt index 0e007a8ab..3afb6c7a2 100644 --- a/kmath-memory/src/nativeMain/kotlin/kscience/kmath/memory/NativeMemory.kt +++ b/kmath-memory/src/nativeMain/kotlin/space/kscience/kmath/memory/NativeMemory.kt @@ -1,4 +1,4 @@ -package kscience.kmath.memory +package space.kscience.kmath.memory @PublishedApi internal class NativeMemory( diff --git a/kmath-nd4j/src/main/kotlin/kscience.kmath.nd4j/Nd4jArrayAlgebra.kt b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt similarity index 98% rename from kmath-nd4j/src/main/kotlin/kscience.kmath.nd4j/Nd4jArrayAlgebra.kt rename to kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt index b9c95034e..1e9818a4a 100644 --- a/kmath-nd4j/src/main/kotlin/kscience.kmath.nd4j/Nd4jArrayAlgebra.kt +++ b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt @@ -1,11 +1,11 @@ -package kscience.kmath.nd4j +package space.kscience.kmath.nd4j -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.nd.* -import kscience.kmath.operations.* -import kscience.kmath.structures.* import org.nd4j.linalg.api.ndarray.INDArray import org.nd4j.linalg.factory.Nd4j +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.nd.* +import space.kscience.kmath.operations.* +import space.kscience.kmath.structures.* internal fun NDAlgebra<*, *>.checkShape(array: INDArray): INDArray { val arrayShape = array.shape().toIntArray() diff --git a/kmath-nd4j/src/main/kotlin/kscience.kmath.nd4j/Nd4jArrayIterator.kt b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayIterator.kt similarity index 98% rename from kmath-nd4j/src/main/kotlin/kscience.kmath.nd4j/Nd4jArrayIterator.kt rename to kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayIterator.kt index 1463a92fe..521c8cab3 100644 --- a/kmath-nd4j/src/main/kotlin/kscience.kmath.nd4j/Nd4jArrayIterator.kt +++ b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayIterator.kt @@ -1,4 +1,4 @@ -package kscience.kmath.nd4j +package space.kscience.kmath.nd4j import org.nd4j.linalg.api.ndarray.INDArray import org.nd4j.linalg.api.shape.Shape diff --git a/kmath-nd4j/src/main/kotlin/kscience.kmath.nd4j/Nd4jArrayStructure.kt b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructure.kt similarity index 95% rename from kmath-nd4j/src/main/kotlin/kscience.kmath.nd4j/Nd4jArrayStructure.kt rename to kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructure.kt index 2a6b56602..415c908a8 100644 --- a/kmath-nd4j/src/main/kotlin/kscience.kmath.nd4j/Nd4jArrayStructure.kt +++ b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructure.kt @@ -1,8 +1,8 @@ -package kscience.kmath.nd4j +package space.kscience.kmath.nd4j -import kscience.kmath.nd.MutableNDStructure -import kscience.kmath.nd.NDStructure import org.nd4j.linalg.api.ndarray.INDArray +import space.kscience.kmath.nd.MutableNDStructure +import space.kscience.kmath.nd.NDStructure /** * Represents a [NDStructure] wrapping an [INDArray] object. diff --git a/kmath-nd4j/src/main/kotlin/kscience.kmath.nd4j/arrays.kt b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/arrays.kt similarity index 83% rename from kmath-nd4j/src/main/kotlin/kscience.kmath.nd4j/arrays.kt rename to kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/arrays.kt index 798f81c35..519c660e8 100644 --- a/kmath-nd4j/src/main/kotlin/kscience.kmath.nd4j/arrays.kt +++ b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/arrays.kt @@ -1,4 +1,4 @@ -package kscience.kmath.nd4j +package space.kscience.kmath.nd4j internal fun IntArray.toLongArray(): LongArray = LongArray(size) { this[it].toLong() } internal fun LongArray.toIntArray(): IntArray = IntArray(size) { this[it].toInt() } diff --git a/kmath-nd4j/src/test/kotlin/kscience/kmath/nd4j/Nd4jArrayAlgebraTest.kt b/kmath-nd4j/src/test/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebraTest.kt similarity index 77% rename from kmath-nd4j/src/test/kotlin/kscience/kmath/nd4j/Nd4jArrayAlgebraTest.kt rename to kmath-nd4j/src/test/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebraTest.kt index 04959d290..9a067aa29 100644 --- a/kmath-nd4j/src/test/kotlin/kscience/kmath/nd4j/Nd4jArrayAlgebraTest.kt +++ b/kmath-nd4j/src/test/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebraTest.kt @@ -1,6 +1,5 @@ -package kscience.kmath.nd4j +package space.kscience.kmath.nd4j -import kscience.kmath.operations.invoke import org.nd4j.linalg.factory.Nd4j import kotlin.test.Test import kotlin.test.assertEquals @@ -9,7 +8,7 @@ import kotlin.test.fail internal class Nd4jArrayAlgebraTest { @Test fun testProduce() { - val res = (RealNd4jArrayField(intArrayOf(2, 2))) { produce { it.sum().toDouble() } } + val res = with(RealNd4jArrayField(intArrayOf(2, 2))){ produce { it.sum().toDouble() } } val expected = (Nd4j.create(2, 2) ?: fail()).asRealStructure() expected[intArrayOf(0, 0)] = 0.0 expected[intArrayOf(0, 1)] = 1.0 @@ -20,7 +19,7 @@ internal class Nd4jArrayAlgebraTest { @Test fun testMap() { - val res = (IntNd4jArrayRing(intArrayOf(2, 2))) { one.map() { it + it * 2 } } + val res = with(IntNd4jArrayRing(intArrayOf(2, 2))) { one.map() { it + it * 2 } } val expected = (Nd4j.create(2, 2) ?: fail()).asIntStructure() expected[intArrayOf(0, 0)] = 3 expected[intArrayOf(0, 1)] = 3 @@ -31,7 +30,7 @@ internal class Nd4jArrayAlgebraTest { @Test fun testAdd() { - val res = (IntNd4jArrayRing(intArrayOf(2, 2))) { one + 25 } + val res = with(IntNd4jArrayRing(intArrayOf(2, 2))) { one + 25 } val expected = (Nd4j.create(2, 2) ?: fail()).asIntStructure() expected[intArrayOf(0, 0)] = 26 expected[intArrayOf(0, 1)] = 26 diff --git a/kmath-nd4j/src/test/kotlin/kscience/kmath/nd4j/Nd4jArrayStructureTest.kt b/kmath-nd4j/src/test/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructureTest.kt similarity index 96% rename from kmath-nd4j/src/test/kotlin/kscience/kmath/nd4j/Nd4jArrayStructureTest.kt rename to kmath-nd4j/src/test/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructureTest.kt index 2f1606061..03369127d 100644 --- a/kmath-nd4j/src/test/kotlin/kscience/kmath/nd4j/Nd4jArrayStructureTest.kt +++ b/kmath-nd4j/src/test/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructureTest.kt @@ -1,7 +1,7 @@ -package kscience.kmath.nd4j +package space.kscience.kmath.nd4j -import kscience.kmath.nd.get import org.nd4j.linalg.factory.Nd4j +import space.kscience.kmath.nd.get import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNotEquals diff --git a/kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/Distribution.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Distribution.kt similarity index 90% rename from kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/Distribution.kt rename to kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Distribution.kt index c4ceb29eb..fa38dd9e4 100644 --- a/kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/Distribution.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Distribution.kt @@ -1,9 +1,9 @@ -package kscience.kmath.stat +package space.kscience.kmath.stat -import kscience.kmath.chains.Chain -import kscience.kmath.chains.collect -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.BufferFactory +import space.kscience.kmath.chains.Chain +import space.kscience.kmath.chains.collect +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.BufferFactory public interface Sampler { public fun sample(generator: RandomGenerator): Chain diff --git a/kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/FactorizedDistribution.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/FactorizedDistribution.kt similarity index 92% rename from kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/FactorizedDistribution.kt rename to kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/FactorizedDistribution.kt index 1ed9deba9..ff7a13652 100644 --- a/kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/FactorizedDistribution.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/FactorizedDistribution.kt @@ -1,7 +1,7 @@ -package kscience.kmath.stat +package space.kscience.kmath.stat -import kscience.kmath.chains.Chain -import kscience.kmath.chains.SimpleChain +import space.kscience.kmath.chains.Chain +import space.kscience.kmath.chains.SimpleChain /** * A multivariate distribution which takes a map of parameters diff --git a/kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/Fitting.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Fitting.kt similarity index 89% rename from kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/Fitting.kt rename to kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Fitting.kt index 9d4655df2..b006c8ba2 100644 --- a/kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/Fitting.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Fitting.kt @@ -1,9 +1,9 @@ -package kscience.kmath.stat +package space.kscience.kmath.stat -import kscience.kmath.expressions.* -import kscience.kmath.operations.ExtendedField -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.indices +import space.kscience.kmath.expressions.* +import space.kscience.kmath.operations.ExtendedField +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.indices import kotlin.math.pow public object Fitting { diff --git a/kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/MCScope.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/MCScope.kt similarity index 98% rename from kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/MCScope.kt rename to kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/MCScope.kt index 5dc567db8..d89d74914 100644 --- a/kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/MCScope.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/MCScope.kt @@ -1,4 +1,4 @@ -package kscience.kmath.stat +package space.kscience.kmath.stat import kotlinx.coroutines.* import kotlin.coroutines.CoroutineContext diff --git a/kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/OptimizationProblem.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/OptimizationProblem.kt similarity index 93% rename from kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/OptimizationProblem.kt rename to kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/OptimizationProblem.kt index 0f3cd9dd9..71f3096de 100644 --- a/kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/OptimizationProblem.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/OptimizationProblem.kt @@ -1,8 +1,8 @@ -package kscience.kmath.stat +package space.kscience.kmath.stat -import kscience.kmath.expressions.DifferentiableExpression -import kscience.kmath.expressions.Expression -import kscience.kmath.expressions.Symbol +import space.kscience.kmath.expressions.DifferentiableExpression +import space.kscience.kmath.expressions.Expression +import space.kscience.kmath.expressions.Symbol public interface OptimizationFeature diff --git a/kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/RandomChain.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/RandomChain.kt similarity index 85% rename from kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/RandomChain.kt rename to kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/RandomChain.kt index 0f10851b9..881eabdac 100644 --- a/kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/RandomChain.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/RandomChain.kt @@ -1,6 +1,6 @@ -package kscience.kmath.stat +package space.kscience.kmath.stat -import kscience.kmath.chains.Chain +import space.kscience.kmath.chains.Chain /** * A possibly stateful chain producing random values. diff --git a/kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/RandomGenerator.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/RandomGenerator.kt similarity index 99% rename from kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/RandomGenerator.kt rename to kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/RandomGenerator.kt index da8ffaf3a..1a4f3b75d 100644 --- a/kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/RandomGenerator.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/RandomGenerator.kt @@ -1,4 +1,4 @@ -package kscience.kmath.stat +package space.kscience.kmath.stat import kotlin.random.Random diff --git a/kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/SamplerAlgebra.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/SamplerAlgebra.kt similarity index 77% rename from kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/SamplerAlgebra.kt rename to kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/SamplerAlgebra.kt index f416028a5..9fed91e1f 100644 --- a/kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/SamplerAlgebra.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/SamplerAlgebra.kt @@ -1,11 +1,11 @@ -package kscience.kmath.stat +package space.kscience.kmath.stat -import kscience.kmath.chains.Chain -import kscience.kmath.chains.ConstantChain -import kscience.kmath.chains.map -import kscience.kmath.chains.zip -import kscience.kmath.operations.Space -import kscience.kmath.operations.invoke +import space.kscience.kmath.chains.Chain +import space.kscience.kmath.chains.ConstantChain +import space.kscience.kmath.chains.map +import space.kscience.kmath.chains.zip +import space.kscience.kmath.operations.Space +import space.kscience.kmath.operations.invoke public class BasicSampler(public val chainBuilder: (RandomGenerator) -> Chain) : Sampler { public override fun sample(generator: RandomGenerator): Chain = chainBuilder(generator) diff --git a/kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/Statistic.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Statistic.kt similarity index 92% rename from kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/Statistic.kt rename to kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Statistic.kt index a4624fc21..29ded2b88 100644 --- a/kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/Statistic.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Statistic.kt @@ -1,4 +1,4 @@ -package kscience.kmath.stat +package space.kscience.kmath.stat import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers @@ -7,11 +7,11 @@ import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.runningReduce -import kscience.kmath.coroutines.mapParallel -import kscience.kmath.operations.* -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.asIterable -import kscience.kmath.structures.asSequence +import space.kscience.kmath.coroutines.mapParallel +import space.kscience.kmath.operations.* +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.asIterable +import space.kscience.kmath.structures.asSequence /** * A function, that transforms a buffer of random quantities to some resulting value diff --git a/kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/UniformDistribution.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/UniformDistribution.kt similarity index 85% rename from kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/UniformDistribution.kt rename to kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/UniformDistribution.kt index 1ba5c96f1..4fc0905b8 100644 --- a/kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/UniformDistribution.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/UniformDistribution.kt @@ -1,7 +1,7 @@ -package kscience.kmath.stat +package space.kscience.kmath.stat -import kscience.kmath.chains.Chain -import kscience.kmath.chains.SimpleChain +import space.kscience.kmath.chains.Chain +import space.kscience.kmath.chains.SimpleChain public class UniformDistribution(public val range: ClosedFloatingPointRange) : UnivariateDistribution { private val length: Double = range.endInclusive - range.start diff --git a/kmath-stat/src/jvmMain/kotlin/kscience/kmath/stat/RandomSourceGenerator.kt b/kmath-stat/src/jvmMain/kotlin/space/kscience/kmath/stat/RandomSourceGenerator.kt similarity index 98% rename from kmath-stat/src/jvmMain/kotlin/kscience/kmath/stat/RandomSourceGenerator.kt rename to kmath-stat/src/jvmMain/kotlin/space/kscience/kmath/stat/RandomSourceGenerator.kt index 5cba28a95..9e752d571 100644 --- a/kmath-stat/src/jvmMain/kotlin/kscience/kmath/stat/RandomSourceGenerator.kt +++ b/kmath-stat/src/jvmMain/kotlin/space/kscience/kmath/stat/RandomSourceGenerator.kt @@ -1,4 +1,4 @@ -package kscience.kmath.stat +package space.kscience.kmath.stat import org.apache.commons.rng.UniformRandomProvider import org.apache.commons.rng.simple.RandomSource diff --git a/kmath-stat/src/jvmMain/kotlin/kscience/kmath/stat/distributions.kt b/kmath-stat/src/jvmMain/kotlin/space/kscience/kmath/stat/distributions.kt similarity index 95% rename from kmath-stat/src/jvmMain/kotlin/kscience/kmath/stat/distributions.kt rename to kmath-stat/src/jvmMain/kotlin/space/kscience/kmath/stat/distributions.kt index 6cc18a37c..d33b54818 100644 --- a/kmath-stat/src/jvmMain/kotlin/kscience/kmath/stat/distributions.kt +++ b/kmath-stat/src/jvmMain/kotlin/space/kscience/kmath/stat/distributions.kt @@ -1,10 +1,10 @@ -package kscience.kmath.stat +package space.kscience.kmath.stat -import kscience.kmath.chains.BlockingIntChain -import kscience.kmath.chains.BlockingRealChain -import kscience.kmath.chains.Chain import org.apache.commons.rng.UniformRandomProvider import org.apache.commons.rng.sampling.distribution.* +import space.kscience.kmath.chains.BlockingIntChain +import space.kscience.kmath.chains.BlockingRealChain +import space.kscience.kmath.chains.Chain import kotlin.math.PI import kotlin.math.exp import kotlin.math.pow diff --git a/kmath-stat/src/jvmTest/kotlin/kscience/kmath/stat/CommonsDistributionsTest.kt b/kmath-stat/src/jvmTest/kotlin/space/kscience/kmath/stat/CommonsDistributionsTest.kt similarity index 96% rename from kmath-stat/src/jvmTest/kotlin/kscience/kmath/stat/CommonsDistributionsTest.kt rename to kmath-stat/src/jvmTest/kotlin/space/kscience/kmath/stat/CommonsDistributionsTest.kt index fe58fac08..70708a5c8 100644 --- a/kmath-stat/src/jvmTest/kotlin/kscience/kmath/stat/CommonsDistributionsTest.kt +++ b/kmath-stat/src/jvmTest/kotlin/space/kscience/kmath/stat/CommonsDistributionsTest.kt @@ -1,4 +1,4 @@ -package kscience.kmath.stat +package space.kscience.kmath.stat import kotlinx.coroutines.flow.take import kotlinx.coroutines.flow.toList diff --git a/kmath-stat/src/jvmTest/kotlin/kscience/kmath/stat/MCScopeTest.kt b/kmath-stat/src/jvmTest/kotlin/space/kscience/kmath/stat/MCScopeTest.kt similarity index 97% rename from kmath-stat/src/jvmTest/kotlin/kscience/kmath/stat/MCScopeTest.kt rename to kmath-stat/src/jvmTest/kotlin/space/kscience/kmath/stat/MCScopeTest.kt index 4e29e6105..9eada43f9 100644 --- a/kmath-stat/src/jvmTest/kotlin/kscience/kmath/stat/MCScopeTest.kt +++ b/kmath-stat/src/jvmTest/kotlin/space/kscience/kmath/stat/MCScopeTest.kt @@ -1,8 +1,7 @@ -package kscience.kmath.stat +package space.kscience.kmath.stat import kotlinx.coroutines.* import java.util.* -import kotlin.collections.HashSet import kotlin.test.Test import kotlin.test.assertEquals diff --git a/kmath-stat/src/jvmTest/kotlin/kscience/kmath/stat/SamplerTest.kt b/kmath-stat/src/jvmTest/kotlin/space/kscience/kmath/stat/SamplerTest.kt similarity index 91% rename from kmath-stat/src/jvmTest/kotlin/kscience/kmath/stat/SamplerTest.kt rename to kmath-stat/src/jvmTest/kotlin/space/kscience/kmath/stat/SamplerTest.kt index afed4c5d0..244b5107f 100644 --- a/kmath-stat/src/jvmTest/kotlin/kscience/kmath/stat/SamplerTest.kt +++ b/kmath-stat/src/jvmTest/kotlin/space/kscience/kmath/stat/SamplerTest.kt @@ -1,4 +1,4 @@ -package kscience.kmath.stat +package space.kscience.kmath.stat import kotlinx.coroutines.runBlocking import kotlin.test.Test diff --git a/kmath-stat/src/jvmTest/kotlin/kscience/kmath/stat/StatisticTest.kt b/kmath-stat/src/jvmTest/kotlin/space/kscience/kmath/stat/StatisticTest.kt similarity index 90% rename from kmath-stat/src/jvmTest/kotlin/kscience/kmath/stat/StatisticTest.kt rename to kmath-stat/src/jvmTest/kotlin/space/kscience/kmath/stat/StatisticTest.kt index 5cee4d172..156e618f9 100644 --- a/kmath-stat/src/jvmTest/kotlin/kscience/kmath/stat/StatisticTest.kt +++ b/kmath-stat/src/jvmTest/kotlin/space/kscience/kmath/stat/StatisticTest.kt @@ -1,10 +1,10 @@ -package kscience.kmath.stat +package space.kscience.kmath.stat import kotlinx.coroutines.flow.drop import kotlinx.coroutines.flow.first import kotlinx.coroutines.runBlocking -import kscience.kmath.streaming.chunked +import space.kscience.kmath.streaming.chunked import kotlin.test.Test internal class StatisticTest { diff --git a/kmath-viktor/api/kmath-viktor.api b/kmath-viktor/api/kmath-viktor.api index cbfaeb8d5..13da08a39 100644 --- a/kmath-viktor/api/kmath-viktor.api +++ b/kmath-viktor/api/kmath-viktor.api @@ -1,10 +1,10 @@ -public final class kscience/kmath/viktor/ViktorBuffer : kscience/kmath/structures/MutableBuffer { - public static final synthetic fun box-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;)Lkscience/kmath/viktor/ViktorBuffer; +public final class space/kscience/kmath/viktor/ViktorBuffer : space/kscience/kmath/structures/MutableBuffer { + public static final synthetic fun box-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;)Lspace/kscience/kmath/viktor/ViktorBuffer; public static fun constructor-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;)Lorg/jetbrains/bio/viktor/F64FlatArray; - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;Lkscience/kmath/structures/Buffer;)Z - public fun copy ()Lkscience/kmath/structures/MutableBuffer; - public static fun copy-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;)Lkscience/kmath/structures/MutableBuffer; + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;Lspace/kscience/kmath/structures/Buffer;)Z + public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; + public static fun copy-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;)Lspace/kscience/kmath/structures/MutableBuffer; public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;Ljava/lang/Object;)Z public static final fun equals-impl0 (Lorg/jetbrains/bio/viktor/F64FlatArray;Lorg/jetbrains/bio/viktor/F64FlatArray;)Z @@ -26,133 +26,133 @@ public final class kscience/kmath/viktor/ViktorBuffer : kscience/kmath/structure public final synthetic fun unbox-impl ()Lorg/jetbrains/bio/viktor/F64FlatArray; } -public final class kscience/kmath/viktor/ViktorNDField : kscience/kmath/nd/NDField, kscience/kmath/operations/ExtendedField, kscience/kmath/operations/RingWithNumbers { +public final class space/kscience/kmath/viktor/ViktorNDField : space/kscience/kmath/nd/NDField, space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/RingWithNumbers { public fun ([I)V public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; - public fun acos-02gLDOA (Lkscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; + public fun acos-Q7Xurp0 (Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun acosh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun acosh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public synthetic fun add (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun add-frQ_39w (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; + public synthetic fun add (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun add-s8yP2C4 (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; - public fun asin-02gLDOA (Lkscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; + public fun asin-Q7Xurp0 (Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun asinh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun asinh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; - public fun atan-02gLDOA (Lkscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; + public fun atan-Q7Xurp0 (Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun atanh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun atanh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun combine (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDStructure; - public fun combine-C8Lp-Ak (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lorg/jetbrains/bio/viktor/F64Array; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/nd/NDStructure; + public synthetic fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; + public fun combine-ZQYDhZg (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; - public fun cos-02gLDOA (Lkscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; + public fun cos-Q7Xurp0 (Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun cosh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun div (DLkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun cosh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun div (DLspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun div (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public synthetic fun div (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun div (Lkscience/kmath/nd/NDStructure;D)Lkscience/kmath/nd/NDStructure; - public fun div (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public synthetic fun div (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public fun div (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public synthetic fun div (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun div (Lspace/kscience/kmath/nd/NDStructure;D)Lspace/kscience/kmath/nd/NDStructure; + public fun div (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public synthetic fun div (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public fun div (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun divide (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; - public fun exp-02gLDOA (Lkscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; + public fun exp-Q7Xurp0 (Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun getElementContext ()Ljava/lang/Object; - public fun getElementContext ()Lkscience/kmath/operations/RealField; - public final fun getF64Buffer (Lkscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; + public fun getElementContext ()Lspace/kscience/kmath/operations/RealField; + public final fun getF64Buffer (Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne-hHuhEO0 ()Lorg/jetbrains/bio/viktor/F64Array; + public fun getOne-MSOxzaI ()Lorg/jetbrains/bio/viktor/F64Array; public fun getShape ()[I public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero-hHuhEO0 ()Lorg/jetbrains/bio/viktor/F64Array; - public fun invoke (Lkotlin/jvm/functions/Function1;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun getZero-MSOxzaI ()Lorg/jetbrains/bio/viktor/F64Array; + public fun invoke (Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; - public fun ln-02gLDOA (Lkscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; - public synthetic fun map (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDStructure; - public fun map-frQ_39w (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lorg/jetbrains/bio/viktor/F64Array; - public synthetic fun mapIndexed (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDStructure; - public fun mapIndexed-frQ_39w (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lorg/jetbrains/bio/viktor/F64Array; - public fun minus (DLkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun ln-Q7Xurp0 (Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; + public synthetic fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; + public fun map-s8yP2C4 (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lorg/jetbrains/bio/viktor/F64Array; + public synthetic fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; + public fun mapIndexed-s8yP2C4 (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lorg/jetbrains/bio/viktor/F64Array; + public fun minus (DLspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun minus (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public synthetic fun minus (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun minus (Lkscience/kmath/nd/NDStructure;D)Lkscience/kmath/nd/NDStructure; - public fun minus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public synthetic fun minus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public fun minus-frQ_39w (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; + public synthetic fun minus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun minus (Lspace/kscience/kmath/nd/NDStructure;D)Lspace/kscience/kmath/nd/NDStructure; + public fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public synthetic fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public fun minus-s8yP2C4 (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public synthetic fun multiply (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public fun multiply (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun multiply-frQ_39w (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lorg/jetbrains/bio/viktor/F64Array; + public synthetic fun multiply (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public fun multiply (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun multiply-s8yP2C4 (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number-02gLDOA (Ljava/lang/Number;)Lorg/jetbrains/bio/viktor/F64Array; - public fun plus (DLkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun number-Q7Xurp0 (Ljava/lang/Number;)Lorg/jetbrains/bio/viktor/F64Array; + public fun plus (DLspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun plus (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public synthetic fun plus (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun plus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public synthetic fun plus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public fun plus-frQ_39w (Lkscience/kmath/nd/NDStructure;D)Lorg/jetbrains/bio/viktor/F64Array; - public fun plus-frQ_39w (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; + public synthetic fun plus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun plus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public synthetic fun plus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public fun plus-s8yP2C4 (Lspace/kscience/kmath/nd/NDStructure;D)Lorg/jetbrains/bio/viktor/F64Array; + public fun plus-s8yP2C4 (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun pow (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun pow (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun power-frQ_39w (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lorg/jetbrains/bio/viktor/F64Array; - public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDStructure; - public fun produce-02gLDOA (Lkotlin/jvm/functions/Function2;)Lorg/jetbrains/bio/viktor/F64Array; + public fun power-s8yP2C4 (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lorg/jetbrains/bio/viktor/F64Array; + public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; + public fun produce-Q7Xurp0 (Lkotlin/jvm/functions/Function2;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; - public fun sin-02gLDOA (Lkscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; + public fun sin-Q7Xurp0 (Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun sinh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun sinh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun sqrt (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/nd/NDStructure; + public fun sqrt (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; - public fun tan (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun tan (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun tanh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun times (DLkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun tanh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun times (DLspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public synthetic fun times (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun times (Lkscience/kmath/nd/NDStructure;D)Lkscience/kmath/nd/NDStructure; - public synthetic fun times (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public fun times (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun times-frQ_39w (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lorg/jetbrains/bio/viktor/F64Array; + public synthetic fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun times (Lspace/kscience/kmath/nd/NDStructure;D)Lspace/kscience/kmath/nd/NDStructure; + public synthetic fun times (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public fun times (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun times-s8yP2C4 (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun unaryMinus (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun unaryPlus (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public final class kscience/kmath/viktor/ViktorNDStructure : kscience/kmath/nd/MutableNDStructure { - public static final synthetic fun box-impl (Lorg/jetbrains/bio/viktor/F64Array;)Lkscience/kmath/viktor/ViktorNDStructure; +public final class space/kscience/kmath/viktor/ViktorNDStructure : space/kscience/kmath/nd/MutableNDStructure { + public static final synthetic fun box-impl (Lorg/jetbrains/bio/viktor/F64Array;)Lspace/kscience/kmath/viktor/ViktorNDStructure; public static fun constructor-impl (Lorg/jetbrains/bio/viktor/F64Array;)Lorg/jetbrains/bio/viktor/F64Array; public fun elements ()Lkotlin/sequences/Sequence; public static fun elements-impl (Lorg/jetbrains/bio/viktor/F64Array;)Lkotlin/sequences/Sequence; @@ -179,8 +179,8 @@ public final class kscience/kmath/viktor/ViktorNDStructure : kscience/kmath/nd/M public final synthetic fun unbox-impl ()Lorg/jetbrains/bio/viktor/F64Array; } -public final class kscience/kmath/viktor/ViktorNDStructureKt { - public static final fun ViktorNDField ([I)Lkscience/kmath/viktor/ViktorNDField; +public final class space/kscience/kmath/viktor/ViktorNDStructureKt { + public static final fun ViktorNDField ([I)Lspace/kscience/kmath/viktor/ViktorNDField; public static final fun asStructure (Lorg/jetbrains/bio/viktor/F64Array;)Lorg/jetbrains/bio/viktor/F64Array; } diff --git a/kmath-viktor/src/main/kotlin/kscience/kmath/viktor/ViktorBuffer.kt b/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorBuffer.kt similarity index 87% rename from kmath-viktor/src/main/kotlin/kscience/kmath/viktor/ViktorBuffer.kt rename to kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorBuffer.kt index 5c9611758..1592763db 100644 --- a/kmath-viktor/src/main/kotlin/kscience/kmath/viktor/ViktorBuffer.kt +++ b/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorBuffer.kt @@ -1,7 +1,7 @@ -package kscience.kmath.viktor +package space.kscience.kmath.viktor -import kscience.kmath.structures.MutableBuffer import org.jetbrains.bio.viktor.F64FlatArray +import space.kscience.kmath.structures.MutableBuffer @Suppress("NOTHING_TO_INLINE", "OVERRIDE_BY_INLINE") public inline class ViktorBuffer(public val flatArray: F64FlatArray) : MutableBuffer { diff --git a/kmath-viktor/src/main/kotlin/kscience/kmath/viktor/ViktorNDStructure.kt b/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorNDStructure.kt similarity index 94% rename from kmath-viktor/src/main/kotlin/kscience/kmath/viktor/ViktorNDStructure.kt rename to kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorNDStructure.kt index d3e4806b0..8deda2544 100644 --- a/kmath-viktor/src/main/kotlin/kscience/kmath/viktor/ViktorNDStructure.kt +++ b/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorNDStructure.kt @@ -1,11 +1,11 @@ -package kscience.kmath.viktor +package space.kscience.kmath.viktor -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.nd.* -import kscience.kmath.operations.ExtendedField -import kscience.kmath.operations.RealField -import kscience.kmath.operations.RingWithNumbers import org.jetbrains.bio.viktor.F64Array +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.nd.* +import space.kscience.kmath.operations.ExtendedField +import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.RingWithNumbers @Suppress("OVERRIDE_BY_INLINE", "NOTHING_TO_INLINE") public inline class ViktorNDStructure(public val f64Buffer: F64Array) : MutableNDStructure { diff --git a/settings.gradle.kts b/settings.gradle.kts index 806419bcd..329bce8f9 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -8,7 +8,7 @@ pluginManagement { maven("https://dl.bintray.com/kotlin/kotlinx") } - val toolsVersion = "0.7.5" + val toolsVersion = "0.7.6" val kotlinVersion = "1.4.30" plugins { From 2a325b4bc8ef19ee05354b99bcbe9e1cc75297fe Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 18 Feb 2021 19:37:12 +0700 Subject: [PATCH 079/150] 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 080/150] 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 081/150] 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 082/150] 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 209e17cd42d45e74ee22aeb086b3163aa6394cd0 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Fri, 19 Feb 2021 10:52:56 +0300 Subject: [PATCH 083/150] Merge histograms --- docs/templates/ARTIFACT-TEMPLATE.md | 19 +- kmath-ast/README.md | 29 +- kmath-ast/docs/README-TEMPLATE.md | 2 +- kmath-complex/README.md | 25 +- kmath-core/README.md | 25 +- kmath-core/api/kmath-core.api | 2747 +++++++++-------- .../kmath/domains/HyperSquareDomain.kt | 10 +- kmath-for-real/README.md | 25 +- kmath-functions/README.md | 25 +- .../histogram/{Counters.kt => Counter.kt} | 4 +- .../kmath/histogram/IndexedHistogramSpace.kt | 20 +- .../kmath/histogram/RealHistogramSpace.kt | 10 +- .../histogram/MultivariateHistogramTest.kt | 12 +- .../kmath/histogram/TreeHistogramSpace.kt | 15 +- .../kmath/histogram/UnivariateHistogram.kt | 14 +- kmath-nd4j/README.md | 25 +- 16 files changed, 1514 insertions(+), 1493 deletions(-) rename kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/{Counters.kt => Counter.kt} (91%) rename kmath-histograms/src/commonMain/kotlin/{ => space}/kscience/kmath/histogram/IndexedHistogramSpace.kt (84%) rename kmath-histograms/src/commonMain/kotlin/{ => space}/kscience/kmath/histogram/RealHistogramSpace.kt (95%) rename kmath-histograms/src/commonTest/kotlin/{scietifik => space/kscience}/kmath/histogram/MultivariateHistogramTest.kt (88%) rename kmath-histograms/src/jvmMain/kotlin/{ => space}/kscience/kmath/histogram/TreeHistogramSpace.kt (93%) diff --git a/docs/templates/ARTIFACT-TEMPLATE.md b/docs/templates/ARTIFACT-TEMPLATE.md index d46a431bd..8ac71193f 100644 --- a/docs/templates/ARTIFACT-TEMPLATE.md +++ b/docs/templates/ARTIFACT-TEMPLATE.md @@ -10,11 +10,12 @@ > > ```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://repo.kotlin.link' } > maven { url 'https://dl.bintray.com/hotkeytlt/maven' } -> +> maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap +>// Uncomment if repo.kotlin.link is unavailable +>// maven { url 'https://dl.bintray.com/mipt-npm/kscience' } +>// maven { url 'https://dl.bintray.com/mipt-npm/dev' } > } > > dependencies { @@ -25,10 +26,12 @@ > > ```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") +> maven("https://repo.kotlin.link") +> maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap +> maven("https://dl.bintray.com/hotkeytlt/maven") // required for a +>// Uncomment if repo.kotlin.link is unavailable +>// maven("https://dl.bintray.com/mipt-npm/kscience") +>// maven("https://dl.bintray.com/mipt-npm/dev") > } > > dependencies { diff --git a/kmath-ast/README.md b/kmath-ast/README.md index f5d6a3ea5..eb84c7fe9 100644 --- a/kmath-ast/README.md +++ b/kmath-ast/README.md @@ -12,7 +12,7 @@ This subproject implements the following features: > #### Artifact: > -> This module artifact: `kscience.kmath:kmath-ast:0.2.0-dev-7`. +> This module artifact: `space.kscience:kmath-ast:0.2.0-dev-7`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-ast/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-ast/_latestVersion) > @@ -22,29 +22,32 @@ This subproject implements the following features: > > ```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://repo.kotlin.link' } > maven { url 'https://dl.bintray.com/hotkeytlt/maven' } -> +> maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap +>// Uncomment if repo.kotlin.link is unavailable +>// maven { url 'https://dl.bintray.com/mipt-npm/kscience' } +>// maven { url 'https://dl.bintray.com/mipt-npm/dev' } > } > > dependencies { -> implementation 'kscience.kmath:kmath-ast:0.2.0-dev-7' +> implementation 'space.kscience:kmath-ast:0.2.0-dev-7' > } > ``` > **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") +> maven("https://repo.kotlin.link") +> maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap +> maven("https://dl.bintray.com/hotkeytlt/maven") // required for a +>// Uncomment if repo.kotlin.link is unavailable +>// maven("https://dl.bintray.com/mipt-npm/kscience") +>// maven("https://dl.bintray.com/mipt-npm/dev") > } > > dependencies { -> implementation("kscience.kmath:kmath-ast:0.2.0-dev-7") +> implementation("space.kscience:kmath-ast:0.2.0-dev-7") > } > ``` @@ -61,10 +64,10 @@ 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; +package space.kscience.kmath.asm.generated; import java.util.Map; import kotlin.jvm.functions.Function2; diff --git a/kmath-ast/docs/README-TEMPLATE.md b/kmath-ast/docs/README-TEMPLATE.md index d44d09bc5..2712cba75 100644 --- a/kmath-ast/docs/README-TEMPLATE.md +++ b/kmath-ast/docs/README-TEMPLATE.md @@ -22,7 +22,7 @@ RealField.mstInField { symbol("x") + 2 }.compile() … leads to generation of bytecode, which can be decompiled to the following Java class: ```java -package kscience.kmath.asm.generated; +package space.kscience.kmath.asm.generated; import java.util.Map; import kotlin.jvm.functions.Function2; diff --git a/kmath-complex/README.md b/kmath-complex/README.md index 8e5320225..741529368 100644 --- a/kmath-complex/README.md +++ b/kmath-complex/README.md @@ -8,7 +8,7 @@ Complex and hypercomplex number systems in KMath: > #### Artifact: > -> This module artifact: `kscience.kmath:kmath-complex:0.2.0-dev-7`. +> This module artifact: `space.kscience:kmath-complex:0.2.0-dev-7`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-complex/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-complex/_latestVersion) > @@ -18,28 +18,31 @@ Complex and hypercomplex number systems in KMath: > > ```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://repo.kotlin.link' } > maven { url 'https://dl.bintray.com/hotkeytlt/maven' } -> +> maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap +>// Uncomment if repo.kotlin.link is unavailable +>// maven { url 'https://dl.bintray.com/mipt-npm/kscience' } +>// maven { url 'https://dl.bintray.com/mipt-npm/dev' } > } > > dependencies { -> implementation 'kscience.kmath:kmath-complex:0.2.0-dev-7' +> implementation 'space.kscience:kmath-complex:0.2.0-dev-7' > } > ``` > **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") +> maven("https://repo.kotlin.link") +> maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap +> maven("https://dl.bintray.com/hotkeytlt/maven") // required for a +>// Uncomment if repo.kotlin.link is unavailable +>// maven("https://dl.bintray.com/mipt-npm/kscience") +>// maven("https://dl.bintray.com/mipt-npm/dev") > } > > dependencies { -> implementation("kscience.kmath:kmath-complex:0.2.0-dev-7") +> implementation("space.kscience:kmath-complex:0.2.0-dev-7") > } > ``` diff --git a/kmath-core/README.md b/kmath-core/README.md index a38b3acaa..1c94717a6 100644 --- a/kmath-core/README.md +++ b/kmath-core/README.md @@ -15,7 +15,7 @@ performance calculations to code generation. > #### Artifact: > -> This module artifact: `kscience.kmath:kmath-core:0.2.0-dev-7`. +> This module artifact: `space.kscience:kmath-core:0.2.0-dev-7`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-core/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-core/_latestVersion) > @@ -25,28 +25,31 @@ performance calculations to code generation. > > ```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://repo.kotlin.link' } > maven { url 'https://dl.bintray.com/hotkeytlt/maven' } -> +> maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap +>// Uncomment if repo.kotlin.link is unavailable +>// maven { url 'https://dl.bintray.com/mipt-npm/kscience' } +>// maven { url 'https://dl.bintray.com/mipt-npm/dev' } > } > > dependencies { -> implementation 'kscience.kmath:kmath-core:0.2.0-dev-7' +> implementation 'space.kscience:kmath-core:0.2.0-dev-7' > } > ``` > **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") +> maven("https://repo.kotlin.link") +> maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap +> maven("https://dl.bintray.com/hotkeytlt/maven") // required for a +>// Uncomment if repo.kotlin.link is unavailable +>// maven("https://dl.bintray.com/mipt-npm/kscience") +>// maven("https://dl.bintray.com/mipt-npm/dev") > } > > dependencies { -> implementation("kscience.kmath:kmath-core:0.2.0-dev-7") +> implementation("space.kscience:kmath-core:0.2.0-dev-7") > } > ``` diff --git a/kmath-core/api/kmath-core.api b/kmath-core/api/kmath-core.api index 1bfc13c3b..8cc72cfbd 100644 --- a/kmath-core/api/kmath-core.api +++ b/kmath-core/api/kmath-core.api @@ -1,65 +1,65 @@ -public abstract interface class kscience/kmath/domains/Domain { - public abstract fun contains (Lkscience/kmath/structures/Buffer;)Z +public abstract interface class space/kscience/kmath/domains/Domain { + public abstract fun contains (Lspace/kscience/kmath/structures/Buffer;)Z public abstract fun getDimension ()I } -public final class kscience/kmath/domains/HyperSquareDomain : kscience/kmath/domains/RealDomain { - public fun (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)V - public fun contains (Lkscience/kmath/structures/Buffer;)Z +public final class space/kscience/kmath/domains/HyperSquareDomain : space/kscience/kmath/domains/RealDomain { + public fun (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)V + public fun contains (Lspace/kscience/kmath/structures/Buffer;)Z public fun getDimension ()I public fun getLowerBound (I)Ljava/lang/Double; - public fun getLowerBound (ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; + public fun getLowerBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; public fun getUpperBound (I)Ljava/lang/Double; - public fun getUpperBound (ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; - public fun nearestInDomain (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun getUpperBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; + public fun nearestInDomain (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun volume ()D } -public abstract interface class kscience/kmath/domains/RealDomain : kscience/kmath/domains/Domain { +public abstract interface class space/kscience/kmath/domains/RealDomain : space/kscience/kmath/domains/Domain { public abstract fun getLowerBound (I)Ljava/lang/Double; - public abstract fun getLowerBound (ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; + public abstract fun getLowerBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; public abstract fun getUpperBound (I)Ljava/lang/Double; - public abstract fun getUpperBound (ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; - public abstract fun nearestInDomain (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public abstract fun getUpperBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; + public abstract fun nearestInDomain (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public abstract fun volume ()D } -public final class kscience/kmath/domains/UnconstrainedDomain : kscience/kmath/domains/RealDomain { +public final class space/kscience/kmath/domains/UnconstrainedDomain : space/kscience/kmath/domains/RealDomain { public fun (I)V - public fun contains (Lkscience/kmath/structures/Buffer;)Z + public fun contains (Lspace/kscience/kmath/structures/Buffer;)Z public fun getDimension ()I public fun getLowerBound (I)Ljava/lang/Double; - public fun getLowerBound (ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; + public fun getLowerBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; public fun getUpperBound (I)Ljava/lang/Double; - public fun getUpperBound (ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; - public fun nearestInDomain (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun getUpperBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; + public fun nearestInDomain (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun volume ()D } -public final class kscience/kmath/domains/UnivariateDomain : kscience/kmath/domains/RealDomain { - public static final synthetic fun box-impl (Lkotlin/ranges/ClosedFloatingPointRange;)Lkscience/kmath/domains/UnivariateDomain; +public final class space/kscience/kmath/domains/UnivariateDomain : space/kscience/kmath/domains/RealDomain { + public static final synthetic fun box-impl (Lkotlin/ranges/ClosedFloatingPointRange;)Lspace/kscience/kmath/domains/UnivariateDomain; public static fun constructor-impl (Lkotlin/ranges/ClosedFloatingPointRange;)Lkotlin/ranges/ClosedFloatingPointRange; - public fun contains (Lkscience/kmath/structures/Buffer;)Z + public fun contains (Lspace/kscience/kmath/structures/Buffer;)Z public static final fun contains-impl (Lkotlin/ranges/ClosedFloatingPointRange;D)Z - public static fun contains-impl (Lkotlin/ranges/ClosedFloatingPointRange;Lkscience/kmath/structures/Buffer;)Z + public static fun contains-impl (Lkotlin/ranges/ClosedFloatingPointRange;Lspace/kscience/kmath/structures/Buffer;)Z public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Lkotlin/ranges/ClosedFloatingPointRange;Ljava/lang/Object;)Z public static final fun equals-impl0 (Lkotlin/ranges/ClosedFloatingPointRange;Lkotlin/ranges/ClosedFloatingPointRange;)Z public fun getDimension ()I public static fun getDimension-impl (Lkotlin/ranges/ClosedFloatingPointRange;)I public fun getLowerBound (I)Ljava/lang/Double; - public fun getLowerBound (ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; + public fun getLowerBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; public static fun getLowerBound-impl (Lkotlin/ranges/ClosedFloatingPointRange;I)Ljava/lang/Double; - public static fun getLowerBound-impl (Lkotlin/ranges/ClosedFloatingPointRange;ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; + public static fun getLowerBound-impl (Lkotlin/ranges/ClosedFloatingPointRange;ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; public final fun getRange ()Lkotlin/ranges/ClosedFloatingPointRange; public fun getUpperBound (I)Ljava/lang/Double; - public fun getUpperBound (ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; + public fun getUpperBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; public static fun getUpperBound-impl (Lkotlin/ranges/ClosedFloatingPointRange;I)Ljava/lang/Double; - public static fun getUpperBound-impl (Lkotlin/ranges/ClosedFloatingPointRange;ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; + public static fun getUpperBound-impl (Lkotlin/ranges/ClosedFloatingPointRange;ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; public fun hashCode ()I public static fun hashCode-impl (Lkotlin/ranges/ClosedFloatingPointRange;)I - public fun nearestInDomain (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static fun nearestInDomain-impl (Lkotlin/ranges/ClosedFloatingPointRange;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun nearestInDomain (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun nearestInDomain-impl (Lkotlin/ranges/ClosedFloatingPointRange;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun toString ()Ljava/lang/String; public static fun toString-impl (Lkotlin/ranges/ClosedFloatingPointRange;)Ljava/lang/String; public final synthetic fun unbox-impl ()Lkotlin/ranges/ClosedFloatingPointRange; @@ -67,384 +67,384 @@ public final class kscience/kmath/domains/UnivariateDomain : kscience/kmath/doma public static fun volume-impl (Lkotlin/ranges/ClosedFloatingPointRange;)D } -public abstract interface class kscience/kmath/expressions/AutoDiffProcessor { - public abstract fun process (Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/DifferentiableExpression; +public abstract interface class space/kscience/kmath/expressions/AutoDiffProcessor { + public abstract fun process (Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/DifferentiableExpression; } -public class kscience/kmath/expressions/AutoDiffValue { +public class space/kscience/kmath/expressions/AutoDiffValue { public fun (Ljava/lang/Object;)V public final fun getValue ()Ljava/lang/Object; } -public final class kscience/kmath/expressions/DerivationResult { - public fun (Ljava/lang/Object;Ljava/util/Map;Lkscience/kmath/operations/Field;)V - public final fun derivative (Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; +public final class space/kscience/kmath/expressions/DerivationResult { + public fun (Ljava/lang/Object;Ljava/util/Map;Lspace/kscience/kmath/operations/Field;)V + public final fun derivative (Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; public final fun div ()Ljava/lang/Object; - public final fun getContext ()Lkscience/kmath/operations/Field; + public final fun getContext ()Lspace/kscience/kmath/operations/Field; public final fun getValue ()Ljava/lang/Object; } -public abstract interface class kscience/kmath/expressions/DifferentiableExpression : kscience/kmath/expressions/Expression { - public abstract fun derivativeOrNull (Ljava/util/List;)Lkscience/kmath/expressions/Expression; +public abstract interface class space/kscience/kmath/expressions/DifferentiableExpression : space/kscience/kmath/expressions/Expression { + public abstract fun derivativeOrNull (Ljava/util/List;)Lspace/kscience/kmath/expressions/Expression; } -public final class kscience/kmath/expressions/DifferentiableExpressionKt { - public static final fun derivative (Lkscience/kmath/expressions/DifferentiableExpression;Ljava/lang/String;)Lkscience/kmath/expressions/Expression; - public static final fun derivative (Lkscience/kmath/expressions/DifferentiableExpression;Ljava/util/List;)Lkscience/kmath/expressions/Expression; - public static final fun derivative (Lkscience/kmath/expressions/DifferentiableExpression;[Lkscience/kmath/expressions/Symbol;)Lkscience/kmath/expressions/Expression; +public final class space/kscience/kmath/expressions/DifferentiableExpressionKt { + public static final fun derivative (Lspace/kscience/kmath/expressions/DifferentiableExpression;Ljava/lang/String;)Lspace/kscience/kmath/expressions/Expression; + public static final fun derivative (Lspace/kscience/kmath/expressions/DifferentiableExpression;Ljava/util/List;)Lspace/kscience/kmath/expressions/Expression; + public static final fun derivative (Lspace/kscience/kmath/expressions/DifferentiableExpression;[Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/expressions/Expression; } -public abstract interface class kscience/kmath/expressions/Expression { +public abstract interface class space/kscience/kmath/expressions/Expression { public abstract fun invoke (Ljava/util/Map;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/expressions/ExpressionAlgebra : kscience/kmath/operations/Algebra { - public abstract fun bindOrNull (Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; +public abstract interface class space/kscience/kmath/expressions/ExpressionAlgebra : space/kscience/kmath/operations/Algebra { + public abstract fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public abstract fun bindSymbolOrNull (Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; public abstract fun const (Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun symbol (Ljava/lang/String;)Ljava/lang/Object; } -public final class kscience/kmath/expressions/ExpressionAlgebra$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun symbol (Lkscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; +public final class space/kscience/kmath/expressions/ExpressionAlgebra$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/expressions/ExpressionBuildersKt { - public static final fun extendedFieldExpression (Lkscience/kmath/operations/ExtendedField;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/Expression; - public static final fun fieldExpression (Lkscience/kmath/operations/Field;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/Expression; - public static final fun ringExpression (Lkscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/Expression; - public static final fun spaceExpression (Lkscience/kmath/operations/Space;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/Expression; +public final class space/kscience/kmath/expressions/ExpressionBuildersKt { + public static final fun extendedFieldExpression (Lspace/kscience/kmath/operations/ExtendedField;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; + public static final fun fieldExpression (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; + public static final fun ringExpression (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; + public static final fun spaceExpression (Lspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; } -public final class kscience/kmath/expressions/ExpressionKt { - public static final fun bind (Lkscience/kmath/expressions/ExpressionAlgebra;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static final fun binding (Lkscience/kmath/expressions/ExpressionAlgebra;)Lkotlin/properties/ReadOnlyProperty; - public static final fun callByString (Lkscience/kmath/expressions/Expression;[Lkotlin/Pair;)Ljava/lang/Object; - public static final fun callBySymbol (Lkscience/kmath/expressions/Expression;[Lkotlin/Pair;)Ljava/lang/Object; +public final class space/kscience/kmath/expressions/ExpressionKt { + public static final fun bindSymbol (Lspace/kscience/kmath/expressions/ExpressionAlgebra;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static final fun binding (Lspace/kscience/kmath/expressions/ExpressionAlgebra;)Lkotlin/properties/ReadOnlyProperty; + public static final fun callByString (Lspace/kscience/kmath/expressions/Expression;[Lkotlin/Pair;)Ljava/lang/Object; + public static final fun callBySymbol (Lspace/kscience/kmath/expressions/Expression;[Lkotlin/Pair;)Ljava/lang/Object; public static final fun getSymbol ()Lkotlin/properties/ReadOnlyProperty; - public static final fun invoke (Lkscience/kmath/expressions/Expression;)Ljava/lang/Object; + public static final fun invoke (Lspace/kscience/kmath/expressions/Expression;)Ljava/lang/Object; } -public abstract class kscience/kmath/expressions/FirstDerivativeExpression : kscience/kmath/expressions/DifferentiableExpression { +public abstract class space/kscience/kmath/expressions/FirstDerivativeExpression : space/kscience/kmath/expressions/DifferentiableExpression { public fun ()V - public final fun derivativeOrNull (Ljava/util/List;)Lkscience/kmath/expressions/Expression; - public abstract fun derivativeOrNull (Lkscience/kmath/expressions/Symbol;)Lkscience/kmath/expressions/Expression; + public final fun derivativeOrNull (Ljava/util/List;)Lspace/kscience/kmath/expressions/Expression; + public abstract fun derivativeOrNull (Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/expressions/Expression; } -public abstract class kscience/kmath/expressions/FunctionalExpressionAlgebra : kscience/kmath/expressions/ExpressionAlgebra { - public fun (Lkscience/kmath/operations/Algebra;)V +public abstract class space/kscience/kmath/expressions/FunctionalExpressionAlgebra : space/kscience/kmath/expressions/ExpressionAlgebra { + public fun (Lspace/kscience/kmath/operations/Algebra;)V public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/expressions/Expression;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun bindOrNull (Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public fun bindOrNull (Lkscience/kmath/expressions/Symbol;)Lkscience/kmath/expressions/Expression; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/expressions/Expression; + public synthetic fun bindSymbolOrNull (Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public fun bindSymbolOrNull (Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun const (Ljava/lang/Object;)Ljava/lang/Object; - public fun const (Ljava/lang/Object;)Lkscience/kmath/expressions/Expression; - public final fun getAlgebra ()Lkscience/kmath/operations/Algebra; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/expressions/Expression; + public fun const (Ljava/lang/Object;)Lspace/kscience/kmath/expressions/Expression; + public final fun getAlgebra ()Lspace/kscience/kmath/operations/Algebra; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/expressions/FunctionalExpressionAlgebraKt { - public static final fun expressionInExtendedField (Lkscience/kmath/operations/ExtendedField;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/Expression; - public static final fun expressionInField (Lkscience/kmath/operations/Field;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/Expression; - public static final fun expressionInRing (Lkscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/Expression; - public static final fun expressionInSpace (Lkscience/kmath/operations/Space;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/Expression; +public final class space/kscience/kmath/expressions/FunctionalExpressionAlgebraKt { + public static final fun expressionInExtendedField (Lspace/kscience/kmath/operations/ExtendedField;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; + public static final fun expressionInField (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; + public static final fun expressionInRing (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; + public static final fun expressionInSpace (Lspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; } -public class kscience/kmath/expressions/FunctionalExpressionExtendedField : kscience/kmath/expressions/FunctionalExpressionField, kscience/kmath/operations/ExtendedField { - public fun (Lkscience/kmath/operations/ExtendedField;)V +public class space/kscience/kmath/expressions/FunctionalExpressionExtendedField : space/kscience/kmath/expressions/FunctionalExpressionField, space/kscience/kmath/operations/ExtendedField { + public fun (Lspace/kscience/kmath/operations/ExtendedField;)V public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; - public fun acos (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun acos (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun acosh (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun acosh (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; - public fun asin (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun asin (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun asinh (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun asinh (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; - public fun atan (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun atan (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun atanh (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun atanh (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; - public fun cos (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun cos (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun cosh (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun cosh (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; - public fun exp (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun exp (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; - public fun ln (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun ln (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number (Ljava/lang/Number;)Lkscience/kmath/expressions/Expression; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun pow (Lkscience/kmath/expressions/Expression;Ljava/lang/Number;)Lkscience/kmath/expressions/Expression; + public fun pow (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun power (Lkscience/kmath/expressions/Expression;Ljava/lang/Number;)Lkscience/kmath/expressions/Expression; + public fun power (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lkscience/kmath/expressions/Expression;Ljava/lang/Number;)Lkscience/kmath/expressions/Expression; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; - public fun sin (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun sin (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun sinh (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun sinh (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun sqrt (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun sqrt (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; - public fun tan (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun tan (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun tanh (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun tanh (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public class kscience/kmath/expressions/FunctionalExpressionField : kscience/kmath/expressions/FunctionalExpressionRing, kscience/kmath/operations/Field { - public fun (Lkscience/kmath/operations/Field;)V +public class space/kscience/kmath/expressions/FunctionalExpressionField : space/kscience/kmath/expressions/FunctionalExpressionRing, space/kscience/kmath/operations/Field { + public fun (Lspace/kscience/kmath/operations/Field;)V public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Number;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun div (Ljava/lang/Number;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public final fun div (Ljava/lang/Object;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; - public final fun div (Lkscience/kmath/expressions/Expression;Ljava/lang/Object;)Lkscience/kmath/expressions/Expression; - public fun div (Lkscience/kmath/expressions/Expression;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public final fun div (Ljava/lang/Object;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; + public final fun div (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Object;)Lspace/kscience/kmath/expressions/Expression; + public fun div (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide (Lkscience/kmath/expressions/Expression;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun divide (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public class kscience/kmath/expressions/FunctionalExpressionRing : kscience/kmath/expressions/FunctionalExpressionSpace, kscience/kmath/operations/Ring { - public fun (Lkscience/kmath/operations/Ring;)V +public class space/kscience/kmath/expressions/FunctionalExpressionRing : space/kscience/kmath/expressions/FunctionalExpressionSpace, space/kscience/kmath/operations/Ring { + public fun (Lspace/kscience/kmath/operations/Ring;)V public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lkscience/kmath/expressions/Expression; + public fun getOne ()Lspace/kscience/kmath/expressions/Expression; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/expressions/Expression;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun multiply (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public final fun times (Ljava/lang/Object;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; - public final fun times (Lkscience/kmath/expressions/Expression;Ljava/lang/Object;)Lkscience/kmath/expressions/Expression; - public fun times (Lkscience/kmath/expressions/Expression;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public final fun times (Ljava/lang/Object;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; + public final fun times (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Object;)Lspace/kscience/kmath/expressions/Expression; + public fun times (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public class kscience/kmath/expressions/FunctionalExpressionSpace : kscience/kmath/expressions/FunctionalExpressionAlgebra, kscience/kmath/operations/Space { - public fun (Lkscience/kmath/operations/Space;)V +public class space/kscience/kmath/expressions/FunctionalExpressionSpace : space/kscience/kmath/expressions/FunctionalExpressionAlgebra, space/kscience/kmath/operations/Space { + public fun (Lspace/kscience/kmath/operations/Space;)V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lkscience/kmath/expressions/Expression;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun add (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun div (Lkscience/kmath/expressions/Expression;Ljava/lang/Number;)Lkscience/kmath/expressions/Expression; + public fun div (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lkscience/kmath/expressions/Expression; + public fun getZero ()Lspace/kscience/kmath/expressions/Expression; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public final fun minus (Ljava/lang/Object;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; - public final fun minus (Lkscience/kmath/expressions/Expression;Ljava/lang/Object;)Lkscience/kmath/expressions/Expression; - public fun minus (Lkscience/kmath/expressions/Expression;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public final fun minus (Ljava/lang/Object;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; + public final fun minus (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Object;)Lspace/kscience/kmath/expressions/Expression; + public fun minus (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/expressions/Expression;Ljava/lang/Number;)Lkscience/kmath/expressions/Expression; + public fun multiply (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public final fun plus (Ljava/lang/Object;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; - public final fun plus (Lkscience/kmath/expressions/Expression;Ljava/lang/Object;)Lkscience/kmath/expressions/Expression; - public fun plus (Lkscience/kmath/expressions/Expression;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public final fun plus (Ljava/lang/Object;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; + public final fun plus (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Object;)Lspace/kscience/kmath/expressions/Expression; + public fun plus (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun times (Lkscience/kmath/expressions/Expression;Ljava/lang/Number;)Lkscience/kmath/expressions/Expression; + public fun times (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun unaryMinus (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun unaryPlus (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; } -public final class kscience/kmath/expressions/SimpleAutoDiffExpression : kscience/kmath/expressions/FirstDerivativeExpression { - public fun (Lkscience/kmath/operations/Field;Lkotlin/jvm/functions/Function1;)V - public fun derivativeOrNull (Lkscience/kmath/expressions/Symbol;)Lkscience/kmath/expressions/Expression; - public final fun getField ()Lkscience/kmath/operations/Field; +public final class space/kscience/kmath/expressions/SimpleAutoDiffExpression : space/kscience/kmath/expressions/FirstDerivativeExpression { + public fun (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function1;)V + public fun derivativeOrNull (Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/expressions/Expression; + public final fun getField ()Lspace/kscience/kmath/operations/Field; public final fun getFunction ()Lkotlin/jvm/functions/Function1; public fun invoke (Ljava/util/Map;)Ljava/lang/Object; } -public final class kscience/kmath/expressions/SimpleAutoDiffExtendedField : kscience/kmath/expressions/SimpleAutoDiffField, kscience/kmath/operations/ExtendedField { - public fun (Lkscience/kmath/operations/ExtendedField;Ljava/util/Map;)V +public final class space/kscience/kmath/expressions/SimpleAutoDiffExtendedField : space/kscience/kmath/expressions/SimpleAutoDiffField, space/kscience/kmath/operations/ExtendedField { + public fun (Lspace/kscience/kmath/operations/ExtendedField;Ljava/util/Map;)V public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; - public fun acos (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun acos (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun acosh (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun acosh (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; - public fun asin (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun asin (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun asinh (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun asinh (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; - public fun atan (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun atan (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun atanh (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun atanh (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; - public fun cos (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun cos (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun cosh (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun cosh (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; - public fun exp (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun exp (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; - public fun ln (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun ln (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun pow (Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; - public final fun pow (Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun pow (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public final fun pow (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun power (Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; + public fun power (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; - public fun sin (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun sin (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun sinh (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public final fun sqr (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun sinh (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public final fun sqr (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun sqrt (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun sqrt (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; - public fun tan (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun tan (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun tanh (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun tanh (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public class kscience/kmath/expressions/SimpleAutoDiffField : kscience/kmath/expressions/ExpressionAlgebra, kscience/kmath/operations/Field, kscience/kmath/operations/RingWithNumbers { - public fun (Lkscience/kmath/operations/Field;Ljava/util/Map;)V +public class space/kscience/kmath/expressions/SimpleAutoDiffField : space/kscience/kmath/expressions/ExpressionAlgebra, space/kscience/kmath/operations/Field, space/kscience/kmath/operations/RingWithNumbers { + public fun (Lspace/kscience/kmath/operations/Field;Ljava/util/Map;)V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun add (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun bindOrNull (Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public fun bindOrNull (Lkscience/kmath/expressions/Symbol;)Lkscience/kmath/expressions/AutoDiffValue; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public synthetic fun bindSymbolOrNull (Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public fun bindSymbolOrNull (Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun const (Ljava/lang/Object;)Ljava/lang/Object; - public fun const (Ljava/lang/Object;)Lkscience/kmath/expressions/AutoDiffValue; - public final fun const (Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/AutoDiffValue; + public fun const (Ljava/lang/Object;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public final fun const (Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/AutoDiffValue; public final fun derive (Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Number;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun div (Ljava/lang/Number;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; - public fun div (Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun div (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public fun div (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide (Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public final fun getContext ()Lkscience/kmath/operations/Field; - public final fun getD (Lkscience/kmath/expressions/AutoDiffValue;)Ljava/lang/Object; + public fun divide (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public final fun getContext ()Lspace/kscience/kmath/operations/Field; + public final fun getD (Lspace/kscience/kmath/expressions/AutoDiffValue;)Ljava/lang/Object; public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lkscience/kmath/expressions/AutoDiffValue; + public fun getOne ()Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lkscience/kmath/expressions/AutoDiffValue; + public fun getZero ()Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Ljava/lang/Number;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun minus (Ljava/lang/Number;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; - public fun minus (Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun minus (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public fun minus (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; - public fun multiply (Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun multiply (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public fun multiply (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number (Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Ljava/lang/Number;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun plus (Ljava/lang/Number;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; - public fun plus (Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun plus (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public fun plus (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public final fun setD (Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Object;)V - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/expressions/AutoDiffValue; + public final fun setD (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Object;)V public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; - public fun times (Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun times (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public fun times (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun unaryMinus (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun unaryPlus (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; } -public final class kscience/kmath/expressions/SimpleAutoDiffKt { - public static final fun acos (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun acosh (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun asin (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun asinh (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun atan (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun atanh (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun cos (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun cosh (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun exp (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun grad (Lkscience/kmath/expressions/DerivationResult;[Lkscience/kmath/expressions/Symbol;)Lkscience/kmath/structures/Buffer; - public static final fun ln (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun pow (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;D)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun pow (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;I)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun pow (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun simpleAutoDiff (Lkscience/kmath/operations/Field;)Lkscience/kmath/expressions/AutoDiffProcessor; - public static final fun simpleAutoDiff (Lkscience/kmath/operations/Field;Ljava/util/Map;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/DerivationResult; - public static final fun simpleAutoDiff (Lkscience/kmath/operations/Field;[Lkotlin/Pair;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/DerivationResult; - public static final fun sin (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun sinh (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun sqr (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun sqrt (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun tan (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun tanh (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; +public final class space/kscience/kmath/expressions/SimpleAutoDiffKt { + public static final fun acos (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun acosh (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun asin (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun asinh (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun atan (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun atanh (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun cos (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun cosh (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun exp (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun grad (Lspace/kscience/kmath/expressions/DerivationResult;[Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/structures/Buffer; + public static final fun ln (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun pow (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;D)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun pow (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;I)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun pow (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun simpleAutoDiff (Lspace/kscience/kmath/operations/Field;)Lspace/kscience/kmath/expressions/AutoDiffProcessor; + public static final fun simpleAutoDiff (Lspace/kscience/kmath/operations/Field;Ljava/util/Map;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/DerivationResult; + public static final fun simpleAutoDiff (Lspace/kscience/kmath/operations/Field;[Lkotlin/Pair;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/DerivationResult; + public static final fun sin (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun sinh (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun sqr (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun sqrt (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun tan (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun tanh (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; } -public final class kscience/kmath/expressions/SimpleSymbolIndexer : kscience/kmath/expressions/SymbolIndexer { - public static final synthetic fun box-impl (Ljava/util/List;)Lkscience/kmath/expressions/SimpleSymbolIndexer; +public final class space/kscience/kmath/expressions/SimpleSymbolIndexer : space/kscience/kmath/expressions/SymbolIndexer { + public static final synthetic fun box-impl (Ljava/util/List;)Lspace/kscience/kmath/expressions/SimpleSymbolIndexer; public static fun constructor-impl (Ljava/util/List;)Ljava/util/List; public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Ljava/util/List;Ljava/lang/Object;)Z public static final fun equals-impl0 (Ljava/util/List;Ljava/util/List;)Z - public fun get (Ljava/util/List;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public fun get (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/expressions/Symbol;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public fun get (Lkscience/kmath/structures/Buffer;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public fun get ([DLkscience/kmath/expressions/Symbol;)D - public fun get ([Ljava/lang/Object;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get-impl (Ljava/util/List;Ljava/util/List;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get-impl (Ljava/util/List;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/expressions/Symbol;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get-impl (Ljava/util/List;Lkscience/kmath/structures/Buffer;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get-impl (Ljava/util/List;[DLkscience/kmath/expressions/Symbol;)D - public static fun get-impl (Ljava/util/List;[Ljava/lang/Object;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public fun get (Ljava/util/List;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public fun get (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/expressions/Symbol;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public fun get (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public fun get ([DLspace/kscience/kmath/expressions/Symbol;)D + public fun get ([Ljava/lang/Object;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static fun get-impl (Ljava/util/List;Ljava/util/List;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static fun get-impl (Ljava/util/List;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/expressions/Symbol;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static fun get-impl (Ljava/util/List;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static fun get-impl (Ljava/util/List;[DLspace/kscience/kmath/expressions/Symbol;)D + public static fun get-impl (Ljava/util/List;[Ljava/lang/Object;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; public fun getSymbols ()Ljava/util/List; public fun hashCode ()I public static fun hashCode-impl (Ljava/util/List;)I - public fun indexOf (Lkscience/kmath/expressions/Symbol;)I - public static fun indexOf-impl (Ljava/util/List;Lkscience/kmath/expressions/Symbol;)I + public fun indexOf (Lspace/kscience/kmath/expressions/Symbol;)I + public static fun indexOf-impl (Ljava/util/List;Lspace/kscience/kmath/expressions/Symbol;)I public fun toDoubleArray (Ljava/util/Map;)[D public static fun toDoubleArray-impl (Ljava/util/List;Ljava/util/Map;)[D public fun toList (Ljava/util/Map;)Ljava/util/List; public static fun toList-impl (Ljava/util/List;Ljava/util/Map;)Ljava/util/List; public fun toMap ([D)Ljava/util/Map; public static fun toMap-impl (Ljava/util/List;[D)Ljava/util/Map; - public fun toPoint (Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/structures/Buffer; - public static fun toPoint-impl (Ljava/util/List;Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/structures/Buffer; + public fun toPoint (Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; + public static fun toPoint-impl (Ljava/util/List;Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; public fun toString ()Ljava/lang/String; public static fun toString-impl (Ljava/util/List;)Ljava/lang/String; public final synthetic fun unbox-impl ()Ljava/util/List; } -public final class kscience/kmath/expressions/StringSymbol : kscience/kmath/expressions/Symbol { - public static final synthetic fun box-impl (Ljava/lang/String;)Lkscience/kmath/expressions/StringSymbol; +public final class space/kscience/kmath/expressions/StringSymbol : space/kscience/kmath/expressions/Symbol { + public static final synthetic fun box-impl (Ljava/lang/String;)Lspace/kscience/kmath/expressions/StringSymbol; public static fun constructor-impl (Ljava/lang/String;)Ljava/lang/String; public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Ljava/lang/String;Ljava/lang/Object;)Z @@ -457,463 +457,463 @@ public final class kscience/kmath/expressions/StringSymbol : kscience/kmath/expr public final synthetic fun unbox-impl ()Ljava/lang/String; } -public abstract interface class kscience/kmath/expressions/Symbol { +public abstract interface class space/kscience/kmath/expressions/Symbol { public abstract fun getIdentity ()Ljava/lang/String; } -public abstract interface class kscience/kmath/expressions/SymbolIndexer { - public abstract fun get (Ljava/util/List;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public abstract fun get (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/expressions/Symbol;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public abstract fun get (Lkscience/kmath/structures/Buffer;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public abstract fun get ([DLkscience/kmath/expressions/Symbol;)D - public abstract fun get ([Ljava/lang/Object;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; +public abstract interface class space/kscience/kmath/expressions/SymbolIndexer { + public abstract fun get (Ljava/util/List;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public abstract fun get (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/expressions/Symbol;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public abstract fun get (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public abstract fun get ([DLspace/kscience/kmath/expressions/Symbol;)D + public abstract fun get ([Ljava/lang/Object;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; public abstract fun getSymbols ()Ljava/util/List; - public abstract fun indexOf (Lkscience/kmath/expressions/Symbol;)I + public abstract fun indexOf (Lspace/kscience/kmath/expressions/Symbol;)I public abstract fun toDoubleArray (Ljava/util/Map;)[D public abstract fun toList (Ljava/util/Map;)Ljava/util/List; public abstract fun toMap ([D)Ljava/util/Map; - public abstract fun toPoint (Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/structures/Buffer; + public abstract fun toPoint (Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; } -public final class kscience/kmath/expressions/SymbolIndexer$DefaultImpls { - public static fun get (Lkscience/kmath/expressions/SymbolIndexer;Ljava/util/List;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get (Lkscience/kmath/expressions/SymbolIndexer;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/expressions/Symbol;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get (Lkscience/kmath/expressions/SymbolIndexer;Lkscience/kmath/structures/Buffer;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get (Lkscience/kmath/expressions/SymbolIndexer;[DLkscience/kmath/expressions/Symbol;)D - public static fun get (Lkscience/kmath/expressions/SymbolIndexer;[Ljava/lang/Object;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun indexOf (Lkscience/kmath/expressions/SymbolIndexer;Lkscience/kmath/expressions/Symbol;)I - public static fun toDoubleArray (Lkscience/kmath/expressions/SymbolIndexer;Ljava/util/Map;)[D - public static fun toList (Lkscience/kmath/expressions/SymbolIndexer;Ljava/util/Map;)Ljava/util/List; - public static fun toMap (Lkscience/kmath/expressions/SymbolIndexer;[D)Ljava/util/Map; - public static fun toPoint (Lkscience/kmath/expressions/SymbolIndexer;Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/structures/Buffer; +public final class space/kscience/kmath/expressions/SymbolIndexer$DefaultImpls { + public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;Ljava/util/List;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/expressions/Symbol;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;[DLspace/kscience/kmath/expressions/Symbol;)D + public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;[Ljava/lang/Object;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static fun indexOf (Lspace/kscience/kmath/expressions/SymbolIndexer;Lspace/kscience/kmath/expressions/Symbol;)I + public static fun toDoubleArray (Lspace/kscience/kmath/expressions/SymbolIndexer;Ljava/util/Map;)[D + public static fun toList (Lspace/kscience/kmath/expressions/SymbolIndexer;Ljava/util/Map;)Ljava/util/List; + public static fun toMap (Lspace/kscience/kmath/expressions/SymbolIndexer;[D)Ljava/util/Map; + public static fun toPoint (Lspace/kscience/kmath/expressions/SymbolIndexer;Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; } -public final class kscience/kmath/expressions/SymbolIndexerKt { +public final class space/kscience/kmath/expressions/SymbolIndexerKt { public static final fun withSymbols (Ljava/util/Collection;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun withSymbols ([Lkscience/kmath/expressions/Symbol;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final fun withSymbols ([Lspace/kscience/kmath/expressions/Symbol;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; } -public final class kscience/kmath/linear/BufferMatrix : kscience/kmath/nd/Structure2D { - public fun (IILkscience/kmath/structures/Buffer;)V +public final class space/kscience/kmath/linear/BufferMatrix : space/kscience/kmath/nd/Structure2D { + public fun (IILspace/kscience/kmath/structures/Buffer;)V public fun elements ()Lkotlin/sequences/Sequence; public fun equals (Ljava/lang/Object;)Z public fun get (II)Ljava/lang/Object; public fun get ([I)Ljava/lang/Object; - public final fun getBuffer ()Lkscience/kmath/structures/Buffer; + public final fun getBuffer ()Lspace/kscience/kmath/structures/Buffer; public fun getColNum ()I - public fun getColumns ()Lkscience/kmath/structures/Buffer; + public fun getColumns ()Lspace/kscience/kmath/structures/Buffer; public fun getDimension ()I public fun getFeature (Lkotlin/reflect/KClass;)Ljava/lang/Object; public fun getRowNum ()I - public fun getRows ()Lkscience/kmath/structures/Buffer; + public fun getRows ()Lspace/kscience/kmath/structures/Buffer; public fun getShape ()[I public fun hashCode ()I public fun toString ()Ljava/lang/String; } -public final class kscience/kmath/linear/BufferMatrixContext : kscience/kmath/linear/GenericMatrixContext { - public static final field Companion Lkscience/kmath/linear/BufferMatrixContext$Companion; - public fun (Lkscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V +public final class space/kscience/kmath/linear/BufferMatrixContext : space/kscience/kmath/linear/GenericMatrixContext { + public static final field Companion Lspace/kscience/kmath/linear/BufferMatrixContext$Companion; + public fun (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/linear/BufferMatrix; - public synthetic fun add (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun add (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun add (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun div (Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; - 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 getElementContext ()Lkscience/kmath/operations/Ring; + public fun div (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public fun getElementContext ()Lspace/kscience/kmath/operations/Ring; 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; + public fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/linear/BufferMatrix; - public synthetic fun multiply (Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; - public final fun one (II)Lkscience/kmath/nd/Structure2D; + public fun multiply (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun multiply (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public final fun one (II)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public fun point (ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/Buffer; - public fun produce (IILkotlin/jvm/functions/Function2;)Lkscience/kmath/linear/BufferMatrix; - public synthetic fun produce (IILkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/Structure2D; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/nd/Structure2D; + public fun plus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun point (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun times (Ljava/lang/Object;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/linear/BufferMatrix; - public synthetic fun times (Ljava/lang/Object;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public fun times (Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; - public fun times (Lkscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lkscience/kmath/linear/BufferMatrix; - public synthetic fun times (Lkscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; + public fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/linear/BufferMatrix; - public synthetic fun unaryMinus (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun unaryMinus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun unaryMinus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun unaryPlus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/BufferMatrixContext$Companion { +public final class space/kscience/kmath/linear/BufferMatrixContext$Companion { } -public final class kscience/kmath/linear/BufferVectorSpace : kscience/kmath/linear/VectorSpace { - public fun (ILkscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;)V +public final class space/kscience/kmath/linear/BufferVectorSpace : space/kscience/kmath/linear/VectorSpace { + public fun (ILspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;)V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun add (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun div (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; + public fun div (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public final fun getBufferFactory ()Lkotlin/jvm/functions/Function2; public fun getSize ()I - public fun getSpace ()Lkscience/kmath/operations/Space; + public fun getSpace ()Lspace/kscience/kmath/operations/Space; public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lkscience/kmath/structures/Buffer; + public fun getZero ()Lspace/kscience/kmath/structures/Buffer; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun minus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; + public fun multiply (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/structures/Buffer; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/structures/Buffer; + public fun plus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun times (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; + public fun times (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryPlus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; } -public abstract interface class kscience/kmath/linear/CholeskyDecompositionFeature : kscience/kmath/linear/MatrixFeature { - public abstract fun getL ()Lkscience/kmath/nd/Structure2D; +public abstract interface class space/kscience/kmath/linear/CholeskyDecompositionFeature : space/kscience/kmath/linear/MatrixFeature { + public abstract fun getL ()Lspace/kscience/kmath/nd/Structure2D; } -public abstract interface class kscience/kmath/linear/DeterminantFeature : kscience/kmath/linear/MatrixFeature { +public abstract interface class space/kscience/kmath/linear/DeterminantFeature : space/kscience/kmath/linear/MatrixFeature { public abstract fun getDeterminant ()Ljava/lang/Object; } -public abstract interface class kscience/kmath/linear/DiagonalFeature : kscience/kmath/linear/MatrixFeature { - public static final field Companion Lkscience/kmath/linear/DiagonalFeature$Companion; +public abstract interface class space/kscience/kmath/linear/DiagonalFeature : space/kscience/kmath/linear/MatrixFeature { + public static final field Companion Lspace/kscience/kmath/linear/DiagonalFeature$Companion; } -public final class kscience/kmath/linear/DiagonalFeature$Companion : kscience/kmath/linear/DiagonalFeature { +public final class space/kscience/kmath/linear/DiagonalFeature$Companion : space/kscience/kmath/linear/DiagonalFeature { } -public abstract interface class kscience/kmath/linear/GenericMatrixContext : kscience/kmath/linear/MatrixContext { - public abstract fun add (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - 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 getElementContext ()Lkscience/kmath/operations/Ring; - public abstract fun minus (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public abstract fun multiply (Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; - public abstract fun times (Lkscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; - public abstract fun unaryMinus (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; +public abstract interface class space/kscience/kmath/linear/GenericMatrixContext : space/kscience/kmath/linear/MatrixContext { + public abstract fun add (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public abstract fun getElementContext ()Lspace/kscience/kmath/operations/Ring; + public abstract fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun multiply (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun unaryMinus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/GenericMatrixContext$DefaultImpls { - public static fun add (Lkscience/kmath/linear/GenericMatrixContext;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun binaryOperation (Lkscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun binaryOperationFunction (Lkscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - 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 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; - public static fun point (Lkscience/kmath/linear/GenericMatrixContext;ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/Buffer; - public static fun symbol (Lkscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lkscience/kmath/nd/Structure2D; - public static fun times (Lkscience/kmath/linear/GenericMatrixContext;Ljava/lang/Number;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun times (Lkscience/kmath/linear/GenericMatrixContext;Ljava/lang/Object;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun times (Lkscience/kmath/linear/GenericMatrixContext;Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; - public static fun times (Lkscience/kmath/linear/GenericMatrixContext;Lkscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; - public static fun unaryMinus (Lkscience/kmath/linear/GenericMatrixContext;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun unaryOperation (Lkscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun unaryOperationFunction (Lkscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/linear/GenericMatrixContext;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; +public final class space/kscience/kmath/linear/GenericMatrixContext$DefaultImpls { + public static fun add (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun binaryOperation (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun binaryOperationFunction (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lspace/kscience/kmath/nd/Structure2D; + public static fun div (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public static fun dot (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun dot (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun minus (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun multiply (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public static fun plus (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun point (Lspace/kscience/kmath/linear/GenericMatrixContext;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public static fun times (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/Number;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun times (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun times (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public static fun times (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; + public static fun unaryMinus (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun unaryOperation (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun unaryOperationFunction (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; } -public abstract interface class kscience/kmath/linear/InverseMatrixFeature : kscience/kmath/linear/MatrixFeature { - public abstract fun getInverse ()Lkscience/kmath/nd/Structure2D; +public abstract interface class space/kscience/kmath/linear/InverseMatrixFeature : space/kscience/kmath/linear/MatrixFeature { + public abstract fun getInverse ()Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/LFeature : kscience/kmath/linear/MatrixFeature { - public static final field INSTANCE Lkscience/kmath/linear/LFeature; +public final class space/kscience/kmath/linear/LFeature : space/kscience/kmath/linear/MatrixFeature { + public static final field INSTANCE Lspace/kscience/kmath/linear/LFeature; } -public final class kscience/kmath/linear/LinearAlgebraKt { - public static final fun asMatrix (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/linear/VirtualMatrix; - public static final fun asPoint (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/structures/Buffer; +public final class space/kscience/kmath/linear/LinearAlgebraKt { + public static final fun asMatrix (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/linear/VirtualMatrix; + public static final fun asPoint (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/structures/Buffer; } -public abstract interface class kscience/kmath/linear/LinearSolver { - public abstract fun inverse (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public abstract fun solve (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public abstract fun solve (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; +public abstract interface class space/kscience/kmath/linear/LinearSolver { + public abstract fun inverse (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun solve (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun solve (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; } -public final class kscience/kmath/linear/LinearSolver$DefaultImpls { - public static fun solve (Lkscience/kmath/linear/LinearSolver;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; +public final class space/kscience/kmath/linear/LinearSolver$DefaultImpls { + public static fun solve (Lspace/kscience/kmath/linear/LinearSolver;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; } -public final class kscience/kmath/linear/LupDecomposition : kscience/kmath/linear/DeterminantFeature, kscience/kmath/linear/LupDecompositionFeature { - public fun (Lkscience/kmath/linear/MatrixContext;Lkscience/kmath/operations/Field;Lkscience/kmath/nd/Structure2D;[IZ)V - public final fun getContext ()Lkscience/kmath/linear/MatrixContext; +public final class space/kscience/kmath/linear/LupDecomposition : space/kscience/kmath/linear/DeterminantFeature, space/kscience/kmath/linear/LupDecompositionFeature { + public fun (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/operations/Field;Lspace/kscience/kmath/nd/Structure2D;[IZ)V + public final fun getContext ()Lspace/kscience/kmath/linear/MatrixContext; public fun getDeterminant ()Ljava/lang/Object; - public final fun getElementContext ()Lkscience/kmath/operations/Field; - public fun getL ()Lkscience/kmath/nd/Structure2D; - public final fun getLu ()Lkscience/kmath/nd/Structure2D; - public fun getP ()Lkscience/kmath/nd/Structure2D; + public final fun getElementContext ()Lspace/kscience/kmath/operations/Field; + public fun getL ()Lspace/kscience/kmath/nd/Structure2D; + public final fun getLu ()Lspace/kscience/kmath/nd/Structure2D; + public fun getP ()Lspace/kscience/kmath/nd/Structure2D; public final fun getPivot ()[I - public fun getU ()Lkscience/kmath/nd/Structure2D; + public fun getU ()Lspace/kscience/kmath/nd/Structure2D; } -public abstract interface class kscience/kmath/linear/LupDecompositionFeature : kscience/kmath/linear/MatrixFeature { - public abstract fun getL ()Lkscience/kmath/nd/Structure2D; - public abstract fun getP ()Lkscience/kmath/nd/Structure2D; - public abstract fun getU ()Lkscience/kmath/nd/Structure2D; +public abstract interface class space/kscience/kmath/linear/LupDecompositionFeature : space/kscience/kmath/linear/MatrixFeature { + public abstract fun getL ()Lspace/kscience/kmath/nd/Structure2D; + public abstract fun getP ()Lspace/kscience/kmath/nd/Structure2D; + public abstract fun getU ()Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/LupDecompositionKt { - public static final fun abs (Lkscience/kmath/linear/GenericMatrixContext;Ljava/lang/Comparable;)Ljava/lang/Comparable; - public static final fun inverseWithLup (Lkscience/kmath/linear/RealMatrixContext;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static final fun lup (Lkscience/kmath/linear/MatrixContext;Lkotlin/jvm/functions/Function2;Lkscience/kmath/operations/Field;Lkscience/kmath/nd/Structure2D;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/linear/LupDecomposition; - public static final fun lup (Lkscience/kmath/linear/MatrixContext;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/linear/LupDecomposition; - public static final fun solveWithLup (Lkscience/kmath/linear/LupDecomposition;Lkotlin/jvm/functions/Function2;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static final fun solveWithLup (Lkscience/kmath/linear/RealMatrixContext;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; +public final class space/kscience/kmath/linear/LupDecompositionKt { + public static final fun abs (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/Comparable;)Ljava/lang/Comparable; + public static final fun inverseWithLup (Lspace/kscience/kmath/linear/RealMatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static final fun lup (Lspace/kscience/kmath/linear/MatrixContext;Lkotlin/jvm/functions/Function2;Lspace/kscience/kmath/operations/Field;Lspace/kscience/kmath/nd/Structure2D;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/linear/LupDecomposition; + public static final fun lup (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/LupDecomposition; + public static final fun solveWithLup (Lspace/kscience/kmath/linear/LupDecomposition;Lkotlin/jvm/functions/Function2;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static final fun solveWithLup (Lspace/kscience/kmath/linear/RealMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/MatrixBuilder { +public final class space/kscience/kmath/linear/MatrixBuilder { public fun (II)V public final fun getColumns ()I public final fun getRows ()I - public final fun invoke ([Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; + public final fun invoke ([Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/MatrixBuilderKt { - public static final fun build (Lkscience/kmath/nd/Structure2D$Companion;II)Lkscience/kmath/linear/MatrixBuilder; - public static final fun column (Lkscience/kmath/nd/Structure2D$Companion;[Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; - public static final fun row (Lkscience/kmath/nd/Structure2D$Companion;[Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; +public final class space/kscience/kmath/linear/MatrixBuilderKt { + public static final fun build (Lspace/kscience/kmath/nd/Structure2D$Companion;II)Lspace/kscience/kmath/linear/MatrixBuilder; + public static final fun column (Lspace/kscience/kmath/nd/Structure2D$Companion;[Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; + public static final fun row (Lspace/kscience/kmath/nd/Structure2D$Companion;[Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; } -public abstract interface class kscience/kmath/linear/MatrixContext : kscience/kmath/operations/SpaceOperations { - public static final field Companion Lkscience/kmath/linear/MatrixContext$Companion; +public abstract interface class space/kscience/kmath/linear/MatrixContext : space/kscience/kmath/operations/SpaceOperations { + public static final field Companion Lspace/kscience/kmath/linear/MatrixContext$Companion; 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 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; - public abstract fun times (Lkscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; + public abstract fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public abstract fun point (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public abstract fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/MatrixContext$Companion { - public final fun buffered (Lkscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/linear/GenericMatrixContext; - public static synthetic fun buffered$default (Lkscience/kmath/linear/MatrixContext$Companion;Lkscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkscience/kmath/linear/GenericMatrixContext; +public final class space/kscience/kmath/linear/MatrixContext$Companion { + public final fun buffered (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/GenericMatrixContext; + public static synthetic fun buffered$default (Lspace/kscience/kmath/linear/MatrixContext$Companion;Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lspace/kscience/kmath/linear/GenericMatrixContext; } -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 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; - public static fun symbol (Lkscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lkscience/kmath/nd/Structure2D; - public static fun times (Lkscience/kmath/linear/MatrixContext;Ljava/lang/Number;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun times (Lkscience/kmath/linear/MatrixContext;Ljava/lang/Object;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun times (Lkscience/kmath/linear/MatrixContext;Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; - public static fun unaryMinus (Lkscience/kmath/linear/MatrixContext;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun unaryOperation (Lkscience/kmath/linear/MatrixContext;Ljava/lang/String;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun unaryOperationFunction (Lkscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/linear/MatrixContext;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; +public final class space/kscience/kmath/linear/MatrixContext$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun binaryOperationFunction (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lspace/kscience/kmath/nd/Structure2D; + public static fun div (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public static fun minus (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun plus (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun point (Lspace/kscience/kmath/linear/MatrixContext;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public static fun times (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/Number;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun times (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun times (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public static fun unaryMinus (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun unaryOperation (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun unaryOperationFunction (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; } -public abstract interface class kscience/kmath/linear/MatrixFeature { +public abstract interface class space/kscience/kmath/linear/MatrixFeature { } -public final class kscience/kmath/linear/MatrixFeaturesKt { - public static final fun DeterminantFeature (Ljava/lang/Object;)Lkscience/kmath/linear/DeterminantFeature; +public final class space/kscience/kmath/linear/MatrixFeaturesKt { + public static final fun DeterminantFeature (Ljava/lang/Object;)Lspace/kscience/kmath/linear/DeterminantFeature; } -public final class kscience/kmath/linear/MatrixWrapper : kscience/kmath/nd/Structure2D { +public final class space/kscience/kmath/linear/MatrixWrapper : space/kscience/kmath/nd/Structure2D { public fun elements ()Lkotlin/sequences/Sequence; public fun equals (Ljava/lang/Object;)Z public fun get (II)Ljava/lang/Object; public fun get ([I)Ljava/lang/Object; public fun getColNum ()I - public fun getColumns ()Lkscience/kmath/structures/Buffer; + public fun getColumns ()Lspace/kscience/kmath/structures/Buffer; public fun getDimension ()I public fun getFeature (Lkotlin/reflect/KClass;)Ljava/lang/Object; public final fun getFeatures ()Ljava/util/Set; - public final fun getOrigin ()Lkscience/kmath/nd/Structure2D; + public final fun getOrigin ()Lspace/kscience/kmath/nd/Structure2D; public fun getRowNum ()I - public fun getRows ()Lkscience/kmath/structures/Buffer; + public fun getRows ()Lspace/kscience/kmath/structures/Buffer; public fun getShape ()[I public fun hashCode ()I public fun toString ()Ljava/lang/String; } -public final class kscience/kmath/linear/MatrixWrapperKt { - public static final fun getOrigin (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static final fun one (Lkscience/kmath/linear/GenericMatrixContext;II)Lkscience/kmath/nd/Structure2D; - public static final fun plus (Lkscience/kmath/nd/Structure2D;Ljava/util/Collection;)Lkscience/kmath/linear/MatrixWrapper; - public static final fun plus (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/linear/MatrixFeature;)Lkscience/kmath/linear/MatrixWrapper; - public static final fun square (Lkscience/kmath/nd/Structure2D$Companion;[Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; - public static final fun transpose (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static final fun zero (Lkscience/kmath/linear/GenericMatrixContext;II)Lkscience/kmath/nd/Structure2D; +public final class space/kscience/kmath/linear/MatrixWrapperKt { + public static final fun getOrigin (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static final fun one (Lspace/kscience/kmath/linear/GenericMatrixContext;II)Lspace/kscience/kmath/nd/Structure2D; + public static final fun plus (Lspace/kscience/kmath/nd/Structure2D;Ljava/util/Collection;)Lspace/kscience/kmath/linear/MatrixWrapper; + public static final fun plus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/linear/MatrixFeature;)Lspace/kscience/kmath/linear/MatrixWrapper; + public static final fun square (Lspace/kscience/kmath/nd/Structure2D$Companion;[Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; + public static final fun transpose (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static final fun zero (Lspace/kscience/kmath/linear/GenericMatrixContext;II)Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/OrthogonalFeature : kscience/kmath/linear/MatrixFeature { - public static final field INSTANCE Lkscience/kmath/linear/OrthogonalFeature; +public final class space/kscience/kmath/linear/OrthogonalFeature : space/kscience/kmath/linear/MatrixFeature { + public static final field INSTANCE Lspace/kscience/kmath/linear/OrthogonalFeature; } -public abstract interface class kscience/kmath/linear/QRDecompositionFeature : kscience/kmath/linear/MatrixFeature { - public abstract fun getQ ()Lkscience/kmath/nd/Structure2D; - public abstract fun getR ()Lkscience/kmath/nd/Structure2D; +public abstract interface class space/kscience/kmath/linear/QRDecompositionFeature : space/kscience/kmath/linear/MatrixFeature { + public abstract fun getQ ()Lspace/kscience/kmath/nd/Structure2D; + public abstract fun getR ()Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/RealMatrixContext : kscience/kmath/linear/MatrixContext { - public static final field INSTANCE Lkscience/kmath/linear/RealMatrixContext; +public final class space/kscience/kmath/linear/RealMatrixContext : space/kscience/kmath/linear/MatrixContext { + public static final field INSTANCE Lspace/kscience/kmath/linear/RealMatrixContext; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/linear/BufferMatrix; + public fun add (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun div (Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; - 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 div (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; 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 fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/linear/BufferMatrix; - public final fun one (II)Lkscience/kmath/nd/Structure2D; + public fun multiply (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/linear/BufferMatrix; + public final fun one (II)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public fun point (ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/Buffer; - public fun produce (IILkotlin/jvm/functions/Function2;)Lkscience/kmath/linear/BufferMatrix; - public synthetic fun produce (IILkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/Structure2D; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/nd/Structure2D; - public fun times (DLkscience/kmath/nd/Structure2D;)Lkscience/kmath/linear/BufferMatrix; + public fun plus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun point (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/Structure2D; + public fun times (DLspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public synthetic fun times (Ljava/lang/Object;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public fun times (Lkscience/kmath/nd/Structure2D;D)Lkscience/kmath/linear/BufferMatrix; - public fun times (Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; - public synthetic fun times (Lkscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; - public final fun toBufferMatrix (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/linear/BufferMatrix; + public synthetic fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun times (Lspace/kscience/kmath/nd/Structure2D;D)Lspace/kscience/kmath/linear/BufferMatrix; + public fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public synthetic fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; + public final fun toBufferMatrix (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun unaryMinus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun unaryPlus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/RealMatrixContextKt { - public static final fun getReal (Lkscience/kmath/linear/MatrixContext$Companion;)Lkscience/kmath/linear/RealMatrixContext; +public final class space/kscience/kmath/linear/RealMatrixContextKt { + public static final fun getReal (Lspace/kscience/kmath/linear/MatrixContext$Companion;)Lspace/kscience/kmath/linear/RealMatrixContext; } -public abstract interface class kscience/kmath/linear/SingularValueDecompositionFeature : kscience/kmath/linear/MatrixFeature { - public abstract fun getS ()Lkscience/kmath/nd/Structure2D; - public abstract fun getSingularValues ()Lkscience/kmath/structures/Buffer; - public abstract fun getU ()Lkscience/kmath/nd/Structure2D; - public abstract fun getV ()Lkscience/kmath/nd/Structure2D; +public abstract interface class space/kscience/kmath/linear/SingularValueDecompositionFeature : space/kscience/kmath/linear/MatrixFeature { + public abstract fun getS ()Lspace/kscience/kmath/nd/Structure2D; + public abstract fun getSingularValues ()Lspace/kscience/kmath/structures/Buffer; + public abstract fun getU ()Lspace/kscience/kmath/nd/Structure2D; + public abstract fun getV ()Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/TransposedFeature : kscience/kmath/linear/MatrixFeature { - public fun (Lkscience/kmath/nd/Structure2D;)V - public final fun getOriginal ()Lkscience/kmath/nd/Structure2D; +public final class space/kscience/kmath/linear/TransposedFeature : space/kscience/kmath/linear/MatrixFeature { + public fun (Lspace/kscience/kmath/nd/Structure2D;)V + public final fun getOriginal ()Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/UFeature : kscience/kmath/linear/MatrixFeature { - public static final field INSTANCE Lkscience/kmath/linear/UFeature; +public final class space/kscience/kmath/linear/UFeature : space/kscience/kmath/linear/MatrixFeature { + public static final field INSTANCE Lspace/kscience/kmath/linear/UFeature; } -public final class kscience/kmath/linear/UnitFeature : kscience/kmath/linear/DiagonalFeature { - public static final field INSTANCE Lkscience/kmath/linear/UnitFeature; +public final class space/kscience/kmath/linear/UnitFeature : space/kscience/kmath/linear/DiagonalFeature { + public static final field INSTANCE Lspace/kscience/kmath/linear/UnitFeature; } -public abstract interface class kscience/kmath/linear/VectorSpace : kscience/kmath/operations/Space { - public static final field Companion Lkscience/kmath/linear/VectorSpace$Companion; - public abstract fun add (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; +public abstract interface class space/kscience/kmath/linear/VectorSpace : space/kscience/kmath/operations/Space { + public static final field Companion Lspace/kscience/kmath/linear/VectorSpace$Companion; + public abstract fun add (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public abstract fun getSize ()I - public abstract fun getSpace ()Lkscience/kmath/operations/Space; - public abstract fun getZero ()Lkscience/kmath/structures/Buffer; - public abstract fun multiply (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; - public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/structures/Buffer; + public abstract fun getSpace ()Lspace/kscience/kmath/operations/Space; + public abstract fun getZero ()Lspace/kscience/kmath/structures/Buffer; + public abstract fun multiply (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; } -public final class kscience/kmath/linear/VectorSpace$Companion { - public final fun buffered (ILkscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/linear/BufferVectorSpace; - public static synthetic fun buffered$default (Lkscience/kmath/linear/VectorSpace$Companion;ILkscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkscience/kmath/linear/BufferVectorSpace; - public final fun real (I)Lkscience/kmath/linear/BufferVectorSpace; +public final class space/kscience/kmath/linear/VectorSpace$Companion { + public final fun buffered (ILspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferVectorSpace; + public static synthetic fun buffered$default (Lspace/kscience/kmath/linear/VectorSpace$Companion;ILspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lspace/kscience/kmath/linear/BufferVectorSpace; + public final fun real (I)Lspace/kscience/kmath/linear/BufferVectorSpace; } -public final class kscience/kmath/linear/VectorSpace$DefaultImpls { - public static fun add (Lkscience/kmath/linear/VectorSpace;Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static fun binaryOperation (Lkscience/kmath/linear/VectorSpace;Ljava/lang/String;Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static fun binaryOperationFunction (Lkscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/linear/VectorSpace;Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; - public static fun getZero (Lkscience/kmath/linear/VectorSpace;)Lkscience/kmath/structures/Buffer; - public static fun minus (Lkscience/kmath/linear/VectorSpace;Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static fun multiply (Lkscience/kmath/linear/VectorSpace;Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; - public static fun plus (Lkscience/kmath/linear/VectorSpace;Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static fun symbol (Lkscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lkscience/kmath/structures/Buffer; - public static fun times (Lkscience/kmath/linear/VectorSpace;Ljava/lang/Number;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static fun times (Lkscience/kmath/linear/VectorSpace;Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; - public static fun unaryMinus (Lkscience/kmath/linear/VectorSpace;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static fun unaryOperation (Lkscience/kmath/linear/VectorSpace;Ljava/lang/String;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static fun unaryOperationFunction (Lkscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/linear/VectorSpace;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; +public final class space/kscience/kmath/linear/VectorSpace$DefaultImpls { + public static fun add (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun binaryOperation (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun binaryOperationFunction (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lspace/kscience/kmath/structures/Buffer; + public static fun div (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public static fun getZero (Lspace/kscience/kmath/linear/VectorSpace;)Lspace/kscience/kmath/structures/Buffer; + public static fun minus (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun multiply (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public static fun plus (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun times (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun times (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public static fun unaryMinus (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun unaryOperation (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun unaryOperationFunction (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; } -public final class kscience/kmath/linear/VirtualMatrix : kscience/kmath/nd/Structure2D { +public final class space/kscience/kmath/linear/VirtualMatrix : space/kscience/kmath/nd/Structure2D { public fun (IILkotlin/jvm/functions/Function2;)V public fun elements ()Lkotlin/sequences/Sequence; public fun equals (Ljava/lang/Object;)Z public fun get (II)Ljava/lang/Object; public fun get ([I)Ljava/lang/Object; public fun getColNum ()I - public fun getColumns ()Lkscience/kmath/structures/Buffer; + public fun getColumns ()Lspace/kscience/kmath/structures/Buffer; public fun getDimension ()I public fun getFeature (Lkotlin/reflect/KClass;)Ljava/lang/Object; public final fun getGenerator ()Lkotlin/jvm/functions/Function2; public fun getRowNum ()I - public fun getRows ()Lkscience/kmath/structures/Buffer; + public fun getRows ()Lspace/kscience/kmath/structures/Buffer; public fun getShape ()[I public fun hashCode ()I } -public final class kscience/kmath/linear/ZeroFeature : kscience/kmath/linear/DiagonalFeature { - public static final field INSTANCE Lkscience/kmath/linear/ZeroFeature; +public final class space/kscience/kmath/linear/ZeroFeature : space/kscience/kmath/linear/DiagonalFeature { + public static final field INSTANCE Lspace/kscience/kmath/linear/ZeroFeature; } -public final class kscience/kmath/misc/CumulativeKt { +public final class space/kscience/kmath/misc/CumulativeKt { public static final fun cumulative (Ljava/lang/Iterable;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/lang/Iterable; public static final fun cumulative (Ljava/util/Iterator;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/util/Iterator; public static final fun cumulative (Ljava/util/List;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/util/List; public static final fun cumulative (Lkotlin/sequences/Sequence;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Lkotlin/sequences/Sequence; - public static final fun cumulativeSum (Ljava/lang/Iterable;Lkscience/kmath/operations/Space;)Ljava/lang/Iterable; - public static final fun cumulativeSum (Ljava/util/List;Lkscience/kmath/operations/Space;)Ljava/util/List; - public static final fun cumulativeSum (Lkotlin/sequences/Sequence;Lkscience/kmath/operations/Space;)Lkotlin/sequences/Sequence; + public static final fun cumulativeSum (Ljava/lang/Iterable;Lspace/kscience/kmath/operations/Space;)Ljava/lang/Iterable; + public static final fun cumulativeSum (Ljava/util/List;Lspace/kscience/kmath/operations/Space;)Ljava/util/List; + public static final fun cumulativeSum (Lkotlin/sequences/Sequence;Lspace/kscience/kmath/operations/Space;)Lkotlin/sequences/Sequence; public static final fun cumulativeSumOfDouble (Ljava/lang/Iterable;)Ljava/lang/Iterable; public static final fun cumulativeSumOfDouble (Ljava/util/List;)Ljava/util/List; public static final fun cumulativeSumOfDouble (Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence; @@ -925,116 +925,116 @@ public final class kscience/kmath/misc/CumulativeKt { public static final fun cumulativeSumOfLong (Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence; } -public abstract interface annotation class kscience/kmath/misc/UnstableKMathAPI : java/lang/annotation/Annotation { +public abstract interface annotation class space/kscience/kmath/misc/UnstableKMathAPI : java/lang/annotation/Annotation { } -public abstract interface class kscience/kmath/nd/BufferNDAlgebra : kscience/kmath/nd/NDAlgebra { - public abstract fun combine (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDBuffer; - public abstract fun getBuffer (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/structures/Buffer; +public abstract interface class space/kscience/kmath/nd/BufferNDAlgebra : space/kscience/kmath/nd/NDAlgebra { + public abstract fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public abstract fun getBuffer (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/structures/Buffer; public abstract fun getBufferFactory ()Lkotlin/jvm/functions/Function2; - public abstract fun getStrides ()Lkscience/kmath/nd/Strides; - public abstract fun map (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; - public abstract fun mapIndexed (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDBuffer; - public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; + public abstract fun getStrides ()Lspace/kscience/kmath/nd/Strides; + public abstract fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public abstract fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; } -public final class kscience/kmath/nd/BufferNDAlgebra$DefaultImpls { - public static fun combine (Lkscience/kmath/nd/BufferNDAlgebra;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDBuffer; - public static fun getBuffer (Lkscience/kmath/nd/BufferNDAlgebra;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/structures/Buffer; - public static fun invoke (Lkscience/kmath/nd/BufferNDAlgebra;Lkotlin/jvm/functions/Function1;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun map (Lkscience/kmath/nd/BufferNDAlgebra;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; - public static fun mapIndexed (Lkscience/kmath/nd/BufferNDAlgebra;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDBuffer; - public static fun produce (Lkscience/kmath/nd/BufferNDAlgebra;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; +public final class space/kscience/kmath/nd/BufferNDAlgebra$DefaultImpls { + public static fun combine (Lspace/kscience/kmath/nd/BufferNDAlgebra;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public static fun getBuffer (Lspace/kscience/kmath/nd/BufferNDAlgebra;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/structures/Buffer; + public static fun invoke (Lspace/kscience/kmath/nd/BufferNDAlgebra;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun map (Lspace/kscience/kmath/nd/BufferNDAlgebra;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public static fun mapIndexed (Lspace/kscience/kmath/nd/BufferNDAlgebra;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public static fun produce (Lspace/kscience/kmath/nd/BufferNDAlgebra;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; } -public final class kscience/kmath/nd/BufferNDAlgebraKt { - public static final fun field (Lkscience/kmath/nd/NDAlgebra$Companion;Lkscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;[I)Lkscience/kmath/nd/BufferedNDField; - public static final fun ndField (Lkscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun ndRing (Lkscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun ndSpace (Lkscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun ring (Lkscience/kmath/nd/NDAlgebra$Companion;Lkscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[I)Lkscience/kmath/nd/BufferedNDRing; - public static final fun space (Lkscience/kmath/nd/NDAlgebra$Companion;Lkscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;[I)Lkscience/kmath/nd/BufferedNDSpace; +public final class space/kscience/kmath/nd/BufferNDAlgebraKt { + public static final fun field (Lspace/kscience/kmath/nd/NDAlgebra$Companion;Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedNDField; + public static final fun ndField (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final fun ndRing (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final fun ndSpace (Lspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final fun ring (Lspace/kscience/kmath/nd/NDAlgebra$Companion;Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedNDRing; + public static final fun space (Lspace/kscience/kmath/nd/NDAlgebra$Companion;Lspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedNDSpace; } -public class kscience/kmath/nd/BufferedNDField : kscience/kmath/nd/BufferedNDRing, kscience/kmath/nd/NDField { - public fun ([ILkscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;)V +public class space/kscience/kmath/nd/BufferedNDField : space/kscience/kmath/nd/BufferedNDRing, space/kscience/kmath/nd/NDField { + public fun ([ILspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;)V public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun div (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun div (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public fun div (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun div (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun div (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public fun div (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun divide (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public class kscience/kmath/nd/BufferedNDRing : kscience/kmath/nd/BufferedNDSpace, kscience/kmath/nd/NDRing { - public fun ([ILkscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V +public class space/kscience/kmath/nd/BufferedNDRing : space/kscience/kmath/nd/BufferedNDSpace, space/kscience/kmath/nd/NDRing { + public fun ([ILspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lkscience/kmath/nd/NDBuffer; + public fun getOne ()Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun multiply (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun times (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public fun times (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun times (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public fun times (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public class kscience/kmath/nd/BufferedNDSpace : kscience/kmath/nd/BufferNDAlgebra, kscience/kmath/nd/NDSpace { - public fun ([ILkscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;)V +public class space/kscience/kmath/nd/BufferedNDSpace : space/kscience/kmath/nd/BufferNDAlgebra, space/kscience/kmath/nd/NDSpace { + public fun ([ILspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;)V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun add (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public fun combine (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun combine (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDStructure; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/nd/NDStructure; + public fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun div (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public fun getBuffer (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/structures/Buffer; + public fun div (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public fun getBuffer (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/structures/Buffer; public final fun getBufferFactory ()Lkotlin/jvm/functions/Function2; public synthetic fun getElementContext ()Ljava/lang/Object; - public final fun getElementContext ()Lkscience/kmath/operations/Space; + public final fun getElementContext ()Lspace/kscience/kmath/operations/Space; public final fun getShape ()[I - public fun getStrides ()Lkscience/kmath/nd/Strides; + public fun getStrides ()Lspace/kscience/kmath/nd/Strides; public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lkscience/kmath/nd/NDBuffer; - public fun invoke (Lkotlin/jvm/functions/Function1;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun map (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun map (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDStructure; - public fun mapIndexed (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun mapIndexed (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDStructure; + public fun getZero ()Lspace/kscience/kmath/nd/NDBuffer; + public fun invoke (Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; + public fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun minus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public fun minus (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun minus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public fun minus (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun multiply (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun plus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public fun plus (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDStructure; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/nd/NDStructure; + public fun plus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun plus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public fun plus (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun times (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun times (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun unaryMinus (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun unaryPlus (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public final class kscience/kmath/nd/DefaultStrides : kscience/kmath/nd/Strides { - public static final field Companion Lkscience/kmath/nd/DefaultStrides$Companion; +public final class space/kscience/kmath/nd/DefaultStrides : space/kscience/kmath/nd/Strides { + public static final field Companion Lspace/kscience/kmath/nd/DefaultStrides$Companion; public synthetic fun ([ILkotlin/jvm/internal/DefaultConstructorMarker;)V public fun equals (Ljava/lang/Object;)Z public fun getLinearSize ()I @@ -1046,168 +1046,168 @@ public final class kscience/kmath/nd/DefaultStrides : kscience/kmath/nd/Strides public fun offset ([I)I } -public final class kscience/kmath/nd/DefaultStrides$Companion { - public final fun invoke ([I)Lkscience/kmath/nd/Strides; +public final class space/kscience/kmath/nd/DefaultStrides$Companion { + public final fun invoke ([I)Lspace/kscience/kmath/nd/Strides; } -public final class kscience/kmath/nd/MutableNDBuffer : kscience/kmath/nd/NDBuffer, kscience/kmath/nd/MutableNDStructure { - public fun (Lkscience/kmath/nd/Strides;Lkscience/kmath/structures/MutableBuffer;)V - public synthetic fun getBuffer ()Lkscience/kmath/structures/Buffer; - public fun getBuffer ()Lkscience/kmath/structures/MutableBuffer; +public final class space/kscience/kmath/nd/MutableNDBuffer : space/kscience/kmath/nd/NDBuffer, space/kscience/kmath/nd/MutableNDStructure { + public fun (Lspace/kscience/kmath/nd/Strides;Lspace/kscience/kmath/structures/MutableBuffer;)V + public synthetic fun getBuffer ()Lspace/kscience/kmath/structures/Buffer; + public fun getBuffer ()Lspace/kscience/kmath/structures/MutableBuffer; public fun set ([ILjava/lang/Object;)V } -public abstract interface class kscience/kmath/nd/MutableNDStructure : kscience/kmath/nd/NDStructure { +public abstract interface class space/kscience/kmath/nd/MutableNDStructure : space/kscience/kmath/nd/NDStructure { public abstract fun set ([ILjava/lang/Object;)V } -public final class kscience/kmath/nd/MutableNDStructure$DefaultImpls { - public static fun getDimension (Lkscience/kmath/nd/MutableNDStructure;)I - public static fun getFeature (Lkscience/kmath/nd/MutableNDStructure;Lkotlin/reflect/KClass;)Ljava/lang/Object; +public final class space/kscience/kmath/nd/MutableNDStructure$DefaultImpls { + public static fun getDimension (Lspace/kscience/kmath/nd/MutableNDStructure;)I + public static fun getFeature (Lspace/kscience/kmath/nd/MutableNDStructure;Lkotlin/reflect/KClass;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/nd/NDAlgebra { - public static final field Companion Lkscience/kmath/nd/NDAlgebra$Companion; - public abstract fun combine (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDStructure; +public abstract interface class space/kscience/kmath/nd/NDAlgebra { + public static final field Companion Lspace/kscience/kmath/nd/NDAlgebra$Companion; + public abstract fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; public abstract fun getElementContext ()Ljava/lang/Object; public abstract fun getShape ()[I - public abstract fun invoke (Lkotlin/jvm/functions/Function1;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public abstract fun map (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDStructure; - public abstract fun mapIndexed (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDStructure; - public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDStructure; + public abstract fun invoke (Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; } -public final class kscience/kmath/nd/NDAlgebra$Companion { +public final class space/kscience/kmath/nd/NDAlgebra$Companion { } -public final class kscience/kmath/nd/NDAlgebra$DefaultImpls { - public static fun invoke (Lkscience/kmath/nd/NDAlgebra;Lkotlin/jvm/functions/Function1;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; +public final class space/kscience/kmath/nd/NDAlgebra$DefaultImpls { + public static fun invoke (Lspace/kscience/kmath/nd/NDAlgebra;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public class kscience/kmath/nd/NDBuffer : kscience/kmath/nd/NDStructure { - public fun (Lkscience/kmath/nd/Strides;Lkscience/kmath/structures/Buffer;)V +public class space/kscience/kmath/nd/NDBuffer : space/kscience/kmath/nd/NDStructure { + public fun (Lspace/kscience/kmath/nd/Strides;Lspace/kscience/kmath/structures/Buffer;)V public fun elements ()Lkotlin/sequences/Sequence; public fun equals (Ljava/lang/Object;)Z public fun get ([I)Ljava/lang/Object; - public fun getBuffer ()Lkscience/kmath/structures/Buffer; + public fun getBuffer ()Lspace/kscience/kmath/structures/Buffer; public fun getDimension ()I public fun getFeature (Lkotlin/reflect/KClass;)Ljava/lang/Object; public fun getShape ()[I - public final fun getStrides ()Lkscience/kmath/nd/Strides; + public final fun getStrides ()Lspace/kscience/kmath/nd/Strides; public fun hashCode ()I public fun toString ()Ljava/lang/String; } -public abstract interface class kscience/kmath/nd/NDField : kscience/kmath/nd/NDRing, kscience/kmath/operations/Field { - public abstract fun div (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public abstract fun div (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public abstract fun divide (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; +public abstract interface class space/kscience/kmath/nd/NDField : space/kscience/kmath/nd/NDRing, space/kscience/kmath/operations/Field { + public abstract fun div (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun div (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun divide (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public final class kscience/kmath/nd/NDField$DefaultImpls { - public static fun add (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun binaryOperation (Lkscience/kmath/nd/NDField;Ljava/lang/String;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun binaryOperationFunction (Lkscience/kmath/nd/NDField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/nd/NDField;Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun div (Lkscience/kmath/nd/NDField;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun div (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun div (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun div (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun divide (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun invoke (Lkscience/kmath/nd/NDField;Lkotlin/jvm/functions/Function1;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDField;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun multiply (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun multiply (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDField;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun symbol (Lkscience/kmath/nd/NDField;Ljava/lang/String;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDField;Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDField;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun unaryMinus (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun unaryOperation (Lkscience/kmath/nd/NDField;Ljava/lang/String;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun unaryOperationFunction (Lkscience/kmath/nd/NDField;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; +public final class space/kscience/kmath/nd/NDField$DefaultImpls { + public static fun add (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun binaryOperation (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun binaryOperationFunction (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;)Lspace/kscience/kmath/nd/NDStructure; + public static fun div (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun div (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun div (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun div (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun div (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun divide (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun invoke (Lspace/kscience/kmath/nd/NDField;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun multiply (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun multiply (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryMinus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryOperation (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryOperationFunction (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public abstract interface class kscience/kmath/nd/NDRing : kscience/kmath/nd/NDSpace, kscience/kmath/operations/Ring { - public static final field Companion Lkscience/kmath/nd/NDRing$Companion; - public abstract fun multiply (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public abstract fun times (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public abstract fun times (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; +public abstract interface class space/kscience/kmath/nd/NDRing : space/kscience/kmath/nd/NDSpace, space/kscience/kmath/operations/Ring { + public static final field Companion Lspace/kscience/kmath/nd/NDRing$Companion; + public abstract fun multiply (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun times (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; } -public final class kscience/kmath/nd/NDRing$Companion { +public final class space/kscience/kmath/nd/NDRing$Companion { } -public final class kscience/kmath/nd/NDRing$DefaultImpls { - public static fun add (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun binaryOperation (Lkscience/kmath/nd/NDRing;Ljava/lang/String;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun binaryOperationFunction (Lkscience/kmath/nd/NDRing;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun invoke (Lkscience/kmath/nd/NDRing;Lkotlin/jvm/functions/Function1;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDRing;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun multiply (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun multiply (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDRing;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun symbol (Lkscience/kmath/nd/NDRing;Ljava/lang/String;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDRing;Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDRing;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun unaryMinus (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun unaryOperation (Lkscience/kmath/nd/NDRing;Ljava/lang/String;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun unaryOperationFunction (Lkscience/kmath/nd/NDRing;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; +public final class space/kscience/kmath/nd/NDRing$DefaultImpls { + public static fun add (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun binaryOperation (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun binaryOperationFunction (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;)Lspace/kscience/kmath/nd/NDStructure; + public static fun div (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun invoke (Lspace/kscience/kmath/nd/NDRing;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun multiply (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun multiply (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryMinus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryOperation (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryOperationFunction (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public abstract interface class kscience/kmath/nd/NDSpace : kscience/kmath/nd/NDAlgebra, kscience/kmath/operations/Space { - public static final field Companion Lkscience/kmath/nd/NDSpace$Companion; - public abstract fun add (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public abstract fun minus (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public abstract fun minus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public abstract fun multiply (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public abstract fun plus (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public abstract fun plus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; +public abstract interface class space/kscience/kmath/nd/NDSpace : space/kscience/kmath/nd/NDAlgebra, space/kscience/kmath/operations/Space { + public static final field Companion Lspace/kscience/kmath/nd/NDSpace$Companion; + public abstract fun add (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun minus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun multiply (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun plus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun plus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; } -public final class kscience/kmath/nd/NDSpace$Companion { +public final class space/kscience/kmath/nd/NDSpace$Companion { } -public final class kscience/kmath/nd/NDSpace$DefaultImpls { - public static fun add (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun binaryOperation (Lkscience/kmath/nd/NDSpace;Ljava/lang/String;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun binaryOperationFunction (Lkscience/kmath/nd/NDSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun invoke (Lkscience/kmath/nd/NDSpace;Lkotlin/jvm/functions/Function1;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDSpace;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun multiply (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDSpace;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun symbol (Lkscience/kmath/nd/NDSpace;Ljava/lang/String;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDSpace;Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun unaryMinus (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun unaryOperation (Lkscience/kmath/nd/NDSpace;Ljava/lang/String;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun unaryOperationFunction (Lkscience/kmath/nd/NDSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; +public final class space/kscience/kmath/nd/NDSpace$DefaultImpls { + public static fun add (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun binaryOperation (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun binaryOperationFunction (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;)Lspace/kscience/kmath/nd/NDStructure; + public static fun div (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun invoke (Lspace/kscience/kmath/nd/NDSpace;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun multiply (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryMinus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryOperation (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryOperationFunction (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public abstract interface class kscience/kmath/nd/NDStructure { - public static final field Companion Lkscience/kmath/nd/NDStructure$Companion; +public abstract interface class space/kscience/kmath/nd/NDStructure { + public static final field Companion Lspace/kscience/kmath/nd/NDStructure$Companion; public abstract fun elements ()Lkotlin/sequences/Sequence; public abstract fun equals (Ljava/lang/Object;)Z public abstract fun get ([I)Ljava/lang/Object; @@ -1217,136 +1217,136 @@ public abstract interface class kscience/kmath/nd/NDStructure { public abstract fun hashCode ()I } -public final class kscience/kmath/nd/NDStructure$Companion { - public final fun auto (Lkotlin/reflect/KClass;Lkscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/nd/NDBuffer; - public final fun auto (Lkotlin/reflect/KClass;[ILkotlin/jvm/functions/Function1;)Lkscience/kmath/nd/NDBuffer; - public final fun build (Lkscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/nd/NDBuffer; - public final fun build ([ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/nd/NDBuffer; - public static synthetic fun build$default (Lkscience/kmath/nd/NDStructure$Companion;Lkscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lkscience/kmath/nd/NDBuffer; - public static synthetic fun build$default (Lkscience/kmath/nd/NDStructure$Companion;[ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lkscience/kmath/nd/NDBuffer; - public final fun contentEquals (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Z +public final class space/kscience/kmath/nd/NDStructure$Companion { + public final fun auto (Lkotlin/reflect/KClass;Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; + public final fun auto (Lkotlin/reflect/KClass;[ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; + public final fun build (Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; + public final fun build ([ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; + public static synthetic fun build$default (Lspace/kscience/kmath/nd/NDStructure$Companion;Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/kmath/nd/NDBuffer; + public static synthetic fun build$default (Lspace/kscience/kmath/nd/NDStructure$Companion;[ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/kmath/nd/NDBuffer; + public final fun contentEquals (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Z } -public final class kscience/kmath/nd/NDStructure$DefaultImpls { - public static fun getDimension (Lkscience/kmath/nd/NDStructure;)I - public static fun getFeature (Lkscience/kmath/nd/NDStructure;Lkotlin/reflect/KClass;)Ljava/lang/Object; +public final class space/kscience/kmath/nd/NDStructure$DefaultImpls { + public static fun getDimension (Lspace/kscience/kmath/nd/NDStructure;)I + public static fun getFeature (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/reflect/KClass;)Ljava/lang/Object; } -public final class kscience/kmath/nd/NDStructureKt { - public static final fun get (Lkscience/kmath/nd/NDStructure;[I)Ljava/lang/Object; - public static final fun mapInPlace (Lkscience/kmath/nd/MutableNDStructure;Lkotlin/jvm/functions/Function2;)V +public final class space/kscience/kmath/nd/NDStructureKt { + public static final fun get (Lspace/kscience/kmath/nd/NDStructure;[I)Ljava/lang/Object; + public static final fun mapInPlace (Lspace/kscience/kmath/nd/MutableNDStructure;Lkotlin/jvm/functions/Function2;)V } -public final class kscience/kmath/nd/RealNDField : kscience/kmath/nd/BufferedNDField, kscience/kmath/operations/ExtendedField, kscience/kmath/operations/RingWithNumbers { +public final class space/kscience/kmath/nd/RealNDField : space/kscience/kmath/nd/BufferedNDField, space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/RingWithNumbers { public fun ([I)V public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; - public fun acos (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun acos (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun acosh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun acosh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; - public fun asin (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun asin (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun asinh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun asinh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; - public fun atan (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun atan (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun atanh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; - public fun combine (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun combine (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDStructure; + public fun atanh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; + public fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; - public fun cos (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun cos (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun cosh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun cosh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; - public fun exp (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun getBuffer (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/structures/Buffer; - public fun getBuffer-JVEF3vg (Lkscience/kmath/nd/NDStructure;)[D + public fun exp (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun getBuffer (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/structures/Buffer; + public fun getBuffer-LGjt3BI (Lspace/kscience/kmath/nd/NDStructure;)[D public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lkscience/kmath/nd/NDBuffer; + public fun getOne ()Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lkscience/kmath/nd/NDBuffer; + public fun getZero ()Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; - public fun ln (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; - public fun map (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun map (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDStructure; - public fun mapIndexed (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun mapIndexed (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDStructure; + public fun ln (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; + public fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; + public fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun minus (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun minus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number (Ljava/lang/Number;)Lkscience/kmath/nd/NDBuffer; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun plus (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun plus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun pow (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun pow (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun power (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDBuffer; - public fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDStructure; + public fun power (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDBuffer; + public fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; - public fun sin (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun sin (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun sinh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun sinh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun sqrt (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun sqrt (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; - public fun tan (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun tan (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun tanh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun tanh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/nd/RealNDFieldKt { - public static final fun nd (Lkscience/kmath/operations/RealField;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun real (Lkscience/kmath/nd/NDAlgebra$Companion;[I)Lkscience/kmath/nd/RealNDField; +public final class space/kscience/kmath/nd/RealNDFieldKt { + public static final fun nd (Lspace/kscience/kmath/operations/RealField;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final fun real (Lspace/kscience/kmath/nd/NDAlgebra$Companion;[I)Lspace/kscience/kmath/nd/RealNDField; } -public final class kscience/kmath/nd/ShapeMismatchException : java/lang/RuntimeException { +public final class space/kscience/kmath/nd/ShapeMismatchException : java/lang/RuntimeException { public fun ([I[I)V public final fun getActual ()[I public final fun getExpected ()[I } -public final class kscience/kmath/nd/ShortNDRing : kscience/kmath/nd/BufferedNDRing, kscience/kmath/operations/RingWithNumbers { +public final class space/kscience/kmath/nd/ShortNDRing : space/kscience/kmath/nd/BufferedNDRing, space/kscience/kmath/operations/RingWithNumbers { public fun ([I)V public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lkscience/kmath/nd/NDBuffer; + public fun getOne ()Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lkscience/kmath/nd/NDBuffer; + public fun getZero ()Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun minus (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun minus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number (Ljava/lang/Number;)Lkscience/kmath/nd/NDBuffer; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun plus (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun plus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; } -public final class kscience/kmath/nd/ShortNDRingKt { - public static final fun nd (Lkscience/kmath/operations/ShortRing;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun produceInline (Lkscience/kmath/nd/BufferedNDRing;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; +public final class space/kscience/kmath/nd/ShortNDRingKt { + public static final fun nd (Lspace/kscience/kmath/operations/ShortRing;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final fun produceInline (Lspace/kscience/kmath/nd/BufferedNDRing;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; } -public abstract interface class kscience/kmath/nd/Strides { +public abstract interface class space/kscience/kmath/nd/Strides { public abstract fun getLinearSize ()I public abstract fun getShape ()[I public abstract fun getStrides ()Ljava/util/List; @@ -1355,222 +1355,225 @@ public abstract interface class kscience/kmath/nd/Strides { public abstract fun offset ([I)I } -public final class kscience/kmath/nd/Strides$DefaultImpls { - public static fun indices (Lkscience/kmath/nd/Strides;)Lkotlin/sequences/Sequence; +public final class space/kscience/kmath/nd/Strides$DefaultImpls { + public static fun indices (Lspace/kscience/kmath/nd/Strides;)Lkotlin/sequences/Sequence; } -public abstract interface class kscience/kmath/nd/Structure1D : kscience/kmath/nd/NDStructure, kscience/kmath/structures/Buffer { +public abstract interface class space/kscience/kmath/nd/Structure1D : space/kscience/kmath/nd/NDStructure, space/kscience/kmath/structures/Buffer { public abstract fun get ([I)Ljava/lang/Object; public abstract fun getDimension ()I public abstract fun iterator ()Ljava/util/Iterator; } -public final class kscience/kmath/nd/Structure1D$DefaultImpls { - public static fun contentEquals (Lkscience/kmath/nd/Structure1D;Lkscience/kmath/structures/Buffer;)Z - public static fun get (Lkscience/kmath/nd/Structure1D;[I)Ljava/lang/Object; - public static fun getDimension (Lkscience/kmath/nd/Structure1D;)I - public static fun getFeature (Lkscience/kmath/nd/Structure1D;Lkotlin/reflect/KClass;)Ljava/lang/Object; - public static fun iterator (Lkscience/kmath/nd/Structure1D;)Ljava/util/Iterator; +public final class space/kscience/kmath/nd/Structure1D$DefaultImpls { + public static fun contentEquals (Lspace/kscience/kmath/nd/Structure1D;Lspace/kscience/kmath/structures/Buffer;)Z + public static fun get (Lspace/kscience/kmath/nd/Structure1D;[I)Ljava/lang/Object; + public static fun getDimension (Lspace/kscience/kmath/nd/Structure1D;)I + public static fun getFeature (Lspace/kscience/kmath/nd/Structure1D;Lkotlin/reflect/KClass;)Ljava/lang/Object; + public static fun iterator (Lspace/kscience/kmath/nd/Structure1D;)Ljava/util/Iterator; } -public final class kscience/kmath/nd/Structure1DKt { - public static final fun as1D (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/Structure1D; - public static final fun asND (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/nd/Structure1D; +public final class space/kscience/kmath/nd/Structure1DKt { + public static final fun as1D (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/Structure1D; + public static final fun asND (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/nd/Structure1D; } -public abstract interface class kscience/kmath/nd/Structure2D : kscience/kmath/nd/NDStructure { - public static final field Companion Lkscience/kmath/nd/Structure2D$Companion; +public abstract interface class space/kscience/kmath/nd/Structure2D : space/kscience/kmath/nd/NDStructure { + public static final field Companion Lspace/kscience/kmath/nd/Structure2D$Companion; public abstract fun elements ()Lkotlin/sequences/Sequence; public abstract fun get (II)Ljava/lang/Object; public abstract fun get ([I)Ljava/lang/Object; public abstract fun getColNum ()I - public abstract fun getColumns ()Lkscience/kmath/structures/Buffer; + public abstract fun getColumns ()Lspace/kscience/kmath/structures/Buffer; public abstract fun getRowNum ()I - public abstract fun getRows ()Lkscience/kmath/structures/Buffer; + public abstract fun getRows ()Lspace/kscience/kmath/structures/Buffer; public abstract fun getShape ()[I } -public final class kscience/kmath/nd/Structure2D$Companion { - public final fun real (IILkotlin/jvm/functions/Function2;)Lkscience/kmath/linear/BufferMatrix; +public final class space/kscience/kmath/nd/Structure2D$Companion { + public final fun real (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferMatrix; } -public final class kscience/kmath/nd/Structure2D$DefaultImpls { - public static fun elements (Lkscience/kmath/nd/Structure2D;)Lkotlin/sequences/Sequence; - public static fun get (Lkscience/kmath/nd/Structure2D;[I)Ljava/lang/Object; - public static fun getColumns (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/structures/Buffer; - public static fun getDimension (Lkscience/kmath/nd/Structure2D;)I - public static fun getFeature (Lkscience/kmath/nd/Structure2D;Lkotlin/reflect/KClass;)Ljava/lang/Object; - public static fun getRows (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/structures/Buffer; - public static fun getShape (Lkscience/kmath/nd/Structure2D;)[I +public final class space/kscience/kmath/nd/Structure2D$DefaultImpls { + public static fun elements (Lspace/kscience/kmath/nd/Structure2D;)Lkotlin/sequences/Sequence; + public static fun get (Lspace/kscience/kmath/nd/Structure2D;[I)Ljava/lang/Object; + public static fun getColumns (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/structures/Buffer; + public static fun getDimension (Lspace/kscience/kmath/nd/Structure2D;)I + public static fun getFeature (Lspace/kscience/kmath/nd/Structure2D;Lkotlin/reflect/KClass;)Ljava/lang/Object; + public static fun getRows (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/structures/Buffer; + public static fun getShape (Lspace/kscience/kmath/nd/Structure2D;)[I } -public final class kscience/kmath/nd/Structure2DKt { - public static final fun as2D (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/Structure2D; +public final class space/kscience/kmath/nd/Structure2DKt { + public static final fun as2D (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/Structure2D; } -public abstract interface class kscience/kmath/operations/Algebra { +public abstract interface class space/kscience/kmath/operations/Algebra { public abstract fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public abstract fun symbol (Ljava/lang/String;)Ljava/lang/Object; + public abstract fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public abstract fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/operations/Algebra$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/Algebra;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/Algebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun symbol (Lkscience/kmath/operations/Algebra;Ljava/lang/String;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/Algebra;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/Algebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; +public final class space/kscience/kmath/operations/Algebra$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/Algebra;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/Algebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/Algebra;Ljava/lang/String;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/Algebra;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/Algebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public abstract interface class kscience/kmath/operations/AlgebraElement { - public abstract fun getContext ()Lkscience/kmath/operations/Algebra; +public abstract interface class space/kscience/kmath/operations/AlgebraElement { + public abstract fun getContext ()Lspace/kscience/kmath/operations/Algebra; } -public final class kscience/kmath/operations/AlgebraElementsKt { - public static final fun div (Lkscience/kmath/operations/AlgebraElement;Ljava/lang/Number;)Lkscience/kmath/operations/AlgebraElement; - public static final fun div (Lkscience/kmath/operations/AlgebraElement;Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun minus (Lkscience/kmath/operations/AlgebraElement;Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun plus (Lkscience/kmath/operations/AlgebraElement;Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun times (Ljava/lang/Number;Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun times (Lkscience/kmath/operations/AlgebraElement;Ljava/lang/Number;)Lkscience/kmath/operations/AlgebraElement; - public static final fun times (Lkscience/kmath/operations/AlgebraElement;Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; +public final class space/kscience/kmath/operations/AlgebraElementsKt { + public static final fun div (Lspace/kscience/kmath/operations/AlgebraElement;Ljava/lang/Number;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun div (Lspace/kscience/kmath/operations/AlgebraElement;Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun minus (Lspace/kscience/kmath/operations/AlgebraElement;Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun plus (Lspace/kscience/kmath/operations/AlgebraElement;Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun times (Ljava/lang/Number;Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun times (Lspace/kscience/kmath/operations/AlgebraElement;Ljava/lang/Number;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun times (Lspace/kscience/kmath/operations/AlgebraElement;Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; } -public final class kscience/kmath/operations/AlgebraExtensionsKt { - public static final fun abs (Lkscience/kmath/operations/Space;Ljava/lang/Comparable;)Ljava/lang/Comparable; - public static final fun average (Lkscience/kmath/operations/Space;Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun average (Lkscience/kmath/operations/Space;Lkotlin/sequences/Sequence;)Ljava/lang/Object; - public static final fun averageWith (Ljava/lang/Iterable;Lkscience/kmath/operations/Space;)Ljava/lang/Object; - public static final fun averageWith (Lkotlin/sequences/Sequence;Lkscience/kmath/operations/Space;)Ljava/lang/Object; - public static final fun power (Lkscience/kmath/operations/Field;Ljava/lang/Object;I)Ljava/lang/Object; - public static final fun power (Lkscience/kmath/operations/Ring;Ljava/lang/Object;I)Ljava/lang/Object; - public static final fun sum (Lkscience/kmath/operations/Space;Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun sum (Lkscience/kmath/operations/Space;Lkotlin/sequences/Sequence;)Ljava/lang/Object; - public static final fun sumWith (Ljava/lang/Iterable;Lkscience/kmath/operations/Space;)Ljava/lang/Object; - public static final fun sumWith (Lkotlin/sequences/Sequence;Lkscience/kmath/operations/Space;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/AlgebraExtensionsKt { + public static final fun abs (Lspace/kscience/kmath/operations/Space;Ljava/lang/Comparable;)Ljava/lang/Comparable; + public static final fun average (Lspace/kscience/kmath/operations/Space;Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun average (Lspace/kscience/kmath/operations/Space;Lkotlin/sequences/Sequence;)Ljava/lang/Object; + public static final fun averageWith (Ljava/lang/Iterable;Lspace/kscience/kmath/operations/Space;)Ljava/lang/Object; + public static final fun averageWith (Lkotlin/sequences/Sequence;Lspace/kscience/kmath/operations/Space;)Ljava/lang/Object; + public static final fun power (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;I)Ljava/lang/Object; + public static final fun power (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;I)Ljava/lang/Object; + public static final fun sum (Lspace/kscience/kmath/operations/Space;Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun sum (Lspace/kscience/kmath/operations/Space;Lkotlin/sequences/Sequence;)Ljava/lang/Object; + public static final fun sumWith (Ljava/lang/Iterable;Lspace/kscience/kmath/operations/Space;)Ljava/lang/Object; + public static final fun sumWith (Lkotlin/sequences/Sequence;Lspace/kscience/kmath/operations/Space;)Ljava/lang/Object; } -public final class kscience/kmath/operations/AlgebraKt { - public static final fun invoke (Lkscience/kmath/operations/Algebra;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/AlgebraKt { + public static final fun bindSymbol (Lspace/kscience/kmath/operations/Algebra;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static final fun invoke (Lspace/kscience/kmath/operations/Algebra;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; } -public final class kscience/kmath/operations/BigInt : java/lang/Comparable { +public final class space/kscience/kmath/operations/BigInt : java/lang/Comparable { public static final field BASE J public static final field BASE_SIZE I - public static final field Companion Lkscience/kmath/operations/BigInt$Companion; - public final fun abs ()Lkscience/kmath/operations/BigInt; - public final fun and (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public static final field Companion Lspace/kscience/kmath/operations/BigInt$Companion; + public final fun abs ()Lspace/kscience/kmath/operations/BigInt; + public final fun and (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun compareTo (Ljava/lang/Object;)I - public fun compareTo (Lkscience/kmath/operations/BigInt;)I - public final fun div (I)Lkscience/kmath/operations/BigInt; - public final fun div (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; - public final fun div-WZ4Q5Ns (I)Lkscience/kmath/operations/BigInt; + public fun compareTo (Lspace/kscience/kmath/operations/BigInt;)I + public final fun div (I)Lspace/kscience/kmath/operations/BigInt; + public final fun div (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; + public final fun div-WZ4Q5Ns (I)Lspace/kscience/kmath/operations/BigInt; public fun equals (Ljava/lang/Object;)Z public fun hashCode ()I - public final fun minus (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; - public final fun modPow (Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; - public final fun or (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; - public final fun plus (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public final fun minus (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; + public final fun modPow (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; + public final fun or (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; + public final fun plus (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public final fun rem (I)I - public final fun rem (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; - public final fun shl (I)Lkscience/kmath/operations/BigInt; - public final fun shr (I)Lkscience/kmath/operations/BigInt; - public final fun times (I)Lkscience/kmath/operations/BigInt; - public final fun times (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; - public final fun times-WZ4Q5Ns (I)Lkscience/kmath/operations/BigInt; + public final fun rem (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; + public final fun shl (I)Lspace/kscience/kmath/operations/BigInt; + public final fun shr (I)Lspace/kscience/kmath/operations/BigInt; + public final fun times (I)Lspace/kscience/kmath/operations/BigInt; + public final fun times (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; + public final fun times-WZ4Q5Ns (I)Lspace/kscience/kmath/operations/BigInt; public fun toString ()Ljava/lang/String; - public final fun unaryMinus ()Lkscience/kmath/operations/BigInt; + public final fun unaryMinus ()Lspace/kscience/kmath/operations/BigInt; } -public final class kscience/kmath/operations/BigInt$Companion { - public final fun getONE ()Lkscience/kmath/operations/BigInt; - public final fun getZERO ()Lkscience/kmath/operations/BigInt; +public final class space/kscience/kmath/operations/BigInt$Companion { + public final fun getONE ()Lspace/kscience/kmath/operations/BigInt; + public final fun getZERO ()Lspace/kscience/kmath/operations/BigInt; } -public final class kscience/kmath/operations/BigIntField : kscience/kmath/operations/Field, kscience/kmath/operations/RingWithNumbers { - public static final field INSTANCE Lkscience/kmath/operations/BigIntField; +public final class space/kscience/kmath/operations/BigIntField : space/kscience/kmath/operations/Field, space/kscience/kmath/operations/RingWithNumbers { + public static final field INSTANCE Lspace/kscience/kmath/operations/BigIntField; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun add (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Number;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun div (Ljava/lang/Number;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Lkscience/kmath/operations/BigInt;Ljava/lang/Number;)Lkscience/kmath/operations/BigInt; - public fun div (Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun div (Lspace/kscience/kmath/operations/BigInt;Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; + public fun div (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide (Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun divide (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lkscience/kmath/operations/BigInt; + public fun getOne ()Lspace/kscience/kmath/operations/BigInt; public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lkscience/kmath/operations/BigInt; + public fun getZero ()Lspace/kscience/kmath/operations/BigInt; public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Ljava/lang/Number;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun minus (Ljava/lang/Number;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Lkscience/kmath/operations/BigInt;Ljava/lang/Number;)Lkscience/kmath/operations/BigInt; - public fun minus (Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun minus (Lspace/kscience/kmath/operations/BigInt;Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; + public fun minus (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/operations/BigInt;Ljava/lang/Number;)Lkscience/kmath/operations/BigInt; - public fun multiply (Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun multiply (Lspace/kscience/kmath/operations/BigInt;Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; + public fun multiply (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number (Ljava/lang/Number;)Lkscience/kmath/operations/BigInt; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Ljava/lang/Number;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun plus (Ljava/lang/Number;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/operations/BigInt;Ljava/lang/Number;)Lkscience/kmath/operations/BigInt; - public fun plus (Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun plus (Lspace/kscience/kmath/operations/BigInt;Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; + public fun plus (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lkscience/kmath/operations/BigInt;Ljava/lang/Number;)Lkscience/kmath/operations/BigInt; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/operations/BigInt;Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/operations/BigInt; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Lkscience/kmath/operations/BigInt;Ljava/lang/Number;)Lkscience/kmath/operations/BigInt; - public fun times (Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun times (Lspace/kscience/kmath/operations/BigInt;Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; + public fun times (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public final fun unaryMinus (Ljava/lang/String;)Lkscience/kmath/operations/BigInt; - public fun unaryMinus (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public final fun unaryMinus (Ljava/lang/String;)Lspace/kscience/kmath/operations/BigInt; + public fun unaryMinus (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public final fun unaryPlus (Ljava/lang/String;)Lkscience/kmath/operations/BigInt; - public fun unaryPlus (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public final fun unaryPlus (Ljava/lang/String;)Lspace/kscience/kmath/operations/BigInt; + public fun unaryPlus (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; } -public final class kscience/kmath/operations/BigIntKt { - public static final fun abs (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; - public static final fun bigInt (Lkscience/kmath/nd/NDAlgebra$Companion;[I)Lkscience/kmath/nd/BufferedNDRing; - public static final fun bigInt (Lkscience/kmath/structures/Buffer$Companion;ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/Buffer; - public static final fun bigInt (Lkscience/kmath/structures/MutableBuffer$Companion;ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/MutableBuffer; - public static final fun parseBigInteger (Ljava/lang/String;)Lkscience/kmath/operations/BigInt; - public static final fun toBigInt (I)Lkscience/kmath/operations/BigInt; - public static final fun toBigInt (J)Lkscience/kmath/operations/BigInt; - public static final fun toBigInt-LpG4sQ0 ([IB)Lkscience/kmath/operations/BigInt; - public static final fun toBigInt-VKZWuLQ (J)Lkscience/kmath/operations/BigInt; - public static final fun toBigInt-WZ4Q5Ns (I)Lkscience/kmath/operations/BigInt; +public final class space/kscience/kmath/operations/BigIntKt { + public static final fun abs (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; + public static final fun bigInt (Lspace/kscience/kmath/nd/NDAlgebra$Companion;[I)Lspace/kscience/kmath/nd/BufferedNDRing; + public static final fun bigInt (Lspace/kscience/kmath/structures/Buffer$Companion;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public static final fun bigInt (Lspace/kscience/kmath/structures/MutableBuffer$Companion;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/MutableBuffer; + public static final fun parseBigInteger (Ljava/lang/String;)Lspace/kscience/kmath/operations/BigInt; + public static final fun toBigInt (I)Lspace/kscience/kmath/operations/BigInt; + public static final fun toBigInt (J)Lspace/kscience/kmath/operations/BigInt; + public static final fun toBigInt-LpG4sQ0 ([IB)Lspace/kscience/kmath/operations/BigInt; + public static final fun toBigInt-VKZWuLQ (J)Lspace/kscience/kmath/operations/BigInt; + public static final fun toBigInt-WZ4Q5Ns (I)Lspace/kscience/kmath/operations/BigInt; } -public final class kscience/kmath/operations/ByteRing : kscience/kmath/operations/Norm, kscience/kmath/operations/NumericAlgebra, kscience/kmath/operations/Ring { - public static final field INSTANCE Lkscience/kmath/operations/ByteRing; +public final class space/kscience/kmath/operations/ByteRing : space/kscience/kmath/operations/Norm, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/Ring { + public static final field INSTANCE Lspace/kscience/kmath/operations/ByteRing; public fun add (BB)Ljava/lang/Byte; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperation (Ljava/lang/String;BB)Ljava/lang/Byte; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public fun bindSymbol (Ljava/lang/String;)Ljava/lang/Byte; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun div (BLjava/lang/Number;)Ljava/lang/Byte; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun getOne ()Ljava/lang/Byte; @@ -1595,8 +1598,6 @@ public final class kscience/kmath/operations/ByteRing : kscience/kmath/operation public fun rightSideNumberOperation (Ljava/lang/String;BLjava/lang/Number;)Ljava/lang/Byte; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public fun symbol (Ljava/lang/String;)Ljava/lang/Byte; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; public fun times (BB)Ljava/lang/Byte; public fun times (BLjava/lang/Number;)Ljava/lang/Byte; public fun times (Ljava/lang/Number;B)Ljava/lang/Byte; @@ -1612,28 +1613,28 @@ public final class kscience/kmath/operations/ByteRing : kscience/kmath/operation public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/ExponentialOperations : kscience/kmath/operations/Algebra { - public static final field Companion Lkscience/kmath/operations/ExponentialOperations$Companion; +public abstract interface class space/kscience/kmath/operations/ExponentialOperations : space/kscience/kmath/operations/Algebra { + public static final field Companion Lspace/kscience/kmath/operations/ExponentialOperations$Companion; public static final field EXP_OPERATION Ljava/lang/String; public static final field LN_OPERATION Ljava/lang/String; public abstract fun exp (Ljava/lang/Object;)Ljava/lang/Object; public abstract fun ln (Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/ExponentialOperations$Companion { +public final class space/kscience/kmath/operations/ExponentialOperations$Companion { public static final field EXP_OPERATION Ljava/lang/String; public static final field LN_OPERATION Ljava/lang/String; } -public final class kscience/kmath/operations/ExponentialOperations$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/ExponentialOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/ExponentialOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun symbol (Lkscience/kmath/operations/ExponentialOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/ExponentialOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/ExponentialOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; +public final class space/kscience/kmath/operations/ExponentialOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/ExponentialOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/ExponentialOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/ExponentialOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/ExponentialOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/ExponentialOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public abstract interface class kscience/kmath/operations/ExtendedField : kscience/kmath/operations/ExtendedFieldOperations, kscience/kmath/operations/Field, kscience/kmath/operations/NumericAlgebra { +public abstract interface class space/kscience/kmath/operations/ExtendedField : space/kscience/kmath/operations/ExtendedFieldOperations, space/kscience/kmath/operations/Field, space/kscience/kmath/operations/NumericAlgebra { public abstract fun acosh (Ljava/lang/Object;)Ljava/lang/Object; public abstract fun asinh (Ljava/lang/Object;)Ljava/lang/Object; public abstract fun atanh (Ljava/lang/Object;)Ljava/lang/Object; @@ -1643,120 +1644,120 @@ public abstract interface class kscience/kmath/operations/ExtendedField : kscien public abstract fun tanh (Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/ExtendedField$DefaultImpls { - public static fun acosh (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun asinh (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun atanh (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperation (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun cosh (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun div (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun div (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun div (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun leftSideNumberOperation (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun leftSideNumberOperationFunction (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun minus (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun pow (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun rightSideNumberOperation (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun rightSideNumberOperationFunction (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun sinh (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun sqrt (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;)Ljava/lang/Object; - public static fun tan (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun tanh (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/ExtendedField$DefaultImpls { + public static fun acosh (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun asinh (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun atanh (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperation (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;)Ljava/lang/Object; + public static fun cosh (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun leftSideNumberOperation (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun leftSideNumberOperationFunction (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun minus (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun pow (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun rightSideNumberOperation (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun rightSideNumberOperationFunction (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun sinh (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun sqrt (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun tan (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun tanh (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/ExtendedFieldOperations : kscience/kmath/operations/ExponentialOperations, kscience/kmath/operations/FieldOperations, kscience/kmath/operations/HyperbolicOperations, kscience/kmath/operations/PowerOperations, kscience/kmath/operations/TrigonometricOperations { +public abstract interface class space/kscience/kmath/operations/ExtendedFieldOperations : space/kscience/kmath/operations/ExponentialOperations, space/kscience/kmath/operations/FieldOperations, space/kscience/kmath/operations/HyperbolicOperations, space/kscience/kmath/operations/PowerOperations, space/kscience/kmath/operations/TrigonometricOperations { public abstract fun tan (Ljava/lang/Object;)Ljava/lang/Object; public abstract fun tanh (Ljava/lang/Object;)Ljava/lang/Object; public abstract fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/operations/ExtendedFieldOperations$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun div (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun pow (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun sqrt (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun tan (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun tanh (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/ExtendedFieldOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun pow (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun sqrt (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; + public static fun tan (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; + public static fun tanh (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/Field : kscience/kmath/operations/FieldOperations, kscience/kmath/operations/Ring { +public abstract interface class space/kscience/kmath/operations/Field : space/kscience/kmath/operations/FieldOperations, space/kscience/kmath/operations/Ring { public abstract fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/Field$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/Field;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/Field;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/operations/Field;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun div (Lkscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun div (Lkscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/Field;Ljava/lang/String;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/Field;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/Field;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/Field;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/Field;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/Field;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/Field$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/Field;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/Field;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/Field;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/Field;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/Field;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/Field;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/Field;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/FieldElement : kscience/kmath/operations/RingElement { +public abstract interface class space/kscience/kmath/operations/FieldElement : space/kscience/kmath/operations/RingElement { } -public abstract interface class kscience/kmath/operations/FieldOperations : kscience/kmath/operations/RingOperations { - public static final field Companion Lkscience/kmath/operations/FieldOperations$Companion; +public abstract interface class space/kscience/kmath/operations/FieldOperations : space/kscience/kmath/operations/RingOperations { + public static final field Companion Lspace/kscience/kmath/operations/FieldOperations$Companion; public static final field DIV_OPERATION Ljava/lang/String; public abstract fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public abstract fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/FieldOperations$Companion { +public final class space/kscience/kmath/operations/FieldOperations$Companion { public static final field DIV_OPERATION Ljava/lang/String; } -public final class kscience/kmath/operations/FieldOperations$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/FieldOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/FieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun div (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/FieldOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/FieldOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/FieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/FieldOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/FloatField : kscience/kmath/operations/ExtendedField, kscience/kmath/operations/Norm { - public static final field INSTANCE Lkscience/kmath/operations/FloatField; +public final class space/kscience/kmath/operations/FloatField : space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/Norm { + public static final field INSTANCE Lspace/kscience/kmath/operations/FloatField; public fun acos (F)Ljava/lang/Float; public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; public fun acosh (F)Ljava/lang/Float; @@ -1774,6 +1775,8 @@ public final class kscience/kmath/operations/FloatField : kscience/kmath/operati public fun binaryOperation (Ljava/lang/String;FF)Ljava/lang/Float; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public fun bindSymbol (Ljava/lang/String;)Ljava/lang/Float; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun cos (F)Ljava/lang/Float; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; public fun cosh (F)Ljava/lang/Float; @@ -1822,8 +1825,6 @@ public final class kscience/kmath/operations/FloatField : kscience/kmath/operati public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; public fun sqrt (F)Ljava/lang/Float; public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Ljava/lang/Float; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; public fun tan (F)Ljava/lang/Float; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; public fun tanh (F)Ljava/lang/Float; @@ -1843,12 +1844,12 @@ public final class kscience/kmath/operations/FloatField : kscience/kmath/operati public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/HyperbolicOperations : kscience/kmath/operations/Algebra { +public abstract interface class space/kscience/kmath/operations/HyperbolicOperations : space/kscience/kmath/operations/Algebra { public static final field ACOSH_OPERATION Ljava/lang/String; public static final field ASINH_OPERATION Ljava/lang/String; public static final field ATANH_OPERATION Ljava/lang/String; public static final field COSH_OPERATION Ljava/lang/String; - public static final field Companion Lkscience/kmath/operations/HyperbolicOperations$Companion; + public static final field Companion Lspace/kscience/kmath/operations/HyperbolicOperations$Companion; public static final field SINH_OPERATION Ljava/lang/String; public static final field TANH_OPERATION Ljava/lang/String; public abstract fun acosh (Ljava/lang/Object;)Ljava/lang/Object; @@ -1859,7 +1860,7 @@ public abstract interface class kscience/kmath/operations/HyperbolicOperations : public abstract fun tanh (Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/HyperbolicOperations$Companion { +public final class space/kscience/kmath/operations/HyperbolicOperations$Companion { public static final field ACOSH_OPERATION Ljava/lang/String; public static final field ASINH_OPERATION Ljava/lang/String; public static final field ATANH_OPERATION Ljava/lang/String; @@ -1868,21 +1869,23 @@ public final class kscience/kmath/operations/HyperbolicOperations$Companion { public static final field TANH_OPERATION Ljava/lang/String; } -public final class kscience/kmath/operations/HyperbolicOperations$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun symbol (Lkscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; +public final class space/kscience/kmath/operations/HyperbolicOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/operations/IntRing : kscience/kmath/operations/Norm, kscience/kmath/operations/NumericAlgebra, kscience/kmath/operations/Ring { - public static final field INSTANCE Lkscience/kmath/operations/IntRing; +public final class space/kscience/kmath/operations/IntRing : space/kscience/kmath/operations/Norm, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/Ring { + public static final field INSTANCE Lspace/kscience/kmath/operations/IntRing; public fun add (II)Ljava/lang/Integer; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperation (Ljava/lang/String;II)Ljava/lang/Integer; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public fun bindSymbol (Ljava/lang/String;)Ljava/lang/Integer; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun div (ILjava/lang/Number;)Ljava/lang/Integer; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun getOne ()Ljava/lang/Integer; @@ -1907,8 +1910,6 @@ public final class kscience/kmath/operations/IntRing : kscience/kmath/operations public fun rightSideNumberOperation (Ljava/lang/String;ILjava/lang/Number;)Ljava/lang/Integer; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public fun symbol (Ljava/lang/String;)Ljava/lang/Integer; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; public fun times (II)Ljava/lang/Integer; public fun times (ILjava/lang/Number;)Ljava/lang/Integer; public fun times (Ljava/lang/Number;I)Ljava/lang/Integer; @@ -1924,23 +1925,25 @@ public final class kscience/kmath/operations/IntRing : kscience/kmath/operations public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/JBigDecimalField : kscience/kmath/operations/JBigDecimalFieldBase { - public static final field Companion Lkscience/kmath/operations/JBigDecimalField$Companion; +public final class space/kscience/kmath/operations/JBigDecimalField : space/kscience/kmath/operations/JBigDecimalFieldBase { + public static final field Companion Lspace/kscience/kmath/operations/JBigDecimalField$Companion; public fun ()V public fun (Ljava/math/MathContext;)V public synthetic fun (Ljava/math/MathContext;ILkotlin/jvm/internal/DefaultConstructorMarker;)V } -public final class kscience/kmath/operations/JBigDecimalField$Companion : kscience/kmath/operations/JBigDecimalFieldBase { +public final class space/kscience/kmath/operations/JBigDecimalField$Companion : space/kscience/kmath/operations/JBigDecimalFieldBase { } -public abstract class kscience/kmath/operations/JBigDecimalFieldBase : kscience/kmath/operations/Field, kscience/kmath/operations/NumericAlgebra, kscience/kmath/operations/PowerOperations { +public abstract class space/kscience/kmath/operations/JBigDecimalFieldBase : space/kscience/kmath/operations/Field, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/PowerOperations { public fun ()V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun add (Ljava/math/BigDecimal;Ljava/math/BigDecimal;)Ljava/math/BigDecimal; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperation (Ljava/lang/String;Ljava/math/BigDecimal;Ljava/math/BigDecimal;)Ljava/math/BigDecimal; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Ljava/math/BigDecimal; public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public fun div (Ljava/lang/Number;Ljava/math/BigDecimal;)Ljava/math/BigDecimal; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; @@ -1975,8 +1978,6 @@ public abstract class kscience/kmath/operations/JBigDecimalFieldBase : kscience/ public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; public fun sqrt (Ljava/math/BigDecimal;)Ljava/math/BigDecimal; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Ljava/math/BigDecimal; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public fun times (Ljava/lang/Number;Ljava/math/BigDecimal;)Ljava/math/BigDecimal; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; @@ -1992,13 +1993,15 @@ public abstract class kscience/kmath/operations/JBigDecimalFieldBase : kscience/ public fun unaryPlus (Ljava/math/BigDecimal;)Ljava/math/BigDecimal; } -public final class kscience/kmath/operations/JBigIntegerField : kscience/kmath/operations/Field, kscience/kmath/operations/NumericAlgebra { - public static final field INSTANCE Lkscience/kmath/operations/JBigIntegerField; +public final class space/kscience/kmath/operations/JBigIntegerField : space/kscience/kmath/operations/Field, space/kscience/kmath/operations/NumericAlgebra { + public static final field INSTANCE Lspace/kscience/kmath/operations/JBigIntegerField; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun add (Ljava/math/BigInteger;Ljava/math/BigInteger;)Ljava/math/BigInteger; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperation (Ljava/lang/String;Ljava/math/BigInteger;Ljava/math/BigInteger;)Ljava/math/BigInteger; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Ljava/math/BigInteger; public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public fun div (Ljava/lang/Number;Ljava/math/BigInteger;)Ljava/math/BigInteger; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; @@ -2027,8 +2030,6 @@ public final class kscience/kmath/operations/JBigIntegerField : kscience/kmath/o public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperation (Ljava/lang/String;Ljava/math/BigInteger;Ljava/lang/Number;)Ljava/math/BigInteger; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Ljava/math/BigInteger; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public fun times (Ljava/lang/Number;Ljava/math/BigInteger;)Ljava/math/BigInteger; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; @@ -2044,16 +2045,18 @@ public final class kscience/kmath/operations/JBigIntegerField : kscience/kmath/o public fun unaryPlus (Ljava/math/BigInteger;)Ljava/math/BigInteger; } -public abstract interface annotation class kscience/kmath/operations/KMathContext : java/lang/annotation/Annotation { +public abstract interface annotation class space/kscience/kmath/operations/KMathContext : java/lang/annotation/Annotation { } -public final class kscience/kmath/operations/LongRing : kscience/kmath/operations/Norm, kscience/kmath/operations/NumericAlgebra, kscience/kmath/operations/Ring { - public static final field INSTANCE Lkscience/kmath/operations/LongRing; +public final class space/kscience/kmath/operations/LongRing : space/kscience/kmath/operations/Norm, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/Ring { + public static final field INSTANCE Lspace/kscience/kmath/operations/LongRing; public fun add (JJ)Ljava/lang/Long; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperation (Ljava/lang/String;JJ)Ljava/lang/Long; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public fun bindSymbol (Ljava/lang/String;)Ljava/lang/Long; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun div (JLjava/lang/Number;)Ljava/lang/Long; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun getOne ()Ljava/lang/Long; @@ -2078,8 +2081,6 @@ public final class kscience/kmath/operations/LongRing : kscience/kmath/operation public fun rightSideNumberOperation (Ljava/lang/String;JLjava/lang/Number;)Ljava/lang/Long; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public fun symbol (Ljava/lang/String;)Ljava/lang/Long; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; public fun times (JJ)Ljava/lang/Long; public fun times (JLjava/lang/Number;)Ljava/lang/Long; public fun times (Ljava/lang/Number;J)Ljava/lang/Long; @@ -2095,11 +2096,11 @@ public final class kscience/kmath/operations/LongRing : kscience/kmath/operation public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/Norm { +public abstract interface class space/kscience/kmath/operations/Norm { public abstract fun norm (Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/NumericAlgebra : kscience/kmath/operations/Algebra { +public abstract interface class space/kscience/kmath/operations/NumericAlgebra : space/kscience/kmath/operations/Algebra { public abstract fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public abstract fun number (Ljava/lang/Number;)Ljava/lang/Object; @@ -2107,41 +2108,41 @@ public abstract interface class kscience/kmath/operations/NumericAlgebra : kscie public abstract fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; } -public final class kscience/kmath/operations/NumericAlgebra$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun leftSideNumberOperation (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun leftSideNumberOperationFunction (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun rightSideNumberOperation (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun rightSideNumberOperationFunction (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun symbol (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; +public final class space/kscience/kmath/operations/NumericAlgebra$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Ljava/lang/Object; + public static fun leftSideNumberOperation (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun leftSideNumberOperationFunction (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun rightSideNumberOperation (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun rightSideNumberOperationFunction (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun unaryOperation (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/operations/OptionalOperationsKt { - public static final fun acos (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun acosh (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun asin (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun asinh (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun atan (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun atanh (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun cos (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun cosh (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun exp (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun ln (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun norm (Lkscience/kmath/operations/AlgebraElement;)Ljava/lang/Object; - public static final fun pow (Lkscience/kmath/operations/AlgebraElement;D)Lkscience/kmath/operations/AlgebraElement; - public static final fun sin (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun sinh (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun sqr (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun sqrt (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun tan (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun tanh (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; +public final class space/kscience/kmath/operations/OptionalOperationsKt { + public static final fun acos (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun acosh (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun asin (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun asinh (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun atan (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun atanh (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun cos (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun cosh (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun exp (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun ln (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun norm (Lspace/kscience/kmath/operations/AlgebraElement;)Ljava/lang/Object; + public static final fun pow (Lspace/kscience/kmath/operations/AlgebraElement;D)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun sin (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun sinh (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun sqr (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun sqrt (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun tan (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun tanh (Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; } -public abstract interface class kscience/kmath/operations/PowerOperations : kscience/kmath/operations/Algebra { - public static final field Companion Lkscience/kmath/operations/PowerOperations$Companion; +public abstract interface class space/kscience/kmath/operations/PowerOperations : space/kscience/kmath/operations/Algebra { + public static final field Companion Lspace/kscience/kmath/operations/PowerOperations$Companion; public static final field POW_OPERATION Ljava/lang/String; public static final field SQRT_OPERATION Ljava/lang/String; public abstract fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; @@ -2149,23 +2150,23 @@ public abstract interface class kscience/kmath/operations/PowerOperations : ksci public abstract fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/PowerOperations$Companion { +public final class space/kscience/kmath/operations/PowerOperations$Companion { public static final field POW_OPERATION Ljava/lang/String; public static final field SQRT_OPERATION Ljava/lang/String; } -public final class kscience/kmath/operations/PowerOperations$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/PowerOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/PowerOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun pow (Lkscience/kmath/operations/PowerOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun sqrt (Lkscience/kmath/operations/PowerOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/PowerOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/PowerOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/PowerOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; +public final class space/kscience/kmath/operations/PowerOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/PowerOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/PowerOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/PowerOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun pow (Lspace/kscience/kmath/operations/PowerOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun sqrt (Lspace/kscience/kmath/operations/PowerOperations;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/PowerOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/PowerOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/operations/RealField : kscience/kmath/operations/ExtendedField, kscience/kmath/operations/Norm { - public static final field INSTANCE Lkscience/kmath/operations/RealField; +public final class space/kscience/kmath/operations/RealField : space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/Norm { + public static final field INSTANCE Lspace/kscience/kmath/operations/RealField; public fun acos (D)Ljava/lang/Double; public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; public fun acosh (D)Ljava/lang/Double; @@ -2183,6 +2184,8 @@ public final class kscience/kmath/operations/RealField : kscience/kmath/operatio public fun binaryOperation (Ljava/lang/String;DD)Ljava/lang/Double; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public fun bindSymbol (Ljava/lang/String;)Ljava/lang/Double; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun cos (D)Ljava/lang/Double; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; public fun cosh (D)Ljava/lang/Double; @@ -2231,8 +2234,6 @@ public final class kscience/kmath/operations/RealField : kscience/kmath/operatio public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; public fun sqrt (D)Ljava/lang/Double; public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Ljava/lang/Double; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; public fun tan (D)Ljava/lang/Double; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; public fun tanh (D)Ljava/lang/Double; @@ -2252,58 +2253,58 @@ public final class kscience/kmath/operations/RealField : kscience/kmath/operatio public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/Ring : kscience/kmath/operations/RingOperations, kscience/kmath/operations/Space { +public abstract interface class space/kscience/kmath/operations/Ring : space/kscience/kmath/operations/RingOperations, space/kscience/kmath/operations/Space { public abstract fun getOne ()Ljava/lang/Object; } -public final class kscience/kmath/operations/Ring$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/Ring;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/Ring;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/Ring;Ljava/lang/String;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/Ring;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/Ring;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/Ring;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/Ring;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/Ring;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/Ring$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/Ring;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/Ring;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/Ring;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/Ring;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/Ring;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/RingElement : kscience/kmath/operations/SpaceElement { +public abstract interface class space/kscience/kmath/operations/RingElement : space/kscience/kmath/operations/SpaceElement { } -public abstract interface class kscience/kmath/operations/RingOperations : kscience/kmath/operations/SpaceOperations { - public static final field Companion Lkscience/kmath/operations/RingOperations$Companion; +public abstract interface class space/kscience/kmath/operations/RingOperations : space/kscience/kmath/operations/SpaceOperations { + public static final field Companion Lspace/kscience/kmath/operations/RingOperations$Companion; public static final field TIMES_OPERATION Ljava/lang/String; public abstract fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public abstract fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/RingOperations$Companion { +public final class space/kscience/kmath/operations/RingOperations$Companion { public static final field TIMES_OPERATION Ljava/lang/String; } -public final class kscience/kmath/operations/RingOperations$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/RingOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/RingOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/RingOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/RingOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/RingOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/RingOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/RingOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/RingOperations;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/RingOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/RingWithNumbers : kscience/kmath/operations/NumericAlgebra, kscience/kmath/operations/Ring { +public abstract interface class space/kscience/kmath/operations/RingWithNumbers : space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/Ring { public abstract fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public abstract fun number (Ljava/lang/Number;)Ljava/lang/Object; @@ -2311,38 +2312,40 @@ public abstract interface class kscience/kmath/operations/RingWithNumbers : ksci public abstract fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; } -public final class kscience/kmath/operations/RingWithNumbers$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun leftSideNumberOperation (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun leftSideNumberOperationFunction (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun minus (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun number (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun rightSideNumberOperation (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun rightSideNumberOperationFunction (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun symbol (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/RingWithNumbers$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun leftSideNumberOperation (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun leftSideNumberOperationFunction (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun minus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun number (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun rightSideNumberOperation (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun rightSideNumberOperationFunction (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun times (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/ShortRing : kscience/kmath/operations/Norm, kscience/kmath/operations/NumericAlgebra, kscience/kmath/operations/Ring { - public static final field INSTANCE Lkscience/kmath/operations/ShortRing; +public final class space/kscience/kmath/operations/ShortRing : space/kscience/kmath/operations/Norm, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/Ring { + public static final field INSTANCE Lspace/kscience/kmath/operations/ShortRing; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun add (SS)Ljava/lang/Short; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperation (Ljava/lang/String;SS)Ljava/lang/Short; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Ljava/lang/Short; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun div (SLjava/lang/Number;)Ljava/lang/Short; public synthetic fun getOne ()Ljava/lang/Object; @@ -2367,8 +2370,6 @@ public final class kscience/kmath/operations/ShortRing : kscience/kmath/operatio public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperation (Ljava/lang/String;SLjava/lang/Number;)Ljava/lang/Short; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Ljava/lang/Short; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public fun times (Ljava/lang/Number;S)Ljava/lang/Short; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; @@ -2384,30 +2385,30 @@ public final class kscience/kmath/operations/ShortRing : kscience/kmath/operatio public fun unaryPlus (S)Ljava/lang/Short; } -public abstract interface class kscience/kmath/operations/Space : kscience/kmath/operations/SpaceOperations { +public abstract interface class space/kscience/kmath/operations/Space : space/kscience/kmath/operations/SpaceOperations { public abstract fun getZero ()Ljava/lang/Object; } -public final class kscience/kmath/operations/Space$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/Space;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/Space;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/Space;Ljava/lang/String;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/Space;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/Space;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/Space;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/Space;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/Space;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/Space$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/Space;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/SpaceElement : kscience/kmath/operations/AlgebraElement { +public abstract interface class space/kscience/kmath/operations/SpaceElement : space/kscience/kmath/operations/AlgebraElement { } -public abstract interface class kscience/kmath/operations/SpaceOperations : kscience/kmath/operations/Algebra { - public static final field Companion Lkscience/kmath/operations/SpaceOperations$Companion; +public abstract interface class space/kscience/kmath/operations/SpaceOperations : space/kscience/kmath/operations/Algebra { + public static final field Companion Lspace/kscience/kmath/operations/SpaceOperations$Companion; public static final field MINUS_OPERATION Ljava/lang/String; public static final field PLUS_OPERATION Ljava/lang/String; public abstract fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; @@ -2423,32 +2424,32 @@ public abstract interface class kscience/kmath/operations/SpaceOperations : ksci public abstract fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/SpaceOperations$Companion { +public final class space/kscience/kmath/operations/SpaceOperations$Companion { public static final field MINUS_OPERATION Ljava/lang/String; public static final field PLUS_OPERATION Ljava/lang/String; } -public final class kscience/kmath/operations/SpaceOperations$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/SpaceOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/TrigonometricOperations : kscience/kmath/operations/Algebra { +public abstract interface class space/kscience/kmath/operations/TrigonometricOperations : space/kscience/kmath/operations/Algebra { public static final field ACOS_OPERATION Ljava/lang/String; public static final field ASIN_OPERATION Ljava/lang/String; public static final field ATAN_OPERATION Ljava/lang/String; public static final field COS_OPERATION Ljava/lang/String; - public static final field Companion Lkscience/kmath/operations/TrigonometricOperations$Companion; + public static final field Companion Lspace/kscience/kmath/operations/TrigonometricOperations$Companion; public static final field SIN_OPERATION Ljava/lang/String; public static final field TAN_OPERATION Ljava/lang/String; public abstract fun acos (Ljava/lang/Object;)Ljava/lang/Object; @@ -2459,7 +2460,7 @@ public abstract interface class kscience/kmath/operations/TrigonometricOperation public abstract fun tan (Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/TrigonometricOperations$Companion { +public final class space/kscience/kmath/operations/TrigonometricOperations$Companion { public static final field ACOS_OPERATION Ljava/lang/String; public static final field ASIN_OPERATION Ljava/lang/String; public static final field ATAN_OPERATION Ljava/lang/String; @@ -2468,71 +2469,71 @@ public final class kscience/kmath/operations/TrigonometricOperations$Companion { public static final field TAN_OPERATION Ljava/lang/String; } -public final class kscience/kmath/operations/TrigonometricOperations$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun symbol (Lkscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; +public final class space/kscience/kmath/operations/TrigonometricOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/structures/ArrayBuffer : kscience/kmath/structures/MutableBuffer { +public final class space/kscience/kmath/structures/ArrayBuffer : space/kscience/kmath/structures/MutableBuffer { public fun ([Ljava/lang/Object;)V - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public fun copy ()Lkscience/kmath/structures/MutableBuffer; + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; public fun get (I)Ljava/lang/Object; public fun getSize ()I public fun iterator ()Ljava/util/Iterator; public fun set (ILjava/lang/Object;)V } -public abstract interface class kscience/kmath/structures/Buffer { - public static final field Companion Lkscience/kmath/structures/Buffer$Companion; - public abstract fun contentEquals (Lkscience/kmath/structures/Buffer;)Z +public abstract interface class space/kscience/kmath/structures/Buffer { + public static final field Companion Lspace/kscience/kmath/structures/Buffer$Companion; + public abstract fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z public abstract fun get (I)Ljava/lang/Object; public abstract fun getSize ()I public abstract fun iterator ()Ljava/util/Iterator; } -public final class kscience/kmath/structures/Buffer$Companion { - public final fun auto (Lkotlin/reflect/KClass;ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/Buffer; - public final fun boxing (ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/Buffer; - public final fun real-4n5bU9U (ILkotlin/jvm/functions/Function1;)[D +public final class space/kscience/kmath/structures/Buffer$Companion { + public final fun auto (Lkotlin/reflect/KClass;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public final fun boxing (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public final fun real-8hrHhI4 (ILkotlin/jvm/functions/Function1;)[D } -public final class kscience/kmath/structures/Buffer$DefaultImpls { - public static fun contentEquals (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Z +public final class space/kscience/kmath/structures/Buffer$DefaultImpls { + public static fun contentEquals (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Z } -public final class kscience/kmath/structures/BufferKt { +public final class space/kscience/kmath/structures/BufferKt { public static final fun ListBuffer (ILkotlin/jvm/functions/Function1;)Ljava/util/List; public static final fun asBuffer (Ljava/util/List;)Ljava/util/List; - public static final fun asBuffer ([Ljava/lang/Object;)Lkscience/kmath/structures/ArrayBuffer; - public static final fun asIterable (Lkscience/kmath/structures/Buffer;)Ljava/lang/Iterable; - public static final fun asReadOnly (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static final fun asSequence (Lkscience/kmath/structures/Buffer;)Lkotlin/sequences/Sequence; - public static final fun getIndices (Lkscience/kmath/structures/Buffer;)Lkotlin/ranges/IntRange; - public static final fun toList (Lkscience/kmath/structures/Buffer;)Ljava/util/List; + public static final fun asBuffer ([Ljava/lang/Object;)Lspace/kscience/kmath/structures/ArrayBuffer; + public static final fun asIterable (Lspace/kscience/kmath/structures/Buffer;)Ljava/lang/Iterable; + public static final fun asReadOnly (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static final fun asSequence (Lspace/kscience/kmath/structures/Buffer;)Lkotlin/sequences/Sequence; + public static final fun getIndices (Lspace/kscience/kmath/structures/Buffer;)Lkotlin/ranges/IntRange; + public static final fun toList (Lspace/kscience/kmath/structures/Buffer;)Ljava/util/List; } -public abstract interface class kscience/kmath/structures/FlaggedBuffer : kscience/kmath/structures/Buffer { +public abstract interface class space/kscience/kmath/structures/FlaggedBuffer : space/kscience/kmath/structures/Buffer { public abstract fun getFlag (I)B } -public final class kscience/kmath/structures/FlaggedBuffer$DefaultImpls { - public static fun contentEquals (Lkscience/kmath/structures/FlaggedBuffer;Lkscience/kmath/structures/Buffer;)Z +public final class space/kscience/kmath/structures/FlaggedBuffer$DefaultImpls { + public static fun contentEquals (Lspace/kscience/kmath/structures/FlaggedBuffer;Lspace/kscience/kmath/structures/Buffer;)Z } -public final class kscience/kmath/structures/FlaggedBufferKt { - public static final fun forEachValid (Lkscience/kmath/structures/FlaggedRealBuffer;Lkotlin/jvm/functions/Function1;)V - public static final fun hasFlag (Lkscience/kmath/structures/FlaggedBuffer;ILkscience/kmath/structures/ValueFlag;)Z - public static final fun isMissing (Lkscience/kmath/structures/FlaggedBuffer;I)Z - public static final fun isValid (Lkscience/kmath/structures/FlaggedBuffer;I)Z +public final class space/kscience/kmath/structures/FlaggedBufferKt { + public static final fun forEachValid (Lspace/kscience/kmath/structures/FlaggedRealBuffer;Lkotlin/jvm/functions/Function1;)V + public static final fun hasFlag (Lspace/kscience/kmath/structures/FlaggedBuffer;ILspace/kscience/kmath/structures/ValueFlag;)Z + public static final fun isMissing (Lspace/kscience/kmath/structures/FlaggedBuffer;I)Z + public static final fun isValid (Lspace/kscience/kmath/structures/FlaggedBuffer;I)Z } -public final class kscience/kmath/structures/FlaggedRealBuffer : kscience/kmath/structures/Buffer, kscience/kmath/structures/FlaggedBuffer { +public final class space/kscience/kmath/structures/FlaggedRealBuffer : space/kscience/kmath/structures/Buffer, space/kscience/kmath/structures/FlaggedBuffer { public fun ([D[B)V - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z public fun get (I)Ljava/lang/Double; public synthetic fun get (I)Ljava/lang/Object; public fun getFlag (I)B @@ -2542,13 +2543,13 @@ public final class kscience/kmath/structures/FlaggedRealBuffer : kscience/kmath/ public fun iterator ()Ljava/util/Iterator; } -public final class kscience/kmath/structures/FloatBuffer : kscience/kmath/structures/MutableBuffer { - public static final synthetic fun box-impl ([F)Lkscience/kmath/structures/FloatBuffer; +public final class space/kscience/kmath/structures/FloatBuffer : space/kscience/kmath/structures/MutableBuffer { + public static final synthetic fun box-impl ([F)Lspace/kscience/kmath/structures/FloatBuffer; public static fun constructor-impl ([F)[F - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl ([FLkscience/kmath/structures/Buffer;)Z - public fun copy ()Lkscience/kmath/structures/MutableBuffer; - public static fun copy-impl ([F)Lkscience/kmath/structures/MutableBuffer; + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl ([FLspace/kscience/kmath/structures/Buffer;)Z + public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; + public static fun copy-impl ([F)Lspace/kscience/kmath/structures/MutableBuffer; public fun equals (Ljava/lang/Object;)Z public static fun equals-impl ([FLjava/lang/Object;)Z public static final fun equals-impl0 ([F[F)Z @@ -2571,20 +2572,20 @@ public final class kscience/kmath/structures/FloatBuffer : kscience/kmath/struct public final synthetic fun unbox-impl ()[F } -public final class kscience/kmath/structures/FloatBufferKt { +public final class space/kscience/kmath/structures/FloatBufferKt { public static final fun FloatBuffer (ILkotlin/jvm/functions/Function1;)[F public static final fun FloatBuffer ([F)[F public static final fun asBuffer ([F)[F - public static final fun getArray (Lkscience/kmath/structures/MutableBuffer;)[F + public static final fun getArray (Lspace/kscience/kmath/structures/MutableBuffer;)[F } -public final class kscience/kmath/structures/IntBuffer : kscience/kmath/structures/MutableBuffer { - public static final synthetic fun box-impl ([I)Lkscience/kmath/structures/IntBuffer; +public final class space/kscience/kmath/structures/IntBuffer : space/kscience/kmath/structures/MutableBuffer { + public static final synthetic fun box-impl ([I)Lspace/kscience/kmath/structures/IntBuffer; public static fun constructor-impl ([I)[I - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl ([ILkscience/kmath/structures/Buffer;)Z - public fun copy ()Lkscience/kmath/structures/MutableBuffer; - public static fun copy-impl ([I)Lkscience/kmath/structures/MutableBuffer; + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl ([ILspace/kscience/kmath/structures/Buffer;)Z + public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; + public static fun copy-impl ([I)Lspace/kscience/kmath/structures/MutableBuffer; public fun equals (Ljava/lang/Object;)Z public static fun equals-impl ([ILjava/lang/Object;)Z public static final fun equals-impl0 ([I[I)Z @@ -2607,18 +2608,18 @@ public final class kscience/kmath/structures/IntBuffer : kscience/kmath/structur public final synthetic fun unbox-impl ()[I } -public final class kscience/kmath/structures/IntBufferKt { +public final class space/kscience/kmath/structures/IntBufferKt { public static final fun IntBuffer (ILkotlin/jvm/functions/Function1;)[I public static final fun IntBuffer ([I)[I public static final fun asBuffer ([I)[I - public static final fun getArray (Lkscience/kmath/structures/MutableBuffer;)[I + public static final fun getArray (Lspace/kscience/kmath/structures/MutableBuffer;)[I } -public final class kscience/kmath/structures/ListBuffer : kscience/kmath/structures/Buffer { - public static final synthetic fun box-impl (Ljava/util/List;)Lkscience/kmath/structures/ListBuffer; +public final class space/kscience/kmath/structures/ListBuffer : space/kscience/kmath/structures/Buffer { + public static final synthetic fun box-impl (Ljava/util/List;)Lspace/kscience/kmath/structures/ListBuffer; public static fun constructor-impl (Ljava/util/List;)Ljava/util/List; - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl (Ljava/util/List;Lkscience/kmath/structures/Buffer;)Z + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl (Ljava/util/List;Lspace/kscience/kmath/structures/Buffer;)Z public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Ljava/util/List;Ljava/lang/Object;)Z public static final fun equals-impl0 (Ljava/util/List;Ljava/util/List;)Z @@ -2636,13 +2637,13 @@ public final class kscience/kmath/structures/ListBuffer : kscience/kmath/structu public final synthetic fun unbox-impl ()Ljava/util/List; } -public final class kscience/kmath/structures/LongBuffer : kscience/kmath/structures/MutableBuffer { - public static final synthetic fun box-impl ([J)Lkscience/kmath/structures/LongBuffer; +public final class space/kscience/kmath/structures/LongBuffer : space/kscience/kmath/structures/MutableBuffer { + public static final synthetic fun box-impl ([J)Lspace/kscience/kmath/structures/LongBuffer; public static fun constructor-impl ([J)[J - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl ([JLkscience/kmath/structures/Buffer;)Z - public fun copy ()Lkscience/kmath/structures/MutableBuffer; - public static fun copy-impl ([J)Lkscience/kmath/structures/MutableBuffer; + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl ([JLspace/kscience/kmath/structures/Buffer;)Z + public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; + public static fun copy-impl ([J)Lspace/kscience/kmath/structures/MutableBuffer; public fun equals (Ljava/lang/Object;)Z public static fun equals-impl ([JLjava/lang/Object;)Z public static final fun equals-impl0 ([J[J)Z @@ -2665,52 +2666,52 @@ public final class kscience/kmath/structures/LongBuffer : kscience/kmath/structu public final synthetic fun unbox-impl ()[J } -public final class kscience/kmath/structures/LongBufferKt { +public final class space/kscience/kmath/structures/LongBufferKt { public static final fun LongBuffer (ILkotlin/jvm/functions/Function1;)[J public static final fun LongBuffer ([J)[J public static final fun asBuffer ([J)[J - public static final fun getArray (Lkscience/kmath/structures/MutableBuffer;)[J + public static final fun getArray (Lspace/kscience/kmath/structures/MutableBuffer;)[J } -public class kscience/kmath/structures/MemoryBuffer : kscience/kmath/structures/Buffer { - public static final field Companion Lkscience/kmath/structures/MemoryBuffer$Companion; - public fun (Lkscience/kmath/memory/Memory;Lkscience/kmath/memory/MemorySpec;)V - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z +public class space/kscience/kmath/structures/MemoryBuffer : space/kscience/kmath/structures/Buffer { + public static final field Companion Lspace/kscience/kmath/structures/MemoryBuffer$Companion; + public fun (Lspace/kscience/kmath/memory/Memory;Lspace/kscience/kmath/memory/MemorySpec;)V + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z public fun get (I)Ljava/lang/Object; - protected final fun getMemory ()Lkscience/kmath/memory/Memory; + protected final fun getMemory ()Lspace/kscience/kmath/memory/Memory; public fun getSize ()I - protected final fun getSpec ()Lkscience/kmath/memory/MemorySpec; + protected final fun getSpec ()Lspace/kscience/kmath/memory/MemorySpec; public fun iterator ()Ljava/util/Iterator; } -public final class kscience/kmath/structures/MemoryBuffer$Companion { - public final fun create (Lkscience/kmath/memory/MemorySpec;I)Lkscience/kmath/structures/MemoryBuffer; - public final fun create (Lkscience/kmath/memory/MemorySpec;ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/MemoryBuffer; +public final class space/kscience/kmath/structures/MemoryBuffer$Companion { + public final fun create (Lspace/kscience/kmath/memory/MemorySpec;I)Lspace/kscience/kmath/structures/MemoryBuffer; + public final fun create (Lspace/kscience/kmath/memory/MemorySpec;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/MemoryBuffer; } -public abstract interface class kscience/kmath/structures/MutableBuffer : kscience/kmath/structures/Buffer { - public static final field Companion Lkscience/kmath/structures/MutableBuffer$Companion; - public abstract fun copy ()Lkscience/kmath/structures/MutableBuffer; +public abstract interface class space/kscience/kmath/structures/MutableBuffer : space/kscience/kmath/structures/Buffer { + public static final field Companion Lspace/kscience/kmath/structures/MutableBuffer$Companion; + public abstract fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; public abstract fun set (ILjava/lang/Object;)V } -public final class kscience/kmath/structures/MutableBuffer$Companion { - public final fun auto (Lkotlin/reflect/KClass;ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/MutableBuffer; - public final fun boxing (ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/MutableBuffer; - public final fun real-4n5bU9U (ILkotlin/jvm/functions/Function1;)[D +public final class space/kscience/kmath/structures/MutableBuffer$Companion { + public final fun auto (Lkotlin/reflect/KClass;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/MutableBuffer; + public final fun boxing (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/MutableBuffer; + public final fun real-8hrHhI4 (ILkotlin/jvm/functions/Function1;)[D } -public final class kscience/kmath/structures/MutableBuffer$DefaultImpls { - public static fun contentEquals (Lkscience/kmath/structures/MutableBuffer;Lkscience/kmath/structures/Buffer;)Z +public final class space/kscience/kmath/structures/MutableBuffer$DefaultImpls { + public static fun contentEquals (Lspace/kscience/kmath/structures/MutableBuffer;Lspace/kscience/kmath/structures/Buffer;)Z } -public final class kscience/kmath/structures/MutableListBuffer : kscience/kmath/structures/MutableBuffer { - public static final synthetic fun box-impl (Ljava/util/List;)Lkscience/kmath/structures/MutableListBuffer; +public final class space/kscience/kmath/structures/MutableListBuffer : space/kscience/kmath/structures/MutableBuffer { + public static final synthetic fun box-impl (Ljava/util/List;)Lspace/kscience/kmath/structures/MutableListBuffer; public static fun constructor-impl (Ljava/util/List;)Ljava/util/List; - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl (Ljava/util/List;Lkscience/kmath/structures/Buffer;)Z - public fun copy ()Lkscience/kmath/structures/MutableBuffer; - public static fun copy-impl (Ljava/util/List;)Lkscience/kmath/structures/MutableBuffer; + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl (Ljava/util/List;Lspace/kscience/kmath/structures/Buffer;)Z + public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; + public static fun copy-impl (Ljava/util/List;)Lspace/kscience/kmath/structures/MutableBuffer; public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Ljava/util/List;Ljava/lang/Object;)Z public static final fun equals-impl0 (Ljava/util/List;Ljava/util/List;)Z @@ -2730,48 +2731,48 @@ public final class kscience/kmath/structures/MutableListBuffer : kscience/kmath/ public final synthetic fun unbox-impl ()Ljava/util/List; } -public final class kscience/kmath/structures/MutableMemoryBuffer : kscience/kmath/structures/MemoryBuffer, kscience/kmath/structures/MutableBuffer { - public static final field Companion Lkscience/kmath/structures/MutableMemoryBuffer$Companion; - public fun (Lkscience/kmath/memory/Memory;Lkscience/kmath/memory/MemorySpec;)V - public fun copy ()Lkscience/kmath/structures/MutableBuffer; +public final class space/kscience/kmath/structures/MutableMemoryBuffer : space/kscience/kmath/structures/MemoryBuffer, space/kscience/kmath/structures/MutableBuffer { + public static final field Companion Lspace/kscience/kmath/structures/MutableMemoryBuffer$Companion; + public fun (Lspace/kscience/kmath/memory/Memory;Lspace/kscience/kmath/memory/MemorySpec;)V + public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; public fun set (ILjava/lang/Object;)V } -public final class kscience/kmath/structures/MutableMemoryBuffer$Companion { - public final fun create (Lkscience/kmath/memory/MemorySpec;I)Lkscience/kmath/structures/MutableMemoryBuffer; - public final fun create (Lkscience/kmath/memory/MemorySpec;ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/MutableMemoryBuffer; +public final class space/kscience/kmath/structures/MutableMemoryBuffer$Companion { + public final fun create (Lspace/kscience/kmath/memory/MemorySpec;I)Lspace/kscience/kmath/structures/MutableMemoryBuffer; + public final fun create (Lspace/kscience/kmath/memory/MemorySpec;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/MutableMemoryBuffer; } -public final class kscience/kmath/structures/ReadOnlyBuffer : kscience/kmath/structures/Buffer { - public static final synthetic fun box-impl (Lkscience/kmath/structures/MutableBuffer;)Lkscience/kmath/structures/ReadOnlyBuffer; - public static fun constructor-impl (Lkscience/kmath/structures/MutableBuffer;)Lkscience/kmath/structures/MutableBuffer; - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl (Lkscience/kmath/structures/MutableBuffer;Lkscience/kmath/structures/Buffer;)Z +public final class space/kscience/kmath/structures/ReadOnlyBuffer : space/kscience/kmath/structures/Buffer { + public static final synthetic fun box-impl (Lspace/kscience/kmath/structures/MutableBuffer;)Lspace/kscience/kmath/structures/ReadOnlyBuffer; + public static fun constructor-impl (Lspace/kscience/kmath/structures/MutableBuffer;)Lspace/kscience/kmath/structures/MutableBuffer; + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl (Lspace/kscience/kmath/structures/MutableBuffer;Lspace/kscience/kmath/structures/Buffer;)Z public fun equals (Ljava/lang/Object;)Z - public static fun equals-impl (Lkscience/kmath/structures/MutableBuffer;Ljava/lang/Object;)Z - public static final fun equals-impl0 (Lkscience/kmath/structures/MutableBuffer;Lkscience/kmath/structures/MutableBuffer;)Z + public static fun equals-impl (Lspace/kscience/kmath/structures/MutableBuffer;Ljava/lang/Object;)Z + public static final fun equals-impl0 (Lspace/kscience/kmath/structures/MutableBuffer;Lspace/kscience/kmath/structures/MutableBuffer;)Z public fun get (I)Ljava/lang/Object; - public static fun get-impl (Lkscience/kmath/structures/MutableBuffer;I)Ljava/lang/Object; - public final fun getBuffer ()Lkscience/kmath/structures/MutableBuffer; + public static fun get-impl (Lspace/kscience/kmath/structures/MutableBuffer;I)Ljava/lang/Object; + public final fun getBuffer ()Lspace/kscience/kmath/structures/MutableBuffer; public fun getSize ()I - public static fun getSize-impl (Lkscience/kmath/structures/MutableBuffer;)I + public static fun getSize-impl (Lspace/kscience/kmath/structures/MutableBuffer;)I public fun hashCode ()I - public static fun hashCode-impl (Lkscience/kmath/structures/MutableBuffer;)I + public static fun hashCode-impl (Lspace/kscience/kmath/structures/MutableBuffer;)I public fun iterator ()Ljava/util/Iterator; - public static fun iterator-impl (Lkscience/kmath/structures/MutableBuffer;)Ljava/util/Iterator; + public static fun iterator-impl (Lspace/kscience/kmath/structures/MutableBuffer;)Ljava/util/Iterator; public fun toString ()Ljava/lang/String; - public static fun toString-impl (Lkscience/kmath/structures/MutableBuffer;)Ljava/lang/String; - public final synthetic fun unbox-impl ()Lkscience/kmath/structures/MutableBuffer; + public static fun toString-impl (Lspace/kscience/kmath/structures/MutableBuffer;)Ljava/lang/String; + public final synthetic fun unbox-impl ()Lspace/kscience/kmath/structures/MutableBuffer; } -public final class kscience/kmath/structures/RealBuffer : kscience/kmath/structures/MutableBuffer { - public static final synthetic fun box-impl ([D)Lkscience/kmath/structures/RealBuffer; +public final class space/kscience/kmath/structures/RealBuffer : space/kscience/kmath/structures/MutableBuffer { + public static final synthetic fun box-impl ([D)Lspace/kscience/kmath/structures/RealBuffer; public static fun constructor-impl ([D)[D - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl ([DLkscience/kmath/structures/Buffer;)Z - public synthetic fun copy ()Lkscience/kmath/structures/MutableBuffer; - public fun copy-H8_hoUg ()[D - public static fun copy-H8_hoUg ([D)[D + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl ([DLspace/kscience/kmath/structures/Buffer;)Z + public synthetic fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; + public fun copy-88GwAag ()[D + public static fun copy-88GwAag ([D)[D public fun equals (Ljava/lang/Object;)Z public static fun equals-impl ([DLjava/lang/Object;)Z public static final fun equals-impl0 ([D[D)Z @@ -2794,180 +2795,180 @@ public final class kscience/kmath/structures/RealBuffer : kscience/kmath/structu public final synthetic fun unbox-impl ()[D } -public final class kscience/kmath/structures/RealBufferField : kscience/kmath/operations/ExtendedField { +public final class space/kscience/kmath/structures/RealBufferField : space/kscience/kmath/operations/ExtendedField { public fun (I)V public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; - public fun acos-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun acos-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun acosh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun acosh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add-4n5bU9U (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)[D + public fun add-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; - public fun asin-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun asin-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun asinh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun asinh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; - public fun atan-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun atan-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun atanh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun atanh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; - public fun cos-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun cos-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun cosh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun cosh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Number;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun div (Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; - public fun div (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun div (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public fun div (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide-4n5bU9U (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)[D + public fun divide-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; - public fun exp-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun exp-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lkscience/kmath/structures/Buffer; + public fun getOne ()Lspace/kscience/kmath/structures/Buffer; public final fun getSize ()I public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lkscience/kmath/structures/Buffer; + public fun getZero ()Lspace/kscience/kmath/structures/Buffer; public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; - public fun ln-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun ln-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun minus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply-4n5bU9U (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)[D - public fun multiply-4n5bU9U (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)[D + public fun multiply-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)[D + public fun multiply-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number (Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun plus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun pow (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; + public fun pow (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun power-4n5bU9U (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)[D + public fun power-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)[D public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; - public fun sin-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun sin-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun sinh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun sinh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun sqrt (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/structures/Buffer; + public fun sqrt (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; - public fun tan-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun tan-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun tanh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun tanh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; - public fun times (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun times (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public fun times (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryPlus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; } -public final class kscience/kmath/structures/RealBufferFieldOperations : kscience/kmath/operations/ExtendedFieldOperations { - public static final field INSTANCE Lkscience/kmath/structures/RealBufferFieldOperations; +public final class space/kscience/kmath/structures/RealBufferFieldOperations : space/kscience/kmath/operations/ExtendedFieldOperations { + public static final field INSTANCE Lspace/kscience/kmath/structures/RealBufferFieldOperations; public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; - public fun acos-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun acos-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun acosh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun acosh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add-4n5bU9U (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)[D + public fun add-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; - public fun asin-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun asin-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun asinh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun asinh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; - public fun atan-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun atan-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun atanh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun atanh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; - public fun cos-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun cos-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun cosh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun cosh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; - public fun div (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun div (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public fun div (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide-4n5bU9U (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)[D + public fun divide-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; - public fun exp-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun exp-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; - public fun ln-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun ln-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun minus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply-4n5bU9U (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)[D - public fun multiply-4n5bU9U (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)[D + public fun multiply-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)[D + public fun multiply-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun plus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun pow (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; + public fun pow (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun power-4n5bU9U (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)[D + public fun power-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)[D public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; - public fun sin-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun sin-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun sinh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun sinh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun sqrt (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/structures/Buffer; + public fun sqrt (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; - public fun tan-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun tan-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun tanh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun tanh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; - public fun times (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun times (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public fun times (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryPlus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; } -public final class kscience/kmath/structures/RealBufferKt { +public final class space/kscience/kmath/structures/RealBufferKt { public static final fun RealBuffer (ILkotlin/jvm/functions/Function1;)[D public static final fun RealBuffer ([D)[D public static final fun asBuffer ([D)[D - public static final fun contentEquals-KRld2r8 ([D[D)Z - public static final fun getArray (Lkscience/kmath/structures/MutableBuffer;)[D + public static final fun contentEquals-2uVC2J0 ([D[D)Z + public static final fun getArray (Lspace/kscience/kmath/structures/MutableBuffer;)[D } -public final class kscience/kmath/structures/ShortBuffer : kscience/kmath/structures/MutableBuffer { - public static final synthetic fun box-impl ([S)Lkscience/kmath/structures/ShortBuffer; +public final class space/kscience/kmath/structures/ShortBuffer : space/kscience/kmath/structures/MutableBuffer { + public static final synthetic fun box-impl ([S)Lspace/kscience/kmath/structures/ShortBuffer; public static fun constructor-impl ([S)[S - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl ([SLkscience/kmath/structures/Buffer;)Z - public fun copy ()Lkscience/kmath/structures/MutableBuffer; - public static fun copy-impl ([S)Lkscience/kmath/structures/MutableBuffer; + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl ([SLspace/kscience/kmath/structures/Buffer;)Z + public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; + public static fun copy-impl ([S)Lspace/kscience/kmath/structures/MutableBuffer; public fun equals (Ljava/lang/Object;)Z public static fun equals-impl ([SLjava/lang/Object;)Z public static final fun equals-impl0 ([S[S)Z @@ -2990,26 +2991,26 @@ public final class kscience/kmath/structures/ShortBuffer : kscience/kmath/struct public final synthetic fun unbox-impl ()[S } -public final class kscience/kmath/structures/ShortBufferKt { +public final class space/kscience/kmath/structures/ShortBufferKt { public static final fun ShortBuffer (ILkotlin/jvm/functions/Function1;)[S public static final fun ShortBuffer ([S)[S public static final fun asBuffer ([S)[S - public static final fun getArray (Lkscience/kmath/structures/MutableBuffer;)[S + public static final fun getArray (Lspace/kscience/kmath/structures/MutableBuffer;)[S } -public final class kscience/kmath/structures/ValueFlag : java/lang/Enum { - public static final field MISSING Lkscience/kmath/structures/ValueFlag; - public static final field NAN Lkscience/kmath/structures/ValueFlag; - public static final field NEGATIVE_INFINITY Lkscience/kmath/structures/ValueFlag; - public static final field POSITIVE_INFINITY Lkscience/kmath/structures/ValueFlag; +public final class space/kscience/kmath/structures/ValueFlag : java/lang/Enum { + public static final field MISSING Lspace/kscience/kmath/structures/ValueFlag; + public static final field NAN Lspace/kscience/kmath/structures/ValueFlag; + public static final field NEGATIVE_INFINITY Lspace/kscience/kmath/structures/ValueFlag; + public static final field POSITIVE_INFINITY Lspace/kscience/kmath/structures/ValueFlag; public final fun getMask ()B - public static fun valueOf (Ljava/lang/String;)Lkscience/kmath/structures/ValueFlag; - public static fun values ()[Lkscience/kmath/structures/ValueFlag; + public static fun valueOf (Ljava/lang/String;)Lspace/kscience/kmath/structures/ValueFlag; + public static fun values ()[Lspace/kscience/kmath/structures/ValueFlag; } -public final class kscience/kmath/structures/VirtualBuffer : kscience/kmath/structures/Buffer { +public final class space/kscience/kmath/structures/VirtualBuffer : space/kscience/kmath/structures/Buffer { public fun (ILkotlin/jvm/functions/Function1;)V - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z public fun get (I)Ljava/lang/Object; public fun getSize ()I public fun iterator ()Ljava/util/Iterator; diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/HyperSquareDomain.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/HyperSquareDomain.kt index 20f19864f..3d0c6d3b8 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/HyperSquareDomain.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/HyperSquareDomain.kt @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package kscience.kmath.domains +package space.kscience.kmath.domains -import kscience.kmath.linear.Point -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.RealBuffer -import kscience.kmath.structures.indices +import space.kscience.kmath.linear.Point +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.RealBuffer +import space.kscience.kmath.structures.indices /** * diff --git a/kmath-for-real/README.md b/kmath-for-real/README.md index c291be3a1..92237350a 100644 --- a/kmath-for-real/README.md +++ b/kmath-for-real/README.md @@ -7,7 +7,7 @@ > #### Artifact: > -> This module artifact: `kscience.kmath:kmath-for-real:0.2.0-dev-7`. +> This module artifact: `space.kscience:kmath-for-real:0.2.0-dev-7`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-for-real/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-for-real/_latestVersion) > @@ -17,28 +17,31 @@ > > ```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://repo.kotlin.link' } > maven { url 'https://dl.bintray.com/hotkeytlt/maven' } -> +> maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap +>// Uncomment if repo.kotlin.link is unavailable +>// maven { url 'https://dl.bintray.com/mipt-npm/kscience' } +>// maven { url 'https://dl.bintray.com/mipt-npm/dev' } > } > > dependencies { -> implementation 'kscience.kmath:kmath-for-real:0.2.0-dev-7' +> implementation 'space.kscience:kmath-for-real:0.2.0-dev-7' > } > ``` > **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") +> maven("https://repo.kotlin.link") +> maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap +> maven("https://dl.bintray.com/hotkeytlt/maven") // required for a +>// Uncomment if repo.kotlin.link is unavailable +>// maven("https://dl.bintray.com/mipt-npm/kscience") +>// maven("https://dl.bintray.com/mipt-npm/dev") > } > > dependencies { -> implementation("kscience.kmath:kmath-for-real:0.2.0-dev-7") +> implementation("space.kscience:kmath-for-real:0.2.0-dev-7") > } > ``` diff --git a/kmath-functions/README.md b/kmath-functions/README.md index f5462e09f..ef54bf994 100644 --- a/kmath-functions/README.md +++ b/kmath-functions/README.md @@ -10,7 +10,7 @@ Functions and interpolations: > #### Artifact: > -> This module artifact: `kscience.kmath:kmath-functions:0.2.0-dev-7`. +> This module artifact: `space.kscience:kmath-functions:0.2.0-dev-7`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-functions/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-functions/_latestVersion) > @@ -20,28 +20,31 @@ Functions and interpolations: > > ```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://repo.kotlin.link' } > maven { url 'https://dl.bintray.com/hotkeytlt/maven' } -> +> maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap +>// Uncomment if repo.kotlin.link is unavailable +>// maven { url 'https://dl.bintray.com/mipt-npm/kscience' } +>// maven { url 'https://dl.bintray.com/mipt-npm/dev' } > } > > dependencies { -> implementation 'kscience.kmath:kmath-functions:0.2.0-dev-7' +> implementation 'space.kscience:kmath-functions:0.2.0-dev-7' > } > ``` > **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") +> maven("https://repo.kotlin.link") +> maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap +> maven("https://dl.bintray.com/hotkeytlt/maven") // required for a +>// Uncomment if repo.kotlin.link is unavailable +>// maven("https://dl.bintray.com/mipt-npm/kscience") +>// maven("https://dl.bintray.com/mipt-npm/dev") > } > > dependencies { -> implementation("kscience.kmath:kmath-functions:0.2.0-dev-7") +> implementation("space.kscience:kmath-functions:0.2.0-dev-7") > } > ``` diff --git a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counters.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counter.kt similarity index 91% rename from kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counters.kt rename to kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counter.kt index 27cccf43c..55e8c0631 100644 --- a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counters.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counter.kt @@ -2,8 +2,8 @@ package space.kscience.kmath.histogram import kotlinx.atomicfu.atomic import kotlinx.atomicfu.getAndUpdate -import kscience.kmath.operations.RealField -import kscience.kmath.operations.Space +import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.Space /** * Common representation for atomic counters diff --git a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/IndexedHistogramSpace.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/IndexedHistogramSpace.kt similarity index 84% rename from kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/IndexedHistogramSpace.kt rename to kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/IndexedHistogramSpace.kt index 53761452f..85262abeb 100644 --- a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/IndexedHistogramSpace.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/IndexedHistogramSpace.kt @@ -1,14 +1,14 @@ -package kscience.kmath.histogram +package space.kscience.kmath.histogram -import kscience.kmath.domains.Domain -import kscience.kmath.linear.Point -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.nd.NDSpace -import kscience.kmath.nd.NDStructure -import kscience.kmath.nd.Strides -import kscience.kmath.operations.Space -import kscience.kmath.operations.SpaceElement -import kscience.kmath.operations.invoke +import space.kscience.kmath.domains.Domain +import space.kscience.kmath.linear.Point +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.nd.NDSpace +import space.kscience.kmath.nd.NDStructure +import space.kscience.kmath.nd.Strides +import space.kscience.kmath.operations.Space +import space.kscience.kmath.operations.SpaceElement +import space.kscience.kmath.operations.invoke /** * A simple histogram bin based on domain diff --git a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/RealHistogramSpace.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/RealHistogramSpace.kt similarity index 95% rename from kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/RealHistogramSpace.kt rename to kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/RealHistogramSpace.kt index c9beb3a73..89d1a0723 100644 --- a/kmath-histograms/src/commonMain/kotlin/kscience/kmath/histogram/RealHistogramSpace.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/RealHistogramSpace.kt @@ -1,9 +1,9 @@ -package kscience.kmath.histogram +package space.kscience.kmath.histogram -import kscience.kmath.domains.Domain -import kscience.kmath.domains.HyperSquareDomain -import kscience.kmath.nd.* -import kscience.kmath.structures.* +import space.kscience.kmath.domains.Domain +import space.kscience.kmath.domains.HyperSquareDomain +import space.kscience.kmath.nd.* +import space.kscience.kmath.structures.* import kotlin.math.floor public class RealHistogramSpace( diff --git a/kmath-histograms/src/commonTest/kotlin/scietifik/kmath/histogram/MultivariateHistogramTest.kt b/kmath-histograms/src/commonTest/kotlin/space/kscience/kmath/histogram/MultivariateHistogramTest.kt similarity index 88% rename from kmath-histograms/src/commonTest/kotlin/scietifik/kmath/histogram/MultivariateHistogramTest.kt rename to kmath-histograms/src/commonTest/kotlin/space/kscience/kmath/histogram/MultivariateHistogramTest.kt index 44b9410d2..e83f42b4b 100644 --- a/kmath-histograms/src/commonTest/kotlin/scietifik/kmath/histogram/MultivariateHistogramTest.kt +++ b/kmath-histograms/src/commonTest/kotlin/space/kscience/kmath/histogram/MultivariateHistogramTest.kt @@ -1,10 +1,8 @@ -package scietifik.kmath.histogram +package space.kscience.kmath.histogram -import kscience.kmath.histogram.RealHistogramSpace -import kscience.kmath.histogram.put -import kscience.kmath.operations.invoke -import kscience.kmath.real.RealVector -import kscience.kmath.real.invoke +import space.kscience.kmath.operations.invoke +import space.kscience.kmath.real.RealVector +import space.kscience.kmath.real.invoke import kotlin.random.Random import kotlin.test.* @@ -46,7 +44,7 @@ internal class MultivariateHistogramTest { @Test fun testHistogramAlgebra() { - val hSpace = RealHistogramSpace.fromRanges( + RealHistogramSpace.fromRanges( (-1.0..1.0), (-1.0..1.0), (-1.0..1.0) diff --git a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/TreeHistogramSpace.kt b/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/TreeHistogramSpace.kt similarity index 93% rename from kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/TreeHistogramSpace.kt rename to kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/TreeHistogramSpace.kt index 67964fbeb..ddecc4332 100644 --- a/kmath-histograms/src/jvmMain/kotlin/kscience/kmath/histogram/TreeHistogramSpace.kt +++ b/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/TreeHistogramSpace.kt @@ -1,11 +1,12 @@ -package kscience.kmath.histogram +package space.kscience.kmath.histogram -import kscience.kmath.domains.UnivariateDomain -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.operations.Space -import kscience.kmath.structures.Buffer +import space.kscience.kmath.domains.UnivariateDomain +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.operations.Space +import space.kscience.kmath.structures.Buffer import java.util.* import kotlin.math.abs +import kotlin.math.floor import kotlin.math.sqrt private fun > TreeMap.getBin(value: Double): B? { @@ -68,7 +69,7 @@ public class TreeHistogramSpace( } hBuilder.apply(builder) val resBins = TreeMap() - bins.forEach { key, binCounter -> + bins.forEach { (key, binCounter) -> val count = binCounter.counter.value resBins[key] = UnivariateBin(binCounter.domain, count, sqrt(count)) } @@ -122,7 +123,7 @@ public class TreeHistogramSpace( binSize: Double, start: Double = 0.0, ): TreeHistogramSpace = TreeHistogramSpace { value -> - val center = start + binSize * Math.floor((value - start) / binSize + 0.5) + val center = start + binSize * floor((value - start) / binSize + 0.5) UnivariateDomain((center - binSize / 2)..(center + binSize / 2)) } diff --git a/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogram.kt b/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogram.kt index 68b9019d0..8c4f9e434 100644 --- a/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogram.kt +++ b/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogram.kt @@ -1,11 +1,11 @@ -package kscience.kmath.histogram +package space.kscience.kmath.histogram -import kscience.kmath.domains.UnivariateDomain -import kscience.kmath.misc.UnstableKMathAPI -import kscience.kmath.operations.Space -import kscience.kmath.operations.SpaceElement -import kscience.kmath.structures.Buffer -import kscience.kmath.structures.asSequence +import space.kscience.kmath.domains.UnivariateDomain +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.operations.Space +import space.kscience.kmath.operations.SpaceElement +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.asSequence public val UnivariateDomain.center: Double get() = (range.endInclusive - range.start) / 2 diff --git a/kmath-nd4j/README.md b/kmath-nd4j/README.md index 9011ef3c5..4cfd0427c 100644 --- a/kmath-nd4j/README.md +++ b/kmath-nd4j/README.md @@ -9,7 +9,7 @@ This subproject implements the following features: > #### Artifact: > -> This module artifact: `kscience.kmath:kmath-nd4j:0.2.0-dev-7`. +> This module artifact: `space.kscience:kmath-nd4j:0.2.0-dev-7`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-nd4j/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-nd4j/_latestVersion) > @@ -19,29 +19,32 @@ This subproject implements the following features: > > ```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://repo.kotlin.link' } > maven { url 'https://dl.bintray.com/hotkeytlt/maven' } -> +> maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap +>// Uncomment if repo.kotlin.link is unavailable +>// maven { url 'https://dl.bintray.com/mipt-npm/kscience' } +>// maven { url 'https://dl.bintray.com/mipt-npm/dev' } > } > > dependencies { -> implementation 'kscience.kmath:kmath-nd4j:0.2.0-dev-7' +> implementation 'space.kscience:kmath-nd4j:0.2.0-dev-7' > } > ``` > **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") +> maven("https://repo.kotlin.link") +> maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap +> maven("https://dl.bintray.com/hotkeytlt/maven") // required for a +>// Uncomment if repo.kotlin.link is unavailable +>// maven("https://dl.bintray.com/mipt-npm/kscience") +>// maven("https://dl.bintray.com/mipt-npm/dev") > } > > dependencies { -> implementation("kscience.kmath:kmath-nd4j:0.2.0-dev-7") +> implementation("space.kscience:kmath-nd4j:0.2.0-dev-7") > } > ``` From ef97386033b4c565589158fb84cc0425f0fb2ded Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Fri, 19 Feb 2021 17:33:20 +0700 Subject: [PATCH 084/150] 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 Date: Fri, 19 Feb 2021 13:38:32 +0300 Subject: [PATCH 085/150] Cleanup --- build.gradle.kts | 2 +- examples/build.gradle.kts | 8 ++++++++ .../kscience/kmath/structures/StructureReadBenchmark.kt | 1 + .../kscience/kmath/structures/StructureWriteBenchmark.kt | 1 + .../kotlin/space/kscience/kmath/complex/Complex.kt | 3 +++ .../kotlin/space/kscience/kmath/complex/Quaternion.kt | 2 ++ .../kotlin/space/kscience/kmath/linear/BufferMatrix.kt | 2 +- .../kotlin/space/kscience/kmath/structures/RealBuffer.kt | 4 ++-- .../kotlin/space/kscience/kmath/streaming/BufferFlow.kt | 2 +- .../space/kscience/kmath/streaming/RingBufferTest.kt | 2 +- .../commonMain/kotlin/space/kscience/kmath/real/dot.kt | 2 +- .../space/kscience/kmath/histogram/RealHistogramSpace.kt | 2 +- settings.gradle.kts | 5 ++--- 13 files changed, 25 insertions(+), 11 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 783c9ca56..c77ad38b5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { id("ru.mipt.npm.project") } -internal val kmathVersion: String by extra("0.2.0-dev-7") +internal val kmathVersion: String by extra("0.2.0") allprojects { repositories { diff --git a/examples/build.gradle.kts b/examples/build.gradle.kts index 5439d46dc..a1ffb32a3 100644 --- a/examples/build.gradle.kts +++ b/examples/build.gradle.kts @@ -69,6 +69,14 @@ benchmark { targets.register("benchmarks") // This one matches sourceSet name above + configurations.register("buffer") { + warmups = 1 // number of warmup iterations + iterations = 3 // number of iterations + iterationTime = 500 // time in seconds per iteration + iterationTimeUnit = "ms" // time unity for iterationTime, default is seconds + include("BufferBenchmark") + } + configurations.register("dot") { warmups = 1 // number of warmup iterations iterations = 3 // number of iterations diff --git a/examples/src/main/kotlin/space/kscience/kmath/structures/StructureReadBenchmark.kt b/examples/src/main/kotlin/space/kscience/kmath/structures/StructureReadBenchmark.kt index cfb3bdf7f..7f6d73394 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/structures/StructureReadBenchmark.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/structures/StructureReadBenchmark.kt @@ -4,6 +4,7 @@ import space.kscience.kmath.nd.DefaultStrides import space.kscience.kmath.nd.NDBuffer import kotlin.system.measureTimeMillis +@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE") fun main() { val n = 6000 val array = DoubleArray(n * n) { 1.0 } diff --git a/examples/src/main/kotlin/space/kscience/kmath/structures/StructureWriteBenchmark.kt b/examples/src/main/kotlin/space/kscience/kmath/structures/StructureWriteBenchmark.kt index c0d97f9ab..13d6f00e4 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/structures/StructureWriteBenchmark.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/structures/StructureWriteBenchmark.kt @@ -4,6 +4,7 @@ import space.kscience.kmath.nd.NDStructure import space.kscience.kmath.nd.mapToBuffer import kotlin.system.measureTimeMillis +@Suppress("UNUSED_VARIABLE") fun main() { val n = 6000 val structure = NDStructure.build(intArrayOf(n, n), Buffer.Companion::auto) { 1.0 } diff --git a/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Complex.kt b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Complex.kt index 6d2c04c39..deadfda5b 100644 --- a/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Complex.kt +++ b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Complex.kt @@ -3,6 +3,7 @@ package space.kscience.kmath.complex import space.kscience.kmath.memory.MemoryReader import space.kscience.kmath.memory.MemorySpec import space.kscience.kmath.memory.MemoryWriter +import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.operations.ExtendedField import space.kscience.kmath.operations.FieldElement import space.kscience.kmath.operations.Norm @@ -45,6 +46,7 @@ private val PI_DIV_2 = Complex(PI / 2, 0) /** * A field of [Complex]. */ +@OptIn(UnstableKMathAPI::class) public object ComplexField : ExtendedField, Norm, RingWithNumbers { public override val zero: Complex = 0.0.toComplex() public override val one: Complex = 1.0.toComplex() @@ -166,6 +168,7 @@ public object ComplexField : ExtendedField, Norm, Rin * @property re The real part. * @property im The imaginary part. */ +@OptIn(UnstableKMathAPI::class) public data class Complex(val re: Double, val im: Double) : FieldElement { public constructor(re: Number, im: Number) : this(re.toDouble(), im.toDouble()) public constructor(re: Number) : this(re.toDouble(), 0.0) diff --git a/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt index 848ac728f..d72644abe 100644 --- a/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt +++ b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt @@ -3,6 +3,7 @@ package space.kscience.kmath.complex import space.kscience.kmath.memory.MemoryReader import space.kscience.kmath.memory.MemorySpec import space.kscience.kmath.memory.MemoryWriter +import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.operations.* import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.MemoryBuffer @@ -34,6 +35,7 @@ public val Quaternion.r: Double /** * A field of [Quaternion]. */ +@OptIn(UnstableKMathAPI::class) public object QuaternionField : Field, Norm, PowerOperations, ExponentialOperations, RingWithNumbers { override val zero: Quaternion = 0.toQuaternion() diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferMatrix.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferMatrix.kt index 63f6f77cd..f8f7f5a05 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferMatrix.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferMatrix.kt @@ -91,7 +91,7 @@ public class BufferMatrixContext>( public class BufferMatrix( public override val rowNum: Int, public override val colNum: Int, - public val buffer: Buffer, + public val buffer: Buffer, ) : Matrix { init { diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBuffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBuffer.kt index b06efb3fc..e53ed85c7 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBuffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBuffer.kt @@ -9,9 +9,9 @@ package space.kscience.kmath.structures public inline class RealBuffer(public val array: DoubleArray) : MutableBuffer { override val size: Int get() = array.size - override inline operator fun get(index: Int): Double = array[index] + override operator fun get(index: Int): Double = array[index] - override inline operator fun set(index: Int, value: Double) { + override operator fun set(index: Int, value: Double) { array[index] = value } diff --git a/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/streaming/BufferFlow.kt b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/streaming/BufferFlow.kt index 262978306..4df22c2ad 100644 --- a/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/streaming/BufferFlow.kt +++ b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/streaming/BufferFlow.kt @@ -17,7 +17,7 @@ public fun Buffer.asFlow(): Flow = iterator().asFlow() * Flat map a [Flow] of [Buffer] into continuous [Flow] of elements */ @FlowPreview -public fun Flow>.spread(): Flow = flatMapConcat { it.asFlow() } +public fun Flow>.spread(): Flow = flatMapConcat { it.asFlow() } /** * Collect incoming flow into fixed size chunks diff --git a/kmath-coroutines/src/jvmTest/kotlin/space/kscience/kmath/streaming/RingBufferTest.kt b/kmath-coroutines/src/jvmTest/kotlin/space/kscience/kmath/streaming/RingBufferTest.kt index 3d037cbf9..4a7109310 100644 --- a/kmath-coroutines/src/jvmTest/kotlin/space/kscience/kmath/streaming/RingBufferTest.kt +++ b/kmath-coroutines/src/jvmTest/kotlin/space/kscience/kmath/streaming/RingBufferTest.kt @@ -28,7 +28,7 @@ internal class RingBufferTest { val windowed = flow.windowed(10) runBlocking { - val first = windowed.take(1).single() + @Suppress("UNUSED_VARIABLE") val first = windowed.take(1).single() val res = windowed.take(15).map { it.asSequence().average() }.toList() assertEquals(0.0, res[0]) assertEquals(4.5, res[9]) diff --git a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/dot.kt b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/dot.kt index 68ce917fc..cbfb364c1 100644 --- a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/dot.kt +++ b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/dot.kt @@ -13,7 +13,7 @@ public infix fun BufferMatrix.dot(other: BufferMatrix): BufferMa val resultArray = DoubleArray(this.rowNum * other.colNum) //convert to array to insure there is no memory indirection - fun Buffer.unsafeArray() = if (this is RealBuffer) + fun Buffer.unsafeArray() = if (this is RealBuffer) this.array else DoubleArray(size) { get(it) } diff --git a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/RealHistogramSpace.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/RealHistogramSpace.kt index 89d1a0723..26efdf1fe 100644 --- a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/RealHistogramSpace.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/RealHistogramSpace.kt @@ -70,7 +70,7 @@ public class RealHistogramSpace( val ndCounter = NDStructure.auto(strides) { Counter.real() } val hBuilder = HistogramBuilder { point, value -> val index = getIndex(point) - ndCounter[index].add(1.0) + ndCounter[index].add(value.toDouble()) } hBuilder.apply(builder) val values: NDBuffer = ndCounter.mapToBuffer { it.value } diff --git a/settings.gradle.kts b/settings.gradle.kts index 329bce8f9..c040f6e33 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -2,13 +2,12 @@ pluginManagement { repositories { gradlePluginPortal() jcenter() + maven("https://repo.kotlin.link") 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/kotlin/kotlinx") } - val toolsVersion = "0.7.6" + val toolsVersion = "0.7.7" val kotlinVersion = "1.4.30" plugins { From dd5ef4810fc8e596148255338a63eb8921c3ae5c Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 21 Feb 2021 16:13:40 +0300 Subject: [PATCH 086/150] Gradle plugin 0.8.0 --- .../workflows/{publish.yml => release.yml} | 2 +- README.md | 4 +- build.gradle.kts | 9 +- examples/build.gradle.kts | 1 + gradle/wrapper/gradle-wrapper.properties | 2 +- kmath-ast/README.md | 6 +- kmath-ast/build.gradle.kts | 5 +- kmath-commons/build.gradle.kts | 2 +- kmath-complex/README.md | 6 +- kmath-complex/build.gradle.kts | 4 +- .../kscience/kmath/complex/Quaternion.kt | 6 +- kmath-core/README.md | 6 +- kmath-core/api/kmath-core.api | 2744 ++++++++--------- kmath-core/build.gradle.kts | 4 +- kmath-coroutines/build.gradle.kts | 2 +- kmath-dimensions/build.gradle.kts | 4 +- kmath-ejml/build.gradle.kts | 2 +- kmath-for-real/README.md | 6 +- kmath-for-real/build.gradle.kts | 2 +- kmath-functions/README.md | 6 +- kmath-functions/build.gradle.kts | 2 +- kmath-geometry/build.gradle.kts | 2 +- kmath-histograms/build.gradle.kts | 2 +- kmath-kotlingrad/build.gradle.kts | 2 +- kmath-memory/build.gradle.kts | 4 +- kmath-nd4j/README.md | 6 +- kmath-nd4j/build.gradle.kts | 2 +- kmath-stat/build.gradle.kts | 2 +- kmath-viktor/api/kmath-viktor.api | 2 - kmath-viktor/build.gradle.kts | 2 +- settings.gradle.kts | 11 +- 31 files changed, 1410 insertions(+), 1450 deletions(-) rename .github/workflows/{publish.yml => release.yml} (99%) diff --git a/.github/workflows/publish.yml b/.github/workflows/release.yml similarity index 99% rename from .github/workflows/publish.yml rename to .github/workflows/release.yml index 40b172908..743520885 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Bintray Publish +name: Gradle release on: release: diff --git a/README.md b/README.md index 586d2185f..7b8e11109 100644 --- a/README.md +++ b/README.md @@ -257,8 +257,8 @@ repositories { } dependencies { - api("kscience.kmath:kmath-core:0.2.0-dev-7") - // api("kscience.kmath:kmath-core-jvm:0.2.0-dev-7") for jvm-specific version + api("kscience.kmath:kmath-core:0.2.0") + // api("kscience.kmath:kmath-core-jvm:0.2.0") for jvm-specific version } ``` diff --git a/build.gradle.kts b/build.gradle.kts index c77ad38b5..f0287f009 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,7 +1,6 @@ -import ru.mipt.npm.gradle.KSciencePublishPlugin plugins { - id("ru.mipt.npm.project") + id("ru.mipt.npm.gradle.project") } internal val kmathVersion: String by extra("0.2.0") @@ -26,7 +25,7 @@ allprojects { } subprojects { - if (name.startsWith("kmath")) apply() + if (name.startsWith("kmath")) apply() } readme { @@ -37,4 +36,8 @@ ksciencePublish { spaceRepo = "https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven" bintrayRepo = "kscience" githubProject = "kmath" +} + +apiValidation{ + nonPublicMarkers.add("space.kscience.kmath.misc.UnstableKMathAPI") } \ No newline at end of file diff --git a/examples/build.gradle.kts b/examples/build.gradle.kts index 2fea45815..77152dc0a 100644 --- a/examples/build.gradle.kts +++ b/examples/build.gradle.kts @@ -11,6 +11,7 @@ sourceSets.register("benchmarks") repositories { jcenter() + maven("https://repo.kotlin.link") maven("https://clojars.org/repo") maven("https://dl.bintray.com/egor-bogomolov/astminer/") maven("https://dl.bintray.com/hotkeytlt/maven") diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 28ff446a2..2a563242c 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.8.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/kmath-ast/README.md b/kmath-ast/README.md index eb84c7fe9..e52f0fa96 100644 --- a/kmath-ast/README.md +++ b/kmath-ast/README.md @@ -12,7 +12,7 @@ This subproject implements the following features: > #### Artifact: > -> This module artifact: `space.kscience:kmath-ast:0.2.0-dev-7`. +> This module artifact: `space.kscience:kmath-ast:0.2.0`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-ast/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-ast/_latestVersion) > @@ -31,7 +31,7 @@ This subproject implements the following features: > } > > dependencies { -> implementation 'space.kscience:kmath-ast:0.2.0-dev-7' +> implementation 'space.kscience:kmath-ast:0.2.0' > } > ``` > **Gradle Kotlin DSL:** @@ -47,7 +47,7 @@ This subproject implements the following features: > } > > dependencies { -> implementation("space.kscience:kmath-ast:0.2.0-dev-7") +> implementation("space.kscience:kmath-ast:0.2.0") > } > ``` diff --git a/kmath-ast/build.gradle.kts b/kmath-ast/build.gradle.kts index ed06b396b..894279695 100644 --- a/kmath-ast/build.gradle.kts +++ b/kmath-ast/build.gradle.kts @@ -1,7 +1,7 @@ import ru.mipt.npm.gradle.Maturity plugins { - id("ru.mipt.npm.mpp") + id("ru.mipt.npm.gradle.mpp") } kotlin.js { @@ -46,6 +46,9 @@ kotlin.sourceSets { } } +//Workaround for https://github.com/Kotlin/dokka/issues/1455 +tasks.getByName("dokkaHtml").dependsOn(tasks.getByName("build")) + readme { maturity = Maturity.PROTOTYPE propertyByTemplate("artifact", rootProject.file("docs/templates/ARTIFACT-TEMPLATE.md")) diff --git a/kmath-commons/build.gradle.kts b/kmath-commons/build.gradle.kts index 08b472295..4fe16605a 100644 --- a/kmath-commons/build.gradle.kts +++ b/kmath-commons/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("ru.mipt.npm.jvm") + id("ru.mipt.npm.gradle.jvm") } description = "Commons math binding for kmath" diff --git a/kmath-complex/README.md b/kmath-complex/README.md index 741529368..71a75bd3e 100644 --- a/kmath-complex/README.md +++ b/kmath-complex/README.md @@ -8,7 +8,7 @@ Complex and hypercomplex number systems in KMath: > #### Artifact: > -> This module artifact: `space.kscience:kmath-complex:0.2.0-dev-7`. +> This module artifact: `space.kscience:kmath-complex:0.2.0`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-complex/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-complex/_latestVersion) > @@ -27,7 +27,7 @@ Complex and hypercomplex number systems in KMath: > } > > dependencies { -> implementation 'space.kscience:kmath-complex:0.2.0-dev-7' +> implementation 'space.kscience:kmath-complex:0.2.0' > } > ``` > **Gradle Kotlin DSL:** @@ -43,6 +43,6 @@ Complex and hypercomplex number systems in KMath: > } > > dependencies { -> implementation("space.kscience:kmath-complex:0.2.0-dev-7") +> implementation("space.kscience:kmath-complex:0.2.0") > } > ``` diff --git a/kmath-complex/build.gradle.kts b/kmath-complex/build.gradle.kts index 8e1ae5cb3..4cd43c70c 100644 --- a/kmath-complex/build.gradle.kts +++ b/kmath-complex/build.gradle.kts @@ -1,8 +1,8 @@ import ru.mipt.npm.gradle.Maturity plugins { - id("ru.mipt.npm.mpp") - id("ru.mipt.npm.native") + id("ru.mipt.npm.gradle.mpp") + id("ru.mipt.npm.gradle.native") } kotlin.sourceSets { diff --git a/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt index d72644abe..4a15e7423 100644 --- a/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt +++ b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt @@ -183,8 +183,10 @@ public object QuaternionField : Field, Norm, * @property y The third component. * @property z The fourth component. */ -public data class Quaternion(val w: Double, val x: Double, val y: Double, val z: Double) : - FieldElement { +@OptIn(UnstableKMathAPI::class) +public data class Quaternion( + val w: Double, val x: Double, val y: Double, val z: Double, +) : FieldElement { public constructor(w: Number, x: Number, y: Number, z: Number) : this( w.toDouble(), x.toDouble(), diff --git a/kmath-core/README.md b/kmath-core/README.md index 1c94717a6..54380670d 100644 --- a/kmath-core/README.md +++ b/kmath-core/README.md @@ -15,7 +15,7 @@ performance calculations to code generation. > #### Artifact: > -> This module artifact: `space.kscience:kmath-core:0.2.0-dev-7`. +> This module artifact: `space.kscience:kmath-core:0.2.0`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-core/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-core/_latestVersion) > @@ -34,7 +34,7 @@ performance calculations to code generation. > } > > dependencies { -> implementation 'space.kscience:kmath-core:0.2.0-dev-7' +> implementation 'space.kscience:kmath-core:0.2.0' > } > ``` > **Gradle Kotlin DSL:** @@ -50,6 +50,6 @@ performance calculations to code generation. > } > > dependencies { -> implementation("space.kscience:kmath-core:0.2.0-dev-7") +> implementation("space.kscience:kmath-core:0.2.0") > } > ``` diff --git a/kmath-core/api/kmath-core.api b/kmath-core/api/kmath-core.api index ac3e9bd30..4a21a3d7e 100644 --- a/kmath-core/api/kmath-core.api +++ b/kmath-core/api/kmath-core.api @@ -1,65 +1,65 @@ -public abstract interface class kscience/kmath/domains/Domain { - public abstract fun contains (Lkscience/kmath/structures/Buffer;)Z +public abstract interface class space/kscience/kmath/domains/Domain { + public abstract fun contains (Lspace/kscience/kmath/structures/Buffer;)Z public abstract fun getDimension ()I } -public final class kscience/kmath/domains/HyperSquareDomain : kscience/kmath/domains/RealDomain { - public fun (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)V - public fun contains (Lkscience/kmath/structures/Buffer;)Z +public final class space/kscience/kmath/domains/HyperSquareDomain : space/kscience/kmath/domains/RealDomain { + public fun (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)V + public fun contains (Lspace/kscience/kmath/structures/Buffer;)Z public fun getDimension ()I public fun getLowerBound (I)Ljava/lang/Double; - public fun getLowerBound (ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; + public fun getLowerBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; public fun getUpperBound (I)Ljava/lang/Double; - public fun getUpperBound (ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; - public fun nearestInDomain (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun getUpperBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; + public fun nearestInDomain (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun volume ()D } -public abstract interface class kscience/kmath/domains/RealDomain : kscience/kmath/domains/Domain { +public abstract interface class space/kscience/kmath/domains/RealDomain : space/kscience/kmath/domains/Domain { public abstract fun getLowerBound (I)Ljava/lang/Double; - public abstract fun getLowerBound (ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; + public abstract fun getLowerBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; public abstract fun getUpperBound (I)Ljava/lang/Double; - public abstract fun getUpperBound (ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; - public abstract fun nearestInDomain (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public abstract fun getUpperBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; + public abstract fun nearestInDomain (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public abstract fun volume ()D } -public final class kscience/kmath/domains/UnconstrainedDomain : kscience/kmath/domains/RealDomain { +public final class space/kscience/kmath/domains/UnconstrainedDomain : space/kscience/kmath/domains/RealDomain { public fun (I)V - public fun contains (Lkscience/kmath/structures/Buffer;)Z + public fun contains (Lspace/kscience/kmath/structures/Buffer;)Z public fun getDimension ()I public fun getLowerBound (I)Ljava/lang/Double; - public fun getLowerBound (ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; + public fun getLowerBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; public fun getUpperBound (I)Ljava/lang/Double; - public fun getUpperBound (ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; - public fun nearestInDomain (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun getUpperBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; + public fun nearestInDomain (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun volume ()D } -public final class kscience/kmath/domains/UnivariateDomain : kscience/kmath/domains/RealDomain { - public static final synthetic fun box-impl (Lkotlin/ranges/ClosedFloatingPointRange;)Lkscience/kmath/domains/UnivariateDomain; +public final class space/kscience/kmath/domains/UnivariateDomain : space/kscience/kmath/domains/RealDomain { + public static final synthetic fun box-impl (Lkotlin/ranges/ClosedFloatingPointRange;)Lspace/kscience/kmath/domains/UnivariateDomain; public static fun constructor-impl (Lkotlin/ranges/ClosedFloatingPointRange;)Lkotlin/ranges/ClosedFloatingPointRange; - public fun contains (Lkscience/kmath/structures/Buffer;)Z + public fun contains (Lspace/kscience/kmath/structures/Buffer;)Z public static final fun contains-impl (Lkotlin/ranges/ClosedFloatingPointRange;D)Z - public static fun contains-impl (Lkotlin/ranges/ClosedFloatingPointRange;Lkscience/kmath/structures/Buffer;)Z + public static fun contains-impl (Lkotlin/ranges/ClosedFloatingPointRange;Lspace/kscience/kmath/structures/Buffer;)Z public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Lkotlin/ranges/ClosedFloatingPointRange;Ljava/lang/Object;)Z public static final fun equals-impl0 (Lkotlin/ranges/ClosedFloatingPointRange;Lkotlin/ranges/ClosedFloatingPointRange;)Z public fun getDimension ()I public static fun getDimension-impl (Lkotlin/ranges/ClosedFloatingPointRange;)I public fun getLowerBound (I)Ljava/lang/Double; - public fun getLowerBound (ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; + public fun getLowerBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; public static fun getLowerBound-impl (Lkotlin/ranges/ClosedFloatingPointRange;I)Ljava/lang/Double; - public static fun getLowerBound-impl (Lkotlin/ranges/ClosedFloatingPointRange;ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; + public static fun getLowerBound-impl (Lkotlin/ranges/ClosedFloatingPointRange;ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; public final fun getRange ()Lkotlin/ranges/ClosedFloatingPointRange; public fun getUpperBound (I)Ljava/lang/Double; - public fun getUpperBound (ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; + public fun getUpperBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; public static fun getUpperBound-impl (Lkotlin/ranges/ClosedFloatingPointRange;I)Ljava/lang/Double; - public static fun getUpperBound-impl (Lkotlin/ranges/ClosedFloatingPointRange;ILkscience/kmath/structures/Buffer;)Ljava/lang/Double; + public static fun getUpperBound-impl (Lkotlin/ranges/ClosedFloatingPointRange;ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; public fun hashCode ()I public static fun hashCode-impl (Lkotlin/ranges/ClosedFloatingPointRange;)I - public fun nearestInDomain (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static fun nearestInDomain-impl (Lkotlin/ranges/ClosedFloatingPointRange;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun nearestInDomain (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun nearestInDomain-impl (Lkotlin/ranges/ClosedFloatingPointRange;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun toString ()Ljava/lang/String; public static fun toString-impl (Lkotlin/ranges/ClosedFloatingPointRange;)Ljava/lang/String; public final synthetic fun unbox-impl ()Lkotlin/ranges/ClosedFloatingPointRange; @@ -67,384 +67,384 @@ public final class kscience/kmath/domains/UnivariateDomain : kscience/kmath/doma public static fun volume-impl (Lkotlin/ranges/ClosedFloatingPointRange;)D } -public abstract interface class kscience/kmath/expressions/AutoDiffProcessor { - public abstract fun process (Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/DifferentiableExpression; +public abstract interface class space/kscience/kmath/expressions/AutoDiffProcessor { + public abstract fun process (Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/DifferentiableExpression; } -public class kscience/kmath/expressions/AutoDiffValue { +public class space/kscience/kmath/expressions/AutoDiffValue { public fun (Ljava/lang/Object;)V public final fun getValue ()Ljava/lang/Object; } -public final class kscience/kmath/expressions/DerivationResult { - public fun (Ljava/lang/Object;Ljava/util/Map;Lkscience/kmath/operations/Field;)V - public final fun derivative (Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; +public final class space/kscience/kmath/expressions/DerivationResult { + public fun (Ljava/lang/Object;Ljava/util/Map;Lspace/kscience/kmath/operations/Field;)V + public final fun derivative (Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; public final fun div ()Ljava/lang/Object; - public final fun getContext ()Lkscience/kmath/operations/Field; + public final fun getContext ()Lspace/kscience/kmath/operations/Field; public final fun getValue ()Ljava/lang/Object; } -public abstract interface class kscience/kmath/expressions/DifferentiableExpression : kscience/kmath/expressions/Expression { - public abstract fun derivativeOrNull (Ljava/util/List;)Lkscience/kmath/expressions/Expression; +public abstract interface class space/kscience/kmath/expressions/DifferentiableExpression : space/kscience/kmath/expressions/Expression { + public abstract fun derivativeOrNull (Ljava/util/List;)Lspace/kscience/kmath/expressions/Expression; } -public final class kscience/kmath/expressions/DifferentiableExpressionKt { - public static final fun derivative (Lkscience/kmath/expressions/DifferentiableExpression;Ljava/lang/String;)Lkscience/kmath/expressions/Expression; - public static final fun derivative (Lkscience/kmath/expressions/DifferentiableExpression;Ljava/util/List;)Lkscience/kmath/expressions/Expression; - public static final fun derivative (Lkscience/kmath/expressions/DifferentiableExpression;[Lkscience/kmath/expressions/Symbol;)Lkscience/kmath/expressions/Expression; +public final class space/kscience/kmath/expressions/DifferentiableExpressionKt { + public static final fun derivative (Lspace/kscience/kmath/expressions/DifferentiableExpression;Ljava/lang/String;)Lspace/kscience/kmath/expressions/Expression; + public static final fun derivative (Lspace/kscience/kmath/expressions/DifferentiableExpression;Ljava/util/List;)Lspace/kscience/kmath/expressions/Expression; + public static final fun derivative (Lspace/kscience/kmath/expressions/DifferentiableExpression;[Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/expressions/Expression; } -public abstract interface class kscience/kmath/expressions/Expression { +public abstract interface class space/kscience/kmath/expressions/Expression { public abstract fun invoke (Ljava/util/Map;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/expressions/ExpressionAlgebra : kscience/kmath/operations/Algebra { - public abstract fun bindOrNull (Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; +public abstract interface class space/kscience/kmath/expressions/ExpressionAlgebra : space/kscience/kmath/operations/Algebra { + public abstract fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public abstract fun bindSymbolOrNull (Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; public abstract fun const (Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun symbol (Ljava/lang/String;)Ljava/lang/Object; } -public final class kscience/kmath/expressions/ExpressionAlgebra$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun symbol (Lkscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; +public final class space/kscience/kmath/expressions/ExpressionAlgebra$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/expressions/ExpressionAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/expressions/ExpressionBuildersKt { - public static final fun extendedFieldExpression (Lkscience/kmath/operations/ExtendedField;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/Expression; - public static final fun fieldExpression (Lkscience/kmath/operations/Field;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/Expression; - public static final fun ringExpression (Lkscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/Expression; - public static final fun spaceExpression (Lkscience/kmath/operations/Space;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/Expression; +public final class space/kscience/kmath/expressions/ExpressionBuildersKt { + public static final fun extendedFieldExpression (Lspace/kscience/kmath/operations/ExtendedField;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; + public static final fun fieldExpression (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; + public static final fun ringExpression (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; + public static final fun spaceExpression (Lspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; } -public final class kscience/kmath/expressions/ExpressionKt { - public static final fun bind (Lkscience/kmath/expressions/ExpressionAlgebra;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static final fun binding (Lkscience/kmath/expressions/ExpressionAlgebra;)Lkotlin/properties/ReadOnlyProperty; - public static final fun callByString (Lkscience/kmath/expressions/Expression;[Lkotlin/Pair;)Ljava/lang/Object; - public static final fun callBySymbol (Lkscience/kmath/expressions/Expression;[Lkotlin/Pair;)Ljava/lang/Object; +public final class space/kscience/kmath/expressions/ExpressionKt { + public static final fun bindSymbol (Lspace/kscience/kmath/expressions/ExpressionAlgebra;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static final fun binding (Lspace/kscience/kmath/expressions/ExpressionAlgebra;)Lkotlin/properties/ReadOnlyProperty; + public static final fun callByString (Lspace/kscience/kmath/expressions/Expression;[Lkotlin/Pair;)Ljava/lang/Object; + public static final fun callBySymbol (Lspace/kscience/kmath/expressions/Expression;[Lkotlin/Pair;)Ljava/lang/Object; public static final fun getSymbol ()Lkotlin/properties/ReadOnlyProperty; - public static final fun invoke (Lkscience/kmath/expressions/Expression;)Ljava/lang/Object; + public static final fun invoke (Lspace/kscience/kmath/expressions/Expression;)Ljava/lang/Object; } -public abstract class kscience/kmath/expressions/FirstDerivativeExpression : kscience/kmath/expressions/DifferentiableExpression { +public abstract class space/kscience/kmath/expressions/FirstDerivativeExpression : space/kscience/kmath/expressions/DifferentiableExpression { public fun ()V - public final fun derivativeOrNull (Ljava/util/List;)Lkscience/kmath/expressions/Expression; - public abstract fun derivativeOrNull (Lkscience/kmath/expressions/Symbol;)Lkscience/kmath/expressions/Expression; + public final fun derivativeOrNull (Ljava/util/List;)Lspace/kscience/kmath/expressions/Expression; + public abstract fun derivativeOrNull (Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/expressions/Expression; } -public abstract class kscience/kmath/expressions/FunctionalExpressionAlgebra : kscience/kmath/expressions/ExpressionAlgebra { - public fun (Lkscience/kmath/operations/Algebra;)V +public abstract class space/kscience/kmath/expressions/FunctionalExpressionAlgebra : space/kscience/kmath/expressions/ExpressionAlgebra { + public fun (Lspace/kscience/kmath/operations/Algebra;)V public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/expressions/Expression;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun bindOrNull (Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public fun bindOrNull (Lkscience/kmath/expressions/Symbol;)Lkscience/kmath/expressions/Expression; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/expressions/Expression; + public synthetic fun bindSymbolOrNull (Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public fun bindSymbolOrNull (Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun const (Ljava/lang/Object;)Ljava/lang/Object; - public fun const (Ljava/lang/Object;)Lkscience/kmath/expressions/Expression; - public final fun getAlgebra ()Lkscience/kmath/operations/Algebra; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/expressions/Expression; + public fun const (Ljava/lang/Object;)Lspace/kscience/kmath/expressions/Expression; + public final fun getAlgebra ()Lspace/kscience/kmath/operations/Algebra; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/expressions/FunctionalExpressionAlgebraKt { - public static final fun expressionInExtendedField (Lkscience/kmath/operations/ExtendedField;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/Expression; - public static final fun expressionInField (Lkscience/kmath/operations/Field;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/Expression; - public static final fun expressionInRing (Lkscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/Expression; - public static final fun expressionInSpace (Lkscience/kmath/operations/Space;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/Expression; +public final class space/kscience/kmath/expressions/FunctionalExpressionAlgebraKt { + public static final fun expressionInExtendedField (Lspace/kscience/kmath/operations/ExtendedField;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; + public static final fun expressionInField (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; + public static final fun expressionInRing (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; + public static final fun expressionInSpace (Lspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; } -public class kscience/kmath/expressions/FunctionalExpressionExtendedField : kscience/kmath/expressions/FunctionalExpressionField, kscience/kmath/operations/ExtendedField { - public fun (Lkscience/kmath/operations/ExtendedField;)V +public class space/kscience/kmath/expressions/FunctionalExpressionExtendedField : space/kscience/kmath/expressions/FunctionalExpressionField, space/kscience/kmath/operations/ExtendedField { + public fun (Lspace/kscience/kmath/operations/ExtendedField;)V public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; - public fun acos (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun acos (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun acosh (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun acosh (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; - public fun asin (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun asin (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun asinh (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun asinh (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; - public fun atan (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun atan (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun atanh (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun atanh (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; - public fun cos (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun cos (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun cosh (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun cosh (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; - public fun exp (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun exp (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; - public fun ln (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun ln (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number (Ljava/lang/Number;)Lkscience/kmath/expressions/Expression; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun pow (Lkscience/kmath/expressions/Expression;Ljava/lang/Number;)Lkscience/kmath/expressions/Expression; + public fun pow (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun power (Lkscience/kmath/expressions/Expression;Ljava/lang/Number;)Lkscience/kmath/expressions/Expression; + public fun power (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lkscience/kmath/expressions/Expression;Ljava/lang/Number;)Lkscience/kmath/expressions/Expression; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; - public fun sin (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun sin (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun sinh (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun sinh (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun sqrt (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun sqrt (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; - public fun tan (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun tan (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun tanh (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun tanh (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public class kscience/kmath/expressions/FunctionalExpressionField : kscience/kmath/expressions/FunctionalExpressionRing, kscience/kmath/operations/Field { - public fun (Lkscience/kmath/operations/Field;)V +public class space/kscience/kmath/expressions/FunctionalExpressionField : space/kscience/kmath/expressions/FunctionalExpressionRing, space/kscience/kmath/operations/Field { + public fun (Lspace/kscience/kmath/operations/Field;)V public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Number;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun div (Ljava/lang/Number;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public final fun div (Ljava/lang/Object;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; - public final fun div (Lkscience/kmath/expressions/Expression;Ljava/lang/Object;)Lkscience/kmath/expressions/Expression; - public fun div (Lkscience/kmath/expressions/Expression;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public final fun div (Ljava/lang/Object;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; + public final fun div (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Object;)Lspace/kscience/kmath/expressions/Expression; + public fun div (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide (Lkscience/kmath/expressions/Expression;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun divide (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public class kscience/kmath/expressions/FunctionalExpressionRing : kscience/kmath/expressions/FunctionalExpressionSpace, kscience/kmath/operations/Ring { - public fun (Lkscience/kmath/operations/Ring;)V +public class space/kscience/kmath/expressions/FunctionalExpressionRing : space/kscience/kmath/expressions/FunctionalExpressionSpace, space/kscience/kmath/operations/Ring { + public fun (Lspace/kscience/kmath/operations/Ring;)V public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lkscience/kmath/expressions/Expression; + public fun getOne ()Lspace/kscience/kmath/expressions/Expression; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/expressions/Expression;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun multiply (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public final fun times (Ljava/lang/Object;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; - public final fun times (Lkscience/kmath/expressions/Expression;Ljava/lang/Object;)Lkscience/kmath/expressions/Expression; - public fun times (Lkscience/kmath/expressions/Expression;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public final fun times (Ljava/lang/Object;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; + public final fun times (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Object;)Lspace/kscience/kmath/expressions/Expression; + public fun times (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public class kscience/kmath/expressions/FunctionalExpressionSpace : kscience/kmath/expressions/FunctionalExpressionAlgebra, kscience/kmath/operations/Space { - public fun (Lkscience/kmath/operations/Space;)V +public class space/kscience/kmath/expressions/FunctionalExpressionSpace : space/kscience/kmath/expressions/FunctionalExpressionAlgebra, space/kscience/kmath/operations/Space { + public fun (Lspace/kscience/kmath/operations/Space;)V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lkscience/kmath/expressions/Expression;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun add (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun div (Lkscience/kmath/expressions/Expression;Ljava/lang/Number;)Lkscience/kmath/expressions/Expression; + public fun div (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lkscience/kmath/expressions/Expression; + public fun getZero ()Lspace/kscience/kmath/expressions/Expression; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public final fun minus (Ljava/lang/Object;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; - public final fun minus (Lkscience/kmath/expressions/Expression;Ljava/lang/Object;)Lkscience/kmath/expressions/Expression; - public fun minus (Lkscience/kmath/expressions/Expression;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public final fun minus (Ljava/lang/Object;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; + public final fun minus (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Object;)Lspace/kscience/kmath/expressions/Expression; + public fun minus (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/expressions/Expression;Ljava/lang/Number;)Lkscience/kmath/expressions/Expression; + public fun multiply (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public final fun plus (Ljava/lang/Object;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; - public final fun plus (Lkscience/kmath/expressions/Expression;Ljava/lang/Object;)Lkscience/kmath/expressions/Expression; - public fun plus (Lkscience/kmath/expressions/Expression;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public final fun plus (Ljava/lang/Object;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; + public final fun plus (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Object;)Lspace/kscience/kmath/expressions/Expression; + public fun plus (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun times (Lkscience/kmath/expressions/Expression;Ljava/lang/Number;)Lkscience/kmath/expressions/Expression; + public fun times (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun unaryMinus (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/expressions/Expression;)Lkscience/kmath/expressions/Expression; + public fun unaryPlus (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; } -public final class kscience/kmath/expressions/SimpleAutoDiffExpression : kscience/kmath/expressions/FirstDerivativeExpression { - public fun (Lkscience/kmath/operations/Field;Lkotlin/jvm/functions/Function1;)V - public fun derivativeOrNull (Lkscience/kmath/expressions/Symbol;)Lkscience/kmath/expressions/Expression; - public final fun getField ()Lkscience/kmath/operations/Field; +public final class space/kscience/kmath/expressions/SimpleAutoDiffExpression : space/kscience/kmath/expressions/FirstDerivativeExpression { + public fun (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function1;)V + public fun derivativeOrNull (Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/expressions/Expression; + public final fun getField ()Lspace/kscience/kmath/operations/Field; public final fun getFunction ()Lkotlin/jvm/functions/Function1; public fun invoke (Ljava/util/Map;)Ljava/lang/Object; } -public final class kscience/kmath/expressions/SimpleAutoDiffExtendedField : kscience/kmath/expressions/SimpleAutoDiffField, kscience/kmath/operations/ExtendedField { - public fun (Lkscience/kmath/operations/ExtendedField;Ljava/util/Map;)V +public final class space/kscience/kmath/expressions/SimpleAutoDiffExtendedField : space/kscience/kmath/expressions/SimpleAutoDiffField, space/kscience/kmath/operations/ExtendedField { + public fun (Lspace/kscience/kmath/operations/ExtendedField;Ljava/util/Map;)V public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; - public fun acos (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun acos (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun acosh (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun acosh (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; - public fun asin (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun asin (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun asinh (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun asinh (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; - public fun atan (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun atan (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun atanh (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun atanh (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; - public fun cos (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun cos (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun cosh (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun cosh (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; - public fun exp (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun exp (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; - public fun ln (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun ln (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun pow (Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; - public final fun pow (Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun pow (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public final fun pow (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun power (Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; + public fun power (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; - public fun sin (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun sin (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun sinh (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public final fun sqr (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun sinh (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public final fun sqr (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun sqrt (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun sqrt (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; - public fun tan (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun tan (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun tanh (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun tanh (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public class kscience/kmath/expressions/SimpleAutoDiffField : kscience/kmath/expressions/ExpressionAlgebra, kscience/kmath/operations/Field, kscience/kmath/operations/RingWithNumbers { - public fun (Lkscience/kmath/operations/Field;Ljava/util/Map;)V +public class space/kscience/kmath/expressions/SimpleAutoDiffField : space/kscience/kmath/expressions/ExpressionAlgebra, space/kscience/kmath/operations/Field, space/kscience/kmath/operations/RingWithNumbers { + public fun (Lspace/kscience/kmath/operations/Field;Ljava/util/Map;)V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun add (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun bindOrNull (Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public fun bindOrNull (Lkscience/kmath/expressions/Symbol;)Lkscience/kmath/expressions/AutoDiffValue; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public synthetic fun bindSymbolOrNull (Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public fun bindSymbolOrNull (Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun const (Ljava/lang/Object;)Ljava/lang/Object; - public fun const (Ljava/lang/Object;)Lkscience/kmath/expressions/AutoDiffValue; - public final fun const (Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/AutoDiffValue; + public fun const (Ljava/lang/Object;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public final fun const (Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/AutoDiffValue; public final fun derive (Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Number;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun div (Ljava/lang/Number;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; - public fun div (Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun div (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public fun div (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide (Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public final fun getContext ()Lkscience/kmath/operations/Field; - public final fun getD (Lkscience/kmath/expressions/AutoDiffValue;)Ljava/lang/Object; + public fun divide (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public final fun getContext ()Lspace/kscience/kmath/operations/Field; + public final fun getD (Lspace/kscience/kmath/expressions/AutoDiffValue;)Ljava/lang/Object; public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lkscience/kmath/expressions/AutoDiffValue; + public fun getOne ()Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lkscience/kmath/expressions/AutoDiffValue; + public fun getZero ()Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Ljava/lang/Number;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun minus (Ljava/lang/Number;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; - public fun minus (Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun minus (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public fun minus (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; - public fun multiply (Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun multiply (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public fun multiply (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number (Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Ljava/lang/Number;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun plus (Ljava/lang/Number;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; - public fun plus (Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun plus (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public fun plus (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public final fun setD (Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Object;)V - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/expressions/AutoDiffValue; + public final fun setD (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Object;)V public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Lkscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lkscience/kmath/expressions/AutoDiffValue; - public fun times (Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun times (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public fun times (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun unaryMinus (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; + public fun unaryPlus (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; } -public final class kscience/kmath/expressions/SimpleAutoDiffKt { - public static final fun acos (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun acosh (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun asin (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun asinh (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun atan (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun atanh (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun cos (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun cosh (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun exp (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun grad (Lkscience/kmath/expressions/DerivationResult;[Lkscience/kmath/expressions/Symbol;)Lkscience/kmath/structures/Buffer; - public static final fun ln (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun pow (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;D)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun pow (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;I)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun pow (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun simpleAutoDiff (Lkscience/kmath/operations/Field;)Lkscience/kmath/expressions/AutoDiffProcessor; - public static final fun simpleAutoDiff (Lkscience/kmath/operations/Field;Ljava/util/Map;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/DerivationResult; - public static final fun simpleAutoDiff (Lkscience/kmath/operations/Field;[Lkotlin/Pair;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/expressions/DerivationResult; - public static final fun sin (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun sinh (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun sqr (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun sqrt (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun tan (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; - public static final fun tanh (Lkscience/kmath/expressions/SimpleAutoDiffField;Lkscience/kmath/expressions/AutoDiffValue;)Lkscience/kmath/expressions/AutoDiffValue; +public final class space/kscience/kmath/expressions/SimpleAutoDiffKt { + public static final fun acos (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun acosh (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun asin (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun asinh (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun atan (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun atanh (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun cos (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun cosh (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun exp (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun grad (Lspace/kscience/kmath/expressions/DerivationResult;[Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/structures/Buffer; + public static final fun ln (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun pow (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;D)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun pow (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;I)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun pow (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun simpleAutoDiff (Lspace/kscience/kmath/operations/Field;)Lspace/kscience/kmath/expressions/AutoDiffProcessor; + public static final fun simpleAutoDiff (Lspace/kscience/kmath/operations/Field;Ljava/util/Map;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/DerivationResult; + public static final fun simpleAutoDiff (Lspace/kscience/kmath/operations/Field;[Lkotlin/Pair;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/DerivationResult; + public static final fun sin (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun sinh (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun sqr (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun sqrt (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun tan (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public static final fun tanh (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; } -public final class kscience/kmath/expressions/SimpleSymbolIndexer : kscience/kmath/expressions/SymbolIndexer { - public static final synthetic fun box-impl (Ljava/util/List;)Lkscience/kmath/expressions/SimpleSymbolIndexer; +public final class space/kscience/kmath/expressions/SimpleSymbolIndexer : space/kscience/kmath/expressions/SymbolIndexer { + public static final synthetic fun box-impl (Ljava/util/List;)Lspace/kscience/kmath/expressions/SimpleSymbolIndexer; public static fun constructor-impl (Ljava/util/List;)Ljava/util/List; public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Ljava/util/List;Ljava/lang/Object;)Z public static final fun equals-impl0 (Ljava/util/List;Ljava/util/List;)Z - public fun get (Ljava/util/List;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public fun get (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/expressions/Symbol;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public fun get (Lkscience/kmath/structures/Buffer;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public fun get ([DLkscience/kmath/expressions/Symbol;)D - public fun get ([Ljava/lang/Object;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get-impl (Ljava/util/List;Ljava/util/List;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get-impl (Ljava/util/List;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/expressions/Symbol;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get-impl (Ljava/util/List;Lkscience/kmath/structures/Buffer;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get-impl (Ljava/util/List;[DLkscience/kmath/expressions/Symbol;)D - public static fun get-impl (Ljava/util/List;[Ljava/lang/Object;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public fun get (Ljava/util/List;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public fun get (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/expressions/Symbol;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public fun get (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public fun get ([DLspace/kscience/kmath/expressions/Symbol;)D + public fun get ([Ljava/lang/Object;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static fun get-impl (Ljava/util/List;Ljava/util/List;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static fun get-impl (Ljava/util/List;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/expressions/Symbol;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static fun get-impl (Ljava/util/List;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static fun get-impl (Ljava/util/List;[DLspace/kscience/kmath/expressions/Symbol;)D + public static fun get-impl (Ljava/util/List;[Ljava/lang/Object;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; public fun getSymbols ()Ljava/util/List; public fun hashCode ()I public static fun hashCode-impl (Ljava/util/List;)I - public fun indexOf (Lkscience/kmath/expressions/Symbol;)I - public static fun indexOf-impl (Ljava/util/List;Lkscience/kmath/expressions/Symbol;)I + public fun indexOf (Lspace/kscience/kmath/expressions/Symbol;)I + public static fun indexOf-impl (Ljava/util/List;Lspace/kscience/kmath/expressions/Symbol;)I public fun toDoubleArray (Ljava/util/Map;)[D public static fun toDoubleArray-impl (Ljava/util/List;Ljava/util/Map;)[D public fun toList (Ljava/util/Map;)Ljava/util/List; public static fun toList-impl (Ljava/util/List;Ljava/util/Map;)Ljava/util/List; public fun toMap ([D)Ljava/util/Map; public static fun toMap-impl (Ljava/util/List;[D)Ljava/util/Map; - public fun toPoint (Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/structures/Buffer; - public static fun toPoint-impl (Ljava/util/List;Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/structures/Buffer; + public fun toPoint (Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; + public static fun toPoint-impl (Ljava/util/List;Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; public fun toString ()Ljava/lang/String; public static fun toString-impl (Ljava/util/List;)Ljava/lang/String; public final synthetic fun unbox-impl ()Ljava/util/List; } -public final class kscience/kmath/expressions/StringSymbol : kscience/kmath/expressions/Symbol { - public static final synthetic fun box-impl (Ljava/lang/String;)Lkscience/kmath/expressions/StringSymbol; +public final class space/kscience/kmath/expressions/StringSymbol : space/kscience/kmath/expressions/Symbol { + public static final synthetic fun box-impl (Ljava/lang/String;)Lspace/kscience/kmath/expressions/StringSymbol; public static fun constructor-impl (Ljava/lang/String;)Ljava/lang/String; public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Ljava/lang/String;Ljava/lang/Object;)Z @@ -457,468 +457,460 @@ public final class kscience/kmath/expressions/StringSymbol : kscience/kmath/expr public final synthetic fun unbox-impl ()Ljava/lang/String; } -public abstract interface class kscience/kmath/expressions/Symbol { +public abstract interface class space/kscience/kmath/expressions/Symbol { public abstract fun getIdentity ()Ljava/lang/String; } -public abstract interface class kscience/kmath/expressions/SymbolIndexer { - public abstract fun get (Ljava/util/List;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public abstract fun get (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/expressions/Symbol;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public abstract fun get (Lkscience/kmath/structures/Buffer;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public abstract fun get ([DLkscience/kmath/expressions/Symbol;)D - public abstract fun get ([Ljava/lang/Object;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; +public abstract interface class space/kscience/kmath/expressions/SymbolIndexer { + public abstract fun get (Ljava/util/List;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public abstract fun get (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/expressions/Symbol;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public abstract fun get (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public abstract fun get ([DLspace/kscience/kmath/expressions/Symbol;)D + public abstract fun get ([Ljava/lang/Object;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; public abstract fun getSymbols ()Ljava/util/List; - public abstract fun indexOf (Lkscience/kmath/expressions/Symbol;)I + public abstract fun indexOf (Lspace/kscience/kmath/expressions/Symbol;)I public abstract fun toDoubleArray (Ljava/util/Map;)[D public abstract fun toList (Ljava/util/Map;)Ljava/util/List; public abstract fun toMap ([D)Ljava/util/Map; - public abstract fun toPoint (Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/structures/Buffer; + public abstract fun toPoint (Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; } -public final class kscience/kmath/expressions/SymbolIndexer$DefaultImpls { - public static fun get (Lkscience/kmath/expressions/SymbolIndexer;Ljava/util/List;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get (Lkscience/kmath/expressions/SymbolIndexer;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/expressions/Symbol;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get (Lkscience/kmath/expressions/SymbolIndexer;Lkscience/kmath/structures/Buffer;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get (Lkscience/kmath/expressions/SymbolIndexer;[DLkscience/kmath/expressions/Symbol;)D - public static fun get (Lkscience/kmath/expressions/SymbolIndexer;[Ljava/lang/Object;Lkscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun indexOf (Lkscience/kmath/expressions/SymbolIndexer;Lkscience/kmath/expressions/Symbol;)I - public static fun toDoubleArray (Lkscience/kmath/expressions/SymbolIndexer;Ljava/util/Map;)[D - public static fun toList (Lkscience/kmath/expressions/SymbolIndexer;Ljava/util/Map;)Ljava/util/List; - public static fun toMap (Lkscience/kmath/expressions/SymbolIndexer;[D)Ljava/util/Map; - public static fun toPoint (Lkscience/kmath/expressions/SymbolIndexer;Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/structures/Buffer; +public final class space/kscience/kmath/expressions/SymbolIndexer$DefaultImpls { + public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;Ljava/util/List;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/expressions/Symbol;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;[DLspace/kscience/kmath/expressions/Symbol;)D + public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;[Ljava/lang/Object;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static fun indexOf (Lspace/kscience/kmath/expressions/SymbolIndexer;Lspace/kscience/kmath/expressions/Symbol;)I + public static fun toDoubleArray (Lspace/kscience/kmath/expressions/SymbolIndexer;Ljava/util/Map;)[D + public static fun toList (Lspace/kscience/kmath/expressions/SymbolIndexer;Ljava/util/Map;)Ljava/util/List; + public static fun toMap (Lspace/kscience/kmath/expressions/SymbolIndexer;[D)Ljava/util/Map; + public static fun toPoint (Lspace/kscience/kmath/expressions/SymbolIndexer;Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; } -public final class kscience/kmath/expressions/SymbolIndexerKt { +public final class space/kscience/kmath/expressions/SymbolIndexerKt { public static final fun withSymbols (Ljava/util/Collection;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun withSymbols ([Lkscience/kmath/expressions/Symbol;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final fun withSymbols ([Lspace/kscience/kmath/expressions/Symbol;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; } -public final class kscience/kmath/linear/BufferMatrix : kscience/kmath/nd/Structure2D { - public fun (IILkscience/kmath/structures/Buffer;)V +public final class space/kscience/kmath/linear/BufferMatrix : space/kscience/kmath/nd/Structure2D { + public fun (IILspace/kscience/kmath/structures/Buffer;)V public fun elements ()Lkotlin/sequences/Sequence; public fun equals (Ljava/lang/Object;)Z public fun get (II)Ljava/lang/Object; public fun get ([I)Ljava/lang/Object; - public final fun getBuffer ()Lkscience/kmath/structures/Buffer; + public final fun getBuffer ()Lspace/kscience/kmath/structures/Buffer; public fun getColNum ()I - public fun getColumns ()Lkscience/kmath/structures/Buffer; + public fun getColumns ()Lspace/kscience/kmath/structures/Buffer; public fun getDimension ()I - public fun getFeature (Lkotlin/reflect/KClass;)Ljava/lang/Object; public fun getRowNum ()I - public fun getRows ()Lkscience/kmath/structures/Buffer; + public fun getRows ()Lspace/kscience/kmath/structures/Buffer; public fun getShape ()[I public fun hashCode ()I public fun toString ()Ljava/lang/String; } -public final class kscience/kmath/linear/BufferMatrixContext : kscience/kmath/linear/GenericMatrixContext { - public static final field Companion Lkscience/kmath/linear/BufferMatrixContext$Companion; - public fun (Lkscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V +public final class space/kscience/kmath/linear/BufferMatrixContext : space/kscience/kmath/linear/GenericMatrixContext { + public static final field Companion Lspace/kscience/kmath/linear/BufferMatrixContext$Companion; + public fun (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/linear/BufferMatrix; - public synthetic fun add (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun add (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun add (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun div (Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; - 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 getElementContext ()Lkscience/kmath/operations/Ring; - public fun getFeature (Lkscience/kmath/nd/Structure2D;Lkotlin/reflect/KClass;)Ljava/lang/Object; + public fun div (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public fun getElementContext ()Lspace/kscience/kmath/operations/Ring; 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; + public fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/linear/BufferMatrix; - public synthetic fun multiply (Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; - public final fun one (II)Lkscience/kmath/nd/Structure2D; + public fun multiply (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun multiply (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public final fun one (II)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public fun point (ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/Buffer; - public fun produce (IILkotlin/jvm/functions/Function2;)Lkscience/kmath/linear/BufferMatrix; - public synthetic fun produce (IILkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/Structure2D; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/nd/Structure2D; + public fun plus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun point (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun times (Ljava/lang/Object;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/linear/BufferMatrix; - public synthetic fun times (Ljava/lang/Object;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public fun times (Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; - public fun times (Lkscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lkscience/kmath/linear/BufferMatrix; - public synthetic fun times (Lkscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; + public fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/linear/BufferMatrix; - public synthetic fun unaryMinus (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun unaryMinus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun unaryMinus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun unaryPlus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/BufferMatrixContext$Companion { +public final class space/kscience/kmath/linear/BufferMatrixContext$Companion { } -public final class kscience/kmath/linear/BufferVectorSpace : kscience/kmath/linear/VectorSpace { - public fun (ILkscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;)V +public final class space/kscience/kmath/linear/BufferVectorSpace : space/kscience/kmath/linear/VectorSpace { + public fun (ILspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;)V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun add (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun div (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; + public fun div (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public final fun getBufferFactory ()Lkotlin/jvm/functions/Function2; public fun getSize ()I - public fun getSpace ()Lkscience/kmath/operations/Space; + public fun getSpace ()Lspace/kscience/kmath/operations/Space; public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lkscience/kmath/structures/Buffer; + public fun getZero ()Lspace/kscience/kmath/structures/Buffer; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun minus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; + public fun multiply (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/structures/Buffer; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/structures/Buffer; + public fun plus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun times (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; + public fun times (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryPlus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; } -public abstract interface class kscience/kmath/linear/CholeskyDecompositionFeature : kscience/kmath/linear/MatrixFeature { - public abstract fun getL ()Lkscience/kmath/nd/Structure2D; +public abstract interface class space/kscience/kmath/linear/CholeskyDecompositionFeature : space/kscience/kmath/linear/MatrixFeature { + public abstract fun getL ()Lspace/kscience/kmath/nd/Structure2D; } -public abstract interface class kscience/kmath/linear/DeterminantFeature : kscience/kmath/linear/MatrixFeature { +public abstract interface class space/kscience/kmath/linear/DeterminantFeature : space/kscience/kmath/linear/MatrixFeature { public abstract fun getDeterminant ()Ljava/lang/Object; } -public abstract interface class kscience/kmath/linear/DiagonalFeature : kscience/kmath/linear/MatrixFeature { - public static final field Companion Lkscience/kmath/linear/DiagonalFeature$Companion; +public abstract interface class space/kscience/kmath/linear/DiagonalFeature : space/kscience/kmath/linear/MatrixFeature { + public static final field Companion Lspace/kscience/kmath/linear/DiagonalFeature$Companion; } -public final class kscience/kmath/linear/DiagonalFeature$Companion : kscience/kmath/linear/DiagonalFeature { +public final class space/kscience/kmath/linear/DiagonalFeature$Companion : space/kscience/kmath/linear/DiagonalFeature { } -public abstract interface class kscience/kmath/linear/GenericMatrixContext : kscience/kmath/linear/MatrixContext { - public abstract fun add (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - 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 getElementContext ()Lkscience/kmath/operations/Ring; - public abstract fun minus (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public abstract fun multiply (Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; - public abstract fun times (Lkscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; - public abstract fun unaryMinus (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; +public abstract interface class space/kscience/kmath/linear/GenericMatrixContext : space/kscience/kmath/linear/MatrixContext { + public abstract fun add (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public abstract fun getElementContext ()Lspace/kscience/kmath/operations/Ring; + public abstract fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun multiply (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun unaryMinus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/GenericMatrixContext$DefaultImpls { - public static fun add (Lkscience/kmath/linear/GenericMatrixContext;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun binaryOperation (Lkscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun binaryOperationFunction (Lkscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - 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; - public static fun point (Lkscience/kmath/linear/GenericMatrixContext;ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/Buffer; - public static fun symbol (Lkscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lkscience/kmath/nd/Structure2D; - public static fun times (Lkscience/kmath/linear/GenericMatrixContext;Ljava/lang/Number;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun times (Lkscience/kmath/linear/GenericMatrixContext;Ljava/lang/Object;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun times (Lkscience/kmath/linear/GenericMatrixContext;Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; - public static fun times (Lkscience/kmath/linear/GenericMatrixContext;Lkscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; - public static fun unaryMinus (Lkscience/kmath/linear/GenericMatrixContext;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun unaryOperation (Lkscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun unaryOperationFunction (Lkscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/linear/GenericMatrixContext;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; +public final class space/kscience/kmath/linear/GenericMatrixContext$DefaultImpls { + public static fun add (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun binaryOperation (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun binaryOperationFunction (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lspace/kscience/kmath/nd/Structure2D; + public static fun div (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public static fun dot (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun dot (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun minus (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun multiply (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public static fun plus (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun point (Lspace/kscience/kmath/linear/GenericMatrixContext;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public static fun times (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/Number;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun times (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun times (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public static fun times (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; + public static fun unaryMinus (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun unaryOperation (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun unaryOperationFunction (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; } -public abstract interface class kscience/kmath/linear/InverseMatrixFeature : kscience/kmath/linear/MatrixFeature { - public abstract fun getInverse ()Lkscience/kmath/nd/Structure2D; +public abstract interface class space/kscience/kmath/linear/InverseMatrixFeature : space/kscience/kmath/linear/MatrixFeature { + public abstract fun getInverse ()Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/LFeature : kscience/kmath/linear/MatrixFeature { - public static final field INSTANCE Lkscience/kmath/linear/LFeature; +public final class space/kscience/kmath/linear/LFeature : space/kscience/kmath/linear/MatrixFeature { + public static final field INSTANCE Lspace/kscience/kmath/linear/LFeature; } -public final class kscience/kmath/linear/LinearAlgebraKt { - public static final fun asMatrix (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/linear/VirtualMatrix; - public static final fun asPoint (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/structures/Buffer; +public final class space/kscience/kmath/linear/LinearAlgebraKt { + public static final fun asMatrix (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/linear/VirtualMatrix; + public static final fun asPoint (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/structures/Buffer; } -public abstract interface class kscience/kmath/linear/LinearSolver { - public abstract fun inverse (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public abstract fun solve (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public abstract fun solve (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; +public abstract interface class space/kscience/kmath/linear/LinearSolver { + public abstract fun inverse (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun solve (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun solve (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; } -public final class kscience/kmath/linear/LinearSolver$DefaultImpls { - public static fun solve (Lkscience/kmath/linear/LinearSolver;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; +public final class space/kscience/kmath/linear/LinearSolver$DefaultImpls { + public static fun solve (Lspace/kscience/kmath/linear/LinearSolver;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; } -public final class kscience/kmath/linear/LupDecomposition : kscience/kmath/linear/DeterminantFeature, kscience/kmath/linear/LupDecompositionFeature { - public fun (Lkscience/kmath/linear/MatrixContext;Lkscience/kmath/operations/Field;Lkscience/kmath/nd/Structure2D;[IZ)V - public final fun getContext ()Lkscience/kmath/linear/MatrixContext; +public final class space/kscience/kmath/linear/LupDecomposition : space/kscience/kmath/linear/DeterminantFeature, space/kscience/kmath/linear/LupDecompositionFeature { + public fun (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/operations/Field;Lspace/kscience/kmath/nd/Structure2D;[IZ)V + public final fun getContext ()Lspace/kscience/kmath/linear/MatrixContext; public fun getDeterminant ()Ljava/lang/Object; - public final fun getElementContext ()Lkscience/kmath/operations/Field; - public fun getL ()Lkscience/kmath/nd/Structure2D; - public final fun getLu ()Lkscience/kmath/nd/Structure2D; - public fun getP ()Lkscience/kmath/nd/Structure2D; + public final fun getElementContext ()Lspace/kscience/kmath/operations/Field; + public fun getL ()Lspace/kscience/kmath/nd/Structure2D; + public final fun getLu ()Lspace/kscience/kmath/nd/Structure2D; + public fun getP ()Lspace/kscience/kmath/nd/Structure2D; public final fun getPivot ()[I - public fun getU ()Lkscience/kmath/nd/Structure2D; + public fun getU ()Lspace/kscience/kmath/nd/Structure2D; } -public abstract interface class kscience/kmath/linear/LupDecompositionFeature : kscience/kmath/linear/MatrixFeature { - public abstract fun getL ()Lkscience/kmath/nd/Structure2D; - public abstract fun getP ()Lkscience/kmath/nd/Structure2D; - public abstract fun getU ()Lkscience/kmath/nd/Structure2D; +public abstract interface class space/kscience/kmath/linear/LupDecompositionFeature : space/kscience/kmath/linear/MatrixFeature { + public abstract fun getL ()Lspace/kscience/kmath/nd/Structure2D; + public abstract fun getP ()Lspace/kscience/kmath/nd/Structure2D; + public abstract fun getU ()Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/LupDecompositionKt { - public static final fun abs (Lkscience/kmath/linear/GenericMatrixContext;Ljava/lang/Comparable;)Ljava/lang/Comparable; - public static final fun inverseWithLup (Lkscience/kmath/linear/RealMatrixContext;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static final fun lup (Lkscience/kmath/linear/MatrixContext;Lkotlin/jvm/functions/Function2;Lkscience/kmath/operations/Field;Lkscience/kmath/nd/Structure2D;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/linear/LupDecomposition; - public static final fun lup (Lkscience/kmath/linear/MatrixContext;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/linear/LupDecomposition; - public static final fun solveWithLup (Lkscience/kmath/linear/LupDecomposition;Lkotlin/jvm/functions/Function2;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static final fun solveWithLup (Lkscience/kmath/linear/RealMatrixContext;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; +public final class space/kscience/kmath/linear/LupDecompositionKt { + public static final fun abs (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/Comparable;)Ljava/lang/Comparable; + public static final fun inverseWithLup (Lspace/kscience/kmath/linear/RealMatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static final fun lup (Lspace/kscience/kmath/linear/MatrixContext;Lkotlin/jvm/functions/Function2;Lspace/kscience/kmath/operations/Field;Lspace/kscience/kmath/nd/Structure2D;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/linear/LupDecomposition; + public static final fun lup (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/LupDecomposition; + public static final fun solveWithLup (Lspace/kscience/kmath/linear/LupDecomposition;Lkotlin/jvm/functions/Function2;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static final fun solveWithLup (Lspace/kscience/kmath/linear/RealMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/MatrixBuilder { +public final class space/kscience/kmath/linear/MatrixBuilder { public fun (II)V public final fun getColumns ()I public final fun getRows ()I - public final fun invoke ([Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; + public final fun invoke ([Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/MatrixBuilderKt { - public static final fun build (Lkscience/kmath/nd/Structure2D$Companion;II)Lkscience/kmath/linear/MatrixBuilder; - public static final fun column (Lkscience/kmath/nd/Structure2D$Companion;[Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; - public static final fun row (Lkscience/kmath/nd/Structure2D$Companion;[Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; +public final class space/kscience/kmath/linear/MatrixBuilderKt { + public static final fun build (Lspace/kscience/kmath/nd/Structure2D$Companion;II)Lspace/kscience/kmath/linear/MatrixBuilder; + public static final fun column (Lspace/kscience/kmath/nd/Structure2D$Companion;[Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; + public static final fun row (Lspace/kscience/kmath/nd/Structure2D$Companion;[Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; } -public abstract interface class kscience/kmath/linear/MatrixContext : kscience/kmath/operations/SpaceOperations { - public static final field Companion Lkscience/kmath/linear/MatrixContext$Companion; +public abstract interface class space/kscience/kmath/linear/MatrixContext : space/kscience/kmath/operations/SpaceOperations { + public static final field Companion Lspace/kscience/kmath/linear/MatrixContext$Companion; 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; - public abstract fun times (Lkscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; + public abstract fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public abstract fun point (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public abstract fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/MatrixContext$Companion { - public final fun buffered (Lkscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/linear/GenericMatrixContext; - public static synthetic fun buffered$default (Lkscience/kmath/linear/MatrixContext$Companion;Lkscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkscience/kmath/linear/GenericMatrixContext; +public final class space/kscience/kmath/linear/MatrixContext$Companion { + public final fun buffered (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/GenericMatrixContext; + public static synthetic fun buffered$default (Lspace/kscience/kmath/linear/MatrixContext$Companion;Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lspace/kscience/kmath/linear/GenericMatrixContext; } -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; - public static fun symbol (Lkscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lkscience/kmath/nd/Structure2D; - public static fun times (Lkscience/kmath/linear/MatrixContext;Ljava/lang/Number;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun times (Lkscience/kmath/linear/MatrixContext;Ljava/lang/Object;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun times (Lkscience/kmath/linear/MatrixContext;Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; - public static fun unaryMinus (Lkscience/kmath/linear/MatrixContext;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun unaryOperation (Lkscience/kmath/linear/MatrixContext;Ljava/lang/String;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static fun unaryOperationFunction (Lkscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/linear/MatrixContext;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; +public final class space/kscience/kmath/linear/MatrixContext$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun binaryOperationFunction (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lspace/kscience/kmath/nd/Structure2D; + public static fun div (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public static fun minus (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun plus (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun point (Lspace/kscience/kmath/linear/MatrixContext;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public static fun times (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/Number;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun times (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun times (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public static fun unaryMinus (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun unaryOperation (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun unaryOperationFunction (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; } -public abstract interface class kscience/kmath/linear/MatrixFeature { +public abstract interface class space/kscience/kmath/linear/MatrixFeature { } -public final class kscience/kmath/linear/MatrixFeaturesKt { - public static final fun DeterminantFeature (Ljava/lang/Object;)Lkscience/kmath/linear/DeterminantFeature; +public final class space/kscience/kmath/linear/MatrixFeaturesKt { + public static final fun DeterminantFeature (Ljava/lang/Object;)Lspace/kscience/kmath/linear/DeterminantFeature; } -public final class kscience/kmath/linear/MatrixWrapper : kscience/kmath/nd/Structure2D { +public final class space/kscience/kmath/linear/MatrixWrapper : space/kscience/kmath/nd/Structure2D { public fun elements ()Lkotlin/sequences/Sequence; public fun equals (Ljava/lang/Object;)Z public fun get (II)Ljava/lang/Object; public fun get ([I)Ljava/lang/Object; public fun getColNum ()I - public fun getColumns ()Lkscience/kmath/structures/Buffer; + public fun getColumns ()Lspace/kscience/kmath/structures/Buffer; public fun getDimension ()I - public fun getFeature (Lkotlin/reflect/KClass;)Ljava/lang/Object; public final fun getFeatures ()Ljava/util/Set; - public final fun getOrigin ()Lkscience/kmath/nd/Structure2D; + public final fun getOrigin ()Lspace/kscience/kmath/nd/Structure2D; public fun getRowNum ()I - public fun getRows ()Lkscience/kmath/structures/Buffer; + public fun getRows ()Lspace/kscience/kmath/structures/Buffer; public fun getShape ()[I public fun hashCode ()I public fun toString ()Ljava/lang/String; } -public final class kscience/kmath/linear/MatrixWrapperKt { - public static final fun getOrigin (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static final fun one (Lkscience/kmath/linear/GenericMatrixContext;II)Lkscience/kmath/nd/Structure2D; - public static final fun plus (Lkscience/kmath/nd/Structure2D;Ljava/util/Collection;)Lkscience/kmath/linear/MatrixWrapper; - public static final fun plus (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/linear/MatrixFeature;)Lkscience/kmath/linear/MatrixWrapper; - public static final fun square (Lkscience/kmath/nd/Structure2D$Companion;[Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; - public static final fun transpose (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public static final fun zero (Lkscience/kmath/linear/GenericMatrixContext;II)Lkscience/kmath/nd/Structure2D; +public final class space/kscience/kmath/linear/MatrixWrapperKt { + public static final fun getOrigin (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static final fun one (Lspace/kscience/kmath/linear/GenericMatrixContext;II)Lspace/kscience/kmath/nd/Structure2D; + public static final fun plus (Lspace/kscience/kmath/nd/Structure2D;Ljava/util/Collection;)Lspace/kscience/kmath/linear/MatrixWrapper; + public static final fun plus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/linear/MatrixFeature;)Lspace/kscience/kmath/linear/MatrixWrapper; + public static final fun square (Lspace/kscience/kmath/nd/Structure2D$Companion;[Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; + public static final fun transpose (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static final fun zero (Lspace/kscience/kmath/linear/GenericMatrixContext;II)Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/OrthogonalFeature : kscience/kmath/linear/MatrixFeature { - public static final field INSTANCE Lkscience/kmath/linear/OrthogonalFeature; +public final class space/kscience/kmath/linear/OrthogonalFeature : space/kscience/kmath/linear/MatrixFeature { + public static final field INSTANCE Lspace/kscience/kmath/linear/OrthogonalFeature; } -public abstract interface class kscience/kmath/linear/QRDecompositionFeature : kscience/kmath/linear/MatrixFeature { - public abstract fun getQ ()Lkscience/kmath/nd/Structure2D; - public abstract fun getR ()Lkscience/kmath/nd/Structure2D; +public abstract interface class space/kscience/kmath/linear/QRDecompositionFeature : space/kscience/kmath/linear/MatrixFeature { + public abstract fun getQ ()Lspace/kscience/kmath/nd/Structure2D; + public abstract fun getR ()Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/RealMatrixContext : kscience/kmath/linear/MatrixContext { - public static final field INSTANCE Lkscience/kmath/linear/RealMatrixContext; +public final class space/kscience/kmath/linear/RealMatrixContext : space/kscience/kmath/linear/MatrixContext { + public static final field INSTANCE Lspace/kscience/kmath/linear/RealMatrixContext; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/linear/BufferMatrix; + public fun add (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun div (Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; - 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 fun div (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; 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 fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/linear/BufferMatrix; - public final fun one (II)Lkscience/kmath/nd/Structure2D; + public fun multiply (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/linear/BufferMatrix; + public final fun one (II)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/nd/Structure2D;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public fun point (ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/Buffer; - public fun produce (IILkotlin/jvm/functions/Function2;)Lkscience/kmath/linear/BufferMatrix; - public synthetic fun produce (IILkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/Structure2D; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/nd/Structure2D; - public fun times (DLkscience/kmath/nd/Structure2D;)Lkscience/kmath/linear/BufferMatrix; + public fun plus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun point (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/Structure2D; + public fun times (DLspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public synthetic fun times (Ljava/lang/Object;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; - public fun times (Lkscience/kmath/nd/Structure2D;D)Lkscience/kmath/linear/BufferMatrix; - public fun times (Lkscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lkscience/kmath/nd/Structure2D; - public synthetic fun times (Lkscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lkscience/kmath/nd/Structure2D; - public final fun toBufferMatrix (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/linear/BufferMatrix; + public synthetic fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun times (Lspace/kscience/kmath/nd/Structure2D;D)Lspace/kscience/kmath/linear/BufferMatrix; + public fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; + public synthetic fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; + public final fun toBufferMatrix (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun unaryMinus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/nd/Structure2D; + public fun unaryPlus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/RealMatrixContextKt { - public static final fun getReal (Lkscience/kmath/linear/MatrixContext$Companion;)Lkscience/kmath/linear/RealMatrixContext; +public final class space/kscience/kmath/linear/RealMatrixContextKt { + public static final fun getReal (Lspace/kscience/kmath/linear/MatrixContext$Companion;)Lspace/kscience/kmath/linear/RealMatrixContext; } -public abstract interface class kscience/kmath/linear/SingularValueDecompositionFeature : kscience/kmath/linear/MatrixFeature { - public abstract fun getS ()Lkscience/kmath/nd/Structure2D; - public abstract fun getSingularValues ()Lkscience/kmath/structures/Buffer; - public abstract fun getU ()Lkscience/kmath/nd/Structure2D; - public abstract fun getV ()Lkscience/kmath/nd/Structure2D; +public abstract interface class space/kscience/kmath/linear/SingularValueDecompositionFeature : space/kscience/kmath/linear/MatrixFeature { + public abstract fun getS ()Lspace/kscience/kmath/nd/Structure2D; + public abstract fun getSingularValues ()Lspace/kscience/kmath/structures/Buffer; + public abstract fun getU ()Lspace/kscience/kmath/nd/Structure2D; + public abstract fun getV ()Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/TransposedFeature : kscience/kmath/linear/MatrixFeature { - public fun (Lkscience/kmath/nd/Structure2D;)V - public final fun getOriginal ()Lkscience/kmath/nd/Structure2D; +public final class space/kscience/kmath/linear/TransposedFeature : space/kscience/kmath/linear/MatrixFeature { + public fun (Lspace/kscience/kmath/nd/Structure2D;)V + public final fun getOriginal ()Lspace/kscience/kmath/nd/Structure2D; } -public final class kscience/kmath/linear/UFeature : kscience/kmath/linear/MatrixFeature { - public static final field INSTANCE Lkscience/kmath/linear/UFeature; +public final class space/kscience/kmath/linear/UFeature : space/kscience/kmath/linear/MatrixFeature { + public static final field INSTANCE Lspace/kscience/kmath/linear/UFeature; } -public final class kscience/kmath/linear/UnitFeature : kscience/kmath/linear/DiagonalFeature { - public static final field INSTANCE Lkscience/kmath/linear/UnitFeature; +public final class space/kscience/kmath/linear/UnitFeature : space/kscience/kmath/linear/DiagonalFeature { + public static final field INSTANCE Lspace/kscience/kmath/linear/UnitFeature; } -public abstract interface class kscience/kmath/linear/VectorSpace : kscience/kmath/operations/Space { - public static final field Companion Lkscience/kmath/linear/VectorSpace$Companion; - public abstract fun add (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; +public abstract interface class space/kscience/kmath/linear/VectorSpace : space/kscience/kmath/operations/Space { + public static final field Companion Lspace/kscience/kmath/linear/VectorSpace$Companion; + public abstract fun add (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public abstract fun getSize ()I - public abstract fun getSpace ()Lkscience/kmath/operations/Space; - public abstract fun getZero ()Lkscience/kmath/structures/Buffer; - public abstract fun multiply (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; - public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/structures/Buffer; + public abstract fun getSpace ()Lspace/kscience/kmath/operations/Space; + public abstract fun getZero ()Lspace/kscience/kmath/structures/Buffer; + public abstract fun multiply (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; } -public final class kscience/kmath/linear/VectorSpace$Companion { - public final fun buffered (ILkscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/linear/BufferVectorSpace; - public static synthetic fun buffered$default (Lkscience/kmath/linear/VectorSpace$Companion;ILkscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkscience/kmath/linear/BufferVectorSpace; - public final fun real (I)Lkscience/kmath/linear/BufferVectorSpace; +public final class space/kscience/kmath/linear/VectorSpace$Companion { + public final fun buffered (ILspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferVectorSpace; + public static synthetic fun buffered$default (Lspace/kscience/kmath/linear/VectorSpace$Companion;ILspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lspace/kscience/kmath/linear/BufferVectorSpace; + public final fun real (I)Lspace/kscience/kmath/linear/BufferVectorSpace; } -public final class kscience/kmath/linear/VectorSpace$DefaultImpls { - public static fun add (Lkscience/kmath/linear/VectorSpace;Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static fun binaryOperation (Lkscience/kmath/linear/VectorSpace;Ljava/lang/String;Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static fun binaryOperationFunction (Lkscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/linear/VectorSpace;Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; - public static fun getZero (Lkscience/kmath/linear/VectorSpace;)Lkscience/kmath/structures/Buffer; - public static fun minus (Lkscience/kmath/linear/VectorSpace;Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static fun multiply (Lkscience/kmath/linear/VectorSpace;Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; - public static fun plus (Lkscience/kmath/linear/VectorSpace;Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static fun symbol (Lkscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lkscience/kmath/structures/Buffer; - public static fun times (Lkscience/kmath/linear/VectorSpace;Ljava/lang/Number;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static fun times (Lkscience/kmath/linear/VectorSpace;Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; - public static fun unaryMinus (Lkscience/kmath/linear/VectorSpace;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static fun unaryOperation (Lkscience/kmath/linear/VectorSpace;Ljava/lang/String;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static fun unaryOperationFunction (Lkscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/linear/VectorSpace;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; +public final class space/kscience/kmath/linear/VectorSpace$DefaultImpls { + public static fun add (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun binaryOperation (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun binaryOperationFunction (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lspace/kscience/kmath/structures/Buffer; + public static fun div (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public static fun getZero (Lspace/kscience/kmath/linear/VectorSpace;)Lspace/kscience/kmath/structures/Buffer; + public static fun minus (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun multiply (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public static fun plus (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun times (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun times (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public static fun unaryMinus (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun unaryOperation (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun unaryOperationFunction (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; } -public final class kscience/kmath/linear/VirtualMatrix : kscience/kmath/nd/Structure2D { +public final class space/kscience/kmath/linear/VirtualMatrix : space/kscience/kmath/nd/Structure2D { public fun (IILkotlin/jvm/functions/Function2;)V public fun elements ()Lkotlin/sequences/Sequence; public fun equals (Ljava/lang/Object;)Z public fun get (II)Ljava/lang/Object; public fun get ([I)Ljava/lang/Object; public fun getColNum ()I - public fun getColumns ()Lkscience/kmath/structures/Buffer; + public fun getColumns ()Lspace/kscience/kmath/structures/Buffer; public fun getDimension ()I - public fun getFeature (Lkotlin/reflect/KClass;)Ljava/lang/Object; public final fun getGenerator ()Lkotlin/jvm/functions/Function2; public fun getRowNum ()I - public fun getRows ()Lkscience/kmath/structures/Buffer; + public fun getRows ()Lspace/kscience/kmath/structures/Buffer; public fun getShape ()[I public fun hashCode ()I } -public final class kscience/kmath/linear/ZeroFeature : kscience/kmath/linear/DiagonalFeature { - public static final field INSTANCE Lkscience/kmath/linear/ZeroFeature; +public final class space/kscience/kmath/linear/ZeroFeature : space/kscience/kmath/linear/DiagonalFeature { + public static final field INSTANCE Lspace/kscience/kmath/linear/ZeroFeature; } -public final class kscience/kmath/misc/CumulativeKt { +public final class space/kscience/kmath/misc/CumulativeKt { public static final fun cumulative (Ljava/lang/Iterable;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/lang/Iterable; public static final fun cumulative (Ljava/util/Iterator;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/util/Iterator; public static final fun cumulative (Ljava/util/List;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/util/List; public static final fun cumulative (Lkotlin/sequences/Sequence;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Lkotlin/sequences/Sequence; - public static final fun cumulativeSum (Ljava/lang/Iterable;Lkscience/kmath/operations/Space;)Ljava/lang/Iterable; - public static final fun cumulativeSum (Ljava/util/List;Lkscience/kmath/operations/Space;)Ljava/util/List; - public static final fun cumulativeSum (Lkotlin/sequences/Sequence;Lkscience/kmath/operations/Space;)Lkotlin/sequences/Sequence; + public static final fun cumulativeSum (Ljava/lang/Iterable;Lspace/kscience/kmath/operations/Space;)Ljava/lang/Iterable; + public static final fun cumulativeSum (Ljava/util/List;Lspace/kscience/kmath/operations/Space;)Ljava/util/List; + public static final fun cumulativeSum (Lkotlin/sequences/Sequence;Lspace/kscience/kmath/operations/Space;)Lkotlin/sequences/Sequence; public static final fun cumulativeSumOfDouble (Ljava/lang/Iterable;)Ljava/lang/Iterable; public static final fun cumulativeSumOfDouble (Ljava/util/List;)Ljava/util/List; public static final fun cumulativeSumOfDouble (Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence; @@ -930,116 +922,116 @@ public final class kscience/kmath/misc/CumulativeKt { public static final fun cumulativeSumOfLong (Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence; } -public abstract interface annotation class kscience/kmath/misc/UnstableKMathAPI : java/lang/annotation/Annotation { +public abstract interface annotation class space/kscience/kmath/misc/UnstableKMathAPI : java/lang/annotation/Annotation { } -public abstract interface class kscience/kmath/nd/BufferNDAlgebra : kscience/kmath/nd/NDAlgebra { - public abstract fun combine (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDBuffer; - public abstract fun getBuffer (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/structures/Buffer; +public abstract interface class space/kscience/kmath/nd/BufferNDAlgebra : space/kscience/kmath/nd/NDAlgebra { + public abstract fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public abstract fun getBuffer (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/structures/Buffer; public abstract fun getBufferFactory ()Lkotlin/jvm/functions/Function2; - public abstract fun getStrides ()Lkscience/kmath/nd/Strides; - public abstract fun map (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; - public abstract fun mapIndexed (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDBuffer; - public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; + public abstract fun getStrides ()Lspace/kscience/kmath/nd/Strides; + public abstract fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public abstract fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; } -public final class kscience/kmath/nd/BufferNDAlgebra$DefaultImpls { - public static fun combine (Lkscience/kmath/nd/BufferNDAlgebra;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDBuffer; - public static fun getBuffer (Lkscience/kmath/nd/BufferNDAlgebra;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/structures/Buffer; - public static fun invoke (Lkscience/kmath/nd/BufferNDAlgebra;Lkotlin/jvm/functions/Function1;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun map (Lkscience/kmath/nd/BufferNDAlgebra;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; - public static fun mapIndexed (Lkscience/kmath/nd/BufferNDAlgebra;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDBuffer; - public static fun produce (Lkscience/kmath/nd/BufferNDAlgebra;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; +public final class space/kscience/kmath/nd/BufferNDAlgebra$DefaultImpls { + public static fun combine (Lspace/kscience/kmath/nd/BufferNDAlgebra;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public static fun getBuffer (Lspace/kscience/kmath/nd/BufferNDAlgebra;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/structures/Buffer; + public static fun invoke (Lspace/kscience/kmath/nd/BufferNDAlgebra;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun map (Lspace/kscience/kmath/nd/BufferNDAlgebra;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public static fun mapIndexed (Lspace/kscience/kmath/nd/BufferNDAlgebra;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public static fun produce (Lspace/kscience/kmath/nd/BufferNDAlgebra;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; } -public final class kscience/kmath/nd/BufferNDAlgebraKt { - public static final fun field (Lkscience/kmath/nd/NDAlgebra$Companion;Lkscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;[I)Lkscience/kmath/nd/BufferedNDField; - public static final fun ndField (Lkscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun ndRing (Lkscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun ndSpace (Lkscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun ring (Lkscience/kmath/nd/NDAlgebra$Companion;Lkscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[I)Lkscience/kmath/nd/BufferedNDRing; - public static final fun space (Lkscience/kmath/nd/NDAlgebra$Companion;Lkscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;[I)Lkscience/kmath/nd/BufferedNDSpace; +public final class space/kscience/kmath/nd/BufferNDAlgebraKt { + public static final fun field (Lspace/kscience/kmath/nd/NDAlgebra$Companion;Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedNDField; + public static final fun ndField (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final fun ndRing (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final fun ndSpace (Lspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final fun ring (Lspace/kscience/kmath/nd/NDAlgebra$Companion;Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedNDRing; + public static final fun space (Lspace/kscience/kmath/nd/NDAlgebra$Companion;Lspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedNDSpace; } -public class kscience/kmath/nd/BufferedNDField : kscience/kmath/nd/BufferedNDRing, kscience/kmath/nd/NDField { - public fun ([ILkscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;)V +public class space/kscience/kmath/nd/BufferedNDField : space/kscience/kmath/nd/BufferedNDRing, space/kscience/kmath/nd/NDField { + public fun ([ILspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;)V public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun div (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun div (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public fun div (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun div (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun div (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public fun div (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun divide (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public class kscience/kmath/nd/BufferedNDRing : kscience/kmath/nd/BufferedNDSpace, kscience/kmath/nd/NDRing { - public fun ([ILkscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V +public class space/kscience/kmath/nd/BufferedNDRing : space/kscience/kmath/nd/BufferedNDSpace, space/kscience/kmath/nd/NDRing { + public fun ([ILspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lkscience/kmath/nd/NDBuffer; + public fun getOne ()Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun multiply (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun times (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public fun times (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun times (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public fun times (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public class kscience/kmath/nd/BufferedNDSpace : kscience/kmath/nd/BufferNDAlgebra, kscience/kmath/nd/NDSpace { - public fun ([ILkscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;)V +public class space/kscience/kmath/nd/BufferedNDSpace : space/kscience/kmath/nd/BufferNDAlgebra, space/kscience/kmath/nd/NDSpace { + public fun ([ILspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;)V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun add (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public fun combine (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun combine (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDStructure; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/nd/NDStructure; + public fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun div (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public fun getBuffer (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/structures/Buffer; + public fun div (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public fun getBuffer (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/structures/Buffer; public final fun getBufferFactory ()Lkotlin/jvm/functions/Function2; public synthetic fun getElementContext ()Ljava/lang/Object; - public final fun getElementContext ()Lkscience/kmath/operations/Space; + public final fun getElementContext ()Lspace/kscience/kmath/operations/Space; public final fun getShape ()[I - public fun getStrides ()Lkscience/kmath/nd/Strides; + public fun getStrides ()Lspace/kscience/kmath/nd/Strides; public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lkscience/kmath/nd/NDBuffer; - public fun invoke (Lkotlin/jvm/functions/Function1;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun map (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun map (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDStructure; - public fun mapIndexed (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun mapIndexed (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDStructure; + public fun getZero ()Lspace/kscience/kmath/nd/NDBuffer; + public fun invoke (Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; + public fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun minus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public fun minus (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun minus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public fun minus (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun multiply (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun plus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public fun plus (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDStructure; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/nd/NDStructure; + public fun plus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun plus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public fun plus (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun times (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun times (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun unaryMinus (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun unaryPlus (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public final class kscience/kmath/nd/DefaultStrides : kscience/kmath/nd/Strides { - public static final field Companion Lkscience/kmath/nd/DefaultStrides$Companion; +public final class space/kscience/kmath/nd/DefaultStrides : space/kscience/kmath/nd/Strides { + public static final field Companion Lspace/kscience/kmath/nd/DefaultStrides$Companion; public synthetic fun ([ILkotlin/jvm/internal/DefaultConstructorMarker;)V public fun equals (Ljava/lang/Object;)Z public fun getLinearSize ()I @@ -1051,307 +1043,303 @@ public final class kscience/kmath/nd/DefaultStrides : kscience/kmath/nd/Strides public fun offset ([I)I } -public final class kscience/kmath/nd/DefaultStrides$Companion { - public final fun invoke ([I)Lkscience/kmath/nd/Strides; +public final class space/kscience/kmath/nd/DefaultStrides$Companion { + public final fun invoke ([I)Lspace/kscience/kmath/nd/Strides; } -public final class kscience/kmath/nd/MutableNDBuffer : kscience/kmath/nd/NDBuffer, kscience/kmath/nd/MutableNDStructure { - public fun (Lkscience/kmath/nd/Strides;Lkscience/kmath/structures/MutableBuffer;)V - public synthetic fun getBuffer ()Lkscience/kmath/structures/Buffer; - public fun getBuffer ()Lkscience/kmath/structures/MutableBuffer; +public final class space/kscience/kmath/nd/MutableNDBuffer : space/kscience/kmath/nd/NDBuffer, space/kscience/kmath/nd/MutableNDStructure { + public fun (Lspace/kscience/kmath/nd/Strides;Lspace/kscience/kmath/structures/MutableBuffer;)V + public synthetic fun getBuffer ()Lspace/kscience/kmath/structures/Buffer; + public fun getBuffer ()Lspace/kscience/kmath/structures/MutableBuffer; public fun set ([ILjava/lang/Object;)V } -public abstract interface class kscience/kmath/nd/MutableNDStructure : kscience/kmath/nd/NDStructure { +public abstract interface class space/kscience/kmath/nd/MutableNDStructure : space/kscience/kmath/nd/NDStructure { public abstract fun set ([ILjava/lang/Object;)V } -public final class kscience/kmath/nd/MutableNDStructure$DefaultImpls { - public static fun getDimension (Lkscience/kmath/nd/MutableNDStructure;)I - public static fun getFeature (Lkscience/kmath/nd/MutableNDStructure;Lkotlin/reflect/KClass;)Ljava/lang/Object; +public final class space/kscience/kmath/nd/MutableNDStructure$DefaultImpls { + public static fun getDimension (Lspace/kscience/kmath/nd/MutableNDStructure;)I } -public abstract interface class kscience/kmath/nd/NDAlgebra { - public static final field Companion Lkscience/kmath/nd/NDAlgebra$Companion; - public abstract fun combine (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDStructure; +public abstract interface class space/kscience/kmath/nd/NDAlgebra { + public static final field Companion Lspace/kscience/kmath/nd/NDAlgebra$Companion; + public abstract fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; public abstract fun getElementContext ()Ljava/lang/Object; public abstract fun getShape ()[I - public abstract fun invoke (Lkotlin/jvm/functions/Function1;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public abstract fun map (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDStructure; - public abstract fun mapIndexed (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDStructure; - public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDStructure; + public abstract fun invoke (Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; } -public final class kscience/kmath/nd/NDAlgebra$Companion { +public final class space/kscience/kmath/nd/NDAlgebra$Companion { } -public final class kscience/kmath/nd/NDAlgebra$DefaultImpls { - public static fun invoke (Lkscience/kmath/nd/NDAlgebra;Lkotlin/jvm/functions/Function1;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; +public final class space/kscience/kmath/nd/NDAlgebra$DefaultImpls { + public static fun invoke (Lspace/kscience/kmath/nd/NDAlgebra;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public class kscience/kmath/nd/NDBuffer : kscience/kmath/nd/NDStructure { - public fun (Lkscience/kmath/nd/Strides;Lkscience/kmath/structures/Buffer;)V +public class space/kscience/kmath/nd/NDBuffer : space/kscience/kmath/nd/NDStructure { + public fun (Lspace/kscience/kmath/nd/Strides;Lspace/kscience/kmath/structures/Buffer;)V public fun elements ()Lkotlin/sequences/Sequence; public fun equals (Ljava/lang/Object;)Z public fun get ([I)Ljava/lang/Object; - public fun getBuffer ()Lkscience/kmath/structures/Buffer; + public fun getBuffer ()Lspace/kscience/kmath/structures/Buffer; public fun getDimension ()I - public fun getFeature (Lkotlin/reflect/KClass;)Ljava/lang/Object; public fun getShape ()[I - public final fun getStrides ()Lkscience/kmath/nd/Strides; + public final fun getStrides ()Lspace/kscience/kmath/nd/Strides; public fun hashCode ()I public fun toString ()Ljava/lang/String; } -public abstract interface class kscience/kmath/nd/NDField : kscience/kmath/nd/NDRing, kscience/kmath/operations/Field { - public abstract fun div (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public abstract fun div (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public abstract fun divide (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; +public abstract interface class space/kscience/kmath/nd/NDField : space/kscience/kmath/nd/NDRing, space/kscience/kmath/operations/Field { + public abstract fun div (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun div (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun divide (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public final class kscience/kmath/nd/NDField$DefaultImpls { - public static fun add (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun binaryOperation (Lkscience/kmath/nd/NDField;Ljava/lang/String;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun binaryOperationFunction (Lkscience/kmath/nd/NDField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/nd/NDField;Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun div (Lkscience/kmath/nd/NDField;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun div (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun div (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun div (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun divide (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun invoke (Lkscience/kmath/nd/NDField;Lkotlin/jvm/functions/Function1;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDField;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun multiply (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun multiply (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDField;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun symbol (Lkscience/kmath/nd/NDField;Ljava/lang/String;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDField;Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDField;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun unaryMinus (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun unaryOperation (Lkscience/kmath/nd/NDField;Ljava/lang/String;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun unaryOperationFunction (Lkscience/kmath/nd/NDField;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/nd/NDField;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; +public final class space/kscience/kmath/nd/NDField$DefaultImpls { + public static fun add (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun binaryOperation (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun binaryOperationFunction (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;)Lspace/kscience/kmath/nd/NDStructure; + public static fun div (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun div (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun div (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun div (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun div (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun divide (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun invoke (Lspace/kscience/kmath/nd/NDField;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun multiply (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun multiply (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryMinus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryOperation (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryOperationFunction (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public abstract interface class kscience/kmath/nd/NDRing : kscience/kmath/nd/NDSpace, kscience/kmath/operations/Ring { - public static final field Companion Lkscience/kmath/nd/NDRing$Companion; - public abstract fun multiply (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public abstract fun times (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public abstract fun times (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; +public abstract interface class space/kscience/kmath/nd/NDRing : space/kscience/kmath/nd/NDSpace, space/kscience/kmath/operations/Ring { + public static final field Companion Lspace/kscience/kmath/nd/NDRing$Companion; + public abstract fun multiply (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun times (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; } -public final class kscience/kmath/nd/NDRing$Companion { +public final class space/kscience/kmath/nd/NDRing$Companion { } -public final class kscience/kmath/nd/NDRing$DefaultImpls { - public static fun add (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun binaryOperation (Lkscience/kmath/nd/NDRing;Ljava/lang/String;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun binaryOperationFunction (Lkscience/kmath/nd/NDRing;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun invoke (Lkscience/kmath/nd/NDRing;Lkotlin/jvm/functions/Function1;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDRing;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun multiply (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun multiply (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDRing;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun symbol (Lkscience/kmath/nd/NDRing;Ljava/lang/String;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDRing;Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDRing;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun unaryMinus (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun unaryOperation (Lkscience/kmath/nd/NDRing;Ljava/lang/String;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun unaryOperationFunction (Lkscience/kmath/nd/NDRing;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/nd/NDRing;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; +public final class space/kscience/kmath/nd/NDRing$DefaultImpls { + public static fun add (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun binaryOperation (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun binaryOperationFunction (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;)Lspace/kscience/kmath/nd/NDStructure; + public static fun div (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun invoke (Lspace/kscience/kmath/nd/NDRing;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun multiply (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun multiply (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryMinus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryOperation (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryOperationFunction (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public abstract interface class kscience/kmath/nd/NDSpace : kscience/kmath/nd/NDAlgebra, kscience/kmath/operations/Space { - public static final field Companion Lkscience/kmath/nd/NDSpace$Companion; - public abstract fun add (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public abstract fun minus (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public abstract fun minus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public abstract fun multiply (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public abstract fun plus (Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public abstract fun plus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; +public abstract interface class space/kscience/kmath/nd/NDSpace : space/kscience/kmath/nd/NDAlgebra, space/kscience/kmath/operations/Space { + public static final field Companion Lspace/kscience/kmath/nd/NDSpace$Companion; + public abstract fun add (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun minus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun multiply (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun plus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun plus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; } -public final class kscience/kmath/nd/NDSpace$Companion { +public final class space/kscience/kmath/nd/NDSpace$Companion { } -public final class kscience/kmath/nd/NDSpace$DefaultImpls { - public static fun add (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun binaryOperation (Lkscience/kmath/nd/NDSpace;Ljava/lang/String;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun binaryOperationFunction (Lkscience/kmath/nd/NDSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun invoke (Lkscience/kmath/nd/NDSpace;Lkotlin/jvm/functions/Function1;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDSpace;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun minus (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun multiply (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDSpace;Ljava/lang/Object;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lkscience/kmath/nd/NDStructure; - public static fun plus (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun symbol (Lkscience/kmath/nd/NDSpace;Ljava/lang/String;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDSpace;Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun times (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; - public static fun unaryMinus (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun unaryOperation (Lkscience/kmath/nd/NDSpace;Ljava/lang/String;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; - public static fun unaryOperationFunction (Lkscience/kmath/nd/NDSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/nd/NDSpace;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; +public final class space/kscience/kmath/nd/NDSpace$DefaultImpls { + public static fun add (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun binaryOperation (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun binaryOperationFunction (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;)Lspace/kscience/kmath/nd/NDStructure; + public static fun div (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun invoke (Lspace/kscience/kmath/nd/NDSpace;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun multiply (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun times (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryMinus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryOperation (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryOperationFunction (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public abstract interface class kscience/kmath/nd/NDStructure { - public static final field Companion Lkscience/kmath/nd/NDStructure$Companion; +public abstract interface class space/kscience/kmath/nd/NDStructure { + public static final field Companion Lspace/kscience/kmath/nd/NDStructure$Companion; public abstract fun elements ()Lkotlin/sequences/Sequence; public abstract fun equals (Ljava/lang/Object;)Z public abstract fun get ([I)Ljava/lang/Object; public abstract fun getDimension ()I - public abstract fun getFeature (Lkotlin/reflect/KClass;)Ljava/lang/Object; public abstract fun getShape ()[I public abstract fun hashCode ()I } -public final class kscience/kmath/nd/NDStructure$Companion { - public final fun auto (Lkotlin/reflect/KClass;Lkscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/nd/NDBuffer; - public final fun auto (Lkotlin/reflect/KClass;[ILkotlin/jvm/functions/Function1;)Lkscience/kmath/nd/NDBuffer; - public final fun build (Lkscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/nd/NDBuffer; - public final fun build ([ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lkscience/kmath/nd/NDBuffer; - public static synthetic fun build$default (Lkscience/kmath/nd/NDStructure$Companion;Lkscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lkscience/kmath/nd/NDBuffer; - public static synthetic fun build$default (Lkscience/kmath/nd/NDStructure$Companion;[ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lkscience/kmath/nd/NDBuffer; - public final fun contentEquals (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;)Z +public final class space/kscience/kmath/nd/NDStructure$Companion { + public final fun auto (Lkotlin/reflect/KClass;Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; + public final fun auto (Lkotlin/reflect/KClass;[ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; + public final fun build (Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; + public final fun build ([ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; + public static synthetic fun build$default (Lspace/kscience/kmath/nd/NDStructure$Companion;Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/kmath/nd/NDBuffer; + public static synthetic fun build$default (Lspace/kscience/kmath/nd/NDStructure$Companion;[ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/kmath/nd/NDBuffer; + public final fun contentEquals (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Z } -public final class kscience/kmath/nd/NDStructure$DefaultImpls { - public static fun getDimension (Lkscience/kmath/nd/NDStructure;)I - public static fun getFeature (Lkscience/kmath/nd/NDStructure;Lkotlin/reflect/KClass;)Ljava/lang/Object; +public final class space/kscience/kmath/nd/NDStructure$DefaultImpls { + public static fun getDimension (Lspace/kscience/kmath/nd/NDStructure;)I } -public final class kscience/kmath/nd/NDStructureKt { - public static final fun get (Lkscience/kmath/nd/NDStructure;[I)Ljava/lang/Object; - public static final fun mapInPlace (Lkscience/kmath/nd/MutableNDStructure;Lkotlin/jvm/functions/Function2;)V +public final class space/kscience/kmath/nd/NDStructureKt { + public static final fun get (Lspace/kscience/kmath/nd/NDStructure;[I)Ljava/lang/Object; + public static final fun mapInPlace (Lspace/kscience/kmath/nd/MutableNDStructure;Lkotlin/jvm/functions/Function2;)V } -public final class kscience/kmath/nd/RealNDField : kscience/kmath/nd/BufferedNDField, kscience/kmath/operations/ExtendedField, kscience/kmath/operations/RingWithNumbers { +public final class space/kscience/kmath/nd/RealNDField : space/kscience/kmath/nd/BufferedNDField, space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/RingWithNumbers { public fun ([I)V public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; - public fun acos (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun acos (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun acosh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun acosh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; - public fun asin (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun asin (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun asinh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun asinh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; - public fun atan (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun atan (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun atanh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; - public fun combine (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun combine (Lkscience/kmath/nd/NDStructure;Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDStructure; + public fun atanh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; + public fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; - public fun cos (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun cos (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun cosh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun cosh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; - public fun exp (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun getBuffer (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/structures/Buffer; - public fun getBuffer-JVEF3vg (Lkscience/kmath/nd/NDStructure;)[D + public fun exp (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun getBuffer (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/structures/Buffer; + public fun getBuffer-LGjt3BI (Lspace/kscience/kmath/nd/NDStructure;)[D public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lkscience/kmath/nd/NDBuffer; + public fun getOne ()Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lkscience/kmath/nd/NDBuffer; + public fun getZero ()Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; - public fun ln (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; - public fun map (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun map (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDStructure; - public fun mapIndexed (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun mapIndexed (Lkscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lkscience/kmath/nd/NDStructure; + public fun ln (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; + public fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; + public fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun minus (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun minus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number (Ljava/lang/Number;)Lkscience/kmath/nd/NDBuffer; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun plus (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun plus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun pow (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun pow (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun power (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDBuffer; - public fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; - public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDStructure; + public fun power (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDBuffer; + public fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; - public fun sin (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun sin (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun sinh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun sinh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun sqrt (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun sqrt (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; - public fun tan (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun tan (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun tanh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer; + public fun tanh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/nd/RealNDFieldKt { - public static final fun nd (Lkscience/kmath/operations/RealField;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun real (Lkscience/kmath/nd/NDAlgebra$Companion;[I)Lkscience/kmath/nd/RealNDField; +public final class space/kscience/kmath/nd/RealNDFieldKt { + public static final fun nd (Lspace/kscience/kmath/operations/RealField;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final fun real (Lspace/kscience/kmath/nd/NDAlgebra$Companion;[I)Lspace/kscience/kmath/nd/RealNDField; } -public final class kscience/kmath/nd/ShapeMismatchException : java/lang/RuntimeException { +public final class space/kscience/kmath/nd/ShapeMismatchException : java/lang/RuntimeException { public fun ([I[I)V public final fun getActual ()[I public final fun getExpected ()[I } -public final class kscience/kmath/nd/ShortNDRing : kscience/kmath/nd/BufferedNDRing, kscience/kmath/operations/RingWithNumbers { +public final class space/kscience/kmath/nd/ShortNDRing : space/kscience/kmath/nd/BufferedNDRing, space/kscience/kmath/operations/RingWithNumbers { public fun ([I)V public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lkscience/kmath/nd/NDBuffer; + public fun getOne ()Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lkscience/kmath/nd/NDBuffer; + public fun getZero ()Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun minus (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun minus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number (Ljava/lang/Number;)Lkscience/kmath/nd/NDBuffer; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure; + public fun plus (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun plus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; } -public final class kscience/kmath/nd/ShortNDRingKt { - public static final fun nd (Lkscience/kmath/operations/ShortRing;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun produceInline (Lkscience/kmath/nd/BufferedNDRing;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer; +public final class space/kscience/kmath/nd/ShortNDRingKt { + public static final fun nd (Lspace/kscience/kmath/operations/ShortRing;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final fun produceInline (Lspace/kscience/kmath/nd/BufferedNDRing;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; } -public abstract interface class kscience/kmath/nd/Strides { +public abstract interface class space/kscience/kmath/nd/Strides { public abstract fun getLinearSize ()I public abstract fun getShape ()[I public abstract fun getStrides ()Ljava/util/List; @@ -1360,222 +1348,223 @@ public abstract interface class kscience/kmath/nd/Strides { public abstract fun offset ([I)I } -public final class kscience/kmath/nd/Strides$DefaultImpls { - public static fun indices (Lkscience/kmath/nd/Strides;)Lkotlin/sequences/Sequence; +public final class space/kscience/kmath/nd/Strides$DefaultImpls { + public static fun indices (Lspace/kscience/kmath/nd/Strides;)Lkotlin/sequences/Sequence; } -public abstract interface class kscience/kmath/nd/Structure1D : kscience/kmath/nd/NDStructure, kscience/kmath/structures/Buffer { +public abstract interface class space/kscience/kmath/nd/Structure1D : space/kscience/kmath/nd/NDStructure, space/kscience/kmath/structures/Buffer { public abstract fun get ([I)Ljava/lang/Object; public abstract fun getDimension ()I public abstract fun iterator ()Ljava/util/Iterator; } -public final class kscience/kmath/nd/Structure1D$DefaultImpls { - public static fun contentEquals (Lkscience/kmath/nd/Structure1D;Lkscience/kmath/structures/Buffer;)Z - public static fun get (Lkscience/kmath/nd/Structure1D;[I)Ljava/lang/Object; - public static fun getDimension (Lkscience/kmath/nd/Structure1D;)I - public static fun getFeature (Lkscience/kmath/nd/Structure1D;Lkotlin/reflect/KClass;)Ljava/lang/Object; - public static fun iterator (Lkscience/kmath/nd/Structure1D;)Ljava/util/Iterator; +public final class space/kscience/kmath/nd/Structure1D$DefaultImpls { + public static fun contentEquals (Lspace/kscience/kmath/nd/Structure1D;Lspace/kscience/kmath/structures/Buffer;)Z + public static fun get (Lspace/kscience/kmath/nd/Structure1D;[I)Ljava/lang/Object; + public static fun getDimension (Lspace/kscience/kmath/nd/Structure1D;)I + public static fun iterator (Lspace/kscience/kmath/nd/Structure1D;)Ljava/util/Iterator; } -public final class kscience/kmath/nd/Structure1DKt { - public static final fun as1D (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/Structure1D; - public static final fun asND (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/nd/Structure1D; +public final class space/kscience/kmath/nd/Structure1DKt { + public static final fun as1D (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/Structure1D; + public static final fun asND (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/nd/Structure1D; } -public abstract interface class kscience/kmath/nd/Structure2D : kscience/kmath/nd/NDStructure { - public static final field Companion Lkscience/kmath/nd/Structure2D$Companion; +public abstract interface class space/kscience/kmath/nd/Structure2D : space/kscience/kmath/nd/NDStructure { + public static final field Companion Lspace/kscience/kmath/nd/Structure2D$Companion; public abstract fun elements ()Lkotlin/sequences/Sequence; public abstract fun get (II)Ljava/lang/Object; public abstract fun get ([I)Ljava/lang/Object; public abstract fun getColNum ()I - public abstract fun getColumns ()Lkscience/kmath/structures/Buffer; + public abstract fun getColumns ()Lspace/kscience/kmath/structures/Buffer; public abstract fun getRowNum ()I - public abstract fun getRows ()Lkscience/kmath/structures/Buffer; + public abstract fun getRows ()Lspace/kscience/kmath/structures/Buffer; public abstract fun getShape ()[I } -public final class kscience/kmath/nd/Structure2D$Companion { - public final fun real (IILkotlin/jvm/functions/Function2;)Lkscience/kmath/linear/BufferMatrix; +public final class space/kscience/kmath/nd/Structure2D$Companion { + public final fun real (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferMatrix; } -public final class kscience/kmath/nd/Structure2D$DefaultImpls { - public static fun elements (Lkscience/kmath/nd/Structure2D;)Lkotlin/sequences/Sequence; - public static fun get (Lkscience/kmath/nd/Structure2D;[I)Ljava/lang/Object; - public static fun getColumns (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/structures/Buffer; - public static fun getDimension (Lkscience/kmath/nd/Structure2D;)I - public static fun getFeature (Lkscience/kmath/nd/Structure2D;Lkotlin/reflect/KClass;)Ljava/lang/Object; - public static fun getRows (Lkscience/kmath/nd/Structure2D;)Lkscience/kmath/structures/Buffer; - public static fun getShape (Lkscience/kmath/nd/Structure2D;)[I +public final class space/kscience/kmath/nd/Structure2D$DefaultImpls { + public static fun elements (Lspace/kscience/kmath/nd/Structure2D;)Lkotlin/sequences/Sequence; + public static fun get (Lspace/kscience/kmath/nd/Structure2D;[I)Ljava/lang/Object; + public static fun getColumns (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/structures/Buffer; + public static fun getDimension (Lspace/kscience/kmath/nd/Structure2D;)I + public static fun getRows (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/structures/Buffer; + public static fun getShape (Lspace/kscience/kmath/nd/Structure2D;)[I } -public final class kscience/kmath/nd/Structure2DKt { - public static final fun as2D (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/Structure2D; +public final class space/kscience/kmath/nd/Structure2DKt { + public static final fun as2D (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/Structure2D; } -public abstract interface class kscience/kmath/operations/Algebra { +public abstract interface class space/kscience/kmath/operations/Algebra { public abstract fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public abstract fun symbol (Ljava/lang/String;)Ljava/lang/Object; + public abstract fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public abstract fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/operations/Algebra$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/Algebra;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/Algebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun symbol (Lkscience/kmath/operations/Algebra;Ljava/lang/String;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/Algebra;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/Algebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; +public final class space/kscience/kmath/operations/Algebra$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/Algebra;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/Algebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/Algebra;Ljava/lang/String;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/Algebra;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/Algebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public abstract interface class kscience/kmath/operations/AlgebraElement { - public abstract fun getContext ()Lkscience/kmath/operations/Algebra; +public abstract interface class space/kscience/kmath/operations/AlgebraElement { + public abstract fun getContext ()Lspace/kscience/kmath/operations/Algebra; } -public final class kscience/kmath/operations/AlgebraElementsKt { - public static final fun div (Lkscience/kmath/operations/AlgebraElement;Ljava/lang/Number;)Lkscience/kmath/operations/AlgebraElement; - public static final fun div (Lkscience/kmath/operations/AlgebraElement;Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun minus (Lkscience/kmath/operations/AlgebraElement;Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun plus (Lkscience/kmath/operations/AlgebraElement;Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun times (Ljava/lang/Number;Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun times (Lkscience/kmath/operations/AlgebraElement;Ljava/lang/Number;)Lkscience/kmath/operations/AlgebraElement; - public static final fun times (Lkscience/kmath/operations/AlgebraElement;Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; +public final class space/kscience/kmath/operations/AlgebraElementsKt { + public static final fun div (Lspace/kscience/kmath/operations/AlgebraElement;Ljava/lang/Number;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun div (Lspace/kscience/kmath/operations/AlgebraElement;Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun minus (Lspace/kscience/kmath/operations/AlgebraElement;Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun plus (Lspace/kscience/kmath/operations/AlgebraElement;Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun times (Ljava/lang/Number;Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun times (Lspace/kscience/kmath/operations/AlgebraElement;Ljava/lang/Number;)Lspace/kscience/kmath/operations/AlgebraElement; + public static final fun times (Lspace/kscience/kmath/operations/AlgebraElement;Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; } -public final class kscience/kmath/operations/AlgebraExtensionsKt { - public static final fun abs (Lkscience/kmath/operations/Space;Ljava/lang/Comparable;)Ljava/lang/Comparable; - public static final fun average (Lkscience/kmath/operations/Space;Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun average (Lkscience/kmath/operations/Space;Lkotlin/sequences/Sequence;)Ljava/lang/Object; - public static final fun averageWith (Ljava/lang/Iterable;Lkscience/kmath/operations/Space;)Ljava/lang/Object; - public static final fun averageWith (Lkotlin/sequences/Sequence;Lkscience/kmath/operations/Space;)Ljava/lang/Object; - public static final fun power (Lkscience/kmath/operations/Field;Ljava/lang/Object;I)Ljava/lang/Object; - public static final fun power (Lkscience/kmath/operations/Ring;Ljava/lang/Object;I)Ljava/lang/Object; - public static final fun sum (Lkscience/kmath/operations/Space;Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun sum (Lkscience/kmath/operations/Space;Lkotlin/sequences/Sequence;)Ljava/lang/Object; - public static final fun sumWith (Ljava/lang/Iterable;Lkscience/kmath/operations/Space;)Ljava/lang/Object; - public static final fun sumWith (Lkotlin/sequences/Sequence;Lkscience/kmath/operations/Space;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/AlgebraExtensionsKt { + public static final fun abs (Lspace/kscience/kmath/operations/Space;Ljava/lang/Comparable;)Ljava/lang/Comparable; + public static final fun average (Lspace/kscience/kmath/operations/Space;Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun average (Lspace/kscience/kmath/operations/Space;Lkotlin/sequences/Sequence;)Ljava/lang/Object; + public static final fun averageWith (Ljava/lang/Iterable;Lspace/kscience/kmath/operations/Space;)Ljava/lang/Object; + public static final fun averageWith (Lkotlin/sequences/Sequence;Lspace/kscience/kmath/operations/Space;)Ljava/lang/Object; + public static final fun power (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;I)Ljava/lang/Object; + public static final fun power (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;I)Ljava/lang/Object; + public static final fun sum (Lspace/kscience/kmath/operations/Space;Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun sum (Lspace/kscience/kmath/operations/Space;Lkotlin/sequences/Sequence;)Ljava/lang/Object; + public static final fun sumWith (Ljava/lang/Iterable;Lspace/kscience/kmath/operations/Space;)Ljava/lang/Object; + public static final fun sumWith (Lkotlin/sequences/Sequence;Lspace/kscience/kmath/operations/Space;)Ljava/lang/Object; } -public final class kscience/kmath/operations/AlgebraKt { - public static final fun invoke (Lkscience/kmath/operations/Algebra;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/AlgebraKt { + public static final fun bindSymbol (Lspace/kscience/kmath/operations/Algebra;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static final fun invoke (Lspace/kscience/kmath/operations/Algebra;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; } -public final class kscience/kmath/operations/BigInt : java/lang/Comparable { +public final class space/kscience/kmath/operations/BigInt : java/lang/Comparable { public static final field BASE J public static final field BASE_SIZE I - public static final field Companion Lkscience/kmath/operations/BigInt$Companion; - public final fun abs ()Lkscience/kmath/operations/BigInt; - public final fun and (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public static final field Companion Lspace/kscience/kmath/operations/BigInt$Companion; + public final fun abs ()Lspace/kscience/kmath/operations/BigInt; + public final fun and (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun compareTo (Ljava/lang/Object;)I - public fun compareTo (Lkscience/kmath/operations/BigInt;)I - public final fun div (I)Lkscience/kmath/operations/BigInt; - public final fun div (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; - public final fun div-WZ4Q5Ns (I)Lkscience/kmath/operations/BigInt; + public fun compareTo (Lspace/kscience/kmath/operations/BigInt;)I + public final fun div (I)Lspace/kscience/kmath/operations/BigInt; + public final fun div (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; + public final fun div-WZ4Q5Ns (I)Lspace/kscience/kmath/operations/BigInt; public fun equals (Ljava/lang/Object;)Z public fun hashCode ()I - public final fun minus (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; - public final fun modPow (Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; - public final fun or (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; - public final fun plus (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public final fun minus (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; + public final fun modPow (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; + public final fun or (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; + public final fun plus (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public final fun rem (I)I - public final fun rem (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; - public final fun shl (I)Lkscience/kmath/operations/BigInt; - public final fun shr (I)Lkscience/kmath/operations/BigInt; - public final fun times (I)Lkscience/kmath/operations/BigInt; - public final fun times (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; - public final fun times-WZ4Q5Ns (I)Lkscience/kmath/operations/BigInt; + public final fun rem (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; + public final fun shl (I)Lspace/kscience/kmath/operations/BigInt; + public final fun shr (I)Lspace/kscience/kmath/operations/BigInt; + public final fun times (I)Lspace/kscience/kmath/operations/BigInt; + public final fun times (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; + public final fun times-WZ4Q5Ns (I)Lspace/kscience/kmath/operations/BigInt; public fun toString ()Ljava/lang/String; - public final fun unaryMinus ()Lkscience/kmath/operations/BigInt; + public final fun unaryMinus ()Lspace/kscience/kmath/operations/BigInt; } -public final class kscience/kmath/operations/BigInt$Companion { - public final fun getONE ()Lkscience/kmath/operations/BigInt; - public final fun getZERO ()Lkscience/kmath/operations/BigInt; +public final class space/kscience/kmath/operations/BigInt$Companion { + public final fun getONE ()Lspace/kscience/kmath/operations/BigInt; + public final fun getZERO ()Lspace/kscience/kmath/operations/BigInt; } -public final class kscience/kmath/operations/BigIntField : kscience/kmath/operations/Field, kscience/kmath/operations/RingWithNumbers { - public static final field INSTANCE Lkscience/kmath/operations/BigIntField; +public final class space/kscience/kmath/operations/BigIntField : space/kscience/kmath/operations/Field, space/kscience/kmath/operations/RingWithNumbers { + public static final field INSTANCE Lspace/kscience/kmath/operations/BigIntField; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun add (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Number;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun div (Ljava/lang/Number;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Lkscience/kmath/operations/BigInt;Ljava/lang/Number;)Lkscience/kmath/operations/BigInt; - public fun div (Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun div (Lspace/kscience/kmath/operations/BigInt;Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; + public fun div (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide (Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun divide (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lkscience/kmath/operations/BigInt; + public fun getOne ()Lspace/kscience/kmath/operations/BigInt; public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lkscience/kmath/operations/BigInt; + public fun getZero ()Lspace/kscience/kmath/operations/BigInt; public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Ljava/lang/Number;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun minus (Ljava/lang/Number;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Lkscience/kmath/operations/BigInt;Ljava/lang/Number;)Lkscience/kmath/operations/BigInt; - public fun minus (Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun minus (Lspace/kscience/kmath/operations/BigInt;Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; + public fun minus (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply (Lkscience/kmath/operations/BigInt;Ljava/lang/Number;)Lkscience/kmath/operations/BigInt; - public fun multiply (Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun multiply (Lspace/kscience/kmath/operations/BigInt;Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; + public fun multiply (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number (Ljava/lang/Number;)Lkscience/kmath/operations/BigInt; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Ljava/lang/Number;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun plus (Ljava/lang/Number;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/operations/BigInt;Ljava/lang/Number;)Lkscience/kmath/operations/BigInt; - public fun plus (Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun plus (Lspace/kscience/kmath/operations/BigInt;Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; + public fun plus (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lkscience/kmath/operations/BigInt;Ljava/lang/Number;)Lkscience/kmath/operations/BigInt; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/operations/BigInt;Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/operations/BigInt; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Lkscience/kmath/operations/BigInt;Ljava/lang/Number;)Lkscience/kmath/operations/BigInt; - public fun times (Lkscience/kmath/operations/BigInt;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun times (Lspace/kscience/kmath/operations/BigInt;Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; + public fun times (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public final fun unaryMinus (Ljava/lang/String;)Lkscience/kmath/operations/BigInt; - public fun unaryMinus (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public final fun unaryMinus (Ljava/lang/String;)Lspace/kscience/kmath/operations/BigInt; + public fun unaryMinus (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public final fun unaryPlus (Ljava/lang/String;)Lkscience/kmath/operations/BigInt; - public fun unaryPlus (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; + public final fun unaryPlus (Ljava/lang/String;)Lspace/kscience/kmath/operations/BigInt; + public fun unaryPlus (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; } -public final class kscience/kmath/operations/BigIntKt { - public static final fun abs (Lkscience/kmath/operations/BigInt;)Lkscience/kmath/operations/BigInt; - public static final fun bigInt (Lkscience/kmath/nd/NDAlgebra$Companion;[I)Lkscience/kmath/nd/BufferedNDRing; - public static final fun bigInt (Lkscience/kmath/structures/Buffer$Companion;ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/Buffer; - public static final fun bigInt (Lkscience/kmath/structures/MutableBuffer$Companion;ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/MutableBuffer; - public static final fun parseBigInteger (Ljava/lang/String;)Lkscience/kmath/operations/BigInt; - public static final fun toBigInt (I)Lkscience/kmath/operations/BigInt; - public static final fun toBigInt (J)Lkscience/kmath/operations/BigInt; - public static final fun toBigInt-LpG4sQ0 ([IB)Lkscience/kmath/operations/BigInt; - public static final fun toBigInt-VKZWuLQ (J)Lkscience/kmath/operations/BigInt; - public static final fun toBigInt-WZ4Q5Ns (I)Lkscience/kmath/operations/BigInt; +public final class space/kscience/kmath/operations/BigIntKt { + public static final fun abs (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; + public static final fun bigInt (Lspace/kscience/kmath/nd/NDAlgebra$Companion;[I)Lspace/kscience/kmath/nd/BufferedNDRing; + public static final fun bigInt (Lspace/kscience/kmath/structures/Buffer$Companion;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public static final fun bigInt (Lspace/kscience/kmath/structures/MutableBuffer$Companion;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/MutableBuffer; + public static final fun parseBigInteger (Ljava/lang/String;)Lspace/kscience/kmath/operations/BigInt; + public static final fun toBigInt (I)Lspace/kscience/kmath/operations/BigInt; + public static final fun toBigInt (J)Lspace/kscience/kmath/operations/BigInt; + public static final fun toBigInt-LpG4sQ0 ([IB)Lspace/kscience/kmath/operations/BigInt; + public static final fun toBigInt-VKZWuLQ (J)Lspace/kscience/kmath/operations/BigInt; + public static final fun toBigInt-WZ4Q5Ns (I)Lspace/kscience/kmath/operations/BigInt; } -public final class kscience/kmath/operations/ByteRing : kscience/kmath/operations/Norm, kscience/kmath/operations/NumericAlgebra, kscience/kmath/operations/Ring { - public static final field INSTANCE Lkscience/kmath/operations/ByteRing; +public final class space/kscience/kmath/operations/ByteRing : space/kscience/kmath/operations/Norm, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/Ring { + public static final field INSTANCE Lspace/kscience/kmath/operations/ByteRing; public fun add (BB)Ljava/lang/Byte; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperation (Ljava/lang/String;BB)Ljava/lang/Byte; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public fun bindSymbol (Ljava/lang/String;)Ljava/lang/Byte; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun div (BLjava/lang/Number;)Ljava/lang/Byte; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun getOne ()Ljava/lang/Byte; @@ -1600,8 +1589,6 @@ public final class kscience/kmath/operations/ByteRing : kscience/kmath/operation public fun rightSideNumberOperation (Ljava/lang/String;BLjava/lang/Number;)Ljava/lang/Byte; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public fun symbol (Ljava/lang/String;)Ljava/lang/Byte; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; public fun times (BB)Ljava/lang/Byte; public fun times (BLjava/lang/Number;)Ljava/lang/Byte; public fun times (Ljava/lang/Number;B)Ljava/lang/Byte; @@ -1617,28 +1604,28 @@ public final class kscience/kmath/operations/ByteRing : kscience/kmath/operation public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/ExponentialOperations : kscience/kmath/operations/Algebra { - public static final field Companion Lkscience/kmath/operations/ExponentialOperations$Companion; +public abstract interface class space/kscience/kmath/operations/ExponentialOperations : space/kscience/kmath/operations/Algebra { + public static final field Companion Lspace/kscience/kmath/operations/ExponentialOperations$Companion; public static final field EXP_OPERATION Ljava/lang/String; public static final field LN_OPERATION Ljava/lang/String; public abstract fun exp (Ljava/lang/Object;)Ljava/lang/Object; public abstract fun ln (Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/ExponentialOperations$Companion { +public final class space/kscience/kmath/operations/ExponentialOperations$Companion { public static final field EXP_OPERATION Ljava/lang/String; public static final field LN_OPERATION Ljava/lang/String; } -public final class kscience/kmath/operations/ExponentialOperations$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/ExponentialOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/ExponentialOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun symbol (Lkscience/kmath/operations/ExponentialOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/ExponentialOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/ExponentialOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; +public final class space/kscience/kmath/operations/ExponentialOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/ExponentialOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/ExponentialOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/ExponentialOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/ExponentialOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/ExponentialOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public abstract interface class kscience/kmath/operations/ExtendedField : kscience/kmath/operations/ExtendedFieldOperations, kscience/kmath/operations/Field, kscience/kmath/operations/NumericAlgebra { +public abstract interface class space/kscience/kmath/operations/ExtendedField : space/kscience/kmath/operations/ExtendedFieldOperations, space/kscience/kmath/operations/Field, space/kscience/kmath/operations/NumericAlgebra { public abstract fun acosh (Ljava/lang/Object;)Ljava/lang/Object; public abstract fun asinh (Ljava/lang/Object;)Ljava/lang/Object; public abstract fun atanh (Ljava/lang/Object;)Ljava/lang/Object; @@ -1648,120 +1635,117 @@ public abstract interface class kscience/kmath/operations/ExtendedField : kscien public abstract fun tanh (Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/ExtendedField$DefaultImpls { - public static fun acosh (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun asinh (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun atanh (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperation (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun cosh (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun div (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun div (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun div (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun leftSideNumberOperation (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun leftSideNumberOperationFunction (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun minus (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun pow (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun rightSideNumberOperation (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun rightSideNumberOperationFunction (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun sinh (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun sqrt (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;)Ljava/lang/Object; - public static fun tan (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun tanh (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/ExtendedField$DefaultImpls { + public static fun acosh (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun asinh (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun atanh (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperation (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;)Ljava/lang/Object; + public static fun cosh (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun leftSideNumberOperation (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun leftSideNumberOperationFunction (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun minus (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun pow (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun rightSideNumberOperation (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun rightSideNumberOperationFunction (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun sinh (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun sqrt (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun tan (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun tanh (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/ExtendedFieldOperations : kscience/kmath/operations/ExponentialOperations, kscience/kmath/operations/FieldOperations, kscience/kmath/operations/HyperbolicOperations, kscience/kmath/operations/PowerOperations, kscience/kmath/operations/TrigonometricOperations { +public abstract interface class space/kscience/kmath/operations/ExtendedFieldOperations : space/kscience/kmath/operations/ExponentialOperations, space/kscience/kmath/operations/FieldOperations, space/kscience/kmath/operations/HyperbolicOperations, space/kscience/kmath/operations/PowerOperations, space/kscience/kmath/operations/TrigonometricOperations { public abstract fun tan (Ljava/lang/Object;)Ljava/lang/Object; public abstract fun tanh (Ljava/lang/Object;)Ljava/lang/Object; public abstract fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/operations/ExtendedFieldOperations$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun div (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun pow (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun sqrt (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun tan (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun tanh (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/ExtendedFieldOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun pow (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun sqrt (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; + public static fun tan (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; + public static fun tanh (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/Field : kscience/kmath/operations/FieldOperations, kscience/kmath/operations/Ring { +public abstract interface class space/kscience/kmath/operations/Field : space/kscience/kmath/operations/FieldOperations, space/kscience/kmath/operations/Ring { public abstract fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/Field$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/Field;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/Field;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/operations/Field;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun div (Lkscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun div (Lkscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/Field;Ljava/lang/String;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/Field;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/Field;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/Field;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/Field;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/Field;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/Field$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/Field;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/Field;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/Field;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/Field;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/Field;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/Field;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/Field;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/FieldElement : kscience/kmath/operations/RingElement { -} - -public abstract interface class kscience/kmath/operations/FieldOperations : kscience/kmath/operations/RingOperations { - public static final field Companion Lkscience/kmath/operations/FieldOperations$Companion; +public abstract interface class space/kscience/kmath/operations/FieldOperations : space/kscience/kmath/operations/RingOperations { + public static final field Companion Lspace/kscience/kmath/operations/FieldOperations$Companion; public static final field DIV_OPERATION Ljava/lang/String; public abstract fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public abstract fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/FieldOperations$Companion { +public final class space/kscience/kmath/operations/FieldOperations$Companion { public static final field DIV_OPERATION Ljava/lang/String; } -public final class kscience/kmath/operations/FieldOperations$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/FieldOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/FieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun div (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/FieldOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/FieldOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/FieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/FieldOperations;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/FieldOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/FloatField : kscience/kmath/operations/ExtendedField, kscience/kmath/operations/Norm { - public static final field INSTANCE Lkscience/kmath/operations/FloatField; +public final class space/kscience/kmath/operations/FloatField : space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/Norm { + public static final field INSTANCE Lspace/kscience/kmath/operations/FloatField; public fun acos (F)Ljava/lang/Float; public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; public fun acosh (F)Ljava/lang/Float; @@ -1779,6 +1763,8 @@ public final class kscience/kmath/operations/FloatField : kscience/kmath/operati public fun binaryOperation (Ljava/lang/String;FF)Ljava/lang/Float; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public fun bindSymbol (Ljava/lang/String;)Ljava/lang/Float; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun cos (F)Ljava/lang/Float; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; public fun cosh (F)Ljava/lang/Float; @@ -1827,8 +1813,6 @@ public final class kscience/kmath/operations/FloatField : kscience/kmath/operati public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; public fun sqrt (F)Ljava/lang/Float; public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Ljava/lang/Float; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; public fun tan (F)Ljava/lang/Float; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; public fun tanh (F)Ljava/lang/Float; @@ -1848,12 +1832,12 @@ public final class kscience/kmath/operations/FloatField : kscience/kmath/operati public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/HyperbolicOperations : kscience/kmath/operations/Algebra { +public abstract interface class space/kscience/kmath/operations/HyperbolicOperations : space/kscience/kmath/operations/Algebra { public static final field ACOSH_OPERATION Ljava/lang/String; public static final field ASINH_OPERATION Ljava/lang/String; public static final field ATANH_OPERATION Ljava/lang/String; public static final field COSH_OPERATION Ljava/lang/String; - public static final field Companion Lkscience/kmath/operations/HyperbolicOperations$Companion; + public static final field Companion Lspace/kscience/kmath/operations/HyperbolicOperations$Companion; public static final field SINH_OPERATION Ljava/lang/String; public static final field TANH_OPERATION Ljava/lang/String; public abstract fun acosh (Ljava/lang/Object;)Ljava/lang/Object; @@ -1864,7 +1848,7 @@ public abstract interface class kscience/kmath/operations/HyperbolicOperations : public abstract fun tanh (Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/HyperbolicOperations$Companion { +public final class space/kscience/kmath/operations/HyperbolicOperations$Companion { public static final field ACOSH_OPERATION Ljava/lang/String; public static final field ASINH_OPERATION Ljava/lang/String; public static final field ATANH_OPERATION Ljava/lang/String; @@ -1873,21 +1857,23 @@ public final class kscience/kmath/operations/HyperbolicOperations$Companion { public static final field TANH_OPERATION Ljava/lang/String; } -public final class kscience/kmath/operations/HyperbolicOperations$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun symbol (Lkscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; +public final class space/kscience/kmath/operations/HyperbolicOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/operations/IntRing : kscience/kmath/operations/Norm, kscience/kmath/operations/NumericAlgebra, kscience/kmath/operations/Ring { - public static final field INSTANCE Lkscience/kmath/operations/IntRing; +public final class space/kscience/kmath/operations/IntRing : space/kscience/kmath/operations/Norm, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/Ring { + public static final field INSTANCE Lspace/kscience/kmath/operations/IntRing; public fun add (II)Ljava/lang/Integer; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperation (Ljava/lang/String;II)Ljava/lang/Integer; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public fun bindSymbol (Ljava/lang/String;)Ljava/lang/Integer; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun div (ILjava/lang/Number;)Ljava/lang/Integer; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun getOne ()Ljava/lang/Integer; @@ -1912,8 +1898,6 @@ public final class kscience/kmath/operations/IntRing : kscience/kmath/operations public fun rightSideNumberOperation (Ljava/lang/String;ILjava/lang/Number;)Ljava/lang/Integer; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public fun symbol (Ljava/lang/String;)Ljava/lang/Integer; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; public fun times (II)Ljava/lang/Integer; public fun times (ILjava/lang/Number;)Ljava/lang/Integer; public fun times (Ljava/lang/Number;I)Ljava/lang/Integer; @@ -1929,23 +1913,25 @@ public final class kscience/kmath/operations/IntRing : kscience/kmath/operations public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/JBigDecimalField : kscience/kmath/operations/JBigDecimalFieldBase { - public static final field Companion Lkscience/kmath/operations/JBigDecimalField$Companion; +public final class space/kscience/kmath/operations/JBigDecimalField : space/kscience/kmath/operations/JBigDecimalFieldBase { + public static final field Companion Lspace/kscience/kmath/operations/JBigDecimalField$Companion; public fun ()V public fun (Ljava/math/MathContext;)V public synthetic fun (Ljava/math/MathContext;ILkotlin/jvm/internal/DefaultConstructorMarker;)V } -public final class kscience/kmath/operations/JBigDecimalField$Companion : kscience/kmath/operations/JBigDecimalFieldBase { +public final class space/kscience/kmath/operations/JBigDecimalField$Companion : space/kscience/kmath/operations/JBigDecimalFieldBase { } -public abstract class kscience/kmath/operations/JBigDecimalFieldBase : kscience/kmath/operations/Field, kscience/kmath/operations/NumericAlgebra, kscience/kmath/operations/PowerOperations { +public abstract class space/kscience/kmath/operations/JBigDecimalFieldBase : space/kscience/kmath/operations/Field, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/PowerOperations { public fun ()V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun add (Ljava/math/BigDecimal;Ljava/math/BigDecimal;)Ljava/math/BigDecimal; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperation (Ljava/lang/String;Ljava/math/BigDecimal;Ljava/math/BigDecimal;)Ljava/math/BigDecimal; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Ljava/math/BigDecimal; public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public fun div (Ljava/lang/Number;Ljava/math/BigDecimal;)Ljava/math/BigDecimal; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; @@ -1980,8 +1966,6 @@ public abstract class kscience/kmath/operations/JBigDecimalFieldBase : kscience/ public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; public fun sqrt (Ljava/math/BigDecimal;)Ljava/math/BigDecimal; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Ljava/math/BigDecimal; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public fun times (Ljava/lang/Number;Ljava/math/BigDecimal;)Ljava/math/BigDecimal; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; @@ -1997,13 +1981,15 @@ public abstract class kscience/kmath/operations/JBigDecimalFieldBase : kscience/ public fun unaryPlus (Ljava/math/BigDecimal;)Ljava/math/BigDecimal; } -public final class kscience/kmath/operations/JBigIntegerField : kscience/kmath/operations/Field, kscience/kmath/operations/NumericAlgebra { - public static final field INSTANCE Lkscience/kmath/operations/JBigIntegerField; +public final class space/kscience/kmath/operations/JBigIntegerField : space/kscience/kmath/operations/Field, space/kscience/kmath/operations/NumericAlgebra { + public static final field INSTANCE Lspace/kscience/kmath/operations/JBigIntegerField; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun add (Ljava/math/BigInteger;Ljava/math/BigInteger;)Ljava/math/BigInteger; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperation (Ljava/lang/String;Ljava/math/BigInteger;Ljava/math/BigInteger;)Ljava/math/BigInteger; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Ljava/math/BigInteger; public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public fun div (Ljava/lang/Number;Ljava/math/BigInteger;)Ljava/math/BigInteger; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; @@ -2032,8 +2018,6 @@ public final class kscience/kmath/operations/JBigIntegerField : kscience/kmath/o public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperation (Ljava/lang/String;Ljava/math/BigInteger;Ljava/lang/Number;)Ljava/math/BigInteger; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Ljava/math/BigInteger; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public fun times (Ljava/lang/Number;Ljava/math/BigInteger;)Ljava/math/BigInteger; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; @@ -2049,16 +2033,18 @@ public final class kscience/kmath/operations/JBigIntegerField : kscience/kmath/o public fun unaryPlus (Ljava/math/BigInteger;)Ljava/math/BigInteger; } -public abstract interface annotation class kscience/kmath/operations/KMathContext : java/lang/annotation/Annotation { +public abstract interface annotation class space/kscience/kmath/operations/KMathContext : java/lang/annotation/Annotation { } -public final class kscience/kmath/operations/LongRing : kscience/kmath/operations/Norm, kscience/kmath/operations/NumericAlgebra, kscience/kmath/operations/Ring { - public static final field INSTANCE Lkscience/kmath/operations/LongRing; +public final class space/kscience/kmath/operations/LongRing : space/kscience/kmath/operations/Norm, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/Ring { + public static final field INSTANCE Lspace/kscience/kmath/operations/LongRing; public fun add (JJ)Ljava/lang/Long; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperation (Ljava/lang/String;JJ)Ljava/lang/Long; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public fun bindSymbol (Ljava/lang/String;)Ljava/lang/Long; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun div (JLjava/lang/Number;)Ljava/lang/Long; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun getOne ()Ljava/lang/Long; @@ -2083,8 +2069,6 @@ public final class kscience/kmath/operations/LongRing : kscience/kmath/operation public fun rightSideNumberOperation (Ljava/lang/String;JLjava/lang/Number;)Ljava/lang/Long; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public fun symbol (Ljava/lang/String;)Ljava/lang/Long; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; public fun times (JJ)Ljava/lang/Long; public fun times (JLjava/lang/Number;)Ljava/lang/Long; public fun times (Ljava/lang/Number;J)Ljava/lang/Long; @@ -2100,11 +2084,11 @@ public final class kscience/kmath/operations/LongRing : kscience/kmath/operation public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/Norm { +public abstract interface class space/kscience/kmath/operations/Norm { public abstract fun norm (Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/NumericAlgebra : kscience/kmath/operations/Algebra { +public abstract interface class space/kscience/kmath/operations/NumericAlgebra : space/kscience/kmath/operations/Algebra { public abstract fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public abstract fun number (Ljava/lang/Number;)Ljava/lang/Object; @@ -2112,41 +2096,23 @@ public abstract interface class kscience/kmath/operations/NumericAlgebra : kscie public abstract fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; } -public final class kscience/kmath/operations/NumericAlgebra$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun leftSideNumberOperation (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun leftSideNumberOperationFunction (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun rightSideNumberOperation (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun rightSideNumberOperationFunction (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun symbol (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; +public final class space/kscience/kmath/operations/NumericAlgebra$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Ljava/lang/Object; + public static fun leftSideNumberOperation (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun leftSideNumberOperationFunction (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun rightSideNumberOperation (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun rightSideNumberOperationFunction (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun unaryOperation (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/NumericAlgebra;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/operations/OptionalOperationsKt { - public static final fun acos (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun acosh (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun asin (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun asinh (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun atan (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun atanh (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun cos (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun cosh (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun exp (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun ln (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun norm (Lkscience/kmath/operations/AlgebraElement;)Ljava/lang/Object; - public static final fun pow (Lkscience/kmath/operations/AlgebraElement;D)Lkscience/kmath/operations/AlgebraElement; - public static final fun sin (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun sinh (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun sqr (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun sqrt (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun tan (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; - public static final fun tanh (Lkscience/kmath/operations/AlgebraElement;)Lkscience/kmath/operations/AlgebraElement; +public final class space/kscience/kmath/operations/OptionalOperationsKt { } -public abstract interface class kscience/kmath/operations/PowerOperations : kscience/kmath/operations/Algebra { - public static final field Companion Lkscience/kmath/operations/PowerOperations$Companion; +public abstract interface class space/kscience/kmath/operations/PowerOperations : space/kscience/kmath/operations/Algebra { + public static final field Companion Lspace/kscience/kmath/operations/PowerOperations$Companion; public static final field POW_OPERATION Ljava/lang/String; public static final field SQRT_OPERATION Ljava/lang/String; public abstract fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; @@ -2154,23 +2120,23 @@ public abstract interface class kscience/kmath/operations/PowerOperations : ksci public abstract fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/PowerOperations$Companion { +public final class space/kscience/kmath/operations/PowerOperations$Companion { public static final field POW_OPERATION Ljava/lang/String; public static final field SQRT_OPERATION Ljava/lang/String; } -public final class kscience/kmath/operations/PowerOperations$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/PowerOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/PowerOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun pow (Lkscience/kmath/operations/PowerOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun sqrt (Lkscience/kmath/operations/PowerOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/PowerOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/PowerOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/PowerOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; +public final class space/kscience/kmath/operations/PowerOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/PowerOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/PowerOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/PowerOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun pow (Lspace/kscience/kmath/operations/PowerOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun sqrt (Lspace/kscience/kmath/operations/PowerOperations;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/PowerOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/PowerOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/operations/RealField : kscience/kmath/operations/ExtendedField, kscience/kmath/operations/Norm { - public static final field INSTANCE Lkscience/kmath/operations/RealField; +public final class space/kscience/kmath/operations/RealField : space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/Norm { + public static final field INSTANCE Lspace/kscience/kmath/operations/RealField; public fun acos (D)Ljava/lang/Double; public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; public fun acosh (D)Ljava/lang/Double; @@ -2188,6 +2154,8 @@ public final class kscience/kmath/operations/RealField : kscience/kmath/operatio public fun binaryOperation (Ljava/lang/String;DD)Ljava/lang/Double; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public fun bindSymbol (Ljava/lang/String;)Ljava/lang/Double; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun cos (D)Ljava/lang/Double; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; public fun cosh (D)Ljava/lang/Double; @@ -2236,8 +2204,6 @@ public final class kscience/kmath/operations/RealField : kscience/kmath/operatio public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; public fun sqrt (D)Ljava/lang/Double; public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Ljava/lang/Double; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; public fun tan (D)Ljava/lang/Double; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; public fun tanh (D)Ljava/lang/Double; @@ -2257,97 +2223,88 @@ public final class kscience/kmath/operations/RealField : kscience/kmath/operatio public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/Ring : kscience/kmath/operations/RingOperations, kscience/kmath/operations/Space { +public abstract interface class space/kscience/kmath/operations/Ring : space/kscience/kmath/operations/RingOperations, space/kscience/kmath/operations/Space { public abstract fun getOne ()Ljava/lang/Object; } -public final class kscience/kmath/operations/Ring$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/Ring;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/Ring;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/Ring;Ljava/lang/String;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/Ring;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/Ring;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/Ring;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/Ring;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/Ring;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/Ring$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/Ring;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/Ring;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/Ring;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/Ring;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/Ring;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/RingElement : kscience/kmath/operations/SpaceElement { -} - -public abstract interface class kscience/kmath/operations/RingOperations : kscience/kmath/operations/SpaceOperations { - public static final field Companion Lkscience/kmath/operations/RingOperations$Companion; +public abstract interface class space/kscience/kmath/operations/RingOperations : space/kscience/kmath/operations/SpaceOperations { + public static final field Companion Lspace/kscience/kmath/operations/RingOperations$Companion; public static final field TIMES_OPERATION Ljava/lang/String; public abstract fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public abstract fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/RingOperations$Companion { +public final class space/kscience/kmath/operations/RingOperations$Companion { public static final field TIMES_OPERATION Ljava/lang/String; } -public final class kscience/kmath/operations/RingOperations$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/RingOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/RingOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/RingOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/RingOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/RingOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/RingOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/RingOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/RingOperations;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/RingOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/RingWithNumbers : kscience/kmath/operations/NumericAlgebra, kscience/kmath/operations/Ring { - public abstract fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public abstract fun number (Ljava/lang/Number;)Ljava/lang/Object; - public abstract fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/RingWithNumbers$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun leftSideNumberOperation (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun leftSideNumberOperationFunction (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun minus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun number (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun rightSideNumberOperation (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun rightSideNumberOperationFunction (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun times (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/RingWithNumbers$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun leftSideNumberOperation (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun leftSideNumberOperationFunction (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun minus (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun number (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun rightSideNumberOperation (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun rightSideNumberOperationFunction (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun symbol (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;)Ljava/lang/Object; -} - -public final class kscience/kmath/operations/ShortRing : kscience/kmath/operations/Norm, kscience/kmath/operations/NumericAlgebra, kscience/kmath/operations/Ring { - public static final field INSTANCE Lkscience/kmath/operations/ShortRing; +public final class space/kscience/kmath/operations/ShortRing : space/kscience/kmath/operations/Norm, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/Ring { + public static final field INSTANCE Lspace/kscience/kmath/operations/ShortRing; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun add (SS)Ljava/lang/Short; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun binaryOperation (Ljava/lang/String;SS)Ljava/lang/Short; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Ljava/lang/Short; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun div (SLjava/lang/Number;)Ljava/lang/Short; public synthetic fun getOne ()Ljava/lang/Object; @@ -2372,8 +2329,6 @@ public final class kscience/kmath/operations/ShortRing : kscience/kmath/operatio public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperation (Ljava/lang/String;SLjava/lang/Number;)Ljava/lang/Short; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Ljava/lang/Short; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public fun times (Ljava/lang/Number;S)Ljava/lang/Short; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; @@ -2389,30 +2344,27 @@ public final class kscience/kmath/operations/ShortRing : kscience/kmath/operatio public fun unaryPlus (S)Ljava/lang/Short; } -public abstract interface class kscience/kmath/operations/Space : kscience/kmath/operations/SpaceOperations { +public abstract interface class space/kscience/kmath/operations/Space : space/kscience/kmath/operations/SpaceOperations { public abstract fun getZero ()Ljava/lang/Object; } -public final class kscience/kmath/operations/Space$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/Space;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/Space;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/Space;Ljava/lang/String;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/Space;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/Space;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/Space;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/Space;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/Space;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/Space$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/Space;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/SpaceElement : kscience/kmath/operations/AlgebraElement { -} - -public abstract interface class kscience/kmath/operations/SpaceOperations : kscience/kmath/operations/Algebra { - public static final field Companion Lkscience/kmath/operations/SpaceOperations$Companion; +public abstract interface class space/kscience/kmath/operations/SpaceOperations : space/kscience/kmath/operations/Algebra { + public static final field Companion Lspace/kscience/kmath/operations/SpaceOperations$Companion; public static final field MINUS_OPERATION Ljava/lang/String; public static final field PLUS_OPERATION Ljava/lang/String; public abstract fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; @@ -2428,32 +2380,32 @@ public abstract interface class kscience/kmath/operations/SpaceOperations : ksci public abstract fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/SpaceOperations$Companion { +public final class space/kscience/kmath/operations/SpaceOperations$Companion { public static final field MINUS_OPERATION Ljava/lang/String; public static final field PLUS_OPERATION Ljava/lang/String; } -public final class kscience/kmath/operations/SpaceOperations$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun div (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun minus (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun symbol (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun unaryMinus (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lkscience/kmath/operations/SpaceOperations;Ljava/lang/Object;)Ljava/lang/Object; +public final class space/kscience/kmath/operations/SpaceOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun unaryMinus (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class kscience/kmath/operations/TrigonometricOperations : kscience/kmath/operations/Algebra { +public abstract interface class space/kscience/kmath/operations/TrigonometricOperations : space/kscience/kmath/operations/Algebra { public static final field ACOS_OPERATION Ljava/lang/String; public static final field ASIN_OPERATION Ljava/lang/String; public static final field ATAN_OPERATION Ljava/lang/String; public static final field COS_OPERATION Ljava/lang/String; - public static final field Companion Lkscience/kmath/operations/TrigonometricOperations$Companion; + public static final field Companion Lspace/kscience/kmath/operations/TrigonometricOperations$Companion; public static final field SIN_OPERATION Ljava/lang/String; public static final field TAN_OPERATION Ljava/lang/String; public abstract fun acos (Ljava/lang/Object;)Ljava/lang/Object; @@ -2464,7 +2416,7 @@ public abstract interface class kscience/kmath/operations/TrigonometricOperation public abstract fun tan (Ljava/lang/Object;)Ljava/lang/Object; } -public final class kscience/kmath/operations/TrigonometricOperations$Companion { +public final class space/kscience/kmath/operations/TrigonometricOperations$Companion { public static final field ACOS_OPERATION Ljava/lang/String; public static final field ASIN_OPERATION Ljava/lang/String; public static final field ATAN_OPERATION Ljava/lang/String; @@ -2473,71 +2425,71 @@ public final class kscience/kmath/operations/TrigonometricOperations$Companion { public static final field TAN_OPERATION Ljava/lang/String; } -public final class kscience/kmath/operations/TrigonometricOperations$DefaultImpls { - public static fun binaryOperation (Lkscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lkscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun symbol (Lkscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun unaryOperation (Lkscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lkscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; +public final class space/kscience/kmath/operations/TrigonometricOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/TrigonometricOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class kscience/kmath/structures/ArrayBuffer : kscience/kmath/structures/MutableBuffer { +public final class space/kscience/kmath/structures/ArrayBuffer : space/kscience/kmath/structures/MutableBuffer { public fun ([Ljava/lang/Object;)V - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public fun copy ()Lkscience/kmath/structures/MutableBuffer; + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; public fun get (I)Ljava/lang/Object; public fun getSize ()I public fun iterator ()Ljava/util/Iterator; public fun set (ILjava/lang/Object;)V } -public abstract interface class kscience/kmath/structures/Buffer { - public static final field Companion Lkscience/kmath/structures/Buffer$Companion; - public abstract fun contentEquals (Lkscience/kmath/structures/Buffer;)Z +public abstract interface class space/kscience/kmath/structures/Buffer { + public static final field Companion Lspace/kscience/kmath/structures/Buffer$Companion; + public abstract fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z public abstract fun get (I)Ljava/lang/Object; public abstract fun getSize ()I public abstract fun iterator ()Ljava/util/Iterator; } -public final class kscience/kmath/structures/Buffer$Companion { - public final fun auto (Lkotlin/reflect/KClass;ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/Buffer; - public final fun boxing (ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/Buffer; - public final fun real-4n5bU9U (ILkotlin/jvm/functions/Function1;)[D +public final class space/kscience/kmath/structures/Buffer$Companion { + public final fun auto (Lkotlin/reflect/KClass;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public final fun boxing (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public final fun real-8hrHhI4 (ILkotlin/jvm/functions/Function1;)[D } -public final class kscience/kmath/structures/Buffer$DefaultImpls { - public static fun contentEquals (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Z +public final class space/kscience/kmath/structures/Buffer$DefaultImpls { + public static fun contentEquals (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Z } -public final class kscience/kmath/structures/BufferKt { +public final class space/kscience/kmath/structures/BufferKt { public static final fun ListBuffer (ILkotlin/jvm/functions/Function1;)Ljava/util/List; public static final fun asBuffer (Ljava/util/List;)Ljava/util/List; - public static final fun asBuffer ([Ljava/lang/Object;)Lkscience/kmath/structures/ArrayBuffer; - public static final fun asIterable (Lkscience/kmath/structures/Buffer;)Ljava/lang/Iterable; - public static final fun asReadOnly (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public static final fun asSequence (Lkscience/kmath/structures/Buffer;)Lkotlin/sequences/Sequence; - public static final fun getIndices (Lkscience/kmath/structures/Buffer;)Lkotlin/ranges/IntRange; - public static final fun toList (Lkscience/kmath/structures/Buffer;)Ljava/util/List; + public static final fun asBuffer ([Ljava/lang/Object;)Lspace/kscience/kmath/structures/ArrayBuffer; + public static final fun asIterable (Lspace/kscience/kmath/structures/Buffer;)Ljava/lang/Iterable; + public static final fun asReadOnly (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static final fun asSequence (Lspace/kscience/kmath/structures/Buffer;)Lkotlin/sequences/Sequence; + public static final fun getIndices (Lspace/kscience/kmath/structures/Buffer;)Lkotlin/ranges/IntRange; + public static final fun toList (Lspace/kscience/kmath/structures/Buffer;)Ljava/util/List; } -public abstract interface class kscience/kmath/structures/FlaggedBuffer : kscience/kmath/structures/Buffer { +public abstract interface class space/kscience/kmath/structures/FlaggedBuffer : space/kscience/kmath/structures/Buffer { public abstract fun getFlag (I)B } -public final class kscience/kmath/structures/FlaggedBuffer$DefaultImpls { - public static fun contentEquals (Lkscience/kmath/structures/FlaggedBuffer;Lkscience/kmath/structures/Buffer;)Z +public final class space/kscience/kmath/structures/FlaggedBuffer$DefaultImpls { + public static fun contentEquals (Lspace/kscience/kmath/structures/FlaggedBuffer;Lspace/kscience/kmath/structures/Buffer;)Z } -public final class kscience/kmath/structures/FlaggedBufferKt { - public static final fun forEachValid (Lkscience/kmath/structures/FlaggedRealBuffer;Lkotlin/jvm/functions/Function1;)V - public static final fun hasFlag (Lkscience/kmath/structures/FlaggedBuffer;ILkscience/kmath/structures/ValueFlag;)Z - public static final fun isMissing (Lkscience/kmath/structures/FlaggedBuffer;I)Z - public static final fun isValid (Lkscience/kmath/structures/FlaggedBuffer;I)Z +public final class space/kscience/kmath/structures/FlaggedBufferKt { + public static final fun forEachValid (Lspace/kscience/kmath/structures/FlaggedRealBuffer;Lkotlin/jvm/functions/Function1;)V + public static final fun hasFlag (Lspace/kscience/kmath/structures/FlaggedBuffer;ILspace/kscience/kmath/structures/ValueFlag;)Z + public static final fun isMissing (Lspace/kscience/kmath/structures/FlaggedBuffer;I)Z + public static final fun isValid (Lspace/kscience/kmath/structures/FlaggedBuffer;I)Z } -public final class kscience/kmath/structures/FlaggedRealBuffer : kscience/kmath/structures/Buffer, kscience/kmath/structures/FlaggedBuffer { +public final class space/kscience/kmath/structures/FlaggedRealBuffer : space/kscience/kmath/structures/Buffer, space/kscience/kmath/structures/FlaggedBuffer { public fun ([D[B)V - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z public fun get (I)Ljava/lang/Double; public synthetic fun get (I)Ljava/lang/Object; public fun getFlag (I)B @@ -2547,13 +2499,13 @@ public final class kscience/kmath/structures/FlaggedRealBuffer : kscience/kmath/ public fun iterator ()Ljava/util/Iterator; } -public final class kscience/kmath/structures/FloatBuffer : kscience/kmath/structures/MutableBuffer { - public static final synthetic fun box-impl ([F)Lkscience/kmath/structures/FloatBuffer; +public final class space/kscience/kmath/structures/FloatBuffer : space/kscience/kmath/structures/MutableBuffer { + public static final synthetic fun box-impl ([F)Lspace/kscience/kmath/structures/FloatBuffer; public static fun constructor-impl ([F)[F - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl ([FLkscience/kmath/structures/Buffer;)Z - public fun copy ()Lkscience/kmath/structures/MutableBuffer; - public static fun copy-impl ([F)Lkscience/kmath/structures/MutableBuffer; + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl ([FLspace/kscience/kmath/structures/Buffer;)Z + public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; + public static fun copy-impl ([F)Lspace/kscience/kmath/structures/MutableBuffer; public fun equals (Ljava/lang/Object;)Z public static fun equals-impl ([FLjava/lang/Object;)Z public static final fun equals-impl0 ([F[F)Z @@ -2576,20 +2528,20 @@ public final class kscience/kmath/structures/FloatBuffer : kscience/kmath/struct public final synthetic fun unbox-impl ()[F } -public final class kscience/kmath/structures/FloatBufferKt { +public final class space/kscience/kmath/structures/FloatBufferKt { public static final fun FloatBuffer (ILkotlin/jvm/functions/Function1;)[F public static final fun FloatBuffer ([F)[F public static final fun asBuffer ([F)[F - public static final fun getArray (Lkscience/kmath/structures/MutableBuffer;)[F + public static final fun getArray (Lspace/kscience/kmath/structures/MutableBuffer;)[F } -public final class kscience/kmath/structures/IntBuffer : kscience/kmath/structures/MutableBuffer { - public static final synthetic fun box-impl ([I)Lkscience/kmath/structures/IntBuffer; +public final class space/kscience/kmath/structures/IntBuffer : space/kscience/kmath/structures/MutableBuffer { + public static final synthetic fun box-impl ([I)Lspace/kscience/kmath/structures/IntBuffer; public static fun constructor-impl ([I)[I - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl ([ILkscience/kmath/structures/Buffer;)Z - public fun copy ()Lkscience/kmath/structures/MutableBuffer; - public static fun copy-impl ([I)Lkscience/kmath/structures/MutableBuffer; + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl ([ILspace/kscience/kmath/structures/Buffer;)Z + public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; + public static fun copy-impl ([I)Lspace/kscience/kmath/structures/MutableBuffer; public fun equals (Ljava/lang/Object;)Z public static fun equals-impl ([ILjava/lang/Object;)Z public static final fun equals-impl0 ([I[I)Z @@ -2612,18 +2564,18 @@ public final class kscience/kmath/structures/IntBuffer : kscience/kmath/structur public final synthetic fun unbox-impl ()[I } -public final class kscience/kmath/structures/IntBufferKt { +public final class space/kscience/kmath/structures/IntBufferKt { public static final fun IntBuffer (ILkotlin/jvm/functions/Function1;)[I public static final fun IntBuffer ([I)[I public static final fun asBuffer ([I)[I - public static final fun getArray (Lkscience/kmath/structures/MutableBuffer;)[I + public static final fun getArray (Lspace/kscience/kmath/structures/MutableBuffer;)[I } -public final class kscience/kmath/structures/ListBuffer : kscience/kmath/structures/Buffer { - public static final synthetic fun box-impl (Ljava/util/List;)Lkscience/kmath/structures/ListBuffer; +public final class space/kscience/kmath/structures/ListBuffer : space/kscience/kmath/structures/Buffer { + public static final synthetic fun box-impl (Ljava/util/List;)Lspace/kscience/kmath/structures/ListBuffer; public static fun constructor-impl (Ljava/util/List;)Ljava/util/List; - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl (Ljava/util/List;Lkscience/kmath/structures/Buffer;)Z + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl (Ljava/util/List;Lspace/kscience/kmath/structures/Buffer;)Z public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Ljava/util/List;Ljava/lang/Object;)Z public static final fun equals-impl0 (Ljava/util/List;Ljava/util/List;)Z @@ -2641,13 +2593,13 @@ public final class kscience/kmath/structures/ListBuffer : kscience/kmath/structu public final synthetic fun unbox-impl ()Ljava/util/List; } -public final class kscience/kmath/structures/LongBuffer : kscience/kmath/structures/MutableBuffer { - public static final synthetic fun box-impl ([J)Lkscience/kmath/structures/LongBuffer; +public final class space/kscience/kmath/structures/LongBuffer : space/kscience/kmath/structures/MutableBuffer { + public static final synthetic fun box-impl ([J)Lspace/kscience/kmath/structures/LongBuffer; public static fun constructor-impl ([J)[J - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl ([JLkscience/kmath/structures/Buffer;)Z - public fun copy ()Lkscience/kmath/structures/MutableBuffer; - public static fun copy-impl ([J)Lkscience/kmath/structures/MutableBuffer; + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl ([JLspace/kscience/kmath/structures/Buffer;)Z + public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; + public static fun copy-impl ([J)Lspace/kscience/kmath/structures/MutableBuffer; public fun equals (Ljava/lang/Object;)Z public static fun equals-impl ([JLjava/lang/Object;)Z public static final fun equals-impl0 ([J[J)Z @@ -2670,52 +2622,52 @@ public final class kscience/kmath/structures/LongBuffer : kscience/kmath/structu public final synthetic fun unbox-impl ()[J } -public final class kscience/kmath/structures/LongBufferKt { +public final class space/kscience/kmath/structures/LongBufferKt { public static final fun LongBuffer (ILkotlin/jvm/functions/Function1;)[J public static final fun LongBuffer ([J)[J public static final fun asBuffer ([J)[J - public static final fun getArray (Lkscience/kmath/structures/MutableBuffer;)[J + public static final fun getArray (Lspace/kscience/kmath/structures/MutableBuffer;)[J } -public class kscience/kmath/structures/MemoryBuffer : kscience/kmath/structures/Buffer { - public static final field Companion Lkscience/kmath/structures/MemoryBuffer$Companion; - public fun (Lkscience/kmath/memory/Memory;Lkscience/kmath/memory/MemorySpec;)V - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z +public class space/kscience/kmath/structures/MemoryBuffer : space/kscience/kmath/structures/Buffer { + public static final field Companion Lspace/kscience/kmath/structures/MemoryBuffer$Companion; + public fun (Lspace/kscience/kmath/memory/Memory;Lspace/kscience/kmath/memory/MemorySpec;)V + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z public fun get (I)Ljava/lang/Object; - protected final fun getMemory ()Lkscience/kmath/memory/Memory; + protected final fun getMemory ()Lspace/kscience/kmath/memory/Memory; public fun getSize ()I - protected final fun getSpec ()Lkscience/kmath/memory/MemorySpec; + protected final fun getSpec ()Lspace/kscience/kmath/memory/MemorySpec; public fun iterator ()Ljava/util/Iterator; } -public final class kscience/kmath/structures/MemoryBuffer$Companion { - public final fun create (Lkscience/kmath/memory/MemorySpec;I)Lkscience/kmath/structures/MemoryBuffer; - public final fun create (Lkscience/kmath/memory/MemorySpec;ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/MemoryBuffer; +public final class space/kscience/kmath/structures/MemoryBuffer$Companion { + public final fun create (Lspace/kscience/kmath/memory/MemorySpec;I)Lspace/kscience/kmath/structures/MemoryBuffer; + public final fun create (Lspace/kscience/kmath/memory/MemorySpec;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/MemoryBuffer; } -public abstract interface class kscience/kmath/structures/MutableBuffer : kscience/kmath/structures/Buffer { - public static final field Companion Lkscience/kmath/structures/MutableBuffer$Companion; - public abstract fun copy ()Lkscience/kmath/structures/MutableBuffer; +public abstract interface class space/kscience/kmath/structures/MutableBuffer : space/kscience/kmath/structures/Buffer { + public static final field Companion Lspace/kscience/kmath/structures/MutableBuffer$Companion; + public abstract fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; public abstract fun set (ILjava/lang/Object;)V } -public final class kscience/kmath/structures/MutableBuffer$Companion { - public final fun auto (Lkotlin/reflect/KClass;ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/MutableBuffer; - public final fun boxing (ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/MutableBuffer; - public final fun real-4n5bU9U (ILkotlin/jvm/functions/Function1;)[D +public final class space/kscience/kmath/structures/MutableBuffer$Companion { + public final fun auto (Lkotlin/reflect/KClass;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/MutableBuffer; + public final fun boxing (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/MutableBuffer; + public final fun real-8hrHhI4 (ILkotlin/jvm/functions/Function1;)[D } -public final class kscience/kmath/structures/MutableBuffer$DefaultImpls { - public static fun contentEquals (Lkscience/kmath/structures/MutableBuffer;Lkscience/kmath/structures/Buffer;)Z +public final class space/kscience/kmath/structures/MutableBuffer$DefaultImpls { + public static fun contentEquals (Lspace/kscience/kmath/structures/MutableBuffer;Lspace/kscience/kmath/structures/Buffer;)Z } -public final class kscience/kmath/structures/MutableListBuffer : kscience/kmath/structures/MutableBuffer { - public static final synthetic fun box-impl (Ljava/util/List;)Lkscience/kmath/structures/MutableListBuffer; +public final class space/kscience/kmath/structures/MutableListBuffer : space/kscience/kmath/structures/MutableBuffer { + public static final synthetic fun box-impl (Ljava/util/List;)Lspace/kscience/kmath/structures/MutableListBuffer; public static fun constructor-impl (Ljava/util/List;)Ljava/util/List; - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl (Ljava/util/List;Lkscience/kmath/structures/Buffer;)Z - public fun copy ()Lkscience/kmath/structures/MutableBuffer; - public static fun copy-impl (Ljava/util/List;)Lkscience/kmath/structures/MutableBuffer; + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl (Ljava/util/List;Lspace/kscience/kmath/structures/Buffer;)Z + public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; + public static fun copy-impl (Ljava/util/List;)Lspace/kscience/kmath/structures/MutableBuffer; public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Ljava/util/List;Ljava/lang/Object;)Z public static final fun equals-impl0 (Ljava/util/List;Ljava/util/List;)Z @@ -2735,48 +2687,48 @@ public final class kscience/kmath/structures/MutableListBuffer : kscience/kmath/ public final synthetic fun unbox-impl ()Ljava/util/List; } -public final class kscience/kmath/structures/MutableMemoryBuffer : kscience/kmath/structures/MemoryBuffer, kscience/kmath/structures/MutableBuffer { - public static final field Companion Lkscience/kmath/structures/MutableMemoryBuffer$Companion; - public fun (Lkscience/kmath/memory/Memory;Lkscience/kmath/memory/MemorySpec;)V - public fun copy ()Lkscience/kmath/structures/MutableBuffer; +public final class space/kscience/kmath/structures/MutableMemoryBuffer : space/kscience/kmath/structures/MemoryBuffer, space/kscience/kmath/structures/MutableBuffer { + public static final field Companion Lspace/kscience/kmath/structures/MutableMemoryBuffer$Companion; + public fun (Lspace/kscience/kmath/memory/Memory;Lspace/kscience/kmath/memory/MemorySpec;)V + public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; public fun set (ILjava/lang/Object;)V } -public final class kscience/kmath/structures/MutableMemoryBuffer$Companion { - public final fun create (Lkscience/kmath/memory/MemorySpec;I)Lkscience/kmath/structures/MutableMemoryBuffer; - public final fun create (Lkscience/kmath/memory/MemorySpec;ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/MutableMemoryBuffer; +public final class space/kscience/kmath/structures/MutableMemoryBuffer$Companion { + public final fun create (Lspace/kscience/kmath/memory/MemorySpec;I)Lspace/kscience/kmath/structures/MutableMemoryBuffer; + public final fun create (Lspace/kscience/kmath/memory/MemorySpec;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/MutableMemoryBuffer; } -public final class kscience/kmath/structures/ReadOnlyBuffer : kscience/kmath/structures/Buffer { - public static final synthetic fun box-impl (Lkscience/kmath/structures/MutableBuffer;)Lkscience/kmath/structures/ReadOnlyBuffer; - public static fun constructor-impl (Lkscience/kmath/structures/MutableBuffer;)Lkscience/kmath/structures/MutableBuffer; - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl (Lkscience/kmath/structures/MutableBuffer;Lkscience/kmath/structures/Buffer;)Z +public final class space/kscience/kmath/structures/ReadOnlyBuffer : space/kscience/kmath/structures/Buffer { + public static final synthetic fun box-impl (Lspace/kscience/kmath/structures/MutableBuffer;)Lspace/kscience/kmath/structures/ReadOnlyBuffer; + public static fun constructor-impl (Lspace/kscience/kmath/structures/MutableBuffer;)Lspace/kscience/kmath/structures/MutableBuffer; + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl (Lspace/kscience/kmath/structures/MutableBuffer;Lspace/kscience/kmath/structures/Buffer;)Z public fun equals (Ljava/lang/Object;)Z - public static fun equals-impl (Lkscience/kmath/structures/MutableBuffer;Ljava/lang/Object;)Z - public static final fun equals-impl0 (Lkscience/kmath/structures/MutableBuffer;Lkscience/kmath/structures/MutableBuffer;)Z + public static fun equals-impl (Lspace/kscience/kmath/structures/MutableBuffer;Ljava/lang/Object;)Z + public static final fun equals-impl0 (Lspace/kscience/kmath/structures/MutableBuffer;Lspace/kscience/kmath/structures/MutableBuffer;)Z public fun get (I)Ljava/lang/Object; - public static fun get-impl (Lkscience/kmath/structures/MutableBuffer;I)Ljava/lang/Object; - public final fun getBuffer ()Lkscience/kmath/structures/MutableBuffer; + public static fun get-impl (Lspace/kscience/kmath/structures/MutableBuffer;I)Ljava/lang/Object; + public final fun getBuffer ()Lspace/kscience/kmath/structures/MutableBuffer; public fun getSize ()I - public static fun getSize-impl (Lkscience/kmath/structures/MutableBuffer;)I + public static fun getSize-impl (Lspace/kscience/kmath/structures/MutableBuffer;)I public fun hashCode ()I - public static fun hashCode-impl (Lkscience/kmath/structures/MutableBuffer;)I + public static fun hashCode-impl (Lspace/kscience/kmath/structures/MutableBuffer;)I public fun iterator ()Ljava/util/Iterator; - public static fun iterator-impl (Lkscience/kmath/structures/MutableBuffer;)Ljava/util/Iterator; + public static fun iterator-impl (Lspace/kscience/kmath/structures/MutableBuffer;)Ljava/util/Iterator; public fun toString ()Ljava/lang/String; - public static fun toString-impl (Lkscience/kmath/structures/MutableBuffer;)Ljava/lang/String; - public final synthetic fun unbox-impl ()Lkscience/kmath/structures/MutableBuffer; + public static fun toString-impl (Lspace/kscience/kmath/structures/MutableBuffer;)Ljava/lang/String; + public final synthetic fun unbox-impl ()Lspace/kscience/kmath/structures/MutableBuffer; } -public final class kscience/kmath/structures/RealBuffer : kscience/kmath/structures/MutableBuffer { - public static final synthetic fun box-impl ([D)Lkscience/kmath/structures/RealBuffer; +public final class space/kscience/kmath/structures/RealBuffer : space/kscience/kmath/structures/MutableBuffer { + public static final synthetic fun box-impl ([D)Lspace/kscience/kmath/structures/RealBuffer; public static fun constructor-impl ([D)[D - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl ([DLkscience/kmath/structures/Buffer;)Z - public synthetic fun copy ()Lkscience/kmath/structures/MutableBuffer; - public fun copy-H8_hoUg ()[D - public static fun copy-H8_hoUg ([D)[D + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl ([DLspace/kscience/kmath/structures/Buffer;)Z + public synthetic fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; + public fun copy-88GwAag ()[D + public static fun copy-88GwAag ([D)[D public fun equals (Ljava/lang/Object;)Z public static fun equals-impl ([DLjava/lang/Object;)Z public static final fun equals-impl0 ([D[D)Z @@ -2799,180 +2751,180 @@ public final class kscience/kmath/structures/RealBuffer : kscience/kmath/structu public final synthetic fun unbox-impl ()[D } -public final class kscience/kmath/structures/RealBufferField : kscience/kmath/operations/ExtendedField { +public final class space/kscience/kmath/structures/RealBufferField : space/kscience/kmath/operations/ExtendedField { public fun (I)V public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; - public fun acos-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun acos-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun acosh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun acosh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add-4n5bU9U (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)[D + public fun add-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; - public fun asin-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun asin-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun asinh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun asinh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; - public fun atan-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun atan-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun atanh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun atanh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; - public fun cos-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun cos-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun cosh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun cosh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Number;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun div (Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; - public fun div (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun div (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public fun div (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide-4n5bU9U (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)[D + public fun divide-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; - public fun exp-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun exp-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lkscience/kmath/structures/Buffer; + public fun getOne ()Lspace/kscience/kmath/structures/Buffer; public final fun getSize ()I public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lkscience/kmath/structures/Buffer; + public fun getZero ()Lspace/kscience/kmath/structures/Buffer; public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; - public fun ln-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun ln-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun minus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply-4n5bU9U (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)[D - public fun multiply-4n5bU9U (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)[D + public fun multiply-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)[D + public fun multiply-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number (Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun plus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun pow (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; + public fun pow (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun power-4n5bU9U (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)[D + public fun power-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)[D public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; - public fun sin-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun sin-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun sinh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun sinh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun sqrt (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/structures/Buffer; + public fun sqrt (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; - public fun tan-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun tan-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun tanh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun tanh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; - public fun times (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun times (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public fun times (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryPlus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; } -public final class kscience/kmath/structures/RealBufferFieldOperations : kscience/kmath/operations/ExtendedFieldOperations { - public static final field INSTANCE Lkscience/kmath/structures/RealBufferFieldOperations; +public final class space/kscience/kmath/structures/RealBufferFieldOperations : space/kscience/kmath/operations/ExtendedFieldOperations { + public static final field INSTANCE Lspace/kscience/kmath/structures/RealBufferFieldOperations; public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; - public fun acos-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun acos-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun acosh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun acosh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add-4n5bU9U (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)[D + public fun add-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; - public fun asin-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun asin-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun asinh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun asinh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; - public fun atan-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun atan-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun atanh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun atanh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; - public fun cos-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun cos-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun cosh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun cosh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; - public fun div (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun div (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public fun div (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide-4n5bU9U (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)[D + public fun divide-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; - public fun exp-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun exp-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; - public fun ln-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun ln-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun minus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply-4n5bU9U (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)[D - public fun multiply-4n5bU9U (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)[D + public fun multiply-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)[D + public fun multiply-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun plus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun pow (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; + public fun pow (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun power-4n5bU9U (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)[D + public fun power-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)[D public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; - public fun sin-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun sin-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun sinh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun sinh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun sqrt (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; - public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object; - public fun symbol (Ljava/lang/String;)Lkscience/kmath/structures/Buffer; + public fun sqrt (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; - public fun tan-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun tan-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun tanh-JVEF3vg (Lkscience/kmath/structures/Buffer;)[D + public fun tanh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Lkscience/kmath/structures/Buffer;Ljava/lang/Number;)Lkscience/kmath/structures/Buffer; - public fun times (Lkscience/kmath/structures/Buffer;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun times (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public fun times (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lkscience/kmath/structures/Buffer;)Lkscience/kmath/structures/Buffer; + public fun unaryPlus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; } -public final class kscience/kmath/structures/RealBufferKt { +public final class space/kscience/kmath/structures/RealBufferKt { public static final fun RealBuffer (ILkotlin/jvm/functions/Function1;)[D public static final fun RealBuffer ([D)[D public static final fun asBuffer ([D)[D - public static final fun contentEquals-KRld2r8 ([D[D)Z - public static final fun getArray (Lkscience/kmath/structures/MutableBuffer;)[D + public static final fun contentEquals-2uVC2J0 ([D[D)Z + public static final fun getArray (Lspace/kscience/kmath/structures/MutableBuffer;)[D } -public final class kscience/kmath/structures/ShortBuffer : kscience/kmath/structures/MutableBuffer { - public static final synthetic fun box-impl ([S)Lkscience/kmath/structures/ShortBuffer; +public final class space/kscience/kmath/structures/ShortBuffer : space/kscience/kmath/structures/MutableBuffer { + public static final synthetic fun box-impl ([S)Lspace/kscience/kmath/structures/ShortBuffer; public static fun constructor-impl ([S)[S - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl ([SLkscience/kmath/structures/Buffer;)Z - public fun copy ()Lkscience/kmath/structures/MutableBuffer; - public static fun copy-impl ([S)Lkscience/kmath/structures/MutableBuffer; + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl ([SLspace/kscience/kmath/structures/Buffer;)Z + public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; + public static fun copy-impl ([S)Lspace/kscience/kmath/structures/MutableBuffer; public fun equals (Ljava/lang/Object;)Z public static fun equals-impl ([SLjava/lang/Object;)Z public static final fun equals-impl0 ([S[S)Z @@ -2995,26 +2947,26 @@ public final class kscience/kmath/structures/ShortBuffer : kscience/kmath/struct public final synthetic fun unbox-impl ()[S } -public final class kscience/kmath/structures/ShortBufferKt { +public final class space/kscience/kmath/structures/ShortBufferKt { public static final fun ShortBuffer (ILkotlin/jvm/functions/Function1;)[S public static final fun ShortBuffer ([S)[S public static final fun asBuffer ([S)[S - public static final fun getArray (Lkscience/kmath/structures/MutableBuffer;)[S + public static final fun getArray (Lspace/kscience/kmath/structures/MutableBuffer;)[S } -public final class kscience/kmath/structures/ValueFlag : java/lang/Enum { - public static final field MISSING Lkscience/kmath/structures/ValueFlag; - public static final field NAN Lkscience/kmath/structures/ValueFlag; - public static final field NEGATIVE_INFINITY Lkscience/kmath/structures/ValueFlag; - public static final field POSITIVE_INFINITY Lkscience/kmath/structures/ValueFlag; +public final class space/kscience/kmath/structures/ValueFlag : java/lang/Enum { + public static final field MISSING Lspace/kscience/kmath/structures/ValueFlag; + public static final field NAN Lspace/kscience/kmath/structures/ValueFlag; + public static final field NEGATIVE_INFINITY Lspace/kscience/kmath/structures/ValueFlag; + public static final field POSITIVE_INFINITY Lspace/kscience/kmath/structures/ValueFlag; public final fun getMask ()B - public static fun valueOf (Ljava/lang/String;)Lkscience/kmath/structures/ValueFlag; - public static fun values ()[Lkscience/kmath/structures/ValueFlag; + public static fun valueOf (Ljava/lang/String;)Lspace/kscience/kmath/structures/ValueFlag; + public static fun values ()[Lspace/kscience/kmath/structures/ValueFlag; } -public final class kscience/kmath/structures/VirtualBuffer : kscience/kmath/structures/Buffer { +public final class space/kscience/kmath/structures/VirtualBuffer : space/kscience/kmath/structures/Buffer { public fun (ILkotlin/jvm/functions/Function1;)V - public fun contentEquals (Lkscience/kmath/structures/Buffer;)Z + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z public fun get (I)Ljava/lang/Object; public fun getSize ()I public fun iterator ()Ljava/util/Iterator; diff --git a/kmath-core/build.gradle.kts b/kmath-core/build.gradle.kts index cfb996894..8d30f1d6e 100644 --- a/kmath-core/build.gradle.kts +++ b/kmath-core/build.gradle.kts @@ -1,8 +1,8 @@ import ru.mipt.npm.gradle.Maturity plugins { - id("ru.mipt.npm.mpp") - id("ru.mipt.npm.native") + id("ru.mipt.npm.gradle.mpp") + id("ru.mipt.npm.gradle.native") } kotlin.sourceSets { diff --git a/kmath-coroutines/build.gradle.kts b/kmath-coroutines/build.gradle.kts index 1f436a54b..4a9ca5244 100644 --- a/kmath-coroutines/build.gradle.kts +++ b/kmath-coroutines/build.gradle.kts @@ -1,4 +1,4 @@ -plugins { id("ru.mipt.npm.mpp") } +plugins { id("ru.mipt.npm.gradle.mpp") } kotlin.sourceSets { all { diff --git a/kmath-dimensions/build.gradle.kts b/kmath-dimensions/build.gradle.kts index 9bf89fc43..3355eda42 100644 --- a/kmath-dimensions/build.gradle.kts +++ b/kmath-dimensions/build.gradle.kts @@ -1,6 +1,6 @@ plugins { - id("ru.mipt.npm.mpp") - id("ru.mipt.npm.native") + id("ru.mipt.npm.gradle.mpp") + id("ru.mipt.npm.gradle.native") } description = "A proof of concept module for adding type-safe dimensions to structures" diff --git a/kmath-ejml/build.gradle.kts b/kmath-ejml/build.gradle.kts index ecf76a022..07f95b13f 100644 --- a/kmath-ejml/build.gradle.kts +++ b/kmath-ejml/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("ru.mipt.npm.jvm") + id("ru.mipt.npm.gradle.jvm") } dependencies { diff --git a/kmath-for-real/README.md b/kmath-for-real/README.md index 92237350a..94b9eb59a 100644 --- a/kmath-for-real/README.md +++ b/kmath-for-real/README.md @@ -7,7 +7,7 @@ > #### Artifact: > -> This module artifact: `space.kscience:kmath-for-real:0.2.0-dev-7`. +> This module artifact: `space.kscience:kmath-for-real:0.2.0`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-for-real/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-for-real/_latestVersion) > @@ -26,7 +26,7 @@ > } > > dependencies { -> implementation 'space.kscience:kmath-for-real:0.2.0-dev-7' +> implementation 'space.kscience:kmath-for-real:0.2.0' > } > ``` > **Gradle Kotlin DSL:** @@ -42,6 +42,6 @@ > } > > dependencies { -> implementation("space.kscience:kmath-for-real:0.2.0-dev-7") +> implementation("space.kscience:kmath-for-real:0.2.0") > } > ``` diff --git a/kmath-for-real/build.gradle.kts b/kmath-for-real/build.gradle.kts index f26f98c2c..d095cac04 100644 --- a/kmath-for-real/build.gradle.kts +++ b/kmath-for-real/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("ru.mipt.npm.mpp") + id("ru.mipt.npm.gradle.mpp") } kotlin.sourceSets.commonMain { diff --git a/kmath-functions/README.md b/kmath-functions/README.md index ef54bf994..0eae4e3c0 100644 --- a/kmath-functions/README.md +++ b/kmath-functions/README.md @@ -10,7 +10,7 @@ Functions and interpolations: > #### Artifact: > -> This module artifact: `space.kscience:kmath-functions:0.2.0-dev-7`. +> This module artifact: `space.kscience:kmath-functions:0.2.0`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-functions/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-functions/_latestVersion) > @@ -29,7 +29,7 @@ Functions and interpolations: > } > > dependencies { -> implementation 'space.kscience:kmath-functions:0.2.0-dev-7' +> implementation 'space.kscience:kmath-functions:0.2.0' > } > ``` > **Gradle Kotlin DSL:** @@ -45,6 +45,6 @@ Functions and interpolations: > } > > dependencies { -> implementation("space.kscience:kmath-functions:0.2.0-dev-7") +> implementation("space.kscience:kmath-functions:0.2.0") > } > ``` diff --git a/kmath-functions/build.gradle.kts b/kmath-functions/build.gradle.kts index 3af61a199..fc52c4981 100644 --- a/kmath-functions/build.gradle.kts +++ b/kmath-functions/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("ru.mipt.npm.mpp") + id("ru.mipt.npm.gradle.mpp") } kotlin.sourceSets.commonMain { diff --git a/kmath-geometry/build.gradle.kts b/kmath-geometry/build.gradle.kts index e27496a41..e99eee38b 100644 --- a/kmath-geometry/build.gradle.kts +++ b/kmath-geometry/build.gradle.kts @@ -1,4 +1,4 @@ -plugins { id("ru.mipt.npm.mpp") } +plugins { id("ru.mipt.npm.gradle.mpp") } kotlin.sourceSets.commonMain { dependencies { diff --git a/kmath-histograms/build.gradle.kts b/kmath-histograms/build.gradle.kts index 6031b3e85..1337e40aa 100644 --- a/kmath-histograms/build.gradle.kts +++ b/kmath-histograms/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("ru.mipt.npm.mpp") + id("ru.mipt.npm.gradle.mpp") } kscience { diff --git a/kmath-kotlingrad/build.gradle.kts b/kmath-kotlingrad/build.gradle.kts index bb76f096b..51292cbfb 100644 --- a/kmath-kotlingrad/build.gradle.kts +++ b/kmath-kotlingrad/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("ru.mipt.npm.jvm") + id("ru.mipt.npm.gradle.jvm") } dependencies { diff --git a/kmath-memory/build.gradle.kts b/kmath-memory/build.gradle.kts index fe7b591de..dbd68b042 100644 --- a/kmath-memory/build.gradle.kts +++ b/kmath-memory/build.gradle.kts @@ -1,6 +1,6 @@ plugins { - id("ru.mipt.npm.mpp") - id("ru.mipt.npm.native") + id("ru.mipt.npm.gradle.mpp") + id("ru.mipt.npm.gradle.native") } readme{ diff --git a/kmath-nd4j/README.md b/kmath-nd4j/README.md index 4cfd0427c..046c8127f 100644 --- a/kmath-nd4j/README.md +++ b/kmath-nd4j/README.md @@ -9,7 +9,7 @@ This subproject implements the following features: > #### Artifact: > -> This module artifact: `space.kscience:kmath-nd4j:0.2.0-dev-7`. +> This module artifact: `space.kscience:kmath-nd4j:0.2.0`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-nd4j/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-nd4j/_latestVersion) > @@ -28,7 +28,7 @@ This subproject implements the following features: > } > > dependencies { -> implementation 'space.kscience:kmath-nd4j:0.2.0-dev-7' +> implementation 'space.kscience:kmath-nd4j:0.2.0' > } > ``` > **Gradle Kotlin DSL:** @@ -44,7 +44,7 @@ This subproject implements the following features: > } > > dependencies { -> implementation("space.kscience:kmath-nd4j:0.2.0-dev-7") +> implementation("space.kscience:kmath-nd4j:0.2.0") > } > ``` diff --git a/kmath-nd4j/build.gradle.kts b/kmath-nd4j/build.gradle.kts index 391727c45..c801f8e51 100644 --- a/kmath-nd4j/build.gradle.kts +++ b/kmath-nd4j/build.gradle.kts @@ -1,7 +1,7 @@ import ru.mipt.npm.gradle.Maturity plugins { - id("ru.mipt.npm.jvm") + id("ru.mipt.npm.gradle.jvm") } dependencies { diff --git a/kmath-stat/build.gradle.kts b/kmath-stat/build.gradle.kts index 919857be8..67a96937c 100644 --- a/kmath-stat/build.gradle.kts +++ b/kmath-stat/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("ru.mipt.npm.mpp") + id("ru.mipt.npm.gradle.mpp") } kotlin.sourceSets { diff --git a/kmath-viktor/api/kmath-viktor.api b/kmath-viktor/api/kmath-viktor.api index 13da08a39..462e065bf 100644 --- a/kmath-viktor/api/kmath-viktor.api +++ b/kmath-viktor/api/kmath-viktor.api @@ -165,8 +165,6 @@ public final class space/kscience/kmath/viktor/ViktorNDStructure : space/kscienc public fun getDimension ()I public static fun getDimension-impl (Lorg/jetbrains/bio/viktor/F64Array;)I public final fun getF64Buffer ()Lorg/jetbrains/bio/viktor/F64Array; - public fun getFeature (Lkotlin/reflect/KClass;)Ljava/lang/Object; - public static fun getFeature-impl (Lorg/jetbrains/bio/viktor/F64Array;Lkotlin/reflect/KClass;)Ljava/lang/Object; public fun getShape ()[I public static fun getShape-impl (Lorg/jetbrains/bio/viktor/F64Array;)[I public fun hashCode ()I diff --git a/kmath-viktor/build.gradle.kts b/kmath-viktor/build.gradle.kts index 3c042174f..b79a25ea1 100644 --- a/kmath-viktor/build.gradle.kts +++ b/kmath-viktor/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("ru.mipt.npm.jvm") + id("ru.mipt.npm.gradle.jvm") } description = "Binding for https://github.com/JetBrains-Research/viktor" diff --git a/settings.gradle.kts b/settings.gradle.kts index c040f6e33..526a6ed21 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,5 +1,6 @@ pluginManagement { repositories { + mavenLocal() gradlePluginPortal() jcenter() maven("https://repo.kotlin.link") @@ -7,15 +8,15 @@ pluginManagement { maven("https://dl.bintray.com/kotlin/kotlinx") } - val toolsVersion = "0.7.7" + val toolsVersion = "0.8.0" val kotlinVersion = "1.4.30" plugins { id("kotlinx.benchmark") version "0.2.0-dev-20" - id("ru.mipt.npm.project") version toolsVersion - id("ru.mipt.npm.mpp") version toolsVersion - id("ru.mipt.npm.jvm") version toolsVersion - id("ru.mipt.npm.publish") version toolsVersion + id("ru.mipt.npm.gradle.project") version toolsVersion + id("ru.mipt.npm.gradle.mpp") version toolsVersion + id("ru.mipt.npm.gradle.jvm") version toolsVersion + id("ru.mipt.npm.gradle.publish") version toolsVersion kotlin("jvm") version kotlinVersion kotlin("plugin.allopen") version kotlinVersion } From 22dedb06cbd1de63503c64d59ab662f5b4a8a0e1 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 21 Feb 2021 16:17:57 +0300 Subject: [PATCH 087/150] Patch changelog --- CHANGELOG.md | 13 +++++++++++++ build.gradle.kts | 5 +---- settings.gradle.kts | 1 - 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bab5d17c0..c7033df7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,19 @@ ## [Unreleased] ### Added + +### Changed + +### Deprecated + +### Removed + +### Fixed + +### Security + +## [0.2.0] +### Added - `fun` annotation for SAM interfaces in library - Explicit `public` visibility for all public APIs - Better trigonometric and hyperbolic functions for `AutoDiffField` (https://github.com/mipt-npm/kmath/pull/140) diff --git a/build.gradle.kts b/build.gradle.kts index f0287f009..83123765d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,10 +1,7 @@ - plugins { id("ru.mipt.npm.gradle.project") } -internal val kmathVersion: String by extra("0.2.0") - allprojects { repositories { jcenter() @@ -21,7 +18,7 @@ allprojects { } group = "space.kscience" - version = kmathVersion + version = "0.2.0" } subprojects { diff --git a/settings.gradle.kts b/settings.gradle.kts index 526a6ed21..ce6eb339a 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,6 +1,5 @@ pluginManagement { repositories { - mavenLocal() gradlePluginPortal() jcenter() maven("https://repo.kotlin.link") From bc9d8a3ed21bedf5cad77bb7501b43cf1e19f9e8 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 21 Feb 2021 16:40:29 +0300 Subject: [PATCH 088/150] Fix landing readme --- README.md | 17 +++-------------- docs/templates/README-TEMPLATE.md | 17 +++-------------- 2 files changed, 6 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 7b8e11109..e524e1cf3 100644 --- a/README.md +++ b/README.md @@ -247,13 +247,12 @@ better than SciPy. ### Repositories -Release artifacts are accessible from bintray with following configuration (see documentation of -[Kotlin Multiplatform](https://kotlinlang.org/docs/reference/multiplatform.html) for more details): +Release and development artifacts are accessible from mipt-npm [Space](https://www.jetbrains.com/space/) repository `https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven` (see documentation of +[Kotlin Multiplatform](https://kotlinlang.org/docs/reference/multiplatform.html) for more details). The repository could be reached through [repo.kotlin.link](https://repo.kotlin.link) proxy: ```kotlin repositories { - maven("https://dl.bintray.com/mipt-npm/kscience") - // maven("https://dl.bintray.com/mipt-npm/dev") for dev versions + maven("https://repo.kotlin.link") } dependencies { @@ -264,16 +263,6 @@ dependencies { Gradle `6.0+` is required for multiplatform artifacts. -#### Development - -Development builds are uploaded to the separate repository: - -```kotlin -repositories { - maven("https://dl.bintray.com/mipt-npm/dev") -} -``` - ## Contributing The project requires a lot of additional work. The most important thing we need is a feedback about what features are diff --git a/docs/templates/README-TEMPLATE.md b/docs/templates/README-TEMPLATE.md index ec65c2db0..10bc7aab1 100644 --- a/docs/templates/README-TEMPLATE.md +++ b/docs/templates/README-TEMPLATE.md @@ -97,13 +97,12 @@ better than SciPy. ### Repositories -Release artifacts are accessible from bintray with following configuration (see documentation of -[Kotlin Multiplatform](https://kotlinlang.org/docs/reference/multiplatform.html) for more details): +Release and development artifacts are accessible from mipt-npm [Space](https://www.jetbrains.com/space/) repository `https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven` (see documentation of +[Kotlin Multiplatform](https://kotlinlang.org/docs/reference/multiplatform.html) for more details). The repository could be reached through [repo.kotlin.link](https://repo.kotlin.link) proxy: ```kotlin repositories { - maven("https://dl.bintray.com/mipt-npm/kscience") - // maven("https://dl.bintray.com/mipt-npm/dev") for dev versions + maven("https://repo.kotlin.link") } dependencies { @@ -114,16 +113,6 @@ dependencies { Gradle `6.0+` is required for multiplatform artifacts. -#### Development - -Development builds are uploaded to the separate repository: - -```kotlin -repositories { - maven("https://dl.bintray.com/mipt-npm/dev") -} -``` - ## Contributing The project requires a lot of additional work. The most important thing we need is a feedback about what features are From 16fcc1c412d61a57a660dbec4b0fab799aad8122 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 21 Feb 2021 16:58:43 +0300 Subject: [PATCH 089/150] Remove bintray badge. --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index e524e1cf3..f598651c4 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,6 @@ ![Gradle build](https://github.com/mipt-npm/kmath/workflows/Gradle%20build/badge.svg) -Bintray: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-core/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-core/_latestVersion) - -Bintray-dev: [ ![Download](https://api.bintray.com/packages/mipt-npm/dev/kmath-core/images/download.svg) ](https://bintray.com/mipt-npm/dev/kmath-core/_latestVersion) - # KMath Could be pronounced as `key-math`. The **K**otlin **Math**ematics library was initially intended as a Kotlin-based analog to From 72affcf09b685f03142bb51f1c508895e796686e Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 22 Feb 2021 21:04:08 +0300 Subject: [PATCH 090/150] update build tools --- README.md | 4 ++-- settings.gradle.kts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e524e1cf3..e9cf64ea0 100644 --- a/README.md +++ b/README.md @@ -256,8 +256,8 @@ repositories { } dependencies { - api("kscience.kmath:kmath-core:0.2.0") - // api("kscience.kmath:kmath-core-jvm:0.2.0") for jvm-specific version + api("kscience.kmath:kmath-core:() -> kotlin.Any") + // api("kscience.kmath:kmath-core-jvm:() -> kotlin.Any") for jvm-specific version } ``` diff --git a/settings.gradle.kts b/settings.gradle.kts index ce6eb339a..cadbfd7ba 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -7,7 +7,7 @@ pluginManagement { maven("https://dl.bintray.com/kotlin/kotlinx") } - val toolsVersion = "0.8.0" + val toolsVersion = "0.8.1" val kotlinVersion = "1.4.30" plugins { From 9f663ae7f71e6c958d0c8114945d24cb29fcc7e7 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Fri, 26 Feb 2021 21:50:06 +0700 Subject: [PATCH 091/150] Update dependencies --- kmath-ast/build.gradle.kts | 12 +++++++----- .../kotlin/space/kscience/kmath/ast/parser.kt | 8 ++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/kmath-ast/build.gradle.kts b/kmath-ast/build.gradle.kts index 894279695..5b764459c 100644 --- a/kmath-ast/build.gradle.kts +++ b/kmath-ast/build.gradle.kts @@ -33,21 +33,23 @@ kotlin.sourceSets { jsMain { dependencies { - implementation(npm("astring", "1.4.3")) + implementation(npm("astring", "1.7.0")) } } jvmMain { dependencies { - api("com.github.h0tk3y.betterParse:better-parse:0.4.0") - implementation("org.ow2.asm:asm:9.0") - implementation("org.ow2.asm:asm-commons:9.0") + api("com.github.h0tk3y.betterParse:better-parse:0.4.1") + implementation("org.ow2.asm:asm:9.1") + implementation("org.ow2.asm:asm-commons:9.1") } } } //Workaround for https://github.com/Kotlin/dokka/issues/1455 -tasks.getByName("dokkaHtml").dependsOn(tasks.getByName("build")) +tasks.dokkaHtml { + dependsOn(tasks.build) +} readme { maturity = Maturity.PROTOTYPE diff --git a/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/ast/parser.kt b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/ast/parser.kt index 4d8204383..be4aff34f 100644 --- a/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/ast/parser.kt +++ b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/ast/parser.kt @@ -1,4 +1,4 @@ -// TODO move to common when https://github.com/h0tk3y/better-parse/pull/33 is merged +// TODO move to common when https://github.com/h0tk3y/better-parse/pull/37 is merged package space.kscience.kmath.ast @@ -25,8 +25,8 @@ import space.kscience.kmath.operations.SpaceOperations */ public object ArithmeticsEvaluator : Grammar() { // TODO replace with "...".toRegex() when better-parse 0.4.1 is released - private val num: Token by regexToken("[\\d.]+(?:[eE][-+]?\\d+)?") - private val id: Token by regexToken("[a-z_A-Z][\\da-z_A-Z]*") + private val num: Token by regexToken("[\\d.]+(?:[eE][-+]?\\d+)?".toRegex()) + private val id: Token by regexToken("[a-z_A-Z][\\da-z_A-Z]*".toRegex()) private val lpar: Token by literalToken("(") private val rpar: Token by literalToken(")") private val comma: Token by literalToken(",") @@ -35,7 +35,7 @@ public object ArithmeticsEvaluator : Grammar() { private val div: Token by literalToken("/") private val minus: Token by literalToken("-") private val plus: Token by literalToken("+") - private val ws: Token by regexToken("\\s+", ignore = true) + private val ws: Token by regexToken("\\s+".toRegex(), ignore = true) private val number: Parser by num use { MST.Numeric(text.toDouble()) } private val singular: Parser by id use { MST.Symbolic(text) } From aa69c8fde464470c0db9907dafe499621581c9f3 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sat, 27 Feb 2021 09:56:50 +0300 Subject: [PATCH 092/150] Update README.md JS-IR badge --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f598651c4..6f2675425 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ [![JetBrains Research](https://jb.gg/badges/research.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub) [![DOI](https://zenodo.org/badge/129486382.svg)](https://zenodo.org/badge/latestdoi/129486382) - ![Gradle build](https://github.com/mipt-npm/kmath/workflows/Gradle%20build/badge.svg) +[![Kotlin JS IR supported](https://img.shields.io/badge/Kotlin%2FJS-IR%20supported-yellow)](https://kotl.in/jsirsupported) + # KMath Could be pronounced as `key-math`. The **K**otlin **Math**ematics library was initially intended as a Kotlin-based analog to From d0cf16c8a616c338b981c6b7b38935811de1530f Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 28 Feb 2021 17:06:47 +0700 Subject: [PATCH 093/150] Rework GA workflows --- .github/workflows/build.yml | 110 ++++++-------------------------- .github/workflows/deploy.yml | 43 +++++++++++++ .github/workflows/release.yml | 117 ---------------------------------- build.gradle.kts | 15 ++++- gradle.properties | 1 + 5 files changed, 75 insertions(+), 211 deletions(-) create mode 100644 .github/workflows/deploy.yml delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 626062abf..56f8721eb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,107 +1,35 @@ -name: Gradle build - +name: build on: [ push ] jobs: - build-ubuntu: - runs-on: ubuntu-20.04 - + build: + strategy: + matrix: + os: [ macOS-latest, windows-latest ] + runs-on: ${{matrix.os}} steps: - - uses: actions/checkout@v2 + - name: Checkout the repo + uses: actions/checkout@v2 - name: Set up JDK 11 uses: actions/setup-java@v1 with: java-version: 11 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Install Chrome - run: | - sudo apt install -y libappindicator1 fonts-liberation - 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: - path: | - .gradle - build - ~/.gradle - key: gradle - restore-keys: gradle - - - name: Cache konan - uses: actions/cache@v2 - with: - path: | - ~/.konan/dependencies - ~/.konan/kotlin-native-prebuilt-linux-* - key: ${{ runner.os }}-konan - restore-keys: ${{ runner.os }}-konan - - name: Build with Gradle - run: ./gradlew -Dorg.gradle.daemon=false --build-cache 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: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Cache gradle - uses: actions/cache@v2 - with: - path: | - .gradle - build - ~/.gradle - key: gradle - restore-keys: gradle - - - name: Cache konan - uses: actions/cache@v2 - with: - path: | - ~/.konan/dependencies - ~/.konan/kotlin-native-prebuilt-macos-* - key: ${{ runner.os }}-konan - restore-keys: ${{ runner.os }}-konan - - name: Build with Gradle - run: sudo ./gradlew -Dorg.gradle.daemon=false --build-cache 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: Grant execute permission for gradlew - run: chmod +x gradlew - name: Add msys to path + if: matrix.os == 'windows-latest' run: SETX PATH "%PATH%;C:\msys64\mingw64\bin" - name: Cache gradle uses: actions/cache@v2 with: - path: | - .gradle - build - ~/.gradle - key: ${{ runner.os }}-gradle - restore-keys: ${{ runner.os }}-gradle - + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }} + restore-keys: | + ${{ runner.os }}-gradle- - name: Cache konan uses: actions/cache@v2 with: - path: | - ~/.konan/dependencies - ~/.konan/kotlin-native-prebuilt-mingw-* - key: ${{ runner.os }}-konan - restore-keys: ${{ runner.os }}-konan - - name: Build with Gradle - run: ./gradlew --build-cache build + path: ~/.konan + key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Build + run: ./gradlew build --no-daemon --stacktrace diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 000000000..83be65b50 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,43 @@ +name: deploy +on: workflow_dispatch + +jobs: + build: + strategy: + matrix: + os: [macOS-latest, windows-latest] + runs-on: ${{matrix.os}} + steps: + - name: Checkout the repo + uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Add msys to path + if: matrix.os == 'windows-latest' + run: SETX PATH "%PATH%;C:\msys64\mingw64\bin" + - name: Cache gradle + uses: actions/cache@v2 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Cache konan + uses: actions/cache@v2 + with: + path: ~/.konan + key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Publish Mac Artifacts + if: matrix.os == 'macOS-latest' + run: ./gradlew publish --no-daemon --stacktrace -PsonatypePublish=true -PsonatypeUser=${{ secrets.SONATYPE_USERNAME }} -PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }} + env: + signingKey: ${{ secrets.SIGNING_KEY }} + - name: Publish Windows Artifacts + if: matrix.os == 'windows-latest' + run: ./gradlew publish --no-daemon --stacktrace -PsonatypePublish=true -PsonatypeUser=${{ secrets.SONATYPE_USERNAME }} -PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }} + env: + signingKey: ${{ secrets.SIGNING_KEY }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 743520885..000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,117 +0,0 @@ -name: Gradle release - -on: - release: - types: - - created - -jobs: - build-ubuntu: - runs-on: ubuntu-20.04 - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Install Chrome - run: | - sudo apt install -y libappindicator1 fonts-liberation - 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: - path: | - .gradle - build - ~/.gradle - key: gradle - restore-keys: gradle - - - name: Cache konan - uses: actions/cache@v2 - with: - path: | - ~/.konan/dependencies - ~/.konan/kotlin-native-prebuilt-linux-* - key: ${{ runner.os }}-konan - restore-keys: ${{ runner.os }}-konan - - name: Build with Gradle - run: ./gradlew -Dorg.gradle.daemon=false --build-cache build - - name: Run release task - run: ./gradlew release -PbintrayUser=${{ secrets.BINTRAY_USER }} -PbintrayApiKey=${{ secrets.BINTRAY_KEY }} - - 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: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Cache gradle - uses: actions/cache@v2 - with: - path: | - .gradle - build - ~/.gradle - key: gradle - restore-keys: gradle - - - name: Cache konan - uses: actions/cache@v2 - with: - path: | - ~/.konan/dependencies - ~/.konan/kotlin-native-prebuilt-macos-* - key: ${{ runner.os }}-konan - restore-keys: ${{ runner.os }}-konan - - name: Build with Gradle - run: sudo ./gradlew -Dorg.gradle.daemon=false --build-cache build - - name: Run release task - run: ./gradlew release -PbintrayUser=${{ secrets.BINTRAY_USER }} -PbintrayApiKey=${{ secrets.BINTRAY_KEY }} - - 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: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Add msys to path - run: SETX PATH "%PATH%;C:\msys64\mingw64\bin" - - name: Cache gradle - uses: actions/cache@v2 - with: - path: | - .gradle - build - ~/.gradle - key: ${{ runner.os }}-gradle - restore-keys: ${{ runner.os }}-gradle - - - name: Cache konan - uses: actions/cache@v2 - with: - path: | - ~/.konan/dependencies - ~/.konan/kotlin-native-prebuilt-mingw-* - key: ${{ runner.os }}-konan - restore-keys: ${{ runner.os }}-konan - - name: Build with Gradle - run: ./gradlew --build-cache build - - name: Run release task - run: ./gradlew release -PbintrayUser=${{ secrets.BINTRAY_USER }} -PbintrayApiKey=${{ secrets.BINTRAY_KEY }} - diff --git a/build.gradle.kts b/build.gradle.kts index 83123765d..9e2b42a3c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,5 @@ +import ru.mipt.npm.gradle.KSciencePublishingPlugin + plugins { id("ru.mipt.npm.gradle.project") } @@ -22,7 +24,14 @@ allprojects { } subprojects { - if (name.startsWith("kmath")) apply() + if (name.startsWith("kmath")) { + apply() + + val publishWindows by tasks.creating { + tasks.find { it.name == "publishMingwX64PublicationToSpaceRepository" }?.let { dependsOn(it) } + tasks.find { it.name == "publishMingwX64PublicationToSonatypeRepository" }?.let { dependsOn(it) } + } + } } readme { @@ -35,6 +44,6 @@ ksciencePublish { githubProject = "kmath" } -apiValidation{ +apiValidation { nonPublicMarkers.add("space.kscience.kmath.misc.UnstableKMathAPI") -} \ No newline at end of file +} diff --git a/gradle.properties b/gradle.properties index 88b90f27b..1a2a263ac 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,6 +3,7 @@ kotlin.mpp.enableGranularSourceSetsMetadata=true kotlin.mpp.stability.nowarn=true kotlin.native.enableDependencyPropagation=false kotlin.parallel.tasks.in.project=true +org.gradle.configureondemand=true org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m org.gradle.parallel=true systemProp.org.gradle.internal.publish.checksums.insecure=true From 13792b07b2eb9670654d52b44eefc739820bad90 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 28 Feb 2021 17:14:41 +0700 Subject: [PATCH 094/150] Add Touchlab notice --- .github/workflows/build.yml | 2 ++ .github/workflows/deploy.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 56f8721eb..3b9005997 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,3 +1,5 @@ +# Based on https://github.com/touchlab/Stately/blob/main/.github/workflows/build.yml + name: build on: [ push ] diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 83be65b50..40a703309 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,3 +1,5 @@ +# Based on https://github.com/touchlab/Stately/blob/main/.github/workflows/deploy.yml + name: deploy on: workflow_dispatch From a68b102e401ab7524de30130f11487ca931c3151 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 28 Feb 2021 20:23:02 +0700 Subject: [PATCH 095/150] Update deploy.yml --- .github/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 40a703309..9fcdec036 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -35,11 +35,11 @@ jobs: ${{ runner.os }}-gradle- - name: Publish Mac Artifacts if: matrix.os == 'macOS-latest' - run: ./gradlew publish --no-daemon --stacktrace -PsonatypePublish=true -PsonatypeUser=${{ secrets.SONATYPE_USERNAME }} -PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }} + run: ./gradlew publishAllPublicationsToSpaceRepository publishAllPublicationsToSonatypeRepository --no-daemon --stacktrace -PsonatypePublish=true -PsonatypeUser=${{ secrets.SONATYPE_USERNAME }} -PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }} env: signingKey: ${{ secrets.SIGNING_KEY }} - name: Publish Windows Artifacts if: matrix.os == 'windows-latest' - run: ./gradlew publish --no-daemon --stacktrace -PsonatypePublish=true -PsonatypeUser=${{ secrets.SONATYPE_USERNAME }} -PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }} + run: ./gradlew publishMingwX64PublicationToSpaceRepository publishMingwX64PublicationToSonatypeRepository --no-daemon --stacktrace -PsonatypePublish=true -PsonatypeUser=${{ secrets.SONATYPE_USERNAME }} -PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }} env: signingKey: ${{ secrets.SIGNING_KEY }} From 4ec33c6857f164ae58dc5408eb4180b7b26dbcd1 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 28 Feb 2021 20:23:16 +0700 Subject: [PATCH 096/150] Remove publishWindows task --- build.gradle.kts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 9e2b42a3c..cb3cb1a3b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -24,14 +24,7 @@ allprojects { } subprojects { - if (name.startsWith("kmath")) { - apply() - - val publishWindows by tasks.creating { - tasks.find { it.name == "publishMingwX64PublicationToSpaceRepository" }?.let { dependsOn(it) } - tasks.find { it.name == "publishMingwX64PublicationToSonatypeRepository" }?.let { dependsOn(it) } - } - } + if (name.startsWith("kmath")) apply() } readme { From 30bd56d0f71261d20533d8720500be6faf96d265 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sun, 28 Feb 2021 21:29:21 +0700 Subject: [PATCH 097/150] Support space credentials --- .github/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9fcdec036..997755816 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -35,11 +35,11 @@ jobs: ${{ runner.os }}-gradle- - name: Publish Mac Artifacts if: matrix.os == 'macOS-latest' - run: ./gradlew publishAllPublicationsToSpaceRepository publishAllPublicationsToSonatypeRepository --no-daemon --stacktrace -PsonatypePublish=true -PsonatypeUser=${{ secrets.SONATYPE_USERNAME }} -PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }} + run: ./gradlew publishAllPublicationsToSpaceRepository publishAllPublicationsToSonatypeRepository --no-daemon --stacktrace -PsonatypePublish=true -PsonatypeUser=${{ secrets.SONATYPE_USERNAME }} -PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }} -PspaceUser=${{ secrets.SPACE_USERNAME }} -PspacePassword=${{ secrets.SPACE_PASSWORD }} env: signingKey: ${{ secrets.SIGNING_KEY }} - name: Publish Windows Artifacts if: matrix.os == 'windows-latest' - run: ./gradlew publishMingwX64PublicationToSpaceRepository publishMingwX64PublicationToSonatypeRepository --no-daemon --stacktrace -PsonatypePublish=true -PsonatypeUser=${{ secrets.SONATYPE_USERNAME }} -PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }} + run: ./gradlew publishAllPublicationsToSpaceRepository publishAllPublicationsToSonatypeRepository --no-daemon --stacktrace -PsonatypePublish=true -PsonatypeUser=${{ secrets.SONATYPE_USERNAME }} -PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }} -PspaceUser=${{ secrets.SPACE_USERNAME }} -PspacePassword=${{ secrets.SPACE_PASSWORD }} env: signingKey: ${{ secrets.SIGNING_KEY }} From 477f7dd0799c67882f67742b30feb004a658f9f7 Mon Sep 17 00:00:00 2001 From: Roland Grinis Date: Mon, 1 Mar 2021 13:01:15 +0000 Subject: [PATCH 098/150] Deprecating div methods --- .../kscience/kmath/operations/Algebra.kt | 1 + .../kscience/kmath/nd4j/Nd4jArrayAlgebra.kt | 1 + .../src/cppMain/.vscode/c_cpp_properties.json | 21 ++++++ kmath-torch/src/cppMain/.vscode/settings.json | 71 ++++++++++++++++++ .../java/kscience/kmath/torch/JTorch.class | Bin 0 -> 3022 bytes 5 files changed, 94 insertions(+) create mode 100644 kmath-torch/src/cppMain/.vscode/c_cpp_properties.json create mode 100644 kmath-torch/src/cppMain/.vscode/settings.json create mode 100644 kmath-torch/src/jvmMain/java/kscience/kmath/torch/JTorch.class diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt index 201e39314..572f7089a 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt @@ -175,6 +175,7 @@ public interface SpaceOperations : Algebra { * @param k the divisor. * @return the quotient. */ + @Deprecated("Dividing not allowed in a Ring") public operator fun T.div(k: Number): T = multiply(this, 1.0 / k.toDouble()) /** diff --git a/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt index 1e9818a4a..c50174b95 100644 --- a/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt +++ b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt @@ -96,6 +96,7 @@ public interface Nd4jArraySpace> : NDSpace, Nd4jArrayAlgeb return a.ndArray.mul(k).wrap() } + @Deprecated("Avoid using this method, underlying array get casted to Doubles") public override operator fun NDStructure.div(k: Number): Nd4jArrayStructure { return ndArray.div(k).wrap() } diff --git a/kmath-torch/src/cppMain/.vscode/c_cpp_properties.json b/kmath-torch/src/cppMain/.vscode/c_cpp_properties.json new file mode 100644 index 000000000..711f47bff --- /dev/null +++ b/kmath-torch/src/cppMain/.vscode/c_cpp_properties.json @@ -0,0 +1,21 @@ +{ + "configurations": [ + { + "name": "Linux", + "includePath": [ + "${workspaceFolder}/**", + "${env:HOME}/miniconda3/envs/ghmc/include", + "${env:HOME}/miniconda3/envs/ghmc/include/python3.8", + "${env:HOME}/miniconda3/envs/ghmc/include/torch/csrc/api/include", + "${env:HOME}/.jdks/openjdk-15.0.2/include", + "${env:HOME}/.jdks/openjdk-15.0.2/include/linux" + ], + "defines": [], + "compilerPath": "/usr/bin/gcc", + "cStandard": "gnu11", + "cppStandard": "gnu++17", + "intelliSenseMode": "gcc-x64" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/kmath-torch/src/cppMain/.vscode/settings.json b/kmath-torch/src/cppMain/.vscode/settings.json new file mode 100644 index 000000000..fd26c7488 --- /dev/null +++ b/kmath-torch/src/cppMain/.vscode/settings.json @@ -0,0 +1,71 @@ +{ + "python.linting.pylintEnabled": false, + "python.linting.mypyEnabled": true, + "python.linting.enabled": false, + "files.associations": { + "chrono": "cpp", + "cctype": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "array": "cpp", + "atomic": "cpp", + "*.tcc": "cpp", + "cinttypes": "cpp", + "complex": "cpp", + "condition_variable": "cpp", + "cstdint": "cpp", + "deque": "cpp", + "forward_list": "cpp", + "list": "cpp", + "unordered_map": "cpp", + "unordered_set": "cpp", + "vector": "cpp", + "exception": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "iterator": "cpp", + "map": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "optional": "cpp", + "random": "cpp", + "ratio": "cpp", + "set": "cpp", + "string": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "fstream": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "mutex": "cpp", + "new": "cpp", + "ostream": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "thread": "cpp", + "typeindex": "cpp", + "typeinfo": "cpp", + "valarray": "cpp", + "variant": "cpp", + "future": "cpp", + "bit": "cpp" + }, + "python.pythonPath": "${env:HOME}/miniconda3/envs/ghmc/bin/python" +} \ No newline at end of file diff --git a/kmath-torch/src/jvmMain/java/kscience/kmath/torch/JTorch.class b/kmath-torch/src/jvmMain/java/kscience/kmath/torch/JTorch.class new file mode 100644 index 0000000000000000000000000000000000000000..d3ce6fcc9b61d2acc35c9bd9c5d5978314a56454 GIT binary patch literal 3022 zcmZWrXL}n(5T1*za*{0B0n3E0MfO*=_z>1^pvxjV@*z4zXG z@89?Y4ci-WM)$w3bC87LHB42nBK7dE3<^(@GD z1GhEjH9|Msv|!Si+frYML(gwdPc3C&+=4ypQPWd?QMsZA|mcyrKlYtih`^}0G73tF}y zgVPt3YGJyn*N-_N+m`az_O0ws>B zY22BLhev>H+>@-{Db>XVak$WN`)U^J=ZesuClZfDi&>kZrDodW8lEQ8e-f-t6P@(X+@dV8+nUHnGee|w(cGPU?DbS+WK&Ls6Ui|vswt<+q|Kxj+R=zP!f2a%aDvCT>p20lIp z$7mWJFSn6QE+u0#wG`t)+VOG0Q>4GVlmBs<5Iq5#YpYZ8slz=<#%7w`4caEjQZi1w z5k4vM2$Yhs@uu;C>J9KaR?q{(PiS-AYjux0d-rCWm; z7oyFc@{+XJvCNK8og8?fijIaZ>d==CU#${;O6GSs@G$fIQcJ~dvs1-)3nTjYeiq$9 z9JDdotV*|WnLqR7>8L2#h3rhTE6;syAsB>BRrTnl&Fi=L06pNa7fSf6f&Q)HAO3Ct zy!1Fa578oK|LpD4=!T77%pMF6fR?Q#GVq|FL=4&6>ufbI{;)?9E8w78Jo7lct z@D|~xVTSoz;UME}qJO*iXWw<6Uq!RHe&}o#x+=H>_U&x zhk&sUCmBPC7-JYP4yDf Date: Mon, 1 Mar 2021 15:03:10 +0000 Subject: [PATCH 099/150] Adding .vscode to .gitignore --- .gitignore | 1 + .../src/cppMain/.vscode/c_cpp_properties.json | 21 ------ kmath-torch/src/cppMain/.vscode/settings.json | 71 ------------------ .../java/kscience/kmath/torch/JTorch.class | Bin 3022 -> 0 bytes 4 files changed, 1 insertion(+), 92 deletions(-) delete mode 100644 kmath-torch/src/cppMain/.vscode/c_cpp_properties.json delete mode 100644 kmath-torch/src/cppMain/.vscode/settings.json delete mode 100644 kmath-torch/src/jvmMain/java/kscience/kmath/torch/JTorch.class diff --git a/.gitignore b/.gitignore index bade7f08c..ea8e65fb4 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ build/ out/ .idea/ +.vscode/ # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) !gradle-wrapper.jar diff --git a/kmath-torch/src/cppMain/.vscode/c_cpp_properties.json b/kmath-torch/src/cppMain/.vscode/c_cpp_properties.json deleted file mode 100644 index 711f47bff..000000000 --- a/kmath-torch/src/cppMain/.vscode/c_cpp_properties.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "configurations": [ - { - "name": "Linux", - "includePath": [ - "${workspaceFolder}/**", - "${env:HOME}/miniconda3/envs/ghmc/include", - "${env:HOME}/miniconda3/envs/ghmc/include/python3.8", - "${env:HOME}/miniconda3/envs/ghmc/include/torch/csrc/api/include", - "${env:HOME}/.jdks/openjdk-15.0.2/include", - "${env:HOME}/.jdks/openjdk-15.0.2/include/linux" - ], - "defines": [], - "compilerPath": "/usr/bin/gcc", - "cStandard": "gnu11", - "cppStandard": "gnu++17", - "intelliSenseMode": "gcc-x64" - } - ], - "version": 4 -} \ No newline at end of file diff --git a/kmath-torch/src/cppMain/.vscode/settings.json b/kmath-torch/src/cppMain/.vscode/settings.json deleted file mode 100644 index fd26c7488..000000000 --- a/kmath-torch/src/cppMain/.vscode/settings.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "python.linting.pylintEnabled": false, - "python.linting.mypyEnabled": true, - "python.linting.enabled": false, - "files.associations": { - "chrono": "cpp", - "cctype": "cpp", - "clocale": "cpp", - "cmath": "cpp", - "cstdarg": "cpp", - "cstddef": "cpp", - "cstdio": "cpp", - "cstdlib": "cpp", - "cstring": "cpp", - "ctime": "cpp", - "cwchar": "cpp", - "cwctype": "cpp", - "array": "cpp", - "atomic": "cpp", - "*.tcc": "cpp", - "cinttypes": "cpp", - "complex": "cpp", - "condition_variable": "cpp", - "cstdint": "cpp", - "deque": "cpp", - "forward_list": "cpp", - "list": "cpp", - "unordered_map": "cpp", - "unordered_set": "cpp", - "vector": "cpp", - "exception": "cpp", - "algorithm": "cpp", - "functional": "cpp", - "iterator": "cpp", - "map": "cpp", - "memory": "cpp", - "memory_resource": "cpp", - "numeric": "cpp", - "optional": "cpp", - "random": "cpp", - "ratio": "cpp", - "set": "cpp", - "string": "cpp", - "string_view": "cpp", - "system_error": "cpp", - "tuple": "cpp", - "type_traits": "cpp", - "utility": "cpp", - "fstream": "cpp", - "initializer_list": "cpp", - "iomanip": "cpp", - "iosfwd": "cpp", - "iostream": "cpp", - "istream": "cpp", - "limits": "cpp", - "mutex": "cpp", - "new": "cpp", - "ostream": "cpp", - "sstream": "cpp", - "stdexcept": "cpp", - "streambuf": "cpp", - "thread": "cpp", - "typeindex": "cpp", - "typeinfo": "cpp", - "valarray": "cpp", - "variant": "cpp", - "future": "cpp", - "bit": "cpp" - }, - "python.pythonPath": "${env:HOME}/miniconda3/envs/ghmc/bin/python" -} \ No newline at end of file diff --git a/kmath-torch/src/jvmMain/java/kscience/kmath/torch/JTorch.class b/kmath-torch/src/jvmMain/java/kscience/kmath/torch/JTorch.class deleted file mode 100644 index d3ce6fcc9b61d2acc35c9bd9c5d5978314a56454..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3022 zcmZWrXL}n(5T1*za*{0B0n3E0MfO*=_z>1^pvxjV@*z4zXG z@89?Y4ci-WM)$w3bC87LHB42nBK7dE3<^(@GD z1GhEjH9|Msv|!Si+frYML(gwdPc3C&+=4ypQPWd?QMsZA|mcyrKlYtih`^}0G73tF}y zgVPt3YGJyn*N-_N+m`az_O0ws>B zY22BLhev>H+>@-{Db>XVak$WN`)U^J=ZesuClZfDi&>kZrDodW8lEQ8e-f-t6P@(X+@dV8+nUHnGee|w(cGPU?DbS+WK&Ls6Ui|vswt<+q|Kxj+R=zP!f2a%aDvCT>p20lIp z$7mWJFSn6QE+u0#wG`t)+VOG0Q>4GVlmBs<5Iq5#YpYZ8slz=<#%7w`4caEjQZi1w z5k4vM2$Yhs@uu;C>J9KaR?q{(PiS-AYjux0d-rCWm; z7oyFc@{+XJvCNK8og8?fijIaZ>d==CU#${;O6GSs@G$fIQcJ~dvs1-)3nTjYeiq$9 z9JDdotV*|WnLqR7>8L2#h3rhTE6;syAsB>BRrTnl&Fi=L06pNa7fSf6f&Q)HAO3Ct zy!1Fa578oK|LpD4=!T77%pMF6fR?Q#GVq|FL=4&6>ufbI{;)?9E8w78Jo7lct z@D|~xVTSoz;UME}qJO*iXWw<6Uq!RHe&}o#x+=H>_U&x zhk&sUCmBPC7-JYP4yDf Date: Mon, 1 Mar 2021 15:15:19 +0000 Subject: [PATCH 100/150] JNI generated files added to .gitignore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index ea8e65fb4..07589aa00 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,7 @@ out/ # Cache of project .gradletasknamecache + +# Generated by javac -h and runtime +*.class +*.log From 8ae8ebe871c8ece0964f98b7062fbe1b10278d1f Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 8 Mar 2021 21:03:48 +0300 Subject: [PATCH 101/150] Fully refactor algebra split ScaleOperations from Space. --- .github/workflows/build.yml | 3 +- .github/workflows/{deploy.yml => publish.yml} | 38 +- CHANGELOG.md | 5 + build.gradle.kts | 7 +- .../space/kscience/kmath/ast/expressions.kt | 4 +- .../kmath/structures/ParallelRealNDField.kt | 38 +- gradle.properties | 7 +- gradle/wrapper/gradle-wrapper.properties | 2 +- .../space/kscience/kmath/ast/MstAlgebra.kt | 58 ++- .../TestESTreeConsistencyWithInterpreter.kt | 24 +- .../asm/TestAsmConsistencyWithInterpreter.kt | 24 +- .../DerivativeStructureExpression.kt | 13 +- .../kscience/kmath/commons/linear/CMMatrix.kt | 4 +- .../space/kscience/kmath/complex/Complex.kt | 28 +- .../kscience/kmath/complex/ComplexNDField.kt | 35 +- .../kscience/kmath/complex/Quaternion.kt | 20 +- .../complex/ExpressionFieldForComplexTest.kt | 6 +- kmath-core/README.md | 55 -- kmath-core/api/kmath-core.api | 480 +++++------------- .../kmath/domains/HyperSquareDomain.kt | 19 +- .../kscience/kmath/domains/RealDomain.kt | 30 +- .../kmath/domains/UnconstrainedDomain.kt | 12 +- .../kmath/domains/UnivariateDomain.kt | 31 +- .../FunctionalExpressionAlgebra.kt | 35 +- .../kmath/expressions/SimpleAutoDiff.kt | 127 ++--- .../kscience/kmath/linear/BufferMatrix.kt | 12 +- .../kscience/kmath/linear/MatrixContext.kt | 11 +- .../kmath/linear/RealMatrixContext.kt | 18 +- .../kscience/kmath/linear/VectorSpace.kt | 35 +- .../kscience/kmath/nd/BufferNDAlgebra.kt | 27 +- .../space/kscience/kmath/nd/NDAlgebra.kt | 32 +- .../space/kscience/kmath/nd/RealNDField.kt | 8 +- .../space/kscience/kmath/nd/ShortNDRing.kt | 4 +- .../kscience/kmath/operations/Algebra.kt | 57 +-- .../kmath/operations/AlgebraElements.kt | 51 +- .../space/kscience/kmath/operations/BigInt.kt | 17 +- .../kmath/operations/NumericAlgebra.kt | 45 +- .../kmath/operations/OptionalOperations.kt | 202 ++++---- .../kmath/operations/algebraExtensions.kt | 12 +- .../kscience/kmath/operations/numbers.kt | 65 +-- .../kmath/structures/RealBufferField.kt | 45 +- .../kmath/expressions/ExpressionFieldTest.kt | 4 +- .../kscience/kmath/testutils/FieldVerifier.kt | 5 +- .../kscience/kmath/testutils/RingVerifier.kt | 6 +- .../kscience/kmath/testutils/SpaceVerifier.kt | 10 +- .../kscience/kmath/operations/BigNumbers.kt | 17 +- .../space/kscience/kmath/chains/flowExtra.kt | 4 +- .../kscience/kmath/ejml/EjmlMatrixContext.kt | 10 +- .../kscience/kmath/functions/Polynomial.kt | 15 +- .../kmath/interpolation/SplineInterpolator.kt | 6 +- .../kmath/geometry/Euclidean2DSpace.kt | 9 +- .../kmath/geometry/Euclidean3DSpace.kt | 10 +- .../kmath/histogram/IndexedHistogramSpace.kt | 14 +- .../kmath/histogram/RealHistogramSpace.kt | 4 + .../kmath/histogram/TreeHistogramSpace.kt | 11 +- .../kmath/histogram/UnivariateHistogram.kt | 2 + .../kscience/kmath/nd4j/Nd4jArrayAlgebra.kt | 27 +- .../kscience/kmath/stat/SamplerAlgebra.kt | 15 +- .../space/kscience/kmath/stat/Statistic.kt | 20 +- kmath-viktor/api/kmath-viktor.api | 11 +- .../kmath/viktor/ViktorNDStructure.kt | 12 +- settings.gradle.kts | 7 +- 62 files changed, 869 insertions(+), 1096 deletions(-) rename .github/workflows/{deploy.yml => publish.yml} (52%) delete mode 100644 kmath-core/README.md diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3b9005997..25f2cfd0d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,5 @@ -# Based on https://github.com/touchlab/Stately/blob/main/.github/workflows/build.yml +name: Gradle build -name: build on: [ push ] jobs: diff --git a/.github/workflows/deploy.yml b/.github/workflows/publish.yml similarity index 52% rename from .github/workflows/deploy.yml rename to .github/workflows/publish.yml index 997755816..42fa6d3b6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/publish.yml @@ -1,10 +1,15 @@ -# Based on https://github.com/touchlab/Stately/blob/main/.github/workflows/deploy.yml +name: Gradle publish -name: deploy -on: workflow_dispatch +on: + workflow_dispatch: + release: + types: + - created jobs: - build: + publish: + environment: + name: publish strategy: matrix: os: [macOS-latest, windows-latest] @@ -33,13 +38,22 @@ jobs: key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }} restore-keys: | ${{ runner.os }}-gradle- - - name: Publish Mac Artifacts - if: matrix.os == 'macOS-latest' - run: ./gradlew publishAllPublicationsToSpaceRepository publishAllPublicationsToSonatypeRepository --no-daemon --stacktrace -PsonatypePublish=true -PsonatypeUser=${{ secrets.SONATYPE_USERNAME }} -PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }} -PspaceUser=${{ secrets.SPACE_USERNAME }} -PspacePassword=${{ secrets.SPACE_PASSWORD }} - env: - signingKey: ${{ secrets.SIGNING_KEY }} - name: Publish Windows Artifacts if: matrix.os == 'windows-latest' - run: ./gradlew publishAllPublicationsToSpaceRepository publishAllPublicationsToSonatypeRepository --no-daemon --stacktrace -PsonatypePublish=true -PsonatypeUser=${{ secrets.SONATYPE_USERNAME }} -PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }} -PspaceUser=${{ secrets.SPACE_USERNAME }} -PspacePassword=${{ secrets.SPACE_PASSWORD }} - env: - signingKey: ${{ secrets.SIGNING_KEY }} + run: > + ./gradlew release --no-daemon + -Ppublishing.enabled=true + -Ppublishing.github.user=${{ secrets.PUBLISHING_GITHUB_USER }} + -Ppublishing.github.token=${{ secrets.PUBLISHING_GITHUB_TOKEN }} + -Ppublishing.space.user=${{ secrets.PUBLISHING_SPACE_USER }} + -Ppublishing.space.token=${{ secrets.PUBLISHING_SPACE_TOKEN }} + - name: Publish Mac Artifacts + if: matrix.os == 'macOS-latest' + run: > + ./gradlew release --no-daemon + -Ppublishing.enabled=true + -Ppublishing.platform=macosX64 + -Ppublishing.github.user=${{ secrets.PUBLISHING_GITHUB_USER }} + -Ppublishing.github.token=${{ secrets.PUBLISHING_GITHUB_TOKEN }} + -Ppublishing.space.user=${{ secrets.PUBLISHING_SPACE_USER }} + -Ppublishing.space.token=${{ secrets.PUBLISHING_SPACE_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index c7033df7f..db3b65024 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,17 @@ ## [Unreleased] ### Added +- Intrinsic value `two` for ExtendedField to work with hyperbolic functions +- ScaleOperations interface ### Changed +- Exponential operations merged with hyperbolic functions ### Deprecated ### Removed +- Nearest in Domain. To be implemented in geometry package. +- Number multiplication and division in main Algebra chain ### Fixed diff --git a/build.gradle.kts b/build.gradle.kts index cb3cb1a3b..41e8a3468 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -20,7 +20,7 @@ allprojects { } group = "space.kscience" - version = "0.2.0" + version = "0.3.0" } subprojects { @@ -32,9 +32,8 @@ readme { } ksciencePublish { - spaceRepo = "https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven" - bintrayRepo = "kscience" - githubProject = "kmath" + github("kmath") + space() } apiValidation { diff --git a/examples/src/main/kotlin/space/kscience/kmath/ast/expressions.kt b/examples/src/main/kotlin/space/kscience/kmath/ast/expressions.kt index ee0f4a492..8d6851ef8 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/ast/expressions.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/ast/expressions.kt @@ -6,10 +6,10 @@ import space.kscience.kmath.operations.RealField fun main() { val expr = RealField.mstInField { val x = bindSymbol("x") - x * 2.0 + 2.0 / x - 16.0 + x * 2.0 + 2.0 * one / x - 16.0 } - repeat(10000000){ + repeat(10000000) { expr.invoke("x" to 1.0) } } \ No newline at end of file diff --git a/examples/src/main/kotlin/space/kscience/kmath/structures/ParallelRealNDField.kt b/examples/src/main/kotlin/space/kscience/kmath/structures/ParallelRealNDField.kt index 111cfec80..0c914468d 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/structures/ParallelRealNDField.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/structures/ParallelRealNDField.kt @@ -3,8 +3,8 @@ package space.kscience.kmath.structures import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.nd.* import space.kscience.kmath.operations.ExtendedField +import space.kscience.kmath.operations.NumbersAddOperations import space.kscience.kmath.operations.RealField -import space.kscience.kmath.operations.RingWithNumbers import java.util.* import java.util.stream.IntStream @@ -15,7 +15,7 @@ import java.util.stream.IntStream class StreamRealNDField( override val shape: IntArray, ) : NDField, - RingWithNumbers>, + NumbersAddOperations>, ExtendedField> { private val strides = DefaultStrides(shape) @@ -79,25 +79,29 @@ class StreamRealNDField( return NDBuffer(strides, array.asBuffer()) } - override fun power(arg: NDStructure, pow: Number): NDBuffer = arg.map() { power(it, pow) } + override fun NDStructure.unaryMinus(): NDStructure = map { -it } - override fun exp(arg: NDStructure): NDBuffer = arg.map() { exp(it) } + override fun scale(a: NDStructure, value: Double): NDStructure = a.map { it * value } - override fun ln(arg: NDStructure): NDBuffer = arg.map() { ln(it) } + override fun power(arg: NDStructure, pow: Number): NDBuffer = arg.map { power(it, pow) } - override fun sin(arg: NDStructure): NDBuffer = arg.map() { sin(it) } - override fun cos(arg: NDStructure): NDBuffer = arg.map() { cos(it) } - override fun tan(arg: NDStructure): NDBuffer = arg.map() { tan(it) } - override fun asin(arg: NDStructure): NDBuffer = arg.map() { asin(it) } - override fun acos(arg: NDStructure): NDBuffer = arg.map() { acos(it) } - override fun atan(arg: NDStructure): NDBuffer = arg.map() { atan(it) } + override fun exp(arg: NDStructure): NDBuffer = arg.map { exp(it) } - override fun sinh(arg: NDStructure): NDBuffer = arg.map() { sinh(it) } - override fun cosh(arg: NDStructure): NDBuffer = arg.map() { cosh(it) } - override fun tanh(arg: NDStructure): NDBuffer = arg.map() { tanh(it) } - override fun asinh(arg: NDStructure): NDBuffer = arg.map() { asinh(it) } - override fun acosh(arg: NDStructure): NDBuffer = arg.map() { acosh(it) } - override fun atanh(arg: NDStructure): NDBuffer = arg.map() { atanh(it) } + override fun ln(arg: NDStructure): NDBuffer = arg.map { ln(it) } + + override fun sin(arg: NDStructure): NDBuffer = arg.map { sin(it) } + override fun cos(arg: NDStructure): NDBuffer = arg.map { cos(it) } + override fun tan(arg: NDStructure): NDBuffer = arg.map { tan(it) } + override fun asin(arg: NDStructure): NDBuffer = arg.map { asin(it) } + override fun acos(arg: NDStructure): NDBuffer = arg.map { acos(it) } + override fun atan(arg: NDStructure): NDBuffer = arg.map { atan(it) } + + override fun sinh(arg: NDStructure): NDBuffer = arg.map { sinh(it) } + override fun cosh(arg: NDStructure): NDBuffer = arg.map { cosh(it) } + override fun tanh(arg: NDStructure): NDBuffer = arg.map { tanh(it) } + override fun asinh(arg: NDStructure): NDBuffer = arg.map { asinh(it) } + override fun acosh(arg: NDStructure): NDBuffer = arg.map { acosh(it) } + override fun atanh(arg: NDStructure): NDBuffer = arg.map { atanh(it) } } fun NDAlgebra.Companion.realWithStream(vararg shape: Int): StreamRealNDField = StreamRealNDField(shape) \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 1a2a263ac..aadc76c52 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,10 @@ kotlin.code.style=official -kotlin.mpp.enableGranularSourceSetsMetadata=true kotlin.mpp.stability.nowarn=true -kotlin.native.enableDependencyPropagation=false kotlin.parallel.tasks.in.project=true org.gradle.configureondemand=true org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m org.gradle.parallel=true -systemProp.org.gradle.internal.publish.checksums.insecure=true + +kotlin.mpp.enableGranularSourceSetsMetadata=true +kotlin.native.enableDependencyPropagation=false + diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2a563242c..442d9132e 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.8.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt index 7bea65684..047ee187d 100644 --- a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt +++ b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt @@ -20,8 +20,8 @@ public object MstAlgebra : NumericAlgebra { /** * [Space] over [MST] nodes. */ -public object MstSpace : Space, NumericAlgebra { - public override val zero: MST.Numeric by lazy { number(0.0) } +public object MstSpace : Space, NumericAlgebra, ScaleOperations { + public override val zero: MST.Numeric = number(0.0) public override fun number(value: Number): MST.Numeric = MstAlgebra.number(value) public override fun bindSymbol(value: String): MST.Symbolic = MstAlgebra.bindSymbol(value) @@ -35,8 +35,8 @@ public object MstSpace : Space, NumericAlgebra { public override operator fun MST.minus(b: MST): MST.Binary = binaryOperationFunction(SpaceOperations.MINUS_OPERATION)(this, b) - public override fun multiply(a: MST, k: Number): MST.Binary = - binaryOperationFunction(RingOperations.TIMES_OPERATION)(a, number(k)) + public override fun scale(a: MST, value: Double): MST.Binary = + binaryOperationFunction(RingOperations.TIMES_OPERATION)(a, number(value)) public override fun binaryOperationFunction(operation: String): (left: MST, right: MST) -> MST.Binary = MstAlgebra.binaryOperationFunction(operation) @@ -49,16 +49,17 @@ public object MstSpace : Space, NumericAlgebra { * [Ring] over [MST] nodes. */ @OptIn(UnstableKMathAPI::class) -public object MstRing : Ring, RingWithNumbers { - public override val zero: MST.Numeric - get() = MstSpace.zero - - public override val one: MST.Numeric by lazy { number(1.0) } +public object MstRing : Ring, NumbersAddOperations, ScaleOperations { + public override val zero: MST.Numeric = MstSpace.zero + public override val one: MST.Numeric = number(1.0) public override fun number(value: Number): MST.Numeric = MstSpace.number(value) public override fun bindSymbol(value: String): MST.Symbolic = MstSpace.bindSymbol(value) public override fun add(a: MST, b: MST): MST.Binary = MstSpace.add(a, b) - public override fun multiply(a: MST, k: Number): MST.Binary = MstSpace.multiply(a, k) + + public override fun scale(a: MST, value: Double): MST.Binary = + MstSpace.binaryOperationFunction(RingOperations.TIMES_OPERATION)(a, MstSpace.number(value)) + public override fun multiply(a: MST, b: MST): MST.Binary = binaryOperationFunction(RingOperations.TIMES_OPERATION)(a, b) @@ -77,17 +78,18 @@ public object MstRing : Ring, RingWithNumbers { * [Field] over [MST] nodes. */ @OptIn(UnstableKMathAPI::class) -public object MstField : Field, RingWithNumbers { - public override val zero: MST.Numeric - get() = MstRing.zero +public object MstField : Field, NumbersAddOperations, ScaleOperations { + public override val zero: MST.Numeric get() = MstRing.zero - public override val one: MST.Numeric - get() = MstRing.one + public override val one: MST.Numeric get() = MstRing.one public override fun bindSymbol(value: String): MST.Symbolic = MstRing.bindSymbol(value) public override fun number(value: Number): MST.Numeric = MstRing.number(value) public override fun add(a: MST, b: MST): MST.Binary = MstRing.add(a, b) - public override fun multiply(a: MST, k: Number): MST.Binary = MstRing.multiply(a, k) + + public override fun scale(a: MST, value: Double): MST.Binary = + MstSpace.binaryOperationFunction(RingOperations.TIMES_OPERATION)(a, MstSpace.number(value)) + public override fun multiply(a: MST, b: MST): MST.Binary = MstRing.multiply(a, b) public override fun divide(a: MST, b: MST): MST.Binary = binaryOperationFunction(FieldOperations.DIV_OPERATION)(a, b) @@ -107,11 +109,8 @@ public object MstField : Field, RingWithNumbers { * [ExtendedField] over [MST] nodes. */ public object MstExtendedField : ExtendedField, NumericAlgebra { - public override val zero: MST.Numeric - get() = MstField.zero - - public override val one: MST.Numeric - get() = MstField.one + public override val zero: MST.Numeric = MstField.zero + public override val one: MST.Numeric = MstField.one public override fun bindSymbol(value: String): MST.Symbolic = MstField.bindSymbol(value) public override fun number(value: Number): MST.Numeric = MstRing.number(value) @@ -121,14 +120,17 @@ public object MstExtendedField : ExtendedField, NumericAlgebra { public override fun asin(arg: MST): MST.Unary = unaryOperationFunction(TrigonometricOperations.ASIN_OPERATION)(arg) public override fun acos(arg: MST): MST.Unary = unaryOperationFunction(TrigonometricOperations.ACOS_OPERATION)(arg) public override fun atan(arg: MST): MST.Unary = unaryOperationFunction(TrigonometricOperations.ATAN_OPERATION)(arg) - public override fun sinh(arg: MST): MST.Unary = unaryOperationFunction(HyperbolicOperations.SINH_OPERATION)(arg) - public override fun cosh(arg: MST): MST.Unary = unaryOperationFunction(HyperbolicOperations.COSH_OPERATION)(arg) - public override fun tanh(arg: MST): MST.Unary = unaryOperationFunction(HyperbolicOperations.TANH_OPERATION)(arg) - public override fun asinh(arg: MST): MST.Unary = unaryOperationFunction(HyperbolicOperations.ASINH_OPERATION)(arg) - public override fun acosh(arg: MST): MST.Unary = unaryOperationFunction(HyperbolicOperations.ACOSH_OPERATION)(arg) - public override fun atanh(arg: MST): MST.Unary = unaryOperationFunction(HyperbolicOperations.ATANH_OPERATION)(arg) + public override fun sinh(arg: MST): MST.Unary = unaryOperationFunction(ExponentialOperations.SINH_OPERATION)(arg) + public override fun cosh(arg: MST): MST.Unary = unaryOperationFunction(ExponentialOperations.COSH_OPERATION)(arg) + public override fun tanh(arg: MST): MST.Unary = unaryOperationFunction(ExponentialOperations.TANH_OPERATION)(arg) + public override fun asinh(arg: MST): MST.Unary = unaryOperationFunction(ExponentialOperations.ASINH_OPERATION)(arg) + public override fun acosh(arg: MST): MST.Unary = unaryOperationFunction(ExponentialOperations.ACOSH_OPERATION)(arg) + public override fun atanh(arg: MST): MST.Unary = unaryOperationFunction(ExponentialOperations.ATANH_OPERATION)(arg) public override fun add(a: MST, b: MST): MST.Binary = MstField.add(a, b) - public override fun multiply(a: MST, k: Number): MST.Binary = MstField.multiply(a, k) + + public override fun scale(a: MST, value: Double): MST = + binaryOperation(SpaceOperations.PLUS_OPERATION, a, number(value)) + public override fun multiply(a: MST, b: MST): MST.Binary = MstField.multiply(a, b) public override fun divide(a: MST, b: MST): MST.Binary = MstField.divide(a, b) public override operator fun MST.unaryPlus(): MST.Unary = MstField { +this@unaryPlus } diff --git a/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeConsistencyWithInterpreter.kt b/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeConsistencyWithInterpreter.kt index 492a5d11f..c91cc4daf 100644 --- a/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeConsistencyWithInterpreter.kt +++ b/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeConsistencyWithInterpreter.kt @@ -15,9 +15,9 @@ internal class TestESTreeConsistencyWithInterpreter { val res1 = MstSpace.mstInSpace { binaryOperationFunction("+")( unaryOperationFunction("+")( - number(3.toByte()) - (number(2.toByte()) + (multiply( + number(3.toByte()) - (number(2.toByte()) + (scale( add(number(1), number(1)), - 2 + 2.0 ) + number(1.toByte()) * 3.toByte() - number(1.toByte()))) ), @@ -28,9 +28,9 @@ internal class TestESTreeConsistencyWithInterpreter { val res2 = MstSpace.mstInSpace { binaryOperationFunction("+")( unaryOperationFunction("+")( - number(3.toByte()) - (number(2.toByte()) + (multiply( + number(3.toByte()) - (number(2.toByte()) + (scale( add(number(1), number(1)), - 2 + 2.0 ) + number(1.toByte()) * 3.toByte() - number(1.toByte()))) ), @@ -46,9 +46,9 @@ internal class TestESTreeConsistencyWithInterpreter { val res1 = ByteRing.mstInRing { binaryOperationFunction("+")( unaryOperationFunction("+")( - (bindSymbol("x") - (2.toByte() + (multiply( + (bindSymbol("x") - (2.toByte() + (scale( add(number(1), number(1)), - 2 + 2.0 ) + 1.toByte()))) * 3.0 - 1.toByte() ), @@ -59,9 +59,9 @@ internal class TestESTreeConsistencyWithInterpreter { val res2 = ByteRing.mstInRing { binaryOperationFunction("+")( unaryOperationFunction("+")( - (bindSymbol("x") - (2.toByte() + (multiply( + (bindSymbol("x") - (2.toByte() + (scale( add(number(1), number(1)), - 2 + 2.0 ) + 1.toByte()))) * 3.0 - 1.toByte() ), number(1) @@ -75,7 +75,7 @@ internal class TestESTreeConsistencyWithInterpreter { fun realField() { val res1 = RealField.mstInField { +(3 - 2 + 2 * number(1) + 1.0) + binaryOperationFunction("+")( - (3.0 - (bindSymbol("x") + (multiply(add(number(1.0), number(1.0)), 2) + 1.0))) * 3 - 1.0 + (3.0 - (bindSymbol("x") + (scale(add(number(1.0), number(1.0)), 2.0) + 1.0))) * 3 - 1.0 + number(1), number(1) / 2 + number(2.0) * one ) + zero @@ -83,7 +83,7 @@ internal class TestESTreeConsistencyWithInterpreter { val res2 = RealField.mstInField { +(3 - 2 + 2 * number(1) + 1.0) + binaryOperationFunction("+")( - (3.0 - (bindSymbol("x") + (multiply(add(number(1.0), number(1.0)), 2) + 1.0))) * 3 - 1.0 + (3.0 - (bindSymbol("x") + (scale(add(number(1.0), number(1.0)), 2.0) + 1.0))) * 3 - 1.0 + number(1), number(1) / 2 + number(2.0) * one ) + zero @@ -96,7 +96,7 @@ internal class TestESTreeConsistencyWithInterpreter { fun complexField() { val res1 = ComplexField.mstInField { +(3 - 2 + 2 * number(1) + 1.0) + binaryOperationFunction("+")( - (3.0 - (bindSymbol("x") + (multiply(add(number(1.0), number(1.0)), 2) + 1.0))) * 3 - 1.0 + (3.0 - (bindSymbol("x") + (scale(add(number(1.0), number(1.0)), 2.0) + 1.0))) * 3 - 1.0 + number(1), number(1) / 2 + number(2.0) * one ) + zero @@ -104,7 +104,7 @@ internal class TestESTreeConsistencyWithInterpreter { val res2 = ComplexField.mstInField { +(3 - 2 + 2 * number(1) + 1.0) + binaryOperationFunction("+")( - (3.0 - (bindSymbol("x") + (multiply(add(number(1.0), number(1.0)), 2) + 1.0))) * 3 - 1.0 + (3.0 - (bindSymbol("x") + (scale(add(number(1.0), number(1.0)), 2.0) + 1.0))) * 3 - 1.0 + number(1), number(1) / 2 + number(2.0) * one ) + zero diff --git a/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmConsistencyWithInterpreter.kt b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmConsistencyWithInterpreter.kt index 0f2328db6..5c6297f3f 100644 --- a/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmConsistencyWithInterpreter.kt +++ b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmConsistencyWithInterpreter.kt @@ -15,9 +15,9 @@ internal class TestAsmConsistencyWithInterpreter { val res1 = MstSpace.mstInSpace { binaryOperationFunction("+")( unaryOperationFunction("+")( - number(3.toByte()) - (number(2.toByte()) + (multiply( + number(3.toByte()) - (number(2.toByte()) + (scale( add(number(1), number(1)), - 2 + 2.0 ) + number(1.toByte()) * 3.toByte() - number(1.toByte()))) ), @@ -28,9 +28,9 @@ internal class TestAsmConsistencyWithInterpreter { val res2 = MstSpace.mstInSpace { binaryOperationFunction("+")( unaryOperationFunction("+")( - number(3.toByte()) - (number(2.toByte()) + (multiply( + number(3.toByte()) - (number(2.toByte()) + (scale( add(number(1), number(1)), - 2 + 2.0 ) + number(1.toByte()) * 3.toByte() - number(1.toByte()))) ), @@ -46,9 +46,9 @@ internal class TestAsmConsistencyWithInterpreter { val res1 = ByteRing.mstInRing { binaryOperationFunction("+")( unaryOperationFunction("+")( - (bindSymbol("x") - (2.toByte() + (multiply( + (bindSymbol("x") - (2.toByte() + (scale( add(number(1), number(1)), - 2 + 2.0 ) + 1.toByte()))) * 3.0 - 1.toByte() ), @@ -59,9 +59,9 @@ internal class TestAsmConsistencyWithInterpreter { val res2 = ByteRing.mstInRing { binaryOperationFunction("+")( unaryOperationFunction("+")( - (bindSymbol("x") - (2.toByte() + (multiply( + (bindSymbol("x") - (2.toByte() + (scale( add(number(1), number(1)), - 2 + 2.0 ) + 1.toByte()))) * 3.0 - 1.toByte() ), number(1) @@ -75,7 +75,7 @@ internal class TestAsmConsistencyWithInterpreter { fun realField() { val res1 = RealField.mstInField { +(3 - 2 + 2 * number(1) + 1.0) + binaryOperationFunction("+")( - (3.0 - (bindSymbol("x") + (multiply(add(number(1.0), number(1.0)), 2) + 1.0))) * 3 - 1.0 + (3.0 - (bindSymbol("x") + (scale(add(number(1.0), number(1.0)), 2.0) + 1.0))) * 3 - 1.0 + number(1), number(1) / 2 + number(2.0) * one ) + zero @@ -83,7 +83,7 @@ internal class TestAsmConsistencyWithInterpreter { val res2 = RealField.mstInField { +(3 - 2 + 2 * number(1) + 1.0) + binaryOperationFunction("+")( - (3.0 - (bindSymbol("x") + (multiply(add(number(1.0), number(1.0)), 2) + 1.0))) * 3 - 1.0 + (3.0 - (bindSymbol("x") + (scale(add(number(1.0), number(1.0)), 2.0) + 1.0))) * 3 - 1.0 + number(1), number(1) / 2 + number(2.0) * one ) + zero @@ -96,7 +96,7 @@ internal class TestAsmConsistencyWithInterpreter { fun complexField() { val res1 = ComplexField.mstInField { +(3 - 2 + 2 * number(1) + 1.0) + binaryOperationFunction("+")( - (3.0 - (bindSymbol("x") + (multiply(add(number(1.0), number(1.0)), 2) + 1.0))) * 3 - 1.0 + (3.0 - (bindSymbol("x") + (scale(add(number(1.0), number(1.0)), 2.0) + 1.0))) * 3 - 1.0 + number(1), number(1) / 2 + number(2.0) * one ) + zero @@ -104,7 +104,7 @@ internal class TestAsmConsistencyWithInterpreter { val res2 = ComplexField.mstInField { +(3 - 2 + 2 * number(1) + 1.0) + binaryOperationFunction("+")( - (3.0 - (bindSymbol("x") + (multiply(add(number(1.0), number(1.0)), 2) + 1.0))) * 3 - 1.0 + (3.0 - (bindSymbol("x") + (scale(add(number(1.0), number(1.0)), 2.0) + 1.0))) * 3 - 1.0 + number(1), number(1) / 2 + number(2.0) * one ) + zero diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpression.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpression.kt index 8342a8071..b74167c3f 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpression.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpression.kt @@ -4,7 +4,7 @@ import org.apache.commons.math3.analysis.differentiation.DerivativeStructure import space.kscience.kmath.expressions.* import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.operations.ExtendedField -import space.kscience.kmath.operations.RingWithNumbers +import space.kscience.kmath.operations.NumbersAddOperations /** * A field over commons-math [DerivativeStructure]. @@ -16,7 +16,8 @@ import space.kscience.kmath.operations.RingWithNumbers public class DerivativeStructureField( public val order: Int, bindings: Map, -) : ExtendedField, ExpressionAlgebra, RingWithNumbers { +) : ExtendedField, ExpressionAlgebra, + NumbersAddOperations { public val numberOfVariables: Int = bindings.size public override val zero: DerivativeStructure by lazy { DerivativeStructure(numberOfVariables, order) } @@ -62,13 +63,11 @@ public class DerivativeStructureField( public fun DerivativeStructure.derivative(vararg symbols: Symbol): Double = derivative(symbols.toList()) + override fun DerivativeStructure.unaryMinus(): DerivativeStructure = negate() + public override fun add(a: DerivativeStructure, b: DerivativeStructure): DerivativeStructure = a.add(b) - public override fun multiply(a: DerivativeStructure, k: Number): DerivativeStructure = when (k) { - is Double -> a.multiply(k) - is Int -> a.multiply(k) - else -> a.multiply(k.toDouble()) - } + public override fun scale(a: DerivativeStructure, value: Double): DerivativeStructure = a.multiply(value) public override fun multiply(a: DerivativeStructure, b: DerivativeStructure): DerivativeStructure = a.multiply(b) public override fun divide(a: DerivativeStructure, b: DerivativeStructure): DerivativeStructure = a.divide(b) diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt index 3638b9808..537da5947 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt @@ -101,8 +101,8 @@ public object CMMatrixContext : MatrixContext { public override operator fun Matrix.minus(b: Matrix): CMMatrix = CMMatrix(toCM().origin.subtract(b.toCM().origin)) - public override fun multiply(a: Matrix, k: Number): CMMatrix = - CMMatrix(a.toCM().origin.scalarMultiply(k.toDouble())) +// public override fun multiply(a: Matrix, k: Number): CMMatrix = +// CMMatrix(a.toCM().origin.scalarMultiply(k.toDouble())) public override operator fun Matrix.times(value: Double): CMMatrix = produce(rowNum, colNum) { i, j -> get(i, j) * value } diff --git a/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Complex.kt b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Complex.kt index deadfda5b..a73fb0201 100644 --- a/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Complex.kt +++ b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Complex.kt @@ -4,10 +4,7 @@ import space.kscience.kmath.memory.MemoryReader import space.kscience.kmath.memory.MemorySpec import space.kscience.kmath.memory.MemoryWriter import space.kscience.kmath.misc.UnstableKMathAPI -import space.kscience.kmath.operations.ExtendedField -import space.kscience.kmath.operations.FieldElement -import space.kscience.kmath.operations.Norm -import space.kscience.kmath.operations.RingWithNumbers +import space.kscience.kmath.operations.* import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.MemoryBuffer import space.kscience.kmath.structures.MutableBuffer @@ -47,7 +44,8 @@ private val PI_DIV_2 = Complex(PI / 2, 0) * A field of [Complex]. */ @OptIn(UnstableKMathAPI::class) -public object ComplexField : ExtendedField, Norm, RingWithNumbers { +public object ComplexField : ExtendedField, Norm, NumbersAddOperations, + ScaleOperations { public override val zero: Complex = 0.0.toComplex() public override val one: Complex = 1.0.toComplex() @@ -56,8 +54,14 @@ public object ComplexField : ExtendedField, Norm, Rin */ public val i: Complex by lazy { Complex(0.0, 1.0) } + override fun Complex.unaryMinus(): Complex = Complex(-re, -im) + + override fun number(value: Number): Complex = Complex(value.toDouble(), 0.0) + + override fun scale(a: Complex, value: Double): Complex = Complex(a.re * value, a.im * value) + public override fun add(a: Complex, b: Complex): Complex = Complex(a.re + b.re, a.im + b.im) - public override fun multiply(a: Complex, k: Number): Complex = Complex(a.re * k.toDouble(), a.im * k.toDouble()) +// public override fun multiply(a: Complex, k: Number): Complex = Complex(a.re * k.toDouble(), a.im * k.toDouble()) public override fun multiply(a: Complex, b: Complex): Complex = Complex(a.re * b.re - a.im * b.im, a.re * b.im + a.im * b.re) @@ -86,8 +90,10 @@ public object ComplexField : ExtendedField, Norm, Rin } } - public override fun sin(arg: Complex): Complex = i * (exp(-i * arg) - exp(i * arg)) / 2 - public override fun cos(arg: Complex): Complex = (exp(-i * arg) + exp(i * arg)) / 2 + override operator fun Complex.div(k: Number): Complex = Complex(re / k.toDouble(), im / k.toDouble()) + + public override fun sin(arg: Complex): Complex = i * (exp(-i * arg) - exp(i * arg)) / 2.0 + public override fun cos(arg: Complex): Complex = (exp(-i * arg) + exp(i * arg)) / 2.0 public override fun tan(arg: Complex): Complex { val e1 = exp(-i * arg) @@ -159,7 +165,8 @@ public object ComplexField : ExtendedField, Norm, Rin public override fun norm(arg: Complex): Complex = sqrt(arg.conjugate * arg) - public override fun bindSymbol(value: String): Complex = if (value == "i") i else super.bindSymbol(value) + public override fun bindSymbol(value: String): Complex = + if (value == "i") i else super.bindSymbol(value) } /** @@ -181,7 +188,8 @@ public data class Complex(val re: Double, val im: Double) : FieldElement(shape, ComplexField, Buffer.Companion::complex), - RingWithNumbers>, + NumbersAddOperations>, ExtendedField> { override val zero: NDBuffer by lazy { produce { zero } } @@ -29,6 +29,7 @@ public class ComplexNDField( val d = value.toComplex() // minimize conversions return produce { d } } + // // @Suppress("OVERRIDE_BY_INLINE") // override inline fun map( @@ -75,25 +76,25 @@ public class ComplexNDField( // return BufferedNDFieldElement(this, buffer) // } - override fun power(arg: NDStructure, pow: Number): NDBuffer = arg.map() { power(it, pow) } + override fun power(arg: NDStructure, pow: Number): NDBuffer = arg.map { power(it, pow) } - override fun exp(arg: NDStructure): NDBuffer = arg.map() { exp(it) } + override fun exp(arg: NDStructure): NDBuffer = arg.map { exp(it) } - override fun ln(arg: NDStructure): NDBuffer = arg.map() { ln(it) } + override fun ln(arg: NDStructure): NDBuffer = arg.map { ln(it) } - override fun sin(arg: NDStructure): NDBuffer = arg.map() { sin(it) } - override fun cos(arg: NDStructure): NDBuffer = arg.map() { cos(it) } - override fun tan(arg: NDStructure): NDBuffer = arg.map() { tan(it) } - override fun asin(arg: NDStructure): NDBuffer = arg.map() { asin(it) } - override fun acos(arg: NDStructure): NDBuffer = arg.map() { acos(it) } - override fun atan(arg: NDStructure): NDBuffer = arg.map() { atan(it) } + override fun sin(arg: NDStructure): NDBuffer = arg.map { sin(it) } + override fun cos(arg: NDStructure): NDBuffer = arg.map { cos(it) } + override fun tan(arg: NDStructure): NDBuffer = arg.map { tan(it) } + override fun asin(arg: NDStructure): NDBuffer = arg.map { asin(it) } + override fun acos(arg: NDStructure): NDBuffer = arg.map { acos(it) } + override fun atan(arg: NDStructure): NDBuffer = arg.map { atan(it) } - override fun sinh(arg: NDStructure): NDBuffer = arg.map() { sinh(it) } - override fun cosh(arg: NDStructure): NDBuffer = arg.map() { cosh(it) } - override fun tanh(arg: NDStructure): NDBuffer = arg.map() { tanh(it) } - override fun asinh(arg: NDStructure): NDBuffer = arg.map() { asinh(it) } - override fun acosh(arg: NDStructure): NDBuffer = arg.map() { acosh(it) } - override fun atanh(arg: NDStructure): NDBuffer = arg.map() { atanh(it) } + override fun sinh(arg: NDStructure): NDBuffer = arg.map { sinh(it) } + override fun cosh(arg: NDStructure): NDBuffer = arg.map { cosh(it) } + override fun tanh(arg: NDStructure): NDBuffer = arg.map { tanh(it) } + override fun asinh(arg: NDStructure): NDBuffer = arg.map { asinh(it) } + override fun acosh(arg: NDStructure): NDBuffer = arg.map { acosh(it) } + override fun atanh(arg: NDStructure): NDBuffer = arg.map { atanh(it) } } diff --git a/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt index 4a15e7423..d391aff18 100644 --- a/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt +++ b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt @@ -37,7 +37,7 @@ public val Quaternion.r: Double */ @OptIn(UnstableKMathAPI::class) public object QuaternionField : Field, Norm, PowerOperations, - ExponentialOperations, RingWithNumbers { + ExponentialOperations, NumbersAddOperations, ScaleOperations { override val zero: Quaternion = 0.toQuaternion() override val one: Quaternion = 1.toQuaternion() @@ -59,10 +59,8 @@ public object QuaternionField : Field, Norm, public override fun add(a: Quaternion, b: Quaternion): Quaternion = Quaternion(a.w + b.w, a.x + b.x, a.y + b.y, a.z + b.z) - public override fun multiply(a: Quaternion, k: Number): Quaternion { - val d = k.toDouble() - return Quaternion(a.w * d, a.x * d, a.y * d, a.z * d) - } + public override fun scale(a: Quaternion, value: Double): Quaternion = + Quaternion(a.w * value, a.x * value, a.y * value, a.z * value) public override fun multiply(a: Quaternion, b: Quaternion): Quaternion = Quaternion( a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z, @@ -173,6 +171,15 @@ public object QuaternionField : Field, Norm, "k" -> k else -> super.bindSymbol(value) } + + override fun number(value: Number): Quaternion =value.toQuaternion() + + public override fun sinh(arg: Quaternion): Quaternion = (exp(arg) - exp(-arg)) / 2.0 + public override fun cosh(arg: Quaternion): Quaternion = (exp(arg) + exp(-arg)) / 2.0 + public override fun tanh(arg: Quaternion): Quaternion = (exp(arg) - exp(-arg)) / (exp(-arg) + exp(arg)) + public override fun asinh(arg: Quaternion): Quaternion = ln(sqrt(arg * arg + one) + arg) + public override fun acosh(arg: Quaternion): Quaternion = ln(arg + sqrt((arg - one) * (arg + one))) + public override fun atanh(arg: Quaternion): Quaternion = (ln(arg + one) - ln(one - arg)) / 2.0 } /** @@ -207,8 +214,7 @@ public data class Quaternion( require(!z.isNaN()) { "x-component of quaternion is not-a-number" } } - public override val context: QuaternionField - get() = QuaternionField + public override val context: QuaternionField get() = QuaternionField /** * Returns a string representation of this quaternion. diff --git a/kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/ExpressionFieldForComplexTest.kt b/kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/ExpressionFieldForComplexTest.kt index 43560b35a..81a131318 100644 --- a/kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/ExpressionFieldForComplexTest.kt +++ b/kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/ExpressionFieldForComplexTest.kt @@ -4,7 +4,6 @@ import space.kscience.kmath.expressions.FunctionalExpressionField import space.kscience.kmath.expressions.bindSymbol import space.kscience.kmath.expressions.invoke import space.kscience.kmath.expressions.symbol -import space.kscience.kmath.operations.invoke import kotlin.test.Test import kotlin.test.assertEquals @@ -13,14 +12,11 @@ internal class ExpressionFieldForComplexTest { @Test fun testComplex() { - val context = FunctionalExpressionField(ComplexField) - - val expression = context { + val expression = FunctionalExpressionField(ComplexField).run { val x = bindSymbol(x) x * x + 2 * x + one } assertEquals(expression(x to Complex(1.0, 0.0)), Complex(4.0, 0.0)) - //assertEquals(expression(), Complex(9.0, 0.0)) } } diff --git a/kmath-core/README.md b/kmath-core/README.md deleted file mode 100644 index 54380670d..000000000 --- a/kmath-core/README.md +++ /dev/null @@ -1,55 +0,0 @@ -# The Core Module (`kmath-core`) - -The core features of KMath: - - - [algebras](src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt) : Algebraic structures like rings, spaces and fields. - - [nd](src/commonMain/kotlin/kscience/kmath/structures/NDStructure.kt) : Many-dimensional structures and operations on them. - - [linear](src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt) : Basic linear algebra operations (sums, products, etc.), backed by the `Space` API. Advanced linear algebra operations like matrix inversion and LU decomposition. - - [buffers](src/commonMain/kotlin/kscience/kmath/structures/Buffers.kt) : One-dimensional structure - - [expressions](src/commonMain/kotlin/kscience/kmath/expressions) : By writing a single mathematical expression once, users will be able to apply different types of -objects to the expression by providing a context. Expressions can be used for a wide variety of purposes from high -performance calculations to code generation. - - [domains](src/commonMain/kotlin/kscience/kmath/domains) : Domains - - [autodif](src/commonMain/kotlin/kscience/kmath/expressions/SimpleAutoDiff.kt) : Automatic differentiation - - -> #### Artifact: -> -> This module artifact: `space.kscience:kmath-core:0.2.0`. -> -> Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-core/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-core/_latestVersion) -> -> Bintray development version: [ ![Download](https://api.bintray.com/packages/mipt-npm/dev/kmath-core/images/download.svg) ](https://bintray.com/mipt-npm/dev/kmath-core/_latestVersion) -> -> **Gradle:** -> -> ```gradle -> repositories { -> maven { url 'https://repo.kotlin.link' } -> maven { url 'https://dl.bintray.com/hotkeytlt/maven' } -> maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap ->// Uncomment if repo.kotlin.link is unavailable ->// maven { url 'https://dl.bintray.com/mipt-npm/kscience' } ->// maven { url 'https://dl.bintray.com/mipt-npm/dev' } -> } -> -> dependencies { -> implementation 'space.kscience:kmath-core:0.2.0' -> } -> ``` -> **Gradle Kotlin DSL:** -> -> ```kotlin -> repositories { -> maven("https://repo.kotlin.link") -> maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap -> maven("https://dl.bintray.com/hotkeytlt/maven") // required for a ->// Uncomment if repo.kotlin.link is unavailable ->// maven("https://dl.bintray.com/mipt-npm/kscience") ->// maven("https://dl.bintray.com/mipt-npm/dev") -> } -> -> dependencies { -> implementation("space.kscience:kmath-core:0.2.0") -> } -> ``` diff --git a/kmath-core/api/kmath-core.api b/kmath-core/api/kmath-core.api index 4a21a3d7e..0efe430ad 100644 --- a/kmath-core/api/kmath-core.api +++ b/kmath-core/api/kmath-core.api @@ -3,70 +3,6 @@ public abstract interface class space/kscience/kmath/domains/Domain { public abstract fun getDimension ()I } -public final class space/kscience/kmath/domains/HyperSquareDomain : space/kscience/kmath/domains/RealDomain { - public fun (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)V - public fun contains (Lspace/kscience/kmath/structures/Buffer;)Z - public fun getDimension ()I - public fun getLowerBound (I)Ljava/lang/Double; - public fun getLowerBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; - public fun getUpperBound (I)Ljava/lang/Double; - public fun getUpperBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; - public fun nearestInDomain (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public fun volume ()D -} - -public abstract interface class space/kscience/kmath/domains/RealDomain : space/kscience/kmath/domains/Domain { - public abstract fun getLowerBound (I)Ljava/lang/Double; - public abstract fun getLowerBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; - public abstract fun getUpperBound (I)Ljava/lang/Double; - public abstract fun getUpperBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; - public abstract fun nearestInDomain (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public abstract fun volume ()D -} - -public final class space/kscience/kmath/domains/UnconstrainedDomain : space/kscience/kmath/domains/RealDomain { - public fun (I)V - public fun contains (Lspace/kscience/kmath/structures/Buffer;)Z - public fun getDimension ()I - public fun getLowerBound (I)Ljava/lang/Double; - public fun getLowerBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; - public fun getUpperBound (I)Ljava/lang/Double; - public fun getUpperBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; - public fun nearestInDomain (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public fun volume ()D -} - -public final class space/kscience/kmath/domains/UnivariateDomain : space/kscience/kmath/domains/RealDomain { - public static final synthetic fun box-impl (Lkotlin/ranges/ClosedFloatingPointRange;)Lspace/kscience/kmath/domains/UnivariateDomain; - public static fun constructor-impl (Lkotlin/ranges/ClosedFloatingPointRange;)Lkotlin/ranges/ClosedFloatingPointRange; - public fun contains (Lspace/kscience/kmath/structures/Buffer;)Z - public static final fun contains-impl (Lkotlin/ranges/ClosedFloatingPointRange;D)Z - public static fun contains-impl (Lkotlin/ranges/ClosedFloatingPointRange;Lspace/kscience/kmath/structures/Buffer;)Z - public fun equals (Ljava/lang/Object;)Z - public static fun equals-impl (Lkotlin/ranges/ClosedFloatingPointRange;Ljava/lang/Object;)Z - public static final fun equals-impl0 (Lkotlin/ranges/ClosedFloatingPointRange;Lkotlin/ranges/ClosedFloatingPointRange;)Z - public fun getDimension ()I - public static fun getDimension-impl (Lkotlin/ranges/ClosedFloatingPointRange;)I - public fun getLowerBound (I)Ljava/lang/Double; - public fun getLowerBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; - public static fun getLowerBound-impl (Lkotlin/ranges/ClosedFloatingPointRange;I)Ljava/lang/Double; - public static fun getLowerBound-impl (Lkotlin/ranges/ClosedFloatingPointRange;ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; - public final fun getRange ()Lkotlin/ranges/ClosedFloatingPointRange; - public fun getUpperBound (I)Ljava/lang/Double; - public fun getUpperBound (ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; - public static fun getUpperBound-impl (Lkotlin/ranges/ClosedFloatingPointRange;I)Ljava/lang/Double; - public static fun getUpperBound-impl (Lkotlin/ranges/ClosedFloatingPointRange;ILspace/kscience/kmath/structures/Buffer;)Ljava/lang/Double; - public fun hashCode ()I - public static fun hashCode-impl (Lkotlin/ranges/ClosedFloatingPointRange;)I - public fun nearestInDomain (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public static fun nearestInDomain-impl (Lkotlin/ranges/ClosedFloatingPointRange;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public fun toString ()Ljava/lang/String; - public static fun toString-impl (Lkotlin/ranges/ClosedFloatingPointRange;)Ljava/lang/String; - public final synthetic fun unbox-impl ()Lkotlin/ranges/ClosedFloatingPointRange; - public fun volume ()D - public static fun volume-impl (Lkotlin/ranges/ClosedFloatingPointRange;)D -} - public abstract interface class space/kscience/kmath/expressions/AutoDiffProcessor { public abstract fun process (Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/DifferentiableExpression; } @@ -179,9 +115,6 @@ public class space/kscience/kmath/expressions/FunctionalExpressionExtendedField public fun cosh (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; public fun exp (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; - public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; - public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; public fun ln (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; @@ -190,8 +123,6 @@ public class space/kscience/kmath/expressions/FunctionalExpressionExtendedField public fun pow (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun power (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; - public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; public fun sin (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; @@ -206,17 +137,31 @@ public class space/kscience/kmath/expressions/FunctionalExpressionExtendedField public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public class space/kscience/kmath/expressions/FunctionalExpressionField : space/kscience/kmath/expressions/FunctionalExpressionRing, space/kscience/kmath/operations/Field { +public class space/kscience/kmath/expressions/FunctionalExpressionField : space/kscience/kmath/expressions/FunctionalExpressionRing, space/kscience/kmath/operations/Field, space/kscience/kmath/operations/ScaleOperations { public fun (Lspace/kscience/kmath/operations/Field;)V public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Number;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; + public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public final fun div (Ljava/lang/Object;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; + public fun div (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public final fun div (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Object;)Lspace/kscience/kmath/expressions/Expression; public fun div (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun divide (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; + public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; + public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; + public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; + public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; + public fun scale (Lspace/kscience/kmath/expressions/Expression;D)Lspace/kscience/kmath/expressions/Expression; + public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; + public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public fun times (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } @@ -239,24 +184,16 @@ public class space/kscience/kmath/expressions/FunctionalExpressionSpace : space/ public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun add (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun div (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun getZero ()Ljava/lang/Object; public fun getZero ()Lspace/kscience/kmath/expressions/Expression; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public final fun minus (Ljava/lang/Object;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public final fun minus (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Object;)Lspace/kscience/kmath/expressions/Expression; public fun minus (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; - public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun multiply (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public final fun plus (Ljava/lang/Object;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public final fun plus (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Object;)Lspace/kscience/kmath/expressions/Expression; public fun plus (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; - public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; - public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun times (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; public fun unaryMinus (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; @@ -272,7 +209,7 @@ public final class space/kscience/kmath/expressions/SimpleAutoDiffExpression : s public fun invoke (Ljava/util/Map;)Ljava/lang/Object; } -public final class space/kscience/kmath/expressions/SimpleAutoDiffExtendedField : space/kscience/kmath/expressions/SimpleAutoDiffField, space/kscience/kmath/operations/ExtendedField { +public final class space/kscience/kmath/expressions/SimpleAutoDiffExtendedField : space/kscience/kmath/expressions/SimpleAutoDiffField, space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/ScaleOperations { public fun (Lspace/kscience/kmath/operations/ExtendedField;Ljava/util/Map;)V public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; public fun acos (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; @@ -294,12 +231,16 @@ public final class space/kscience/kmath/expressions/SimpleAutoDiffExtendedField public fun exp (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; public fun ln (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun pow (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; public final fun pow (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun power (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; + public fun scale (Lspace/kscience/kmath/expressions/AutoDiffValue;D)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; public fun sin (Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; @@ -314,7 +255,7 @@ public final class space/kscience/kmath/expressions/SimpleAutoDiffExtendedField public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public class space/kscience/kmath/expressions/SimpleAutoDiffField : space/kscience/kmath/expressions/ExpressionAlgebra, space/kscience/kmath/operations/Field, space/kscience/kmath/operations/RingWithNumbers { +public class space/kscience/kmath/expressions/SimpleAutoDiffField : space/kscience/kmath/expressions/ExpressionAlgebra, space/kscience/kmath/operations/Field, space/kscience/kmath/operations/NumbersAddOperations { public fun (Lspace/kscience/kmath/operations/Field;Ljava/util/Map;)V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun add (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; @@ -329,8 +270,6 @@ public class space/kscience/kmath/expressions/SimpleAutoDiffField : space/kscien public fun const (Ljava/lang/Object;)Lspace/kscience/kmath/expressions/AutoDiffValue; public final fun const (Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/AutoDiffValue; public final fun derive (Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object; - public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Number;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun div (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; @@ -352,9 +291,7 @@ public class space/kscience/kmath/expressions/SimpleAutoDiffField : space/kscien public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun minus (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; public fun minus (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; - public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; public fun multiply (Lspace/kscience/kmath/expressions/AutoDiffValue;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; @@ -367,6 +304,8 @@ public class space/kscience/kmath/expressions/SimpleAutoDiffField : space/kscien public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Number;)Lspace/kscience/kmath/expressions/AutoDiffValue; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; + public fun scale (Lspace/kscience/kmath/expressions/AutoDiffValue;D)Lspace/kscience/kmath/expressions/AutoDiffValue; public final fun setD (Lspace/kscience/kmath/expressions/AutoDiffValue;Ljava/lang/Object;)V public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public fun times (Ljava/lang/Number;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; @@ -521,8 +460,6 @@ public final class space/kscience/kmath/linear/BufferMatrixContext : space/kscie public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/nd/Structure2D; - public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun div (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; public synthetic fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; @@ -530,21 +467,14 @@ public final class space/kscience/kmath/linear/BufferMatrixContext : space/kscie public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; public synthetic fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun multiply (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/linear/BufferMatrix; - public synthetic fun multiply (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; public final fun one (II)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun plus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public fun point (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; public fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferMatrix; public synthetic fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/Structure2D; - public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; public synthetic fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; public fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/linear/BufferMatrix; public synthetic fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; @@ -561,7 +491,7 @@ public final class space/kscience/kmath/linear/BufferMatrixContext$Companion { } public final class space/kscience/kmath/linear/BufferVectorSpace : space/kscience/kmath/linear/VectorSpace { - public fun (ILspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;)V + public fun (ILspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun add (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; @@ -569,24 +499,17 @@ public final class space/kscience/kmath/linear/BufferVectorSpace : space/kscienc public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun div (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public fun getAlgebra ()Lspace/kscience/kmath/operations/Ring; public final fun getBufferFactory ()Lkotlin/jvm/functions/Function2; public fun getSize ()I - public fun getSpace ()Lspace/kscience/kmath/operations/Space; public synthetic fun getZero ()Ljava/lang/Object; public fun getZero ()Lspace/kscience/kmath/structures/Buffer; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun minus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun multiply (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun plus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun times (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public fun scale (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Object;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; public fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; @@ -617,7 +540,6 @@ public abstract interface class space/kscience/kmath/linear/GenericMatrixContext public abstract fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public abstract fun getElementContext ()Lspace/kscience/kmath/operations/Ring; public abstract fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public abstract fun multiply (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; public abstract fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; public abstract fun unaryMinus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; } @@ -627,16 +549,12 @@ public final class space/kscience/kmath/linear/GenericMatrixContext$DefaultImpls public static fun binaryOperation (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public static fun binaryOperationFunction (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public static fun bindSymbol (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lspace/kscience/kmath/nd/Structure2D; - public static fun div (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; public static fun dot (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public static fun dot (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public static fun minus (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public static fun multiply (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; public static fun plus (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public static fun point (Lspace/kscience/kmath/linear/GenericMatrixContext;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; - public static fun times (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/Number;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public static fun times (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public static fun times (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; public static fun times (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; public static fun unaryMinus (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public static fun unaryOperation (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; @@ -727,14 +645,10 @@ public final class space/kscience/kmath/linear/MatrixContext$DefaultImpls { public static fun binaryOperation (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public static fun binaryOperationFunction (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public static fun bindSymbol (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lspace/kscience/kmath/nd/Structure2D; - public static fun div (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; public static fun minus (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public static fun plus (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public static fun point (Lspace/kscience/kmath/linear/MatrixContext;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; - public static fun times (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/Number;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public static fun times (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public static fun times (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; - public static fun unaryMinus (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public static fun unaryOperation (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public static fun unaryOperationFunction (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public static fun unaryPlus (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; @@ -792,15 +706,11 @@ public final class space/kscience/kmath/linear/RealMatrixContext : space/kscienc public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/nd/Structure2D; - public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun div (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; public synthetic fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun multiply (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/linear/BufferMatrix; public final fun one (II)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun plus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; @@ -808,12 +718,8 @@ public final class space/kscience/kmath/linear/RealMatrixContext : space/kscienc public fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferMatrix; public synthetic fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/Structure2D; public fun times (DLspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; - public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public fun times (Lspace/kscience/kmath/nd/Structure2D;D)Lspace/kscience/kmath/linear/BufferMatrix; - public fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; public final fun toBufferMatrix (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; @@ -852,16 +758,17 @@ public final class space/kscience/kmath/linear/UnitFeature : space/kscience/kmat public abstract interface class space/kscience/kmath/linear/VectorSpace : space/kscience/kmath/operations/Space { public static final field Companion Lspace/kscience/kmath/linear/VectorSpace$Companion; public abstract fun add (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public abstract fun getAlgebra ()Lspace/kscience/kmath/operations/Ring; public abstract fun getSize ()I - public abstract fun getSpace ()Lspace/kscience/kmath/operations/Space; public abstract fun getZero ()Lspace/kscience/kmath/structures/Buffer; - public abstract fun multiply (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; + public abstract fun scale (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Object;)Lspace/kscience/kmath/structures/Buffer; + public abstract fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; } public final class space/kscience/kmath/linear/VectorSpace$Companion { - public final fun buffered (ILspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferVectorSpace; - public static synthetic fun buffered$default (Lspace/kscience/kmath/linear/VectorSpace$Companion;ILspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lspace/kscience/kmath/linear/BufferVectorSpace; + public final fun buffered (ILspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferVectorSpace; + public static synthetic fun buffered$default (Lspace/kscience/kmath/linear/VectorSpace$Companion;ILspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lspace/kscience/kmath/linear/BufferVectorSpace; public final fun real (I)Lspace/kscience/kmath/linear/BufferVectorSpace; } @@ -870,13 +777,10 @@ public final class space/kscience/kmath/linear/VectorSpace$DefaultImpls { public static fun binaryOperation (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public static fun binaryOperationFunction (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public static fun bindSymbol (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lspace/kscience/kmath/structures/Buffer; - public static fun div (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public static fun getZero (Lspace/kscience/kmath/linear/VectorSpace;)Lspace/kscience/kmath/structures/Buffer; public static fun minus (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public static fun multiply (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public static fun plus (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public static fun times (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public static fun times (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public static fun scale (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Object;)Lspace/kscience/kmath/structures/Buffer; public static fun unaryMinus (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public static fun unaryOperation (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public static fun unaryOperationFunction (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; @@ -956,14 +860,28 @@ public final class space/kscience/kmath/nd/BufferNDAlgebraKt { public class space/kscience/kmath/nd/BufferedNDField : space/kscience/kmath/nd/BufferedNDRing, space/kscience/kmath/nd/NDField { public fun ([ILspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;)V public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun div (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun div (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public fun div (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; public fun div (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun divide (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; + public fun scale (Lspace/kscience/kmath/nd/NDStructure;D)Lspace/kscience/kmath/nd/NDStructure; + public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public fun times (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; } public class space/kscience/kmath/nd/BufferedNDRing : space/kscience/kmath/nd/BufferedNDSpace, space/kscience/kmath/nd/NDRing { @@ -990,11 +908,9 @@ public class space/kscience/kmath/nd/BufferedNDSpace : space/kscience/kmath/nd/B public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/nd/NDStructure; public fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; - public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun div (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public fun getBuffer (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/structures/Buffer; public final fun getBufferFactory ()Lkotlin/jvm/functions/Function2; - public synthetic fun getElementContext ()Ljava/lang/Object; + public synthetic fun getElementContext ()Lspace/kscience/kmath/operations/Algebra; public final fun getElementContext ()Lspace/kscience/kmath/operations/Space; public final fun getShape ()[I public fun getStrides ()Lspace/kscience/kmath/nd/Strides; @@ -1009,18 +925,12 @@ public class space/kscience/kmath/nd/BufferedNDSpace : space/kscience/kmath/nd/B public fun minus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; public fun minus (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun multiply (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun plus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public fun plus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; public fun plus (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; - public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun times (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; public fun unaryMinus (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; @@ -1065,7 +975,7 @@ public final class space/kscience/kmath/nd/MutableNDStructure$DefaultImpls { public abstract interface class space/kscience/kmath/nd/NDAlgebra { public static final field Companion Lspace/kscience/kmath/nd/NDAlgebra$Companion; public abstract fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; - public abstract fun getElementContext ()Ljava/lang/Object; + public abstract fun getElementContext ()Lspace/kscience/kmath/operations/Algebra; public abstract fun getShape ()[I public abstract fun invoke (Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public abstract fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; @@ -1093,7 +1003,7 @@ public class space/kscience/kmath/nd/NDBuffer : space/kscience/kmath/nd/NDStruct public fun toString ()Ljava/lang/String; } -public abstract interface class space/kscience/kmath/nd/NDField : space/kscience/kmath/nd/NDRing, space/kscience/kmath/operations/Field { +public abstract interface class space/kscience/kmath/nd/NDField : space/kscience/kmath/nd/NDRing, space/kscience/kmath/operations/Field, space/kscience/kmath/operations/ScaleOperations { public abstract fun div (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public abstract fun div (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; public abstract fun divide (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; @@ -1104,27 +1014,29 @@ public final class space/kscience/kmath/nd/NDField$DefaultImpls { public static fun binaryOperation (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun binaryOperationFunction (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public static fun bindSymbol (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;)Lspace/kscience/kmath/nd/NDStructure; - public static fun div (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun div (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun div (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public static fun div (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; public static fun div (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun divide (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun invoke (Lspace/kscience/kmath/nd/NDField;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun leftSideNumberOperation (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun leftSideNumberOperationFunction (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public static fun minus (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun minus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; public static fun minus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun multiply (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public static fun multiply (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun number (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public static fun plus (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun plus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; public static fun plus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun rightSideNumberOperation (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public static fun rightSideNumberOperationFunction (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public static fun times (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun times (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun times (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public static fun times (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; public static fun times (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun unaryMinus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun unaryOperation (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun unaryOperationFunction (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public static fun unaryPlus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; @@ -1145,22 +1057,17 @@ public final class space/kscience/kmath/nd/NDRing$DefaultImpls { public static fun binaryOperation (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun binaryOperationFunction (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public static fun bindSymbol (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;)Lspace/kscience/kmath/nd/NDStructure; - public static fun div (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public static fun invoke (Lspace/kscience/kmath/nd/NDRing;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun minus (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun minus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; public static fun minus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun multiply (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public static fun multiply (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun plus (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun plus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; public static fun plus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun times (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun times (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun times (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public static fun times (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; public static fun times (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun unaryMinus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun unaryOperation (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun unaryOperationFunction (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public static fun unaryPlus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; @@ -1171,7 +1078,6 @@ public abstract interface class space/kscience/kmath/nd/NDSpace : space/kscience public abstract fun add (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public abstract fun minus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public abstract fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; - public abstract fun multiply (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public abstract fun plus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public abstract fun plus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; } @@ -1184,18 +1090,13 @@ public final class space/kscience/kmath/nd/NDSpace$DefaultImpls { public static fun binaryOperation (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun binaryOperationFunction (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public static fun bindSymbol (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;)Lspace/kscience/kmath/nd/NDStructure; - public static fun div (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public static fun invoke (Lspace/kscience/kmath/nd/NDSpace;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun minus (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun minus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; public static fun minus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun multiply (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public static fun plus (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun plus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; public static fun plus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun times (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun times (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; - public static fun unaryMinus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun unaryOperation (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public static fun unaryOperationFunction (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public static fun unaryPlus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; @@ -1230,7 +1131,7 @@ public final class space/kscience/kmath/nd/NDStructureKt { public static final fun mapInPlace (Lspace/kscience/kmath/nd/MutableNDStructure;Lkotlin/jvm/functions/Function2;)V } -public final class space/kscience/kmath/nd/RealNDField : space/kscience/kmath/nd/BufferedNDField, space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/RingWithNumbers { +public final class space/kscience/kmath/nd/RealNDField : space/kscience/kmath/nd/BufferedNDField, space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/NumbersAddOperations, space/kscience/kmath/operations/ScaleOperations { public fun ([I)V public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; public fun acos (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; @@ -1258,9 +1159,6 @@ public final class space/kscience/kmath/nd/RealNDField : space/kscience/kmath/nd public fun getOne ()Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun getZero ()Ljava/lang/Object; public fun getZero ()Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; public fun ln (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; @@ -1273,6 +1171,7 @@ public final class space/kscience/kmath/nd/RealNDField : space/kscience/kmath/nd public fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public fun plus (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; @@ -1283,9 +1182,9 @@ public final class space/kscience/kmath/nd/RealNDField : space/kscience/kmath/nd public fun power (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDBuffer; public fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; - public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; + public fun scale (Lspace/kscience/kmath/nd/NDStructure;D)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; public fun sin (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; @@ -1310,7 +1209,7 @@ public final class space/kscience/kmath/nd/ShapeMismatchException : java/lang/Ru public final fun getExpected ()[I } -public final class space/kscience/kmath/nd/ShortNDRing : space/kscience/kmath/nd/BufferedNDRing, space/kscience/kmath/operations/RingWithNumbers { +public final class space/kscience/kmath/nd/ShortNDRing : space/kscience/kmath/nd/BufferedNDRing, space/kscience/kmath/operations/NumbersAddOperations { public fun ([I)V public synthetic fun getOne ()Ljava/lang/Object; public fun getOne ()Lspace/kscience/kmath/nd/NDBuffer; @@ -1420,12 +1319,8 @@ public abstract interface class space/kscience/kmath/operations/AlgebraElement { } public final class space/kscience/kmath/operations/AlgebraElementsKt { - public static final fun div (Lspace/kscience/kmath/operations/AlgebraElement;Ljava/lang/Number;)Lspace/kscience/kmath/operations/AlgebraElement; public static final fun div (Lspace/kscience/kmath/operations/AlgebraElement;Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; - public static final fun minus (Lspace/kscience/kmath/operations/AlgebraElement;Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; public static final fun plus (Lspace/kscience/kmath/operations/AlgebraElement;Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; - public static final fun times (Ljava/lang/Number;Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; - public static final fun times (Lspace/kscience/kmath/operations/AlgebraElement;Ljava/lang/Number;)Lspace/kscience/kmath/operations/AlgebraElement; public static final fun times (Lspace/kscience/kmath/operations/AlgebraElement;Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement; } @@ -1481,7 +1376,7 @@ public final class space/kscience/kmath/operations/BigInt$Companion { public final fun getZERO ()Lspace/kscience/kmath/operations/BigInt; } -public final class space/kscience/kmath/operations/BigIntField : space/kscience/kmath/operations/Field, space/kscience/kmath/operations/RingWithNumbers { +public final class space/kscience/kmath/operations/BigIntField : space/kscience/kmath/operations/Field, space/kscience/kmath/operations/NumbersAddOperations, space/kscience/kmath/operations/ScaleOperations { public static final field INSTANCE Lspace/kscience/kmath/operations/BigIntField; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun add (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; @@ -1490,8 +1385,6 @@ public final class space/kscience/kmath/operations/BigIntField : space/kscience/ public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/operations/BigInt; - public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Number;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun div (Lspace/kscience/kmath/operations/BigInt;Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; @@ -1511,9 +1404,7 @@ public final class space/kscience/kmath/operations/BigIntField : space/kscience/ public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun minus (Lspace/kscience/kmath/operations/BigInt;Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; public fun minus (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; - public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply (Lspace/kscience/kmath/operations/BigInt;Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; public fun multiply (Lspace/kscience/kmath/operations/BigInt;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; @@ -1526,6 +1417,8 @@ public final class space/kscience/kmath/operations/BigIntField : space/kscience/ public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/operations/BigInt;Ljava/lang/Number;)Lspace/kscience/kmath/operations/BigInt; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; + public fun scale (Lspace/kscience/kmath/operations/BigInt;D)Lspace/kscience/kmath/operations/BigInt; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public fun times (Ljava/lang/Number;Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; @@ -1565,8 +1458,6 @@ public final class space/kscience/kmath/operations/ByteRing : space/kscience/kma public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public fun bindSymbol (Ljava/lang/String;)Ljava/lang/Byte; public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; - public fun div (BLjava/lang/Number;)Ljava/lang/Byte; - public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun getOne ()Ljava/lang/Byte; public synthetic fun getOne ()Ljava/lang/Object; public fun getZero ()Ljava/lang/Byte; @@ -1577,8 +1468,6 @@ public final class space/kscience/kmath/operations/ByteRing : space/kscience/kma public fun minus (BB)Ljava/lang/Byte; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun multiply (BB)Ljava/lang/Byte; - public fun multiply (BLjava/lang/Number;)Ljava/lang/Byte; - public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun norm (B)Ljava/lang/Byte; public synthetic fun norm (Ljava/lang/Object;)Ljava/lang/Object; @@ -1590,10 +1479,6 @@ public final class space/kscience/kmath/operations/ByteRing : space/kscience/kma public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public fun times (BB)Ljava/lang/Byte; - public fun times (BLjava/lang/Number;)Ljava/lang/Byte; - public fun times (Ljava/lang/Number;B)Ljava/lang/Byte; - public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun unaryMinus (B)Ljava/lang/Byte; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; @@ -1605,16 +1490,34 @@ public final class space/kscience/kmath/operations/ByteRing : space/kscience/kma } public abstract interface class space/kscience/kmath/operations/ExponentialOperations : space/kscience/kmath/operations/Algebra { + public static final field ACOSH_OPERATION Ljava/lang/String; + public static final field ASINH_OPERATION Ljava/lang/String; + public static final field ATANH_OPERATION Ljava/lang/String; + public static final field COSH_OPERATION Ljava/lang/String; public static final field Companion Lspace/kscience/kmath/operations/ExponentialOperations$Companion; public static final field EXP_OPERATION Ljava/lang/String; public static final field LN_OPERATION Ljava/lang/String; + public static final field SINH_OPERATION Ljava/lang/String; + public static final field TANH_OPERATION Ljava/lang/String; + public abstract fun acosh (Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun asinh (Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun atanh (Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun cosh (Ljava/lang/Object;)Ljava/lang/Object; public abstract fun exp (Ljava/lang/Object;)Ljava/lang/Object; public abstract fun ln (Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun sinh (Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun tanh (Ljava/lang/Object;)Ljava/lang/Object; } public final class space/kscience/kmath/operations/ExponentialOperations$Companion { + public static final field ACOSH_OPERATION Ljava/lang/String; + public static final field ASINH_OPERATION Ljava/lang/String; + public static final field ATANH_OPERATION Ljava/lang/String; + public static final field COSH_OPERATION Ljava/lang/String; public static final field EXP_OPERATION Ljava/lang/String; public static final field LN_OPERATION Ljava/lang/String; + public static final field SINH_OPERATION Ljava/lang/String; + public static final field TANH_OPERATION Ljava/lang/String; } public final class space/kscience/kmath/operations/ExponentialOperations$DefaultImpls { @@ -1625,7 +1528,7 @@ public final class space/kscience/kmath/operations/ExponentialOperations$Default public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/ExponentialOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public abstract interface class space/kscience/kmath/operations/ExtendedField : space/kscience/kmath/operations/ExtendedFieldOperations, space/kscience/kmath/operations/Field, space/kscience/kmath/operations/NumericAlgebra { +public abstract interface class space/kscience/kmath/operations/ExtendedField : space/kscience/kmath/operations/ExtendedFieldOperations, space/kscience/kmath/operations/Field, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/ScaleOperations { public abstract fun acosh (Ljava/lang/Object;)Ljava/lang/Object; public abstract fun asinh (Ljava/lang/Object;)Ljava/lang/Object; public abstract fun atanh (Ljava/lang/Object;)Ljava/lang/Object; @@ -1643,12 +1546,12 @@ public final class space/kscience/kmath/operations/ExtendedField$DefaultImpls { public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public static fun bindSymbol (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;)Ljava/lang/Object; public static fun cosh (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; - public static fun div (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public static fun div (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public static fun div (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public static fun leftSideNumberOperation (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public static fun leftSideNumberOperationFunction (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public static fun minus (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun number (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Number;)Ljava/lang/Object; public static fun plus (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public static fun pow (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public static fun rightSideNumberOperation (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; @@ -1660,13 +1563,12 @@ public final class space/kscience/kmath/operations/ExtendedField$DefaultImpls { public static fun times (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public static fun times (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public static fun times (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; public static fun unaryOperation (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public static fun unaryPlus (Lspace/kscience/kmath/operations/ExtendedField;Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class space/kscience/kmath/operations/ExtendedFieldOperations : space/kscience/kmath/operations/ExponentialOperations, space/kscience/kmath/operations/FieldOperations, space/kscience/kmath/operations/HyperbolicOperations, space/kscience/kmath/operations/PowerOperations, space/kscience/kmath/operations/TrigonometricOperations { +public abstract interface class space/kscience/kmath/operations/ExtendedFieldOperations : space/kscience/kmath/operations/ExponentialOperations, space/kscience/kmath/operations/FieldOperations, space/kscience/kmath/operations/PowerOperations, space/kscience/kmath/operations/TrigonometricOperations { public abstract fun tan (Ljava/lang/Object;)Ljava/lang/Object; public abstract fun tanh (Ljava/lang/Object;)Ljava/lang/Object; public abstract fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; @@ -1676,7 +1578,6 @@ public final class space/kscience/kmath/operations/ExtendedFieldOperations$Defau public static fun binaryOperation (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public static fun bindSymbol (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun div (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public static fun div (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public static fun minus (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public static fun plus (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; @@ -1684,32 +1585,32 @@ public final class space/kscience/kmath/operations/ExtendedFieldOperations$Defau public static fun sqrt (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; public static fun tan (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; public static fun tanh (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public static fun times (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; public static fun unaryOperation (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public static fun unaryPlus (Lspace/kscience/kmath/operations/ExtendedFieldOperations;Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class space/kscience/kmath/operations/Field : space/kscience/kmath/operations/FieldOperations, space/kscience/kmath/operations/Ring { - public abstract fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; +public abstract interface class space/kscience/kmath/operations/Field : space/kscience/kmath/operations/FieldOperations, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/Ring, space/kscience/kmath/operations/ScaleOperations { + public abstract fun number (Ljava/lang/Number;)Ljava/lang/Object; } public final class space/kscience/kmath/operations/Field$DefaultImpls { public static fun binaryOperation (Lspace/kscience/kmath/operations/Field;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/Field;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public static fun bindSymbol (Lspace/kscience/kmath/operations/Field;Ljava/lang/String;)Ljava/lang/Object; - public static fun div (Lspace/kscience/kmath/operations/Field;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public static fun div (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public static fun div (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun leftSideNumberOperation (Lspace/kscience/kmath/operations/Field;Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun leftSideNumberOperationFunction (Lspace/kscience/kmath/operations/Field;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public static fun minus (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun number (Lspace/kscience/kmath/operations/Field;Ljava/lang/Number;)Ljava/lang/Object; public static fun plus (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun rightSideNumberOperation (Lspace/kscience/kmath/operations/Field;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun rightSideNumberOperationFunction (Lspace/kscience/kmath/operations/Field;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public static fun times (Lspace/kscience/kmath/operations/Field;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public static fun times (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public static fun times (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;)Ljava/lang/Object; public static fun unaryOperation (Lspace/kscience/kmath/operations/Field;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/Field;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public static fun unaryPlus (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;)Ljava/lang/Object; @@ -1731,14 +1632,10 @@ public final class space/kscience/kmath/operations/FieldOperations$DefaultImpls public static fun binaryOperation (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public static fun bindSymbol (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun div (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public static fun div (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public static fun minus (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public static fun plus (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public static fun times (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;)Ljava/lang/Object; public static fun unaryOperation (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public static fun unaryPlus (Lspace/kscience/kmath/operations/FieldOperations;Ljava/lang/Object;)Ljava/lang/Object; @@ -1771,8 +1668,6 @@ public final class space/kscience/kmath/operations/FloatField : space/kscience/k public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; public fun div (FF)Ljava/lang/Float; public fun div (FLjava/lang/Number;)Ljava/lang/Float; - public fun div (Ljava/lang/Number;F)Ljava/lang/Float; - public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun divide (FF)Ljava/lang/Float; @@ -1791,8 +1686,6 @@ public final class space/kscience/kmath/operations/FloatField : space/kscience/k public fun minus (FF)Ljava/lang/Float; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun multiply (FF)Ljava/lang/Float; - public fun multiply (FLjava/lang/Number;)Ljava/lang/Float; - public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun norm (F)Ljava/lang/Float; public synthetic fun norm (Ljava/lang/Object;)Ljava/lang/Object; @@ -1807,6 +1700,8 @@ public final class space/kscience/kmath/operations/FloatField : space/kscience/k public fun rightSideNumberOperation (Ljava/lang/String;FLjava/lang/Number;)Ljava/lang/Float; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public fun scale (FD)Ljava/lang/Float; + public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; public fun sin (F)Ljava/lang/Float; public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; public fun sinh (F)Ljava/lang/Float; @@ -1832,39 +1727,6 @@ public final class space/kscience/kmath/operations/FloatField : space/kscience/k public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class space/kscience/kmath/operations/HyperbolicOperations : space/kscience/kmath/operations/Algebra { - public static final field ACOSH_OPERATION Ljava/lang/String; - public static final field ASINH_OPERATION Ljava/lang/String; - public static final field ATANH_OPERATION Ljava/lang/String; - public static final field COSH_OPERATION Ljava/lang/String; - public static final field Companion Lspace/kscience/kmath/operations/HyperbolicOperations$Companion; - public static final field SINH_OPERATION Ljava/lang/String; - public static final field TANH_OPERATION Ljava/lang/String; - public abstract fun acosh (Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun asinh (Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun atanh (Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun cosh (Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun sinh (Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun tanh (Ljava/lang/Object;)Ljava/lang/Object; -} - -public final class space/kscience/kmath/operations/HyperbolicOperations$Companion { - public static final field ACOSH_OPERATION Ljava/lang/String; - public static final field ASINH_OPERATION Ljava/lang/String; - public static final field ATANH_OPERATION Ljava/lang/String; - public static final field COSH_OPERATION Ljava/lang/String; - public static final field SINH_OPERATION Ljava/lang/String; - public static final field TANH_OPERATION Ljava/lang/String; -} - -public final class space/kscience/kmath/operations/HyperbolicOperations$DefaultImpls { - public static fun binaryOperation (Lspace/kscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun bindSymbol (Lspace/kscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun unaryOperation (Lspace/kscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/HyperbolicOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; -} - public final class space/kscience/kmath/operations/IntRing : space/kscience/kmath/operations/Norm, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/Ring { public static final field INSTANCE Lspace/kscience/kmath/operations/IntRing; public fun add (II)Ljava/lang/Integer; @@ -1874,8 +1736,6 @@ public final class space/kscience/kmath/operations/IntRing : space/kscience/kmat public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public fun bindSymbol (Ljava/lang/String;)Ljava/lang/Integer; public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; - public fun div (ILjava/lang/Number;)Ljava/lang/Integer; - public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun getOne ()Ljava/lang/Integer; public synthetic fun getOne ()Ljava/lang/Object; public fun getZero ()Ljava/lang/Integer; @@ -1886,8 +1746,6 @@ public final class space/kscience/kmath/operations/IntRing : space/kscience/kmat public fun minus (II)Ljava/lang/Integer; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun multiply (II)Ljava/lang/Integer; - public fun multiply (ILjava/lang/Number;)Ljava/lang/Integer; - public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun norm (I)Ljava/lang/Integer; public synthetic fun norm (Ljava/lang/Object;)Ljava/lang/Object; @@ -1899,10 +1757,6 @@ public final class space/kscience/kmath/operations/IntRing : space/kscience/kmat public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public fun times (II)Ljava/lang/Integer; - public fun times (ILjava/lang/Number;)Ljava/lang/Integer; - public fun times (Ljava/lang/Number;I)Ljava/lang/Integer; - public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun unaryMinus (I)Ljava/lang/Integer; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; @@ -1923,7 +1777,7 @@ public final class space/kscience/kmath/operations/JBigDecimalField : space/ksci public final class space/kscience/kmath/operations/JBigDecimalField$Companion : space/kscience/kmath/operations/JBigDecimalFieldBase { } -public abstract class space/kscience/kmath/operations/JBigDecimalFieldBase : space/kscience/kmath/operations/Field, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/PowerOperations { +public abstract class space/kscience/kmath/operations/JBigDecimalFieldBase : space/kscience/kmath/operations/Field, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/PowerOperations, space/kscience/kmath/operations/ScaleOperations { public fun ()V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun add (Ljava/math/BigDecimal;Ljava/math/BigDecimal;)Ljava/math/BigDecimal; @@ -1932,8 +1786,6 @@ public abstract class space/kscience/kmath/operations/JBigDecimalFieldBase : spa public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun bindSymbol (Ljava/lang/String;)Ljava/math/BigDecimal; - public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Number;Ljava/math/BigDecimal;)Ljava/math/BigDecimal; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun div (Ljava/math/BigDecimal;Ljava/lang/Number;)Ljava/math/BigDecimal; @@ -1949,9 +1801,7 @@ public abstract class space/kscience/kmath/operations/JBigDecimalFieldBase : spa public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun minus (Ljava/math/BigDecimal;Ljava/math/BigDecimal;)Ljava/math/BigDecimal; - public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply (Ljava/math/BigDecimal;Ljava/lang/Number;)Ljava/math/BigDecimal; public fun multiply (Ljava/math/BigDecimal;Ljava/math/BigDecimal;)Ljava/math/BigDecimal; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; public fun number (Ljava/lang/Number;)Ljava/math/BigDecimal; @@ -1964,6 +1814,8 @@ public abstract class space/kscience/kmath/operations/JBigDecimalFieldBase : spa public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperation (Ljava/lang/String;Ljava/math/BigDecimal;Ljava/lang/Number;)Ljava/math/BigDecimal; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; + public fun scale (Ljava/math/BigDecimal;D)Ljava/math/BigDecimal; public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; public fun sqrt (Ljava/math/BigDecimal;)Ljava/math/BigDecimal; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; @@ -1981,7 +1833,7 @@ public abstract class space/kscience/kmath/operations/JBigDecimalFieldBase : spa public fun unaryPlus (Ljava/math/BigDecimal;)Ljava/math/BigDecimal; } -public final class space/kscience/kmath/operations/JBigIntegerField : space/kscience/kmath/operations/Field, space/kscience/kmath/operations/NumericAlgebra { +public final class space/kscience/kmath/operations/JBigIntegerField : space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/Ring { public static final field INSTANCE Lspace/kscience/kmath/operations/JBigIntegerField; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun add (Ljava/math/BigInteger;Ljava/math/BigInteger;)Ljava/math/BigInteger; @@ -1990,14 +1842,6 @@ public final class space/kscience/kmath/operations/JBigIntegerField : space/ksci public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun bindSymbol (Ljava/lang/String;)Ljava/math/BigInteger; - public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Number;Ljava/math/BigInteger;)Ljava/math/BigInteger; - public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/math/BigInteger;Ljava/lang/Number;)Ljava/math/BigInteger; - public fun div (Ljava/math/BigInteger;Ljava/math/BigInteger;)Ljava/math/BigInteger; - public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide (Ljava/math/BigInteger;Ljava/math/BigInteger;)Ljava/math/BigInteger; public synthetic fun getOne ()Ljava/lang/Object; public fun getOne ()Ljava/math/BigInteger; public synthetic fun getZero ()Ljava/lang/Object; @@ -2007,9 +1851,7 @@ public final class space/kscience/kmath/operations/JBigIntegerField : space/ksci public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun minus (Ljava/math/BigInteger;Ljava/math/BigInteger;)Ljava/math/BigInteger; - public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply (Ljava/math/BigInteger;Ljava/lang/Number;)Ljava/math/BigInteger; public fun multiply (Ljava/math/BigInteger;Ljava/math/BigInteger;)Ljava/math/BigInteger; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; public fun number (Ljava/lang/Number;)Ljava/math/BigInteger; @@ -2018,11 +1860,7 @@ public final class space/kscience/kmath/operations/JBigIntegerField : space/ksci public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperation (Ljava/lang/String;Ljava/math/BigInteger;Ljava/lang/Number;)Ljava/math/BigInteger; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Ljava/math/BigInteger;)Ljava/math/BigInteger; - public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/math/BigInteger;Ljava/lang/Number;)Ljava/math/BigInteger; public fun times (Ljava/math/BigInteger;Ljava/math/BigInteger;)Ljava/math/BigInteger; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; public fun unaryMinus (Ljava/math/BigInteger;)Ljava/math/BigInteger; @@ -2045,8 +1883,6 @@ public final class space/kscience/kmath/operations/LongRing : space/kscience/kma public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public fun bindSymbol (Ljava/lang/String;)Ljava/lang/Long; public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; - public fun div (JLjava/lang/Number;)Ljava/lang/Long; - public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun getOne ()Ljava/lang/Long; public synthetic fun getOne ()Ljava/lang/Object; public fun getZero ()Ljava/lang/Long; @@ -2057,8 +1893,6 @@ public final class space/kscience/kmath/operations/LongRing : space/kscience/kma public fun minus (JJ)Ljava/lang/Long; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun multiply (JJ)Ljava/lang/Long; - public fun multiply (JLjava/lang/Number;)Ljava/lang/Long; - public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun norm (J)Ljava/lang/Long; public synthetic fun norm (Ljava/lang/Object;)Ljava/lang/Object; @@ -2070,10 +1904,6 @@ public final class space/kscience/kmath/operations/LongRing : space/kscience/kma public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public fun times (JJ)Ljava/lang/Long; - public fun times (JLjava/lang/Number;)Ljava/lang/Long; - public fun times (Ljava/lang/Number;J)Ljava/lang/Long; - public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun unaryMinus (J)Ljava/lang/Long; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; @@ -2088,6 +1918,25 @@ public abstract interface class space/kscience/kmath/operations/Norm { public abstract fun norm (Ljava/lang/Object;)Ljava/lang/Object; } +public final class space/kscience/kmath/operations/NumbersAddOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/NumbersAddOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/NumbersAddOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/NumbersAddOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun leftSideNumberOperation (Lspace/kscience/kmath/operations/NumbersAddOperations;Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun leftSideNumberOperationFunction (Lspace/kscience/kmath/operations/NumbersAddOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun minus (Lspace/kscience/kmath/operations/NumbersAddOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/NumbersAddOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/NumbersAddOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/NumbersAddOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/NumbersAddOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/NumbersAddOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun rightSideNumberOperation (Lspace/kscience/kmath/operations/NumbersAddOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun rightSideNumberOperationFunction (Lspace/kscience/kmath/operations/NumbersAddOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun unaryOperation (Lspace/kscience/kmath/operations/NumbersAddOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/NumbersAddOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/NumbersAddOperations;Ljava/lang/Object;)Ljava/lang/Object; +} + public abstract interface class space/kscience/kmath/operations/NumericAlgebra : space/kscience/kmath/operations/Algebra { public abstract fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; @@ -2135,7 +1984,7 @@ public final class space/kscience/kmath/operations/PowerOperations$DefaultImpls public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/PowerOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class space/kscience/kmath/operations/RealField : space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/Norm { +public final class space/kscience/kmath/operations/RealField : space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/Norm, space/kscience/kmath/operations/ScaleOperations { public static final field INSTANCE Lspace/kscience/kmath/operations/RealField; public fun acos (D)Ljava/lang/Double; public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; @@ -2162,8 +2011,6 @@ public final class space/kscience/kmath/operations/RealField : space/kscience/km public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; public fun div (DD)Ljava/lang/Double; public fun div (DLjava/lang/Number;)Ljava/lang/Double; - public fun div (Ljava/lang/Number;D)Ljava/lang/Double; - public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun divide (DD)Ljava/lang/Double; @@ -2182,8 +2029,6 @@ public final class space/kscience/kmath/operations/RealField : space/kscience/km public fun minus (DD)Ljava/lang/Double; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun multiply (DD)Ljava/lang/Double; - public fun multiply (DLjava/lang/Number;)Ljava/lang/Double; - public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun norm (D)Ljava/lang/Double; public synthetic fun norm (Ljava/lang/Object;)Ljava/lang/Object; @@ -2198,6 +2043,8 @@ public final class space/kscience/kmath/operations/RealField : space/kscience/km public fun rightSideNumberOperation (Ljava/lang/String;DLjava/lang/Number;)Ljava/lang/Double; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public fun scale (DD)Ljava/lang/Double; + public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; public fun sin (D)Ljava/lang/Double; public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; public fun sinh (D)Ljava/lang/Double; @@ -2231,13 +2078,9 @@ public final class space/kscience/kmath/operations/Ring$DefaultImpls { public static fun binaryOperation (Lspace/kscience/kmath/operations/Ring;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/Ring;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public static fun bindSymbol (Lspace/kscience/kmath/operations/Ring;Ljava/lang/String;)Ljava/lang/Object; - public static fun div (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public static fun minus (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public static fun plus (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public static fun times (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;)Ljava/lang/Object; public static fun unaryOperation (Lspace/kscience/kmath/operations/Ring;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/Ring;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public static fun unaryPlus (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;)Ljava/lang/Object; @@ -2259,41 +2102,30 @@ public final class space/kscience/kmath/operations/RingOperations$DefaultImpls { public static fun binaryOperation (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public static fun bindSymbol (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun div (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public static fun minus (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public static fun plus (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public static fun times (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;)Ljava/lang/Object; public static fun unaryOperation (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public static fun unaryPlus (Lspace/kscience/kmath/operations/RingOperations;Ljava/lang/Object;)Ljava/lang/Object; } -public final class space/kscience/kmath/operations/RingWithNumbers$DefaultImpls { - public static fun binaryOperation (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun bindSymbol (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Ljava/lang/Object; - public static fun div (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun leftSideNumberOperation (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun leftSideNumberOperationFunction (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun minus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun minus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun minus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun number (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;)Ljava/lang/Object; - public static fun plus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun plus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun rightSideNumberOperation (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun rightSideNumberOperationFunction (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun times (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun times (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryMinus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lspace/kscience/kmath/operations/RingWithNumbers;Ljava/lang/Object;)Ljava/lang/Object; +public abstract interface class space/kscience/kmath/operations/ScaleOperations : space/kscience/kmath/operations/Algebra { + public abstract fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public abstract fun scale (Ljava/lang/Object;D)Ljava/lang/Object; + public abstract fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; +} + +public final class space/kscience/kmath/operations/ScaleOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/ScaleOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/ScaleOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/ScaleOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun div (Lspace/kscience/kmath/operations/ScaleOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/ScaleOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public static fun times (Lspace/kscience/kmath/operations/ScaleOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/ScaleOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/ScaleOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } public final class space/kscience/kmath/operations/ShortRing : space/kscience/kmath/operations/Norm, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/Ring { @@ -2305,8 +2137,6 @@ public final class space/kscience/kmath/operations/ShortRing : space/kscience/km public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun bindSymbol (Ljava/lang/String;)Ljava/lang/Short; - public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun div (SLjava/lang/Number;)Ljava/lang/Short; public synthetic fun getOne ()Ljava/lang/Object; public fun getOne ()Ljava/lang/Short; public synthetic fun getZero ()Ljava/lang/Object; @@ -2316,9 +2146,7 @@ public final class space/kscience/kmath/operations/ShortRing : space/kscience/km public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun minus (SS)Ljava/lang/Short; - public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply (SLjava/lang/Number;)Ljava/lang/Short; public fun multiply (SS)Ljava/lang/Short; public synthetic fun norm (Ljava/lang/Object;)Ljava/lang/Object; public fun norm (S)Ljava/lang/Short; @@ -2329,11 +2157,7 @@ public final class space/kscience/kmath/operations/ShortRing : space/kscience/km public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperation (Ljava/lang/String;SLjava/lang/Number;)Ljava/lang/Short; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;S)Ljava/lang/Short; - public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (SLjava/lang/Number;)Ljava/lang/Short; public fun times (SS)Ljava/lang/Short; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; public fun unaryMinus (S)Ljava/lang/Short; @@ -2352,12 +2176,8 @@ public final class space/kscience/kmath/operations/Space$DefaultImpls { public static fun binaryOperation (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public static fun bindSymbol (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;)Ljava/lang/Object; - public static fun div (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public static fun minus (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public static fun plus (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lspace/kscience/kmath/operations/Space;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun unaryMinus (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;)Ljava/lang/Object; public static fun unaryOperation (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public static fun unaryPlus (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;)Ljava/lang/Object; @@ -2369,12 +2189,8 @@ public abstract interface class space/kscience/kmath/operations/SpaceOperations public static final field PLUS_OPERATION Ljava/lang/String; public abstract fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public abstract fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public abstract fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public abstract fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public abstract fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; public abstract fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public abstract fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; @@ -2389,12 +2205,8 @@ public final class space/kscience/kmath/operations/SpaceOperations$DefaultImpls public static fun binaryOperation (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public static fun bindSymbol (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun div (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public static fun minus (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public static fun plus (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public static fun times (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public static fun unaryMinus (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;)Ljava/lang/Object; public static fun unaryOperation (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public static fun unaryPlus (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;)Ljava/lang/Object; @@ -2776,8 +2588,6 @@ public final class space/kscience/kmath/structures/RealBufferField : space/kscie public fun cos-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; public fun cosh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun div (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; @@ -2798,9 +2608,7 @@ public final class space/kscience/kmath/structures/RealBufferField : space/kscie public fun ln-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun minus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)[D public fun multiply-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; @@ -2813,6 +2621,8 @@ public final class space/kscience/kmath/structures/RealBufferField : space/kscie public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; + public fun scale-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;D)[D public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; public fun sin-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; @@ -2863,9 +2673,7 @@ public final class space/kscience/kmath/structures/RealBufferFieldOperations : s public fun cos-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; public fun cosh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public fun div (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun divide-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D @@ -2875,9 +2683,7 @@ public final class space/kscience/kmath/structures/RealBufferFieldOperations : s public fun ln-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun minus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)[D public fun multiply-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun plus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; @@ -2895,14 +2701,10 @@ public final class space/kscience/kmath/structures/RealBufferFieldOperations : s public fun tan-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; public fun tanh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public fun times (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public fun unaryMinus-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/HyperSquareDomain.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/HyperSquareDomain.kt index 3d0c6d3b8..c948f8672 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/HyperSquareDomain.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/HyperSquareDomain.kt @@ -16,8 +16,8 @@ package space.kscience.kmath.domains import space.kscience.kmath.linear.Point +import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.structures.Buffer -import space.kscience.kmath.structures.RealBuffer import space.kscience.kmath.structures.indices /** @@ -26,6 +26,7 @@ import space.kscience.kmath.structures.indices * * @author Alexander Nozik */ +@UnstableKMathAPI public class HyperSquareDomain(private val lower: Buffer, private val upper: Buffer) : RealDomain { public override val dimension: Int get() = lower.size @@ -33,26 +34,10 @@ public class HyperSquareDomain(private val lower: Buffer, private val up point[i] in lower[i]..upper[i] } - public override fun getLowerBound(num: Int, point: Point): Double = lower[num] - public override fun getLowerBound(num: Int): Double = lower[num] - public override fun getUpperBound(num: Int, point: Point): Double = upper[num] - public override fun getUpperBound(num: Int): Double = upper[num] - public override fun nearestInDomain(point: Point): Point { - val res = DoubleArray(point.size) { i -> - when { - point[i] < lower[i] -> lower[i] - point[i] > upper[i] -> upper[i] - else -> point[i] - } - } - - return RealBuffer(*res) - } - public override fun volume(): Double { var res = 1.0 diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/RealDomain.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/RealDomain.kt index 13555dad9..c20cbfec1 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/RealDomain.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/RealDomain.kt @@ -15,45 +15,27 @@ */ package space.kscience.kmath.domains -import space.kscience.kmath.linear.Point +import space.kscience.kmath.misc.UnstableKMathAPI /** * n-dimensional volume * * @author Alexander Nozik */ +@UnstableKMathAPI public interface RealDomain : Domain { - public fun nearestInDomain(point: Point): Point - - /** - * The lower edge for the domain going down from point - * @param num - * @param point - * @return - */ - public fun getLowerBound(num: Int, point: Point): Double? - - /** - * The upper edge of the domain going up from point - * @param num - * @param point - * @return - */ - public fun getUpperBound(num: Int, point: Point): Double? /** * Global lower edge - * @param num - * @return + * @param num axis number */ - public fun getLowerBound(num: Int): Double? + public fun getLowerBound(num: Int): Double /** * Global upper edge - * @param num - * @return + * @param num axis number */ - public fun getUpperBound(num: Int): Double? + public fun getUpperBound(num: Int): Double /** * Hyper volume diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/UnconstrainedDomain.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/UnconstrainedDomain.kt index f1bcc50ad..002caac50 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/UnconstrainedDomain.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/UnconstrainedDomain.kt @@ -16,19 +16,15 @@ package space.kscience.kmath.domains import space.kscience.kmath.linear.Point +import space.kscience.kmath.misc.UnstableKMathAPI +@UnstableKMathAPI public class UnconstrainedDomain(public override val dimension: Int) : RealDomain { public override operator fun contains(point: Point): Boolean = true - public override fun getLowerBound(num: Int, point: Point): Double? = Double.NEGATIVE_INFINITY + public override fun getLowerBound(num: Int): Double = Double.NEGATIVE_INFINITY - public override fun getLowerBound(num: Int): Double? = Double.NEGATIVE_INFINITY - - public override fun getUpperBound(num: Int, point: Point): Double? = Double.POSITIVE_INFINITY - - public override fun getUpperBound(num: Int): Double? = Double.POSITIVE_INFINITY - - public override fun nearestInDomain(point: Point): Point = point + public override fun getUpperBound(num: Int): Double = Double.POSITIVE_INFINITY public override fun volume(): Double = Double.POSITIVE_INFINITY } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/UnivariateDomain.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/UnivariateDomain.kt index 36cd4afa7..d20349960 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/UnivariateDomain.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/UnivariateDomain.kt @@ -1,11 +1,11 @@ package space.kscience.kmath.domains import space.kscience.kmath.linear.Point -import space.kscience.kmath.structures.asBuffer +import space.kscience.kmath.misc.UnstableKMathAPI +@UnstableKMathAPI public inline class UnivariateDomain(public val range: ClosedFloatingPointRange) : RealDomain { - public override val dimension: Int - get() = 1 + public override val dimension: Int get() = 1 public operator fun contains(d: Double): Boolean = range.contains(d) @@ -14,33 +14,12 @@ public inline class UnivariateDomain(public val range: ClosedFloatingPointRange< return contains(point[0]) } - public override fun nearestInDomain(point: Point): Point { - require(point.size == 1) - val value = point[0] - - return when { - value in range -> point - value >= range.endInclusive -> doubleArrayOf(range.endInclusive).asBuffer() - else -> doubleArrayOf(range.start).asBuffer() - } - } - - public override fun getLowerBound(num: Int, point: Point): Double? { + public override fun getLowerBound(num: Int): Double { require(num == 0) return range.start } - public override fun getUpperBound(num: Int, point: Point): Double? { - require(num == 0) - return range.endInclusive - } - - public override fun getLowerBound(num: Int): Double? { - require(num == 0) - return range.start - } - - public override fun getUpperBound(num: Int): Double? { + public override fun getUpperBound(num: Int): Double { require(num == 0) return range.endInclusive } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/FunctionalExpressionAlgebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/FunctionalExpressionAlgebra.kt index 5177bc868..3c23d0ecf 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/FunctionalExpressionAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/FunctionalExpressionAlgebra.kt @@ -48,18 +48,21 @@ public open class FunctionalExpressionSpace>( ) : FunctionalExpressionAlgebra(algebra), Space> { public override val zero: Expression get() = const(algebra.zero) + override fun Expression.unaryMinus(): Expression = + unaryOperation(SpaceOperations.MINUS_OPERATION, this) + /** * Builds an Expression of addition of two another expressions. */ public override fun add(a: Expression, b: Expression): Expression = - binaryOperationFunction(SpaceOperations.PLUS_OPERATION)(a, b) + binaryOperation(SpaceOperations.PLUS_OPERATION, a, b) - /** - * Builds an Expression of multiplication of expression by number. - */ - public override fun multiply(a: Expression, k: Number): Expression = Expression { arguments -> - algebra.multiply(a.invoke(arguments), k) - } +// /** +// * Builds an Expression of multiplication of expression by number. +// */ +// public override fun multiply(a: Expression, k: Number): Expression = Expression { arguments -> +// algebra.multiply(a.invoke(arguments), k) +// } public operator fun Expression.plus(arg: T): Expression = this + const(arg) public operator fun Expression.minus(arg: T): Expression = this - const(arg) @@ -71,13 +74,13 @@ public open class FunctionalExpressionSpace>( public override fun binaryOperationFunction(operation: String): (left: Expression, right: Expression) -> Expression = super.binaryOperationFunction(operation) + } public open class FunctionalExpressionRing>( algebra: A, ) : FunctionalExpressionSpace(algebra), Ring> { - public override val one: Expression - get() = const(algebra.one) + public override val one: Expression get() = const(algebra.one) /** * Builds an Expression of multiplication of two expressions. @@ -95,9 +98,10 @@ public open class FunctionalExpressionRing>( super.binaryOperationFunction(operation) } -public open class FunctionalExpressionField>( +public open class FunctionalExpressionField>( algebra: A, -) : FunctionalExpressionRing(algebra), Field> { +) : FunctionalExpressionRing(algebra), Field>, + ScaleOperations> { /** * Builds an Expression of division an expression by another one. */ @@ -112,6 +116,10 @@ public open class FunctionalExpressionField>( public override fun binaryOperationFunction(operation: String): (left: Expression, right: Expression) -> Expression = super.binaryOperationFunction(operation) + + override fun scale(a: Expression, value: Double): Expression = algebra { + Expression { args -> a(args) * value } + } } public open class FunctionalExpressionExtendedField>( @@ -160,5 +168,6 @@ public inline fun > A.expressionInRing(block: FunctionalExpressio public inline fun > A.expressionInField(block: FunctionalExpressionField.() -> Expression): Expression = FunctionalExpressionField(this).block() -public inline fun > A.expressionInExtendedField(block: FunctionalExpressionExtendedField.() -> Expression): Expression = - FunctionalExpressionExtendedField(this).block() +public inline fun > A.expressionInExtendedField( + block: FunctionalExpressionExtendedField.() -> Expression, +): Expression = FunctionalExpressionExtendedField(this).block() diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SimpleAutoDiff.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SimpleAutoDiff.kt index c710ba679..4b5b3311e 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SimpleAutoDiff.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SimpleAutoDiff.kt @@ -47,36 +47,6 @@ public fun DerivationResult.grad(vararg variables: Symbol): Point> F.simpleAutoDiff( - bindings: Map, - body: SimpleAutoDiffField.() -> AutoDiffValue, -): DerivationResult { - contract { callsInPlace(body, InvocationKind.EXACTLY_ONCE) } - - return SimpleAutoDiffField(this, bindings).differentiate(body) -} - -public fun > F.simpleAutoDiff( - vararg bindings: Pair, - body: SimpleAutoDiffField.() -> AutoDiffValue, -): DerivationResult = simpleAutoDiff(bindings.toMap(), body) - /** * Represents field in context of which functions can be derived. */ @@ -84,12 +54,9 @@ public fun > F.simpleAutoDiff( public open class SimpleAutoDiffField>( public val context: F, bindings: Map, -) : Field>, ExpressionAlgebra>, RingWithNumbers> { - public override val zero: AutoDiffValue - get() = const(context.zero) - - public override val one: AutoDiffValue - get() = const(context.one) +) : Field>, ExpressionAlgebra>, NumbersAddOperations> { + public override val zero: AutoDiffValue get() = const(context.zero) + public override val one: AutoDiffValue get() = const(context.one) // this stack contains pairs of blocks and values to apply them to private var stack: Array = arrayOfNulls(8) @@ -137,6 +104,8 @@ public open class SimpleAutoDiffField>( override fun const(value: T): AutoDiffValue = AutoDiffValue(value) + override fun number(value: Number): AutoDiffValue = const { one * value } + /** * A variable accessing inner state of derivatives. * Use this value in inner builders to avoid creating additional derivative bindings. @@ -175,21 +144,24 @@ public open class SimpleAutoDiffField>( return DerivationResult(result.value, bindings.mapValues { it.value.d }, context) } - // Overloads for Double constants +// // Overloads for Double constants +// +// public override operator fun Number.plus(b: AutoDiffValue): AutoDiffValue = +// derive(const { this@plus.toDouble() * one + b.value }) { z -> +// b.d += z.d +// } +// +// public override operator fun AutoDiffValue.plus(b: Number): AutoDiffValue = b.plus(this) +// +// public override operator fun Number.minus(b: AutoDiffValue): AutoDiffValue = +// derive(const { this@minus.toDouble() * one - b.value }) { z -> b.d -= z.d } +// +// public override operator fun AutoDiffValue.minus(b: Number): AutoDiffValue = +// derive(const { this@minus.value - one * b.toDouble() }) { z -> d += z.d } - public override operator fun Number.plus(b: AutoDiffValue): AutoDiffValue = - derive(const { this@plus.toDouble() * one + b.value }) { z -> - b.d += z.d - } - - public override operator fun AutoDiffValue.plus(b: Number): AutoDiffValue = b.plus(this) - - public override operator fun Number.minus(b: AutoDiffValue): AutoDiffValue = - derive(const { this@minus.toDouble() * one - b.value }) { z -> b.d -= z.d } - - public override operator fun AutoDiffValue.minus(b: Number): AutoDiffValue = - derive(const { this@minus.value - one * b.toDouble() }) { z -> this@minus.d += z.d } + override fun AutoDiffValue.unaryMinus(): AutoDiffValue = + derive(const { -value }) { z -> d -= z.d } // Basic math (+, -, *, /) @@ -211,12 +183,44 @@ public open class SimpleAutoDiffField>( b.d -= z.d * a.value / (b.value * b.value) } - public override fun multiply(a: AutoDiffValue, k: Number): AutoDiffValue = - derive(const { k.toDouble() * a.value }) { z -> - a.d += z.d * k.toDouble() + public override fun scale(a: AutoDiffValue, value: Double): AutoDiffValue = + derive(const { value * a.value }) { z -> + a.d += z.d * value } } + +/** + * Runs differentiation and establishes [SimpleAutoDiffField] context inside the block of code. + * + * The partial derivatives are placed in argument `d` variable + * + * Example: + * ``` + * val x by symbol // define variable(s) and their values + * val y = RealField.withAutoDiff() { sqr(x) + 5 * x + 3 } // write formulate in deriv context + * assertEquals(17.0, y.x) // the value of result (y) + * assertEquals(9.0, x.d) // dy/dx + * ``` + * + * @param body the action in [SimpleAutoDiffField] context returning [AutoDiffVariable] to differentiate with respect to. + * @return the result of differentiation. + */ +public fun > F.simpleAutoDiff( + bindings: Map, + body: SimpleAutoDiffField.() -> AutoDiffValue, +): DerivationResult { + contract { callsInPlace(body, InvocationKind.EXACTLY_ONCE) } + + return SimpleAutoDiffField(this, bindings).differentiate(body) +} + +public fun > F.simpleAutoDiff( + vararg bindings: Pair, + body: SimpleAutoDiffField.() -> AutoDiffValue, +): DerivationResult = simpleAutoDiff(bindings.toMap(), body) + + /** * A constructs that creates a derivative structure with required order on-demand */ @@ -247,19 +251,20 @@ public fun > simpleAutoDiff(field: F): AutoDiffProcessor> SimpleAutoDiffField.sqr(x: AutoDiffValue): AutoDiffValue = - derive(const { x.value * x.value }) { z -> x.d += z.d * 2 * x.value } +public fun > SimpleAutoDiffField.sqr(x: AutoDiffValue): AutoDiffValue = + derive(const { x.value * x.value }) { z -> x.d += z.d * 2.0 * x.value } // x ^ 1/2 public fun > SimpleAutoDiffField.sqrt(x: AutoDiffValue): AutoDiffValue = - derive(const { sqrt(x.value) }) { z -> x.d += z.d * 0.5 / z.value } + derive(const { sqrt(x.value) }) { z -> x.d += z.d / 2.0 / z.value } // x ^ y (const) public fun > SimpleAutoDiffField.pow( x: AutoDiffValue, y: Double, -): AutoDiffValue = - derive(const { power(x.value, y) }) { z -> x.d += z.d * y * power(x.value, y - 1) } +): AutoDiffValue = derive(const { power(x.value, y) }) { z -> + x.d += z.d * y * power(x.value, y - 1) +} public fun > SimpleAutoDiffField.pow( x: AutoDiffValue, @@ -328,7 +333,13 @@ public fun > SimpleAutoDiffField.atanh(x: Au public class SimpleAutoDiffExtendedField>( context: F, bindings: Map, -) : ExtendedField>, SimpleAutoDiffField(context, bindings) { +) : ExtendedField>, ScaleOperations>, + SimpleAutoDiffField(context, bindings) { + + override fun number(value: Number): AutoDiffValue = const { number(value) } + + override fun scale(a: AutoDiffValue, value: Double): AutoDiffValue = a * number(value) + // x ^ 2 public fun sqr(x: AutoDiffValue): AutoDiffValue = (this as SimpleAutoDiffField).sqr(x) diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferMatrix.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferMatrix.kt index f8f7f5a05..ef1d82795 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferMatrix.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferMatrix.kt @@ -78,12 +78,12 @@ public class BufferMatrixContext>( } } - override fun multiply(a: Matrix, k: Number): BufferMatrix { - val aBufferMatrix = a.toBufferMatrix() - return elementContext { - produce(a.rowNum, a.colNum) { i, j -> aBufferMatrix[i, j] * k.toDouble() } - } - } +// override fun multiply(a: Matrix, k: Number): BufferMatrix { +// val aBufferMatrix = a.toBufferMatrix() +// return elementContext { +// produce(a.rowNum, a.colNum) { i, j -> aBufferMatrix[i, j] * k.toDouble() } +// } +// } public companion object } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixContext.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixContext.kt index c999a170c..639d77e85 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixContext.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixContext.kt @@ -1,10 +1,7 @@ package space.kscience.kmath.linear import space.kscience.kmath.misc.UnstableKMathAPI -import space.kscience.kmath.operations.Ring -import space.kscience.kmath.operations.SpaceOperations -import space.kscience.kmath.operations.invoke -import space.kscience.kmath.operations.sum +import space.kscience.kmath.operations.* import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.BufferFactory import space.kscience.kmath.structures.asSequence @@ -167,9 +164,9 @@ public interface GenericMatrixContext, out M : Matrix> : return produce(rowNum, colNum) { i, j -> elementContext { get(i, j) + b[i, j] } } } - - public override fun multiply(a: Matrix, k: Number): M = - produce(a.rowNum, a.colNum) { i, j -> elementContext { a[i, j] * k } } +// +// public override fun multiply(a: Matrix, k: Number): M = +// produce(a.rowNum, a.colNum) { i, j -> elementContext { a[i, j] * k } } public override operator fun Matrix.times(value: T): M = produce(rowNum, colNum) { i, j -> elementContext { get(i, j) * value } } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealMatrixContext.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealMatrixContext.kt index 5f28e6f4c..a53f0837f 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealMatrixContext.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealMatrixContext.kt @@ -21,6 +21,8 @@ public object RealMatrixContext : MatrixContext> { if (i == j) 1.0 else 0.0 } + DiagonalFeature + override fun Matrix.unaryMinus(): Matrix = produce(rowNum, colNum) { i, j -> -get(i, j) } + public override infix fun Matrix.dot(other: Matrix): BufferMatrix { require(colNum == other.rowNum) { "Matrix dot operation dimension mismatch: ($rowNum, $colNum) x (${other.rowNum}, ${other.colNum})" } val bufferMatrix = toBufferMatrix() @@ -60,12 +62,16 @@ public object RealMatrixContext : MatrixContext> { val bufferMatrix = toBufferMatrix() return produce(rowNum, colNum) { i, j -> bufferMatrix[i, j] * value } } - - - override fun multiply(a: Matrix, k: Number): BufferMatrix { - val aBufferMatrix = a.toBufferMatrix() - return produce(a.rowNum, a.colNum) { i, j -> aBufferMatrix[i, j] * k.toDouble() } - } +// +// override fun multiply(a: Matrix, k: Number): BufferMatrix { +// val aBufferMatrix = a.toBufferMatrix() +// return produce(a.rowNum, a.colNum) { i, j -> aBufferMatrix[i, j] * k.toDouble() } +// } +// +// override fun divide(a: Matrix, k: Number): BufferMatrix { +// val aBufferMatrix = a.toBufferMatrix() +// return produce(a.rowNum, a.colNum) { i, j -> aBufferMatrix[i, j] / k.toDouble() } +// } } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VectorSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VectorSpace.kt index 310c1350c..fd3144d24 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VectorSpace.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VectorSpace.kt @@ -1,6 +1,7 @@ package space.kscience.kmath.linear import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.Ring import space.kscience.kmath.operations.Space import space.kscience.kmath.operations.invoke import space.kscience.kmath.structures.Buffer @@ -10,21 +11,18 @@ import space.kscience.kmath.structures.BufferFactory * A linear space for vectors. * Could be used on any point-like structure */ -public interface VectorSpace> : Space> { +public interface VectorSpace> : Space> { public val size: Int - public val space: S - override val zero: Point get() = produce { space.zero } + public val algebra: A + override val zero: Point get() = produce { algebra.zero } - public fun produce(initializer: S.(Int) -> T): Point + public fun produce(initializer: A.(Int) -> T): Point - /** - * Produce a space-element of this vector space for expressions - */ - //fun produceElement(initializer: (Int) -> T): Vector + override fun add(a: Point, b: Point): Point = produce { algebra { a[it] + b[it] } } - override fun add(a: Point, b: Point): Point = produce { space { a[it] + b[it] } } + public fun scale(a: Point, scale: T): Point = produce { algebra { a[it] * scale } } - override fun multiply(a: Point, k: Number): Point = produce { space { a[it] * k } } + override fun Point.unaryMinus(): Point = produce { -get(it) } //TODO add basis @@ -45,26 +43,25 @@ public interface VectorSpace> : Space> { /** * A structured vector space with custom buffer */ - public fun > buffered( + public fun > buffered( size: Int, - space: S, + space: A, bufferFactory: BufferFactory = Buffer.Companion::boxing, - ): BufferVectorSpace = BufferVectorSpace(size, space, bufferFactory) + ): BufferVectorSpace = BufferVectorSpace(size, space, bufferFactory) /** * Automatic buffered vector, unboxed if it is possible */ - public inline fun > auto(size: Int, space: S): VectorSpace = + public inline fun > auto(size: Int, space: A): VectorSpace = buffered(size, space, Buffer.Companion::auto) } } -public class BufferVectorSpace>( +public class BufferVectorSpace>( override val size: Int, - override val space: S, + override val algebra: A, public val bufferFactory: BufferFactory, -) : VectorSpace { - override fun produce(initializer: S.(Int) -> T): Buffer = bufferFactory(size) { space.initializer(it) } - //override fun produceElement(initializer: (Int) -> T): Vector = BufferVector(this, produce(initializer)) +) : VectorSpace { + override fun produce(initializer: A.(Int) -> T): Buffer = bufferFactory(size) { algebra.initializer(it) } } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferNDAlgebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferNDAlgebra.kt index 71c7d444c..ff9c911ac 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferNDAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferNDAlgebra.kt @@ -1,19 +1,16 @@ package space.kscience.kmath.nd -import space.kscience.kmath.operations.Field -import space.kscience.kmath.operations.RealField -import space.kscience.kmath.operations.Ring -import space.kscience.kmath.operations.Space +import space.kscience.kmath.operations.* import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.BufferFactory import kotlin.contracts.InvocationKind import kotlin.contracts.contract -public interface BufferNDAlgebra : NDAlgebra { +public interface BufferNDAlgebra> : NDAlgebra { public val strides: Strides public val bufferFactory: BufferFactory - override fun produce(initializer: C.(IntArray) -> T): NDBuffer = NDBuffer( + override fun produce(initializer: A.(IntArray) -> T): NDBuffer = NDBuffer( strides, bufferFactory(strides.linearSize) { offset -> elementContext.initializer(strides.index(offset)) @@ -30,14 +27,14 @@ public interface BufferNDAlgebra : NDAlgebra { else -> bufferFactory(strides.linearSize) { offset -> get(strides.index(offset)) } } - override fun NDStructure.map(transform: C.(T) -> T): NDBuffer { + override fun NDStructure.map(transform: A.(T) -> T): NDBuffer { val buffer = bufferFactory(strides.linearSize) { offset -> elementContext.transform(buffer[offset]) } return NDBuffer(strides, buffer) } - override fun NDStructure.mapIndexed(transform: C.(index: IntArray, T) -> T): NDBuffer { + override fun NDStructure.mapIndexed(transform: A.(index: IntArray, T) -> T): NDBuffer { val buffer = bufferFactory(strides.linearSize) { offset -> elementContext.transform( strides.index(offset), @@ -47,7 +44,7 @@ public interface BufferNDAlgebra : NDAlgebra { return NDBuffer(strides, buffer) } - override fun combine(a: NDStructure, b: NDStructure, transform: C.(T, T) -> T): NDBuffer { + override fun combine(a: NDStructure, b: NDStructure, transform: A.(T, T) -> T): NDBuffer { val buffer = bufferFactory(strides.linearSize) { offset -> elementContext.transform(a.buffer[offset], b.buffer[offset]) } @@ -55,13 +52,14 @@ public interface BufferNDAlgebra : NDAlgebra { } } -public open class BufferedNDSpace>( +public open class BufferedNDSpace>( final override val shape: IntArray, - final override val elementContext: R, + final override val elementContext: A, final override val bufferFactory: BufferFactory, -) : NDSpace, BufferNDAlgebra { +) : NDSpace, BufferNDAlgebra { override val strides: Strides = DefaultStrides(shape) override val zero: NDBuffer by lazy { produce { zero } } + override fun NDStructure.unaryMinus(): NDStructure = produce { -get(it) } } public open class BufferedNDRing>( @@ -76,7 +74,10 @@ public open class BufferedNDField>( shape: IntArray, elementContext: R, bufferFactory: BufferFactory, -) : BufferedNDRing(shape, elementContext, bufferFactory), NDField +) : BufferedNDRing(shape, elementContext, bufferFactory), NDField { + + override fun scale(a: NDStructure, value: Double): NDStructure = a.map { it * value } +} // space factories public fun > NDAlgebra.Companion.space( diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDAlgebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDAlgebra.kt index af154d3cd..6b6e887dc 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDAlgebra.kt @@ -1,8 +1,6 @@ package space.kscience.kmath.nd -import space.kscience.kmath.operations.Field -import space.kscience.kmath.operations.Ring -import space.kscience.kmath.operations.Space +import space.kscience.kmath.operations.* import space.kscience.kmath.structures.* /** @@ -21,7 +19,7 @@ public class ShapeMismatchException(public val expected: IntArray, public val ac * @param C the type of the element context. * @param N the type of the structure. */ -public interface NDAlgebra { +public interface NDAlgebra> { /** * The shape of ND-structures this algebra operates on. */ @@ -33,7 +31,7 @@ public interface NDAlgebra { public val elementContext: C /** - * Produces a new [N] structure using given initializer function. + * Produces a new NDStructure using given initializer function. */ public fun produce(initializer: C.(IntArray) -> T): NDStructure @@ -67,7 +65,7 @@ public interface NDAlgebra { * @param structures the structures to check. * @return the array of valid structures. */ -internal fun NDAlgebra.checkShape(vararg structures: NDStructure): Array> = structures +internal fun > NDAlgebra.checkShape(vararg structures: NDStructure): Array> = structures .map(NDStructure::shape) .singleOrNull { !shape.contentEquals(it) } ?.let>> { throw ShapeMismatchException(shape, it) } @@ -79,7 +77,7 @@ internal fun NDAlgebra.checkShape(vararg structures: NDStructure * @param element the structure to check. * @return the valid structure. */ -internal fun NDAlgebra.checkShape(element: NDStructure): NDStructure { +internal fun > NDAlgebra.checkShape(element: NDStructure): NDStructure { if (!element.shape.contentEquals(shape)) throw ShapeMismatchException(shape, element.shape) return element } @@ -102,14 +100,14 @@ public interface NDSpace> : Space>, NDAlgebra, b: NDStructure): NDStructure = combine(a, b) { aValue, bValue -> add(aValue, bValue) } - /** - * Element-wise multiplication by scalar. - * - * @param a the multiplicand. - * @param k the multiplier. - * @return the product. - */ - public override fun multiply(a: NDStructure, k: Number): NDStructure = a.map() { multiply(it, k) } +// /** +// * Element-wise multiplication by scalar. +// * +// * @param a the multiplicand. +// * @param k the multiplier. +// * @return the product. +// */ +// public override fun multiply(a: NDStructure, k: Number): NDStructure = a.map { multiply(it, k) } // TODO move to extensions after KEEP-176 @@ -120,7 +118,7 @@ public interface NDSpace> : Space>, NDAlgebra.plus(arg: T): NDStructure = this.map() { value -> add(arg, value) } + public operator fun NDStructure.plus(arg: T): NDStructure = this.map { value -> add(arg, value) } /** * Subtracts an element from ND structure of it. @@ -200,7 +198,7 @@ public interface NDRing> : Ring>, NDSpace { * @param N the type of ND structure. * @param F the type field of structure elements. */ -public interface NDField> : Field>, NDRing { +public interface NDField> : Field>, NDRing, ScaleOperations> { /** * Element-wise division. * diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/RealNDField.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/RealNDField.kt index 73ba337ae..2165aea22 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/RealNDField.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/RealNDField.kt @@ -2,8 +2,9 @@ package space.kscience.kmath.nd import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.operations.ExtendedField +import space.kscience.kmath.operations.NumbersAddOperations import space.kscience.kmath.operations.RealField -import space.kscience.kmath.operations.RingWithNumbers +import space.kscience.kmath.operations.ScaleOperations import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.RealBuffer import kotlin.contracts.InvocationKind @@ -13,7 +14,8 @@ import kotlin.contracts.contract public class RealNDField( shape: IntArray, ) : BufferedNDField(shape, RealField, Buffer.Companion::real), - RingWithNumbers>, + NumbersAddOperations>, + ScaleOperations>, ExtendedField> { override val zero: NDBuffer by lazy { produce { zero } } @@ -75,6 +77,8 @@ public class RealNDField( return NDBuffer(strides, buffer) } + override fun scale(a: NDStructure, value: Double): NDStructure = a.map { it * value } + override fun power(arg: NDStructure, pow: Number): NDBuffer = arg.map { power(it, pow) } override fun exp(arg: NDStructure): NDBuffer = arg.map { exp(it) } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/ShortNDRing.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/ShortNDRing.kt index 30960a090..2085840a4 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/ShortNDRing.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/ShortNDRing.kt @@ -1,7 +1,7 @@ package space.kscience.kmath.nd import space.kscience.kmath.misc.UnstableKMathAPI -import space.kscience.kmath.operations.RingWithNumbers +import space.kscience.kmath.operations.NumbersAddOperations import space.kscience.kmath.operations.ShortRing import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.ShortBuffer @@ -12,7 +12,7 @@ import kotlin.contracts.contract public class ShortNDRing( shape: IntArray, ) : BufferedNDRing(shape, ShortRing, Buffer.Companion::auto), - RingWithNumbers> { + NumbersAddOperations> { override val zero: NDBuffer by lazy { produce { zero } } override val one: NDBuffer by lazy { produce { one } } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt index 572f7089a..2163f61b2 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt @@ -87,10 +87,11 @@ public interface Algebra { * @param right the second argument of operation. * @return a result of operation. */ - public fun binaryOperation(operation: String, left: T, right: T): T = binaryOperationFunction(operation)(left, right) + public fun binaryOperation(operation: String, left: T, right: T): T = + binaryOperationFunction(operation)(left, right) } -public fun Algebra.bindSymbol(symbol: Symbol): T = bindSymbol(symbol.identity) +public fun Algebra.bindSymbol(symbol: Symbol): T = bindSymbol(symbol.identity) /** * Call a block with an [Algebra] as receiver. @@ -114,15 +115,6 @@ public interface SpaceOperations : Algebra { */ public fun add(a: T, b: T): T - /** - * Multiplication of element by scalar. - * - * @param a the multiplier. - * @param k the multiplicand. - * @return the produce. - */ - public fun multiply(a: T, k: Number): T - // Operations to be performed in this context. Could be moved to extensions in case of KEEP-176 /** @@ -131,7 +123,7 @@ public interface SpaceOperations : Algebra { * @receiver this value. * @return the additive inverse of this value. */ - public operator fun T.unaryMinus(): T = multiply(this, -1.0) + public operator fun T.unaryMinus(): T /** * Returns this value. @@ -159,34 +151,6 @@ public interface SpaceOperations : Algebra { */ public operator fun T.minus(b: T): T = add(this, -b) - /** - * Multiplication of this element by a scalar. - * - * @receiver the multiplier. - * @param k the multiplicand. - * @return the product. - */ - public operator fun T.times(k: Number): T = multiply(this, k) - - /** - * Division of this element by scalar. - * - * @receiver the dividend. - * @param k the divisor. - * @return the quotient. - */ - @Deprecated("Dividing not allowed in a Ring") - public operator fun T.div(k: Number): T = multiply(this, 1.0 / k.toDouble()) - - /** - * Multiplication of this number by element. - * - * @receiver the multiplier. - * @param b the multiplicand. - * @return the product. - */ - public operator fun Number.times(b: T): T = b * this - public override fun unaryOperationFunction(operation: String): (arg: T) -> T = when (operation) { PLUS_OPERATION -> { arg -> arg } MINUS_OPERATION -> { arg -> -arg } @@ -318,13 +282,6 @@ public interface FieldOperations : RingOperations { * * @param T the type of element of this semifield. */ -public interface Field : Ring, FieldOperations { - /** - * Division of element by scalar. - * - * @receiver the dividend. - * @param b the divisor. - * @return the quotient. - */ - public operator fun Number.div(b: T): T = this * divide(one, b) -} +public interface Field : Ring, FieldOperations, ScaleOperations, NumericAlgebra { + override fun number(value: Number): T = scale(one, value.toDouble()) +} \ No newline at end of file diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/AlgebraElements.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/AlgebraElements.kt index 629c4de1b..1fb4f6750 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/AlgebraElements.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/AlgebraElements.kt @@ -14,24 +14,24 @@ public interface AlgebraElement> { */ public val context: C } - -/** - * Divides this element by number. - * - * @param k the divisor. - * @return the quotient. - */ -public operator fun , S : Space> T.div(k: Number): T = - context.multiply(this, 1.0 / k.toDouble()) - -/** - * Multiplies this element by number. - * - * @param k the multiplicand. - * @return the product. - */ -public operator fun , S : Space> T.times(k: Number): T = - context.multiply(this, k.toDouble()) +// +///** +// * Divides this element by number. +// * +// * @param k the divisor. +// * @return the quotient. +// */ +//public operator fun , S : Space> T.div(k: Number): T = +// context.multiply(this, 1.0 / k.toDouble()) +// +///** +// * Multiplies this element by number. +// * +// * @param k the multiplicand. +// * @return the product. +// */ +//public operator fun , S : Space> T.times(k: Number): T = +// context.multiply(this, k.toDouble()) /** * Subtracts element from this one. @@ -39,8 +39,9 @@ public operator fun , S : Space> T.times(k: Number): * @param b the subtrahend. * @return the difference. */ -public operator fun , S : Space> T.minus(b: T): T = - context.add(this, context.multiply(b, -1.0)) +@UnstableKMathAPI +public operator fun , S : NumbersAddOperations> T.minus(b: T): T = + context.add(this, context.run { -b}) /** * Adds element to this one. @@ -51,11 +52,11 @@ public operator fun , S : Space> T.minus(b: T): T = public operator fun , S : Space> T.plus(b: T): T = context.add(this, b) -/** - * Number times element - */ -public operator fun , S : Space> Number.times(element: T): T = - element.times(this) +///** +// * Number times element +// */ +//public operator fun , S : Space> Number.times(element: T): T = +// element.times(this) /** diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/BigInt.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/BigInt.kt index c21260b82..7e6a2eb81 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/BigInt.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/BigInt.kt @@ -21,29 +21,28 @@ public typealias TBase = ULong * @author Robert Drynkin (https://github.com/robdrynkin) and Peter Klimai (https://github.com/pklimai) */ @OptIn(UnstableKMathAPI::class) -public object BigIntField : Field, RingWithNumbers { +public object BigIntField : Field, NumbersAddOperations, ScaleOperations { override val zero: BigInt = BigInt.ZERO override val one: BigInt = BigInt.ONE - override fun add(a: BigInt, b: BigInt): BigInt = a.plus(b) override fun number(value: Number): BigInt = value.toLong().toBigInt() - override fun multiply(a: BigInt, k: Number): BigInt = a.times(number(k)) - + @Suppress("EXTENSION_SHADOWED_BY_MEMBER") + override fun BigInt.unaryMinus(): BigInt = -this + override fun add(a: BigInt, b: BigInt): BigInt = a.plus(b) + override fun scale(a: BigInt, value: Double): BigInt = a.times(number(value)) override fun multiply(a: BigInt, b: BigInt): BigInt = a.times(b) + override fun divide(a: BigInt, b: BigInt): BigInt = a.div(b) public operator fun String.unaryPlus(): BigInt = this.parseBigInteger() ?: error("Can't parse $this as big integer") - public operator fun String.unaryMinus(): BigInt = -(this.parseBigInteger() ?: error("Can't parse $this as big integer")) - - override fun divide(a: BigInt, b: BigInt): BigInt = a.div(b) } public class BigInt internal constructor( private val sign: Byte, - private val magnitude: Magnitude - ) : Comparable { + private val magnitude: Magnitude, +) : 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-core/src/commonMain/kotlin/space/kscience/kmath/operations/NumericAlgebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/NumericAlgebra.kt index 81f4c1fdf..187261b1d 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/NumericAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/NumericAlgebra.kt @@ -81,14 +81,53 @@ public interface NumericAlgebra : Algebra { rightSideNumberOperationFunction(operation)(left, right) } +/** + * Scale by scalar operations + */ +public interface ScaleOperations : Algebra { + /** + * Scaling of element by scalar. + * + * @param a the multiplier. + * @param value the multiplicand. + * @return the produce. + */ + public fun scale(a: T, value: Double): T + + /** + * Multiplication of this element by a scalar. + * + * @receiver the multiplier. + * @param k the multiplicand. + * @return the product. + */ + public operator fun T.times(k: Number): T = scale(this, k.toDouble()) + + /** + * Division of this element by scalar. + * + * @receiver the dividend. + * @param k the divisor. + * @return the quotient. + */ + public operator fun T.div(k: Number): T = scale(this, 1.0 / k.toDouble()) + + /** + * Multiplication of this number by element. + * + * @receiver the multiplier. + * @param b the multiplicand. + * @return the product. + */ + public operator fun Number.times(b: T): T = b * this +} + /** * A combination of [NumericAlgebra] and [Ring] that adds intrinsic simple operations on numbers like `T+1` * TODO to be removed and replaced by extensions after multiple receivers are there */ @UnstableKMathAPI -public interface RingWithNumbers: Ring, NumericAlgebra{ - public override fun number(value: Number): T = one * value - +public interface NumbersAddOperations : Space, NumericAlgebra { /** * Addition of element and scalar. * diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/OptionalOperations.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/OptionalOperations.kt index 6cb329695..6e6249dfe 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/OptionalOperations.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/OptionalOperations.kt @@ -107,111 +107,6 @@ public fun >> acos(arg: T): @UnstableKMathAPI public fun >> atan(arg: T): T = arg.context.atan(arg) -/** - * A container for hyperbolic trigonometric operations for specific type. - * - * @param T the type of element of this structure. - */ -public interface HyperbolicOperations : Algebra { - /** - * Computes the hyperbolic sine of [arg]. - */ - public fun sinh(arg: T): T - - /** - * Computes the hyperbolic cosine of [arg]. - */ - public fun cosh(arg: T): T - - /** - * Computes the hyperbolic tangent of [arg]. - */ - public fun tanh(arg: T): T - - /** - * Computes the inverse hyperbolic sine of [arg]. - */ - public fun asinh(arg: T): T - - /** - * Computes the inverse hyperbolic cosine of [arg]. - */ - public fun acosh(arg: T): T - - /** - * Computes the inverse hyperbolic tangent of [arg]. - */ - public fun atanh(arg: T): T - - public companion object { - /** - * The identifier of hyperbolic sine. - */ - public const val SINH_OPERATION: String = "sinh" - - /** - * The identifier of hyperbolic cosine. - */ - public const val COSH_OPERATION: String = "cosh" - - /** - * The identifier of hyperbolic tangent. - */ - public const val TANH_OPERATION: String = "tanh" - - /** - * The identifier of inverse hyperbolic sine. - */ - public const val ASINH_OPERATION: String = "asinh" - - /** - * The identifier of inverse hyperbolic cosine. - */ - public const val ACOSH_OPERATION: String = "acosh" - - /** - * The identifier of inverse hyperbolic tangent. - */ - public const val ATANH_OPERATION: String = "atanh" - } -} - -/** - * Computes the hyperbolic sine of [arg]. - */ -@UnstableKMathAPI -public fun >> sinh(arg: T): T = arg.context.sinh(arg) - -/** - * Computes the hyperbolic cosine of [arg]. - */ -@UnstableKMathAPI -public fun >> cosh(arg: T): T = arg.context.cosh(arg) - -/** - * Computes the hyperbolic tangent of [arg]. - */ -@UnstableKMathAPI -public fun >> tanh(arg: T): T = arg.context.tanh(arg) - -/** - * Computes the inverse hyperbolic sine of [arg]. - */ -@UnstableKMathAPI -public fun >> asinh(arg: T): T = arg.context.asinh(arg) - -/** - * Computes the inverse hyperbolic cosine of [arg]. - */ -@UnstableKMathAPI -public fun >> acosh(arg: T): T = arg.context.acosh(arg) - -/** - * Computes the inverse hyperbolic tangent of [arg]. - */ -@UnstableKMathAPI -public fun >> atanh(arg: T): T = arg.context.atanh(arg) - /** * A context extension to include power operations based on exponentiation. * @@ -284,6 +179,36 @@ public interface ExponentialOperations : Algebra { */ public fun ln(arg: T): T + /** + * Computes the hyperbolic sine of [arg]. + */ + public fun sinh(arg: T): T + + /** + * Computes the hyperbolic cosine of [arg]. + */ + public fun cosh(arg: T): T + + /** + * Computes the hyperbolic tangent of [arg]. + */ + public fun tanh(arg: T): T + + /** + * Computes the inverse hyperbolic sine of [arg]. + */ + public fun asinh(arg: T): T + + /** + * Computes the inverse hyperbolic cosine of [arg]. + */ + public fun acosh(arg: T): T + + /** + * Computes the inverse hyperbolic tangent of [arg]. + */ + public fun atanh(arg: T): T + public companion object { /** * The identifier of exponential function. @@ -294,6 +219,36 @@ public interface ExponentialOperations : Algebra { * The identifier of natural logarithm. */ public const val LN_OPERATION: String = "ln" + + /** + * The identifier of hyperbolic sine. + */ + public const val SINH_OPERATION: String = "sinh" + + /** + * The identifier of hyperbolic cosine. + */ + public const val COSH_OPERATION: String = "cosh" + + /** + * The identifier of hyperbolic tangent. + */ + public const val TANH_OPERATION: String = "tanh" + + /** + * The identifier of inverse hyperbolic sine. + */ + public const val ASINH_OPERATION: String = "asinh" + + /** + * The identifier of inverse hyperbolic cosine. + */ + public const val ACOSH_OPERATION: String = "acosh" + + /** + * The identifier of inverse hyperbolic tangent. + */ + public const val ATANH_OPERATION: String = "atanh" } } @@ -309,6 +264,43 @@ public fun >> exp(arg: T): T @UnstableKMathAPI public fun >> ln(arg: T): T = arg.context.ln(arg) + +/** + * Computes the hyperbolic sine of [arg]. + */ +@UnstableKMathAPI +public fun >> sinh(arg: T): T = arg.context.sinh(arg) + +/** + * Computes the hyperbolic cosine of [arg]. + */ +@UnstableKMathAPI +public fun >> cosh(arg: T): T = arg.context.cosh(arg) + +/** + * Computes the hyperbolic tangent of [arg]. + */ +@UnstableKMathAPI +public fun >> tanh(arg: T): T = arg.context.tanh(arg) + +/** + * Computes the inverse hyperbolic sine of [arg]. + */ +@UnstableKMathAPI +public fun >> asinh(arg: T): T = arg.context.asinh(arg) + +/** + * Computes the inverse hyperbolic cosine of [arg]. + */ +@UnstableKMathAPI +public fun >> acosh(arg: T): T = arg.context.acosh(arg) + +/** + * Computes the inverse hyperbolic tangent of [arg]. + */ +@UnstableKMathAPI +public fun >> atanh(arg: T): T = arg.context.atanh(arg) + /** * A container for norm functional on element. * diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/algebraExtensions.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/algebraExtensions.kt index ae1267d2b..66b16b6f6 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/algebraExtensions.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/algebraExtensions.kt @@ -26,7 +26,8 @@ public fun Space.sum(data: Sequence): T = data.fold(zero) { left, righ * @return the average value. * @author Iaroslav Postovalov */ -public fun Space.average(data: Iterable): T = sum(data) / data.count() +public fun S.average(data: Iterable): T where S : Space, S : ScaleOperations = + sum(data) / data.count() /** * Returns an average value of elements in the sequence in this [Space]. @@ -36,7 +37,8 @@ public fun Space.average(data: Iterable): T = sum(data) / data.count() * @return the average value. * @author Iaroslav Postovalov */ -public fun Space.average(data: Sequence): T = sum(data) / data.count() +public fun S.average(data: Sequence): T where S : Space, S : ScaleOperations = + sum(data) / data.count() /** * Absolute of the comparable [value] @@ -69,7 +71,8 @@ public fun Sequence.sumWith(space: Space): T = space.sum(this) * @return the average value. * @author Iaroslav Postovalov */ -public fun Iterable.averageWith(space: Space): T = space.average(this) +public fun Iterable.averageWith(space: S): T where S : Space, S : ScaleOperations = + space.average(this) /** * Returns an average value of elements in the sequence in this [Space]. @@ -79,7 +82,8 @@ public fun Iterable.averageWith(space: Space): T = space.average(this) * @return the average value. * @author Iaroslav Postovalov */ -public fun Sequence.averageWith(space: Space): T = space.average(this) +public fun Sequence.averageWith(space: S): T where S : Space, S : ScaleOperations = + space.average(this) //TODO optimized power operation diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/numbers.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/numbers.kt index aa62715d1..4841e78d6 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/numbers.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/numbers.kt @@ -8,7 +8,6 @@ import kotlin.math.pow as kpow public interface ExtendedFieldOperations : FieldOperations, TrigonometricOperations, - HyperbolicOperations, PowerOperations, ExponentialOperations { public override fun tan(arg: T): T = sin(arg) / cos(arg) @@ -21,15 +20,15 @@ public interface ExtendedFieldOperations : TrigonometricOperations.ACOS_OPERATION -> ::acos TrigonometricOperations.ASIN_OPERATION -> ::asin TrigonometricOperations.ATAN_OPERATION -> ::atan - HyperbolicOperations.COSH_OPERATION -> ::cosh - HyperbolicOperations.SINH_OPERATION -> ::sinh - HyperbolicOperations.TANH_OPERATION -> ::tanh - HyperbolicOperations.ACOSH_OPERATION -> ::acosh - HyperbolicOperations.ASINH_OPERATION -> ::asinh - HyperbolicOperations.ATANH_OPERATION -> ::atanh PowerOperations.SQRT_OPERATION -> ::sqrt ExponentialOperations.EXP_OPERATION -> ::exp ExponentialOperations.LN_OPERATION -> ::ln + ExponentialOperations.COSH_OPERATION -> ::cosh + ExponentialOperations.SINH_OPERATION -> ::sinh + ExponentialOperations.TANH_OPERATION -> ::tanh + ExponentialOperations.ACOSH_OPERATION -> ::acosh + ExponentialOperations.ASINH_OPERATION -> ::asinh + ExponentialOperations.ATANH_OPERATION -> ::atanh else -> super.unaryOperationFunction(operation) } } @@ -37,18 +36,18 @@ public interface ExtendedFieldOperations : /** * Advanced Number-like field that implements basic operations. */ -public interface ExtendedField : ExtendedFieldOperations, Field, NumericAlgebra { - public override fun sinh(arg: T): T = (exp(arg) - exp(-arg)) / 2 - public override fun cosh(arg: T): T = (exp(arg) + exp(-arg)) / 2 +public interface ExtendedField : ExtendedFieldOperations, Field, NumericAlgebra, ScaleOperations { + public override fun sinh(arg: T): T = (exp(arg) - exp(-arg)) / 2.0 + public override fun cosh(arg: T): T = (exp(arg) + exp(-arg)) / 2.0 public override fun tanh(arg: T): T = (exp(arg) - exp(-arg)) / (exp(-arg) + exp(arg)) public override fun asinh(arg: T): T = ln(sqrt(arg * arg + one) + arg) public override fun acosh(arg: T): T = ln(arg + sqrt((arg - one) * (arg + one))) - public override fun atanh(arg: T): T = (ln(arg + one) - ln(one - arg)) / 2 + public override fun atanh(arg: T): T = (ln(arg + one) - ln(one - arg)) / 2.0 public override fun rightSideNumberOperationFunction(operation: String): (left: T, right: Number) -> T = when (operation) { PowerOperations.POW_OPERATION -> ::power - else -> super.rightSideNumberOperationFunction(operation) + else -> super.rightSideNumberOperationFunction(operation) } } @@ -56,28 +55,27 @@ public interface ExtendedField : ExtendedFieldOperations, Field, Numeri * A field for [Double] without boxing. Does not produce appropriate field element. */ @Suppress("EXTENSION_SHADOWED_BY_MEMBER", "OVERRIDE_BY_INLINE", "NOTHING_TO_INLINE") -public object RealField : ExtendedField, Norm { - public override val zero: Double - get() = 0.0 - - public override val one: Double - get() = 1.0 +public object RealField : ExtendedField, Norm, ScaleOperations { + public override val zero: Double = 0.0 + public override val one: Double = 1.0 override fun number(value: Number): Double = value.toDouble() public override fun binaryOperationFunction(operation: String): (left: Double, right: Double) -> Double = when (operation) { PowerOperations.POW_OPERATION -> ::power - else -> super.binaryOperationFunction(operation) + else -> super.binaryOperationFunction(operation) } public override inline fun add(a: Double, b: Double): Double = a + b - public override inline fun multiply(a: Double, k: Number): Double = a * k.toDouble() +// public override inline fun multiply(a: Double, k: Number): Double = a * k.toDouble() +// override fun divide(a: Double, k: Number): Double = a / k.toDouble() public override inline fun multiply(a: Double, b: Double): Double = a * b - public override inline fun divide(a: Double, b: Double): Double = a / b + override fun scale(a: Double, value: Double): Double = a * value + public override inline fun sin(arg: Double): Double = kotlin.math.sin(arg) public override inline fun cos(arg: Double): Double = kotlin.math.cos(arg) public override inline fun tan(arg: Double): Double = kotlin.math.tan(arg) @@ -110,11 +108,8 @@ public object RealField : ExtendedField, Norm { */ @Suppress("EXTENSION_SHADOWED_BY_MEMBER", "OVERRIDE_BY_INLINE", "NOTHING_TO_INLINE") public object FloatField : ExtendedField, Norm { - public override val zero: Float - get() = 0.0f - - public override val one: Float - get() = 1.0f + public override val zero: Float = 0.0f + public override val one: Float = 1.0f override fun number(value: Number): Float = value.toFloat() @@ -125,7 +120,7 @@ public object FloatField : ExtendedField, Norm { } public override inline fun add(a: Float, b: Float): Float = a + b - public override inline fun multiply(a: Float, k: Number): Float = a * k.toFloat() + override fun scale(a: Float, value: Double): Float = a * value.toFloat() public override inline fun multiply(a: Float, b: Float): Float = a * b @@ -170,12 +165,8 @@ public object IntRing : Ring, Norm, NumericAlgebra { get() = 1 override fun number(value: Number): Int = value.toInt() - public override inline fun add(a: Int, b: Int): Int = a + b - public override inline fun multiply(a: Int, k: Number): Int = k.toInt() * a - public override inline fun multiply(a: Int, b: Int): Int = a * b - public override inline fun norm(arg: Int): Int = abs(arg) public override inline fun Int.unaryMinus(): Int = -this @@ -196,12 +187,8 @@ public object ShortRing : Ring, Norm, NumericAlgebra get() = 1 override fun number(value: Number): Short = value.toShort() - public override inline fun add(a: Short, b: Short): Short = (a + b).toShort() - public override inline fun multiply(a: Short, k: Number): Short = (a * k.toShort()).toShort() - public override inline fun multiply(a: Short, b: Short): Short = (a * b).toShort() - public override fun norm(arg: Short): Short = if (arg > 0) arg else (-arg).toShort() public override inline fun Short.unaryMinus(): Short = (-this).toShort() @@ -222,12 +209,8 @@ public object ByteRing : Ring, Norm, NumericAlgebra { get() = 1 override fun number(value: Number): Byte = value.toByte() - public override inline fun add(a: Byte, b: Byte): Byte = (a + b).toByte() - public override inline fun multiply(a: Byte, k: Number): Byte = (a * k.toByte()).toByte() - public override inline fun multiply(a: Byte, b: Byte): Byte = (a * b).toByte() - public override fun norm(arg: Byte): Byte = if (arg > 0) arg else (-arg).toByte() public override inline fun Byte.unaryMinus(): Byte = (-this).toByte() @@ -248,12 +231,8 @@ public object LongRing : Ring, Norm, NumericAlgebra { get() = 1L override fun number(value: Number): Long = value.toLong() - public override inline fun add(a: Long, b: Long): Long = a + b - public override inline fun multiply(a: Long, k: Number): Long = a * k.toLong() - public override inline fun multiply(a: Long, b: Long): Long = a * b - public override fun norm(arg: Long): Long = abs(arg) public override inline fun Long.unaryMinus(): Long = (-this) diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBufferField.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBufferField.kt index 7351881ee..2a03a36e3 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBufferField.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBufferField.kt @@ -8,6 +8,12 @@ import kotlin.math.* * [ExtendedFieldOperations] over [RealBuffer]. */ public object RealBufferFieldOperations : ExtendedFieldOperations> { + override fun Buffer.unaryMinus(): RealBuffer = if (this is RealBuffer) { + RealBuffer(size) { -array[it] } + } else { + RealBuffer(size) { -get(it) } + } + public override fun add(a: Buffer, b: Buffer): RealBuffer { require(b.size == a.size) { "The size of the first buffer ${a.size} should be the same as for second one: ${b.size} " @@ -19,15 +25,24 @@ public object RealBufferFieldOperations : ExtendedFieldOperations RealBuffer(DoubleArray(a.size) { aArray[it] + bArray[it] }) } else RealBuffer(DoubleArray(a.size) { a[it] + b[it] }) } - - public override fun multiply(a: Buffer, k: Number): RealBuffer { - val kValue = k.toDouble() - - return if (a is RealBuffer) { - val aArray = a.array - RealBuffer(DoubleArray(a.size) { aArray[it] * kValue }) - } else RealBuffer(DoubleArray(a.size) { a[it] * kValue }) - } +// +// public override fun multiply(a: Buffer, k: Number): RealBuffer { +// val kValue = k.toDouble() +// +// return if (a is RealBuffer) { +// val aArray = a.array +// RealBuffer(DoubleArray(a.size) { aArray[it] * kValue }) +// } else RealBuffer(DoubleArray(a.size) { a[it] * kValue }) +// } +// +// public override fun divide(a: Buffer, k: Number): RealBuffer { +// val kValue = k.toDouble() +// +// return if (a is RealBuffer) { +// val aArray = a.array +// RealBuffer(DoubleArray(a.size) { aArray[it] / kValue }) +// } else RealBuffer(DoubleArray(a.size) { a[it] / kValue }) +// } public override fun multiply(a: Buffer, b: Buffer): RealBuffer { require(b.size == a.size) { @@ -152,14 +167,22 @@ public class RealBufferField(public val size: Int) : ExtendedField = RealBuffer(size) { value.toDouble() } + override fun Buffer.unaryMinus(): Buffer = RealBufferFieldOperations.run { + -this@unaryMinus + } + public override fun add(a: Buffer, b: Buffer): RealBuffer { require(a.size == size) { "The buffer size ${a.size} does not match context size $size" } return RealBufferFieldOperations.add(a, b) } - public override fun multiply(a: Buffer, k: Number): RealBuffer { + public override fun scale(a: Buffer, value: Double): RealBuffer { require(a.size == size) { "The buffer size ${a.size} does not match context size $size" } - return RealBufferFieldOperations.multiply(a, k) + + return if (a is RealBuffer) { + val aArray = a.array + RealBuffer(DoubleArray(a.size) { aArray[it] * value }) + } else RealBuffer(DoubleArray(a.size) { a[it] * value }) } public override fun multiply(a: Buffer, b: Buffer): RealBuffer { diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/ExpressionFieldTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/ExpressionFieldTest.kt index c13850193..cf75eba3e 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/ExpressionFieldTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/ExpressionFieldTest.kt @@ -11,9 +11,7 @@ class ExpressionFieldTest { @Test fun testExpression() { - val context = FunctionalExpressionField(RealField) - - val expression = context { + val expression = FunctionalExpressionField(RealField).invoke { val x by binding() x * x + 2 * x + one } diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/FieldVerifier.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/FieldVerifier.kt index 2aef6b27f..cdb0a7c5d 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/FieldVerifier.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/FieldVerifier.kt @@ -5,8 +5,9 @@ import space.kscience.kmath.operations.invoke import kotlin.test.assertEquals import kotlin.test.assertNotEquals -internal class FieldVerifier(override val algebra: Field, a: T, b: T, c: T, x: Number) : - RingVerifier(algebra, a, b, c, x) { +internal class FieldVerifier>( + algebra: A, a: T, b: T, c: T, x: Number, +) : RingVerifier(algebra, a, b, c, x) { override fun verify() { super.verify() diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/RingVerifier.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/RingVerifier.kt index dd8841806..6970c8ac7 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/RingVerifier.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/RingVerifier.kt @@ -1,11 +1,13 @@ package space.kscience.kmath.testutils import space.kscience.kmath.operations.Ring +import space.kscience.kmath.operations.ScaleOperations import space.kscience.kmath.operations.invoke import kotlin.test.assertEquals -internal open class RingVerifier(override val algebra: Ring, a: T, b: T, c: T, x: Number) : - SpaceVerifier(algebra, a, b, c, x) { +internal open class RingVerifier(algebra: A, a: T, b: T, c: T, x: Number) : + SpaceVerifier(algebra, a, b, c, x) where A : Ring, A : ScaleOperations { + override fun verify() { super.verify() diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/SpaceVerifier.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/SpaceVerifier.kt index f7a25b593..6ea75156b 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/SpaceVerifier.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/SpaceVerifier.kt @@ -1,18 +1,18 @@ package space.kscience.kmath.testutils +import space.kscience.kmath.operations.ScaleOperations import space.kscience.kmath.operations.Space import space.kscience.kmath.operations.invoke import kotlin.test.assertEquals import kotlin.test.assertNotEquals -internal open class SpaceVerifier( - override val algebra: Space, +internal open class SpaceVerifier( + override val algebra: S, val a: T, val b: T, val c: T, - val x: Number -) : - AlgebraicVerifier> { + val x: Number, +) : AlgebraicVerifier> where S : Space, S : ScaleOperations { override fun verify() { algebra { assertEquals(a + b + c, a + (b + c), "Addition in $algebra is not associative.") diff --git a/kmath-core/src/jvmMain/kotlin/space/kscience/kmath/operations/BigNumbers.kt b/kmath-core/src/jvmMain/kotlin/space/kscience/kmath/operations/BigNumbers.kt index 8f8b31ed9..0ac0ba1c5 100644 --- a/kmath-core/src/jvmMain/kotlin/space/kscience/kmath/operations/BigNumbers.kt +++ b/kmath-core/src/jvmMain/kotlin/space/kscience/kmath/operations/BigNumbers.kt @@ -7,19 +7,16 @@ import java.math.MathContext /** * A field over [BigInteger]. */ -public object JBigIntegerField : Field, NumericAlgebra { - public override val zero: BigInteger - get() = BigInteger.ZERO +public object JBigIntegerField : Ring, NumericAlgebra { + public override val zero: BigInteger get() = BigInteger.ZERO - public override val one: BigInteger - get() = BigInteger.ONE + public override val one: BigInteger get() = BigInteger.ONE public override fun number(value: Number): BigInteger = BigInteger.valueOf(value.toLong()) - public override fun divide(a: BigInteger, b: BigInteger): BigInteger = a.div(b) public override fun add(a: BigInteger, b: BigInteger): BigInteger = a.add(b) public override operator fun BigInteger.minus(b: BigInteger): BigInteger = subtract(b) - public override fun multiply(a: BigInteger, k: Number): BigInteger = a.multiply(k.toInt().toBigInteger()) public override fun multiply(a: BigInteger, b: BigInteger): BigInteger = a.multiply(b) + public override operator fun BigInteger.unaryMinus(): BigInteger = negate() } @@ -30,7 +27,7 @@ public object JBigIntegerField : Field, NumericAlgebra { */ public abstract class JBigDecimalFieldBase internal constructor( private val mathContext: MathContext = MathContext.DECIMAL64, -) : Field, PowerOperations, NumericAlgebra { +) : Field, PowerOperations, NumericAlgebra, ScaleOperations { public override val zero: BigDecimal get() = BigDecimal.ZERO @@ -41,8 +38,8 @@ public abstract class JBigDecimalFieldBase internal constructor( public override operator fun BigDecimal.minus(b: BigDecimal): BigDecimal = subtract(b) public override fun number(value: Number): BigDecimal = BigDecimal.valueOf(value.toDouble()) - public override fun multiply(a: BigDecimal, k: Number): BigDecimal = - a.multiply(k.toDouble().toBigDecimal(mathContext), mathContext) + public override fun scale(a: BigDecimal, value: Double): BigDecimal = + a.multiply(value.toBigDecimal(mathContext), mathContext) public override fun multiply(a: BigDecimal, b: BigDecimal): BigDecimal = a.multiply(b, mathContext) public override fun divide(a: BigDecimal, b: BigDecimal): BigDecimal = a.divide(b, mathContext) diff --git a/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/flowExtra.kt b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/flowExtra.kt index 489cca8c1..eff813bee 100644 --- a/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/flowExtra.kt +++ b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/flowExtra.kt @@ -5,16 +5,16 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.runningReduce import kotlinx.coroutines.flow.scan +import space.kscience.kmath.operations.ScaleOperations import space.kscience.kmath.operations.Space import space.kscience.kmath.operations.SpaceOperations import space.kscience.kmath.operations.invoke -@ExperimentalCoroutinesApi public fun Flow.cumulativeSum(space: SpaceOperations): Flow = space { runningReduce { sum, element -> sum + element } } @ExperimentalCoroutinesApi -public fun Flow.mean(space: Space): Flow = space { +public fun Flow.mean(algebra: S): Flow where S : Space, S : ScaleOperations = algebra { data class Accumulator(var sum: T, var num: Int) scan(Accumulator(zero, 0)) { sum, element -> diff --git a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrixContext.kt b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrixContext.kt index d67f80409..95c465975 100644 --- a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrixContext.kt +++ b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrixContext.kt @@ -4,13 +4,14 @@ import org.ejml.simple.SimpleMatrix import space.kscience.kmath.linear.* import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.nd.getFeature +import space.kscience.kmath.operations.ScaleOperations /** * Represents context of basic operations operating with [EjmlMatrix]. * * @author Iaroslav Postovalov */ -public object EjmlMatrixContext : MatrixContext { +public object EjmlMatrixContext : MatrixContext, ScaleOperations> { /** * Converts this matrix to EJML one. @@ -41,6 +42,9 @@ public object EjmlMatrixContext : MatrixContext { (0 until it.numRows()).forEach { row -> it[row, 0] = initializer(row) } }) + + override fun Matrix.unaryMinus(): Matrix = this*(-1) + public override fun Matrix.dot(other: Matrix): EjmlMatrix = EjmlMatrix(toEjml().origin.mult(other.toEjml().origin)) @@ -53,8 +57,8 @@ public object EjmlMatrixContext : MatrixContext { public override operator fun Matrix.minus(b: Matrix): EjmlMatrix = EjmlMatrix(toEjml().origin - b.toEjml().origin) - public override fun multiply(a: Matrix, k: Number): EjmlMatrix = - produce(a.rowNum, a.colNum) { i, j -> a[i, j] * k.toDouble() } + public override fun scale(a: Matrix, value: Double): EjmlMatrix = + produce(a.rowNum, a.colNum) { i, j -> a[i, j] * value } public override operator fun Matrix.times(value: Double): EjmlMatrix = EjmlMatrix(toEjml().origin.scale(value)) diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt index b1e47f34c..7416069bd 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt @@ -1,6 +1,7 @@ package space.kscience.kmath.functions import space.kscience.kmath.operations.Ring +import space.kscience.kmath.operations.ScaleOperations import space.kscience.kmath.operations.Space import space.kscience.kmath.operations.invoke import kotlin.contracts.InvocationKind @@ -41,9 +42,15 @@ public fun > Polynomial.asFunction(ring: C): (T) -> T = /** * An algebra for polynomials */ -public class PolynomialSpace>(private val ring: C) : Space> { +public class PolynomialSpace( + private val ring: C, +) : Space>, ScaleOperations> where C: Ring, C: ScaleOperations{ public override val zero: Polynomial = Polynomial(emptyList()) + override fun Polynomial.unaryMinus(): Polynomial = with(ring) { + Polynomial(coefficients.map { -it }) + } + public override fun add(a: Polynomial, b: Polynomial): Polynomial { val dim = max(a.coefficients.size, b.coefficients.size) @@ -54,13 +61,13 @@ public class PolynomialSpace>(private val ring: C) : Space< } } - public override fun multiply(a: Polynomial, k: Number): Polynomial = - ring { Polynomial(List(a.coefficients.size) { index -> a.coefficients[index] * k }) } + public override fun scale(a: Polynomial, value: Double): Polynomial = + ring { Polynomial(List(a.coefficients.size) { index -> a.coefficients[index] * value }) } public operator fun Polynomial.invoke(arg: T): T = value(ring, arg) } -public inline fun , R> C.polynomial(block: PolynomialSpace.() -> R): R { +public inline fun C.polynomial(block: PolynomialSpace.() -> R): R where C: Ring, C: ScaleOperations{ contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } return PolynomialSpace(this).block() } diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt index 34fd25ad4..78d6e0d0c 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt @@ -11,9 +11,9 @@ import space.kscience.kmath.structures.MutableBufferFactory * Generic spline interpolator. Not recommended for performance critical places, use platform-specific and type specific ones. * Based on https://github.com/apache/commons-math/blob/eb57d6d457002a0bb5336d789a3381a24599affe/src/main/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolator.java */ -public class SplineInterpolator>( - public override val algebra: Field, - public val bufferFactory: MutableBufferFactory +public class SplineInterpolator, F : Field>( + public override val algebra: F, + public val bufferFactory: MutableBufferFactory, ) : PolynomialInterpolator { //TODO possibly optimize zeroed buffers diff --git a/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/Euclidean2DSpace.kt b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/Euclidean2DSpace.kt index 609274d7d..54a1e032c 100644 --- a/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/Euclidean2DSpace.kt +++ b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/Euclidean2DSpace.kt @@ -2,6 +2,7 @@ package space.kscience.kmath.geometry import space.kscience.kmath.linear.Point import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.operations.ScaleOperations import space.kscience.kmath.operations.SpaceElement import space.kscience.kmath.operations.invoke import kotlin.math.sqrt @@ -30,18 +31,20 @@ public fun Vector2D(x: Double, y: Double): Vector2D = Vector2DImpl(x, y) private data class Vector2DImpl( override val x: Double, - override val y: Double + override val y: Double, ) : Vector2D /** * 2D Euclidean space */ -public object Euclidean2DSpace : GeometrySpace { +public object Euclidean2DSpace : GeometrySpace, ScaleOperations { public override val zero: Vector2D by lazy { Vector2D(0.0, 0.0) } public fun Vector2D.norm(): Double = sqrt(x * x + y * y) + override fun Vector2D.unaryMinus(): Vector2D = Vector2D(-x, -y) + public override fun Vector2D.distanceTo(other: Vector2D): Double = (this - other).norm() public override fun add(a: Vector2D, b: Vector2D): Vector2D = Vector2D(a.x + b.x, a.y + b.y) - public override fun multiply(a: Vector2D, k: Number): Vector2D = Vector2D(a.x * k.toDouble(), a.y * k.toDouble()) + public override fun scale(a: Vector2D, value: Double): Vector2D = Vector2D(a.x * value, a.y * value) public override fun Vector2D.dot(other: Vector2D): Double = x * other.x + y * other.y } diff --git a/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/Euclidean3DSpace.kt b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/Euclidean3DSpace.kt index 906f5df03..ed110e383 100644 --- a/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/Euclidean3DSpace.kt +++ b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/Euclidean3DSpace.kt @@ -2,6 +2,7 @@ package space.kscience.kmath.geometry import space.kscience.kmath.linear.Point import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.operations.ScaleOperations import space.kscience.kmath.operations.SpaceElement import space.kscience.kmath.operations.invoke import kotlin.math.sqrt @@ -32,21 +33,22 @@ public val Vector3D.r: Double get() = Euclidean3DSpace { sqrt(norm()) } private data class Vector3DImpl( override val x: Double, override val y: Double, - override val z: Double + override val z: Double, ) : Vector3D -public object Euclidean3DSpace : GeometrySpace { +public object Euclidean3DSpace : GeometrySpace, ScaleOperations { public override val zero: Vector3D by lazy { Vector3D(0.0, 0.0, 0.0) } public fun Vector3D.norm(): Double = sqrt(x * x + y * y + z * z) + override fun Vector3D.unaryMinus(): Vector3D = Vector3D(-x, -y, -z) public override fun Vector3D.distanceTo(other: Vector3D): Double = (this - other).norm() public override fun add(a: Vector3D, b: Vector3D): Vector3D = Vector3D(a.x + b.x, a.y + b.y, a.z + b.z) - public override fun multiply(a: Vector3D, k: Number): Vector3D = - Vector3D(a.x * k.toDouble(), a.y * k.toDouble(), a.z * k.toDouble()) + public override fun scale(a: Vector3D, value: Double): Vector3D = + Vector3D(a.x * value, a.y * value, a.z * value) public override fun Vector3D.dot(other: Vector3D): Double = x * other.x + y * other.y + z * other.z diff --git a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/IndexedHistogramSpace.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/IndexedHistogramSpace.kt index 85262abeb..b82644481 100644 --- a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/IndexedHistogramSpace.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/IndexedHistogramSpace.kt @@ -3,9 +3,10 @@ package space.kscience.kmath.histogram import space.kscience.kmath.domains.Domain import space.kscience.kmath.linear.Point import space.kscience.kmath.misc.UnstableKMathAPI -import space.kscience.kmath.nd.NDSpace +import space.kscience.kmath.nd.NDField import space.kscience.kmath.nd.NDStructure import space.kscience.kmath.nd.Strides +import space.kscience.kmath.operations.ScaleOperations import space.kscience.kmath.operations.Space import space.kscience.kmath.operations.SpaceElement import space.kscience.kmath.operations.invoke @@ -41,10 +42,11 @@ public class IndexedHistogram, V : Any>( /** * A space for producing histograms with values in a NDStructure */ -public interface IndexedHistogramSpace, V : Any> : Space> { +public interface IndexedHistogramSpace, V : Any> + : Space>, ScaleOperations> { //public val valueSpace: Space public val strides: Strides - public val histogramValueSpace: NDSpace //= NDAlgebra.space(valueSpace, Buffer.Companion::boxing, *shape), + public val histogramValueSpace: NDField //= NDAlgebra.space(valueSpace, Buffer.Companion::boxing, *shape), /** * Resolve index of the bin including given [point] @@ -63,12 +65,12 @@ public interface IndexedHistogramSpace, V : Any> : Space, b: IndexedHistogram): IndexedHistogram { require(a.context == this) { "Can't operate on a histogram produced by external space" } require(b.context == this) { "Can't operate on a histogram produced by external space" } - return IndexedHistogram(this, histogramValueSpace.invoke { a.values + b.values }) + return IndexedHistogram(this, histogramValueSpace { a.values + b.values }) } - override fun multiply(a: IndexedHistogram, k: Number): IndexedHistogram { + override fun scale(a: IndexedHistogram, value: Double): IndexedHistogram { require(a.context == this) { "Can't operate on a histogram produced by external space" } - return IndexedHistogram(this, histogramValueSpace.invoke { a.values * k }) + return IndexedHistogram(this, histogramValueSpace { a.values * value }) } override val zero: IndexedHistogram get() = produce { } diff --git a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/RealHistogramSpace.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/RealHistogramSpace.kt index 26efdf1fe..3df0b1626 100644 --- a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/RealHistogramSpace.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/RealHistogramSpace.kt @@ -2,6 +2,7 @@ package space.kscience.kmath.histogram import space.kscience.kmath.domains.Domain import space.kscience.kmath.domains.HyperSquareDomain +import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.nd.* import space.kscience.kmath.structures.* import kotlin.math.floor @@ -40,6 +41,7 @@ public class RealHistogramSpace( getIndex(it, point[it]) } + @OptIn(UnstableKMathAPI::class) override fun getDomain(index: IntArray): Domain { val lowerBoundary = index.mapIndexed { axis, i -> when (i) { @@ -77,6 +79,8 @@ public class RealHistogramSpace( return IndexedHistogram(this, values) } + override fun IndexedHistogram.unaryMinus(): IndexedHistogram = this * (-1) + public companion object { /** * Use it like diff --git a/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/TreeHistogramSpace.kt b/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/TreeHistogramSpace.kt index ddecc4332..85e82f515 100644 --- a/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/TreeHistogramSpace.kt +++ b/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/TreeHistogramSpace.kt @@ -2,6 +2,7 @@ package space.kscience.kmath.histogram import space.kscience.kmath.domains.UnivariateDomain import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.operations.ScaleOperations import space.kscience.kmath.operations.Space import space.kscience.kmath.structures.Buffer import java.util.* @@ -36,7 +37,7 @@ public class TreeHistogram( @UnstableKMathAPI public class TreeHistogramSpace( public val binFactory: (Double) -> UnivariateDomain, -) : Space { +) : Space, ScaleOperations { private class BinCounter(val domain: UnivariateDomain, val counter: Counter = Counter.real()) : ClosedFloatingPointRange by domain.range @@ -97,14 +98,14 @@ public class TreeHistogramSpace( return TreeHistogram(this, bins) } - override fun multiply(a: UnivariateHistogram, k: Number): UnivariateHistogram { + override fun scale(a: UnivariateHistogram, value: Double): UnivariateHistogram { val bins = TreeMap().apply { a.bins.forEach { bin -> put(bin.domain.center, UnivariateBin( bin.domain, - value = bin.value * k.toDouble(), - standardDeviation = abs(bin.standardDeviation * k.toDouble()) + value = bin.value * value.toDouble(), + standardDeviation = abs(bin.standardDeviation * value.toDouble()) ) ) } @@ -113,6 +114,8 @@ public class TreeHistogramSpace( return TreeHistogram(this, bins) } + override fun UnivariateHistogram.unaryMinus(): UnivariateHistogram = this * (-1) + override val zero: UnivariateHistogram = produce { } public companion object { diff --git a/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogram.kt b/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogram.kt index 8c4f9e434..96e3d41ae 100644 --- a/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogram.kt +++ b/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogram.kt @@ -8,6 +8,7 @@ import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.asSequence +@UnstableKMathAPI public val UnivariateDomain.center: Double get() = (range.endInclusive - range.start) / 2 /** @@ -15,6 +16,7 @@ public val UnivariateDomain.center: Double get() = (range.endInclusive - range.s * @param value The value of histogram including weighting * @param standardDeviation Standard deviation of the bin value. Zero or negative if not applicable */ +@UnstableKMathAPI public class UnivariateBin( public val domain: UnivariateDomain, override val value: Double, diff --git a/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt index c50174b95..11e7b73e4 100644 --- a/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt +++ b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt @@ -20,7 +20,7 @@ internal fun NDAlgebra<*, *>.checkShape(array: INDArray): INDArray { * @param T the type of ND-structure element. * @param C the type of the element context. */ -public interface Nd4jArrayAlgebra : NDAlgebra { +public interface Nd4jArrayAlgebra> : NDAlgebra { /** * Wraps [INDArray] to [N]. */ @@ -92,18 +92,9 @@ public interface Nd4jArraySpace> : NDSpace, Nd4jArrayAlgeb return ndArray.neg().wrap() } - public override fun multiply(a: NDStructure, k: Number): Nd4jArrayStructure { + public fun multiply(a: NDStructure, k: Number): Nd4jArrayStructure { return a.ndArray.mul(k).wrap() } - - @Deprecated("Avoid using this method, underlying array get casted to Doubles") - public override operator fun NDStructure.div(k: Number): Nd4jArrayStructure { - return ndArray.div(k).wrap() - } - - public override operator fun NDStructure.times(k: Number): Nd4jArrayStructure { - return ndArray.mul(k).wrap() - } } /** @@ -180,8 +171,7 @@ public interface Nd4jArrayField> : NDField, Nd4jArrayRing< public override fun divide(a: NDStructure, b: NDStructure): Nd4jArrayStructure = a.ndArray.div(b.ndArray).wrap() - public override operator fun Number.div(b: NDStructure): Nd4jArrayStructure = b.ndArray.rdiv(this).wrap() - + public operator fun Number.div(b: NDStructure): Nd4jArrayStructure = b.ndArray.rdiv(this).wrap() public companion object { private val floatNd4jArrayFieldCache: ThreadLocal> = @@ -218,11 +208,14 @@ public interface Nd4jArrayField> : NDField, Nd4jArrayRing< * Represents [NDField] over [Nd4jArrayRealStructure]. */ public class RealNd4jArrayField(public override val shape: IntArray) : Nd4jArrayField { - public override val elementContext: RealField - get() = RealField + public override val elementContext: RealField get() = RealField public override fun INDArray.wrap(): Nd4jArrayStructure = checkShape(this).asRealStructure() + override fun scale(a: NDStructure, value: Double): Nd4jArrayStructure { + return a.ndArray.mul(value).wrap() + } + public override operator fun NDStructure.div(arg: Double): Nd4jArrayStructure { return ndArray.div(arg).wrap() } @@ -257,6 +250,10 @@ public class FloatNd4jArrayField(public override val shape: IntArray) : Nd4jArra public override fun INDArray.wrap(): Nd4jArrayStructure = checkShape(this).asFloatStructure() + override fun scale(a: NDStructure, value: Double): NDStructure { + return a.ndArray.mul(value).wrap() + } + public override operator fun NDStructure.div(arg: Float): Nd4jArrayStructure { return ndArray.div(arg).wrap() } diff --git a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/SamplerAlgebra.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/SamplerAlgebra.kt index 9fed91e1f..ca2fd58cc 100644 --- a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/SamplerAlgebra.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/SamplerAlgebra.kt @@ -4,6 +4,7 @@ import space.kscience.kmath.chains.Chain import space.kscience.kmath.chains.ConstantChain import space.kscience.kmath.chains.map import space.kscience.kmath.chains.zip +import space.kscience.kmath.operations.ScaleOperations import space.kscience.kmath.operations.Space import space.kscience.kmath.operations.invoke @@ -18,14 +19,18 @@ public class ConstantSampler(public val value: T) : Sampler { /** * A space for samplers. Allows to perform simple operations on distributions */ -public class SamplerSpace(public val space: Space) : Space> { - public override val zero: Sampler = ConstantSampler(space.zero) +public class SamplerSpace(public val algebra: S) : Space>, + ScaleOperations> where S : Space, S : ScaleOperations { + + public override val zero: Sampler = ConstantSampler(algebra.zero) public override fun add(a: Sampler, b: Sampler): Sampler = BasicSampler { generator -> - a.sample(generator).zip(b.sample(generator)) { aValue, bValue -> space { aValue + bValue } } + a.sample(generator).zip(b.sample(generator)) { aValue, bValue -> algebra { aValue + bValue } } } - public override fun multiply(a: Sampler, k: Number): Sampler = BasicSampler { generator -> - a.sample(generator).map { space { it * k.toDouble() } } + public override fun scale(a: Sampler, value: Double): Sampler = BasicSampler { generator -> + a.sample(generator).map { algebra { it * value } } } + + override fun Sampler.unaryMinus(): Sampler = scale(this, -1.0) } diff --git a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Statistic.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Statistic.kt index 29ded2b88..4a3103d1b 100644 --- a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Statistic.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Statistic.kt @@ -43,7 +43,7 @@ public interface ComposableStatistic : Statistic { @ExperimentalCoroutinesApi private fun ComposableStatistic.flowIntermediate( flow: Flow>, - dispatcher: CoroutineDispatcher = Dispatchers.Default + dispatcher: CoroutineDispatcher = Dispatchers.Default, ): Flow = flow .mapParallel(dispatcher) { computeIntermediate(it) } .runningReduce(::composeIntermediate) @@ -59,27 +59,31 @@ private fun ComposableStatistic.flowIntermediate( @ExperimentalCoroutinesApi public fun ComposableStatistic.flow( flow: Flow>, - dispatcher: CoroutineDispatcher = Dispatchers.Default + dispatcher: CoroutineDispatcher = Dispatchers.Default, ): Flow = flowIntermediate(flow, dispatcher).map(::toResult) /** * Arithmetic mean */ -public class Mean(public val space: Space) : ComposableStatistic, T> { +public class Mean( + private val space: Space, + private val division: (sum: T, count: Int) -> T, +) : ComposableStatistic, T> { public override suspend fun computeIntermediate(data: Buffer): Pair = space { sum(data.asIterable()) } to data.size public override suspend fun composeIntermediate(first: Pair, second: Pair): Pair = space { first.first + second.first } to (first.second + second.second) - public override suspend fun toResult(intermediate: Pair): T = - space { intermediate.first / intermediate.second } + public override suspend fun toResult(intermediate: Pair): T = space { + division(intermediate.first, intermediate.second) + } public companion object { //TODO replace with optimized version which respects overflow - public val real: Mean = Mean(RealField) - public val int: Mean = Mean(IntRing) - public val long: Mean = Mean(LongRing) + public val real: Mean = Mean(RealField) { sum, count -> sum / count } + public val int: Mean = Mean(IntRing) { sum, count -> sum / count } + public val long: Mean = Mean(LongRing) { sum, count -> sum / count } } } diff --git a/kmath-viktor/api/kmath-viktor.api b/kmath-viktor/api/kmath-viktor.api index 462e065bf..ebb97b150 100644 --- a/kmath-viktor/api/kmath-viktor.api +++ b/kmath-viktor/api/kmath-viktor.api @@ -26,7 +26,7 @@ public final class space/kscience/kmath/viktor/ViktorBuffer : space/kscience/kma public final synthetic fun unbox-impl ()Lorg/jetbrains/bio/viktor/F64FlatArray; } -public final class space/kscience/kmath/viktor/ViktorNDField : space/kscience/kmath/nd/NDField, space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/RingWithNumbers { +public final class space/kscience/kmath/viktor/ViktorNDField : space/kscience/kmath/nd/NDField, space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/NumbersAddOperations, space/kscience/kmath/operations/ScaleOperations { public fun ([I)V public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; public fun acos-Q7Xurp0 (Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; @@ -55,8 +55,6 @@ public final class space/kscience/kmath/viktor/ViktorNDField : space/kscience/km public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; public fun cosh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public fun div (DLspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; @@ -68,7 +66,7 @@ public final class space/kscience/kmath/viktor/ViktorNDField : space/kscience/km public fun divide (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; public fun exp-Q7Xurp0 (Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; - public synthetic fun getElementContext ()Ljava/lang/Object; + public synthetic fun getElementContext ()Lspace/kscience/kmath/operations/Algebra; public fun getElementContext ()Lspace/kscience/kmath/operations/RealField; public final fun getF64Buffer (Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun getOne ()Ljava/lang/Object; @@ -96,11 +94,8 @@ public final class space/kscience/kmath/viktor/ViktorNDField : space/kscience/km public fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; public fun minus-s8yP2C4 (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; - public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public synthetic fun multiply (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public fun multiply (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public fun multiply-s8yP2C4 (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; public fun number-Q7Xurp0 (Ljava/lang/Number;)Lorg/jetbrains/bio/viktor/F64Array; public fun plus (DLspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; @@ -122,6 +117,8 @@ public final class space/kscience/kmath/viktor/ViktorNDField : space/kscience/km public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; + public fun scale-s8yP2C4 (Lspace/kscience/kmath/nd/NDStructure;D)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; public fun sin-Q7Xurp0 (Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; diff --git a/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorNDStructure.kt b/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorNDStructure.kt index 8deda2544..218afcbef 100644 --- a/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorNDStructure.kt +++ b/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorNDStructure.kt @@ -4,8 +4,9 @@ import org.jetbrains.bio.viktor.F64Array import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.nd.* import space.kscience.kmath.operations.ExtendedField +import space.kscience.kmath.operations.NumbersAddOperations import space.kscience.kmath.operations.RealField -import space.kscience.kmath.operations.RingWithNumbers +import space.kscience.kmath.operations.ScaleOperations @Suppress("OVERRIDE_BY_INLINE", "NOTHING_TO_INLINE") public inline class ViktorNDStructure(public val f64Buffer: F64Array) : MutableNDStructure { @@ -26,7 +27,8 @@ public fun F64Array.asStructure(): ViktorNDStructure = ViktorNDStructure(this) @OptIn(UnstableKMathAPI::class) @Suppress("OVERRIDE_BY_INLINE", "NOTHING_TO_INLINE") public class ViktorNDField(public override val shape: IntArray) : NDField, - RingWithNumbers>, ExtendedField> { + NumbersAddOperations>, ExtendedField>, + ScaleOperations> { public val NDStructure.f64Buffer: F64Array get() = when { @@ -55,6 +57,8 @@ public class ViktorNDField(public override val shape: IntArray) : NDField.unaryMinus(): NDStructure = this * (-1) + public override fun NDStructure.map(transform: RealField.(Double) -> Double): ViktorNDStructure = F64Array(*this@ViktorNDField.shape).apply { this@ViktorNDField.strides.indices().forEach { index -> @@ -83,8 +87,8 @@ public class ViktorNDField(public override val shape: IntArray) : NDField, b: NDStructure): ViktorNDStructure = (a.f64Buffer + b.f64Buffer).asStructure() - public override fun multiply(a: NDStructure, k: Number): ViktorNDStructure = - (a.f64Buffer * k.toDouble()).asStructure() + public override fun scale(a: NDStructure, value: Double): ViktorNDStructure = + (a.f64Buffer * value.toDouble()).asStructure() public override inline fun NDStructure.plus(b: NDStructure): ViktorNDStructure = (f64Buffer + b.f64Buffer).asStructure() diff --git a/settings.gradle.kts b/settings.gradle.kts index cadbfd7ba..b4d7b3049 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,14 +1,15 @@ pluginManagement { repositories { + maven("https://repo.kotlin.link") + mavenLocal() gradlePluginPortal() jcenter() - maven("https://repo.kotlin.link") maven("https://dl.bintray.com/kotlin/kotlin-eap") maven("https://dl.bintray.com/kotlin/kotlinx") } - val toolsVersion = "0.8.1" - val kotlinVersion = "1.4.30" + val toolsVersion = "0.9.1" + val kotlinVersion = "1.4.31" plugins { id("kotlinx.benchmark") version "0.2.0-dev-20" From 940718098dd588860e33aefde1d027a80dfdf61b Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Wed, 10 Mar 2021 21:35:28 +0700 Subject: [PATCH 102/150] Revise benchmarks code Revise benchmarks code by using kotlinx.benchmark type aliases (it will simplify creating multiplatform benchmarks), using Blackhole class to consume results, moving all the constant state to private companion objects --- .../kmath/benchmarks/ArrayBenchmark.kt | 32 +++++++------ .../kmath/benchmarks/BufferBenchmark.kt | 10 ++--- .../kscience/kmath/benchmarks/DotBenchmark.kt | 27 +++++------ .../ExpressionsInterpretersBenchmark.kt | 37 ++++++++------- .../benchmarks/LinearAlgebraBenchmark.kt | 19 ++++---- .../kmath/benchmarks/NDFieldBenchmark.kt | 28 +++++++----- .../kmath/benchmarks/ViktorBenchmark.kt | 42 ++++++++++------- .../kmath/benchmarks/ViktorLogBenchmark.kt | 45 ++++++++++--------- 8 files changed, 134 insertions(+), 106 deletions(-) diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ArrayBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ArrayBenchmark.kt index 535778844..43b698c03 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ArrayBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ArrayBenchmark.kt @@ -1,34 +1,38 @@ package space.kscience.kmath.benchmarks -import org.openjdk.jmh.annotations.Benchmark -import org.openjdk.jmh.annotations.Scope -import org.openjdk.jmh.annotations.State +import kotlinx.benchmark.Benchmark +import kotlinx.benchmark.Blackhole +import kotlinx.benchmark.Scope +import kotlinx.benchmark.State import java.nio.IntBuffer @State(Scope.Benchmark) internal class ArrayBenchmark { @Benchmark - fun benchmarkArrayRead() { + fun benchmarkArrayRead(blackhole: Blackhole) { var res = 0 - for (i in 1..space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.size) res += space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.array[space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.size - i] + for (i in 1..size) res += array[size - i] + blackhole.consume(res) } @Benchmark - fun benchmarkBufferRead() { + fun benchmarkBufferRead(blackhole: Blackhole) { var res = 0 - for (i in 1..space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.size) res += space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.arrayBuffer[space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.size - i] + for (i in 1..size) res += arrayBuffer[size - i] + blackhole.consume(res) } @Benchmark - fun nativeBufferRead() { + fun nativeBufferRead(blackhole: Blackhole) { var res = 0 - for (i in 1..space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.size) res += space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.nativeBuffer[space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.size - i] + for (i in 1..size) res += nativeBuffer[size - i] + blackhole.consume(res) } - companion object { - const val size: Int = 1000 - val array: IntArray = IntArray(space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.size) { it } - val arrayBuffer: IntBuffer = IntBuffer.wrap(space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.array) - val nativeBuffer: IntBuffer = IntBuffer.allocate(space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.size).also { for (i in 0 until space.kscience.kmath.benchmarks.ArrayBenchmark.Companion.size) it.put(i, i) } + private companion object { + private const val size = 1000 + private val array = IntArray(size) { it } + private val arrayBuffer = IntBuffer.wrap(array) + private val nativeBuffer = IntBuffer.allocate(size).also { for (i in 0 until size) it.put(i, i) } } } diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/BufferBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/BufferBenchmark.kt index 1afb4e52c..1c3bbab75 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/BufferBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/BufferBenchmark.kt @@ -1,8 +1,8 @@ package space.kscience.kmath.benchmarks -import org.openjdk.jmh.annotations.Benchmark -import org.openjdk.jmh.annotations.Scope -import org.openjdk.jmh.annotations.State +import kotlinx.benchmark.Benchmark +import kotlinx.benchmark.Scope +import kotlinx.benchmark.State import space.kscience.kmath.complex.Complex import space.kscience.kmath.complex.complex import space.kscience.kmath.structures.MutableBuffer @@ -28,7 +28,7 @@ internal class BufferBenchmark { } } - companion object { - const val size: Int = 100 + private companion object { + private const val size = 100 } } diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt index 39eeb24d3..93b5c5549 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt @@ -1,8 +1,9 @@ package space.kscience.kmath.benchmarks import kotlinx.benchmark.Benchmark -import org.openjdk.jmh.annotations.Scope -import org.openjdk.jmh.annotations.State +import kotlinx.benchmark.Blackhole +import kotlinx.benchmark.Scope +import kotlinx.benchmark.State import space.kscience.kmath.commons.linear.CMMatrixContext import space.kscience.kmath.ejml.EjmlMatrixContext import space.kscience.kmath.linear.BufferMatrixContext @@ -17,7 +18,7 @@ import kotlin.random.Random internal class DotBenchmark { companion object { val random = Random(12224) - val dim = 1000 + const val dim = 1000 //creating invertible matrix val matrix1 = Matrix.real(dim, dim) { i, j -> if (i <= j) random.nextDouble() else 0.0 } @@ -31,37 +32,37 @@ internal class DotBenchmark { } @Benchmark - fun cmDot() { + fun cmDot(blackhole: Blackhole) { CMMatrixContext { - cmMatrix1 dot cmMatrix2 + blackhole.consume(cmMatrix1 dot cmMatrix2) } } @Benchmark - fun ejmlDot() { + fun ejmlDot(blackhole: Blackhole) { EjmlMatrixContext { - ejmlMatrix1 dot ejmlMatrix2 + blackhole.consume(ejmlMatrix1 dot ejmlMatrix2) } } @Benchmark - fun ejmlDotWithConversion() { + fun ejmlDotWithConversion(blackhole: Blackhole) { EjmlMatrixContext { - matrix1 dot matrix2 + blackhole.consume(matrix1 dot matrix2) } } @Benchmark - fun bufferedDot() { + fun bufferedDot(blackhole: Blackhole) { BufferMatrixContext(RealField, Buffer.Companion::real).invoke { - matrix1 dot matrix2 + blackhole.consume(matrix1 dot matrix2) } } @Benchmark - fun realDot() { + fun realDot(blackhole: Blackhole) { RealMatrixContext { - matrix1 dot matrix2 + blackhole.consume(matrix1 dot matrix2) } } } diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt index a9c0fe703..9c150f074 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt @@ -1,64 +1,62 @@ package space.kscience.kmath.benchmarks -import org.openjdk.jmh.annotations.Benchmark -import org.openjdk.jmh.annotations.Scope -import org.openjdk.jmh.annotations.State +import kotlinx.benchmark.Benchmark +import kotlinx.benchmark.Blackhole +import kotlinx.benchmark.Scope +import kotlinx.benchmark.State import space.kscience.kmath.asm.compile import space.kscience.kmath.ast.mstInField import space.kscience.kmath.expressions.Expression import space.kscience.kmath.expressions.expressionInField import space.kscience.kmath.expressions.invoke import space.kscience.kmath.expressions.symbol -import space.kscience.kmath.operations.Field import space.kscience.kmath.operations.RealField import space.kscience.kmath.operations.bindSymbol import kotlin.random.Random @State(Scope.Benchmark) internal class ExpressionsInterpretersBenchmark { - private val algebra: Field = RealField - val x by symbol - @Benchmark - fun functionalExpression() { + fun functionalExpression(blackhole: Blackhole) { val expr = algebra.expressionInField { val x = bindSymbol(x) x * const(2.0) + const(2.0) / x - const(16.0) } - invokeAndSum(expr) + invokeAndSum(expr, blackhole) } @Benchmark - fun mstExpression() { + fun mstExpression(blackhole: Blackhole) { val expr = algebra.mstInField { val x = bindSymbol(x) x * 2.0 + 2.0 / x - 16.0 } - invokeAndSum(expr) + invokeAndSum(expr, blackhole) } @Benchmark - fun asmExpression() { + fun asmExpression(blackhole: Blackhole) { val expr = algebra.mstInField { val x = bindSymbol(x) x * 2.0 + 2.0 / x - 16.0 }.compile() - invokeAndSum(expr) + invokeAndSum(expr, blackhole) } @Benchmark - fun rawExpression() { + fun rawExpression(blackhole: Blackhole) { val expr = Expression { args -> val x = args.getValue(x) x * 2.0 + 2.0 / x - 16.0 } - invokeAndSum(expr) + + invokeAndSum(expr, blackhole) } - private fun invokeAndSum(expr: Expression) { + private fun invokeAndSum(expr: Expression, blackhole: Blackhole) { val random = Random(0) var sum = 0.0 @@ -66,6 +64,11 @@ internal class ExpressionsInterpretersBenchmark { sum += expr(x to random.nextDouble()) } - println(sum) + blackhole.consume(sum) + } + + private companion object { + private val algebra = RealField + private val x by symbol } } diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/LinearAlgebraBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/LinearAlgebraBenchmark.kt index 22e735e12..30cb6c0b9 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/LinearAlgebraBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/LinearAlgebraBenchmark.kt @@ -1,8 +1,9 @@ package space.kscience.kmath.benchmarks import kotlinx.benchmark.Benchmark -import org.openjdk.jmh.annotations.Scope -import org.openjdk.jmh.annotations.State +import kotlinx.benchmark.Blackhole +import kotlinx.benchmark.Scope +import kotlinx.benchmark.State import space.kscience.kmath.commons.linear.CMMatrixContext import space.kscience.kmath.commons.linear.CMMatrixContext.dot import space.kscience.kmath.commons.linear.inverse @@ -18,7 +19,7 @@ import kotlin.random.Random internal class LinearAlgebraBenchmark { companion object { val random = Random(1224) - val dim = 100 + const val dim = 100 //creating invertible matrix val u = Matrix.real(dim, dim) { i, j -> if (i <= j) random.nextDouble() else 0.0 } @@ -27,21 +28,21 @@ internal class LinearAlgebraBenchmark { } @Benchmark - fun kmathLupInversion() { - MatrixContext.real.inverseWithLup(matrix) + fun kmathLupInversion(blackhole: Blackhole) { + blackhole.consume(MatrixContext.real.inverseWithLup(matrix)) } @Benchmark - fun cmLUPInversion() { + fun cmLUPInversion(blackhole: Blackhole) { with(CMMatrixContext) { - inverse(matrix) + blackhole.consume(inverse(matrix)) } } @Benchmark - fun ejmlInverse() { + fun ejmlInverse(blackhole: Blackhole) { with(EjmlMatrixContext) { - inverse(matrix) + blackhole.consume(inverse(matrix)) } } } diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/NDFieldBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/NDFieldBenchmark.kt index 5bcc09cdb..aeee0dafe 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/NDFieldBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/NDFieldBenchmark.kt @@ -1,8 +1,9 @@ package space.kscience.kmath.benchmarks -import org.openjdk.jmh.annotations.Benchmark -import org.openjdk.jmh.annotations.Scope -import org.openjdk.jmh.annotations.State +import kotlinx.benchmark.Benchmark +import kotlinx.benchmark.Blackhole +import kotlinx.benchmark.Scope +import kotlinx.benchmark.State import space.kscience.kmath.nd.* import space.kscience.kmath.operations.RealField import space.kscience.kmath.structures.Buffer @@ -10,35 +11,38 @@ import space.kscience.kmath.structures.Buffer @State(Scope.Benchmark) internal class NDFieldBenchmark { @Benchmark - fun autoFieldAdd() { + fun autoFieldAdd(blackhole: Blackhole) { with(autoField) { var res: NDStructure = one repeat(n) { res += one } + blackhole.consume(res) } } @Benchmark - fun specializedFieldAdd() { + fun specializedFieldAdd(blackhole: Blackhole) { with(specializedField) { var res: NDStructure = one repeat(n) { res += 1.0 } + blackhole.consume(res) } } @Benchmark - fun boxingFieldAdd() { + fun boxingFieldAdd(blackhole: Blackhole) { with(genericField) { var res: NDStructure = one repeat(n) { res += 1.0 } + blackhole.consume(res) } } - companion object { - const val dim: Int = 1000 - const val n: Int = 100 - val autoField = NDAlgebra.auto(RealField, dim, dim) - val specializedField: RealNDField = NDAlgebra.real(dim, dim) - val genericField = NDAlgebra.field(RealField, Buffer.Companion::boxing, dim, dim) + private companion object { + private const val dim = 1000 + private const val n = 100 + private val autoField = NDAlgebra.auto(RealField, dim, dim) + private val specializedField = NDAlgebra.real(dim, dim) + private val genericField = NDAlgebra.field(RealField, Buffer.Companion::boxing, dim, dim) } } diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorBenchmark.kt index 370258bc6..c511173a9 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorBenchmark.kt @@ -1,51 +1,61 @@ package space.kscience.kmath.benchmarks +import kotlinx.benchmark.Benchmark +import kotlinx.benchmark.Blackhole +import kotlinx.benchmark.Scope +import kotlinx.benchmark.State import org.jetbrains.bio.viktor.F64Array -import org.openjdk.jmh.annotations.Benchmark -import org.openjdk.jmh.annotations.Scope -import org.openjdk.jmh.annotations.State -import space.kscience.kmath.nd.* +import space.kscience.kmath.nd.NDAlgebra +import space.kscience.kmath.nd.NDStructure +import space.kscience.kmath.nd.auto +import space.kscience.kmath.nd.real import space.kscience.kmath.operations.RealField import space.kscience.kmath.viktor.ViktorNDField @State(Scope.Benchmark) internal class ViktorBenchmark { - final val dim: Int = 1000 - final val n: Int = 100 - - // automatically build context most suited for given type. - final val autoField: NDField = NDAlgebra.auto(RealField, dim, dim) - final val realField: RealNDField = NDAlgebra.real(dim, dim) - final val viktorField: ViktorNDField = ViktorNDField(dim, dim) - @Benchmark - fun automaticFieldAddition() { + fun automaticFieldAddition(blackhole: Blackhole) { with(autoField) { var res: NDStructure = one repeat(n) { res += 1.0 } + blackhole.consume(res) } } @Benchmark - fun realFieldAddition() { + fun realFieldAddition(blackhole: Blackhole) { with(realField) { var res: NDStructure = one repeat(n) { res += 1.0 } + blackhole.consume(res) } } @Benchmark - fun viktorFieldAddition() { + fun viktorFieldAddition(blackhole: Blackhole) { with(viktorField) { var res = one repeat(n) { res += 1.0 } + blackhole.consume(res) } } @Benchmark - fun rawViktor() { + fun rawViktor(blackhole: Blackhole) { val one = F64Array.full(init = 1.0, shape = intArrayOf(dim, dim)) var res = one repeat(n) { res = res + one } + blackhole.consume(res) + } + + private companion object { + private const val dim = 1000 + private const val n = 100 + + // automatically build context most suited for given type. + private val autoField = NDAlgebra.auto(RealField, dim, dim) + private val realField = NDAlgebra.real(dim, dim) + private val viktorField = ViktorNDField(dim, dim) } } diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt index 9f99b002a..c48c86af9 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt @@ -1,48 +1,53 @@ package space.kscience.kmath.benchmarks +import kotlinx.benchmark.Benchmark +import kotlinx.benchmark.Blackhole +import kotlinx.benchmark.Scope +import kotlinx.benchmark.State import org.jetbrains.bio.viktor.F64Array -import org.openjdk.jmh.annotations.Benchmark -import org.openjdk.jmh.annotations.Scope -import org.openjdk.jmh.annotations.State -import space.kscience.kmath.nd.* +import space.kscience.kmath.nd.NDAlgebra +import space.kscience.kmath.nd.auto +import space.kscience.kmath.nd.real import space.kscience.kmath.operations.RealField import space.kscience.kmath.viktor.ViktorNDField @State(Scope.Benchmark) internal class ViktorLogBenchmark { - final val dim: Int = 1000 - final val n: Int = 100 - - // automatically build context most suited for given type. - final val autoField: NDField = NDAlgebra.auto(RealField, dim, dim) - final val realField: RealNDField = NDAlgebra.real(dim, dim) - final val viktorField: ViktorNDField = ViktorNDField(intArrayOf(dim, dim)) - - @Benchmark - fun realFieldLog() { + fun realFieldLog(blackhole: Blackhole) { with(realField) { val fortyTwo = produce { 42.0 } var res = one repeat(n) { res = ln(fortyTwo) } + blackhole.consume(res) } } @Benchmark - fun viktorFieldLog() { + fun viktorFieldLog(blackhole: Blackhole) { with(viktorField) { val fortyTwo = produce { 42.0 } var res = one repeat(n) { res = ln(fortyTwo) } + blackhole.consume(res) } } @Benchmark - fun rawViktorLog() { + fun rawViktorLog(blackhole: Blackhole) { val fortyTwo = F64Array.full(dim, dim, init = 42.0) - var res: F64Array - repeat(n) { - res = fortyTwo.log() - } + lateinit var res: F64Array + repeat(n) { res = fortyTwo.log() } + blackhole.consume(res) + } + + private companion object { + private const val dim = 1000 + private const val n = 100 + + // automatically build context most suited for given type. + private val autoField = NDAlgebra.auto(RealField, dim, dim) + private val realField = NDAlgebra.real(dim, dim) + private val viktorField = ViktorNDField(intArrayOf(dim, dim)) } } From 6a5ca2a115570c404b7fa0be7885cd2d539e60e5 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 10 Mar 2021 18:02:04 +0300 Subject: [PATCH 103/150] Code review. --- CHANGELOG.md | 2 +- build.gradle.kts | 1 + .../space/kscience/kmath/ast/expressions.kt | 3 +- .../kmath/linear/RealMatrixContext.kt | 12 ++- .../kmath/operations/NumericAlgebra.kt | 2 +- .../kscience/kmath/functions/Polynomial.kt | 6 +- .../kmath/interpolation/SplineInterpolator.kt | 4 +- .../kscience/kmath/nd4j/Nd4jArrayAlgebra.kt | 100 +++++++----------- .../kmath/viktor/ViktorNDStructure.kt | 2 +- 9 files changed, 58 insertions(+), 74 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db3b65024..595cd3bbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,8 @@ ## [Unreleased] ### Added -- Intrinsic value `two` for ExtendedField to work with hyperbolic functions - ScaleOperations interface +- Field extends ScaleOperations ### Changed - Exponential operations merged with hyperbolic functions diff --git a/build.gradle.kts b/build.gradle.kts index 41e8a3468..113107f69 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -34,6 +34,7 @@ readme { ksciencePublish { github("kmath") space() + sonatype() } apiValidation { diff --git a/examples/src/main/kotlin/space/kscience/kmath/ast/expressions.kt b/examples/src/main/kotlin/space/kscience/kmath/ast/expressions.kt index 8d6851ef8..1cafe30c1 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/ast/expressions.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/ast/expressions.kt @@ -1,12 +1,11 @@ package space.kscience.kmath.ast -import space.kscience.kmath.expressions.invoke import space.kscience.kmath.operations.RealField fun main() { val expr = RealField.mstInField { val x = bindSymbol("x") - x * 2.0 + 2.0 * one / x - 16.0 + x * 2.0 + number(2.0) / x - 16.0 } repeat(10000000) { diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealMatrixContext.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealMatrixContext.kt index a53f0837f..dbccb7536 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealMatrixContext.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealMatrixContext.kt @@ -1,8 +1,9 @@ package space.kscience.kmath.linear +import space.kscience.kmath.operations.ScaleOperations import space.kscience.kmath.structures.RealBuffer -public object RealMatrixContext : MatrixContext> { +public object RealMatrixContext : MatrixContext>, ScaleOperations> { public override fun produce( rows: Int, @@ -58,10 +59,13 @@ public object RealMatrixContext : MatrixContext> { } } - override fun Matrix.times(value: Double): BufferMatrix { - val bufferMatrix = toBufferMatrix() - return produce(rowNum, colNum) { i, j -> bufferMatrix[i, j] * value } + override fun scale(a: Matrix, value: Double): BufferMatrix { + val bufferMatrix = a.toBufferMatrix() + return produce(a.rowNum, a.colNum) { i, j -> bufferMatrix[i, j] * value } } + + override fun Matrix.times(value: Double): BufferMatrix = scale(this, value) + // // override fun multiply(a: Matrix, k: Number): BufferMatrix { // val aBufferMatrix = a.toBufferMatrix() diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/NumericAlgebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/NumericAlgebra.kt index 187261b1d..5f6ec869a 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/NumericAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/NumericAlgebra.kt @@ -86,7 +86,7 @@ public interface NumericAlgebra : Algebra { */ public interface ScaleOperations : Algebra { /** - * Scaling of element by scalar. + * Scaling an element by a scalar. * * @param a the multiplier. * @param value the multiplicand. diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt index 7416069bd..9141fa7b9 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt @@ -42,9 +42,9 @@ public fun > Polynomial.asFunction(ring: C): (T) -> T = /** * An algebra for polynomials */ -public class PolynomialSpace( +public class PolynomialSpace( private val ring: C, -) : Space>, ScaleOperations> where C: Ring, C: ScaleOperations{ +) : Space>, ScaleOperations> where C : Ring, C : ScaleOperations { public override val zero: Polynomial = Polynomial(emptyList()) override fun Polynomial.unaryMinus(): Polynomial = with(ring) { @@ -67,7 +67,7 @@ public class PolynomialSpace( public operator fun Polynomial.invoke(arg: T): T = value(ring, arg) } -public inline fun C.polynomial(block: PolynomialSpace.() -> R): R where C: Ring, C: ScaleOperations{ +public inline fun C.polynomial(block: PolynomialSpace.() -> R): R where C : Ring, C : ScaleOperations { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } return PolynomialSpace(this).block() } diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt index 78d6e0d0c..ddbe743f0 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt @@ -11,8 +11,8 @@ import space.kscience.kmath.structures.MutableBufferFactory * Generic spline interpolator. Not recommended for performance critical places, use platform-specific and type specific ones. * Based on https://github.com/apache/commons-math/blob/eb57d6d457002a0bb5336d789a3381a24599affe/src/main/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolator.java */ -public class SplineInterpolator, F : Field>( - public override val algebra: F, +public class SplineInterpolator>( + public override val algebra: Field, public val bufferFactory: MutableBufferFactory, ) : PolynomialInterpolator { //TODO possibly optimize zeroed buffers diff --git a/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt index 11e7b73e4..dea74abdc 100644 --- a/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt +++ b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt @@ -80,21 +80,17 @@ public interface Nd4jArraySpace> : NDSpace, Nd4jArrayAlgeb public override val zero: Nd4jArrayStructure get() = Nd4j.zeros(*shape).wrap() - public override fun add(a: NDStructure, b: NDStructure): Nd4jArrayStructure { - return a.ndArray.add(b.ndArray).wrap() - } + public override fun add(a: NDStructure, b: NDStructure): Nd4jArrayStructure = + a.ndArray.add(b.ndArray).wrap() - public override operator fun NDStructure.minus(b: NDStructure): Nd4jArrayStructure { - return ndArray.sub(b.ndArray).wrap() - } + public override operator fun NDStructure.minus(b: NDStructure): Nd4jArrayStructure = + ndArray.sub(b.ndArray).wrap() - public override operator fun NDStructure.unaryMinus(): Nd4jArrayStructure { - return ndArray.neg().wrap() - } + public override operator fun NDStructure.unaryMinus(): Nd4jArrayStructure = + ndArray.neg().wrap() - public fun multiply(a: NDStructure, k: Number): Nd4jArrayStructure { - return a.ndArray.mul(k).wrap() - } + public fun multiply(a: NDStructure, k: Number): Nd4jArrayStructure = + a.ndArray.mul(k).wrap() } /** @@ -109,9 +105,8 @@ public interface Nd4jArrayRing> : NDRing, Nd4jArraySpace get() = Nd4j.ones(*shape).wrap() - public override fun multiply(a: NDStructure, b: NDStructure): Nd4jArrayStructure { - return a.ndArray.mul(b.ndArray).wrap() - } + public override fun multiply(a: NDStructure, b: NDStructure): Nd4jArrayStructure = + a.ndArray.mul(b.ndArray).wrap() // // public override operator fun Nd4jArrayStructure.minus(b: Number): Nd4jArrayStructure { // check(this) @@ -250,33 +245,26 @@ public class FloatNd4jArrayField(public override val shape: IntArray) : Nd4jArra public override fun INDArray.wrap(): Nd4jArrayStructure = checkShape(this).asFloatStructure() - override fun scale(a: NDStructure, value: Double): NDStructure { - return a.ndArray.mul(value).wrap() - } + override fun scale(a: NDStructure, value: Double): NDStructure = + a.ndArray.mul(value).wrap() - public override operator fun NDStructure.div(arg: Float): Nd4jArrayStructure { - return ndArray.div(arg).wrap() - } + public override operator fun NDStructure.div(arg: Float): Nd4jArrayStructure = + ndArray.div(arg).wrap() - public override operator fun NDStructure.plus(arg: Float): Nd4jArrayStructure { - return ndArray.add(arg).wrap() - } + public override operator fun NDStructure.plus(arg: Float): Nd4jArrayStructure = + ndArray.add(arg).wrap() - public override operator fun NDStructure.minus(arg: Float): Nd4jArrayStructure { - return ndArray.sub(arg).wrap() - } + public override operator fun NDStructure.minus(arg: Float): Nd4jArrayStructure = + ndArray.sub(arg).wrap() - public override operator fun NDStructure.times(arg: Float): Nd4jArrayStructure { - return ndArray.mul(arg).wrap() - } + public override operator fun NDStructure.times(arg: Float): Nd4jArrayStructure = + ndArray.mul(arg).wrap() - public override operator fun Float.div(arg: NDStructure): Nd4jArrayStructure { - return arg.ndArray.rdiv(this).wrap() - } + public override operator fun Float.div(arg: NDStructure): Nd4jArrayStructure = + arg.ndArray.rdiv(this).wrap() - public override operator fun Float.minus(arg: NDStructure): Nd4jArrayStructure { - return arg.ndArray.rsub(this).wrap() - } + public override operator fun Float.minus(arg: NDStructure): Nd4jArrayStructure = + arg.ndArray.rsub(this).wrap() } /** @@ -288,21 +276,17 @@ public class IntNd4jArrayRing(public override val shape: IntArray) : Nd4jArrayRi public override fun INDArray.wrap(): Nd4jArrayStructure = checkShape(this).asIntStructure() - public override operator fun NDStructure.plus(arg: Int): Nd4jArrayStructure { - return ndArray.add(arg).wrap() - } + public override operator fun NDStructure.plus(arg: Int): Nd4jArrayStructure = + ndArray.add(arg).wrap() - public override operator fun NDStructure.minus(arg: Int): Nd4jArrayStructure { - return ndArray.sub(arg).wrap() - } + public override operator fun NDStructure.minus(arg: Int): Nd4jArrayStructure = + ndArray.sub(arg).wrap() - public override operator fun NDStructure.times(arg: Int): Nd4jArrayStructure { - return ndArray.mul(arg).wrap() - } + public override operator fun NDStructure.times(arg: Int): Nd4jArrayStructure = + ndArray.mul(arg).wrap() - public override operator fun Int.minus(arg: NDStructure): Nd4jArrayStructure { - return arg.ndArray.rsub(this).wrap() - } + public override operator fun Int.minus(arg: NDStructure): Nd4jArrayStructure = + arg.ndArray.rsub(this).wrap() } /** @@ -314,19 +298,15 @@ public class LongNd4jArrayRing(public override val shape: IntArray) : Nd4jArrayR public override fun INDArray.wrap(): Nd4jArrayStructure = checkShape(this).asLongStructure() - public override operator fun NDStructure.plus(arg: Long): Nd4jArrayStructure { - return ndArray.add(arg).wrap() - } + public override operator fun NDStructure.plus(arg: Long): Nd4jArrayStructure = + ndArray.add(arg).wrap() - public override operator fun NDStructure.minus(arg: Long): Nd4jArrayStructure { - return ndArray.sub(arg).wrap() - } + public override operator fun NDStructure.minus(arg: Long): Nd4jArrayStructure = + ndArray.sub(arg).wrap() - public override operator fun NDStructure.times(arg: Long): Nd4jArrayStructure { - return ndArray.mul(arg).wrap() - } + public override operator fun NDStructure.times(arg: Long): Nd4jArrayStructure = + ndArray.mul(arg).wrap() - public override operator fun Long.minus(arg: NDStructure): Nd4jArrayStructure { - return arg.ndArray.rsub(this).wrap() - } + public override operator fun Long.minus(arg: NDStructure): Nd4jArrayStructure = + arg.ndArray.rsub(this).wrap() } diff --git a/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorNDStructure.kt b/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorNDStructure.kt index 218afcbef..f5697cea2 100644 --- a/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorNDStructure.kt +++ b/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorNDStructure.kt @@ -57,7 +57,7 @@ public class ViktorNDField(public override val shape: IntArray) : NDField.unaryMinus(): NDStructure = this * (-1) + override fun NDStructure.unaryMinus(): NDStructure = -1 * this public override fun NDStructure.map(transform: RealField.(Double) -> Double): ViktorNDStructure = F64Array(*this@ViktorNDField.shape).apply { From fe95c4e48ed60716b60e446d26aca6083a7a83a2 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 10 Mar 2021 18:20:23 +0300 Subject: [PATCH 104/150] Code review. --- .../kotlin/space/kscience/kmath/ast/expressions.kt | 1 + kmath-core/api/kmath-core.api | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/examples/src/main/kotlin/space/kscience/kmath/ast/expressions.kt b/examples/src/main/kotlin/space/kscience/kmath/ast/expressions.kt index 1cafe30c1..c342fc3ef 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/ast/expressions.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/ast/expressions.kt @@ -1,5 +1,6 @@ package space.kscience.kmath.ast +import space.kscience.kmath.expressions.invoke import space.kscience.kmath.operations.RealField fun main() { diff --git a/kmath-core/api/kmath-core.api b/kmath-core/api/kmath-core.api index 0efe430ad..da4725428 100644 --- a/kmath-core/api/kmath-core.api +++ b/kmath-core/api/kmath-core.api @@ -697,7 +697,7 @@ public abstract interface class space/kscience/kmath/linear/QRDecompositionFeatu public abstract fun getR ()Lspace/kscience/kmath/nd/Structure2D; } -public final class space/kscience/kmath/linear/RealMatrixContext : space/kscience/kmath/linear/MatrixContext { +public final class space/kscience/kmath/linear/RealMatrixContext : space/kscience/kmath/linear/MatrixContext, space/kscience/kmath/operations/ScaleOperations { public static final field INSTANCE Lspace/kscience/kmath/linear/RealMatrixContext; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun add (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; @@ -706,6 +706,8 @@ public final class space/kscience/kmath/linear/RealMatrixContext : space/kscienc public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/nd/Structure2D; + public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public fun div (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; public synthetic fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; @@ -717,9 +719,15 @@ public final class space/kscience/kmath/linear/RealMatrixContext : space/kscienc public fun point (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; public fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferMatrix; public synthetic fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/Structure2D; + public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; + public fun scale (Lspace/kscience/kmath/nd/Structure2D;D)Lspace/kscience/kmath/linear/BufferMatrix; public fun times (DLspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; + public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public fun times (Lspace/kscience/kmath/nd/Structure2D;D)Lspace/kscience/kmath/linear/BufferMatrix; + public fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; public final fun toBufferMatrix (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; From 39b41cc2ae0b8c7071c42fe50b8cd08b1016e15f Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Wed, 10 Mar 2021 22:40:43 +0700 Subject: [PATCH 105/150] Fix #223 --- .../kotlin/space/kscience/kmath/operations/Algebra.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt index 572f7089a..6bb7d5ed7 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt @@ -188,7 +188,7 @@ public interface SpaceOperations : Algebra { public operator fun Number.times(b: T): T = b * this public override fun unaryOperationFunction(operation: String): (arg: T) -> T = when (operation) { - PLUS_OPERATION -> { arg -> arg } + PLUS_OPERATION -> { arg -> +arg } MINUS_OPERATION -> { arg -> -arg } else -> super.unaryOperationFunction(operation) } From 522f39cef3f75efe11d5e323a3ada955da9d6f7a Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 10 Mar 2021 22:09:19 +0300 Subject: [PATCH 106/150] replace Space by Group --- CHANGELOG.md | 1 + .../space/kscience/kmath/ast/MstAlgebra.kt | 34 +-- .../space/kscience/kmath/ast/MstExpression.kt | 10 +- .../TestESTreeConsistencyWithInterpreter.kt | 4 +- .../kotlin/space/kscience/kmath/ast/parser.kt | 8 +- .../asm/TestAsmConsistencyWithInterpreter.kt | 4 +- kmath-core/api/kmath-core.api | 260 +++++++++--------- .../FunctionalExpressionAlgebra.kt | 20 +- .../kmath/expressions/expressionBuilders.kt | 8 +- .../kscience/kmath/linear/MatrixContext.kt | 2 +- .../kscience/kmath/linear/VectorSpace.kt | 14 +- .../space/kscience/kmath/misc/cumulative.kt | 8 +- .../kscience/kmath/nd/BufferNDAlgebra.kt | 14 +- .../space/kscience/kmath/nd/NDAlgebra.kt | 20 +- .../kscience/kmath/operations/Algebra.kt | 11 +- .../kmath/operations/AlgebraElements.kt | 6 +- .../kmath/operations/NumericAlgebra.kt | 2 +- .../kmath/operations/algebraExtensions.kt | 30 +- .../kscience/kmath/testutils/SpaceVerifier.kt | 4 +- .../space/kscience/kmath/chains/flowExtra.kt | 10 +- .../kscience/kmath/functions/Polynomial.kt | 4 +- .../kscience/kmath/geometry/GeometrySpace.kt | 4 +- .../space/kscience/kmath/histogram/Counter.kt | 4 +- .../kmath/histogram/IndexedHistogramSpace.kt | 4 +- .../kmath/histogram/TreeHistogramSpace.kt | 4 +- .../kmath/histogram/UnivariateHistogram.kt | 4 +- .../kmath/kotlingrad/ScalarsAdapters.kt | 8 +- .../kscience/kmath/nd4j/Nd4jArrayAlgebra.kt | 6 +- .../kscience/kmath/stat/SamplerAlgebra.kt | 6 +- .../space/kscience/kmath/stat/Statistic.kt | 2 +- 30 files changed, 258 insertions(+), 258 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 595cd3bbc..a172eb69a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ### Changed - Exponential operations merged with hyperbolic functions +- Space is replaced by Group. Space is reserved for vector spaces. ### Deprecated diff --git a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt index 047ee187d..a65027147 100644 --- a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt +++ b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt @@ -18,22 +18,22 @@ public object MstAlgebra : NumericAlgebra { } /** - * [Space] over [MST] nodes. + * [Group] over [MST] nodes. */ -public object MstSpace : Space, NumericAlgebra, ScaleOperations { +public object MstGroup : Group, NumericAlgebra, ScaleOperations { public override val zero: MST.Numeric = number(0.0) public override fun number(value: Number): MST.Numeric = MstAlgebra.number(value) public override fun bindSymbol(value: String): MST.Symbolic = MstAlgebra.bindSymbol(value) - public override fun add(a: MST, b: MST): MST.Binary = binaryOperationFunction(SpaceOperations.PLUS_OPERATION)(a, b) + public override fun add(a: MST, b: MST): MST.Binary = binaryOperationFunction(GroupOperations.PLUS_OPERATION)(a, b) public override operator fun MST.unaryPlus(): MST.Unary = - unaryOperationFunction(SpaceOperations.PLUS_OPERATION)(this) + unaryOperationFunction(GroupOperations.PLUS_OPERATION)(this) public override operator fun MST.unaryMinus(): MST.Unary = - unaryOperationFunction(SpaceOperations.MINUS_OPERATION)(this) + unaryOperationFunction(GroupOperations.MINUS_OPERATION)(this) public override operator fun MST.minus(b: MST): MST.Binary = - binaryOperationFunction(SpaceOperations.MINUS_OPERATION)(this, b) + binaryOperationFunction(GroupOperations.MINUS_OPERATION)(this, b) public override fun scale(a: MST, value: Double): MST.Binary = binaryOperationFunction(RingOperations.TIMES_OPERATION)(a, number(value)) @@ -50,25 +50,25 @@ public object MstSpace : Space, NumericAlgebra, ScaleOperations { */ @OptIn(UnstableKMathAPI::class) public object MstRing : Ring, NumbersAddOperations, ScaleOperations { - public override val zero: MST.Numeric = MstSpace.zero + public override val zero: MST.Numeric = MstGroup.zero public override val one: MST.Numeric = number(1.0) - public override fun number(value: Number): MST.Numeric = MstSpace.number(value) - public override fun bindSymbol(value: String): MST.Symbolic = MstSpace.bindSymbol(value) - public override fun add(a: MST, b: MST): MST.Binary = MstSpace.add(a, b) + public override fun number(value: Number): MST.Numeric = MstGroup.number(value) + public override fun bindSymbol(value: String): MST.Symbolic = MstGroup.bindSymbol(value) + public override fun add(a: MST, b: MST): MST.Binary = MstGroup.add(a, b) public override fun scale(a: MST, value: Double): MST.Binary = - MstSpace.binaryOperationFunction(RingOperations.TIMES_OPERATION)(a, MstSpace.number(value)) + MstGroup.binaryOperationFunction(RingOperations.TIMES_OPERATION)(a, MstGroup.number(value)) public override fun multiply(a: MST, b: MST): MST.Binary = binaryOperationFunction(RingOperations.TIMES_OPERATION)(a, b) - public override operator fun MST.unaryPlus(): MST.Unary = MstSpace { +this@unaryPlus } - public override operator fun MST.unaryMinus(): MST.Unary = MstSpace { -this@unaryMinus } - public override operator fun MST.minus(b: MST): MST.Binary = MstSpace { this@minus - b } + public override operator fun MST.unaryPlus(): MST.Unary = MstGroup { +this@unaryPlus } + public override operator fun MST.unaryMinus(): MST.Unary = MstGroup { -this@unaryMinus } + public override operator fun MST.minus(b: MST): MST.Binary = MstGroup { this@minus - b } public override fun binaryOperationFunction(operation: String): (left: MST, right: MST) -> MST.Binary = - MstSpace.binaryOperationFunction(operation) + MstGroup.binaryOperationFunction(operation) public override fun unaryOperationFunction(operation: String): (arg: MST) -> MST.Unary = MstAlgebra.unaryOperationFunction(operation) @@ -88,7 +88,7 @@ public object MstField : Field, NumbersAddOperations, ScaleOperations< public override fun add(a: MST, b: MST): MST.Binary = MstRing.add(a, b) public override fun scale(a: MST, value: Double): MST.Binary = - MstSpace.binaryOperationFunction(RingOperations.TIMES_OPERATION)(a, MstSpace.number(value)) + MstGroup.binaryOperationFunction(RingOperations.TIMES_OPERATION)(a, MstGroup.number(value)) public override fun multiply(a: MST, b: MST): MST.Binary = MstRing.multiply(a, b) public override fun divide(a: MST, b: MST): MST.Binary = @@ -129,7 +129,7 @@ public object MstExtendedField : ExtendedField, NumericAlgebra { public override fun add(a: MST, b: MST): MST.Binary = MstField.add(a, b) public override fun scale(a: MST, value: Double): MST = - binaryOperation(SpaceOperations.PLUS_OPERATION, a, number(value)) + binaryOperation(GroupOperations.PLUS_OPERATION, a, number(value)) public override fun multiply(a: MST, b: MST): MST.Binary = MstField.multiply(a, b) public override fun divide(a: MST, b: MST): MST.Binary = MstField.divide(a, b) diff --git a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstExpression.kt b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstExpression.kt index 412dde32c..3a598fb8c 100644 --- a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstExpression.kt +++ b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstExpression.kt @@ -54,13 +54,13 @@ public inline fun , E : Algebra> A.mst( ): MstExpression = MstExpression(this, mstAlgebra.block()) /** - * Builds [MstExpression] over [Space]. + * Builds [MstExpression] over [Group]. * * @author Alexander Nozik */ -public inline fun > A.mstInSpace(block: MstSpace.() -> MST): MstExpression { +public inline fun > A.mstInSpace(block: MstGroup.() -> MST): MstExpression { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } - return MstExpression(this, MstSpace.block()) + return MstExpression(this, MstGroup.block()) } /** @@ -94,11 +94,11 @@ public inline fun > A.mstInExtendedField(b } /** - * Builds [MstExpression] over [FunctionalExpressionSpace]. + * Builds [MstExpression] over [FunctionalExpressionGroup]. * * @author Alexander Nozik */ -public inline fun > FunctionalExpressionSpace.mstInSpace(block: MstSpace.() -> MST): MstExpression { +public inline fun > FunctionalExpressionGroup.mstInSpace(block: MstGroup.() -> MST): MstExpression { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } return algebra.mstInSpace(block) } diff --git a/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeConsistencyWithInterpreter.kt b/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeConsistencyWithInterpreter.kt index c91cc4daf..34e9dd945 100644 --- a/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeConsistencyWithInterpreter.kt +++ b/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeConsistencyWithInterpreter.kt @@ -12,7 +12,7 @@ import kotlin.test.assertEquals internal class TestESTreeConsistencyWithInterpreter { @Test fun mstSpace() { - val res1 = MstSpace.mstInSpace { + val res1 = MstGroup.mstInSpace { binaryOperationFunction("+")( unaryOperationFunction("+")( number(3.toByte()) - (number(2.toByte()) + (scale( @@ -25,7 +25,7 @@ internal class TestESTreeConsistencyWithInterpreter { ) + bindSymbol("x") + zero }("x" to MST.Numeric(2)) - val res2 = MstSpace.mstInSpace { + val res2 = MstGroup.mstInSpace { binaryOperationFunction("+")( unaryOperationFunction("+")( number(3.toByte()) - (number(2.toByte()) + (scale( diff --git a/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/ast/parser.kt b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/ast/parser.kt index be4aff34f..9a38ce81a 100644 --- a/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/ast/parser.kt +++ b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/ast/parser.kt @@ -14,9 +14,9 @@ import com.github.h0tk3y.betterParse.lexer.regexToken import com.github.h0tk3y.betterParse.parser.ParseResult import com.github.h0tk3y.betterParse.parser.Parser import space.kscience.kmath.operations.FieldOperations +import space.kscience.kmath.operations.GroupOperations import space.kscience.kmath.operations.PowerOperations import space.kscience.kmath.operations.RingOperations -import space.kscience.kmath.operations.SpaceOperations /** * better-parse implementation of grammar defined in the ArithmeticsEvaluator.g4. @@ -55,7 +55,7 @@ public object ArithmeticsEvaluator : Grammar() { .or(binaryFunction) .or(unaryFunction) .or(singular) - .or(-minus and parser(ArithmeticsEvaluator::term) map { MST.Unary(SpaceOperations.MINUS_OPERATION, it) }) + .or(-minus and parser(ArithmeticsEvaluator::term) map { MST.Unary(GroupOperations.MINUS_OPERATION, it) }) .or(-lpar and parser(ArithmeticsEvaluator::subSumChain) and -rpar) private val powChain: Parser by leftAssociative(term = term, operator = pow) { a, _, b -> @@ -77,9 +77,9 @@ public object ArithmeticsEvaluator : Grammar() { operator = plus or minus use TokenMatch::type ) { a, op, b -> if (op == plus) - MST.Binary(SpaceOperations.PLUS_OPERATION, a, b) + MST.Binary(GroupOperations.PLUS_OPERATION, a, b) else - MST.Binary(SpaceOperations.MINUS_OPERATION, a, b) + MST.Binary(GroupOperations.MINUS_OPERATION, a, b) } override val rootParser: Parser by subSumChain diff --git a/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmConsistencyWithInterpreter.kt b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmConsistencyWithInterpreter.kt index 5c6297f3f..4be2ee331 100644 --- a/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmConsistencyWithInterpreter.kt +++ b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmConsistencyWithInterpreter.kt @@ -12,7 +12,7 @@ import kotlin.test.assertEquals internal class TestAsmConsistencyWithInterpreter { @Test fun mstSpace() { - val res1 = MstSpace.mstInSpace { + val res1 = MstGroup.mstInSpace { binaryOperationFunction("+")( unaryOperationFunction("+")( number(3.toByte()) - (number(2.toByte()) + (scale( @@ -25,7 +25,7 @@ internal class TestAsmConsistencyWithInterpreter { ) + bindSymbol("x") + zero }("x" to MST.Numeric(2)) - val res2 = MstSpace.mstInSpace { + val res2 = MstGroup.mstInSpace { binaryOperationFunction("+")( unaryOperationFunction("+")( number(3.toByte()) - (number(2.toByte()) + (scale( diff --git a/kmath-core/api/kmath-core.api b/kmath-core/api/kmath-core.api index da4725428..eae91c985 100644 --- a/kmath-core/api/kmath-core.api +++ b/kmath-core/api/kmath-core.api @@ -52,7 +52,7 @@ public final class space/kscience/kmath/expressions/ExpressionBuildersKt { public static final fun extendedFieldExpression (Lspace/kscience/kmath/operations/ExtendedField;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; public static final fun fieldExpression (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; public static final fun ringExpression (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; - public static final fun spaceExpression (Lspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; + public static final fun spaceExpression (Lspace/kscience/kmath/operations/Group;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; } public final class space/kscience/kmath/expressions/ExpressionKt { @@ -91,7 +91,7 @@ public final class space/kscience/kmath/expressions/FunctionalExpressionAlgebraK public static final fun expressionInExtendedField (Lspace/kscience/kmath/operations/ExtendedField;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; public static final fun expressionInField (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; public static final fun expressionInRing (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; - public static final fun expressionInSpace (Lspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; + public static final fun expressionInSpace (Lspace/kscience/kmath/operations/Group;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/Expression; } public class space/kscience/kmath/expressions/FunctionalExpressionExtendedField : space/kscience/kmath/expressions/FunctionalExpressionField, space/kscience/kmath/operations/ExtendedField { @@ -165,22 +165,8 @@ public class space/kscience/kmath/expressions/FunctionalExpressionField : space/ public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public class space/kscience/kmath/expressions/FunctionalExpressionRing : space/kscience/kmath/expressions/FunctionalExpressionSpace, space/kscience/kmath/operations/Ring { - public fun (Lspace/kscience/kmath/operations/Ring;)V - public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lspace/kscience/kmath/expressions/Expression; - public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; - public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public final fun times (Ljava/lang/Object;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; - public final fun times (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Object;)Lspace/kscience/kmath/expressions/Expression; - public fun times (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; - public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; -} - -public class space/kscience/kmath/expressions/FunctionalExpressionSpace : space/kscience/kmath/expressions/FunctionalExpressionAlgebra, space/kscience/kmath/operations/Space { - public fun (Lspace/kscience/kmath/operations/Space;)V +public class space/kscience/kmath/expressions/FunctionalExpressionGroup : space/kscience/kmath/expressions/FunctionalExpressionAlgebra, space/kscience/kmath/operations/Group { + public fun (Lspace/kscience/kmath/operations/Group;)V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun add (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; @@ -201,6 +187,20 @@ public class space/kscience/kmath/expressions/FunctionalExpressionSpace : space/ public fun unaryPlus (Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; } +public class space/kscience/kmath/expressions/FunctionalExpressionRing : space/kscience/kmath/expressions/FunctionalExpressionGroup, space/kscience/kmath/operations/Ring { + public fun (Lspace/kscience/kmath/operations/Ring;)V + public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun getOne ()Ljava/lang/Object; + public fun getOne ()Lspace/kscience/kmath/expressions/Expression; + public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun multiply (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; + public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public final fun times (Ljava/lang/Object;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; + public final fun times (Lspace/kscience/kmath/expressions/Expression;Ljava/lang/Object;)Lspace/kscience/kmath/expressions/Expression; + public fun times (Lspace/kscience/kmath/expressions/Expression;Lspace/kscience/kmath/expressions/Expression;)Lspace/kscience/kmath/expressions/Expression; + public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; +} + public final class space/kscience/kmath/expressions/SimpleAutoDiffExpression : space/kscience/kmath/expressions/FirstDerivativeExpression { public fun (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function1;)V public fun derivativeOrNull (Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/expressions/Expression; @@ -490,7 +490,7 @@ public final class space/kscience/kmath/linear/BufferMatrixContext : space/kscie public final class space/kscience/kmath/linear/BufferMatrixContext$Companion { } -public final class space/kscience/kmath/linear/BufferVectorSpace : space/kscience/kmath/linear/VectorSpace { +public final class space/kscience/kmath/linear/BufferVectorGroup : space/kscience/kmath/linear/VectorSpace { public fun (ILspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun add (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; @@ -625,7 +625,7 @@ public final class space/kscience/kmath/linear/MatrixBuilderKt { public static final fun row (Lspace/kscience/kmath/nd/Structure2D$Companion;[Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; } -public abstract interface class space/kscience/kmath/linear/MatrixContext : space/kscience/kmath/operations/SpaceOperations { +public abstract interface class space/kscience/kmath/linear/MatrixContext : space/kscience/kmath/operations/GroupOperations { public static final field Companion Lspace/kscience/kmath/linear/MatrixContext$Companion; public abstract fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public abstract fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; @@ -763,7 +763,7 @@ public final class space/kscience/kmath/linear/UnitFeature : space/kscience/kmat public static final field INSTANCE Lspace/kscience/kmath/linear/UnitFeature; } -public abstract interface class space/kscience/kmath/linear/VectorSpace : space/kscience/kmath/operations/Space { +public abstract interface class space/kscience/kmath/linear/VectorSpace : space/kscience/kmath/operations/Group { public static final field Companion Lspace/kscience/kmath/linear/VectorSpace$Companion; public abstract fun add (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public abstract fun getAlgebra ()Lspace/kscience/kmath/operations/Ring; @@ -775,9 +775,9 @@ public abstract interface class space/kscience/kmath/linear/VectorSpace : space/ } public final class space/kscience/kmath/linear/VectorSpace$Companion { - public final fun buffered (ILspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferVectorSpace; - public static synthetic fun buffered$default (Lspace/kscience/kmath/linear/VectorSpace$Companion;ILspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lspace/kscience/kmath/linear/BufferVectorSpace; - public final fun real (I)Lspace/kscience/kmath/linear/BufferVectorSpace; + public final fun buffered (ILspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferVectorGroup; + public static synthetic fun buffered$default (Lspace/kscience/kmath/linear/VectorSpace$Companion;ILspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lspace/kscience/kmath/linear/BufferVectorGroup; + public final fun real (I)Lspace/kscience/kmath/linear/BufferVectorGroup; } public final class space/kscience/kmath/linear/VectorSpace$DefaultImpls { @@ -820,9 +820,9 @@ public final class space/kscience/kmath/misc/CumulativeKt { public static final fun cumulative (Ljava/util/Iterator;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/util/Iterator; public static final fun cumulative (Ljava/util/List;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/util/List; public static final fun cumulative (Lkotlin/sequences/Sequence;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Lkotlin/sequences/Sequence; - public static final fun cumulativeSum (Ljava/lang/Iterable;Lspace/kscience/kmath/operations/Space;)Ljava/lang/Iterable; - public static final fun cumulativeSum (Ljava/util/List;Lspace/kscience/kmath/operations/Space;)Ljava/util/List; - public static final fun cumulativeSum (Lkotlin/sequences/Sequence;Lspace/kscience/kmath/operations/Space;)Lkotlin/sequences/Sequence; + public static final fun cumulativeSum (Ljava/lang/Iterable;Lspace/kscience/kmath/operations/Group;)Ljava/lang/Iterable; + public static final fun cumulativeSum (Ljava/util/List;Lspace/kscience/kmath/operations/Group;)Ljava/util/List; + public static final fun cumulativeSum (Lkotlin/sequences/Sequence;Lspace/kscience/kmath/operations/Group;)Lkotlin/sequences/Sequence; public static final fun cumulativeSumOfDouble (Ljava/lang/Iterable;)Ljava/lang/Iterable; public static final fun cumulativeSumOfDouble (Ljava/util/List;)Ljava/util/List; public static final fun cumulativeSumOfDouble (Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence; @@ -860,9 +860,9 @@ public final class space/kscience/kmath/nd/BufferNDAlgebraKt { public static final fun field (Lspace/kscience/kmath/nd/NDAlgebra$Companion;Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedNDField; public static final fun ndField (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; public static final fun ndRing (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun ndSpace (Lspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final fun ndSpace (Lspace/kscience/kmath/operations/Group;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; public static final fun ring (Lspace/kscience/kmath/nd/NDAlgebra$Companion;Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedNDRing; - public static final fun space (Lspace/kscience/kmath/nd/NDAlgebra$Companion;Lspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedNDSpace; + public static final fun space (Lspace/kscience/kmath/nd/NDAlgebra$Companion;Lspace/kscience/kmath/operations/Group;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedNDGroup; } public class space/kscience/kmath/nd/BufferedNDField : space/kscience/kmath/nd/BufferedNDRing, space/kscience/kmath/nd/NDField { @@ -892,21 +892,8 @@ public class space/kscience/kmath/nd/BufferedNDField : space/kscience/kmath/nd/B public fun times (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; } -public class space/kscience/kmath/nd/BufferedNDRing : space/kscience/kmath/nd/BufferedNDSpace, space/kscience/kmath/nd/NDRing { - public fun ([ILspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V - public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public fun times (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; - public fun times (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; -} - -public class space/kscience/kmath/nd/BufferedNDSpace : space/kscience/kmath/nd/BufferNDAlgebra, space/kscience/kmath/nd/NDSpace { - public fun ([ILspace/kscience/kmath/operations/Space;Lkotlin/jvm/functions/Function2;)V +public class space/kscience/kmath/nd/BufferedNDGroup : space/kscience/kmath/nd/BufferNDAlgebra, space/kscience/kmath/nd/NDGroup { + public fun ([ILspace/kscience/kmath/operations/Group;Lkotlin/jvm/functions/Function2;)V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun add (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; @@ -919,7 +906,7 @@ public class space/kscience/kmath/nd/BufferedNDSpace : space/kscience/kmath/nd/B public fun getBuffer (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/structures/Buffer; public final fun getBufferFactory ()Lkotlin/jvm/functions/Function2; public synthetic fun getElementContext ()Lspace/kscience/kmath/operations/Algebra; - public final fun getElementContext ()Lspace/kscience/kmath/operations/Space; + public final fun getElementContext ()Lspace/kscience/kmath/operations/Group; public final fun getShape ()[I public fun getStrides ()Lspace/kscience/kmath/nd/Strides; public synthetic fun getZero ()Ljava/lang/Object; @@ -948,6 +935,19 @@ public class space/kscience/kmath/nd/BufferedNDSpace : space/kscience/kmath/nd/B public fun unaryPlus (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } +public class space/kscience/kmath/nd/BufferedNDRing : space/kscience/kmath/nd/BufferedNDGroup, space/kscience/kmath/nd/NDRing { + public fun ([ILspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V + public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun getOne ()Ljava/lang/Object; + public fun getOne ()Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun multiply (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun times (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public fun times (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; +} + public final class space/kscience/kmath/nd/DefaultStrides : space/kscience/kmath/nd/Strides { public static final field Companion Lspace/kscience/kmath/nd/DefaultStrides$Companion; public synthetic fun ([ILkotlin/jvm/internal/DefaultConstructorMarker;)V @@ -1050,7 +1050,36 @@ public final class space/kscience/kmath/nd/NDField$DefaultImpls { public static fun unaryPlus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public abstract interface class space/kscience/kmath/nd/NDRing : space/kscience/kmath/nd/NDSpace, space/kscience/kmath/operations/Ring { +public abstract interface class space/kscience/kmath/nd/NDGroup : space/kscience/kmath/nd/NDAlgebra, space/kscience/kmath/operations/Group { + public static final field Companion Lspace/kscience/kmath/nd/NDGroup$Companion; + public abstract fun add (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun minus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun plus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public abstract fun plus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; +} + +public final class space/kscience/kmath/nd/NDGroup$Companion { +} + +public final class space/kscience/kmath/nd/NDGroup$DefaultImpls { + public static fun add (Lspace/kscience/kmath/nd/NDGroup;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun binaryOperation (Lspace/kscience/kmath/nd/NDGroup;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun binaryOperationFunction (Lspace/kscience/kmath/nd/NDGroup;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/nd/NDGroup;Ljava/lang/String;)Lspace/kscience/kmath/nd/NDStructure; + public static fun invoke (Lspace/kscience/kmath/nd/NDGroup;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDGroup;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDGroup;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun minus (Lspace/kscience/kmath/nd/NDGroup;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDGroup;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDGroup;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; + public static fun plus (Lspace/kscience/kmath/nd/NDGroup;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryOperation (Lspace/kscience/kmath/nd/NDGroup;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public static fun unaryOperationFunction (Lspace/kscience/kmath/nd/NDGroup;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/nd/NDGroup;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; +} + +public abstract interface class space/kscience/kmath/nd/NDRing : space/kscience/kmath/nd/NDGroup, space/kscience/kmath/operations/Ring { public static final field Companion Lspace/kscience/kmath/nd/NDRing$Companion; public abstract fun multiply (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; public abstract fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; @@ -1081,35 +1110,6 @@ public final class space/kscience/kmath/nd/NDRing$DefaultImpls { public static fun unaryPlus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; } -public abstract interface class space/kscience/kmath/nd/NDSpace : space/kscience/kmath/nd/NDAlgebra, space/kscience/kmath/operations/Space { - public static final field Companion Lspace/kscience/kmath/nd/NDSpace$Companion; - public abstract fun add (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public abstract fun minus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public abstract fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; - public abstract fun plus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public abstract fun plus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; -} - -public final class space/kscience/kmath/nd/NDSpace$Companion { -} - -public final class space/kscience/kmath/nd/NDSpace$DefaultImpls { - public static fun add (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun binaryOperation (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun binaryOperationFunction (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun bindSymbol (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;)Lspace/kscience/kmath/nd/NDStructure; - public static fun invoke (Lspace/kscience/kmath/nd/NDSpace;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun minus (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun minus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; - public static fun minus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun plus (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun plus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; - public static fun plus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun unaryOperation (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun unaryOperationFunction (Lspace/kscience/kmath/nd/NDSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lspace/kscience/kmath/nd/NDSpace;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; -} - public abstract interface class space/kscience/kmath/nd/NDStructure { public static final field Companion Lspace/kscience/kmath/nd/NDStructure$Companion; public abstract fun elements ()Lkotlin/sequences/Sequence; @@ -1333,17 +1333,17 @@ public final class space/kscience/kmath/operations/AlgebraElementsKt { } public final class space/kscience/kmath/operations/AlgebraExtensionsKt { - public static final fun abs (Lspace/kscience/kmath/operations/Space;Ljava/lang/Comparable;)Ljava/lang/Comparable; - public static final fun average (Lspace/kscience/kmath/operations/Space;Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun average (Lspace/kscience/kmath/operations/Space;Lkotlin/sequences/Sequence;)Ljava/lang/Object; - public static final fun averageWith (Ljava/lang/Iterable;Lspace/kscience/kmath/operations/Space;)Ljava/lang/Object; - public static final fun averageWith (Lkotlin/sequences/Sequence;Lspace/kscience/kmath/operations/Space;)Ljava/lang/Object; + public static final fun abs (Lspace/kscience/kmath/operations/Group;Ljava/lang/Comparable;)Ljava/lang/Comparable; + public static final fun average (Lspace/kscience/kmath/operations/Group;Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun average (Lspace/kscience/kmath/operations/Group;Lkotlin/sequences/Sequence;)Ljava/lang/Object; + public static final fun averageWith (Ljava/lang/Iterable;Lspace/kscience/kmath/operations/Group;)Ljava/lang/Object; + public static final fun averageWith (Lkotlin/sequences/Sequence;Lspace/kscience/kmath/operations/Group;)Ljava/lang/Object; public static final fun power (Lspace/kscience/kmath/operations/Field;Ljava/lang/Object;I)Ljava/lang/Object; public static final fun power (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;I)Ljava/lang/Object; - public static final fun sum (Lspace/kscience/kmath/operations/Space;Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun sum (Lspace/kscience/kmath/operations/Space;Lkotlin/sequences/Sequence;)Ljava/lang/Object; - public static final fun sumWith (Ljava/lang/Iterable;Lspace/kscience/kmath/operations/Space;)Ljava/lang/Object; - public static final fun sumWith (Lkotlin/sequences/Sequence;Lspace/kscience/kmath/operations/Space;)Ljava/lang/Object; + public static final fun sum (Lspace/kscience/kmath/operations/Group;Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun sum (Lspace/kscience/kmath/operations/Group;Lkotlin/sequences/Sequence;)Ljava/lang/Object; + public static final fun sumWith (Ljava/lang/Iterable;Lspace/kscience/kmath/operations/Group;)Ljava/lang/Object; + public static final fun sumWith (Lkotlin/sequences/Sequence;Lspace/kscience/kmath/operations/Group;)Ljava/lang/Object; } public final class space/kscience/kmath/operations/AlgebraKt { @@ -1735,6 +1735,50 @@ public final class space/kscience/kmath/operations/FloatField : space/kscience/k public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; } +public abstract interface class space/kscience/kmath/operations/Group : space/kscience/kmath/operations/GroupOperations { + public abstract fun getZero ()Ljava/lang/Object; +} + +public final class space/kscience/kmath/operations/Group$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/Group;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/Group;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/Group;Ljava/lang/String;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/Group;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/Group;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/Group;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/Group;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/Group;Ljava/lang/Object;)Ljava/lang/Object; +} + +public abstract interface class space/kscience/kmath/operations/GroupOperations : space/kscience/kmath/operations/Algebra { + public static final field Companion Lspace/kscience/kmath/operations/GroupOperations$Companion; + public static final field MINUS_OPERATION Ljava/lang/String; + public static final field PLUS_OPERATION Ljava/lang/String; + public abstract fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public abstract fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public abstract fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; +} + +public final class space/kscience/kmath/operations/GroupOperations$Companion { + public static final field MINUS_OPERATION Ljava/lang/String; + public static final field PLUS_OPERATION Ljava/lang/String; +} + +public final class space/kscience/kmath/operations/GroupOperations$DefaultImpls { + public static fun binaryOperation (Lspace/kscience/kmath/operations/GroupOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/GroupOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/operations/GroupOperations;Ljava/lang/String;)Ljava/lang/Object; + public static fun minus (Lspace/kscience/kmath/operations/GroupOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun plus (Lspace/kscience/kmath/operations/GroupOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperation (Lspace/kscience/kmath/operations/GroupOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/GroupOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/operations/GroupOperations;Ljava/lang/Object;)Ljava/lang/Object; +} + public final class space/kscience/kmath/operations/IntRing : space/kscience/kmath/operations/Norm, space/kscience/kmath/operations/NumericAlgebra, space/kscience/kmath/operations/Ring { public static final field INSTANCE Lspace/kscience/kmath/operations/IntRing; public fun add (II)Ljava/lang/Integer; @@ -2078,7 +2122,7 @@ public final class space/kscience/kmath/operations/RealField : space/kscience/km public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class space/kscience/kmath/operations/Ring : space/kscience/kmath/operations/RingOperations, space/kscience/kmath/operations/Space { +public abstract interface class space/kscience/kmath/operations/Ring : space/kscience/kmath/operations/Group, space/kscience/kmath/operations/RingOperations { public abstract fun getOne ()Ljava/lang/Object; } @@ -2094,7 +2138,7 @@ public final class space/kscience/kmath/operations/Ring$DefaultImpls { public static fun unaryPlus (Lspace/kscience/kmath/operations/Ring;Ljava/lang/Object;)Ljava/lang/Object; } -public abstract interface class space/kscience/kmath/operations/RingOperations : space/kscience/kmath/operations/SpaceOperations { +public abstract interface class space/kscience/kmath/operations/RingOperations : space/kscience/kmath/operations/GroupOperations { public static final field Companion Lspace/kscience/kmath/operations/RingOperations$Companion; public static final field TIMES_OPERATION Ljava/lang/String; public abstract fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; @@ -2176,50 +2220,6 @@ public final class space/kscience/kmath/operations/ShortRing : space/kscience/km public fun unaryPlus (S)Ljava/lang/Short; } -public abstract interface class space/kscience/kmath/operations/Space : space/kscience/kmath/operations/SpaceOperations { - public abstract fun getZero ()Ljava/lang/Object; -} - -public final class space/kscience/kmath/operations/Space$DefaultImpls { - public static fun binaryOperation (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun bindSymbol (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;)Ljava/lang/Object; - public static fun minus (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/Space;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lspace/kscience/kmath/operations/Space;Ljava/lang/Object;)Ljava/lang/Object; -} - -public abstract interface class space/kscience/kmath/operations/SpaceOperations : space/kscience/kmath/operations/Algebra { - public static final field Companion Lspace/kscience/kmath/operations/SpaceOperations$Companion; - public static final field MINUS_OPERATION Ljava/lang/String; - public static final field PLUS_OPERATION Ljava/lang/String; - public abstract fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public abstract fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public abstract fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; -} - -public final class space/kscience/kmath/operations/SpaceOperations$Companion { - public static final field MINUS_OPERATION Ljava/lang/String; - public static final field PLUS_OPERATION Ljava/lang/String; -} - -public final class space/kscience/kmath/operations/SpaceOperations$DefaultImpls { - public static fun binaryOperation (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun binaryOperationFunction (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun bindSymbol (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;)Ljava/lang/Object; - public static fun minus (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun plus (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperation (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lspace/kscience/kmath/operations/SpaceOperations;Ljava/lang/Object;)Ljava/lang/Object; -} - public abstract interface class space/kscience/kmath/operations/TrigonometricOperations : space/kscience/kmath/operations/Algebra { public static final field ACOS_OPERATION Ljava/lang/String; public static final field ASIN_OPERATION Ljava/lang/String; diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/FunctionalExpressionAlgebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/FunctionalExpressionAlgebra.kt index 3c23d0ecf..880f13a3e 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/FunctionalExpressionAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/FunctionalExpressionAlgebra.kt @@ -41,21 +41,21 @@ public abstract class FunctionalExpressionAlgebra>( } /** - * A context class for [Expression] construction for [Space] algebras. + * A context class for [Expression] construction for [Group] algebras. */ -public open class FunctionalExpressionSpace>( +public open class FunctionalExpressionGroup>( algebra: A, -) : FunctionalExpressionAlgebra(algebra), Space> { +) : FunctionalExpressionAlgebra(algebra), Group> { public override val zero: Expression get() = const(algebra.zero) override fun Expression.unaryMinus(): Expression = - unaryOperation(SpaceOperations.MINUS_OPERATION, this) + unaryOperation(GroupOperations.MINUS_OPERATION, this) /** * Builds an Expression of addition of two another expressions. */ public override fun add(a: Expression, b: Expression): Expression = - binaryOperation(SpaceOperations.PLUS_OPERATION, a, b) + binaryOperation(GroupOperations.PLUS_OPERATION, a, b) // /** // * Builds an Expression of multiplication of expression by number. @@ -79,7 +79,7 @@ public open class FunctionalExpressionSpace>( public open class FunctionalExpressionRing>( algebra: A, -) : FunctionalExpressionSpace(algebra), Ring> { +) : FunctionalExpressionGroup(algebra), Ring> { public override val one: Expression get() = const(algebra.one) /** @@ -92,10 +92,10 @@ public open class FunctionalExpressionRing>( public operator fun T.times(arg: Expression): Expression = arg * this public override fun unaryOperationFunction(operation: String): (arg: Expression) -> Expression = - super.unaryOperationFunction(operation) + super.unaryOperationFunction(operation) public override fun binaryOperationFunction(operation: String): (left: Expression, right: Expression) -> Expression = - super.binaryOperationFunction(operation) + super.binaryOperationFunction(operation) } public open class FunctionalExpressionField>( @@ -159,8 +159,8 @@ public open class FunctionalExpressionExtendedField>( super.binaryOperationFunction(operation) } -public inline fun > A.expressionInSpace(block: FunctionalExpressionSpace.() -> Expression): Expression = - FunctionalExpressionSpace(this).block() +public inline fun > A.expressionInSpace(block: FunctionalExpressionGroup.() -> Expression): Expression = + FunctionalExpressionGroup(this).block() public inline fun > A.expressionInRing(block: FunctionalExpressionRing.() -> Expression): Expression = FunctionalExpressionRing(this).block() diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/expressionBuilders.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/expressionBuilders.kt index 0ef6803d6..fbf080032 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/expressionBuilders.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/expressionBuilders.kt @@ -2,18 +2,18 @@ package space.kscience.kmath.expressions import space.kscience.kmath.operations.ExtendedField import space.kscience.kmath.operations.Field +import space.kscience.kmath.operations.Group import space.kscience.kmath.operations.Ring -import space.kscience.kmath.operations.Space import kotlin.contracts.InvocationKind import kotlin.contracts.contract /** - * Creates a functional expression with this [Space]. + * Creates a functional expression with this [Group]. */ -public inline fun Space.spaceExpression(block: FunctionalExpressionSpace>.() -> Expression): Expression { +public inline fun Group.spaceExpression(block: FunctionalExpressionGroup>.() -> Expression): Expression { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } - return FunctionalExpressionSpace(this).block() + return FunctionalExpressionGroup(this).block() } /** diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixContext.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixContext.kt index 639d77e85..b8937885a 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixContext.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixContext.kt @@ -13,7 +13,7 @@ import kotlin.reflect.KClass * @param T the type of items in the matrices. * @param M the type of operated matrices. */ -public interface MatrixContext> : SpaceOperations> { +public interface MatrixContext> : GroupOperations> { /** * Produces a matrix with this context and given dimensions. */ diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VectorSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VectorSpace.kt index fd3144d24..570c87b81 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VectorSpace.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VectorSpace.kt @@ -1,8 +1,8 @@ package space.kscience.kmath.linear +import space.kscience.kmath.operations.Group import space.kscience.kmath.operations.RealField import space.kscience.kmath.operations.Ring -import space.kscience.kmath.operations.Space import space.kscience.kmath.operations.invoke import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.BufferFactory @@ -11,7 +11,7 @@ import space.kscience.kmath.structures.BufferFactory * A linear space for vectors. * Could be used on any point-like structure */ -public interface VectorSpace> : Space> { +public interface VectorSpace> : Group> { public val size: Int public val algebra: A override val zero: Point get() = produce { algebra.zero } @@ -27,13 +27,13 @@ public interface VectorSpace> : Space> { //TODO add basis public companion object { - private val realSpaceCache: MutableMap> = hashMapOf() + private val realSpaceCache: MutableMap> = hashMapOf() /** * Non-boxing double vector space */ - public fun real(size: Int): BufferVectorSpace = realSpaceCache.getOrPut(size) { - BufferVectorSpace( + public fun real(size: Int): BufferVectorGroup = realSpaceCache.getOrPut(size) { + BufferVectorGroup( size, RealField, Buffer.Companion::auto @@ -47,7 +47,7 @@ public interface VectorSpace> : Space> { size: Int, space: A, bufferFactory: BufferFactory = Buffer.Companion::boxing, - ): BufferVectorSpace = BufferVectorSpace(size, space, bufferFactory) + ): BufferVectorGroup = BufferVectorGroup(size, space, bufferFactory) /** * Automatic buffered vector, unboxed if it is possible @@ -58,7 +58,7 @@ public interface VectorSpace> : Space> { } -public class BufferVectorSpace>( +public class BufferVectorGroup>( override val size: Int, override val algebra: A, public val bufferFactory: BufferFactory, diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/cumulative.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/cumulative.kt index 380723095..b50e095cf 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/cumulative.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/cumulative.kt @@ -1,6 +1,6 @@ package space.kscience.kmath.misc -import space.kscience.kmath.operations.Space +import space.kscience.kmath.operations.Group import space.kscience.kmath.operations.invoke import kotlin.jvm.JvmName @@ -37,7 +37,7 @@ public fun List.cumulative(initial: R, operation: (R, T) -> R): List Iterable.cumulativeSum(space: Space): Iterable = +public fun Iterable.cumulativeSum(space: Group): Iterable = space { cumulative(zero) { element: T, sum: T -> sum + element } } @JvmName("cumulativeSumOfDouble") @@ -49,7 +49,7 @@ public fun Iterable.cumulativeSum(): Iterable = cumulative(0) { elemen @JvmName("cumulativeSumOfLong") public fun Iterable.cumulativeSum(): Iterable = cumulative(0L) { element, sum -> sum + element } -public fun Sequence.cumulativeSum(space: Space): Sequence = +public fun Sequence.cumulativeSum(space: Group): Sequence = space { cumulative(zero) { element: T, sum: T -> sum + element } } @JvmName("cumulativeSumOfDouble") @@ -61,7 +61,7 @@ public fun Sequence.cumulativeSum(): Sequence = cumulative(0) { elemen @JvmName("cumulativeSumOfLong") public fun Sequence.cumulativeSum(): Sequence = cumulative(0L) { element, sum -> sum + element } -public fun List.cumulativeSum(space: Space): List = +public fun List.cumulativeSum(space: Group): List = space { cumulative(zero) { element: T, sum: T -> sum + element } } @JvmName("cumulativeSumOfDouble") diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferNDAlgebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferNDAlgebra.kt index ff9c911ac..58d1ea7b1 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferNDAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferNDAlgebra.kt @@ -52,11 +52,11 @@ public interface BufferNDAlgebra> : NDAlgebra { } } -public open class BufferedNDSpace>( +public open class BufferedNDGroup>( final override val shape: IntArray, final override val elementContext: A, final override val bufferFactory: BufferFactory, -) : NDSpace, BufferNDAlgebra { +) : NDGroup, BufferNDAlgebra { override val strides: Strides = DefaultStrides(shape) override val zero: NDBuffer by lazy { produce { zero } } override fun NDStructure.unaryMinus(): NDStructure = produce { -get(it) } @@ -66,7 +66,7 @@ public open class BufferedNDRing>( shape: IntArray, elementContext: R, bufferFactory: BufferFactory, -) : BufferedNDSpace(shape, elementContext, bufferFactory), NDRing { +) : BufferedNDGroup(shape, elementContext, bufferFactory), NDRing { override val one: NDBuffer by lazy { produce { one } } } @@ -80,16 +80,16 @@ public open class BufferedNDField>( } // space factories -public fun > NDAlgebra.Companion.space( +public fun > NDAlgebra.Companion.space( space: A, bufferFactory: BufferFactory, vararg shape: Int, -): BufferedNDSpace = BufferedNDSpace(shape, space, bufferFactory) +): BufferedNDGroup = BufferedNDGroup(shape, space, bufferFactory) -public inline fun , R> A.ndSpace( +public inline fun , R> A.ndSpace( noinline bufferFactory: BufferFactory, vararg shape: Int, - action: BufferedNDSpace.() -> R, + action: BufferedNDGroup.() -> R, ): R { contract { callsInPlace(action, InvocationKind.EXACTLY_ONCE) } return NDAlgebra.space(this, bufferFactory, *shape).run(action) diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDAlgebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDAlgebra.kt index 6b6e887dc..e3ffae74b 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDAlgebra.kt @@ -54,7 +54,7 @@ public interface NDAlgebra> { * Element-wise invocation of function working on [T] on a [NDStructure]. */ public operator fun Function1.invoke(structure: NDStructure): NDStructure = - structure.map() { value -> this@invoke(value) } + structure.map { value -> this@invoke(value) } public companion object } @@ -89,7 +89,7 @@ internal fun > NDAlgebra.checkShape(element: NDStructure< * @param N the type of ND structure. * @param S the type of space of structure elements. */ -public interface NDSpace> : Space>, NDAlgebra { +public interface NDGroup> : Group>, NDAlgebra { /** * Element-wise addition. * @@ -127,7 +127,7 @@ public interface NDSpace> : Space>, NDAlgebra.minus(arg: T): NDStructure = this.map() { value -> add(arg, -value) } + public operator fun NDStructure.minus(arg: T): NDStructure = this.map { value -> add(arg, -value) } /** * Adds an element to ND structure of it. @@ -136,7 +136,7 @@ public interface NDSpace> : Space>, NDAlgebra): NDStructure = arg.map() { value -> add(this@plus, value) } + public operator fun T.plus(arg: NDStructure): NDStructure = arg.map { value -> add(this@plus, value) } /** * Subtracts an ND structure from an element of it. @@ -145,7 +145,7 @@ public interface NDSpace> : Space>, NDAlgebra): NDStructure = arg.map() { value -> add(-this@minus, value) } + public operator fun T.minus(arg: NDStructure): NDStructure = arg.map { value -> add(-this@minus, value) } public companion object } @@ -157,7 +157,7 @@ public interface NDSpace> : Space>, NDAlgebra> : Ring>, NDSpace { +public interface NDRing> : Ring>, NDGroup { /** * Element-wise multiplication. * @@ -177,7 +177,7 @@ public interface NDRing> : Ring>, NDSpace { * @param arg the multiplier. * @return the product. */ - public operator fun NDStructure.times(arg: T): NDStructure = this.map() { value -> multiply(arg, value) } + public operator fun NDStructure.times(arg: T): NDStructure = this.map { value -> multiply(arg, value) } /** * Multiplies an element by a ND structure of it. @@ -186,7 +186,7 @@ public interface NDRing> : Ring>, NDSpace { * @param arg the multiplier. * @return the product. */ - public operator fun T.times(arg: NDStructure): NDStructure = arg.map() { value -> multiply(this@times, value) } + public operator fun T.times(arg: NDStructure): NDStructure = arg.map { value -> multiply(this@times, value) } public companion object } @@ -217,7 +217,7 @@ public interface NDField> : Field>, NDRing, * @param arg the divisor. * @return the quotient. */ - public operator fun NDStructure.div(arg: T): NDStructure = this.map() { value -> divide(arg, value) } + public operator fun NDStructure.div(arg: T): NDStructure = this.map { value -> divide(arg, value) } /** * Divides an element by an ND structure of it. @@ -226,7 +226,7 @@ public interface NDField> : Field>, NDRing, * @param arg the divisor. * @return the quotient. */ - public operator fun T.div(arg: NDStructure): NDStructure = arg.map() { divide(it, this@div) } + public operator fun T.div(arg: NDStructure): NDStructure = arg.map { divide(it, this@div) } // @ThreadLocal // public companion object { diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt index 2163f61b2..0198700f2 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt @@ -105,7 +105,7 @@ public inline operator fun
, R> A.invoke(block: A.() -> R): R = r * * @param T the type of element of this semispace. */ -public interface SpaceOperations : Algebra { +public interface GroupOperations : Algebra { /** * Addition of two elements. * @@ -177,12 +177,11 @@ public interface SpaceOperations : Algebra { } /** - * Represents linear space with neutral element, i.e. algebraic structure with associative, binary operation [add] and - * scalar multiplication [multiply]. + * Represents linear space with neutral element, i.e. algebraic structure with associative, binary operation [add]. * * @param T the type of element of this semispace. */ -public interface Space : SpaceOperations { +public interface Group : GroupOperations { /** * The neutral element of addition. */ @@ -195,7 +194,7 @@ public interface Space : SpaceOperations { * * @param T the type of element of this semiring. */ -public interface RingOperations : SpaceOperations { +public interface RingOperations : GroupOperations { /** * Multiplies two elements. * @@ -231,7 +230,7 @@ public interface RingOperations : SpaceOperations { * * @param T the type of element of this ring. */ -public interface Ring : Space, RingOperations { +public interface Ring : Group, RingOperations { /** * neutral operation for multiplication */ diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/AlgebraElements.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/AlgebraElements.kt index 1fb4f6750..3e42ac094 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/AlgebraElements.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/AlgebraElements.kt @@ -49,7 +49,7 @@ public operator fun , S : NumbersAddOperations> T.mi * @param b the augend. * @return the sum. */ -public operator fun , S : Space> T.plus(b: T): T = +public operator fun , S : Group> T.plus(b: T): T = context.add(this, b) ///** @@ -80,14 +80,14 @@ public operator fun , F : Field> T.div(b: T): T = /** - * The element of [Space]. + * The element of [Group]. * * @param T the type of space operation results. * @param I self type of the element. Needed for static type checking. * @param S the type of space. */ @UnstableKMathAPI -public interface SpaceElement, S : Space> : AlgebraElement +public interface SpaceElement, S : Group> : AlgebraElement /** * The element of [Ring]. diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/NumericAlgebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/NumericAlgebra.kt index 5f6ec869a..bd5f5951f 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/NumericAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/NumericAlgebra.kt @@ -127,7 +127,7 @@ public interface ScaleOperations : Algebra { * TODO to be removed and replaced by extensions after multiple receivers are there */ @UnstableKMathAPI -public interface NumbersAddOperations : Space, NumericAlgebra { +public interface NumbersAddOperations : Group, NumericAlgebra { /** * Addition of element and scalar. * diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/algebraExtensions.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/algebraExtensions.kt index 66b16b6f6..52a0dec6f 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/algebraExtensions.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/algebraExtensions.kt @@ -1,49 +1,49 @@ package space.kscience.kmath.operations /** - * Returns the sum of all elements in the iterable in this [Space]. + * Returns the sum of all elements in the iterable in this [Group]. * * @receiver the algebra that provides addition. * @param data the iterable to sum up. * @return the sum. */ -public fun Space.sum(data: Iterable): T = data.fold(zero) { left, right -> add(left, right) } +public fun Group.sum(data: Iterable): T = data.fold(zero) { left, right -> add(left, right) } /** - * Returns the sum of all elements in the sequence in this [Space]. + * Returns the sum of all elements in the sequence in this [Group]. * * @receiver the algebra that provides addition. * @param data the sequence to sum up. * @return the sum. */ -public fun Space.sum(data: Sequence): T = data.fold(zero) { left, right -> add(left, right) } +public fun Group.sum(data: Sequence): T = data.fold(zero) { left, right -> add(left, right) } /** - * Returns an average value of elements in the iterable in this [Space]. + * Returns an average value of elements in the iterable in this [Group]. * * @receiver the algebra that provides addition and division. * @param data the iterable to find average. * @return the average value. * @author Iaroslav Postovalov */ -public fun S.average(data: Iterable): T where S : Space, S : ScaleOperations = +public fun S.average(data: Iterable): T where S : Group, S : ScaleOperations = sum(data) / data.count() /** - * Returns an average value of elements in the sequence in this [Space]. + * Returns an average value of elements in the sequence in this [Group]. * * @receiver the algebra that provides addition and division. * @param data the sequence to find average. * @return the average value. * @author Iaroslav Postovalov */ -public fun S.average(data: Sequence): T where S : Space, S : ScaleOperations = +public fun S.average(data: Sequence): T where S : Group, S : ScaleOperations = sum(data) / data.count() /** * Absolute of the comparable [value] */ -public fun > Space.abs(value: T): T = if (value > zero) value else -value +public fun > Group.abs(value: T): T = if (value > zero) value else -value /** * Returns the sum of all elements in the iterable in provided space. @@ -52,7 +52,7 @@ public fun > Space.abs(value: T): T = if (value > zero) val * @param space the algebra that provides addition. * @return the sum. */ -public fun Iterable.sumWith(space: Space): T = space.sum(this) +public fun Iterable.sumWith(space: Group): T = space.sum(this) /** * Returns the sum of all elements in the sequence in provided space. @@ -61,28 +61,28 @@ public fun Iterable.sumWith(space: Space): T = space.sum(this) * @param space the algebra that provides addition. * @return the sum. */ -public fun Sequence.sumWith(space: Space): T = space.sum(this) +public fun Sequence.sumWith(space: Group): T = space.sum(this) /** - * Returns an average value of elements in the iterable in this [Space]. + * Returns an average value of elements in the iterable in this [Group]. * * @receiver the iterable to find average. * @param space the algebra that provides addition and division. * @return the average value. * @author Iaroslav Postovalov */ -public fun Iterable.averageWith(space: S): T where S : Space, S : ScaleOperations = +public fun Iterable.averageWith(space: S): T where S : Group, S : ScaleOperations = space.average(this) /** - * Returns an average value of elements in the sequence in this [Space]. + * Returns an average value of elements in the sequence in this [Group]. * * @receiver the sequence to find average. * @param space the algebra that provides addition and division. * @return the average value. * @author Iaroslav Postovalov */ -public fun Sequence.averageWith(space: S): T where S : Space, S : ScaleOperations = +public fun Sequence.averageWith(space: S): T where S : Group, S : ScaleOperations = space.average(this) //TODO optimized power operation diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/SpaceVerifier.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/SpaceVerifier.kt index 6ea75156b..a9cd4454c 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/SpaceVerifier.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/testutils/SpaceVerifier.kt @@ -1,7 +1,7 @@ package space.kscience.kmath.testutils +import space.kscience.kmath.operations.Group import space.kscience.kmath.operations.ScaleOperations -import space.kscience.kmath.operations.Space import space.kscience.kmath.operations.invoke import kotlin.test.assertEquals import kotlin.test.assertNotEquals @@ -12,7 +12,7 @@ internal open class SpaceVerifier( val b: T, val c: T, val x: Number, -) : AlgebraicVerifier> where S : Space, S : ScaleOperations { +) : AlgebraicVerifier> where S : Group, S : ScaleOperations { override fun verify() { algebra { assertEquals(a + b + c, a + (b + c), "Addition in $algebra is not associative.") diff --git a/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/flowExtra.kt b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/flowExtra.kt index eff813bee..81b4327fc 100644 --- a/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/flowExtra.kt +++ b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/flowExtra.kt @@ -5,16 +5,16 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.runningReduce import kotlinx.coroutines.flow.scan +import space.kscience.kmath.operations.Group +import space.kscience.kmath.operations.GroupOperations import space.kscience.kmath.operations.ScaleOperations -import space.kscience.kmath.operations.Space -import space.kscience.kmath.operations.SpaceOperations import space.kscience.kmath.operations.invoke -public fun Flow.cumulativeSum(space: SpaceOperations): Flow = - space { runningReduce { sum, element -> sum + element } } +public fun Flow.cumulativeSum(group: GroupOperations): Flow = + group { runningReduce { sum, element -> sum + element } } @ExperimentalCoroutinesApi -public fun Flow.mean(algebra: S): Flow where S : Space, S : ScaleOperations = algebra { +public fun Flow.mean(algebra: S): Flow where S : Group, S : ScaleOperations = algebra { data class Accumulator(var sum: T, var num: Int) scan(Accumulator(zero, 0)) { sum, element -> diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt index 9141fa7b9..049909fe1 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt @@ -1,8 +1,8 @@ package space.kscience.kmath.functions +import space.kscience.kmath.operations.Group import space.kscience.kmath.operations.Ring import space.kscience.kmath.operations.ScaleOperations -import space.kscience.kmath.operations.Space import space.kscience.kmath.operations.invoke import kotlin.contracts.InvocationKind import kotlin.contracts.contract @@ -44,7 +44,7 @@ public fun > Polynomial.asFunction(ring: C): (T) -> T = */ public class PolynomialSpace( private val ring: C, -) : Space>, ScaleOperations> where C : Ring, C : ScaleOperations { +) : Group>, ScaleOperations> where C : Ring, C : ScaleOperations { public override val zero: Polynomial = Polynomial(emptyList()) override fun Polynomial.unaryMinus(): Polynomial = with(ring) { diff --git a/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/GeometrySpace.kt b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/GeometrySpace.kt index 392156e9f..808bd692f 100644 --- a/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/GeometrySpace.kt +++ b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/GeometrySpace.kt @@ -1,10 +1,10 @@ package space.kscience.kmath.geometry -import space.kscience.kmath.operations.Space +import space.kscience.kmath.operations.Group public interface Vector -public interface GeometrySpace : Space { +public interface GeometrySpace : Group { /** * L2 distance */ diff --git a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counter.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counter.kt index 55e8c0631..d5f3965d9 100644 --- a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counter.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counter.kt @@ -2,8 +2,8 @@ package space.kscience.kmath.histogram import kotlinx.atomicfu.atomic import kotlinx.atomicfu.getAndUpdate +import space.kscience.kmath.operations.Group import space.kscience.kmath.operations.RealField -import space.kscience.kmath.operations.Space /** * Common representation for atomic counters @@ -36,7 +36,7 @@ public class LongCounter : Counter { override val value: Long get() = innerValue.value } -public class ObjectCounter(public val space: Space) : Counter { +public class ObjectCounter(public val space: Group) : Counter { private val innerValue = atomic(space.zero) override fun add(delta: T) { diff --git a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/IndexedHistogramSpace.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/IndexedHistogramSpace.kt index b82644481..19128b2ac 100644 --- a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/IndexedHistogramSpace.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/IndexedHistogramSpace.kt @@ -6,8 +6,8 @@ import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.nd.NDField import space.kscience.kmath.nd.NDStructure import space.kscience.kmath.nd.Strides +import space.kscience.kmath.operations.Group import space.kscience.kmath.operations.ScaleOperations -import space.kscience.kmath.operations.Space import space.kscience.kmath.operations.SpaceElement import space.kscience.kmath.operations.invoke @@ -43,7 +43,7 @@ public class IndexedHistogram, V : Any>( * A space for producing histograms with values in a NDStructure */ public interface IndexedHistogramSpace, V : Any> - : Space>, ScaleOperations> { + : Group>, ScaleOperations> { //public val valueSpace: Space public val strides: Strides public val histogramValueSpace: NDField //= NDAlgebra.space(valueSpace, Buffer.Companion::boxing, *shape), diff --git a/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/TreeHistogramSpace.kt b/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/TreeHistogramSpace.kt index 85e82f515..b2071fa02 100644 --- a/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/TreeHistogramSpace.kt +++ b/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/TreeHistogramSpace.kt @@ -2,8 +2,8 @@ package space.kscience.kmath.histogram import space.kscience.kmath.domains.UnivariateDomain import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.operations.Group import space.kscience.kmath.operations.ScaleOperations -import space.kscience.kmath.operations.Space import space.kscience.kmath.structures.Buffer import java.util.* import kotlin.math.abs @@ -37,7 +37,7 @@ public class TreeHistogram( @UnstableKMathAPI public class TreeHistogramSpace( public val binFactory: (Double) -> UnivariateDomain, -) : Space, ScaleOperations { +) : Group, ScaleOperations { private class BinCounter(val domain: UnivariateDomain, val counter: Counter = Counter.real()) : ClosedFloatingPointRange by domain.range diff --git a/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogram.kt b/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogram.kt index 96e3d41ae..03bd096d9 100644 --- a/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogram.kt +++ b/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogram.kt @@ -2,7 +2,7 @@ package space.kscience.kmath.histogram import space.kscience.kmath.domains.UnivariateDomain import space.kscience.kmath.misc.UnstableKMathAPI -import space.kscience.kmath.operations.Space +import space.kscience.kmath.operations.Group import space.kscience.kmath.operations.SpaceElement import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.asSequence @@ -30,7 +30,7 @@ public class UnivariateBin( @OptIn(UnstableKMathAPI::class) public interface UnivariateHistogram : Histogram, - SpaceElement> { + SpaceElement> { public operator fun get(value: Double): UnivariateBin? public override operator fun get(point: Buffer): UnivariateBin? = get(point[0]) diff --git a/kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/ScalarsAdapters.kt b/kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/ScalarsAdapters.kt index 6ca6bc113..82b801f91 100644 --- a/kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/ScalarsAdapters.kt +++ b/kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/ScalarsAdapters.kt @@ -102,8 +102,8 @@ public fun > MST.toSFun(): SFun = when (this) { is MST.Symbolic -> toSVar() is MST.Unary -> when (operation) { - SpaceOperations.PLUS_OPERATION -> +value.toSFun() - SpaceOperations.MINUS_OPERATION -> -value.toSFun() + GroupOperations.PLUS_OPERATION -> +value.toSFun() + GroupOperations.MINUS_OPERATION -> -value.toSFun() TrigonometricOperations.SIN_OPERATION -> sin(value.toSFun()) TrigonometricOperations.COS_OPERATION -> cos(value.toSFun()) TrigonometricOperations.TAN_OPERATION -> tan(value.toSFun()) @@ -114,8 +114,8 @@ public fun > MST.toSFun(): SFun = when (this) { } is MST.Binary -> when (operation) { - SpaceOperations.PLUS_OPERATION -> left.toSFun() + right.toSFun() - SpaceOperations.MINUS_OPERATION -> left.toSFun() - right.toSFun() + GroupOperations.PLUS_OPERATION -> left.toSFun() + right.toSFun() + GroupOperations.MINUS_OPERATION -> left.toSFun() - right.toSFun() RingOperations.TIMES_OPERATION -> left.toSFun() * right.toSFun() FieldOperations.DIV_OPERATION -> left.toSFun() / right.toSFun() PowerOperations.POW_OPERATION -> left.toSFun() pow (right as MST.Numeric).toSConst() diff --git a/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt index dea74abdc..d8ce1052a 100644 --- a/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt +++ b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt @@ -70,12 +70,12 @@ public interface Nd4jArrayAlgebra> : NDAlgebra { } /** - * Represents [NDSpace] over [Nd4jArrayStructure]. + * Represents [NDGroup] over [Nd4jArrayStructure]. * * @param T the type of the element contained in ND structure. * @param S the type of space of structure elements. */ -public interface Nd4jArraySpace> : NDSpace, Nd4jArrayAlgebra { +public interface Nd4JArrayGroup> : NDGroup, Nd4jArrayAlgebra { public override val zero: Nd4jArrayStructure get() = Nd4j.zeros(*shape).wrap() @@ -100,7 +100,7 @@ public interface Nd4jArraySpace> : NDSpace, Nd4jArrayAlgeb * @param R the type of ring of structure elements. */ @OptIn(UnstableKMathAPI::class) -public interface Nd4jArrayRing> : NDRing, Nd4jArraySpace { +public interface Nd4jArrayRing> : NDRing, Nd4JArrayGroup { public override val one: Nd4jArrayStructure get() = Nd4j.ones(*shape).wrap() diff --git a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/SamplerAlgebra.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/SamplerAlgebra.kt index ca2fd58cc..c5ec99dae 100644 --- a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/SamplerAlgebra.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/SamplerAlgebra.kt @@ -4,8 +4,8 @@ import space.kscience.kmath.chains.Chain import space.kscience.kmath.chains.ConstantChain import space.kscience.kmath.chains.map import space.kscience.kmath.chains.zip +import space.kscience.kmath.operations.Group import space.kscience.kmath.operations.ScaleOperations -import space.kscience.kmath.operations.Space import space.kscience.kmath.operations.invoke public class BasicSampler(public val chainBuilder: (RandomGenerator) -> Chain) : Sampler { @@ -19,8 +19,8 @@ public class ConstantSampler(public val value: T) : Sampler { /** * A space for samplers. Allows to perform simple operations on distributions */ -public class SamplerSpace(public val algebra: S) : Space>, - ScaleOperations> where S : Space, S : ScaleOperations { +public class SamplerSpace(public val algebra: S) : Group>, + ScaleOperations> where S : Group, S : ScaleOperations { public override val zero: Sampler = ConstantSampler(algebra.zero) diff --git a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Statistic.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Statistic.kt index 4a3103d1b..a9f7cd3e4 100644 --- a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Statistic.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Statistic.kt @@ -66,7 +66,7 @@ public fun ComposableStatistic.flow( * Arithmetic mean */ public class Mean( - private val space: Space, + private val space: Group, private val division: (sum: T, count: Int) -> T, ) : ComposableStatistic, T> { public override suspend fun computeIntermediate(data: Buffer): Pair = From fd51564628da781426226582f3c315d116106667 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Thu, 11 Mar 2021 10:18:59 +0300 Subject: [PATCH 107/150] Return field get access in algebras --- .../kotlin/space/kscience/kmath/ast/MstAlgebra.kt | 6 +++--- .../kotlin/space/kscience/kmath/viktor/ViktorNDStructure.kt | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt index a65027147..16fdfbeac 100644 --- a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt +++ b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt @@ -50,7 +50,7 @@ public object MstGroup : Group, NumericAlgebra, ScaleOperations { */ @OptIn(UnstableKMathAPI::class) public object MstRing : Ring, NumbersAddOperations, ScaleOperations { - public override val zero: MST.Numeric = MstGroup.zero + public override val zero: MST.Numeric get() = MstGroup.zero public override val one: MST.Numeric = number(1.0) public override fun number(value: Number): MST.Numeric = MstGroup.number(value) @@ -109,8 +109,8 @@ public object MstField : Field, NumbersAddOperations, ScaleOperations< * [ExtendedField] over [MST] nodes. */ public object MstExtendedField : ExtendedField, NumericAlgebra { - public override val zero: MST.Numeric = MstField.zero - public override val one: MST.Numeric = MstField.one + public override val zero: MST.Numeric get() = MstField.zero + public override val one: MST.Numeric get() = MstField.one public override fun bindSymbol(value: String): MST.Symbolic = MstField.bindSymbol(value) public override fun number(value: Number): MST.Numeric = MstRing.number(value) diff --git a/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorNDStructure.kt b/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorNDStructure.kt index f5697cea2..d791ed675 100644 --- a/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorNDStructure.kt +++ b/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorNDStructure.kt @@ -40,11 +40,9 @@ public class ViktorNDField(public override val shape: IntArray) : NDField produce { this@f64Buffer[it] }.f64Buffer } - public override val zero: ViktorNDStructure - get() = F64Array.full(init = 0.0, shape = shape).asStructure() + public override val zero: ViktorNDStructure by lazy { F64Array.full(init = 0.0, shape = shape).asStructure() } - public override val one: ViktorNDStructure - get() = F64Array.full(init = 1.0, shape = shape).asStructure() + public override val one: ViktorNDStructure by lazy { F64Array.full(init = 1.0, shape = shape).asStructure() } private val strides: Strides = DefaultStrides(shape) From 803f298d8b27ecd0732bed869a29fd1ce8747ca0 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Thu, 11 Mar 2021 11:28:10 +0300 Subject: [PATCH 108/150] Make vector spaces great again --- CHANGELOG.md | 1 + .../space/kscience/kmath/ast/MstExpression.kt | 6 +-- .../TestESTreeConsistencyWithInterpreter.kt | 4 +- .../estree/TestESTreeOperationsSupport.kt | 6 +-- .../asm/TestAsmConsistencyWithInterpreter.kt | 4 +- .../kmath/asm/TestAsmOperationsSupport.kt | 6 +-- .../kscience/kmath/commons/linear/CMMatrix.kt | 3 ++ kmath-core/api/kmath-core.api | 48 ++++++++++++++----- .../kscience/kmath/linear/BufferMatrix.kt | 14 ++++-- .../kscience/kmath/linear/MatrixContext.kt | 18 +++---- .../kscience/kmath/linear/MatrixWrapper.kt | 31 +++++++----- .../kscience/kmath/linear/VectorSpace.kt | 27 ++++++----- .../kscience/kmath/geometry/GeometrySpace.kt | 3 +- 13 files changed, 109 insertions(+), 62 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a172eb69a..05c956de3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ### Changed - Exponential operations merged with hyperbolic functions - Space is replaced by Group. Space is reserved for vector spaces. +- VectorSpace is now a vector space ### Deprecated diff --git a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstExpression.kt b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstExpression.kt index 3a598fb8c..63dfb38f7 100644 --- a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstExpression.kt +++ b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstExpression.kt @@ -58,7 +58,7 @@ public inline fun , E : Algebra> A.mst( * * @author Alexander Nozik */ -public inline fun > A.mstInSpace(block: MstGroup.() -> MST): MstExpression { +public inline fun > A.mstInGroup(block: MstGroup.() -> MST): MstExpression { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } return MstExpression(this, MstGroup.block()) } @@ -98,9 +98,9 @@ public inline fun > A.mstInExtendedField(b * * @author Alexander Nozik */ -public inline fun > FunctionalExpressionGroup.mstInSpace(block: MstGroup.() -> MST): MstExpression { +public inline fun > FunctionalExpressionGroup.mstInGroup(block: MstGroup.() -> MST): MstExpression { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } - return algebra.mstInSpace(block) + return algebra.mstInGroup(block) } /** diff --git a/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeConsistencyWithInterpreter.kt b/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeConsistencyWithInterpreter.kt index 34e9dd945..bb34254b1 100644 --- a/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeConsistencyWithInterpreter.kt +++ b/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeConsistencyWithInterpreter.kt @@ -12,7 +12,7 @@ import kotlin.test.assertEquals internal class TestESTreeConsistencyWithInterpreter { @Test fun mstSpace() { - val res1 = MstGroup.mstInSpace { + val res1 = MstGroup.mstInGroup { binaryOperationFunction("+")( unaryOperationFunction("+")( number(3.toByte()) - (number(2.toByte()) + (scale( @@ -25,7 +25,7 @@ internal class TestESTreeConsistencyWithInterpreter { ) + bindSymbol("x") + zero }("x" to MST.Numeric(2)) - val res2 = MstGroup.mstInSpace { + val res2 = MstGroup.mstInGroup { binaryOperationFunction("+")( unaryOperationFunction("+")( number(3.toByte()) - (number(2.toByte()) + (scale( diff --git a/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeOperationsSupport.kt b/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeOperationsSupport.kt index 6e2f85327..27bf2f167 100644 --- a/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeOperationsSupport.kt +++ b/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeOperationsSupport.kt @@ -2,7 +2,7 @@ package space.kscience.kmath.estree import space.kscience.kmath.ast.mstInExtendedField import space.kscience.kmath.ast.mstInField -import space.kscience.kmath.ast.mstInSpace +import space.kscience.kmath.ast.mstInGroup import space.kscience.kmath.expressions.invoke import space.kscience.kmath.operations.RealField import kotlin.random.Random @@ -12,14 +12,14 @@ import kotlin.test.assertEquals internal class TestESTreeOperationsSupport { @Test fun testUnaryOperationInvocation() { - val expression = RealField.mstInSpace { -bindSymbol("x") }.compile() + val expression = RealField.mstInGroup { -bindSymbol("x") }.compile() val res = expression("x" to 2.0) assertEquals(-2.0, res) } @Test fun testBinaryOperationInvocation() { - val expression = RealField.mstInSpace { -bindSymbol("x") + number(1.0) }.compile() + val expression = RealField.mstInGroup { -bindSymbol("x") + number(1.0) }.compile() val res = expression("x" to 2.0) assertEquals(-1.0, res) } diff --git a/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmConsistencyWithInterpreter.kt b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmConsistencyWithInterpreter.kt index 4be2ee331..7cc1497d0 100644 --- a/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmConsistencyWithInterpreter.kt +++ b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmConsistencyWithInterpreter.kt @@ -12,7 +12,7 @@ import kotlin.test.assertEquals internal class TestAsmConsistencyWithInterpreter { @Test fun mstSpace() { - val res1 = MstGroup.mstInSpace { + val res1 = MstGroup.mstInGroup { binaryOperationFunction("+")( unaryOperationFunction("+")( number(3.toByte()) - (number(2.toByte()) + (scale( @@ -25,7 +25,7 @@ internal class TestAsmConsistencyWithInterpreter { ) + bindSymbol("x") + zero }("x" to MST.Numeric(2)) - val res2 = MstGroup.mstInSpace { + val res2 = MstGroup.mstInGroup { binaryOperationFunction("+")( unaryOperationFunction("+")( number(3.toByte()) - (number(2.toByte()) + (scale( diff --git a/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmOperationsSupport.kt b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmOperationsSupport.kt index e3adc4629..e99075f07 100644 --- a/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmOperationsSupport.kt +++ b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmOperationsSupport.kt @@ -2,7 +2,7 @@ package space.kscience.kmath.asm import space.kscience.kmath.ast.mstInExtendedField import space.kscience.kmath.ast.mstInField -import space.kscience.kmath.ast.mstInSpace +import space.kscience.kmath.ast.mstInGroup import space.kscience.kmath.expressions.invoke import space.kscience.kmath.operations.RealField import kotlin.random.Random @@ -12,14 +12,14 @@ import kotlin.test.assertEquals internal class TestAsmOperationsSupport { @Test fun testUnaryOperationInvocation() { - val expression = RealField.mstInSpace { -bindSymbol("x") }.compile() + val expression = RealField.mstInGroup { -bindSymbol("x") }.compile() val res = expression("x" to 2.0) assertEquals(-2.0, res) } @Test fun testBinaryOperationInvocation() { - val expression = RealField.mstInSpace { -bindSymbol("x") + number(1.0) }.compile() + val expression = RealField.mstInGroup { -bindSymbol("x") + number(1.0) }.compile() val res = expression("x" to 2.0) assertEquals(-1.0, res) } diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt index 537da5947..393b28973 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt @@ -86,6 +86,9 @@ public object CMMatrixContext : MatrixContext { } } + override fun scale(a: Matrix, value: Double): Matrix = a.toCM().times(value) + + public override fun Matrix.dot(other: Matrix): CMMatrix = CMMatrix(toCM().origin.multiply(other.toCM().origin)) diff --git a/kmath-core/api/kmath-core.api b/kmath-core/api/kmath-core.api index eae91c985..8b30e4c05 100644 --- a/kmath-core/api/kmath-core.api +++ b/kmath-core/api/kmath-core.api @@ -460,6 +460,8 @@ public final class space/kscience/kmath/linear/BufferMatrixContext : space/kscie public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/nd/Structure2D; + public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public fun div (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; public synthetic fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; @@ -473,8 +475,14 @@ public final class space/kscience/kmath/linear/BufferMatrixContext : space/kscie public fun point (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; public fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferMatrix; public synthetic fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/Structure2D; + public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; + public fun scale (Lspace/kscience/kmath/nd/Structure2D;D)Lspace/kscience/kmath/nd/Structure2D; + public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; public synthetic fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; public fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/linear/BufferMatrix; public synthetic fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; @@ -490,8 +498,8 @@ public final class space/kscience/kmath/linear/BufferMatrixContext : space/kscie public final class space/kscience/kmath/linear/BufferMatrixContext$Companion { } -public final class space/kscience/kmath/linear/BufferVectorGroup : space/kscience/kmath/linear/VectorSpace { - public fun (ILspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V +public final class space/kscience/kmath/linear/BufferVectorSpace : space/kscience/kmath/linear/VectorSpace { + public fun (ILspace/kscience/kmath/operations/Group;Lkotlin/jvm/functions/Function2;)V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun add (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; @@ -499,7 +507,9 @@ public final class space/kscience/kmath/linear/BufferVectorGroup : space/kscienc public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/structures/Buffer; - public fun getAlgebra ()Lspace/kscience/kmath/operations/Ring; + public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public fun div (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public fun getAlgebra ()Lspace/kscience/kmath/operations/Group; public final fun getBufferFactory ()Lkotlin/jvm/functions/Function2; public fun getSize ()I public synthetic fun getZero ()Ljava/lang/Object; @@ -509,7 +519,12 @@ public final class space/kscience/kmath/linear/BufferVectorGroup : space/kscienc public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun plus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; - public fun scale (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Object;)Lspace/kscience/kmath/structures/Buffer; + public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; + public fun scale (Lspace/kscience/kmath/structures/Buffer;D)Lspace/kscience/kmath/structures/Buffer; + public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public fun times (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; public fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; @@ -549,12 +564,15 @@ public final class space/kscience/kmath/linear/GenericMatrixContext$DefaultImpls public static fun binaryOperation (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public static fun binaryOperationFunction (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public static fun bindSymbol (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lspace/kscience/kmath/nd/Structure2D; + public static fun div (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; public static fun dot (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public static fun dot (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public static fun minus (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public static fun plus (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public static fun point (Lspace/kscience/kmath/linear/GenericMatrixContext;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public static fun times (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/Number;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public static fun times (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun times (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; public static fun times (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; public static fun unaryMinus (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public static fun unaryOperation (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; @@ -625,7 +643,7 @@ public final class space/kscience/kmath/linear/MatrixBuilderKt { public static final fun row (Lspace/kscience/kmath/nd/Structure2D$Companion;[Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; } -public abstract interface class space/kscience/kmath/linear/MatrixContext : space/kscience/kmath/operations/GroupOperations { +public abstract interface class space/kscience/kmath/linear/MatrixContext : space/kscience/kmath/operations/GroupOperations, space/kscience/kmath/operations/ScaleOperations { public static final field Companion Lspace/kscience/kmath/linear/MatrixContext$Companion; public abstract fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public abstract fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; @@ -645,10 +663,13 @@ public final class space/kscience/kmath/linear/MatrixContext$DefaultImpls { public static fun binaryOperation (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public static fun binaryOperationFunction (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public static fun bindSymbol (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lspace/kscience/kmath/nd/Structure2D; + public static fun div (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; public static fun minus (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public static fun plus (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public static fun point (Lspace/kscience/kmath/linear/MatrixContext;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; + public static fun times (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/Number;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public static fun times (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun times (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; public static fun unaryOperation (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public static fun unaryOperationFunction (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public static fun unaryPlus (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; @@ -763,21 +784,21 @@ public final class space/kscience/kmath/linear/UnitFeature : space/kscience/kmat public static final field INSTANCE Lspace/kscience/kmath/linear/UnitFeature; } -public abstract interface class space/kscience/kmath/linear/VectorSpace : space/kscience/kmath/operations/Group { +public abstract interface class space/kscience/kmath/linear/VectorSpace : space/kscience/kmath/operations/Group, space/kscience/kmath/operations/ScaleOperations { public static final field Companion Lspace/kscience/kmath/linear/VectorSpace$Companion; public abstract fun add (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public abstract fun getAlgebra ()Lspace/kscience/kmath/operations/Ring; + public abstract fun getAlgebra ()Lspace/kscience/kmath/operations/Group; public abstract fun getSize ()I public abstract fun getZero ()Lspace/kscience/kmath/structures/Buffer; public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; - public abstract fun scale (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Object;)Lspace/kscience/kmath/structures/Buffer; + public abstract fun scale (Lspace/kscience/kmath/structures/Buffer;D)Lspace/kscience/kmath/structures/Buffer; public abstract fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; } public final class space/kscience/kmath/linear/VectorSpace$Companion { - public final fun buffered (ILspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferVectorGroup; - public static synthetic fun buffered$default (Lspace/kscience/kmath/linear/VectorSpace$Companion;ILspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lspace/kscience/kmath/linear/BufferVectorGroup; - public final fun real (I)Lspace/kscience/kmath/linear/BufferVectorGroup; + public final fun buffered (ILspace/kscience/kmath/operations/Group;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferVectorSpace; + public static synthetic fun buffered$default (Lspace/kscience/kmath/linear/VectorSpace$Companion;ILspace/kscience/kmath/operations/Group;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lspace/kscience/kmath/linear/BufferVectorSpace; + public final fun real (I)Lspace/kscience/kmath/linear/BufferVectorSpace; } public final class space/kscience/kmath/linear/VectorSpace$DefaultImpls { @@ -785,10 +806,13 @@ public final class space/kscience/kmath/linear/VectorSpace$DefaultImpls { public static fun binaryOperation (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public static fun binaryOperationFunction (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public static fun bindSymbol (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lspace/kscience/kmath/structures/Buffer; + public static fun div (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public static fun getZero (Lspace/kscience/kmath/linear/VectorSpace;)Lspace/kscience/kmath/structures/Buffer; public static fun minus (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public static fun plus (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public static fun scale (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Object;)Lspace/kscience/kmath/structures/Buffer; + public static fun scale (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;D)Lspace/kscience/kmath/structures/Buffer; + public static fun times (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun times (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; public static fun unaryMinus (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public static fun unaryOperation (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public static fun unaryOperationFunction (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferMatrix.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferMatrix.kt index ef1d82795..ba7b7358c 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferMatrix.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferMatrix.kt @@ -3,6 +3,7 @@ package space.kscience.kmath.linear import space.kscience.kmath.nd.NDStructure import space.kscience.kmath.nd.Structure2D import space.kscience.kmath.operations.Ring +import space.kscience.kmath.operations.ScaleOperations import space.kscience.kmath.operations.invoke import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.BufferFactory @@ -18,15 +19,22 @@ public typealias Matrix = Structure2D /** * Basic implementation of Matrix space based on [NDStructure] */ -public class BufferMatrixContext>( - public override val elementContext: R, +public class BufferMatrixContext( + public override val elementContext: A, private val bufferFactory: BufferFactory, -) : GenericMatrixContext> { +) : GenericMatrixContext> where A : Ring, A : ScaleOperations { + public override fun produce(rows: Int, columns: Int, initializer: (i: Int, j: Int) -> T): BufferMatrix { val buffer = bufferFactory(rows * columns) { offset -> initializer(offset / columns, offset % columns) } return BufferMatrix(rows, columns, buffer) } + override fun scale(a: Matrix, value: Double): Matrix = elementContext { + produce(a.rowNum, a.colNum) { i, j -> + a[i, j] * value + } + } + public override fun point(size: Int, initializer: (Int) -> T): Point = bufferFactory(size, initializer) private fun Matrix.toBufferMatrix(): BufferMatrix = if (this is BufferMatrix) this else { diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixContext.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixContext.kt index b8937885a..6afec94e8 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixContext.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixContext.kt @@ -13,7 +13,7 @@ import kotlin.reflect.KClass * @param T the type of items in the matrices. * @param M the type of operated matrices. */ -public interface MatrixContext> : GroupOperations> { +public interface MatrixContext> : GroupOperations>, ScaleOperations> { /** * Produces a matrix with this context and given dimensions. */ @@ -28,7 +28,7 @@ public interface MatrixContext> : GroupOperations, right: Matrix) -> M = when (operation) { "dot" -> { left, right -> left dot right } - else -> super.binaryOperationFunction(operation) as (Matrix, Matrix) -> M + else -> super.binaryOperationFunction(operation) as (Matrix, Matrix) -> M } /** @@ -84,15 +84,15 @@ public interface MatrixContext> : GroupOperations> buffered( - ring: R, + public fun buffered( + ring: A, bufferFactory: BufferFactory = Buffer.Companion::boxing, - ): GenericMatrixContext> = BufferMatrixContext(ring, bufferFactory) + ): GenericMatrixContext> where A : Ring, A: ScaleOperations = BufferMatrixContext(ring, bufferFactory) /** * Automatic buffered matrix, unboxed if it is possible */ - public inline fun > auto(ring: R): GenericMatrixContext> = + public inline fun auto(ring: A): GenericMatrixContext> where A : Ring, A: ScaleOperations = buffered(ring, Buffer.Companion::auto) } } @@ -116,14 +116,14 @@ public inline fun MatrixContext.getFeature(m: M * 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 A the type of ring of matrix elements. * @param M the type of operated matrices. */ -public interface GenericMatrixContext, out M : Matrix> : MatrixContext { +public interface GenericMatrixContext> : MatrixContext where A : Ring, A : ScaleOperations{ /** * The ring over matrix elements. */ - public val elementContext: R + public val elementContext: A public override infix fun Matrix.dot(other: Matrix): M { //TODO add typed error diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixWrapper.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixWrapper.kt index 86ec0de88..69e4a916f 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixWrapper.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixWrapper.kt @@ -4,6 +4,7 @@ import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.nd.Structure2D import space.kscience.kmath.nd.getFeature import space.kscience.kmath.operations.Ring +import space.kscience.kmath.operations.ScaleOperations import space.kscience.kmath.structures.asBuffer import kotlin.math.sqrt import kotlin.reflect.KClass @@ -14,7 +15,7 @@ import kotlin.reflect.safeCast * * @param T the type of items. */ -public class MatrixWrapper internal constructor( +public class MatrixWrapper internal constructor( public val origin: Matrix, public val features: Set, ) : Matrix by origin { @@ -73,17 +74,23 @@ public fun Structure2D.Companion.square(vararg elements: T): Matrix /** * Diagonal matrix of ones. The matrix is virtual no actual matrix is created */ -public fun > GenericMatrixContext.one(rows: Int, columns: Int): Matrix = - VirtualMatrix(rows, columns) { i, j -> - if (i == j) elementContext.one else elementContext.zero - } + UnitFeature +public fun GenericMatrixContext.one( + rows: Int, + columns: Int, +): Matrix where A : Ring, A : ScaleOperations = VirtualMatrix(rows, columns) { i, j -> + if (i == j) elementContext.one else elementContext.zero +} + UnitFeature /** * A virtual matrix of zeroes */ -public fun > GenericMatrixContext.zero(rows: Int, columns: Int): Matrix = - VirtualMatrix(rows, columns) { _, _ -> elementContext.zero } + ZeroFeature +public fun GenericMatrixContext.zero( + rows: Int, + columns: Int, +): Matrix where A : Ring, A : ScaleOperations = VirtualMatrix(rows, columns) { _, _ -> + elementContext.zero +} + ZeroFeature public class TransposedFeature(public val original: Matrix) : MatrixFeature @@ -91,9 +98,7 @@ public class TransposedFeature(public val original: Matrix) : Matrix * Create a virtual transposed matrix without copying anything. `A.transpose().transpose() === A` */ @OptIn(UnstableKMathAPI::class) -public fun Matrix.transpose(): Matrix { - return getFeature>()?.original ?: VirtualMatrix( - colNum, - rowNum, - ) { i, j -> get(j, i) } + TransposedFeature(this) -} \ No newline at end of file +public fun Matrix.transpose(): Matrix = getFeature>()?.original ?: VirtualMatrix( + colNum, + rowNum, +) { i, j -> get(j, i) } + TransposedFeature(this) \ No newline at end of file diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VectorSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VectorSpace.kt index 570c87b81..cfacf6826 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VectorSpace.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VectorSpace.kt @@ -2,7 +2,7 @@ package space.kscience.kmath.linear import space.kscience.kmath.operations.Group import space.kscience.kmath.operations.RealField -import space.kscience.kmath.operations.Ring +import space.kscience.kmath.operations.ScaleOperations import space.kscience.kmath.operations.invoke import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.BufferFactory @@ -11,7 +11,8 @@ import space.kscience.kmath.structures.BufferFactory * A linear space for vectors. * Could be used on any point-like structure */ -public interface VectorSpace> : Group> { +public interface VectorSpace : Group>, ScaleOperations> + where A : Group, A : ScaleOperations { public val size: Int public val algebra: A override val zero: Point get() = produce { algebra.zero } @@ -20,20 +21,20 @@ public interface VectorSpace> : Group> { override fun add(a: Point, b: Point): Point = produce { algebra { a[it] + b[it] } } - public fun scale(a: Point, scale: T): Point = produce { algebra { a[it] * scale } } + override fun scale(a: Point, value: Double): Point = produce { algebra.scale(a[it], value) } override fun Point.unaryMinus(): Point = produce { -get(it) } //TODO add basis public companion object { - private val realSpaceCache: MutableMap> = hashMapOf() + private val realSpaceCache: MutableMap> = hashMapOf() /** * Non-boxing double vector space */ - public fun real(size: Int): BufferVectorGroup = realSpaceCache.getOrPut(size) { - BufferVectorGroup( + public fun real(size: Int): BufferVectorSpace = realSpaceCache.getOrPut(size) { + BufferVectorSpace( size, RealField, Buffer.Companion::auto @@ -43,25 +44,29 @@ public interface VectorSpace> : Group> { /** * A structured vector space with custom buffer */ - public fun > buffered( + public fun buffered( size: Int, space: A, bufferFactory: BufferFactory = Buffer.Companion::boxing, - ): BufferVectorGroup = BufferVectorGroup(size, space, bufferFactory) + ): BufferVectorSpace where A : Group, A : ScaleOperations = + BufferVectorSpace(size, space, bufferFactory) /** * Automatic buffered vector, unboxed if it is possible */ - public inline fun > auto(size: Int, space: A): VectorSpace = + public inline fun auto( + size: Int, + space: A, + ): VectorSpace where A : Group, A : ScaleOperations = buffered(size, space, Buffer.Companion::auto) } } -public class BufferVectorGroup>( +public class BufferVectorSpace( override val size: Int, override val algebra: A, public val bufferFactory: BufferFactory, -) : VectorSpace { +) : VectorSpace where A : Group, A : ScaleOperations { override fun produce(initializer: A.(Int) -> T): Buffer = bufferFactory(size) { algebra.initializer(it) } } diff --git a/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/GeometrySpace.kt b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/GeometrySpace.kt index 808bd692f..9552c1320 100644 --- a/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/GeometrySpace.kt +++ b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/GeometrySpace.kt @@ -1,10 +1,11 @@ package space.kscience.kmath.geometry import space.kscience.kmath.operations.Group +import space.kscience.kmath.operations.ScaleOperations public interface Vector -public interface GeometrySpace : Group { +public interface GeometrySpace : Group, ScaleOperations { /** * L2 distance */ From 993bba3133581498865ed71cbe22a303a879b58e Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Fri, 12 Mar 2021 19:03:56 +0700 Subject: [PATCH 109/150] Fix #226 --- .../kotlin/space/kscience/kmath/misc/cumulative.kt | 12 ++++++------ .../kscience/kmath/operations/algebraExtensions.kt | 12 ++++++------ .../kotlin/space/kscience/kmath/chains/flowExtra.kt | 2 +- .../kotlin/space/kscience/kmath/histogram/Counter.kt | 9 +++++---- .../kotlin/space/kscience/kmath/stat/Statistic.kt | 8 ++++---- 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/cumulative.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/cumulative.kt index b50e095cf..6466695a6 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/cumulative.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/cumulative.kt @@ -37,8 +37,8 @@ public fun List.cumulative(initial: R, operation: (R, T) -> R): List Iterable.cumulativeSum(space: Group): Iterable = - space { cumulative(zero) { element: T, sum: T -> sum + element } } +public fun Iterable.cumulativeSum(group: Group): Iterable = + group { cumulative(zero) { element: T, sum: T -> sum + element } } @JvmName("cumulativeSumOfDouble") public fun Iterable.cumulativeSum(): Iterable = cumulative(0.0) { element, sum -> sum + element } @@ -49,8 +49,8 @@ public fun Iterable.cumulativeSum(): Iterable = cumulative(0) { elemen @JvmName("cumulativeSumOfLong") public fun Iterable.cumulativeSum(): Iterable = cumulative(0L) { element, sum -> sum + element } -public fun Sequence.cumulativeSum(space: Group): Sequence = - space { cumulative(zero) { element: T, sum: T -> sum + element } } +public fun Sequence.cumulativeSum(group: Group): Sequence = + group { cumulative(zero) { element: T, sum: T -> sum + element } } @JvmName("cumulativeSumOfDouble") public fun Sequence.cumulativeSum(): Sequence = cumulative(0.0) { element, sum -> sum + element } @@ -61,8 +61,8 @@ public fun Sequence.cumulativeSum(): Sequence = cumulative(0) { elemen @JvmName("cumulativeSumOfLong") public fun Sequence.cumulativeSum(): Sequence = cumulative(0L) { element, sum -> sum + element } -public fun List.cumulativeSum(space: Group): List = - space { cumulative(zero) { element: T, sum: T -> sum + element } } +public fun List.cumulativeSum(group: Group): List = + group { cumulative(zero) { element: T, sum: T -> sum + element } } @JvmName("cumulativeSumOfDouble") public fun List.cumulativeSum(): List = cumulative(0.0) { element, sum -> sum + element } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/algebraExtensions.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/algebraExtensions.kt index 52a0dec6f..b927655e3 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/algebraExtensions.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/algebraExtensions.kt @@ -49,19 +49,19 @@ public fun > Group.abs(value: T): T = if (value > zero) val * Returns the sum of all elements in the iterable in provided space. * * @receiver the collection to sum up. - * @param space the algebra that provides addition. + * @param group the algebra that provides addition. * @return the sum. */ -public fun Iterable.sumWith(space: Group): T = space.sum(this) +public fun Iterable.sumWith(group: Group): T = group.sum(this) /** * Returns the sum of all elements in the sequence in provided space. * * @receiver the collection to sum up. - * @param space the algebra that provides addition. + * @param group the algebra that provides addition. * @return the sum. */ -public fun Sequence.sumWith(space: Group): T = space.sum(this) +public fun Sequence.sumWith(group: Group): T = group.sum(this) /** * Returns an average value of elements in the iterable in this [Group]. @@ -71,7 +71,7 @@ public fun Sequence.sumWith(space: Group): T = space.sum(this) * @return the average value. * @author Iaroslav Postovalov */ -public fun Iterable.averageWith(space: S): T where S : Group, S : ScaleOperations = +public fun Iterable.averageWith(space: S): T where S : Group, S : ScaleOperations = space.average(this) /** @@ -82,7 +82,7 @@ public fun Iterable.averageWith(space: S): T where S : Group, S : * @return the average value. * @author Iaroslav Postovalov */ -public fun Sequence.averageWith(space: S): T where S : Group, S : ScaleOperations = +public fun Sequence.averageWith(space: S): T where S : Group, S : ScaleOperations = space.average(this) //TODO optimized power operation diff --git a/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/flowExtra.kt b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/flowExtra.kt index 81b4327fc..7d4914a01 100644 --- a/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/flowExtra.kt +++ b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/flowExtra.kt @@ -14,7 +14,7 @@ public fun Flow.cumulativeSum(group: GroupOperations): Flow = group { runningReduce { sum, element -> sum + element } } @ExperimentalCoroutinesApi -public fun Flow.mean(algebra: S): Flow where S : Group, S : ScaleOperations = algebra { +public fun Flow.mean(space: S): Flow where S : Group, S : ScaleOperations = space { data class Accumulator(var sum: T, var num: Int) scan(Accumulator(zero, 0)) { sum, element -> diff --git a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counter.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counter.kt index d5f3965d9..5f79fdab8 100644 --- a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counter.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counter.kt @@ -11,7 +11,8 @@ import space.kscience.kmath.operations.RealField public interface Counter { public fun add(delta: T) public val value: T - public companion object{ + + public companion object { public fun real(): ObjectCounter = ObjectCounter(RealField) } } @@ -36,11 +37,11 @@ public class LongCounter : Counter { override val value: Long get() = innerValue.value } -public class ObjectCounter(public val space: Group) : Counter { - private val innerValue = atomic(space.zero) +public class ObjectCounter(public val group: Group) : Counter { + private val innerValue = atomic(group.zero) override fun add(delta: T) { - innerValue.getAndUpdate { space.run { it + delta } } + innerValue.getAndUpdate { group.run { it + delta } } } override val value: T get() = innerValue.value diff --git a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Statistic.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Statistic.kt index a9f7cd3e4..6fe0fee9b 100644 --- a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Statistic.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Statistic.kt @@ -66,16 +66,16 @@ public fun ComposableStatistic.flow( * Arithmetic mean */ public class Mean( - private val space: Group, + private val group: Group, private val division: (sum: T, count: Int) -> T, ) : ComposableStatistic, T> { public override suspend fun computeIntermediate(data: Buffer): Pair = - space { sum(data.asIterable()) } to data.size + group { sum(data.asIterable()) } to data.size public override suspend fun composeIntermediate(first: Pair, second: Pair): Pair = - space { first.first + second.first } to (first.second + second.second) + group { first.first + second.first } to (first.second + second.second) - public override suspend fun toResult(intermediate: Pair): T = space { + public override suspend fun toResult(intermediate: Pair): T = group { division(intermediate.first, intermediate.second) } From d56254196585115d735ca54385202679de13acd1 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Fri, 12 Mar 2021 19:23:01 +0700 Subject: [PATCH 110/150] Improve conversion functions for Buffer --- kmath-core/api/kmath-core.api | 11 ++++---- .../space/kscience/kmath/structures/Buffer.kt | 26 ++++++++++++++++--- .../kscience/kmath/structures/FloatBuffer.kt | 8 +++--- .../kscience/kmath/structures/IntBuffer.kt | 8 +++--- .../kscience/kmath/structures/LongBuffer.kt | 8 +++--- .../kscience/kmath/structures/RealBuffer.kt | 8 +++--- .../kscience/kmath/structures/ShortBuffer.kt | 8 +++--- 7 files changed, 54 insertions(+), 23 deletions(-) diff --git a/kmath-core/api/kmath-core.api b/kmath-core/api/kmath-core.api index 8b30e4c05..d19c2c640 100644 --- a/kmath-core/api/kmath-core.api +++ b/kmath-core/api/kmath-core.api @@ -2314,6 +2314,7 @@ public final class space/kscience/kmath/structures/BufferKt { public static final fun asSequence (Lspace/kscience/kmath/structures/Buffer;)Lkotlin/sequences/Sequence; public static final fun getIndices (Lspace/kscience/kmath/structures/Buffer;)Lkotlin/ranges/IntRange; public static final fun toList (Lspace/kscience/kmath/structures/Buffer;)Ljava/util/List; + public static final fun toMutableList (Lspace/kscience/kmath/structures/Buffer;)Ljava/util/List; } public abstract interface class space/kscience/kmath/structures/FlaggedBuffer : space/kscience/kmath/structures/Buffer { @@ -2376,7 +2377,7 @@ public final class space/kscience/kmath/structures/FloatBufferKt { public static final fun FloatBuffer (ILkotlin/jvm/functions/Function1;)[F public static final fun FloatBuffer ([F)[F public static final fun asBuffer ([F)[F - public static final fun getArray (Lspace/kscience/kmath/structures/MutableBuffer;)[F + public static final fun toFloatArray (Lspace/kscience/kmath/structures/Buffer;)[F } public final class space/kscience/kmath/structures/IntBuffer : space/kscience/kmath/structures/MutableBuffer { @@ -2412,7 +2413,7 @@ public final class space/kscience/kmath/structures/IntBufferKt { public static final fun IntBuffer (ILkotlin/jvm/functions/Function1;)[I public static final fun IntBuffer ([I)[I public static final fun asBuffer ([I)[I - public static final fun getArray (Lspace/kscience/kmath/structures/MutableBuffer;)[I + public static final fun toIntArray (Lspace/kscience/kmath/structures/Buffer;)[I } public final class space/kscience/kmath/structures/ListBuffer : space/kscience/kmath/structures/Buffer { @@ -2470,7 +2471,7 @@ public final class space/kscience/kmath/structures/LongBufferKt { public static final fun LongBuffer (ILkotlin/jvm/functions/Function1;)[J public static final fun LongBuffer ([J)[J public static final fun asBuffer ([J)[J - public static final fun getArray (Lspace/kscience/kmath/structures/MutableBuffer;)[J + public static final fun toLongArray (Lspace/kscience/kmath/structures/Buffer;)[J } public class space/kscience/kmath/structures/MemoryBuffer : space/kscience/kmath/structures/Buffer { @@ -2749,7 +2750,7 @@ public final class space/kscience/kmath/structures/RealBufferKt { public static final fun RealBuffer ([D)[D public static final fun asBuffer ([D)[D public static final fun contentEquals-2uVC2J0 ([D[D)Z - public static final fun getArray (Lspace/kscience/kmath/structures/MutableBuffer;)[D + public static final fun toDoubleArray (Lspace/kscience/kmath/structures/Buffer;)[D } public final class space/kscience/kmath/structures/ShortBuffer : space/kscience/kmath/structures/MutableBuffer { @@ -2785,7 +2786,7 @@ public final class space/kscience/kmath/structures/ShortBufferKt { public static final fun ShortBuffer (ILkotlin/jvm/functions/Function1;)[S public static final fun ShortBuffer ([S)[S public static final fun asBuffer ([S)[S - public static final fun getArray (Lspace/kscience/kmath/structures/MutableBuffer;)[S + public static final fun toShortArray (Lspace/kscience/kmath/structures/Buffer;)[S } public final class space/kscience/kmath/structures/ValueFlag : java/lang/Enum { diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt index 2fccd2eeb..2bde18fce 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt @@ -100,9 +100,29 @@ public fun Buffer.asSequence(): Sequence = Sequence(::iterator) public fun Buffer.asIterable(): Iterable = Iterable(::iterator) /** - * Converts this [Buffer] to a new [List] + * Returns a new [List] containing all elements of this buffer. */ -public fun Buffer.toList(): List = asSequence().toList() +public fun Buffer.toList(): List = when (this) { + is ArrayBuffer -> array.toList() + is ListBuffer -> list.toList() + is MutableListBuffer -> list.toList() + else -> asSequence().toList() +} + +/** + * Returns a new [MutableList] filled with all elements of this buffer. + */ +public fun Buffer.toMutableList(): MutableList = when (this) { + is ArrayBuffer -> array.toMutableList() + is ListBuffer -> list.toMutableList() + is MutableListBuffer -> list.toMutableList() + else -> asSequence().toMutableList() +} + +/** + * Returns a new [Array] containing all elements of this buffer. + */ +public inline fun Buffer.toTypedArray(): Array = asSequence().toList().toTypedArray() /** * Returns an [IntRange] of the valid indices for this [Buffer]. @@ -222,7 +242,7 @@ public inline class MutableListBuffer(public val list: MutableList) : Muta * @param T the type of elements contained in the buffer. * @property array The underlying array. */ -public class ArrayBuffer(private val array: Array) : MutableBuffer { +public class ArrayBuffer(internal val array: Array) : MutableBuffer { // Can't inline because array is invariant override val size: Int get() = array.size diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/FloatBuffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/FloatBuffer.kt index 3839be8e1..9fc7d55f3 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/FloatBuffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/FloatBuffer.kt @@ -36,10 +36,12 @@ public inline fun FloatBuffer(size: Int, init: (Int) -> Float): FloatBuffer = Fl public fun FloatBuffer(vararg floats: Float): FloatBuffer = FloatBuffer(floats) /** - * Returns a [FloatArray] containing all of the elements of this [MutableBuffer]. + * Returns a new [FloatArray] containing all of the elements of this [Buffer]. */ -public val MutableBuffer.array: FloatArray - get() = (if (this is FloatBuffer) array else FloatArray(size) { get(it) }) +public fun Buffer.toFloatArray(): FloatArray = when(this) { + is FloatBuffer -> array.copyOf() + else -> FloatArray(size, ::get) +} /** * Returns [FloatBuffer] over this array. diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/IntBuffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/IntBuffer.kt index df3289a3e..d3d0f79a5 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/IntBuffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/IntBuffer.kt @@ -35,10 +35,12 @@ public inline fun IntBuffer(size: Int, init: (Int) -> Int): IntBuffer = IntBuffe public fun IntBuffer(vararg ints: Int): IntBuffer = IntBuffer(ints) /** - * Returns a [IntArray] containing all of the elements of this [MutableBuffer]. + * Returns a new [IntArray] containing all of the elements of this [Buffer]. */ -public val MutableBuffer.array: IntArray - get() = (if (this is IntBuffer) array else IntArray(size) { get(it) }) +public fun Buffer.toIntArray(): IntArray = when(this) { + is IntBuffer -> array.copyOf() + else -> IntArray(size, ::get) +} /** * Returns [IntBuffer] over this array. diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/LongBuffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/LongBuffer.kt index d07d44799..fec358421 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/LongBuffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/LongBuffer.kt @@ -35,10 +35,12 @@ public inline fun LongBuffer(size: Int, init: (Int) -> Long): LongBuffer = LongB public fun LongBuffer(vararg longs: Long): LongBuffer = LongBuffer(longs) /** - * Returns a [IntArray] containing all of the elements of this [MutableBuffer]. + * Returns a new [LongArray] containing all of the elements of this [Buffer]. */ -public val MutableBuffer.array: LongArray - get() = (if (this is LongBuffer) array else LongArray(size) { get(it) }) +public fun Buffer.toLongArray(): LongArray = when(this) { + is LongBuffer -> array.copyOf() + else -> LongArray(size, ::get) +} /** * Returns [LongBuffer] over this array. diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBuffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBuffer.kt index e53ed85c7..01b533138 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBuffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBuffer.kt @@ -40,10 +40,12 @@ public fun RealBuffer(vararg doubles: Double): RealBuffer = RealBuffer(doubles) public fun RealBuffer.contentEquals(vararg doubles: Double): Boolean = array.contentEquals(doubles) /** - * Returns a [DoubleArray] containing all of the elements of this [MutableBuffer]. + * Returns a new [DoubleArray] containing all of the elements of this [Buffer]. */ -public val MutableBuffer.array: DoubleArray - get() = (if (this is RealBuffer) array else DoubleArray(size) { get(it) }) +public fun Buffer.toDoubleArray(): DoubleArray = when(this) { + is RealBuffer -> array.copyOf() + else -> DoubleArray(size, ::get) +} /** * Returns [RealBuffer] over this array. diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/ShortBuffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/ShortBuffer.kt index afc472b72..77f128403 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/ShortBuffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/ShortBuffer.kt @@ -33,10 +33,12 @@ public inline fun ShortBuffer(size: Int, init: (Int) -> Short): ShortBuffer = Sh public fun ShortBuffer(vararg shorts: Short): ShortBuffer = ShortBuffer(shorts) /** - * Returns a [ShortArray] containing all of the elements of this [MutableBuffer]. + * Returns a new [ShortArray] containing all of the elements of this [Buffer]. */ -public val MutableBuffer.array: ShortArray - get() = (if (this is ShortBuffer) array else ShortArray(size) { get(it) }) +public fun Buffer.toShortArray(): ShortArray = when(this) { + is ShortBuffer -> array.copyOf() + else -> ShortArray(size, ::get) +} /** * Returns [ShortBuffer] over this array. From 401ca2443db984bb6fc56be9ce1f2761fb6e6000 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Fri, 12 Mar 2021 20:00:33 +0700 Subject: [PATCH 111/150] Provide pages workflow for sending Dokka artifacts to gh-pages --- .github/workflows/pages.yml | 31 +++++++++++++++++++++++++++++++ gradle.properties | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pages.yml diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 000000000..29a2ed649 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,31 @@ +name: Dokka publication + +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-20.04 + steps: + - name: Checkout the repo + uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Cache gradle + uses: actions/cache@v2 + with: + path: ~/.gradle/caches + key: ubuntu-20.04-gradle-${{ hashFiles('*.gradle.kts') }} + restore-keys: | + ubuntu-20.04-gradle- + - name: Build + run: ./gradlew build --no-daemon --stacktrace + - name: Deploy to GitHub Pages + uses: JamesIves/github-pages-deploy-action@4.1.0 + with: + branch: gh-pages + folder: build/dokka/htmlMultiModule diff --git a/gradle.properties b/gradle.properties index aadc76c52..e28e22e8e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ kotlin.code.style=official kotlin.mpp.stability.nowarn=true kotlin.parallel.tasks.in.project=true org.gradle.configureondemand=true -org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m +org.gradle.jvmargs=-XX:MaxMetaspaceSize=1G org.gradle.parallel=true kotlin.mpp.enableGranularSourceSetsMetadata=true From 52a942dbe24c9eb22fdbcd14a4038a04f2b03a98 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Fri, 12 Mar 2021 19:29:06 +0300 Subject: [PATCH 112/150] integrand --- .../kotlin/space/kscience/kmath/integration/Integrand.kt | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrand.kt diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrand.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrand.kt new file mode 100644 index 000000000..31006cde2 --- /dev/null +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrand.kt @@ -0,0 +1,9 @@ +package space.kscience.kmath.integration + +import kotlin.reflect.KClass + +public interface IntegrandFeature + +public interface Integrand { + public fun getFeature(type: KClass): T? = null +} \ No newline at end of file From 850dd3f58e371ac33b7c8193adae5cc2a9524afb Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Fri, 12 Mar 2021 20:00:33 +0700 Subject: [PATCH 113/150] Provide pages workflow for sending Dokka artifacts to gh-pages --- .github/workflows/pages.yml | 31 +++++++++++++++++++++++++++++++ gradle.properties | 10 ++++++---- 2 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/pages.yml diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 000000000..29a2ed649 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,31 @@ +name: Dokka publication + +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-20.04 + steps: + - name: Checkout the repo + uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Cache gradle + uses: actions/cache@v2 + with: + path: ~/.gradle/caches + key: ubuntu-20.04-gradle-${{ hashFiles('*.gradle.kts') }} + restore-keys: | + ubuntu-20.04-gradle- + - name: Build + run: ./gradlew build --no-daemon --stacktrace + - name: Deploy to GitHub Pages + uses: JamesIves/github-pages-deploy-action@4.1.0 + with: + branch: gh-pages + folder: build/dokka/htmlMultiModule diff --git a/gradle.properties b/gradle.properties index 88b90f27b..e28e22e8e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,10 @@ kotlin.code.style=official -kotlin.mpp.enableGranularSourceSetsMetadata=true kotlin.mpp.stability.nowarn=true -kotlin.native.enableDependencyPropagation=false kotlin.parallel.tasks.in.project=true -org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m +org.gradle.configureondemand=true +org.gradle.jvmargs=-XX:MaxMetaspaceSize=1G org.gradle.parallel=true -systemProp.org.gradle.internal.publish.checksums.insecure=true + +kotlin.mpp.enableGranularSourceSetsMetadata=true +kotlin.native.enableDependencyPropagation=false + From 1c02ab347127343ee9b81731d7f16b00da70372a Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sat, 13 Mar 2021 00:04:10 +0700 Subject: [PATCH 114/150] Fix wrong task name --- .github/workflows/pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 29a2ed649..d6a6d97de 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -23,7 +23,7 @@ jobs: restore-keys: | ubuntu-20.04-gradle- - name: Build - run: ./gradlew build --no-daemon --stacktrace + run: ./gradlew dokkaHtmlMultiModule --no-daemon --stacktrace - name: Deploy to GitHub Pages uses: JamesIves/github-pages-deploy-action@4.1.0 with: From 756626c9bc8101f2c19c86f9af4cd8d92c35e2fb Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sat, 13 Mar 2021 00:30:14 +0700 Subject: [PATCH 115/150] Fix Dokka build --- .github/workflows/pages.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index d6a6d97de..c70227fce 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -22,10 +22,17 @@ jobs: key: ubuntu-20.04-gradle-${{ hashFiles('*.gradle.kts') }} restore-keys: | ubuntu-20.04-gradle- + - name: Cache konan + uses: actions/cache@v2 + with: + path: ~/.konan + key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }} + restore-keys: | + ${{ runner.os }}-gradle- - name: Build - run: ./gradlew dokkaHtmlMultiModule --no-daemon --stacktrace + run: ./gradlew dokkaHtmlMultiModule --no-daemon --no-parallel --stacktrace - name: Deploy to GitHub Pages uses: JamesIves/github-pages-deploy-action@4.1.0 with: - branch: gh-pages - folder: build/dokka/htmlMultiModule + branch: gh-pages + folder: build/dokka/htmlMultiModule From 171f5d5ba37aedf4fbe975c9c1c9791f5a078970 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sat, 13 Mar 2021 00:57:40 +0700 Subject: [PATCH 116/150] Increase Metaspace size --- gradle.properties | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index e28e22e8e..4b3e4aa69 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,9 +2,8 @@ kotlin.code.style=official kotlin.mpp.stability.nowarn=true kotlin.parallel.tasks.in.project=true org.gradle.configureondemand=true -org.gradle.jvmargs=-XX:MaxMetaspaceSize=1G +org.gradle.jvmargs=-XX:MaxMetaspaceSize=2G org.gradle.parallel=true kotlin.mpp.enableGranularSourceSetsMetadata=true kotlin.native.enableDependencyPropagation=false - From 6b44439d43b9cf25beba434ae42ffdf638b9f8be Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Sat, 13 Mar 2021 01:44:37 +0700 Subject: [PATCH 117/150] Fix lack of index.html --- .github/workflows/pages.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index c70227fce..82b0fb303 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -30,7 +30,9 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- - name: Build - run: ./gradlew dokkaHtmlMultiModule --no-daemon --no-parallel --stacktrace + run: | + ./gradlew dokkaHtmlMultiModule --no-daemon --no-parallel --stacktrace + mv build/dokka/htmlMultiModule/-modules.html build/dokka/htmlMultiModule/index.html - name: Deploy to GitHub Pages uses: JamesIves/github-pages-deploy-action@4.1.0 with: From 9bc8e8fbf9ecfe3178e922f6a7ea23b92eaca207 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Fri, 12 Mar 2021 22:52:18 +0300 Subject: [PATCH 118/150] WIP vector space refactor --- .../kscience/kmath/benchmarks/DotBenchmark.kt | 26 +-- .../benchmarks/LinearAlgebraBenchmark.kt | 13 +- .../structures/StructureWriteBenchmark.kt | 2 +- .../kscience/kmath/commons/linear/CMMatrix.kt | 15 +- .../kscience/kmath/commons/linear/CMSolver.kt | 8 +- .../kscience/kmath/linear/BufferMatrix.kt | 144 ------------ .../kscience/kmath/linear/LinearAlgebra.kt | 8 +- .../kscience/kmath/linear/LinearSpace.kt | 213 ++++++++++++++++++ .../kscience/kmath/linear/LupDecomposition.kt | 35 ++- .../kscience/kmath/linear/MatrixBuilder.kt | 52 ++--- .../kscience/kmath/linear/MatrixContext.kt | 173 -------------- .../kscience/kmath/linear/MatrixWrapper.kt | 30 +-- ...ealMatrixContext.kt => RealLinearSpace.kt} | 23 +- .../kscience/kmath/linear/VectorSpace.kt | 72 ------ .../kscience/kmath/linear/VirtualMatrix.kt | 2 - .../space/kscience/kmath/nd/NDStructure.kt | 6 +- .../space/kscience/kmath/nd/Structure1D.kt | 6 +- .../space/kscience/kmath/nd/Structure2D.kt | 12 +- .../kmath/structures/BufferAccessor2D.kt | 2 +- .../space/kscience/kmath/linear/MatrixTest.kt | 6 +- .../kscience/kmath/linear/RealLUSolverTest.kt | 8 +- .../kscience/kmath/dimensions/Wrappers.kt | 8 +- ...jmlMatrixContext.kt => EjmlLinearSpace.kt} | 16 +- .../space/kscience/kmath/real/RealMatrix.kt | 34 +-- .../kaceince/kmath/real/RealVectorTest.kt | 4 +- 25 files changed, 352 insertions(+), 566 deletions(-) delete mode 100644 kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferMatrix.kt create mode 100644 kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt delete mode 100644 kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixContext.kt rename kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/{RealMatrixContext.kt => RealLinearSpace.kt} (78%) delete mode 100644 kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VectorSpace.kt rename kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/{EjmlMatrixContext.kt => EjmlLinearSpace.kt} (80%) diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt index 93b5c5549..8fb0c284e 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt @@ -4,11 +4,11 @@ import kotlinx.benchmark.Benchmark import kotlinx.benchmark.Blackhole import kotlinx.benchmark.Scope import kotlinx.benchmark.State -import space.kscience.kmath.commons.linear.CMMatrixContext -import space.kscience.kmath.ejml.EjmlMatrixContext -import space.kscience.kmath.linear.BufferMatrixContext +import space.kscience.kmath.commons.linear.CMLinearSpace +import space.kscience.kmath.ejml.EjmlLinearSpace +import space.kscience.kmath.linear.BufferLinearSpace import space.kscience.kmath.linear.Matrix -import space.kscience.kmath.linear.RealMatrixContext +import space.kscience.kmath.linear.RealLinearSpace import space.kscience.kmath.operations.RealField import space.kscience.kmath.operations.invoke import space.kscience.kmath.structures.Buffer @@ -24,44 +24,44 @@ internal class DotBenchmark { val matrix1 = Matrix.real(dim, dim) { i, j -> if (i <= j) random.nextDouble() else 0.0 } val matrix2 = Matrix.real(dim, dim) { i, j -> if (i <= j) random.nextDouble() else 0.0 } - val cmMatrix1 = CMMatrixContext { matrix1.toCM() } - val cmMatrix2 = CMMatrixContext { matrix2.toCM() } + val cmMatrix1 = CMLinearSpace { matrix1.toCM() } + val cmMatrix2 = CMLinearSpace { matrix2.toCM() } - val ejmlMatrix1 = EjmlMatrixContext { matrix1.toEjml() } - val ejmlMatrix2 = EjmlMatrixContext { matrix2.toEjml() } + val ejmlMatrix1 = EjmlLinearSpace { matrix1.toEjml() } + val ejmlMatrix2 = EjmlLinearSpace { matrix2.toEjml() } } @Benchmark fun cmDot(blackhole: Blackhole) { - CMMatrixContext { + CMLinearSpace { blackhole.consume(cmMatrix1 dot cmMatrix2) } } @Benchmark fun ejmlDot(blackhole: Blackhole) { - EjmlMatrixContext { + EjmlLinearSpace { blackhole.consume(ejmlMatrix1 dot ejmlMatrix2) } } @Benchmark fun ejmlDotWithConversion(blackhole: Blackhole) { - EjmlMatrixContext { + EjmlLinearSpace { blackhole.consume(matrix1 dot matrix2) } } @Benchmark fun bufferedDot(blackhole: Blackhole) { - BufferMatrixContext(RealField, Buffer.Companion::real).invoke { + BufferLinearSpace(RealField, Buffer.Companion::real).invoke { blackhole.consume(matrix1 dot matrix2) } } @Benchmark fun realDot(blackhole: Blackhole) { - RealMatrixContext { + RealLinearSpace { blackhole.consume(matrix1 dot matrix2) } } diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/LinearAlgebraBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/LinearAlgebraBenchmark.kt index 30cb6c0b9..85759d93c 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/LinearAlgebraBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/LinearAlgebraBenchmark.kt @@ -4,13 +4,12 @@ import kotlinx.benchmark.Benchmark import kotlinx.benchmark.Blackhole import kotlinx.benchmark.Scope import kotlinx.benchmark.State -import space.kscience.kmath.commons.linear.CMMatrixContext -import space.kscience.kmath.commons.linear.CMMatrixContext.dot +import space.kscience.kmath.commons.linear.CMLinearSpace import space.kscience.kmath.commons.linear.inverse -import space.kscience.kmath.ejml.EjmlMatrixContext +import space.kscience.kmath.ejml.EjmlLinearSpace import space.kscience.kmath.ejml.inverse +import space.kscience.kmath.linear.LinearSpace import space.kscience.kmath.linear.Matrix -import space.kscience.kmath.linear.MatrixContext import space.kscience.kmath.linear.inverseWithLup import space.kscience.kmath.linear.real import kotlin.random.Random @@ -29,19 +28,19 @@ internal class LinearAlgebraBenchmark { @Benchmark fun kmathLupInversion(blackhole: Blackhole) { - blackhole.consume(MatrixContext.real.inverseWithLup(matrix)) + blackhole.consume(LinearSpace.real.inverseWithLup(matrix)) } @Benchmark fun cmLUPInversion(blackhole: Blackhole) { - with(CMMatrixContext) { + with(CMLinearSpace) { blackhole.consume(inverse(matrix)) } } @Benchmark fun ejmlInverse(blackhole: Blackhole) { - with(EjmlMatrixContext) { + with(EjmlLinearSpace) { blackhole.consume(inverse(matrix)) } } diff --git a/examples/src/main/kotlin/space/kscience/kmath/structures/StructureWriteBenchmark.kt b/examples/src/main/kotlin/space/kscience/kmath/structures/StructureWriteBenchmark.kt index 13d6f00e4..66d85edff 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/structures/StructureWriteBenchmark.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/structures/StructureWriteBenchmark.kt @@ -7,7 +7,7 @@ import kotlin.system.measureTimeMillis @Suppress("UNUSED_VARIABLE") fun main() { val n = 6000 - val structure = NDStructure.build(intArrayOf(n, n), Buffer.Companion::auto) { 1.0 } + val structure = NDStructure.buffered(intArrayOf(n, n), Buffer.Companion::auto) { 1.0 } structure.mapToBuffer { it + 1 } // warm-up val time1 = measureTimeMillis { val res = structure.mapToBuffer { it + 1 } } println("Structure mapping finished in $time1 millis") diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt index 393b28973..53f96626d 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt @@ -3,6 +3,7 @@ package space.kscience.kmath.commons.linear import org.apache.commons.math3.linear.* import space.kscience.kmath.linear.* import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.operations.RealField import space.kscience.kmath.structures.RealBuffer import kotlin.reflect.KClass import kotlin.reflect.cast @@ -55,7 +56,7 @@ public inline class CMMatrix(public val origin: RealMatrix) : Matrix { public fun RealMatrix.asMatrix(): CMMatrix = CMMatrix(this) -public class CMVector(public val origin: RealVector) : Point { +public class CMVector(public val origin: RealVector) : Vector { public override val size: Int get() = origin.dimension public override operator fun get(index: Int): Double = origin.getEntry(index) @@ -70,8 +71,8 @@ public fun Point.toCM(): CMVector = if (this is CMVector) this else { public fun RealVector.toPoint(): CMVector = CMVector(this) -public object CMMatrixContext : MatrixContext { - public override fun produce(rows: Int, columns: Int, initializer: (i: Int, j: Int) -> Double): CMMatrix { +public object CMLinearSpace : LinearSpace { + public override fun buildMatrix(rows: Int, columns: Int, initializer: (i: Int, j: Int) -> Double): CMMatrix { val array = Array(rows) { i -> DoubleArray(columns) { j -> initializer(i, j) } } return CMMatrix(Array2DRowRealMatrix(array)) } @@ -86,17 +87,15 @@ public object CMMatrixContext : MatrixContext { } } - override fun scale(a: Matrix, value: Double): Matrix = a.toCM().times(value) - public override fun Matrix.dot(other: Matrix): CMMatrix = CMMatrix(toCM().origin.multiply(other.toCM().origin)) - public override fun Matrix.dot(vector: Point): CMVector = + public override fun Matrix.dot(vector: Vector): CMVector = CMVector(toCM().origin.preMultiply(vector.toCM().origin)) public override operator fun Matrix.unaryMinus(): CMMatrix = - produce(rowNum, colNum) { i, j -> -get(i, j) } + buildMatrix(rowNum, colNum) { i, j -> -get(i, j) } public override fun add(a: Matrix, b: Matrix): CMMatrix = CMMatrix(a.toCM().origin.multiply(b.toCM().origin)) @@ -108,7 +107,7 @@ public object CMMatrixContext : MatrixContext { // CMMatrix(a.toCM().origin.scalarMultiply(k.toDouble())) public override operator fun Matrix.times(value: Double): CMMatrix = - produce(rowNum, colNum) { i, j -> get(i, j) * value } + buildMatrix(rowNum, colNum) { i, j -> get(i, j) * value } } public operator fun CMMatrix.plus(other: CMMatrix): CMMatrix = diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMSolver.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMSolver.kt index 3ce7ca9e6..ff4727aa2 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMSolver.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMSolver.kt @@ -12,7 +12,7 @@ public enum class CMDecomposition { CHOLESKY } -public fun CMMatrixContext.solver( +public fun CMLinearSpace.solver( a: Matrix, decomposition: CMDecomposition = CMDecomposition.LUP ): DecompositionSolver = when (decomposition) { @@ -23,19 +23,19 @@ public fun CMMatrixContext.solver( CMDecomposition.CHOLESKY -> CholeskyDecomposition(a.toCM().origin).solver } -public fun CMMatrixContext.solve( +public fun CMLinearSpace.solve( a: Matrix, b: Matrix, decomposition: CMDecomposition = CMDecomposition.LUP ): CMMatrix = solver(a, decomposition).solve(b.toCM().origin).asMatrix() -public fun CMMatrixContext.solve( +public fun CMLinearSpace.solve( a: Matrix, b: Point, decomposition: CMDecomposition = CMDecomposition.LUP ): CMVector = solver(a, decomposition).solve(b.toCM().origin).toPoint() -public fun CMMatrixContext.inverse( +public fun CMLinearSpace.inverse( a: Matrix, decomposition: CMDecomposition = CMDecomposition.LUP ): CMMatrix = solver(a, decomposition).inverse.asMatrix() diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferMatrix.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferMatrix.kt deleted file mode 100644 index ba7b7358c..000000000 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferMatrix.kt +++ /dev/null @@ -1,144 +0,0 @@ -package space.kscience.kmath.linear - -import space.kscience.kmath.nd.NDStructure -import space.kscience.kmath.nd.Structure2D -import space.kscience.kmath.operations.Ring -import space.kscience.kmath.operations.ScaleOperations -import space.kscience.kmath.operations.invoke -import space.kscience.kmath.structures.Buffer -import space.kscience.kmath.structures.BufferFactory -import space.kscience.kmath.structures.asSequence - -/** - * Alias for [Structure2D] with more familiar name. - * - * @param T the type of items. - */ -public typealias Matrix = Structure2D - -/** - * Basic implementation of Matrix space based on [NDStructure] - */ -public class BufferMatrixContext( - public override val elementContext: A, - private val bufferFactory: BufferFactory, -) : GenericMatrixContext> where A : Ring, A : ScaleOperations { - - public override fun produce(rows: Int, columns: Int, initializer: (i: Int, j: Int) -> T): BufferMatrix { - val buffer = bufferFactory(rows * columns) { offset -> initializer(offset / columns, offset % columns) } - return BufferMatrix(rows, columns, buffer) - } - - override fun scale(a: Matrix, value: Double): Matrix = elementContext { - produce(a.rowNum, a.colNum) { i, j -> - a[i, j] * value - } - } - - public override fun point(size: Int, initializer: (Int) -> T): Point = bufferFactory(size, initializer) - - private fun Matrix.toBufferMatrix(): BufferMatrix = if (this is BufferMatrix) this else { - produce(rowNum, colNum) { i, j -> get(i, j) } - } - - public fun one(rows: Int, columns: Int): Matrix = VirtualMatrix(rows, columns) { i, j -> - if (i == j) 1.0 else 0.0 - } + DiagonalFeature - - public override infix fun Matrix.dot(other: Matrix): BufferMatrix { - require(colNum == other.rowNum) { "Matrix dot operation dimension mismatch: ($rowNum, $colNum) x (${other.rowNum}, ${other.colNum})" } - val bufferMatrix = toBufferMatrix() - val otherBufferMatrix = other.toBufferMatrix() - return elementContext { - produce(rowNum, other.colNum) { i, j -> - var res = one - for (l in 0 until colNum) { - res += bufferMatrix[i, l] * otherBufferMatrix[l, j] - } - res - } - } - } - - public override infix fun Matrix.dot(vector: Point): Point { - require(colNum == vector.size) { "Matrix dot vector operation dimension mismatch: ($rowNum, $colNum) x (${vector.size})" } - val bufferMatrix = toBufferMatrix() - return elementContext { - bufferFactory(rowNum) { i -> - var res = one - for (j in 0 until colNum) { - res += bufferMatrix[i, j] * vector[j] - } - res - } - } - } - - override fun add(a: Matrix, b: Matrix): BufferMatrix { - require(a.rowNum == b.rowNum) { "Row number mismatch in matrix addition. Left side: ${a.rowNum}, right side: ${b.rowNum}" } - require(a.colNum == b.colNum) { "Column number mismatch in matrix addition. Left side: ${a.colNum}, right side: ${b.colNum}" } - val aBufferMatrix = a.toBufferMatrix() - val bBufferMatrix = b.toBufferMatrix() - return elementContext { - produce(a.rowNum, a.colNum) { i, j -> - aBufferMatrix[i, j] + bBufferMatrix[i, j] - } - } - } - -// override fun multiply(a: Matrix, k: Number): BufferMatrix { -// val aBufferMatrix = a.toBufferMatrix() -// return elementContext { -// produce(a.rowNum, a.colNum) { i, j -> aBufferMatrix[i, j] * k.toDouble() } -// } -// } - - public companion object -} - -public class BufferMatrix( - public override val rowNum: Int, - public override val colNum: Int, - public val buffer: Buffer, -) : Matrix { - - init { - require(buffer.size == rowNum * colNum) { "Dimension mismatch for matrix structure" } - } - - override val shape: IntArray get() = intArrayOf(rowNum, colNum) - - public override operator fun get(index: IntArray): T = get(index[0], index[1]) - public override operator fun get(i: Int, j: Int): T = buffer[i * colNum + j] - - public override fun elements(): Sequence> = sequence { - for (i in 0 until rowNum) for (j in 0 until colNum) yield(intArrayOf(i, j) to get(i, j)) - } - - public override fun equals(other: Any?): Boolean { - if (this === other) return true - - return when (other) { - is NDStructure<*> -> NDStructure.contentEquals(this, other) - else -> false - } - } - - override fun hashCode(): Int { - var result = rowNum - result = 31 * result + colNum - result = 31 * result + buffer.hashCode() - return result - } - - public override fun toString(): String { - return 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-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearAlgebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearAlgebra.kt index ea871ccba..265a709e9 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearAlgebra.kt @@ -1,7 +1,7 @@ package space.kscience.kmath.linear +import space.kscience.kmath.nd.as1D import space.kscience.kmath.structures.Buffer -import space.kscience.kmath.structures.VirtualBuffer public typealias Point = Buffer @@ -10,16 +10,16 @@ public typealias Point = Buffer */ public interface LinearSolver { public fun solve(a: Matrix, b: Matrix): Matrix - public fun solve(a: Matrix, b: Point): Point = solve(a, b.asMatrix()).asPoint() + public fun solve(a: Matrix, b: Point): Point = solve(a, b.asMatrix()).asVector() public fun inverse(a: Matrix): Matrix } /** * Convert matrix to vector if it is possible */ -public fun Matrix.asPoint(): Point = +public fun Matrix.asVector(): Vector = if (this.colNum == 1) - VirtualBuffer(rowNum) { get(it, 0) } + as1D() else error("Can't convert matrix with more than one column to vector") diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt new file mode 100644 index 000000000..e0076cda9 --- /dev/null +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt @@ -0,0 +1,213 @@ +package space.kscience.kmath.linear + +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.nd.* +import space.kscience.kmath.operations.* +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.BufferFactory +import kotlin.reflect.KClass + +/** + * Alias for [Structure2D] with more familiar name. + * + * @param T the type of items. + */ +public typealias Matrix = Structure2D + +/** + * Alias for [Structure1D] with more familiar name. + * + * @param T the type of items. + */ +public typealias Vector = Structure1D + +/** + * Basic operations on matrices and vectors. Operates on [Matrix]. + * + * @param T the type of items in the matrices. + * @param M the type of operated matrices. + */ +public interface LinearSpace> { + public val elementAlgebra: A + + /** + * Produces a matrix with this context and given dimensions. + */ + public fun buildMatrix(rows: Int, columns: Int, initializer: A.(i: Int, j: Int) -> T): Matrix + + /** + * Produces a point compatible with matrix space (and possibly optimized for it). + */ + public fun buildVector(size: Int, initializer: A.(Int) -> T): Vector = + buildMatrix(1, size) { _, j -> initializer(j) }.as1D() + + public operator fun Matrix.unaryMinus(): Matrix = buildMatrix(rowNum, colNum) { i, j -> + -get(i, j) + } + + public operator fun Vector.unaryMinus(): Vector = buildVector(size) { + -get(it) + } + + /** + * Matrix sum + */ + public operator fun Matrix.plus(other: Matrix): Matrix = buildMatrix(rowNum, colNum) { i, j -> + get(i, j) + other[i, j] + } + + + /** + * Vector sum + */ + public operator fun Vector.plus(other: Vector): Vector = buildVector(size) { + get(it) + other[it] + } + + /** + * Matrix subtraction + */ + public operator fun Matrix.minus(other: Matrix): Matrix = buildMatrix(rowNum, colNum) { i, j -> + get(i, j) - other[i, j] + } + + /** + * Vector subtraction + */ + public operator fun Vector.minus(other: Vector): Vector = buildVector(size) { + get(it) - other[it] + } + + + /** + * Computes the dot product of this matrix and another one. + * + * @receiver the multiplicand. + * @param other the multiplier. + * @return the dot product. + */ + public infix fun Matrix.dot(other: Matrix): Matrix { + require(colNum == other.rowNum) { "Matrix dot operation dimension mismatch: ($rowNum, $colNum) x (${other.rowNum}, ${other.colNum})" } + return elementAlgebra { + buildMatrix(rowNum, other.colNum) { i, j -> + var res = zero + for (l in 0 until colNum) { + res += this@dot[i, l] * other[l, j] + } + res + } + } + } + + /** + * Computes the dot product of this matrix and a vector. + * + * @receiver the multiplicand. + * @param vector the multiplier. + * @return the dot product. + */ + public infix fun Matrix.dot(vector: Vector): Vector { + require(colNum == vector.size) { "Matrix dot vector operation dimension mismatch: ($rowNum, $colNum) x (${vector.size})" } + return elementAlgebra { + buildVector(rowNum) { i -> + var res = one + for (j in 0 until colNum) { + res += this@dot[i, j] * vector[j] + } + res + } + } + } + + /** + * Multiplies a matrix by its element. + * + * @receiver the multiplicand. + * @param value the multiplier. + * @receiver the product. + */ + public operator fun Matrix.times(value: T): Matrix = + buildMatrix(rowNum, colNum) { i, j -> get(i, j) * value } + + /** + * Multiplies an element by a matrix of it. + * + * @receiver the multiplicand. + * @param m the multiplier. + * @receiver the product. + */ + public operator fun T.times(m: Matrix): Matrix = m * this + + /** + * Multiplies a vector by its element. + * + * @receiver the multiplicand. + * @param value the multiplier. + * @receiver the product. + */ + public operator fun Vector.times(value: T): Vector = + buildVector(size) { i -> get(i) * value } + + /** + * Multiplies an element by a vector of it. + * + * @receiver the multiplicand. + * @param v the multiplier. + * @receiver the product. + */ + public operator fun T.times(v: Vector): Vector = v * this + + /** + * Gets a feature from the matrix. This function may return some additional features to + * [space.kscience.kmath.nd.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 + */ + public fun > buffered( + algebra: A, + bufferFactory: BufferFactory = Buffer.Companion::boxing, + ): LinearSpace = object : LinearSpace { + override val elementAlgebra: A = algebra + + override fun buildMatrix( + rows: Int, columns: Int, + initializer: A.(i: Int, j: Int) -> T, + ): Matrix = NDStructure.buffered(intArrayOf(rows, columns)) { (i, j) -> + algebra.initializer(i, j) + }.as2D() + + } + + /** + * Automatic buffered matrix, unboxed if it is possible + */ + public inline fun > auto(ring: A): LinearSpace = + buffered(ring, Buffer.Companion::auto) + } +} + +/** + * Gets a feature from the matrix. This function may return some additional features to + * [space.kscience.kmath.nd.NDStructure.getFeature]. + * + * @param T the type of items in the matrices. + * @param M the type of operated matrices. + * @param F the type of feature. + * @receiver the [LinearSpace] of [T]. + * @param m the matrix. + * @return a feature object or `null` if it isn't present. + */ +@UnstableKMathAPI +public inline fun LinearSpace.getFeature(m: Matrix): F? = getFeature(m, F::class) + diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LupDecomposition.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LupDecomposition.kt index a3d4cbc47..5d68534bc 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LupDecomposition.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LupDecomposition.kt @@ -12,7 +12,7 @@ import space.kscience.kmath.structures.MutableBufferFactory * Common implementation of [LupDecompositionFeature]. */ public class LupDecomposition( - public val context: MatrixContext>, + public val context: LinearSpace, public val elementContext: Field, public val lu: Matrix, public val pivot: IntArray, @@ -62,15 +62,14 @@ public class LupDecomposition( } @PublishedApi -internal fun , F : Field> GenericMatrixContext.abs(value: T): T = - if (value > elementContext.zero) value else elementContext { -value } +internal fun > LinearSpace>.abs(value: T): T = + if (value > elementAlgebra.zero) value else elementAlgebra { -value } /** * Create a lup decomposition of generic matrix. */ -public fun > MatrixContext>.lup( +public fun > LinearSpace>.lup( factory: MutableBufferFactory, - elementContext: Field, matrix: Matrix, checkSingular: (T) -> Boolean, ): LupDecomposition { @@ -80,7 +79,7 @@ public fun > MatrixContext>.lup( //TODO just waits for KEEP-176 BufferAccessor2D(matrix.rowNum, matrix.colNum, factory).run { - elementContext { + elementAlgebra { val lu = create(matrix) // Initialize permutation array and parity @@ -142,18 +141,18 @@ public fun > MatrixContext>.lup( for (row in col + 1 until m) lu[row, col] /= luDiag } - return LupDecomposition(this@lup, elementContext, lu.collect(), pivot, even) + return LupDecomposition(this@lup, elementAlgebra, lu.collect(), pivot, even) } } } -public inline fun , F : Field> GenericMatrixContext>.lup( +public inline fun > LinearSpace>.lup( matrix: Matrix, noinline checkSingular: (T) -> Boolean, -): LupDecomposition = lup(MutableBuffer.Companion::auto, elementContext, matrix, checkSingular) +): LupDecomposition = lup(MutableBuffer.Companion::auto, matrix, checkSingular) -public fun MatrixContext>.lup(matrix: Matrix): LupDecomposition = - lup(Buffer.Companion::real, RealField, matrix) { it < 1e-11 } +public fun LinearSpace.lup(matrix: Matrix): LupDecomposition = + lup(Buffer.Companion::real, matrix) { it < 1e-11 } public fun LupDecomposition.solveWithLup( factory: MutableBufferFactory, @@ -198,7 +197,7 @@ public fun LupDecomposition.solveWithLup( } } - return context.produce(pivot.size, matrix.colNum) { i, j -> bp[i, j] } + return context.buildMatrix(pivot.size, matrix.colNum) { i, j -> bp[i, j] } } } } @@ -210,18 +209,18 @@ public inline fun LupDecomposition.solveWithLup(matrix: Mat * Solves a system of linear equations *ax = b** using LUP decomposition. */ @OptIn(UnstableKMathAPI::class) -public inline fun , F : Field> GenericMatrixContext>.solveWithLup( +public inline fun > LinearSpace>.solveWithLup( a: Matrix, b: Matrix, noinline bufferFactory: MutableBufferFactory = MutableBuffer.Companion::auto, noinline checkSingular: (T) -> Boolean, ): Matrix { // Use existing decomposition if it is provided by matrix - val decomposition = a.getFeature() ?: lup(bufferFactory, elementContext, a, checkSingular) + val decomposition = a.getFeature() ?: lup(bufferFactory, a, checkSingular) return decomposition.solveWithLup(bufferFactory, b) } -public inline fun , F : Field> GenericMatrixContext>.inverseWithLup( +public inline fun > LinearSpace>.inverseWithLup( matrix: Matrix, noinline bufferFactory: MutableBufferFactory = MutableBuffer.Companion::auto, noinline checkSingular: (T) -> Boolean, @@ -229,15 +228,15 @@ public inline fun , F : Field> GenericMatrixContext @OptIn(UnstableKMathAPI::class) -public fun RealMatrixContext.solveWithLup(a: Matrix, b: Matrix): Matrix { +public fun RealLinearSpace.solveWithLup(a: Matrix, b: Matrix): Matrix { // Use existing decomposition if it is provided by matrix val bufferFactory: MutableBufferFactory = MutableBuffer.Companion::real - val decomposition: LupDecomposition = a.getFeature() ?: lup(bufferFactory, RealField, a) { it < 1e-11 } + val decomposition: LupDecomposition = a.getFeature() ?: lup(bufferFactory, a) { it < 1e-11 } return decomposition.solveWithLup(bufferFactory, b) } /** * Inverses a square matrix using LUP decomposition. Non square matrix will throw a error. */ -public fun RealMatrixContext.inverseWithLup(matrix: Matrix): Matrix = +public fun RealLinearSpace.inverseWithLup(matrix: Matrix): Matrix = solveWithLup(matrix, one(matrix.rowNum, matrix.colNum)) \ No newline at end of file diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixBuilder.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixBuilder.kt index c96834360..57bea5cb6 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixBuilder.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixBuilder.kt @@ -1,46 +1,30 @@ package space.kscience.kmath.linear -import space.kscience.kmath.nd.Structure2D -import space.kscience.kmath.structures.Buffer -import space.kscience.kmath.structures.BufferFactory -import space.kscience.kmath.structures.asBuffer +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.operations.Ring -public class MatrixBuilder(public val rows: Int, public val columns: Int) { - public operator fun invoke(vararg elements: T): Matrix { - require(rows * columns == elements.size) { "The number of elements ${elements.size} is not equal $rows * $columns" } - val buffer = elements.asBuffer() - return BufferMatrix(rows, columns, buffer) - } - //TODO add specific matrix builder functions like diagonal, etc +@UnstableKMathAPI +public fun LinearSpace>.matrix(rows: Int, columns: Int, vararg elements: T): Matrix { + require(rows * columns == elements.size) { "The number of elements ${elements.size} is not equal $rows * $columns" } + return buildMatrix(rows, columns) { i, j -> elements[i * columns + j] } } -public fun Structure2D.Companion.build(rows: Int, columns: Int): MatrixBuilder = MatrixBuilder(rows, columns) - -public fun Structure2D.Companion.row(vararg values: T): Matrix { - val buffer = values.asBuffer() - return BufferMatrix(1, values.size, buffer) +@UnstableKMathAPI +public fun LinearSpace>.vector(vararg elements: T): Vector { + return buildVector(elements.size, elements::get) } -public inline fun Structure2D.Companion.row( +public inline fun LinearSpace>.row( size: Int, - factory: BufferFactory = Buffer.Companion::auto, - noinline builder: (Int) -> T, -): Matrix { - val buffer = factory(size, builder) - return BufferMatrix(1, size, buffer) -} + crossinline builder: (Int) -> T, +): Matrix = buildMatrix(1, size) { _, j -> builder(j) } -public fun Structure2D.Companion.column(vararg values: T): Matrix { - val buffer = values.asBuffer() - return BufferMatrix(values.size, 1, buffer) -} +public fun LinearSpace>.row(vararg values: T): Matrix = row(values.size, values::get) -public inline fun Structure2D.Companion.column( +public inline fun LinearSpace>.column( size: Int, - factory: BufferFactory = Buffer.Companion::auto, - noinline builder: (Int) -> T, -): Matrix { - val buffer = factory(size, builder) - return BufferMatrix(size, 1, buffer) -} + crossinline builder: (Int) -> T, +): Matrix = buildMatrix(size, 1) { i, _ -> builder(i) } + +public fun LinearSpace>.column(vararg values: T): Matrix = column(values.size, values::get) \ No newline at end of file diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixContext.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixContext.kt deleted file mode 100644 index 6afec94e8..000000000 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixContext.kt +++ /dev/null @@ -1,173 +0,0 @@ -package space.kscience.kmath.linear - -import space.kscience.kmath.misc.UnstableKMathAPI -import space.kscience.kmath.operations.* -import space.kscience.kmath.structures.Buffer -import space.kscience.kmath.structures.BufferFactory -import space.kscience.kmath.structures.asSequence -import kotlin.reflect.KClass - -/** - * 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> : GroupOperations>, ScaleOperations> { - /** - * Produces a matrix with this context and given dimensions. - */ - public fun produce(rows: Int, columns: Int, initializer: (i: Int, j: Int) -> T): M - - /** - * 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) - - @Suppress("UNCHECKED_CAST") - public override fun binaryOperationFunction(operation: String): (left: Matrix, right: Matrix) -> M = - when (operation) { - "dot" -> { left, right -> left dot right } - else -> super.binaryOperationFunction(operation) as (Matrix, Matrix) -> M - } - - /** - * Computes the dot product of this matrix and another one. - * - * @receiver the multiplicand. - * @param other the multiplier. - * @return the dot product. - */ - public infix fun Matrix.dot(other: Matrix): M - - /** - * Computes the dot product of this matrix and a vector. - * - * @receiver the multiplicand. - * @param vector the multiplier. - * @return the dot product. - */ - public infix fun Matrix.dot(vector: Point): Point - - /** - * Multiplies a matrix by its element. - * - * @receiver the multiplicand. - * @param value the multiplier. - * @receiver the product. - */ - public operator fun Matrix.times(value: T): M - - /** - * Multiplies an element by a matrix of it. - * - * @receiver the multiplicand. - * @param m the multiplier. - * @receiver the product. - */ - public operator fun T.times(m: Matrix): M = m * this - - /** - * 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. - * @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 - */ - public fun buffered( - ring: A, - bufferFactory: BufferFactory = Buffer.Companion::boxing, - ): GenericMatrixContext> where A : Ring, A: ScaleOperations = BufferMatrixContext(ring, bufferFactory) - - /** - * Automatic buffered matrix, unboxed if it is possible - */ - public inline fun auto(ring: A): GenericMatrixContext> where A : Ring, A: ScaleOperations = - buffered(ring, Buffer.Companion::auto) - } -} - -/** - * Gets a feature from the matrix. This function may return some additional features to - * [kscience.kmath.nd.NDStructure.getFeature]. - * - * @param T the type of items in the matrices. - * @param M the type of operated matrices. - * @param F the type of feature. - * @receiver the [MatrixContext] of [T]. - * @param m the matrix. - * @return a feature object or `null` if it isn't present. - */ -@UnstableKMathAPI -public inline fun 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 A the type of ring of matrix elements. - * @param M the type of operated matrices. - */ -public interface GenericMatrixContext> : MatrixContext where A : Ring, A : ScaleOperations{ - /** - * The ring over matrix elements. - */ - public val elementContext: A - - public override infix fun Matrix.dot(other: Matrix): M { - //TODO add typed error - require(colNum == other.rowNum) { "Matrix dot operation dimension mismatch: ($rowNum, $colNum) x (${other.rowNum}, ${other.colNum})" } - - return produce(rowNum, other.colNum) { i, j -> - val row = rows[i] - val column = other.columns[j] - elementContext { sum(row.asSequence().zip(column.asSequence(), ::multiply)) } - } - } - - public override infix fun Matrix.dot(vector: Point): Point { - //TODO add typed error - require(colNum == vector.size) { "Matrix dot vector operation dimension mismatch: ($rowNum, $colNum) x (${vector.size})" } - - return point(rowNum) { i -> - val row = rows[i] - elementContext { sum(row.asSequence().zip(vector.asSequence(), ::multiply)) } - } - } - - public override operator fun Matrix.unaryMinus(): M = - produce(rowNum, colNum) { i, j -> elementContext { -get(i, j) } } - - public override fun add(a: Matrix, b: Matrix): M { - require(a.rowNum == b.rowNum && a.colNum == b.colNum) { - "Matrix operation dimension mismatch. [${a.rowNum},${a.colNum}] + [${b.rowNum},${b.colNum}]" - } - - return produce(a.rowNum, a.colNum) { i, j -> elementContext { a[i, j] + b[i, j] } } - } - - public override operator fun Matrix.minus(b: Matrix): M { - require(rowNum == b.rowNum && colNum == b.colNum) { - "Matrix operation dimension mismatch. [$rowNum,$colNum] - [${b.rowNum},${b.colNum}]" - } - - return produce(rowNum, colNum) { i, j -> elementContext { get(i, j) + b[i, j] } } - } -// -// public override fun multiply(a: Matrix, k: Number): M = -// produce(a.rowNum, a.colNum) { i, j -> elementContext { a[i, j] * k } } - - public override operator fun Matrix.times(value: T): M = - produce(rowNum, colNum) { i, j -> elementContext { get(i, j) * value } } -} diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixWrapper.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixWrapper.kt index 69e4a916f..97f0acd61 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixWrapper.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixWrapper.kt @@ -1,14 +1,9 @@ package space.kscience.kmath.linear import space.kscience.kmath.misc.UnstableKMathAPI -import space.kscience.kmath.nd.Structure2D import space.kscience.kmath.nd.getFeature import space.kscience.kmath.operations.Ring -import space.kscience.kmath.operations.ScaleOperations -import space.kscience.kmath.structures.asBuffer -import kotlin.math.sqrt import kotlin.reflect.KClass -import kotlin.reflect.safeCast /** * A [Matrix] that holds [MatrixFeature] objects. @@ -24,7 +19,8 @@ public class MatrixWrapper internal constructor( * Get the first feature matching given class. Does not guarantee that matrix has only one feature matching the criteria */ @UnstableKMathAPI - override fun getFeature(type: KClass): T? = type.safeCast(features.find { type.isInstance(it) }) + @Suppress("UNCHECKED_CAST") + override fun getFeature(type: KClass): T? = features.singleOrNull { type.isInstance(it) } as? T ?: origin.getFeature(type) override fun equals(other: Any?): Boolean = origin == other @@ -61,35 +57,25 @@ public operator fun Matrix.plus(newFeatures: Collection Structure2D.Companion.square(vararg elements: T): Matrix { - val size: Int = sqrt(elements.size.toDouble()).toInt() - require(size * size == elements.size) { "The number of elements ${elements.size} is not a full square" } - val buffer = elements.asBuffer() - return BufferMatrix(size, size, buffer) -} - /** * Diagonal matrix of ones. The matrix is virtual no actual matrix is created */ -public fun GenericMatrixContext.one( +public fun LinearSpace>.one( rows: Int, columns: Int, -): Matrix where A : Ring, A : ScaleOperations = VirtualMatrix(rows, columns) { i, j -> - if (i == j) elementContext.one else elementContext.zero +): Matrix = VirtualMatrix(rows, columns) { i, j -> + if (i == j) elementAlgebra.one else elementAlgebra.zero } + UnitFeature /** * A virtual matrix of zeroes */ -public fun GenericMatrixContext.zero( +public fun LinearSpace>.zero( rows: Int, columns: Int, -): Matrix where A : Ring, A : ScaleOperations = VirtualMatrix(rows, columns) { _, _ -> - elementContext.zero +): Matrix = VirtualMatrix(rows, columns) { _, _ -> + elementAlgebra.zero } + ZeroFeature public class TransposedFeature(public val original: Matrix) : MatrixFeature diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealMatrixContext.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealLinearSpace.kt similarity index 78% rename from kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealMatrixContext.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealLinearSpace.kt index dbccb7536..6dc97c51e 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealMatrixContext.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealLinearSpace.kt @@ -1,34 +1,37 @@ package space.kscience.kmath.linear +import space.kscience.kmath.operations.RealField import space.kscience.kmath.operations.ScaleOperations import space.kscience.kmath.structures.RealBuffer -public object RealMatrixContext : MatrixContext>, ScaleOperations> { +public object RealLinearSpace : LinearSpace, ScaleOperations> { - public override fun produce( + override val elementAlgebra: RealField get() = RealField + + public override fun buildMatrix( rows: Int, columns: Int, initializer: (i: Int, j: Int) -> Double, - ): BufferMatrix { + ): Matrix { val buffer = RealBuffer(rows * columns) { offset -> initializer(offset / columns, offset % columns) } - return BufferMatrix(rows, columns, buffer) + return BufferMatrix(rows, columns, buffer) } public fun Matrix.toBufferMatrix(): BufferMatrix = if (this is BufferMatrix) this else { - produce(rowNum, colNum) { i, j -> get(i, j) } + buildMatrix(rowNum, colNum) { i, j -> get(i, j) } } public fun one(rows: Int, columns: Int): Matrix = VirtualMatrix(rows, columns) { i, j -> if (i == j) 1.0 else 0.0 } + DiagonalFeature - override fun Matrix.unaryMinus(): Matrix = produce(rowNum, colNum) { i, j -> -get(i, j) } + override fun Matrix.unaryMinus(): Matrix = buildMatrix(rowNum, colNum) { i, j -> -get(i, j) } public override infix fun Matrix.dot(other: Matrix): BufferMatrix { require(colNum == other.rowNum) { "Matrix dot operation dimension mismatch: ($rowNum, $colNum) x (${other.rowNum}, ${other.colNum})" } val bufferMatrix = toBufferMatrix() val otherBufferMatrix = other.toBufferMatrix() - return produce(rowNum, other.colNum) { i, j -> + return buildMatrix(rowNum, other.colNum) { i, j -> var res = 0.0 for (l in 0 until colNum) { res += bufferMatrix[i, l] * otherBufferMatrix[l, j] @@ -54,14 +57,14 @@ public object RealMatrixContext : MatrixContext>, S require(a.colNum == b.colNum) { "Column number mismatch in matrix addition. Left side: ${a.colNum}, right side: ${b.colNum}" } val aBufferMatrix = a.toBufferMatrix() val bBufferMatrix = b.toBufferMatrix() - return produce(a.rowNum, a.colNum) { i, j -> + return buildMatrix(a.rowNum, a.colNum) { i, j -> aBufferMatrix[i, j] + bBufferMatrix[i, j] } } override fun scale(a: Matrix, value: Double): BufferMatrix { val bufferMatrix = a.toBufferMatrix() - return produce(a.rowNum, a.colNum) { i, j -> bufferMatrix[i, j] * value } + return buildMatrix(a.rowNum, a.colNum) { i, j -> bufferMatrix[i, j] * value } } override fun Matrix.times(value: Double): BufferMatrix = scale(this, value) @@ -82,4 +85,4 @@ public object RealMatrixContext : MatrixContext>, S /** * Partially optimized real-valued matrix */ -public val MatrixContext.Companion.real: RealMatrixContext get() = RealMatrixContext +public val LinearSpace.Companion.real: RealLinearSpace get() = RealLinearSpace diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VectorSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VectorSpace.kt deleted file mode 100644 index cfacf6826..000000000 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VectorSpace.kt +++ /dev/null @@ -1,72 +0,0 @@ -package space.kscience.kmath.linear - -import space.kscience.kmath.operations.Group -import space.kscience.kmath.operations.RealField -import space.kscience.kmath.operations.ScaleOperations -import space.kscience.kmath.operations.invoke -import space.kscience.kmath.structures.Buffer -import space.kscience.kmath.structures.BufferFactory - -/** - * A linear space for vectors. - * Could be used on any point-like structure - */ -public interface VectorSpace : Group>, ScaleOperations> - where A : Group, A : ScaleOperations { - public val size: Int - public val algebra: A - override val zero: Point get() = produce { algebra.zero } - - public fun produce(initializer: A.(Int) -> T): Point - - override fun add(a: Point, b: Point): Point = produce { algebra { a[it] + b[it] } } - - override fun scale(a: Point, value: Double): Point = produce { algebra.scale(a[it], value) } - - override fun Point.unaryMinus(): Point = produce { -get(it) } - - //TODO add basis - - public companion object { - private val realSpaceCache: MutableMap> = hashMapOf() - - /** - * Non-boxing double vector space - */ - public fun real(size: Int): BufferVectorSpace = realSpaceCache.getOrPut(size) { - BufferVectorSpace( - size, - RealField, - Buffer.Companion::auto - ) - } - - /** - * A structured vector space with custom buffer - */ - public fun buffered( - size: Int, - space: A, - bufferFactory: BufferFactory = Buffer.Companion::boxing, - ): BufferVectorSpace where A : Group, A : ScaleOperations = - BufferVectorSpace(size, space, bufferFactory) - - /** - * Automatic buffered vector, unboxed if it is possible - */ - public inline fun auto( - size: Int, - space: A, - ): VectorSpace where A : Group, A : ScaleOperations = - buffered(size, space, Buffer.Companion::auto) - } -} - - -public class BufferVectorSpace( - override val size: Int, - override val algebra: A, - public val bufferFactory: BufferFactory, -) : VectorSpace where A : Group, A : ScaleOperations { - override fun produce(initializer: A.(Int) -> T): Buffer = bufferFactory(size) { algebra.initializer(it) } -} diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VirtualMatrix.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VirtualMatrix.kt index 26b1899a1..11699ce2f 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VirtualMatrix.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VirtualMatrix.kt @@ -31,6 +31,4 @@ public class VirtualMatrix( result = 31 * result + generator.hashCode() return result } - - } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDStructure.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDStructure.kt index 137772632..62e126694 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDStructure.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDStructure.kt @@ -74,7 +74,7 @@ public interface NDStructure { * * Strides should be reused if possible. */ - public fun build( + public fun buffered( strides: Strides, bufferFactory: BufferFactory = Buffer.Companion::boxing, initializer: (IntArray) -> T, @@ -94,11 +94,11 @@ public interface NDStructure { crossinline initializer: (IntArray) -> T, ): NDBuffer = NDBuffer(strides, Buffer.auto(type, strides.linearSize) { i -> initializer(strides.index(i)) }) - public fun build( + public fun buffered( shape: IntArray, bufferFactory: BufferFactory = Buffer.Companion::boxing, initializer: (IntArray) -> T, - ): NDBuffer = build(DefaultStrides(shape), bufferFactory, initializer) + ): NDBuffer = buffered(DefaultStrides(shape), bufferFactory, initializer) public inline fun auto( shape: IntArray, diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt index e83485ff0..c54bfeed9 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt @@ -46,7 +46,11 @@ private inline class Buffer1DWrapper(val buffer: Buffer) : Structure1D * Represent a [NDStructure] as [Structure1D]. Throw error in case of dimension mismatch */ public fun NDStructure.as1D(): Structure1D = if (shape.size == 1) { - if (this is NDBuffer) Buffer1DWrapper(this.buffer) else Structure1DWrapper(this) + when (this) { + is Structure1DWrapper -> this + is NDBuffer -> Buffer1DWrapper(this.buffer) + else -> Structure1DWrapper(this) + } } else error("Can't create 1d-structure from ${shape.size}d-structure") diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt index fcc8c0d7e..0098eeb3b 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt @@ -1,7 +1,5 @@ package space.kscience.kmath.nd -import space.kscience.kmath.linear.BufferMatrix -import space.kscience.kmath.linear.RealMatrixContext import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.VirtualBuffer @@ -54,15 +52,7 @@ public interface Structure2D : NDStructure { for (j in 0 until colNum) yield(intArrayOf(i, j) to get(i, j)) } - public companion object { - public inline fun real( - rows: Int, - columns: Int, - crossinline init: (i: Int, j: Int) -> Double, - ): BufferMatrix = RealMatrixContext.produce(rows,columns) { i, j -> - init(i, j) - } - } + public companion object } /** diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/BufferAccessor2D.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/BufferAccessor2D.kt index fd440a344..d9e37ebd8 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/BufferAccessor2D.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/BufferAccessor2D.kt @@ -25,7 +25,7 @@ internal class BufferAccessor2D( public fun create(mat: Structure2D): MutableBuffer = create { i, j -> mat[i, j] } //TODO optimize wrapper - public fun MutableBuffer.collect(): Structure2D = NDStructure.build( + public fun MutableBuffer.collect(): Structure2D = NDStructure.buffered( DefaultStrides(intArrayOf(rowNum, colNum)), factory ) { (i, j) -> diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt index 75967f024..5cf83889a 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt @@ -10,7 +10,7 @@ import kotlin.test.assertEquals class MatrixTest { @Test fun testTranspose() { - val matrix = MatrixContext.real.one(3, 3) + val matrix = LinearSpace.real.one(3, 3) val transposed = matrix.transpose() assertEquals(matrix, transposed) } @@ -39,7 +39,7 @@ class MatrixTest { infix fun Matrix.pow(power: Int): Matrix { var res = this repeat(power - 1) { - res = RealMatrixContext.invoke { res dot this@pow } + res = RealLinearSpace.invoke { res dot this@pow } } return res } @@ -52,7 +52,7 @@ class MatrixTest { val firstMatrix = NDStructure.auto(2, 3) { (i, j) -> (i + j).toDouble() }.as2D() val secondMatrix = NDStructure.auto(3, 2) { (i, j) -> (i + j).toDouble() }.as2D() - MatrixContext.real.run { + LinearSpace.real.run { // val firstMatrix = produce(2, 3) { i, j -> (i + j).toDouble() } // val secondMatrix = produce(3, 2) { i, j -> (i + j).toDouble() } val result = firstMatrix dot secondMatrix diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt index f1289801a..4d6b8f5be 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt @@ -7,8 +7,8 @@ class RealLUSolverTest { @Test fun testInvertOne() { - val matrix = MatrixContext.real.one(2, 2) - val inverted = MatrixContext.real.inverseWithLup(matrix) + val matrix = LinearSpace.real.one(2, 2) + val inverted = LinearSpace.real.inverseWithLup(matrix) assertEquals(matrix, inverted) } @@ -19,7 +19,7 @@ class RealLUSolverTest { 1.0, 3.0 ) - MatrixContext.real.run { + LinearSpace.real.run { val lup = lup(matrix) //Check determinant @@ -36,7 +36,7 @@ class RealLUSolverTest { 1.0, 3.0 ) - val inverted = MatrixContext.real.inverseWithLup(matrix) + val inverted = LinearSpace.real.inverseWithLup(matrix) val expected = Matrix.square( 0.375, -0.125, diff --git a/kmath-dimensions/src/commonMain/kotlin/space/kscience/kmath/dimensions/Wrappers.kt b/kmath-dimensions/src/commonMain/kotlin/space/kscience/kmath/dimensions/Wrappers.kt index 237824a39..89ff97f14 100644 --- a/kmath-dimensions/src/commonMain/kotlin/space/kscience/kmath/dimensions/Wrappers.kt +++ b/kmath-dimensions/src/commonMain/kotlin/space/kscience/kmath/dimensions/Wrappers.kt @@ -77,7 +77,7 @@ public inline class DPointWrapper(public val point: Point) /** * Basic operations on dimension-safe matrices. Operates on [Matrix] */ -public inline class DMatrixContext(public val context: MatrixContext>) { +public inline class DMatrixContext(public val context: LinearSpace>) { public inline fun Matrix.coerce(): DMatrix { require(rowNum == Dimension.dim().toInt()) { "Row number mismatch: expected ${Dimension.dim()} but found $rowNum" @@ -96,14 +96,14 @@ public inline class DMatrixContext(public val context: MatrixContext produce(noinline initializer: (i: Int, j: Int) -> T): DMatrix { val rows = Dimension.dim() val cols = Dimension.dim() - return context.produce(rows.toInt(), cols.toInt(), initializer).coerce() + return context.buildMatrix(rows.toInt(), cols.toInt(), initializer).coerce() } public inline fun point(noinline initializer: (Int) -> T): DPoint { val size = Dimension.dim() return DPoint.coerceUnsafe( - context.point( + context.buildVector( size.toInt(), initializer ) @@ -136,7 +136,7 @@ public inline class DMatrixContext(public val context: MatrixContext).transpose() }.coerce() public companion object { - public val real: DMatrixContext = DMatrixContext(MatrixContext.real) + public val real: DMatrixContext = DMatrixContext(LinearSpace.real) } } diff --git a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrixContext.kt b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt similarity index 80% rename from kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrixContext.kt rename to kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt index 95c465975..c3f93ca55 100644 --- a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrixContext.kt +++ b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt @@ -11,7 +11,7 @@ import space.kscience.kmath.operations.ScaleOperations * * @author Iaroslav Postovalov */ -public object EjmlMatrixContext : MatrixContext, ScaleOperations> { +public object EjmlLinearSpace : LinearSpace, ScaleOperations> { /** * Converts this matrix to EJML one. @@ -19,7 +19,7 @@ public object EjmlMatrixContext : MatrixContext, ScaleOperat @OptIn(UnstableKMathAPI::class) public fun Matrix.toEjml(): EjmlMatrix = when (val matrix = origin) { is EjmlMatrix -> matrix - else -> produce(rowNum, colNum) { i, j -> get(i, j) } + else -> buildMatrix(rowNum, colNum) { i, j -> get(i, j) } } /** @@ -30,14 +30,14 @@ public object EjmlMatrixContext : MatrixContext, ScaleOperat (0 until it.numRows()).forEach { row -> it[row, 0] = get(row) } }) - override fun produce(rows: Int, columns: Int, initializer: (i: Int, j: Int) -> Double): EjmlMatrix = + override fun buildMatrix(rows: Int, columns: Int, initializer: (i: Int, j: Int) -> Double): EjmlMatrix = EjmlMatrix(SimpleMatrix(rows, columns).also { (0 until rows).forEach { row -> (0 until columns).forEach { col -> it[row, col] = initializer(row, col) } } }) - override fun point(size: Int, initializer: (Int) -> Double): Point = + override fun buildVector(size: Int, initializer: (Int) -> Double): Point = EjmlVector(SimpleMatrix(size, 1).also { (0 until it.numRows()).forEach { row -> it[row, 0] = initializer(row) } }) @@ -58,7 +58,7 @@ public object EjmlMatrixContext : MatrixContext, ScaleOperat EjmlMatrix(toEjml().origin - b.toEjml().origin) public override fun scale(a: Matrix, value: Double): EjmlMatrix = - produce(a.rowNum, a.colNum) { i, j -> a[i, j] * value } + buildMatrix(a.rowNum, a.colNum) { i, j -> a[i, j] * value } public override operator fun Matrix.times(value: Double): EjmlMatrix = EjmlMatrix(toEjml().origin.scale(value)) @@ -72,7 +72,7 @@ public object EjmlMatrixContext : MatrixContext, ScaleOperat * @return the solution for 'x' that is n by p. * @author Iaroslav Postovalov */ -public fun EjmlMatrixContext.solve(a: Matrix, b: Matrix): EjmlMatrix = +public fun EjmlLinearSpace.solve(a: Matrix, b: Matrix): EjmlMatrix = EjmlMatrix(a.toEjml().origin.solve(b.toEjml().origin)) /** @@ -83,10 +83,10 @@ public fun EjmlMatrixContext.solve(a: Matrix, b: Matrix): EjmlMa * @return the solution for 'x' that is n by p. * @author Iaroslav Postovalov */ -public fun EjmlMatrixContext.solve(a: Matrix, b: Point): EjmlVector = +public fun EjmlLinearSpace.solve(a: Matrix, b: Point): EjmlVector = EjmlVector(a.toEjml().origin.solve(b.toEjml().origin)) @OptIn(UnstableKMathAPI::class) public fun EjmlMatrix.inverted(): EjmlMatrix = getFeature>()!!.inverse as EjmlMatrix -public fun EjmlMatrixContext.inverse(matrix: Matrix): Matrix = matrix.toEjml().inverted() \ No newline at end of file +public fun EjmlLinearSpace.inverse(matrix: Matrix): Matrix = matrix.toEjml().inverted() \ No newline at end of file diff --git a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealMatrix.kt b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealMatrix.kt index 30d002498..b93c430f9 100644 --- a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealMatrix.kt +++ b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealMatrix.kt @@ -22,14 +22,14 @@ import kotlin.math.pow public typealias RealMatrix = Matrix public fun realMatrix(rowNum: Int, colNum: Int, initializer: (i: Int, j: Int) -> Double): RealMatrix = - MatrixContext.real.produce(rowNum, colNum, initializer) + LinearSpace.real.buildMatrix(rowNum, colNum, initializer) public fun Array.toMatrix(): RealMatrix { - return MatrixContext.real.produce(size, this[0].size) { row, col -> this[row][col] } + return LinearSpace.real.buildMatrix(size, this[0].size) { row, col -> this[row][col] } } public fun Sequence.toMatrix(): RealMatrix = toList().let { - MatrixContext.real.produce(it.size, it[0].size) { row, col -> it[row][col] } + LinearSpace.real.buildMatrix(it.size, it[0].size) { row, col -> it[row][col] } } public fun RealMatrix.repeatStackVertical(n: Int): RealMatrix = @@ -42,37 +42,37 @@ public fun RealMatrix.repeatStackVertical(n: Int): RealMatrix = */ public operator fun RealMatrix.times(double: Double): RealMatrix = - MatrixContext.real.produce(rowNum, colNum) { row, col -> + LinearSpace.real.buildMatrix(rowNum, colNum) { row, col -> this[row, col] * double } public operator fun RealMatrix.plus(double: Double): RealMatrix = - MatrixContext.real.produce(rowNum, colNum) { row, col -> + LinearSpace.real.buildMatrix(rowNum, colNum) { row, col -> this[row, col] + double } public operator fun RealMatrix.minus(double: Double): RealMatrix = - MatrixContext.real.produce(rowNum, colNum) { row, col -> + LinearSpace.real.buildMatrix(rowNum, colNum) { row, col -> this[row, col] - double } public operator fun RealMatrix.div(double: Double): RealMatrix = - MatrixContext.real.produce(rowNum, colNum) { row, col -> + LinearSpace.real.buildMatrix(rowNum, colNum) { row, col -> this[row, col] / double } public operator fun Double.times(matrix: RealMatrix): RealMatrix = - MatrixContext.real.produce(matrix.rowNum, matrix.colNum) { row, col -> + LinearSpace.real.buildMatrix(matrix.rowNum, matrix.colNum) { row, col -> this * matrix[row, col] } public operator fun Double.plus(matrix: RealMatrix): RealMatrix = - MatrixContext.real.produce(matrix.rowNum, matrix.colNum) { row, col -> + LinearSpace.real.buildMatrix(matrix.rowNum, matrix.colNum) { row, col -> this + matrix[row, col] } public operator fun Double.minus(matrix: RealMatrix): RealMatrix = - MatrixContext.real.produce(matrix.rowNum, matrix.colNum) { row, col -> + LinearSpace.real.buildMatrix(matrix.rowNum, matrix.colNum) { row, col -> this - matrix[row, col] } @@ -87,20 +87,20 @@ public operator fun Double.minus(matrix: RealMatrix): RealMatrix = @UnstableKMathAPI public operator fun RealMatrix.times(other: RealMatrix): RealMatrix = - MatrixContext.real.produce(rowNum, colNum) { row, col -> this[row, col] * other[row, col] } + LinearSpace.real.buildMatrix(rowNum, colNum) { row, col -> this[row, col] * other[row, col] } public operator fun RealMatrix.plus(other: RealMatrix): RealMatrix = - MatrixContext.real.add(this, other) + LinearSpace.real.add(this, other) public operator fun RealMatrix.minus(other: RealMatrix): RealMatrix = - MatrixContext.real.produce(rowNum, colNum) { row, col -> this[row, col] - other[row, col] } + LinearSpace.real.buildMatrix(rowNum, colNum) { row, col -> this[row, col] - other[row, col] } /* * Operations on columns */ public inline fun RealMatrix.appendColumn(crossinline mapper: (Buffer) -> Double): RealMatrix = - MatrixContext.real.produce(rowNum, colNum + 1) { row, col -> + LinearSpace.real.buildMatrix(rowNum, colNum + 1) { row, col -> if (col < colNum) this[row, col] else @@ -108,7 +108,7 @@ public inline fun RealMatrix.appendColumn(crossinline mapper: (Buffer) - } public fun RealMatrix.extractColumns(columnRange: IntRange): RealMatrix = - MatrixContext.real.produce(rowNum, columnRange.count()) { row, col -> + LinearSpace.real.buildMatrix(rowNum, columnRange.count()) { row, col -> this[row, columnRange.first + col] } @@ -141,14 +141,14 @@ public fun RealMatrix.max(): Double? = elements().map { (_, value) -> value }.ma public fun RealMatrix.average(): Double = elements().map { (_, value) -> value }.average() public inline fun RealMatrix.map(crossinline transform: (Double) -> Double): RealMatrix = - MatrixContext.real.produce(rowNum, colNum) { i, j -> + LinearSpace.real.buildMatrix(rowNum, colNum) { i, j -> transform(get(i, j)) } /** * Inverse a square real matrix using LUP decomposition */ -public fun RealMatrix.inverseWithLup(): RealMatrix = MatrixContext.real.inverseWithLup(this) +public fun RealMatrix.inverseWithLup(): RealMatrix = LinearSpace.real.inverseWithLup(this) //extended operations diff --git a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealVectorTest.kt b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealVectorTest.kt index 463c68681..5d032de67 100644 --- a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealVectorTest.kt +++ b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealVectorTest.kt @@ -1,6 +1,6 @@ package kaceince.kmath.real -import space.kscience.kmath.linear.MatrixContext +import space.kscience.kmath.linear.LinearSpace import space.kscience.kmath.linear.asMatrix import space.kscience.kmath.linear.real import space.kscience.kmath.linear.transpose @@ -32,7 +32,7 @@ internal class RealVectorTest { val vector2 = Buffer.real(5) { 5 - it.toDouble() } val matrix1 = vector1.asMatrix() val matrix2 = vector2.asMatrix().transpose() - val product = MatrixContext.real { matrix1 dot matrix2 } + val product = LinearSpace.real { matrix1 dot matrix2 } assertEquals(5.0, product[1, 0]) assertEquals(6.0, product[2, 2]) } From 19d3998c3b4c636692a1690c27cb46b40169f50c Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sat, 13 Mar 2021 10:10:00 +0300 Subject: [PATCH 119/150] WIP vector space refactor --- .../kscience/kmath/commons/linear/CMMatrix.kt | 80 ++++++--- .../kscience/kmath/linear/LinearSpace.kt | 12 +- .../kscience/kmath/linear/MatrixBuilder.kt | 2 +- .../kscience/kmath/linear/RealLinearSpace.kt | 156 +++++++++--------- .../space/kscience/kmath/nd/NDStructure.kt | 2 +- .../kscience/kmath/ejml/EjmlLinearSpace.kt | 62 +++++-- .../space/kscience/kmath/ejml/EjmlMatrix.kt | 2 +- 7 files changed, 185 insertions(+), 131 deletions(-) diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt index 53f96626d..c1c3d716a 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt @@ -3,12 +3,13 @@ package space.kscience.kmath.commons.linear import org.apache.commons.math3.linear.* import space.kscience.kmath.linear.* import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.nd.NDStructure import space.kscience.kmath.operations.RealField import space.kscience.kmath.structures.RealBuffer import kotlin.reflect.KClass import kotlin.reflect.cast -public inline class CMMatrix(public val origin: RealMatrix) : Matrix { +public class CMMatrix(public val origin: RealMatrix) : Matrix { public override val rowNum: Int get() = origin.rowDimension public override val colNum: Int get() = origin.columnDimension @@ -51,12 +52,17 @@ public inline class CMMatrix(public val origin: RealMatrix) : Matrix { }?.let(type::cast) public override operator fun get(i: Int, j: Int): Double = origin.getEntry(i, j) + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is NDStructure<*>) return false + return NDStructure.contentEquals(this, other) + } + + override fun hashCode(): Int = origin.hashCode() } - -public fun RealMatrix.asMatrix(): CMMatrix = CMMatrix(this) - -public class CMVector(public val origin: RealVector) : Vector { +public inline class CMVector(public val origin: RealVector) : Vector { public override val size: Int get() = origin.dimension public override operator fun get(index: Int): Double = origin.getEntry(index) @@ -64,16 +70,17 @@ public class CMVector(public val origin: RealVector) : Vector { public override operator fun iterator(): Iterator = origin.toArray().iterator() } -public fun Point.toCM(): CMVector = if (this is CMVector) this else { - val array = DoubleArray(size) { this[it] } - CMVector(ArrayRealVector(array)) -} - public fun RealVector.toPoint(): CMVector = CMVector(this) public object CMLinearSpace : LinearSpace { - public override fun buildMatrix(rows: Int, columns: Int, initializer: (i: Int, j: Int) -> Double): CMMatrix { - val array = Array(rows) { i -> DoubleArray(columns) { j -> initializer(i, j) } } + override val elementAlgebra: RealField get() = RealField + + public override fun buildMatrix( + rows: Int, + columns: Int, + initializer: RealField.(i: Int, j: Int) -> Double, + ): CMMatrix { + val array = Array(rows) { i -> DoubleArray(columns) { j -> RealField.initializer(i, j) } } return CMMatrix(Array2DRowRealMatrix(array)) } @@ -83,31 +90,50 @@ public object CMLinearSpace : LinearSpace { else -> { //TODO add feature analysis val array = Array(rowNum) { i -> DoubleArray(colNum) { j -> get(i, j) } } - CMMatrix(Array2DRowRealMatrix(array)) + Array2DRowRealMatrix(array).wrap() } } + public fun Vector.toCM(): CMVector = if (this is CMVector) this else { + val array = DoubleArray(size) { this[it] } + ArrayRealVector(array).wrap() + } + + private fun RealMatrix.wrap(): CMMatrix = CMMatrix(this) + private fun RealVector.wrap(): CMVector = CMVector(this) + + override fun buildVector(size: Int, initializer: RealField.(Int) -> Double): Vector = + ArrayRealVector(DoubleArray(size) { RealField.initializer(it) }).wrap() + + override fun Matrix.plus(other: Matrix): CMMatrix = + toCM().origin.add(other.toCM().origin).wrap() + + override fun Vector.plus(other: Vector): CMVector = + toCM().origin.add(other.toCM().origin).wrap() + + override fun Vector.minus(other: Vector): CMVector = + toCM().origin.subtract(other.toCM().origin).wrap() public override fun Matrix.dot(other: Matrix): CMMatrix = - CMMatrix(toCM().origin.multiply(other.toCM().origin)) + toCM().origin.multiply(other.toCM().origin).wrap() public override fun Matrix.dot(vector: Vector): CMVector = - CMVector(toCM().origin.preMultiply(vector.toCM().origin)) + toCM().origin.preMultiply(vector.toCM().origin).wrap() - public override operator fun Matrix.unaryMinus(): CMMatrix = - buildMatrix(rowNum, colNum) { i, j -> -get(i, j) } - - public override fun add(a: Matrix, b: Matrix): CMMatrix = - CMMatrix(a.toCM().origin.multiply(b.toCM().origin)) - - public override operator fun Matrix.minus(b: Matrix): CMMatrix = - CMMatrix(toCM().origin.subtract(b.toCM().origin)) - -// public override fun multiply(a: Matrix, k: Number): CMMatrix = -// CMMatrix(a.toCM().origin.scalarMultiply(k.toDouble())) + public override operator fun Matrix.minus(other: Matrix): CMMatrix = + toCM().origin.subtract(other.toCM().origin).wrap() public override operator fun Matrix.times(value: Double): CMMatrix = - buildMatrix(rowNum, colNum) { i, j -> get(i, j) * value } + toCM().origin.scalarMultiply(value).wrap() + + override fun Double.times(m: Matrix): CMMatrix = + m * this + + override fun Vector.times(value: Double): CMVector = + toCM().origin.mapMultiply(value).wrap() + + override fun Double.times(v: Vector): CMVector = + v * this } public operator fun CMMatrix.plus(other: CMMatrix): CMMatrix = diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt index e0076cda9..5800bdd0d 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt @@ -14,12 +14,7 @@ import kotlin.reflect.KClass */ public typealias Matrix = Structure2D -/** - * Alias for [Structure1D] with more familiar name. - * - * @param T the type of items. - */ -public typealias Vector = Structure1D +public typealias Vector = Point /** * Basic operations on matrices and vectors. Operates on [Matrix]. @@ -183,12 +178,13 @@ public interface LinearSpace> { override fun buildMatrix( rows: Int, columns: Int, initializer: A.(i: Int, j: Int) -> T, - ): Matrix = NDStructure.buffered(intArrayOf(rows, columns)) { (i, j) -> + ): Matrix = NDStructure.buffered(intArrayOf(rows, columns), bufferFactory) { (i, j) -> algebra.initializer(i, j) }.as2D() - } + public val real: LinearSpace = buffered(RealField, Buffer.Companion::real) + /** * Automatic buffered matrix, unboxed if it is possible */ diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixBuilder.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixBuilder.kt index 57bea5cb6..28df78dad 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixBuilder.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixBuilder.kt @@ -12,7 +12,7 @@ public fun LinearSpace>.matrix(rows: Int, columns: Int, var @UnstableKMathAPI public fun LinearSpace>.vector(vararg elements: T): Vector { - return buildVector(elements.size, elements::get) + return buildVector(elements.size) { elements[it] } } public inline fun LinearSpace>.row( diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealLinearSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealLinearSpace.kt index 6dc97c51e..3fa23db82 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealLinearSpace.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealLinearSpace.kt @@ -1,88 +1,86 @@ package space.kscience.kmath.linear -import space.kscience.kmath.operations.RealField -import space.kscience.kmath.operations.ScaleOperations -import space.kscience.kmath.structures.RealBuffer - -public object RealLinearSpace : LinearSpace, ScaleOperations> { - - override val elementAlgebra: RealField get() = RealField - - public override fun buildMatrix( - rows: Int, - columns: Int, - initializer: (i: Int, j: Int) -> Double, - ): Matrix { - val buffer = RealBuffer(rows * columns) { offset -> initializer(offset / columns, offset % columns) } - return BufferMatrix(rows, columns, buffer) - } - - public fun Matrix.toBufferMatrix(): BufferMatrix = if (this is BufferMatrix) this else { - buildMatrix(rowNum, colNum) { i, j -> get(i, j) } - } - - public fun one(rows: Int, columns: Int): Matrix = VirtualMatrix(rows, columns) { i, j -> - if (i == j) 1.0 else 0.0 - } + DiagonalFeature - - override fun Matrix.unaryMinus(): Matrix = buildMatrix(rowNum, colNum) { i, j -> -get(i, j) } - - public override infix fun Matrix.dot(other: Matrix): BufferMatrix { - require(colNum == other.rowNum) { "Matrix dot operation dimension mismatch: ($rowNum, $colNum) x (${other.rowNum}, ${other.colNum})" } - val bufferMatrix = toBufferMatrix() - val otherBufferMatrix = other.toBufferMatrix() - return buildMatrix(rowNum, other.colNum) { i, j -> - var res = 0.0 - for (l in 0 until colNum) { - res += bufferMatrix[i, l] * otherBufferMatrix[l, j] - } - res - } - } - - public override infix fun Matrix.dot(vector: Point): Point { - require(colNum == vector.size) { "Matrix dot vector operation dimension mismatch: ($rowNum, $colNum) x (${vector.size})" } - val bufferMatrix = toBufferMatrix() - return RealBuffer(rowNum) { i -> - var res = 0.0 - for (j in 0 until colNum) { - res += bufferMatrix[i, j] * vector[j] - } - res - } - } - - override fun add(a: Matrix, b: Matrix): BufferMatrix { - require(a.rowNum == b.rowNum) { "Row number mismatch in matrix addition. Left side: ${a.rowNum}, right side: ${b.rowNum}" } - require(a.colNum == b.colNum) { "Column number mismatch in matrix addition. Left side: ${a.colNum}, right side: ${b.colNum}" } - val aBufferMatrix = a.toBufferMatrix() - val bBufferMatrix = b.toBufferMatrix() - return buildMatrix(a.rowNum, a.colNum) { i, j -> - aBufferMatrix[i, j] + bBufferMatrix[i, j] - } - } - - override fun scale(a: Matrix, value: Double): BufferMatrix { - val bufferMatrix = a.toBufferMatrix() - return buildMatrix(a.rowNum, a.colNum) { i, j -> bufferMatrix[i, j] * value } - } - - override fun Matrix.times(value: Double): BufferMatrix = scale(this, value) +//public object RealLinearSpace: +//public object RealLinearSpace : LinearSpace, ScaleOperations> { // -// override fun multiply(a: Matrix, k: Number): BufferMatrix { -// val aBufferMatrix = a.toBufferMatrix() -// return produce(a.rowNum, a.colNum) { i, j -> aBufferMatrix[i, j] * k.toDouble() } +// override val elementAlgebra: RealField get() = RealField +// +// public override fun buildMatrix( +// rows: Int, +// columns: Int, +// initializer: (i: Int, j: Int) -> Double, +// ): Matrix { +// val buffer = RealBuffer(rows * columns) { offset -> initializer(offset / columns, offset % columns) } +// return BufferMatrix(rows, columns, buffer) // } // -// override fun divide(a: Matrix, k: Number): BufferMatrix { -// val aBufferMatrix = a.toBufferMatrix() -// return produce(a.rowNum, a.colNum) { i, j -> aBufferMatrix[i, j] / k.toDouble() } +// public fun Matrix.toBufferMatrix(): BufferMatrix = if (this is BufferMatrix) this else { +// buildMatrix(rowNum, colNum) { i, j -> get(i, j) } // } -} +// +// public fun one(rows: Int, columns: Int): Matrix = VirtualMatrix(rows, columns) { i, j -> +// if (i == j) 1.0 else 0.0 +// } + DiagonalFeature +// +// override fun Matrix.unaryMinus(): Matrix = buildMatrix(rowNum, colNum) { i, j -> -get(i, j) } +// +// public override infix fun Matrix.dot(other: Matrix): BufferMatrix { +// require(colNum == other.rowNum) { "Matrix dot operation dimension mismatch: ($rowNum, $colNum) x (${other.rowNum}, ${other.colNum})" } +// val bufferMatrix = toBufferMatrix() +// val otherBufferMatrix = other.toBufferMatrix() +// return buildMatrix(rowNum, other.colNum) { i, j -> +// var res = 0.0 +// for (l in 0 until colNum) { +// res += bufferMatrix[i, l] * otherBufferMatrix[l, j] +// } +// res +// } +// } +// +// public override infix fun Matrix.dot(vector: Point): Point { +// require(colNum == vector.size) { "Matrix dot vector operation dimension mismatch: ($rowNum, $colNum) x (${vector.size})" } +// val bufferMatrix = toBufferMatrix() +// return RealBuffer(rowNum) { i -> +// var res = 0.0 +// for (j in 0 until colNum) { +// res += bufferMatrix[i, j] * vector[j] +// } +// res +// } +// } +// +// override fun add(a: Matrix, b: Matrix): BufferMatrix { +// require(a.rowNum == b.rowNum) { "Row number mismatch in matrix addition. Left side: ${a.rowNum}, right side: ${b.rowNum}" } +// require(a.colNum == b.colNum) { "Column number mismatch in matrix addition. Left side: ${a.colNum}, right side: ${b.colNum}" } +// val aBufferMatrix = a.toBufferMatrix() +// val bBufferMatrix = b.toBufferMatrix() +// return buildMatrix(a.rowNum, a.colNum) { i, j -> +// aBufferMatrix[i, j] + bBufferMatrix[i, j] +// } +// } +// +// override fun scale(a: Matrix, value: Double): BufferMatrix { +// val bufferMatrix = a.toBufferMatrix() +// return buildMatrix(a.rowNum, a.colNum) { i, j -> bufferMatrix[i, j] * value } +// } +// +// override fun Matrix.times(value: Double): BufferMatrix = scale(this, value) +// +//// +//// override fun multiply(a: Matrix, k: Number): BufferMatrix { +//// val aBufferMatrix = a.toBufferMatrix() +//// return produce(a.rowNum, a.colNum) { i, j -> aBufferMatrix[i, j] * k.toDouble() } +//// } +//// +//// override fun divide(a: Matrix, k: Number): BufferMatrix { +//// val aBufferMatrix = a.toBufferMatrix() +//// return produce(a.rowNum, a.colNum) { i, j -> aBufferMatrix[i, j] / k.toDouble() } +//// } +//} -/** - * Partially optimized real-valued matrix - */ -public val LinearSpace.Companion.real: RealLinearSpace get() = RealLinearSpace +///** +// * Partially optimized real-valued matrix +// */ +//public val LinearSpace.Companion.real: RealLinearSpace get() = RealLinearSpace diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDStructure.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDStructure.kt index 62e126694..48041df58 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDStructure.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDStructure.kt @@ -52,7 +52,7 @@ public interface NDStructure { * optimize operations and performance. If the feature is not present, null is defined. */ @UnstableKMathAPI - public fun getFeature(type: KClass): T? = null + public fun getFeature(type: KClass): F? = null public companion object { /** diff --git a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt index c3f93ca55..339e06459 100644 --- a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt +++ b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt @@ -4,6 +4,7 @@ import org.ejml.simple.SimpleMatrix import space.kscience.kmath.linear.* import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.nd.getFeature +import space.kscience.kmath.operations.RealField import space.kscience.kmath.operations.ScaleOperations /** @@ -11,7 +12,9 @@ import space.kscience.kmath.operations.ScaleOperations * * @author Iaroslav Postovalov */ -public object EjmlLinearSpace : LinearSpace, ScaleOperations> { +public object EjmlLinearSpace : LinearSpace, ScaleOperations> { + + override val elementAlgebra: RealField get() = RealField /** * Converts this matrix to EJML one. @@ -25,43 +28,74 @@ public object EjmlLinearSpace : LinearSpace, ScaleOperations /** * Converts this vector to EJML one. */ - public fun Point.toEjml(): EjmlVector = - if (this is EjmlVector) this else EjmlVector(SimpleMatrix(size, 1).also { + public fun Vector.toEjml(): EjmlVector = when (this) { + is EjmlVector -> this + else -> EjmlVector(SimpleMatrix(size, 1).also { (0 until it.numRows()).forEach { row -> it[row, 0] = get(row) } }) + } - override fun buildMatrix(rows: Int, columns: Int, initializer: (i: Int, j: Int) -> Double): EjmlMatrix = + override fun buildMatrix(rows: Int, columns: Int, initializer: RealField.(i: Int, j: Int) -> Double): EjmlMatrix = EjmlMatrix(SimpleMatrix(rows, columns).also { (0 until rows).forEach { row -> - (0 until columns).forEach { col -> it[row, col] = initializer(row, col) } + (0 until columns).forEach { col -> it[row, col] = RealField.initializer(row, col) } } }) - override fun buildVector(size: Int, initializer: (Int) -> Double): Point = + override fun buildVector(size: Int, initializer: RealField.(Int) -> Double): Vector = EjmlVector(SimpleMatrix(size, 1).also { (0 until it.numRows()).forEach { row -> it[row, 0] = initializer(row) } }) + private fun SimpleMatrix.wrapMatrix() = EjmlMatrix(this) + private fun SimpleMatrix.wrapVector() = EjmlVector(this) - override fun Matrix.unaryMinus(): Matrix = this*(-1) + override fun Matrix.unaryMinus(): Matrix = this * (-1) public override fun Matrix.dot(other: Matrix): EjmlMatrix = EjmlMatrix(toEjml().origin.mult(other.toEjml().origin)) - public override fun Matrix.dot(vector: Point): EjmlVector = + public override fun Matrix.dot(vector: Vector): EjmlVector = EjmlVector(toEjml().origin.mult(vector.toEjml().origin)) - public override fun add(a: Matrix, b: Matrix): EjmlMatrix = - EjmlMatrix(a.toEjml().origin + b.toEjml().origin) - - public override operator fun Matrix.minus(b: Matrix): EjmlMatrix = - EjmlMatrix(toEjml().origin - b.toEjml().origin) + public override operator fun Matrix.minus(other: Matrix): EjmlMatrix = + EjmlMatrix(toEjml().origin - other.toEjml().origin) public override fun scale(a: Matrix, value: Double): EjmlMatrix = - buildMatrix(a.rowNum, a.colNum) { i, j -> a[i, j] * value } + a.toEjml().origin.scale(value).wrapMatrix() public override operator fun Matrix.times(value: Double): EjmlMatrix = EjmlMatrix(toEjml().origin.scale(value)) + + override fun Vector.unaryMinus(): EjmlVector = + toEjml().origin.negative().wrapVector() + + override fun Matrix.plus(other: Matrix): Matrix { + TODO("Not yet implemented") + } + + override fun Vector.plus(other: Vector): Vector { + TODO("Not yet implemented") + } + + override fun Vector.minus(other: Vector): Vector { + TODO("Not yet implemented") + } + + override fun Double.times(m: Matrix): Matrix { + TODO("Not yet implemented") + } + + override fun Vector.times(value: Double): Vector { + TODO("Not yet implemented") + } + + override fun Double.times(v: Vector): Vector { + TODO("Not yet implemented") + } + + public override fun add(a: Matrix, b: Matrix): EjmlMatrix = + EjmlMatrix(a.toEjml().origin + b.toEjml().origin) } /** diff --git a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt index d23e613e4..a1984fa31 100644 --- a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt +++ b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt @@ -85,7 +85,7 @@ public class EjmlMatrix(public val origin: SimpleMatrix) : Matrix { override fun equals(other: Any?): Boolean { if (this === other) return true - if (other !is Matrix<*>) return false + if (other !is NDStructure<*>) return false return NDStructure.contentEquals(this, other) } From d5ba816b7daa64a089c3b07e4aa28ab1e10b74f8 Mon Sep 17 00:00:00 2001 From: darksnake Date: Sat, 13 Mar 2021 18:00:47 +0300 Subject: [PATCH 120/150] WIP Matrix refactor --- .../kscience/kmath/linear/LinearSpace.kt | 2 +- .../kscience/kmath/linear/LupDecomposition.kt | 4 +- .../space/kscience/kmath/linear/MatrixTest.kt | 3 +- .../kscience/kmath/dimensions/Wrappers.kt | 31 +++++++------ .../kscience/kmath/ejml/EjmlLinearSpace.kt | 39 ++++++---------- .../space/kscience/kmath/real/RealMatrix.kt | 29 ++++++------ .../kotlin/space/kscience/kmath/real/dot.kt | 46 +++++++++---------- 7 files changed, 74 insertions(+), 80 deletions(-) diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt index 5800bdd0d..4a9d2c9b3 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt @@ -22,7 +22,7 @@ public typealias Vector = Point * @param T the type of items in the matrices. * @param M the type of operated matrices. */ -public interface LinearSpace> { +public interface LinearSpace> { public val elementAlgebra: A /** diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LupDecomposition.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LupDecomposition.kt index 5d68534bc..0937f1e19 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LupDecomposition.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LupDecomposition.kt @@ -228,7 +228,7 @@ public inline fun > LinearSpace>.inverseWi @OptIn(UnstableKMathAPI::class) -public fun RealLinearSpace.solveWithLup(a: Matrix, b: Matrix): Matrix { +public fun LinearSpace.solveWithLup(a: Matrix, b: Matrix): Matrix { // Use existing decomposition if it is provided by matrix val bufferFactory: MutableBufferFactory = MutableBuffer.Companion::real val decomposition: LupDecomposition = a.getFeature() ?: lup(bufferFactory, a) { it < 1e-11 } @@ -238,5 +238,5 @@ public fun RealLinearSpace.solveWithLup(a: Matrix, b: Matrix): M /** * Inverses a square matrix using LUP decomposition. Non square matrix will throw a error. */ -public fun RealLinearSpace.inverseWithLup(matrix: Matrix): Matrix = +public fun LinearSpace.inverseWithLup(matrix: Matrix): Matrix = solveWithLup(matrix, one(matrix.rowNum, matrix.colNum)) \ No newline at end of file diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt index 5cf83889a..27374e93f 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt @@ -2,7 +2,6 @@ package space.kscience.kmath.linear import space.kscience.kmath.nd.NDStructure import space.kscience.kmath.nd.as2D -import space.kscience.kmath.operations.invoke import kotlin.test.Test import kotlin.test.assertEquals @@ -17,7 +16,7 @@ class MatrixTest { @Test fun testBuilder() { - val matrix = Matrix.build(2, 3)( + val matrix = LinearSpace.real.matrix(2, 3)( 1.0, 0.0, 0.0, 0.0, 1.0, 2.0 ) diff --git a/kmath-dimensions/src/commonMain/kotlin/space/kscience/kmath/dimensions/Wrappers.kt b/kmath-dimensions/src/commonMain/kotlin/space/kscience/kmath/dimensions/Wrappers.kt index 89ff97f14..f7e14b29f 100644 --- a/kmath-dimensions/src/commonMain/kotlin/space/kscience/kmath/dimensions/Wrappers.kt +++ b/kmath-dimensions/src/commonMain/kotlin/space/kscience/kmath/dimensions/Wrappers.kt @@ -2,7 +2,8 @@ package space.kscience.kmath.dimensions import space.kscience.kmath.linear.* import space.kscience.kmath.nd.Structure2D -import space.kscience.kmath.operations.invoke +import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.Ring /** * A matrix with compile-time controlled dimension @@ -77,7 +78,7 @@ public inline class DPointWrapper(public val point: Point) /** * Basic operations on dimension-safe matrices. Operates on [Matrix] */ -public inline class DMatrixContext(public val context: LinearSpace>) { +public inline class DMatrixContext>(public val context: LinearSpace) { public inline fun Matrix.coerce(): DMatrix { require(rowNum == Dimension.dim().toInt()) { "Row number mismatch: expected ${Dimension.dim()} but found $rowNum" @@ -93,13 +94,15 @@ public inline class DMatrixContext(public val context: LinearSpace produce(noinline initializer: (i: Int, j: Int) -> T): DMatrix { + public inline fun produce( + noinline initializer: A.(i: Int, j: Int) -> T + ): DMatrix { val rows = Dimension.dim() val cols = Dimension.dim() return context.buildMatrix(rows.toInt(), cols.toInt(), initializer).coerce() } - public inline fun point(noinline initializer: (Int) -> T): DPoint { + public inline fun point(noinline initializer: A.(Int) -> T): DPoint { val size = Dimension.dim() return DPoint.coerceUnsafe( @@ -112,31 +115,31 @@ public inline class DMatrixContext(public val context: LinearSpace DMatrix.dot( other: DMatrix, - ): DMatrix = context { this@dot dot other }.coerce() + ): DMatrix = context.run { this@dot dot other }.coerce() public inline infix fun DMatrix.dot(vector: DPoint): DPoint = - DPoint.coerceUnsafe(context { this@dot dot vector }) + DPoint.coerceUnsafe(context.run { this@dot dot vector }) public inline operator fun DMatrix.times(value: T): DMatrix = - context { this@times.times(value) }.coerce() + context.run { this@times.times(value) }.coerce() public inline operator fun T.times(m: DMatrix): DMatrix = m * this public inline operator fun DMatrix.plus(other: DMatrix): DMatrix = - context { this@plus + other }.coerce() + context.run { this@plus + other }.coerce() public inline operator fun DMatrix.minus(other: DMatrix): DMatrix = - context { this@minus + other }.coerce() + context.run { this@minus + other }.coerce() public inline operator fun DMatrix.unaryMinus(): DMatrix = - context { this@unaryMinus.unaryMinus() }.coerce() + context.run { this@unaryMinus.unaryMinus() }.coerce() public inline fun DMatrix.transpose(): DMatrix = - context { (this@transpose as Matrix).transpose() }.coerce() + context.run { (this@transpose as Matrix).transpose() }.coerce() public companion object { - public val real: DMatrixContext = DMatrixContext(LinearSpace.real) + public val real: DMatrixContext = DMatrixContext(LinearSpace.real) } } @@ -144,11 +147,11 @@ public inline class DMatrixContext(public val context: LinearSpace DMatrixContext.one(): DMatrix = produce { i, j -> +public inline fun DMatrixContext.one(): DMatrix = produce { i, j -> if (i == j) 1.0 else 0.0 } -public inline fun DMatrixContext.zero(): DMatrix = +public inline fun DMatrixContext.zero(): DMatrix = produce { _, _ -> 0.0 } \ No newline at end of file diff --git a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt index 339e06459..57ce977fd 100644 --- a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt +++ b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt @@ -44,7 +44,7 @@ public object EjmlLinearSpace : LinearSpace, ScaleOperations< override fun buildVector(size: Int, initializer: RealField.(Int) -> Double): Vector = EjmlVector(SimpleMatrix(size, 1).also { - (0 until it.numRows()).forEach { row -> it[row, 0] = initializer(row) } + (0 until it.numRows()).forEach { row -> it[row, 0] = RealField.initializer(row) } }) private fun SimpleMatrix.wrapMatrix() = EjmlMatrix(this) @@ -59,43 +59,34 @@ public object EjmlLinearSpace : LinearSpace, ScaleOperations< EjmlVector(toEjml().origin.mult(vector.toEjml().origin)) public override operator fun Matrix.minus(other: Matrix): EjmlMatrix = - EjmlMatrix(toEjml().origin - other.toEjml().origin) + (toEjml().origin - other.toEjml().origin).wrapMatrix() public override fun scale(a: Matrix, value: Double): EjmlMatrix = a.toEjml().origin.scale(value).wrapMatrix() public override operator fun Matrix.times(value: Double): EjmlMatrix = - EjmlMatrix(toEjml().origin.scale(value)) + toEjml().origin.scale(value).wrapMatrix() override fun Vector.unaryMinus(): EjmlVector = toEjml().origin.negative().wrapVector() - override fun Matrix.plus(other: Matrix): Matrix { - TODO("Not yet implemented") - } + override fun Matrix.plus(other: Matrix): EjmlMatrix = + (toEjml().origin + other.toEjml().origin).wrapMatrix() - override fun Vector.plus(other: Vector): Vector { - TODO("Not yet implemented") - } + override fun Vector.plus(other: Vector): EjmlVector = + (toEjml().origin + other.toEjml().origin).wrapVector() - override fun Vector.minus(other: Vector): Vector { - TODO("Not yet implemented") - } + override fun Vector.minus(other: Vector): EjmlVector = + (toEjml().origin - other.toEjml().origin).wrapVector() - override fun Double.times(m: Matrix): Matrix { - TODO("Not yet implemented") - } + override fun Double.times(m: Matrix): EjmlMatrix = + m.toEjml().origin.scale(this).wrapMatrix() - override fun Vector.times(value: Double): Vector { - TODO("Not yet implemented") - } + override fun Vector.times(value: Double): EjmlVector = + toEjml().origin.scale(value).wrapVector() - override fun Double.times(v: Vector): Vector { - TODO("Not yet implemented") - } - - public override fun add(a: Matrix, b: Matrix): EjmlMatrix = - EjmlMatrix(a.toEjml().origin + b.toEjml().origin) + override fun Double.times(v: Vector): EjmlVector = + v.toEjml().origin.scale(this).wrapVector() } /** diff --git a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealMatrix.kt b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealMatrix.kt index b93c430f9..640615cc9 100644 --- a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealMatrix.kt +++ b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealMatrix.kt @@ -2,6 +2,7 @@ package space.kscience.kmath.real import space.kscience.kmath.linear.* import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.operations.RealField import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.RealBuffer import space.kscience.kmath.structures.asIterable @@ -21,11 +22,11 @@ import kotlin.math.pow public typealias RealMatrix = Matrix -public fun realMatrix(rowNum: Int, colNum: Int, initializer: (i: Int, j: Int) -> Double): RealMatrix = +public fun realMatrix(rowNum: Int, colNum: Int, initializer: RealField.(i: Int, j: Int) -> Double): RealMatrix = LinearSpace.real.buildMatrix(rowNum, colNum, initializer) public fun Array.toMatrix(): RealMatrix { - return LinearSpace.real.buildMatrix(size, this[0].size) { row, col -> this[row][col] } + return LinearSpace.real.buildMatrix(size, this[0].size) { row, col -> this@toMatrix[row][col] } } public fun Sequence.toMatrix(): RealMatrix = toList().let { @@ -43,37 +44,37 @@ public fun RealMatrix.repeatStackVertical(n: Int): RealMatrix = public operator fun RealMatrix.times(double: Double): RealMatrix = LinearSpace.real.buildMatrix(rowNum, colNum) { row, col -> - this[row, col] * double + get(row, col) * double } public operator fun RealMatrix.plus(double: Double): RealMatrix = LinearSpace.real.buildMatrix(rowNum, colNum) { row, col -> - this[row, col] + double + get(row, col) + double } public operator fun RealMatrix.minus(double: Double): RealMatrix = LinearSpace.real.buildMatrix(rowNum, colNum) { row, col -> - this[row, col] - double + get(row, col) - double } public operator fun RealMatrix.div(double: Double): RealMatrix = LinearSpace.real.buildMatrix(rowNum, colNum) { row, col -> - this[row, col] / double + get(row, col) / double } public operator fun Double.times(matrix: RealMatrix): RealMatrix = LinearSpace.real.buildMatrix(matrix.rowNum, matrix.colNum) { row, col -> - this * matrix[row, col] + this@times * matrix[row, col] } public operator fun Double.plus(matrix: RealMatrix): RealMatrix = LinearSpace.real.buildMatrix(matrix.rowNum, matrix.colNum) { row, col -> - this + matrix[row, col] + this@plus + matrix[row, col] } public operator fun Double.minus(matrix: RealMatrix): RealMatrix = LinearSpace.real.buildMatrix(matrix.rowNum, matrix.colNum) { row, col -> - this - matrix[row, col] + this@minus - matrix[row, col] } // TODO: does this operation make sense? Should it be 'this/matrix[row, col]'? @@ -87,13 +88,13 @@ public operator fun Double.minus(matrix: RealMatrix): RealMatrix = @UnstableKMathAPI public operator fun RealMatrix.times(other: RealMatrix): RealMatrix = - LinearSpace.real.buildMatrix(rowNum, colNum) { row, col -> this[row, col] * other[row, col] } + LinearSpace.real.buildMatrix(rowNum, colNum) { row, col -> this@times[row, col] * other[row, col] } public operator fun RealMatrix.plus(other: RealMatrix): RealMatrix = - LinearSpace.real.add(this, other) + LinearSpace.real.run { this@plus + other } public operator fun RealMatrix.minus(other: RealMatrix): RealMatrix = - LinearSpace.real.buildMatrix(rowNum, colNum) { row, col -> this[row, col] - other[row, col] } + LinearSpace.real.buildMatrix(rowNum, colNum) { row, col -> this@minus[row, col] - other[row, col] } /* * Operations on columns @@ -102,14 +103,14 @@ public operator fun RealMatrix.minus(other: RealMatrix): RealMatrix = public inline fun RealMatrix.appendColumn(crossinline mapper: (Buffer) -> Double): RealMatrix = LinearSpace.real.buildMatrix(rowNum, colNum + 1) { row, col -> if (col < colNum) - this[row, col] + get(row, col) else mapper(rows[row]) } public fun RealMatrix.extractColumns(columnRange: IntRange): RealMatrix = LinearSpace.real.buildMatrix(rowNum, columnRange.count()) { row, col -> - this[row, columnRange.first + col] + this@extractColumns[row, columnRange.first + col] } public fun RealMatrix.extractColumn(columnIndex: Int): RealMatrix = diff --git a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/dot.kt b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/dot.kt index cbfb364c1..5a66b55bd 100644 --- a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/dot.kt +++ b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/dot.kt @@ -1,31 +1,31 @@ package space.kscience.kmath.real -import space.kscience.kmath.linear.BufferMatrix -import space.kscience.kmath.structures.Buffer -import space.kscience.kmath.structures.RealBuffer +import space.kscience.kmath.linear.LinearSpace +import space.kscience.kmath.nd.Matrix /** * Optimized dot product for real matrices */ -public infix fun BufferMatrix.dot(other: BufferMatrix): BufferMatrix { - require(colNum == other.rowNum) { "Matrix dot operation dimension mismatch: ($rowNum, $colNum) x (${other.rowNum}, ${other.colNum})" } - val resultArray = DoubleArray(this.rowNum * other.colNum) - - //convert to array to insure there is no memory indirection - fun Buffer.unsafeArray() = if (this is RealBuffer) - this.array - else - DoubleArray(size) { get(it) } - - val a = this.buffer.unsafeArray() - val b = other.buffer.unsafeArray() - - for (i in (0 until rowNum)) - for (j in (0 until other.colNum)) - for (k in (0 until colNum)) - resultArray[i * other.colNum + j] += a[i * colNum + k] * b[k * other.colNum + j] - - val buffer = RealBuffer(resultArray) - return BufferMatrix(rowNum, other.colNum, buffer) +public infix fun Matrix.dot(other: Matrix): Matrix = LinearSpace.real.run{ + this@dot dot other +// require(colNum == other.rowNum) { "Matrix dot operation dimension mismatch: ($rowNum, $colNum) x (${other.rowNum}, ${other.colNum})" } +// val resultArray = DoubleArray(this.rowNum * other.colNum) +// +// //convert to array to insure there is no memory indirection +// fun Buffer.unsafeArray() = if (this is RealBuffer) +// this.array +// else +// DoubleArray(size) { get(it) } +// +// val a = this.buffer.unsafeArray() +// val b = other.buffer.unsafeArray() +// +// for (i in (0 until rowNum)) +// for (j in (0 until other.colNum)) +// for (k in (0 until colNum)) +// resultArray[i * other.colNum + j] += a[i * colNum + k] * b[k * other.colNum + j] +// +// val buffer = RealBuffer(resultArray) +// return BufferMatrix(rowNum, other.colNum, buffer) } \ No newline at end of file From 5e6f65a181c1a04cf5b992ab350972cb41d6ac93 Mon Sep 17 00:00:00 2001 From: darksnake Date: Sat, 13 Mar 2021 18:19:10 +0300 Subject: [PATCH 121/150] WIP Matrix refactor --- .../kmath/structures/typeSafeDimensions.kt | 4 +- .../kscience/kmath/commons/linear/CMMatrix.kt | 4 +- .../kscience/kmath/commons/linear/CMSolver.kt | 4 +- .../kscience/kmath/linear/MatrixBuilder.kt | 25 ++++++++++-- .../space/kscience/kmath/linear/MatrixTest.kt | 2 +- .../kscience/kmath/linear/RealLUSolverTest.kt | 14 +++---- .../kmath/structures/NumberNDFieldTest.kt | 5 ++- .../kotlin/space/kscience/kmath/real/dot.kt | 19 ---------- .../kaceince/kmath/real/RealMatrixTest.kt | 38 +++++++++---------- .../kaceince/kmath/real/RealVectorTest.kt | 4 +- 10 files changed, 60 insertions(+), 59 deletions(-) diff --git a/examples/src/main/kotlin/space/kscience/kmath/structures/typeSafeDimensions.kt b/examples/src/main/kotlin/space/kscience/kmath/structures/typeSafeDimensions.kt index fdd631238..d2d130ab4 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/structures/typeSafeDimensions.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/structures/typeSafeDimensions.kt @@ -5,7 +5,7 @@ import space.kscience.kmath.dimensions.D3 import space.kscience.kmath.dimensions.DMatrixContext import space.kscience.kmath.dimensions.Dimension -private fun DMatrixContext.simple() { +private fun DMatrixContext.simple() { val m1 = produce { i, j -> (i + j).toDouble() } val m2 = produce { i, j -> (i + j).toDouble() } @@ -17,7 +17,7 @@ private object D5 : Dimension { override val dim: UInt = 5u } -private fun DMatrixContext.custom() { +private fun DMatrixContext.custom() { val m1 = produce { i, j -> (i + j).toDouble() } val m2 = produce { i, j -> (i - j).toDouble() } val m3 = produce { i, j -> (i - j).toDouble() } diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt index c1c3d716a..b462a1a36 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt @@ -99,8 +99,8 @@ public object CMLinearSpace : LinearSpace { ArrayRealVector(array).wrap() } - private fun RealMatrix.wrap(): CMMatrix = CMMatrix(this) - private fun RealVector.wrap(): CMVector = CMVector(this) + internal fun RealMatrix.wrap(): CMMatrix = CMMatrix(this) + internal fun RealVector.wrap(): CMVector = CMVector(this) override fun buildVector(size: Int, initializer: RealField.(Int) -> Double): Vector = ArrayRealVector(DoubleArray(size) { RealField.initializer(it) }).wrap() diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMSolver.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMSolver.kt index ff4727aa2..b5fd0154e 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMSolver.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMSolver.kt @@ -27,7 +27,7 @@ public fun CMLinearSpace.solve( a: Matrix, b: Matrix, decomposition: CMDecomposition = CMDecomposition.LUP -): CMMatrix = solver(a, decomposition).solve(b.toCM().origin).asMatrix() +): CMMatrix = solver(a, decomposition).solve(b.toCM().origin).wrap() public fun CMLinearSpace.solve( a: Matrix, @@ -38,4 +38,4 @@ public fun CMLinearSpace.solve( public fun CMLinearSpace.inverse( a: Matrix, decomposition: CMDecomposition = CMDecomposition.LUP -): CMMatrix = solver(a, decomposition).inverse.asMatrix() +): CMMatrix = solver(a, decomposition).inverse.wrap() diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixBuilder.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixBuilder.kt index 28df78dad..6814cb561 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixBuilder.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixBuilder.kt @@ -3,11 +3,30 @@ package space.kscience.kmath.linear import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.operations.Ring +public class MatrixBuilder>( + public val linearSpace: LinearSpace, + public val rows: Int, + public val columns: Int, +) { + public operator fun invoke(vararg elements: T): Matrix { + require(rows * columns == elements.size) { "The number of elements ${elements.size} is not equal $rows * $columns" } + return linearSpace.buildMatrix(rows, columns) { i, j -> elements[i * columns + j] } + } + + //TODO add specific matrix builder functions like diagonal, etc +} @UnstableKMathAPI -public fun LinearSpace>.matrix(rows: Int, columns: Int, vararg elements: T): Matrix { - require(rows * columns == elements.size) { "The number of elements ${elements.size} is not equal $rows * $columns" } - return buildMatrix(rows, columns) { i, j -> elements[i * columns + j] } +public fun > LinearSpace.matrix(rows: Int, columns: Int): MatrixBuilder = + MatrixBuilder(this, rows, columns) + +/** + * Build a square matrix from given elements. + */ +@UnstableKMathAPI +public fun LinearSpace>.square(vararg elements: T): Matrix { + val size: Int = kotlin.math.sqrt(elements.size.toDouble()).toInt() + return matrix(size,size)(*elements) } @UnstableKMathAPI diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt index 27374e93f..53cdd4522 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt @@ -38,7 +38,7 @@ class MatrixTest { infix fun Matrix.pow(power: Int): Matrix { var res = this repeat(power - 1) { - res = RealLinearSpace.invoke { res dot this@pow } + res = LinearSpace.real.run { res dot this@pow } } return res } diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt index 4d6b8f5be..802849a1e 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt @@ -14,12 +14,12 @@ class RealLUSolverTest { @Test fun testDecomposition() { - val matrix = Matrix.square( - 3.0, 1.0, - 1.0, 3.0 - ) - LinearSpace.real.run { + val matrix = square( + 3.0, 1.0, + 1.0, 3.0 + ) + val lup = lup(matrix) //Check determinant @@ -31,14 +31,14 @@ class RealLUSolverTest { @Test fun testInvert() { - val matrix = Matrix.square( + val matrix = LinearSpace.real.square( 3.0, 1.0, 1.0, 3.0 ) val inverted = LinearSpace.real.inverseWithLup(matrix) - val expected = Matrix.square( + val expected = LinearSpace.real.square( 0.375, -0.125, -0.125, 0.375 ) diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/structures/NumberNDFieldTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/structures/NumberNDFieldTest.kt index 23b0e7348..dd7871f9a 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/structures/NumberNDFieldTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/structures/NumberNDFieldTest.kt @@ -1,5 +1,6 @@ package space.kscience.kmath.structures +import space.kscience.kmath.linear.LinearSpace import space.kscience.kmath.nd.* import space.kscience.kmath.operations.Norm import space.kscience.kmath.operations.invoke @@ -33,7 +34,9 @@ class NumberNDFieldTest { @Test fun testGeneration() { - val array = Structure2D.real(3, 3) { i, j -> (i * 10 + j).toDouble() } + val array = LinearSpace.real.buildMatrix(3, 3) { i, j -> + (i * 10 + j).toDouble() + } for (i in 0..2) { for (j in 0..2) { diff --git a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/dot.kt b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/dot.kt index 5a66b55bd..1a7c1213c 100644 --- a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/dot.kt +++ b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/dot.kt @@ -9,23 +9,4 @@ import space.kscience.kmath.nd.Matrix */ public infix fun Matrix.dot(other: Matrix): Matrix = LinearSpace.real.run{ this@dot dot other -// require(colNum == other.rowNum) { "Matrix dot operation dimension mismatch: ($rowNum, $colNum) x (${other.rowNum}, ${other.colNum})" } -// val resultArray = DoubleArray(this.rowNum * other.colNum) -// -// //convert to array to insure there is no memory indirection -// fun Buffer.unsafeArray() = if (this is RealBuffer) -// this.array -// else -// DoubleArray(size) { get(it) } -// -// val a = this.buffer.unsafeArray() -// val b = other.buffer.unsafeArray() -// -// for (i in (0 until rowNum)) -// for (j in (0 until other.colNum)) -// for (k in (0 until colNum)) -// resultArray[i * other.colNum + j] += a[i * colNum + k] * b[k * other.colNum + j] -// -// val buffer = RealBuffer(resultArray) -// return BufferMatrix(rowNum, other.colNum, buffer) } \ No newline at end of file diff --git a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealMatrixTest.kt b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealMatrixTest.kt index 9e2778be9..6ab11b03b 100644 --- a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealMatrixTest.kt +++ b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealMatrixTest.kt @@ -1,7 +1,7 @@ package kaceince.kmath.real -import space.kscience.kmath.linear.Matrix -import space.kscience.kmath.linear.build +import space.kscience.kmath.linear.LinearSpace +import space.kscience.kmath.linear.matrix import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.real.* import space.kscience.kmath.structures.contentEquals @@ -30,11 +30,11 @@ internal class RealMatrixTest { @Test fun testRepeatStackVertical() { - val matrix1 = Matrix.build(2, 3)( + val matrix1 = LinearSpace.real.matrix(2, 3)( 1.0, 0.0, 0.0, 0.0, 1.0, 2.0 ) - val matrix2 = Matrix.build(6, 3)( + val matrix2 = LinearSpace.real.matrix(6, 3)( 1.0, 0.0, 0.0, 0.0, 1.0, 2.0, 1.0, 0.0, 0.0, @@ -47,12 +47,12 @@ internal class RealMatrixTest { @Test fun testMatrixAndDouble() { - val matrix1 = Matrix.build(2, 3)( + val matrix1 = LinearSpace.real.matrix(2, 3)( 1.0, 0.0, 3.0, 4.0, 6.0, 2.0 ) val matrix2 = (matrix1 * 2.5 + 1.0 - 2.0) / 2.0 - val expectedResult = Matrix.build(2, 3)( + val expectedResult = LinearSpace.real.matrix(2, 3)( 0.75, -0.5, 3.25, 4.5, 7.0, 2.0 ) @@ -61,13 +61,13 @@ internal class RealMatrixTest { @Test fun testDoubleAndMatrix() { - val matrix1 = Matrix.build(2, 3)( + val matrix1 = LinearSpace.real.matrix(2, 3)( 1.0, 0.0, 3.0, 4.0, 6.0, 2.0 ) val matrix2 = 20.0 - (10.0 + (5.0 * matrix1)) //val matrix2 = 10.0 + (5.0 * matrix1) - val expectedResult = Matrix.build(2, 3)( + val expectedResult = LinearSpace.real.matrix(2, 3)( 5.0, 10.0, -5.0, -10.0, -20.0, 0.0 ) @@ -76,15 +76,15 @@ internal class RealMatrixTest { @Test fun testSquareAndPower() { - val matrix1 = Matrix.build(2, 3)( + val matrix1 = LinearSpace.real.matrix(2, 3)( -1.0, 0.0, 3.0, 4.0, -6.0, -2.0 ) - val matrix2 = Matrix.build(2, 3)( + val matrix2 = LinearSpace.real.matrix(2, 3)( 1.0, 0.0, 9.0, 16.0, 36.0, 4.0 ) - val matrix3 = Matrix.build(2, 3)( + val matrix3 = LinearSpace.real.matrix(2, 3)( -1.0, 0.0, 27.0, 64.0, -216.0, -8.0 ) @@ -95,16 +95,16 @@ internal class RealMatrixTest { @OptIn(UnstableKMathAPI::class) @Test fun testTwoMatrixOperations() { - val matrix1 = Matrix.build(2, 3)( + val matrix1 = LinearSpace.real.matrix(2, 3)( -1.0, 0.0, 3.0, 4.0, -6.0, 7.0 ) - val matrix2 = Matrix.build(2, 3)( + val matrix2 = LinearSpace.real.matrix(2, 3)( 1.0, 0.0, 3.0, 4.0, 6.0, -2.0 ) val result = matrix1 * matrix2 + matrix1 - matrix2 - val expectedResult = Matrix.build(2, 3)( + val expectedResult = LinearSpace.real.matrix(2, 3)( -3.0, 0.0, 9.0, 16.0, -48.0, -5.0 ) @@ -113,16 +113,16 @@ internal class RealMatrixTest { @Test fun testColumnOperations() { - val matrix1 = Matrix.build(2, 4)( + val matrix1 = LinearSpace.real.matrix(2, 4)( -1.0, 0.0, 3.0, 15.0, 4.0, -6.0, 7.0, -11.0 ) - val matrix2 = Matrix.build(2, 5)( + val matrix2 = LinearSpace.real.matrix(2, 5)( -1.0, 0.0, 3.0, 15.0, -1.0, 4.0, -6.0, 7.0, -11.0, 4.0 ) - val col1 = Matrix.build(2, 1)(0.0, -6.0) - val cols1to2 = Matrix.build(2, 2)( + val col1 = LinearSpace.real.matrix(2, 1)(0.0, -6.0) + val cols1to2 = LinearSpace.real.matrix(2, 2)( 0.0, 3.0, -6.0, 7.0 ) @@ -147,7 +147,7 @@ internal class RealMatrixTest { @Test fun testAllElementOperations() { - val matrix1 = Matrix.build(2, 4)( + val matrix1 = LinearSpace.real.matrix(2, 4)( -1.0, 0.0, 3.0, 15.0, 4.0, -6.0, 7.0, -11.0 ) diff --git a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealVectorTest.kt b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealVectorTest.kt index 5d032de67..59d55110f 100644 --- a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealVectorTest.kt +++ b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealVectorTest.kt @@ -2,9 +2,7 @@ package kaceince.kmath.real import space.kscience.kmath.linear.LinearSpace import space.kscience.kmath.linear.asMatrix -import space.kscience.kmath.linear.real import space.kscience.kmath.linear.transpose -import space.kscience.kmath.operations.invoke import space.kscience.kmath.real.plus import space.kscience.kmath.structures.Buffer import kotlin.test.Test @@ -32,7 +30,7 @@ internal class RealVectorTest { val vector2 = Buffer.real(5) { 5 - it.toDouble() } val matrix1 = vector1.asMatrix() val matrix2 = vector2.asMatrix().transpose() - val product = LinearSpace.real { matrix1 dot matrix2 } + val product = LinearSpace.real.run { matrix1 dot matrix2 } assertEquals(5.0, product[1, 0]) assertEquals(6.0, product[2, 2]) } From be9398b3226bebf2a5afbd561c6b5fb816fbde9e Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sat, 13 Mar 2021 21:22:18 +0300 Subject: [PATCH 122/150] Vector space refactor --- kmath-core/api/kmath-core.api | 327 ++++-------------- .../kscience/kmath/linear/MatrixBuilder.kt | 12 +- .../kscience/kmath/linear/VirtualMatrix.kt | 10 +- .../space/kscience/kmath/nd/Structure2D.kt | 11 +- .../space/kscience/kmath/linear/MatrixTest.kt | 2 + .../kscience/kmath/linear/RealLUSolverTest.kt | 8 +- .../space/kscience/kmath/real/RealMatrix.kt | 4 + .../kaceince/kmath/real/RealMatrixTest.kt | 31 +- 8 files changed, 105 insertions(+), 300 deletions(-) diff --git a/kmath-core/api/kmath-core.api b/kmath-core/api/kmath-core.api index 8b30e4c05..c1f8d5ec5 100644 --- a/kmath-core/api/kmath-core.api +++ b/kmath-core/api/kmath-core.api @@ -432,108 +432,6 @@ public final class space/kscience/kmath/expressions/SymbolIndexerKt { public static final fun withSymbols ([Lspace/kscience/kmath/expressions/Symbol;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; } -public final class space/kscience/kmath/linear/BufferMatrix : space/kscience/kmath/nd/Structure2D { - public fun (IILspace/kscience/kmath/structures/Buffer;)V - public fun elements ()Lkotlin/sequences/Sequence; - public fun equals (Ljava/lang/Object;)Z - public fun get (II)Ljava/lang/Object; - public fun get ([I)Ljava/lang/Object; - public final fun getBuffer ()Lspace/kscience/kmath/structures/Buffer; - public fun getColNum ()I - public fun getColumns ()Lspace/kscience/kmath/structures/Buffer; - public fun getDimension ()I - public fun getRowNum ()I - public fun getRows ()Lspace/kscience/kmath/structures/Buffer; - public fun getShape ()[I - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class space/kscience/kmath/linear/BufferMatrixContext : space/kscience/kmath/linear/GenericMatrixContext { - public static final field Companion Lspace/kscience/kmath/linear/BufferMatrixContext$Companion; - public fun (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V - public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; - public synthetic fun add (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; - public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/nd/Structure2D; - public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun div (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; - public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; - public synthetic fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public fun getElementContext ()Lspace/kscience/kmath/operations/Ring; - public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; - public synthetic fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public final fun one (II)Lspace/kscience/kmath/nd/Structure2D; - public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public fun point (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; - public fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferMatrix; - public synthetic fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/Structure2D; - public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; - public fun scale (Lspace/kscience/kmath/nd/Structure2D;D)Lspace/kscience/kmath/nd/Structure2D; - public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; - public synthetic fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; - public fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/linear/BufferMatrix; - public synthetic fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; - public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; - public synthetic fun unaryMinus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; -} - -public final class space/kscience/kmath/linear/BufferMatrixContext$Companion { -} - -public final class space/kscience/kmath/linear/BufferVectorSpace : space/kscience/kmath/linear/VectorSpace { - public fun (ILspace/kscience/kmath/operations/Group;Lkotlin/jvm/functions/Function2;)V - public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; - public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun div (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; - public fun getAlgebra ()Lspace/kscience/kmath/operations/Group; - public final fun getBufferFactory ()Lkotlin/jvm/functions/Function2; - public fun getSize ()I - public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lspace/kscience/kmath/structures/Buffer; - public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; - public fun scale (Lspace/kscience/kmath/structures/Buffer;D)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun times (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; -} - public abstract interface class space/kscience/kmath/linear/CholeskyDecompositionFeature : space/kscience/kmath/linear/MatrixFeature { public abstract fun getL ()Lspace/kscience/kmath/nd/Structure2D; } @@ -549,37 +447,6 @@ public abstract interface class space/kscience/kmath/linear/DiagonalFeature : sp public final class space/kscience/kmath/linear/DiagonalFeature$Companion : space/kscience/kmath/linear/DiagonalFeature { } -public abstract interface class space/kscience/kmath/linear/GenericMatrixContext : space/kscience/kmath/linear/MatrixContext { - public abstract fun add (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public abstract fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public abstract fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public abstract fun getElementContext ()Lspace/kscience/kmath/operations/Ring; - public abstract fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public abstract fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; - public abstract fun unaryMinus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; -} - -public final class space/kscience/kmath/linear/GenericMatrixContext$DefaultImpls { - public static fun add (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public static fun binaryOperation (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public static fun binaryOperationFunction (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun bindSymbol (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lspace/kscience/kmath/nd/Structure2D; - public static fun div (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; - public static fun dot (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public static fun dot (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public static fun minus (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public static fun plus (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public static fun point (Lspace/kscience/kmath/linear/GenericMatrixContext;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; - public static fun times (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/Number;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public static fun times (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public static fun times (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; - public static fun times (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; - public static fun unaryMinus (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public static fun unaryOperation (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public static fun unaryOperationFunction (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lspace/kscience/kmath/linear/GenericMatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; -} - public abstract interface class space/kscience/kmath/linear/InverseMatrixFeature : space/kscience/kmath/linear/MatrixFeature { public abstract fun getInverse ()Lspace/kscience/kmath/nd/Structure2D; } @@ -590,7 +457,7 @@ public final class space/kscience/kmath/linear/LFeature : space/kscience/kmath/l public final class space/kscience/kmath/linear/LinearAlgebraKt { public static final fun asMatrix (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/linear/VirtualMatrix; - public static final fun asPoint (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/structures/Buffer; + public static final fun asVector (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/structures/Buffer; } public abstract interface class space/kscience/kmath/linear/LinearSolver { @@ -603,9 +470,50 @@ public final class space/kscience/kmath/linear/LinearSolver$DefaultImpls { public static fun solve (Lspace/kscience/kmath/linear/LinearSolver;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; } +public abstract interface class space/kscience/kmath/linear/LinearSpace { + public static final field Companion Lspace/kscience/kmath/linear/LinearSpace$Companion; + public abstract fun buildMatrix (IILkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun buildVector (ILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; + public abstract fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public abstract fun getElementAlgebra ()Lspace/kscience/kmath/operations/Ring; + public abstract fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun minus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public abstract fun plus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun plus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public abstract fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun times (Ljava/lang/Object;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public abstract fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun times (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Object;)Lspace/kscience/kmath/structures/Buffer; + public abstract fun unaryMinus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public abstract fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; +} + +public final class space/kscience/kmath/linear/LinearSpace$Companion { + public final fun buffered (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/LinearSpace; + public static synthetic fun buffered$default (Lspace/kscience/kmath/linear/LinearSpace$Companion;Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lspace/kscience/kmath/linear/LinearSpace; + public final fun getReal ()Lspace/kscience/kmath/linear/LinearSpace; +} + +public final class space/kscience/kmath/linear/LinearSpace$DefaultImpls { + public static fun buildVector (Lspace/kscience/kmath/linear/LinearSpace;ILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; + public static fun dot (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun dot (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun minus (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun minus (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun plus (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun plus (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun times (Lspace/kscience/kmath/linear/LinearSpace;Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun times (Lspace/kscience/kmath/linear/LinearSpace;Ljava/lang/Object;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public static fun times (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; + public static fun times (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Object;)Lspace/kscience/kmath/structures/Buffer; + public static fun unaryMinus (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static fun unaryMinus (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; +} + public final class space/kscience/kmath/linear/LupDecomposition : space/kscience/kmath/linear/DeterminantFeature, space/kscience/kmath/linear/LupDecompositionFeature { - public fun (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/operations/Field;Lspace/kscience/kmath/nd/Structure2D;[IZ)V - public final fun getContext ()Lspace/kscience/kmath/linear/MatrixContext; + public fun (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/operations/Field;Lspace/kscience/kmath/nd/Structure2D;[IZ)V + public final fun getContext ()Lspace/kscience/kmath/linear/LinearSpace; public fun getDeterminant ()Ljava/lang/Object; public final fun getElementContext ()Lspace/kscience/kmath/operations/Field; public fun getL ()Lspace/kscience/kmath/nd/Structure2D; @@ -622,57 +530,27 @@ public abstract interface class space/kscience/kmath/linear/LupDecompositionFeat } public final class space/kscience/kmath/linear/LupDecompositionKt { - public static final fun abs (Lspace/kscience/kmath/linear/GenericMatrixContext;Ljava/lang/Comparable;)Ljava/lang/Comparable; - public static final fun inverseWithLup (Lspace/kscience/kmath/linear/RealMatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public static final fun lup (Lspace/kscience/kmath/linear/MatrixContext;Lkotlin/jvm/functions/Function2;Lspace/kscience/kmath/operations/Field;Lspace/kscience/kmath/nd/Structure2D;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/linear/LupDecomposition; - public static final fun lup (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/LupDecomposition; + public static final fun abs (Lspace/kscience/kmath/linear/LinearSpace;Ljava/lang/Comparable;)Ljava/lang/Comparable; + public static final fun inverseWithLup (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static final fun lup (Lspace/kscience/kmath/linear/LinearSpace;Lkotlin/jvm/functions/Function2;Lspace/kscience/kmath/nd/Structure2D;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/linear/LupDecomposition; + public static final fun lup (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/LupDecomposition; + public static final fun solveWithLup (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public static final fun solveWithLup (Lspace/kscience/kmath/linear/LupDecomposition;Lkotlin/jvm/functions/Function2;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public static final fun solveWithLup (Lspace/kscience/kmath/linear/RealMatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; } public final class space/kscience/kmath/linear/MatrixBuilder { - public fun (II)V + public fun (Lspace/kscience/kmath/linear/LinearSpace;II)V public final fun getColumns ()I + public final fun getLinearSpace ()Lspace/kscience/kmath/linear/LinearSpace; public final fun getRows ()I public final fun invoke ([Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; } public final class space/kscience/kmath/linear/MatrixBuilderKt { - public static final fun build (Lspace/kscience/kmath/nd/Structure2D$Companion;II)Lspace/kscience/kmath/linear/MatrixBuilder; - public static final fun column (Lspace/kscience/kmath/nd/Structure2D$Companion;[Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; - public static final fun row (Lspace/kscience/kmath/nd/Structure2D$Companion;[Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; -} - -public abstract interface class space/kscience/kmath/linear/MatrixContext : space/kscience/kmath/operations/GroupOperations, space/kscience/kmath/operations/ScaleOperations { - public static final field Companion Lspace/kscience/kmath/linear/MatrixContext$Companion; - public abstract fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public abstract fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public abstract fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public abstract fun point (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; - public abstract fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/Structure2D; - public abstract fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public abstract fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; -} - -public final class space/kscience/kmath/linear/MatrixContext$Companion { - public final fun buffered (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/GenericMatrixContext; - public static synthetic fun buffered$default (Lspace/kscience/kmath/linear/MatrixContext$Companion;Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lspace/kscience/kmath/linear/GenericMatrixContext; -} - -public final class space/kscience/kmath/linear/MatrixContext$DefaultImpls { - public static fun binaryOperation (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public static fun binaryOperationFunction (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun bindSymbol (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lspace/kscience/kmath/nd/Structure2D; - public static fun div (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; - public static fun minus (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public static fun plus (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public static fun point (Lspace/kscience/kmath/linear/MatrixContext;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; - public static fun times (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/Number;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public static fun times (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public static fun times (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; - public static fun unaryOperation (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public static fun unaryOperationFunction (Lspace/kscience/kmath/linear/MatrixContext;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lspace/kscience/kmath/linear/MatrixContext;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public static final fun column (Lspace/kscience/kmath/linear/LinearSpace;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/Structure2D; + public static final fun column (Lspace/kscience/kmath/linear/LinearSpace;[Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; + public static final fun row (Lspace/kscience/kmath/linear/LinearSpace;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/Structure2D; + public static final fun row (Lspace/kscience/kmath/linear/LinearSpace;[Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; } public abstract interface class space/kscience/kmath/linear/MatrixFeature { @@ -701,12 +579,11 @@ public final class space/kscience/kmath/linear/MatrixWrapper : space/kscience/km public final class space/kscience/kmath/linear/MatrixWrapperKt { public static final fun getOrigin (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public static final fun one (Lspace/kscience/kmath/linear/GenericMatrixContext;II)Lspace/kscience/kmath/nd/Structure2D; + public static final fun one (Lspace/kscience/kmath/linear/LinearSpace;II)Lspace/kscience/kmath/nd/Structure2D; public static final fun plus (Lspace/kscience/kmath/nd/Structure2D;Ljava/util/Collection;)Lspace/kscience/kmath/linear/MatrixWrapper; public static final fun plus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/linear/MatrixFeature;)Lspace/kscience/kmath/linear/MatrixWrapper; - public static final fun square (Lspace/kscience/kmath/nd/Structure2D$Companion;[Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; public static final fun transpose (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public static final fun zero (Lspace/kscience/kmath/linear/GenericMatrixContext;II)Lspace/kscience/kmath/nd/Structure2D; + public static final fun zero (Lspace/kscience/kmath/linear/LinearSpace;II)Lspace/kscience/kmath/nd/Structure2D; } public final class space/kscience/kmath/linear/OrthogonalFeature : space/kscience/kmath/linear/MatrixFeature { @@ -718,52 +595,6 @@ public abstract interface class space/kscience/kmath/linear/QRDecompositionFeatu public abstract fun getR ()Lspace/kscience/kmath/nd/Structure2D; } -public final class space/kscience/kmath/linear/RealMatrixContext : space/kscience/kmath/linear/MatrixContext, space/kscience/kmath/operations/ScaleOperations { - public static final field INSTANCE Lspace/kscience/kmath/linear/RealMatrixContext; - public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; - public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; - public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/nd/Structure2D; - public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun div (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; - public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; - public synthetic fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public final fun one (II)Lspace/kscience/kmath/nd/Structure2D; - public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public fun point (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; - public fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferMatrix; - public synthetic fun produce (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/Structure2D; - public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; - public fun scale (Lspace/kscience/kmath/nd/Structure2D;D)Lspace/kscience/kmath/linear/BufferMatrix; - public fun times (DLspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; - public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public synthetic fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public fun times (Lspace/kscience/kmath/nd/Structure2D;D)Lspace/kscience/kmath/linear/BufferMatrix; - public fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Number;)Lspace/kscience/kmath/nd/Structure2D; - public synthetic fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; - public final fun toBufferMatrix (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/linear/BufferMatrix; - public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; -} - -public final class space/kscience/kmath/linear/RealMatrixContextKt { - public static final fun getReal (Lspace/kscience/kmath/linear/MatrixContext$Companion;)Lspace/kscience/kmath/linear/RealMatrixContext; -} - public abstract interface class space/kscience/kmath/linear/SingularValueDecompositionFeature : space/kscience/kmath/linear/MatrixFeature { public abstract fun getS ()Lspace/kscience/kmath/nd/Structure2D; public abstract fun getSingularValues ()Lspace/kscience/kmath/structures/Buffer; @@ -784,41 +615,6 @@ public final class space/kscience/kmath/linear/UnitFeature : space/kscience/kmat public static final field INSTANCE Lspace/kscience/kmath/linear/UnitFeature; } -public abstract interface class space/kscience/kmath/linear/VectorSpace : space/kscience/kmath/operations/Group, space/kscience/kmath/operations/ScaleOperations { - public static final field Companion Lspace/kscience/kmath/linear/VectorSpace$Companion; - public abstract fun add (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public abstract fun getAlgebra ()Lspace/kscience/kmath/operations/Group; - public abstract fun getSize ()I - public abstract fun getZero ()Lspace/kscience/kmath/structures/Buffer; - public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; - public abstract fun scale (Lspace/kscience/kmath/structures/Buffer;D)Lspace/kscience/kmath/structures/Buffer; - public abstract fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; -} - -public final class space/kscience/kmath/linear/VectorSpace$Companion { - public final fun buffered (ILspace/kscience/kmath/operations/Group;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferVectorSpace; - public static synthetic fun buffered$default (Lspace/kscience/kmath/linear/VectorSpace$Companion;ILspace/kscience/kmath/operations/Group;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lspace/kscience/kmath/linear/BufferVectorSpace; - public final fun real (I)Lspace/kscience/kmath/linear/BufferVectorSpace; -} - -public final class space/kscience/kmath/linear/VectorSpace$DefaultImpls { - public static fun add (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public static fun binaryOperation (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public static fun binaryOperationFunction (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun bindSymbol (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lspace/kscience/kmath/structures/Buffer; - public static fun div (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; - public static fun getZero (Lspace/kscience/kmath/linear/VectorSpace;)Lspace/kscience/kmath/structures/Buffer; - public static fun minus (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public static fun plus (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public static fun scale (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;D)Lspace/kscience/kmath/structures/Buffer; - public static fun times (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public static fun times (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; - public static fun unaryMinus (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public static fun unaryOperation (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public static fun unaryOperationFunction (Lspace/kscience/kmath/linear/VectorSpace;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lspace/kscience/kmath/linear/VectorSpace;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; -} - public final class space/kscience/kmath/linear/VirtualMatrix : space/kscience/kmath/nd/Structure2D { public fun (IILkotlin/jvm/functions/Function2;)V public fun elements ()Lkotlin/sequences/Sequence; @@ -1147,10 +943,10 @@ public abstract interface class space/kscience/kmath/nd/NDStructure { public final class space/kscience/kmath/nd/NDStructure$Companion { public final fun auto (Lkotlin/reflect/KClass;Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; public final fun auto (Lkotlin/reflect/KClass;[ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; - public final fun build (Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; - public final fun build ([ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; - public static synthetic fun build$default (Lspace/kscience/kmath/nd/NDStructure$Companion;Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/kmath/nd/NDBuffer; - public static synthetic fun build$default (Lspace/kscience/kmath/nd/NDStructure$Companion;[ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/kmath/nd/NDBuffer; + public final fun buffered (Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; + public final fun buffered ([ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; + public static synthetic fun buffered$default (Lspace/kscience/kmath/nd/NDStructure$Companion;Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/kmath/nd/NDBuffer; + public static synthetic fun buffered$default (Lspace/kscience/kmath/nd/NDStructure$Companion;[ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/kmath/nd/NDBuffer; public final fun contentEquals (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Z } @@ -1314,7 +1110,6 @@ public abstract interface class space/kscience/kmath/nd/Structure2D : space/ksci } public final class space/kscience/kmath/nd/Structure2D$Companion { - public final fun real (IILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/linear/BufferMatrix; } public final class space/kscience/kmath/nd/Structure2D$DefaultImpls { diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixBuilder.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixBuilder.kt index 6814cb561..0a7f280bc 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixBuilder.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixBuilder.kt @@ -16,19 +16,13 @@ public class MatrixBuilder>( //TODO add specific matrix builder functions like diagonal, etc } +/** + * Create a matrix builder with given number of rows and columns + */ @UnstableKMathAPI public fun > LinearSpace.matrix(rows: Int, columns: Int): MatrixBuilder = MatrixBuilder(this, rows, columns) -/** - * Build a square matrix from given elements. - */ -@UnstableKMathAPI -public fun LinearSpace>.square(vararg elements: T): Matrix { - val size: Int = kotlin.math.sqrt(elements.size.toDouble()).toInt() - return matrix(size,size)(*elements) -} - @UnstableKMathAPI public fun LinearSpace>.vector(vararg elements: T): Vector { return buildVector(elements.size) { elements[it] } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VirtualMatrix.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VirtualMatrix.kt index 11699ce2f..7f0451946 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VirtualMatrix.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VirtualMatrix.kt @@ -1,5 +1,7 @@ package space.kscience.kmath.linear +import space.kscience.kmath.nd.NDStructure + /** * The matrix where each element is evaluated each time when is being accessed. * @@ -17,12 +19,8 @@ public class VirtualMatrix( override fun equals(other: Any?): Boolean { if (this === other) return true - if (other !is Matrix<*>) return false - - if (rowNum != other.rowNum) return false - if (colNum != other.colNum) return false - - return elements().all { (index, value) -> value == other[index] } + if (other !is NDStructure<*>) return false + return NDStructure.contentEquals(this, other) } override fun hashCode(): Int { diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt index 0098eeb3b..09c830646 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt @@ -1,7 +1,9 @@ package space.kscience.kmath.nd +import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.VirtualBuffer +import kotlin.reflect.KClass /** * A structure that is guaranteed to be two-dimensional. @@ -58,7 +60,7 @@ public interface Structure2D : NDStructure { /** * A 2D wrapper for nd-structure */ -private inline class Structure2DWrapper(val structure: NDStructure) : Structure2D { +private class Structure2DWrapper(val structure: NDStructure) : Structure2D { override val shape: IntArray get() = structure.shape override val rowNum: Int get() = shape[0] @@ -66,7 +68,14 @@ private inline class Structure2DWrapper(val structure: NDStructure) : Stru override operator fun get(i: Int, j: Int): T = structure[i, j] + @UnstableKMathAPI + override fun getFeature(type: KClass): F? = structure.getFeature(type) + override fun elements(): Sequence> = structure.elements() + + override fun equals(other: Any?): Boolean = structure == other + + override fun hashCode(): Int = structure.hashCode() } /** diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt index 53cdd4522..097703f49 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt @@ -1,10 +1,12 @@ package space.kscience.kmath.linear +import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.nd.NDStructure import space.kscience.kmath.nd.as2D import kotlin.test.Test import kotlin.test.assertEquals +@UnstableKMathAPI @Suppress("UNUSED_VARIABLE") class MatrixTest { @Test diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt index 802849a1e..704f91998 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt @@ -1,8 +1,10 @@ package space.kscience.kmath.linear +import space.kscience.kmath.misc.UnstableKMathAPI import kotlin.test.Test import kotlin.test.assertEquals +@UnstableKMathAPI class RealLUSolverTest { @Test @@ -15,7 +17,7 @@ class RealLUSolverTest { @Test fun testDecomposition() { LinearSpace.real.run { - val matrix = square( + val matrix = matrix(2,2)( 3.0, 1.0, 1.0, 3.0 ) @@ -31,14 +33,14 @@ class RealLUSolverTest { @Test fun testInvert() { - val matrix = LinearSpace.real.square( + val matrix = LinearSpace.real.matrix(2,2)( 3.0, 1.0, 1.0, 3.0 ) val inverted = LinearSpace.real.inverseWithLup(matrix) - val expected = LinearSpace.real.square( + val expected = LinearSpace.real.matrix(2,2)( 0.375, -0.125, -0.125, 0.375 ) diff --git a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealMatrix.kt b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealMatrix.kt index 640615cc9..76c73ab16 100644 --- a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealMatrix.kt +++ b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealMatrix.kt @@ -25,6 +25,10 @@ public typealias RealMatrix = Matrix public fun realMatrix(rowNum: Int, colNum: Int, initializer: RealField.(i: Int, j: Int) -> Double): RealMatrix = LinearSpace.real.buildMatrix(rowNum, colNum, initializer) +@OptIn(UnstableKMathAPI::class) +public fun realMatrix(rowNum: Int, colNum: Int): MatrixBuilder = + LinearSpace.real.matrix(rowNum, colNum) + public fun Array.toMatrix(): RealMatrix { return LinearSpace.real.buildMatrix(size, this[0].size) { row, col -> this@toMatrix[row][col] } } diff --git a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealMatrixTest.kt b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealMatrixTest.kt index 6ab11b03b..06135598e 100644 --- a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealMatrixTest.kt +++ b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealMatrixTest.kt @@ -9,6 +9,7 @@ import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue +@UnstableKMathAPI internal class RealMatrixTest { @Test fun testSum() { @@ -30,11 +31,11 @@ internal class RealMatrixTest { @Test fun testRepeatStackVertical() { - val matrix1 = LinearSpace.real.matrix(2, 3)( + val matrix1 = realMatrix(2, 3)( 1.0, 0.0, 0.0, 0.0, 1.0, 2.0 ) - val matrix2 = LinearSpace.real.matrix(6, 3)( + val matrix2 = realMatrix(6, 3)( 1.0, 0.0, 0.0, 0.0, 1.0, 2.0, 1.0, 0.0, 0.0, @@ -47,7 +48,7 @@ internal class RealMatrixTest { @Test fun testMatrixAndDouble() { - val matrix1 = LinearSpace.real.matrix(2, 3)( + val matrix1 = realMatrix(2, 3)( 1.0, 0.0, 3.0, 4.0, 6.0, 2.0 ) @@ -61,13 +62,13 @@ internal class RealMatrixTest { @Test fun testDoubleAndMatrix() { - val matrix1 = LinearSpace.real.matrix(2, 3)( + val matrix1 = realMatrix(2, 3)( 1.0, 0.0, 3.0, 4.0, 6.0, 2.0 ) val matrix2 = 20.0 - (10.0 + (5.0 * matrix1)) //val matrix2 = 10.0 + (5.0 * matrix1) - val expectedResult = LinearSpace.real.matrix(2, 3)( + val expectedResult = realMatrix(2, 3)( 5.0, 10.0, -5.0, -10.0, -20.0, 0.0 ) @@ -76,15 +77,15 @@ internal class RealMatrixTest { @Test fun testSquareAndPower() { - val matrix1 = LinearSpace.real.matrix(2, 3)( + val matrix1 = realMatrix(2, 3)( -1.0, 0.0, 3.0, 4.0, -6.0, -2.0 ) - val matrix2 = LinearSpace.real.matrix(2, 3)( + val matrix2 = realMatrix(2, 3)( 1.0, 0.0, 9.0, 16.0, 36.0, 4.0 ) - val matrix3 = LinearSpace.real.matrix(2, 3)( + val matrix3 = realMatrix(2, 3)( -1.0, 0.0, 27.0, 64.0, -216.0, -8.0 ) @@ -95,16 +96,16 @@ internal class RealMatrixTest { @OptIn(UnstableKMathAPI::class) @Test fun testTwoMatrixOperations() { - val matrix1 = LinearSpace.real.matrix(2, 3)( + val matrix1 = realMatrix(2, 3)( -1.0, 0.0, 3.0, 4.0, -6.0, 7.0 ) - val matrix2 = LinearSpace.real.matrix(2, 3)( + val matrix2 = realMatrix(2, 3)( 1.0, 0.0, 3.0, 4.0, 6.0, -2.0 ) val result = matrix1 * matrix2 + matrix1 - matrix2 - val expectedResult = LinearSpace.real.matrix(2, 3)( + val expectedResult = realMatrix(2, 3)( -3.0, 0.0, 9.0, 16.0, -48.0, -5.0 ) @@ -113,16 +114,16 @@ internal class RealMatrixTest { @Test fun testColumnOperations() { - val matrix1 = LinearSpace.real.matrix(2, 4)( + val matrix1 = realMatrix(2, 4)( -1.0, 0.0, 3.0, 15.0, 4.0, -6.0, 7.0, -11.0 ) - val matrix2 = LinearSpace.real.matrix(2, 5)( + val matrix2 = realMatrix(2, 5)( -1.0, 0.0, 3.0, 15.0, -1.0, 4.0, -6.0, 7.0, -11.0, 4.0 ) - val col1 = LinearSpace.real.matrix(2, 1)(0.0, -6.0) - val cols1to2 = LinearSpace.real.matrix(2, 2)( + val col1 = realMatrix(2, 1)(0.0, -6.0) + val cols1to2 = realMatrix(2, 2)( 0.0, 3.0, -6.0, 7.0 ) From 0aa73cd48fd0aa517189987ecbb0f011114d9a3e Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 14 Mar 2021 09:43:22 +0300 Subject: [PATCH 123/150] Vector space refactor (optimization) --- examples/build.gradle.kts | 8 ++ .../kscience/kmath/benchmarks/DotBenchmark.kt | 17 ++-- .../ExpressionsInterpretersBenchmark.kt | 4 +- ...Benchmark.kt => MatrixInverseBenchmark.kt} | 13 +-- .../kmath/benchmarks/ViktorLogBenchmark.kt | 4 +- .../space/kscience/kmath/ast/MstAlgebra.kt | 6 +- kmath-core/api/kmath-core.api | 44 +++++++--- .../kscience/kmath/linear/LinearSpace.kt | 20 ++--- .../kmath/linear/LinearSpaceOverNd.kt | 85 +++++++++++++++++++ .../kscience/kmath/nd/BufferNDAlgebra.kt | 8 +- .../space/kscience/kmath/nd/Structure1D.kt | 6 +- .../space/kscience/kmath/nd/Structure2D.kt | 25 +++--- .../kmath/structures/BufferAccessor2D.kt | 4 +- .../kmath/structures/bufferOperation.kt | 7 ++ .../kscience/kmath/linear/RealLUSolverTest.kt | 4 +- .../kscience/kmath/ejml/EjmlLinearSpace.kt | 8 +- .../kotlin/space/kscience/kmath/real/dot.kt | 2 +- 17 files changed, 183 insertions(+), 82 deletions(-) rename examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/{LinearAlgebraBenchmark.kt => MatrixInverseBenchmark.kt} (75%) create mode 100644 kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpaceOverNd.kt create mode 100644 kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/bufferOperation.kt diff --git a/examples/build.gradle.kts b/examples/build.gradle.kts index 77152dc0a..0301e4d67 100644 --- a/examples/build.gradle.kts +++ b/examples/build.gradle.kts @@ -92,6 +92,14 @@ benchmark { iterationTimeUnit = "ms" // time unity for iterationTime, default is seconds include("ExpressionsInterpretersBenchmark") } + + configurations.register("matrixInverse") { + warmups = 1 // number of warmup iterations + iterations = 3 // number of iterations + iterationTime = 500 // time in seconds per iteration + iterationTimeUnit = "ms" // time unity for iterationTime, default is seconds + include("MatrixInverseBenchmark") + } } kotlin.sourceSets.all { diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt index 8fb0c284e..dbf373929 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt @@ -6,12 +6,9 @@ import kotlinx.benchmark.Scope import kotlinx.benchmark.State import space.kscience.kmath.commons.linear.CMLinearSpace import space.kscience.kmath.ejml.EjmlLinearSpace -import space.kscience.kmath.linear.BufferLinearSpace -import space.kscience.kmath.linear.Matrix -import space.kscience.kmath.linear.RealLinearSpace +import space.kscience.kmath.linear.LinearSpace +import space.kscience.kmath.linear.invoke import space.kscience.kmath.operations.RealField -import space.kscience.kmath.operations.invoke -import space.kscience.kmath.structures.Buffer import kotlin.random.Random @State(Scope.Benchmark) @@ -21,8 +18,8 @@ internal class DotBenchmark { const val dim = 1000 //creating invertible matrix - val matrix1 = Matrix.real(dim, dim) { i, j -> if (i <= j) random.nextDouble() else 0.0 } - val matrix2 = Matrix.real(dim, dim) { i, j -> if (i <= j) random.nextDouble() else 0.0 } + val matrix1 = LinearSpace.real.buildMatrix(dim, dim) { i, j -> if (i <= j) random.nextDouble() else 0.0 } + val matrix2 = LinearSpace.real.buildMatrix(dim, dim) { i, j -> if (i <= j) random.nextDouble() else 0.0 } val cmMatrix1 = CMLinearSpace { matrix1.toCM() } val cmMatrix2 = CMLinearSpace { matrix2.toCM() } @@ -33,7 +30,7 @@ internal class DotBenchmark { @Benchmark fun cmDot(blackhole: Blackhole) { - CMLinearSpace { + CMLinearSpace.run { blackhole.consume(cmMatrix1 dot cmMatrix2) } } @@ -54,14 +51,14 @@ internal class DotBenchmark { @Benchmark fun bufferedDot(blackhole: Blackhole) { - BufferLinearSpace(RealField, Buffer.Companion::real).invoke { + LinearSpace.auto(RealField).invoke { blackhole.consume(matrix1 dot matrix2) } } @Benchmark fun realDot(blackhole: Blackhole) { - RealLinearSpace { + LinearSpace.real { blackhole.consume(matrix1 dot matrix2) } } diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt index 9c150f074..e5cfbf9f6 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt @@ -30,7 +30,7 @@ internal class ExpressionsInterpretersBenchmark { fun mstExpression(blackhole: Blackhole) { val expr = algebra.mstInField { val x = bindSymbol(x) - x * 2.0 + 2.0 / x - 16.0 + x * 2.0 + number(2.0) / x - 16.0 } invokeAndSum(expr, blackhole) @@ -40,7 +40,7 @@ internal class ExpressionsInterpretersBenchmark { fun asmExpression(blackhole: Blackhole) { val expr = algebra.mstInField { val x = bindSymbol(x) - x * 2.0 + 2.0 / x - 16.0 + x * 2.0 + number(2.0) / x - 16.0 }.compile() invokeAndSum(expr, blackhole) diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/LinearAlgebraBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/MatrixInverseBenchmark.kt similarity index 75% rename from examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/LinearAlgebraBenchmark.kt rename to examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/MatrixInverseBenchmark.kt index 85759d93c..7aa8ac975 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/LinearAlgebraBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/MatrixInverseBenchmark.kt @@ -9,21 +9,22 @@ import space.kscience.kmath.commons.linear.inverse import space.kscience.kmath.ejml.EjmlLinearSpace import space.kscience.kmath.ejml.inverse import space.kscience.kmath.linear.LinearSpace -import space.kscience.kmath.linear.Matrix import space.kscience.kmath.linear.inverseWithLup -import space.kscience.kmath.linear.real +import space.kscience.kmath.linear.invoke import kotlin.random.Random @State(Scope.Benchmark) -internal class LinearAlgebraBenchmark { +internal class MatrixInverseBenchmark { companion object { val random = Random(1224) const val dim = 100 + private val space = LinearSpace.real + //creating invertible matrix - val u = Matrix.real(dim, dim) { i, j -> if (i <= j) random.nextDouble() else 0.0 } - val l = Matrix.real(dim, dim) { i, j -> if (i >= j) random.nextDouble() else 0.0 } - val matrix = l dot u + val u = space.buildMatrix(dim, dim) { i, j -> if (i <= j) random.nextDouble() else 0.0 } + val l = space.buildMatrix(dim, dim) { i, j -> if (i >= j) random.nextDouble() else 0.0 } + val matrix = space { l dot u } } @Benchmark diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt index c48c86af9..0036b615c 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt @@ -15,7 +15,7 @@ import space.kscience.kmath.viktor.ViktorNDField internal class ViktorLogBenchmark { @Benchmark fun realFieldLog(blackhole: Blackhole) { - with(realField) { + with(realNdField) { val fortyTwo = produce { 42.0 } var res = one repeat(n) { res = ln(fortyTwo) } @@ -47,7 +47,7 @@ internal class ViktorLogBenchmark { // automatically build context most suited for given type. private val autoField = NDAlgebra.auto(RealField, dim, dim) - private val realField = NDAlgebra.real(dim, dim) + private val realNdField = NDAlgebra.real(dim, dim) private val viktorField = ViktorNDField(intArrayOf(dim, dim)) } } diff --git a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt index 16fdfbeac..5ed39687b 100644 --- a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt +++ b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt @@ -54,7 +54,7 @@ public object MstRing : Ring, NumbersAddOperations, ScaleOperations, NumbersAddOperations, ScaleOperations< public override val one: MST.Numeric get() = MstRing.one - public override fun bindSymbol(value: String): MST.Symbolic = MstRing.bindSymbol(value) + public override fun bindSymbol(value: String): MST.Symbolic = MstAlgebra.bindSymbol(value) public override fun number(value: Number): MST.Numeric = MstRing.number(value) public override fun add(a: MST, b: MST): MST.Binary = MstRing.add(a, b) @@ -112,7 +112,7 @@ public object MstExtendedField : ExtendedField, NumericAlgebra { public override val zero: MST.Numeric get() = MstField.zero public override val one: MST.Numeric get() = MstField.one - public override fun bindSymbol(value: String): MST.Symbolic = MstField.bindSymbol(value) + public override fun bindSymbol(value: String): MST.Symbolic = MstAlgebra.bindSymbol(value) public override fun number(value: Number): MST.Numeric = MstRing.number(value) public override fun sin(arg: MST): MST.Unary = unaryOperationFunction(TrigonometricOperations.SIN_OPERATION)(arg) public override fun cos(arg: MST): MST.Unary = unaryOperationFunction(TrigonometricOperations.COS_OPERATION)(arg) diff --git a/kmath-core/api/kmath-core.api b/kmath-core/api/kmath-core.api index c1f8d5ec5..38da35d6c 100644 --- a/kmath-core/api/kmath-core.api +++ b/kmath-core/api/kmath-core.api @@ -496,7 +496,6 @@ public final class space/kscience/kmath/linear/LinearSpace$Companion { } public final class space/kscience/kmath/linear/LinearSpace$DefaultImpls { - public static fun buildVector (Lspace/kscience/kmath/linear/LinearSpace;ILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; public static fun dot (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public static fun dot (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; public static fun minus (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; @@ -511,6 +510,29 @@ public final class space/kscience/kmath/linear/LinearSpace$DefaultImpls { public static fun unaryMinus (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; } +public final class space/kscience/kmath/linear/LinearSpaceKt { + public static final fun invoke (Lspace/kscience/kmath/linear/LinearSpace;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; +} + +public final class space/kscience/kmath/linear/LinearSpaceOverNd : space/kscience/kmath/linear/LinearSpace { + public fun (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V + public fun buildMatrix (IILkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/Structure2D; + public fun buildVector (ILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; + public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public fun getElementAlgebra ()Lspace/kscience/kmath/operations/Ring; + public fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun minus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public fun plus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun plus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun times (Ljava/lang/Object;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; + public fun times (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Object;)Lspace/kscience/kmath/structures/Buffer; + public fun unaryMinus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; +} + public final class space/kscience/kmath/linear/LupDecomposition : space/kscience/kmath/linear/DeterminantFeature, space/kscience/kmath/linear/LupDecompositionFeature { public fun (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/operations/Field;Lspace/kscience/kmath/nd/Structure2D;[IZ)V public final fun getContext ()Lspace/kscience/kmath/linear/LinearSpace; @@ -566,12 +588,12 @@ public final class space/kscience/kmath/linear/MatrixWrapper : space/kscience/km public fun get (II)Ljava/lang/Object; public fun get ([I)Ljava/lang/Object; public fun getColNum ()I - public fun getColumns ()Lspace/kscience/kmath/structures/Buffer; + public fun getColumns ()Ljava/util/List; public fun getDimension ()I public final fun getFeatures ()Ljava/util/Set; public final fun getOrigin ()Lspace/kscience/kmath/nd/Structure2D; public fun getRowNum ()I - public fun getRows ()Lspace/kscience/kmath/structures/Buffer; + public fun getRows ()Ljava/util/List; public fun getShape ()[I public fun hashCode ()I public fun toString ()Ljava/lang/String; @@ -622,11 +644,11 @@ public final class space/kscience/kmath/linear/VirtualMatrix : space/kscience/km public fun get (II)Ljava/lang/Object; public fun get ([I)Ljava/lang/Object; public fun getColNum ()I - public fun getColumns ()Lspace/kscience/kmath/structures/Buffer; + public fun getColumns ()Ljava/util/List; public fun getDimension ()I public final fun getGenerator ()Lkotlin/jvm/functions/Function2; public fun getRowNum ()I - public fun getRows ()Lspace/kscience/kmath/structures/Buffer; + public fun getRows ()Ljava/util/List; public fun getShape ()[I public fun hashCode ()I } @@ -678,11 +700,11 @@ public final class space/kscience/kmath/nd/BufferNDAlgebra$DefaultImpls { public final class space/kscience/kmath/nd/BufferNDAlgebraKt { public static final fun field (Lspace/kscience/kmath/nd/NDAlgebra$Companion;Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedNDField; + public static final fun group (Lspace/kscience/kmath/nd/NDAlgebra$Companion;Lspace/kscience/kmath/operations/Group;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedNDGroup; public static final fun ndField (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final fun ndGroup (Lspace/kscience/kmath/operations/Group;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; public static final fun ndRing (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun ndSpace (Lspace/kscience/kmath/operations/Group;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; public static final fun ring (Lspace/kscience/kmath/nd/NDAlgebra$Companion;Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedNDRing; - public static final fun space (Lspace/kscience/kmath/nd/NDAlgebra$Companion;Lspace/kscience/kmath/operations/Group;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedNDGroup; } public class space/kscience/kmath/nd/BufferedNDField : space/kscience/kmath/nd/BufferedNDRing, space/kscience/kmath/nd/NDField { @@ -1103,9 +1125,9 @@ public abstract interface class space/kscience/kmath/nd/Structure2D : space/ksci public abstract fun get (II)Ljava/lang/Object; public abstract fun get ([I)Ljava/lang/Object; public abstract fun getColNum ()I - public abstract fun getColumns ()Lspace/kscience/kmath/structures/Buffer; + public abstract fun getColumns ()Ljava/util/List; public abstract fun getRowNum ()I - public abstract fun getRows ()Lspace/kscience/kmath/structures/Buffer; + public abstract fun getRows ()Ljava/util/List; public abstract fun getShape ()[I } @@ -1115,9 +1137,9 @@ public final class space/kscience/kmath/nd/Structure2D$Companion { public final class space/kscience/kmath/nd/Structure2D$DefaultImpls { public static fun elements (Lspace/kscience/kmath/nd/Structure2D;)Lkotlin/sequences/Sequence; public static fun get (Lspace/kscience/kmath/nd/Structure2D;[I)Ljava/lang/Object; - public static fun getColumns (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/structures/Buffer; + public static fun getColumns (Lspace/kscience/kmath/nd/Structure2D;)Ljava/util/List; public static fun getDimension (Lspace/kscience/kmath/nd/Structure2D;)I - public static fun getRows (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/structures/Buffer; + public static fun getRows (Lspace/kscience/kmath/nd/Structure2D;)Ljava/util/List; public static fun getShape (Lspace/kscience/kmath/nd/Structure2D;)[I } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt index 4a9d2c9b3..b0331bdea 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt @@ -33,8 +33,7 @@ public interface LinearSpace> { /** * Produces a point compatible with matrix space (and possibly optimized for it). */ - public fun buildVector(size: Int, initializer: A.(Int) -> T): Vector = - buildMatrix(1, size) { _, j -> initializer(j) }.as1D() + public fun buildVector(size: Int, initializer: A.(Int) -> T): Vector public operator fun Matrix.unaryMinus(): Matrix = buildMatrix(rowNum, colNum) { i, j -> -get(i, j) @@ -154,7 +153,7 @@ public interface LinearSpace> { /** * Gets a feature from the matrix. This function may return some additional features to - * [space.kscience.kmath.nd.NDStructure.getFeature]. + * [group.kscience.kmath.nd.NDStructure.getFeature]. * * @param F the type of feature. * @param m the matrix. @@ -172,16 +171,7 @@ public interface LinearSpace> { public fun > buffered( algebra: A, bufferFactory: BufferFactory = Buffer.Companion::boxing, - ): LinearSpace = object : LinearSpace { - override val elementAlgebra: A = algebra - - override fun buildMatrix( - rows: Int, columns: Int, - initializer: A.(i: Int, j: Int) -> T, - ): Matrix = NDStructure.buffered(intArrayOf(rows, columns), bufferFactory) { (i, j) -> - algebra.initializer(i, j) - }.as2D() - } + ): LinearSpace = LinearSpaceOverNd(algebra,bufferFactory) public val real: LinearSpace = buffered(RealField, Buffer.Companion::real) @@ -193,9 +183,11 @@ public interface LinearSpace> { } } +public operator fun , R> LS.invoke(block: LS.() -> R): R = run(block) + /** * Gets a feature from the matrix. This function may return some additional features to - * [space.kscience.kmath.nd.NDStructure.getFeature]. + * [group.kscience.kmath.nd.NDStructure.getFeature]. * * @param T the type of items in the matrices. * @param M the type of operated matrices. diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpaceOverNd.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpaceOverNd.kt new file mode 100644 index 000000000..6a82f37ec --- /dev/null +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpaceOverNd.kt @@ -0,0 +1,85 @@ +package space.kscience.kmath.linear + +import space.kscience.kmath.nd.* +import space.kscience.kmath.operations.Ring +import space.kscience.kmath.operations.invoke +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.BufferFactory +import space.kscience.kmath.structures.VirtualBuffer +import space.kscience.kmath.structures.indices + + +public class LinearSpaceOverNd>( + override val elementAlgebra: A, + private val bufferFactory: BufferFactory, +) : LinearSpace { + + private fun ndRing( + rows: Int, + cols: Int, + ): BufferedNDRing = NDAlgebra.ring(elementAlgebra, bufferFactory, rows, cols) + + override fun buildMatrix(rows: Int, columns: Int, initializer: A.(i: Int, j: Int) -> T): Matrix = + ndRing(rows, columns).produce { (i, j) -> elementAlgebra.initializer(i, j) }.as2D() + + override fun buildVector(size: Int, initializer: A.(Int) -> T): Vector = + bufferFactory(size) { elementAlgebra.initializer(it) } + + override fun Matrix.unaryMinus(): Matrix = ndRing(rowNum, colNum).run { + unwrap().map { -it }.as2D() + } + + override fun Matrix.plus(other: Matrix): Matrix = ndRing(rowNum, colNum).run { + require(shape.contentEquals(other.shape)) { "Shape mismatch on Matrix::plus. Expected $shape but found ${other.shape}" } + unwrap().plus(other.unwrap()).as2D() + } + + override fun Matrix.minus(other: Matrix): Matrix = ndRing(rowNum, colNum).run { + require(shape.contentEquals(other.shape)) { "Shape mismatch on Matrix::plus. Expected $shape but found ${other.shape}" } + unwrap().minus(other.unwrap()).as2D() + } + + private fun Buffer.linearize() = if (this is VirtualBuffer) { + buildVector(size) { get(it) } + } else { + this + } + + override fun Matrix.dot(other: Matrix): Matrix { + require(colNum == other.rowNum) { "Matrix dot operation dimension mismatch: ($rowNum, $colNum) x (${other.rowNum}, ${other.colNum})" } + return elementAlgebra { + val rows = this@dot.rows.map{it.linearize()} + val columns = other.columns.map { it.linearize() } + //TODO optimize buffers + buildMatrix(rowNum, other.colNum) { i, j -> + val r = rows[i] + val c = columns[j] + var res = zero + for (l in r.indices) { + res += r[l] * c[l] + } + res + } + } + } + + override fun Matrix.dot(vector: Vector): Vector { + require(colNum == vector.size) { "Matrix dot vector operation dimension mismatch: ($rowNum, $colNum) x (${vector.size})" } + return elementAlgebra { + val rows = this@dot.rows + //TODO optimize buffers + buildVector(rowNum) { i -> + val r = rows[i] + var res = zero + for (j in r.indices) { + res += r[j] * vector[j] + } + res + } + } + } + + override fun Matrix.times(value: T): Matrix = ndRing(rowNum, colNum).run { + unwrap().map { it * value }.as2D() + } +} \ No newline at end of file diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferNDAlgebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferNDAlgebra.kt index 58d1ea7b1..bce3a0830 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferNDAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferNDAlgebra.kt @@ -79,20 +79,20 @@ public open class BufferedNDField>( override fun scale(a: NDStructure, value: Double): NDStructure = a.map { it * value } } -// space factories -public fun > NDAlgebra.Companion.space( +// group factories +public fun > NDAlgebra.Companion.group( space: A, bufferFactory: BufferFactory, vararg shape: Int, ): BufferedNDGroup = BufferedNDGroup(shape, space, bufferFactory) -public inline fun , R> A.ndSpace( +public inline fun , R> A.ndGroup( noinline bufferFactory: BufferFactory, vararg shape: Int, action: BufferedNDGroup.() -> R, ): R { contract { callsInPlace(action, InvocationKind.EXACTLY_ONCE) } - return NDAlgebra.space(this, bufferFactory, *shape).run(action) + return NDAlgebra.group(this, bufferFactory, *shape).run(action) } //ring factories diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt index c54bfeed9..1335a4933 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt @@ -45,14 +45,12 @@ private inline class Buffer1DWrapper(val buffer: Buffer) : Structure1D /** * Represent a [NDStructure] as [Structure1D]. Throw error in case of dimension mismatch */ -public fun NDStructure.as1D(): Structure1D = if (shape.size == 1) { +public fun NDStructure.as1D(): Structure1D = this as? Structure1D ?: if (shape.size == 1) { when (this) { - is Structure1DWrapper -> this is NDBuffer -> Buffer1DWrapper(this.buffer) else -> Structure1DWrapper(this) } -} else - error("Can't create 1d-structure from ${shape.size}d-structure") +} else error("Can't create 1d-structure from ${shape.size}d-structure") /** * Represent this buffer as 1D structure diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt index 09c830646..e9f8234e5 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt @@ -26,14 +26,14 @@ public interface Structure2D : NDStructure { /** * The buffer of rows of this structure. It gets elements from the structure dynamically. */ - public val rows: Buffer> - get() = VirtualBuffer(rowNum) { i -> VirtualBuffer(colNum) { j -> get(i, j) } } + public val rows: List> + get() = List(rowNum) { i -> VirtualBuffer(colNum) { j -> get(i, j) } } /** * The buffer of columns of this structure. It gets elements from the structure dynamically. */ - public val columns: Buffer> - get() = VirtualBuffer(colNum) { j -> VirtualBuffer(rowNum) { i -> get(i, j) } } + public val columns: List> + get() = List(colNum) { j -> VirtualBuffer(rowNum) { i -> get(i, j) } } /** * Retrieves an element from the structure by two indices. @@ -75,20 +75,15 @@ private class Structure2DWrapper(val structure: NDStructure) : Structure2D override fun equals(other: Any?): Boolean = structure == other - override fun hashCode(): Int = structure.hashCode() + override fun hashCode(): Int = structure.hashCode() } /** * Represent a [NDStructure] as [Structure1D]. Throw error in case of dimension mismatch */ -public fun NDStructure.as2D(): Structure2D = if (shape.size == 2) - Structure2DWrapper(this) -else - error("Can't create 2d-structure from ${shape.size}d-structure") +public fun NDStructure.as2D(): Structure2D = this as? Structure2D ?: when (shape.size) { + 2 -> Structure2DWrapper(this) + else -> error("Can't create 2d-structure from ${shape.size}d-structure") +} -/** - * Alias for [Structure2D] with more familiar name. - * - * @param T the type of items in the matrix. - */ -public typealias Matrix = Structure2D +internal fun Structure2D.unwrap(): NDStructure = if (this is Structure2DWrapper) structure else this \ No newline at end of file diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/BufferAccessor2D.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/BufferAccessor2D.kt index d9e37ebd8..0910b2034 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/BufferAccessor2D.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/BufferAccessor2D.kt @@ -13,10 +13,10 @@ internal class BufferAccessor2D( public val colNum: Int, val factory: MutableBufferFactory, ) { - public operator fun Buffer.get(i: Int, j: Int): T = get(i + colNum * j) + public operator fun Buffer.get(i: Int, j: Int): T = get(i*colNum + j) public operator fun MutableBuffer.set(i: Int, j: Int, value: T) { - set(i + colNum * j, value) + set(i*colNum + j, value) } public inline fun create(crossinline init: (i: Int, j: Int) -> T): MutableBuffer = diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/bufferOperation.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/bufferOperation.kt new file mode 100644 index 000000000..459136631 --- /dev/null +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/bufferOperation.kt @@ -0,0 +1,7 @@ +package space.kscience.kmath.structures + + +public inline fun Buffer.map( + bufferFactory: BufferFactory = Buffer.Companion::auto, + crossinline block: (T) -> R, +): Buffer = bufferFactory(size) { block(get(it)) } \ No newline at end of file diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt index 704f91998..fb90b5e11 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt @@ -19,13 +19,13 @@ class RealLUSolverTest { LinearSpace.real.run { val matrix = matrix(2,2)( 3.0, 1.0, - 1.0, 3.0 + 2.0, 3.0 ) val lup = lup(matrix) //Check determinant - assertEquals(8.0, lup.determinant) + assertEquals(7.0, lup.determinant) assertEquals(lup.p dot matrix, lup.l dot lup.u) } diff --git a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt index 57ce977fd..2d3a928a6 100644 --- a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt +++ b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt @@ -5,14 +5,13 @@ import space.kscience.kmath.linear.* import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.nd.getFeature import space.kscience.kmath.operations.RealField -import space.kscience.kmath.operations.ScaleOperations /** * Represents context of basic operations operating with [EjmlMatrix]. * * @author Iaroslav Postovalov */ -public object EjmlLinearSpace : LinearSpace, ScaleOperations> { +public object EjmlLinearSpace : LinearSpace { override val elementAlgebra: RealField get() = RealField @@ -50,7 +49,7 @@ public object EjmlLinearSpace : LinearSpace, ScaleOperations< private fun SimpleMatrix.wrapMatrix() = EjmlMatrix(this) private fun SimpleMatrix.wrapVector() = EjmlVector(this) - override fun Matrix.unaryMinus(): Matrix = this * (-1) + override fun Matrix.unaryMinus(): Matrix = this * (-1.0) public override fun Matrix.dot(other: Matrix): EjmlMatrix = EjmlMatrix(toEjml().origin.mult(other.toEjml().origin)) @@ -61,9 +60,6 @@ public object EjmlLinearSpace : LinearSpace, ScaleOperations< public override operator fun Matrix.minus(other: Matrix): EjmlMatrix = (toEjml().origin - other.toEjml().origin).wrapMatrix() - public override fun scale(a: Matrix, value: Double): EjmlMatrix = - a.toEjml().origin.scale(value).wrapMatrix() - public override operator fun Matrix.times(value: Double): EjmlMatrix = toEjml().origin.scale(value).wrapMatrix() diff --git a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/dot.kt b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/dot.kt index 1a7c1213c..0bc5c111b 100644 --- a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/dot.kt +++ b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/dot.kt @@ -1,7 +1,7 @@ package space.kscience.kmath.real import space.kscience.kmath.linear.LinearSpace -import space.kscience.kmath.nd.Matrix +import space.kscience.kmath.linear.Matrix /** From 8179be2f6284a01fa5ebfb020ee2051c83265655 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 14 Mar 2021 09:55:24 +0300 Subject: [PATCH 124/150] cleanup --- .../linear/{LinearSpaceOverNd.kt => BufferLinearSpace.kt} | 6 ++---- .../kotlin/space/kscience/kmath/linear/LinearSpace.kt | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) rename kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/{LinearSpaceOverNd.kt => BufferLinearSpace.kt} (94%) diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpaceOverNd.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferLinearSpace.kt similarity index 94% rename from kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpaceOverNd.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferLinearSpace.kt index 6a82f37ec..1ea138063 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpaceOverNd.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferLinearSpace.kt @@ -9,7 +9,7 @@ import space.kscience.kmath.structures.VirtualBuffer import space.kscience.kmath.structures.indices -public class LinearSpaceOverNd>( +public class BufferLinearSpace>( override val elementAlgebra: A, private val bufferFactory: BufferFactory, ) : LinearSpace { @@ -35,7 +35,7 @@ public class LinearSpaceOverNd>( } override fun Matrix.minus(other: Matrix): Matrix = ndRing(rowNum, colNum).run { - require(shape.contentEquals(other.shape)) { "Shape mismatch on Matrix::plus. Expected $shape but found ${other.shape}" } + require(shape.contentEquals(other.shape)) { "Shape mismatch on Matrix::minus. Expected $shape but found ${other.shape}" } unwrap().minus(other.unwrap()).as2D() } @@ -50,7 +50,6 @@ public class LinearSpaceOverNd>( return elementAlgebra { val rows = this@dot.rows.map{it.linearize()} val columns = other.columns.map { it.linearize() } - //TODO optimize buffers buildMatrix(rowNum, other.colNum) { i, j -> val r = rows[i] val c = columns[j] @@ -67,7 +66,6 @@ public class LinearSpaceOverNd>( require(colNum == vector.size) { "Matrix dot vector operation dimension mismatch: ($rowNum, $colNum) x (${vector.size})" } return elementAlgebra { val rows = this@dot.rows - //TODO optimize buffers buildVector(rowNum) { i -> val r = rows[i] var res = zero diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt index b0331bdea..4fd4d28d1 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt @@ -171,7 +171,7 @@ public interface LinearSpace> { public fun > buffered( algebra: A, bufferFactory: BufferFactory = Buffer.Companion::boxing, - ): LinearSpace = LinearSpaceOverNd(algebra,bufferFactory) + ): LinearSpace = BufferLinearSpace(algebra,bufferFactory) public val real: LinearSpace = buffered(RealField, Buffer.Companion::real) From 0cc68e72ce58eaca0efe362309ccf0fa72724cf0 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 14 Mar 2021 09:59:53 +0300 Subject: [PATCH 125/150] cleanup --- .../kotlin/space/kscience/kmath/linear/BufferLinearSpace.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferLinearSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferLinearSpace.kt index 1ea138063..ac6211c4b 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferLinearSpace.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferLinearSpace.kt @@ -65,7 +65,7 @@ public class BufferLinearSpace>( override fun Matrix.dot(vector: Vector): Vector { require(colNum == vector.size) { "Matrix dot vector operation dimension mismatch: ($rowNum, $colNum) x (${vector.size})" } return elementAlgebra { - val rows = this@dot.rows + val rows = this@dot.rows.map { it.linearize() } buildVector(rowNum) { i -> val r = rows[i] var res = zero From 5a568c4587ba1b93a1c83d0b5eb2cecd7fe40dbf Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 14 Mar 2021 14:23:53 +0300 Subject: [PATCH 126/150] add gradient example --- .../space/kscience/kmath/linear/gradient.kt | 28 ++++++++++++++ kmath-core/api/kmath-core.api | 38 +++++++++---------- .../space/kscience/kmath/real/RealVector.kt | 19 ++++++++-- 3 files changed, 62 insertions(+), 23 deletions(-) create mode 100644 examples/src/main/kotlin/space/kscience/kmath/linear/gradient.kt diff --git a/examples/src/main/kotlin/space/kscience/kmath/linear/gradient.kt b/examples/src/main/kotlin/space/kscience/kmath/linear/gradient.kt new file mode 100644 index 000000000..ce2b9cb00 --- /dev/null +++ b/examples/src/main/kotlin/space/kscience/kmath/linear/gradient.kt @@ -0,0 +1,28 @@ +package space.kscience.kmath.linear + +import space.kscience.kmath.real.* +import space.kscience.kmath.structures.RealBuffer + +fun main() { + val x0 = Vector(0.0, 0.0, 0.0) + val sigma = Vector(1.0, 1.0, 1.0) + + val gaussian: (Vector) -> Double = { x -> + require(x.size == x0.size) + kotlin.math.exp(-((x - x0) / sigma).square().sum()) + } + + fun ((Vector) -> Double).grad(x: Vector): Vector { + require(x.size == x0.size) + return RealBuffer(x.size) { i -> + val h = sigma[i] / 5 + val dVector = RealBuffer(x.size) { if (it == i) h else 0.0 } + val f1 = invoke(x + dVector / 2) + val f0 = invoke(x - dVector / 2) + (f1 - f0) / h + } + } + + println(gaussian.grad(x0)) + +} \ No newline at end of file diff --git a/kmath-core/api/kmath-core.api b/kmath-core/api/kmath-core.api index 38da35d6c..525711e96 100644 --- a/kmath-core/api/kmath-core.api +++ b/kmath-core/api/kmath-core.api @@ -432,6 +432,25 @@ public final class space/kscience/kmath/expressions/SymbolIndexerKt { public static final fun withSymbols ([Lspace/kscience/kmath/expressions/Symbol;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; } +public final class space/kscience/kmath/linear/BufferLinearSpace : space/kscience/kmath/linear/LinearSpace { + public fun (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V + public fun buildMatrix (IILkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/Structure2D; + public fun buildVector (ILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; + public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public fun getElementAlgebra ()Lspace/kscience/kmath/operations/Ring; + public fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun minus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public fun plus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun plus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun times (Ljava/lang/Object;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; + public fun times (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Object;)Lspace/kscience/kmath/structures/Buffer; + public fun unaryMinus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; + public fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; +} + public abstract interface class space/kscience/kmath/linear/CholeskyDecompositionFeature : space/kscience/kmath/linear/MatrixFeature { public abstract fun getL ()Lspace/kscience/kmath/nd/Structure2D; } @@ -514,25 +533,6 @@ public final class space/kscience/kmath/linear/LinearSpaceKt { public static final fun invoke (Lspace/kscience/kmath/linear/LinearSpace;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; } -public final class space/kscience/kmath/linear/LinearSpaceOverNd : space/kscience/kmath/linear/LinearSpace { - public fun (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V - public fun buildMatrix (IILkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/Structure2D; - public fun buildVector (ILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; - public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public fun dot (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public fun getElementAlgebra ()Lspace/kscience/kmath/operations/Ring; - public fun minus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public fun minus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public fun plus (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public fun plus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public fun times (Ljava/lang/Object;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public fun times (Lspace/kscience/kmath/nd/Structure2D;Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; - public fun times (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Object;)Lspace/kscience/kmath/structures/Buffer; - public fun unaryMinus (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; - public fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; -} - public final class space/kscience/kmath/linear/LupDecomposition : space/kscience/kmath/linear/DeterminantFeature, space/kscience/kmath/linear/LupDecompositionFeature { public fun (Lspace/kscience/kmath/linear/LinearSpace;Lspace/kscience/kmath/operations/Field;Lspace/kscience/kmath/nd/Structure2D;[IZ)V public final fun getContext ()Lspace/kscience/kmath/linear/LinearSpace; diff --git a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealVector.kt b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealVector.kt index ca892fa7e..ee42fe404 100644 --- a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealVector.kt +++ b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealVector.kt @@ -5,6 +5,7 @@ import space.kscience.kmath.operations.Norm import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.asBuffer import space.kscience.kmath.structures.asIterable +import space.kscience.kmath.structures.indices import kotlin.math.pow import kotlin.math.sqrt @@ -30,7 +31,7 @@ public inline fun RealVector.mapIndexed(transform: (index: Int, value: Double) - Buffer.real(size) { transform(it, get(it)) } public operator fun RealVector.plus(other: RealVector): RealVector { - require(size == other.size){"Vector size $size expected but ${other.size} found"} + require(size == other.size) { "Vector size $size expected but ${other.size} found" } return mapIndexed { index, value -> value + other[index] } } @@ -41,7 +42,7 @@ public operator fun Number.plus(vector: RealVector): RealVector = vector + this public operator fun RealVector.unaryMinus(): Buffer = map { -it } public operator fun RealVector.minus(other: RealVector): RealVector { - require(size == other.size){"Vector size $size expected but ${other.size} found"} + require(size == other.size) { "Vector size $size expected but ${other.size} found" } return mapIndexed { index, value -> value - other[index] } } @@ -50,7 +51,7 @@ public operator fun RealVector.minus(number: Number): RealVector = map { it - nu public operator fun Number.minus(vector: RealVector): RealVector = vector.map { toDouble() - it } public operator fun RealVector.times(other: RealVector): RealVector { - require(size == other.size){"Vector size $size expected but ${other.size} found"} + require(size == other.size) { "Vector size $size expected but ${other.size} found" } return mapIndexed { index, value -> value * other[index] } } @@ -59,7 +60,7 @@ public operator fun RealVector.times(number: Number): RealVector = map { it * nu public operator fun Number.times(vector: RealVector): RealVector = vector * this public operator fun RealVector.div(other: RealVector): RealVector { - require(size == other.size){"Vector size $size expected but ${other.size} found"} + require(size == other.size) { "Vector size $size expected but ${other.size} found" } return mapIndexed { index, value -> value / other[index] } } @@ -88,3 +89,13 @@ public fun tan(vector: RealVector): RealVector = vector.map { kotlin.math.tan(it public fun ln(vector: RealVector): RealVector = vector.map { kotlin.math.ln(it) } public fun log10(vector: RealVector): RealVector = vector.map { kotlin.math.log10(it) } + +// reductions methods + +public fun RealVector.sum(): Double { + var res = 0.0 + for (i in indices) { + res += get(i) + } + return res +} \ No newline at end of file From e01f90b5e03d42a7c0c50591f34222c3607edff5 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 14 Mar 2021 14:40:13 +0300 Subject: [PATCH 127/150] add gradient example --- CHANGELOG.md | 1 + .../space/kscience/kmath/linear/gradient.kt | 8 +- .../kscience/kmath/commons/linear/CMMatrix.kt | 16 ++-- kmath-core/api/kmath-core.api | 10 +-- .../kmath/linear/BufferLinearSpace.kt | 4 +- .../{LinearAlgebra.kt => LinearSolver.kt} | 5 +- .../kscience/kmath/linear/LinearSpace.kt | 19 ++-- .../kscience/kmath/linear/MatrixBuilder.kt | 2 +- .../kscience/kmath/linear/RealLinearSpace.kt | 86 ------------------- .../kscience/kmath/ejml/EjmlLinearSpace.kt | 16 ++-- 10 files changed, 41 insertions(+), 126 deletions(-) rename kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/{LinearAlgebra.kt => LinearSolver.kt} (83%) delete mode 100644 kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealLinearSpace.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 05c956de3..47690e36a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Exponential operations merged with hyperbolic functions - Space is replaced by Group. Space is reserved for vector spaces. - VectorSpace is now a vector space +- ### Deprecated diff --git a/examples/src/main/kotlin/space/kscience/kmath/linear/gradient.kt b/examples/src/main/kotlin/space/kscience/kmath/linear/gradient.kt index ce2b9cb00..8dd3d7f6b 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/linear/gradient.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/linear/gradient.kt @@ -4,15 +4,15 @@ import space.kscience.kmath.real.* import space.kscience.kmath.structures.RealBuffer fun main() { - val x0 = Vector(0.0, 0.0, 0.0) - val sigma = Vector(1.0, 1.0, 1.0) + val x0 = Point(0.0, 0.0, 0.0) + val sigma = Point(1.0, 1.0, 1.0) - val gaussian: (Vector) -> Double = { x -> + val gaussian: (Point) -> Double = { x -> require(x.size == x0.size) kotlin.math.exp(-((x - x0) / sigma).square().sum()) } - fun ((Vector) -> Double).grad(x: Vector): Vector { + fun ((Point) -> Double).grad(x: Point): Point { require(x.size == x0.size) return RealBuffer(x.size) { i -> val h = sigma[i] / 5 diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt index b462a1a36..5f632491c 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt @@ -62,7 +62,7 @@ public class CMMatrix(public val origin: RealMatrix) : Matrix { override fun hashCode(): Int = origin.hashCode() } -public inline class CMVector(public val origin: RealVector) : Vector { +public inline class CMVector(public val origin: RealVector) : Point { public override val size: Int get() = origin.dimension public override operator fun get(index: Int): Double = origin.getEntry(index) @@ -94,7 +94,7 @@ public object CMLinearSpace : LinearSpace { } } - public fun Vector.toCM(): CMVector = if (this is CMVector) this else { + public fun Point.toCM(): CMVector = if (this is CMVector) this else { val array = DoubleArray(size) { this[it] } ArrayRealVector(array).wrap() } @@ -102,22 +102,22 @@ public object CMLinearSpace : LinearSpace { internal fun RealMatrix.wrap(): CMMatrix = CMMatrix(this) internal fun RealVector.wrap(): CMVector = CMVector(this) - override fun buildVector(size: Int, initializer: RealField.(Int) -> Double): Vector = + override fun buildVector(size: Int, initializer: RealField.(Int) -> Double): Point = ArrayRealVector(DoubleArray(size) { RealField.initializer(it) }).wrap() override fun Matrix.plus(other: Matrix): CMMatrix = toCM().origin.add(other.toCM().origin).wrap() - override fun Vector.plus(other: Vector): CMVector = + override fun Point.plus(other: Point): CMVector = toCM().origin.add(other.toCM().origin).wrap() - override fun Vector.minus(other: Vector): CMVector = + override fun Point.minus(other: Point): CMVector = toCM().origin.subtract(other.toCM().origin).wrap() public override fun Matrix.dot(other: Matrix): CMMatrix = toCM().origin.multiply(other.toCM().origin).wrap() - public override fun Matrix.dot(vector: Vector): CMVector = + public override fun Matrix.dot(vector: Point): CMVector = toCM().origin.preMultiply(vector.toCM().origin).wrap() public override operator fun Matrix.minus(other: Matrix): CMMatrix = @@ -129,10 +129,10 @@ public object CMLinearSpace : LinearSpace { override fun Double.times(m: Matrix): CMMatrix = m * this - override fun Vector.times(value: Double): CMVector = + override fun Point.times(value: Double): CMVector = toCM().origin.mapMultiply(value).wrap() - override fun Double.times(v: Vector): CMVector = + override fun Double.times(v: Point): CMVector = v * this } diff --git a/kmath-core/api/kmath-core.api b/kmath-core/api/kmath-core.api index 525711e96..b2417fa7d 100644 --- a/kmath-core/api/kmath-core.api +++ b/kmath-core/api/kmath-core.api @@ -474,11 +474,6 @@ public final class space/kscience/kmath/linear/LFeature : space/kscience/kmath/l public static final field INSTANCE Lspace/kscience/kmath/linear/LFeature; } -public final class space/kscience/kmath/linear/LinearAlgebraKt { - public static final fun asMatrix (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/linear/VirtualMatrix; - public static final fun asVector (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/structures/Buffer; -} - public abstract interface class space/kscience/kmath/linear/LinearSolver { public abstract fun inverse (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; public abstract fun solve (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/nd/Structure2D; @@ -489,6 +484,11 @@ public final class space/kscience/kmath/linear/LinearSolver$DefaultImpls { public static fun solve (Lspace/kscience/kmath/linear/LinearSolver;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; } +public final class space/kscience/kmath/linear/LinearSolverKt { + public static final fun asMatrix (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/linear/VirtualMatrix; + public static final fun asVector (Lspace/kscience/kmath/nd/Structure2D;)Lspace/kscience/kmath/structures/Buffer; +} + public abstract interface class space/kscience/kmath/linear/LinearSpace { public static final field Companion Lspace/kscience/kmath/linear/LinearSpace$Companion; public abstract fun buildMatrix (IILkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/Structure2D; diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferLinearSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferLinearSpace.kt index ac6211c4b..b6c2ea17b 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferLinearSpace.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferLinearSpace.kt @@ -22,7 +22,7 @@ public class BufferLinearSpace>( override fun buildMatrix(rows: Int, columns: Int, initializer: A.(i: Int, j: Int) -> T): Matrix = ndRing(rows, columns).produce { (i, j) -> elementAlgebra.initializer(i, j) }.as2D() - override fun buildVector(size: Int, initializer: A.(Int) -> T): Vector = + override fun buildVector(size: Int, initializer: A.(Int) -> T): Point = bufferFactory(size) { elementAlgebra.initializer(it) } override fun Matrix.unaryMinus(): Matrix = ndRing(rowNum, colNum).run { @@ -62,7 +62,7 @@ public class BufferLinearSpace>( } } - override fun Matrix.dot(vector: Vector): Vector { + override fun Matrix.dot(vector: Point): Point { require(colNum == vector.size) { "Matrix dot vector operation dimension mismatch: ($rowNum, $colNum) x (${vector.size})" } return elementAlgebra { val rows = this@dot.rows.map { it.linearize() } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearAlgebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSolver.kt similarity index 83% rename from kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearAlgebra.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSolver.kt index 265a709e9..6cce5a446 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSolver.kt @@ -1,9 +1,6 @@ package space.kscience.kmath.linear import space.kscience.kmath.nd.as1D -import space.kscience.kmath.structures.Buffer - -public typealias Point = Buffer /** * A group of methods to resolve equation A dot X = B, where A and B are matrices or vectors @@ -17,7 +14,7 @@ public interface LinearSolver { /** * Convert matrix to vector if it is possible */ -public fun Matrix.asVector(): Vector = +public fun Matrix.asVector(): Point = if (this.colNum == 1) as1D() else diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt index 4fd4d28d1..de9ac35db 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt @@ -14,7 +14,10 @@ import kotlin.reflect.KClass */ public typealias Matrix = Structure2D -public typealias Vector = Point +/** + * Alias or using [Buffer] as a point/vector in a many-dimensional space. + */ +public typealias Point = Buffer /** * Basic operations on matrices and vectors. Operates on [Matrix]. @@ -33,13 +36,13 @@ public interface LinearSpace> { /** * Produces a point compatible with matrix space (and possibly optimized for it). */ - public fun buildVector(size: Int, initializer: A.(Int) -> T): Vector + public fun buildVector(size: Int, initializer: A.(Int) -> T): Point public operator fun Matrix.unaryMinus(): Matrix = buildMatrix(rowNum, colNum) { i, j -> -get(i, j) } - public operator fun Vector.unaryMinus(): Vector = buildVector(size) { + public operator fun Point.unaryMinus(): Point = buildVector(size) { -get(it) } @@ -54,7 +57,7 @@ public interface LinearSpace> { /** * Vector sum */ - public operator fun Vector.plus(other: Vector): Vector = buildVector(size) { + public operator fun Point.plus(other: Point): Point = buildVector(size) { get(it) + other[it] } @@ -68,7 +71,7 @@ public interface LinearSpace> { /** * Vector subtraction */ - public operator fun Vector.minus(other: Vector): Vector = buildVector(size) { + public operator fun Point.minus(other: Point): Point = buildVector(size) { get(it) - other[it] } @@ -100,7 +103,7 @@ public interface LinearSpace> { * @param vector the multiplier. * @return the dot product. */ - public infix fun Matrix.dot(vector: Vector): Vector { + public infix fun Matrix.dot(vector: Point): Point { require(colNum == vector.size) { "Matrix dot vector operation dimension mismatch: ($rowNum, $colNum) x (${vector.size})" } return elementAlgebra { buildVector(rowNum) { i -> @@ -139,7 +142,7 @@ public interface LinearSpace> { * @param value the multiplier. * @receiver the product. */ - public operator fun Vector.times(value: T): Vector = + public operator fun Point.times(value: T): Point = buildVector(size) { i -> get(i) * value } /** @@ -149,7 +152,7 @@ public interface LinearSpace> { * @param v the multiplier. * @receiver the product. */ - public operator fun T.times(v: Vector): Vector = v * this + public operator fun T.times(v: Point): Point = v * this /** * Gets a feature from the matrix. This function may return some additional features to diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixBuilder.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixBuilder.kt index 0a7f280bc..b30d621fe 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixBuilder.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixBuilder.kt @@ -24,7 +24,7 @@ public fun > LinearSpace.matrix(rows: Int, columns: I MatrixBuilder(this, rows, columns) @UnstableKMathAPI -public fun LinearSpace>.vector(vararg elements: T): Vector { +public fun LinearSpace>.vector(vararg elements: T): Point { return buildVector(elements.size) { elements[it] } } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealLinearSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealLinearSpace.kt deleted file mode 100644 index 3fa23db82..000000000 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/RealLinearSpace.kt +++ /dev/null @@ -1,86 +0,0 @@ -package space.kscience.kmath.linear - -//public object RealLinearSpace: - -//public object RealLinearSpace : LinearSpace, ScaleOperations> { -// -// override val elementAlgebra: RealField get() = RealField -// -// public override fun buildMatrix( -// rows: Int, -// columns: Int, -// initializer: (i: Int, j: Int) -> Double, -// ): Matrix { -// val buffer = RealBuffer(rows * columns) { offset -> initializer(offset / columns, offset % columns) } -// return BufferMatrix(rows, columns, buffer) -// } -// -// public fun Matrix.toBufferMatrix(): BufferMatrix = if (this is BufferMatrix) this else { -// buildMatrix(rowNum, colNum) { i, j -> get(i, j) } -// } -// -// public fun one(rows: Int, columns: Int): Matrix = VirtualMatrix(rows, columns) { i, j -> -// if (i == j) 1.0 else 0.0 -// } + DiagonalFeature -// -// override fun Matrix.unaryMinus(): Matrix = buildMatrix(rowNum, colNum) { i, j -> -get(i, j) } -// -// public override infix fun Matrix.dot(other: Matrix): BufferMatrix { -// require(colNum == other.rowNum) { "Matrix dot operation dimension mismatch: ($rowNum, $colNum) x (${other.rowNum}, ${other.colNum})" } -// val bufferMatrix = toBufferMatrix() -// val otherBufferMatrix = other.toBufferMatrix() -// return buildMatrix(rowNum, other.colNum) { i, j -> -// var res = 0.0 -// for (l in 0 until colNum) { -// res += bufferMatrix[i, l] * otherBufferMatrix[l, j] -// } -// res -// } -// } -// -// public override infix fun Matrix.dot(vector: Point): Point { -// require(colNum == vector.size) { "Matrix dot vector operation dimension mismatch: ($rowNum, $colNum) x (${vector.size})" } -// val bufferMatrix = toBufferMatrix() -// return RealBuffer(rowNum) { i -> -// var res = 0.0 -// for (j in 0 until colNum) { -// res += bufferMatrix[i, j] * vector[j] -// } -// res -// } -// } -// -// override fun add(a: Matrix, b: Matrix): BufferMatrix { -// require(a.rowNum == b.rowNum) { "Row number mismatch in matrix addition. Left side: ${a.rowNum}, right side: ${b.rowNum}" } -// require(a.colNum == b.colNum) { "Column number mismatch in matrix addition. Left side: ${a.colNum}, right side: ${b.colNum}" } -// val aBufferMatrix = a.toBufferMatrix() -// val bBufferMatrix = b.toBufferMatrix() -// return buildMatrix(a.rowNum, a.colNum) { i, j -> -// aBufferMatrix[i, j] + bBufferMatrix[i, j] -// } -// } -// -// override fun scale(a: Matrix, value: Double): BufferMatrix { -// val bufferMatrix = a.toBufferMatrix() -// return buildMatrix(a.rowNum, a.colNum) { i, j -> bufferMatrix[i, j] * value } -// } -// -// override fun Matrix.times(value: Double): BufferMatrix = scale(this, value) -// -//// -//// override fun multiply(a: Matrix, k: Number): BufferMatrix { -//// val aBufferMatrix = a.toBufferMatrix() -//// return produce(a.rowNum, a.colNum) { i, j -> aBufferMatrix[i, j] * k.toDouble() } -//// } -//// -//// override fun divide(a: Matrix, k: Number): BufferMatrix { -//// val aBufferMatrix = a.toBufferMatrix() -//// return produce(a.rowNum, a.colNum) { i, j -> aBufferMatrix[i, j] / k.toDouble() } -//// } -//} - - -///** -// * Partially optimized real-valued matrix -// */ -//public val LinearSpace.Companion.real: RealLinearSpace get() = RealLinearSpace diff --git a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt index 2d3a928a6..eecd88681 100644 --- a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt +++ b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt @@ -27,7 +27,7 @@ public object EjmlLinearSpace : LinearSpace { /** * Converts this vector to EJML one. */ - public fun Vector.toEjml(): EjmlVector = when (this) { + public fun Point.toEjml(): EjmlVector = when (this) { is EjmlVector -> this else -> EjmlVector(SimpleMatrix(size, 1).also { (0 until it.numRows()).forEach { row -> it[row, 0] = get(row) } @@ -41,7 +41,7 @@ public object EjmlLinearSpace : LinearSpace { } }) - override fun buildVector(size: Int, initializer: RealField.(Int) -> Double): Vector = + override fun buildVector(size: Int, initializer: RealField.(Int) -> Double): Point = EjmlVector(SimpleMatrix(size, 1).also { (0 until it.numRows()).forEach { row -> it[row, 0] = RealField.initializer(row) } }) @@ -54,7 +54,7 @@ public object EjmlLinearSpace : LinearSpace { public override fun Matrix.dot(other: Matrix): EjmlMatrix = EjmlMatrix(toEjml().origin.mult(other.toEjml().origin)) - public override fun Matrix.dot(vector: Vector): EjmlVector = + public override fun Matrix.dot(vector: Point): EjmlVector = EjmlVector(toEjml().origin.mult(vector.toEjml().origin)) public override operator fun Matrix.minus(other: Matrix): EjmlMatrix = @@ -63,25 +63,25 @@ public object EjmlLinearSpace : LinearSpace { public override operator fun Matrix.times(value: Double): EjmlMatrix = toEjml().origin.scale(value).wrapMatrix() - override fun Vector.unaryMinus(): EjmlVector = + override fun Point.unaryMinus(): EjmlVector = toEjml().origin.negative().wrapVector() override fun Matrix.plus(other: Matrix): EjmlMatrix = (toEjml().origin + other.toEjml().origin).wrapMatrix() - override fun Vector.plus(other: Vector): EjmlVector = + override fun Point.plus(other: Point): EjmlVector = (toEjml().origin + other.toEjml().origin).wrapVector() - override fun Vector.minus(other: Vector): EjmlVector = + override fun Point.minus(other: Point): EjmlVector = (toEjml().origin - other.toEjml().origin).wrapVector() override fun Double.times(m: Matrix): EjmlMatrix = m.toEjml().origin.scale(this).wrapMatrix() - override fun Vector.times(value: Double): EjmlVector = + override fun Point.times(value: Double): EjmlVector = toEjml().origin.scale(value).wrapVector() - override fun Double.times(v: Vector): EjmlVector = + override fun Double.times(v: Point): EjmlVector = v.toEjml().origin.scale(this).wrapVector() } From 6c451b5ca7d5891e1553d5023dd4e42c662db234 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 14 Mar 2021 15:09:04 +0300 Subject: [PATCH 128/150] fix doc typo --- .../kotlin/space/kscience/kmath/linear/LinearSpace.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt index de9ac35db..1642bfb14 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt @@ -156,7 +156,7 @@ public interface LinearSpace> { /** * Gets a feature from the matrix. This function may return some additional features to - * [group.kscience.kmath.nd.NDStructure.getFeature]. + * [space.kscience.kmath.nd.NDStructure.getFeature]. * * @param F the type of feature. * @param m the matrix. @@ -190,7 +190,7 @@ public operator fun , R> LS.invoke(block: LS.() -> R): R /** * Gets a feature from the matrix. This function may return some additional features to - * [group.kscience.kmath.nd.NDStructure.getFeature]. + * [space.kscience.kmath.nd.NDStructure.getFeature]. * * @param T the type of items in the matrices. * @param M the type of operated matrices. From 0e0deaeb72d0ecc4cb6acb7fa6a1409b249f555b Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 15 Mar 2021 14:26:17 +0300 Subject: [PATCH 129/150] Refactor buffer factories --- CHANGELOG.md | 2 +- kmath-core/api/kmath-core.api | 17 +- ...rLinearSpace.kt => BufferedLinearSpace.kt} | 2 +- .../kscience/kmath/linear/LinearSolver.kt | 13 +- .../kscience/kmath/linear/LinearSpace.kt | 5 +- .../kscience/kmath/linear/LupDecomposition.kt | 6 +- .../space/kscience/kmath/nd/NDStructure.kt | 4 +- .../space/kscience/kmath/nd/RealNDField.kt | 3 +- .../space/kscience/kmath/nd/Structure1D.kt | 9 ++ .../space/kscience/kmath/nd/Structure2D.kt | 7 +- .../space/kscience/kmath/structures/Buffer.kt | 150 +++++++----------- .../kmath/structures/bufferOperation.kt | 79 ++++++++- .../space/kscience/kmath/real/RealVector.kt | 7 +- .../kaceince/kmath/real/RealVectorTest.kt | 12 +- .../kscience/kmath/histogram/Histogram.kt | 4 +- .../space/kscience/kmath/stat/Distribution.kt | 3 +- 16 files changed, 198 insertions(+), 125 deletions(-) rename kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/{BufferLinearSpace.kt => BufferedLinearSpace.kt} (98%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47690e36a..eb97698c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ - Exponential operations merged with hyperbolic functions - Space is replaced by Group. Space is reserved for vector spaces. - VectorSpace is now a vector space -- +- Buffer factories for primitives moved to MutableBuffer.Companion ### Deprecated diff --git a/kmath-core/api/kmath-core.api b/kmath-core/api/kmath-core.api index 2fa9e165b..c5e13fe20 100644 --- a/kmath-core/api/kmath-core.api +++ b/kmath-core/api/kmath-core.api @@ -432,7 +432,7 @@ public final class space/kscience/kmath/expressions/SymbolIndexerKt { public static final fun withSymbols ([Lspace/kscience/kmath/expressions/Symbol;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; } -public final class space/kscience/kmath/linear/BufferLinearSpace : space/kscience/kmath/linear/LinearSpace { +public final class space/kscience/kmath/linear/BufferedLinearSpace : space/kscience/kmath/linear/LinearSpace { public fun (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V public fun buildMatrix (IILkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/Structure2D; public fun buildVector (ILkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; @@ -2115,7 +2115,6 @@ public abstract interface class space/kscience/kmath/structures/Buffer { public final class space/kscience/kmath/structures/Buffer$Companion { public final fun auto (Lkotlin/reflect/KClass;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; public final fun boxing (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; - public final fun real-8hrHhI4 (ILkotlin/jvm/functions/Function1;)[D } public final class space/kscience/kmath/structures/Buffer$DefaultImpls { @@ -2123,15 +2122,17 @@ public final class space/kscience/kmath/structures/Buffer$DefaultImpls { } public final class space/kscience/kmath/structures/BufferKt { - public static final fun ListBuffer (ILkotlin/jvm/functions/Function1;)Ljava/util/List; public static final fun asBuffer (Ljava/util/List;)Ljava/util/List; public static final fun asBuffer ([Ljava/lang/Object;)Lspace/kscience/kmath/structures/ArrayBuffer; - public static final fun asIterable (Lspace/kscience/kmath/structures/Buffer;)Ljava/lang/Iterable; + public static final fun asMutableBuffer (Ljava/util/List;)Ljava/util/List; public static final fun asReadOnly (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public static final fun asSequence (Lspace/kscience/kmath/structures/Buffer;)Lkotlin/sequences/Sequence; public static final fun getIndices (Lspace/kscience/kmath/structures/Buffer;)Lkotlin/ranges/IntRange; +} + +public final class space/kscience/kmath/structures/BufferOperationKt { + public static final fun asIterable (Lspace/kscience/kmath/structures/Buffer;)Ljava/lang/Iterable; + public static final fun asSequence (Lspace/kscience/kmath/structures/Buffer;)Lkotlin/sequences/Sequence; public static final fun toList (Lspace/kscience/kmath/structures/Buffer;)Ljava/util/List; - public static final fun toMutableList (Lspace/kscience/kmath/structures/Buffer;)Ljava/util/List; } public abstract interface class space/kscience/kmath/structures/FlaggedBuffer : space/kscience/kmath/structures/Buffer { @@ -2316,7 +2317,11 @@ public abstract interface class space/kscience/kmath/structures/MutableBuffer : public final class space/kscience/kmath/structures/MutableBuffer$Companion { public final fun auto (Lkotlin/reflect/KClass;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/MutableBuffer; public final fun boxing (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/MutableBuffer; + public final fun float-YxruXGw (ILkotlin/jvm/functions/Function1;)[F + public final fun int-Ye6GY2U (ILkotlin/jvm/functions/Function1;)[I + public final fun long-BuQOeTY (ILkotlin/jvm/functions/Function1;)[J public final fun real-8hrHhI4 (ILkotlin/jvm/functions/Function1;)[D + public final fun short-1yRgbGw (ILkotlin/jvm/functions/Function1;)[S } public final class space/kscience/kmath/structures/MutableBuffer$DefaultImpls { diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferLinearSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferedLinearSpace.kt similarity index 98% rename from kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferLinearSpace.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferedLinearSpace.kt index b6c2ea17b..5814ab35c 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferLinearSpace.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferedLinearSpace.kt @@ -9,7 +9,7 @@ import space.kscience.kmath.structures.VirtualBuffer import space.kscience.kmath.structures.indices -public class BufferLinearSpace>( +public class BufferedLinearSpace>( override val elementAlgebra: A, private val bufferFactory: BufferFactory, ) : LinearSpace { diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSolver.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSolver.kt index 6cce5a446..af136c552 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSolver.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSolver.kt @@ -6,9 +6,20 @@ import space.kscience.kmath.nd.as1D * A group of methods to resolve equation A dot X = B, where A and B are matrices or vectors */ public interface LinearSolver { + /** + * Solve a dot x = b matrix equation and return x + */ public fun solve(a: Matrix, b: Matrix): Matrix + + /** + * Solve a dot x = b vector equation and return b + */ public fun solve(a: Matrix, b: Point): Point = solve(a, b.asMatrix()).asVector() - public fun inverse(a: Matrix): Matrix + + /** + * Get inverse of a matrix + */ + public fun inverse(matrix: Matrix): Matrix } /** diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt index 1642bfb14..cf8564e08 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt @@ -5,6 +5,7 @@ import space.kscience.kmath.nd.* import space.kscience.kmath.operations.* import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.BufferFactory +import space.kscience.kmath.structures.RealBuffer import kotlin.reflect.KClass /** @@ -174,9 +175,9 @@ public interface LinearSpace> { public fun > buffered( algebra: A, bufferFactory: BufferFactory = Buffer.Companion::boxing, - ): LinearSpace = BufferLinearSpace(algebra,bufferFactory) + ): LinearSpace = BufferedLinearSpace(algebra,bufferFactory) - public val real: LinearSpace = buffered(RealField, Buffer.Companion::real) + public val real: LinearSpace = buffered(RealField, ::RealBuffer) /** * Automatic buffered matrix, unboxed if it is possible diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LupDecomposition.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LupDecomposition.kt index 0937f1e19..eed50ec28 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LupDecomposition.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LupDecomposition.kt @@ -3,10 +3,10 @@ package space.kscience.kmath.linear import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.nd.getFeature import space.kscience.kmath.operations.* -import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.BufferAccessor2D import space.kscience.kmath.structures.MutableBuffer import space.kscience.kmath.structures.MutableBufferFactory +import space.kscience.kmath.structures.RealBuffer /** * Common implementation of [LupDecompositionFeature]. @@ -152,7 +152,7 @@ public inline fun > LinearSpace>.lup( ): LupDecomposition = lup(MutableBuffer.Companion::auto, matrix, checkSingular) public fun LinearSpace.lup(matrix: Matrix): LupDecomposition = - lup(Buffer.Companion::real, matrix) { it < 1e-11 } + lup(::RealBuffer, matrix) { it < 1e-11 } public fun LupDecomposition.solveWithLup( factory: MutableBufferFactory, @@ -230,7 +230,7 @@ public inline fun > LinearSpace>.inverseWi @OptIn(UnstableKMathAPI::class) public fun LinearSpace.solveWithLup(a: Matrix, b: Matrix): Matrix { // Use existing decomposition if it is provided by matrix - val bufferFactory: MutableBufferFactory = MutableBuffer.Companion::real + val bufferFactory: MutableBufferFactory = ::RealBuffer val decomposition: LupDecomposition = a.getFeature() ?: lup(bufferFactory, a) { it < 1e-11 } return decomposition.solveWithLup(bufferFactory, b) } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDStructure.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDStructure.kt index 48041df58..d758f195d 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDStructure.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDStructure.kt @@ -48,8 +48,8 @@ public interface NDStructure { public override fun hashCode(): Int /** - * Feature is additional property or hint that does not directly affect the structure, but could in some cases help - * optimize operations and performance. If the feature is not present, null is defined. + * Feature is some additional strucure information which allows to access it special properties or hints. + * If the feature is not present, null is returned. */ @UnstableKMathAPI public fun getFeature(type: KClass): F? = null diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/RealNDField.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/RealNDField.kt index 2165aea22..9f1f14af1 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/RealNDField.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/RealNDField.kt @@ -5,7 +5,6 @@ import space.kscience.kmath.operations.ExtendedField import space.kscience.kmath.operations.NumbersAddOperations import space.kscience.kmath.operations.RealField import space.kscience.kmath.operations.ScaleOperations -import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.RealBuffer import kotlin.contracts.InvocationKind import kotlin.contracts.contract @@ -13,7 +12,7 @@ import kotlin.contracts.contract @OptIn(UnstableKMathAPI::class) public class RealNDField( shape: IntArray, -) : BufferedNDField(shape, RealField, Buffer.Companion::real), +) : BufferedNDField(shape, RealField, ::RealBuffer), NumbersAddOperations>, ScaleOperations>, ExtendedField> { diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt index 1335a4933..ac8714803 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt @@ -56,3 +56,12 @@ public fun NDStructure.as1D(): Structure1D = this as? Structure1D ? * Represent this buffer as 1D structure */ public fun Buffer.asND(): Structure1D = Buffer1DWrapper(this) + +/** + * Expose inner buffer of this [Structure1D] if possible + */ +internal fun Structure1D.unwrap(): Buffer = when { + this is Buffer1DWrapper -> buffer + this is Structure1DWrapper && structure is NDBuffer -> structure.buffer + else -> this +} diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt index e9f8234e5..60dedc933 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt @@ -86,4 +86,9 @@ public fun NDStructure.as2D(): Structure2D = this as? Structure2D ? else -> error("Can't create 2d-structure from ${shape.size}d-structure") } -internal fun Structure2D.unwrap(): NDStructure = if (this is Structure2DWrapper) structure else this \ No newline at end of file +/** + * Expose inner [NDStructure] if possible + */ +internal fun Structure2D.unwrap(): NDStructure = + if (this is Structure2DWrapper) structure + else this \ No newline at end of file diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt index 2bde18fce..1d40a2f2e 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt @@ -44,21 +44,12 @@ public interface Buffer { asSequence().mapIndexed { index, value -> value == other[index] }.all { it } public companion object { - /** - * Creates a [RealBuffer] with the specified [size], where each element is calculated by calling the specified - * [initializer] function. - */ - public inline fun real(size: Int, initializer: (Int) -> Double): RealBuffer = - RealBuffer(size) { initializer(it) } - /** * Creates a [ListBuffer] of given type [T] with given [size]. Each element is calculated by calling the * specified [initializer] function. */ public inline fun boxing(size: Int, initializer: (Int) -> T): Buffer = - ListBuffer(List(size, initializer)) - - // TODO add resolution based on Annotation or companion resolution + List(size, initializer).asBuffer() /** * Creates a [Buffer] of given [type]. If the type is primitive, specialized buffers are used ([IntBuffer], @@ -69,11 +60,11 @@ public interface Buffer { @Suppress("UNCHECKED_CAST") public inline fun auto(type: KClass, size: Int, initializer: (Int) -> T): Buffer = when (type) { - Double::class -> RealBuffer(size) { initializer(it) as Double } as Buffer - Short::class -> ShortBuffer(size) { initializer(it) as Short } as Buffer - Int::class -> IntBuffer(size) { initializer(it) as Int } as Buffer - Long::class -> LongBuffer(size) { initializer(it) as Long } as Buffer - Float::class -> FloatBuffer(size) { initializer(it) as Float } as Buffer + Double::class -> MutableBuffer.real(size) { initializer(it) as Double } as Buffer + Short::class -> MutableBuffer.short(size) { initializer(it) as Short } as Buffer + Int::class -> MutableBuffer.int(size) { initializer(it) as Int } as Buffer + Long::class -> MutableBuffer.long(size) { initializer(it) as Long } as Buffer + Float::class -> MutableBuffer.float(size) { initializer(it) as Float } as Buffer else -> boxing(size, initializer) } @@ -89,41 +80,6 @@ public interface Buffer { } } -/** - * Creates a sequence that returns all elements from this [Buffer]. - */ -public fun Buffer.asSequence(): Sequence = Sequence(::iterator) - -/** - * Creates an iterable that returns all elements from this [Buffer]. - */ -public fun Buffer.asIterable(): Iterable = Iterable(::iterator) - -/** - * Returns a new [List] containing all elements of this buffer. - */ -public fun Buffer.toList(): List = when (this) { - is ArrayBuffer -> array.toList() - is ListBuffer -> list.toList() - is MutableListBuffer -> list.toList() - else -> asSequence().toList() -} - -/** - * Returns a new [MutableList] filled with all elements of this buffer. - */ -public fun Buffer.toMutableList(): MutableList = when (this) { - is ArrayBuffer -> array.toMutableList() - is ListBuffer -> list.toMutableList() - is MutableListBuffer -> list.toMutableList() - else -> asSequence().toMutableList() -} - -/** - * Returns a new [Array] containing all elements of this buffer. - */ -public inline fun Buffer.toTypedArray(): Array = asSequence().toList().toTypedArray() - /** * Returns an [IntRange] of the valid indices for this [Buffer]. */ @@ -146,6 +102,44 @@ public interface MutableBuffer : Buffer { public fun copy(): MutableBuffer public companion object { + + /** + * Creates a [RealBuffer] with the specified [size], where each element is calculated by calling the specified + * [initializer] function. + */ + public inline fun real(size: Int, initializer: (Int) -> Double): RealBuffer = + RealBuffer(size, initializer) + + /** + * Creates a [ShortBuffer] with the specified [size], where each element is calculated by calling the specified + * [initializer] function. + */ + public inline fun short(size: Int, initializer: (Int) -> Short): ShortBuffer = + ShortBuffer(size, initializer) + + /** + * Creates a [IntBuffer] with the specified [size], where each element is calculated by calling the specified + * [initializer] function. + */ + public inline fun int(size: Int, initializer: (Int) -> Int): IntBuffer = + IntBuffer(size, initializer) + + /** + * Creates a [LongBuffer] with the specified [size], where each element is calculated by calling the specified + * [initializer] function. + */ + public inline fun long(size: Int, initializer: (Int) -> Long): LongBuffer = + LongBuffer(size, initializer) + + + /** + * Creates a [FloatBuffer] with the specified [size], where each element is calculated by calling the specified + * [initializer] function. + */ + public inline fun float(size: Int, initializer: (Int) -> Float): FloatBuffer = + FloatBuffer(size, initializer) + + /** * Create a boxing mutable buffer of given type */ @@ -161,11 +155,11 @@ public interface MutableBuffer : Buffer { @Suppress("UNCHECKED_CAST") public inline fun auto(type: KClass, size: Int, initializer: (Int) -> T): MutableBuffer = when (type) { - Double::class -> RealBuffer(size) { initializer(it) as Double } as MutableBuffer - Short::class -> ShortBuffer(size) { initializer(it) as Short } as MutableBuffer - Int::class -> IntBuffer(size) { initializer(it) as Int } as MutableBuffer - Float::class -> FloatBuffer(size) { initializer(it) as Float } as MutableBuffer - Long::class -> LongBuffer(size) { initializer(it) as Long } as MutableBuffer + Double::class -> real(size) { initializer(it) as Double } as MutableBuffer + Short::class -> short(size) { initializer(it) as Short } as MutableBuffer + Int::class -> int(size) { initializer(it) as Int } as MutableBuffer + Float::class -> float(size) { initializer(it) as Float } as MutableBuffer + Long::class -> long(size) { initializer(it) as Long } as MutableBuffer else -> boxing(size, initializer) } @@ -178,13 +172,6 @@ public interface MutableBuffer : Buffer { @Suppress("UNCHECKED_CAST") public inline fun auto(size: Int, initializer: (Int) -> T): MutableBuffer = auto(T::class, size, initializer) - - /** - * Creates a [RealBuffer] with the specified [size], where each element is calculated by calling the specified - * [initializer] function. - */ - public inline fun real(size: Int, initializer: (Int) -> Double): RealBuffer = - RealBuffer(size) { initializer(it) } } } @@ -207,15 +194,6 @@ public inline class ListBuffer(public val list: List) : Buffer { */ public fun List.asBuffer(): ListBuffer = ListBuffer(this) -/** - * Creates a new [ListBuffer] 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 ListBuffer(size: Int, init: (Int) -> T): ListBuffer = List(size, init).asBuffer() - /** * [MutableBuffer] implementation over [MutableList]. * @@ -236,6 +214,11 @@ public inline class MutableListBuffer(public val list: MutableList) : Muta override fun copy(): MutableBuffer = MutableListBuffer(ArrayList(list)) } +/** + * Returns an [ListBuffer] that wraps the original list. + */ +public fun MutableList.asMutableBuffer(): MutableListBuffer = MutableListBuffer(this) + /** * [MutableBuffer] implementation over [Array]. * @@ -244,8 +227,7 @@ public inline class MutableListBuffer(public val list: MutableList) : Muta */ public class ArrayBuffer(internal val array: Array) : MutableBuffer { // Can't inline because array is invariant - override val size: Int - get() = array.size + override val size: Int get() = array.size override operator fun get(index: Int): T = array[index] @@ -263,16 +245,6 @@ public class ArrayBuffer(internal val array: Array) : MutableBuffer { */ 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]. * @@ -313,14 +285,4 @@ public class VirtualBuffer(override val size: Int, private val generator: (In /** * Convert this buffer to read-only buffer. */ -public fun Buffer.asReadOnly(): Buffer = if (this is MutableBuffer) ReadOnlyBuffer(this) else this - -/** - * Typealias for buffer transformations. - */ -public typealias BufferTransform = (Buffer) -> Buffer - -/** - * Typealias for buffer transformations with suspend function. - */ -public typealias SuspendBufferTransform = suspend (Buffer) -> Buffer +public fun Buffer.asReadOnly(): Buffer = if (this is MutableBuffer) ReadOnlyBuffer(this) else this \ No newline at end of file diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/bufferOperation.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/bufferOperation.kt index 459136631..4355ba17f 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/bufferOperation.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/bufferOperation.kt @@ -1,7 +1,84 @@ package space.kscience.kmath.structures +import space.kscience.kmath.misc.UnstableKMathAPI +/** + * Typealias for buffer transformations. + */ +public typealias BufferTransform = (Buffer) -> Buffer + +/** + * Typealias for buffer transformations with suspend function. + */ +public typealias SuspendBufferTransform = suspend (Buffer) -> Buffer + + +/** + * Creates a sequence that returns all elements from this [Buffer]. + */ +public fun Buffer.asSequence(): Sequence = Sequence(::iterator) + +/** + * Creates an iterable that returns all elements from this [Buffer]. + */ +public fun Buffer.asIterable(): Iterable = Iterable(::iterator) + +/** + * Returns a new [List] containing all elements of this buffer. + */ +public fun Buffer.toList(): List = when (this) { + is ArrayBuffer -> array.toList() + is ListBuffer -> list.toList() + is MutableListBuffer -> list.toList() + else -> asSequence().toList() +} + +/** + * Returns a new [MutableList] filled with all elements of this buffer. + * **NOTE:** this method uses a protective copy, so it should not be used in performance-critical code. + */ +@UnstableKMathAPI +public fun Buffer.toMutableList(): MutableList = when (this) { + is ArrayBuffer -> array.toMutableList() + is ListBuffer -> list.toMutableList() + is MutableListBuffer -> list.toMutableList() + else -> MutableList(size, ::get) +} + +/** + * Returns a new [Array] containing all elements of this buffer. + * **NOTE:** this method uses a protective copy, so it should not be used in performance-critical code. + */ +@UnstableKMathAPI +public inline fun Buffer.toTypedArray(): Array = Array(size, ::get) + +/** + * Create a new buffer from this one with the given mapping function. + * Provided [BufferFactory] is used to construct the new buffer. + */ public inline fun Buffer.map( bufferFactory: BufferFactory = Buffer.Companion::auto, crossinline block: (T) -> R, -): Buffer = bufferFactory(size) { block(get(it)) } \ No newline at end of file +): Buffer = bufferFactory(size) { block(get(it)) } + +/** + * Create a new buffer from this one with the given indexed mapping function. + * Provided [BufferFactory] is used to construct the new buffer. + */ +public inline fun Buffer.mapIndexed( + bufferFactory: BufferFactory = Buffer.Companion::auto, + crossinline block: (index: Int, value: T) -> R, +): Buffer = bufferFactory(size) { block(it, get(it)) } + +/** + * Zip two buffers using given [transform]. + */ +@UnstableKMathAPI +public inline fun Buffer.zip( + other: Buffer, + bufferFactory: BufferFactory = Buffer.Companion::auto, + crossinline transform: (T1, T2) -> R, +): Buffer { + require(size == other.size) { "Buffer size mismatch in zip: expected $size but found ${other.size}" } + return bufferFactory(size) { transform(get(it), other[it]) } +} \ No newline at end of file diff --git a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealVector.kt b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealVector.kt index ee42fe404..8cc128947 100644 --- a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealVector.kt +++ b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealVector.kt @@ -1,8 +1,10 @@ package space.kscience.kmath.real import space.kscience.kmath.linear.Point +import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.operations.Norm import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.MutableBuffer.Companion.real import space.kscience.kmath.structures.asBuffer import space.kscience.kmath.structures.asIterable import space.kscience.kmath.structures.indices @@ -20,15 +22,16 @@ public operator fun Buffer.Companion.invoke(vararg doubles: Double): RealVector /** * Fill the vector of given [size] with given [value] */ +@UnstableKMathAPI public fun Buffer.Companion.same(size: Int, value: Number): RealVector = real(size) { value.toDouble() } // Transformation methods public inline fun RealVector.map(transform: (Double) -> Double): RealVector = - Buffer.real(size) { transform(get(it)) } + real(size) { transform(get(it)) } public inline fun RealVector.mapIndexed(transform: (index: Int, value: Double) -> Double): RealVector = - Buffer.real(size) { transform(it, get(it)) } + real(size) { transform(it, get(it)) } public operator fun RealVector.plus(other: RealVector): RealVector { require(size == other.size) { "Vector size $size expected but ${other.size} found" } diff --git a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealVectorTest.kt b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealVectorTest.kt index 59d55110f..60d85fda3 100644 --- a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealVectorTest.kt +++ b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealVectorTest.kt @@ -4,30 +4,30 @@ import space.kscience.kmath.linear.LinearSpace import space.kscience.kmath.linear.asMatrix import space.kscience.kmath.linear.transpose import space.kscience.kmath.real.plus -import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.RealBuffer import kotlin.test.Test import kotlin.test.assertEquals internal class RealVectorTest { @Test fun testSum() { - val vector1 = Buffer.real(5) { it.toDouble() } - val vector2 = Buffer.real(5) { 5 - it.toDouble() } + val vector1 = RealBuffer(5) { it.toDouble() } + val vector2 = RealBuffer(5) { 5 - it.toDouble() } val sum = vector1 + vector2 assertEquals(5.0, sum[2]) } @Test fun testVectorToMatrix() { - val vector = Buffer.real(5) { it.toDouble() } + val vector = RealBuffer(5) { it.toDouble() } val matrix = vector.asMatrix() assertEquals(4.0, matrix[4, 0]) } @Test fun testDot() { - val vector1 = Buffer.real(5) { it.toDouble() } - val vector2 = Buffer.real(5) { 5 - it.toDouble() } + val vector1 = RealBuffer(5) { it.toDouble() } + val vector2 = RealBuffer(5) { 5 - it.toDouble() } val matrix1 = vector1.asMatrix() val matrix2 = vector2.asMatrix().transpose() val product = LinearSpace.real.run { matrix1 dot matrix2 } diff --git a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Histogram.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Histogram.kt index 73b34783c..9ee4a6e1e 100644 --- a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Histogram.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Histogram.kt @@ -2,8 +2,8 @@ package space.kscience.kmath.histogram import space.kscience.kmath.domains.Domain import space.kscience.kmath.linear.Point -import space.kscience.kmath.structures.ArrayBuffer import space.kscience.kmath.structures.RealBuffer +import space.kscience.kmath.structures.asBuffer /** * The binned data element. Could be a histogram bin with a number of counts or an artificial construct @@ -40,7 +40,7 @@ public fun interface HistogramBuilder { public fun > HistogramBuilder.put(point: Point): Unit = putValue(point, 1.0) -public fun HistogramBuilder.put(vararg point: T): Unit = put(ArrayBuffer(point)) +public fun HistogramBuilder.put(vararg point: T): Unit = put(point.asBuffer()) public fun HistogramBuilder.put(vararg point: Number): Unit = put(RealBuffer(point.map { it.toDouble() }.toDoubleArray())) diff --git a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Distribution.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Distribution.kt index fa38dd9e4..b5b6db1d8 100644 --- a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Distribution.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Distribution.kt @@ -4,6 +4,7 @@ import space.kscience.kmath.chains.Chain import space.kscience.kmath.chains.collect import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.BufferFactory +import space.kscience.kmath.structures.RealBuffer public interface Sampler { public fun sample(generator: RandomGenerator): Chain @@ -74,4 +75,4 @@ public fun Sampler.sampleBuffer( * Generate a bunch of samples from real distributions */ public fun Sampler.sampleBuffer(generator: RandomGenerator, size: Int): Chain> = - sampleBuffer(generator, size, Buffer.Companion::real) + sampleBuffer(generator, size, ::RealBuffer) From d9743978ab5739e087f23bbe1c86240231ca5b10 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 15 Mar 2021 14:26:59 +0300 Subject: [PATCH 130/150] Reformat code --- .../kmath/expressions/DifferentiableExpression.kt | 2 +- .../kscience/kmath/expressions/Expression.kt | 2 +- .../expressions/FunctionalExpressionAlgebra.kt | 2 +- .../kscience/kmath/linear/BufferedLinearSpace.kt | 2 +- .../space/kscience/kmath/linear/LinearSpace.kt | 2 +- .../space/kscience/kmath/linear/VirtualMatrix.kt | 2 +- .../kotlin/space/kscience/kmath/nd/NDAlgebra.kt | 15 ++++++++------- .../kscience/kmath/operations/AlgebraElements.kt | 2 +- .../kmath/operations/algebraExtensions.kt | 4 ++-- .../kscience/kmath/structures/BufferAccessor2D.kt | 4 ++-- .../kscience/kmath/structures/FloatBuffer.kt | 2 +- .../space/kscience/kmath/structures/IntBuffer.kt | 2 +- .../space/kscience/kmath/structures/LongBuffer.kt | 2 +- .../kscience/kmath/structures/MemoryBuffer.kt | 4 ++-- .../space/kscience/kmath/structures/RealBuffer.kt | 2 +- .../kscience/kmath/structures/ShortBuffer.kt | 2 +- .../kscience/kmath/linear/RealLUSolverTest.kt | 6 +++--- .../kmath/structures/NumberNDFieldTest.kt | 2 +- 18 files changed, 30 insertions(+), 29 deletions(-) diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/DifferentiableExpression.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/DifferentiableExpression.kt index 508a62aca..5cbc4dbf4 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/DifferentiableExpression.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/DifferentiableExpression.kt @@ -28,7 +28,7 @@ public fun > DifferentiableExpression.derivative(name /** * A [DifferentiableExpression] that defines only first derivatives */ -public abstract class FirstDerivativeExpression> : DifferentiableExpression { +public abstract class FirstDerivativeExpression> : DifferentiableExpression { /** * Returns first derivative of this expression by given [symbol]. */ diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/Expression.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/Expression.kt index 231bbdab1..5ba24aa62 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/Expression.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/Expression.kt @@ -95,7 +95,7 @@ public fun ExpressionAlgebra.bindSymbol(symbol: Symbol): E = /** * A delegate to create a symbol with a string identity in this scope */ -public val symbol: ReadOnlyProperty = ReadOnlyProperty { _, property -> +public val symbol: ReadOnlyProperty = ReadOnlyProperty { _, property -> StringSymbol(property.name) } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/FunctionalExpressionAlgebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/FunctionalExpressionAlgebra.kt index 880f13a3e..cca75754f 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/FunctionalExpressionAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/FunctionalExpressionAlgebra.kt @@ -98,7 +98,7 @@ public open class FunctionalExpressionRing>( super.binaryOperationFunction(operation) } -public open class FunctionalExpressionField>( +public open class FunctionalExpressionField>( algebra: A, ) : FunctionalExpressionRing(algebra), Field>, ScaleOperations> { diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferedLinearSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferedLinearSpace.kt index 5814ab35c..fe92a711a 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferedLinearSpace.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferedLinearSpace.kt @@ -48,7 +48,7 @@ public class BufferedLinearSpace>( override fun Matrix.dot(other: Matrix): Matrix { require(colNum == other.rowNum) { "Matrix dot operation dimension mismatch: ($rowNum, $colNum) x (${other.rowNum}, ${other.colNum})" } return elementAlgebra { - val rows = this@dot.rows.map{it.linearize()} + val rows = this@dot.rows.map { it.linearize() } val columns = other.columns.map { it.linearize() } buildMatrix(rowNum, other.colNum) { i, j -> val r = rows[i] diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt index cf8564e08..740ad12eb 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt @@ -175,7 +175,7 @@ public interface LinearSpace> { public fun > buffered( algebra: A, bufferFactory: BufferFactory = Buffer.Companion::boxing, - ): LinearSpace = BufferedLinearSpace(algebra,bufferFactory) + ): LinearSpace = BufferedLinearSpace(algebra, bufferFactory) public val real: LinearSpace = buffered(RealField, ::RealBuffer) diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VirtualMatrix.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VirtualMatrix.kt index 7f0451946..8efa08f81 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VirtualMatrix.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VirtualMatrix.kt @@ -10,7 +10,7 @@ import space.kscience.kmath.nd.NDStructure public class VirtualMatrix( override val rowNum: Int, override val colNum: Int, - public val generator: (i: Int, j: Int) -> T + public val generator: (i: Int, j: Int) -> T, ) : Matrix { override val shape: IntArray get() = intArrayOf(rowNum, colNum) diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDAlgebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDAlgebra.kt index e3ffae74b..81e1e988a 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDAlgebra.kt @@ -19,7 +19,7 @@ public class ShapeMismatchException(public val expected: IntArray, public val ac * @param C the type of the element context. * @param N the type of the structure. */ -public interface NDAlgebra> { +public interface NDAlgebra> { /** * The shape of ND-structures this algebra operates on. */ @@ -65,11 +65,12 @@ public interface NDAlgebra> { * @param structures the structures to check. * @return the array of valid structures. */ -internal fun > NDAlgebra.checkShape(vararg structures: NDStructure): Array> = structures - .map(NDStructure::shape) - .singleOrNull { !shape.contentEquals(it) } - ?.let>> { throw ShapeMismatchException(shape, it) } - ?: structures +internal fun > NDAlgebra.checkShape(vararg structures: NDStructure): Array> = + structures + .map(NDStructure::shape) + .singleOrNull { !shape.contentEquals(it) } + ?.let>> { throw ShapeMismatchException(shape, it) } + ?: structures /** * Checks if given element is consistent with this context. @@ -77,7 +78,7 @@ internal fun > NDAlgebra.checkShape(vararg structures: ND * @param element the structure to check. * @return the valid structure. */ -internal fun > NDAlgebra.checkShape(element: NDStructure): NDStructure { +internal fun > NDAlgebra.checkShape(element: NDStructure): NDStructure { if (!element.shape.contentEquals(shape)) throw ShapeMismatchException(shape, element.shape) return element } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/AlgebraElements.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/AlgebraElements.kt index 3e42ac094..b2b5911df 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/AlgebraElements.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/AlgebraElements.kt @@ -41,7 +41,7 @@ public interface AlgebraElement> { */ @UnstableKMathAPI public operator fun , S : NumbersAddOperations> T.minus(b: T): T = - context.add(this, context.run { -b}) + context.add(this, context.run { -b }) /** * Adds element to this one. diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/algebraExtensions.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/algebraExtensions.kt index 52a0dec6f..9a395b0f4 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/algebraExtensions.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/algebraExtensions.kt @@ -71,7 +71,7 @@ public fun Sequence.sumWith(space: Group): T = space.sum(this) * @return the average value. * @author Iaroslav Postovalov */ -public fun Iterable.averageWith(space: S): T where S : Group, S : ScaleOperations = +public fun Iterable.averageWith(space: S): T where S : Group, S : ScaleOperations = space.average(this) /** @@ -82,7 +82,7 @@ public fun Iterable.averageWith(space: S): T where S : Group, S : * @return the average value. * @author Iaroslav Postovalov */ -public fun Sequence.averageWith(space: S): T where S : Group, S : ScaleOperations = +public fun Sequence.averageWith(space: S): T where S : Group, S : ScaleOperations = space.average(this) //TODO optimized power operation diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/BufferAccessor2D.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/BufferAccessor2D.kt index 0910b2034..c65af7a98 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/BufferAccessor2D.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/BufferAccessor2D.kt @@ -13,10 +13,10 @@ internal class BufferAccessor2D( public val colNum: Int, val factory: MutableBufferFactory, ) { - public operator fun Buffer.get(i: Int, j: Int): T = get(i*colNum + j) + public operator fun Buffer.get(i: Int, j: Int): T = get(i * colNum + j) public operator fun MutableBuffer.set(i: Int, j: Int, value: T) { - set(i*colNum + j, value) + set(i * colNum + j, value) } public inline fun create(crossinline init: (i: Int, j: Int) -> T): MutableBuffer = diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/FloatBuffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/FloatBuffer.kt index 9fc7d55f3..5c4ec3b05 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/FloatBuffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/FloatBuffer.kt @@ -38,7 +38,7 @@ public fun FloatBuffer(vararg floats: Float): FloatBuffer = FloatBuffer(floats) /** * Returns a new [FloatArray] containing all of the elements of this [Buffer]. */ -public fun Buffer.toFloatArray(): FloatArray = when(this) { +public fun Buffer.toFloatArray(): FloatArray = when (this) { is FloatBuffer -> array.copyOf() else -> FloatArray(size, ::get) } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/IntBuffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/IntBuffer.kt index d3d0f79a5..32dfcf9aa 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/IntBuffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/IntBuffer.kt @@ -37,7 +37,7 @@ public fun IntBuffer(vararg ints: Int): IntBuffer = IntBuffer(ints) /** * Returns a new [IntArray] containing all of the elements of this [Buffer]. */ -public fun Buffer.toIntArray(): IntArray = when(this) { +public fun Buffer.toIntArray(): IntArray = when (this) { is IntBuffer -> array.copyOf() else -> IntArray(size, ::get) } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/LongBuffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/LongBuffer.kt index fec358421..48b1d7a7b 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/LongBuffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/LongBuffer.kt @@ -37,7 +37,7 @@ public fun LongBuffer(vararg longs: Long): LongBuffer = LongBuffer(longs) /** * Returns a new [LongArray] containing all of the elements of this [Buffer]. */ -public fun Buffer.toLongArray(): LongArray = when(this) { +public fun Buffer.toLongArray(): LongArray = when (this) { is LongBuffer -> array.copyOf() else -> LongArray(size, ::get) } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/MemoryBuffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/MemoryBuffer.kt index 418adb537..50a2db590 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/MemoryBuffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/MemoryBuffer.kt @@ -24,7 +24,7 @@ public open class MemoryBuffer(protected val memory: Memory, protected public inline fun create( spec: MemorySpec, size: Int, - initializer: (Int) -> T + initializer: (Int) -> T, ): MemoryBuffer = MutableMemoryBuffer(Memory.allocate(size * spec.objectSize), spec).also { buffer -> (0 until size).forEach { buffer[it] = initializer(it) } } @@ -53,7 +53,7 @@ public class MutableMemoryBuffer(memory: Memory, spec: MemorySpec) : public inline fun create( spec: MemorySpec, size: Int, - initializer: (Int) -> T + initializer: (Int) -> T, ): MutableMemoryBuffer = MutableMemoryBuffer(Memory.allocate(size * spec.objectSize), spec).also { buffer -> (0 until size).forEach { buffer[it] = initializer(it) } } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBuffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBuffer.kt index 01b533138..b56c03b76 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBuffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBuffer.kt @@ -42,7 +42,7 @@ public fun RealBuffer.contentEquals(vararg doubles: Double): Boolean = array.con /** * Returns a new [DoubleArray] containing all of the elements of this [Buffer]. */ -public fun Buffer.toDoubleArray(): DoubleArray = when(this) { +public fun Buffer.toDoubleArray(): DoubleArray = when (this) { is RealBuffer -> array.copyOf() else -> DoubleArray(size, ::get) } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/ShortBuffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/ShortBuffer.kt index 77f128403..7832bb863 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/ShortBuffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/ShortBuffer.kt @@ -35,7 +35,7 @@ public fun ShortBuffer(vararg shorts: Short): ShortBuffer = ShortBuffer(shorts) /** * Returns a new [ShortArray] containing all of the elements of this [Buffer]. */ -public fun Buffer.toShortArray(): ShortArray = when(this) { +public fun Buffer.toShortArray(): ShortArray = when (this) { is ShortBuffer -> array.copyOf() else -> ShortArray(size, ::get) } diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt index fb90b5e11..e6efc6a8a 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt @@ -17,7 +17,7 @@ class RealLUSolverTest { @Test fun testDecomposition() { LinearSpace.real.run { - val matrix = matrix(2,2)( + val matrix = matrix(2, 2)( 3.0, 1.0, 2.0, 3.0 ) @@ -33,14 +33,14 @@ class RealLUSolverTest { @Test fun testInvert() { - val matrix = LinearSpace.real.matrix(2,2)( + val matrix = LinearSpace.real.matrix(2, 2)( 3.0, 1.0, 1.0, 3.0 ) val inverted = LinearSpace.real.inverseWithLup(matrix) - val expected = LinearSpace.real.matrix(2,2)( + val expected = LinearSpace.real.matrix(2, 2)( 0.375, -0.125, -0.125, 0.375 ) diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/structures/NumberNDFieldTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/structures/NumberNDFieldTest.kt index dd7871f9a..e9e6e92fb 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/structures/NumberNDFieldTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/structures/NumberNDFieldTest.kt @@ -11,7 +11,7 @@ import kotlin.test.assertEquals @Suppress("UNUSED_VARIABLE") class NumberNDFieldTest { - val algebra = NDAlgebra.real(3,3) + val algebra = NDAlgebra.real(3, 3) val array1 = algebra.produce { (i, j) -> (i + j).toDouble() } val array2 = algebra.produce { (i, j) -> (i - j).toDouble() } From 71ed56c2b69868948c39dba7dd22c9a4692f8a5c Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 15 Mar 2021 16:46:12 +0300 Subject: [PATCH 131/150] Move features to scopes --- .../kscience/kmath/commons/linear/CMMatrix.kt | 82 ++++++++++--------- .../kscience/kmath/linear/LinearSpace.kt | 21 ++--- .../space/kscience/kmath/nd/NDAlgebra.kt | 25 ++++++ .../kscience/kmath/ejml/EjmlLinearSpace.kt | 74 +++++++++++++++++ .../space/kscience/kmath/ejml/EjmlMatrix.kt | 69 +--------------- .../kscience/kmath/ejml/EjmlMatrixTest.kt | 9 +- 6 files changed, 156 insertions(+), 124 deletions(-) diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt index 5f632491c..5b45c2e51 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt @@ -13,44 +13,6 @@ public class CMMatrix(public val origin: RealMatrix) : Matrix { public override val rowNum: Int get() = origin.rowDimension public override val colNum: Int get() = origin.columnDimension - @UnstableKMathAPI - override fun getFeature(type: KClass): T? = when (type) { - DiagonalFeature::class -> if (origin is DiagonalMatrix) DiagonalFeature else null - - DeterminantFeature::class, LupDecompositionFeature::class -> object : - DeterminantFeature, - LupDecompositionFeature { - private val lup by lazy { LUDecomposition(origin) } - override val determinant: Double by lazy { lup.determinant } - override val l: Matrix by lazy { CMMatrix(lup.l) + LFeature } - override val u: Matrix by lazy { CMMatrix(lup.u) + UFeature } - override val p: Matrix by lazy { CMMatrix(lup.p) } - } - - CholeskyDecompositionFeature::class -> object : CholeskyDecompositionFeature { - override val l: Matrix by lazy { - val cholesky = CholeskyDecomposition(origin) - CMMatrix(cholesky.l) + LFeature - } - } - - QRDecompositionFeature::class -> object : QRDecompositionFeature { - private val qr by lazy { QRDecomposition(origin) } - override val q: Matrix by lazy { CMMatrix(qr.q) + OrthogonalFeature } - override val r: Matrix by lazy { CMMatrix(qr.r) + UFeature } - } - - SingularValueDecompositionFeature::class -> object : SingularValueDecompositionFeature { - private val sv by lazy { SingularValueDecomposition(origin) } - override val u: Matrix by lazy { CMMatrix(sv.u) } - override val s: Matrix by lazy { CMMatrix(sv.s) } - override val v: Matrix by lazy { CMMatrix(sv.v) } - override val singularValues: Point by lazy { RealBuffer(sv.singularValues) } - } - - else -> null - }?.let(type::cast) - public override operator fun get(i: Int, j: Int): Double = origin.getEntry(i, j) override fun equals(other: Any?): Boolean { @@ -134,6 +96,50 @@ public object CMLinearSpace : LinearSpace { override fun Double.times(v: Point): CMVector = v * this + + @UnstableKMathAPI + override fun getFeature(structure: Matrix, type: KClass): F? { + //Return the feature if it is intrinsic to the structure + structure.getFeature(type)?.let { return it } + + val origin = structure.toCM().origin + + return when (type) { + DiagonalFeature::class -> if (origin is DiagonalMatrix) DiagonalFeature else null + + DeterminantFeature::class, LupDecompositionFeature::class -> object : + DeterminantFeature, + LupDecompositionFeature { + private val lup by lazy { LUDecomposition(origin) } + override val determinant: Double by lazy { lup.determinant } + override val l: Matrix by lazy { CMMatrix(lup.l) + LFeature } + override val u: Matrix by lazy { CMMatrix(lup.u) + UFeature } + override val p: Matrix by lazy { CMMatrix(lup.p) } + } + + CholeskyDecompositionFeature::class -> object : CholeskyDecompositionFeature { + override val l: Matrix by lazy { + val cholesky = CholeskyDecomposition(origin) + CMMatrix(cholesky.l) + LFeature + } + } + + QRDecompositionFeature::class -> object : QRDecompositionFeature { + private val qr by lazy { QRDecomposition(origin) } + override val q: Matrix by lazy { CMMatrix(qr.q) + OrthogonalFeature } + override val r: Matrix by lazy { CMMatrix(qr.r) + UFeature } + } + + SingularValueDecompositionFeature::class -> object : SingularValueDecompositionFeature { + private val sv by lazy { SingularValueDecomposition(origin) } + override val u: Matrix by lazy { CMMatrix(sv.u) } + override val s: Matrix by lazy { CMMatrix(sv.s) } + override val v: Matrix by lazy { CMMatrix(sv.v) } + override val singularValues: Point by lazy { RealBuffer(sv.singularValues) } + } + else -> null + }?.let(type::cast) + } } public operator fun CMMatrix.plus(other: CMMatrix): CMMatrix = diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt index 740ad12eb..e8c7d119b 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt @@ -156,16 +156,15 @@ public interface LinearSpace> { public operator fun T.times(v: Point): Point = v * this /** - * Gets a feature from the matrix. This function may return some additional features to - * [space.kscience.kmath.nd.NDStructure.getFeature]. + * Get a feature of the structure in this scope. Structure features take precedence other context features * * @param F the type of feature. - * @param m the matrix. + * @param structure the structure. * @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 fun getFeature(structure: Matrix, type: KClass): F? = structure.getFeature(type) public companion object { @@ -187,19 +186,17 @@ public interface LinearSpace> { } } -public operator fun , R> LS.invoke(block: LS.() -> R): R = run(block) - /** - * Gets a feature from the matrix. This function may return some additional features to - * [space.kscience.kmath.nd.NDStructure.getFeature]. + * Get a feature of the structure in this scope. Structure features take precedence other context features * * @param T the type of items in the matrices. - * @param M the type of operated matrices. * @param F the type of feature. - * @receiver the [LinearSpace] of [T]. - * @param m the matrix. * @return a feature object or `null` if it isn't present. */ @UnstableKMathAPI -public inline fun LinearSpace.getFeature(m: Matrix): F? = getFeature(m, F::class) +public inline fun LinearSpace.getFeature(structure: Matrix): F? = + getFeature(structure, F::class) + + +public operator fun , R> LS.invoke(block: LS.() -> R): R = run(block) diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDAlgebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDAlgebra.kt index 81e1e988a..5514a8f0f 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDAlgebra.kt @@ -1,7 +1,9 @@ package space.kscience.kmath.nd +import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.operations.* import space.kscience.kmath.structures.* +import kotlin.reflect.KClass /** * An exception is thrown when the expected ans actual shape of NDArray differs. @@ -56,9 +58,32 @@ public interface NDAlgebra> { public operator fun Function1.invoke(structure: NDStructure): NDStructure = structure.map { value -> this@invoke(value) } + /** + * Get a feature of the structure in this scope. Structure features take precedence other context features + * + * @param F the type of feature. + * @param structure the structure. + * @param type the [KClass] instance of [F]. + * @return a feature object or `null` if it isn't present. + */ + @UnstableKMathAPI + public fun getFeature(structure: NDStructure, type: KClass): F? = structure.getFeature(type) + public companion object } + +/** + * Get a feature of the structure in this scope. Structure features take precedence other context features + * + * @param T the type of items in the matrices. + * @param F the type of feature. + * @return a feature object or `null` if it isn't present. + */ +@UnstableKMathAPI +public inline fun NDAlgebra.getFeature(structure: NDStructure): F? = + getFeature(structure, F::class) + /** * Checks if given elements are consistent with this context. * diff --git a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt index eecd88681..452280295 100644 --- a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt +++ b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt @@ -1,10 +1,14 @@ package space.kscience.kmath.ejml +import org.ejml.dense.row.factory.DecompositionFactory_DDRM import org.ejml.simple.SimpleMatrix import space.kscience.kmath.linear.* import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.nd.getFeature import space.kscience.kmath.operations.RealField +import space.kscience.kmath.structures.RealBuffer +import kotlin.reflect.KClass +import kotlin.reflect.cast /** * Represents context of basic operations operating with [EjmlMatrix]. @@ -83,6 +87,76 @@ public object EjmlLinearSpace : LinearSpace { override fun Double.times(v: Point): EjmlVector = v.toEjml().origin.scale(this).wrapVector() + + @UnstableKMathAPI + override fun getFeature(structure: Matrix, type: KClass): F? { + //Return the feature if it is intrinsic to the structure + structure.getFeature(type)?.let { return it } + + val origin = structure.toEjml().origin + + return when (type) { + InverseMatrixFeature::class -> object : InverseMatrixFeature { + override val inverse: Matrix by lazy { EjmlMatrix(origin.invert()) } + } + + DeterminantFeature::class -> object : DeterminantFeature { + override val determinant: Double by lazy(origin::determinant) + } + + SingularValueDecompositionFeature::class -> object : SingularValueDecompositionFeature { + private val svd by lazy { + DecompositionFactory_DDRM.svd(origin.numRows(), origin.numCols(), true, true, false) + .apply { decompose(origin.ddrm.copy()) } + } + + override val u: Matrix by lazy { EjmlMatrix(SimpleMatrix(svd.getU(null, false))) } + override val s: Matrix by lazy { EjmlMatrix(SimpleMatrix(svd.getW(null))) } + override val v: Matrix by lazy { EjmlMatrix(SimpleMatrix(svd.getV(null, false))) } + override val singularValues: Point by lazy { RealBuffer(svd.singularValues) } + } + + QRDecompositionFeature::class -> object : QRDecompositionFeature { + private val qr by lazy { + DecompositionFactory_DDRM.qr().apply { decompose(origin.ddrm.copy()) } + } + + override val q: Matrix by lazy { + EjmlMatrix(SimpleMatrix(qr.getQ(null, false))) + OrthogonalFeature + } + + override val r: Matrix by lazy { EjmlMatrix(SimpleMatrix(qr.getR(null, false))) + UFeature } + } + + CholeskyDecompositionFeature::class -> object : CholeskyDecompositionFeature { + override val l: Matrix by lazy { + val cholesky = + DecompositionFactory_DDRM.chol(structure.rowNum, true).apply { decompose(origin.ddrm.copy()) } + + EjmlMatrix(SimpleMatrix(cholesky.getT(null))) + LFeature + } + } + + LupDecompositionFeature::class -> object : LupDecompositionFeature { + private val lup by lazy { + DecompositionFactory_DDRM.lu(origin.numRows(), origin.numCols()) + .apply { decompose(origin.ddrm.copy()) } + } + + override val l: Matrix by lazy { + EjmlMatrix(SimpleMatrix(lup.getLower(null))) + LFeature + } + + override val u: Matrix by lazy { + EjmlMatrix(SimpleMatrix(lup.getUpper(null))) + UFeature + } + + override val p: Matrix by lazy { EjmlMatrix(SimpleMatrix(lup.getRowPivot(null))) } + } + + else -> null + }?.let(type::cast) + } } /** diff --git a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt index a1984fa31..5f93af729 100644 --- a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt +++ b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt @@ -1,13 +1,8 @@ package space.kscience.kmath.ejml -import org.ejml.dense.row.factory.DecompositionFactory_DDRM import org.ejml.simple.SimpleMatrix -import space.kscience.kmath.linear.* -import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.linear.Matrix import space.kscience.kmath.nd.NDStructure -import space.kscience.kmath.structures.RealBuffer -import kotlin.reflect.KClass -import kotlin.reflect.cast /** * Represents featured matrix over EJML [SimpleMatrix]. @@ -19,68 +14,6 @@ public class EjmlMatrix(public val origin: SimpleMatrix) : Matrix { public override val rowNum: Int get() = origin.numRows() public override val colNum: Int get() = origin.numCols() - @UnstableKMathAPI - public override fun getFeature(type: KClass): T? = when (type) { - InverseMatrixFeature::class -> object : InverseMatrixFeature { - override val inverse: Matrix by lazy { EjmlMatrix(origin.invert()) } - } - - DeterminantFeature::class -> object : DeterminantFeature { - override val determinant: Double by lazy(origin::determinant) - } - - SingularValueDecompositionFeature::class -> object : SingularValueDecompositionFeature { - private val svd by lazy { - DecompositionFactory_DDRM.svd(origin.numRows(), origin.numCols(), true, true, false) - .apply { decompose(origin.ddrm.copy()) } - } - - override val u: Matrix by lazy { EjmlMatrix(SimpleMatrix(svd.getU(null, false))) } - override val s: Matrix by lazy { EjmlMatrix(SimpleMatrix(svd.getW(null))) } - override val v: Matrix by lazy { EjmlMatrix(SimpleMatrix(svd.getV(null, false))) } - override val singularValues: Point by lazy { RealBuffer(svd.singularValues) } - } - - QRDecompositionFeature::class -> object : QRDecompositionFeature { - private val qr by lazy { - DecompositionFactory_DDRM.qr().apply { decompose(origin.ddrm.copy()) } - } - - override val q: Matrix by lazy { - EjmlMatrix(SimpleMatrix(qr.getQ(null, false))) + OrthogonalFeature - } - - override val r: Matrix by lazy { EjmlMatrix(SimpleMatrix(qr.getR(null, false))) + UFeature } - } - - CholeskyDecompositionFeature::class -> object : CholeskyDecompositionFeature { - override val l: Matrix by lazy { - val cholesky = - DecompositionFactory_DDRM.chol(rowNum, true).apply { decompose(origin.ddrm.copy()) } - - EjmlMatrix(SimpleMatrix(cholesky.getT(null))) + LFeature - } - } - - LupDecompositionFeature::class -> object : LupDecompositionFeature { - private val lup by lazy { - DecompositionFactory_DDRM.lu(origin.numRows(), origin.numCols()).apply { decompose(origin.ddrm.copy()) } - } - - override val l: Matrix by lazy { - EjmlMatrix(SimpleMatrix(lup.getLower(null))) + LFeature - } - - override val u: Matrix by lazy { - EjmlMatrix(SimpleMatrix(lup.getUpper(null))) + UFeature - } - - override val p: Matrix by lazy { EjmlMatrix(SimpleMatrix(lup.getRowPivot(null))) } - } - - else -> null - }?.let(type::cast) - public override operator fun get(i: Int, j: Int): Double = origin[i, j] override fun equals(other: Any?): Boolean { diff --git a/kmath-ejml/src/test/kotlin/space/kscience/kmath/ejml/EjmlMatrixTest.kt b/kmath-ejml/src/test/kotlin/space/kscience/kmath/ejml/EjmlMatrixTest.kt index 7f31d2f93..70b2ce723 100644 --- a/kmath-ejml/src/test/kotlin/space/kscience/kmath/ejml/EjmlMatrixTest.kt +++ b/kmath-ejml/src/test/kotlin/space/kscience/kmath/ejml/EjmlMatrixTest.kt @@ -2,10 +2,7 @@ package space.kscience.kmath.ejml import org.ejml.dense.row.factory.DecompositionFactory_DDRM import org.ejml.simple.SimpleMatrix -import space.kscience.kmath.linear.DeterminantFeature -import space.kscience.kmath.linear.LupDecompositionFeature -import space.kscience.kmath.linear.MatrixFeature -import space.kscience.kmath.linear.plus +import space.kscience.kmath.linear.* import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.nd.getFeature import kotlin.random.Random @@ -45,9 +42,9 @@ internal class EjmlMatrixTest { fun features() { val m = randomMatrix val w = EjmlMatrix(m) - val det = w.getFeature>() ?: fail() + val det: DeterminantFeature = EjmlLinearSpace.getFeature(w) ?: fail() assertEquals(m.determinant(), det.determinant) - val lup = w.getFeature>() ?: fail() + val lup: LupDecompositionFeature = EjmlLinearSpace.getFeature(w) ?: fail() val ludecompositionF64 = DecompositionFactory_DDRM.lu(m.numRows(), m.numCols()) .also { it.decompose(m.ddrm.copy()) } From cceffa09e827bf0e17a2d79784d8927ce5653f6b Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 15 Mar 2021 19:24:07 +0300 Subject: [PATCH 132/150] Bump dev version --- build.gradle.kts | 2 +- .../space/kscience/kmath/commons/linear/CMMatrix.kt | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 113107f69..9810e378f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -20,7 +20,7 @@ allprojects { } group = "space.kscience" - version = "0.3.0" + version = "0.3.0-dev-2" } subprojects { diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt index 5b45c2e51..4671598f7 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt @@ -103,7 +103,7 @@ public object CMLinearSpace : LinearSpace { structure.getFeature(type)?.let { return it } val origin = structure.toCM().origin - + return when (type) { DiagonalFeature::class -> if (origin is DiagonalMatrix) DiagonalFeature else null @@ -142,11 +142,8 @@ public object CMLinearSpace : LinearSpace { } } -public operator fun CMMatrix.plus(other: CMMatrix): CMMatrix = - CMMatrix(origin.add(other.origin)) +public operator fun CMMatrix.plus(other: CMMatrix): CMMatrix = CMMatrix(origin.add(other.origin)) -public operator fun CMMatrix.minus(other: CMMatrix): CMMatrix = - CMMatrix(origin.subtract(other.origin)) +public operator fun CMMatrix.minus(other: CMMatrix): CMMatrix = CMMatrix(origin.subtract(other.origin)) -public infix fun CMMatrix.dot(other: CMMatrix): CMMatrix = - CMMatrix(origin.multiply(other.origin)) +public infix fun CMMatrix.dot(other: CMMatrix): CMMatrix = CMMatrix(origin.multiply(other.origin)) From 913c12fb3002f7b218036e5cc42d8f82ba1a518c Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 15 Mar 2021 19:39:22 +0300 Subject: [PATCH 133/150] fix coordinates --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6f2675425..0e874ac31 100644 --- a/README.md +++ b/README.md @@ -253,8 +253,8 @@ repositories { } dependencies { - api("kscience.kmath:kmath-core:0.2.0") - // api("kscience.kmath:kmath-core-jvm:0.2.0") for jvm-specific version + api("space.kscience.kmath:kmath-core:0.2.1") + // api("space.kscience.kmath:kmath-core-jvm:0.2.1") for jvm-specific version } ``` From 179a07e03432f4ded4e151ac384e8630705ee546 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 15 Mar 2021 19:41:37 +0300 Subject: [PATCH 134/150] Bump readme --- README.md | 7 ++++--- docs/templates/README-TEMPLATE.md | 4 +--- kmath-ast/README.md | 6 +++--- kmath-complex/README.md | 6 +++--- kmath-for-real/README.md | 6 +++--- kmath-functions/README.md | 6 +++--- kmath-nd4j/README.md | 6 +++--- 7 files changed, 20 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index c95b0a13f..c129ba4ba 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ [![JetBrains Research](https://jb.gg/badges/research.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub) [![DOI](https://zenodo.org/badge/129486382.svg)](https://zenodo.org/badge/latestdoi/129486382) + ![Gradle build](https://github.com/mipt-npm/kmath/workflows/Gradle%20build/badge.svg) -[![Kotlin JS IR supported](https://img.shields.io/badge/Kotlin%2FJS-IR%20supported-yellow)](https://kotl.in/jsirsupported) +[![Maven Central](https://img.shields.io/maven-central/v/space.kscience/kmath-core.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22space.kscience%22%20AND%20a:%22kmath-core%22) # KMath @@ -253,8 +254,8 @@ repositories { } dependencies { - api("kscience.kmath:kmath-core:() -> kotlin.Any") - // api("kscience.kmath:kmath-core-jvm:() -> kotlin.Any") for jvm-specific version + api("kscience.kmath:kmath-core:0.3.0-dev-2") + // api("kscience.kmath:kmath-core-jvm:0.3.0-dev-2") for jvm-specific version } ``` diff --git a/docs/templates/README-TEMPLATE.md b/docs/templates/README-TEMPLATE.md index 10bc7aab1..c8be0d300 100644 --- a/docs/templates/README-TEMPLATE.md +++ b/docs/templates/README-TEMPLATE.md @@ -3,9 +3,7 @@ ![Gradle build](https://github.com/mipt-npm/kmath/workflows/Gradle%20build/badge.svg) -Bintray: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-core/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-core/_latestVersion) - -Bintray-dev: [ ![Download](https://api.bintray.com/packages/mipt-npm/dev/kmath-core/images/download.svg) ](https://bintray.com/mipt-npm/dev/kmath-core/_latestVersion) +[![Maven Central](https://img.shields.io/maven-central/v/space.kscience/kmath-core.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22space.kscience%22%20AND%20a:%22kmath-core%22) # KMath diff --git a/kmath-ast/README.md b/kmath-ast/README.md index e52f0fa96..a88b6f696 100644 --- a/kmath-ast/README.md +++ b/kmath-ast/README.md @@ -12,7 +12,7 @@ This subproject implements the following features: > #### Artifact: > -> This module artifact: `space.kscience:kmath-ast:0.2.0`. +> This module artifact: `space.kscience:kmath-ast:0.3.0-dev-2`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-ast/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-ast/_latestVersion) > @@ -31,7 +31,7 @@ This subproject implements the following features: > } > > dependencies { -> implementation 'space.kscience:kmath-ast:0.2.0' +> implementation 'space.kscience:kmath-ast:0.3.0-dev-2' > } > ``` > **Gradle Kotlin DSL:** @@ -47,7 +47,7 @@ This subproject implements the following features: > } > > dependencies { -> implementation("space.kscience:kmath-ast:0.2.0") +> implementation("space.kscience:kmath-ast:0.3.0-dev-2") > } > ``` diff --git a/kmath-complex/README.md b/kmath-complex/README.md index 71a75bd3e..7a7628a2c 100644 --- a/kmath-complex/README.md +++ b/kmath-complex/README.md @@ -8,7 +8,7 @@ Complex and hypercomplex number systems in KMath: > #### Artifact: > -> This module artifact: `space.kscience:kmath-complex:0.2.0`. +> This module artifact: `space.kscience:kmath-complex:0.3.0-dev-2`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-complex/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-complex/_latestVersion) > @@ -27,7 +27,7 @@ Complex and hypercomplex number systems in KMath: > } > > dependencies { -> implementation 'space.kscience:kmath-complex:0.2.0' +> implementation 'space.kscience:kmath-complex:0.3.0-dev-2' > } > ``` > **Gradle Kotlin DSL:** @@ -43,6 +43,6 @@ Complex and hypercomplex number systems in KMath: > } > > dependencies { -> implementation("space.kscience:kmath-complex:0.2.0") +> implementation("space.kscience:kmath-complex:0.3.0-dev-2") > } > ``` diff --git a/kmath-for-real/README.md b/kmath-for-real/README.md index 94b9eb59a..63c5cd249 100644 --- a/kmath-for-real/README.md +++ b/kmath-for-real/README.md @@ -7,7 +7,7 @@ > #### Artifact: > -> This module artifact: `space.kscience:kmath-for-real:0.2.0`. +> This module artifact: `space.kscience:kmath-for-real:0.3.0-dev-2`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-for-real/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-for-real/_latestVersion) > @@ -26,7 +26,7 @@ > } > > dependencies { -> implementation 'space.kscience:kmath-for-real:0.2.0' +> implementation 'space.kscience:kmath-for-real:0.3.0-dev-2' > } > ``` > **Gradle Kotlin DSL:** @@ -42,6 +42,6 @@ > } > > dependencies { -> implementation("space.kscience:kmath-for-real:0.2.0") +> implementation("space.kscience:kmath-for-real:0.3.0-dev-2") > } > ``` diff --git a/kmath-functions/README.md b/kmath-functions/README.md index 0eae4e3c0..29cc68c8e 100644 --- a/kmath-functions/README.md +++ b/kmath-functions/README.md @@ -10,7 +10,7 @@ Functions and interpolations: > #### Artifact: > -> This module artifact: `space.kscience:kmath-functions:0.2.0`. +> This module artifact: `space.kscience:kmath-functions:0.3.0-dev-2`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-functions/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-functions/_latestVersion) > @@ -29,7 +29,7 @@ Functions and interpolations: > } > > dependencies { -> implementation 'space.kscience:kmath-functions:0.2.0' +> implementation 'space.kscience:kmath-functions:0.3.0-dev-2' > } > ``` > **Gradle Kotlin DSL:** @@ -45,6 +45,6 @@ Functions and interpolations: > } > > dependencies { -> implementation("space.kscience:kmath-functions:0.2.0") +> implementation("space.kscience:kmath-functions:0.3.0-dev-2") > } > ``` diff --git a/kmath-nd4j/README.md b/kmath-nd4j/README.md index 046c8127f..08f0ae541 100644 --- a/kmath-nd4j/README.md +++ b/kmath-nd4j/README.md @@ -9,7 +9,7 @@ This subproject implements the following features: > #### Artifact: > -> This module artifact: `space.kscience:kmath-nd4j:0.2.0`. +> This module artifact: `space.kscience:kmath-nd4j:0.3.0-dev-2`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-nd4j/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-nd4j/_latestVersion) > @@ -28,7 +28,7 @@ This subproject implements the following features: > } > > dependencies { -> implementation 'space.kscience:kmath-nd4j:0.2.0' +> implementation 'space.kscience:kmath-nd4j:0.3.0-dev-2' > } > ``` > **Gradle Kotlin DSL:** @@ -44,7 +44,7 @@ This subproject implements the following features: > } > > dependencies { -> implementation("space.kscience:kmath-nd4j:0.2.0") +> implementation("space.kscience:kmath-nd4j:0.3.0-dev-2") > } > ``` From 17647742a8a5f1c7d99bf88b6905210ac7e75922 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 15 Mar 2021 19:45:46 +0300 Subject: [PATCH 135/150] Bump readme --- kmath-core/README.md | 55 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 kmath-core/README.md diff --git a/kmath-core/README.md b/kmath-core/README.md new file mode 100644 index 000000000..14f1ecb41 --- /dev/null +++ b/kmath-core/README.md @@ -0,0 +1,55 @@ +# The Core Module (`kmath-core`) + +The core features of KMath: + + - [algebras](src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt) : Algebraic structures like rings, spaces and fields. + - [nd](src/commonMain/kotlin/kscience/kmath/structures/NDStructure.kt) : Many-dimensional structures and operations on them. + - [linear](src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt) : Basic linear algebra operations (sums, products, etc.), backed by the `Space` API. Advanced linear algebra operations like matrix inversion and LU decomposition. + - [buffers](src/commonMain/kotlin/kscience/kmath/structures/Buffers.kt) : One-dimensional structure + - [expressions](src/commonMain/kotlin/kscience/kmath/expressions) : By writing a single mathematical expression once, users will be able to apply different types of +objects to the expression by providing a context. Expressions can be used for a wide variety of purposes from high +performance calculations to code generation. + - [domains](src/commonMain/kotlin/kscience/kmath/domains) : Domains + - [autodif](src/commonMain/kotlin/kscience/kmath/expressions/SimpleAutoDiff.kt) : Automatic differentiation + + +> #### Artifact: +> +> This module artifact: `space.kscience:kmath-core:0.3.0-dev-2`. +> +> Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-core/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-core/_latestVersion) +> +> Bintray development version: [ ![Download](https://api.bintray.com/packages/mipt-npm/dev/kmath-core/images/download.svg) ](https://bintray.com/mipt-npm/dev/kmath-core/_latestVersion) +> +> **Gradle:** +> +> ```gradle +> repositories { +> maven { url 'https://repo.kotlin.link' } +> maven { url 'https://dl.bintray.com/hotkeytlt/maven' } +> maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap +>// Uncomment if repo.kotlin.link is unavailable +>// maven { url 'https://dl.bintray.com/mipt-npm/kscience' } +>// maven { url 'https://dl.bintray.com/mipt-npm/dev' } +> } +> +> dependencies { +> implementation 'space.kscience:kmath-core:0.3.0-dev-2' +> } +> ``` +> **Gradle Kotlin DSL:** +> +> ```kotlin +> repositories { +> maven("https://repo.kotlin.link") +> maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap +> maven("https://dl.bintray.com/hotkeytlt/maven") // required for a +>// Uncomment if repo.kotlin.link is unavailable +>// maven("https://dl.bintray.com/mipt-npm/kscience") +>// maven("https://dl.bintray.com/mipt-npm/dev") +> } +> +> dependencies { +> implementation("space.kscience:kmath-core:0.3.0-dev-2") +> } +> ``` From 484a58755fe2b97c7fa2e8c05fbc0245a102c407 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 15 Mar 2021 19:57:01 +0300 Subject: [PATCH 136/150] Bump readme --- README.md | 2 +- docs/templates/ARTIFACT-TEMPLATE.md | 6 ------ docs/templates/README-TEMPLATE.md | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c129ba4ba..436495c9c 100644 --- a/README.md +++ b/README.md @@ -254,7 +254,7 @@ repositories { } dependencies { - api("kscience.kmath:kmath-core:0.3.0-dev-2") + api("space.kscience:kmath-core:0.3.0-dev-2") // api("kscience.kmath:kmath-core-jvm:0.3.0-dev-2") for jvm-specific version } ``` diff --git a/docs/templates/ARTIFACT-TEMPLATE.md b/docs/templates/ARTIFACT-TEMPLATE.md index 8ac71193f..cb741bc6f 100644 --- a/docs/templates/ARTIFACT-TEMPLATE.md +++ b/docs/templates/ARTIFACT-TEMPLATE.md @@ -13,9 +13,6 @@ > maven { url 'https://repo.kotlin.link' } > maven { url 'https://dl.bintray.com/hotkeytlt/maven' } > maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap ->// Uncomment if repo.kotlin.link is unavailable ->// maven { url 'https://dl.bintray.com/mipt-npm/kscience' } ->// maven { url 'https://dl.bintray.com/mipt-npm/dev' } > } > > dependencies { @@ -29,9 +26,6 @@ > maven("https://repo.kotlin.link") > maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap > maven("https://dl.bintray.com/hotkeytlt/maven") // required for a ->// Uncomment if repo.kotlin.link is unavailable ->// maven("https://dl.bintray.com/mipt-npm/kscience") ->// maven("https://dl.bintray.com/mipt-npm/dev") > } > > dependencies { diff --git a/docs/templates/README-TEMPLATE.md b/docs/templates/README-TEMPLATE.md index c8be0d300..4366c8fcd 100644 --- a/docs/templates/README-TEMPLATE.md +++ b/docs/templates/README-TEMPLATE.md @@ -104,7 +104,7 @@ repositories { } dependencies { - api("kscience.kmath:kmath-core:$version") + api("${group}:kmath-core:$version") // api("kscience.kmath:kmath-core-jvm:$version") for jvm-specific version } ``` From 874875c13aaf79f6a27fa6c1f19f9f264bc53c19 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 16 Mar 2021 15:05:44 +0300 Subject: [PATCH 137/150] API for integration --- .../kmath/commons/integration/CMIntegrator.kt | 77 +++++++++++++++ .../integration/GaussRuleIntegrator.kt | 94 +++++++++++++++++++ .../commons/integration/IntegrationTest.kt | 30 ++++++ .../kscience/kmath/integration/Integrand.kt | 17 +++- .../kscience/kmath/integration/Integrator.kt | 11 +++ .../integration/MultivariateIntegrand.kt | 27 ++++++ .../kmath/integration/UnivariateIntegrand.kt | 64 +++++++++++++ 7 files changed, 318 insertions(+), 2 deletions(-) create mode 100644 kmath-commons/src/main/kotlin/space/kscience/kmath/commons/integration/CMIntegrator.kt create mode 100644 kmath-commons/src/main/kotlin/space/kscience/kmath/commons/integration/GaussRuleIntegrator.kt create mode 100644 kmath-commons/src/test/kotlin/space/kscience/kmath/commons/integration/IntegrationTest.kt create mode 100644 kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrator.kt create mode 100644 kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/MultivariateIntegrand.kt create mode 100644 kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/UnivariateIntegrand.kt diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/integration/CMIntegrator.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/integration/CMIntegrator.kt new file mode 100644 index 000000000..e2ed84f1a --- /dev/null +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/integration/CMIntegrator.kt @@ -0,0 +1,77 @@ +package space.kscience.kmath.commons.integration + +import org.apache.commons.math3.analysis.integration.IterativeLegendreGaussIntegrator +import org.apache.commons.math3.analysis.integration.SimpsonIntegrator +import space.kscience.kmath.integration.* + +/** + * Integration wrapper for Common-maths UnivariateIntegrator + */ +public class CMIntegrator( + private val defaultMaxCalls: Int = 200, + public val integratorBuilder: (Integrand) -> org.apache.commons.math3.analysis.integration.UnivariateIntegrator, +) : UnivariateIntegrator { + + public class TargetRelativeAccuracy(public val value: Double) : IntegrandFeature + public class TargetAbsoluteAccuracy(public val value: Double) : IntegrandFeature + + public class MinIterations(public val value: Int) : IntegrandFeature + public class MaxIterations(public val value: Int) : IntegrandFeature + + override fun evaluate(integrand: UnivariateIntegrand): UnivariateIntegrand { + val integrator = integratorBuilder(integrand) + val maxCalls = integrand.getFeature()?.maxCalls ?: defaultMaxCalls + val remainingCalls = maxCalls - integrand.calls + val range = integrand.getFeature>()?.range + ?: error("Integration range is not provided") + val res = integrator.integrate(remainingCalls, integrand.function, range.start, range.endInclusive) + + return integrand + + IntegrandValue(res) + + IntegrandAbsoluteAccuracy(integrator.absoluteAccuracy) + + IntegrandRelativeAccuracy(integrator.relativeAccuracy) + + IntegrandCalls(integrator.evaluations + integrand.calls) + } + + + public companion object { + /** + * Create a Simpson integrator based on [SimpsonIntegrator] + */ + public fun simpson(defaultMaxCalls: Int = 200): CMIntegrator = CMIntegrator(defaultMaxCalls) { integrand -> + val absoluteAccuracy = integrand.getFeature()?.value + ?: SimpsonIntegrator.DEFAULT_ABSOLUTE_ACCURACY + val relativeAccuracy = integrand.getFeature()?.value + ?: SimpsonIntegrator.DEFAULT_ABSOLUTE_ACCURACY + val minIterations = integrand.getFeature()?.value + ?: SimpsonIntegrator.DEFAULT_MIN_ITERATIONS_COUNT + val maxIterations = integrand.getFeature()?.value + ?: SimpsonIntegrator.SIMPSON_MAX_ITERATIONS_COUNT + + SimpsonIntegrator(relativeAccuracy, absoluteAccuracy, minIterations, maxIterations) + } + + /** + * Create a Gauss-Legandre integrator based on [IterativeLegendreGaussIntegrator] + */ + public fun legandre(numPoints: Int, defaultMaxCalls: Int = numPoints * 5): CMIntegrator = + CMIntegrator(defaultMaxCalls) { integrand -> + val absoluteAccuracy = integrand.getFeature()?.value + ?: IterativeLegendreGaussIntegrator.DEFAULT_ABSOLUTE_ACCURACY + val relativeAccuracy = integrand.getFeature()?.value + ?: IterativeLegendreGaussIntegrator.DEFAULT_ABSOLUTE_ACCURACY + val minIterations = integrand.getFeature()?.value + ?: IterativeLegendreGaussIntegrator.DEFAULT_MIN_ITERATIONS_COUNT + val maxIterations = integrand.getFeature()?.value + ?: IterativeLegendreGaussIntegrator.DEFAULT_MAX_ITERATIONS_COUNT + + IterativeLegendreGaussIntegrator( + numPoints, + relativeAccuracy, + absoluteAccuracy, + minIterations, + maxIterations + ) + } + } +} \ No newline at end of file diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/integration/GaussRuleIntegrator.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/integration/GaussRuleIntegrator.kt new file mode 100644 index 000000000..29df2e787 --- /dev/null +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/integration/GaussRuleIntegrator.kt @@ -0,0 +1,94 @@ +/* + * Copyright 2015 Alexander Nozik. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package space.kscience.kmath.commons.integration + +import org.apache.commons.math3.analysis.integration.gauss.GaussIntegrator +import org.apache.commons.math3.analysis.integration.gauss.GaussIntegratorFactory +import space.kscience.kmath.integration.* + +/** + * A simple one-pass integrator based on Gauss rule + */ +public class GaussRuleIntegrator( + private val numpoints: Int, + private var type: GaussRule = GaussRule.LEGANDRE, +) : UnivariateIntegrator { + + override fun evaluate(integrand: UnivariateIntegrand): UnivariateIntegrand { + val range = integrand.getFeature>()?.range + ?: error("Integration range is not provided") + val integrator: GaussIntegrator = getIntegrator(range) + //TODO check performance + val res: Double = integrator.integrate(integrand.function) + return integrand + IntegrandValue(res) + IntegrandCalls(integrand.calls + numpoints) + } + + private fun getIntegrator(range: ClosedRange): GaussIntegrator { + return when (type) { + GaussRule.LEGANDRE -> factory.legendre( + numpoints, + range.start, + range.endInclusive + ) + GaussRule.LEGANDREHP -> factory.legendreHighPrecision( + numpoints, + range.start, + range.endInclusive + ) + GaussRule.UNIFORM -> GaussIntegrator( + getUniformRule( + range.start, + range.endInclusive, + numpoints + ) + ) + } + } + + private fun getUniformRule( + min: Double, + max: Double, + numPoints: Int, + ): org.apache.commons.math3.util.Pair { + assert(numPoints > 2) + val points = DoubleArray(numPoints) + val weights = DoubleArray(numPoints) + val step = (max - min) / (numPoints - 1) + points[0] = min + for (i in 1 until numPoints) { + points[i] = points[i - 1] + step + weights[i] = step + } + return org.apache.commons.math3.util.Pair(points, weights) + } + + public enum class GaussRule { + UNIFORM, LEGANDRE, LEGANDREHP + } + + public companion object { + private val factory: GaussIntegratorFactory = GaussIntegratorFactory() + + public fun integrate( + range: ClosedRange, + numPoints: Int = 100, + type: GaussRule = GaussRule.LEGANDRE, + function: (Double) -> Double, + ): Double = GaussRuleIntegrator(numPoints, type).evaluate( + UnivariateIntegrand(function, IntegrationRange(range)) + ).value!! + } +} \ No newline at end of file diff --git a/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/integration/IntegrationTest.kt b/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/integration/IntegrationTest.kt new file mode 100644 index 000000000..671acce07 --- /dev/null +++ b/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/integration/IntegrationTest.kt @@ -0,0 +1,30 @@ +package space.kscience.kmath.commons.integration + +import org.junit.jupiter.api.Test +import space.kscience.kmath.integration.integrate +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.operations.RealField.sin +import kotlin.math.PI +import kotlin.math.abs +import kotlin.test.assertTrue + +@UnstableKMathAPI +internal class IntegrationTest { + private val function: (Double) -> Double = { sin(it) } + + @Test + fun simpson() { + val res = CMIntegrator.simpson().integrate(0.0..2 * PI, function) + assertTrue { abs(res) < 1e-3 } + } + + @Test + fun customSimpson() { + val res = CMIntegrator.simpson().integrate(0.0..PI, function) { + add(CMIntegrator.TargetRelativeAccuracy(1e-4)) + add(CMIntegrator.TargetAbsoluteAccuracy(1e-4)) + } + assertTrue { abs(res - 2) < 1e-3 } + assertTrue { abs(res - 2) > 1e-12 } + } +} \ No newline at end of file diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrand.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrand.kt index 31006cde2..ae964b271 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrand.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrand.kt @@ -5,5 +5,18 @@ import kotlin.reflect.KClass public interface IntegrandFeature public interface Integrand { - public fun getFeature(type: KClass): T? = null -} \ No newline at end of file + public fun getFeature(type: KClass): T? +} + +public inline fun Integrand.getFeature(): T? = getFeature(T::class) + +public class IntegrandValue(public val value: T) : IntegrandFeature + +public class IntegrandRelativeAccuracy(public val accuracy: Double) : IntegrandFeature + +public class IntegrandAbsoluteAccuracy(public val accuracy: Double) : IntegrandFeature + +public class IntegrandCalls(public val calls: Int) : IntegrandFeature +public val Integrand.calls: Int get() = getFeature()?.calls ?: 0 + +public class IntegrandMaxCalls(public val maxCalls: Int) : IntegrandFeature diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrator.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrator.kt new file mode 100644 index 000000000..39330e91e --- /dev/null +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrator.kt @@ -0,0 +1,11 @@ +package space.kscience.kmath.integration + +/** + * A general interface for all integrators + */ +public interface Integrator { + /** + * Run one integration pass and return a new [Integrand] with a new set of features + */ + public fun evaluate(integrand: I): I +} \ No newline at end of file diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/MultivariateIntegrand.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/MultivariateIntegrand.kt new file mode 100644 index 000000000..4b3a6deb4 --- /dev/null +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/MultivariateIntegrand.kt @@ -0,0 +1,27 @@ +package space.kscience.kmath.integration + +import space.kscience.kmath.linear.Point +import kotlin.reflect.KClass + +public class MultivariateIntegrand internal constructor( + private val features: Map, IntegrandFeature>, + public val function: (Point) -> T, +) : Integrand { + + @Suppress("UNCHECKED_CAST") + override fun getFeature(type: KClass): T? = features[type] as? T + + public operator fun plus(pair: Pair, F>): MultivariateIntegrand = + MultivariateIntegrand(features + pair, function) + + public operator fun plus(feature: F): MultivariateIntegrand = + plus(feature::class to feature) +} + +@Suppress("FunctionName") +public fun MultivariateIntegrand( + vararg features: IntegrandFeature, + function: (Point) -> T, +): MultivariateIntegrand = MultivariateIntegrand(features.associateBy { it::class }, function) + +public val MultivariateIntegrand.value: T? get() = getFeature>()?.value diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/UnivariateIntegrand.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/UnivariateIntegrand.kt new file mode 100644 index 000000000..ac9c570bc --- /dev/null +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/UnivariateIntegrand.kt @@ -0,0 +1,64 @@ +package space.kscience.kmath.integration + +import space.kscience.kmath.misc.UnstableKMathAPI +import kotlin.reflect.KClass + +public class UnivariateIntegrand internal constructor( + private val features: Map, IntegrandFeature>, + public val function: (T) -> T, +) : Integrand { + + @Suppress("UNCHECKED_CAST") + override fun getFeature(type: KClass): T? = features[type] as? T + + public operator fun plus(pair: Pair, F>): UnivariateIntegrand = + UnivariateIntegrand(features + pair, function) + + public operator fun plus(feature: F): UnivariateIntegrand = + plus(feature::class to feature) +} + +@Suppress("FunctionName") +public fun UnivariateIntegrand( + function: (T) -> T, + vararg features: IntegrandFeature, +): UnivariateIntegrand = UnivariateIntegrand(features.associateBy { it::class }, function) + +public typealias UnivariateIntegrator = Integrator> + +public inline class IntegrationRange>(public val range: ClosedRange) : IntegrandFeature + +public val UnivariateIntegrand.value: T? get() = getFeature>()?.value + +/** + * A shortcut method to integrate a [function] in [range] with additional [features]. + * The [function] is placed in the end position to allow passing a lambda. + */ +@UnstableKMathAPI +public fun UnivariateIntegrator.integrate( + range: ClosedRange, + vararg features: IntegrandFeature, + function: (Double) -> Double, +): Double = evaluate( + UnivariateIntegrand(function, IntegrationRange(range), *features) +).value ?: error("Unexpected: no value after integration.") + +/** + * A shortcut method to integrate a [function] in [range] with additional [features]. + * The [function] is placed in the end position to allow passing a lambda. + */ +@UnstableKMathAPI +public fun UnivariateIntegrator.integrate( + range: ClosedRange, + function: (Double) -> Double, + featureBuilder: (MutableList.() -> Unit) = {}, +): Double { + //TODO use dedicated feature builder class instead or add extensions to MutableList + val features = buildList { + featureBuilder() + add(IntegrationRange(range)) + } + return evaluate( + UnivariateIntegrand(function, *features.toTypedArray()) + ).value ?: error("Unexpected: no value after integration.") +} \ No newline at end of file From 105b84b87cd9e22a0c1f40916f053d3cf257a0fc Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 16 Mar 2021 20:44:03 +0300 Subject: [PATCH 138/150] minor cosmetics --- .../kmath/commons/integration/CMIntegrator.kt | 19 +++++++++++++++++-- .../integration/GaussRuleIntegrator.kt | 4 ++-- .../optimization/CMOptimizationProblem.kt | 2 +- .../commons/integration/IntegrationTest.kt | 4 ++-- .../kscience/kmath/integration/Integrator.kt | 2 +- .../kmath/integration/UnivariateIntegrand.kt | 4 ++-- 6 files changed, 25 insertions(+), 10 deletions(-) diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/integration/CMIntegrator.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/integration/CMIntegrator.kt index e2ed84f1a..8511ed66e 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/integration/CMIntegrator.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/integration/CMIntegrator.kt @@ -3,6 +3,7 @@ package space.kscience.kmath.commons.integration import org.apache.commons.math3.analysis.integration.IterativeLegendreGaussIntegrator import org.apache.commons.math3.analysis.integration.SimpsonIntegrator import space.kscience.kmath.integration.* +import space.kscience.kmath.misc.UnstableKMathAPI /** * Integration wrapper for Common-maths UnivariateIntegrator @@ -18,7 +19,7 @@ public class CMIntegrator( public class MinIterations(public val value: Int) : IntegrandFeature public class MaxIterations(public val value: Int) : IntegrandFeature - override fun evaluate(integrand: UnivariateIntegrand): UnivariateIntegrand { + override fun integrate(integrand: UnivariateIntegrand): UnivariateIntegrand { val integrator = integratorBuilder(integrand) val maxCalls = integrand.getFeature()?.maxCalls ?: defaultMaxCalls val remainingCalls = maxCalls - integrand.calls @@ -74,4 +75,18 @@ public class CMIntegrator( ) } } -} \ No newline at end of file +} + +@UnstableKMathAPI +public var MutableList.targetAbsoluteAccuracy: Double? + get() = filterIsInstance().lastOrNull()?.value + set(value){ + value?.let { add(CMIntegrator.TargetAbsoluteAccuracy(value))} + } + +@UnstableKMathAPI +public var MutableList.targetRelativeAccuracy: Double? + get() = filterIsInstance().lastOrNull()?.value + set(value){ + value?.let { add(CMIntegrator.TargetRelativeAccuracy(value))} + } \ No newline at end of file diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/integration/GaussRuleIntegrator.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/integration/GaussRuleIntegrator.kt index 29df2e787..5a18756ac 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/integration/GaussRuleIntegrator.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/integration/GaussRuleIntegrator.kt @@ -27,7 +27,7 @@ public class GaussRuleIntegrator( private var type: GaussRule = GaussRule.LEGANDRE, ) : UnivariateIntegrator { - override fun evaluate(integrand: UnivariateIntegrand): UnivariateIntegrand { + override fun integrate(integrand: UnivariateIntegrand): UnivariateIntegrand { val range = integrand.getFeature>()?.range ?: error("Integration range is not provided") val integrator: GaussIntegrator = getIntegrator(range) @@ -87,7 +87,7 @@ public class GaussRuleIntegrator( numPoints: Int = 100, type: GaussRule = GaussRule.LEGANDRE, function: (Double) -> Double, - ): Double = GaussRuleIntegrator(numPoints, type).evaluate( + ): Double = GaussRuleIntegrator(numPoints, type).integrate( UnivariateIntegrand(function, IntegrationRange(range)) ).value!! } diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/CMOptimizationProblem.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/CMOptimizationProblem.kt index d655b4f61..13a10475f 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/CMOptimizationProblem.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/CMOptimizationProblem.kt @@ -19,7 +19,7 @@ import kotlin.reflect.KClass public operator fun PointValuePair.component1(): DoubleArray = point public operator fun PointValuePair.component2(): Double = value -public class CMOptimizationProblem(override val symbols: List, ) : +public class CMOptimizationProblem(override val symbols: List) : OptimizationProblem, SymbolIndexer, OptimizationFeature { private val optimizationData: HashMap, OptimizationData> = HashMap() private var optimizatorBuilder: (() -> MultivariateOptimizer)? = null diff --git a/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/integration/IntegrationTest.kt b/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/integration/IntegrationTest.kt index 671acce07..3693d5796 100644 --- a/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/integration/IntegrationTest.kt +++ b/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/integration/IntegrationTest.kt @@ -21,8 +21,8 @@ internal class IntegrationTest { @Test fun customSimpson() { val res = CMIntegrator.simpson().integrate(0.0..PI, function) { - add(CMIntegrator.TargetRelativeAccuracy(1e-4)) - add(CMIntegrator.TargetAbsoluteAccuracy(1e-4)) + targetRelativeAccuracy = 1e-4 + targetAbsoluteAccuracy = 1e-4 } assertTrue { abs(res - 2) < 1e-3 } assertTrue { abs(res - 2) > 1e-12 } diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrator.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrator.kt index 39330e91e..7027e62c7 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrator.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrator.kt @@ -7,5 +7,5 @@ public interface Integrator { /** * Run one integration pass and return a new [Integrand] with a new set of features */ - public fun evaluate(integrand: I): I + public fun integrate(integrand: I): I } \ No newline at end of file diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/UnivariateIntegrand.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/UnivariateIntegrand.kt index ac9c570bc..9389318e8 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/UnivariateIntegrand.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/UnivariateIntegrand.kt @@ -39,7 +39,7 @@ public fun UnivariateIntegrator.integrate( range: ClosedRange, vararg features: IntegrandFeature, function: (Double) -> Double, -): Double = evaluate( +): Double = integrate( UnivariateIntegrand(function, IntegrationRange(range), *features) ).value ?: error("Unexpected: no value after integration.") @@ -58,7 +58,7 @@ public fun UnivariateIntegrator.integrate( featureBuilder() add(IntegrationRange(range)) } - return evaluate( + return integrate( UnivariateIntegrand(function, *features.toTypedArray()) ).value ?: error("Unexpected: no value after integration.") } \ No newline at end of file From 05f742452d4ea7c707a9581160aae721d7402dd6 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 16 Mar 2021 20:56:20 +0300 Subject: [PATCH 139/150] Structure naming change --- .github/workflows/publish.yml | 2 +- CHANGELOG.md | 2 + docs/images/KM.svg | 29 +- docs/images/KM_mono.svg | 44 +- docs/images/KMath.svg | 47 +- docs/images/KMath_mono.svg | 239 +++++---- examples/build.gradle.kts | 2 +- .../kmath/benchmarks/NDFieldBenchmark.kt | 12 +- .../kmath/benchmarks/ViktorBenchmark.kt | 12 +- .../kmath/benchmarks/ViktorLogBenchmark.kt | 10 +- .../kmath/commons/fit/fitWithAutoDiff.kt | 4 +- .../kscience/kmath/operations/ComplexDemo.kt | 6 +- .../kscience/kmath/structures/ComplexND.kt | 12 +- .../kscience/kmath/structures/NDField.kt | 22 +- .../kmath/structures/ParallelRealNDField.kt | 60 +-- .../structures/StructureWriteBenchmark.kt | 4 +- .../space/kscience/kmath/ast/MstAlgebra.kt | 2 +- .../estree/TestESTreeOperationsSupport.kt | 4 +- .../kmath/asm/internal/codegenUtils.kt | 2 +- .../kmath/asm/TestAsmOperationsSupport.kt | 4 +- kmath-commons/build.gradle.kts | 2 +- .../kmath/commons/integration/CMIntegrator.kt | 8 +- .../kscience/kmath/commons/linear/CMMatrix.kt | 6 +- .../kscience/kmath/commons/linear/CMSolver.kt | 8 +- .../commons/transform/Transformations.kt | 16 +- .../DerivativeStructureExpressionTest.kt | 4 +- .../{ComplexNDField.kt => ComplexFieldND.kt} | 52 +- .../kscience/kmath/complex/Quaternion.kt | 2 +- kmath-core/api/kmath-core.api | 504 +++++++++--------- .../kmath/linear/BufferedLinearSpace.kt | 2 +- .../kscience/kmath/linear/VirtualMatrix.kt | 6 +- .../kmath/nd/{NDAlgebra.kt => AlgebraND.kt} | 60 +-- ...{BufferNDAlgebra.kt => BufferAlgebraND.kt} | 64 +-- .../nd/{RealNDField.kt => RealFieldND.kt} | 64 +-- .../nd/{ShortNDRing.kt => ShortRingND.kt} | 12 +- .../space/kscience/kmath/nd/Structure1D.kt | 8 +- .../space/kscience/kmath/nd/Structure2D.kt | 12 +- .../nd/{NDStructure.kt => StructureND.kt} | 30 +- .../space/kscience/kmath/operations/BigInt.kt | 8 +- .../kmath/structures/BufferAccessor2D.kt | 4 +- .../space/kscience/kmath/linear/MatrixTest.kt | 6 +- .../kscience/kmath/structures/NDFieldTest.kt | 6 +- .../kmath/structures/NumberNDFieldTest.kt | 8 +- kmath-coroutines/build.gradle.kts | 2 +- .../space/kscience/kmath/chains/Chain.kt | 4 +- .../kmath/coroutines/coroutinesExtra.kt | 6 +- .../kscience/kmath/streaming/RingBuffer.kt | 2 +- ...{LazyNDStructure.kt => LazyStructureND.kt} | 30 +- kmath-dimensions/build.gradle.kts | 2 +- .../kscience/kmath/dimensions/Wrappers.kt | 14 +- kmath-ejml/build.gradle.kts | 2 +- .../space/kscience/kmath/ejml/EjmlMatrix.kt | 6 +- .../kotlin/space/kscience/kmath/real/dot.kt | 2 +- .../kotlin/kaceince/kmath/real/GridTest.kt | 2 +- kmath-functions/build.gradle.kts | 8 +- .../kscience/kmath/integration/Integrand.kt | 1 + .../kscience/kmath/integration/Integrator.kt | 2 +- .../kmath/interpolation/Interpolator.kt | 6 +- .../kmath/interpolation/XYPointSet.kt | 2 +- kmath-geometry/build.gradle.kts | 2 +- .../space/kscience/kmath/histogram/Counter.kt | 3 +- .../kscience/kmath/histogram/Histogram.kt | 2 +- .../kmath/histogram/IndexedHistogramSpace.kt | 8 +- .../kmath/histogram/RealHistogramSpace.kt | 6 +- .../histogram/MultivariateHistogramTest.kt | 2 +- .../kmath/histogram/UnivariateHistogram.kt | 3 +- kmath-kotlingrad/build.gradle.kts | 2 +- kmath-memory/build.gradle.kts | 2 +- .../space/kscience/kmath/memory/MemorySpec.kt | 3 +- .../kscience/kmath/memory/ByteBufferMemory.kt | 5 +- .../kscience/kmath/memory/NativeMemory.kt | 2 +- .../kscience/kmath/nd4j/Nd4jArrayAlgebra.kt | 106 ++-- .../kscience/kmath/nd4j/Nd4jArrayStructure.kt | 4 +- .../kmath/nd4j/Nd4jArrayAlgebraTest.kt | 2 +- .../kmath/nd4j/Nd4jArrayStructureTest.kt | 6 +- kmath-stat/build.gradle.kts | 2 +- .../space/kscience/kmath/stat/Distribution.kt | 2 +- .../kmath/stat/OptimizationProblem.kt | 4 +- .../space/kscience/kmath/stat/RandomChain.kt | 2 +- .../kscience/kmath/stat/distributions.kt | 4 +- kmath-viktor/api/kmath-viktor.api | 148 ++--- kmath-viktor/build.gradle.kts | 2 +- .../kmath/viktor/ViktorNDStructure.kt | 123 ----- .../kmath/viktor/ViktorStructureND.kt | 123 +++++ 84 files changed, 1060 insertions(+), 1010 deletions(-) rename kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/{ComplexNDField.kt => ComplexFieldND.kt} (69%) rename kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/{NDAlgebra.kt => AlgebraND.kt} (75%) rename kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/{BufferNDAlgebra.kt => BufferAlgebraND.kt} (60%) rename kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/{RealNDField.kt => RealFieldND.kt} (61%) rename kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/{ShortNDRing.kt => ShortRingND.kt} (80%) rename kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/{NDStructure.kt => StructureND.kt} (92%) rename kmath-coroutines/src/jvmMain/kotlin/space/kscience/kmath/structures/{LazyNDStructure.kt => LazyStructureND.kt} (62%) delete mode 100644 kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorNDStructure.kt create mode 100644 kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorStructureND.kt diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 42fa6d3b6..ca374574e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,7 +12,7 @@ jobs: name: publish strategy: matrix: - os: [macOS-latest, windows-latest] + os: [ macOS-latest, windows-latest ] runs-on: ${{matrix.os}} steps: - name: Checkout the repo diff --git a/CHANGELOG.md b/CHANGELOG.md index eb97698c6..17486bd2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,14 @@ ### Added - ScaleOperations interface - Field extends ScaleOperations +- Basic integration API ### Changed - Exponential operations merged with hyperbolic functions - Space is replaced by Group. Space is reserved for vector spaces. - VectorSpace is now a vector space - Buffer factories for primitives moved to MutableBuffer.Companion +- NDStructure and NDAlgebra to StructureND and AlgebraND respectively ### Deprecated diff --git a/docs/images/KM.svg b/docs/images/KM.svg index 50126cbc5..83af21f35 100644 --- a/docs/images/KM.svg +++ b/docs/images/KM.svg @@ -13,27 +13,30 @@ version="1.1">image/svg+xml + + + image/svg+xml + + image/svg+xml + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + { kotlinOptions.jvmTarget = "11" } -readme{ +readme { maturity = ru.mipt.npm.gradle.Maturity.EXPERIMENTAL } diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/NDFieldBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/NDFieldBenchmark.kt index aeee0dafe..e381a1559 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/NDFieldBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/NDFieldBenchmark.kt @@ -13,7 +13,7 @@ internal class NDFieldBenchmark { @Benchmark fun autoFieldAdd(blackhole: Blackhole) { with(autoField) { - var res: NDStructure = one + var res: StructureND = one repeat(n) { res += one } blackhole.consume(res) } @@ -22,7 +22,7 @@ internal class NDFieldBenchmark { @Benchmark fun specializedFieldAdd(blackhole: Blackhole) { with(specializedField) { - var res: NDStructure = one + var res: StructureND = one repeat(n) { res += 1.0 } blackhole.consume(res) } @@ -32,7 +32,7 @@ internal class NDFieldBenchmark { @Benchmark fun boxingFieldAdd(blackhole: Blackhole) { with(genericField) { - var res: NDStructure = one + var res: StructureND = one repeat(n) { res += 1.0 } blackhole.consume(res) } @@ -41,8 +41,8 @@ internal class NDFieldBenchmark { private companion object { private const val dim = 1000 private const val n = 100 - private val autoField = NDAlgebra.auto(RealField, dim, dim) - private val specializedField = NDAlgebra.real(dim, dim) - private val genericField = NDAlgebra.field(RealField, Buffer.Companion::boxing, dim, dim) + private val autoField = AlgebraND.auto(RealField, dim, dim) + private val specializedField = AlgebraND.real(dim, dim) + private val genericField = AlgebraND.field(RealField, Buffer.Companion::boxing, dim, dim) } } diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorBenchmark.kt index c511173a9..21c29affd 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorBenchmark.kt @@ -5,8 +5,8 @@ import kotlinx.benchmark.Blackhole import kotlinx.benchmark.Scope import kotlinx.benchmark.State import org.jetbrains.bio.viktor.F64Array -import space.kscience.kmath.nd.NDAlgebra -import space.kscience.kmath.nd.NDStructure +import space.kscience.kmath.nd.AlgebraND +import space.kscience.kmath.nd.StructureND import space.kscience.kmath.nd.auto import space.kscience.kmath.nd.real import space.kscience.kmath.operations.RealField @@ -17,7 +17,7 @@ internal class ViktorBenchmark { @Benchmark fun automaticFieldAddition(blackhole: Blackhole) { with(autoField) { - var res: NDStructure = one + var res: StructureND = one repeat(n) { res += 1.0 } blackhole.consume(res) } @@ -26,7 +26,7 @@ internal class ViktorBenchmark { @Benchmark fun realFieldAddition(blackhole: Blackhole) { with(realField) { - var res: NDStructure = one + var res: StructureND = one repeat(n) { res += 1.0 } blackhole.consume(res) } @@ -54,8 +54,8 @@ internal class ViktorBenchmark { private const val n = 100 // automatically build context most suited for given type. - private val autoField = NDAlgebra.auto(RealField, dim, dim) - private val realField = NDAlgebra.real(dim, dim) + private val autoField = AlgebraND.auto(RealField, dim, dim) + private val realField = AlgebraND.real(dim, dim) private val viktorField = ViktorNDField(dim, dim) } } diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt index 0036b615c..e964f9bff 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt @@ -5,11 +5,11 @@ import kotlinx.benchmark.Blackhole import kotlinx.benchmark.Scope import kotlinx.benchmark.State import org.jetbrains.bio.viktor.F64Array -import space.kscience.kmath.nd.NDAlgebra +import space.kscience.kmath.nd.AlgebraND import space.kscience.kmath.nd.auto import space.kscience.kmath.nd.real import space.kscience.kmath.operations.RealField -import space.kscience.kmath.viktor.ViktorNDField +import space.kscience.kmath.viktor.ViktorFieldND @State(Scope.Benchmark) internal class ViktorLogBenchmark { @@ -46,8 +46,8 @@ internal class ViktorLogBenchmark { private const val n = 100 // automatically build context most suited for given type. - private val autoField = NDAlgebra.auto(RealField, dim, dim) - private val realNdField = NDAlgebra.real(dim, dim) - private val viktorField = ViktorNDField(intArrayOf(dim, dim)) + private val autoField = AlgebraND.auto(RealField, dim, dim) + private val realNdField = AlgebraND.real(dim, dim) + private val viktorField = ViktorFieldND(intArrayOf(dim, dim)) } } diff --git a/examples/src/main/kotlin/space/kscience/kmath/commons/fit/fitWithAutoDiff.kt b/examples/src/main/kotlin/space/kscience/kmath/commons/fit/fitWithAutoDiff.kt index 63b819dc9..c26fb34e9 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/commons/fit/fitWithAutoDiff.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/commons/fit/fitWithAutoDiff.kt @@ -90,10 +90,10 @@ fun main() { } } br() - h3{ + h3 { +"Fit result: $result" } - h3{ + h3 { +"Chi2/dof = ${result.value / (x.size - 3)}" } } diff --git a/examples/src/main/kotlin/space/kscience/kmath/operations/ComplexDemo.kt b/examples/src/main/kotlin/space/kscience/kmath/operations/ComplexDemo.kt index 5330d9e40..105fb108e 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/operations/ComplexDemo.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/operations/ComplexDemo.kt @@ -2,17 +2,17 @@ package space.kscience.kmath.operations import space.kscience.kmath.complex.Complex import space.kscience.kmath.complex.complex -import space.kscience.kmath.nd.NDAlgebra +import space.kscience.kmath.nd.AlgebraND fun main() { // 2d element - val element = NDAlgebra.complex(2, 2).produce { (i, j) -> + val element = AlgebraND.complex(2, 2).produce { (i, j) -> Complex(i.toDouble() - j.toDouble(), i.toDouble() + j.toDouble()) } println(element) // 1d element operation - val result = with(NDAlgebra.complex(8)) { + val result = with(AlgebraND.complex(8)) { val a = produce { (it) -> i * it - it.toDouble() } val b = 3 val c = Complex(1.0, 1.0) diff --git a/examples/src/main/kotlin/space/kscience/kmath/structures/ComplexND.kt b/examples/src/main/kotlin/space/kscience/kmath/structures/ComplexND.kt index b8cbc9a57..68af2560b 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/structures/ComplexND.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/structures/ComplexND.kt @@ -4,8 +4,8 @@ package space.kscience.kmath.structures import space.kscience.kmath.complex.* import space.kscience.kmath.linear.transpose -import space.kscience.kmath.nd.NDAlgebra -import space.kscience.kmath.nd.NDStructure +import space.kscience.kmath.nd.AlgebraND +import space.kscience.kmath.nd.StructureND import space.kscience.kmath.nd.as2D import space.kscience.kmath.nd.real import space.kscience.kmath.operations.invoke @@ -15,12 +15,12 @@ fun main() { val dim = 1000 val n = 1000 - val realField = NDAlgebra.real(dim, dim) - val complexField: ComplexNDField = NDAlgebra.complex(dim, dim) + val realField = AlgebraND.real(dim, dim) + val complexField: ComplexFieldND = AlgebraND.complex(dim, dim) val realTime = measureTimeMillis { realField { - var res: NDStructure = one + var res: StructureND = one repeat(n) { res += 1.0 } @@ -31,7 +31,7 @@ fun main() { val complexTime = measureTimeMillis { complexField { - var res: NDStructure = one + var res: StructureND = one repeat(n) { res += 1.0 } diff --git a/examples/src/main/kotlin/space/kscience/kmath/structures/NDField.kt b/examples/src/main/kotlin/space/kscience/kmath/structures/NDField.kt index 10fb3cb3d..b884251c4 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/structures/NDField.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/structures/NDField.kt @@ -24,56 +24,56 @@ fun main() { val n = 1000 // automatically build context most suited for given type. - val autoField = NDAlgebra.auto(RealField, dim, dim) + val autoField = AlgebraND.auto(RealField, dim, dim) // specialized nd-field for Double. It works as generic Double field as well - val realField = NDAlgebra.real(dim, dim) + val realField = AlgebraND.real(dim, dim) //A generic boxing field. It should be used for objects, not primitives. - val boxingField = NDAlgebra.field(RealField, Buffer.Companion::boxing, dim, dim) + val boxingField = AlgebraND.field(RealField, Buffer.Companion::boxing, dim, dim) // Nd4j specialized field. val nd4jField = Nd4jArrayField.real(dim, dim) //viktor field - val viktorField = ViktorNDField(dim,dim) + val viktorField = ViktorNDField(dim, dim) //parallel processing based on Java Streams - val parallelField = NDAlgebra.realWithStream(dim,dim) + val parallelField = AlgebraND.realWithStream(dim, dim) measureAndPrint("Boxing addition") { boxingField { - var res: NDStructure = one + var res: StructureND = one repeat(n) { res += 1.0 } } } measureAndPrint("Specialized addition") { realField { - var res: NDStructure = one + var res: StructureND = one repeat(n) { res += 1.0 } } } measureAndPrint("Nd4j specialized addition") { nd4jField { - var res: NDStructure = one + var res: StructureND = one repeat(n) { res += 1.0 } } } measureAndPrint("Viktor addition") { viktorField { - var res: NDStructure = one + var res: StructureND = one repeat(n) { res += 1.0 } } } measureAndPrint("Parallel stream addition") { parallelField { - var res: NDStructure = one + var res: StructureND = one repeat(n) { res += 1.0 } } } measureAndPrint("Automatic field addition") { autoField { - var res: NDStructure = one + var res: StructureND = one repeat(n) { res += 1.0 } } } diff --git a/examples/src/main/kotlin/space/kscience/kmath/structures/ParallelRealNDField.kt b/examples/src/main/kotlin/space/kscience/kmath/structures/ParallelRealNDField.kt index 0c914468d..8b3c5dfbb 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/structures/ParallelRealNDField.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/structures/ParallelRealNDField.kt @@ -12,11 +12,11 @@ import java.util.stream.IntStream * A demonstration implementation of NDField over Real using Java [DoubleStream] for parallel execution */ @OptIn(UnstableKMathAPI::class) -class StreamRealNDField( +class StreamRealFieldND( override val shape: IntArray, -) : NDField, - NumbersAddOperations>, - ExtendedField> { +) : FieldND, + NumbersAddOperations>, + ExtendedField> { private val strides = DefaultStrides(shape) override val elementContext: RealField get() = RealField @@ -28,13 +28,13 @@ class StreamRealNDField( return produce { d } } - private val NDStructure.buffer: RealBuffer + private val StructureND.buffer: RealBuffer get() = when { - !shape.contentEquals(this@StreamRealNDField.shape) -> throw ShapeMismatchException( - this@StreamRealNDField.shape, + !shape.contentEquals(this@StreamRealFieldND.shape) -> throw ShapeMismatchException( + this@StreamRealFieldND.shape, shape ) - this is NDBuffer && this.strides == this@StreamRealNDField.strides -> this.buffer as RealBuffer + this is NDBuffer && this.strides == this@StreamRealFieldND.strides -> this.buffer as RealBuffer else -> RealBuffer(strides.linearSize) { offset -> get(strides.index(offset)) } } @@ -48,14 +48,14 @@ class StreamRealNDField( return NDBuffer(strides, array.asBuffer()) } - override fun NDStructure.map( + override fun StructureND.map( transform: RealField.(Double) -> Double, ): NDBuffer { val array = Arrays.stream(buffer.array).parallel().map { RealField.transform(it) }.toArray() return NDBuffer(strides, array.asBuffer()) } - override fun NDStructure.mapIndexed( + override fun StructureND.mapIndexed( transform: RealField.(index: IntArray, Double) -> Double, ): NDBuffer { val array = IntStream.range(0, strides.linearSize).parallel().mapToDouble { offset -> @@ -69,8 +69,8 @@ class StreamRealNDField( } override fun combine( - a: NDStructure, - b: NDStructure, + a: StructureND, + b: StructureND, transform: RealField.(Double, Double) -> Double, ): NDBuffer { val array = IntStream.range(0, strides.linearSize).parallel().mapToDouble { offset -> @@ -79,29 +79,29 @@ class StreamRealNDField( return NDBuffer(strides, array.asBuffer()) } - override fun NDStructure.unaryMinus(): NDStructure = map { -it } + override fun StructureND.unaryMinus(): StructureND = map { -it } - override fun scale(a: NDStructure, value: Double): NDStructure = a.map { it * value } + override fun scale(a: StructureND, value: Double): StructureND = a.map { it * value } - override fun power(arg: NDStructure, pow: Number): NDBuffer = arg.map { power(it, pow) } + override fun power(arg: StructureND, pow: Number): NDBuffer = arg.map { power(it, pow) } - override fun exp(arg: NDStructure): NDBuffer = arg.map { exp(it) } + override fun exp(arg: StructureND): NDBuffer = arg.map { exp(it) } - override fun ln(arg: NDStructure): NDBuffer = arg.map { ln(it) } + override fun ln(arg: StructureND): NDBuffer = arg.map { ln(it) } - override fun sin(arg: NDStructure): NDBuffer = arg.map { sin(it) } - override fun cos(arg: NDStructure): NDBuffer = arg.map { cos(it) } - override fun tan(arg: NDStructure): NDBuffer = arg.map { tan(it) } - override fun asin(arg: NDStructure): NDBuffer = arg.map { asin(it) } - override fun acos(arg: NDStructure): NDBuffer = arg.map { acos(it) } - override fun atan(arg: NDStructure): NDBuffer = arg.map { atan(it) } + override fun sin(arg: StructureND): NDBuffer = arg.map { sin(it) } + override fun cos(arg: StructureND): NDBuffer = arg.map { cos(it) } + override fun tan(arg: StructureND): NDBuffer = arg.map { tan(it) } + override fun asin(arg: StructureND): NDBuffer = arg.map { asin(it) } + override fun acos(arg: StructureND): NDBuffer = arg.map { acos(it) } + override fun atan(arg: StructureND): NDBuffer = arg.map { atan(it) } - override fun sinh(arg: NDStructure): NDBuffer = arg.map { sinh(it) } - override fun cosh(arg: NDStructure): NDBuffer = arg.map { cosh(it) } - override fun tanh(arg: NDStructure): NDBuffer = arg.map { tanh(it) } - override fun asinh(arg: NDStructure): NDBuffer = arg.map { asinh(it) } - override fun acosh(arg: NDStructure): NDBuffer = arg.map { acosh(it) } - override fun atanh(arg: NDStructure): NDBuffer = arg.map { atanh(it) } + override fun sinh(arg: StructureND): NDBuffer = arg.map { sinh(it) } + override fun cosh(arg: StructureND): NDBuffer = arg.map { cosh(it) } + override fun tanh(arg: StructureND): NDBuffer = arg.map { tanh(it) } + override fun asinh(arg: StructureND): NDBuffer = arg.map { asinh(it) } + override fun acosh(arg: StructureND): NDBuffer = arg.map { acosh(it) } + override fun atanh(arg: StructureND): NDBuffer = arg.map { atanh(it) } } -fun NDAlgebra.Companion.realWithStream(vararg shape: Int): StreamRealNDField = StreamRealNDField(shape) \ No newline at end of file +fun AlgebraND.Companion.realWithStream(vararg shape: Int): StreamRealFieldND = StreamRealFieldND(shape) \ No newline at end of file diff --git a/examples/src/main/kotlin/space/kscience/kmath/structures/StructureWriteBenchmark.kt b/examples/src/main/kotlin/space/kscience/kmath/structures/StructureWriteBenchmark.kt index 66d85edff..7aa5a07fd 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/structures/StructureWriteBenchmark.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/structures/StructureWriteBenchmark.kt @@ -1,13 +1,13 @@ package space.kscience.kmath.structures -import space.kscience.kmath.nd.NDStructure +import space.kscience.kmath.nd.StructureND import space.kscience.kmath.nd.mapToBuffer import kotlin.system.measureTimeMillis @Suppress("UNUSED_VARIABLE") fun main() { val n = 6000 - val structure = NDStructure.buffered(intArrayOf(n, n), Buffer.Companion::auto) { 1.0 } + val structure = StructureND.buffered(intArrayOf(n, n), Buffer.Companion::auto) { 1.0 } structure.mapToBuffer { it + 1 } // warm-up val time1 = measureTimeMillis { val res = structure.mapToBuffer { it + 1 } } println("Structure mapping finished in $time1 millis") diff --git a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt index 5ed39687b..c1aeae90e 100644 --- a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt +++ b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt @@ -50,7 +50,7 @@ public object MstGroup : Group, NumericAlgebra, ScaleOperations { */ @OptIn(UnstableKMathAPI::class) public object MstRing : Ring, NumbersAddOperations, ScaleOperations { - public override val zero: MST.Numeric get() = MstGroup.zero + public override val zero: MST.Numeric get() = MstGroup.zero public override val one: MST.Numeric = number(1.0) public override fun number(value: Number): MST.Numeric = MstGroup.number(value) diff --git a/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeOperationsSupport.kt b/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeOperationsSupport.kt index 27bf2f167..590d0957d 100644 --- a/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeOperationsSupport.kt +++ b/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeOperationsSupport.kt @@ -32,7 +32,9 @@ internal class TestESTreeOperationsSupport { @Test fun testMultipleCalls() { - val e = RealField.mstInExtendedField { sin(bindSymbol("x")).pow(4) - 6 * bindSymbol("x") / tanh(bindSymbol("x")) }.compile() + val e = + RealField.mstInExtendedField { sin(bindSymbol("x")).pow(4) - 6 * bindSymbol("x") / tanh(bindSymbol("x")) } + .compile() val r = Random(0) var s = 0.0 repeat(1000000) { s += e("x" to r.nextDouble()) } diff --git a/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/codegenUtils.kt b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/codegenUtils.kt index 1124a860f..4522c966f 100644 --- a/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/codegenUtils.kt +++ b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/codegenUtils.kt @@ -86,7 +86,7 @@ internal inline fun ClassWriter.visitField( descriptor: String, signature: String?, value: Any?, - block: FieldVisitor.() -> Unit + block: FieldVisitor.() -> Unit, ): FieldVisitor { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } return visitField(access, name, descriptor, signature, value).apply(block) diff --git a/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmOperationsSupport.kt b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmOperationsSupport.kt index e99075f07..7047c824c 100644 --- a/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmOperationsSupport.kt +++ b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmOperationsSupport.kt @@ -32,7 +32,9 @@ internal class TestAsmOperationsSupport { @Test fun testMultipleCalls() { - val e = RealField.mstInExtendedField { sin(bindSymbol("x")).pow(4) - 6 * bindSymbol("x") / tanh(bindSymbol("x")) }.compile() + val e = + RealField.mstInExtendedField { sin(bindSymbol("x")).pow(4) - 6 * bindSymbol("x") / tanh(bindSymbol("x")) } + .compile() val r = Random(0) var s = 0.0 repeat(1000000) { s += e("x" to r.nextDouble()) } diff --git a/kmath-commons/build.gradle.kts b/kmath-commons/build.gradle.kts index 4fe16605a..56dcef29a 100644 --- a/kmath-commons/build.gradle.kts +++ b/kmath-commons/build.gradle.kts @@ -12,6 +12,6 @@ dependencies { api("org.apache.commons:commons-math3:3.6.1") } -readme{ +readme { maturity = ru.mipt.npm.gradle.Maturity.EXPERIMENTAL } \ No newline at end of file diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/integration/CMIntegrator.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/integration/CMIntegrator.kt index 8511ed66e..e1ba7d777 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/integration/CMIntegrator.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/integration/CMIntegrator.kt @@ -80,13 +80,13 @@ public class CMIntegrator( @UnstableKMathAPI public var MutableList.targetAbsoluteAccuracy: Double? get() = filterIsInstance().lastOrNull()?.value - set(value){ - value?.let { add(CMIntegrator.TargetAbsoluteAccuracy(value))} + set(value) { + value?.let { add(CMIntegrator.TargetAbsoluteAccuracy(value)) } } @UnstableKMathAPI public var MutableList.targetRelativeAccuracy: Double? get() = filterIsInstance().lastOrNull()?.value - set(value){ - value?.let { add(CMIntegrator.TargetRelativeAccuracy(value))} + set(value) { + value?.let { add(CMIntegrator.TargetRelativeAccuracy(value)) } } \ No newline at end of file diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt index 4671598f7..4e3a44a83 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt @@ -3,7 +3,7 @@ package space.kscience.kmath.commons.linear import org.apache.commons.math3.linear.* import space.kscience.kmath.linear.* import space.kscience.kmath.misc.UnstableKMathAPI -import space.kscience.kmath.nd.NDStructure +import space.kscience.kmath.nd.StructureND import space.kscience.kmath.operations.RealField import space.kscience.kmath.structures.RealBuffer import kotlin.reflect.KClass @@ -17,8 +17,8 @@ public class CMMatrix(public val origin: RealMatrix) : Matrix { override fun equals(other: Any?): Boolean { if (this === other) return true - if (other !is NDStructure<*>) return false - return NDStructure.contentEquals(this, other) + if (other !is StructureND<*>) return false + return StructureND.contentEquals(this, other) } override fun hashCode(): Int = origin.hashCode() diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMSolver.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMSolver.kt index b5fd0154e..b4706473a 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMSolver.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMSolver.kt @@ -14,7 +14,7 @@ public enum class CMDecomposition { public fun CMLinearSpace.solver( a: Matrix, - decomposition: CMDecomposition = CMDecomposition.LUP + decomposition: CMDecomposition = CMDecomposition.LUP, ): DecompositionSolver = when (decomposition) { CMDecomposition.LUP -> LUDecomposition(a.toCM().origin).solver CMDecomposition.RRQR -> RRQRDecomposition(a.toCM().origin).solver @@ -26,16 +26,16 @@ public fun CMLinearSpace.solver( public fun CMLinearSpace.solve( a: Matrix, b: Matrix, - decomposition: CMDecomposition = CMDecomposition.LUP + decomposition: CMDecomposition = CMDecomposition.LUP, ): CMMatrix = solver(a, decomposition).solve(b.toCM().origin).wrap() public fun CMLinearSpace.solve( a: Matrix, b: Point, - decomposition: CMDecomposition = CMDecomposition.LUP + decomposition: CMDecomposition = CMDecomposition.LUP, ): CMVector = solver(a, decomposition).solve(b.toCM().origin).toPoint() public fun CMLinearSpace.inverse( a: Matrix, - decomposition: CMDecomposition = CMDecomposition.LUP + decomposition: CMDecomposition = CMDecomposition.LUP, ): CMMatrix = solver(a, decomposition).inverse.wrap() diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/transform/Transformations.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/transform/Transformations.kt index e174a237f..aaee594ad 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/transform/Transformations.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/transform/Transformations.kt @@ -33,34 +33,34 @@ public object Transformations { public fun fourier( normalization: DftNormalization = DftNormalization.STANDARD, - direction: TransformType = TransformType.FORWARD + direction: TransformType = TransformType.FORWARD, ): SuspendBufferTransform = { FastFourierTransformer(normalization).transform(it.toArray(), direction).asBuffer() } public fun realFourier( normalization: DftNormalization = DftNormalization.STANDARD, - direction: TransformType = TransformType.FORWARD + direction: TransformType = TransformType.FORWARD, ): SuspendBufferTransform = { FastFourierTransformer(normalization).transform(it.asArray(), direction).asBuffer() } public fun sine( normalization: DstNormalization = DstNormalization.STANDARD_DST_I, - direction: TransformType = TransformType.FORWARD + direction: TransformType = TransformType.FORWARD, ): SuspendBufferTransform = { FastSineTransformer(normalization).transform(it.asArray(), direction).asBuffer() } public fun cosine( normalization: DctNormalization = DctNormalization.STANDARD_DCT_I, - direction: TransformType = TransformType.FORWARD + direction: TransformType = TransformType.FORWARD, ): SuspendBufferTransform = { FastCosineTransformer(normalization).transform(it.asArray(), direction).asBuffer() } public fun hadamard( - direction: TransformType = TransformType.FORWARD + direction: TransformType = TransformType.FORWARD, ): SuspendBufferTransform = { FastHadamardTransformer().transform(it.asArray(), direction).asBuffer() } @@ -72,7 +72,7 @@ public object Transformations { @FlowPreview public fun Flow>.FFT( normalization: DftNormalization = DftNormalization.STANDARD, - direction: TransformType = TransformType.FORWARD + direction: TransformType = TransformType.FORWARD, ): Flow> { val transform = Transformations.fourier(normalization, direction) return map { transform(it) } @@ -82,7 +82,7 @@ public fun Flow>.FFT( @JvmName("realFFT") public fun Flow>.FFT( normalization: DftNormalization = DftNormalization.STANDARD, - direction: TransformType = TransformType.FORWARD + direction: TransformType = TransformType.FORWARD, ): Flow> { val transform = Transformations.realFourier(normalization, direction) return map(transform) @@ -96,7 +96,7 @@ public fun Flow>.FFT( public fun Flow.FFT( bufferSize: Int = Int.MAX_VALUE, normalization: DftNormalization = DftNormalization.STANDARD, - direction: TransformType = TransformType.FORWARD + direction: TransformType = TransformType.FORWARD, ): Flow = chunked(bufferSize).FFT(normalization, direction).spread() /** diff --git a/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpressionTest.kt b/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpressionTest.kt index 19b6e28da..8d9bab652 100644 --- a/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpressionTest.kt +++ b/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpressionTest.kt @@ -27,10 +27,10 @@ internal class AutoDiffTest { val y = bindSymbol("y") val z = x * (-sin(x * y) + y) + 2.0 println(z.derivative(x)) - println(z.derivative(y,x)) + println(z.derivative(y, x)) assertEquals(z.derivative(x, y), z.derivative(y, x)) //check that improper order cause failure - assertFails { z.derivative(x,x,y) } + assertFails { z.derivative(x, x, y) } } } diff --git a/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/ComplexNDField.kt b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/ComplexFieldND.kt similarity index 69% rename from kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/ComplexNDField.kt rename to kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/ComplexFieldND.kt index 382659e10..382410e45 100644 --- a/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/ComplexNDField.kt +++ b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/ComplexFieldND.kt @@ -1,10 +1,10 @@ package space.kscience.kmath.complex import space.kscience.kmath.misc.UnstableKMathAPI -import space.kscience.kmath.nd.BufferedNDField -import space.kscience.kmath.nd.NDAlgebra +import space.kscience.kmath.nd.AlgebraND +import space.kscience.kmath.nd.BufferedFieldND import space.kscience.kmath.nd.NDBuffer -import space.kscience.kmath.nd.NDStructure +import space.kscience.kmath.nd.StructureND import space.kscience.kmath.operations.ExtendedField import space.kscience.kmath.operations.NumbersAddOperations import space.kscience.kmath.structures.Buffer @@ -16,11 +16,11 @@ import kotlin.contracts.contract * An optimized nd-field for complex numbers */ @OptIn(UnstableKMathAPI::class) -public class ComplexNDField( +public class ComplexFieldND( shape: IntArray, -) : BufferedNDField(shape, ComplexField, Buffer.Companion::complex), - NumbersAddOperations>, - ExtendedField> { +) : BufferedFieldND(shape, ComplexField, Buffer.Companion::complex), + NumbersAddOperations>, + ExtendedField> { override val zero: NDBuffer by lazy { produce { zero } } override val one: NDBuffer by lazy { produce { one } } @@ -76,44 +76,44 @@ public class ComplexNDField( // return BufferedNDFieldElement(this, buffer) // } - override fun power(arg: NDStructure, pow: Number): NDBuffer = arg.map { power(it, pow) } + override fun power(arg: StructureND, pow: Number): NDBuffer = arg.map { power(it, pow) } - override fun exp(arg: NDStructure): NDBuffer = arg.map { exp(it) } + override fun exp(arg: StructureND): NDBuffer = arg.map { exp(it) } - override fun ln(arg: NDStructure): NDBuffer = arg.map { ln(it) } + override fun ln(arg: StructureND): NDBuffer = arg.map { ln(it) } - override fun sin(arg: NDStructure): NDBuffer = arg.map { sin(it) } - override fun cos(arg: NDStructure): NDBuffer = arg.map { cos(it) } - override fun tan(arg: NDStructure): NDBuffer = arg.map { tan(it) } - override fun asin(arg: NDStructure): NDBuffer = arg.map { asin(it) } - override fun acos(arg: NDStructure): NDBuffer = arg.map { acos(it) } - override fun atan(arg: NDStructure): NDBuffer = arg.map { atan(it) } + override fun sin(arg: StructureND): NDBuffer = arg.map { sin(it) } + override fun cos(arg: StructureND): NDBuffer = arg.map { cos(it) } + override fun tan(arg: StructureND): NDBuffer = arg.map { tan(it) } + override fun asin(arg: StructureND): NDBuffer = arg.map { asin(it) } + override fun acos(arg: StructureND): NDBuffer = arg.map { acos(it) } + override fun atan(arg: StructureND): NDBuffer = arg.map { atan(it) } - override fun sinh(arg: NDStructure): NDBuffer = arg.map { sinh(it) } - override fun cosh(arg: NDStructure): NDBuffer = arg.map { cosh(it) } - override fun tanh(arg: NDStructure): NDBuffer = arg.map { tanh(it) } - override fun asinh(arg: NDStructure): NDBuffer = arg.map { asinh(it) } - override fun acosh(arg: NDStructure): NDBuffer = arg.map { acosh(it) } - override fun atanh(arg: NDStructure): NDBuffer = arg.map { atanh(it) } + override fun sinh(arg: StructureND): NDBuffer = arg.map { sinh(it) } + override fun cosh(arg: StructureND): NDBuffer = arg.map { cosh(it) } + override fun tanh(arg: StructureND): NDBuffer = arg.map { tanh(it) } + override fun asinh(arg: StructureND): NDBuffer = arg.map { asinh(it) } + override fun acosh(arg: StructureND): NDBuffer = arg.map { acosh(it) } + override fun atanh(arg: StructureND): NDBuffer = arg.map { atanh(it) } } /** * Fast element production using function inlining */ -public inline fun BufferedNDField.produceInline(initializer: ComplexField.(Int) -> Complex): NDBuffer { +public inline fun BufferedFieldND.produceInline(initializer: ComplexField.(Int) -> Complex): NDBuffer { contract { callsInPlace(initializer, InvocationKind.EXACTLY_ONCE) } val buffer = Buffer.complex(strides.linearSize) { offset -> ComplexField.initializer(offset) } return NDBuffer(strides, buffer) } -public fun NDAlgebra.Companion.complex(vararg shape: Int): ComplexNDField = ComplexNDField(shape) +public fun AlgebraND.Companion.complex(vararg shape: Int): ComplexFieldND = ComplexFieldND(shape) /** * Produce a context for n-dimensional operations inside this real field */ -public inline fun ComplexField.nd(vararg shape: Int, action: ComplexNDField.() -> R): R { +public inline fun ComplexField.nd(vararg shape: Int, action: ComplexFieldND.() -> R): R { contract { callsInPlace(action, InvocationKind.EXACTLY_ONCE) } - return ComplexNDField(shape).action() + return ComplexFieldND(shape).action() } diff --git a/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt index d391aff18..9a0346ca7 100644 --- a/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt +++ b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt @@ -172,7 +172,7 @@ public object QuaternionField : Field, Norm, else -> super.bindSymbol(value) } - override fun number(value: Number): Quaternion =value.toQuaternion() + override fun number(value: Number): Quaternion = value.toQuaternion() public override fun sinh(arg: Quaternion): Quaternion = (exp(arg) - exp(-arg)) / 2.0 public override fun cosh(arg: Quaternion): Quaternion = (exp(arg) + exp(-arg)) / 2.0 diff --git a/kmath-core/api/kmath-core.api b/kmath-core/api/kmath-core.api index c5e13fe20..2fb28d73a 100644 --- a/kmath-core/api/kmath-core.api +++ b/kmath-core/api/kmath-core.api @@ -679,73 +679,91 @@ public final class space/kscience/kmath/misc/CumulativeKt { public abstract interface annotation class space/kscience/kmath/misc/UnstableKMathAPI : java/lang/annotation/Annotation { } -public abstract interface class space/kscience/kmath/nd/BufferNDAlgebra : space/kscience/kmath/nd/NDAlgebra { - public abstract fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; - public abstract fun getBuffer (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/structures/Buffer; +public abstract interface class space/kscience/kmath/nd/AlgebraND { + public static final field Companion Lspace/kscience/kmath/nd/AlgebraND$Companion; + public abstract fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND; + public abstract fun getElementContext ()Lspace/kscience/kmath/operations/Algebra; + public abstract fun getShape ()[I + public abstract fun invoke (Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public abstract fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND; + public abstract fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND; + public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND; +} + +public final class space/kscience/kmath/nd/AlgebraND$Companion { +} + +public final class space/kscience/kmath/nd/AlgebraND$DefaultImpls { + public static fun invoke (Lspace/kscience/kmath/nd/AlgebraND;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; +} + +public abstract interface class space/kscience/kmath/nd/BufferAlgebraND : space/kscience/kmath/nd/AlgebraND { + public abstract fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public abstract fun getBuffer (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/structures/Buffer; public abstract fun getBufferFactory ()Lkotlin/jvm/functions/Function2; public abstract fun getStrides ()Lspace/kscience/kmath/nd/Strides; - public abstract fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; - public abstract fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public abstract fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public abstract fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; } -public final class space/kscience/kmath/nd/BufferNDAlgebra$DefaultImpls { - public static fun combine (Lspace/kscience/kmath/nd/BufferNDAlgebra;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; - public static fun getBuffer (Lspace/kscience/kmath/nd/BufferNDAlgebra;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/structures/Buffer; - public static fun invoke (Lspace/kscience/kmath/nd/BufferNDAlgebra;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun map (Lspace/kscience/kmath/nd/BufferNDAlgebra;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; - public static fun mapIndexed (Lspace/kscience/kmath/nd/BufferNDAlgebra;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; - public static fun produce (Lspace/kscience/kmath/nd/BufferNDAlgebra;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; +public final class space/kscience/kmath/nd/BufferAlgebraND$DefaultImpls { + public static fun combine (Lspace/kscience/kmath/nd/BufferAlgebraND;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public static fun getBuffer (Lspace/kscience/kmath/nd/BufferAlgebraND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/structures/Buffer; + public static fun invoke (Lspace/kscience/kmath/nd/BufferAlgebraND;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun map (Lspace/kscience/kmath/nd/BufferAlgebraND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public static fun mapIndexed (Lspace/kscience/kmath/nd/BufferAlgebraND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public static fun produce (Lspace/kscience/kmath/nd/BufferAlgebraND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; } -public final class space/kscience/kmath/nd/BufferNDAlgebraKt { - public static final fun field (Lspace/kscience/kmath/nd/NDAlgebra$Companion;Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedNDField; - public static final fun group (Lspace/kscience/kmath/nd/NDAlgebra$Companion;Lspace/kscience/kmath/operations/Group;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedNDGroup; +public final class space/kscience/kmath/nd/BufferAlgebraNDKt { + public static final fun field (Lspace/kscience/kmath/nd/AlgebraND$Companion;Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedFieldND; + public static final fun group (Lspace/kscience/kmath/nd/AlgebraND$Companion;Lspace/kscience/kmath/operations/Group;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedGroupND; public static final fun ndField (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; public static final fun ndGroup (Lspace/kscience/kmath/operations/Group;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; public static final fun ndRing (Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun ring (Lspace/kscience/kmath/nd/NDAlgebra$Companion;Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedNDRing; + public static final fun ring (Lspace/kscience/kmath/nd/AlgebraND$Companion;Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedRingND; } -public class space/kscience/kmath/nd/BufferedNDField : space/kscience/kmath/nd/BufferedNDRing, space/kscience/kmath/nd/NDField { +public class space/kscience/kmath/nd/BufferedFieldND : space/kscience/kmath/nd/BufferedRingND, space/kscience/kmath/nd/FieldND { public fun ([ILspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;)V public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public fun div (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; - public fun div (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; - public fun div (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun div (Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public fun div (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; + public fun div (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND; + public fun div (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun divide (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; - public fun scale (Lspace/kscience/kmath/nd/NDStructure;D)Lspace/kscience/kmath/nd/NDStructure; + public fun scale (Lspace/kscience/kmath/nd/StructureND;D)Lspace/kscience/kmath/nd/StructureND; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun times (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public fun times (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; } -public class space/kscience/kmath/nd/BufferedNDGroup : space/kscience/kmath/nd/BufferNDAlgebra, space/kscience/kmath/nd/NDGroup { +public class space/kscience/kmath/nd/BufferedGroupND : space/kscience/kmath/nd/BufferAlgebraND, space/kscience/kmath/nd/GroupND { public fun ([ILspace/kscience/kmath/operations/Group;Lkotlin/jvm/functions/Function2;)V public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun add (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; - public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/nd/NDStructure; - public fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; - public fun getBuffer (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/structures/Buffer; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/nd/StructureND; + public fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND; + public fun getBuffer (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/structures/Buffer; public final fun getBufferFactory ()Lkotlin/jvm/functions/Function2; public synthetic fun getElementContext ()Lspace/kscience/kmath/operations/Algebra; public final fun getElementContext ()Lspace/kscience/kmath/operations/Group; @@ -753,41 +771,41 @@ public class space/kscience/kmath/nd/BufferedNDGroup : space/kscience/kmath/nd/B public fun getStrides ()Lspace/kscience/kmath/nd/Strides; public synthetic fun getZero ()Ljava/lang/Object; public fun getZero ()Lspace/kscience/kmath/nd/NDBuffer; - public fun invoke (Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; - public fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; + public fun invoke (Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND; + public fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; - public fun minus (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun minus (Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public fun minus (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND; + public fun minus (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public fun plus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; - public fun plus (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun plus (Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public fun plus (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND; + public fun plus (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; + public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun unaryMinus (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun unaryPlus (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; } -public class space/kscience/kmath/nd/BufferedNDRing : space/kscience/kmath/nd/BufferedNDGroup, space/kscience/kmath/nd/NDRing { +public class space/kscience/kmath/nd/BufferedRingND : space/kscience/kmath/nd/BufferedGroupND, space/kscience/kmath/nd/RingND { public fun ([ILspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun getOne ()Ljava/lang/Object; public fun getOne ()Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun multiply (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public fun times (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; - public fun times (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public fun times (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND; + public fun times (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; } public final class space/kscience/kmath/nd/DefaultStrides : space/kscience/kmath/nd/Strides { @@ -807,6 +825,74 @@ public final class space/kscience/kmath/nd/DefaultStrides$Companion { public final fun invoke ([I)Lspace/kscience/kmath/nd/Strides; } +public abstract interface class space/kscience/kmath/nd/FieldND : space/kscience/kmath/nd/RingND, space/kscience/kmath/operations/Field, space/kscience/kmath/operations/ScaleOperations { + public abstract fun div (Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public abstract fun div (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND; + public abstract fun divide (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; +} + +public final class space/kscience/kmath/nd/FieldND$DefaultImpls { + public static fun add (Lspace/kscience/kmath/nd/FieldND;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun binaryOperation (Lspace/kscience/kmath/nd/FieldND;Ljava/lang/String;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun binaryOperationFunction (Lspace/kscience/kmath/nd/FieldND;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/nd/FieldND;Ljava/lang/String;)Lspace/kscience/kmath/nd/StructureND; + public static fun div (Lspace/kscience/kmath/nd/FieldND;Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun div (Lspace/kscience/kmath/nd/FieldND;Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; + public static fun div (Lspace/kscience/kmath/nd/FieldND;Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND; + public static fun div (Lspace/kscience/kmath/nd/FieldND;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun divide (Lspace/kscience/kmath/nd/FieldND;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun invoke (Lspace/kscience/kmath/nd/FieldND;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun leftSideNumberOperation (Lspace/kscience/kmath/nd/FieldND;Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun leftSideNumberOperationFunction (Lspace/kscience/kmath/nd/FieldND;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun minus (Lspace/kscience/kmath/nd/FieldND;Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun minus (Lspace/kscience/kmath/nd/FieldND;Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND; + public static fun minus (Lspace/kscience/kmath/nd/FieldND;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun multiply (Lspace/kscience/kmath/nd/FieldND;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun number (Lspace/kscience/kmath/nd/FieldND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; + public static fun plus (Lspace/kscience/kmath/nd/FieldND;Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun plus (Lspace/kscience/kmath/nd/FieldND;Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND; + public static fun plus (Lspace/kscience/kmath/nd/FieldND;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun rightSideNumberOperation (Lspace/kscience/kmath/nd/FieldND;Ljava/lang/String;Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; + public static fun rightSideNumberOperationFunction (Lspace/kscience/kmath/nd/FieldND;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun times (Lspace/kscience/kmath/nd/FieldND;Ljava/lang/Number;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun times (Lspace/kscience/kmath/nd/FieldND;Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun times (Lspace/kscience/kmath/nd/FieldND;Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; + public static fun times (Lspace/kscience/kmath/nd/FieldND;Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND; + public static fun times (Lspace/kscience/kmath/nd/FieldND;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun unaryOperation (Lspace/kscience/kmath/nd/FieldND;Ljava/lang/String;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun unaryOperationFunction (Lspace/kscience/kmath/nd/FieldND;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/nd/FieldND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; +} + +public abstract interface class space/kscience/kmath/nd/GroupND : space/kscience/kmath/nd/AlgebraND, space/kscience/kmath/operations/Group { + public static final field Companion Lspace/kscience/kmath/nd/GroupND$Companion; + public abstract fun add (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public abstract fun minus (Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public abstract fun minus (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND; + public abstract fun plus (Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public abstract fun plus (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND; +} + +public final class space/kscience/kmath/nd/GroupND$Companion { +} + +public final class space/kscience/kmath/nd/GroupND$DefaultImpls { + public static fun add (Lspace/kscience/kmath/nd/GroupND;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun binaryOperation (Lspace/kscience/kmath/nd/GroupND;Ljava/lang/String;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun binaryOperationFunction (Lspace/kscience/kmath/nd/GroupND;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/nd/GroupND;Ljava/lang/String;)Lspace/kscience/kmath/nd/StructureND; + public static fun invoke (Lspace/kscience/kmath/nd/GroupND;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun minus (Lspace/kscience/kmath/nd/GroupND;Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun minus (Lspace/kscience/kmath/nd/GroupND;Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND; + public static fun minus (Lspace/kscience/kmath/nd/GroupND;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun plus (Lspace/kscience/kmath/nd/GroupND;Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun plus (Lspace/kscience/kmath/nd/GroupND;Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND; + public static fun plus (Lspace/kscience/kmath/nd/GroupND;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun unaryOperation (Lspace/kscience/kmath/nd/GroupND;Ljava/lang/String;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun unaryOperationFunction (Lspace/kscience/kmath/nd/GroupND;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/nd/GroupND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; +} + public final class space/kscience/kmath/nd/MutableNDBuffer : space/kscience/kmath/nd/NDBuffer, space/kscience/kmath/nd/MutableNDStructure { public fun (Lspace/kscience/kmath/nd/Strides;Lspace/kscience/kmath/structures/MutableBuffer;)V public synthetic fun getBuffer ()Lspace/kscience/kmath/structures/Buffer; @@ -814,7 +900,7 @@ public final class space/kscience/kmath/nd/MutableNDBuffer : space/kscience/kmat public fun set ([ILjava/lang/Object;)V } -public abstract interface class space/kscience/kmath/nd/MutableNDStructure : space/kscience/kmath/nd/NDStructure { +public abstract interface class space/kscience/kmath/nd/MutableNDStructure : space/kscience/kmath/nd/StructureND { public abstract fun set ([ILjava/lang/Object;)V } @@ -822,25 +908,7 @@ public final class space/kscience/kmath/nd/MutableNDStructure$DefaultImpls { public static fun getDimension (Lspace/kscience/kmath/nd/MutableNDStructure;)I } -public abstract interface class space/kscience/kmath/nd/NDAlgebra { - public static final field Companion Lspace/kscience/kmath/nd/NDAlgebra$Companion; - public abstract fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; - public abstract fun getElementContext ()Lspace/kscience/kmath/operations/Algebra; - public abstract fun getShape ()[I - public abstract fun invoke (Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public abstract fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; - public abstract fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; - public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; -} - -public final class space/kscience/kmath/nd/NDAlgebra$Companion { -} - -public final class space/kscience/kmath/nd/NDAlgebra$DefaultImpls { - public static fun invoke (Lspace/kscience/kmath/nd/NDAlgebra;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; -} - -public class space/kscience/kmath/nd/NDBuffer : space/kscience/kmath/nd/NDStructure { +public class space/kscience/kmath/nd/NDBuffer : space/kscience/kmath/nd/StructureND { public fun (Lspace/kscience/kmath/nd/Strides;Lspace/kscience/kmath/structures/Buffer;)V public fun elements ()Lkotlin/sequences/Sequence; public fun equals (Ljava/lang/Object;)Z @@ -853,204 +921,107 @@ public class space/kscience/kmath/nd/NDBuffer : space/kscience/kmath/nd/NDStruct public fun toString ()Ljava/lang/String; } -public abstract interface class space/kscience/kmath/nd/NDField : space/kscience/kmath/nd/NDRing, space/kscience/kmath/operations/Field, space/kscience/kmath/operations/ScaleOperations { - public abstract fun div (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public abstract fun div (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; - public abstract fun divide (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; -} - -public final class space/kscience/kmath/nd/NDField$DefaultImpls { - public static fun add (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun binaryOperation (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun binaryOperationFunction (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun bindSymbol (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;)Lspace/kscience/kmath/nd/NDStructure; - public static fun div (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun div (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; - public static fun div (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; - public static fun div (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun divide (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun invoke (Lspace/kscience/kmath/nd/NDField;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun leftSideNumberOperation (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun leftSideNumberOperationFunction (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun minus (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun minus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; - public static fun minus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun multiply (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun number (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; - public static fun plus (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun plus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; - public static fun plus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun rightSideNumberOperation (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; - public static fun rightSideNumberOperationFunction (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun times (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun times (Lspace/kscience/kmath/nd/NDField;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun times (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; - public static fun times (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; - public static fun times (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun unaryOperation (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun unaryOperationFunction (Lspace/kscience/kmath/nd/NDField;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lspace/kscience/kmath/nd/NDField;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; -} - -public abstract interface class space/kscience/kmath/nd/NDGroup : space/kscience/kmath/nd/NDAlgebra, space/kscience/kmath/operations/Group { - public static final field Companion Lspace/kscience/kmath/nd/NDGroup$Companion; - public abstract fun add (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public abstract fun minus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public abstract fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; - public abstract fun plus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public abstract fun plus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; -} - -public final class space/kscience/kmath/nd/NDGroup$Companion { -} - -public final class space/kscience/kmath/nd/NDGroup$DefaultImpls { - public static fun add (Lspace/kscience/kmath/nd/NDGroup;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun binaryOperation (Lspace/kscience/kmath/nd/NDGroup;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun binaryOperationFunction (Lspace/kscience/kmath/nd/NDGroup;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun bindSymbol (Lspace/kscience/kmath/nd/NDGroup;Ljava/lang/String;)Lspace/kscience/kmath/nd/NDStructure; - public static fun invoke (Lspace/kscience/kmath/nd/NDGroup;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun minus (Lspace/kscience/kmath/nd/NDGroup;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun minus (Lspace/kscience/kmath/nd/NDGroup;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; - public static fun minus (Lspace/kscience/kmath/nd/NDGroup;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun plus (Lspace/kscience/kmath/nd/NDGroup;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun plus (Lspace/kscience/kmath/nd/NDGroup;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; - public static fun plus (Lspace/kscience/kmath/nd/NDGroup;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun unaryOperation (Lspace/kscience/kmath/nd/NDGroup;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun unaryOperationFunction (Lspace/kscience/kmath/nd/NDGroup;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lspace/kscience/kmath/nd/NDGroup;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; -} - -public abstract interface class space/kscience/kmath/nd/NDRing : space/kscience/kmath/nd/NDGroup, space/kscience/kmath/operations/Ring { - public static final field Companion Lspace/kscience/kmath/nd/NDRing$Companion; - public abstract fun multiply (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public abstract fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public abstract fun times (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; -} - -public final class space/kscience/kmath/nd/NDRing$Companion { -} - -public final class space/kscience/kmath/nd/NDRing$DefaultImpls { - public static fun add (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun binaryOperation (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun binaryOperationFunction (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public static fun bindSymbol (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;)Lspace/kscience/kmath/nd/NDStructure; - public static fun invoke (Lspace/kscience/kmath/nd/NDRing;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun minus (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun minus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; - public static fun minus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun multiply (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun plus (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun plus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; - public static fun plus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun times (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun times (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; - public static fun times (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun unaryOperation (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public static fun unaryOperationFunction (Lspace/kscience/kmath/nd/NDRing;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public static fun unaryPlus (Lspace/kscience/kmath/nd/NDRing;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; -} - -public abstract interface class space/kscience/kmath/nd/NDStructure { - public static final field Companion Lspace/kscience/kmath/nd/NDStructure$Companion; - public abstract fun elements ()Lkotlin/sequences/Sequence; - public abstract fun equals (Ljava/lang/Object;)Z - public abstract fun get ([I)Ljava/lang/Object; - public abstract fun getDimension ()I - public abstract fun getShape ()[I - public abstract fun hashCode ()I -} - -public final class space/kscience/kmath/nd/NDStructure$Companion { - public final fun auto (Lkotlin/reflect/KClass;Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; - public final fun auto (Lkotlin/reflect/KClass;[ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; - public final fun buffered (Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; - public final fun buffered ([ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; - public static synthetic fun buffered$default (Lspace/kscience/kmath/nd/NDStructure$Companion;Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/kmath/nd/NDBuffer; - public static synthetic fun buffered$default (Lspace/kscience/kmath/nd/NDStructure$Companion;[ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/kmath/nd/NDBuffer; - public final fun contentEquals (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Z -} - -public final class space/kscience/kmath/nd/NDStructure$DefaultImpls { - public static fun getDimension (Lspace/kscience/kmath/nd/NDStructure;)I -} - -public final class space/kscience/kmath/nd/NDStructureKt { - public static final fun get (Lspace/kscience/kmath/nd/NDStructure;[I)Ljava/lang/Object; - public static final fun mapInPlace (Lspace/kscience/kmath/nd/MutableNDStructure;Lkotlin/jvm/functions/Function2;)V -} - -public final class space/kscience/kmath/nd/RealNDField : space/kscience/kmath/nd/BufferedNDField, space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/NumbersAddOperations, space/kscience/kmath/operations/ScaleOperations { +public final class space/kscience/kmath/nd/RealFieldND : space/kscience/kmath/nd/BufferedFieldND, space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/NumbersAddOperations, space/kscience/kmath/operations/ScaleOperations { public fun ([I)V public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; - public fun acos (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; + public fun acos (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun acosh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; + public fun acosh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; - public fun asin (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; + public fun asin (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun asinh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; + public fun asinh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; - public fun atan (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; + public fun atan (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun atanh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; - public fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; + public fun atanh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; - public fun cos (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; + public fun cos (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun cosh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; + public fun cosh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; - public fun exp (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun getBuffer (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/structures/Buffer; - public fun getBuffer-LGjt3BI (Lspace/kscience/kmath/nd/NDStructure;)[D + public fun exp (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun getBuffer (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/structures/Buffer; + public fun getBuffer-LGjt3BI (Lspace/kscience/kmath/nd/StructureND;)[D public synthetic fun getOne ()Ljava/lang/Object; public fun getOne ()Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun getZero ()Ljava/lang/Object; public fun getZero ()Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; - public fun ln (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; - public fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; - public fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; + public fun ln (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND; + public fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun minus (Ljava/lang/Number;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public fun minus (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public synthetic fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun plus (Ljava/lang/Number;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun plus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public fun plus (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun pow (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public fun pow (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun power (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDBuffer; + public fun power (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDBuffer; public fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; + public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; - public fun scale (Lspace/kscience/kmath/nd/NDStructure;D)Lspace/kscience/kmath/nd/NDStructure; + public fun scale (Lspace/kscience/kmath/nd/StructureND;D)Lspace/kscience/kmath/nd/StructureND; public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; - public fun sin (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; + public fun sin (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun sinh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; + public fun sinh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun sqrt (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun sqrt (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; - public fun tan (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; + public fun tan (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun tanh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDBuffer; + public fun tanh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class space/kscience/kmath/nd/RealNDFieldKt { +public final class space/kscience/kmath/nd/RealFieldNDKt { public static final fun nd (Lspace/kscience/kmath/operations/RealField;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun real (Lspace/kscience/kmath/nd/NDAlgebra$Companion;[I)Lspace/kscience/kmath/nd/RealNDField; + public static final fun real (Lspace/kscience/kmath/nd/AlgebraND$Companion;[I)Lspace/kscience/kmath/nd/RealFieldND; +} + +public abstract interface class space/kscience/kmath/nd/RingND : space/kscience/kmath/nd/GroupND, space/kscience/kmath/operations/Ring { + public static final field Companion Lspace/kscience/kmath/nd/RingND$Companion; + public abstract fun multiply (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public abstract fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public abstract fun times (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND; +} + +public final class space/kscience/kmath/nd/RingND$Companion { +} + +public final class space/kscience/kmath/nd/RingND$DefaultImpls { + public static fun add (Lspace/kscience/kmath/nd/RingND;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun binaryOperation (Lspace/kscience/kmath/nd/RingND;Ljava/lang/String;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun binaryOperationFunction (Lspace/kscience/kmath/nd/RingND;Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public static fun bindSymbol (Lspace/kscience/kmath/nd/RingND;Ljava/lang/String;)Lspace/kscience/kmath/nd/StructureND; + public static fun invoke (Lspace/kscience/kmath/nd/RingND;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun minus (Lspace/kscience/kmath/nd/RingND;Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun minus (Lspace/kscience/kmath/nd/RingND;Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND; + public static fun minus (Lspace/kscience/kmath/nd/RingND;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun multiply (Lspace/kscience/kmath/nd/RingND;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun plus (Lspace/kscience/kmath/nd/RingND;Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun plus (Lspace/kscience/kmath/nd/RingND;Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND; + public static fun plus (Lspace/kscience/kmath/nd/RingND;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun times (Lspace/kscience/kmath/nd/RingND;Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun times (Lspace/kscience/kmath/nd/RingND;Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND; + public static fun times (Lspace/kscience/kmath/nd/RingND;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun unaryOperation (Lspace/kscience/kmath/nd/RingND;Ljava/lang/String;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public static fun unaryOperationFunction (Lspace/kscience/kmath/nd/RingND;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public static fun unaryPlus (Lspace/kscience/kmath/nd/RingND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; } public final class space/kscience/kmath/nd/ShapeMismatchException : java/lang/RuntimeException { @@ -1059,33 +1030,33 @@ public final class space/kscience/kmath/nd/ShapeMismatchException : java/lang/Ru public final fun getExpected ()[I } -public final class space/kscience/kmath/nd/ShortNDRing : space/kscience/kmath/nd/BufferedNDRing, space/kscience/kmath/operations/NumbersAddOperations { +public final class space/kscience/kmath/nd/ShortRingND : space/kscience/kmath/nd/BufferedRingND, space/kscience/kmath/operations/NumbersAddOperations { public fun ([I)V public synthetic fun getOne ()Ljava/lang/Object; public fun getOne ()Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun getZero ()Ljava/lang/Object; public fun getZero ()Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun minus (Ljava/lang/Number;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public fun minus (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDBuffer; public synthetic fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun plus (Ljava/lang/Number;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun plus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public fun plus (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; } -public final class space/kscience/kmath/nd/ShortNDRingKt { +public final class space/kscience/kmath/nd/ShortRingNDKt { public static final fun nd (Lspace/kscience/kmath/operations/ShortRing;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun produceInline (Lspace/kscience/kmath/nd/BufferedNDRing;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public static final fun produceInline (Lspace/kscience/kmath/nd/BufferedRingND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; } public abstract interface class space/kscience/kmath/nd/Strides { @@ -1101,7 +1072,7 @@ public final class space/kscience/kmath/nd/Strides$DefaultImpls { public static fun indices (Lspace/kscience/kmath/nd/Strides;)Lkotlin/sequences/Sequence; } -public abstract interface class space/kscience/kmath/nd/Structure1D : space/kscience/kmath/nd/NDStructure, space/kscience/kmath/structures/Buffer { +public abstract interface class space/kscience/kmath/nd/Structure1D : space/kscience/kmath/nd/StructureND, space/kscience/kmath/structures/Buffer { public abstract fun get ([I)Ljava/lang/Object; public abstract fun getDimension ()I public abstract fun iterator ()Ljava/util/Iterator; @@ -1115,11 +1086,11 @@ public final class space/kscience/kmath/nd/Structure1D$DefaultImpls { } public final class space/kscience/kmath/nd/Structure1DKt { - public static final fun as1D (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/Structure1D; + public static final fun as1D (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/Structure1D; public static final fun asND (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/nd/Structure1D; } -public abstract interface class space/kscience/kmath/nd/Structure2D : space/kscience/kmath/nd/NDStructure { +public abstract interface class space/kscience/kmath/nd/Structure2D : space/kscience/kmath/nd/StructureND { public static final field Companion Lspace/kscience/kmath/nd/Structure2D$Companion; public abstract fun elements ()Lkotlin/sequences/Sequence; public abstract fun get (II)Ljava/lang/Object; @@ -1144,7 +1115,36 @@ public final class space/kscience/kmath/nd/Structure2D$DefaultImpls { } public final class space/kscience/kmath/nd/Structure2DKt { - public static final fun as2D (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/Structure2D; + public static final fun as2D (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/Structure2D; +} + +public abstract interface class space/kscience/kmath/nd/StructureND { + public static final field Companion Lspace/kscience/kmath/nd/StructureND$Companion; + public abstract fun elements ()Lkotlin/sequences/Sequence; + public abstract fun equals (Ljava/lang/Object;)Z + public abstract fun get ([I)Ljava/lang/Object; + public abstract fun getDimension ()I + public abstract fun getShape ()[I + public abstract fun hashCode ()I +} + +public final class space/kscience/kmath/nd/StructureND$Companion { + public final fun auto (Lkotlin/reflect/KClass;Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; + public final fun auto (Lkotlin/reflect/KClass;[ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; + public final fun buffered (Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; + public final fun buffered ([ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; + public static synthetic fun buffered$default (Lspace/kscience/kmath/nd/StructureND$Companion;Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/kmath/nd/NDBuffer; + public static synthetic fun buffered$default (Lspace/kscience/kmath/nd/StructureND$Companion;[ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/kmath/nd/NDBuffer; + public final fun contentEquals (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Z +} + +public final class space/kscience/kmath/nd/StructureND$DefaultImpls { + public static fun getDimension (Lspace/kscience/kmath/nd/StructureND;)I +} + +public final class space/kscience/kmath/nd/StructureNDKt { + public static final fun get (Lspace/kscience/kmath/nd/StructureND;[I)Ljava/lang/Object; + public static final fun mapInPlace (Lspace/kscience/kmath/nd/MutableNDStructure;Lkotlin/jvm/functions/Function2;)V } public abstract interface class space/kscience/kmath/operations/Algebra { @@ -1287,7 +1287,7 @@ public final class space/kscience/kmath/operations/BigIntField : space/kscience/ public final class space/kscience/kmath/operations/BigIntKt { public static final fun abs (Lspace/kscience/kmath/operations/BigInt;)Lspace/kscience/kmath/operations/BigInt; - public static final fun bigInt (Lspace/kscience/kmath/nd/NDAlgebra$Companion;[I)Lspace/kscience/kmath/nd/BufferedNDRing; + public static final fun bigInt (Lspace/kscience/kmath/nd/AlgebraND$Companion;[I)Lspace/kscience/kmath/nd/BufferedRingND; public static final fun bigInt (Lspace/kscience/kmath/structures/Buffer$Companion;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; public static final fun bigInt (Lspace/kscience/kmath/structures/MutableBuffer$Companion;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/MutableBuffer; public static final fun parseBigInteger (Ljava/lang/String;)Lspace/kscience/kmath/operations/BigInt; diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferedLinearSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferedLinearSpace.kt index fe92a711a..662cd6409 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferedLinearSpace.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/BufferedLinearSpace.kt @@ -17,7 +17,7 @@ public class BufferedLinearSpace>( private fun ndRing( rows: Int, cols: Int, - ): BufferedNDRing = NDAlgebra.ring(elementAlgebra, bufferFactory, rows, cols) + ): BufferedRingND = AlgebraND.ring(elementAlgebra, bufferFactory, rows, cols) override fun buildMatrix(rows: Int, columns: Int, initializer: A.(i: Int, j: Int) -> T): Matrix = ndRing(rows, columns).produce { (i, j) -> elementAlgebra.initializer(i, j) }.as2D() diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VirtualMatrix.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VirtualMatrix.kt index 8efa08f81..56cafbdb5 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VirtualMatrix.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VirtualMatrix.kt @@ -1,6 +1,6 @@ package space.kscience.kmath.linear -import space.kscience.kmath.nd.NDStructure +import space.kscience.kmath.nd.StructureND /** * The matrix where each element is evaluated each time when is being accessed. @@ -19,8 +19,8 @@ public class VirtualMatrix( override fun equals(other: Any?): Boolean { if (this === other) return true - if (other !is NDStructure<*>) return false - return NDStructure.contentEquals(this, other) + if (other !is StructureND<*>) return false + return StructureND.contentEquals(this, other) } override fun hashCode(): Int { diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDAlgebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/AlgebraND.kt similarity index 75% rename from kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDAlgebra.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/AlgebraND.kt index 5514a8f0f..b23ce947d 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/AlgebraND.kt @@ -21,7 +21,7 @@ public class ShapeMismatchException(public val expected: IntArray, public val ac * @param C the type of the element context. * @param N the type of the structure. */ -public interface NDAlgebra> { +public interface AlgebraND> { /** * The shape of ND-structures this algebra operates on. */ @@ -35,27 +35,27 @@ public interface NDAlgebra> { /** * Produces a new NDStructure using given initializer function. */ - public fun produce(initializer: C.(IntArray) -> T): NDStructure + public fun produce(initializer: C.(IntArray) -> T): StructureND /** * Maps elements from one structure to another one by applying [transform] to them. */ - public fun NDStructure.map(transform: C.(T) -> T): NDStructure + public fun StructureND.map(transform: C.(T) -> T): StructureND /** * Maps elements from one structure to another one by applying [transform] to them alongside with their indices. */ - public fun NDStructure.mapIndexed(transform: C.(index: IntArray, T) -> T): NDStructure + public fun StructureND.mapIndexed(transform: C.(index: IntArray, T) -> T): StructureND /** * Combines two structures into one. */ - public fun combine(a: NDStructure, b: NDStructure, transform: C.(T, T) -> T): NDStructure + public fun combine(a: StructureND, b: StructureND, transform: C.(T, T) -> T): StructureND /** - * Element-wise invocation of function working on [T] on a [NDStructure]. + * Element-wise invocation of function working on [T] on a [StructureND]. */ - public operator fun Function1.invoke(structure: NDStructure): NDStructure = + public operator fun Function1.invoke(structure: StructureND): StructureND = structure.map { value -> this@invoke(value) } /** @@ -67,7 +67,7 @@ public interface NDAlgebra> { * @return a feature object or `null` if it isn't present. */ @UnstableKMathAPI - public fun getFeature(structure: NDStructure, type: KClass): F? = structure.getFeature(type) + public fun getFeature(structure: StructureND, type: KClass): F? = structure.getFeature(type) public companion object } @@ -81,7 +81,7 @@ public interface NDAlgebra> { * @return a feature object or `null` if it isn't present. */ @UnstableKMathAPI -public inline fun NDAlgebra.getFeature(structure: NDStructure): F? = +public inline fun AlgebraND.getFeature(structure: StructureND): F? = getFeature(structure, F::class) /** @@ -90,11 +90,11 @@ public inline fun NDAlgebra.getFeature(structur * @param structures the structures to check. * @return the array of valid structures. */ -internal fun > NDAlgebra.checkShape(vararg structures: NDStructure): Array> = +internal fun > AlgebraND.checkShape(vararg structures: StructureND): Array> = structures - .map(NDStructure::shape) + .map(StructureND::shape) .singleOrNull { !shape.contentEquals(it) } - ?.let>> { throw ShapeMismatchException(shape, it) } + ?.let>> { throw ShapeMismatchException(shape, it) } ?: structures /** @@ -103,19 +103,19 @@ internal fun > NDAlgebra.checkShape(vararg structures: N * @param element the structure to check. * @return the valid structure. */ -internal fun > NDAlgebra.checkShape(element: NDStructure): NDStructure { +internal fun > AlgebraND.checkShape(element: StructureND): StructureND { if (!element.shape.contentEquals(shape)) throw ShapeMismatchException(shape, element.shape) return element } /** - * Space of [NDStructure]. + * Space of [StructureND]. * * @param T the type of the element contained in ND structure. * @param N the type of ND structure. * @param S the type of space of structure elements. */ -public interface NDGroup> : Group>, NDAlgebra { +public interface GroupND> : Group>, AlgebraND { /** * Element-wise addition. * @@ -123,7 +123,7 @@ public interface NDGroup> : Group>, NDAlgebra, b: NDStructure): NDStructure = + public override fun add(a: StructureND, b: StructureND): StructureND = combine(a, b) { aValue, bValue -> add(aValue, bValue) } // /** @@ -144,7 +144,7 @@ public interface NDGroup> : Group>, NDAlgebra.plus(arg: T): NDStructure = this.map { value -> add(arg, value) } + public operator fun StructureND.plus(arg: T): StructureND = this.map { value -> add(arg, value) } /** * Subtracts an element from ND structure of it. @@ -153,7 +153,7 @@ public interface NDGroup> : Group>, NDAlgebra.minus(arg: T): NDStructure = this.map { value -> add(arg, -value) } + public operator fun StructureND.minus(arg: T): StructureND = this.map { value -> add(arg, -value) } /** * Adds an element to ND structure of it. @@ -162,7 +162,7 @@ public interface NDGroup> : Group>, NDAlgebra): NDStructure = arg.map { value -> add(this@plus, value) } + public operator fun T.plus(arg: StructureND): StructureND = arg.map { value -> add(this@plus, value) } /** * Subtracts an ND structure from an element of it. @@ -171,19 +171,19 @@ public interface NDGroup> : Group>, NDAlgebra): NDStructure = arg.map { value -> add(-this@minus, value) } + public operator fun T.minus(arg: StructureND): StructureND = arg.map { value -> add(-this@minus, value) } public companion object } /** - * Ring of [NDStructure]. + * Ring of [StructureND]. * * @param T the type of the element contained in ND structure. * @param N the type of ND structure. * @param R the type of ring of structure elements. */ -public interface NDRing> : Ring>, NDGroup { +public interface RingND> : Ring>, GroupND { /** * Element-wise multiplication. * @@ -191,7 +191,7 @@ public interface NDRing> : Ring>, NDGroup { * @param b the multiplier. * @return the product. */ - public override fun multiply(a: NDStructure, b: NDStructure): NDStructure = + public override fun multiply(a: StructureND, b: StructureND): StructureND = combine(a, b) { aValue, bValue -> multiply(aValue, bValue) } //TODO move to extensions after KEEP-176 @@ -203,7 +203,7 @@ public interface NDRing> : Ring>, NDGroup { * @param arg the multiplier. * @return the product. */ - public operator fun NDStructure.times(arg: T): NDStructure = this.map { value -> multiply(arg, value) } + public operator fun StructureND.times(arg: T): StructureND = this.map { value -> multiply(arg, value) } /** * Multiplies an element by a ND structure of it. @@ -212,19 +212,19 @@ public interface NDRing> : Ring>, NDGroup { * @param arg the multiplier. * @return the product. */ - public operator fun T.times(arg: NDStructure): NDStructure = arg.map { value -> multiply(this@times, value) } + public operator fun T.times(arg: StructureND): StructureND = arg.map { value -> multiply(this@times, value) } public companion object } /** - * Field of [NDStructure]. + * Field of [StructureND]. * * @param T the type of the element contained in ND structure. * @param N the type of ND structure. * @param F the type field of structure elements. */ -public interface NDField> : Field>, NDRing, ScaleOperations> { +public interface FieldND> : Field>, RingND, ScaleOperations> { /** * Element-wise division. * @@ -232,7 +232,7 @@ public interface NDField> : Field>, NDRing, * @param b the divisor. * @return the quotient. */ - public override fun divide(a: NDStructure, b: NDStructure): NDStructure = + public override fun divide(a: StructureND, b: StructureND): StructureND = combine(a, b) { aValue, bValue -> divide(aValue, bValue) } //TODO move to extensions after KEEP-176 @@ -243,7 +243,7 @@ public interface NDField> : Field>, NDRing, * @param arg the divisor. * @return the quotient. */ - public operator fun NDStructure.div(arg: T): NDStructure = this.map { value -> divide(arg, value) } + public operator fun StructureND.div(arg: T): StructureND = this.map { value -> divide(arg, value) } /** * Divides an element by an ND structure of it. @@ -252,7 +252,7 @@ public interface NDField> : Field>, NDRing, * @param arg the divisor. * @return the quotient. */ - public operator fun T.div(arg: NDStructure): NDStructure = arg.map { divide(it, this@div) } + public operator fun T.div(arg: StructureND): StructureND = arg.map { divide(it, this@div) } // @ThreadLocal // public companion object { diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferNDAlgebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferAlgebraND.kt similarity index 60% rename from kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferNDAlgebra.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferAlgebraND.kt index bce3a0830..cef43d06f 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferNDAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferAlgebraND.kt @@ -6,7 +6,7 @@ import space.kscience.kmath.structures.BufferFactory import kotlin.contracts.InvocationKind import kotlin.contracts.contract -public interface BufferNDAlgebra> : NDAlgebra { +public interface BufferAlgebraND> : AlgebraND { public val strides: Strides public val bufferFactory: BufferFactory @@ -17,24 +17,24 @@ public interface BufferNDAlgebra> : NDAlgebra { } ) - public val NDStructure.buffer: Buffer + public val StructureND.buffer: Buffer get() = when { - !shape.contentEquals(this@BufferNDAlgebra.shape) -> throw ShapeMismatchException( - this@BufferNDAlgebra.shape, + !shape.contentEquals(this@BufferAlgebraND.shape) -> throw ShapeMismatchException( + this@BufferAlgebraND.shape, shape ) - this is NDBuffer && this.strides == this@BufferNDAlgebra.strides -> this.buffer + this is NDBuffer && this.strides == this@BufferAlgebraND.strides -> this.buffer else -> bufferFactory(strides.linearSize) { offset -> get(strides.index(offset)) } } - override fun NDStructure.map(transform: A.(T) -> T): NDBuffer { + override fun StructureND.map(transform: A.(T) -> T): NDBuffer { val buffer = bufferFactory(strides.linearSize) { offset -> elementContext.transform(buffer[offset]) } return NDBuffer(strides, buffer) } - override fun NDStructure.mapIndexed(transform: A.(index: IntArray, T) -> T): NDBuffer { + override fun StructureND.mapIndexed(transform: A.(index: IntArray, T) -> T): NDBuffer { val buffer = bufferFactory(strides.linearSize) { offset -> elementContext.transform( strides.index(offset), @@ -44,7 +44,7 @@ public interface BufferNDAlgebra> : NDAlgebra { return NDBuffer(strides, buffer) } - override fun combine(a: NDStructure, b: NDStructure, transform: A.(T, T) -> T): NDBuffer { + override fun combine(a: StructureND, b: StructureND, transform: A.(T, T) -> T): NDBuffer { val buffer = bufferFactory(strides.linearSize) { offset -> elementContext.transform(a.buffer[offset], b.buffer[offset]) } @@ -52,86 +52,86 @@ public interface BufferNDAlgebra> : NDAlgebra { } } -public open class BufferedNDGroup>( +public open class BufferedGroupND>( final override val shape: IntArray, final override val elementContext: A, final override val bufferFactory: BufferFactory, -) : NDGroup, BufferNDAlgebra { +) : GroupND, BufferAlgebraND { override val strides: Strides = DefaultStrides(shape) override val zero: NDBuffer by lazy { produce { zero } } - override fun NDStructure.unaryMinus(): NDStructure = produce { -get(it) } + override fun StructureND.unaryMinus(): StructureND = produce { -get(it) } } -public open class BufferedNDRing>( +public open class BufferedRingND>( shape: IntArray, elementContext: R, bufferFactory: BufferFactory, -) : BufferedNDGroup(shape, elementContext, bufferFactory), NDRing { +) : BufferedGroupND(shape, elementContext, bufferFactory), RingND { override val one: NDBuffer by lazy { produce { one } } } -public open class BufferedNDField>( +public open class BufferedFieldND>( shape: IntArray, elementContext: R, bufferFactory: BufferFactory, -) : BufferedNDRing(shape, elementContext, bufferFactory), NDField { +) : BufferedRingND(shape, elementContext, bufferFactory), FieldND { - override fun scale(a: NDStructure, value: Double): NDStructure = a.map { it * value } + override fun scale(a: StructureND, value: Double): StructureND = a.map { it * value } } // group factories -public fun > NDAlgebra.Companion.group( +public fun > AlgebraND.Companion.group( space: A, bufferFactory: BufferFactory, vararg shape: Int, -): BufferedNDGroup = BufferedNDGroup(shape, space, bufferFactory) +): BufferedGroupND = BufferedGroupND(shape, space, bufferFactory) public inline fun , R> A.ndGroup( noinline bufferFactory: BufferFactory, vararg shape: Int, - action: BufferedNDGroup.() -> R, + action: BufferedGroupND.() -> R, ): R { contract { callsInPlace(action, InvocationKind.EXACTLY_ONCE) } - return NDAlgebra.group(this, bufferFactory, *shape).run(action) + return AlgebraND.group(this, bufferFactory, *shape).run(action) } //ring factories -public fun > NDAlgebra.Companion.ring( +public fun > AlgebraND.Companion.ring( ring: A, bufferFactory: BufferFactory, vararg shape: Int, -): BufferedNDRing = BufferedNDRing(shape, ring, bufferFactory) +): BufferedRingND = BufferedRingND(shape, ring, bufferFactory) public inline fun , R> A.ndRing( noinline bufferFactory: BufferFactory, vararg shape: Int, - action: BufferedNDRing.() -> R, + action: BufferedRingND.() -> R, ): R { contract { callsInPlace(action, InvocationKind.EXACTLY_ONCE) } - return NDAlgebra.ring(this, bufferFactory, *shape).run(action) + return AlgebraND.ring(this, bufferFactory, *shape).run(action) } //field factories -public fun > NDAlgebra.Companion.field( +public fun > AlgebraND.Companion.field( field: A, bufferFactory: BufferFactory, vararg shape: Int, -): BufferedNDField = BufferedNDField(shape, field, bufferFactory) +): BufferedFieldND = BufferedFieldND(shape, field, bufferFactory) @Suppress("UNCHECKED_CAST") -public inline fun > NDAlgebra.Companion.auto( +public inline fun > AlgebraND.Companion.auto( field: A, vararg shape: Int, -): NDField = when (field) { - RealField -> RealNDField(shape) as NDField - else -> BufferedNDField(shape, field, Buffer.Companion::auto) +): FieldND = when (field) { + RealField -> RealFieldND(shape) as FieldND + else -> BufferedFieldND(shape, field, Buffer.Companion::auto) } public inline fun , R> A.ndField( noinline bufferFactory: BufferFactory, vararg shape: Int, - action: BufferedNDField.() -> R, + action: BufferedFieldND.() -> R, ): R { contract { callsInPlace(action, InvocationKind.EXACTLY_ONCE) } - return NDAlgebra.field(this, bufferFactory, *shape).run(action) + return AlgebraND.field(this, bufferFactory, *shape).run(action) } \ No newline at end of file diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/RealNDField.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/RealFieldND.kt similarity index 61% rename from kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/RealNDField.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/RealFieldND.kt index 9f1f14af1..643eb2eb0 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/RealNDField.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/RealFieldND.kt @@ -10,12 +10,12 @@ import kotlin.contracts.InvocationKind import kotlin.contracts.contract @OptIn(UnstableKMathAPI::class) -public class RealNDField( +public class RealFieldND( shape: IntArray, -) : BufferedNDField(shape, RealField, ::RealBuffer), - NumbersAddOperations>, - ScaleOperations>, - ExtendedField> { +) : BufferedFieldND(shape, RealField, ::RealBuffer), + NumbersAddOperations>, + ScaleOperations>, + ExtendedField> { override val zero: NDBuffer by lazy { produce { zero } } override val one: NDBuffer by lazy { produce { one } } @@ -25,18 +25,18 @@ public class RealNDField( return produce { d } } - override val NDStructure.buffer: RealBuffer + override val StructureND.buffer: RealBuffer get() = when { - !shape.contentEquals(this@RealNDField.shape) -> throw ShapeMismatchException( - this@RealNDField.shape, + !shape.contentEquals(this@RealFieldND.shape) -> throw ShapeMismatchException( + this@RealFieldND.shape, shape ) - this is NDBuffer && this.strides == this@RealNDField.strides -> this.buffer as RealBuffer + this is NDBuffer && this.strides == this@RealFieldND.strides -> this.buffer as RealBuffer else -> RealBuffer(strides.linearSize) { offset -> get(strides.index(offset)) } } @Suppress("OVERRIDE_BY_INLINE") - override inline fun NDStructure.map( + override inline fun StructureND.map( transform: RealField.(Double) -> Double, ): NDBuffer { val buffer = RealBuffer(strides.linearSize) { offset -> RealField.transform(buffer.array[offset]) } @@ -53,7 +53,7 @@ public class RealNDField( } @Suppress("OVERRIDE_BY_INLINE") - override inline fun NDStructure.mapIndexed( + override inline fun StructureND.mapIndexed( transform: RealField.(index: IntArray, Double) -> Double, ): NDBuffer = NDBuffer( strides, @@ -66,8 +66,8 @@ public class RealNDField( @Suppress("OVERRIDE_BY_INLINE") override inline fun combine( - a: NDStructure, - b: NDStructure, + a: StructureND, + b: StructureND, transform: RealField.(Double, Double) -> Double, ): NDBuffer { val buffer = RealBuffer(strides.linearSize) { offset -> @@ -76,35 +76,35 @@ public class RealNDField( return NDBuffer(strides, buffer) } - override fun scale(a: NDStructure, value: Double): NDStructure = a.map { it * value } + override fun scale(a: StructureND, value: Double): StructureND = a.map { it * value } - override fun power(arg: NDStructure, pow: Number): NDBuffer = arg.map { power(it, pow) } + override fun power(arg: StructureND, pow: Number): NDBuffer = arg.map { power(it, pow) } - override fun exp(arg: NDStructure): NDBuffer = arg.map { exp(it) } + override fun exp(arg: StructureND): NDBuffer = arg.map { exp(it) } - override fun ln(arg: NDStructure): NDBuffer = arg.map { ln(it) } + override fun ln(arg: StructureND): NDBuffer = arg.map { ln(it) } - override fun sin(arg: NDStructure): NDBuffer = arg.map { sin(it) } - override fun cos(arg: NDStructure): NDBuffer = arg.map { cos(it) } - override fun tan(arg: NDStructure): NDBuffer = arg.map { tan(it) } - override fun asin(arg: NDStructure): NDBuffer = arg.map { asin(it) } - override fun acos(arg: NDStructure): NDBuffer = arg.map { acos(it) } - override fun atan(arg: NDStructure): NDBuffer = arg.map { atan(it) } + override fun sin(arg: StructureND): NDBuffer = arg.map { sin(it) } + override fun cos(arg: StructureND): NDBuffer = arg.map { cos(it) } + override fun tan(arg: StructureND): NDBuffer = arg.map { tan(it) } + override fun asin(arg: StructureND): NDBuffer = arg.map { asin(it) } + override fun acos(arg: StructureND): NDBuffer = arg.map { acos(it) } + override fun atan(arg: StructureND): NDBuffer = arg.map { atan(it) } - override fun sinh(arg: NDStructure): NDBuffer = arg.map { sinh(it) } - override fun cosh(arg: NDStructure): NDBuffer = arg.map { cosh(it) } - override fun tanh(arg: NDStructure): NDBuffer = arg.map { tanh(it) } - override fun asinh(arg: NDStructure): NDBuffer = arg.map { asinh(it) } - override fun acosh(arg: NDStructure): NDBuffer = arg.map { acosh(it) } - override fun atanh(arg: NDStructure): NDBuffer = arg.map { atanh(it) } + override fun sinh(arg: StructureND): NDBuffer = arg.map { sinh(it) } + override fun cosh(arg: StructureND): NDBuffer = arg.map { cosh(it) } + override fun tanh(arg: StructureND): NDBuffer = arg.map { tanh(it) } + override fun asinh(arg: StructureND): NDBuffer = arg.map { asinh(it) } + override fun acosh(arg: StructureND): NDBuffer = arg.map { acosh(it) } + override fun atanh(arg: StructureND): NDBuffer = arg.map { atanh(it) } } -public fun NDAlgebra.Companion.real(vararg shape: Int): RealNDField = RealNDField(shape) +public fun AlgebraND.Companion.real(vararg shape: Int): RealFieldND = RealFieldND(shape) /** * Produce a context for n-dimensional operations inside this real field */ -public inline fun RealField.nd(vararg shape: Int, action: RealNDField.() -> R): R { +public inline fun RealField.nd(vararg shape: Int, action: RealFieldND.() -> R): R { contract { callsInPlace(action, InvocationKind.EXACTLY_ONCE) } - return RealNDField(shape).run(action) + return RealFieldND(shape).run(action) } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/ShortNDRing.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/ShortRingND.kt similarity index 80% rename from kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/ShortNDRing.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/ShortRingND.kt index 2085840a4..4e39dd544 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/ShortNDRing.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/ShortRingND.kt @@ -9,10 +9,10 @@ import kotlin.contracts.InvocationKind import kotlin.contracts.contract @OptIn(UnstableKMathAPI::class) -public class ShortNDRing( +public class ShortRingND( shape: IntArray, -) : BufferedNDRing(shape, ShortRing, Buffer.Companion::auto), - NumbersAddOperations> { +) : BufferedRingND(shape, ShortRing, Buffer.Companion::auto), + NumbersAddOperations> { override val zero: NDBuffer by lazy { produce { zero } } override val one: NDBuffer by lazy { produce { one } } @@ -26,11 +26,11 @@ public class ShortNDRing( /** * Fast element production using function inlining. */ -public inline fun BufferedNDRing.produceInline(crossinline initializer: ShortRing.(Int) -> Short): NDBuffer { +public inline fun BufferedRingND.produceInline(crossinline initializer: ShortRing.(Int) -> Short): NDBuffer { return NDBuffer(strides, ShortBuffer(ShortArray(strides.linearSize) { offset -> ShortRing.initializer(offset) })) } -public inline fun ShortRing.nd(vararg shape: Int, action: ShortNDRing.() -> R): R { +public inline fun ShortRing.nd(vararg shape: Int, action: ShortRingND.() -> R): R { contract { callsInPlace(action, InvocationKind.EXACTLY_ONCE) } - return ShortNDRing(shape).run(action) + return ShortRingND(shape).run(action) } \ No newline at end of file diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt index ac8714803..eba51a980 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt @@ -6,7 +6,7 @@ import space.kscience.kmath.structures.asSequence /** * A structure that is guaranteed to be one-dimensional */ -public interface Structure1D : NDStructure, Buffer { +public interface Structure1D : StructureND, Buffer { public override val dimension: Int get() = 1 public override operator fun get(index: IntArray): T { @@ -20,7 +20,7 @@ public interface Structure1D : NDStructure, Buffer { /** * A 1D wrapper for nd-structure */ -private inline class Structure1DWrapper(val structure: NDStructure) : Structure1D { +private inline class Structure1DWrapper(val structure: StructureND) : Structure1D { override val shape: IntArray get() = structure.shape override val size: Int get() = structure.shape[0] @@ -43,9 +43,9 @@ private inline class Buffer1DWrapper(val buffer: Buffer) : Structure1D } /** - * Represent a [NDStructure] as [Structure1D]. Throw error in case of dimension mismatch + * Represent a [StructureND] as [Structure1D]. Throw error in case of dimension mismatch */ -public fun NDStructure.as1D(): Structure1D = this as? Structure1D ?: if (shape.size == 1) { +public fun StructureND.as1D(): Structure1D = this as? Structure1D ?: if (shape.size == 1) { when (this) { is NDBuffer -> Buffer1DWrapper(this.buffer) else -> Structure1DWrapper(this) diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt index 60dedc933..1c3b0fec8 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt @@ -10,7 +10,7 @@ import kotlin.reflect.KClass * * @param T the type of items. */ -public interface Structure2D : NDStructure { +public interface Structure2D : StructureND { /** * The number of rows in this structure. */ @@ -60,7 +60,7 @@ public interface Structure2D : NDStructure { /** * A 2D wrapper for nd-structure */ -private class Structure2DWrapper(val structure: NDStructure) : Structure2D { +private class Structure2DWrapper(val structure: StructureND) : Structure2D { override val shape: IntArray get() = structure.shape override val rowNum: Int get() = shape[0] @@ -79,16 +79,16 @@ private class Structure2DWrapper(val structure: NDStructure) : Structure2D } /** - * Represent a [NDStructure] as [Structure1D]. Throw error in case of dimension mismatch + * Represent a [StructureND] as [Structure1D]. Throw error in case of dimension mismatch */ -public fun NDStructure.as2D(): Structure2D = this as? Structure2D ?: when (shape.size) { +public fun StructureND.as2D(): Structure2D = this as? Structure2D ?: when (shape.size) { 2 -> Structure2DWrapper(this) else -> error("Can't create 2d-structure from ${shape.size}d-structure") } /** - * Expose inner [NDStructure] if possible + * Expose inner [StructureND] if possible */ -internal fun Structure2D.unwrap(): NDStructure = +internal fun Structure2D.unwrap(): StructureND = if (this is Structure2DWrapper) structure else this \ No newline at end of file diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDStructure.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/StructureND.kt similarity index 92% rename from kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDStructure.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/StructureND.kt index d758f195d..54253ba9e 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/NDStructure.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/StructureND.kt @@ -16,7 +16,7 @@ import kotlin.reflect.KClass * * @param T the type of items. */ -public interface NDStructure { +public interface StructureND { /** * The shape of structure, i.e. non-empty sequence of non-negative integers that specify sizes of dimensions of * this structure. @@ -56,9 +56,9 @@ public interface NDStructure { public companion object { /** - * Indicates whether some [NDStructure] is equal to another one. + * Indicates whether some [StructureND] is equal to another one. */ - public fun contentEquals(st1: NDStructure<*>, st2: NDStructure<*>): Boolean { + public fun contentEquals(st1: StructureND<*>, st2: StructureND<*>): Boolean { if (st1 === st2) return true // fast comparison of buffers if possible @@ -126,15 +126,15 @@ public interface NDStructure { * @param index the indices. * @return the value. */ -public operator fun NDStructure.get(vararg index: Int): T = get(index) +public operator fun StructureND.get(vararg index: Int): T = get(index) @UnstableKMathAPI -public inline fun NDStructure<*>.getFeature(): T? = getFeature(T::class) +public inline fun StructureND<*>.getFeature(): T? = getFeature(T::class) /** - * Represents mutable [NDStructure]. + * Represents mutable [StructureND]. */ -public interface MutableNDStructure : NDStructure { +public interface MutableNDStructure : StructureND { /** * Inserts an item at the specified indices. * @@ -252,7 +252,7 @@ public class DefaultStrides private constructor(override val shape: IntArray) : } /** - * Represents [NDStructure] over [Buffer]. + * Represents [StructureND] over [Buffer]. * * @param T the type of items. * @param strides The strides to access elements of [Buffer] by linear indices. @@ -261,7 +261,7 @@ public class DefaultStrides private constructor(override val shape: IntArray) : public open class NDBuffer( public val strides: Strides, buffer: Buffer, -) : NDStructure { +) : StructureND { init { if (strides.linearSize != buffer.size) { @@ -280,7 +280,7 @@ public open class NDBuffer( } override fun equals(other: Any?): Boolean { - return NDStructure.contentEquals(this, other as? NDStructure<*> ?: return false) + return StructureND.contentEquals(this, other as? StructureND<*> ?: return false) } override fun hashCode(): Int { @@ -307,7 +307,7 @@ public open class NDBuffer( /** * Transform structure to a new structure using provided [BufferFactory] and optimizing if argument is [NDBuffer] */ -public inline fun NDStructure.mapToBuffer( +public inline fun StructureND.mapToBuffer( factory: BufferFactory = Buffer.Companion::auto, crossinline transform: (T) -> R, ): NDBuffer { @@ -338,10 +338,10 @@ public class MutableNDBuffer( override operator fun set(index: IntArray, value: T): Unit = buffer.set(strides.offset(index), value) } -public inline fun NDStructure.combine( - struct: NDStructure, +public inline fun StructureND.combine( + struct: StructureND, crossinline block: (T, T) -> T, -): NDStructure { +): StructureND { require(shape.contentEquals(struct.shape)) { "Shape mismatch in structure combination" } - return NDStructure.auto(shape) { block(this[it], struct[it]) } + return StructureND.auto(shape) { block(this[it], struct[it]) } } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/BigInt.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/BigInt.kt index 7e6a2eb81..55bb68850 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/BigInt.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/BigInt.kt @@ -1,8 +1,8 @@ package space.kscience.kmath.operations import space.kscience.kmath.misc.UnstableKMathAPI -import space.kscience.kmath.nd.BufferedNDRing -import space.kscience.kmath.nd.NDAlgebra +import space.kscience.kmath.nd.AlgebraND +import space.kscience.kmath.nd.BufferedRingND import space.kscience.kmath.operations.BigInt.Companion.BASE import space.kscience.kmath.operations.BigInt.Companion.BASE_SIZE import space.kscience.kmath.structures.Buffer @@ -464,5 +464,5 @@ public inline fun Buffer.Companion.bigInt(size: Int, initializer: (Int) -> BigIn public inline fun MutableBuffer.Companion.bigInt(size: Int, initializer: (Int) -> BigInt): MutableBuffer = boxing(size, initializer) -public fun NDAlgebra.Companion.bigInt(vararg shape: Int): BufferedNDRing = - BufferedNDRing(shape, BigIntField, Buffer.Companion::bigInt) +public fun AlgebraND.Companion.bigInt(vararg shape: Int): BufferedRingND = + BufferedRingND(shape, BigIntField, Buffer.Companion::bigInt) diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/BufferAccessor2D.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/BufferAccessor2D.kt index c65af7a98..6666c88b4 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/BufferAccessor2D.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/BufferAccessor2D.kt @@ -1,8 +1,8 @@ package space.kscience.kmath.structures import space.kscience.kmath.nd.DefaultStrides -import space.kscience.kmath.nd.NDStructure import space.kscience.kmath.nd.Structure2D +import space.kscience.kmath.nd.StructureND import space.kscience.kmath.nd.as2D /** @@ -25,7 +25,7 @@ internal class BufferAccessor2D( public fun create(mat: Structure2D): MutableBuffer = create { i, j -> mat[i, j] } //TODO optimize wrapper - public fun MutableBuffer.collect(): Structure2D = NDStructure.buffered( + public fun MutableBuffer.collect(): Structure2D = StructureND.buffered( DefaultStrides(intArrayOf(rowNum, colNum)), factory ) { (i, j) -> diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt index 097703f49..a8a2f2586 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt @@ -1,7 +1,7 @@ package space.kscience.kmath.linear import space.kscience.kmath.misc.UnstableKMathAPI -import space.kscience.kmath.nd.NDStructure +import space.kscience.kmath.nd.StructureND import space.kscience.kmath.nd.as2D import kotlin.test.Test import kotlin.test.assertEquals @@ -50,8 +50,8 @@ class MatrixTest { @Test fun test2DDot() { - val firstMatrix = NDStructure.auto(2, 3) { (i, j) -> (i + j).toDouble() }.as2D() - val secondMatrix = NDStructure.auto(3, 2) { (i, j) -> (i + j).toDouble() }.as2D() + val firstMatrix = StructureND.auto(2, 3) { (i, j) -> (i + j).toDouble() }.as2D() + val secondMatrix = StructureND.auto(3, 2) { (i, j) -> (i + j).toDouble() }.as2D() LinearSpace.real.run { // val firstMatrix = produce(2, 3) { i, j -> (i + j).toDouble() } diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/structures/NDFieldTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/structures/NDFieldTest.kt index 3c84d7b4b..b282ee9f5 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/structures/NDFieldTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/structures/NDFieldTest.kt @@ -1,6 +1,6 @@ package space.kscience.kmath.structures -import space.kscience.kmath.nd.NDAlgebra +import space.kscience.kmath.nd.AlgebraND import space.kscience.kmath.nd.get import space.kscience.kmath.nd.real import space.kscience.kmath.operations.invoke @@ -11,12 +11,12 @@ import kotlin.test.assertEquals internal class NDFieldTest { @Test fun verify() { - (NDAlgebra.real(12, 32)) { FieldVerifier(this, one + 3, one - 23, one * 12, 6.66) } + (AlgebraND.real(12, 32)) { FieldVerifier(this, one + 3, one - 23, one * 12, 6.66) } } @Test fun testStrides() { - val ndArray = NDAlgebra.real(10, 10).produce { (it[0] + it[1]).toDouble() } + val ndArray = AlgebraND.real(10, 10).produce { (it[0] + it[1]).toDouble() } assertEquals(ndArray[5, 5], 10.0) } } diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/structures/NumberNDFieldTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/structures/NumberNDFieldTest.kt index e9e6e92fb..fb67f0308 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/structures/NumberNDFieldTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/structures/NumberNDFieldTest.kt @@ -11,7 +11,7 @@ import kotlin.test.assertEquals @Suppress("UNUSED_VARIABLE") class NumberNDFieldTest { - val algebra = NDAlgebra.real(3, 3) + val algebra = AlgebraND.real(3, 3) val array1 = algebra.produce { (i, j) -> (i + j).toDouble() } val array2 = algebra.produce { (i, j) -> (i - j).toDouble() } @@ -69,15 +69,15 @@ class NumberNDFieldTest { val division = array1.combine(array2, Double::div) } - object L2Norm : Norm, Double> { - override fun norm(arg: NDStructure): Double = + object L2Norm : Norm, Double> { + override fun norm(arg: StructureND): Double = kotlin.math.sqrt(arg.elements().sumByDouble { it.second.toDouble() }) } @Test fun testInternalContext() { algebra { - (NDAlgebra.real(*array1.shape)) { with(L2Norm) { 1 + norm(array1) + exp(array2) } } + (AlgebraND.real(*array1.shape)) { with(L2Norm) { 1 + norm(array1) + exp(array2) } } } } } diff --git a/kmath-coroutines/build.gradle.kts b/kmath-coroutines/build.gradle.kts index 4a9ca5244..b68dd2e8d 100644 --- a/kmath-coroutines/build.gradle.kts +++ b/kmath-coroutines/build.gradle.kts @@ -18,6 +18,6 @@ kotlin.sourceSets { } } -readme{ +readme { maturity = ru.mipt.npm.gradle.Maturity.EXPERIMENTAL } \ No newline at end of file diff --git a/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/Chain.kt b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/Chain.kt index 5375113fe..26d078fcb 100644 --- a/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/Chain.kt +++ b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/Chain.kt @@ -83,7 +83,7 @@ public class StatefulChain( private val state: S, private val seed: S.() -> R, private val forkState: ((S) -> S), - private val gen: suspend S.(R) -> R + private val gen: suspend S.(R) -> R, ) : Chain { private val mutex: Mutex = Mutex() private var value: R? = null @@ -145,7 +145,7 @@ public fun Chain.collect(mapper: suspend (Chain) -> R): Chain = public fun Chain.collectWithState( state: S, stateFork: (S) -> S, - mapper: suspend S.(Chain) -> R + mapper: suspend S.(Chain) -> R, ): Chain = object : Chain { override suspend fun next(): R = state.mapper(this@collectWithState) diff --git a/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/coroutines/coroutinesExtra.kt b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/coroutines/coroutinesExtra.kt index 6578af0e9..7a3a52657 100644 --- a/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/coroutines/coroutinesExtra.kt +++ b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/coroutines/coroutinesExtra.kt @@ -27,7 +27,7 @@ public class AsyncFlow internal constructor(internal val deferredFlow: Flow Flow.async( dispatcher: CoroutineDispatcher = Dispatchers.Default, - block: suspend CoroutineScope.(T) -> R + block: suspend CoroutineScope.(T) -> R, ): AsyncFlow { val flow = map { LazyDeferred(dispatcher) { block(it) } } return AsyncFlow(flow) @@ -72,12 +72,12 @@ public suspend fun AsyncFlow.collect(concurrency: Int, collector: FlowCol public suspend inline fun AsyncFlow.collect( concurrency: Int, - crossinline action: suspend (value: T) -> Unit + crossinline action: suspend (value: T) -> Unit, ): Unit = collect(concurrency, object : FlowCollector { override suspend fun emit(value: T): Unit = action(value) }) public inline fun Flow.mapParallel( dispatcher: CoroutineDispatcher = Dispatchers.Default, - crossinline transform: suspend (T) -> R + crossinline transform: suspend (T) -> R, ): Flow = flatMapMerge { value -> flow { emit(transform(value)) } }.flowOn(dispatcher) diff --git a/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/streaming/RingBuffer.kt b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/streaming/RingBuffer.kt index efed41112..f81ad2f0d 100644 --- a/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/streaming/RingBuffer.kt +++ b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/streaming/RingBuffer.kt @@ -13,7 +13,7 @@ import space.kscience.kmath.structures.VirtualBuffer public class RingBuffer( private val buffer: MutableBuffer, private var startIndex: Int = 0, - size: Int = 0 + size: Int = 0, ) : Buffer { private val mutex: Mutex = Mutex() diff --git a/kmath-coroutines/src/jvmMain/kotlin/space/kscience/kmath/structures/LazyNDStructure.kt b/kmath-coroutines/src/jvmMain/kotlin/space/kscience/kmath/structures/LazyStructureND.kt similarity index 62% rename from kmath-coroutines/src/jvmMain/kotlin/space/kscience/kmath/structures/LazyNDStructure.kt rename to kmath-coroutines/src/jvmMain/kotlin/space/kscience/kmath/structures/LazyStructureND.kt index 51a79f44a..468b90561 100644 --- a/kmath-coroutines/src/jvmMain/kotlin/space/kscience/kmath/structures/LazyNDStructure.kt +++ b/kmath-coroutines/src/jvmMain/kotlin/space/kscience/kmath/structures/LazyStructureND.kt @@ -3,13 +3,13 @@ package space.kscience.kmath.structures import kotlinx.coroutines.* import space.kscience.kmath.coroutines.Math import space.kscience.kmath.nd.DefaultStrides -import space.kscience.kmath.nd.NDStructure +import space.kscience.kmath.nd.StructureND -public class LazyNDStructure( +public class LazyStructureND( public val scope: CoroutineScope, public override val shape: IntArray, - public val function: suspend (IntArray) -> T -) : NDStructure { + public val function: suspend (IntArray) -> T, +) : StructureND { private val cache: MutableMap> = hashMapOf() public fun deferred(index: IntArray): Deferred = cache.getOrPut(index) { @@ -26,7 +26,7 @@ public class LazyNDStructure( } public override fun equals(other: Any?): Boolean { - return NDStructure.contentEquals(this, other as? NDStructure<*> ?: return false) + return StructureND.contentEquals(this, other as? StructureND<*> ?: return false) } public override fun hashCode(): Int { @@ -38,21 +38,21 @@ public class LazyNDStructure( } } -public fun NDStructure.deferred(index: IntArray): Deferred = - if (this is LazyNDStructure) deferred(index) else CompletableDeferred(get(index)) +public fun StructureND.deferred(index: IntArray): Deferred = + if (this is LazyStructureND) deferred(index) else CompletableDeferred(get(index)) -public suspend fun NDStructure.await(index: IntArray): T = - if (this is LazyNDStructure) await(index) else get(index) +public suspend fun StructureND.await(index: IntArray): T = + if (this is LazyStructureND) await(index) else get(index) /** * PENDING would benefit from KEEP-176 */ -public inline fun NDStructure.mapAsyncIndexed( +public inline fun StructureND.mapAsyncIndexed( scope: CoroutineScope, - crossinline function: suspend (T, index: IntArray) -> R -): LazyNDStructure = LazyNDStructure(scope, shape) { index -> function(get(index), index) } + crossinline function: suspend (T, index: IntArray) -> R, +): LazyStructureND = LazyStructureND(scope, shape) { index -> function(get(index), index) } -public inline fun NDStructure.mapAsync( +public inline fun StructureND.mapAsync( scope: CoroutineScope, - crossinline function: suspend (T) -> R -): LazyNDStructure = LazyNDStructure(scope, shape) { index -> function(get(index)) } + crossinline function: suspend (T) -> R, +): LazyStructureND = LazyStructureND(scope, shape) { index -> function(get(index)) } diff --git a/kmath-dimensions/build.gradle.kts b/kmath-dimensions/build.gradle.kts index 3355eda42..3c73f34e6 100644 --- a/kmath-dimensions/build.gradle.kts +++ b/kmath-dimensions/build.gradle.kts @@ -19,6 +19,6 @@ kotlin.sourceSets { } } -readme{ +readme { maturity = ru.mipt.npm.gradle.Maturity.PROTOTYPE } diff --git a/kmath-dimensions/src/commonMain/kotlin/space/kscience/kmath/dimensions/Wrappers.kt b/kmath-dimensions/src/commonMain/kotlin/space/kscience/kmath/dimensions/Wrappers.kt index f7e14b29f..81b008b6a 100644 --- a/kmath-dimensions/src/commonMain/kotlin/space/kscience/kmath/dimensions/Wrappers.kt +++ b/kmath-dimensions/src/commonMain/kotlin/space/kscience/kmath/dimensions/Wrappers.kt @@ -1,6 +1,9 @@ package space.kscience.kmath.dimensions -import space.kscience.kmath.linear.* +import space.kscience.kmath.linear.LinearSpace +import space.kscience.kmath.linear.Matrix +import space.kscience.kmath.linear.Point +import space.kscience.kmath.linear.transpose import space.kscience.kmath.nd.Structure2D import space.kscience.kmath.operations.RealField import space.kscience.kmath.operations.Ring @@ -95,7 +98,7 @@ public inline class DMatrixContext>(public val context: * Produce a matrix with this context and given dimensions */ public inline fun produce( - noinline initializer: A.(i: Int, j: Int) -> T + noinline initializer: A.(i: Int, j: Int) -> T, ): DMatrix { val rows = Dimension.dim() val cols = Dimension.dim() @@ -147,9 +150,10 @@ public inline class DMatrixContext>(public val context: /** * A square unit matrix */ -public inline fun DMatrixContext.one(): DMatrix = produce { i, j -> - if (i == j) 1.0 else 0.0 -} +public inline fun DMatrixContext.one(): DMatrix = + produce { i, j -> + if (i == j) 1.0 else 0.0 + } public inline fun DMatrixContext.zero(): DMatrix = produce { _, _ -> diff --git a/kmath-ejml/build.gradle.kts b/kmath-ejml/build.gradle.kts index 07f95b13f..1ce2291c4 100644 --- a/kmath-ejml/build.gradle.kts +++ b/kmath-ejml/build.gradle.kts @@ -7,6 +7,6 @@ dependencies { implementation(project(":kmath-core")) } -readme{ +readme { maturity = ru.mipt.npm.gradle.Maturity.PROTOTYPE } \ No newline at end of file diff --git a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt index 5f93af729..c79493411 100644 --- a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt +++ b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt @@ -2,7 +2,7 @@ package space.kscience.kmath.ejml import org.ejml.simple.SimpleMatrix import space.kscience.kmath.linear.Matrix -import space.kscience.kmath.nd.NDStructure +import space.kscience.kmath.nd.StructureND /** * Represents featured matrix over EJML [SimpleMatrix]. @@ -18,8 +18,8 @@ public class EjmlMatrix(public val origin: SimpleMatrix) : Matrix { override fun equals(other: Any?): Boolean { if (this === other) return true - if (other !is NDStructure<*>) return false - return NDStructure.contentEquals(this, other) + if (other !is StructureND<*>) return false + return StructureND.contentEquals(this, other) } override fun hashCode(): Int = origin.hashCode() diff --git a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/dot.kt b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/dot.kt index 0bc5c111b..d5f093d63 100644 --- a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/dot.kt +++ b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/dot.kt @@ -7,6 +7,6 @@ import space.kscience.kmath.linear.Matrix /** * Optimized dot product for real matrices */ -public infix fun Matrix.dot(other: Matrix): Matrix = LinearSpace.real.run{ +public infix fun Matrix.dot(other: Matrix): Matrix = LinearSpace.real.run { this@dot dot other } \ No newline at end of file diff --git a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/GridTest.kt b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/GridTest.kt index c538a2d99..5a644c8f9 100644 --- a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/GridTest.kt +++ b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/GridTest.kt @@ -6,7 +6,7 @@ import kotlin.test.assertEquals class GridTest { @Test - fun testStepGrid(){ + fun testStepGrid() { val grid = 0.0..1.0 step 0.2 assertEquals(6, grid.size) } diff --git a/kmath-functions/build.gradle.kts b/kmath-functions/build.gradle.kts index fc52c4981..067dbd9b3 100644 --- a/kmath-functions/build.gradle.kts +++ b/kmath-functions/build.gradle.kts @@ -15,6 +15,10 @@ readme { feature("piecewise", "src/commonMain/kotlin/kscience/kmath/functions/Piecewise.kt", "Piecewise functions.") feature("polynomials", "src/commonMain/kotlin/kscience/kmath/functions/Polynomial.kt", "Polynomial functions.") - feature("linear interpolation", "src/commonMain/kotlin/kscience/kmath/interpolation/LinearInterpolator.kt", "Linear XY interpolator.") - feature("spline interpolation", "src/commonMain/kotlin/kscience/kmath/interpolation/SplineInterpolator.kt", "Cubic spline XY interpolator.") + feature("linear interpolation", + "src/commonMain/kotlin/kscience/kmath/interpolation/LinearInterpolator.kt", + "Linear XY interpolator.") + feature("spline interpolation", + "src/commonMain/kotlin/kscience/kmath/interpolation/SplineInterpolator.kt", + "Cubic spline XY interpolator.") } \ No newline at end of file diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrand.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrand.kt index ae964b271..336a3ef3a 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrand.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrand.kt @@ -17,6 +17,7 @@ public class IntegrandRelativeAccuracy(public val accuracy: Double) : IntegrandF public class IntegrandAbsoluteAccuracy(public val accuracy: Double) : IntegrandFeature public class IntegrandCalls(public val calls: Int) : IntegrandFeature + public val Integrand.calls: Int get() = getFeature()?.calls ?: 0 public class IntegrandMaxCalls(public val maxCalls: Int) : IntegrandFeature diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrator.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrator.kt index 7027e62c7..ebc53ad2e 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrator.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrator.kt @@ -3,7 +3,7 @@ package space.kscience.kmath.integration /** * A general interface for all integrators */ -public interface Integrator { +public interface Integrator { /** * Run one integration pass and return a new [Integrand] with a new set of features */ diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/Interpolator.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/Interpolator.kt index dc5227f8b..fa978a9bc 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/Interpolator.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/Interpolator.kt @@ -24,21 +24,21 @@ public interface PolynomialInterpolator> : Interpolator public fun > PolynomialInterpolator.interpolatePolynomials( x: Buffer, - y: Buffer + y: Buffer, ): PiecewisePolynomial { val pointSet = BufferXYPointSet(x, y) return interpolatePolynomials(pointSet) } public fun > PolynomialInterpolator.interpolatePolynomials( - data: Map + data: Map, ): PiecewisePolynomial { val pointSet = BufferXYPointSet(data.keys.toList().asBuffer(), data.values.toList().asBuffer()) return interpolatePolynomials(pointSet) } public fun > PolynomialInterpolator.interpolatePolynomials( - data: List> + data: List>, ): PiecewisePolynomial { val pointSet = BufferXYPointSet(data.map { it.first }.asBuffer(), data.map { it.second }.asBuffer()) return interpolatePolynomials(pointSet) diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/XYPointSet.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/XYPointSet.kt index c3bcad846..1ff7b6351 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/XYPointSet.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/XYPointSet.kt @@ -32,7 +32,7 @@ public class NDStructureColumn(public val structure: Structure2D, public v public class BufferXYPointSet( public override val x: Buffer, - public override val y: Buffer + public override val y: Buffer, ) : XYPointSet { public override val size: Int get() = x.size diff --git a/kmath-geometry/build.gradle.kts b/kmath-geometry/build.gradle.kts index e99eee38b..9d1b2d4d6 100644 --- a/kmath-geometry/build.gradle.kts +++ b/kmath-geometry/build.gradle.kts @@ -6,6 +6,6 @@ kotlin.sourceSets.commonMain { } } -readme{ +readme { maturity = ru.mipt.npm.gradle.Maturity.PROTOTYPE } diff --git a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counter.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counter.kt index d5f3965d9..ca0eba52f 100644 --- a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counter.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counter.kt @@ -11,7 +11,8 @@ import space.kscience.kmath.operations.RealField public interface Counter { public fun add(delta: T) public val value: T - public companion object{ + + public companion object { public fun real(): ObjectCounter = ObjectCounter(RealField) } } diff --git a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Histogram.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Histogram.kt index 9ee4a6e1e..ed76c7aa1 100644 --- a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Histogram.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Histogram.kt @@ -29,7 +29,7 @@ public interface Histogram> { public val bins: Iterable } -public fun interface HistogramBuilder { +public fun interface HistogramBuilder { /** * Increment appropriate bin diff --git a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/IndexedHistogramSpace.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/IndexedHistogramSpace.kt index 19128b2ac..f55080b09 100644 --- a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/IndexedHistogramSpace.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/IndexedHistogramSpace.kt @@ -3,9 +3,9 @@ package space.kscience.kmath.histogram import space.kscience.kmath.domains.Domain import space.kscience.kmath.linear.Point import space.kscience.kmath.misc.UnstableKMathAPI -import space.kscience.kmath.nd.NDField -import space.kscience.kmath.nd.NDStructure +import space.kscience.kmath.nd.FieldND import space.kscience.kmath.nd.Strides +import space.kscience.kmath.nd.StructureND import space.kscience.kmath.operations.Group import space.kscience.kmath.operations.ScaleOperations import space.kscience.kmath.operations.SpaceElement @@ -22,7 +22,7 @@ public data class DomainBin>( @OptIn(UnstableKMathAPI::class) public class IndexedHistogram, V : Any>( override val context: IndexedHistogramSpace, - public val values: NDStructure, + public val values: StructureND, ) : Histogram>, SpaceElement, IndexedHistogramSpace> { override fun get(point: Point): Bin? { @@ -46,7 +46,7 @@ public interface IndexedHistogramSpace, V : Any> : Group>, ScaleOperations> { //public val valueSpace: Space public val strides: Strides - public val histogramValueSpace: NDField //= NDAlgebra.space(valueSpace, Buffer.Companion::boxing, *shape), + public val histogramValueSpace: FieldND //= NDAlgebra.space(valueSpace, Buffer.Companion::boxing, *shape), /** * Resolve index of the bin including given [point] diff --git a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/RealHistogramSpace.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/RealHistogramSpace.kt index 3df0b1626..1407470c1 100644 --- a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/RealHistogramSpace.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/RealHistogramSpace.kt @@ -23,13 +23,13 @@ public class RealHistogramSpace( public val dimension: Int get() = lower.size private val shape = IntArray(binNums.size) { binNums[it] + 2 } - override val histogramValueSpace: RealNDField = NDAlgebra.real(*shape) + override val histogramValueSpace: RealFieldND = AlgebraND.real(*shape) override val strides: Strides get() = histogramValueSpace.strides private val binSize = RealBuffer(dimension) { (upper[it] - lower[it]) / binNums[it] } /** - * Get internal [NDStructure] bin index for given axis + * Get internal [StructureND] bin index for given axis */ private fun getIndex(axis: Int, value: Double): Int = when { value >= upper[axis] -> binNums[axis] + 1 // overflow @@ -69,7 +69,7 @@ public class RealHistogramSpace( } override fun produce(builder: HistogramBuilder.() -> Unit): IndexedHistogram { - val ndCounter = NDStructure.auto(strides) { Counter.real() } + val ndCounter = StructureND.auto(strides) { Counter.real() } val hBuilder = HistogramBuilder { point, value -> val index = getIndex(point) ndCounter[index].add(value.toDouble()) diff --git a/kmath-histograms/src/commonTest/kotlin/space/kscience/kmath/histogram/MultivariateHistogramTest.kt b/kmath-histograms/src/commonTest/kotlin/space/kscience/kmath/histogram/MultivariateHistogramTest.kt index e83f42b4b..fc00c6cdf 100644 --- a/kmath-histograms/src/commonTest/kotlin/space/kscience/kmath/histogram/MultivariateHistogramTest.kt +++ b/kmath-histograms/src/commonTest/kotlin/space/kscience/kmath/histogram/MultivariateHistogramTest.kt @@ -44,7 +44,7 @@ internal class MultivariateHistogramTest { @Test fun testHistogramAlgebra() { - RealHistogramSpace.fromRanges( + RealHistogramSpace.fromRanges( (-1.0..1.0), (-1.0..1.0), (-1.0..1.0) diff --git a/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogram.kt b/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogram.kt index 03bd096d9..b1b2a10c2 100644 --- a/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogram.kt +++ b/kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogram.kt @@ -9,7 +9,8 @@ import space.kscience.kmath.structures.asSequence @UnstableKMathAPI -public val UnivariateDomain.center: Double get() = (range.endInclusive - range.start) / 2 +public val UnivariateDomain.center: Double + get() = (range.endInclusive - range.start) / 2 /** * A univariate bin based an a range diff --git a/kmath-kotlingrad/build.gradle.kts b/kmath-kotlingrad/build.gradle.kts index 51292cbfb..a7c0c7e01 100644 --- a/kmath-kotlingrad/build.gradle.kts +++ b/kmath-kotlingrad/build.gradle.kts @@ -8,6 +8,6 @@ dependencies { api(project(":kmath-ast")) } -readme{ +readme { maturity = ru.mipt.npm.gradle.Maturity.PROTOTYPE } \ No newline at end of file diff --git a/kmath-memory/build.gradle.kts b/kmath-memory/build.gradle.kts index dbd68b042..1ccd1bed8 100644 --- a/kmath-memory/build.gradle.kts +++ b/kmath-memory/build.gradle.kts @@ -3,7 +3,7 @@ plugins { id("ru.mipt.npm.gradle.native") } -readme{ +readme { description = """ An API and basic implementation for arranging objects in a continous memory block. """.trimIndent() diff --git a/kmath-memory/src/commonMain/kotlin/space/kscience/kmath/memory/MemorySpec.kt b/kmath-memory/src/commonMain/kotlin/space/kscience/kmath/memory/MemorySpec.kt index 7c68e3abb..5ed3c3c9e 100644 --- a/kmath-memory/src/commonMain/kotlin/space/kscience/kmath/memory/MemorySpec.kt +++ b/kmath-memory/src/commonMain/kotlin/space/kscience/kmath/memory/MemorySpec.kt @@ -32,7 +32,8 @@ public fun MemoryReader.read(spec: MemorySpec, offset: Int): T = wi /** * Writes the object [value] with [spec] starting from [offset]. */ -public fun MemoryWriter.write(spec: MemorySpec, offset: Int, value: T): Unit = with(spec) { write(offset, value) } +public fun MemoryWriter.write(spec: MemorySpec, offset: Int, value: T): Unit = + with(spec) { write(offset, value) } /** * Reads array of [size] objects mapped by [spec] at certain [offset]. diff --git a/kmath-memory/src/jvmMain/kotlin/space/kscience/kmath/memory/ByteBufferMemory.kt b/kmath-memory/src/jvmMain/kotlin/space/kscience/kmath/memory/ByteBufferMemory.kt index 5145b1ed4..fe15cce49 100644 --- a/kmath-memory/src/jvmMain/kotlin/space/kscience/kmath/memory/ByteBufferMemory.kt +++ b/kmath-memory/src/jvmMain/kotlin/space/kscience/kmath/memory/ByteBufferMemory.kt @@ -13,7 +13,7 @@ import kotlin.contracts.contract internal class ByteBufferMemory( val buffer: ByteBuffer, val startOffset: Int = 0, - override val size: Int = buffer.limit() + override val size: Int = buffer.limit(), ) : Memory { @Suppress("NOTHING_TO_INLINE") private inline fun position(o: Int): Int = startOffset + o @@ -100,7 +100,8 @@ public actual fun Memory.Companion.allocate(length: Int): Memory = * Wraps a [Memory] around existing [ByteArray]. This operation is unsafe since the array is not copied * and could be mutated independently from the resulting [Memory]. */ -public actual fun Memory.Companion.wrap(array: ByteArray): Memory = ByteBufferMemory(checkNotNull(ByteBuffer.wrap(array))) +public actual fun Memory.Companion.wrap(array: ByteArray): Memory = + ByteBufferMemory(checkNotNull(ByteBuffer.wrap(array))) /** * Wraps this [ByteBuffer] to [Memory] object. diff --git a/kmath-memory/src/nativeMain/kotlin/space/kscience/kmath/memory/NativeMemory.kt b/kmath-memory/src/nativeMain/kotlin/space/kscience/kmath/memory/NativeMemory.kt index 3afb6c7a2..1274959ad 100644 --- a/kmath-memory/src/nativeMain/kotlin/space/kscience/kmath/memory/NativeMemory.kt +++ b/kmath-memory/src/nativeMain/kotlin/space/kscience/kmath/memory/NativeMemory.kt @@ -4,7 +4,7 @@ package space.kscience.kmath.memory internal class NativeMemory( val array: ByteArray, val startOffset: Int = 0, - override val size: Int = array.size + override val size: Int = array.size, ) : Memory { @Suppress("NOTHING_TO_INLINE") private inline fun position(o: Int): Int = startOffset + o diff --git a/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt index d8ce1052a..bf73ec20f 100644 --- a/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt +++ b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt @@ -7,7 +7,7 @@ import space.kscience.kmath.nd.* import space.kscience.kmath.operations.* import space.kscience.kmath.structures.* -internal fun NDAlgebra<*, *>.checkShape(array: INDArray): INDArray { +internal fun AlgebraND<*, *>.checkShape(array: INDArray): INDArray { val arrayShape = array.shape().toIntArray() if (!shape.contentEquals(arrayShape)) throw ShapeMismatchException(shape, arrayShape) return array @@ -15,18 +15,18 @@ internal fun NDAlgebra<*, *>.checkShape(array: INDArray): INDArray { /** - * Represents [NDAlgebra] over [Nd4jArrayAlgebra]. + * Represents [AlgebraND] over [Nd4jArrayAlgebra]. * * @param T the type of ND-structure element. * @param C the type of the element context. */ -public interface Nd4jArrayAlgebra> : NDAlgebra { +public interface Nd4jArrayAlgebra> : AlgebraND { /** * Wraps [INDArray] to [N]. */ public fun INDArray.wrap(): Nd4jArrayStructure - public val NDStructure.ndArray: INDArray + public val StructureND.ndArray: INDArray get() = when { !shape.contentEquals(this@Nd4jArrayAlgebra.shape) -> throw ShapeMismatchException( this@Nd4jArrayAlgebra.shape, @@ -44,13 +44,13 @@ public interface Nd4jArrayAlgebra> : NDAlgebra { return struct } - public override fun NDStructure.map(transform: C.(T) -> T): Nd4jArrayStructure { + public override fun StructureND.map(transform: C.(T) -> T): Nd4jArrayStructure { val newStruct = ndArray.dup().wrap() newStruct.elements().forEach { (idx, value) -> newStruct[idx] = elementContext.transform(value) } return newStruct } - public override fun NDStructure.mapIndexed( + public override fun StructureND.mapIndexed( transform: C.(index: IntArray, T) -> T, ): Nd4jArrayStructure { val new = Nd4j.create(*this@Nd4jArrayAlgebra.shape).wrap() @@ -59,8 +59,8 @@ public interface Nd4jArrayAlgebra> : NDAlgebra { } public override fun combine( - a: NDStructure, - b: NDStructure, + a: StructureND, + b: StructureND, transform: C.(T, T) -> T, ): Nd4jArrayStructure { val new = Nd4j.create(*shape).wrap() @@ -70,42 +70,42 @@ public interface Nd4jArrayAlgebra> : NDAlgebra { } /** - * Represents [NDGroup] over [Nd4jArrayStructure]. + * Represents [GroupND] over [Nd4jArrayStructure]. * * @param T the type of the element contained in ND structure. * @param S the type of space of structure elements. */ -public interface Nd4JArrayGroup> : NDGroup, Nd4jArrayAlgebra { +public interface Nd4JArrayGroup> : GroupND, Nd4jArrayAlgebra { public override val zero: Nd4jArrayStructure get() = Nd4j.zeros(*shape).wrap() - public override fun add(a: NDStructure, b: NDStructure): Nd4jArrayStructure = + public override fun add(a: StructureND, b: StructureND): Nd4jArrayStructure = a.ndArray.add(b.ndArray).wrap() - public override operator fun NDStructure.minus(b: NDStructure): Nd4jArrayStructure = + public override operator fun StructureND.minus(b: StructureND): Nd4jArrayStructure = ndArray.sub(b.ndArray).wrap() - public override operator fun NDStructure.unaryMinus(): Nd4jArrayStructure = + public override operator fun StructureND.unaryMinus(): Nd4jArrayStructure = ndArray.neg().wrap() - public fun multiply(a: NDStructure, k: Number): Nd4jArrayStructure = + public fun multiply(a: StructureND, k: Number): Nd4jArrayStructure = a.ndArray.mul(k).wrap() } /** - * Represents [NDRing] over [Nd4jArrayStructure]. + * Represents [RingND] over [Nd4jArrayStructure]. * * @param T the type of the element contained in ND structure. * @param R the type of ring of structure elements. */ @OptIn(UnstableKMathAPI::class) -public interface Nd4jArrayRing> : NDRing, Nd4JArrayGroup { +public interface Nd4jArrayRing> : RingND, Nd4JArrayGroup { public override val one: Nd4jArrayStructure get() = Nd4j.ones(*shape).wrap() - public override fun multiply(a: NDStructure, b: NDStructure): Nd4jArrayStructure = + public override fun multiply(a: StructureND, b: StructureND): Nd4jArrayStructure = a.ndArray.mul(b.ndArray).wrap() // // public override operator fun Nd4jArrayStructure.minus(b: Number): Nd4jArrayStructure { @@ -131,19 +131,19 @@ public interface Nd4jArrayRing> : NDRing, Nd4JArrayGroup = intNd4jArrayRingCache.get().getOrPut(shape) { IntNd4jArrayRing(shape) } /** - * Creates an [NDRing] for [Long] values or pull it from cache if it was created previously. + * Creates an [RingND] for [Long] values or pull it from cache if it was created previously. */ public fun long(vararg shape: Int): Nd4jArrayRing = longNd4jArrayRingCache.get().getOrPut(shape) { LongNd4jArrayRing(shape) } /** - * Creates a most suitable implementation of [NDRing] using reified class. + * Creates a most suitable implementation of [RingND] using reified class. */ @Suppress("UNCHECKED_CAST") public inline fun auto(vararg shape: Int): Nd4jArrayRing> = when { @@ -155,18 +155,18 @@ public interface Nd4jArrayRing> : NDRing, Nd4JArrayGroup> : NDField, Nd4jArrayRing { +public interface Nd4jArrayField> : FieldND, Nd4jArrayRing { - public override fun divide(a: NDStructure, b: NDStructure): Nd4jArrayStructure = + public override fun divide(a: StructureND, b: StructureND): Nd4jArrayStructure = a.ndArray.div(b.ndArray).wrap() - public operator fun Number.div(b: NDStructure): Nd4jArrayStructure = b.ndArray.rdiv(this).wrap() + public operator fun Number.div(b: StructureND): Nd4jArrayStructure = b.ndArray.rdiv(this).wrap() public companion object { private val floatNd4jArrayFieldCache: ThreadLocal> = @@ -176,19 +176,19 @@ public interface Nd4jArrayField> : NDField, Nd4jArrayRing< ThreadLocal.withInitial { hashMapOf() } /** - * Creates an [NDField] for [Float] values or pull it from cache if it was created previously. + * Creates an [FieldND] for [Float] values or pull it from cache if it was created previously. */ public fun float(vararg shape: Int): Nd4jArrayRing = floatNd4jArrayFieldCache.get().getOrPut(shape) { FloatNd4jArrayField(shape) } /** - * Creates an [NDField] for [Double] values or pull it from cache if it was created previously. + * Creates an [FieldND] for [Double] values or pull it from cache if it was created previously. */ public fun real(vararg shape: Int): Nd4jArrayRing = realNd4jArrayFieldCache.get().getOrPut(shape) { RealNd4jArrayField(shape) } /** - * Creates a most suitable implementation of [NDRing] using reified class. + * Creates a most suitable implementation of [RingND] using reified class. */ @Suppress("UNCHECKED_CAST") public inline fun auto(vararg shape: Int): Nd4jArrayField> = when { @@ -200,44 +200,44 @@ public interface Nd4jArrayField> : NDField, Nd4jArrayRing< } /** - * Represents [NDField] over [Nd4jArrayRealStructure]. + * Represents [FieldND] over [Nd4jArrayRealStructure]. */ public class RealNd4jArrayField(public override val shape: IntArray) : Nd4jArrayField { public override val elementContext: RealField get() = RealField public override fun INDArray.wrap(): Nd4jArrayStructure = checkShape(this).asRealStructure() - override fun scale(a: NDStructure, value: Double): Nd4jArrayStructure { + override fun scale(a: StructureND, value: Double): Nd4jArrayStructure { return a.ndArray.mul(value).wrap() } - public override operator fun NDStructure.div(arg: Double): Nd4jArrayStructure { + public override operator fun StructureND.div(arg: Double): Nd4jArrayStructure { return ndArray.div(arg).wrap() } - public override operator fun NDStructure.plus(arg: Double): Nd4jArrayStructure { + public override operator fun StructureND.plus(arg: Double): Nd4jArrayStructure { return ndArray.add(arg).wrap() } - public override operator fun NDStructure.minus(arg: Double): Nd4jArrayStructure { + public override operator fun StructureND.minus(arg: Double): Nd4jArrayStructure { return ndArray.sub(arg).wrap() } - public override operator fun NDStructure.times(arg: Double): Nd4jArrayStructure { + public override operator fun StructureND.times(arg: Double): Nd4jArrayStructure { return ndArray.mul(arg).wrap() } - public override operator fun Double.div(arg: NDStructure): Nd4jArrayStructure { + public override operator fun Double.div(arg: StructureND): Nd4jArrayStructure { return arg.ndArray.rdiv(this).wrap() } - public override operator fun Double.minus(arg: NDStructure): Nd4jArrayStructure { + public override operator fun Double.minus(arg: StructureND): Nd4jArrayStructure { return arg.ndArray.rsub(this).wrap() } } /** - * Represents [NDField] over [Nd4jArrayStructure] of [Float]. + * Represents [FieldND] over [Nd4jArrayStructure] of [Float]. */ public class FloatNd4jArrayField(public override val shape: IntArray) : Nd4jArrayField { public override val elementContext: FloatField @@ -245,30 +245,30 @@ public class FloatNd4jArrayField(public override val shape: IntArray) : Nd4jArra public override fun INDArray.wrap(): Nd4jArrayStructure = checkShape(this).asFloatStructure() - override fun scale(a: NDStructure, value: Double): NDStructure = + override fun scale(a: StructureND, value: Double): StructureND = a.ndArray.mul(value).wrap() - public override operator fun NDStructure.div(arg: Float): Nd4jArrayStructure = + public override operator fun StructureND.div(arg: Float): Nd4jArrayStructure = ndArray.div(arg).wrap() - public override operator fun NDStructure.plus(arg: Float): Nd4jArrayStructure = + public override operator fun StructureND.plus(arg: Float): Nd4jArrayStructure = ndArray.add(arg).wrap() - public override operator fun NDStructure.minus(arg: Float): Nd4jArrayStructure = + public override operator fun StructureND.minus(arg: Float): Nd4jArrayStructure = ndArray.sub(arg).wrap() - public override operator fun NDStructure.times(arg: Float): Nd4jArrayStructure = + public override operator fun StructureND.times(arg: Float): Nd4jArrayStructure = ndArray.mul(arg).wrap() - public override operator fun Float.div(arg: NDStructure): Nd4jArrayStructure = + public override operator fun Float.div(arg: StructureND): Nd4jArrayStructure = arg.ndArray.rdiv(this).wrap() - public override operator fun Float.minus(arg: NDStructure): Nd4jArrayStructure = + public override operator fun Float.minus(arg: StructureND): Nd4jArrayStructure = arg.ndArray.rsub(this).wrap() } /** - * Represents [NDRing] over [Nd4jArrayIntStructure]. + * Represents [RingND] over [Nd4jArrayIntStructure]. */ public class IntNd4jArrayRing(public override val shape: IntArray) : Nd4jArrayRing { public override val elementContext: IntRing @@ -276,21 +276,21 @@ public class IntNd4jArrayRing(public override val shape: IntArray) : Nd4jArrayRi public override fun INDArray.wrap(): Nd4jArrayStructure = checkShape(this).asIntStructure() - public override operator fun NDStructure.plus(arg: Int): Nd4jArrayStructure = + public override operator fun StructureND.plus(arg: Int): Nd4jArrayStructure = ndArray.add(arg).wrap() - public override operator fun NDStructure.minus(arg: Int): Nd4jArrayStructure = + public override operator fun StructureND.minus(arg: Int): Nd4jArrayStructure = ndArray.sub(arg).wrap() - public override operator fun NDStructure.times(arg: Int): Nd4jArrayStructure = + public override operator fun StructureND.times(arg: Int): Nd4jArrayStructure = ndArray.mul(arg).wrap() - public override operator fun Int.minus(arg: NDStructure): Nd4jArrayStructure = + public override operator fun Int.minus(arg: StructureND): Nd4jArrayStructure = arg.ndArray.rsub(this).wrap() } /** - * Represents [NDRing] over [Nd4jArrayStructure] of [Long]. + * Represents [RingND] over [Nd4jArrayStructure] of [Long]. */ public class LongNd4jArrayRing(public override val shape: IntArray) : Nd4jArrayRing { public override val elementContext: LongRing @@ -298,15 +298,15 @@ public class LongNd4jArrayRing(public override val shape: IntArray) : Nd4jArrayR public override fun INDArray.wrap(): Nd4jArrayStructure = checkShape(this).asLongStructure() - public override operator fun NDStructure.plus(arg: Long): Nd4jArrayStructure = + public override operator fun StructureND.plus(arg: Long): Nd4jArrayStructure = ndArray.add(arg).wrap() - public override operator fun NDStructure.minus(arg: Long): Nd4jArrayStructure = + public override operator fun StructureND.minus(arg: Long): Nd4jArrayStructure = ndArray.sub(arg).wrap() - public override operator fun NDStructure.times(arg: Long): Nd4jArrayStructure = + public override operator fun StructureND.times(arg: Long): Nd4jArrayStructure = ndArray.mul(arg).wrap() - public override operator fun Long.minus(arg: NDStructure): Nd4jArrayStructure = + public override operator fun Long.minus(arg: StructureND): Nd4jArrayStructure = arg.ndArray.rsub(this).wrap() } diff --git a/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructure.kt b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructure.kt index 415c908a8..9b4cc1a24 100644 --- a/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructure.kt +++ b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructure.kt @@ -2,10 +2,10 @@ package space.kscience.kmath.nd4j import org.nd4j.linalg.api.ndarray.INDArray import space.kscience.kmath.nd.MutableNDStructure -import space.kscience.kmath.nd.NDStructure +import space.kscience.kmath.nd.StructureND /** - * Represents a [NDStructure] wrapping an [INDArray] object. + * Represents a [StructureND] wrapping an [INDArray] object. * * @param T the type of items. */ diff --git a/kmath-nd4j/src/test/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebraTest.kt b/kmath-nd4j/src/test/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebraTest.kt index 9a067aa29..6a8d8796c 100644 --- a/kmath-nd4j/src/test/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebraTest.kt +++ b/kmath-nd4j/src/test/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebraTest.kt @@ -8,7 +8,7 @@ import kotlin.test.fail internal class Nd4jArrayAlgebraTest { @Test fun testProduce() { - val res = with(RealNd4jArrayField(intArrayOf(2, 2))){ produce { it.sum().toDouble() } } + val res = with(RealNd4jArrayField(intArrayOf(2, 2))) { produce { it.sum().toDouble() } } val expected = (Nd4j.create(2, 2) ?: fail()).asRealStructure() expected[intArrayOf(0, 0)] = 0.0 expected[intArrayOf(0, 1)] = 1.0 diff --git a/kmath-nd4j/src/test/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructureTest.kt b/kmath-nd4j/src/test/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructureTest.kt index 03369127d..5cf6dd26f 100644 --- a/kmath-nd4j/src/test/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructureTest.kt +++ b/kmath-nd4j/src/test/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructureTest.kt @@ -41,9 +41,9 @@ internal class Nd4jArrayStructureTest { @Test fun testHashCode() { - val nd1 = Nd4j.create(doubleArrayOf(1.0, 2.0, 3.0))?:fail() + val nd1 = Nd4j.create(doubleArrayOf(1.0, 2.0, 3.0)) ?: fail() val struct1 = nd1.asRealStructure() - val nd2 = Nd4j.create(doubleArrayOf(1.0, 2.0, 3.0))?:fail() + val nd2 = Nd4j.create(doubleArrayOf(1.0, 2.0, 3.0)) ?: fail() val struct2 = nd2.asRealStructure() assertEquals(struct1.hashCode(), struct2.hashCode()) } @@ -57,7 +57,7 @@ internal class Nd4jArrayStructureTest { @Test fun testGet() { - val nd = Nd4j.rand(10, 2, 3, 6)?:fail() + val nd = Nd4j.rand(10, 2, 3, 6) ?: fail() val struct = nd.asIntStructure() assertEquals(nd.getInt(0, 0, 0, 0), struct[0, 0, 0, 0]) } diff --git a/kmath-stat/build.gradle.kts b/kmath-stat/build.gradle.kts index 67a96937c..5b29a9e64 100644 --- a/kmath-stat/build.gradle.kts +++ b/kmath-stat/build.gradle.kts @@ -25,6 +25,6 @@ kotlin.sourceSets { } } -readme{ +readme { maturity = ru.mipt.npm.gradle.Maturity.EXPERIMENTAL } \ No newline at end of file diff --git a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Distribution.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Distribution.kt index b5b6db1d8..dacf7a9cd 100644 --- a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Distribution.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Distribution.kt @@ -53,7 +53,7 @@ public fun > UnivariateDistribution.integral(from: T, to: T public fun Sampler.sampleBuffer( generator: RandomGenerator, size: Int, - bufferFactory: BufferFactory = Buffer.Companion::boxing + bufferFactory: BufferFactory = Buffer.Companion::boxing, ): Chain> { require(size > 1) //creating temporary storage once diff --git a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/OptimizationProblem.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/OptimizationProblem.kt index 71f3096de..ffa24fa98 100644 --- a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/OptimizationProblem.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/OptimizationProblem.kt @@ -68,7 +68,7 @@ public fun > Expression.optimizeWith( configuration: F.() -> Unit, ): OptimizationResult { require(symbols.isNotEmpty()) { "Must provide a list of symbols for optimization" } - val problem = factory(symbols.toList(),configuration) + val problem = factory(symbols.toList(), configuration) problem.expression(this) return problem.optimize() } @@ -76,7 +76,7 @@ public fun > Expression.optimizeWith( /** * Optimize differentiable expression using specific [OptimizationProblemFactory] */ -public fun > DifferentiableExpression>.optimizeWith( +public fun > DifferentiableExpression>.optimizeWith( factory: OptimizationProblemFactory, vararg symbols: Symbol, configuration: F.() -> Unit, diff --git a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/RandomChain.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/RandomChain.kt index 881eabdac..6e1f36c8a 100644 --- a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/RandomChain.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/RandomChain.kt @@ -7,7 +7,7 @@ import space.kscience.kmath.chains.Chain */ public class RandomChain( public val generator: RandomGenerator, - private val gen: suspend RandomGenerator.() -> R + private val gen: suspend RandomGenerator.() -> R, ) : Chain { override suspend fun next(): R = generator.gen() diff --git a/kmath-stat/src/jvmMain/kotlin/space/kscience/kmath/stat/distributions.kt b/kmath-stat/src/jvmMain/kotlin/space/kscience/kmath/stat/distributions.kt index d33b54818..1be436a4f 100644 --- a/kmath-stat/src/jvmMain/kotlin/space/kscience/kmath/stat/distributions.kt +++ b/kmath-stat/src/jvmMain/kotlin/space/kscience/kmath/stat/distributions.kt @@ -50,7 +50,7 @@ private fun normalSampler(method: NormalSamplerMethod, provider: UniformRandomPr } public fun Distribution.Companion.normal( - method: NormalSamplerMethod = NormalSamplerMethod.Ziggurat + method: NormalSamplerMethod = NormalSamplerMethod.Ziggurat, ): ContinuousSamplerDistribution = object : ContinuousSamplerDistribution() { override fun buildCMSampler(generator: RandomGenerator): ContinuousSampler { val provider = generator.asUniformRandomProvider() @@ -66,7 +66,7 @@ public fun Distribution.Companion.normal( public fun Distribution.Companion.normal( mean: Double, sigma: Double, - method: NormalSamplerMethod = NormalSamplerMethod.Ziggurat + method: NormalSamplerMethod = NormalSamplerMethod.Ziggurat, ): ContinuousSamplerDistribution = object : ContinuousSamplerDistribution() { private val sigma2 = sigma.pow(2) private val norm = sigma * sqrt(PI * 2) diff --git a/kmath-viktor/api/kmath-viktor.api b/kmath-viktor/api/kmath-viktor.api index ebb97b150..d48a9f9c8 100644 --- a/kmath-viktor/api/kmath-viktor.api +++ b/kmath-viktor/api/kmath-viktor.api @@ -26,130 +26,130 @@ public final class space/kscience/kmath/viktor/ViktorBuffer : space/kscience/kma public final synthetic fun unbox-impl ()Lorg/jetbrains/bio/viktor/F64FlatArray; } -public final class space/kscience/kmath/viktor/ViktorNDField : space/kscience/kmath/nd/NDField, space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/NumbersAddOperations, space/kscience/kmath/operations/ScaleOperations { +public final class space/kscience/kmath/viktor/ViktorFieldND : space/kscience/kmath/nd/FieldND, space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/NumbersAddOperations, space/kscience/kmath/operations/ScaleOperations { public fun ([I)V public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; - public fun acos-Q7Xurp0 (Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; + public fun acos-8UOKELU (Lspace/kscience/kmath/nd/StructureND;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun acosh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun acosh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public synthetic fun add (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public fun add-s8yP2C4 (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; + public synthetic fun add (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public fun add-zrEAbyI (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; - public fun asin-Q7Xurp0 (Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; + public fun asin-8UOKELU (Lspace/kscience/kmath/nd/StructureND;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun asinh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun asinh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; - public fun atan-Q7Xurp0 (Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; + public fun atan-8UOKELU (Lspace/kscience/kmath/nd/StructureND;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun atanh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun atanh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; - public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/nd/NDStructure; - public synthetic fun combine (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; - public fun combine-ZQYDhZg (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lorg/jetbrains/bio/viktor/F64Array; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/nd/StructureND; + public synthetic fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND; + public fun combine-WKhNzhk (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; - public fun cos-Q7Xurp0 (Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; + public fun cos-8UOKELU (Lspace/kscience/kmath/nd/StructureND;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun cosh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public fun div (DLspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun cosh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public fun div (DLspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public synthetic fun div (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public fun div (Lspace/kscience/kmath/nd/NDStructure;D)Lspace/kscience/kmath/nd/NDStructure; - public fun div (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; - public synthetic fun div (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; - public fun div (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public synthetic fun div (Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public fun div (Lspace/kscience/kmath/nd/StructureND;D)Lspace/kscience/kmath/nd/StructureND; + public fun div (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; + public synthetic fun div (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND; + public fun div (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun divide (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; - public fun exp-Q7Xurp0 (Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; + public fun exp-8UOKELU (Lspace/kscience/kmath/nd/StructureND;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun getElementContext ()Lspace/kscience/kmath/operations/Algebra; public fun getElementContext ()Lspace/kscience/kmath/operations/RealField; - public final fun getF64Buffer (Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; + public final fun getF64Buffer (Lspace/kscience/kmath/nd/StructureND;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne-MSOxzaI ()Lorg/jetbrains/bio/viktor/F64Array; + public fun getOne-6kW2wQc ()Lorg/jetbrains/bio/viktor/F64Array; public fun getShape ()[I public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero-MSOxzaI ()Lorg/jetbrains/bio/viktor/F64Array; - public fun invoke (Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun getZero-6kW2wQc ()Lorg/jetbrains/bio/viktor/F64Array; + public fun invoke (Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; - public fun ln-Q7Xurp0 (Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; - public synthetic fun map (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; - public fun map-s8yP2C4 (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function2;)Lorg/jetbrains/bio/viktor/F64Array; - public synthetic fun mapIndexed (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDStructure; - public fun mapIndexed-s8yP2C4 (Lspace/kscience/kmath/nd/NDStructure;Lkotlin/jvm/functions/Function3;)Lorg/jetbrains/bio/viktor/F64Array; - public fun minus (DLspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun ln-8UOKELU (Lspace/kscience/kmath/nd/StructureND;)Lorg/jetbrains/bio/viktor/F64Array; + public synthetic fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND; + public fun map-zrEAbyI (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lorg/jetbrains/bio/viktor/F64Array; + public synthetic fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND; + public fun mapIndexed-zrEAbyI (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lorg/jetbrains/bio/viktor/F64Array; + public fun minus (DLspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun minus (Ljava/lang/Number;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public synthetic fun minus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public fun minus (Lspace/kscience/kmath/nd/NDStructure;D)Lspace/kscience/kmath/nd/NDStructure; - public fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; - public synthetic fun minus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; - public fun minus-s8yP2C4 (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; + public synthetic fun minus (Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public fun minus (Lspace/kscience/kmath/nd/StructureND;D)Lspace/kscience/kmath/nd/StructureND; + public fun minus (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; + public synthetic fun minus (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND; + public fun minus-zrEAbyI (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun multiply (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number-Q7Xurp0 (Ljava/lang/Number;)Lorg/jetbrains/bio/viktor/F64Array; - public fun plus (DLspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun number-8UOKELU (Ljava/lang/Number;)Lorg/jetbrains/bio/viktor/F64Array; + public fun plus (DLspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun plus (Ljava/lang/Number;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public synthetic fun plus (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public fun plus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; - public synthetic fun plus (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; - public fun plus-s8yP2C4 (Lspace/kscience/kmath/nd/NDStructure;D)Lorg/jetbrains/bio/viktor/F64Array; - public fun plus-s8yP2C4 (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; + public synthetic fun plus (Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public fun plus (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; + public synthetic fun plus (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND; + public fun plus-zrEAbyI (Lspace/kscience/kmath/nd/StructureND;D)Lorg/jetbrains/bio/viktor/F64Array; + public fun plus-zrEAbyI (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun pow (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public fun pow (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun power-s8yP2C4 (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lorg/jetbrains/bio/viktor/F64Array; - public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDStructure; - public fun produce-Q7Xurp0 (Lkotlin/jvm/functions/Function2;)Lorg/jetbrains/bio/viktor/F64Array; + public fun power-zrEAbyI (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lorg/jetbrains/bio/viktor/F64Array; + public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND; + public fun produce-8UOKELU (Lkotlin/jvm/functions/Function2;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDStructure; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; - public fun scale-s8yP2C4 (Lspace/kscience/kmath/nd/NDStructure;D)Lorg/jetbrains/bio/viktor/F64Array; + public fun scale-zrEAbyI (Lspace/kscience/kmath/nd/StructureND;D)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; - public fun sin-Q7Xurp0 (Lspace/kscience/kmath/nd/NDStructure;)Lorg/jetbrains/bio/viktor/F64Array; + public fun sin-8UOKELU (Lspace/kscience/kmath/nd/StructureND;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun sinh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun sinh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun sqrt (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun sqrt (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; - public fun tan (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun tan (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun tanh (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public fun times (DLspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun tanh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public fun times (DLspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public synthetic fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public fun times (Lspace/kscience/kmath/nd/NDStructure;D)Lspace/kscience/kmath/nd/NDStructure; - public synthetic fun times (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Object;)Lspace/kscience/kmath/nd/NDStructure; - public fun times (Lspace/kscience/kmath/nd/NDStructure;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; - public fun times-s8yP2C4 (Lspace/kscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lorg/jetbrains/bio/viktor/F64Array; + public synthetic fun times (Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public fun times (Lspace/kscience/kmath/nd/StructureND;D)Lspace/kscience/kmath/nd/StructureND; + public synthetic fun times (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND; + public fun times (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public fun times-zrEAbyI (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun unaryMinus (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lspace/kscience/kmath/nd/NDStructure;)Lspace/kscience/kmath/nd/NDStructure; + public fun unaryPlus (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; } -public final class space/kscience/kmath/viktor/ViktorNDStructure : space/kscience/kmath/nd/MutableNDStructure { - public static final synthetic fun box-impl (Lorg/jetbrains/bio/viktor/F64Array;)Lspace/kscience/kmath/viktor/ViktorNDStructure; +public final class space/kscience/kmath/viktor/ViktorStructureND : space/kscience/kmath/nd/MutableNDStructure { + public static final synthetic fun box-impl (Lorg/jetbrains/bio/viktor/F64Array;)Lspace/kscience/kmath/viktor/ViktorStructureND; public static fun constructor-impl (Lorg/jetbrains/bio/viktor/F64Array;)Lorg/jetbrains/bio/viktor/F64Array; public fun elements ()Lkotlin/sequences/Sequence; public static fun elements-impl (Lorg/jetbrains/bio/viktor/F64Array;)Lkotlin/sequences/Sequence; @@ -174,8 +174,8 @@ public final class space/kscience/kmath/viktor/ViktorNDStructure : space/kscienc public final synthetic fun unbox-impl ()Lorg/jetbrains/bio/viktor/F64Array; } -public final class space/kscience/kmath/viktor/ViktorNDStructureKt { - public static final fun ViktorNDField ([I)Lspace/kscience/kmath/viktor/ViktorNDField; +public final class space/kscience/kmath/viktor/ViktorStructureNDKt { + public static final fun ViktorNDField ([I)Lspace/kscience/kmath/viktor/ViktorFieldND; public static final fun asStructure (Lorg/jetbrains/bio/viktor/F64Array;)Lorg/jetbrains/bio/viktor/F64Array; } diff --git a/kmath-viktor/build.gradle.kts b/kmath-viktor/build.gradle.kts index b79a25ea1..94744f528 100644 --- a/kmath-viktor/build.gradle.kts +++ b/kmath-viktor/build.gradle.kts @@ -9,6 +9,6 @@ dependencies { api("org.jetbrains.bio:viktor:1.0.1") } -readme{ +readme { maturity = ru.mipt.npm.gradle.Maturity.DEVELOPMENT } \ No newline at end of file diff --git a/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorNDStructure.kt b/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorNDStructure.kt deleted file mode 100644 index d791ed675..000000000 --- a/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorNDStructure.kt +++ /dev/null @@ -1,123 +0,0 @@ -package space.kscience.kmath.viktor - -import org.jetbrains.bio.viktor.F64Array -import space.kscience.kmath.misc.UnstableKMathAPI -import space.kscience.kmath.nd.* -import space.kscience.kmath.operations.ExtendedField -import space.kscience.kmath.operations.NumbersAddOperations -import space.kscience.kmath.operations.RealField -import space.kscience.kmath.operations.ScaleOperations - -@Suppress("OVERRIDE_BY_INLINE", "NOTHING_TO_INLINE") -public inline class ViktorNDStructure(public val f64Buffer: F64Array) : MutableNDStructure { - public override val shape: IntArray get() = f64Buffer.shape - - public override inline fun get(index: IntArray): Double = f64Buffer.get(*index) - - public override inline fun set(index: IntArray, value: Double) { - f64Buffer.set(*index, value = value) - } - - public override fun elements(): Sequence> = - DefaultStrides(shape).indices().map { it to get(it) } -} - -public fun F64Array.asStructure(): ViktorNDStructure = ViktorNDStructure(this) - -@OptIn(UnstableKMathAPI::class) -@Suppress("OVERRIDE_BY_INLINE", "NOTHING_TO_INLINE") -public class ViktorNDField(public override val shape: IntArray) : NDField, - NumbersAddOperations>, ExtendedField>, - ScaleOperations> { - - public val NDStructure.f64Buffer: F64Array - get() = when { - !shape.contentEquals(this@ViktorNDField.shape) -> throw ShapeMismatchException( - this@ViktorNDField.shape, - shape - ) - this is ViktorNDStructure && this.f64Buffer.shape.contentEquals(this@ViktorNDField.shape) -> this.f64Buffer - else -> produce { this@f64Buffer[it] }.f64Buffer - } - - public override val zero: ViktorNDStructure by lazy { F64Array.full(init = 0.0, shape = shape).asStructure() } - - public override val one: ViktorNDStructure by lazy { F64Array.full(init = 1.0, shape = shape).asStructure() } - - private val strides: Strides = DefaultStrides(shape) - - public override val elementContext: RealField get() = RealField - - public override fun produce(initializer: RealField.(IntArray) -> Double): ViktorNDStructure = - F64Array(*shape).apply { - this@ViktorNDField.strides.indices().forEach { index -> - set(value = RealField.initializer(index), indices = index) - } - }.asStructure() - - override fun NDStructure.unaryMinus(): NDStructure = -1 * this - - public override fun NDStructure.map(transform: RealField.(Double) -> Double): ViktorNDStructure = - F64Array(*this@ViktorNDField.shape).apply { - this@ViktorNDField.strides.indices().forEach { index -> - set(value = RealField.transform(this@map[index]), indices = index) - } - }.asStructure() - - public override fun NDStructure.mapIndexed( - transform: RealField.(index: IntArray, Double) -> Double, - ): ViktorNDStructure = F64Array(*this@ViktorNDField.shape).apply { - this@ViktorNDField.strides.indices().forEach { index -> - set(value = RealField.transform(index, this@mapIndexed[index]), indices = index) - } - }.asStructure() - - public override fun combine( - a: NDStructure, - b: NDStructure, - transform: RealField.(Double, Double) -> Double, - ): ViktorNDStructure = F64Array(*shape).apply { - this@ViktorNDField.strides.indices().forEach { index -> - set(value = RealField.transform(a[index], b[index]), indices = index) - } - }.asStructure() - - public override fun add(a: NDStructure, b: NDStructure): ViktorNDStructure = - (a.f64Buffer + b.f64Buffer).asStructure() - - public override fun scale(a: NDStructure, value: Double): ViktorNDStructure = - (a.f64Buffer * value.toDouble()).asStructure() - - public override inline fun NDStructure.plus(b: NDStructure): ViktorNDStructure = - (f64Buffer + b.f64Buffer).asStructure() - - public override inline fun NDStructure.minus(b: NDStructure): ViktorNDStructure = - (f64Buffer - b.f64Buffer).asStructure() - - public override inline fun NDStructure.times(k: Number): ViktorNDStructure = - (f64Buffer * k.toDouble()).asStructure() - - public override inline fun NDStructure.plus(arg: Double): ViktorNDStructure = - (f64Buffer.plus(arg)).asStructure() - - override fun number(value: Number): ViktorNDStructure = - F64Array.full(init = value.toDouble(), shape = shape).asStructure() - - override fun sin(arg: NDStructure): ViktorNDStructure = arg.map { sin(it) } - - override fun cos(arg: NDStructure): ViktorNDStructure = arg.map { cos(it) } - - override fun asin(arg: NDStructure): ViktorNDStructure = arg.map { asin(it) } - - override fun acos(arg: NDStructure): ViktorNDStructure = arg.map { acos(it) } - - override fun atan(arg: NDStructure): ViktorNDStructure = arg.map { atan(it) } - - override fun power(arg: NDStructure, pow: Number): ViktorNDStructure = arg.map { it.pow(pow) } - - override fun exp(arg: NDStructure): ViktorNDStructure = arg.f64Buffer.exp().asStructure() - - override fun ln(arg: NDStructure): ViktorNDStructure = arg.f64Buffer.log().asStructure() -} - -public fun ViktorNDField(vararg shape: Int): ViktorNDField = ViktorNDField(shape) \ No newline at end of file diff --git a/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorStructureND.kt b/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorStructureND.kt new file mode 100644 index 000000000..9195415c5 --- /dev/null +++ b/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorStructureND.kt @@ -0,0 +1,123 @@ +package space.kscience.kmath.viktor + +import org.jetbrains.bio.viktor.F64Array +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.nd.* +import space.kscience.kmath.operations.ExtendedField +import space.kscience.kmath.operations.NumbersAddOperations +import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.ScaleOperations + +@Suppress("OVERRIDE_BY_INLINE", "NOTHING_TO_INLINE") +public inline class ViktorStructureND(public val f64Buffer: F64Array) : MutableNDStructure { + public override val shape: IntArray get() = f64Buffer.shape + + public override inline fun get(index: IntArray): Double = f64Buffer.get(*index) + + public override inline fun set(index: IntArray, value: Double) { + f64Buffer.set(*index, value = value) + } + + public override fun elements(): Sequence> = + DefaultStrides(shape).indices().map { it to get(it) } +} + +public fun F64Array.asStructure(): ViktorStructureND = ViktorStructureND(this) + +@OptIn(UnstableKMathAPI::class) +@Suppress("OVERRIDE_BY_INLINE", "NOTHING_TO_INLINE") +public class ViktorFieldND(public override val shape: IntArray) : FieldND, + NumbersAddOperations>, ExtendedField>, + ScaleOperations> { + + public val StructureND.f64Buffer: F64Array + get() = when { + !shape.contentEquals(this@ViktorFieldND.shape) -> throw ShapeMismatchException( + this@ViktorFieldND.shape, + shape + ) + this is ViktorStructureND && this.f64Buffer.shape.contentEquals(this@ViktorFieldND.shape) -> this.f64Buffer + else -> produce { this@f64Buffer[it] }.f64Buffer + } + + public override val zero: ViktorStructureND by lazy { F64Array.full(init = 0.0, shape = shape).asStructure() } + + public override val one: ViktorStructureND by lazy { F64Array.full(init = 1.0, shape = shape).asStructure() } + + private val strides: Strides = DefaultStrides(shape) + + public override val elementContext: RealField get() = RealField + + public override fun produce(initializer: RealField.(IntArray) -> Double): ViktorStructureND = + F64Array(*shape).apply { + this@ViktorFieldND.strides.indices().forEach { index -> + set(value = RealField.initializer(index), indices = index) + } + }.asStructure() + + override fun StructureND.unaryMinus(): StructureND = -1 * this + + public override fun StructureND.map(transform: RealField.(Double) -> Double): ViktorStructureND = + F64Array(*this@ViktorFieldND.shape).apply { + this@ViktorFieldND.strides.indices().forEach { index -> + set(value = RealField.transform(this@map[index]), indices = index) + } + }.asStructure() + + public override fun StructureND.mapIndexed( + transform: RealField.(index: IntArray, Double) -> Double, + ): ViktorStructureND = F64Array(*this@ViktorFieldND.shape).apply { + this@ViktorFieldND.strides.indices().forEach { index -> + set(value = RealField.transform(index, this@mapIndexed[index]), indices = index) + } + }.asStructure() + + public override fun combine( + a: StructureND, + b: StructureND, + transform: RealField.(Double, Double) -> Double, + ): ViktorStructureND = F64Array(*shape).apply { + this@ViktorFieldND.strides.indices().forEach { index -> + set(value = RealField.transform(a[index], b[index]), indices = index) + } + }.asStructure() + + public override fun add(a: StructureND, b: StructureND): ViktorStructureND = + (a.f64Buffer + b.f64Buffer).asStructure() + + public override fun scale(a: StructureND, value: Double): ViktorStructureND = + (a.f64Buffer * value.toDouble()).asStructure() + + public override inline fun StructureND.plus(b: StructureND): ViktorStructureND = + (f64Buffer + b.f64Buffer).asStructure() + + public override inline fun StructureND.minus(b: StructureND): ViktorStructureND = + (f64Buffer - b.f64Buffer).asStructure() + + public override inline fun StructureND.times(k: Number): ViktorStructureND = + (f64Buffer * k.toDouble()).asStructure() + + public override inline fun StructureND.plus(arg: Double): ViktorStructureND = + (f64Buffer.plus(arg)).asStructure() + + override fun number(value: Number): ViktorStructureND = + F64Array.full(init = value.toDouble(), shape = shape).asStructure() + + override fun sin(arg: StructureND): ViktorStructureND = arg.map { sin(it) } + + override fun cos(arg: StructureND): ViktorStructureND = arg.map { cos(it) } + + override fun asin(arg: StructureND): ViktorStructureND = arg.map { asin(it) } + + override fun acos(arg: StructureND): ViktorStructureND = arg.map { acos(it) } + + override fun atan(arg: StructureND): ViktorStructureND = arg.map { atan(it) } + + override fun power(arg: StructureND, pow: Number): ViktorStructureND = arg.map { it.pow(pow) } + + override fun exp(arg: StructureND): ViktorStructureND = arg.f64Buffer.exp().asStructure() + + override fun ln(arg: StructureND): ViktorStructureND = arg.f64Buffer.log().asStructure() +} + +public fun ViktorNDField(vararg shape: Int): ViktorFieldND = ViktorFieldND(shape) \ No newline at end of file From 206e4cbcf642a59792df62f71eb2d551df8b90ee Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 16 Mar 2021 21:17:26 +0300 Subject: [PATCH 140/150] Real -> Double --- CHANGELOG.md | 1 + docs/algebra.md | 2 +- docs/nd-structure.md | 4 +- .../kmath/benchmarks/BufferBenchmark.kt | 6 +- .../kscience/kmath/benchmarks/DotBenchmark.kt | 4 +- .../ExpressionsInterpretersBenchmark.kt | 4 +- .../kmath/benchmarks/NDFieldBenchmark.kt | 6 +- .../kmath/benchmarks/ViktorBenchmark.kt | 4 +- .../kmath/benchmarks/ViktorLogBenchmark.kt | 4 +- .../space/kscience/kmath/ast/expressions.kt | 4 +- .../kscience/kmath/ast/kotlingradSupport.kt | 6 +- .../kmath/commons/fit/fitWithAutoDiff.kt | 4 +- .../space/kscience/kmath/linear/gradient.kt | 10 +- .../kscience/kmath/structures/NDField.kt | 6 +- ...lRealNDField.kt => StreamDoubleFieldND.kt} | 36 +- .../structures/StructureReadBenchmark.kt | 2 +- .../structures/StructureWriteBenchmark.kt | 4 +- kmath-ast/README.md | 8 +- kmath-ast/docs/README-TEMPLATE.md | 8 +- .../TestESTreeConsistencyWithInterpreter.kt | 6 +- .../estree/TestESTreeOperationsSupport.kt | 10 +- .../kmath/estree/TestESTreeSpecialization.kt | 16 +- .../asm/TestAsmConsistencyWithInterpreter.kt | 6 +- .../kmath/asm/TestAsmOperationsSupport.kt | 10 +- .../kmath/asm/TestAsmSpecialization.kt | 16 +- .../kmath/ast/ParserPrecedenceTest.kt | 4 +- .../space/kscience/kmath/ast/ParserTest.kt | 4 +- .../kscience/kmath/commons/linear/CMMatrix.kt | 18 +- .../commons/transform/Transformations.kt | 3 +- .../commons/integration/IntegrationTest.kt | 2 +- .../kscience/kmath/complex/ComplexFieldND.kt | 10 +- kmath-core/api/kmath-core.api | 696 +++++++++--------- .../{RealDomain.kt => DoubleDomain.kt} | 2 +- .../kmath/domains/HyperSquareDomain.kt | 2 +- .../kmath/domains/UnconstrainedDomain.kt | 2 +- .../kmath/domains/UnivariateDomain.kt | 2 +- .../kmath/expressions/SimpleAutoDiff.kt | 2 +- .../kscience/kmath/linear/LinearSpace.kt | 4 +- .../kscience/kmath/linear/LupDecomposition.kt | 12 +- .../kscience/kmath/nd/BufferAlgebraND.kt | 2 +- .../nd/{RealFieldND.kt => DoubleFieldND.kt} | 46 +- .../kscience/kmath/operations/numbers.kt | 2 +- .../space/kscience/kmath/structures/Buffer.kt | 18 +- .../{RealBuffer.kt => DoubleBuffer.kt} | 22 +- .../kmath/structures/DoubleBufferField.kt | 272 +++++++ .../kmath/structures/FlaggedBuffer.kt | 4 +- .../kmath/structures/RealBufferField.kt | 272 ------- .../kmath/expressions/ExpressionFieldTest.kt | 8 +- .../kmath/expressions/SimpleAutoDiffTest.kt | 20 +- ...lLUSolverTest.kt => DoubleLUSolverTest.kt} | 2 +- .../{RealFieldTest.kt => DoubleFieldTest.kt} | 6 +- ...ingRealChain.kt => BlockingDoubleChain.kt} | 2 +- .../kscience/kmath/streaming/BufferFlow.kt | 12 +- .../kmath/structures/LazyStructureND.kt | 2 +- .../kscience/kmath/dimensions/Wrappers.kt | 8 +- .../kscience/kmath/ejml/EjmlLinearSpace.kt | 18 +- kmath-for-real/build.gradle.kts | 8 +- .../space/kscience/kmath/real/RealMatrix.kt | 16 +- .../space/kscience/kmath/real/RealVector.kt | 65 +- .../kotlin/space/kscience/kmath/real/grids.kt | 2 +- .../space/kscience/kmath/real/realND.kt | 10 +- ...{RealMatrixTest.kt => DoubleMatrixTest.kt} | 2 +- ...{RealVectorTest.kt => DoubleVectorTest.kt} | 14 +- .../interpolation/LinearInterpolatorTest.kt | 6 +- .../space/kscience/kmath/histogram/Counter.kt | 4 +- ...togramSpace.kt => DoubleHistogramSpace.kt} | 12 +- .../kscience/kmath/histogram/Histogram.kt | 6 +- .../histogram/MultivariateHistogramTest.kt | 15 +- .../kmath/kotlingrad/AdaptingTests.kt | 28 +- kmath-nd4j/docs/README-TEMPLATE.md | 6 +- .../kscience/kmath/nd4j/Nd4jArrayAlgebra.kt | 14 +- .../kscience/kmath/nd4j/Nd4jArrayIterator.kt | 4 +- .../kscience/kmath/nd4j/Nd4jArrayStructure.kt | 4 +- .../kmath/nd4j/Nd4jArrayAlgebraTest.kt | 4 +- .../kmath/nd4j/Nd4jArrayStructureTest.kt | 14 +- .../space/kscience/kmath/stat/Distribution.kt | 4 +- .../space/kscience/kmath/stat/Statistic.kt | 2 +- .../kscience/kmath/stat/distributions.kt | 6 +- kmath-viktor/api/kmath-viktor.api | 2 +- .../kmath/viktor/ViktorStructureND.kt | 22 +- 80 files changed, 968 insertions(+), 968 deletions(-) rename examples/src/main/kotlin/space/kscience/kmath/structures/{ParallelRealNDField.kt => StreamDoubleFieldND.kt} (76%) rename kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/{RealDomain.kt => DoubleDomain.kt} (95%) rename kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/{RealFieldND.kt => DoubleFieldND.kt} (67%) rename kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/{RealBuffer.kt => DoubleBuffer.kt} (53%) create mode 100644 kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/DoubleBufferField.kt delete mode 100644 kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBufferField.kt rename kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/{RealLUSolverTest.kt => DoubleLUSolverTest.kt} (97%) rename kmath-core/src/commonTest/kotlin/space/kscience/kmath/operations/{RealFieldTest.kt => DoubleFieldTest.kt} (59%) rename kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/{BlockingRealChain.kt => BlockingDoubleChain.kt} (82%) rename kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/{RealMatrixTest.kt => DoubleMatrixTest.kt} (99%) rename kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/{RealVectorTest.kt => DoubleVectorTest.kt} (67%) rename kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/{RealHistogramSpace.kt => DoubleHistogramSpace.kt} (92%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17486bd2b..f9e3f963e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - VectorSpace is now a vector space - Buffer factories for primitives moved to MutableBuffer.Companion - NDStructure and NDAlgebra to StructureND and AlgebraND respectively +- Real -> Double ### Deprecated diff --git a/docs/algebra.md b/docs/algebra.md index 6bfcde043..84693bb81 100644 --- a/docs/algebra.md +++ b/docs/algebra.md @@ -31,7 +31,7 @@ multiplication; - [Ring](http://mathworld.wolfram.com/Ring.html) adds multiplication and its neutral element (i.e. 1); - [Field](http://mathworld.wolfram.com/Field.html) adds division operation. -A typical implementation of `Field` is the `RealField` which works on doubles, and `VectorSpace` for `Space`. +A typical implementation of `Field` is the `DoubleField` which works on doubles, and `VectorSpace` for `Space`. In some cases algebra context can hold additional operations like `exp` or `sin`, and then it inherits appropriate interface. Also, contexts may have operations, which produce elements outside of the context. For example, `Matrix.dot` diff --git a/docs/nd-structure.md b/docs/nd-structure.md index 835304b9f..ec9b4d521 100644 --- a/docs/nd-structure.md +++ b/docs/nd-structure.md @@ -10,11 +10,11 @@ structures. In `kmath` performance depends on which particular context was used Let us consider following contexts: ```kotlin // automatically build context most suited for given type. - val autoField = NDField.auto(RealField, dim, dim) + val autoField = NDField.auto(DoubleField, dim, dim) // specialized nd-field for Double. It works as generic Double field as well val specializedField = NDField.real(dim, dim) //A generic boxing field. It should be used for objects, not primitives. - val genericField = NDField.buffered(RealField, dim, dim) + val genericField = NDField.buffered(DoubleField, dim, dim) ``` Now let us perform several tests and see which implementation is best suited for each case: diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/BufferBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/BufferBenchmark.kt index 1c3bbab75..1db1d77dc 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/BufferBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/BufferBenchmark.kt @@ -5,14 +5,14 @@ import kotlinx.benchmark.Scope import kotlinx.benchmark.State import space.kscience.kmath.complex.Complex import space.kscience.kmath.complex.complex +import space.kscience.kmath.structures.DoubleBuffer import space.kscience.kmath.structures.MutableBuffer -import space.kscience.kmath.structures.RealBuffer @State(Scope.Benchmark) internal class BufferBenchmark { @Benchmark - fun genericRealBufferReadWrite() { - val buffer = RealBuffer(size) { it.toDouble() } + fun genericDoubleBufferReadWrite() { + val buffer = DoubleBuffer(size) { it.toDouble() } (0 until size).forEach { buffer[it] diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt index dbf373929..6a2126dc1 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt @@ -8,7 +8,7 @@ import space.kscience.kmath.commons.linear.CMLinearSpace import space.kscience.kmath.ejml.EjmlLinearSpace import space.kscience.kmath.linear.LinearSpace import space.kscience.kmath.linear.invoke -import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.DoubleField import kotlin.random.Random @State(Scope.Benchmark) @@ -51,7 +51,7 @@ internal class DotBenchmark { @Benchmark fun bufferedDot(blackhole: Blackhole) { - LinearSpace.auto(RealField).invoke { + LinearSpace.auto(DoubleField).invoke { blackhole.consume(matrix1 dot matrix2) } } diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt index e5cfbf9f6..0899241f9 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt @@ -10,7 +10,7 @@ import space.kscience.kmath.expressions.Expression import space.kscience.kmath.expressions.expressionInField import space.kscience.kmath.expressions.invoke import space.kscience.kmath.expressions.symbol -import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.operations.bindSymbol import kotlin.random.Random @@ -68,7 +68,7 @@ internal class ExpressionsInterpretersBenchmark { } private companion object { - private val algebra = RealField + private val algebra = DoubleField private val x by symbol } } diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/NDFieldBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/NDFieldBenchmark.kt index e381a1559..09c415d9a 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/NDFieldBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/NDFieldBenchmark.kt @@ -5,7 +5,7 @@ import kotlinx.benchmark.Blackhole import kotlinx.benchmark.Scope import kotlinx.benchmark.State import space.kscience.kmath.nd.* -import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.structures.Buffer @State(Scope.Benchmark) @@ -41,8 +41,8 @@ internal class NDFieldBenchmark { private companion object { private const val dim = 1000 private const val n = 100 - private val autoField = AlgebraND.auto(RealField, dim, dim) + private val autoField = AlgebraND.auto(DoubleField, dim, dim) private val specializedField = AlgebraND.real(dim, dim) - private val genericField = AlgebraND.field(RealField, Buffer.Companion::boxing, dim, dim) + private val genericField = AlgebraND.field(DoubleField, Buffer.Companion::boxing, dim, dim) } } diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorBenchmark.kt index 21c29affd..fd0188bd6 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorBenchmark.kt @@ -9,7 +9,7 @@ import space.kscience.kmath.nd.AlgebraND import space.kscience.kmath.nd.StructureND import space.kscience.kmath.nd.auto import space.kscience.kmath.nd.real -import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.viktor.ViktorNDField @State(Scope.Benchmark) @@ -54,7 +54,7 @@ internal class ViktorBenchmark { private const val n = 100 // automatically build context most suited for given type. - private val autoField = AlgebraND.auto(RealField, dim, dim) + private val autoField = AlgebraND.auto(DoubleField, dim, dim) private val realField = AlgebraND.real(dim, dim) private val viktorField = ViktorNDField(dim, dim) } diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt index e964f9bff..b6bd036ba 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt @@ -8,7 +8,7 @@ import org.jetbrains.bio.viktor.F64Array import space.kscience.kmath.nd.AlgebraND import space.kscience.kmath.nd.auto import space.kscience.kmath.nd.real -import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.viktor.ViktorFieldND @State(Scope.Benchmark) @@ -46,7 +46,7 @@ internal class ViktorLogBenchmark { private const val n = 100 // automatically build context most suited for given type. - private val autoField = AlgebraND.auto(RealField, dim, dim) + private val autoField = AlgebraND.auto(DoubleField, dim, dim) private val realNdField = AlgebraND.real(dim, dim) private val viktorField = ViktorFieldND(intArrayOf(dim, dim)) } diff --git a/examples/src/main/kotlin/space/kscience/kmath/ast/expressions.kt b/examples/src/main/kotlin/space/kscience/kmath/ast/expressions.kt index c342fc3ef..17c85eea5 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/ast/expressions.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/ast/expressions.kt @@ -1,10 +1,10 @@ package space.kscience.kmath.ast import space.kscience.kmath.expressions.invoke -import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.DoubleField fun main() { - val expr = RealField.mstInField { + val expr = DoubleField.mstInField { val x = bindSymbol("x") x * 2.0 + number(2.0) / x - 16.0 } diff --git a/examples/src/main/kotlin/space/kscience/kmath/ast/kotlingradSupport.kt b/examples/src/main/kotlin/space/kscience/kmath/ast/kotlingradSupport.kt index 16304a458..23c9d5b41 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/ast/kotlingradSupport.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/ast/kotlingradSupport.kt @@ -5,7 +5,7 @@ import space.kscience.kmath.expressions.derivative import space.kscience.kmath.expressions.invoke import space.kscience.kmath.expressions.symbol import space.kscience.kmath.kotlingrad.differentiable -import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.DoubleField /** * In this example, x^2-4*x-44 function is differentiated with Kotlin∇, and the autodiff result is compared with @@ -14,11 +14,11 @@ import space.kscience.kmath.operations.RealField fun main() { val x by symbol - val actualDerivative = MstExpression(RealField, "x^2-4*x-44".parseMath()) + val actualDerivative = MstExpression(DoubleField, "x^2-4*x-44".parseMath()) .differentiable() .derivative(x) .compile() - val expectedDerivative = MstExpression(RealField, "2*x-4".parseMath()).compile() + val expectedDerivative = MstExpression(DoubleField, "2*x-4".parseMath()).compile() assert(actualDerivative("x" to 123.0) == expectedDerivative("x" to 123.0)) } diff --git a/examples/src/main/kotlin/space/kscience/kmath/commons/fit/fitWithAutoDiff.kt b/examples/src/main/kotlin/space/kscience/kmath/commons/fit/fitWithAutoDiff.kt index c26fb34e9..ef0c29a2d 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/commons/fit/fitWithAutoDiff.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/commons/fit/fitWithAutoDiff.kt @@ -8,7 +8,7 @@ import kscience.plotly.models.TraceValues import space.kscience.kmath.commons.optimization.chiSquared import space.kscience.kmath.commons.optimization.minimize import space.kscience.kmath.expressions.symbol -import space.kscience.kmath.real.RealVector +import space.kscience.kmath.real.DoubleVector import space.kscience.kmath.real.map import space.kscience.kmath.real.step import space.kscience.kmath.stat.* @@ -26,7 +26,7 @@ private val c by symbol /** * Shortcut to use buffers in plotly */ -operator fun TraceValues.invoke(vector: RealVector) { +operator fun TraceValues.invoke(vector: DoubleVector) { numbers = vector.asIterable() } diff --git a/examples/src/main/kotlin/space/kscience/kmath/linear/gradient.kt b/examples/src/main/kotlin/space/kscience/kmath/linear/gradient.kt index 8dd3d7f6b..8940aeac9 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/linear/gradient.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/linear/gradient.kt @@ -1,11 +1,11 @@ package space.kscience.kmath.linear import space.kscience.kmath.real.* -import space.kscience.kmath.structures.RealBuffer +import space.kscience.kmath.structures.DoubleBuffer fun main() { - val x0 = Point(0.0, 0.0, 0.0) - val sigma = Point(1.0, 1.0, 1.0) + val x0 = DoubleVector(0.0, 0.0, 0.0) + val sigma = DoubleVector(1.0, 1.0, 1.0) val gaussian: (Point) -> Double = { x -> require(x.size == x0.size) @@ -14,9 +14,9 @@ fun main() { fun ((Point) -> Double).grad(x: Point): Point { require(x.size == x0.size) - return RealBuffer(x.size) { i -> + return DoubleBuffer(x.size) { i -> val h = sigma[i] / 5 - val dVector = RealBuffer(x.size) { if (it == i) h else 0.0 } + val dVector = DoubleBuffer(x.size) { if (it == i) h else 0.0 } val f1 = invoke(x + dVector / 2) val f0 = invoke(x - dVector / 2) (f1 - f0) / h diff --git a/examples/src/main/kotlin/space/kscience/kmath/structures/NDField.kt b/examples/src/main/kotlin/space/kscience/kmath/structures/NDField.kt index b884251c4..f7dc3280a 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/structures/NDField.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/structures/NDField.kt @@ -4,7 +4,7 @@ import kotlinx.coroutines.GlobalScope import org.nd4j.linalg.factory.Nd4j import space.kscience.kmath.nd.* import space.kscience.kmath.nd4j.Nd4jArrayField -import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.operations.invoke import space.kscience.kmath.viktor.ViktorNDField import kotlin.contracts.InvocationKind @@ -24,11 +24,11 @@ fun main() { val n = 1000 // automatically build context most suited for given type. - val autoField = AlgebraND.auto(RealField, dim, dim) + val autoField = AlgebraND.auto(DoubleField, dim, dim) // specialized nd-field for Double. It works as generic Double field as well val realField = AlgebraND.real(dim, dim) //A generic boxing field. It should be used for objects, not primitives. - val boxingField = AlgebraND.field(RealField, Buffer.Companion::boxing, dim, dim) + val boxingField = AlgebraND.field(DoubleField, Buffer.Companion::boxing, dim, dim) // Nd4j specialized field. val nd4jField = Nd4jArrayField.real(dim, dim) //viktor field diff --git a/examples/src/main/kotlin/space/kscience/kmath/structures/ParallelRealNDField.kt b/examples/src/main/kotlin/space/kscience/kmath/structures/StreamDoubleFieldND.kt similarity index 76% rename from examples/src/main/kotlin/space/kscience/kmath/structures/ParallelRealNDField.kt rename to examples/src/main/kotlin/space/kscience/kmath/structures/StreamDoubleFieldND.kt index 8b3c5dfbb..b4653b598 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/structures/ParallelRealNDField.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/structures/StreamDoubleFieldND.kt @@ -2,9 +2,9 @@ package space.kscience.kmath.structures import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.nd.* +import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.operations.ExtendedField import space.kscience.kmath.operations.NumbersAddOperations -import space.kscience.kmath.operations.RealField import java.util.* import java.util.stream.IntStream @@ -12,14 +12,14 @@ import java.util.stream.IntStream * A demonstration implementation of NDField over Real using Java [DoubleStream] for parallel execution */ @OptIn(UnstableKMathAPI::class) -class StreamRealFieldND( +class StreamDoubleFieldND( override val shape: IntArray, -) : FieldND, +) : FieldND, NumbersAddOperations>, ExtendedField> { private val strides = DefaultStrides(shape) - override val elementContext: RealField get() = RealField + override val elementContext: DoubleField get() = DoubleField override val zero: NDBuffer by lazy { produce { zero } } override val one: NDBuffer by lazy { produce { one } } @@ -28,38 +28,38 @@ class StreamRealFieldND( return produce { d } } - private val StructureND.buffer: RealBuffer + private val StructureND.buffer: DoubleBuffer get() = when { - !shape.contentEquals(this@StreamRealFieldND.shape) -> throw ShapeMismatchException( - this@StreamRealFieldND.shape, + !shape.contentEquals(this@StreamDoubleFieldND.shape) -> throw ShapeMismatchException( + this@StreamDoubleFieldND.shape, shape ) - this is NDBuffer && this.strides == this@StreamRealFieldND.strides -> this.buffer as RealBuffer - else -> RealBuffer(strides.linearSize) { offset -> get(strides.index(offset)) } + this is NDBuffer && this.strides == this@StreamDoubleFieldND.strides -> this.buffer as DoubleBuffer + else -> DoubleBuffer(strides.linearSize) { offset -> get(strides.index(offset)) } } - override fun produce(initializer: RealField.(IntArray) -> Double): NDBuffer { + override fun produce(initializer: DoubleField.(IntArray) -> Double): NDBuffer { val array = IntStream.range(0, strides.linearSize).parallel().mapToDouble { offset -> val index = strides.index(offset) - RealField.initializer(index) + DoubleField.initializer(index) }.toArray() return NDBuffer(strides, array.asBuffer()) } override fun StructureND.map( - transform: RealField.(Double) -> Double, + transform: DoubleField.(Double) -> Double, ): NDBuffer { - val array = Arrays.stream(buffer.array).parallel().map { RealField.transform(it) }.toArray() + val array = Arrays.stream(buffer.array).parallel().map { DoubleField.transform(it) }.toArray() return NDBuffer(strides, array.asBuffer()) } override fun StructureND.mapIndexed( - transform: RealField.(index: IntArray, Double) -> Double, + transform: DoubleField.(index: IntArray, Double) -> Double, ): NDBuffer { val array = IntStream.range(0, strides.linearSize).parallel().mapToDouble { offset -> - RealField.transform( + DoubleField.transform( strides.index(offset), buffer.array[offset] ) @@ -71,10 +71,10 @@ class StreamRealFieldND( override fun combine( a: StructureND, b: StructureND, - transform: RealField.(Double, Double) -> Double, + transform: DoubleField.(Double, Double) -> Double, ): NDBuffer { val array = IntStream.range(0, strides.linearSize).parallel().mapToDouble { offset -> - RealField.transform(a.buffer.array[offset], b.buffer.array[offset]) + DoubleField.transform(a.buffer.array[offset], b.buffer.array[offset]) }.toArray() return NDBuffer(strides, array.asBuffer()) } @@ -104,4 +104,4 @@ class StreamRealFieldND( override fun atanh(arg: StructureND): NDBuffer = arg.map { atanh(it) } } -fun AlgebraND.Companion.realWithStream(vararg shape: Int): StreamRealFieldND = StreamRealFieldND(shape) \ No newline at end of file +fun AlgebraND.Companion.realWithStream(vararg shape: Int): StreamDoubleFieldND = StreamDoubleFieldND(shape) \ No newline at end of file diff --git a/examples/src/main/kotlin/space/kscience/kmath/structures/StructureReadBenchmark.kt b/examples/src/main/kotlin/space/kscience/kmath/structures/StructureReadBenchmark.kt index 7f6d73394..89f984a5b 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/structures/StructureReadBenchmark.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/structures/StructureReadBenchmark.kt @@ -8,7 +8,7 @@ import kotlin.system.measureTimeMillis fun main() { val n = 6000 val array = DoubleArray(n * n) { 1.0 } - val buffer = RealBuffer(array) + val buffer = DoubleBuffer(array) val strides = DefaultStrides(intArrayOf(n, n)) val structure = NDBuffer(strides, buffer) diff --git a/examples/src/main/kotlin/space/kscience/kmath/structures/StructureWriteBenchmark.kt b/examples/src/main/kotlin/space/kscience/kmath/structures/StructureWriteBenchmark.kt index 7aa5a07fd..27741be61 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/structures/StructureWriteBenchmark.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/structures/StructureWriteBenchmark.kt @@ -20,10 +20,10 @@ fun main() { println("Array mapping finished in $time2 millis") - val buffer = RealBuffer(DoubleArray(n * n) { 1.0 }) + val buffer = DoubleBuffer(DoubleArray(n * n) { 1.0 }) val time3 = measureTimeMillis { - val target = RealBuffer(DoubleArray(n * n)) + val target = DoubleBuffer(DoubleArray(n * n)) val res = array.forEachIndexed { index, value -> target[index] = value + 1 } diff --git a/kmath-ast/README.md b/kmath-ast/README.md index a88b6f696..1b3f70080 100644 --- a/kmath-ast/README.md +++ b/kmath-ast/README.md @@ -61,7 +61,7 @@ a special implementation of `Expression` with implemented `invoke` function. For example, the following builder: ```kotlin -RealField.mstInField { symbol("x") + 2 }.compile() +DoubleField.mstInField { symbol("x") + 2 }.compile() ``` … leads to generation of bytecode, which can be decompiled to the following Java class: @@ -94,8 +94,8 @@ public final class AsmCompiledExpression_45045_0 implements Expression { This API extends MST and MstExpression, so you may optimize as both of them: ```kotlin -RealField.mstInField { symbol("x") + 2 }.compile() -RealField.expression("x+2".parseMath()) +DoubleField.mstInField { symbol("x") + 2 }.compile() +DoubleField.expression("x+2".parseMath()) ``` #### Known issues @@ -109,7 +109,7 @@ RealField.expression("x+2".parseMath()) A similar feature is also available on JS. ```kotlin -RealField.mstInField { symbol("x") + 2 }.compile() +DoubleField.mstInField { symbol("x") + 2 }.compile() ``` The code above returns expression implemented with such a JS function: diff --git a/kmath-ast/docs/README-TEMPLATE.md b/kmath-ast/docs/README-TEMPLATE.md index 2712cba75..80e48008b 100644 --- a/kmath-ast/docs/README-TEMPLATE.md +++ b/kmath-ast/docs/README-TEMPLATE.md @@ -16,7 +16,7 @@ a special implementation of `Expression` with implemented `invoke` function. For example, the following builder: ```kotlin -RealField.mstInField { symbol("x") + 2 }.compile() +DoubleField.mstInField { symbol("x") + 2 }.compile() ``` … leads to generation of bytecode, which can be decompiled to the following Java class: @@ -49,8 +49,8 @@ public final class AsmCompiledExpression_45045_0 implements Expression { This API extends MST and MstExpression, so you may optimize as both of them: ```kotlin -RealField.mstInField { symbol("x") + 2 }.compile() -RealField.expression("x+2".parseMath()) +DoubleField.mstInField { symbol("x") + 2 }.compile() +DoubleField.expression("x+2".parseMath()) ``` #### Known issues @@ -64,7 +64,7 @@ RealField.expression("x+2".parseMath()) A similar feature is also available on JS. ```kotlin -RealField.mstInField { symbol("x") + 2 }.compile() +DoubleField.mstInField { symbol("x") + 2 }.compile() ``` The code above returns expression implemented with such a JS function: diff --git a/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeConsistencyWithInterpreter.kt b/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeConsistencyWithInterpreter.kt index bb34254b1..683c0337c 100644 --- a/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeConsistencyWithInterpreter.kt +++ b/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeConsistencyWithInterpreter.kt @@ -5,7 +5,7 @@ import space.kscience.kmath.complex.ComplexField import space.kscience.kmath.complex.toComplex import space.kscience.kmath.expressions.invoke import space.kscience.kmath.operations.ByteRing -import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.DoubleField import kotlin.test.Test import kotlin.test.assertEquals @@ -73,7 +73,7 @@ internal class TestESTreeConsistencyWithInterpreter { @Test fun realField() { - val res1 = RealField.mstInField { + val res1 = DoubleField.mstInField { +(3 - 2 + 2 * number(1) + 1.0) + binaryOperationFunction("+")( (3.0 - (bindSymbol("x") + (scale(add(number(1.0), number(1.0)), 2.0) + 1.0))) * 3 - 1.0 + number(1), @@ -81,7 +81,7 @@ internal class TestESTreeConsistencyWithInterpreter { ) + zero }("x" to 2.0) - val res2 = RealField.mstInField { + val res2 = DoubleField.mstInField { +(3 - 2 + 2 * number(1) + 1.0) + binaryOperationFunction("+")( (3.0 - (bindSymbol("x") + (scale(add(number(1.0), number(1.0)), 2.0) + 1.0))) * 3 - 1.0 + number(1), diff --git a/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeOperationsSupport.kt b/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeOperationsSupport.kt index 590d0957d..d59c048b6 100644 --- a/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeOperationsSupport.kt +++ b/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeOperationsSupport.kt @@ -4,7 +4,7 @@ import space.kscience.kmath.ast.mstInExtendedField import space.kscience.kmath.ast.mstInField import space.kscience.kmath.ast.mstInGroup import space.kscience.kmath.expressions.invoke -import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.DoubleField import kotlin.random.Random import kotlin.test.Test import kotlin.test.assertEquals @@ -12,28 +12,28 @@ import kotlin.test.assertEquals internal class TestESTreeOperationsSupport { @Test fun testUnaryOperationInvocation() { - val expression = RealField.mstInGroup { -bindSymbol("x") }.compile() + val expression = DoubleField.mstInGroup { -bindSymbol("x") }.compile() val res = expression("x" to 2.0) assertEquals(-2.0, res) } @Test fun testBinaryOperationInvocation() { - val expression = RealField.mstInGroup { -bindSymbol("x") + number(1.0) }.compile() + val expression = DoubleField.mstInGroup { -bindSymbol("x") + number(1.0) }.compile() val res = expression("x" to 2.0) assertEquals(-1.0, res) } @Test fun testConstProductInvocation() { - val res = RealField.mstInField { bindSymbol("x") * 2 }("x" to 2.0) + val res = DoubleField.mstInField { bindSymbol("x") * 2 }("x" to 2.0) assertEquals(4.0, res) } @Test fun testMultipleCalls() { val e = - RealField.mstInExtendedField { sin(bindSymbol("x")).pow(4) - 6 * bindSymbol("x") / tanh(bindSymbol("x")) } + DoubleField.mstInExtendedField { sin(bindSymbol("x")).pow(4) - 6 * bindSymbol("x") / tanh(bindSymbol("x")) } .compile() val r = Random(0) var s = 0.0 diff --git a/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeSpecialization.kt b/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeSpecialization.kt index c5e43241a..6be963175 100644 --- a/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeSpecialization.kt +++ b/kmath-ast/src/jsTest/kotlin/space/kscience/kmath/estree/TestESTreeSpecialization.kt @@ -2,50 +2,50 @@ package space.kscience.kmath.estree import space.kscience.kmath.ast.mstInField import space.kscience.kmath.expressions.invoke -import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.DoubleField import kotlin.test.Test import kotlin.test.assertEquals internal class TestESTreeSpecialization { @Test fun testUnaryPlus() { - val expr = RealField.mstInField { unaryOperationFunction("+")(bindSymbol("x")) }.compile() + val expr = DoubleField.mstInField { unaryOperationFunction("+")(bindSymbol("x")) }.compile() assertEquals(2.0, expr("x" to 2.0)) } @Test fun testUnaryMinus() { - val expr = RealField.mstInField { unaryOperationFunction("-")(bindSymbol("x")) }.compile() + val expr = DoubleField.mstInField { unaryOperationFunction("-")(bindSymbol("x")) }.compile() assertEquals(-2.0, expr("x" to 2.0)) } @Test fun testAdd() { - val expr = RealField.mstInField { binaryOperationFunction("+")(bindSymbol("x"), bindSymbol("x")) }.compile() + val expr = DoubleField.mstInField { binaryOperationFunction("+")(bindSymbol("x"), bindSymbol("x")) }.compile() assertEquals(4.0, expr("x" to 2.0)) } @Test fun testSine() { - val expr = RealField.mstInField { unaryOperationFunction("sin")(bindSymbol("x")) }.compile() + val expr = DoubleField.mstInField { unaryOperationFunction("sin")(bindSymbol("x")) }.compile() assertEquals(0.0, expr("x" to 0.0)) } @Test fun testMinus() { - val expr = RealField.mstInField { binaryOperationFunction("-")(bindSymbol("x"), bindSymbol("x")) }.compile() + val expr = DoubleField.mstInField { binaryOperationFunction("-")(bindSymbol("x"), bindSymbol("x")) }.compile() assertEquals(0.0, expr("x" to 2.0)) } @Test fun testDivide() { - val expr = RealField.mstInField { binaryOperationFunction("/")(bindSymbol("x"), bindSymbol("x")) }.compile() + val expr = DoubleField.mstInField { binaryOperationFunction("/")(bindSymbol("x"), bindSymbol("x")) }.compile() assertEquals(1.0, expr("x" to 2.0)) } @Test fun testPower() { - val expr = RealField + val expr = DoubleField .mstInField { binaryOperationFunction("pow")(bindSymbol("x"), number(2)) } .compile() diff --git a/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmConsistencyWithInterpreter.kt b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmConsistencyWithInterpreter.kt index 7cc1497d0..abc320360 100644 --- a/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmConsistencyWithInterpreter.kt +++ b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmConsistencyWithInterpreter.kt @@ -5,7 +5,7 @@ import space.kscience.kmath.complex.ComplexField import space.kscience.kmath.complex.toComplex import space.kscience.kmath.expressions.invoke import space.kscience.kmath.operations.ByteRing -import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.DoubleField import kotlin.test.Test import kotlin.test.assertEquals @@ -73,7 +73,7 @@ internal class TestAsmConsistencyWithInterpreter { @Test fun realField() { - val res1 = RealField.mstInField { + val res1 = DoubleField.mstInField { +(3 - 2 + 2 * number(1) + 1.0) + binaryOperationFunction("+")( (3.0 - (bindSymbol("x") + (scale(add(number(1.0), number(1.0)), 2.0) + 1.0))) * 3 - 1.0 + number(1), @@ -81,7 +81,7 @@ internal class TestAsmConsistencyWithInterpreter { ) + zero }("x" to 2.0) - val res2 = RealField.mstInField { + val res2 = DoubleField.mstInField { +(3 - 2 + 2 * number(1) + 1.0) + binaryOperationFunction("+")( (3.0 - (bindSymbol("x") + (scale(add(number(1.0), number(1.0)), 2.0) + 1.0))) * 3 - 1.0 + number(1), diff --git a/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmOperationsSupport.kt b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmOperationsSupport.kt index 7047c824c..5d70cb76b 100644 --- a/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmOperationsSupport.kt +++ b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmOperationsSupport.kt @@ -4,7 +4,7 @@ import space.kscience.kmath.ast.mstInExtendedField import space.kscience.kmath.ast.mstInField import space.kscience.kmath.ast.mstInGroup import space.kscience.kmath.expressions.invoke -import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.DoubleField import kotlin.random.Random import kotlin.test.Test import kotlin.test.assertEquals @@ -12,28 +12,28 @@ import kotlin.test.assertEquals internal class TestAsmOperationsSupport { @Test fun testUnaryOperationInvocation() { - val expression = RealField.mstInGroup { -bindSymbol("x") }.compile() + val expression = DoubleField.mstInGroup { -bindSymbol("x") }.compile() val res = expression("x" to 2.0) assertEquals(-2.0, res) } @Test fun testBinaryOperationInvocation() { - val expression = RealField.mstInGroup { -bindSymbol("x") + number(1.0) }.compile() + val expression = DoubleField.mstInGroup { -bindSymbol("x") + number(1.0) }.compile() val res = expression("x" to 2.0) assertEquals(-1.0, res) } @Test fun testConstProductInvocation() { - val res = RealField.mstInField { bindSymbol("x") * 2 }("x" to 2.0) + val res = DoubleField.mstInField { bindSymbol("x") * 2 }("x" to 2.0) assertEquals(4.0, res) } @Test fun testMultipleCalls() { val e = - RealField.mstInExtendedField { sin(bindSymbol("x")).pow(4) - 6 * bindSymbol("x") / tanh(bindSymbol("x")) } + DoubleField.mstInExtendedField { sin(bindSymbol("x")).pow(4) - 6 * bindSymbol("x") / tanh(bindSymbol("x")) } .compile() val r = Random(0) var s = 0.0 diff --git a/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmSpecialization.kt b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmSpecialization.kt index a214ca4ad..f485260c9 100644 --- a/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmSpecialization.kt +++ b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/asm/TestAsmSpecialization.kt @@ -2,50 +2,50 @@ package space.kscience.kmath.asm import space.kscience.kmath.ast.mstInField import space.kscience.kmath.expressions.invoke -import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.DoubleField import kotlin.test.Test import kotlin.test.assertEquals internal class TestAsmSpecialization { @Test fun testUnaryPlus() { - val expr = RealField.mstInField { unaryOperationFunction("+")(bindSymbol("x")) }.compile() + val expr = DoubleField.mstInField { unaryOperationFunction("+")(bindSymbol("x")) }.compile() assertEquals(2.0, expr("x" to 2.0)) } @Test fun testUnaryMinus() { - val expr = RealField.mstInField { unaryOperationFunction("-")(bindSymbol("x")) }.compile() + val expr = DoubleField.mstInField { unaryOperationFunction("-")(bindSymbol("x")) }.compile() assertEquals(-2.0, expr("x" to 2.0)) } @Test fun testAdd() { - val expr = RealField.mstInField { binaryOperationFunction("+")(bindSymbol("x"), bindSymbol("x")) }.compile() + val expr = DoubleField.mstInField { binaryOperationFunction("+")(bindSymbol("x"), bindSymbol("x")) }.compile() assertEquals(4.0, expr("x" to 2.0)) } @Test fun testSine() { - val expr = RealField.mstInField { unaryOperationFunction("sin")(bindSymbol("x")) }.compile() + val expr = DoubleField.mstInField { unaryOperationFunction("sin")(bindSymbol("x")) }.compile() assertEquals(0.0, expr("x" to 0.0)) } @Test fun testMinus() { - val expr = RealField.mstInField { binaryOperationFunction("-")(bindSymbol("x"), bindSymbol("x")) }.compile() + val expr = DoubleField.mstInField { binaryOperationFunction("-")(bindSymbol("x"), bindSymbol("x")) }.compile() assertEquals(0.0, expr("x" to 2.0)) } @Test fun testDivide() { - val expr = RealField.mstInField { binaryOperationFunction("/")(bindSymbol("x"), bindSymbol("x")) }.compile() + val expr = DoubleField.mstInField { binaryOperationFunction("/")(bindSymbol("x"), bindSymbol("x")) }.compile() assertEquals(1.0, expr("x" to 2.0)) } @Test fun testPower() { - val expr = RealField + val expr = DoubleField .mstInField { binaryOperationFunction("pow")(bindSymbol("x"), number(2)) } .compile() diff --git a/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/ast/ParserPrecedenceTest.kt b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/ast/ParserPrecedenceTest.kt index 7153f4bfc..1450cab84 100644 --- a/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/ast/ParserPrecedenceTest.kt +++ b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/ast/ParserPrecedenceTest.kt @@ -1,12 +1,12 @@ package space.kscience.kmath.ast +import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.operations.Field -import space.kscience.kmath.operations.RealField import kotlin.test.Test import kotlin.test.assertEquals internal class ParserPrecedenceTest { - private val f: Field = RealField + private val f: Field = DoubleField @Test fun test1(): Unit = assertEquals(6.0, f.evaluate("2*2+2".parseMath())) diff --git a/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/ast/ParserTest.kt b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/ast/ParserTest.kt index 6807d5c5d..3d5449043 100644 --- a/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/ast/ParserTest.kt +++ b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/ast/ParserTest.kt @@ -4,7 +4,7 @@ import space.kscience.kmath.complex.Complex import space.kscience.kmath.complex.ComplexField import space.kscience.kmath.expressions.invoke import space.kscience.kmath.operations.Algebra -import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.DoubleField import kotlin.test.Test import kotlin.test.assertEquals @@ -33,7 +33,7 @@ internal class ParserTest { @Test fun `evaluate MST with unary function`() { val mst = "sin(0)".parseMath() - val res = RealField.evaluate(mst) + val res = DoubleField.evaluate(mst) assertEquals(0.0, res) } diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt index 4e3a44a83..4efd8383b 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt @@ -4,8 +4,8 @@ import org.apache.commons.math3.linear.* import space.kscience.kmath.linear.* import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.nd.StructureND -import space.kscience.kmath.operations.RealField -import space.kscience.kmath.structures.RealBuffer +import space.kscience.kmath.operations.DoubleField +import space.kscience.kmath.structures.DoubleBuffer import kotlin.reflect.KClass import kotlin.reflect.cast @@ -34,15 +34,15 @@ public inline class CMVector(public val origin: RealVector) : Point { public fun RealVector.toPoint(): CMVector = CMVector(this) -public object CMLinearSpace : LinearSpace { - override val elementAlgebra: RealField get() = RealField +public object CMLinearSpace : LinearSpace { + override val elementAlgebra: DoubleField get() = DoubleField public override fun buildMatrix( rows: Int, columns: Int, - initializer: RealField.(i: Int, j: Int) -> Double, + initializer: DoubleField.(i: Int, j: Int) -> Double, ): CMMatrix { - val array = Array(rows) { i -> DoubleArray(columns) { j -> RealField.initializer(i, j) } } + val array = Array(rows) { i -> DoubleArray(columns) { j -> DoubleField.initializer(i, j) } } return CMMatrix(Array2DRowRealMatrix(array)) } @@ -64,8 +64,8 @@ public object CMLinearSpace : LinearSpace { internal fun RealMatrix.wrap(): CMMatrix = CMMatrix(this) internal fun RealVector.wrap(): CMVector = CMVector(this) - override fun buildVector(size: Int, initializer: RealField.(Int) -> Double): Point = - ArrayRealVector(DoubleArray(size) { RealField.initializer(it) }).wrap() + override fun buildVector(size: Int, initializer: DoubleField.(Int) -> Double): Point = + ArrayRealVector(DoubleArray(size) { DoubleField.initializer(it) }).wrap() override fun Matrix.plus(other: Matrix): CMMatrix = toCM().origin.add(other.toCM().origin).wrap() @@ -135,7 +135,7 @@ public object CMLinearSpace : LinearSpace { override val u: Matrix by lazy { CMMatrix(sv.u) } override val s: Matrix by lazy { CMMatrix(sv.s) } override val v: Matrix by lazy { CMMatrix(sv.v) } - override val singularValues: Point by lazy { RealBuffer(sv.singularValues) } + override val singularValues: Point by lazy { DoubleBuffer(sv.singularValues) } } else -> null }?.let(type::cast) diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/transform/Transformations.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/transform/Transformations.kt index aaee594ad..ad6b6d8cd 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/transform/Transformations.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/transform/Transformations.kt @@ -6,7 +6,6 @@ import kotlinx.coroutines.flow.map import org.apache.commons.math3.transform.* import space.kscience.kmath.complex.Complex import space.kscience.kmath.streaming.chunked -import space.kscience.kmath.streaming.spread import space.kscience.kmath.structures.* @@ -17,7 +16,7 @@ public object Transformations { private fun Buffer.toArray(): Array = Array(size) { org.apache.commons.math3.complex.Complex(get(it).re, get(it).im) } - private fun Buffer.asArray() = if (this is RealBuffer) { + private fun Buffer.asArray() = if (this is DoubleBuffer) { array } else { DoubleArray(size) { i -> get(i) } diff --git a/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/integration/IntegrationTest.kt b/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/integration/IntegrationTest.kt index 3693d5796..d163203f7 100644 --- a/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/integration/IntegrationTest.kt +++ b/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/integration/IntegrationTest.kt @@ -3,7 +3,7 @@ package space.kscience.kmath.commons.integration import org.junit.jupiter.api.Test import space.kscience.kmath.integration.integrate import space.kscience.kmath.misc.UnstableKMathAPI -import space.kscience.kmath.operations.RealField.sin +import space.kscience.kmath.operations.DoubleField.sin import kotlin.math.PI import kotlin.math.abs import kotlin.test.assertTrue diff --git a/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/ComplexFieldND.kt b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/ComplexFieldND.kt index 382410e45..e16962da7 100644 --- a/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/ComplexFieldND.kt +++ b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/ComplexFieldND.kt @@ -34,15 +34,15 @@ public class ComplexFieldND( // @Suppress("OVERRIDE_BY_INLINE") // override inline fun map( // arg: AbstractNDBuffer, -// transform: RealField.(Double) -> Double, +// transform: DoubleField.(Double) -> Double, // ): RealNDElement { // check(arg) -// val array = RealBuffer(arg.strides.linearSize) { offset -> RealField.transform(arg.buffer[offset]) } +// val array = RealBuffer(arg.strides.linearSize) { offset -> DoubleField.transform(arg.buffer[offset]) } // return BufferedNDFieldElement(this, array) // } // // @Suppress("OVERRIDE_BY_INLINE") -// override inline fun produce(initializer: RealField.(IntArray) -> Double): RealNDElement { +// override inline fun produce(initializer: DoubleField.(IntArray) -> Double): RealNDElement { // val array = RealBuffer(strides.linearSize) { offset -> elementContext.initializer(strides.index(offset)) } // return BufferedNDFieldElement(this, array) // } @@ -50,7 +50,7 @@ public class ComplexFieldND( // @Suppress("OVERRIDE_BY_INLINE") // override inline fun mapIndexed( // arg: AbstractNDBuffer, -// transform: RealField.(index: IntArray, Double) -> Double, +// transform: DoubleField.(index: IntArray, Double) -> Double, // ): RealNDElement { // check(arg) // return BufferedNDFieldElement( @@ -67,7 +67,7 @@ public class ComplexFieldND( // override inline fun combine( // a: AbstractNDBuffer, // b: AbstractNDBuffer, -// transform: RealField.(Double, Double) -> Double, +// transform: DoubleField.(Double, Double) -> Double, // ): RealNDElement { // check(a, b) // val buffer = RealBuffer(strides.linearSize) { offset -> diff --git a/kmath-core/api/kmath-core.api b/kmath-core/api/kmath-core.api index 2fb28d73a..8be9ff115 100644 --- a/kmath-core/api/kmath-core.api +++ b/kmath-core/api/kmath-core.api @@ -825,6 +825,78 @@ public final class space/kscience/kmath/nd/DefaultStrides$Companion { public final fun invoke ([I)Lspace/kscience/kmath/nd/Strides; } +public final class space/kscience/kmath/nd/DoubleFieldND : space/kscience/kmath/nd/BufferedFieldND, space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/NumbersAddOperations, space/kscience/kmath/operations/ScaleOperations { + public fun ([I)V + public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; + public fun acos (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; + public fun acosh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; + public fun asin (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; + public fun asinh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; + public fun atan (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; + public fun atanh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND; + public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; + public fun cos (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; + public fun cosh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; + public fun exp (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun getBuffer (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/structures/Buffer; + public fun getBuffer-Udx-57Q (Lspace/kscience/kmath/nd/StructureND;)[D + public synthetic fun getOne ()Ljava/lang/Object; + public fun getOne ()Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun getZero ()Ljava/lang/Object; + public fun getZero ()Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; + public fun ln (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND; + public fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND; + public synthetic fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public fun minus (Ljava/lang/Number;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public fun minus (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; + public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; + public synthetic fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public fun plus (Ljava/lang/Number;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public fun plus (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; + public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public fun pow (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; + public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public fun power (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDBuffer; + public fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND; + public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; + public fun scale (Lspace/kscience/kmath/nd/StructureND;D)Lspace/kscience/kmath/nd/StructureND; + public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; + public fun sin (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; + public fun sinh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; + public fun sqrt (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; + public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; + public fun tan (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; + public fun tanh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; +} + +public final class space/kscience/kmath/nd/DoubleFieldNDKt { + public static final fun nd (Lspace/kscience/kmath/operations/DoubleField;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final fun real (Lspace/kscience/kmath/nd/AlgebraND$Companion;[I)Lspace/kscience/kmath/nd/DoubleFieldND; +} + public abstract interface class space/kscience/kmath/nd/FieldND : space/kscience/kmath/nd/RingND, space/kscience/kmath/operations/Field, space/kscience/kmath/operations/ScaleOperations { public abstract fun div (Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public abstract fun div (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND; @@ -921,78 +993,6 @@ public class space/kscience/kmath/nd/NDBuffer : space/kscience/kmath/nd/Structur public fun toString ()Ljava/lang/String; } -public final class space/kscience/kmath/nd/RealFieldND : space/kscience/kmath/nd/BufferedFieldND, space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/NumbersAddOperations, space/kscience/kmath/operations/ScaleOperations { - public fun ([I)V - public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; - public fun acos (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun acosh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; - public fun asin (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun asinh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; - public fun atan (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun atanh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; - public fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND; - public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; - public fun cos (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun cosh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; - public fun exp (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun getBuffer (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/structures/Buffer; - public fun getBuffer-LGjt3BI (Lspace/kscience/kmath/nd/StructureND;)[D - public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; - public fun ln (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; - public fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND; - public fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND; - public synthetic fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Ljava/lang/Number;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; - public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun minus (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; - public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; - public synthetic fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Ljava/lang/Number;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; - public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun plus (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; - public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun pow (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; - public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun power (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDBuffer; - public fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND; - public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; - public fun scale (Lspace/kscience/kmath/nd/StructureND;D)Lspace/kscience/kmath/nd/StructureND; - public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; - public fun sin (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun sinh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun sqrt (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; - public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; - public fun tan (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; - public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun tanh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; - public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; -} - -public final class space/kscience/kmath/nd/RealFieldNDKt { - public static final fun nd (Lspace/kscience/kmath/operations/RealField;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun real (Lspace/kscience/kmath/nd/AlgebraND$Companion;[I)Lspace/kscience/kmath/nd/RealFieldND; -} - public abstract interface class space/kscience/kmath/nd/RingND : space/kscience/kmath/nd/GroupND, space/kscience/kmath/operations/Ring { public static final field Companion Lspace/kscience/kmath/nd/RingND$Companion; public abstract fun multiply (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; @@ -1338,6 +1338,92 @@ public final class space/kscience/kmath/operations/ByteRing : space/kscience/kma public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; } +public final class space/kscience/kmath/operations/DoubleField : space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/Norm, space/kscience/kmath/operations/ScaleOperations { + public static final field INSTANCE Lspace/kscience/kmath/operations/DoubleField; + public fun acos (D)Ljava/lang/Double; + public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; + public fun acosh (D)Ljava/lang/Double; + public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; + public fun add (DD)Ljava/lang/Double; + public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun asin (D)Ljava/lang/Double; + public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; + public fun asinh (D)Ljava/lang/Double; + public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; + public fun atan (D)Ljava/lang/Double; + public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; + public fun atanh (D)Ljava/lang/Double; + public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; + public fun binaryOperation (Ljava/lang/String;DD)Ljava/lang/Double; + public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public fun bindSymbol (Ljava/lang/String;)Ljava/lang/Double; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun cos (D)Ljava/lang/Double; + public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; + public fun cosh (D)Ljava/lang/Double; + public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; + public fun div (DD)Ljava/lang/Double; + public fun div (DLjava/lang/Number;)Ljava/lang/Double; + public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun divide (DD)Ljava/lang/Double; + public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun exp (D)Ljava/lang/Double; + public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; + public fun getOne ()Ljava/lang/Double; + public synthetic fun getOne ()Ljava/lang/Object; + public fun getZero ()Ljava/lang/Double; + public synthetic fun getZero ()Ljava/lang/Object; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;D)Ljava/lang/Double; + public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public fun ln (D)Ljava/lang/Double; + public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; + public fun minus (DD)Ljava/lang/Double; + public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun multiply (DD)Ljava/lang/Double; + public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun norm (D)Ljava/lang/Double; + public synthetic fun norm (Ljava/lang/Object;)Ljava/lang/Object; + public fun number (Ljava/lang/Number;)Ljava/lang/Double; + public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; + public fun plus (DD)Ljava/lang/Double; + public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun pow (DLjava/lang/Number;)Ljava/lang/Double; + public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public fun power (DLjava/lang/Number;)Ljava/lang/Double; + public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public fun rightSideNumberOperation (Ljava/lang/String;DLjava/lang/Number;)Ljava/lang/Double; + public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public fun scale (DD)Ljava/lang/Double; + public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; + public fun sin (D)Ljava/lang/Double; + public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; + public fun sinh (D)Ljava/lang/Double; + public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; + public fun sqrt (D)Ljava/lang/Double; + public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; + public fun tan (D)Ljava/lang/Double; + public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; + public fun tanh (D)Ljava/lang/Double; + public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; + public fun times (DD)Ljava/lang/Double; + public fun times (DLjava/lang/Number;)Ljava/lang/Double; + public fun times (Ljava/lang/Number;D)Ljava/lang/Double; + public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun unaryMinus (D)Ljava/lang/Double; + public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; + public fun unaryOperation (Ljava/lang/String;D)Ljava/lang/Double; + public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public fun unaryPlus (D)Ljava/lang/Double; + public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; +} + public abstract interface class space/kscience/kmath/operations/ExponentialOperations : space/kscience/kmath/operations/Algebra { public static final field ACOSH_OPERATION Ljava/lang/String; public static final field ASINH_OPERATION Ljava/lang/String; @@ -1877,92 +1963,6 @@ public final class space/kscience/kmath/operations/PowerOperations$DefaultImpls public static fun unaryOperationFunction (Lspace/kscience/kmath/operations/PowerOperations;Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } -public final class space/kscience/kmath/operations/RealField : space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/Norm, space/kscience/kmath/operations/ScaleOperations { - public static final field INSTANCE Lspace/kscience/kmath/operations/RealField; - public fun acos (D)Ljava/lang/Double; - public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; - public fun acosh (D)Ljava/lang/Double; - public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun add (DD)Ljava/lang/Double; - public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun asin (D)Ljava/lang/Double; - public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; - public fun asinh (D)Ljava/lang/Double; - public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun atan (D)Ljava/lang/Double; - public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; - public fun atanh (D)Ljava/lang/Double; - public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;DD)Ljava/lang/Double; - public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public fun bindSymbol (Ljava/lang/String;)Ljava/lang/Double; - public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; - public fun cos (D)Ljava/lang/Double; - public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; - public fun cosh (D)Ljava/lang/Double; - public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun div (DD)Ljava/lang/Double; - public fun div (DLjava/lang/Number;)Ljava/lang/Double; - public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide (DD)Ljava/lang/Double; - public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun exp (D)Ljava/lang/Double; - public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; - public fun getOne ()Ljava/lang/Double; - public synthetic fun getOne ()Ljava/lang/Object; - public fun getZero ()Ljava/lang/Double; - public synthetic fun getZero ()Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;D)Ljava/lang/Double; - public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public fun ln (D)Ljava/lang/Double; - public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (DD)Ljava/lang/Double; - public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply (DD)Ljava/lang/Double; - public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun norm (D)Ljava/lang/Double; - public synthetic fun norm (Ljava/lang/Object;)Ljava/lang/Object; - public fun number (Ljava/lang/Number;)Ljava/lang/Double; - public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun plus (DD)Ljava/lang/Double; - public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun pow (DLjava/lang/Number;)Ljava/lang/Double; - public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun power (DLjava/lang/Number;)Ljava/lang/Double; - public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;DLjava/lang/Number;)Ljava/lang/Double; - public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public fun scale (DD)Ljava/lang/Double; - public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; - public fun sin (D)Ljava/lang/Double; - public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; - public fun sinh (D)Ljava/lang/Double; - public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun sqrt (D)Ljava/lang/Double; - public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun tan (D)Ljava/lang/Double; - public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; - public fun tanh (D)Ljava/lang/Double; - public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun times (DD)Ljava/lang/Double; - public fun times (DLjava/lang/Number;)Ljava/lang/Double; - public fun times (Ljava/lang/Number;D)Ljava/lang/Double; - public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (D)Ljava/lang/Double; - public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;D)Ljava/lang/Double; - public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public fun unaryPlus (D)Ljava/lang/Double; - public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; -} - public abstract interface class space/kscience/kmath/operations/Ring : space/kscience/kmath/operations/Group, space/kscience/kmath/operations/RingOperations { public abstract fun getOne ()Ljava/lang/Object; } @@ -2135,6 +2135,193 @@ public final class space/kscience/kmath/structures/BufferOperationKt { public static final fun toList (Lspace/kscience/kmath/structures/Buffer;)Ljava/util/List; } +public final class space/kscience/kmath/structures/DoubleBuffer : space/kscience/kmath/structures/MutableBuffer { + public static final synthetic fun box-impl ([D)Lspace/kscience/kmath/structures/DoubleBuffer; + public static fun constructor-impl ([D)[D + public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z + public static fun contentEquals-impl ([DLspace/kscience/kmath/structures/Buffer;)Z + public synthetic fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; + public fun copy-Dv3HvWU ()[D + public static fun copy-Dv3HvWU ([D)[D + public fun equals (Ljava/lang/Object;)Z + public static fun equals-impl ([DLjava/lang/Object;)Z + public static final fun equals-impl0 ([D[D)Z + public fun get (I)Ljava/lang/Double; + public synthetic fun get (I)Ljava/lang/Object; + public static fun get-impl ([DI)Ljava/lang/Double; + public final fun getArray ()[D + public fun getSize ()I + public static fun getSize-impl ([D)I + public fun hashCode ()I + public static fun hashCode-impl ([D)I + public synthetic fun iterator ()Ljava/util/Iterator; + public fun iterator ()Lkotlin/collections/DoubleIterator; + public static fun iterator-impl ([D)Lkotlin/collections/DoubleIterator; + public fun set (ID)V + public synthetic fun set (ILjava/lang/Object;)V + public static fun set-impl ([DID)V + public fun toString ()Ljava/lang/String; + public static fun toString-impl ([D)Ljava/lang/String; + public final synthetic fun unbox-impl ()[D +} + +public final class space/kscience/kmath/structures/DoubleBufferField : space/kscience/kmath/operations/ExtendedField { + public fun (I)V + public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; + public fun acos-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; + public fun acosh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun add-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; + public fun asin-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; + public fun asinh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; + public fun atan-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; + public fun atanh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/structures/Buffer; + public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; + public fun cos-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; + public fun cosh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun div (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public fun div (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun divide-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; + public fun exp-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun getOne ()Ljava/lang/Object; + public fun getOne ()Lspace/kscience/kmath/structures/Buffer; + public final fun getSize ()I + public synthetic fun getZero ()Ljava/lang/Object; + public fun getZero ()Lspace/kscience/kmath/structures/Buffer; + public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; + public fun ln-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun minus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun multiply-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun plus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public fun pow (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public fun power-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)[D + public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; + public fun scale-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;D)[D + public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; + public fun sin-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; + public fun sinh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; + public fun sqrt (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; + public fun tan-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; + public fun tanh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; + public fun times (Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun times (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public fun times (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; + public fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; + public fun unaryPlus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; +} + +public final class space/kscience/kmath/structures/DoubleBufferFieldOperations : space/kscience/kmath/operations/ExtendedFieldOperations { + public static final field INSTANCE Lspace/kscience/kmath/structures/DoubleBufferFieldOperations; + public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; + public fun acos-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; + public fun acosh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun add-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; + public fun asin-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; + public fun asinh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; + public fun atan-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; + public fun atanh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; + public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; + public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/structures/Buffer; + public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; + public fun cos-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; + public fun cosh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun div (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun divide-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; + public fun exp-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; + public fun ln-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun minus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun multiply-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun plus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public fun pow (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; + public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; + public fun power-CZ9oacQ (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)[D + public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; + public fun sin-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; + public fun sinh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; + public fun sqrt (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; + public fun tan-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; + public fun tanh-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun times (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; + public fun unaryMinus-Udx-57Q (Lspace/kscience/kmath/structures/Buffer;)[D + public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; + public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; + public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; + public fun unaryPlus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; +} + +public final class space/kscience/kmath/structures/DoubleBufferKt { + public static final fun DoubleBuffer (ILkotlin/jvm/functions/Function1;)[D + public static final fun DoubleBuffer ([D)[D + public static final fun asBuffer ([D)[D + public static final fun contentEquals-2c9zdjM ([D[D)Z + public static final fun toDoubleArray (Lspace/kscience/kmath/structures/Buffer;)[D +} + public abstract interface class space/kscience/kmath/structures/FlaggedBuffer : space/kscience/kmath/structures/Buffer { public abstract fun getFlag (I)B } @@ -2144,13 +2331,13 @@ public final class space/kscience/kmath/structures/FlaggedBuffer$DefaultImpls { } public final class space/kscience/kmath/structures/FlaggedBufferKt { - public static final fun forEachValid (Lspace/kscience/kmath/structures/FlaggedRealBuffer;Lkotlin/jvm/functions/Function1;)V + public static final fun forEachValid (Lspace/kscience/kmath/structures/FlaggedDoubleBuffer;Lkotlin/jvm/functions/Function1;)V public static final fun hasFlag (Lspace/kscience/kmath/structures/FlaggedBuffer;ILspace/kscience/kmath/structures/ValueFlag;)Z public static final fun isMissing (Lspace/kscience/kmath/structures/FlaggedBuffer;I)Z public static final fun isValid (Lspace/kscience/kmath/structures/FlaggedBuffer;I)Z } -public final class space/kscience/kmath/structures/FlaggedRealBuffer : space/kscience/kmath/structures/Buffer, space/kscience/kmath/structures/FlaggedBuffer { +public final class space/kscience/kmath/structures/FlaggedDoubleBuffer : space/kscience/kmath/structures/Buffer, space/kscience/kmath/structures/FlaggedBuffer { public fun ([D[B)V public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z public fun get (I)Ljava/lang/Double; @@ -2317,10 +2504,10 @@ public abstract interface class space/kscience/kmath/structures/MutableBuffer : public final class space/kscience/kmath/structures/MutableBuffer$Companion { public final fun auto (Lkotlin/reflect/KClass;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/MutableBuffer; public final fun boxing (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/MutableBuffer; + public final fun double-CZ9oacQ (ILkotlin/jvm/functions/Function1;)[D public final fun float-YxruXGw (ILkotlin/jvm/functions/Function1;)[F public final fun int-Ye6GY2U (ILkotlin/jvm/functions/Function1;)[I public final fun long-BuQOeTY (ILkotlin/jvm/functions/Function1;)[J - public final fun real-8hrHhI4 (ILkotlin/jvm/functions/Function1;)[D public final fun short-1yRgbGw (ILkotlin/jvm/functions/Function1;)[S } @@ -2388,193 +2575,6 @@ public final class space/kscience/kmath/structures/ReadOnlyBuffer : space/kscien public final synthetic fun unbox-impl ()Lspace/kscience/kmath/structures/MutableBuffer; } -public final class space/kscience/kmath/structures/RealBuffer : space/kscience/kmath/structures/MutableBuffer { - public static final synthetic fun box-impl ([D)Lspace/kscience/kmath/structures/RealBuffer; - public static fun constructor-impl ([D)[D - public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl ([DLspace/kscience/kmath/structures/Buffer;)Z - public synthetic fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; - public fun copy-88GwAag ()[D - public static fun copy-88GwAag ([D)[D - public fun equals (Ljava/lang/Object;)Z - public static fun equals-impl ([DLjava/lang/Object;)Z - public static final fun equals-impl0 ([D[D)Z - public fun get (I)Ljava/lang/Double; - public synthetic fun get (I)Ljava/lang/Object; - public static fun get-impl ([DI)Ljava/lang/Double; - public final fun getArray ()[D - public fun getSize ()I - public static fun getSize-impl ([D)I - public fun hashCode ()I - public static fun hashCode-impl ([D)I - public synthetic fun iterator ()Ljava/util/Iterator; - public fun iterator ()Lkotlin/collections/DoubleIterator; - public static fun iterator-impl ([D)Lkotlin/collections/DoubleIterator; - public fun set (ID)V - public synthetic fun set (ILjava/lang/Object;)V - public static fun set-impl ([DID)V - public fun toString ()Ljava/lang/String; - public static fun toString-impl ([D)Ljava/lang/String; - public final synthetic fun unbox-impl ()[D -} - -public final class space/kscience/kmath/structures/RealBufferField : space/kscience/kmath/operations/ExtendedField { - public fun (I)V - public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; - public fun acos-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun acosh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; - public fun asin-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun asinh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; - public fun atan-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun atanh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; - public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; - public fun cos-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun cosh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; - public fun div (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; - public fun exp-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lspace/kscience/kmath/structures/Buffer; - public final fun getSize ()I - public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lspace/kscience/kmath/structures/Buffer; - public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; - public fun ln-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun pow (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun power-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)[D - public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun rightSideNumberOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; - public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; - public fun scale-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;D)[D - public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; - public fun sin-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun sinh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun sqrt (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; - public fun tan-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun tanh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Ljava/lang/Number;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; - public fun times (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; -} - -public final class space/kscience/kmath/structures/RealBufferFieldOperations : space/kscience/kmath/operations/ExtendedFieldOperations { - public static final field INSTANCE Lspace/kscience/kmath/structures/RealBufferFieldOperations; - public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; - public fun acos-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun acosh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun add-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; - public fun asin-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun asinh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; - public fun atan-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun atanh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun binaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; - public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; - public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; - public fun cos-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun cosh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun div (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun divide-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; - public fun exp-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; - public fun ln-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun minus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun multiply-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun plus (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun pow (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun power-8hrHhI4 (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Number;)[D - public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; - public fun sin-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun sinh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; - public fun sqrt (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; - public fun tan-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun tanh-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun times (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryMinus-LGjt3BI (Lspace/kscience/kmath/structures/Buffer;)[D - public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryOperation (Ljava/lang/String;Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; - public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; - public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object; - public fun unaryPlus (Lspace/kscience/kmath/structures/Buffer;)Lspace/kscience/kmath/structures/Buffer; -} - -public final class space/kscience/kmath/structures/RealBufferKt { - public static final fun RealBuffer (ILkotlin/jvm/functions/Function1;)[D - public static final fun RealBuffer ([D)[D - public static final fun asBuffer ([D)[D - public static final fun contentEquals-2uVC2J0 ([D[D)Z - public static final fun toDoubleArray (Lspace/kscience/kmath/structures/Buffer;)[D -} - public final class space/kscience/kmath/structures/ShortBuffer : space/kscience/kmath/structures/MutableBuffer { public static final synthetic fun box-impl ([S)Lspace/kscience/kmath/structures/ShortBuffer; public static fun constructor-impl ([S)[S diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/RealDomain.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/DoubleDomain.kt similarity index 95% rename from kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/RealDomain.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/DoubleDomain.kt index c20cbfec1..057a4a344 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/RealDomain.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/DoubleDomain.kt @@ -23,7 +23,7 @@ import space.kscience.kmath.misc.UnstableKMathAPI * @author Alexander Nozik */ @UnstableKMathAPI -public interface RealDomain : Domain { +public interface DoubleDomain : Domain { /** * Global lower edge diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/HyperSquareDomain.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/HyperSquareDomain.kt index c948f8672..a15d04b4c 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/HyperSquareDomain.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/HyperSquareDomain.kt @@ -27,7 +27,7 @@ import space.kscience.kmath.structures.indices * @author Alexander Nozik */ @UnstableKMathAPI -public class HyperSquareDomain(private val lower: Buffer, private val upper: Buffer) : RealDomain { +public class HyperSquareDomain(private val lower: Buffer, private val upper: Buffer) : DoubleDomain { public override val dimension: Int get() = lower.size public override operator fun contains(point: Point): Boolean = point.indices.all { i -> diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/UnconstrainedDomain.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/UnconstrainedDomain.kt index 002caac50..79f33fe05 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/UnconstrainedDomain.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/UnconstrainedDomain.kt @@ -19,7 +19,7 @@ import space.kscience.kmath.linear.Point import space.kscience.kmath.misc.UnstableKMathAPI @UnstableKMathAPI -public class UnconstrainedDomain(public override val dimension: Int) : RealDomain { +public class UnconstrainedDomain(public override val dimension: Int) : DoubleDomain { public override operator fun contains(point: Point): Boolean = true public override fun getLowerBound(num: Int): Double = Double.NEGATIVE_INFINITY diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/UnivariateDomain.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/UnivariateDomain.kt index d20349960..6f737bd38 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/UnivariateDomain.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/UnivariateDomain.kt @@ -4,7 +4,7 @@ import space.kscience.kmath.linear.Point import space.kscience.kmath.misc.UnstableKMathAPI @UnstableKMathAPI -public inline class UnivariateDomain(public val range: ClosedFloatingPointRange) : RealDomain { +public inline class UnivariateDomain(public val range: ClosedFloatingPointRange) : DoubleDomain { public override val dimension: Int get() = 1 public operator fun contains(d: Double): Boolean = range.contains(d) diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SimpleAutoDiff.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SimpleAutoDiff.kt index 4b5b3311e..4b0d402ed 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SimpleAutoDiff.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SimpleAutoDiff.kt @@ -198,7 +198,7 @@ public open class SimpleAutoDiffField>( * Example: * ``` * val x by symbol // define variable(s) and their values - * val y = RealField.withAutoDiff() { sqr(x) + 5 * x + 3 } // write formulate in deriv context + * val y = DoubleField.withAutoDiff() { sqr(x) + 5 * x + 3 } // write formulate in deriv context * assertEquals(17.0, y.x) // the value of result (y) * assertEquals(9.0, x.d) // dy/dx * ``` diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt index e8c7d119b..6a587270b 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt @@ -5,7 +5,7 @@ import space.kscience.kmath.nd.* import space.kscience.kmath.operations.* import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.BufferFactory -import space.kscience.kmath.structures.RealBuffer +import space.kscience.kmath.structures.DoubleBuffer import kotlin.reflect.KClass /** @@ -176,7 +176,7 @@ public interface LinearSpace> { bufferFactory: BufferFactory = Buffer.Companion::boxing, ): LinearSpace = BufferedLinearSpace(algebra, bufferFactory) - public val real: LinearSpace = buffered(RealField, ::RealBuffer) + public val real: LinearSpace = buffered(DoubleField, ::DoubleBuffer) /** * Automatic buffered matrix, unboxed if it is possible diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LupDecomposition.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LupDecomposition.kt index eed50ec28..7a6495638 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LupDecomposition.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LupDecomposition.kt @@ -4,9 +4,9 @@ import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.nd.getFeature import space.kscience.kmath.operations.* import space.kscience.kmath.structures.BufferAccessor2D +import space.kscience.kmath.structures.DoubleBuffer import space.kscience.kmath.structures.MutableBuffer import space.kscience.kmath.structures.MutableBufferFactory -import space.kscience.kmath.structures.RealBuffer /** * Common implementation of [LupDecompositionFeature]. @@ -151,8 +151,8 @@ public inline fun > LinearSpace>.lup( noinline checkSingular: (T) -> Boolean, ): LupDecomposition = lup(MutableBuffer.Companion::auto, matrix, checkSingular) -public fun LinearSpace.lup(matrix: Matrix): LupDecomposition = - lup(::RealBuffer, matrix) { it < 1e-11 } +public fun LinearSpace.lup(matrix: Matrix): LupDecomposition = + lup(::DoubleBuffer, matrix) { it < 1e-11 } public fun LupDecomposition.solveWithLup( factory: MutableBufferFactory, @@ -228,9 +228,9 @@ public inline fun > LinearSpace>.inverseWi @OptIn(UnstableKMathAPI::class) -public fun LinearSpace.solveWithLup(a: Matrix, b: Matrix): Matrix { +public fun LinearSpace.solveWithLup(a: Matrix, b: Matrix): Matrix { // Use existing decomposition if it is provided by matrix - val bufferFactory: MutableBufferFactory = ::RealBuffer + val bufferFactory: MutableBufferFactory = ::DoubleBuffer val decomposition: LupDecomposition = a.getFeature() ?: lup(bufferFactory, a) { it < 1e-11 } return decomposition.solveWithLup(bufferFactory, b) } @@ -238,5 +238,5 @@ public fun LinearSpace.solveWithLup(a: Matrix, b: Mat /** * Inverses a square matrix using LUP decomposition. Non square matrix will throw a error. */ -public fun LinearSpace.inverseWithLup(matrix: Matrix): Matrix = +public fun LinearSpace.inverseWithLup(matrix: Matrix): Matrix = solveWithLup(matrix, one(matrix.rowNum, matrix.colNum)) \ No newline at end of file diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferAlgebraND.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferAlgebraND.kt index cef43d06f..b81eb9519 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferAlgebraND.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferAlgebraND.kt @@ -123,7 +123,7 @@ public inline fun > AlgebraND.Companion.auto( field: A, vararg shape: Int, ): FieldND = when (field) { - RealField -> RealFieldND(shape) as FieldND + DoubleField -> DoubleFieldND(shape) as FieldND else -> BufferedFieldND(shape, field, Buffer.Companion::auto) } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/RealFieldND.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/DoubleFieldND.kt similarity index 67% rename from kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/RealFieldND.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/DoubleFieldND.kt index 643eb2eb0..a7a9d8935 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/RealFieldND.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/DoubleFieldND.kt @@ -1,18 +1,18 @@ package space.kscience.kmath.nd import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.operations.ExtendedField import space.kscience.kmath.operations.NumbersAddOperations -import space.kscience.kmath.operations.RealField import space.kscience.kmath.operations.ScaleOperations -import space.kscience.kmath.structures.RealBuffer +import space.kscience.kmath.structures.DoubleBuffer import kotlin.contracts.InvocationKind import kotlin.contracts.contract @OptIn(UnstableKMathAPI::class) -public class RealFieldND( +public class DoubleFieldND( shape: IntArray, -) : BufferedFieldND(shape, RealField, ::RealBuffer), +) : BufferedFieldND(shape, DoubleField, ::DoubleBuffer), NumbersAddOperations>, ScaleOperations>, ExtendedField> { @@ -25,40 +25,40 @@ public class RealFieldND( return produce { d } } - override val StructureND.buffer: RealBuffer + override val StructureND.buffer: DoubleBuffer get() = when { - !shape.contentEquals(this@RealFieldND.shape) -> throw ShapeMismatchException( - this@RealFieldND.shape, + !shape.contentEquals(this@DoubleFieldND.shape) -> throw ShapeMismatchException( + this@DoubleFieldND.shape, shape ) - this is NDBuffer && this.strides == this@RealFieldND.strides -> this.buffer as RealBuffer - else -> RealBuffer(strides.linearSize) { offset -> get(strides.index(offset)) } + this is NDBuffer && this.strides == this@DoubleFieldND.strides -> this.buffer as DoubleBuffer + else -> DoubleBuffer(strides.linearSize) { offset -> get(strides.index(offset)) } } @Suppress("OVERRIDE_BY_INLINE") override inline fun StructureND.map( - transform: RealField.(Double) -> Double, + transform: DoubleField.(Double) -> Double, ): NDBuffer { - val buffer = RealBuffer(strides.linearSize) { offset -> RealField.transform(buffer.array[offset]) } + val buffer = DoubleBuffer(strides.linearSize) { offset -> DoubleField.transform(buffer.array[offset]) } return NDBuffer(strides, buffer) } @Suppress("OVERRIDE_BY_INLINE") - override inline fun produce(initializer: RealField.(IntArray) -> Double): NDBuffer { + override inline fun produce(initializer: DoubleField.(IntArray) -> Double): NDBuffer { val array = DoubleArray(strides.linearSize) { offset -> val index = strides.index(offset) - RealField.initializer(index) + DoubleField.initializer(index) } - return NDBuffer(strides, RealBuffer(array)) + return NDBuffer(strides, DoubleBuffer(array)) } @Suppress("OVERRIDE_BY_INLINE") override inline fun StructureND.mapIndexed( - transform: RealField.(index: IntArray, Double) -> Double, + transform: DoubleField.(index: IntArray, Double) -> Double, ): NDBuffer = NDBuffer( strides, - buffer = RealBuffer(strides.linearSize) { offset -> - RealField.transform( + buffer = DoubleBuffer(strides.linearSize) { offset -> + DoubleField.transform( strides.index(offset), buffer.array[offset] ) @@ -68,10 +68,10 @@ public class RealFieldND( override inline fun combine( a: StructureND, b: StructureND, - transform: RealField.(Double, Double) -> Double, + transform: DoubleField.(Double, Double) -> Double, ): NDBuffer { - val buffer = RealBuffer(strides.linearSize) { offset -> - RealField.transform(a.buffer.array[offset], b.buffer.array[offset]) + val buffer = DoubleBuffer(strides.linearSize) { offset -> + DoubleField.transform(a.buffer.array[offset], b.buffer.array[offset]) } return NDBuffer(strides, buffer) } @@ -99,12 +99,12 @@ public class RealFieldND( override fun atanh(arg: StructureND): NDBuffer = arg.map { atanh(it) } } -public fun AlgebraND.Companion.real(vararg shape: Int): RealFieldND = RealFieldND(shape) +public fun AlgebraND.Companion.real(vararg shape: Int): DoubleFieldND = DoubleFieldND(shape) /** * Produce a context for n-dimensional operations inside this real field */ -public inline fun RealField.nd(vararg shape: Int, action: RealFieldND.() -> R): R { +public inline fun DoubleField.nd(vararg shape: Int, action: DoubleFieldND.() -> R): R { contract { callsInPlace(action, InvocationKind.EXACTLY_ONCE) } - return RealFieldND(shape).run(action) + return DoubleFieldND(shape).run(action) } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/numbers.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/numbers.kt index 4841e78d6..0101b058a 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/numbers.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/numbers.kt @@ -55,7 +55,7 @@ public interface ExtendedField : ExtendedFieldOperations, Field, Numeri * A field for [Double] without boxing. Does not produce appropriate field element. */ @Suppress("EXTENSION_SHADOWED_BY_MEMBER", "OVERRIDE_BY_INLINE", "NOTHING_TO_INLINE") -public object RealField : ExtendedField, Norm, ScaleOperations { +public object DoubleField : ExtendedField, Norm, ScaleOperations { public override val zero: Double = 0.0 public override val one: Double = 1.0 diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt index 1d40a2f2e..1c64bfcec 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt @@ -53,14 +53,14 @@ public interface Buffer { /** * Creates a [Buffer] of given [type]. If the type is primitive, specialized buffers are used ([IntBuffer], - * [RealBuffer], etc.), [ListBuffer] is returned otherwise. + * [DoubleBuffer], etc.), [ListBuffer] is returned otherwise. * * The [size] is specified, and each element is calculated by calling the specified [initializer] function. */ @Suppress("UNCHECKED_CAST") public inline fun auto(type: KClass, size: Int, initializer: (Int) -> T): Buffer = when (type) { - Double::class -> MutableBuffer.real(size) { initializer(it) as Double } as Buffer + Double::class -> MutableBuffer.double(size) { initializer(it) as Double } as Buffer Short::class -> MutableBuffer.short(size) { initializer(it) as Short } as Buffer Int::class -> MutableBuffer.int(size) { initializer(it) as Int } as Buffer Long::class -> MutableBuffer.long(size) { initializer(it) as Long } as Buffer @@ -70,7 +70,7 @@ public interface Buffer { /** * Creates a [Buffer] of given type [T]. If the type is primitive, specialized buffers are used ([IntBuffer], - * [RealBuffer], etc.), [ListBuffer] is returned otherwise. + * [DoubleBuffer], etc.), [ListBuffer] is returned otherwise. * * The [size] is specified, and each element is calculated by calling the specified [initializer] function. */ @@ -104,11 +104,11 @@ public interface MutableBuffer : Buffer { public companion object { /** - * Creates a [RealBuffer] with the specified [size], where each element is calculated by calling the specified + * Creates a [DoubleBuffer] with the specified [size], where each element is calculated by calling the specified * [initializer] function. */ - public inline fun real(size: Int, initializer: (Int) -> Double): RealBuffer = - RealBuffer(size, initializer) + public inline fun double(size: Int, initializer: (Int) -> Double): DoubleBuffer = + DoubleBuffer(size, initializer) /** * Creates a [ShortBuffer] with the specified [size], where each element is calculated by calling the specified @@ -148,14 +148,14 @@ public interface MutableBuffer : Buffer { /** * Creates a [MutableBuffer] of given [type]. If the type is primitive, specialized buffers are used - * ([IntBuffer], [RealBuffer], etc.), [ListBuffer] is returned otherwise. + * ([IntBuffer], [DoubleBuffer], etc.), [ListBuffer] is returned otherwise. * * The [size] is specified, and each element is calculated by calling the specified [initializer] function. */ @Suppress("UNCHECKED_CAST") public inline fun auto(type: KClass, size: Int, initializer: (Int) -> T): MutableBuffer = when (type) { - Double::class -> real(size) { initializer(it) as Double } as MutableBuffer + Double::class -> double(size) { initializer(it) as Double } as MutableBuffer Short::class -> short(size) { initializer(it) as Short } as MutableBuffer Int::class -> int(size) { initializer(it) as Int } as MutableBuffer Float::class -> float(size) { initializer(it) as Float } as MutableBuffer @@ -165,7 +165,7 @@ public interface MutableBuffer : Buffer { /** * Creates a [MutableBuffer] of given type [T]. If the type is primitive, specialized buffers are used - * ([IntBuffer], [RealBuffer], etc.), [ListBuffer] is returned otherwise. + * ([IntBuffer], [DoubleBuffer], etc.), [ListBuffer] is returned otherwise. * * The [size] is specified, and each element is calculated by calling the specified [initializer] function. */ diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBuffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/DoubleBuffer.kt similarity index 53% rename from kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBuffer.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/DoubleBuffer.kt index b56c03b76..0a23d31fe 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBuffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/DoubleBuffer.kt @@ -6,7 +6,7 @@ package space.kscience.kmath.structures * @property array the underlying array. */ @Suppress("OVERRIDE_BY_INLINE") -public inline class RealBuffer(public val array: DoubleArray) : MutableBuffer { +public inline class DoubleBuffer(public val array: DoubleArray) : MutableBuffer { override val size: Int get() = array.size override operator fun get(index: Int): Double = array[index] @@ -17,40 +17,40 @@ public inline class RealBuffer(public val array: DoubleArray) : MutableBuffer Double): RealBuffer = RealBuffer(DoubleArray(size) { init(it) }) +public inline fun DoubleBuffer(size: Int, init: (Int) -> Double): DoubleBuffer = DoubleBuffer(DoubleArray(size) { init(it) }) /** - * Returns a new [RealBuffer] of given elements. + * Returns a new [DoubleBuffer] of given elements. */ -public fun RealBuffer(vararg doubles: Double): RealBuffer = RealBuffer(doubles) +public fun DoubleBuffer(vararg doubles: Double): DoubleBuffer = DoubleBuffer(doubles) /** - * Simplified [RealBuffer] to array comparison + * Simplified [DoubleBuffer] to array comparison */ -public fun RealBuffer.contentEquals(vararg doubles: Double): Boolean = array.contentEquals(doubles) +public fun DoubleBuffer.contentEquals(vararg doubles: Double): Boolean = array.contentEquals(doubles) /** * Returns a new [DoubleArray] containing all of the elements of this [Buffer]. */ public fun Buffer.toDoubleArray(): DoubleArray = when (this) { - is RealBuffer -> array.copyOf() + is DoubleBuffer -> array.copyOf() else -> DoubleArray(size, ::get) } /** - * Returns [RealBuffer] over this array. + * Returns [DoubleBuffer] over this array. * * @receiver the array. * @return the new buffer. */ -public fun DoubleArray.asBuffer(): RealBuffer = RealBuffer(this) +public fun DoubleArray.asBuffer(): DoubleBuffer = DoubleBuffer(this) diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/DoubleBufferField.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/DoubleBufferField.kt new file mode 100644 index 000000000..4a85219ac --- /dev/null +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/DoubleBufferField.kt @@ -0,0 +1,272 @@ +package space.kscience.kmath.structures + +import space.kscience.kmath.operations.ExtendedField +import space.kscience.kmath.operations.ExtendedFieldOperations +import kotlin.math.* + +/** + * [ExtendedFieldOperations] over [DoubleBuffer]. + */ +public object DoubleBufferFieldOperations : ExtendedFieldOperations> { + override fun Buffer.unaryMinus(): DoubleBuffer = if (this is DoubleBuffer) { + DoubleBuffer(size) { -array[it] } + } else { + DoubleBuffer(size) { -get(it) } + } + + public override fun add(a: Buffer, b: Buffer): DoubleBuffer { + require(b.size == a.size) { + "The size of the first buffer ${a.size} should be the same as for second one: ${b.size} " + } + + return if (a is DoubleBuffer && b is DoubleBuffer) { + val aArray = a.array + val bArray = b.array + DoubleBuffer(DoubleArray(a.size) { aArray[it] + bArray[it] }) + } else DoubleBuffer(DoubleArray(a.size) { a[it] + b[it] }) + } +// +// public override fun multiply(a: Buffer, k: Number): RealBuffer { +// val kValue = k.toDouble() +// +// return if (a is RealBuffer) { +// val aArray = a.array +// RealBuffer(DoubleArray(a.size) { aArray[it] * kValue }) +// } else RealBuffer(DoubleArray(a.size) { a[it] * kValue }) +// } +// +// public override fun divide(a: Buffer, k: Number): RealBuffer { +// val kValue = k.toDouble() +// +// return if (a is RealBuffer) { +// val aArray = a.array +// RealBuffer(DoubleArray(a.size) { aArray[it] / kValue }) +// } else RealBuffer(DoubleArray(a.size) { a[it] / kValue }) +// } + + public override fun multiply(a: Buffer, b: Buffer): DoubleBuffer { + require(b.size == a.size) { + "The size of the first buffer ${a.size} should be the same as for second one: ${b.size} " + } + + return if (a is DoubleBuffer && b is DoubleBuffer) { + val aArray = a.array + val bArray = b.array + DoubleBuffer(DoubleArray(a.size) { aArray[it] * bArray[it] }) + } else + DoubleBuffer(DoubleArray(a.size) { a[it] * b[it] }) + } + + public override fun divide(a: Buffer, b: Buffer): DoubleBuffer { + require(b.size == a.size) { + "The size of the first buffer ${a.size} should be the same as for second one: ${b.size} " + } + + return if (a is DoubleBuffer && b is DoubleBuffer) { + val aArray = a.array + val bArray = b.array + DoubleBuffer(DoubleArray(a.size) { aArray[it] / bArray[it] }) + } else DoubleBuffer(DoubleArray(a.size) { a[it] / b[it] }) + } + + public override fun sin(arg: Buffer): DoubleBuffer = if (arg is DoubleBuffer) { + val array = arg.array + DoubleBuffer(DoubleArray(arg.size) { sin(array[it]) }) + } else DoubleBuffer(DoubleArray(arg.size) { sin(arg[it]) }) + + public override fun cos(arg: Buffer): DoubleBuffer = if (arg is DoubleBuffer) { + val array = arg.array + DoubleBuffer(DoubleArray(arg.size) { cos(array[it]) }) + } else DoubleBuffer(DoubleArray(arg.size) { cos(arg[it]) }) + + public override fun tan(arg: Buffer): DoubleBuffer = if (arg is DoubleBuffer) { + val array = arg.array + DoubleBuffer(DoubleArray(arg.size) { tan(array[it]) }) + } else DoubleBuffer(DoubleArray(arg.size) { tan(arg[it]) }) + + public override fun asin(arg: Buffer): DoubleBuffer = if (arg is DoubleBuffer) { + val array = arg.array + DoubleBuffer(DoubleArray(arg.size) { asin(array[it]) }) + } else + DoubleBuffer(DoubleArray(arg.size) { asin(arg[it]) }) + + public override fun acos(arg: Buffer): DoubleBuffer = if (arg is DoubleBuffer) { + val array = arg.array + DoubleBuffer(DoubleArray(arg.size) { acos(array[it]) }) + } else + DoubleBuffer(DoubleArray(arg.size) { acos(arg[it]) }) + + public override fun atan(arg: Buffer): DoubleBuffer = if (arg is DoubleBuffer) { + val array = arg.array + DoubleBuffer(DoubleArray(arg.size) { atan(array[it]) }) + } else + DoubleBuffer(DoubleArray(arg.size) { atan(arg[it]) }) + + public override fun sinh(arg: Buffer): DoubleBuffer = if (arg is DoubleBuffer) { + val array = arg.array + DoubleBuffer(DoubleArray(arg.size) { sinh(array[it]) }) + } else + DoubleBuffer(DoubleArray(arg.size) { sinh(arg[it]) }) + + public override fun cosh(arg: Buffer): DoubleBuffer = if (arg is DoubleBuffer) { + val array = arg.array + DoubleBuffer(DoubleArray(arg.size) { cosh(array[it]) }) + } else + DoubleBuffer(DoubleArray(arg.size) { cosh(arg[it]) }) + + public override fun tanh(arg: Buffer): DoubleBuffer = if (arg is DoubleBuffer) { + val array = arg.array + DoubleBuffer(DoubleArray(arg.size) { tanh(array[it]) }) + } else + DoubleBuffer(DoubleArray(arg.size) { tanh(arg[it]) }) + + public override fun asinh(arg: Buffer): DoubleBuffer = if (arg is DoubleBuffer) { + val array = arg.array + DoubleBuffer(DoubleArray(arg.size) { asinh(array[it]) }) + } else + DoubleBuffer(DoubleArray(arg.size) { asinh(arg[it]) }) + + public override fun acosh(arg: Buffer): DoubleBuffer = if (arg is DoubleBuffer) { + val array = arg.array + DoubleBuffer(DoubleArray(arg.size) { acosh(array[it]) }) + } else + DoubleBuffer(DoubleArray(arg.size) { acosh(arg[it]) }) + + public override fun atanh(arg: Buffer): DoubleBuffer = if (arg is DoubleBuffer) { + val array = arg.array + DoubleBuffer(DoubleArray(arg.size) { atanh(array[it]) }) + } else + DoubleBuffer(DoubleArray(arg.size) { atanh(arg[it]) }) + + public override fun power(arg: Buffer, pow: Number): DoubleBuffer = if (arg is DoubleBuffer) { + val array = arg.array + DoubleBuffer(DoubleArray(arg.size) { array[it].pow(pow.toDouble()) }) + } else + DoubleBuffer(DoubleArray(arg.size) { arg[it].pow(pow.toDouble()) }) + + public override fun exp(arg: Buffer): DoubleBuffer = if (arg is DoubleBuffer) { + val array = arg.array + DoubleBuffer(DoubleArray(arg.size) { exp(array[it]) }) + } else DoubleBuffer(DoubleArray(arg.size) { exp(arg[it]) }) + + public override fun ln(arg: Buffer): DoubleBuffer = if (arg is DoubleBuffer) { + val array = arg.array + DoubleBuffer(DoubleArray(arg.size) { ln(array[it]) }) + } else + DoubleBuffer(DoubleArray(arg.size) { ln(arg[it]) }) +} + +/** + * [ExtendedField] over [DoubleBuffer]. + * + * @property size the size of buffers to operate on. + */ +public class DoubleBufferField(public val size: Int) : ExtendedField> { + public override val zero: Buffer by lazy { DoubleBuffer(size) { 0.0 } } + public override val one: Buffer by lazy { DoubleBuffer(size) { 1.0 } } + + override fun number(value: Number): Buffer = DoubleBuffer(size) { value.toDouble() } + + override fun Buffer.unaryMinus(): Buffer = DoubleBufferFieldOperations.run { + -this@unaryMinus + } + + public override fun add(a: Buffer, b: Buffer): DoubleBuffer { + require(a.size == size) { "The buffer size ${a.size} does not match context size $size" } + return DoubleBufferFieldOperations.add(a, b) + } + + public override fun scale(a: Buffer, value: Double): DoubleBuffer { + require(a.size == size) { "The buffer size ${a.size} does not match context size $size" } + + return if (a is DoubleBuffer) { + val aArray = a.array + DoubleBuffer(DoubleArray(a.size) { aArray[it] * value }) + } else DoubleBuffer(DoubleArray(a.size) { a[it] * value }) + } + + public override fun multiply(a: Buffer, b: Buffer): DoubleBuffer { + require(a.size == size) { "The buffer size ${a.size} does not match context size $size" } + return DoubleBufferFieldOperations.multiply(a, b) + } + + public override fun divide(a: Buffer, b: Buffer): DoubleBuffer { + require(a.size == size) { "The buffer size ${a.size} does not match context size $size" } + return DoubleBufferFieldOperations.divide(a, b) + } + + public override fun sin(arg: Buffer): DoubleBuffer { + require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } + return DoubleBufferFieldOperations.sin(arg) + } + + public override fun cos(arg: Buffer): DoubleBuffer { + require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } + return DoubleBufferFieldOperations.cos(arg) + } + + public override fun tan(arg: Buffer): DoubleBuffer { + require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } + return DoubleBufferFieldOperations.tan(arg) + } + + public override fun asin(arg: Buffer): DoubleBuffer { + require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } + return DoubleBufferFieldOperations.asin(arg) + } + + public override fun acos(arg: Buffer): DoubleBuffer { + require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } + return DoubleBufferFieldOperations.acos(arg) + } + + public override fun atan(arg: Buffer): DoubleBuffer { + require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } + return DoubleBufferFieldOperations.atan(arg) + } + + public override fun sinh(arg: Buffer): DoubleBuffer { + require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } + return DoubleBufferFieldOperations.sinh(arg) + } + + public override fun cosh(arg: Buffer): DoubleBuffer { + require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } + return DoubleBufferFieldOperations.cosh(arg) + } + + public override fun tanh(arg: Buffer): DoubleBuffer { + require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } + return DoubleBufferFieldOperations.tanh(arg) + } + + public override fun asinh(arg: Buffer): DoubleBuffer { + require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } + return DoubleBufferFieldOperations.asinh(arg) + } + + public override fun acosh(arg: Buffer): DoubleBuffer { + require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } + return DoubleBufferFieldOperations.acosh(arg) + } + + public override fun atanh(arg: Buffer): DoubleBuffer { + require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } + return DoubleBufferFieldOperations.atanh(arg) + } + + public override fun power(arg: Buffer, pow: Number): DoubleBuffer { + require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } + return DoubleBufferFieldOperations.power(arg, pow) + } + + public override fun exp(arg: Buffer): DoubleBuffer { + require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } + return DoubleBufferFieldOperations.exp(arg) + } + + public override fun ln(arg: Buffer): DoubleBuffer { + require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } + return DoubleBufferFieldOperations.ln(arg) + } +} diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/FlaggedBuffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/FlaggedBuffer.kt index 3326c1491..670a0c175 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/FlaggedBuffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/FlaggedBuffer.kt @@ -48,7 +48,7 @@ public fun FlaggedBuffer<*>.isMissing(index: Int): Boolean = hasFlag(index, Valu /** * A real buffer which supports flags for each value like NaN or Missing */ -public class FlaggedRealBuffer(public val values: DoubleArray, public val flags: ByteArray) : FlaggedBuffer, +public class FlaggedDoubleBuffer(public val values: DoubleArray, public val flags: ByteArray) : FlaggedBuffer, Buffer { init { require(values.size == flags.size) { "Values and flags must have the same dimensions" } @@ -65,7 +65,7 @@ public class FlaggedRealBuffer(public val values: DoubleArray, public val flags: }.iterator() } -public inline fun FlaggedRealBuffer.forEachValid(block: (Double) -> Unit) { +public inline fun FlaggedDoubleBuffer.forEachValid(block: (Double) -> Unit) { indices .asSequence() .filter(::isValid) diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBufferField.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBufferField.kt deleted file mode 100644 index 2a03a36e3..000000000 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBufferField.kt +++ /dev/null @@ -1,272 +0,0 @@ -package space.kscience.kmath.structures - -import space.kscience.kmath.operations.ExtendedField -import space.kscience.kmath.operations.ExtendedFieldOperations -import kotlin.math.* - -/** - * [ExtendedFieldOperations] over [RealBuffer]. - */ -public object RealBufferFieldOperations : ExtendedFieldOperations> { - override fun Buffer.unaryMinus(): RealBuffer = if (this is RealBuffer) { - RealBuffer(size) { -array[it] } - } else { - RealBuffer(size) { -get(it) } - } - - public override fun add(a: Buffer, b: Buffer): RealBuffer { - require(b.size == a.size) { - "The size of the first buffer ${a.size} should be the same as for second one: ${b.size} " - } - - return if (a is RealBuffer && b is RealBuffer) { - val aArray = a.array - val bArray = b.array - RealBuffer(DoubleArray(a.size) { aArray[it] + bArray[it] }) - } else RealBuffer(DoubleArray(a.size) { a[it] + b[it] }) - } -// -// public override fun multiply(a: Buffer, k: Number): RealBuffer { -// val kValue = k.toDouble() -// -// return if (a is RealBuffer) { -// val aArray = a.array -// RealBuffer(DoubleArray(a.size) { aArray[it] * kValue }) -// } else RealBuffer(DoubleArray(a.size) { a[it] * kValue }) -// } -// -// public override fun divide(a: Buffer, k: Number): RealBuffer { -// val kValue = k.toDouble() -// -// return if (a is RealBuffer) { -// val aArray = a.array -// RealBuffer(DoubleArray(a.size) { aArray[it] / kValue }) -// } else RealBuffer(DoubleArray(a.size) { a[it] / kValue }) -// } - - public override fun multiply(a: Buffer, b: Buffer): RealBuffer { - require(b.size == a.size) { - "The size of the first buffer ${a.size} should be the same as for second one: ${b.size} " - } - - return if (a is RealBuffer && b is RealBuffer) { - val aArray = a.array - val bArray = b.array - RealBuffer(DoubleArray(a.size) { aArray[it] * bArray[it] }) - } else - RealBuffer(DoubleArray(a.size) { a[it] * b[it] }) - } - - public override fun divide(a: Buffer, b: Buffer): RealBuffer { - require(b.size == a.size) { - "The size of the first buffer ${a.size} should be the same as for second one: ${b.size} " - } - - return if (a is RealBuffer && b is RealBuffer) { - val aArray = a.array - val bArray = b.array - RealBuffer(DoubleArray(a.size) { aArray[it] / bArray[it] }) - } else RealBuffer(DoubleArray(a.size) { a[it] / b[it] }) - } - - public override fun sin(arg: Buffer): RealBuffer = if (arg is RealBuffer) { - val array = arg.array - RealBuffer(DoubleArray(arg.size) { sin(array[it]) }) - } else RealBuffer(DoubleArray(arg.size) { sin(arg[it]) }) - - public override fun cos(arg: Buffer): RealBuffer = if (arg is RealBuffer) { - val array = arg.array - RealBuffer(DoubleArray(arg.size) { cos(array[it]) }) - } else RealBuffer(DoubleArray(arg.size) { cos(arg[it]) }) - - public override fun tan(arg: Buffer): RealBuffer = if (arg is RealBuffer) { - val array = arg.array - RealBuffer(DoubleArray(arg.size) { tan(array[it]) }) - } else RealBuffer(DoubleArray(arg.size) { tan(arg[it]) }) - - public override fun asin(arg: Buffer): RealBuffer = if (arg is RealBuffer) { - val array = arg.array - RealBuffer(DoubleArray(arg.size) { asin(array[it]) }) - } else - RealBuffer(DoubleArray(arg.size) { asin(arg[it]) }) - - public override fun acos(arg: Buffer): RealBuffer = if (arg is RealBuffer) { - val array = arg.array - RealBuffer(DoubleArray(arg.size) { acos(array[it]) }) - } else - RealBuffer(DoubleArray(arg.size) { acos(arg[it]) }) - - public override fun atan(arg: Buffer): RealBuffer = if (arg is RealBuffer) { - val array = arg.array - RealBuffer(DoubleArray(arg.size) { atan(array[it]) }) - } else - RealBuffer(DoubleArray(arg.size) { atan(arg[it]) }) - - public override fun sinh(arg: Buffer): RealBuffer = if (arg is RealBuffer) { - val array = arg.array - RealBuffer(DoubleArray(arg.size) { sinh(array[it]) }) - } else - RealBuffer(DoubleArray(arg.size) { sinh(arg[it]) }) - - public override fun cosh(arg: Buffer): RealBuffer = if (arg is RealBuffer) { - val array = arg.array - RealBuffer(DoubleArray(arg.size) { cosh(array[it]) }) - } else - RealBuffer(DoubleArray(arg.size) { cosh(arg[it]) }) - - public override fun tanh(arg: Buffer): RealBuffer = if (arg is RealBuffer) { - val array = arg.array - RealBuffer(DoubleArray(arg.size) { tanh(array[it]) }) - } else - RealBuffer(DoubleArray(arg.size) { tanh(arg[it]) }) - - public override fun asinh(arg: Buffer): RealBuffer = if (arg is RealBuffer) { - val array = arg.array - RealBuffer(DoubleArray(arg.size) { asinh(array[it]) }) - } else - RealBuffer(DoubleArray(arg.size) { asinh(arg[it]) }) - - public override fun acosh(arg: Buffer): RealBuffer = if (arg is RealBuffer) { - val array = arg.array - RealBuffer(DoubleArray(arg.size) { acosh(array[it]) }) - } else - RealBuffer(DoubleArray(arg.size) { acosh(arg[it]) }) - - public override fun atanh(arg: Buffer): RealBuffer = if (arg is RealBuffer) { - val array = arg.array - RealBuffer(DoubleArray(arg.size) { atanh(array[it]) }) - } else - RealBuffer(DoubleArray(arg.size) { atanh(arg[it]) }) - - public override fun power(arg: Buffer, pow: Number): RealBuffer = if (arg is RealBuffer) { - val array = arg.array - RealBuffer(DoubleArray(arg.size) { array[it].pow(pow.toDouble()) }) - } else - RealBuffer(DoubleArray(arg.size) { arg[it].pow(pow.toDouble()) }) - - public override fun exp(arg: Buffer): RealBuffer = if (arg is RealBuffer) { - val array = arg.array - RealBuffer(DoubleArray(arg.size) { exp(array[it]) }) - } else RealBuffer(DoubleArray(arg.size) { exp(arg[it]) }) - - public override fun ln(arg: Buffer): RealBuffer = if (arg is RealBuffer) { - val array = arg.array - RealBuffer(DoubleArray(arg.size) { ln(array[it]) }) - } else - RealBuffer(DoubleArray(arg.size) { ln(arg[it]) }) -} - -/** - * [ExtendedField] over [RealBuffer]. - * - * @property size the size of buffers to operate on. - */ -public class RealBufferField(public val size: Int) : ExtendedField> { - public override val zero: Buffer by lazy { RealBuffer(size) { 0.0 } } - public override val one: Buffer by lazy { RealBuffer(size) { 1.0 } } - - override fun number(value: Number): Buffer = RealBuffer(size) { value.toDouble() } - - override fun Buffer.unaryMinus(): Buffer = RealBufferFieldOperations.run { - -this@unaryMinus - } - - public override fun add(a: Buffer, b: Buffer): RealBuffer { - require(a.size == size) { "The buffer size ${a.size} does not match context size $size" } - return RealBufferFieldOperations.add(a, b) - } - - public override fun scale(a: Buffer, value: Double): RealBuffer { - require(a.size == size) { "The buffer size ${a.size} does not match context size $size" } - - return if (a is RealBuffer) { - val aArray = a.array - RealBuffer(DoubleArray(a.size) { aArray[it] * value }) - } else RealBuffer(DoubleArray(a.size) { a[it] * value }) - } - - public override fun multiply(a: Buffer, b: Buffer): RealBuffer { - require(a.size == size) { "The buffer size ${a.size} does not match context size $size" } - return RealBufferFieldOperations.multiply(a, b) - } - - public override fun divide(a: Buffer, b: Buffer): RealBuffer { - require(a.size == size) { "The buffer size ${a.size} does not match context size $size" } - return RealBufferFieldOperations.divide(a, b) - } - - public override fun sin(arg: Buffer): RealBuffer { - require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } - return RealBufferFieldOperations.sin(arg) - } - - public override fun cos(arg: Buffer): RealBuffer { - require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } - return RealBufferFieldOperations.cos(arg) - } - - public override fun tan(arg: Buffer): RealBuffer { - require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } - return RealBufferFieldOperations.tan(arg) - } - - public override fun asin(arg: Buffer): RealBuffer { - require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } - return RealBufferFieldOperations.asin(arg) - } - - public override fun acos(arg: Buffer): RealBuffer { - require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } - return RealBufferFieldOperations.acos(arg) - } - - public override fun atan(arg: Buffer): RealBuffer { - require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } - return RealBufferFieldOperations.atan(arg) - } - - public override fun sinh(arg: Buffer): RealBuffer { - require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } - return RealBufferFieldOperations.sinh(arg) - } - - public override fun cosh(arg: Buffer): RealBuffer { - require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } - return RealBufferFieldOperations.cosh(arg) - } - - public override fun tanh(arg: Buffer): RealBuffer { - require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } - return RealBufferFieldOperations.tanh(arg) - } - - public override fun asinh(arg: Buffer): RealBuffer { - require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } - return RealBufferFieldOperations.asinh(arg) - } - - public override fun acosh(arg: Buffer): RealBuffer { - require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } - return RealBufferFieldOperations.acosh(arg) - } - - public override fun atanh(arg: Buffer): RealBuffer { - require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } - return RealBufferFieldOperations.atanh(arg) - } - - public override fun power(arg: Buffer, pow: Number): RealBuffer { - require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } - return RealBufferFieldOperations.power(arg, pow) - } - - public override fun exp(arg: Buffer): RealBuffer { - require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } - return RealBufferFieldOperations.exp(arg) - } - - public override fun ln(arg: Buffer): RealBuffer { - require(arg.size == size) { "The buffer size ${arg.size} does not match context size $size" } - return RealBufferFieldOperations.ln(arg) - } -} diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/ExpressionFieldTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/ExpressionFieldTest.kt index cf75eba3e..b1be0c392 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/ExpressionFieldTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/ExpressionFieldTest.kt @@ -1,6 +1,6 @@ package space.kscience.kmath.expressions -import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.operations.invoke import kotlin.test.Test import kotlin.test.assertEquals @@ -11,7 +11,7 @@ class ExpressionFieldTest { @Test fun testExpression() { - val expression = FunctionalExpressionField(RealField).invoke { + val expression = FunctionalExpressionField(DoubleField).invoke { val x by binding() x * x + 2 * x + one } @@ -27,7 +27,7 @@ class ExpressionFieldTest { return x * x + 2 * x + one } - val expression = FunctionalExpressionField(RealField).expression() + val expression = FunctionalExpressionField(DoubleField).expression() assertEquals(expression(x to 1.0), 4.0) } @@ -38,7 +38,7 @@ class ExpressionFieldTest { x * x + 2 * x + one } - val expression = FunctionalExpressionField(RealField).expressionBuilder() + val expression = FunctionalExpressionField(DoubleField).expressionBuilder() assertEquals(expression(x to 1.0), 4.0) } } diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/SimpleAutoDiffTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/SimpleAutoDiffTest.kt index ee7fffa4c..95b2b2d1c 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/SimpleAutoDiffTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/SimpleAutoDiffTest.kt @@ -1,6 +1,6 @@ package space.kscience.kmath.expressions -import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.structures.asBuffer import kotlin.math.E import kotlin.math.PI @@ -14,19 +14,19 @@ class SimpleAutoDiffTest { fun dx( xBinding: Pair, - body: SimpleAutoDiffField.(x: AutoDiffValue) -> AutoDiffValue, - ): DerivationResult = RealField.simpleAutoDiff(xBinding) { body(bindSymbol(xBinding.first)) } + body: SimpleAutoDiffField.(x: AutoDiffValue) -> AutoDiffValue, + ): DerivationResult = DoubleField.simpleAutoDiff(xBinding) { body(bindSymbol(xBinding.first)) } fun dxy( xBinding: Pair, yBinding: Pair, - body: SimpleAutoDiffField.(x: AutoDiffValue, y: AutoDiffValue) -> AutoDiffValue, - ): DerivationResult = RealField.simpleAutoDiff(xBinding, yBinding) { + body: SimpleAutoDiffField.(x: AutoDiffValue, y: AutoDiffValue) -> AutoDiffValue, + ): DerivationResult = DoubleField.simpleAutoDiff(xBinding, yBinding) { body(bindSymbol(xBinding.first), bindSymbol(yBinding.first)) } - fun diff(block: SimpleAutoDiffField.() -> AutoDiffValue): SimpleAutoDiffExpression { - return SimpleAutoDiffExpression(RealField, block) + fun diff(block: SimpleAutoDiffField.() -> AutoDiffValue): SimpleAutoDiffExpression { + return SimpleAutoDiffExpression(DoubleField, block) } val x by symbol @@ -35,7 +35,7 @@ class SimpleAutoDiffTest { @Test fun testPlusX2() { - val y = RealField.simpleAutoDiff(x to 3.0) { + val y = DoubleField.simpleAutoDiff(x to 3.0) { // diff w.r.t this x at 3 val x = bindSymbol(x) x + x @@ -58,7 +58,7 @@ class SimpleAutoDiffTest { @Test fun testPlus() { // two variables - val z = RealField.simpleAutoDiff(x to 2.0, y to 3.0) { + val z = DoubleField.simpleAutoDiff(x to 2.0, y to 3.0) { val x = bindSymbol(x) val y = bindSymbol(y) x + y @@ -71,7 +71,7 @@ class SimpleAutoDiffTest { @Test fun testMinus() { // two variables - val z = RealField.simpleAutoDiff(x to 7.0, y to 3.0) { + val z = DoubleField.simpleAutoDiff(x to 7.0, y to 3.0) { val x = bindSymbol(x) val y = bindSymbol(y) diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/DoubleLUSolverTest.kt similarity index 97% rename from kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt rename to kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/DoubleLUSolverTest.kt index e6efc6a8a..6761575f6 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/RealLUSolverTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/DoubleLUSolverTest.kt @@ -5,7 +5,7 @@ import kotlin.test.Test import kotlin.test.assertEquals @UnstableKMathAPI -class RealLUSolverTest { +class DoubleLUSolverTest { @Test fun testInvertOne() { diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/operations/RealFieldTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/operations/DoubleFieldTest.kt similarity index 59% rename from kmath-core/src/commonTest/kotlin/space/kscience/kmath/operations/RealFieldTest.kt rename to kmath-core/src/commonTest/kotlin/space/kscience/kmath/operations/DoubleFieldTest.kt index bba612d12..fde4f4a9e 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/operations/RealFieldTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/operations/DoubleFieldTest.kt @@ -4,13 +4,13 @@ import space.kscience.kmath.testutils.FieldVerifier import kotlin.test.Test import kotlin.test.assertEquals -internal class RealFieldTest { +internal class DoubleFieldTest { @Test - fun verify() = FieldVerifier(RealField, 42.0, 66.0, 2.0, 5).verify() + fun verify() = FieldVerifier(DoubleField, 42.0, 66.0, 2.0, 5).verify() @Test fun testSqrt() { - val sqrt = RealField { sqrt(25 * one) } + val sqrt = DoubleField { sqrt(25 * one) } assertEquals(5.0, sqrt) } } diff --git a/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/BlockingRealChain.kt b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/BlockingDoubleChain.kt similarity index 82% rename from kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/BlockingRealChain.kt rename to kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/BlockingDoubleChain.kt index ac6b117dc..bc4508994 100644 --- a/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/BlockingRealChain.kt +++ b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/BlockingDoubleChain.kt @@ -3,7 +3,7 @@ package space.kscience.kmath.chains /** * Performance optimized chain for real values */ -public abstract class BlockingRealChain : Chain { +public abstract class BlockingDoubleChain : Chain { public abstract fun nextDouble(): Double override suspend fun next(): Double = nextDouble() diff --git a/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/streaming/BufferFlow.kt b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/streaming/BufferFlow.kt index 4df22c2ad..c271f8889 100644 --- a/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/streaming/BufferFlow.kt +++ b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/streaming/BufferFlow.kt @@ -2,10 +2,10 @@ package space.kscience.kmath.streaming import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.* -import space.kscience.kmath.chains.BlockingRealChain +import space.kscience.kmath.chains.BlockingDoubleChain import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.BufferFactory -import space.kscience.kmath.structures.RealBuffer +import space.kscience.kmath.structures.DoubleBuffer import space.kscience.kmath.structures.asBuffer /** @@ -45,10 +45,10 @@ public fun Flow.chunked(bufferSize: Int, bufferFactory: BufferFactory) /** * Specialized flow chunker for real buffer */ -public fun Flow.chunked(bufferSize: Int): Flow = flow { +public fun Flow.chunked(bufferSize: Int): Flow = flow { require(bufferSize > 0) { "Resulting chunk size must be more than zero" } - if (this@chunked is BlockingRealChain) { + if (this@chunked is BlockingDoubleChain) { // performance optimization for blocking primitive chain while (true) emit(nextBlock(bufferSize).asBuffer()) } else { @@ -60,13 +60,13 @@ public fun Flow.chunked(bufferSize: Int): Flow = flow { counter++ if (counter == bufferSize) { - val buffer = RealBuffer(array) + val buffer = DoubleBuffer(array) emit(buffer) counter = 0 } } - if (counter > 0) emit(RealBuffer(counter) { array[it] }) + if (counter > 0) emit(DoubleBuffer(counter) { array[it] }) } } diff --git a/kmath-coroutines/src/jvmMain/kotlin/space/kscience/kmath/structures/LazyStructureND.kt b/kmath-coroutines/src/jvmMain/kotlin/space/kscience/kmath/structures/LazyStructureND.kt index 468b90561..261f91aee 100644 --- a/kmath-coroutines/src/jvmMain/kotlin/space/kscience/kmath/structures/LazyStructureND.kt +++ b/kmath-coroutines/src/jvmMain/kotlin/space/kscience/kmath/structures/LazyStructureND.kt @@ -10,7 +10,7 @@ public class LazyStructureND( public override val shape: IntArray, public val function: suspend (IntArray) -> T, ) : StructureND { - private val cache: MutableMap> = hashMapOf() + private val cache: MutableMap> = HashMap() public fun deferred(index: IntArray): Deferred = cache.getOrPut(index) { scope.async(context = Dispatchers.Math) { function(index) } diff --git a/kmath-dimensions/src/commonMain/kotlin/space/kscience/kmath/dimensions/Wrappers.kt b/kmath-dimensions/src/commonMain/kotlin/space/kscience/kmath/dimensions/Wrappers.kt index 81b008b6a..dd85a97cb 100644 --- a/kmath-dimensions/src/commonMain/kotlin/space/kscience/kmath/dimensions/Wrappers.kt +++ b/kmath-dimensions/src/commonMain/kotlin/space/kscience/kmath/dimensions/Wrappers.kt @@ -5,7 +5,7 @@ import space.kscience.kmath.linear.Matrix import space.kscience.kmath.linear.Point import space.kscience.kmath.linear.transpose import space.kscience.kmath.nd.Structure2D -import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.operations.Ring /** @@ -142,7 +142,7 @@ public inline class DMatrixContext>(public val context: context.run { (this@transpose as Matrix).transpose() }.coerce() public companion object { - public val real: DMatrixContext = DMatrixContext(LinearSpace.real) + public val real: DMatrixContext = DMatrixContext(LinearSpace.real) } } @@ -150,12 +150,12 @@ public inline class DMatrixContext>(public val context: /** * A square unit matrix */ -public inline fun DMatrixContext.one(): DMatrix = +public inline fun DMatrixContext.one(): DMatrix = produce { i, j -> if (i == j) 1.0 else 0.0 } -public inline fun DMatrixContext.zero(): DMatrix = +public inline fun DMatrixContext.zero(): DMatrix = produce { _, _ -> 0.0 } \ No newline at end of file diff --git a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt index 452280295..a82fe933e 100644 --- a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt +++ b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt @@ -5,8 +5,8 @@ import org.ejml.simple.SimpleMatrix import space.kscience.kmath.linear.* import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.nd.getFeature -import space.kscience.kmath.operations.RealField -import space.kscience.kmath.structures.RealBuffer +import space.kscience.kmath.operations.DoubleField +import space.kscience.kmath.structures.DoubleBuffer import kotlin.reflect.KClass import kotlin.reflect.cast @@ -15,9 +15,9 @@ import kotlin.reflect.cast * * @author Iaroslav Postovalov */ -public object EjmlLinearSpace : LinearSpace { +public object EjmlLinearSpace : LinearSpace { - override val elementAlgebra: RealField get() = RealField + override val elementAlgebra: DoubleField get() = DoubleField /** * Converts this matrix to EJML one. @@ -38,16 +38,16 @@ public object EjmlLinearSpace : LinearSpace { }) } - override fun buildMatrix(rows: Int, columns: Int, initializer: RealField.(i: Int, j: Int) -> Double): EjmlMatrix = + override fun buildMatrix(rows: Int, columns: Int, initializer: DoubleField.(i: Int, j: Int) -> Double): EjmlMatrix = EjmlMatrix(SimpleMatrix(rows, columns).also { (0 until rows).forEach { row -> - (0 until columns).forEach { col -> it[row, col] = RealField.initializer(row, col) } + (0 until columns).forEach { col -> it[row, col] = DoubleField.initializer(row, col) } } }) - override fun buildVector(size: Int, initializer: RealField.(Int) -> Double): Point = + override fun buildVector(size: Int, initializer: DoubleField.(Int) -> Double): Point = EjmlVector(SimpleMatrix(size, 1).also { - (0 until it.numRows()).forEach { row -> it[row, 0] = RealField.initializer(row) } + (0 until it.numRows()).forEach { row -> it[row, 0] = DoubleField.initializer(row) } }) private fun SimpleMatrix.wrapMatrix() = EjmlMatrix(this) @@ -113,7 +113,7 @@ public object EjmlLinearSpace : LinearSpace { override val u: Matrix by lazy { EjmlMatrix(SimpleMatrix(svd.getU(null, false))) } override val s: Matrix by lazy { EjmlMatrix(SimpleMatrix(svd.getW(null))) } override val v: Matrix by lazy { EjmlMatrix(SimpleMatrix(svd.getV(null, false))) } - override val singularValues: Point by lazy { RealBuffer(svd.singularValues) } + override val singularValues: Point by lazy { DoubleBuffer(svd.singularValues) } } QRDecompositionFeature::class -> object : QRDecompositionFeature { diff --git a/kmath-for-real/build.gradle.kts b/kmath-for-real/build.gradle.kts index d095cac04..5fc6724f3 100644 --- a/kmath-for-real/build.gradle.kts +++ b/kmath-for-real/build.gradle.kts @@ -18,15 +18,15 @@ readme { propertyByTemplate("artifact", rootProject.file("docs/templates/ARTIFACT-TEMPLATE.md")) feature( - id = "RealVector", + id = "DoubleVector", description = "Numpy-like operations for Buffers/Points", - ref = "src/commonMain/kotlin/kscience/kmath/real/RealVector.kt" + ref = "src/commonMain/kotlin/kscience/kmath/real/DoubleVector.kt" ) feature( - id = "RealMatrix", + id = "DoubleMatrix", description = "Numpy-like operations for 2d real structures", - ref = "src/commonMain/kotlin/kscience/kmath/real/RealMatrix.kt" + ref = "src/commonMain/kotlin/kscience/kmath/real/DoubleMatrix.kt" ) feature( diff --git a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealMatrix.kt b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealMatrix.kt index 76c73ab16..a16d64234 100644 --- a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealMatrix.kt +++ b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealMatrix.kt @@ -2,9 +2,9 @@ package space.kscience.kmath.real import space.kscience.kmath.linear.* import space.kscience.kmath.misc.UnstableKMathAPI -import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.structures.Buffer -import space.kscience.kmath.structures.RealBuffer +import space.kscience.kmath.structures.DoubleBuffer import space.kscience.kmath.structures.asIterable import kotlin.math.pow @@ -22,11 +22,11 @@ import kotlin.math.pow public typealias RealMatrix = Matrix -public fun realMatrix(rowNum: Int, colNum: Int, initializer: RealField.(i: Int, j: Int) -> Double): RealMatrix = +public fun realMatrix(rowNum: Int, colNum: Int, initializer: DoubleField.(i: Int, j: Int) -> Double): RealMatrix = LinearSpace.real.buildMatrix(rowNum, colNum, initializer) @OptIn(UnstableKMathAPI::class) -public fun realMatrix(rowNum: Int, colNum: Int): MatrixBuilder = +public fun realMatrix(rowNum: Int, colNum: Int): MatrixBuilder = LinearSpace.real.matrix(rowNum, colNum) public fun Array.toMatrix(): RealMatrix { @@ -120,19 +120,19 @@ public fun RealMatrix.extractColumns(columnRange: IntRange): RealMatrix = public fun RealMatrix.extractColumn(columnIndex: Int): RealMatrix = extractColumns(columnIndex..columnIndex) -public fun RealMatrix.sumByColumn(): RealBuffer = RealBuffer(colNum) { j -> +public fun RealMatrix.sumByColumn(): DoubleBuffer = DoubleBuffer(colNum) { j -> columns[j].asIterable().sum() } -public fun RealMatrix.minByColumn(): RealBuffer = RealBuffer(colNum) { j -> +public fun RealMatrix.minByColumn(): DoubleBuffer = DoubleBuffer(colNum) { j -> columns[j].asIterable().minOrNull() ?: error("Cannot produce min on empty column") } -public fun RealMatrix.maxByColumn(): RealBuffer = RealBuffer(colNum) { j -> +public fun RealMatrix.maxByColumn(): DoubleBuffer = DoubleBuffer(colNum) { j -> columns[j].asIterable().maxOrNull() ?: error("Cannot produce min on empty column") } -public fun RealMatrix.averageByColumn(): RealBuffer = RealBuffer(colNum) { j -> +public fun RealMatrix.averageByColumn(): DoubleBuffer = DoubleBuffer(colNum) { j -> columns[j].asIterable().average() } diff --git a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealVector.kt b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealVector.kt index 8cc128947..433e3c756 100644 --- a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealVector.kt +++ b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealVector.kt @@ -4,98 +4,99 @@ import space.kscience.kmath.linear.Point import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.operations.Norm import space.kscience.kmath.structures.Buffer -import space.kscience.kmath.structures.MutableBuffer.Companion.real +import space.kscience.kmath.structures.MutableBuffer.Companion.double import space.kscience.kmath.structures.asBuffer import space.kscience.kmath.structures.asIterable import space.kscience.kmath.structures.indices import kotlin.math.pow import kotlin.math.sqrt -public typealias RealVector = Point +public typealias DoubleVector = Point public object VectorL2Norm : Norm, Double> { override fun norm(arg: Point): Double = sqrt(arg.asIterable().sumByDouble(Number::toDouble)) } -public operator fun Buffer.Companion.invoke(vararg doubles: Double): RealVector = doubles.asBuffer() +@Suppress("FunctionName") +public fun DoubleVector(vararg doubles: Double): DoubleVector = doubles.asBuffer() /** * Fill the vector of given [size] with given [value] */ @UnstableKMathAPI -public fun Buffer.Companion.same(size: Int, value: Number): RealVector = real(size) { value.toDouble() } +public fun Buffer.Companion.same(size: Int, value: Number): DoubleVector = double(size) { value.toDouble() } // Transformation methods -public inline fun RealVector.map(transform: (Double) -> Double): RealVector = - real(size) { transform(get(it)) } +public inline fun DoubleVector.map(transform: (Double) -> Double): DoubleVector = + double(size) { transform(get(it)) } -public inline fun RealVector.mapIndexed(transform: (index: Int, value: Double) -> Double): RealVector = - real(size) { transform(it, get(it)) } +public inline fun DoubleVector.mapIndexed(transform: (index: Int, value: Double) -> Double): DoubleVector = + double(size) { transform(it, get(it)) } -public operator fun RealVector.plus(other: RealVector): RealVector { +public operator fun DoubleVector.plus(other: DoubleVector): DoubleVector { require(size == other.size) { "Vector size $size expected but ${other.size} found" } return mapIndexed { index, value -> value + other[index] } } -public operator fun RealVector.plus(number: Number): RealVector = map { it + number.toDouble() } +public operator fun DoubleVector.plus(number: Number): DoubleVector = map { it + number.toDouble() } -public operator fun Number.plus(vector: RealVector): RealVector = vector + this +public operator fun Number.plus(vector: DoubleVector): DoubleVector = vector + this -public operator fun RealVector.unaryMinus(): Buffer = map { -it } +public operator fun DoubleVector.unaryMinus(): Buffer = map { -it } -public operator fun RealVector.minus(other: RealVector): RealVector { +public operator fun DoubleVector.minus(other: DoubleVector): DoubleVector { require(size == other.size) { "Vector size $size expected but ${other.size} found" } return mapIndexed { index, value -> value - other[index] } } -public operator fun RealVector.minus(number: Number): RealVector = map { it - number.toDouble() } +public operator fun DoubleVector.minus(number: Number): DoubleVector = map { it - number.toDouble() } -public operator fun Number.minus(vector: RealVector): RealVector = vector.map { toDouble() - it } +public operator fun Number.minus(vector: DoubleVector): DoubleVector = vector.map { toDouble() - it } -public operator fun RealVector.times(other: RealVector): RealVector { +public operator fun DoubleVector.times(other: DoubleVector): DoubleVector { require(size == other.size) { "Vector size $size expected but ${other.size} found" } return mapIndexed { index, value -> value * other[index] } } -public operator fun RealVector.times(number: Number): RealVector = map { it * number.toDouble() } +public operator fun DoubleVector.times(number: Number): DoubleVector = map { it * number.toDouble() } -public operator fun Number.times(vector: RealVector): RealVector = vector * this +public operator fun Number.times(vector: DoubleVector): DoubleVector = vector * this -public operator fun RealVector.div(other: RealVector): RealVector { +public operator fun DoubleVector.div(other: DoubleVector): DoubleVector { require(size == other.size) { "Vector size $size expected but ${other.size} found" } return mapIndexed { index, value -> value / other[index] } } -public operator fun RealVector.div(number: Number): RealVector = map { it / number.toDouble() } +public operator fun DoubleVector.div(number: Number): DoubleVector = map { it / number.toDouble() } -public operator fun Number.div(vector: RealVector): RealVector = vector.map { toDouble() / it } +public operator fun Number.div(vector: DoubleVector): DoubleVector = vector.map { toDouble() / it } //extended operations -public fun RealVector.pow(p: Double): RealVector = map { it.pow(p) } +public fun DoubleVector.pow(p: Double): DoubleVector = map { it.pow(p) } -public fun RealVector.pow(p: Int): RealVector = map { it.pow(p) } +public fun DoubleVector.pow(p: Int): DoubleVector = map { it.pow(p) } -public fun exp(vector: RealVector): RealVector = vector.map { kotlin.math.exp(it) } +public fun exp(vector: DoubleVector): DoubleVector = vector.map { kotlin.math.exp(it) } -public fun sqrt(vector: RealVector): RealVector = vector.map { kotlin.math.sqrt(it) } +public fun sqrt(vector: DoubleVector): DoubleVector = vector.map { kotlin.math.sqrt(it) } -public fun RealVector.square(): RealVector = map { it.pow(2) } +public fun DoubleVector.square(): DoubleVector = map { it.pow(2) } -public fun sin(vector: RealVector): RealVector = vector.map { kotlin.math.sin(it) } +public fun sin(vector: DoubleVector): DoubleVector = vector.map { kotlin.math.sin(it) } -public fun cos(vector: RealVector): RealVector = vector.map { kotlin.math.cos(it) } +public fun cos(vector: DoubleVector): DoubleVector = vector.map { kotlin.math.cos(it) } -public fun tan(vector: RealVector): RealVector = vector.map { kotlin.math.tan(it) } +public fun tan(vector: DoubleVector): DoubleVector = vector.map { kotlin.math.tan(it) } -public fun ln(vector: RealVector): RealVector = vector.map { kotlin.math.ln(it) } +public fun ln(vector: DoubleVector): DoubleVector = vector.map { kotlin.math.ln(it) } -public fun log10(vector: RealVector): RealVector = vector.map { kotlin.math.log10(it) } +public fun log10(vector: DoubleVector): DoubleVector = vector.map { kotlin.math.log10(it) } // reductions methods -public fun RealVector.sum(): Double { +public fun DoubleVector.sum(): Double { var res = 0.0 for (i in indices) { res += get(i) diff --git a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/grids.kt b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/grids.kt index 8b4f1cd96..35297a3ac 100644 --- a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/grids.kt +++ b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/grids.kt @@ -33,7 +33,7 @@ public fun ClosedFloatingPointRange.toSequenceWithStep(step: Double): Se } } -public infix fun ClosedFloatingPointRange.step(step: Double): RealVector = +public infix fun ClosedFloatingPointRange.step(step: Double): DoubleVector = toSequenceWithStep(step).toList().asBuffer() /** diff --git a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/realND.kt b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/realND.kt index 492e40922..7655a4170 100644 --- a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/realND.kt +++ b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/realND.kt @@ -1,15 +1,15 @@ package space.kscience.kmath.real import space.kscience.kmath.nd.NDBuffer -import space.kscience.kmath.operations.RealField -import space.kscience.kmath.structures.RealBuffer +import space.kscience.kmath.operations.DoubleField +import space.kscience.kmath.structures.DoubleBuffer /** * Map one [NDBuffer] using function without indices. */ -public inline fun NDBuffer.mapInline(crossinline transform: RealField.(Double) -> Double): NDBuffer { - val array = DoubleArray(strides.linearSize) { offset -> RealField.transform(buffer[offset]) } - return NDBuffer(strides, RealBuffer(array)) +public inline fun NDBuffer.mapInline(crossinline transform: DoubleField.(Double) -> Double): NDBuffer { + val array = DoubleArray(strides.linearSize) { offset -> DoubleField.transform(buffer[offset]) } + return NDBuffer(strides, DoubleBuffer(array)) } /** diff --git a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealMatrixTest.kt b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/DoubleMatrixTest.kt similarity index 99% rename from kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealMatrixTest.kt rename to kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/DoubleMatrixTest.kt index 06135598e..c1d3ccf5f 100644 --- a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealMatrixTest.kt +++ b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/DoubleMatrixTest.kt @@ -10,7 +10,7 @@ import kotlin.test.assertEquals import kotlin.test.assertTrue @UnstableKMathAPI -internal class RealMatrixTest { +internal class DoubleMatrixTest { @Test fun testSum() { val m = realMatrix(10, 10) { i, j -> (i + j).toDouble() } diff --git a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealVectorTest.kt b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/DoubleVectorTest.kt similarity index 67% rename from kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealVectorTest.kt rename to kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/DoubleVectorTest.kt index 60d85fda3..669f88186 100644 --- a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/RealVectorTest.kt +++ b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/DoubleVectorTest.kt @@ -4,30 +4,30 @@ import space.kscience.kmath.linear.LinearSpace import space.kscience.kmath.linear.asMatrix import space.kscience.kmath.linear.transpose import space.kscience.kmath.real.plus -import space.kscience.kmath.structures.RealBuffer +import space.kscience.kmath.structures.DoubleBuffer import kotlin.test.Test import kotlin.test.assertEquals -internal class RealVectorTest { +internal class DoubleVectorTest { @Test fun testSum() { - val vector1 = RealBuffer(5) { it.toDouble() } - val vector2 = RealBuffer(5) { 5 - it.toDouble() } + val vector1 = DoubleBuffer(5) { it.toDouble() } + val vector2 = DoubleBuffer(5) { 5 - it.toDouble() } val sum = vector1 + vector2 assertEquals(5.0, sum[2]) } @Test fun testVectorToMatrix() { - val vector = RealBuffer(5) { it.toDouble() } + val vector = DoubleBuffer(5) { it.toDouble() } val matrix = vector.asMatrix() assertEquals(4.0, matrix[4, 0]) } @Test fun testDot() { - val vector1 = RealBuffer(5) { it.toDouble() } - val vector2 = RealBuffer(5) { 5 - it.toDouble() } + val vector1 = DoubleBuffer(5) { it.toDouble() } + val vector2 = DoubleBuffer(5) { 5 - it.toDouble() } val matrix1 = vector1.asMatrix() val matrix2 = vector2.asMatrix().transpose() val product = LinearSpace.real.run { matrix1 dot matrix2 } diff --git a/kmath-functions/src/commonTest/kotlin/space/kscience/kmath/interpolation/LinearInterpolatorTest.kt b/kmath-functions/src/commonTest/kotlin/space/kscience/kmath/interpolation/LinearInterpolatorTest.kt index 0b7b62147..476c035e9 100644 --- a/kmath-functions/src/commonTest/kotlin/space/kscience/kmath/interpolation/LinearInterpolatorTest.kt +++ b/kmath-functions/src/commonTest/kotlin/space/kscience/kmath/interpolation/LinearInterpolatorTest.kt @@ -2,7 +2,7 @@ package space.kscience.kmath.interpolation import space.kscience.kmath.functions.PiecewisePolynomial import space.kscience.kmath.functions.asFunction -import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.DoubleField import kotlin.test.Test import kotlin.test.assertEquals @@ -16,8 +16,8 @@ internal class LinearInterpolatorTest { 3.0 to 4.0 ) - val polynomial: PiecewisePolynomial = LinearInterpolator(RealField).interpolatePolynomials(data) - val function = polynomial.asFunction(RealField) + val polynomial: PiecewisePolynomial = LinearInterpolator(DoubleField).interpolatePolynomials(data) + val function = polynomial.asFunction(DoubleField) assertEquals(null, function(-1.0)) assertEquals(0.5, function(0.5)) assertEquals(2.0, function(1.5)) diff --git a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counter.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counter.kt index ca0eba52f..616a72fde 100644 --- a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counter.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counter.kt @@ -2,8 +2,8 @@ package space.kscience.kmath.histogram import kotlinx.atomicfu.atomic import kotlinx.atomicfu.getAndUpdate +import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.operations.Group -import space.kscience.kmath.operations.RealField /** * Common representation for atomic counters @@ -13,7 +13,7 @@ public interface Counter { public val value: T public companion object { - public fun real(): ObjectCounter = ObjectCounter(RealField) + public fun real(): ObjectCounter = ObjectCounter(DoubleField) } } diff --git a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/RealHistogramSpace.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/DoubleHistogramSpace.kt similarity index 92% rename from kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/RealHistogramSpace.kt rename to kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/DoubleHistogramSpace.kt index 1407470c1..fa9b67404 100644 --- a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/RealHistogramSpace.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/DoubleHistogramSpace.kt @@ -7,7 +7,7 @@ import space.kscience.kmath.nd.* import space.kscience.kmath.structures.* import kotlin.math.floor -public class RealHistogramSpace( +public class DoubleHistogramSpace( private val lower: Buffer, private val upper: Buffer, private val binNums: IntArray = IntArray(lower.size) { 20 }, @@ -23,10 +23,10 @@ public class RealHistogramSpace( public val dimension: Int get() = lower.size private val shape = IntArray(binNums.size) { binNums[it] + 2 } - override val histogramValueSpace: RealFieldND = AlgebraND.real(*shape) + override val histogramValueSpace: DoubleFieldND = AlgebraND.real(*shape) override val strides: Strides get() = histogramValueSpace.strides - private val binSize = RealBuffer(dimension) { (upper[it] - lower[it]) / binNums[it] } + private val binSize = DoubleBuffer(dimension) { (upper[it] - lower[it]) / binNums[it] } /** * Get internal [StructureND] bin index for given axis @@ -91,7 +91,7 @@ public class RealHistogramSpace( *) *``` */ - public fun fromRanges(vararg ranges: ClosedFloatingPointRange): RealHistogramSpace = RealHistogramSpace( + public fun fromRanges(vararg ranges: ClosedFloatingPointRange): DoubleHistogramSpace = DoubleHistogramSpace( ranges.map(ClosedFloatingPointRange::start).asBuffer(), ranges.map(ClosedFloatingPointRange::endInclusive).asBuffer() ) @@ -105,8 +105,8 @@ public class RealHistogramSpace( *) *``` */ - public fun fromRanges(vararg ranges: Pair, Int>): RealHistogramSpace = - RealHistogramSpace( + public fun fromRanges(vararg ranges: Pair, Int>): DoubleHistogramSpace = + DoubleHistogramSpace( ListBuffer( ranges .map(Pair, Int>::first) diff --git a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Histogram.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Histogram.kt index ed76c7aa1..d680a9ad0 100644 --- a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Histogram.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Histogram.kt @@ -2,7 +2,7 @@ package space.kscience.kmath.histogram import space.kscience.kmath.domains.Domain import space.kscience.kmath.linear.Point -import space.kscience.kmath.structures.RealBuffer +import space.kscience.kmath.structures.DoubleBuffer import space.kscience.kmath.structures.asBuffer /** @@ -43,9 +43,9 @@ public fun > HistogramBuilder.put(point: Point): U public fun HistogramBuilder.put(vararg point: T): Unit = put(point.asBuffer()) public fun HistogramBuilder.put(vararg point: Number): Unit = - put(RealBuffer(point.map { it.toDouble() }.toDoubleArray())) + put(DoubleBuffer(point.map { it.toDouble() }.toDoubleArray())) -public fun HistogramBuilder.put(vararg point: Double): Unit = put(RealBuffer(point)) +public fun HistogramBuilder.put(vararg point: Double): Unit = put(DoubleBuffer(point)) public fun HistogramBuilder.fill(sequence: Iterable>): Unit = sequence.forEach { put(it) } /** diff --git a/kmath-histograms/src/commonTest/kotlin/space/kscience/kmath/histogram/MultivariateHistogramTest.kt b/kmath-histograms/src/commonTest/kotlin/space/kscience/kmath/histogram/MultivariateHistogramTest.kt index fc00c6cdf..feb87a7a7 100644 --- a/kmath-histograms/src/commonTest/kotlin/space/kscience/kmath/histogram/MultivariateHistogramTest.kt +++ b/kmath-histograms/src/commonTest/kotlin/space/kscience/kmath/histogram/MultivariateHistogramTest.kt @@ -1,15 +1,14 @@ package space.kscience.kmath.histogram import space.kscience.kmath.operations.invoke -import space.kscience.kmath.real.RealVector -import space.kscience.kmath.real.invoke +import space.kscience.kmath.real.DoubleVector import kotlin.random.Random import kotlin.test.* internal class MultivariateHistogramTest { @Test fun testSinglePutHistogram() { - val hSpace = RealHistogramSpace.fromRanges( + val hSpace = DoubleHistogramSpace.fromRanges( (-1.0..1.0), (-1.0..1.0) ) @@ -17,14 +16,14 @@ internal class MultivariateHistogramTest { put(0.55, 0.55) } val bin = histogram.bins.find { it.value.toInt() > 0 } ?: fail() - assertTrue { bin.contains(RealVector(0.55, 0.55)) } - assertTrue { bin.contains(RealVector(0.6, 0.5)) } - assertFalse { bin.contains(RealVector(-0.55, 0.55)) } + assertTrue { bin.contains(DoubleVector(0.55, 0.55)) } + assertTrue { bin.contains(DoubleVector(0.6, 0.5)) } + assertFalse { bin.contains(DoubleVector(-0.55, 0.55)) } } @Test fun testSequentialPut() { - val hSpace = RealHistogramSpace.fromRanges( + val hSpace = DoubleHistogramSpace.fromRanges( (-1.0..1.0), (-1.0..1.0), (-1.0..1.0) @@ -44,7 +43,7 @@ internal class MultivariateHistogramTest { @Test fun testHistogramAlgebra() { - RealHistogramSpace.fromRanges( + DoubleHistogramSpace.fromRanges( (-1.0..1.0), (-1.0..1.0), (-1.0..1.0) diff --git a/kmath-kotlingrad/src/test/kotlin/space/kscience/kmath/kotlingrad/AdaptingTests.kt b/kmath-kotlingrad/src/test/kotlin/space/kscience/kmath/kotlingrad/AdaptingTests.kt index ffdabaffb..7cd3276b8 100644 --- a/kmath-kotlingrad/src/test/kotlin/space/kscience/kmath/kotlingrad/AdaptingTests.kt +++ b/kmath-kotlingrad/src/test/kotlin/space/kscience/kmath/kotlingrad/AdaptingTests.kt @@ -6,7 +6,7 @@ import space.kscience.kmath.ast.MstAlgebra import space.kscience.kmath.ast.MstExpression import space.kscience.kmath.ast.parseMath import space.kscience.kmath.expressions.invoke -import space.kscience.kmath.operations.RealField +import space.kscience.kmath.operations.DoubleField import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue @@ -16,8 +16,8 @@ internal class AdaptingTests { @Test fun symbol() { val c1 = MstAlgebra.bindSymbol("x") - assertTrue(c1.toSVar>().name == "x") - val c2 = "kitten".parseMath().toSFun>() + assertTrue(c1.toSVar>().name == "x") + val c2 = "kitten".parseMath().toSFun>() if (c2 is SVar) assertTrue(c2.name == "kitten") else fail() } @@ -25,15 +25,15 @@ internal class AdaptingTests { fun number() { val c1 = MstAlgebra.number(12354324) assertTrue(c1.toSConst().doubleValue == 12354324.0) - val c2 = "0.234".parseMath().toSFun>() + val c2 = "0.234".parseMath().toSFun>() if (c2 is SConst) assertTrue(c2.doubleValue == 0.234) else fail() - val c3 = "1e-3".parseMath().toSFun>() + val c3 = "1e-3".parseMath().toSFun>() if (c3 is SConst) assertEquals(0.001, c3.value) else fail() } @Test fun simpleFunctionShape() { - val linear = "2*x+16".parseMath().toSFun>() + val linear = "2*x+16".parseMath().toSFun>() if (linear !is Sum) fail() if (linear.left !is Prod) fail() if (linear.right !is SConst) fail() @@ -41,21 +41,21 @@ internal class AdaptingTests { @Test fun simpleFunctionDerivative() { - val x = MstAlgebra.bindSymbol("x").toSVar>() - val quadratic = "x^2-4*x-44".parseMath().toSFun>() - val actualDerivative = MstExpression(RealField, quadratic.d(x).toMst()).compile() - val expectedDerivative = MstExpression(RealField, "2*x-4".parseMath()).compile() + val x = MstAlgebra.bindSymbol("x").toSVar>() + val quadratic = "x^2-4*x-44".parseMath().toSFun>() + val actualDerivative = MstExpression(DoubleField, quadratic.d(x).toMst()).compile() + val expectedDerivative = MstExpression(DoubleField, "2*x-4".parseMath()).compile() assertEquals(actualDerivative("x" to 123.0), expectedDerivative("x" to 123.0)) } @Test fun moreComplexDerivative() { - val x = MstAlgebra.bindSymbol("x").toSVar>() - val composition = "-sqrt(sin(x^2)-cos(x)^2-16*x)".parseMath().toSFun>() - val actualDerivative = MstExpression(RealField, composition.d(x).toMst()).compile() + val x = MstAlgebra.bindSymbol("x").toSVar>() + val composition = "-sqrt(sin(x^2)-cos(x)^2-16*x)".parseMath().toSFun>() + val actualDerivative = MstExpression(DoubleField, composition.d(x).toMst()).compile() val expectedDerivative = MstExpression( - RealField, + DoubleField, "-(2*x*cos(x^2)+2*sin(x)*cos(x)-16)/(2*sqrt(sin(x^2)-16*x-cos(x)^2))".parseMath() ).compile() diff --git a/kmath-nd4j/docs/README-TEMPLATE.md b/kmath-nd4j/docs/README-TEMPLATE.md index 76ce8c9a7..9783e74be 100644 --- a/kmath-nd4j/docs/README-TEMPLATE.md +++ b/kmath-nd4j/docs/README-TEMPLATE.md @@ -15,7 +15,7 @@ import org.nd4j.linalg.factory.* import scientifik.kmath.nd4j.* import scientifik.kmath.structures.* -val array = Nd4j.ones(2, 2).asRealStructure() +val array = Nd4j.ones(2, 2).asDoubleStructure() println(array[0, 0]) // 1.0 array[intArrayOf(0, 0)] = 24.0 println(array[0, 0]) // 24.0 @@ -28,8 +28,8 @@ import org.nd4j.linalg.factory.* import scientifik.kmath.nd4j.* import scientifik.kmath.operations.* -val field = RealNd4jArrayField(intArrayOf(2, 2)) -val array = Nd4j.rand(2, 2).asRealStructure() +val field = DoubleNd4jArrayField(intArrayOf(2, 2)) +val array = Nd4j.rand(2, 2).asDoubleStructure() val res = field { (25.0 / array + 20) * 4 diff --git a/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt index bf73ec20f..8ea992bcb 100644 --- a/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt +++ b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebra.kt @@ -172,7 +172,7 @@ public interface Nd4jArrayField> : FieldND, Nd4jArrayRing< private val floatNd4jArrayFieldCache: ThreadLocal> = ThreadLocal.withInitial { hashMapOf() } - private val realNd4jArrayFieldCache: ThreadLocal> = + private val doubleNd4JArrayFieldCache: ThreadLocal> = ThreadLocal.withInitial { hashMapOf() } /** @@ -184,8 +184,8 @@ public interface Nd4jArrayField> : FieldND, Nd4jArrayRing< /** * Creates an [FieldND] for [Double] values or pull it from cache if it was created previously. */ - public fun real(vararg shape: Int): Nd4jArrayRing = - realNd4jArrayFieldCache.get().getOrPut(shape) { RealNd4jArrayField(shape) } + public fun real(vararg shape: Int): Nd4jArrayRing = + doubleNd4JArrayFieldCache.get().getOrPut(shape) { DoubleNd4jArrayField(shape) } /** * Creates a most suitable implementation of [RingND] using reified class. @@ -200,12 +200,12 @@ public interface Nd4jArrayField> : FieldND, Nd4jArrayRing< } /** - * Represents [FieldND] over [Nd4jArrayRealStructure]. + * Represents [FieldND] over [Nd4jArrayDoubleStructure]. */ -public class RealNd4jArrayField(public override val shape: IntArray) : Nd4jArrayField { - public override val elementContext: RealField get() = RealField +public class DoubleNd4jArrayField(public override val shape: IntArray) : Nd4jArrayField { + public override val elementContext: DoubleField get() = DoubleField - public override fun INDArray.wrap(): Nd4jArrayStructure = checkShape(this).asRealStructure() + public override fun INDArray.wrap(): Nd4jArrayStructure = checkShape(this).asDoubleStructure() override fun scale(a: StructureND, value: Double): Nd4jArrayStructure { return a.ndArray.mul(value).wrap() diff --git a/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayIterator.kt b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayIterator.kt index 521c8cab3..cfb900277 100644 --- a/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayIterator.kt +++ b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayIterator.kt @@ -37,11 +37,11 @@ private sealed class Nd4jArrayIteratorBase(protected val iterateOver: INDArra } } -private class Nd4jArrayRealIterator(iterateOver: INDArray) : Nd4jArrayIteratorBase(iterateOver) { +private class Nd4jArrayDoubleIterator(iterateOver: INDArray) : Nd4jArrayIteratorBase(iterateOver) { override fun getSingle(indices: LongArray): Double = iterateOver.getDouble(*indices) } -internal fun INDArray.realIterator(): Iterator> = Nd4jArrayRealIterator(this) +internal fun INDArray.realIterator(): Iterator> = Nd4jArrayDoubleIterator(this) private class Nd4jArrayLongIterator(iterateOver: INDArray) : Nd4jArrayIteratorBase(iterateOver) { override fun getSingle(indices: LongArray) = iterateOver.getLong(*indices) diff --git a/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructure.kt b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructure.kt index 9b4cc1a24..ec4cc9c56 100644 --- a/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructure.kt +++ b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructure.kt @@ -45,7 +45,7 @@ private data class Nd4jArrayLongStructure(override val ndArray: INDArray) : Nd4j */ public fun INDArray.asLongStructure(): Nd4jArrayStructure = Nd4jArrayLongStructure(this) -private data class Nd4jArrayRealStructure(override val ndArray: INDArray) : Nd4jArrayStructure() { +private data class Nd4jArrayDoubleStructure(override val ndArray: INDArray) : Nd4jArrayStructure() { override fun elementsIterator(): Iterator> = ndArray.realIterator() override fun get(index: IntArray): Double = ndArray.getDouble(*index) override fun set(index: IntArray, value: Double): Unit = run { ndArray.putScalar(index, value) } @@ -54,7 +54,7 @@ private data class Nd4jArrayRealStructure(override val ndArray: INDArray) : Nd4j /** * Wraps this [INDArray] to [Nd4jArrayStructure]. */ -public fun INDArray.asRealStructure(): Nd4jArrayStructure = Nd4jArrayRealStructure(this) +public fun INDArray.asDoubleStructure(): Nd4jArrayStructure = Nd4jArrayDoubleStructure(this) private data class Nd4jArrayFloatStructure(override val ndArray: INDArray) : Nd4jArrayStructure() { override fun elementsIterator(): Iterator> = ndArray.floatIterator() diff --git a/kmath-nd4j/src/test/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebraTest.kt b/kmath-nd4j/src/test/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebraTest.kt index 6a8d8796c..e658275f5 100644 --- a/kmath-nd4j/src/test/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebraTest.kt +++ b/kmath-nd4j/src/test/kotlin/space/kscience/kmath/nd4j/Nd4jArrayAlgebraTest.kt @@ -8,8 +8,8 @@ import kotlin.test.fail internal class Nd4jArrayAlgebraTest { @Test fun testProduce() { - val res = with(RealNd4jArrayField(intArrayOf(2, 2))) { produce { it.sum().toDouble() } } - val expected = (Nd4j.create(2, 2) ?: fail()).asRealStructure() + val res = with(DoubleNd4jArrayField(intArrayOf(2, 2))) { produce { it.sum().toDouble() } } + val expected = (Nd4j.create(2, 2) ?: fail()).asDoubleStructure() expected[intArrayOf(0, 0)] = 0.0 expected[intArrayOf(0, 1)] = 1.0 expected[intArrayOf(1, 0)] = 1.0 diff --git a/kmath-nd4j/src/test/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructureTest.kt b/kmath-nd4j/src/test/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructureTest.kt index 5cf6dd26f..0c03270dd 100644 --- a/kmath-nd4j/src/test/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructureTest.kt +++ b/kmath-nd4j/src/test/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructureTest.kt @@ -11,7 +11,7 @@ internal class Nd4jArrayStructureTest { @Test fun testElements() { val nd = Nd4j.create(doubleArrayOf(1.0, 2.0, 3.0))!! - val struct = nd.asRealStructure() + val struct = nd.asDoubleStructure() val res = struct.elements().map(Pair::second).toList() assertEquals(listOf(1.0, 2.0, 3.0), res) } @@ -19,22 +19,22 @@ internal class Nd4jArrayStructureTest { @Test fun testShape() { val nd = Nd4j.rand(10, 2, 3, 6) ?: fail() - val struct = nd.asRealStructure() + val struct = nd.asDoubleStructure() assertEquals(intArrayOf(10, 2, 3, 6).toList(), struct.shape.toList()) } @Test fun testEquals() { val nd1 = Nd4j.create(doubleArrayOf(1.0, 2.0, 3.0)) ?: fail() - val struct1 = nd1.asRealStructure() + val struct1 = nd1.asDoubleStructure() assertEquals(struct1, struct1) assertNotEquals(struct1 as Any?, null) val nd2 = Nd4j.create(doubleArrayOf(1.0, 2.0, 3.0)) ?: fail() - val struct2 = nd2.asRealStructure() + val struct2 = nd2.asDoubleStructure() assertEquals(struct1, struct2) assertEquals(struct2, struct1) val nd3 = Nd4j.create(doubleArrayOf(1.0, 2.0, 3.0)) ?: fail() - val struct3 = nd3.asRealStructure() + val struct3 = nd3.asDoubleStructure() assertEquals(struct2, struct3) assertEquals(struct1, struct3) } @@ -42,9 +42,9 @@ internal class Nd4jArrayStructureTest { @Test fun testHashCode() { val nd1 = Nd4j.create(doubleArrayOf(1.0, 2.0, 3.0)) ?: fail() - val struct1 = nd1.asRealStructure() + val struct1 = nd1.asDoubleStructure() val nd2 = Nd4j.create(doubleArrayOf(1.0, 2.0, 3.0)) ?: fail() - val struct2 = nd2.asRealStructure() + val struct2 = nd2.asDoubleStructure() assertEquals(struct1.hashCode(), struct2.hashCode()) } diff --git a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Distribution.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Distribution.kt index dacf7a9cd..25f6a87b5 100644 --- a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Distribution.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Distribution.kt @@ -4,7 +4,7 @@ import space.kscience.kmath.chains.Chain import space.kscience.kmath.chains.collect import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.BufferFactory -import space.kscience.kmath.structures.RealBuffer +import space.kscience.kmath.structures.DoubleBuffer public interface Sampler { public fun sample(generator: RandomGenerator): Chain @@ -75,4 +75,4 @@ public fun Sampler.sampleBuffer( * Generate a bunch of samples from real distributions */ public fun Sampler.sampleBuffer(generator: RandomGenerator, size: Int): Chain> = - sampleBuffer(generator, size, ::RealBuffer) + sampleBuffer(generator, size, ::DoubleBuffer) diff --git a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Statistic.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Statistic.kt index a9f7cd3e4..8bf6b09ef 100644 --- a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Statistic.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Statistic.kt @@ -81,7 +81,7 @@ public class Mean( public companion object { //TODO replace with optimized version which respects overflow - public val real: Mean = Mean(RealField) { sum, count -> sum / count } + public val real: Mean = Mean(DoubleField) { sum, count -> sum / count } public val int: Mean = Mean(IntRing) { sum, count -> sum / count } public val long: Mean = Mean(LongRing) { sum, count -> sum / count } } diff --git a/kmath-stat/src/jvmMain/kotlin/space/kscience/kmath/stat/distributions.kt b/kmath-stat/src/jvmMain/kotlin/space/kscience/kmath/stat/distributions.kt index 1be436a4f..8b5551a16 100644 --- a/kmath-stat/src/jvmMain/kotlin/space/kscience/kmath/stat/distributions.kt +++ b/kmath-stat/src/jvmMain/kotlin/space/kscience/kmath/stat/distributions.kt @@ -2,8 +2,8 @@ package space.kscience.kmath.stat import org.apache.commons.rng.UniformRandomProvider import org.apache.commons.rng.sampling.distribution.* +import space.kscience.kmath.chains.BlockingDoubleChain import space.kscience.kmath.chains.BlockingIntChain -import space.kscience.kmath.chains.BlockingRealChain import space.kscience.kmath.chains.Chain import kotlin.math.PI import kotlin.math.exp @@ -11,7 +11,7 @@ import kotlin.math.pow import kotlin.math.sqrt public abstract class ContinuousSamplerDistribution : Distribution { - private inner class ContinuousSamplerChain(val generator: RandomGenerator) : BlockingRealChain() { + private inner class ContinuousSamplerChain(val generator: RandomGenerator) : BlockingDoubleChain() { private val sampler = buildCMSampler(generator) override fun nextDouble(): Double = sampler.sample() @@ -20,7 +20,7 @@ public abstract class ContinuousSamplerDistribution : Distribution { protected abstract fun buildCMSampler(generator: RandomGenerator): ContinuousSampler - public override fun sample(generator: RandomGenerator): BlockingRealChain = ContinuousSamplerChain(generator) + public override fun sample(generator: RandomGenerator): BlockingDoubleChain = ContinuousSamplerChain(generator) } public abstract class DiscreteSamplerDistribution : Distribution { diff --git a/kmath-viktor/api/kmath-viktor.api b/kmath-viktor/api/kmath-viktor.api index d48a9f9c8..6fe6c9db7 100644 --- a/kmath-viktor/api/kmath-viktor.api +++ b/kmath-viktor/api/kmath-viktor.api @@ -67,7 +67,7 @@ public final class space/kscience/kmath/viktor/ViktorFieldND : space/kscience/km public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; public fun exp-8UOKELU (Lspace/kscience/kmath/nd/StructureND;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun getElementContext ()Lspace/kscience/kmath/operations/Algebra; - public fun getElementContext ()Lspace/kscience/kmath/operations/RealField; + public fun getElementContext ()Lspace/kscience/kmath/operations/DoubleField; public final fun getF64Buffer (Lspace/kscience/kmath/nd/StructureND;)Lorg/jetbrains/bio/viktor/F64Array; public synthetic fun getOne ()Ljava/lang/Object; public fun getOne-6kW2wQc ()Lorg/jetbrains/bio/viktor/F64Array; diff --git a/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorStructureND.kt b/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorStructureND.kt index 9195415c5..2749f5431 100644 --- a/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorStructureND.kt +++ b/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorStructureND.kt @@ -3,9 +3,9 @@ package space.kscience.kmath.viktor import org.jetbrains.bio.viktor.F64Array import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.nd.* +import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.operations.ExtendedField import space.kscience.kmath.operations.NumbersAddOperations -import space.kscience.kmath.operations.RealField import space.kscience.kmath.operations.ScaleOperations @Suppress("OVERRIDE_BY_INLINE", "NOTHING_TO_INLINE") @@ -26,7 +26,7 @@ public fun F64Array.asStructure(): ViktorStructureND = ViktorStructureND(this) @OptIn(UnstableKMathAPI::class) @Suppress("OVERRIDE_BY_INLINE", "NOTHING_TO_INLINE") -public class ViktorFieldND(public override val shape: IntArray) : FieldND, +public class ViktorFieldND(public override val shape: IntArray) : FieldND, NumbersAddOperations>, ExtendedField>, ScaleOperations> { @@ -46,39 +46,39 @@ public class ViktorFieldND(public override val shape: IntArray) : FieldND Double): ViktorStructureND = + public override fun produce(initializer: DoubleField.(IntArray) -> Double): ViktorStructureND = F64Array(*shape).apply { this@ViktorFieldND.strides.indices().forEach { index -> - set(value = RealField.initializer(index), indices = index) + set(value = DoubleField.initializer(index), indices = index) } }.asStructure() override fun StructureND.unaryMinus(): StructureND = -1 * this - public override fun StructureND.map(transform: RealField.(Double) -> Double): ViktorStructureND = + public override fun StructureND.map(transform: DoubleField.(Double) -> Double): ViktorStructureND = F64Array(*this@ViktorFieldND.shape).apply { this@ViktorFieldND.strides.indices().forEach { index -> - set(value = RealField.transform(this@map[index]), indices = index) + set(value = DoubleField.transform(this@map[index]), indices = index) } }.asStructure() public override fun StructureND.mapIndexed( - transform: RealField.(index: IntArray, Double) -> Double, + transform: DoubleField.(index: IntArray, Double) -> Double, ): ViktorStructureND = F64Array(*this@ViktorFieldND.shape).apply { this@ViktorFieldND.strides.indices().forEach { index -> - set(value = RealField.transform(index, this@mapIndexed[index]), indices = index) + set(value = DoubleField.transform(index, this@mapIndexed[index]), indices = index) } }.asStructure() public override fun combine( a: StructureND, b: StructureND, - transform: RealField.(Double, Double) -> Double, + transform: DoubleField.(Double, Double) -> Double, ): ViktorStructureND = F64Array(*shape).apply { this@ViktorFieldND.strides.indices().forEach { index -> - set(value = RealField.transform(a[index], b[index]), indices = index) + set(value = DoubleField.transform(a[index], b[index]), indices = index) } }.asStructure() From a3ca06a24142baec0a5cbe340ceea3da1cf103c6 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 16 Mar 2021 21:43:29 +0300 Subject: [PATCH 141/150] Remove StructureND identity #248 --- CHANGELOG.md | 1 + .../kmath/structures/StreamDoubleFieldND.kt | 54 +++---- .../structures/StructureReadBenchmark.kt | 4 +- .../kscience/kmath/commons/linear/CMMatrix.kt | 11 +- .../commons/transform/Transformations.kt | 2 + .../kscience/kmath/complex/ComplexFieldND.kt | 42 +++--- kmath-core/api/kmath-core.api | 132 ++++++++---------- .../kscience/kmath/linear/MatrixWrapper.kt | 2 - .../kscience/kmath/linear/VirtualMatrix.kt | 15 -- .../kscience/kmath/nd/BufferAlgebraND.kt | 20 +-- .../space/kscience/kmath/nd/DoubleFieldND.kt | 52 +++---- .../space/kscience/kmath/nd/ShortRingND.kt | 10 +- .../space/kscience/kmath/nd/Structure1D.kt | 4 +- .../space/kscience/kmath/nd/Structure2D.kt | 6 +- .../space/kscience/kmath/nd/StructureND.kt | 52 +++---- .../space/kscience/kmath/structures/Buffer.kt | 13 +- .../kmath/linear/DoubleLUSolverTest.kt | 12 +- .../space/kscience/kmath/linear/MatrixTest.kt | 3 +- .../kmath/structures/LazyStructureND.kt | 12 -- .../space/kscience/kmath/ejml/EjmlMatrix.kt | 13 +- .../kscience/kmath/ejml/EjmlMatrixTest.kt | 11 +- .../space/kscience/kmath/real/realND.kt | 20 +-- .../kaceince/kmath/real/DoubleMatrixTest.kt | 23 +-- .../kmath/histogram/DoubleHistogramSpace.kt | 2 +- .../kscience/kmath/nd4j/Nd4jArrayStructure.kt | 4 +- kmath-viktor/api/kmath-viktor.api | 2 +- .../kmath/viktor/ViktorStructureND.kt | 2 +- 27 files changed, 239 insertions(+), 285 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9e3f963e..644c634b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -76,6 +76,7 @@ - `toGrid` method. - Public visibility of `BufferAccessor2D` - `Real` class +- StructureND identity and equals ### Fixed - `symbol` method in `MstExtendedField` (https://github.com/mipt-npm/kmath/pull/140) diff --git a/examples/src/main/kotlin/space/kscience/kmath/structures/StreamDoubleFieldND.kt b/examples/src/main/kotlin/space/kscience/kmath/structures/StreamDoubleFieldND.kt index b4653b598..6741209fc 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/structures/StreamDoubleFieldND.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/structures/StreamDoubleFieldND.kt @@ -20,10 +20,10 @@ class StreamDoubleFieldND( private val strides = DefaultStrides(shape) override val elementContext: DoubleField get() = DoubleField - override val zero: NDBuffer by lazy { produce { zero } } - override val one: NDBuffer by lazy { produce { one } } + override val zero: BufferND by lazy { produce { zero } } + override val one: BufferND by lazy { produce { one } } - override fun number(value: Number): NDBuffer { + override fun number(value: Number): BufferND { val d = value.toDouble() // minimize conversions return produce { d } } @@ -34,30 +34,30 @@ class StreamDoubleFieldND( this@StreamDoubleFieldND.shape, shape ) - this is NDBuffer && this.strides == this@StreamDoubleFieldND.strides -> this.buffer as DoubleBuffer + this is BufferND && this.strides == this@StreamDoubleFieldND.strides -> this.buffer as DoubleBuffer else -> DoubleBuffer(strides.linearSize) { offset -> get(strides.index(offset)) } } - override fun produce(initializer: DoubleField.(IntArray) -> Double): NDBuffer { + override fun produce(initializer: DoubleField.(IntArray) -> Double): BufferND { val array = IntStream.range(0, strides.linearSize).parallel().mapToDouble { offset -> val index = strides.index(offset) DoubleField.initializer(index) }.toArray() - return NDBuffer(strides, array.asBuffer()) + return BufferND(strides, array.asBuffer()) } override fun StructureND.map( transform: DoubleField.(Double) -> Double, - ): NDBuffer { + ): BufferND { val array = Arrays.stream(buffer.array).parallel().map { DoubleField.transform(it) }.toArray() - return NDBuffer(strides, array.asBuffer()) + return BufferND(strides, array.asBuffer()) } override fun StructureND.mapIndexed( transform: DoubleField.(index: IntArray, Double) -> Double, - ): NDBuffer { + ): BufferND { val array = IntStream.range(0, strides.linearSize).parallel().mapToDouble { offset -> DoubleField.transform( strides.index(offset), @@ -65,43 +65,43 @@ class StreamDoubleFieldND( ) }.toArray() - return NDBuffer(strides, array.asBuffer()) + return BufferND(strides, array.asBuffer()) } override fun combine( a: StructureND, b: StructureND, transform: DoubleField.(Double, Double) -> Double, - ): NDBuffer { + ): BufferND { val array = IntStream.range(0, strides.linearSize).parallel().mapToDouble { offset -> DoubleField.transform(a.buffer.array[offset], b.buffer.array[offset]) }.toArray() - return NDBuffer(strides, array.asBuffer()) + return BufferND(strides, array.asBuffer()) } override fun StructureND.unaryMinus(): StructureND = map { -it } override fun scale(a: StructureND, value: Double): StructureND = a.map { it * value } - override fun power(arg: StructureND, pow: Number): NDBuffer = arg.map { power(it, pow) } + override fun power(arg: StructureND, pow: Number): BufferND = arg.map { power(it, pow) } - override fun exp(arg: StructureND): NDBuffer = arg.map { exp(it) } + override fun exp(arg: StructureND): BufferND = arg.map { exp(it) } - override fun ln(arg: StructureND): NDBuffer = arg.map { ln(it) } + override fun ln(arg: StructureND): BufferND = arg.map { ln(it) } - override fun sin(arg: StructureND): NDBuffer = arg.map { sin(it) } - override fun cos(arg: StructureND): NDBuffer = arg.map { cos(it) } - override fun tan(arg: StructureND): NDBuffer = arg.map { tan(it) } - override fun asin(arg: StructureND): NDBuffer = arg.map { asin(it) } - override fun acos(arg: StructureND): NDBuffer = arg.map { acos(it) } - override fun atan(arg: StructureND): NDBuffer = arg.map { atan(it) } + override fun sin(arg: StructureND): BufferND = arg.map { sin(it) } + override fun cos(arg: StructureND): BufferND = arg.map { cos(it) } + override fun tan(arg: StructureND): BufferND = arg.map { tan(it) } + override fun asin(arg: StructureND): BufferND = arg.map { asin(it) } + override fun acos(arg: StructureND): BufferND = arg.map { acos(it) } + override fun atan(arg: StructureND): BufferND = arg.map { atan(it) } - override fun sinh(arg: StructureND): NDBuffer = arg.map { sinh(it) } - override fun cosh(arg: StructureND): NDBuffer = arg.map { cosh(it) } - override fun tanh(arg: StructureND): NDBuffer = arg.map { tanh(it) } - override fun asinh(arg: StructureND): NDBuffer = arg.map { asinh(it) } - override fun acosh(arg: StructureND): NDBuffer = arg.map { acosh(it) } - override fun atanh(arg: StructureND): NDBuffer = arg.map { atanh(it) } + override fun sinh(arg: StructureND): BufferND = arg.map { sinh(it) } + override fun cosh(arg: StructureND): BufferND = arg.map { cosh(it) } + override fun tanh(arg: StructureND): BufferND = arg.map { tanh(it) } + override fun asinh(arg: StructureND): BufferND = arg.map { asinh(it) } + override fun acosh(arg: StructureND): BufferND = arg.map { acosh(it) } + override fun atanh(arg: StructureND): BufferND = arg.map { atanh(it) } } fun AlgebraND.Companion.realWithStream(vararg shape: Int): StreamDoubleFieldND = StreamDoubleFieldND(shape) \ No newline at end of file diff --git a/examples/src/main/kotlin/space/kscience/kmath/structures/StructureReadBenchmark.kt b/examples/src/main/kotlin/space/kscience/kmath/structures/StructureReadBenchmark.kt index 89f984a5b..1c8a923c7 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/structures/StructureReadBenchmark.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/structures/StructureReadBenchmark.kt @@ -1,7 +1,7 @@ package space.kscience.kmath.structures +import space.kscience.kmath.nd.BufferND import space.kscience.kmath.nd.DefaultStrides -import space.kscience.kmath.nd.NDBuffer import kotlin.system.measureTimeMillis @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE") @@ -10,7 +10,7 @@ fun main() { val array = DoubleArray(n * n) { 1.0 } val buffer = DoubleBuffer(array) val strides = DefaultStrides(intArrayOf(n, n)) - val structure = NDBuffer(strides, buffer) + val structure = BufferND(strides, buffer) measureTimeMillis { var res = 0.0 diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt index 4efd8383b..89e9649e9 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt @@ -3,25 +3,16 @@ package space.kscience.kmath.commons.linear import org.apache.commons.math3.linear.* import space.kscience.kmath.linear.* import space.kscience.kmath.misc.UnstableKMathAPI -import space.kscience.kmath.nd.StructureND import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.structures.DoubleBuffer import kotlin.reflect.KClass import kotlin.reflect.cast -public class CMMatrix(public val origin: RealMatrix) : Matrix { +public inline class CMMatrix(public val origin: RealMatrix) : Matrix { public override val rowNum: Int get() = origin.rowDimension public override val colNum: Int get() = origin.columnDimension public override operator fun get(i: Int, j: Int): Double = origin.getEntry(i, j) - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is StructureND<*>) return false - return StructureND.contentEquals(this, other) - } - - override fun hashCode(): Int = origin.hashCode() } public inline class CMVector(public val origin: RealVector) : Point { diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/transform/Transformations.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/transform/Transformations.kt index ad6b6d8cd..010ea7e9f 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/transform/Transformations.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/transform/Transformations.kt @@ -6,9 +6,11 @@ import kotlinx.coroutines.flow.map import org.apache.commons.math3.transform.* import space.kscience.kmath.complex.Complex import space.kscience.kmath.streaming.chunked +import space.kscience.kmath.streaming.spread import space.kscience.kmath.structures.* + /** * Streaming and buffer transformations */ diff --git a/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/ComplexFieldND.kt b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/ComplexFieldND.kt index e16962da7..d11f2b7db 100644 --- a/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/ComplexFieldND.kt +++ b/kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/ComplexFieldND.kt @@ -2,8 +2,8 @@ package space.kscience.kmath.complex import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.nd.AlgebraND +import space.kscience.kmath.nd.BufferND import space.kscience.kmath.nd.BufferedFieldND -import space.kscience.kmath.nd.NDBuffer import space.kscience.kmath.nd.StructureND import space.kscience.kmath.operations.ExtendedField import space.kscience.kmath.operations.NumbersAddOperations @@ -22,10 +22,10 @@ public class ComplexFieldND( NumbersAddOperations>, ExtendedField> { - override val zero: NDBuffer by lazy { produce { zero } } - override val one: NDBuffer by lazy { produce { one } } + override val zero: BufferND by lazy { produce { zero } } + override val one: BufferND by lazy { produce { one } } - override fun number(value: Number): NDBuffer { + override fun number(value: Number): BufferND { val d = value.toComplex() // minimize conversions return produce { d } } @@ -76,35 +76,35 @@ public class ComplexFieldND( // return BufferedNDFieldElement(this, buffer) // } - override fun power(arg: StructureND, pow: Number): NDBuffer = arg.map { power(it, pow) } + override fun power(arg: StructureND, pow: Number): BufferND = arg.map { power(it, pow) } - override fun exp(arg: StructureND): NDBuffer = arg.map { exp(it) } + override fun exp(arg: StructureND): BufferND = arg.map { exp(it) } - override fun ln(arg: StructureND): NDBuffer = arg.map { ln(it) } + override fun ln(arg: StructureND): BufferND = arg.map { ln(it) } - override fun sin(arg: StructureND): NDBuffer = arg.map { sin(it) } - override fun cos(arg: StructureND): NDBuffer = arg.map { cos(it) } - override fun tan(arg: StructureND): NDBuffer = arg.map { tan(it) } - override fun asin(arg: StructureND): NDBuffer = arg.map { asin(it) } - override fun acos(arg: StructureND): NDBuffer = arg.map { acos(it) } - override fun atan(arg: StructureND): NDBuffer = arg.map { atan(it) } + override fun sin(arg: StructureND): BufferND = arg.map { sin(it) } + override fun cos(arg: StructureND): BufferND = arg.map { cos(it) } + override fun tan(arg: StructureND): BufferND = arg.map { tan(it) } + override fun asin(arg: StructureND): BufferND = arg.map { asin(it) } + override fun acos(arg: StructureND): BufferND = arg.map { acos(it) } + override fun atan(arg: StructureND): BufferND = arg.map { atan(it) } - override fun sinh(arg: StructureND): NDBuffer = arg.map { sinh(it) } - override fun cosh(arg: StructureND): NDBuffer = arg.map { cosh(it) } - override fun tanh(arg: StructureND): NDBuffer = arg.map { tanh(it) } - override fun asinh(arg: StructureND): NDBuffer = arg.map { asinh(it) } - override fun acosh(arg: StructureND): NDBuffer = arg.map { acosh(it) } - override fun atanh(arg: StructureND): NDBuffer = arg.map { atanh(it) } + override fun sinh(arg: StructureND): BufferND = arg.map { sinh(it) } + override fun cosh(arg: StructureND): BufferND = arg.map { cosh(it) } + override fun tanh(arg: StructureND): BufferND = arg.map { tanh(it) } + override fun asinh(arg: StructureND): BufferND = arg.map { asinh(it) } + override fun acosh(arg: StructureND): BufferND = arg.map { acosh(it) } + override fun atanh(arg: StructureND): BufferND = arg.map { atanh(it) } } /** * Fast element production using function inlining */ -public inline fun BufferedFieldND.produceInline(initializer: ComplexField.(Int) -> Complex): NDBuffer { +public inline fun BufferedFieldND.produceInline(initializer: ComplexField.(Int) -> Complex): BufferND { contract { callsInPlace(initializer, InvocationKind.EXACTLY_ONCE) } val buffer = Buffer.complex(strides.linearSize) { offset -> ComplexField.initializer(offset) } - return NDBuffer(strides, buffer) + return BufferND(strides, buffer) } diff --git a/kmath-core/api/kmath-core.api b/kmath-core/api/kmath-core.api index 8be9ff115..5fabaae1b 100644 --- a/kmath-core/api/kmath-core.api +++ b/kmath-core/api/kmath-core.api @@ -584,7 +584,6 @@ public final class space/kscience/kmath/linear/MatrixFeaturesKt { public final class space/kscience/kmath/linear/MatrixWrapper : space/kscience/kmath/nd/Structure2D { public fun elements ()Lkotlin/sequences/Sequence; - public fun equals (Ljava/lang/Object;)Z public fun get (II)Ljava/lang/Object; public fun get ([I)Ljava/lang/Object; public fun getColNum ()I @@ -595,7 +594,6 @@ public final class space/kscience/kmath/linear/MatrixWrapper : space/kscience/km public fun getRowNum ()I public fun getRows ()Ljava/util/List; public fun getShape ()[I - public fun hashCode ()I public fun toString ()Ljava/lang/String; } @@ -640,7 +638,6 @@ public final class space/kscience/kmath/linear/UnitFeature : space/kscience/kmat public final class space/kscience/kmath/linear/VirtualMatrix : space/kscience/kmath/nd/Structure2D { public fun (IILkotlin/jvm/functions/Function2;)V public fun elements ()Lkotlin/sequences/Sequence; - public fun equals (Ljava/lang/Object;)Z public fun get (II)Ljava/lang/Object; public fun get ([I)Ljava/lang/Object; public fun getColNum ()I @@ -650,7 +647,6 @@ public final class space/kscience/kmath/linear/VirtualMatrix : space/kscience/km public fun getRowNum ()I public fun getRows ()Ljava/util/List; public fun getShape ()[I - public fun hashCode ()I } public final class space/kscience/kmath/linear/ZeroFeature : space/kscience/kmath/linear/DiagonalFeature { @@ -698,22 +694,22 @@ public final class space/kscience/kmath/nd/AlgebraND$DefaultImpls { } public abstract interface class space/kscience/kmath/nd/BufferAlgebraND : space/kscience/kmath/nd/AlgebraND { - public abstract fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public abstract fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/BufferND; public abstract fun getBuffer (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/structures/Buffer; public abstract fun getBufferFactory ()Lkotlin/jvm/functions/Function2; public abstract fun getStrides ()Lspace/kscience/kmath/nd/Strides; - public abstract fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; - public abstract fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; - public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public abstract fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/BufferND; + public abstract fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/BufferND; + public abstract fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/BufferND; } public final class space/kscience/kmath/nd/BufferAlgebraND$DefaultImpls { - public static fun combine (Lspace/kscience/kmath/nd/BufferAlgebraND;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public static fun combine (Lspace/kscience/kmath/nd/BufferAlgebraND;Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/BufferND; public static fun getBuffer (Lspace/kscience/kmath/nd/BufferAlgebraND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/structures/Buffer; public static fun invoke (Lspace/kscience/kmath/nd/BufferAlgebraND;Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; - public static fun map (Lspace/kscience/kmath/nd/BufferAlgebraND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; - public static fun mapIndexed (Lspace/kscience/kmath/nd/BufferAlgebraND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; - public static fun produce (Lspace/kscience/kmath/nd/BufferAlgebraND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public static fun map (Lspace/kscience/kmath/nd/BufferAlgebraND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/BufferND; + public static fun mapIndexed (Lspace/kscience/kmath/nd/BufferAlgebraND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/BufferND; + public static fun produce (Lspace/kscience/kmath/nd/BufferAlgebraND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/BufferND; } public final class space/kscience/kmath/nd/BufferAlgebraNDKt { @@ -725,6 +721,17 @@ public final class space/kscience/kmath/nd/BufferAlgebraNDKt { public static final fun ring (Lspace/kscience/kmath/nd/AlgebraND$Companion;Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedRingND; } +public class space/kscience/kmath/nd/BufferND : space/kscience/kmath/nd/StructureND { + public fun (Lspace/kscience/kmath/nd/Strides;Lspace/kscience/kmath/structures/Buffer;)V + public fun elements ()Lkotlin/sequences/Sequence; + public fun get ([I)Ljava/lang/Object; + public fun getBuffer ()Lspace/kscience/kmath/structures/Buffer; + public fun getDimension ()I + public fun getShape ()[I + public final fun getStrides ()Lspace/kscience/kmath/nd/Strides; + public fun toString ()Ljava/lang/String; +} + public class space/kscience/kmath/nd/BufferedFieldND : space/kscience/kmath/nd/BufferedRingND, space/kscience/kmath/nd/FieldND { public fun ([ILspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function2;)V public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; @@ -761,7 +768,7 @@ public class space/kscience/kmath/nd/BufferedGroupND : space/kscience/kmath/nd/B public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/nd/StructureND; - public fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/BufferND; public synthetic fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND; public fun getBuffer (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/structures/Buffer; public final fun getBufferFactory ()Lkotlin/jvm/functions/Function2; @@ -770,11 +777,11 @@ public class space/kscience/kmath/nd/BufferedGroupND : space/kscience/kmath/nd/B public final fun getShape ()[I public fun getStrides ()Lspace/kscience/kmath/nd/Strides; public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lspace/kscience/kmath/nd/NDBuffer; + public fun getZero ()Lspace/kscience/kmath/nd/BufferND; public fun invoke (Lkotlin/jvm/functions/Function1;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; - public fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/BufferND; public synthetic fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND; - public fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/BufferND; public synthetic fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun minus (Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; @@ -784,7 +791,7 @@ public class space/kscience/kmath/nd/BufferedGroupND : space/kscience/kmath/nd/B public fun plus (Ljava/lang/Object;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public fun plus (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Object;)Lspace/kscience/kmath/nd/StructureND; public fun plus (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; - public fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/BufferND; public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object; public fun unaryMinus (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; @@ -799,7 +806,7 @@ public class space/kscience/kmath/nd/BufferedRingND : space/kscience/kmath/nd/Bu public fun ([ILspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;)V public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lspace/kscience/kmath/nd/NDBuffer; + public fun getOne ()Lspace/kscience/kmath/nd/BufferND; public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; public fun multiply (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; @@ -828,43 +835,43 @@ public final class space/kscience/kmath/nd/DefaultStrides$Companion { public final class space/kscience/kmath/nd/DoubleFieldND : space/kscience/kmath/nd/BufferedFieldND, space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/NumbersAddOperations, space/kscience/kmath/operations/ScaleOperations { public fun ([I)V public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object; - public fun acos (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public fun acos (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND; public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun acosh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public fun acosh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND; public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object; - public fun asin (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public fun asin (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND; public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun asinh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public fun asinh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND; public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object; - public fun atan (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public fun atan (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND; public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun atanh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; - public fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public fun atanh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND; + public fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/BufferND; public synthetic fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object; - public fun cos (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public fun cos (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND; public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object; - public fun cosh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public fun cosh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND; public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object; - public fun exp (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public fun exp (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND; public synthetic fun getBuffer (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/structures/Buffer; public fun getBuffer-Udx-57Q (Lspace/kscience/kmath/nd/StructureND;)[D public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lspace/kscience/kmath/nd/NDBuffer; + public fun getOne ()Lspace/kscience/kmath/nd/BufferND; public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lspace/kscience/kmath/nd/NDBuffer; + public fun getZero ()Lspace/kscience/kmath/nd/BufferND; public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object; - public fun ln (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; - public fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public fun ln (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND; + public fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/BufferND; public synthetic fun map (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND; - public fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/NDBuffer; + public fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/BufferND; public synthetic fun mapIndexed (Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public fun minus (Ljava/lang/Number;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun minus (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDBuffer; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/BufferND; public synthetic fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public fun plus (Ljava/lang/Number;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; @@ -873,22 +880,22 @@ public final class space/kscience/kmath/nd/DoubleFieldND : space/kscience/kmath/ public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun pow (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; - public fun power (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDBuffer; - public fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public fun power (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/BufferND; + public fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/BufferND; public synthetic fun produce (Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/StructureND; public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun scale (Ljava/lang/Object;D)Ljava/lang/Object; public fun scale (Lspace/kscience/kmath/nd/StructureND;D)Lspace/kscience/kmath/nd/StructureND; public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object; - public fun sin (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public fun sin (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND; public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object; - public fun sinh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public fun sinh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND; public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object; public fun sqrt (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object; - public fun tan (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public fun tan (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND; public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object; - public fun tanh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/NDBuffer; + public fun tanh (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/BufferND; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; } @@ -965,32 +972,19 @@ public final class space/kscience/kmath/nd/GroupND$DefaultImpls { public static fun unaryPlus (Lspace/kscience/kmath/nd/GroupND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; } -public final class space/kscience/kmath/nd/MutableNDBuffer : space/kscience/kmath/nd/NDBuffer, space/kscience/kmath/nd/MutableNDStructure { +public final class space/kscience/kmath/nd/MutableBufferND : space/kscience/kmath/nd/BufferND, space/kscience/kmath/nd/MutableStructureND { public fun (Lspace/kscience/kmath/nd/Strides;Lspace/kscience/kmath/structures/MutableBuffer;)V public synthetic fun getBuffer ()Lspace/kscience/kmath/structures/Buffer; public fun getBuffer ()Lspace/kscience/kmath/structures/MutableBuffer; public fun set ([ILjava/lang/Object;)V } -public abstract interface class space/kscience/kmath/nd/MutableNDStructure : space/kscience/kmath/nd/StructureND { +public abstract interface class space/kscience/kmath/nd/MutableStructureND : space/kscience/kmath/nd/StructureND { public abstract fun set ([ILjava/lang/Object;)V } -public final class space/kscience/kmath/nd/MutableNDStructure$DefaultImpls { - public static fun getDimension (Lspace/kscience/kmath/nd/MutableNDStructure;)I -} - -public class space/kscience/kmath/nd/NDBuffer : space/kscience/kmath/nd/StructureND { - public fun (Lspace/kscience/kmath/nd/Strides;Lspace/kscience/kmath/structures/Buffer;)V - public fun elements ()Lkotlin/sequences/Sequence; - public fun equals (Ljava/lang/Object;)Z - public fun get ([I)Ljava/lang/Object; - public fun getBuffer ()Lspace/kscience/kmath/structures/Buffer; - public fun getDimension ()I - public fun getShape ()[I - public final fun getStrides ()Lspace/kscience/kmath/nd/Strides; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; +public final class space/kscience/kmath/nd/MutableStructureND$DefaultImpls { + public static fun getDimension (Lspace/kscience/kmath/nd/MutableStructureND;)I } public abstract interface class space/kscience/kmath/nd/RingND : space/kscience/kmath/nd/GroupND, space/kscience/kmath/operations/Ring { @@ -1033,9 +1027,9 @@ public final class space/kscience/kmath/nd/ShapeMismatchException : java/lang/Ru public final class space/kscience/kmath/nd/ShortRingND : space/kscience/kmath/nd/BufferedRingND, space/kscience/kmath/operations/NumbersAddOperations { public fun ([I)V public synthetic fun getOne ()Ljava/lang/Object; - public fun getOne ()Lspace/kscience/kmath/nd/NDBuffer; + public fun getOne ()Lspace/kscience/kmath/nd/BufferND; public synthetic fun getZero ()Ljava/lang/Object; - public fun getZero ()Lspace/kscience/kmath/nd/NDBuffer; + public fun getZero ()Lspace/kscience/kmath/nd/BufferND; public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; @@ -1044,7 +1038,7 @@ public final class space/kscience/kmath/nd/ShortRingND : space/kscience/kmath/nd public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; public fun minus (Lspace/kscience/kmath/nd/StructureND;Ljava/lang/Number;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object; - public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/NDBuffer; + public fun number (Ljava/lang/Number;)Lspace/kscience/kmath/nd/BufferND; public synthetic fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object; public fun plus (Ljava/lang/Number;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object; @@ -1056,7 +1050,7 @@ public final class space/kscience/kmath/nd/ShortRingND : space/kscience/kmath/nd public final class space/kscience/kmath/nd/ShortRingNDKt { public static final fun nd (Lspace/kscience/kmath/operations/ShortRing;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun produceInline (Lspace/kscience/kmath/nd/BufferedRingND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/NDBuffer; + public static final fun produceInline (Lspace/kscience/kmath/nd/BufferedRingND;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/nd/BufferND; } public abstract interface class space/kscience/kmath/nd/Strides { @@ -1121,20 +1115,18 @@ public final class space/kscience/kmath/nd/Structure2DKt { public abstract interface class space/kscience/kmath/nd/StructureND { public static final field Companion Lspace/kscience/kmath/nd/StructureND$Companion; public abstract fun elements ()Lkotlin/sequences/Sequence; - public abstract fun equals (Ljava/lang/Object;)Z public abstract fun get ([I)Ljava/lang/Object; public abstract fun getDimension ()I public abstract fun getShape ()[I - public abstract fun hashCode ()I } public final class space/kscience/kmath/nd/StructureND$Companion { - public final fun auto (Lkotlin/reflect/KClass;Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; - public final fun auto (Lkotlin/reflect/KClass;[ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; - public final fun buffered (Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; - public final fun buffered ([ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/NDBuffer; - public static synthetic fun buffered$default (Lspace/kscience/kmath/nd/StructureND$Companion;Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/kmath/nd/NDBuffer; - public static synthetic fun buffered$default (Lspace/kscience/kmath/nd/StructureND$Companion;[ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/kmath/nd/NDBuffer; + public final fun auto (Lkotlin/reflect/KClass;Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/BufferND; + public final fun auto (Lkotlin/reflect/KClass;[ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/BufferND; + public final fun buffered (Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/BufferND; + public final fun buffered ([ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/nd/BufferND; + public static synthetic fun buffered$default (Lspace/kscience/kmath/nd/StructureND$Companion;Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/kmath/nd/BufferND; + public static synthetic fun buffered$default (Lspace/kscience/kmath/nd/StructureND$Companion;[ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/kmath/nd/BufferND; public final fun contentEquals (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Z } @@ -1144,7 +1136,7 @@ public final class space/kscience/kmath/nd/StructureND$DefaultImpls { public final class space/kscience/kmath/nd/StructureNDKt { public static final fun get (Lspace/kscience/kmath/nd/StructureND;[I)Ljava/lang/Object; - public static final fun mapInPlace (Lspace/kscience/kmath/nd/MutableNDStructure;Lkotlin/jvm/functions/Function2;)V + public static final fun mapInPlace (Lspace/kscience/kmath/nd/MutableStructureND;Lkotlin/jvm/functions/Function2;)V } public abstract interface class space/kscience/kmath/operations/Algebra { diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixWrapper.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixWrapper.kt index 97f0acd61..868f74cc6 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixWrapper.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixWrapper.kt @@ -23,8 +23,6 @@ public class MatrixWrapper internal constructor( override fun getFeature(type: KClass): T? = features.singleOrNull { type.isInstance(it) } as? T ?: origin.getFeature(type) - override fun equals(other: Any?): Boolean = origin == other - override fun hashCode(): Int = origin.hashCode() override fun toString(): String { return "MatrixWrapper(matrix=$origin, features=$features)" } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VirtualMatrix.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VirtualMatrix.kt index 56cafbdb5..e80ee5ebd 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VirtualMatrix.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/VirtualMatrix.kt @@ -1,7 +1,5 @@ package space.kscience.kmath.linear -import space.kscience.kmath.nd.StructureND - /** * The matrix where each element is evaluated each time when is being accessed. * @@ -16,17 +14,4 @@ public class VirtualMatrix( override val shape: IntArray get() = intArrayOf(rowNum, colNum) override operator fun get(i: Int, j: Int): T = generator(i, j) - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is StructureND<*>) return false - return StructureND.contentEquals(this, other) - } - - override fun hashCode(): Int { - var result = rowNum - result = 31 * result + colNum - result = 31 * result + generator.hashCode() - return result - } } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferAlgebraND.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferAlgebraND.kt index b81eb9519..67e94df74 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferAlgebraND.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferAlgebraND.kt @@ -10,7 +10,7 @@ public interface BufferAlgebraND> : AlgebraND { public val strides: Strides public val bufferFactory: BufferFactory - override fun produce(initializer: A.(IntArray) -> T): NDBuffer = NDBuffer( + override fun produce(initializer: A.(IntArray) -> T): BufferND = BufferND( strides, bufferFactory(strides.linearSize) { offset -> elementContext.initializer(strides.index(offset)) @@ -23,32 +23,32 @@ public interface BufferAlgebraND> : AlgebraND { this@BufferAlgebraND.shape, shape ) - this is NDBuffer && this.strides == this@BufferAlgebraND.strides -> this.buffer + this is BufferND && this.strides == this@BufferAlgebraND.strides -> this.buffer else -> bufferFactory(strides.linearSize) { offset -> get(strides.index(offset)) } } - override fun StructureND.map(transform: A.(T) -> T): NDBuffer { + override fun StructureND.map(transform: A.(T) -> T): BufferND { val buffer = bufferFactory(strides.linearSize) { offset -> elementContext.transform(buffer[offset]) } - return NDBuffer(strides, buffer) + return BufferND(strides, buffer) } - override fun StructureND.mapIndexed(transform: A.(index: IntArray, T) -> T): NDBuffer { + override fun StructureND.mapIndexed(transform: A.(index: IntArray, T) -> T): BufferND { val buffer = bufferFactory(strides.linearSize) { offset -> elementContext.transform( strides.index(offset), buffer[offset] ) } - return NDBuffer(strides, buffer) + return BufferND(strides, buffer) } - override fun combine(a: StructureND, b: StructureND, transform: A.(T, T) -> T): NDBuffer { + override fun combine(a: StructureND, b: StructureND, transform: A.(T, T) -> T): BufferND { val buffer = bufferFactory(strides.linearSize) { offset -> elementContext.transform(a.buffer[offset], b.buffer[offset]) } - return NDBuffer(strides, buffer) + return BufferND(strides, buffer) } } @@ -58,7 +58,7 @@ public open class BufferedGroupND>( final override val bufferFactory: BufferFactory, ) : GroupND, BufferAlgebraND { override val strides: Strides = DefaultStrides(shape) - override val zero: NDBuffer by lazy { produce { zero } } + override val zero: BufferND by lazy { produce { zero } } override fun StructureND.unaryMinus(): StructureND = produce { -get(it) } } @@ -67,7 +67,7 @@ public open class BufferedRingND>( elementContext: R, bufferFactory: BufferFactory, ) : BufferedGroupND(shape, elementContext, bufferFactory), RingND { - override val one: NDBuffer by lazy { produce { one } } + override val one: BufferND by lazy { produce { one } } } public open class BufferedFieldND>( diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/DoubleFieldND.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/DoubleFieldND.kt index a7a9d8935..d38ed02da 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/DoubleFieldND.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/DoubleFieldND.kt @@ -17,10 +17,10 @@ public class DoubleFieldND( ScaleOperations>, ExtendedField> { - override val zero: NDBuffer by lazy { produce { zero } } - override val one: NDBuffer by lazy { produce { one } } + override val zero: BufferND by lazy { produce { zero } } + override val one: BufferND by lazy { produce { one } } - override fun number(value: Number): NDBuffer { + override fun number(value: Number): BufferND { val d = value.toDouble() // minimize conversions return produce { d } } @@ -31,31 +31,31 @@ public class DoubleFieldND( this@DoubleFieldND.shape, shape ) - this is NDBuffer && this.strides == this@DoubleFieldND.strides -> this.buffer as DoubleBuffer + this is BufferND && this.strides == this@DoubleFieldND.strides -> this.buffer as DoubleBuffer else -> DoubleBuffer(strides.linearSize) { offset -> get(strides.index(offset)) } } @Suppress("OVERRIDE_BY_INLINE") override inline fun StructureND.map( transform: DoubleField.(Double) -> Double, - ): NDBuffer { + ): BufferND { val buffer = DoubleBuffer(strides.linearSize) { offset -> DoubleField.transform(buffer.array[offset]) } - return NDBuffer(strides, buffer) + return BufferND(strides, buffer) } @Suppress("OVERRIDE_BY_INLINE") - override inline fun produce(initializer: DoubleField.(IntArray) -> Double): NDBuffer { + override inline fun produce(initializer: DoubleField.(IntArray) -> Double): BufferND { val array = DoubleArray(strides.linearSize) { offset -> val index = strides.index(offset) DoubleField.initializer(index) } - return NDBuffer(strides, DoubleBuffer(array)) + return BufferND(strides, DoubleBuffer(array)) } @Suppress("OVERRIDE_BY_INLINE") override inline fun StructureND.mapIndexed( transform: DoubleField.(index: IntArray, Double) -> Double, - ): NDBuffer = NDBuffer( + ): BufferND = BufferND( strides, buffer = DoubleBuffer(strides.linearSize) { offset -> DoubleField.transform( @@ -69,34 +69,34 @@ public class DoubleFieldND( a: StructureND, b: StructureND, transform: DoubleField.(Double, Double) -> Double, - ): NDBuffer { + ): BufferND { val buffer = DoubleBuffer(strides.linearSize) { offset -> DoubleField.transform(a.buffer.array[offset], b.buffer.array[offset]) } - return NDBuffer(strides, buffer) + return BufferND(strides, buffer) } override fun scale(a: StructureND, value: Double): StructureND = a.map { it * value } - override fun power(arg: StructureND, pow: Number): NDBuffer = arg.map { power(it, pow) } + override fun power(arg: StructureND, pow: Number): BufferND = arg.map { power(it, pow) } - override fun exp(arg: StructureND): NDBuffer = arg.map { exp(it) } + override fun exp(arg: StructureND): BufferND = arg.map { exp(it) } - override fun ln(arg: StructureND): NDBuffer = arg.map { ln(it) } + override fun ln(arg: StructureND): BufferND = arg.map { ln(it) } - override fun sin(arg: StructureND): NDBuffer = arg.map { sin(it) } - override fun cos(arg: StructureND): NDBuffer = arg.map { cos(it) } - override fun tan(arg: StructureND): NDBuffer = arg.map { tan(it) } - override fun asin(arg: StructureND): NDBuffer = arg.map { asin(it) } - override fun acos(arg: StructureND): NDBuffer = arg.map { acos(it) } - override fun atan(arg: StructureND): NDBuffer = arg.map { atan(it) } + override fun sin(arg: StructureND): BufferND = arg.map { sin(it) } + override fun cos(arg: StructureND): BufferND = arg.map { cos(it) } + override fun tan(arg: StructureND): BufferND = arg.map { tan(it) } + override fun asin(arg: StructureND): BufferND = arg.map { asin(it) } + override fun acos(arg: StructureND): BufferND = arg.map { acos(it) } + override fun atan(arg: StructureND): BufferND = arg.map { atan(it) } - override fun sinh(arg: StructureND): NDBuffer = arg.map { sinh(it) } - override fun cosh(arg: StructureND): NDBuffer = arg.map { cosh(it) } - override fun tanh(arg: StructureND): NDBuffer = arg.map { tanh(it) } - override fun asinh(arg: StructureND): NDBuffer = arg.map { asinh(it) } - override fun acosh(arg: StructureND): NDBuffer = arg.map { acosh(it) } - override fun atanh(arg: StructureND): NDBuffer = arg.map { atanh(it) } + override fun sinh(arg: StructureND): BufferND = arg.map { sinh(it) } + override fun cosh(arg: StructureND): BufferND = arg.map { cosh(it) } + override fun tanh(arg: StructureND): BufferND = arg.map { tanh(it) } + override fun asinh(arg: StructureND): BufferND = arg.map { asinh(it) } + override fun acosh(arg: StructureND): BufferND = arg.map { acosh(it) } + override fun atanh(arg: StructureND): BufferND = arg.map { atanh(it) } } public fun AlgebraND.Companion.real(vararg shape: Int): DoubleFieldND = DoubleFieldND(shape) diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/ShortRingND.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/ShortRingND.kt index 4e39dd544..f1056d0ff 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/ShortRingND.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/ShortRingND.kt @@ -14,10 +14,10 @@ public class ShortRingND( ) : BufferedRingND(shape, ShortRing, Buffer.Companion::auto), NumbersAddOperations> { - override val zero: NDBuffer by lazy { produce { zero } } - override val one: NDBuffer by lazy { produce { one } } + override val zero: BufferND by lazy { produce { zero } } + override val one: BufferND by lazy { produce { one } } - override fun number(value: Number): NDBuffer { + override fun number(value: Number): BufferND { val d = value.toShort() // minimize conversions return produce { d } } @@ -26,8 +26,8 @@ public class ShortRingND( /** * Fast element production using function inlining. */ -public inline fun BufferedRingND.produceInline(crossinline initializer: ShortRing.(Int) -> Short): NDBuffer { - return NDBuffer(strides, ShortBuffer(ShortArray(strides.linearSize) { offset -> ShortRing.initializer(offset) })) +public inline fun BufferedRingND.produceInline(crossinline initializer: ShortRing.(Int) -> Short): BufferND { + return BufferND(strides, ShortBuffer(ShortArray(strides.linearSize) { offset -> ShortRing.initializer(offset) })) } public inline fun ShortRing.nd(vararg shape: Int, action: ShortRingND.() -> R): R { diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt index eba51a980..8cf5d18cb 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt @@ -47,7 +47,7 @@ private inline class Buffer1DWrapper(val buffer: Buffer) : Structure1D */ public fun StructureND.as1D(): Structure1D = this as? Structure1D ?: if (shape.size == 1) { when (this) { - is NDBuffer -> Buffer1DWrapper(this.buffer) + is BufferND -> Buffer1DWrapper(this.buffer) else -> Structure1DWrapper(this) } } else error("Can't create 1d-structure from ${shape.size}d-structure") @@ -62,6 +62,6 @@ public fun Buffer.asND(): Structure1D = Buffer1DWrapper(this) */ internal fun Structure1D.unwrap(): Buffer = when { this is Buffer1DWrapper -> buffer - this is Structure1DWrapper && structure is NDBuffer -> structure.buffer + this is Structure1DWrapper && structure is BufferND -> structure.buffer else -> this } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt index 1c3b0fec8..3834cd97c 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt @@ -60,7 +60,7 @@ public interface Structure2D : StructureND { /** * A 2D wrapper for nd-structure */ -private class Structure2DWrapper(val structure: StructureND) : Structure2D { +private inline class Structure2DWrapper(val structure: StructureND) : Structure2D { override val shape: IntArray get() = structure.shape override val rowNum: Int get() = shape[0] @@ -72,10 +72,6 @@ private class Structure2DWrapper(val structure: StructureND) : Structure2D override fun getFeature(type: KClass): F? = structure.getFeature(type) override fun elements(): Sequence> = structure.elements() - - override fun equals(other: Any?): Boolean = structure == other - - override fun hashCode(): Int = structure.hashCode() } /** diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/StructureND.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/StructureND.kt index 54253ba9e..bb7814bfd 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/StructureND.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/StructureND.kt @@ -14,6 +14,8 @@ import kotlin.reflect.KClass * of dimensions and items in an array is defined by its shape, which is a sequence of non-negative integers that * specify the sizes of each dimension. * + * StructureND is in general identity-free. [StructureND.contentEquals] should be used in tests to compare contents. + * * @param T the type of items. */ public interface StructureND { @@ -43,10 +45,6 @@ public interface StructureND { */ public fun elements(): Sequence> - //force override equality and hash code - public override fun equals(other: Any?): Boolean - public override fun hashCode(): Int - /** * Feature is some additional strucure information which allows to access it special properties or hints. * If the feature is not present, null is returned. @@ -62,7 +60,7 @@ public interface StructureND { if (st1 === st2) return true // fast comparison of buffers if possible - if (st1 is NDBuffer && st2 is NDBuffer && st1.strides == st2.strides) + if (st1 is BufferND && st2 is BufferND && st1.strides == st2.strides) return st1.buffer.contentEquals(st2.buffer) //element by element comparison if it could not be avoided @@ -78,7 +76,7 @@ public interface StructureND { strides: Strides, bufferFactory: BufferFactory = Buffer.Companion::boxing, initializer: (IntArray) -> T, - ): NDBuffer = NDBuffer(strides, bufferFactory(strides.linearSize) { i -> initializer(strides.index(i)) }) + ): BufferND = BufferND(strides, bufferFactory(strides.linearSize) { i -> initializer(strides.index(i)) }) /** * Inline create NDStructure with non-boxing buffer implementation if it is possible @@ -86,37 +84,37 @@ public interface StructureND { public inline fun auto( strides: Strides, crossinline initializer: (IntArray) -> T, - ): NDBuffer = NDBuffer(strides, Buffer.auto(strides.linearSize) { i -> initializer(strides.index(i)) }) + ): BufferND = BufferND(strides, Buffer.auto(strides.linearSize) { i -> initializer(strides.index(i)) }) public inline fun auto( type: KClass, strides: Strides, crossinline initializer: (IntArray) -> T, - ): NDBuffer = NDBuffer(strides, Buffer.auto(type, strides.linearSize) { i -> initializer(strides.index(i)) }) + ): BufferND = BufferND(strides, Buffer.auto(type, strides.linearSize) { i -> initializer(strides.index(i)) }) public fun buffered( shape: IntArray, bufferFactory: BufferFactory = Buffer.Companion::boxing, initializer: (IntArray) -> T, - ): NDBuffer = buffered(DefaultStrides(shape), bufferFactory, initializer) + ): BufferND = buffered(DefaultStrides(shape), bufferFactory, initializer) public inline fun auto( shape: IntArray, crossinline initializer: (IntArray) -> T, - ): NDBuffer = auto(DefaultStrides(shape), initializer) + ): BufferND = auto(DefaultStrides(shape), initializer) @JvmName("autoVarArg") public inline fun auto( vararg shape: Int, crossinline initializer: (IntArray) -> T, - ): NDBuffer = + ): BufferND = auto(DefaultStrides(shape), initializer) public inline fun auto( type: KClass, vararg shape: Int, crossinline initializer: (IntArray) -> T, - ): NDBuffer = auto(type, DefaultStrides(shape), initializer) + ): BufferND = auto(type, DefaultStrides(shape), initializer) } } @@ -134,7 +132,7 @@ public inline fun StructureND<*>.getFeature(): T? = getFeature /** * Represents mutable [StructureND]. */ -public interface MutableNDStructure : StructureND { +public interface MutableStructureND : StructureND { /** * Inserts an item at the specified indices. * @@ -147,7 +145,7 @@ public interface MutableNDStructure : StructureND { /** * Transform a structure element-by element in place. */ -public inline fun MutableNDStructure.mapInPlace(action: (IntArray, T) -> T): Unit = +public inline fun MutableStructureND.mapInPlace(action: (IntArray, T) -> T): Unit = elements().forEach { (index, oldValue) -> this[index] = action(index, oldValue) } /** @@ -258,7 +256,7 @@ public class DefaultStrides private constructor(override val shape: IntArray) : * @param strides The strides to access elements of [Buffer] by linear indices. * @param buffer The underlying buffer. */ -public open class NDBuffer( +public open class BufferND( public val strides: Strides, buffer: Buffer, ) : StructureND { @@ -279,16 +277,6 @@ public open class NDBuffer( it to this[it] } - override fun equals(other: Any?): Boolean { - return StructureND.contentEquals(this, other as? StructureND<*> ?: return false) - } - - override fun hashCode(): Int { - var result = strides.hashCode() - result = 31 * result + buffer.hashCode() - return result - } - override fun toString(): String { val bufferRepr: String = when (shape.size) { 1 -> buffer.asSequence().joinToString(prefix = "[", postfix = "]", separator = ", ") @@ -305,27 +293,27 @@ public open class NDBuffer( } /** - * Transform structure to a new structure using provided [BufferFactory] and optimizing if argument is [NDBuffer] + * Transform structure to a new structure using provided [BufferFactory] and optimizing if argument is [BufferND] */ public inline fun StructureND.mapToBuffer( factory: BufferFactory = Buffer.Companion::auto, crossinline transform: (T) -> R, -): NDBuffer { - return if (this is NDBuffer) - NDBuffer(this.strides, factory.invoke(strides.linearSize) { transform(buffer[it]) }) +): BufferND { + return if (this is BufferND) + BufferND(this.strides, factory.invoke(strides.linearSize) { transform(buffer[it]) }) else { val strides = DefaultStrides(shape) - NDBuffer(strides, factory.invoke(strides.linearSize) { transform(get(strides.index(it))) }) + BufferND(strides, factory.invoke(strides.linearSize) { transform(get(strides.index(it))) }) } } /** * Mutable ND buffer based on linear [MutableBuffer]. */ -public class MutableNDBuffer( +public class MutableBufferND( strides: Strides, buffer: MutableBuffer, -) : NDBuffer(strides, buffer), MutableNDStructure { +) : BufferND(strides, buffer), MutableStructureND { init { require(strides.linearSize == buffer.size) { diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt index 1c64bfcec..d373be35e 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt @@ -17,7 +17,9 @@ public typealias BufferFactory = (Int, (Int) -> T) -> Buffer public typealias MutableBufferFactory = (Int, (Int) -> T) -> MutableBuffer /** - * A generic immutable random-access structure for both primitives and objects. + * A generic read-only random-access structure for both primitives and objects. + * + * [Buffer] is in general identity-free. [contentEquals] should be used for content equality checks * * @param T the type of elements contained in the buffer. */ @@ -40,8 +42,13 @@ public interface Buffer { /** * Checks content equality with another buffer. */ - public fun contentEquals(other: Buffer<*>): Boolean = - asSequence().mapIndexed { index, value -> value == other[index] }.all { it } + public fun contentEquals(other: Buffer<*>): Boolean { + if (this.size != other.size) return false + for (i in indices) { + if (get(i) != other[i]) return false + } + return true + } public companion object { /** diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/DoubleLUSolverTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/DoubleLUSolverTest.kt index 6761575f6..445aadd97 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/DoubleLUSolverTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/DoubleLUSolverTest.kt @@ -1,8 +1,14 @@ package space.kscience.kmath.linear import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.nd.StructureND import kotlin.test.Test import kotlin.test.assertEquals +import kotlin.test.assertTrue + +fun assertMatrixEquals(expected: StructureND, actual: StructureND) { + assertTrue { StructureND.contentEquals(expected, actual) } +} @UnstableKMathAPI class DoubleLUSolverTest { @@ -11,7 +17,7 @@ class DoubleLUSolverTest { fun testInvertOne() { val matrix = LinearSpace.real.one(2, 2) val inverted = LinearSpace.real.inverseWithLup(matrix) - assertEquals(matrix, inverted) + assertMatrixEquals(matrix, inverted) } @Test @@ -27,7 +33,7 @@ class DoubleLUSolverTest { //Check determinant assertEquals(7.0, lup.determinant) - assertEquals(lup.p dot matrix, lup.l dot lup.u) + assertMatrixEquals(lup.p dot matrix, lup.l dot lup.u) } } @@ -45,6 +51,6 @@ class DoubleLUSolverTest { -0.125, 0.375 ) - assertEquals(expected, inverted) + assertMatrixEquals(expected, inverted) } } diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt index a8a2f2586..fd6fb320b 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/linear/MatrixTest.kt @@ -5,6 +5,7 @@ import space.kscience.kmath.nd.StructureND import space.kscience.kmath.nd.as2D import kotlin.test.Test import kotlin.test.assertEquals +import kotlin.test.assertTrue @UnstableKMathAPI @Suppress("UNUSED_VARIABLE") @@ -13,7 +14,7 @@ class MatrixTest { fun testTranspose() { val matrix = LinearSpace.real.one(3, 3) val transposed = matrix.transpose() - assertEquals(matrix, transposed) + assertTrue { StructureND.contentEquals(matrix, transposed) } } @Test diff --git a/kmath-coroutines/src/jvmMain/kotlin/space/kscience/kmath/structures/LazyStructureND.kt b/kmath-coroutines/src/jvmMain/kotlin/space/kscience/kmath/structures/LazyStructureND.kt index 261f91aee..6b0938c54 100644 --- a/kmath-coroutines/src/jvmMain/kotlin/space/kscience/kmath/structures/LazyStructureND.kt +++ b/kmath-coroutines/src/jvmMain/kotlin/space/kscience/kmath/structures/LazyStructureND.kt @@ -24,18 +24,6 @@ public class LazyStructureND( val res = runBlocking { strides.indices().toList().map { index -> index to await(index) } } return res.asSequence() } - - public override fun equals(other: Any?): Boolean { - return StructureND.contentEquals(this, other as? StructureND<*> ?: return false) - } - - public override fun hashCode(): Int { - var result = scope.hashCode() - result = 31 * result + shape.contentHashCode() - result = 31 * result + function.hashCode() - result = 31 * result + cache.hashCode() - return result - } } public fun StructureND.deferred(index: IntArray): Deferred = diff --git a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt index c79493411..712c2a42c 100644 --- a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt +++ b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt @@ -2,7 +2,6 @@ package space.kscience.kmath.ejml import org.ejml.simple.SimpleMatrix import space.kscience.kmath.linear.Matrix -import space.kscience.kmath.nd.StructureND /** * Represents featured matrix over EJML [SimpleMatrix]. @@ -10,19 +9,9 @@ import space.kscience.kmath.nd.StructureND * @property origin the underlying [SimpleMatrix]. * @author Iaroslav Postovalov */ -public class EjmlMatrix(public val origin: SimpleMatrix) : Matrix { +public inline class EjmlMatrix(public val origin: SimpleMatrix) : Matrix { public override val rowNum: Int get() = origin.numRows() public override val colNum: Int get() = origin.numCols() public override operator fun get(i: Int, j: Int): Double = origin[i, j] - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is StructureND<*>) return false - return StructureND.contentEquals(this, other) - } - - override fun hashCode(): Int = origin.hashCode() - - } diff --git a/kmath-ejml/src/test/kotlin/space/kscience/kmath/ejml/EjmlMatrixTest.kt b/kmath-ejml/src/test/kotlin/space/kscience/kmath/ejml/EjmlMatrixTest.kt index 70b2ce723..5fb526f40 100644 --- a/kmath-ejml/src/test/kotlin/space/kscience/kmath/ejml/EjmlMatrixTest.kt +++ b/kmath-ejml/src/test/kotlin/space/kscience/kmath/ejml/EjmlMatrixTest.kt @@ -4,11 +4,16 @@ import org.ejml.dense.row.factory.DecompositionFactory_DDRM import org.ejml.simple.SimpleMatrix import space.kscience.kmath.linear.* import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.nd.StructureND import space.kscience.kmath.nd.getFeature import kotlin.random.Random import kotlin.random.asJavaRandom import kotlin.test.* +fun assertMatrixEquals(expected: StructureND, actual: StructureND) { + assertTrue { StructureND.contentEquals(expected, actual) } +} + internal class EjmlMatrixTest { private val random = Random(0) @@ -49,9 +54,9 @@ internal class EjmlMatrixTest { val ludecompositionF64 = DecompositionFactory_DDRM.lu(m.numRows(), m.numCols()) .also { it.decompose(m.ddrm.copy()) } - assertEquals(EjmlMatrix(SimpleMatrix(ludecompositionF64.getLower(null))), lup.l) - assertEquals(EjmlMatrix(SimpleMatrix(ludecompositionF64.getUpper(null))), lup.u) - assertEquals(EjmlMatrix(SimpleMatrix(ludecompositionF64.getRowPivot(null))), lup.p) + assertMatrixEquals(EjmlMatrix(SimpleMatrix(ludecompositionF64.getLower(null))), lup.l) + assertMatrixEquals(EjmlMatrix(SimpleMatrix(ludecompositionF64.getUpper(null))), lup.u) + assertMatrixEquals(EjmlMatrix(SimpleMatrix(ludecompositionF64.getRowPivot(null))), lup.p) } private object SomeFeature : MatrixFeature {} diff --git a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/realND.kt b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/realND.kt index 7655a4170..95faec4b3 100644 --- a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/realND.kt +++ b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/realND.kt @@ -1,31 +1,31 @@ package space.kscience.kmath.real -import space.kscience.kmath.nd.NDBuffer +import space.kscience.kmath.nd.BufferND import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.structures.DoubleBuffer /** - * Map one [NDBuffer] using function without indices. + * Map one [BufferND] using function without indices. */ -public inline fun NDBuffer.mapInline(crossinline transform: DoubleField.(Double) -> Double): NDBuffer { +public inline fun BufferND.mapInline(crossinline transform: DoubleField.(Double) -> Double): BufferND { val array = DoubleArray(strides.linearSize) { offset -> DoubleField.transform(buffer[offset]) } - return NDBuffer(strides, DoubleBuffer(array)) + return BufferND(strides, DoubleBuffer(array)) } /** * Element by element application of any operation on elements to the whole array. Just like in numpy. */ -public operator fun Function1.invoke(ndElement: NDBuffer): NDBuffer = - ndElement.mapInline { this@invoke(it) } +public operator fun Function1.invoke(elementND: BufferND): BufferND = + elementND.mapInline { this@invoke(it) } /* plus and minus */ /** - * Summation operation for [NDBuffer] and single element + * Summation operation for [BufferND] and single element */ -public operator fun NDBuffer.plus(arg: Double): NDBuffer = mapInline { it + arg } +public operator fun BufferND.plus(arg: Double): BufferND = mapInline { it + arg } /** - * Subtraction operation between [NDBuffer] and single element + * Subtraction operation between [BufferND] and single element */ -public operator fun NDBuffer.minus(arg: Double): NDBuffer = mapInline { it - arg } \ No newline at end of file +public operator fun BufferND.minus(arg: Double): BufferND = mapInline { it - arg } \ No newline at end of file diff --git a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/DoubleMatrixTest.kt b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/DoubleMatrixTest.kt index c1d3ccf5f..1c47d803a 100644 --- a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/DoubleMatrixTest.kt +++ b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/DoubleMatrixTest.kt @@ -3,12 +3,17 @@ package kaceince.kmath.real import space.kscience.kmath.linear.LinearSpace import space.kscience.kmath.linear.matrix import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.nd.StructureND import space.kscience.kmath.real.* import space.kscience.kmath.structures.contentEquals import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue +fun assertMatrixEquals(expected: StructureND, actual: StructureND) { + assertTrue { StructureND.contentEquals(expected, actual) } +} + @UnstableKMathAPI internal class DoubleMatrixTest { @Test @@ -43,7 +48,7 @@ internal class DoubleMatrixTest { 1.0, 0.0, 0.0, 0.0, 1.0, 2.0 ) - assertEquals(matrix2, matrix1.repeatStackVertical(3)) + assertMatrixEquals(matrix2, matrix1.repeatStackVertical(3)) } @Test @@ -57,7 +62,7 @@ internal class DoubleMatrixTest { 0.75, -0.5, 3.25, 4.5, 7.0, 2.0 ) - assertEquals(matrix2, expectedResult) + assertMatrixEquals(matrix2, expectedResult) } @Test @@ -72,7 +77,7 @@ internal class DoubleMatrixTest { 5.0, 10.0, -5.0, -10.0, -20.0, 0.0 ) - assertEquals(matrix2, expectedResult) + assertMatrixEquals(matrix2, expectedResult) } @Test @@ -89,8 +94,8 @@ internal class DoubleMatrixTest { -1.0, 0.0, 27.0, 64.0, -216.0, -8.0 ) - assertEquals(matrix1.square(), matrix2) - assertEquals(matrix1.pow(3), matrix3) + assertMatrixEquals(matrix1.square(), matrix2) + assertMatrixEquals(matrix1.pow(3), matrix3) } @OptIn(UnstableKMathAPI::class) @@ -109,7 +114,7 @@ internal class DoubleMatrixTest { -3.0, 0.0, 9.0, 16.0, -48.0, -5.0 ) - assertEquals(result, expectedResult) + assertMatrixEquals(result, expectedResult) } @Test @@ -128,9 +133,9 @@ internal class DoubleMatrixTest { -6.0, 7.0 ) - assertEquals(matrix1.appendColumn { it[0] }, matrix2) - assertEquals(matrix1.extractColumn(1), col1) - assertEquals(matrix1.extractColumns(1..2), cols1to2) + assertMatrixEquals(matrix1.appendColumn { it[0] }, matrix2) + assertMatrixEquals(matrix1.extractColumn(1), col1) + assertMatrixEquals(matrix1.extractColumns(1..2), cols1to2) //equals should never be called on buffers assertTrue { matrix1.sumByColumn().contentEquals(3.0, -6.0, 10.0, 4.0) diff --git a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/DoubleHistogramSpace.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/DoubleHistogramSpace.kt index fa9b67404..384ce6159 100644 --- a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/DoubleHistogramSpace.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/DoubleHistogramSpace.kt @@ -75,7 +75,7 @@ public class DoubleHistogramSpace( ndCounter[index].add(value.toDouble()) } hBuilder.apply(builder) - val values: NDBuffer = ndCounter.mapToBuffer { it.value } + val values: BufferND = ndCounter.mapToBuffer { it.value } return IndexedHistogram(this, values) } diff --git a/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructure.kt b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructure.kt index ec4cc9c56..6a3ae37a7 100644 --- a/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructure.kt +++ b/kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jArrayStructure.kt @@ -1,7 +1,7 @@ package space.kscience.kmath.nd4j import org.nd4j.linalg.api.ndarray.INDArray -import space.kscience.kmath.nd.MutableNDStructure +import space.kscience.kmath.nd.MutableStructureND import space.kscience.kmath.nd.StructureND /** @@ -9,7 +9,7 @@ import space.kscience.kmath.nd.StructureND * * @param T the type of items. */ -public sealed class Nd4jArrayStructure : MutableNDStructure { +public sealed class Nd4jArrayStructure : MutableStructureND { /** * The wrapped [INDArray]. */ diff --git a/kmath-viktor/api/kmath-viktor.api b/kmath-viktor/api/kmath-viktor.api index 6fe6c9db7..d322ddd71 100644 --- a/kmath-viktor/api/kmath-viktor.api +++ b/kmath-viktor/api/kmath-viktor.api @@ -148,7 +148,7 @@ public final class space/kscience/kmath/viktor/ViktorFieldND : space/kscience/km public fun unaryPlus (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; } -public final class space/kscience/kmath/viktor/ViktorStructureND : space/kscience/kmath/nd/MutableNDStructure { +public final class space/kscience/kmath/viktor/ViktorStructureND : space/kscience/kmath/nd/MutableStructureND { public static final synthetic fun box-impl (Lorg/jetbrains/bio/viktor/F64Array;)Lspace/kscience/kmath/viktor/ViktorStructureND; public static fun constructor-impl (Lorg/jetbrains/bio/viktor/F64Array;)Lorg/jetbrains/bio/viktor/F64Array; public fun elements ()Lkotlin/sequences/Sequence; diff --git a/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorStructureND.kt b/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorStructureND.kt index 2749f5431..420bcac90 100644 --- a/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorStructureND.kt +++ b/kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorStructureND.kt @@ -9,7 +9,7 @@ import space.kscience.kmath.operations.NumbersAddOperations import space.kscience.kmath.operations.ScaleOperations @Suppress("OVERRIDE_BY_INLINE", "NOTHING_TO_INLINE") -public inline class ViktorStructureND(public val f64Buffer: F64Array) : MutableNDStructure { +public inline class ViktorStructureND(public val f64Buffer: F64Array) : MutableStructureND { public override val shape: IntArray get() = f64Buffer.shape public override inline fun get(index: IntArray): Double = f64Buffer.get(*index) From 90981f6a401beb1e9ace8d6f4b6a27b9316ac825 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 16 Mar 2021 21:56:09 +0300 Subject: [PATCH 142/150] Remove contentEquals from Buffer --- kmath-core/api/kmath-core.api | 35 +------------------ .../space/kscience/kmath/nd/StructureND.kt | 4 +-- .../space/kscience/kmath/structures/Buffer.kt | 30 ++++++---------- .../kmath/expressions/SimpleAutoDiffTest.kt | 3 +- .../space/kscience/kmath/ejml/EjmlVector.kt | 6 ---- kmath-viktor/api/kmath-viktor.api | 2 -- 6 files changed, 15 insertions(+), 65 deletions(-) diff --git a/kmath-core/api/kmath-core.api b/kmath-core/api/kmath-core.api index 5fabaae1b..529f6c5f8 100644 --- a/kmath-core/api/kmath-core.api +++ b/kmath-core/api/kmath-core.api @@ -1073,7 +1073,6 @@ public abstract interface class space/kscience/kmath/nd/Structure1D : space/ksci } public final class space/kscience/kmath/nd/Structure1D$DefaultImpls { - public static fun contentEquals (Lspace/kscience/kmath/nd/Structure1D;Lspace/kscience/kmath/structures/Buffer;)Z public static fun get (Lspace/kscience/kmath/nd/Structure1D;[I)Ljava/lang/Object; public static fun getDimension (Lspace/kscience/kmath/nd/Structure1D;)I public static fun iterator (Lspace/kscience/kmath/nd/Structure1D;)Ljava/util/Iterator; @@ -2088,7 +2087,6 @@ public final class space/kscience/kmath/operations/TrigonometricOperations$Defau public final class space/kscience/kmath/structures/ArrayBuffer : space/kscience/kmath/structures/MutableBuffer { public fun ([Ljava/lang/Object;)V - public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; public fun get (I)Ljava/lang/Object; public fun getSize ()I @@ -2098,7 +2096,6 @@ public final class space/kscience/kmath/structures/ArrayBuffer : space/kscience/ public abstract interface class space/kscience/kmath/structures/Buffer { public static final field Companion Lspace/kscience/kmath/structures/Buffer$Companion; - public abstract fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z public abstract fun get (I)Ljava/lang/Object; public abstract fun getSize ()I public abstract fun iterator ()Ljava/util/Iterator; @@ -2107,10 +2104,7 @@ public abstract interface class space/kscience/kmath/structures/Buffer { public final class space/kscience/kmath/structures/Buffer$Companion { public final fun auto (Lkotlin/reflect/KClass;ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; public final fun boxing (ILkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/structures/Buffer; -} - -public final class space/kscience/kmath/structures/Buffer$DefaultImpls { - public static fun contentEquals (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Z + public final fun contentEquals (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/structures/Buffer;)Z } public final class space/kscience/kmath/structures/BufferKt { @@ -2130,8 +2124,6 @@ public final class space/kscience/kmath/structures/BufferOperationKt { public final class space/kscience/kmath/structures/DoubleBuffer : space/kscience/kmath/structures/MutableBuffer { public static final synthetic fun box-impl ([D)Lspace/kscience/kmath/structures/DoubleBuffer; public static fun constructor-impl ([D)[D - public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl ([DLspace/kscience/kmath/structures/Buffer;)Z public synthetic fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; public fun copy-Dv3HvWU ()[D public static fun copy-Dv3HvWU ([D)[D @@ -2318,10 +2310,6 @@ public abstract interface class space/kscience/kmath/structures/FlaggedBuffer : public abstract fun getFlag (I)B } -public final class space/kscience/kmath/structures/FlaggedBuffer$DefaultImpls { - public static fun contentEquals (Lspace/kscience/kmath/structures/FlaggedBuffer;Lspace/kscience/kmath/structures/Buffer;)Z -} - public final class space/kscience/kmath/structures/FlaggedBufferKt { public static final fun forEachValid (Lspace/kscience/kmath/structures/FlaggedDoubleBuffer;Lkotlin/jvm/functions/Function1;)V public static final fun hasFlag (Lspace/kscience/kmath/structures/FlaggedBuffer;ILspace/kscience/kmath/structures/ValueFlag;)Z @@ -2331,7 +2319,6 @@ public final class space/kscience/kmath/structures/FlaggedBufferKt { public final class space/kscience/kmath/structures/FlaggedDoubleBuffer : space/kscience/kmath/structures/Buffer, space/kscience/kmath/structures/FlaggedBuffer { public fun ([D[B)V - public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z public fun get (I)Ljava/lang/Double; public synthetic fun get (I)Ljava/lang/Object; public fun getFlag (I)B @@ -2344,8 +2331,6 @@ public final class space/kscience/kmath/structures/FlaggedDoubleBuffer : space/k public final class space/kscience/kmath/structures/FloatBuffer : space/kscience/kmath/structures/MutableBuffer { public static final synthetic fun box-impl ([F)Lspace/kscience/kmath/structures/FloatBuffer; public static fun constructor-impl ([F)[F - public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl ([FLspace/kscience/kmath/structures/Buffer;)Z public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; public static fun copy-impl ([F)Lspace/kscience/kmath/structures/MutableBuffer; public fun equals (Ljava/lang/Object;)Z @@ -2380,8 +2365,6 @@ public final class space/kscience/kmath/structures/FloatBufferKt { public final class space/kscience/kmath/structures/IntBuffer : space/kscience/kmath/structures/MutableBuffer { public static final synthetic fun box-impl ([I)Lspace/kscience/kmath/structures/IntBuffer; public static fun constructor-impl ([I)[I - public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl ([ILspace/kscience/kmath/structures/Buffer;)Z public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; public static fun copy-impl ([I)Lspace/kscience/kmath/structures/MutableBuffer; public fun equals (Ljava/lang/Object;)Z @@ -2416,8 +2399,6 @@ public final class space/kscience/kmath/structures/IntBufferKt { public final class space/kscience/kmath/structures/ListBuffer : space/kscience/kmath/structures/Buffer { public static final synthetic fun box-impl (Ljava/util/List;)Lspace/kscience/kmath/structures/ListBuffer; public static fun constructor-impl (Ljava/util/List;)Ljava/util/List; - public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl (Ljava/util/List;Lspace/kscience/kmath/structures/Buffer;)Z public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Ljava/util/List;Ljava/lang/Object;)Z public static final fun equals-impl0 (Ljava/util/List;Ljava/util/List;)Z @@ -2438,8 +2419,6 @@ public final class space/kscience/kmath/structures/ListBuffer : space/kscience/k public final class space/kscience/kmath/structures/LongBuffer : space/kscience/kmath/structures/MutableBuffer { public static final synthetic fun box-impl ([J)Lspace/kscience/kmath/structures/LongBuffer; public static fun constructor-impl ([J)[J - public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl ([JLspace/kscience/kmath/structures/Buffer;)Z public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; public static fun copy-impl ([J)Lspace/kscience/kmath/structures/MutableBuffer; public fun equals (Ljava/lang/Object;)Z @@ -2474,7 +2453,6 @@ public final class space/kscience/kmath/structures/LongBufferKt { public class space/kscience/kmath/structures/MemoryBuffer : space/kscience/kmath/structures/Buffer { public static final field Companion Lspace/kscience/kmath/structures/MemoryBuffer$Companion; public fun (Lspace/kscience/kmath/memory/Memory;Lspace/kscience/kmath/memory/MemorySpec;)V - public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z public fun get (I)Ljava/lang/Object; protected final fun getMemory ()Lspace/kscience/kmath/memory/Memory; public fun getSize ()I @@ -2503,15 +2481,9 @@ public final class space/kscience/kmath/structures/MutableBuffer$Companion { public final fun short-1yRgbGw (ILkotlin/jvm/functions/Function1;)[S } -public final class space/kscience/kmath/structures/MutableBuffer$DefaultImpls { - public static fun contentEquals (Lspace/kscience/kmath/structures/MutableBuffer;Lspace/kscience/kmath/structures/Buffer;)Z -} - public final class space/kscience/kmath/structures/MutableListBuffer : space/kscience/kmath/structures/MutableBuffer { public static final synthetic fun box-impl (Ljava/util/List;)Lspace/kscience/kmath/structures/MutableListBuffer; public static fun constructor-impl (Ljava/util/List;)Ljava/util/List; - public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl (Ljava/util/List;Lspace/kscience/kmath/structures/Buffer;)Z public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; public static fun copy-impl (Ljava/util/List;)Lspace/kscience/kmath/structures/MutableBuffer; public fun equals (Ljava/lang/Object;)Z @@ -2548,8 +2520,6 @@ public final class space/kscience/kmath/structures/MutableMemoryBuffer$Companion public final class space/kscience/kmath/structures/ReadOnlyBuffer : space/kscience/kmath/structures/Buffer { public static final synthetic fun box-impl (Lspace/kscience/kmath/structures/MutableBuffer;)Lspace/kscience/kmath/structures/ReadOnlyBuffer; public static fun constructor-impl (Lspace/kscience/kmath/structures/MutableBuffer;)Lspace/kscience/kmath/structures/MutableBuffer; - public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl (Lspace/kscience/kmath/structures/MutableBuffer;Lspace/kscience/kmath/structures/Buffer;)Z public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Lspace/kscience/kmath/structures/MutableBuffer;Ljava/lang/Object;)Z public static final fun equals-impl0 (Lspace/kscience/kmath/structures/MutableBuffer;Lspace/kscience/kmath/structures/MutableBuffer;)Z @@ -2570,8 +2540,6 @@ public final class space/kscience/kmath/structures/ReadOnlyBuffer : space/kscien public final class space/kscience/kmath/structures/ShortBuffer : space/kscience/kmath/structures/MutableBuffer { public static final synthetic fun box-impl ([S)Lspace/kscience/kmath/structures/ShortBuffer; public static fun constructor-impl ([S)[S - public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl ([SLspace/kscience/kmath/structures/Buffer;)Z public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; public static fun copy-impl ([S)Lspace/kscience/kmath/structures/MutableBuffer; public fun equals (Ljava/lang/Object;)Z @@ -2615,7 +2583,6 @@ public final class space/kscience/kmath/structures/ValueFlag : java/lang/Enum { public final class space/kscience/kmath/structures/VirtualBuffer : space/kscience/kmath/structures/Buffer { public fun (ILkotlin/jvm/functions/Function1;)V - public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z public fun get (I)Ljava/lang/Object; public fun getSize ()I public fun iterator ()Ljava/util/Iterator; diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/StructureND.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/StructureND.kt index bb7814bfd..b31ce3eac 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/StructureND.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/StructureND.kt @@ -56,12 +56,12 @@ public interface StructureND { /** * Indicates whether some [StructureND] is equal to another one. */ - public fun contentEquals(st1: StructureND<*>, st2: StructureND<*>): Boolean { + public fun contentEquals(st1: StructureND, st2: StructureND): Boolean { if (st1 === st2) return true // fast comparison of buffers if possible if (st1 is BufferND && st2 is BufferND && st1.strides == st2.strides) - return st1.buffer.contentEquals(st2.buffer) + return Buffer.contentEquals(st1.buffer, st2.buffer) //element by element comparison if it could not be avoided return st1.elements().all { (index, value) -> value == st2[index] } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt index d373be35e..b29181cea 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt @@ -19,7 +19,7 @@ public typealias MutableBufferFactory = (Int, (Int) -> T) -> MutableBuffer /** * A generic read-only random-access structure for both primitives and objects. * - * [Buffer] is in general identity-free. [contentEquals] should be used for content equality checks + * [Buffer] is in general identity-free. [Buffer.contentEquals] should be used for content equality checks. * * @param T the type of elements contained in the buffer. */ @@ -39,18 +39,16 @@ public interface Buffer { */ public operator fun iterator(): Iterator - /** - * Checks content equality with another buffer. - */ - public fun contentEquals(other: Buffer<*>): Boolean { - if (this.size != other.size) return false - for (i in indices) { - if (get(i) != other[i]) return false - } - return true - } - public companion object { + + public fun contentEquals(first: Buffer, second: Buffer): Boolean{ + if (first.size != second.size) return false + for (i in first.indices) { + if (first[i] != second[i]) return false + } + return true + } + /** * Creates a [ListBuffer] of given type [T] with given [size]. Each element is calculated by calling the * specified [initializer] function. @@ -279,14 +277,6 @@ public class VirtualBuffer(override val size: Int, private val generator: (In } override operator fun iterator(): Iterator = (0 until size).asSequence().map(generator).iterator() - - override fun contentEquals(other: Buffer<*>): Boolean { - return if (other is VirtualBuffer) { - this.size == other.size && this.generator == other.generator - } else { - super.contentEquals(other) - } - } } /** diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/SimpleAutoDiffTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/SimpleAutoDiffTest.kt index 95b2b2d1c..ca7aca905 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/SimpleAutoDiffTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/SimpleAutoDiffTest.kt @@ -1,6 +1,7 @@ package space.kscience.kmath.expressions import space.kscience.kmath.operations.DoubleField +import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.asBuffer import kotlin.math.E import kotlin.math.PI @@ -276,7 +277,7 @@ class SimpleAutoDiffTest { fun testDivGrad() { val res = dxy(x to 1.0, y to 2.0) { x, y -> x * x + y * y } assertEquals(6.0, res.div()) - assertTrue(res.grad(x, y).contentEquals(doubleArrayOf(2.0, 4.0).asBuffer())) + assertTrue(Buffer.contentEquals(res.grad(x, y), doubleArrayOf(2.0, 4.0).asBuffer())) } private fun assertApprox(a: Double, b: Double) { diff --git a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlVector.kt b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlVector.kt index efa1f6128..c7f87675d 100644 --- a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlVector.kt +++ b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlVector.kt @@ -2,7 +2,6 @@ package space.kscience.kmath.ejml import org.ejml.simple.SimpleMatrix import space.kscience.kmath.linear.Point -import space.kscience.kmath.structures.Buffer /** * Represents point over EJML [SimpleMatrix]. @@ -31,10 +30,5 @@ public class EjmlVector internal constructor(public val origin: SimpleMatrix) : override fun hasNext(): Boolean = cursor < origin.numCols() * origin.numRows() } - public override fun contentEquals(other: Buffer<*>): Boolean { - if (other is EjmlVector) return origin.isIdentical(other.origin, 0.0) - return super.contentEquals(other) - } - public override fun toString(): String = "EjmlVector(origin=$origin)" } diff --git a/kmath-viktor/api/kmath-viktor.api b/kmath-viktor/api/kmath-viktor.api index d322ddd71..0b9ea1b48 100644 --- a/kmath-viktor/api/kmath-viktor.api +++ b/kmath-viktor/api/kmath-viktor.api @@ -1,8 +1,6 @@ public final class space/kscience/kmath/viktor/ViktorBuffer : space/kscience/kmath/structures/MutableBuffer { public static final synthetic fun box-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;)Lspace/kscience/kmath/viktor/ViktorBuffer; public static fun constructor-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;)Lorg/jetbrains/bio/viktor/F64FlatArray; - public fun contentEquals (Lspace/kscience/kmath/structures/Buffer;)Z - public static fun contentEquals-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;Lspace/kscience/kmath/structures/Buffer;)Z public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; public static fun copy-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;)Lspace/kscience/kmath/structures/MutableBuffer; public fun equals (Ljava/lang/Object;)Z From 248d42c4e0656d478efa890ddd55c799ed3cef8e Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 16 Mar 2021 22:46:22 +0300 Subject: [PATCH 143/150] Remove MutableBufferND --- CHANGELOG.md | 1 + README.md | 54 +++++----- build.gradle.kts | 2 +- kmath-ast/README.md | 24 ++--- kmath-ast/build.gradle.kts | 12 +-- kmath-complex/README.md | 16 +-- kmath-complex/build.gradle.kts | 4 +- kmath-core/README.md | 26 ++--- kmath-core/api/kmath-core.api | 12 +-- kmath-core/build.gradle.kts | 14 +-- .../space/kscience/kmath/nd/BufferND.kt | 48 +++++++++ .../space/kscience/kmath/nd/StructureND.kt | 100 ++++-------------- .../space/kscience/kmath/structures/Buffer.kt | 3 + kmath-for-real/README.md | 18 ++-- kmath-for-real/build.gradle.kts | 6 +- kmath-functions/README.md | 20 ++-- kmath-functions/build.gradle.kts | 8 +- kmath-nd4j/README.md | 24 ++--- kmath-nd4j/build.gradle.kts | 9 +- 19 files changed, 174 insertions(+), 227 deletions(-) create mode 100644 kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferND.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 644c634b2..8b4dddf81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ ### Removed - Nearest in Domain. To be implemented in geometry package. - Number multiplication and division in main Algebra chain +- `contentEquals` from Buffer. It moved to the companion. ### Fixed diff --git a/README.md b/README.md index 436495c9c..2aaeb3150 100644 --- a/README.md +++ b/README.md @@ -87,12 +87,12 @@ KMath is a modular library. Different modules provide different features with di > **Maturity**: PROTOTYPE > > **Features:** -> - [expression-language](kmath-ast/src/jvmMain/kotlin/kscience/kmath/ast/parser.kt) : Expression language and its parser -> - [mst](kmath-ast/src/commonMain/kotlin/kscience/kmath/ast/MST.kt) : MST (Mathematical Syntax Tree) as expression language's syntax intermediate representation -> - [mst-building](kmath-ast/src/commonMain/kotlin/kscience/kmath/ast/MstAlgebra.kt) : MST building algebraic structure -> - [mst-interpreter](kmath-ast/src/commonMain/kotlin/kscience/kmath/ast/MST.kt) : MST interpreter -> - [mst-jvm-codegen](kmath-ast/src/jvmMain/kotlin/kscience/kmath/asm/asm.kt) : Dynamic MST to JVM bytecode compiler -> - [mst-js-codegen](kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/estree.kt) : Dynamic MST to JS compiler +> - [expression-language](kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/ast/parser.kt) : Expression language and its parser +> - [mst](kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MST.kt) : MST (Mathematical Syntax Tree) as expression language's syntax intermediate representation +> - [mst-building](kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt) : MST building algebraic structure +> - [mst-interpreter](kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MST.kt) : MST interpreter +> - [mst-jvm-codegen](kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/asm.kt) : Dynamic MST to JVM bytecode compiler +> - [mst-js-codegen](kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/estree.kt) : Dynamic MST to JS compiler
@@ -108,8 +108,8 @@ KMath is a modular library. Different modules provide different features with di > **Maturity**: PROTOTYPE > > **Features:** -> - [complex](kmath-complex/src/commonMain/kotlin/kscience/kmath/complex/Complex.kt) : Complex Numbers -> - [quaternion](kmath-complex/src/commonMain/kotlin/kscience/kmath/complex/Quaternion.kt) : Quaternions +> - [complex](kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Complex.kt) : Complex Numbers +> - [quaternion](kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt) : Quaternions
@@ -119,15 +119,15 @@ KMath is a modular library. Different modules provide different features with di > **Maturity**: DEVELOPMENT > > **Features:** -> - [algebras](kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt) : Algebraic structures like rings, spaces and fields. -> - [nd](kmath-core/src/commonMain/kotlin/kscience/kmath/structures/NDStructure.kt) : Many-dimensional structures and operations on them. -> - [linear](kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt) : Basic linear algebra operations (sums, products, etc.), backed by the `Space` API. Advanced linear algebra operations like matrix inversion and LU decomposition. -> - [buffers](kmath-core/src/commonMain/kotlin/kscience/kmath/structures/Buffers.kt) : One-dimensional structure -> - [expressions](kmath-core/src/commonMain/kotlin/kscience/kmath/expressions) : By writing a single mathematical expression once, users will be able to apply different types of +> - [algebras](kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt) : Algebraic structures like rings, spaces and fields. +> - [nd](kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/StructureND.kt) : Many-dimensional structures and operations on them. +> - [linear](kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt) : Basic linear algebra operations (sums, products, etc.), backed by the `Space` API. Advanced linear algebra operations like matrix inversion and LU decomposition. +> - [buffers](kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt) : One-dimensional structure +> - [expressions](kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions) : By writing a single mathematical expression once, users will be able to apply different types of objects to the expression by providing a context. Expressions can be used for a wide variety of purposes from high performance calculations to code generation. -> - [domains](kmath-core/src/commonMain/kotlin/kscience/kmath/domains) : Domains -> - [autodif](kmath-core/src/commonMain/kotlin/kscience/kmath/expressions/SimpleAutoDiff.kt) : Automatic differentiation +> - [domains](kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains) : Domains +> - [autodif](kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SimpleAutoDiff.kt) : Automatic differentiation
@@ -157,9 +157,9 @@ One can still use generic algebras though. > **Maturity**: EXPERIMENTAL > > **Features:** -> - [RealVector](kmath-for-real/src/commonMain/kotlin/kscience/kmath/real/RealVector.kt) : Numpy-like operations for Buffers/Points -> - [RealMatrix](kmath-for-real/src/commonMain/kotlin/kscience/kmath/real/RealMatrix.kt) : Numpy-like operations for 2d real structures -> - [grids](kmath-for-real/src/commonMain/kotlin/kscience/kmath/structures/grids.kt) : Uniform grid generators +> - [DoubleVector](kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/DoubleVector.kt) : Numpy-like operations for Buffers/Points +> - [DoubleMatrix](kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/DoubleMatrix.kt) : Numpy-like operations for 2d real structures +> - [grids](kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/structures/grids.kt) : Uniform grid generators
@@ -169,10 +169,10 @@ One can still use generic algebras though. > **Maturity**: PROTOTYPE > > **Features:** -> - [piecewise](kmath-functions/Piecewise functions.) : src/commonMain/kotlin/kscience/kmath/functions/Piecewise.kt -> - [polynomials](kmath-functions/Polynomial functions.) : src/commonMain/kotlin/kscience/kmath/functions/Polynomial.kt -> - [linear interpolation](kmath-functions/Linear XY interpolator.) : src/commonMain/kotlin/kscience/kmath/interpolation/LinearInterpolator.kt -> - [spline interpolation](kmath-functions/Cubic spline XY interpolator.) : src/commonMain/kotlin/kscience/kmath/interpolation/SplineInterpolator.kt +> - [piecewise](kmath-functions/Piecewise functions.) : src/commonMain/kotlin/space/kscience/kmath/functions/Piecewise.kt +> - [polynomials](kmath-functions/Polynomial functions.) : src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt +> - [linear interpolation](kmath-functions/Linear XY interpolator.) : src/commonMain/kotlin/space/kscience/kmath/interpolation/LinearInterpolator.kt +> - [spline interpolation](kmath-functions/Cubic spline XY interpolator.) : src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt
@@ -206,9 +206,9 @@ One can still use generic algebras though. > **Maturity**: EXPERIMENTAL > > **Features:** -> - [nd4jarraystructure](kmath-nd4j/src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt) : NDStructure wrapper for INDArray -> - [nd4jarrayrings](kmath-nd4j/src/commonMain/kotlin/kscience/kmath/structures/NDStructure.kt) : Rings over Nd4jArrayStructure of Int and Long -> - [nd4jarrayfields](kmath-nd4j/src/commonMain/kotlin/kscience/kmath/structures/Buffers.kt) : Fields over Nd4jArrayStructure of Float and Double +> - [nd4jarraystructure](kmath-nd4j/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt) : NDStructure wrapper for INDArray +> - [nd4jarrayrings](kmath-nd4j/src/commonMain/kotlin/space/kscience/kmath/structures/NDStructure.kt) : Rings over Nd4jArrayStructure of Int and Long +> - [nd4jarrayfields](kmath-nd4j/src/commonMain/kotlin/space/kscience/kmath/structures/Buffers.kt) : Fields over Nd4jArrayStructure of Float and Double
@@ -254,8 +254,8 @@ repositories { } dependencies { - api("space.kscience:kmath-core:0.3.0-dev-2") - // api("kscience.kmath:kmath-core-jvm:0.3.0-dev-2") for jvm-specific version + api("space.kscience:kmath-core:0.3.0-dev-3") + // api("kscience.kmath:kmath-core-jvm:0.3.0-dev-3") for jvm-specific version } ``` diff --git a/build.gradle.kts b/build.gradle.kts index 9810e378f..5f1a8b88a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -20,7 +20,7 @@ allprojects { } group = "space.kscience" - version = "0.3.0-dev-2" + version = "0.3.0-dev-3" } subprojects { diff --git a/kmath-ast/README.md b/kmath-ast/README.md index 1b3f70080..4c79b5b36 100644 --- a/kmath-ast/README.md +++ b/kmath-ast/README.md @@ -2,17 +2,17 @@ This subproject implements the following features: - - [expression-language](src/jvmMain/kotlin/kscience/kmath/ast/parser.kt) : Expression language and its parser - - [mst](src/commonMain/kotlin/kscience/kmath/ast/MST.kt) : MST (Mathematical Syntax Tree) as expression language's syntax intermediate representation - - [mst-building](src/commonMain/kotlin/kscience/kmath/ast/MstAlgebra.kt) : MST building algebraic structure - - [mst-interpreter](src/commonMain/kotlin/kscience/kmath/ast/MST.kt) : MST interpreter - - [mst-jvm-codegen](src/jvmMain/kotlin/kscience/kmath/asm/asm.kt) : Dynamic MST to JVM bytecode compiler - - [mst-js-codegen](src/jsMain/kotlin/kscience/kmath/estree/estree.kt) : Dynamic MST to JS compiler + - [expression-language](src/jvmMain/kotlin/space/kscience/kmath/ast/parser.kt) : Expression language and its parser + - [mst](src/commonMain/kotlin/space/kscience/kmath/ast/MST.kt) : MST (Mathematical Syntax Tree) as expression language's syntax intermediate representation + - [mst-building](src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt) : MST building algebraic structure + - [mst-interpreter](src/commonMain/kotlin/space/kscience/kmath/ast/MST.kt) : MST interpreter + - [mst-jvm-codegen](src/jvmMain/kotlin/space/kscience/kmath/asm/asm.kt) : Dynamic MST to JVM bytecode compiler + - [mst-js-codegen](src/jsMain/kotlin/space/kscience/kmath/estree/estree.kt) : Dynamic MST to JS compiler > #### Artifact: > -> This module artifact: `space.kscience:kmath-ast:0.3.0-dev-2`. +> This module artifact: `space.kscience:kmath-ast:0.3.0-dev-3`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-ast/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-ast/_latestVersion) > @@ -25,13 +25,10 @@ This subproject implements the following features: > maven { url 'https://repo.kotlin.link' } > maven { url 'https://dl.bintray.com/hotkeytlt/maven' } > maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap ->// Uncomment if repo.kotlin.link is unavailable ->// maven { url 'https://dl.bintray.com/mipt-npm/kscience' } ->// maven { url 'https://dl.bintray.com/mipt-npm/dev' } > } > > dependencies { -> implementation 'space.kscience:kmath-ast:0.3.0-dev-2' +> implementation 'space.kscience:kmath-ast:0.3.0-dev-3' > } > ``` > **Gradle Kotlin DSL:** @@ -41,13 +38,10 @@ This subproject implements the following features: > maven("https://repo.kotlin.link") > maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap > maven("https://dl.bintray.com/hotkeytlt/maven") // required for a ->// Uncomment if repo.kotlin.link is unavailable ->// maven("https://dl.bintray.com/mipt-npm/kscience") ->// maven("https://dl.bintray.com/mipt-npm/dev") > } > > dependencies { -> implementation("space.kscience:kmath-ast:0.3.0-dev-2") +> implementation("space.kscience:kmath-ast:0.3.0-dev-3") > } > ``` diff --git a/kmath-ast/build.gradle.kts b/kmath-ast/build.gradle.kts index 5b764459c..e3a7faf0a 100644 --- a/kmath-ast/build.gradle.kts +++ b/kmath-ast/build.gradle.kts @@ -58,36 +58,36 @@ readme { feature( id = "expression-language", description = "Expression language and its parser", - ref = "src/jvmMain/kotlin/kscience/kmath/ast/parser.kt" + ref = "src/jvmMain/kotlin/space/kscience/kmath/ast/parser.kt" ) feature( id = "mst", description = "MST (Mathematical Syntax Tree) as expression language's syntax intermediate representation", - ref = "src/commonMain/kotlin/kscience/kmath/ast/MST.kt" + ref = "src/commonMain/kotlin/space/kscience/kmath/ast/MST.kt" ) feature( id = "mst-building", description = "MST building algebraic structure", - ref = "src/commonMain/kotlin/kscience/kmath/ast/MstAlgebra.kt" + ref = "src/commonMain/kotlin/space/kscience/kmath/ast/MstAlgebra.kt" ) feature( id = "mst-interpreter", description = "MST interpreter", - ref = "src/commonMain/kotlin/kscience/kmath/ast/MST.kt" + ref = "src/commonMain/kotlin/space/kscience/kmath/ast/MST.kt" ) feature( id = "mst-jvm-codegen", description = "Dynamic MST to JVM bytecode compiler", - ref = "src/jvmMain/kotlin/kscience/kmath/asm/asm.kt" + ref = "src/jvmMain/kotlin/space/kscience/kmath/asm/asm.kt" ) feature( id = "mst-js-codegen", description = "Dynamic MST to JS compiler", - ref = "src/jsMain/kotlin/kscience/kmath/estree/estree.kt" + ref = "src/jsMain/kotlin/space/kscience/kmath/estree/estree.kt" ) } diff --git a/kmath-complex/README.md b/kmath-complex/README.md index 7a7628a2c..9e9cd5b6f 100644 --- a/kmath-complex/README.md +++ b/kmath-complex/README.md @@ -2,13 +2,13 @@ Complex and hypercomplex number systems in KMath: - - [complex](src/commonMain/kotlin/kscience/kmath/complex/Complex.kt) : Complex Numbers - - [quaternion](src/commonMain/kotlin/kscience/kmath/complex/Quaternion.kt) : Quaternions + - [complex](src/commonMain/kotlin/space/kscience/kmath/complex/Complex.kt) : Complex Numbers + - [quaternion](src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt) : Quaternions > #### Artifact: > -> This module artifact: `space.kscience:kmath-complex:0.3.0-dev-2`. +> This module artifact: `space.kscience:kmath-complex:0.3.0-dev-3`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-complex/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-complex/_latestVersion) > @@ -21,13 +21,10 @@ Complex and hypercomplex number systems in KMath: > maven { url 'https://repo.kotlin.link' } > maven { url 'https://dl.bintray.com/hotkeytlt/maven' } > maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap ->// Uncomment if repo.kotlin.link is unavailable ->// maven { url 'https://dl.bintray.com/mipt-npm/kscience' } ->// maven { url 'https://dl.bintray.com/mipt-npm/dev' } > } > > dependencies { -> implementation 'space.kscience:kmath-complex:0.3.0-dev-2' +> implementation 'space.kscience:kmath-complex:0.3.0-dev-3' > } > ``` > **Gradle Kotlin DSL:** @@ -37,12 +34,9 @@ Complex and hypercomplex number systems in KMath: > maven("https://repo.kotlin.link") > maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap > maven("https://dl.bintray.com/hotkeytlt/maven") // required for a ->// Uncomment if repo.kotlin.link is unavailable ->// maven("https://dl.bintray.com/mipt-npm/kscience") ->// maven("https://dl.bintray.com/mipt-npm/dev") > } > > dependencies { -> implementation("space.kscience:kmath-complex:0.3.0-dev-2") +> implementation("space.kscience:kmath-complex:0.3.0-dev-3") > } > ``` diff --git a/kmath-complex/build.gradle.kts b/kmath-complex/build.gradle.kts index 4cd43c70c..5b9dc3ba0 100644 --- a/kmath-complex/build.gradle.kts +++ b/kmath-complex/build.gradle.kts @@ -25,12 +25,12 @@ readme { feature( id = "complex", description = "Complex Numbers", - ref = "src/commonMain/kotlin/kscience/kmath/complex/Complex.kt" + ref = "src/commonMain/kotlin/space/kscience/kmath/complex/Complex.kt" ) feature( id = "quaternion", description = "Quaternions", - ref = "src/commonMain/kotlin/kscience/kmath/complex/Quaternion.kt" + ref = "src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt" ) } diff --git a/kmath-core/README.md b/kmath-core/README.md index 14f1ecb41..dd54b7aeb 100644 --- a/kmath-core/README.md +++ b/kmath-core/README.md @@ -2,20 +2,20 @@ The core features of KMath: - - [algebras](src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt) : Algebraic structures like rings, spaces and fields. - - [nd](src/commonMain/kotlin/kscience/kmath/structures/NDStructure.kt) : Many-dimensional structures and operations on them. - - [linear](src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt) : Basic linear algebra operations (sums, products, etc.), backed by the `Space` API. Advanced linear algebra operations like matrix inversion and LU decomposition. - - [buffers](src/commonMain/kotlin/kscience/kmath/structures/Buffers.kt) : One-dimensional structure - - [expressions](src/commonMain/kotlin/kscience/kmath/expressions) : By writing a single mathematical expression once, users will be able to apply different types of + - [algebras](src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt) : Algebraic structures like rings, spaces and fields. + - [nd](src/commonMain/kotlin/space/kscience/kmath/structures/NDStructure.kt) : Many-dimensional structures and operations on them. + - [linear](src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt) : Basic linear algebra operations (sums, products, etc.), backed by the `Space` API. Advanced linear algebra operations like matrix inversion and LU decomposition. + - [buffers](src/commonMain/kotlin/space/kscience/kmath/structures/Buffers.kt) : One-dimensional structure + - [expressions](src/commonMain/kotlin/space/kscience/kmath/expressions) : By writing a single mathematical expression once, users will be able to apply different types of objects to the expression by providing a context. Expressions can be used for a wide variety of purposes from high performance calculations to code generation. - - [domains](src/commonMain/kotlin/kscience/kmath/domains) : Domains - - [autodif](src/commonMain/kotlin/kscience/kmath/expressions/SimpleAutoDiff.kt) : Automatic differentiation + - [domains](src/commonMain/kotlin/space/kscience/kmath/domains) : Domains + - [autodif](src/commonMain/kotlin/space/kscience/kmath/expressions/SimpleAutoDiff.kt) : Automatic differentiation > #### Artifact: > -> This module artifact: `space.kscience:kmath-core:0.3.0-dev-2`. +> This module artifact: `space.kscience:kmath-core:0.3.0-dev-3`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-core/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-core/_latestVersion) > @@ -28,13 +28,10 @@ performance calculations to code generation. > maven { url 'https://repo.kotlin.link' } > maven { url 'https://dl.bintray.com/hotkeytlt/maven' } > maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap ->// Uncomment if repo.kotlin.link is unavailable ->// maven { url 'https://dl.bintray.com/mipt-npm/kscience' } ->// maven { url 'https://dl.bintray.com/mipt-npm/dev' } > } > > dependencies { -> implementation 'space.kscience:kmath-core:0.3.0-dev-2' +> implementation 'space.kscience:kmath-core:0.3.0-dev-3' > } > ``` > **Gradle Kotlin DSL:** @@ -44,12 +41,9 @@ performance calculations to code generation. > maven("https://repo.kotlin.link") > maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap > maven("https://dl.bintray.com/hotkeytlt/maven") // required for a ->// Uncomment if repo.kotlin.link is unavailable ->// maven("https://dl.bintray.com/mipt-npm/kscience") ->// maven("https://dl.bintray.com/mipt-npm/dev") > } > > dependencies { -> implementation("space.kscience:kmath-core:0.3.0-dev-2") +> implementation("space.kscience:kmath-core:0.3.0-dev-3") > } > ``` diff --git a/kmath-core/api/kmath-core.api b/kmath-core/api/kmath-core.api index 529f6c5f8..04325379e 100644 --- a/kmath-core/api/kmath-core.api +++ b/kmath-core/api/kmath-core.api @@ -721,11 +721,11 @@ public final class space/kscience/kmath/nd/BufferAlgebraNDKt { public static final fun ring (Lspace/kscience/kmath/nd/AlgebraND$Companion;Lspace/kscience/kmath/operations/Ring;Lkotlin/jvm/functions/Function2;[I)Lspace/kscience/kmath/nd/BufferedRingND; } -public class space/kscience/kmath/nd/BufferND : space/kscience/kmath/nd/StructureND { +public final class space/kscience/kmath/nd/BufferND : space/kscience/kmath/nd/StructureND { public fun (Lspace/kscience/kmath/nd/Strides;Lspace/kscience/kmath/structures/Buffer;)V public fun elements ()Lkotlin/sequences/Sequence; public fun get ([I)Ljava/lang/Object; - public fun getBuffer ()Lspace/kscience/kmath/structures/Buffer; + public final fun getBuffer ()Lspace/kscience/kmath/structures/Buffer; public fun getDimension ()I public fun getShape ()[I public final fun getStrides ()Lspace/kscience/kmath/nd/Strides; @@ -972,13 +972,6 @@ public final class space/kscience/kmath/nd/GroupND$DefaultImpls { public static fun unaryPlus (Lspace/kscience/kmath/nd/GroupND;Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/StructureND; } -public final class space/kscience/kmath/nd/MutableBufferND : space/kscience/kmath/nd/BufferND, space/kscience/kmath/nd/MutableStructureND { - public fun (Lspace/kscience/kmath/nd/Strides;Lspace/kscience/kmath/structures/MutableBuffer;)V - public synthetic fun getBuffer ()Lspace/kscience/kmath/structures/Buffer; - public fun getBuffer ()Lspace/kscience/kmath/structures/MutableBuffer; - public fun set ([ILjava/lang/Object;)V -} - public abstract interface class space/kscience/kmath/nd/MutableStructureND : space/kscience/kmath/nd/StructureND { public abstract fun set ([ILjava/lang/Object;)V } @@ -1127,6 +1120,7 @@ public final class space/kscience/kmath/nd/StructureND$Companion { public static synthetic fun buffered$default (Lspace/kscience/kmath/nd/StructureND$Companion;Lspace/kscience/kmath/nd/Strides;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/kmath/nd/BufferND; public static synthetic fun buffered$default (Lspace/kscience/kmath/nd/StructureND$Companion;[ILkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/kmath/nd/BufferND; public final fun contentEquals (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;)Z + public final fun toString (Lspace/kscience/kmath/nd/StructureND;)Ljava/lang/String; } public final class space/kscience/kmath/nd/StructureND$DefaultImpls { diff --git a/kmath-core/build.gradle.kts b/kmath-core/build.gradle.kts index 8d30f1d6e..2fed3eb2f 100644 --- a/kmath-core/build.gradle.kts +++ b/kmath-core/build.gradle.kts @@ -23,13 +23,13 @@ readme { description = """ Algebraic structures like rings, spaces and fields. """.trimIndent(), - ref = "src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt" + ref = "src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt" ) feature( id = "nd", description = "Many-dimensional structures and operations on them.", - ref = "src/commonMain/kotlin/kscience/kmath/structures/NDStructure.kt" + ref = "src/commonMain/kotlin/space/kscience/kmath/structures/StructureND.kt" ) feature( @@ -37,13 +37,13 @@ readme { description = """ Basic linear algebra operations (sums, products, etc.), backed by the `Space` API. Advanced linear algebra operations like matrix inversion and LU decomposition. """.trimIndent(), - ref = "src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt" + ref = "src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt" ) feature( id = "buffers", description = "One-dimensional structure", - ref = "src/commonMain/kotlin/kscience/kmath/structures/Buffers.kt" + ref = "src/commonMain/kotlin/space/kscience/kmath/structures/Buffers.kt" ) feature( @@ -53,18 +53,18 @@ readme { objects to the expression by providing a context. Expressions can be used for a wide variety of purposes from high performance calculations to code generation. """.trimIndent(), - ref = "src/commonMain/kotlin/kscience/kmath/expressions" + ref = "src/commonMain/kotlin/space/kscience/kmath/expressions" ) feature( id = "domains", description = "Domains", - ref = "src/commonMain/kotlin/kscience/kmath/domains" + ref = "src/commonMain/kotlin/space/kscience/kmath/domains" ) feature( id = "autodif", description = "Automatic differentiation", - ref = "src/commonMain/kotlin/kscience/kmath/expressions/SimpleAutoDiff.kt" + ref = "src/commonMain/kotlin/space/kscience/kmath/expressions/SimpleAutoDiff.kt" ) } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferND.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferND.kt new file mode 100644 index 000000000..c7f8d222d --- /dev/null +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferND.kt @@ -0,0 +1,48 @@ +package space.kscience.kmath.nd + +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.BufferFactory + +/** + * Represents [StructureND] over [Buffer]. + * + * @param T the type of items. + * @param strides The strides to access elements of [Buffer] by linear indices. + * @param buffer The underlying buffer. + */ +public class BufferND( + public val strides: Strides, + public val buffer: Buffer, +) : StructureND { + + init { + if (strides.linearSize != buffer.size) { + error("Expected buffer side of ${strides.linearSize}, but found ${buffer.size}") + } + } + + override operator fun get(index: IntArray): T = buffer[strides.offset(index)] + + override val shape: IntArray get() = strides.shape + + override fun elements(): Sequence> = strides.indices().map { + it to this[it] + } + + override fun toString(): String = StructureND.toString(this) +} + +/** + * Transform structure to a new structure using provided [BufferFactory] and optimizing if argument is [BufferND] + */ +public inline fun StructureND.mapToBuffer( + factory: BufferFactory = Buffer.Companion::auto, + crossinline transform: (T) -> R, +): BufferND { + return if (this is BufferND) + BufferND(this.strides, factory.invoke(strides.linearSize) { transform(buffer[it]) }) + else { + val strides = DefaultStrides(shape) + BufferND(strides, factory.invoke(strides.linearSize) { transform(get(strides.index(it))) }) + } +} \ No newline at end of file diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/StructureND.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/StructureND.kt index b31ce3eac..78eac1809 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/StructureND.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/StructureND.kt @@ -3,8 +3,6 @@ package space.kscience.kmath.nd import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.BufferFactory -import space.kscience.kmath.structures.MutableBuffer -import space.kscience.kmath.structures.asSequence import kotlin.jvm.JvmName import kotlin.native.concurrent.ThreadLocal import kotlin.reflect.KClass @@ -56,7 +54,7 @@ public interface StructureND { /** * Indicates whether some [StructureND] is equal to another one. */ - public fun contentEquals(st1: StructureND, st2: StructureND): Boolean { + public fun contentEquals(st1: StructureND, st2: StructureND): Boolean { if (st1 === st2) return true // fast comparison of buffers if possible @@ -67,6 +65,25 @@ public interface StructureND { return st1.elements().all { (index, value) -> value == st2[index] } } + /** + * Debug output to string + */ + public fun toString(structure: StructureND<*>): String { + val bufferRepr: String = when (structure.shape.size) { + 1 -> (0 until structure.shape[0]).map { structure[it] } + .joinToString(prefix = "[", postfix = "]", separator = ", ") + 2 -> (0 until structure.shape[0]).joinToString(prefix = "[", postfix = "]", separator = ", ") { i -> + (0 until structure.shape[1]).joinToString(prefix = "[", postfix = "]", separator = ", ") { j -> + structure[i, j].toString() + } + } + else -> "..." + } + val className = structure::class.simpleName ?: "StructureND" + + return "$className(shape=${structure.shape.contentToString()}, buffer=$bufferRepr)" + } + /** * Creates a NDStructure with explicit buffer factory. * @@ -249,83 +266,6 @@ public class DefaultStrides private constructor(override val shape: IntArray) : } } -/** - * Represents [StructureND] over [Buffer]. - * - * @param T the type of items. - * @param strides The strides to access elements of [Buffer] by linear indices. - * @param buffer The underlying buffer. - */ -public open class BufferND( - public val strides: Strides, - buffer: Buffer, -) : StructureND { - - init { - if (strides.linearSize != buffer.size) { - error("Expected buffer side of ${strides.linearSize}, but found ${buffer.size}") - } - } - - public open val buffer: Buffer = buffer - - override operator fun get(index: IntArray): T = buffer[strides.offset(index)] - - override val shape: IntArray get() = strides.shape - - override fun elements(): Sequence> = strides.indices().map { - it to this[it] - } - - override fun toString(): String { - val bufferRepr: String = when (shape.size) { - 1 -> buffer.asSequence().joinToString(prefix = "[", postfix = "]", separator = ", ") - 2 -> (0 until shape[0]).joinToString(prefix = "[", postfix = "]", separator = ", ") { i -> - (0 until shape[1]).joinToString(prefix = "[", postfix = "]", separator = ", ") { j -> - val offset = strides.offset(intArrayOf(i, j)) - buffer[offset].toString() - } - } - else -> "..." - } - return "NDBuffer(shape=${shape.contentToString()}, buffer=$bufferRepr)" - } -} - -/** - * Transform structure to a new structure using provided [BufferFactory] and optimizing if argument is [BufferND] - */ -public inline fun StructureND.mapToBuffer( - factory: BufferFactory = Buffer.Companion::auto, - crossinline transform: (T) -> R, -): BufferND { - return if (this is BufferND) - BufferND(this.strides, factory.invoke(strides.linearSize) { transform(buffer[it]) }) - else { - val strides = DefaultStrides(shape) - BufferND(strides, factory.invoke(strides.linearSize) { transform(get(strides.index(it))) }) - } -} - -/** - * Mutable ND buffer based on linear [MutableBuffer]. - */ -public class MutableBufferND( - strides: Strides, - buffer: MutableBuffer, -) : BufferND(strides, buffer), MutableStructureND { - - init { - require(strides.linearSize == buffer.size) { - "Expected buffer side of ${strides.linearSize}, but found ${buffer.size}" - } - } - - override val buffer: MutableBuffer = super.buffer as MutableBuffer - - override operator fun set(index: IntArray, value: T): Unit = buffer.set(strides.offset(index), value) -} - public inline fun StructureND.combine( struct: StructureND, crossinline block: (T, T) -> T, diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt index b29181cea..7ce098ed1 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt @@ -41,6 +41,9 @@ public interface Buffer { public companion object { + /** + * Check the element-by-element match of content of two buffers. + */ public fun contentEquals(first: Buffer, second: Buffer): Boolean{ if (first.size != second.size) return false for (i in first.indices) { diff --git a/kmath-for-real/README.md b/kmath-for-real/README.md index 63c5cd249..139cd3cef 100644 --- a/kmath-for-real/README.md +++ b/kmath-for-real/README.md @@ -1,13 +1,13 @@ # Real number specialization module (`kmath-for-real`) - - [RealVector](src/commonMain/kotlin/kscience/kmath/real/RealVector.kt) : Numpy-like operations for Buffers/Points - - [RealMatrix](src/commonMain/kotlin/kscience/kmath/real/RealMatrix.kt) : Numpy-like operations for 2d real structures - - [grids](src/commonMain/kotlin/kscience/kmath/structures/grids.kt) : Uniform grid generators + - [DoubleVector](src/commonMain/kotlin/space/kscience/kmath/real/DoubleVector.kt) : Numpy-like operations for Buffers/Points + - [DoubleMatrix](src/commonMain/kotlin/space/kscience/kmath/real/DoubleMatrix.kt) : Numpy-like operations for 2d real structures + - [grids](src/commonMain/kotlin/space/kscience/kmath/structures/grids.kt) : Uniform grid generators > #### Artifact: > -> This module artifact: `space.kscience:kmath-for-real:0.3.0-dev-2`. +> This module artifact: `space.kscience:kmath-for-real:0.3.0-dev-3`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-for-real/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-for-real/_latestVersion) > @@ -20,13 +20,10 @@ > maven { url 'https://repo.kotlin.link' } > maven { url 'https://dl.bintray.com/hotkeytlt/maven' } > maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap ->// Uncomment if repo.kotlin.link is unavailable ->// maven { url 'https://dl.bintray.com/mipt-npm/kscience' } ->// maven { url 'https://dl.bintray.com/mipt-npm/dev' } > } > > dependencies { -> implementation 'space.kscience:kmath-for-real:0.3.0-dev-2' +> implementation 'space.kscience:kmath-for-real:0.3.0-dev-3' > } > ``` > **Gradle Kotlin DSL:** @@ -36,12 +33,9 @@ > maven("https://repo.kotlin.link") > maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap > maven("https://dl.bintray.com/hotkeytlt/maven") // required for a ->// Uncomment if repo.kotlin.link is unavailable ->// maven("https://dl.bintray.com/mipt-npm/kscience") ->// maven("https://dl.bintray.com/mipt-npm/dev") > } > > dependencies { -> implementation("space.kscience:kmath-for-real:0.3.0-dev-2") +> implementation("space.kscience:kmath-for-real:0.3.0-dev-3") > } > ``` diff --git a/kmath-for-real/build.gradle.kts b/kmath-for-real/build.gradle.kts index 5fc6724f3..0dcaf330a 100644 --- a/kmath-for-real/build.gradle.kts +++ b/kmath-for-real/build.gradle.kts @@ -20,18 +20,18 @@ readme { feature( id = "DoubleVector", description = "Numpy-like operations for Buffers/Points", - ref = "src/commonMain/kotlin/kscience/kmath/real/DoubleVector.kt" + ref = "src/commonMain/kotlin/space/kscience/kmath/real/DoubleVector.kt" ) feature( id = "DoubleMatrix", description = "Numpy-like operations for 2d real structures", - ref = "src/commonMain/kotlin/kscience/kmath/real/DoubleMatrix.kt" + ref = "src/commonMain/kotlin/space/kscience/kmath/real/DoubleMatrix.kt" ) feature( id = "grids", description = "Uniform grid generators", - ref = "src/commonMain/kotlin/kscience/kmath/structures/grids.kt" + ref = "src/commonMain/kotlin/space/kscience/kmath/structures/grids.kt" ) } diff --git a/kmath-functions/README.md b/kmath-functions/README.md index 29cc68c8e..d13c4c107 100644 --- a/kmath-functions/README.md +++ b/kmath-functions/README.md @@ -2,15 +2,15 @@ Functions and interpolations: - - [piecewise](Piecewise functions.) : src/commonMain/kotlin/kscience/kmath/functions/Piecewise.kt - - [polynomials](Polynomial functions.) : src/commonMain/kotlin/kscience/kmath/functions/Polynomial.kt - - [linear interpolation](Linear XY interpolator.) : src/commonMain/kotlin/kscience/kmath/interpolation/LinearInterpolator.kt - - [spline interpolation](Cubic spline XY interpolator.) : src/commonMain/kotlin/kscience/kmath/interpolation/SplineInterpolator.kt + - [piecewise](Piecewise functions.) : src/commonMain/kotlin/space/kscience/kmath/functions/Piecewise.kt + - [polynomials](Polynomial functions.) : src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt + - [linear interpolation](Linear XY interpolator.) : src/commonMain/kotlin/space/kscience/kmath/interpolation/LinearInterpolator.kt + - [spline interpolation](Cubic spline XY interpolator.) : src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt > #### Artifact: > -> This module artifact: `space.kscience:kmath-functions:0.3.0-dev-2`. +> This module artifact: `space.kscience:kmath-functions:0.3.0-dev-3`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-functions/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-functions/_latestVersion) > @@ -23,13 +23,10 @@ Functions and interpolations: > maven { url 'https://repo.kotlin.link' } > maven { url 'https://dl.bintray.com/hotkeytlt/maven' } > maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap ->// Uncomment if repo.kotlin.link is unavailable ->// maven { url 'https://dl.bintray.com/mipt-npm/kscience' } ->// maven { url 'https://dl.bintray.com/mipt-npm/dev' } > } > > dependencies { -> implementation 'space.kscience:kmath-functions:0.3.0-dev-2' +> implementation 'space.kscience:kmath-functions:0.3.0-dev-3' > } > ``` > **Gradle Kotlin DSL:** @@ -39,12 +36,9 @@ Functions and interpolations: > maven("https://repo.kotlin.link") > maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap > maven("https://dl.bintray.com/hotkeytlt/maven") // required for a ->// Uncomment if repo.kotlin.link is unavailable ->// maven("https://dl.bintray.com/mipt-npm/kscience") ->// maven("https://dl.bintray.com/mipt-npm/dev") > } > > dependencies { -> implementation("space.kscience:kmath-functions:0.3.0-dev-2") +> implementation("space.kscience:kmath-functions:0.3.0-dev-3") > } > ``` diff --git a/kmath-functions/build.gradle.kts b/kmath-functions/build.gradle.kts index 067dbd9b3..51fc75501 100644 --- a/kmath-functions/build.gradle.kts +++ b/kmath-functions/build.gradle.kts @@ -13,12 +13,12 @@ readme { maturity = ru.mipt.npm.gradle.Maturity.PROTOTYPE propertyByTemplate("artifact", rootProject.file("docs/templates/ARTIFACT-TEMPLATE.md")) - feature("piecewise", "src/commonMain/kotlin/kscience/kmath/functions/Piecewise.kt", "Piecewise functions.") - feature("polynomials", "src/commonMain/kotlin/kscience/kmath/functions/Polynomial.kt", "Polynomial functions.") + feature("piecewise", "src/commonMain/kotlin/space/kscience/kmath/functions/Piecewise.kt", "Piecewise functions.") + feature("polynomials", "src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt", "Polynomial functions.") feature("linear interpolation", - "src/commonMain/kotlin/kscience/kmath/interpolation/LinearInterpolator.kt", + "src/commonMain/kotlin/space/kscience/kmath/interpolation/LinearInterpolator.kt", "Linear XY interpolator.") feature("spline interpolation", - "src/commonMain/kotlin/kscience/kmath/interpolation/SplineInterpolator.kt", + "src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt", "Cubic spline XY interpolator.") } \ No newline at end of file diff --git a/kmath-nd4j/README.md b/kmath-nd4j/README.md index 08f0ae541..2771722eb 100644 --- a/kmath-nd4j/README.md +++ b/kmath-nd4j/README.md @@ -2,14 +2,14 @@ This subproject implements the following features: - - [nd4jarraystructure](src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt) : NDStructure wrapper for INDArray - - [nd4jarrayrings](src/commonMain/kotlin/kscience/kmath/structures/NDStructure.kt) : Rings over Nd4jArrayStructure of Int and Long - - [nd4jarrayfields](src/commonMain/kotlin/kscience/kmath/structures/Buffers.kt) : Fields over Nd4jArrayStructure of Float and Double + - [nd4jarraystructure](#) : NDStructure wrapper for INDArray + - [nd4jarrayrings](#) : Rings over Nd4jArrayStructure of Int and Long + - [nd4jarrayfields](#) : Fields over Nd4jArrayStructure of Float and Double > #### Artifact: > -> This module artifact: `space.kscience:kmath-nd4j:0.3.0-dev-2`. +> This module artifact: `space.kscience:kmath-nd4j:0.3.0-dev-3`. > > Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-nd4j/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-nd4j/_latestVersion) > @@ -22,13 +22,10 @@ This subproject implements the following features: > maven { url 'https://repo.kotlin.link' } > maven { url 'https://dl.bintray.com/hotkeytlt/maven' } > maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap ->// Uncomment if repo.kotlin.link is unavailable ->// maven { url 'https://dl.bintray.com/mipt-npm/kscience' } ->// maven { url 'https://dl.bintray.com/mipt-npm/dev' } > } > > dependencies { -> implementation 'space.kscience:kmath-nd4j:0.3.0-dev-2' +> implementation 'space.kscience:kmath-nd4j:0.3.0-dev-3' > } > ``` > **Gradle Kotlin DSL:** @@ -38,13 +35,10 @@ This subproject implements the following features: > maven("https://repo.kotlin.link") > maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap > maven("https://dl.bintray.com/hotkeytlt/maven") // required for a ->// Uncomment if repo.kotlin.link is unavailable ->// maven("https://dl.bintray.com/mipt-npm/kscience") ->// maven("https://dl.bintray.com/mipt-npm/dev") > } > > dependencies { -> implementation("space.kscience:kmath-nd4j:0.3.0-dev-2") +> implementation("space.kscience:kmath-nd4j:0.3.0-dev-3") > } > ``` @@ -57,7 +51,7 @@ import org.nd4j.linalg.factory.* import scientifik.kmath.nd4j.* import scientifik.kmath.structures.* -val array = Nd4j.ones(2, 2).asRealStructure() +val array = Nd4j.ones(2, 2).asDoubleStructure() println(array[0, 0]) // 1.0 array[intArrayOf(0, 0)] = 24.0 println(array[0, 0]) // 24.0 @@ -70,8 +64,8 @@ import org.nd4j.linalg.factory.* import scientifik.kmath.nd4j.* import scientifik.kmath.operations.* -val field = RealNd4jArrayField(intArrayOf(2, 2)) -val array = Nd4j.rand(2, 2).asRealStructure() +val field = DoubleNd4jArrayField(intArrayOf(2, 2)) +val array = Nd4j.rand(2, 2).asDoubleStructure() val res = field { (25.0 / array + 20) * 4 diff --git a/kmath-nd4j/build.gradle.kts b/kmath-nd4j/build.gradle.kts index c801f8e51..2954a1e65 100644 --- a/kmath-nd4j/build.gradle.kts +++ b/kmath-nd4j/build.gradle.kts @@ -19,19 +19,16 @@ readme { feature( id = "nd4jarraystructure", - description = "NDStructure wrapper for INDArray", - ref = "src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt" + description = "NDStructure wrapper for INDArray" ) feature( id = "nd4jarrayrings", - description = "Rings over Nd4jArrayStructure of Int and Long", - ref = "src/commonMain/kotlin/kscience/kmath/structures/NDStructure.kt" + description = "Rings over Nd4jArrayStructure of Int and Long" ) feature( id = "nd4jarrayfields", - description = "Fields over Nd4jArrayStructure of Float and Double", - ref = "src/commonMain/kotlin/kscience/kmath/structures/Buffers.kt" + description = "Fields over Nd4jArrayStructure of Float and Double" ) } From 6375cb5fd8cd0e50d6f236707e5f5818e104de64 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Wed, 17 Mar 2021 23:11:26 +0700 Subject: [PATCH 144/150] Some adjustments to the EJML module --- README.md | 12 ++-- kmath-ast/README.md | 2 +- kmath-core/README.md | 4 +- kmath-ejml/README.md | 43 ++++++++++++++ kmath-ejml/build.gradle.kts | 29 ++++++++-- kmath-ejml/docs/README-TEMPLATE.md | 7 +++ .../kscience/kmath/ejml/EjmlLinearSpace.kt | 56 ++++++++++++------- .../space/kscience/kmath/ejml/EjmlMatrix.kt | 2 +- .../space/kscience/kmath/ejml/EjmlVector.kt | 2 +- 9 files changed, 122 insertions(+), 35 deletions(-) create mode 100644 kmath-ejml/README.md create mode 100644 kmath-ejml/docs/README-TEMPLATE.md diff --git a/README.md b/README.md index 2aaeb3150..cc9439d27 100644 --- a/README.md +++ b/README.md @@ -120,10 +120,10 @@ KMath is a modular library. Different modules provide different features with di > > **Features:** > - [algebras](kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt) : Algebraic structures like rings, spaces and fields. -> - [nd](kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/StructureND.kt) : Many-dimensional structures and operations on them. +> - [nd](kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/StructureND.kt) : Many-dimensional structures and operations on them. > - [linear](kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt) : Basic linear algebra operations (sums, products, etc.), backed by the `Space` API. Advanced linear algebra operations like matrix inversion and LU decomposition. -> - [buffers](kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt) : One-dimensional structure -> - [expressions](kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions) : By writing a single mathematical expression once, users will be able to apply different types of +> - [buffers](kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffers.kt) : One-dimensional structure +> - [expressions](kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions) : By writing a single mathematical expression once, users will be able to apply different types of objects to the expression by providing a context. Expressions can be used for a wide variety of purposes from high performance calculations to code generation. > - [domains](kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains) : Domains @@ -206,9 +206,9 @@ One can still use generic algebras though. > **Maturity**: EXPERIMENTAL > > **Features:** -> - [nd4jarraystructure](kmath-nd4j/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt) : NDStructure wrapper for INDArray -> - [nd4jarrayrings](kmath-nd4j/src/commonMain/kotlin/space/kscience/kmath/structures/NDStructure.kt) : Rings over Nd4jArrayStructure of Int and Long -> - [nd4jarrayfields](kmath-nd4j/src/commonMain/kotlin/space/kscience/kmath/structures/Buffers.kt) : Fields over Nd4jArrayStructure of Float and Double +> - [nd4jarraystructure](kmath-nd4j/#) : NDStructure wrapper for INDArray +> - [nd4jarrayrings](kmath-nd4j/#) : Rings over Nd4jArrayStructure of Int and Long +> - [nd4jarrayfields](kmath-nd4j/#) : Fields over Nd4jArrayStructure of Float and Double
diff --git a/kmath-ast/README.md b/kmath-ast/README.md index 4c79b5b36..ee14604d2 100644 --- a/kmath-ast/README.md +++ b/kmath-ast/README.md @@ -58,7 +58,7 @@ For example, the following builder: DoubleField.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 space.kscience.kmath.asm.generated; diff --git a/kmath-core/README.md b/kmath-core/README.md index dd54b7aeb..4e4b5273d 100644 --- a/kmath-core/README.md +++ b/kmath-core/README.md @@ -3,10 +3,10 @@ The core features of KMath: - [algebras](src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt) : Algebraic structures like rings, spaces and fields. - - [nd](src/commonMain/kotlin/space/kscience/kmath/structures/NDStructure.kt) : Many-dimensional structures and operations on them. + - [nd](src/commonMain/kotlin/space/kscience/kmath/structures/StructureND.kt) : Many-dimensional structures and operations on them. - [linear](src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt) : Basic linear algebra operations (sums, products, etc.), backed by the `Space` API. Advanced linear algebra operations like matrix inversion and LU decomposition. - [buffers](src/commonMain/kotlin/space/kscience/kmath/structures/Buffers.kt) : One-dimensional structure - - [expressions](src/commonMain/kotlin/space/kscience/kmath/expressions) : By writing a single mathematical expression once, users will be able to apply different types of + - [expressions](src/commonMain/kotlin/space/kscience/kmath/expressions) : By writing a single mathematical expression once, users will be able to apply different types of objects to the expression by providing a context. Expressions can be used for a wide variety of purposes from high performance calculations to code generation. - [domains](src/commonMain/kotlin/space/kscience/kmath/domains) : Domains diff --git a/kmath-ejml/README.md b/kmath-ejml/README.md new file mode 100644 index 000000000..1081b2b7f --- /dev/null +++ b/kmath-ejml/README.md @@ -0,0 +1,43 @@ +# ejml-simple support (`kmath-ejml`) + +This subproject implements the following features: + + - [ejml-vector](src/main/kotlin/space/kscience/kmath/ejml/EjmlVector.kt) : The Point implementation using SimpleMatrix. + - [ejml-matrix](src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt) : The Matrix implementation using SimpleMatrix. + - [ejml-linear-space](src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt) : The LinearSpace implementation using SimpleMatrix. + + +> #### Artifact: +> +> This module artifact: `space.kscience:kmath-ejml:0.3.0-dev-3`. +> +> Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-ejml/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-ejml/_latestVersion) +> +> Bintray development version: [ ![Download](https://api.bintray.com/packages/mipt-npm/dev/kmath-ejml/images/download.svg) ](https://bintray.com/mipt-npm/dev/kmath-ejml/_latestVersion) +> +> **Gradle:** +> +> ```gradle +> repositories { +> maven { url 'https://repo.kotlin.link' } +> maven { url 'https://dl.bintray.com/hotkeytlt/maven' } +> maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap +> } +> +> dependencies { +> implementation 'space.kscience:kmath-ejml:0.3.0-dev-3' +> } +> ``` +> **Gradle Kotlin DSL:** +> +> ```kotlin +> repositories { +> maven("https://repo.kotlin.link") +> maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap +> maven("https://dl.bintray.com/hotkeytlt/maven") // required for a +> } +> +> dependencies { +> implementation("space.kscience:kmath-ejml:0.3.0-dev-3") +> } +> ``` diff --git a/kmath-ejml/build.gradle.kts b/kmath-ejml/build.gradle.kts index 1ce2291c4..5091139ac 100644 --- a/kmath-ejml/build.gradle.kts +++ b/kmath-ejml/build.gradle.kts @@ -1,12 +1,33 @@ +import ru.mipt.npm.gradle.Maturity + plugins { id("ru.mipt.npm.gradle.jvm") } dependencies { - implementation("org.ejml:ejml-simple:0.39") - implementation(project(":kmath-core")) + api("org.ejml:ejml-simple:0.40") + api(project(":kmath-core")) } readme { - maturity = ru.mipt.npm.gradle.Maturity.PROTOTYPE -} \ No newline at end of file + maturity = Maturity.PROTOTYPE + propertyByTemplate("artifact", rootProject.file("docs/templates/ARTIFACT-TEMPLATE.md")) + + feature( + id = "ejml-vector", + description = "The Point implementation using SimpleMatrix.", + ref = "src/main/kotlin/space/kscience/kmath/ejml/EjmlVector.kt" + ) + + feature( + id = "ejml-matrix", + description = "The Matrix implementation using SimpleMatrix.", + ref = "src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt" + ) + + feature( + id = "ejml-linear-space", + description = "The LinearSpace implementation using SimpleMatrix.", + ref = "src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt" + ) +} diff --git a/kmath-ejml/docs/README-TEMPLATE.md b/kmath-ejml/docs/README-TEMPLATE.md new file mode 100644 index 000000000..c53f4a81c --- /dev/null +++ b/kmath-ejml/docs/README-TEMPLATE.md @@ -0,0 +1,7 @@ +# ejml-simple support (`kmath-ejml`) + +This subproject implements the following features: + +${features} + +${artifact} diff --git a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt index a82fe933e..6fc0a049c 100644 --- a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt +++ b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt @@ -14,10 +14,13 @@ import kotlin.reflect.cast * Represents context of basic operations operating with [EjmlMatrix]. * * @author Iaroslav Postovalov + * @author Alexander Nozik */ public object EjmlLinearSpace : LinearSpace { - - override val elementAlgebra: DoubleField get() = DoubleField + /** + * The [DoubleField] reference. + */ + public override val elementAlgebra: DoubleField get() = DoubleField /** * Converts this matrix to EJML one. @@ -38,14 +41,17 @@ public object EjmlLinearSpace : LinearSpace { }) } - override fun buildMatrix(rows: Int, columns: Int, initializer: DoubleField.(i: Int, j: Int) -> Double): EjmlMatrix = - EjmlMatrix(SimpleMatrix(rows, columns).also { - (0 until rows).forEach { row -> - (0 until columns).forEach { col -> it[row, col] = DoubleField.initializer(row, col) } - } - }) + public override fun buildMatrix( + rows: Int, + columns: Int, + initializer: DoubleField.(i: Int, j: Int) -> Double, + ): EjmlMatrix = EjmlMatrix(SimpleMatrix(rows, columns).also { + (0 until rows).forEach { row -> + (0 until columns).forEach { col -> it[row, col] = DoubleField.initializer(row, col) } + } + }) - override fun buildVector(size: Int, initializer: DoubleField.(Int) -> Double): Point = + public override fun buildVector(size: Int, initializer: DoubleField.(Int) -> Double): Point = EjmlVector(SimpleMatrix(size, 1).also { (0 until it.numRows()).forEach { row -> it[row, 0] = DoubleField.initializer(row) } }) @@ -53,7 +59,7 @@ public object EjmlLinearSpace : LinearSpace { private fun SimpleMatrix.wrapMatrix() = EjmlMatrix(this) private fun SimpleMatrix.wrapVector() = EjmlVector(this) - override fun Matrix.unaryMinus(): Matrix = this * (-1.0) + public override fun Matrix.unaryMinus(): Matrix = this * (-1.0) public override fun Matrix.dot(other: Matrix): EjmlMatrix = EjmlMatrix(toEjml().origin.mult(other.toEjml().origin)) @@ -67,29 +73,29 @@ public object EjmlLinearSpace : LinearSpace { public override operator fun Matrix.times(value: Double): EjmlMatrix = toEjml().origin.scale(value).wrapMatrix() - override fun Point.unaryMinus(): EjmlVector = + public override fun Point.unaryMinus(): EjmlVector = toEjml().origin.negative().wrapVector() - override fun Matrix.plus(other: Matrix): EjmlMatrix = + public override fun Matrix.plus(other: Matrix): EjmlMatrix = (toEjml().origin + other.toEjml().origin).wrapMatrix() - override fun Point.plus(other: Point): EjmlVector = + public override fun Point.plus(other: Point): EjmlVector = (toEjml().origin + other.toEjml().origin).wrapVector() - override fun Point.minus(other: Point): EjmlVector = + public override fun Point.minus(other: Point): EjmlVector = (toEjml().origin - other.toEjml().origin).wrapVector() - override fun Double.times(m: Matrix): EjmlMatrix = + public override fun Double.times(m: Matrix): EjmlMatrix = m.toEjml().origin.scale(this).wrapMatrix() - override fun Point.times(value: Double): EjmlVector = + public override fun Point.times(value: Double): EjmlVector = toEjml().origin.scale(value).wrapVector() - override fun Double.times(v: Point): EjmlVector = + public override fun Double.times(v: Point): EjmlVector = v.toEjml().origin.scale(this).wrapVector() @UnstableKMathAPI - override fun getFeature(structure: Matrix, type: KClass): F? { + public override fun getFeature(structure: Matrix, type: KClass): F? { //Return the feature if it is intrinsic to the structure structure.getFeature(type)?.let { return it } @@ -160,7 +166,7 @@ public object EjmlLinearSpace : LinearSpace { } /** - * Solves for X in the following equation: x = a^-1*b, where 'a' is base matrix and 'b' is an n by p matrix. + * Solves for *x* in the following equation: *x = [a] -1 · [b]*. * * @param a the base matrix. * @param b n by p matrix. @@ -171,7 +177,7 @@ public fun EjmlLinearSpace.solve(a: Matrix, b: Matrix): EjmlMatr EjmlMatrix(a.toEjml().origin.solve(b.toEjml().origin)) /** - * Solves for X in the following equation: x = a^(-1)*b, where 'a' is base matrix and 'b' is an n by p matrix. + * Solves for *x* in the following equation: *x = [a] -1 · [b]*. * * @param a the base matrix. * @param b n by p vector. @@ -181,7 +187,17 @@ public fun EjmlLinearSpace.solve(a: Matrix, b: Matrix): EjmlMatr public fun EjmlLinearSpace.solve(a: Matrix, b: Point): EjmlVector = EjmlVector(a.toEjml().origin.solve(b.toEjml().origin)) +/** + * Inverts this matrix. + * + * @author Alexander Nozik + */ @OptIn(UnstableKMathAPI::class) public fun EjmlMatrix.inverted(): EjmlMatrix = getFeature>()!!.inverse as EjmlMatrix +/** + * Inverts the given matrix. + * + * @author Alexander Nozik + */ public fun EjmlLinearSpace.inverse(matrix: Matrix): Matrix = matrix.toEjml().inverted() \ No newline at end of file diff --git a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt index 712c2a42c..10afd6ec2 100644 --- a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt +++ b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt @@ -4,7 +4,7 @@ import org.ejml.simple.SimpleMatrix import space.kscience.kmath.linear.Matrix /** - * Represents featured matrix over EJML [SimpleMatrix]. + * The matrix implementation over EJML [SimpleMatrix]. * * @property origin the underlying [SimpleMatrix]. * @author Iaroslav Postovalov diff --git a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlVector.kt b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlVector.kt index c7f87675d..2c8d2edd4 100644 --- a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlVector.kt +++ b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlVector.kt @@ -9,7 +9,7 @@ import space.kscience.kmath.linear.Point * @property origin the underlying [SimpleMatrix]. * @author Iaroslav Postovalov */ -public class EjmlVector internal constructor(public val origin: SimpleMatrix) : Point { +public inline class EjmlVector internal constructor(public val origin: SimpleMatrix) : Point { public override val size: Int get() = origin.numRows() From 88d0c19a741f32145877c65d1cf7f70ff20b9ade Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Fri, 19 Mar 2021 11:07:27 +0300 Subject: [PATCH 145/150] Refactor structure features. Basic curve fitting --- build.gradle.kts | 6 +- .../kmath/commons/fit/fitWithAutoDiff.kt | 8 +- .../kscience/kmath/commons/linear/CMMatrix.kt | 3 +- ...timizationProblem.kt => CMOptimization.kt} | 42 +++--- .../kmath/commons/optimization/cmFit.kt | 22 ++-- .../commons/optimization/OptimizeTest.kt | 4 +- kmath-core/api/kmath-core.api | 9 +- .../kscience/kmath/linear/LinearSpace.kt | 4 +- .../kscience/kmath/linear/MatrixFeatures.kt | 4 +- .../kscience/kmath/linear/MatrixWrapper.kt | 3 +- .../space/kscience/kmath/nd/AlgebraND.kt | 5 +- .../space/kscience/kmath/nd/Structure1D.kt | 2 + .../space/kscience/kmath/nd/Structure2D.kt | 2 +- .../space/kscience/kmath/nd/StructureND.kt | 6 +- .../kmath/chains/BlockingDoubleChain.kt | 2 +- .../kscience/kmath/ejml/EjmlLinearSpace.kt | 3 +- .../kotlin/space/kscience/kmath/real/grids.kt | 74 ++++++----- kmath-stat/build.gradle.kts | 8 -- .../kscience/kmath/optimization/DataFit.kt | 17 +++ .../optimization/FunctionOptimization.kt | 122 ++++++++++++++++++ .../kmath/optimization/Optimization.kt | 44 +++++++ .../space/kscience/kmath/stat/Fitting.kt | 63 --------- .../kmath/stat/OptimizationProblem.kt | 88 ------------- .../space/kscience/kmath/stat/RandomChain.kt | 2 +- .../kscience/kmath/stat/distributions.kt | 25 ++-- 25 files changed, 311 insertions(+), 257 deletions(-) rename kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/{CMOptimizationProblem.kt => CMOptimization.kt} (75%) create mode 100644 kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/DataFit.kt create mode 100644 kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/FunctionOptimization.kt create mode 100644 kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/Optimization.kt delete mode 100644 kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Fitting.kt delete mode 100644 kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/OptimizationProblem.kt diff --git a/build.gradle.kts b/build.gradle.kts index 5f1a8b88a..9570d7744 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,3 @@ -import ru.mipt.npm.gradle.KSciencePublishingPlugin - plugins { id("ru.mipt.npm.gradle.project") } @@ -20,11 +18,11 @@ allprojects { } group = "space.kscience" - version = "0.3.0-dev-3" + version = "0.3.0-dev-4" } subprojects { - if (name.startsWith("kmath")) apply() + if (name.startsWith("kmath")) apply(plugin = "maven-publish") } readme { diff --git a/examples/src/main/kotlin/space/kscience/kmath/commons/fit/fitWithAutoDiff.kt b/examples/src/main/kotlin/space/kscience/kmath/commons/fit/fitWithAutoDiff.kt index ef0c29a2d..6141a1058 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/commons/fit/fitWithAutoDiff.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/commons/fit/fitWithAutoDiff.kt @@ -8,10 +8,14 @@ import kscience.plotly.models.TraceValues import space.kscience.kmath.commons.optimization.chiSquared import space.kscience.kmath.commons.optimization.minimize import space.kscience.kmath.expressions.symbol +import space.kscience.kmath.optimization.FunctionOptimization +import space.kscience.kmath.optimization.OptimizationResult import space.kscience.kmath.real.DoubleVector import space.kscience.kmath.real.map import space.kscience.kmath.real.step -import space.kscience.kmath.stat.* +import space.kscience.kmath.stat.Distribution +import space.kscience.kmath.stat.RandomGenerator +import space.kscience.kmath.stat.normal import space.kscience.kmath.structures.asIterable import space.kscience.kmath.structures.toList import kotlin.math.pow @@ -58,7 +62,7 @@ fun main() { val yErr = y.map { sqrt(it) }//RealVector.same(x.size, sigma) // compute differentiable chi^2 sum for given model ax^2 + bx + c - val chi2 = Fitting.chiSquared(x, y, yErr) { x1 -> + val chi2 = FunctionOptimization.chiSquared(x, y, yErr) { x1 -> //bind variables to autodiff context val a = bind(a) val b = bind(b) diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt index 89e9649e9..80929e6b9 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt @@ -3,6 +3,7 @@ package space.kscience.kmath.commons.linear import org.apache.commons.math3.linear.* import space.kscience.kmath.linear.* import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.nd.StructureFeature import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.structures.DoubleBuffer import kotlin.reflect.KClass @@ -89,7 +90,7 @@ public object CMLinearSpace : LinearSpace { v * this @UnstableKMathAPI - override fun getFeature(structure: Matrix, type: KClass): F? { + override fun getFeature(structure: Matrix, type: KClass): F? { //Return the feature if it is intrinsic to the structure structure.getFeature(type)?.let { return it } diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/CMOptimizationProblem.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/CMOptimization.kt similarity index 75% rename from kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/CMOptimizationProblem.kt rename to kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/CMOptimization.kt index 13a10475f..6200b61a9 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/CMOptimizationProblem.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/CMOptimization.kt @@ -10,21 +10,25 @@ import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.AbstractSimplex import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.NelderMeadSimplex import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.SimplexOptimizer import space.kscience.kmath.expressions.* -import space.kscience.kmath.stat.OptimizationFeature -import space.kscience.kmath.stat.OptimizationProblem -import space.kscience.kmath.stat.OptimizationProblemFactory -import space.kscience.kmath.stat.OptimizationResult +import space.kscience.kmath.optimization.FunctionOptimization +import space.kscience.kmath.optimization.OptimizationFeature +import space.kscience.kmath.optimization.OptimizationProblemFactory +import space.kscience.kmath.optimization.OptimizationResult import kotlin.reflect.KClass public operator fun PointValuePair.component1(): DoubleArray = point public operator fun PointValuePair.component2(): Double = value -public class CMOptimizationProblem(override val symbols: List) : - OptimizationProblem, SymbolIndexer, OptimizationFeature { +public class CMOptimization( + override val symbols: List, +) : FunctionOptimization, SymbolIndexer, OptimizationFeature { private val optimizationData: HashMap, OptimizationData> = HashMap() - private var optimizatorBuilder: (() -> MultivariateOptimizer)? = null - public var convergenceChecker: ConvergenceChecker = SimpleValueChecker(DEFAULT_RELATIVE_TOLERANCE, - DEFAULT_ABSOLUTE_TOLERANCE, DEFAULT_MAX_ITER) + private var optimizerBuilder: (() -> MultivariateOptimizer)? = null + public var convergenceChecker: ConvergenceChecker = SimpleValueChecker( + DEFAULT_RELATIVE_TOLERANCE, + DEFAULT_ABSOLUTE_TOLERANCE, + DEFAULT_MAX_ITER + ) public fun addOptimizationData(data: OptimizationData) { optimizationData[data::class] = data @@ -57,8 +61,8 @@ public class CMOptimizationProblem(override val symbols: List) : } } addOptimizationData(gradientFunction) - if (optimizatorBuilder == null) { - optimizatorBuilder = { + if (optimizerBuilder == null) { + optimizerBuilder = { NonLinearConjugateGradientOptimizer( NonLinearConjugateGradientOptimizer.Formula.FLETCHER_REEVES, convergenceChecker @@ -70,8 +74,8 @@ public class CMOptimizationProblem(override val symbols: List) : public fun simplex(simplex: AbstractSimplex) { addOptimizationData(simplex) //Set optimization builder to simplex if it is not present - if (optimizatorBuilder == null) { - optimizatorBuilder = { SimplexOptimizer(convergenceChecker) } + if (optimizerBuilder == null) { + optimizerBuilder = { SimplexOptimizer(convergenceChecker) } } } @@ -84,7 +88,7 @@ public class CMOptimizationProblem(override val symbols: List) : } public fun optimizer(block: () -> MultivariateOptimizer) { - optimizatorBuilder = block + optimizerBuilder = block } override fun update(result: OptimizationResult) { @@ -92,19 +96,19 @@ public class CMOptimizationProblem(override val symbols: List) : } override fun optimize(): OptimizationResult { - val optimizer = optimizatorBuilder?.invoke() ?: error("Optimizer not defined") + val optimizer = optimizerBuilder?.invoke() ?: error("Optimizer not defined") val (point, value) = optimizer.optimize(*optimizationData.values.toTypedArray()) return OptimizationResult(point.toMap(), value, setOf(this)) } - public companion object : OptimizationProblemFactory { + public companion object : OptimizationProblemFactory { public const val DEFAULT_RELATIVE_TOLERANCE: Double = 1e-4 public const val DEFAULT_ABSOLUTE_TOLERANCE: Double = 1e-4 public const val DEFAULT_MAX_ITER: Int = 1000 - override fun build(symbols: List): CMOptimizationProblem = CMOptimizationProblem(symbols) + override fun build(symbols: List): CMOptimization = CMOptimization(symbols) } } -public fun CMOptimizationProblem.initialGuess(vararg pairs: Pair): Unit = initialGuess(pairs.toMap()) -public fun CMOptimizationProblem.simplexSteps(vararg pairs: Pair): Unit = simplexSteps(pairs.toMap()) +public fun CMOptimization.initialGuess(vararg pairs: Pair): Unit = initialGuess(pairs.toMap()) +public fun CMOptimization.simplexSteps(vararg pairs: Pair): Unit = simplexSteps(pairs.toMap()) diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/cmFit.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/cmFit.kt index 5ecd5b756..384414e6d 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/cmFit.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/cmFit.kt @@ -6,16 +6,16 @@ import space.kscience.kmath.commons.expressions.DerivativeStructureField import space.kscience.kmath.expressions.DifferentiableExpression import space.kscience.kmath.expressions.Expression import space.kscience.kmath.expressions.Symbol -import space.kscience.kmath.stat.Fitting -import space.kscience.kmath.stat.OptimizationResult -import space.kscience.kmath.stat.optimizeWith +import space.kscience.kmath.optimization.FunctionOptimization +import space.kscience.kmath.optimization.OptimizationResult +import space.kscience.kmath.optimization.optimizeWith import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.asBuffer /** * Generate a chi squared expression from given x-y-sigma data and inline model. Provides automatic differentiation */ -public fun Fitting.chiSquared( +public fun FunctionOptimization.Companion.chiSquared( x: Buffer, y: Buffer, yErr: Buffer, @@ -25,7 +25,7 @@ public fun Fitting.chiSquared( /** * Generate a chi squared expression from given x-y-sigma data and inline model. Provides automatic differentiation */ -public fun Fitting.chiSquared( +public fun FunctionOptimization.Companion.chiSquared( x: Iterable, y: Iterable, yErr: Iterable, @@ -43,23 +43,23 @@ public fun Fitting.chiSquared( */ public fun Expression.optimize( vararg symbols: Symbol, - configuration: CMOptimizationProblem.() -> Unit, -): OptimizationResult = optimizeWith(CMOptimizationProblem, symbols = symbols, configuration) + configuration: CMOptimization.() -> Unit, +): OptimizationResult = optimizeWith(CMOptimization, symbols = symbols, configuration) /** * Optimize differentiable expression */ public fun DifferentiableExpression>.optimize( vararg symbols: Symbol, - configuration: CMOptimizationProblem.() -> Unit, -): OptimizationResult = optimizeWith(CMOptimizationProblem, symbols = symbols, configuration) + configuration: CMOptimization.() -> Unit, +): OptimizationResult = optimizeWith(CMOptimization, symbols = symbols, configuration) public fun DifferentiableExpression>.minimize( vararg startPoint: Pair, - configuration: CMOptimizationProblem.() -> Unit = {}, + configuration: CMOptimization.() -> Unit = {}, ): OptimizationResult { require(startPoint.isNotEmpty()) { "Must provide a list of symbols for optimization" } - val problem = CMOptimizationProblem(startPoint.map { it.first }).apply(configuration) + val problem = CMOptimization(startPoint.map { it.first }).apply(configuration) problem.diffExpression(this) problem.initialGuess(startPoint.toMap()) problem.goal(GoalType.MINIMIZE) diff --git a/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/optimization/OptimizeTest.kt b/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/optimization/OptimizeTest.kt index d29934a4d..cbbe1457e 100644 --- a/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/optimization/OptimizeTest.kt +++ b/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/optimization/OptimizeTest.kt @@ -3,8 +3,8 @@ package space.kscience.kmath.commons.optimization import org.junit.jupiter.api.Test import space.kscience.kmath.commons.expressions.DerivativeStructureExpression import space.kscience.kmath.expressions.symbol +import space.kscience.kmath.optimization.FunctionOptimization import space.kscience.kmath.stat.Distribution -import space.kscience.kmath.stat.Fitting import space.kscience.kmath.stat.RandomGenerator import space.kscience.kmath.stat.normal import kotlin.math.pow @@ -55,7 +55,7 @@ internal class OptimizeTest { val yErr = List(x.size) { sigma } - val chi2 = Fitting.chiSquared(x, y, yErr) { x1 -> + val chi2 = FunctionOptimization.chiSquared(x, y, yErr) { x1 -> val cWithDefault = bindSymbolOrNull(c) ?: one bind(a) * x1.pow(2) + bind(b) * x1 + cWithDefault } diff --git a/kmath-core/api/kmath-core.api b/kmath-core/api/kmath-core.api index 04325379e..8c62198cd 100644 --- a/kmath-core/api/kmath-core.api +++ b/kmath-core/api/kmath-core.api @@ -575,7 +575,7 @@ public final class space/kscience/kmath/linear/MatrixBuilderKt { public static final fun row (Lspace/kscience/kmath/linear/LinearSpace;[Ljava/lang/Object;)Lspace/kscience/kmath/nd/Structure2D; } -public abstract interface class space/kscience/kmath/linear/MatrixFeature { +public abstract interface class space/kscience/kmath/linear/MatrixFeature : space/kscience/kmath/nd/StructureFeature { } public final class space/kscience/kmath/linear/MatrixFeaturesKt { @@ -1060,11 +1060,15 @@ public final class space/kscience/kmath/nd/Strides$DefaultImpls { } public abstract interface class space/kscience/kmath/nd/Structure1D : space/kscience/kmath/nd/StructureND, space/kscience/kmath/structures/Buffer { + public static final field Companion Lspace/kscience/kmath/nd/Structure1D$Companion; public abstract fun get ([I)Ljava/lang/Object; public abstract fun getDimension ()I public abstract fun iterator ()Ljava/util/Iterator; } +public final class space/kscience/kmath/nd/Structure1D$Companion { +} + public final class space/kscience/kmath/nd/Structure1D$DefaultImpls { public static fun get (Lspace/kscience/kmath/nd/Structure1D;[I)Ljava/lang/Object; public static fun getDimension (Lspace/kscience/kmath/nd/Structure1D;)I @@ -1104,6 +1108,9 @@ public final class space/kscience/kmath/nd/Structure2DKt { public static final fun as2D (Lspace/kscience/kmath/nd/StructureND;)Lspace/kscience/kmath/nd/Structure2D; } +public abstract interface class space/kscience/kmath/nd/StructureFeature { +} + public abstract interface class space/kscience/kmath/nd/StructureND { public static final field Companion Lspace/kscience/kmath/nd/StructureND$Companion; public abstract fun elements ()Lkotlin/sequences/Sequence; diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt index 6a587270b..dfc4c7c9b 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt @@ -164,7 +164,7 @@ public interface LinearSpace> { * @return a feature object or `null` if it isn't present. */ @UnstableKMathAPI - public fun getFeature(structure: Matrix, type: KClass): F? = structure.getFeature(type) + public fun getFeature(structure: Matrix, type: KClass): F? = structure.getFeature(type) public companion object { @@ -194,7 +194,7 @@ public interface LinearSpace> { * @return a feature object or `null` if it isn't present. */ @UnstableKMathAPI -public inline fun LinearSpace.getFeature(structure: Matrix): F? = +public inline fun LinearSpace.getFeature(structure: Matrix): F? = getFeature(structure, F::class) diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixFeatures.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixFeatures.kt index 6b97e89ef..30e3daa7a 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixFeatures.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixFeatures.kt @@ -1,10 +1,12 @@ package space.kscience.kmath.linear +import space.kscience.kmath.nd.StructureFeature + /** * A marker interface representing some properties of matrices or additional transformations of them. Features are used * to optimize matrix operations performance in some cases or retrieve the APIs. */ -public interface MatrixFeature +public interface MatrixFeature: StructureFeature /** * Matrices with this feature are considered to have only diagonal non-null elements. diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixWrapper.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixWrapper.kt index 868f74cc6..def3b87f7 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixWrapper.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixWrapper.kt @@ -1,6 +1,7 @@ package space.kscience.kmath.linear import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.nd.StructureFeature import space.kscience.kmath.nd.getFeature import space.kscience.kmath.operations.Ring import kotlin.reflect.KClass @@ -20,7 +21,7 @@ public class MatrixWrapper internal constructor( */ @UnstableKMathAPI @Suppress("UNCHECKED_CAST") - override fun getFeature(type: KClass): T? = features.singleOrNull { type.isInstance(it) } as? T + override fun getFeature(type: KClass): F? = features.singleOrNull { type.isInstance(it) } as? F ?: origin.getFeature(type) override fun toString(): String { diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/AlgebraND.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/AlgebraND.kt index b23ce947d..2821a6648 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/AlgebraND.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/AlgebraND.kt @@ -67,7 +67,8 @@ public interface AlgebraND> { * @return a feature object or `null` if it isn't present. */ @UnstableKMathAPI - public fun getFeature(structure: StructureND, type: KClass): F? = structure.getFeature(type) + public fun getFeature(structure: StructureND, type: KClass): F? = + structure.getFeature(type) public companion object } @@ -81,7 +82,7 @@ public interface AlgebraND> { * @return a feature object or `null` if it isn't present. */ @UnstableKMathAPI -public inline fun AlgebraND.getFeature(structure: StructureND): F? = +public inline fun AlgebraND.getFeature(structure: StructureND): F? = getFeature(structure, F::class) /** diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt index 8cf5d18cb..5483ed28f 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure1D.kt @@ -15,6 +15,8 @@ public interface Structure1D : StructureND, Buffer { } public override operator fun iterator(): Iterator = (0 until size).asSequence().map(::get).iterator() + + public companion object } /** diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt index 3834cd97c..5dfdd028a 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Structure2D.kt @@ -69,7 +69,7 @@ private inline class Structure2DWrapper(val structure: StructureND) : Stru override operator fun get(i: Int, j: Int): T = structure[i, j] @UnstableKMathAPI - override fun getFeature(type: KClass): F? = structure.getFeature(type) + override fun getFeature(type: KClass): F? = structure.getFeature(type) override fun elements(): Sequence> = structure.elements() } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/StructureND.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/StructureND.kt index 78eac1809..a1aa5e554 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/StructureND.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/StructureND.kt @@ -7,6 +7,8 @@ import kotlin.jvm.JvmName import kotlin.native.concurrent.ThreadLocal import kotlin.reflect.KClass +public interface StructureFeature + /** * Represents n-dimensional structure, i.e. multidimensional container of items of the same type and size. The number * of dimensions and items in an array is defined by its shape, which is a sequence of non-negative integers that @@ -48,7 +50,7 @@ public interface StructureND { * If the feature is not present, null is returned. */ @UnstableKMathAPI - public fun getFeature(type: KClass): F? = null + public fun getFeature(type: KClass): F? = null public companion object { /** @@ -144,7 +146,7 @@ public interface StructureND { public operator fun StructureND.get(vararg index: Int): T = get(index) @UnstableKMathAPI -public inline fun StructureND<*>.getFeature(): T? = getFeature(T::class) +public inline fun StructureND<*>.getFeature(): T? = getFeature(T::class) /** * Represents mutable [StructureND]. diff --git a/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/BlockingDoubleChain.kt b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/BlockingDoubleChain.kt index bc4508994..ba6adf35b 100644 --- a/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/BlockingDoubleChain.kt +++ b/kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/BlockingDoubleChain.kt @@ -8,5 +8,5 @@ public abstract class BlockingDoubleChain : Chain { override suspend fun next(): Double = nextDouble() - public fun nextBlock(size: Int): DoubleArray = DoubleArray(size) { nextDouble() } + public open fun nextBlock(size: Int): DoubleArray = DoubleArray(size) { nextDouble() } } diff --git a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt index a82fe933e..f84a57c9d 100644 --- a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt +++ b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt @@ -4,6 +4,7 @@ import org.ejml.dense.row.factory.DecompositionFactory_DDRM import org.ejml.simple.SimpleMatrix import space.kscience.kmath.linear.* import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.nd.StructureFeature import space.kscience.kmath.nd.getFeature import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.structures.DoubleBuffer @@ -89,7 +90,7 @@ public object EjmlLinearSpace : LinearSpace { v.toEjml().origin.scale(this).wrapVector() @UnstableKMathAPI - override fun getFeature(structure: Matrix, type: KClass): F? { + override fun getFeature(structure: Matrix, type: KClass): F? { //Return the feature if it is intrinsic to the structure structure.getFeature(type)?.let { return it } diff --git a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/grids.kt b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/grids.kt index 35297a3ac..446a3d9cb 100644 --- a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/grids.kt +++ b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/grids.kt @@ -1,7 +1,43 @@ package space.kscience.kmath.real -import space.kscience.kmath.structures.asBuffer -import kotlin.math.abs +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.DoubleBuffer +import kotlin.math.floor + +public val ClosedFloatingPointRange.length: Double get() = endInclusive - start + +/** + * Create a Buffer-based grid with equally distributed [numberOfPoints] points. The range could be increasing or decreasing. + * If range has a zero size, then the buffer consisting of [numberOfPoints] equal values is returned. + */ +@UnstableKMathAPI +public fun Buffer.Companion.fromRange(range: ClosedFloatingPointRange, numberOfPoints: Int): DoubleBuffer { + require(numberOfPoints >= 2) { "Number of points in grid must be more than 1" } + val normalizedRange = when { + range.endInclusive > range.start -> range + range.endInclusive < range.start -> range.endInclusive..range.start + else -> return DoubleBuffer(numberOfPoints) { range.start } + } + val step = normalizedRange.length / (numberOfPoints - 1) + return DoubleBuffer(numberOfPoints) { normalizedRange.start + step * it / (numberOfPoints - 1) } +} + +/** + * Create a Buffer-based grid with equally distributed points with a fixed [step]. The range could be increasing or decreasing. + * If the step is larger than the range size, single point is returned. + */ +@UnstableKMathAPI +public fun Buffer.Companion.fromRange(range: ClosedFloatingPointRange, step: Double): DoubleBuffer { + require(step > 0) { "The grid step must be positive" } + val normalizedRange = when { + range.endInclusive > range.start -> range + range.endInclusive < range.start -> range.endInclusive..range.start + else -> return DoubleBuffer(range.start) + } + val numberOfPoints = floor(normalizedRange.length / step).toInt() + return DoubleBuffer(numberOfPoints) { normalizedRange.start + step * it / (numberOfPoints - 1) } +} /** * Convert double range to sequence. @@ -11,35 +47,5 @@ import kotlin.math.abs * * If step is negative, the same goes from upper boundary downwards */ -public fun ClosedFloatingPointRange.toSequenceWithStep(step: Double): Sequence = when { - step == 0.0 -> error("Zero step in double progression") - - step > 0 -> sequence { - var current = start - - while (current <= endInclusive) { - yield(current) - current += step - } - } - - else -> sequence { - var current = endInclusive - - while (current >= start) { - yield(current) - current += step - } - } -} - -public infix fun ClosedFloatingPointRange.step(step: Double): DoubleVector = - toSequenceWithStep(step).toList().asBuffer() - -/** - * Convert double range to sequence with the fixed number of points - */ -public fun ClosedFloatingPointRange.toSequenceWithPoints(numPoints: Int): Sequence { - require(numPoints > 1) { "The number of points should be more than 2" } - return toSequenceWithStep(abs(endInclusive - start) / (numPoints - 1)) -} +@UnstableKMathAPI +public infix fun ClosedFloatingPointRange.step(step: Double): DoubleBuffer = Buffer.fromRange(this, step) \ No newline at end of file diff --git a/kmath-stat/build.gradle.kts b/kmath-stat/build.gradle.kts index 5b29a9e64..bc3890b1e 100644 --- a/kmath-stat/build.gradle.kts +++ b/kmath-stat/build.gradle.kts @@ -3,14 +3,6 @@ plugins { } kotlin.sourceSets { - all { - languageSettings.apply { - useExperimentalAnnotation("kotlinx.coroutines.FlowPreview") - useExperimentalAnnotation("kotlinx.coroutines.ExperimentalCoroutinesApi") - useExperimentalAnnotation("kotlinx.coroutines.ObsoleteCoroutinesApi") - } - } - commonMain { dependencies { api(project(":kmath-coroutines")) diff --git a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/DataFit.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/DataFit.kt new file mode 100644 index 000000000..e9a5dea86 --- /dev/null +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/DataFit.kt @@ -0,0 +1,17 @@ +package space.kscience.kmath.optimization + +import space.kscience.kmath.expressions.DifferentiableExpression +import space.kscience.kmath.expressions.StringSymbol +import space.kscience.kmath.expressions.Symbol +import space.kscience.kmath.structures.Buffer + +public interface DataFit : Optimization { + + public fun modelAndData( + x: Buffer, + y: Buffer, + yErr: Buffer, + model: DifferentiableExpression, + xSymbol: Symbol = StringSymbol("x"), + ) +} \ No newline at end of file diff --git a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/FunctionOptimization.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/FunctionOptimization.kt new file mode 100644 index 000000000..bf37f5c64 --- /dev/null +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/FunctionOptimization.kt @@ -0,0 +1,122 @@ +package space.kscience.kmath.optimization + +import space.kscience.kmath.expressions.* +import space.kscience.kmath.operations.ExtendedField +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.indices +import kotlin.math.pow + +/** + * A likelihood function optimization problem + */ +public interface FunctionOptimization: Optimization, DataFit { + /** + * Define the initial guess for the optimization problem + */ + public fun initialGuess(map: Map) + + /** + * Set an objective function expression + */ + public fun expression(expression: Expression) + + /** + * Set a differentiable expression as objective function as function and gradient provider + */ + public fun diffExpression(expression: DifferentiableExpression>) + + override fun modelAndData( + x: Buffer, + y: Buffer, + yErr: Buffer, + model: DifferentiableExpression, + xSymbol: Symbol, + ) { + require(x.size == y.size) { "X and y buffers should be of the same size" } + require(y.size == yErr.size) { "Y and yErr buffer should of the same size" } + + } + + public companion object{ + /** + * Generate a chi squared expression from given x-y-sigma data and inline model. Provides automatic differentiation + */ + public fun chiSquared( + autoDiff: AutoDiffProcessor>, + x: Buffer, + y: Buffer, + yErr: Buffer, + model: A.(I) -> I, + ): DifferentiableExpression> where A : ExtendedField, A : ExpressionAlgebra { + require(x.size == y.size) { "X and y buffers should be of the same size" } + require(y.size == yErr.size) { "Y and yErr buffer should of the same size" } + + return autoDiff.process { + var sum = zero + + x.indices.forEach { + val xValue = const(x[it]) + val yValue = const(y[it]) + val yErrValue = const(yErr[it]) + val modelValue = model(xValue) + sum += ((yValue - modelValue) / yErrValue).pow(2) + } + + sum + } + } + + /** + * Generate a chi squared expression from given x-y-sigma model represented by an expression. Does not provide derivatives + */ + public fun chiSquared( + x: Buffer, + y: Buffer, + yErr: Buffer, + model: Expression, + xSymbol: Symbol = StringSymbol("x"), + ): Expression { + require(x.size == y.size) { "X and y buffers should be of the same size" } + require(y.size == yErr.size) { "Y and yErr buffer should of the same size" } + + return Expression { arguments -> + x.indices.sumByDouble { + val xValue = x[it] + val yValue = y[it] + val yErrValue = yErr[it] + val modifiedArgs = arguments + (xSymbol to xValue) + val modelValue = model(modifiedArgs) + ((yValue - modelValue) / yErrValue).pow(2) + } + } + } + } +} + +/** + * Optimize expression without derivatives using specific [OptimizationProblemFactory] + */ +public fun > Expression.optimizeWith( + factory: OptimizationProblemFactory, + vararg symbols: Symbol, + configuration: F.() -> Unit, +): OptimizationResult { + require(symbols.isNotEmpty()) { "Must provide a list of symbols for optimization" } + val problem = factory(symbols.toList(), configuration) + problem.expression(this) + return problem.optimize() +} + +/** + * Optimize differentiable expression using specific [OptimizationProblemFactory] + */ +public fun > DifferentiableExpression>.optimizeWith( + factory: OptimizationProblemFactory, + vararg symbols: Symbol, + configuration: F.() -> Unit, +): OptimizationResult { + require(symbols.isNotEmpty()) { "Must provide a list of symbols for optimization" } + val problem = factory(symbols.toList(), configuration) + problem.diffExpression(this) + return problem.optimize() +} diff --git a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/Optimization.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/Optimization.kt new file mode 100644 index 000000000..370274b41 --- /dev/null +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/Optimization.kt @@ -0,0 +1,44 @@ +package space.kscience.kmath.optimization + +import space.kscience.kmath.expressions.Symbol + +public interface OptimizationFeature + +public class OptimizationResult( + public val point: Map, + public val value: T, + public val features: Set = emptySet(), +) { + override fun toString(): String { + return "OptimizationResult(point=$point, value=$value)" + } +} + +public operator fun OptimizationResult.plus( + feature: OptimizationFeature, +): OptimizationResult = OptimizationResult(point, value, features + feature) + +/** + * An optimization problem builder over [T] variables + */ +public interface Optimization { + + /** + * Update the problem from previous optimization run + */ + public fun update(result: OptimizationResult) + + /** + * Make an optimization run + */ + public fun optimize(): OptimizationResult +} + +public fun interface OptimizationProblemFactory> { + public fun build(symbols: List): P +} + +public operator fun > OptimizationProblemFactory.invoke( + symbols: List, + block: P.() -> Unit, +): P = build(symbols).apply(block) diff --git a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Fitting.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Fitting.kt deleted file mode 100644 index b006c8ba2..000000000 --- a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Fitting.kt +++ /dev/null @@ -1,63 +0,0 @@ -package space.kscience.kmath.stat - -import space.kscience.kmath.expressions.* -import space.kscience.kmath.operations.ExtendedField -import space.kscience.kmath.structures.Buffer -import space.kscience.kmath.structures.indices -import kotlin.math.pow - -public object Fitting { - - /** - * Generate a chi squared expression from given x-y-sigma data and inline model. Provides automatic differentiation - */ - public fun chiSquared( - autoDiff: AutoDiffProcessor>, - x: Buffer, - y: Buffer, - yErr: Buffer, - model: A.(I) -> I, - ): DifferentiableExpression> where A : ExtendedField, A : ExpressionAlgebra { - require(x.size == y.size) { "X and y buffers should be of the same size" } - require(y.size == yErr.size) { "Y and yErr buffer should of the same size" } - - return autoDiff.process { - var sum = zero - - x.indices.forEach { - val xValue = const(x[it]) - val yValue = const(y[it]) - val yErrValue = const(yErr[it]) - val modelValue = model(xValue) - sum += ((yValue - modelValue) / yErrValue).pow(2) - } - - sum - } - } - - /** - * Generate a chi squared expression from given x-y-sigma model represented by an expression. Does not provide derivatives - */ - public fun chiSquared( - x: Buffer, - y: Buffer, - yErr: Buffer, - model: Expression, - xSymbol: Symbol = StringSymbol("x"), - ): Expression { - require(x.size == y.size) { "X and y buffers should be of the same size" } - require(y.size == yErr.size) { "Y and yErr buffer should of the same size" } - - return Expression { arguments -> - x.indices.sumByDouble { - val xValue = x[it] - val yValue = y[it] - val yErrValue = yErr[it] - val modifiedArgs = arguments + (xSymbol to xValue) - val modelValue = model(modifiedArgs) - ((yValue - modelValue) / yErrValue).pow(2) - } - } - } -} diff --git a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/OptimizationProblem.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/OptimizationProblem.kt deleted file mode 100644 index ffa24fa98..000000000 --- a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/OptimizationProblem.kt +++ /dev/null @@ -1,88 +0,0 @@ -package space.kscience.kmath.stat - -import space.kscience.kmath.expressions.DifferentiableExpression -import space.kscience.kmath.expressions.Expression -import space.kscience.kmath.expressions.Symbol - -public interface OptimizationFeature - -public class OptimizationResult( - public val point: Map, - public val value: T, - public val features: Set = emptySet(), -) { - override fun toString(): String { - return "OptimizationResult(point=$point, value=$value)" - } -} - -public operator fun OptimizationResult.plus( - feature: OptimizationFeature, -): OptimizationResult = OptimizationResult(point, value, features + feature) - -/** - * A configuration builder for optimization problem - */ -public interface OptimizationProblem { - /** - * Define the initial guess for the optimization problem - */ - public fun initialGuess(map: Map) - - /** - * Set an objective function expression - */ - public fun expression(expression: Expression) - - /** - * Set a differentiable expression as objective function as function and gradient provider - */ - public fun diffExpression(expression: DifferentiableExpression>) - - /** - * Update the problem from previous optimization run - */ - public fun update(result: OptimizationResult) - - /** - * Make an optimization run - */ - public fun optimize(): OptimizationResult -} - -public fun interface OptimizationProblemFactory> { - public fun build(symbols: List): P -} - -public operator fun > OptimizationProblemFactory.invoke( - symbols: List, - block: P.() -> Unit, -): P = build(symbols).apply(block) - -/** - * Optimize expression without derivatives using specific [OptimizationProblemFactory] - */ -public fun > Expression.optimizeWith( - factory: OptimizationProblemFactory, - vararg symbols: Symbol, - configuration: F.() -> Unit, -): OptimizationResult { - require(symbols.isNotEmpty()) { "Must provide a list of symbols for optimization" } - val problem = factory(symbols.toList(), configuration) - problem.expression(this) - return problem.optimize() -} - -/** - * Optimize differentiable expression using specific [OptimizationProblemFactory] - */ -public fun > DifferentiableExpression>.optimizeWith( - factory: OptimizationProblemFactory, - vararg symbols: Symbol, - configuration: F.() -> Unit, -): OptimizationResult { - require(symbols.isNotEmpty()) { "Must provide a list of symbols for optimization" } - val problem = factory(symbols.toList(), configuration) - problem.diffExpression(this) - return problem.optimize() -} diff --git a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/RandomChain.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/RandomChain.kt index 6e1f36c8a..978094ffd 100644 --- a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/RandomChain.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/RandomChain.kt @@ -14,4 +14,4 @@ public class RandomChain( override fun fork(): Chain = RandomChain(generator.fork(), gen) } -public fun RandomGenerator.chain(gen: suspend RandomGenerator.() -> R): RandomChain = RandomChain(this, gen) +public fun RandomGenerator.chain(gen: suspend RandomGenerator.() -> R): RandomChain = RandomChain(this, gen) \ No newline at end of file diff --git a/kmath-stat/src/jvmMain/kotlin/space/kscience/kmath/stat/distributions.kt b/kmath-stat/src/jvmMain/kotlin/space/kscience/kmath/stat/distributions.kt index 8b5551a16..c3d711789 100644 --- a/kmath-stat/src/jvmMain/kotlin/space/kscience/kmath/stat/distributions.kt +++ b/kmath-stat/src/jvmMain/kotlin/space/kscience/kmath/stat/distributions.kt @@ -80,19 +80,20 @@ public fun Distribution.Companion.normal( override fun probability(arg: Double): Double = exp(-(arg - mean).pow(2) / 2 / sigma2) / norm } -public fun Distribution.Companion.poisson(lambda: Double): DiscreteSamplerDistribution = - object : DiscreteSamplerDistribution() { - private val computedProb: MutableMap = hashMapOf(0 to exp(-lambda)) +public fun Distribution.Companion.poisson( + lambda: Double, +): DiscreteSamplerDistribution = object : DiscreteSamplerDistribution() { + private val computedProb: HashMap = hashMapOf(0 to exp(-lambda)) - override fun buildSampler(generator: RandomGenerator): DiscreteSampler = - PoissonSampler.of(generator.asUniformRandomProvider(), lambda) + override fun buildSampler(generator: RandomGenerator): DiscreteSampler = + PoissonSampler.of(generator.asUniformRandomProvider(), lambda) - override fun probability(arg: Int): Double { - require(arg >= 0) { "The argument must be >= 0" } + override fun probability(arg: Int): Double { + require(arg >= 0) { "The argument must be >= 0" } - return if (arg > 40) - exp(-(arg - lambda).pow(2) / 2 / lambda) / sqrt(2 * PI * lambda) - else - computedProb.getOrPut(arg) { probability(arg - 1) * lambda / arg } - } + return if (arg > 40) + exp(-(arg - lambda).pow(2) / 2 / lambda) / sqrt(2 * PI * lambda) + else + computedProb.getOrPut(arg) { probability(arg - 1) * lambda / arg } } +} From aeceb4a3371576565581c2f0b7a181a320c8894b Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Fri, 19 Mar 2021 14:53:14 +0300 Subject: [PATCH 146/150] Move dataset to core --- CHANGELOG.md | 1 + .../ExpressionsInterpretersBenchmark.kt | 2 +- .../kscience/kmath/ast/kotlingradSupport.kt | 2 +- .../kmath/commons/fit/fitWithAutoDiff.kt | 2 +- .../space/kscience/kmath/ast/MstExpression.kt | 2 + .../kmath/estree/internal/ESTreeBuilder.kt | 2 +- .../kmath/asm/internal/mapIntrinsics.kt | 4 +- .../DerivativeStructureExpression.kt | 2 + .../commons/optimization/CMOptimization.kt | 8 +- .../kmath/commons/optimization/cmFit.kt | 2 +- .../DerivativeStructureExpressionTest.kt | 6 +- .../commons/optimization/OptimizeTest.kt | 2 +- .../complex/ExpressionFieldForComplexTest.kt | 2 +- kmath-core/api/kmath-core.api | 155 ++++++++---------- .../expressions/DifferentiableExpression.kt | 3 + .../kscience/kmath/expressions/Expression.kt | 26 +-- .../FunctionalExpressionAlgebra.kt | 1 + .../kmath/expressions/SimpleAutoDiff.kt | 1 + .../kmath/expressions/SymbolIndexer.kt | 6 + .../space/kscience/kmath/misc/ColumnarData.kt | 15 ++ .../space/kscience/kmath/misc/Symbol.kt | 34 ++++ .../space/kscience/kmath/misc}/XYPointSet.kt | 39 +++-- .../kscience/kmath/operations/Algebra.kt | 2 +- .../kmath/structures/bufferOperation.kt | 9 + .../kmath/expressions/ExpressionFieldTest.kt | 1 + .../kmath/expressions/SimpleAutoDiffTest.kt | 2 + .../space/kscience/kmath/real/RealVector.kt | 14 +- .../kotlin/space/kscience/kmath/real/grids.kt | 12 +- .../kotlin/kaceince/kmath/real/GridTest.kt | 5 + .../kmath/interpolation/Interpolator.kt | 15 +- .../kmath/interpolation/LinearInterpolator.kt | 11 +- .../kmath/interpolation/SplineInterpolator.kt | 5 +- .../kotlingrad/DifferentiableMstExpression.kt | 2 +- .../kscience/kmath/optimization/DataFit.kt | 4 +- .../optimization/FunctionOptimization.kt | 7 +- .../kmath/optimization/Optimization.kt | 2 +- 36 files changed, 246 insertions(+), 162 deletions(-) create mode 100644 kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/ColumnarData.kt create mode 100644 kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/Symbol.kt rename {kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation => kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc}/XYPointSet.kt (57%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b4dddf81..4ade9cd9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Buffer factories for primitives moved to MutableBuffer.Companion - NDStructure and NDAlgebra to StructureND and AlgebraND respectively - Real -> Double +- DataSets are moved from functions to core ### Deprecated diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt index 0899241f9..2438e3979 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt @@ -9,7 +9,7 @@ import space.kscience.kmath.ast.mstInField import space.kscience.kmath.expressions.Expression import space.kscience.kmath.expressions.expressionInField import space.kscience.kmath.expressions.invoke -import space.kscience.kmath.expressions.symbol +import space.kscience.kmath.misc.symbol import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.operations.bindSymbol import kotlin.random.Random diff --git a/examples/src/main/kotlin/space/kscience/kmath/ast/kotlingradSupport.kt b/examples/src/main/kotlin/space/kscience/kmath/ast/kotlingradSupport.kt index 23c9d5b41..138b3e708 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/ast/kotlingradSupport.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/ast/kotlingradSupport.kt @@ -3,8 +3,8 @@ package space.kscience.kmath.ast import space.kscience.kmath.asm.compile import space.kscience.kmath.expressions.derivative import space.kscience.kmath.expressions.invoke -import space.kscience.kmath.expressions.symbol import space.kscience.kmath.kotlingrad.differentiable +import space.kscience.kmath.misc.symbol import space.kscience.kmath.operations.DoubleField /** diff --git a/examples/src/main/kotlin/space/kscience/kmath/commons/fit/fitWithAutoDiff.kt b/examples/src/main/kotlin/space/kscience/kmath/commons/fit/fitWithAutoDiff.kt index 6141a1058..ca4d9c181 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/commons/fit/fitWithAutoDiff.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/commons/fit/fitWithAutoDiff.kt @@ -7,7 +7,7 @@ import kscience.plotly.models.ScatterMode import kscience.plotly.models.TraceValues import space.kscience.kmath.commons.optimization.chiSquared import space.kscience.kmath.commons.optimization.minimize -import space.kscience.kmath.expressions.symbol +import space.kscience.kmath.misc.symbol import space.kscience.kmath.optimization.FunctionOptimization import space.kscience.kmath.optimization.OptimizationResult import space.kscience.kmath.real.DoubleVector diff --git a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstExpression.kt b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstExpression.kt index 63dfb38f7..5c43df068 100644 --- a/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstExpression.kt +++ b/kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstExpression.kt @@ -1,6 +1,8 @@ package space.kscience.kmath.ast import space.kscience.kmath.expressions.* +import space.kscience.kmath.misc.StringSymbol +import space.kscience.kmath.misc.Symbol import space.kscience.kmath.operations.* import kotlin.contracts.InvocationKind import kotlin.contracts.contract diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/ESTreeBuilder.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/ESTreeBuilder.kt index b4de9968d..1e966d986 100644 --- a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/ESTreeBuilder.kt +++ b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/internal/ESTreeBuilder.kt @@ -3,7 +3,7 @@ package space.kscience.kmath.estree.internal import space.kscience.kmath.estree.internal.astring.generate import space.kscience.kmath.estree.internal.estree.* import space.kscience.kmath.expressions.Expression -import space.kscience.kmath.expressions.Symbol +import space.kscience.kmath.misc.Symbol internal class ESTreeBuilder(val bodyCallback: ESTreeBuilder.() -> BaseExpression) { private class GeneratedExpression(val executable: dynamic, val constants: Array) : Expression { diff --git a/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/mapIntrinsics.kt b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/mapIntrinsics.kt index f54bc070c..0a0c21d8a 100644 --- a/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/mapIntrinsics.kt +++ b/kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/internal/mapIntrinsics.kt @@ -2,8 +2,8 @@ package space.kscience.kmath.asm.internal -import space.kscience.kmath.expressions.StringSymbol -import space.kscience.kmath.expressions.Symbol +import space.kscience.kmath.misc.StringSymbol +import space.kscience.kmath.misc.Symbol /** * Gets value with given [key] or throws [NoSuchElementException] whenever it is not present. diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpression.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpression.kt index b74167c3f..58e9687e5 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpression.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpression.kt @@ -2,6 +2,8 @@ package space.kscience.kmath.commons.expressions import org.apache.commons.math3.analysis.differentiation.DerivativeStructure import space.kscience.kmath.expressions.* +import space.kscience.kmath.misc.StringSymbol +import space.kscience.kmath.misc.Symbol import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.operations.ExtendedField import space.kscience.kmath.operations.NumbersAddOperations diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/CMOptimization.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/CMOptimization.kt index 6200b61a9..93d0f0bba 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/CMOptimization.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/CMOptimization.kt @@ -9,7 +9,12 @@ import org.apache.commons.math3.optim.nonlinear.scalar.gradient.NonLinearConjuga import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.AbstractSimplex import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.NelderMeadSimplex import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.SimplexOptimizer -import space.kscience.kmath.expressions.* +import space.kscience.kmath.expressions.DifferentiableExpression +import space.kscience.kmath.expressions.Expression +import space.kscience.kmath.expressions.SymbolIndexer +import space.kscience.kmath.expressions.derivative +import space.kscience.kmath.misc.Symbol +import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.optimization.FunctionOptimization import space.kscience.kmath.optimization.OptimizationFeature import space.kscience.kmath.optimization.OptimizationProblemFactory @@ -19,6 +24,7 @@ import kotlin.reflect.KClass public operator fun PointValuePair.component1(): DoubleArray = point public operator fun PointValuePair.component2(): Double = value +@OptIn(UnstableKMathAPI::class) public class CMOptimization( override val symbols: List, ) : FunctionOptimization, SymbolIndexer, OptimizationFeature { diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/cmFit.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/cmFit.kt index 384414e6d..8e9ce7a80 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/cmFit.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/cmFit.kt @@ -5,7 +5,7 @@ import org.apache.commons.math3.optim.nonlinear.scalar.GoalType import space.kscience.kmath.commons.expressions.DerivativeStructureField import space.kscience.kmath.expressions.DifferentiableExpression import space.kscience.kmath.expressions.Expression -import space.kscience.kmath.expressions.Symbol +import space.kscience.kmath.misc.Symbol import space.kscience.kmath.optimization.FunctionOptimization import space.kscience.kmath.optimization.OptimizationResult import space.kscience.kmath.optimization.optimizeWith diff --git a/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpressionTest.kt b/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpressionTest.kt index 8d9bab652..b19eb5950 100644 --- a/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpressionTest.kt +++ b/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/expressions/DerivativeStructureExpressionTest.kt @@ -1,6 +1,10 @@ package space.kscience.kmath.commons.expressions -import space.kscience.kmath.expressions.* +import space.kscience.kmath.expressions.binding +import space.kscience.kmath.expressions.derivative +import space.kscience.kmath.expressions.invoke +import space.kscience.kmath.misc.Symbol +import space.kscience.kmath.misc.symbol import kotlin.contracts.InvocationKind import kotlin.contracts.contract import kotlin.test.Test diff --git a/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/optimization/OptimizeTest.kt b/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/optimization/OptimizeTest.kt index cbbe1457e..5f5d3e1e4 100644 --- a/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/optimization/OptimizeTest.kt +++ b/kmath-commons/src/test/kotlin/space/kscience/kmath/commons/optimization/OptimizeTest.kt @@ -2,7 +2,7 @@ package space.kscience.kmath.commons.optimization import org.junit.jupiter.api.Test import space.kscience.kmath.commons.expressions.DerivativeStructureExpression -import space.kscience.kmath.expressions.symbol +import space.kscience.kmath.misc.symbol import space.kscience.kmath.optimization.FunctionOptimization import space.kscience.kmath.stat.Distribution import space.kscience.kmath.stat.RandomGenerator diff --git a/kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/ExpressionFieldForComplexTest.kt b/kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/ExpressionFieldForComplexTest.kt index 81a131318..3837b0d40 100644 --- a/kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/ExpressionFieldForComplexTest.kt +++ b/kmath-complex/src/commonTest/kotlin/space/kscience/kmath/complex/ExpressionFieldForComplexTest.kt @@ -3,7 +3,7 @@ package space.kscience.kmath.complex import space.kscience.kmath.expressions.FunctionalExpressionField import space.kscience.kmath.expressions.bindSymbol import space.kscience.kmath.expressions.invoke -import space.kscience.kmath.expressions.symbol +import space.kscience.kmath.misc.symbol import kotlin.test.Test import kotlin.test.assertEquals diff --git a/kmath-core/api/kmath-core.api b/kmath-core/api/kmath-core.api index 8c62198cd..570e50a86 100644 --- a/kmath-core/api/kmath-core.api +++ b/kmath-core/api/kmath-core.api @@ -14,7 +14,7 @@ public class space/kscience/kmath/expressions/AutoDiffValue { public final class space/kscience/kmath/expressions/DerivationResult { public fun (Ljava/lang/Object;Ljava/util/Map;Lspace/kscience/kmath/operations/Field;)V - public final fun derivative (Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public final fun derivative (Lspace/kscience/kmath/misc/Symbol;)Ljava/lang/Object; public final fun div ()Ljava/lang/Object; public final fun getContext ()Lspace/kscience/kmath/operations/Field; public final fun getValue ()Ljava/lang/Object; @@ -27,7 +27,7 @@ public abstract interface class space/kscience/kmath/expressions/DifferentiableE public final class space/kscience/kmath/expressions/DifferentiableExpressionKt { public static final fun derivative (Lspace/kscience/kmath/expressions/DifferentiableExpression;Ljava/lang/String;)Lspace/kscience/kmath/expressions/Expression; public static final fun derivative (Lspace/kscience/kmath/expressions/DifferentiableExpression;Ljava/util/List;)Lspace/kscience/kmath/expressions/Expression; - public static final fun derivative (Lspace/kscience/kmath/expressions/DifferentiableExpression;[Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/expressions/Expression; + public static final fun derivative (Lspace/kscience/kmath/expressions/DifferentiableExpression;[Lspace/kscience/kmath/misc/Symbol;)Lspace/kscience/kmath/expressions/Expression; } public abstract interface class space/kscience/kmath/expressions/Expression { @@ -36,7 +36,7 @@ public abstract interface class space/kscience/kmath/expressions/Expression { public abstract interface class space/kscience/kmath/expressions/ExpressionAlgebra : space/kscience/kmath/operations/Algebra { public abstract fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; - public abstract fun bindSymbolOrNull (Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public abstract fun bindSymbolOrNull (Lspace/kscience/kmath/misc/Symbol;)Ljava/lang/Object; public abstract fun const (Ljava/lang/Object;)Ljava/lang/Object; } @@ -56,18 +56,17 @@ public final class space/kscience/kmath/expressions/ExpressionBuildersKt { } public final class space/kscience/kmath/expressions/ExpressionKt { - public static final fun bindSymbol (Lspace/kscience/kmath/expressions/ExpressionAlgebra;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static final fun bindSymbol (Lspace/kscience/kmath/expressions/ExpressionAlgebra;Lspace/kscience/kmath/misc/Symbol;)Ljava/lang/Object; public static final fun binding (Lspace/kscience/kmath/expressions/ExpressionAlgebra;)Lkotlin/properties/ReadOnlyProperty; public static final fun callByString (Lspace/kscience/kmath/expressions/Expression;[Lkotlin/Pair;)Ljava/lang/Object; public static final fun callBySymbol (Lspace/kscience/kmath/expressions/Expression;[Lkotlin/Pair;)Ljava/lang/Object; - public static final fun getSymbol ()Lkotlin/properties/ReadOnlyProperty; public static final fun invoke (Lspace/kscience/kmath/expressions/Expression;)Ljava/lang/Object; } public abstract class space/kscience/kmath/expressions/FirstDerivativeExpression : space/kscience/kmath/expressions/DifferentiableExpression { public fun ()V public final fun derivativeOrNull (Ljava/util/List;)Lspace/kscience/kmath/expressions/Expression; - public abstract fun derivativeOrNull (Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/expressions/Expression; + public abstract fun derivativeOrNull (Lspace/kscience/kmath/misc/Symbol;)Lspace/kscience/kmath/expressions/Expression; } public abstract class space/kscience/kmath/expressions/FunctionalExpressionAlgebra : space/kscience/kmath/expressions/ExpressionAlgebra { @@ -77,8 +76,8 @@ public abstract class space/kscience/kmath/expressions/FunctionalExpressionAlgeb public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/expressions/Expression; - public synthetic fun bindSymbolOrNull (Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public fun bindSymbolOrNull (Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/expressions/Expression; + public synthetic fun bindSymbolOrNull (Lspace/kscience/kmath/misc/Symbol;)Ljava/lang/Object; + public fun bindSymbolOrNull (Lspace/kscience/kmath/misc/Symbol;)Lspace/kscience/kmath/expressions/Expression; public synthetic fun const (Ljava/lang/Object;)Ljava/lang/Object; public fun const (Ljava/lang/Object;)Lspace/kscience/kmath/expressions/Expression; public final fun getAlgebra ()Lspace/kscience/kmath/operations/Algebra; @@ -203,7 +202,7 @@ public class space/kscience/kmath/expressions/FunctionalExpressionRing : space/k public final class space/kscience/kmath/expressions/SimpleAutoDiffExpression : space/kscience/kmath/expressions/FirstDerivativeExpression { public fun (Lspace/kscience/kmath/operations/Field;Lkotlin/jvm/functions/Function1;)V - public fun derivativeOrNull (Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/expressions/Expression; + public fun derivativeOrNull (Lspace/kscience/kmath/misc/Symbol;)Lspace/kscience/kmath/expressions/Expression; public final fun getField ()Lspace/kscience/kmath/operations/Field; public final fun getFunction ()Lkotlin/jvm/functions/Function1; public fun invoke (Ljava/util/Map;)Ljava/lang/Object; @@ -264,8 +263,8 @@ public class space/kscience/kmath/expressions/SimpleAutoDiffField : space/kscien public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2; public synthetic fun bindSymbol (Ljava/lang/String;)Ljava/lang/Object; public fun bindSymbol (Ljava/lang/String;)Lspace/kscience/kmath/expressions/AutoDiffValue; - public synthetic fun bindSymbolOrNull (Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public fun bindSymbolOrNull (Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/expressions/AutoDiffValue; + public synthetic fun bindSymbolOrNull (Lspace/kscience/kmath/misc/Symbol;)Ljava/lang/Object; + public fun bindSymbolOrNull (Lspace/kscience/kmath/misc/Symbol;)Lspace/kscience/kmath/expressions/AutoDiffValue; public synthetic fun const (Ljava/lang/Object;)Ljava/lang/Object; public fun const (Ljava/lang/Object;)Lspace/kscience/kmath/expressions/AutoDiffValue; public final fun const (Lkotlin/jvm/functions/Function1;)Lspace/kscience/kmath/expressions/AutoDiffValue; @@ -332,7 +331,7 @@ public final class space/kscience/kmath/expressions/SimpleAutoDiffKt { public static final fun cos (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public static final fun cosh (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public static final fun exp (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; - public static final fun grad (Lspace/kscience/kmath/expressions/DerivationResult;[Lspace/kscience/kmath/expressions/Symbol;)Lspace/kscience/kmath/structures/Buffer; + public static final fun grad (Lspace/kscience/kmath/expressions/DerivationResult;[Lspace/kscience/kmath/misc/Symbol;)Lspace/kscience/kmath/structures/Buffer; public static final fun ln (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; public static final fun pow (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;D)Lspace/kscience/kmath/expressions/AutoDiffValue; public static final fun pow (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;I)Lspace/kscience/kmath/expressions/AutoDiffValue; @@ -348,79 +347,13 @@ public final class space/kscience/kmath/expressions/SimpleAutoDiffKt { public static final fun tanh (Lspace/kscience/kmath/expressions/SimpleAutoDiffField;Lspace/kscience/kmath/expressions/AutoDiffValue;)Lspace/kscience/kmath/expressions/AutoDiffValue; } -public final class space/kscience/kmath/expressions/SimpleSymbolIndexer : space/kscience/kmath/expressions/SymbolIndexer { - public static final synthetic fun box-impl (Ljava/util/List;)Lspace/kscience/kmath/expressions/SimpleSymbolIndexer; - public static fun constructor-impl (Ljava/util/List;)Ljava/util/List; - public fun equals (Ljava/lang/Object;)Z - public static fun equals-impl (Ljava/util/List;Ljava/lang/Object;)Z - public static final fun equals-impl0 (Ljava/util/List;Ljava/util/List;)Z - public fun get (Ljava/util/List;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public fun get (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/expressions/Symbol;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public fun get (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public fun get ([DLspace/kscience/kmath/expressions/Symbol;)D - public fun get ([Ljava/lang/Object;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get-impl (Ljava/util/List;Ljava/util/List;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get-impl (Ljava/util/List;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/expressions/Symbol;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get-impl (Ljava/util/List;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get-impl (Ljava/util/List;[DLspace/kscience/kmath/expressions/Symbol;)D - public static fun get-impl (Ljava/util/List;[Ljava/lang/Object;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public fun getSymbols ()Ljava/util/List; - public fun hashCode ()I - public static fun hashCode-impl (Ljava/util/List;)I - public fun indexOf (Lspace/kscience/kmath/expressions/Symbol;)I - public static fun indexOf-impl (Ljava/util/List;Lspace/kscience/kmath/expressions/Symbol;)I - public fun toDoubleArray (Ljava/util/Map;)[D - public static fun toDoubleArray-impl (Ljava/util/List;Ljava/util/Map;)[D - public fun toList (Ljava/util/Map;)Ljava/util/List; - public static fun toList-impl (Ljava/util/List;Ljava/util/Map;)Ljava/util/List; - public fun toMap ([D)Ljava/util/Map; - public static fun toMap-impl (Ljava/util/List;[D)Ljava/util/Map; - public fun toPoint (Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; - public static fun toPoint-impl (Ljava/util/List;Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; - public fun toString ()Ljava/lang/String; - public static fun toString-impl (Ljava/util/List;)Ljava/lang/String; - public final synthetic fun unbox-impl ()Ljava/util/List; -} - -public final class space/kscience/kmath/expressions/StringSymbol : space/kscience/kmath/expressions/Symbol { - public static final synthetic fun box-impl (Ljava/lang/String;)Lspace/kscience/kmath/expressions/StringSymbol; - public static fun constructor-impl (Ljava/lang/String;)Ljava/lang/String; - public fun equals (Ljava/lang/Object;)Z - public static fun equals-impl (Ljava/lang/String;Ljava/lang/Object;)Z - public static final fun equals-impl0 (Ljava/lang/String;Ljava/lang/String;)Z - public fun getIdentity ()Ljava/lang/String; - public fun hashCode ()I - public static fun hashCode-impl (Ljava/lang/String;)I - public fun toString ()Ljava/lang/String; - public static fun toString-impl (Ljava/lang/String;)Ljava/lang/String; - public final synthetic fun unbox-impl ()Ljava/lang/String; -} - -public abstract interface class space/kscience/kmath/expressions/Symbol { - public abstract fun getIdentity ()Ljava/lang/String; -} - -public abstract interface class space/kscience/kmath/expressions/SymbolIndexer { - public abstract fun get (Ljava/util/List;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public abstract fun get (Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/expressions/Symbol;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public abstract fun get (Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public abstract fun get ([DLspace/kscience/kmath/expressions/Symbol;)D - public abstract fun get ([Ljava/lang/Object;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public abstract fun getSymbols ()Ljava/util/List; - public abstract fun indexOf (Lspace/kscience/kmath/expressions/Symbol;)I - public abstract fun toDoubleArray (Ljava/util/Map;)[D - public abstract fun toList (Ljava/util/Map;)Ljava/util/List; - public abstract fun toMap ([D)Ljava/util/Map; - public abstract fun toPoint (Ljava/util/Map;Lkotlin/jvm/functions/Function2;)Lspace/kscience/kmath/structures/Buffer; -} - public final class space/kscience/kmath/expressions/SymbolIndexer$DefaultImpls { - public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;Ljava/util/List;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/expressions/Symbol;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;[DLspace/kscience/kmath/expressions/Symbol;)D - public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;[Ljava/lang/Object;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; - public static fun indexOf (Lspace/kscience/kmath/expressions/SymbolIndexer;Lspace/kscience/kmath/expressions/Symbol;)I + public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;Ljava/util/List;Lspace/kscience/kmath/misc/Symbol;)Ljava/lang/Object; + public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;Lspace/kscience/kmath/nd/Structure2D;Lspace/kscience/kmath/misc/Symbol;Lspace/kscience/kmath/misc/Symbol;)Ljava/lang/Object; + public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;Lspace/kscience/kmath/structures/Buffer;Lspace/kscience/kmath/misc/Symbol;)Ljava/lang/Object; + public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;[DLspace/kscience/kmath/misc/Symbol;)D + public static fun get (Lspace/kscience/kmath/expressions/SymbolIndexer;[Ljava/lang/Object;Lspace/kscience/kmath/misc/Symbol;)Ljava/lang/Object; + public static fun indexOf (Lspace/kscience/kmath/expressions/SymbolIndexer;Lspace/kscience/kmath/misc/Symbol;)I public static fun toDoubleArray (Lspace/kscience/kmath/expressions/SymbolIndexer;Ljava/util/Map;)[D public static fun toList (Lspace/kscience/kmath/expressions/SymbolIndexer;Ljava/util/Map;)Ljava/util/List; public static fun toMap (Lspace/kscience/kmath/expressions/SymbolIndexer;[D)Ljava/util/Map; @@ -428,8 +361,6 @@ public final class space/kscience/kmath/expressions/SymbolIndexer$DefaultImpls { } public final class space/kscience/kmath/expressions/SymbolIndexerKt { - public static final fun withSymbols (Ljava/util/Collection;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun withSymbols ([Lspace/kscience/kmath/expressions/Symbol;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; } public final class space/kscience/kmath/linear/BufferedLinearSpace : space/kscience/kmath/linear/LinearSpace { @@ -672,9 +603,58 @@ public final class space/kscience/kmath/misc/CumulativeKt { public static final fun cumulativeSumOfLong (Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence; } +public final class space/kscience/kmath/misc/NDStructureColumn : space/kscience/kmath/structures/Buffer { + public fun (Lspace/kscience/kmath/nd/Structure2D;I)V + public fun get (I)Ljava/lang/Object; + public final fun getColumn ()I + public fun getSize ()I + public final fun getStructure ()Lspace/kscience/kmath/nd/Structure2D; + public fun iterator ()Ljava/util/Iterator; +} + +public final class space/kscience/kmath/misc/StringSymbol : space/kscience/kmath/misc/Symbol { + public static final synthetic fun box-impl (Ljava/lang/String;)Lspace/kscience/kmath/misc/StringSymbol; + public static fun constructor-impl (Ljava/lang/String;)Ljava/lang/String; + public fun equals (Ljava/lang/Object;)Z + public static fun equals-impl (Ljava/lang/String;Ljava/lang/Object;)Z + public static final fun equals-impl0 (Ljava/lang/String;Ljava/lang/String;)Z + public fun getIdentity ()Ljava/lang/String; + public fun hashCode ()I + public static fun hashCode-impl (Ljava/lang/String;)I + public fun toString ()Ljava/lang/String; + public static fun toString-impl (Ljava/lang/String;)Ljava/lang/String; + public final synthetic fun unbox-impl ()Ljava/lang/String; +} + +public abstract interface class space/kscience/kmath/misc/Symbol { + public static final field Companion Lspace/kscience/kmath/misc/Symbol$Companion; + public abstract fun getIdentity ()Ljava/lang/String; +} + +public final class space/kscience/kmath/misc/Symbol$Companion { + public final fun getX-tWtZOCg ()Ljava/lang/String; + public final fun getY-tWtZOCg ()Ljava/lang/String; + public final fun getZ-tWtZOCg ()Ljava/lang/String; +} + +public final class space/kscience/kmath/misc/SymbolKt { + public static final fun getSymbol ()Lkotlin/properties/ReadOnlyProperty; +} + public abstract interface annotation class space/kscience/kmath/misc/UnstableKMathAPI : java/lang/annotation/Annotation { } +public final class space/kscience/kmath/misc/XYPointSet$DefaultImpls { + public static fun get (Lspace/kscience/kmath/misc/XYPointSet;Lspace/kscience/kmath/misc/Symbol;)Lspace/kscience/kmath/structures/Buffer; +} + +public final class space/kscience/kmath/misc/XYPointSetKt { +} + +public final class space/kscience/kmath/misc/XYZPointSet$DefaultImpls { + public static fun get (Lspace/kscience/kmath/misc/XYZPointSet;Lspace/kscience/kmath/misc/Symbol;)Lspace/kscience/kmath/structures/Buffer; +} + public abstract interface class space/kscience/kmath/nd/AlgebraND { public static final field Companion Lspace/kscience/kmath/nd/AlgebraND$Companion; public abstract fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND; @@ -1180,7 +1160,7 @@ public final class space/kscience/kmath/operations/AlgebraExtensionsKt { } public final class space/kscience/kmath/operations/AlgebraKt { - public static final fun bindSymbol (Lspace/kscience/kmath/operations/Algebra;Lspace/kscience/kmath/expressions/Symbol;)Ljava/lang/Object; + public static final fun bindSymbol (Lspace/kscience/kmath/operations/Algebra;Lspace/kscience/kmath/misc/Symbol;)Ljava/lang/Object; public static final fun invoke (Lspace/kscience/kmath/operations/Algebra;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; } @@ -2119,6 +2099,7 @@ public final class space/kscience/kmath/structures/BufferKt { public final class space/kscience/kmath/structures/BufferOperationKt { public static final fun asIterable (Lspace/kscience/kmath/structures/Buffer;)Ljava/lang/Iterable; public static final fun asSequence (Lspace/kscience/kmath/structures/Buffer;)Lkotlin/sequences/Sequence; + public static final fun fold (Lspace/kscience/kmath/structures/Buffer;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object; public static final fun toList (Lspace/kscience/kmath/structures/Buffer;)Ljava/util/List; } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/DifferentiableExpression.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/DifferentiableExpression.kt index 5cbc4dbf4..1f0ceaec3 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/DifferentiableExpression.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/DifferentiableExpression.kt @@ -1,5 +1,8 @@ package space.kscience.kmath.expressions +import space.kscience.kmath.misc.StringSymbol +import space.kscience.kmath.misc.Symbol + /** * Represents expression which structure can be differentiated. * diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/Expression.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/Expression.kt index 5ba24aa62..7918f199e 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/Expression.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/Expression.kt @@ -1,26 +1,11 @@ package space.kscience.kmath.expressions +import space.kscience.kmath.misc.StringSymbol +import space.kscience.kmath.misc.Symbol import space.kscience.kmath.operations.Algebra import kotlin.jvm.JvmName import kotlin.properties.ReadOnlyProperty -/** - * A marker interface for a symbol. A symbol mus have an identity - */ -public interface Symbol { - /** - * Identity object for the symbol. Two symbols with the same identity are considered to be the same symbol. - */ - public val identity: String -} - -/** - * A [Symbol] with a [String] identity - */ -public inline class StringSymbol(override val identity: String) : Symbol { - override fun toString(): String = identity -} - /** * An elementary function that could be invoked on a map of arguments. * @@ -92,13 +77,6 @@ public interface ExpressionAlgebra : Algebra { public fun ExpressionAlgebra.bindSymbol(symbol: Symbol): E = bindSymbolOrNull(symbol) ?: error("Symbol $symbol could not be bound to $this") -/** - * A delegate to create a symbol with a string identity in this scope - */ -public val symbol: ReadOnlyProperty = ReadOnlyProperty { _, property -> - StringSymbol(property.name) -} - /** * Bind a symbol by name inside the [ExpressionAlgebra] */ diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/FunctionalExpressionAlgebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/FunctionalExpressionAlgebra.kt index cca75754f..ebd9e7f22 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/FunctionalExpressionAlgebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/FunctionalExpressionAlgebra.kt @@ -1,5 +1,6 @@ package space.kscience.kmath.expressions +import space.kscience.kmath.misc.Symbol import space.kscience.kmath.operations.* /** diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SimpleAutoDiff.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SimpleAutoDiff.kt index 4b0d402ed..d9be4a92e 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SimpleAutoDiff.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SimpleAutoDiff.kt @@ -1,6 +1,7 @@ package space.kscience.kmath.expressions import space.kscience.kmath.linear.Point +import space.kscience.kmath.misc.Symbol import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.operations.* import space.kscience.kmath.structures.asBuffer diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SymbolIndexer.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SymbolIndexer.kt index 580acaafb..4db4b5828 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SymbolIndexer.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SymbolIndexer.kt @@ -1,6 +1,8 @@ package space.kscience.kmath.expressions import space.kscience.kmath.linear.Point +import space.kscience.kmath.misc.Symbol +import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.nd.Structure2D import space.kscience.kmath.structures.BufferFactory @@ -8,6 +10,7 @@ import space.kscience.kmath.structures.BufferFactory * An environment to easy transform indexed variables to symbols and back. * TODO requires multi-receivers to be beautiful */ +@UnstableKMathAPI public interface SymbolIndexer { public val symbols: List public fun indexOf(symbol: Symbol): Int = symbols.indexOf(symbol) @@ -49,13 +52,16 @@ public interface SymbolIndexer { public fun Map.toDoubleArray(): DoubleArray = DoubleArray(symbols.size) { getValue(symbols[it]) } } +@UnstableKMathAPI public inline class SimpleSymbolIndexer(override val symbols: List) : SymbolIndexer /** * Execute the block with symbol indexer based on given symbol order */ +@UnstableKMathAPI public inline fun withSymbols(vararg symbols: Symbol, block: SymbolIndexer.() -> R): R = with(SimpleSymbolIndexer(symbols.toList()), block) +@UnstableKMathAPI public inline fun withSymbols(symbols: Collection, block: SymbolIndexer.() -> R): R = with(SimpleSymbolIndexer(symbols.toList()), block) \ No newline at end of file diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/ColumnarData.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/ColumnarData.kt new file mode 100644 index 000000000..ed5a7e8f0 --- /dev/null +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/ColumnarData.kt @@ -0,0 +1,15 @@ +package space.kscience.kmath.misc + +import space.kscience.kmath.structures.Buffer + +/** + * A column-based data set with all columns of the same size (not necessary fixed in time). + * The column could be retrieved by a [get] operation. + */ +@UnstableKMathAPI +public interface ColumnarData { + public val size: Int + + public operator fun get(symbol: Symbol): Buffer +} + diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/Symbol.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/Symbol.kt new file mode 100644 index 000000000..2c9774b6a --- /dev/null +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/Symbol.kt @@ -0,0 +1,34 @@ +package space.kscience.kmath.misc + +import kotlin.properties.ReadOnlyProperty + +/** + * A marker interface for a symbol. A symbol mus have an identity + */ +public interface Symbol { + /** + * Identity object for the symbol. Two symbols with the same identity are considered to be the same symbol. + */ + public val identity: String + + public companion object{ + public val x: StringSymbol = StringSymbol("x") + public val y: StringSymbol = StringSymbol("y") + public val z: StringSymbol = StringSymbol("z") + } +} + +/** + * A [Symbol] with a [String] identity + */ +public inline class StringSymbol(override val identity: String) : Symbol { + override fun toString(): String = identity +} + + +/** + * A delegate to create a symbol with a string identity in this scope + */ +public val symbol: ReadOnlyProperty = ReadOnlyProperty { _, property -> + StringSymbol(property.name) +} diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/XYPointSet.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/XYPointSet.kt similarity index 57% rename from kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/XYPointSet.kt rename to kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/XYPointSet.kt index 1ff7b6351..bc9052348 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/XYPointSet.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/XYPointSet.kt @@ -1,22 +1,32 @@ -package space.kscience.kmath.interpolation +package space.kscience.kmath.misc import space.kscience.kmath.nd.Structure2D import space.kscience.kmath.structures.Buffer -public interface XYPointSet { - public val size: Int +@UnstableKMathAPI +public interface XYPointSet : ColumnarData { public val x: Buffer public val y: Buffer + + override fun get(symbol: Symbol): Buffer = when (symbol) { + Symbol.x -> x + Symbol.y -> y + else -> error("A column for symbol $symbol not found") + } } -public interface XYZPointSet : XYPointSet { +@UnstableKMathAPI +public interface XYZPointSet : XYPointSet { public val z: Buffer + + override fun get(symbol: Symbol): Buffer = when (symbol) { + Symbol.x -> x + Symbol.y -> y + Symbol.z -> z + else -> error("A column for symbol $symbol not found") + } } -internal fun > insureSorted(points: XYPointSet) { - for (i in 0 until points.size - 1) - require(points.x[i + 1] > points.x[i]) { "Input data is not sorted at index $i" } -} public class NDStructureColumn(public val structure: Structure2D, public val column: Int) : Buffer { public override val size: Int @@ -30,22 +40,23 @@ public class NDStructureColumn(public val structure: Structure2D, public v public override operator fun iterator(): Iterator = sequence { repeat(size) { yield(get(it)) } }.iterator() } -public class BufferXYPointSet( +@UnstableKMathAPI +public class BufferXYPointSet( public override val x: Buffer, public override val y: Buffer, -) : XYPointSet { - public override val size: Int - get() = x.size +) : XYPointSet { + public override val size: Int get() = x.size init { require(x.size == y.size) { "Sizes of x and y buffers should be the same" } } } -public fun Structure2D.asXYPointSet(): XYPointSet { +@UnstableKMathAPI +public fun Structure2D.asXYPointSet(): XYPointSet { require(shape[1] == 2) { "Structure second dimension should be of size 2" } - return object : XYPointSet { + return object : XYPointSet { override val size: Int get() = this@asXYPointSet.shape[0] override val x: Buffer get() = NDStructureColumn(this@asXYPointSet, 0) override val y: Buffer get() = NDStructureColumn(this@asXYPointSet, 1) diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt index 9f57bc4c1..04234205f 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt @@ -1,6 +1,6 @@ package space.kscience.kmath.operations -import space.kscience.kmath.expressions.Symbol +import space.kscience.kmath.misc.Symbol /** * Stub for DSL the [Algebra] is. diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/bufferOperation.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/bufferOperation.kt index 4355ba17f..5f8bbe21f 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/bufferOperation.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/bufferOperation.kt @@ -70,6 +70,15 @@ public inline fun Buffer.mapIndexed( crossinline block: (index: Int, value: T) -> R, ): Buffer = bufferFactory(size) { block(it, get(it)) } +/** + * Fold given buffer according to [operation] + */ +public inline fun Buffer.fold(initial: R, operation: (acc: R, T) -> R): R { + var accumulator = initial + for (index in this.indices) accumulator = operation(accumulator, get(index)) + return accumulator +} + /** * Zip two buffers using given [transform]. */ diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/ExpressionFieldTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/ExpressionFieldTest.kt index b1be0c392..61b1d03f0 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/ExpressionFieldTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/ExpressionFieldTest.kt @@ -1,5 +1,6 @@ package space.kscience.kmath.expressions +import space.kscience.kmath.misc.symbol import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.operations.invoke import kotlin.test.Test diff --git a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/SimpleAutoDiffTest.kt b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/SimpleAutoDiffTest.kt index ca7aca905..666db13d8 100644 --- a/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/SimpleAutoDiffTest.kt +++ b/kmath-core/src/commonTest/kotlin/space/kscience/kmath/expressions/SimpleAutoDiffTest.kt @@ -1,5 +1,7 @@ package space.kscience.kmath.expressions +import space.kscience.kmath.misc.Symbol +import space.kscience.kmath.misc.symbol import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.asBuffer diff --git a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealVector.kt b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealVector.kt index 433e3c756..6b059ef56 100644 --- a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealVector.kt +++ b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/RealVector.kt @@ -6,17 +6,13 @@ import space.kscience.kmath.operations.Norm import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.MutableBuffer.Companion.double import space.kscience.kmath.structures.asBuffer -import space.kscience.kmath.structures.asIterable +import space.kscience.kmath.structures.fold import space.kscience.kmath.structures.indices import kotlin.math.pow import kotlin.math.sqrt public typealias DoubleVector = Point -public object VectorL2Norm : Norm, Double> { - override fun norm(arg: Point): Double = sqrt(arg.asIterable().sumByDouble(Number::toDouble)) -} - @Suppress("FunctionName") public fun DoubleVector(vararg doubles: Double): DoubleVector = doubles.asBuffer() @@ -102,4 +98,10 @@ public fun DoubleVector.sum(): Double { res += get(i) } return res -} \ No newline at end of file +} + +public object VectorL2Norm : Norm { + override fun norm(arg: DoubleVector): Double = sqrt(arg.fold(0.0) { acc: Double, d: Double -> acc + d.pow(2) }) +} + +public val DoubleVector.norm: Double get() = VectorL2Norm.norm(this) \ No newline at end of file diff --git a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/grids.kt b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/grids.kt index 446a3d9cb..7f02c7db3 100644 --- a/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/grids.kt +++ b/kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/grids.kt @@ -11,7 +11,6 @@ public val ClosedFloatingPointRange.length: Double get() = endInclusive * Create a Buffer-based grid with equally distributed [numberOfPoints] points. The range could be increasing or decreasing. * If range has a zero size, then the buffer consisting of [numberOfPoints] equal values is returned. */ -@UnstableKMathAPI public fun Buffer.Companion.fromRange(range: ClosedFloatingPointRange, numberOfPoints: Int): DoubleBuffer { require(numberOfPoints >= 2) { "Number of points in grid must be more than 1" } val normalizedRange = when { @@ -20,23 +19,22 @@ public fun Buffer.Companion.fromRange(range: ClosedFloatingPointRange, n else -> return DoubleBuffer(numberOfPoints) { range.start } } val step = normalizedRange.length / (numberOfPoints - 1) - return DoubleBuffer(numberOfPoints) { normalizedRange.start + step * it / (numberOfPoints - 1) } + return DoubleBuffer(numberOfPoints) { normalizedRange.start + step * it } } /** * Create a Buffer-based grid with equally distributed points with a fixed [step]. The range could be increasing or decreasing. * If the step is larger than the range size, single point is returned. */ -@UnstableKMathAPI -public fun Buffer.Companion.fromRange(range: ClosedFloatingPointRange, step: Double): DoubleBuffer { +public fun Buffer.Companion.withFixedStep(range: ClosedFloatingPointRange, step: Double): DoubleBuffer { require(step > 0) { "The grid step must be positive" } val normalizedRange = when { range.endInclusive > range.start -> range range.endInclusive < range.start -> range.endInclusive..range.start else -> return DoubleBuffer(range.start) } - val numberOfPoints = floor(normalizedRange.length / step).toInt() - return DoubleBuffer(numberOfPoints) { normalizedRange.start + step * it / (numberOfPoints - 1) } + val numberOfPoints = floor(normalizedRange.length / step).toInt() + 1 + return DoubleBuffer(numberOfPoints) { normalizedRange.start + step * it } } /** @@ -48,4 +46,4 @@ public fun Buffer.Companion.fromRange(range: ClosedFloatingPointRange, s * If step is negative, the same goes from upper boundary downwards */ @UnstableKMathAPI -public infix fun ClosedFloatingPointRange.step(step: Double): DoubleBuffer = Buffer.fromRange(this, step) \ No newline at end of file +public infix fun ClosedFloatingPointRange.step(step: Double): DoubleBuffer = Buffer.withFixedStep(this, step) \ No newline at end of file diff --git a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/GridTest.kt b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/GridTest.kt index 5a644c8f9..91ee517ab 100644 --- a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/GridTest.kt +++ b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/GridTest.kt @@ -1,13 +1,18 @@ package kaceince.kmath.real +import space.kscience.kmath.real.DoubleVector +import space.kscience.kmath.real.minus +import space.kscience.kmath.real.norm import space.kscience.kmath.real.step import kotlin.test.Test import kotlin.test.assertEquals +import kotlin.test.assertTrue class GridTest { @Test fun testStepGrid() { val grid = 0.0..1.0 step 0.2 assertEquals(6, grid.size) + assertTrue { (grid - DoubleVector(0.0, 0.2, 0.4, 0.6, 0.8, 1.0)).norm < 1e-4 } } } \ No newline at end of file diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/Interpolator.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/Interpolator.kt index fa978a9bc..864431d7a 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/Interpolator.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/Interpolator.kt @@ -1,27 +1,32 @@ +@file:OptIn(UnstableKMathAPI::class) package space.kscience.kmath.interpolation import space.kscience.kmath.functions.PiecewisePolynomial import space.kscience.kmath.functions.value +import space.kscience.kmath.misc.BufferXYPointSet +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.misc.XYPointSet import space.kscience.kmath.operations.Ring import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.asBuffer -public fun interface Interpolator { - public fun interpolate(points: XYPointSet): (X) -> Y +public fun interface Interpolator { + public fun interpolate(points: XYPointSet): (X) -> Y } -public interface PolynomialInterpolator> : Interpolator { +public interface PolynomialInterpolator> : Interpolator { public val algebra: Ring public fun getDefaultValue(): T = error("Out of bounds") - public fun interpolatePolynomials(points: XYPointSet): PiecewisePolynomial + public fun interpolatePolynomials(points: XYPointSet): PiecewisePolynomial - override fun interpolate(points: XYPointSet): (T) -> T = { x -> + override fun interpolate(points: XYPointSet): (T) -> T = { x -> interpolatePolynomials(points).value(algebra, x) ?: getDefaultValue() } } + public fun > PolynomialInterpolator.interpolatePolynomials( x: Buffer, y: Buffer, diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/LinearInterpolator.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/LinearInterpolator.kt index c939384e3..89a242ece 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/LinearInterpolator.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/LinearInterpolator.kt @@ -3,14 +3,23 @@ package space.kscience.kmath.interpolation import space.kscience.kmath.functions.OrderedPiecewisePolynomial import space.kscience.kmath.functions.PiecewisePolynomial import space.kscience.kmath.functions.Polynomial +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.misc.XYPointSet import space.kscience.kmath.operations.Field import space.kscience.kmath.operations.invoke +@OptIn(UnstableKMathAPI::class) +internal fun > insureSorted(points: XYPointSet<*, T, *>) { + for (i in 0 until points.size - 1) + require(points.x[i + 1] > points.x[i]) { "Input data is not sorted at index $i" } +} + /** * Reference JVM implementation: https://github.com/apache/commons-math/blob/master/src/main/java/org/apache/commons/math4/analysis/interpolation/LinearInterpolator.java */ public class LinearInterpolator>(public override val algebra: Field) : PolynomialInterpolator { - public override fun interpolatePolynomials(points: XYPointSet): PiecewisePolynomial = algebra { + @OptIn(UnstableKMathAPI::class) + public override fun interpolatePolynomials(points: XYPointSet): PiecewisePolynomial = algebra { require(points.size > 0) { "Point array should not be empty" } insureSorted(points) diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt index ddbe743f0..8b6db8cf9 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt @@ -3,6 +3,8 @@ package space.kscience.kmath.interpolation import space.kscience.kmath.functions.OrderedPiecewisePolynomial import space.kscience.kmath.functions.PiecewisePolynomial import space.kscience.kmath.functions.Polynomial +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.misc.XYPointSet import space.kscience.kmath.operations.Field import space.kscience.kmath.operations.invoke import space.kscience.kmath.structures.MutableBufferFactory @@ -17,7 +19,8 @@ public class SplineInterpolator>( ) : PolynomialInterpolator { //TODO possibly optimize zeroed buffers - public override fun interpolatePolynomials(points: XYPointSet): PiecewisePolynomial = algebra { + @OptIn(UnstableKMathAPI::class) + public override fun interpolatePolynomials(points: XYPointSet): PiecewisePolynomial = algebra { require(points.size >= 3) { "Can't use spline interpolator with less than 3 points" } insureSorted(points) // Number of intervals. The number of data points is n + 1. diff --git a/kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/DifferentiableMstExpression.kt b/kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/DifferentiableMstExpression.kt index 39a7248b4..fe27b7e4d 100644 --- a/kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/DifferentiableMstExpression.kt +++ b/kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/DifferentiableMstExpression.kt @@ -5,7 +5,7 @@ import space.kscience.kmath.ast.MST import space.kscience.kmath.ast.MstAlgebra import space.kscience.kmath.ast.MstExpression import space.kscience.kmath.expressions.DifferentiableExpression -import space.kscience.kmath.expressions.Symbol +import space.kscience.kmath.misc.Symbol import space.kscience.kmath.operations.NumericAlgebra /** diff --git a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/DataFit.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/DataFit.kt index e9a5dea86..70dd8417c 100644 --- a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/DataFit.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/DataFit.kt @@ -1,8 +1,8 @@ package space.kscience.kmath.optimization import space.kscience.kmath.expressions.DifferentiableExpression -import space.kscience.kmath.expressions.StringSymbol -import space.kscience.kmath.expressions.Symbol +import space.kscience.kmath.misc.StringSymbol +import space.kscience.kmath.misc.Symbol import space.kscience.kmath.structures.Buffer public interface DataFit : Optimization { diff --git a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/FunctionOptimization.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/FunctionOptimization.kt index bf37f5c64..02aa9e9bb 100644 --- a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/FunctionOptimization.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/FunctionOptimization.kt @@ -1,6 +1,11 @@ package space.kscience.kmath.optimization -import space.kscience.kmath.expressions.* +import space.kscience.kmath.expressions.AutoDiffProcessor +import space.kscience.kmath.expressions.DifferentiableExpression +import space.kscience.kmath.expressions.Expression +import space.kscience.kmath.expressions.ExpressionAlgebra +import space.kscience.kmath.misc.StringSymbol +import space.kscience.kmath.misc.Symbol import space.kscience.kmath.operations.ExtendedField import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.indices diff --git a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/Optimization.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/Optimization.kt index 370274b41..0b13e07ba 100644 --- a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/Optimization.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/Optimization.kt @@ -1,6 +1,6 @@ package space.kscience.kmath.optimization -import space.kscience.kmath.expressions.Symbol +import space.kscience.kmath.misc.Symbol public interface OptimizationFeature From 67aa173927c3f50dcea398d201236c54ad5fe4e0 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Mon, 22 Mar 2021 16:11:54 +0700 Subject: [PATCH 147/150] Some documentation updates --- .../kscience/kmath/domains/DoubleDomain.kt | 1 - .../kscience/kmath/linear/LinearSolver.kt | 14 ++++++-- .../kscience/kmath/linear/LinearSpace.kt | 2 ++ .../kscience/kmath/operations/Algebra.kt | 19 +++++----- .../space/kscience/kmath/operations/BigInt.kt | 7 ++-- .../kscience/kmath/functions/Piecewise.kt | 35 +++++++++++++++---- .../kscience/kmath/functions/Polynomial.kt | 3 ++ 7 files changed, 61 insertions(+), 20 deletions(-) diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/DoubleDomain.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/DoubleDomain.kt index 057a4a344..154763159 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/DoubleDomain.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/DoubleDomain.kt @@ -24,7 +24,6 @@ import space.kscience.kmath.misc.UnstableKMathAPI */ @UnstableKMathAPI public interface DoubleDomain : Domain { - /** * Global lower edge * @param num axis number diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSolver.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSolver.kt index af136c552..3e2dbee3f 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSolver.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSolver.kt @@ -3,7 +3,10 @@ package space.kscience.kmath.linear import space.kscience.kmath.nd.as1D /** - * A group of methods to resolve equation A dot X = B, where A and B are matrices or vectors + * A group of methods to solve for *X* in equation *X = A -1 · B*, where *A* and *B* are matrices or + * vectors. + * + * @param T the type of items. */ public interface LinearSolver { /** @@ -23,7 +26,7 @@ public interface LinearSolver { } /** - * Convert matrix to vector if it is possible + * Convert matrix to vector if it is possible. */ public fun Matrix.asVector(): Point = if (this.colNum == 1) @@ -31,4 +34,11 @@ public fun Matrix.asVector(): Point = else error("Can't convert matrix with more than one column to vector") +/** + * Creates an n × 1 [VirtualMatrix], where n is the size of the given buffer. + * + * @param T the type of elements contained in the buffer. + * @receiver a buffer. + * @return the new matrix. + */ public fun Point.asMatrix(): VirtualMatrix = VirtualMatrix(size, 1) { i, _ -> get(i) } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt index 6a587270b..921f4c79c 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LinearSpace.kt @@ -17,6 +17,8 @@ public typealias Matrix = Structure2D /** * Alias or using [Buffer] as a point/vector in a many-dimensional space. + * + * @param T the type of elements contained in the buffer. */ public typealias Point = Buffer diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt index 9f57bc4c1..960b7581c 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt @@ -100,8 +100,8 @@ public fun Algebra.bindSymbol(symbol: Symbol): T = bindSymbol(symbo public inline operator fun
, R> A.invoke(block: A.() -> R): R = run(block) /** - * Represents linear space without neutral element, i.e. algebraic structure with associative, binary operation [add] - * and scalar multiplication [multiply]. + * Represents group without neutral element (also known as inverse semigroup), i.e. algebraic structure with + * associative, binary operation [add]. * * @param T the type of element of this semispace. */ @@ -177,7 +177,7 @@ public interface GroupOperations : Algebra { } /** - * Represents linear space with neutral element, i.e. algebraic structure with associative, binary operation [add]. + * Represents group, i.e. algebraic structure with associative, binary operation [add]. * * @param T the type of element of this semispace. */ @@ -189,8 +189,8 @@ public interface Group : GroupOperations { } /** - * Represents rng, i.e. algebraic structure with associative, binary, commutative operation [add] and associative, - * operation [multiply] distributive over [add]. + * Represents ring without multiplicative and additive identities, i.e. algebraic structure with + * associative, binary, commutative operation [add] and associative, operation [multiply] distributive over [add]. * * @param T the type of element of this semiring. */ @@ -238,7 +238,7 @@ public interface Ring : Group, RingOperations { } /** - * Represents field without identity elements, i.e. algebraic structure with associative, binary, commutative operations + * Represents field without without multiplicative and additive identities, i.e. algebraic structure with associative, binary, commutative operations * [add] and [multiply]; binary operation [divide] as multiplication of left operand by reciprocal of right one. * * @param T the type of element of this semifield. @@ -276,10 +276,11 @@ public interface FieldOperations : RingOperations { } /** - * Represents field, i.e. algebraic structure with three operations: associative "addition" and "multiplication", - * and "division" and their neutral elements. + * Represents field, i.e. algebraic structure with three operations: associative, commutative addition and + * multiplication, and division. **This interface differs from the eponymous mathematical definition: fields in KMath + * also support associative multiplication by scalar.** * - * @param T the type of element of this semifield. + * @param T the type of element of this field. */ public interface Field : Ring, FieldOperations, ScaleOperations, NumericAlgebra { override fun number(value: Number): T = scale(one, value.toDouble()) diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/BigInt.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/BigInt.kt index 55bb68850..b5e27575b 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/BigInt.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/BigInt.kt @@ -12,8 +12,8 @@ import kotlin.math.max import kotlin.math.min import kotlin.math.sign -public typealias Magnitude = UIntArray -public typealias TBase = ULong +private typealias Magnitude = UIntArray +private typealias TBase = ULong /** * Kotlin Multiplatform implementation of Big Integer numbers (KBigInteger). @@ -358,6 +358,9 @@ private fun stripLeadingZeros(mag: Magnitude): Magnitude { return mag.sliceArray(IntRange(0, resSize)) } +/** + * Returns the absolute value of the given value [x]. + */ public fun abs(x: BigInt): BigInt = x.abs() /** diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Piecewise.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Piecewise.kt index d2470a4b4..3510973be 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Piecewise.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Piecewise.kt @@ -2,14 +2,28 @@ package space.kscience.kmath.functions import space.kscience.kmath.operations.Ring +/** + * Represents piecewise-defined function. + * + * @param T the piece key type. + * @param R the sub-function type. + */ public fun interface Piecewise { + /** + * Returns the appropriate sub-function for given piece key. + */ public fun findPiece(arg: T): R? } +/** + * Represents piecewise-defined function where all the sub-functions are polynomials. + */ public fun interface PiecewisePolynomial : Piecewise> /** - * Ordered list of pieces in piecewise function + * Basic [Piecewise] implementation where all the pieces are ordered by the [Comparable] type instances. + * + * @param T the comparable piece key type. */ public class OrderedPiecewisePolynomial>(delimiter: T) : PiecewisePolynomial { @@ -17,8 +31,10 @@ public class OrderedPiecewisePolynomial>(delimiter: T) : private val pieces: MutableList> = arrayListOf() /** - * Dynamically add a piece to the "right" side (beyond maximum argument value of previous piece) - * @param right new rightmost position. If is less then current rightmost position, a error is thrown. + * Dynamically adds a piece to the right side (beyond maximum argument value of previous piece) + * + * @param right new rightmost position. If is less then current rightmost position, an error is thrown. + * @param piece the sub-function. */ public fun putRight(right: T, piece: Polynomial) { require(right > delimiters.last()) { "New delimiter should be to the right of old one" } @@ -26,13 +42,19 @@ public class OrderedPiecewisePolynomial>(delimiter: T) : pieces.add(piece) } + /** + * Dynamically adds a piece to the left side (beyond maximum argument value of previous piece) + * + * @param left the new leftmost position. If is less then current rightmost position, an error is thrown. + * @param piece the sub-function. + */ public fun putLeft(left: T, piece: Polynomial) { require(left < delimiters.first()) { "New delimiter should be to the left of old one" } delimiters.add(0, left) pieces.add(0, piece) } - override fun findPiece(arg: T): Polynomial? { + public override fun findPiece(arg: T): Polynomial? { if (arg < delimiters.first() || arg >= delimiters.last()) return null else { @@ -46,9 +68,10 @@ public class OrderedPiecewisePolynomial>(delimiter: T) : } /** - * Return a value of polynomial function with given [ring] an given [arg] or null if argument is outside of piecewise definition. + * Return a value of polynomial function with given [ring] an given [arg] or null if argument is outside of piecewise + * definition. */ public fun , C : Ring> PiecewisePolynomial.value(ring: C, arg: T): T? = findPiece(arg)?.value(ring, arg) -public fun , C : Ring> PiecewisePolynomial.asFunction(ring: C): (T) -> T? = { value(ring, it) } \ No newline at end of file +public fun , C : Ring> PiecewisePolynomial.asFunction(ring: C): (T) -> T? = { value(ring, it) } diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt index 049909fe1..9f4e21991 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt @@ -15,6 +15,9 @@ import kotlin.math.pow */ public inline class Polynomial(public val coefficients: List) +/** + * Returns a [Polynomial] instance with given [coefficients]. + */ @Suppress("FunctionName") public fun Polynomial(vararg coefficients: T): Polynomial = Polynomial(coefficients.toList()) From 1b01654667877eff08b5ffe0fb83fc6458cae238 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Mon, 22 Mar 2021 18:32:08 +0700 Subject: [PATCH 148/150] Improve Dokka configuration --- README.md | 11 +++-- build.gradle.kts | 24 ++++++++- docs/templates/ARTIFACT-TEMPLATE.md | 62 +++++++++++------------ docs/templates/README-TEMPLATE.md | 5 +- gradle.properties | 2 +- kmath-ast/README.md | 66 +++++++++++-------------- kmath-ast/docs/README-TEMPLATE.md | 4 +- kmath-complex/README.md | 66 +++++++++++-------------- kmath-complex/docs/README-TEMPLATE.md | 4 +- kmath-core/README.md | 66 +++++++++++-------------- kmath-core/docs/README-TEMPLATE.md | 4 +- kmath-ejml/README.md | 66 +++++++++++-------------- kmath-ejml/docs/README-TEMPLATE.md | 4 +- kmath-for-real/README.md | 66 ++++++++++++------------- kmath-for-real/docs/README-TEMPLATE.md | 4 +- kmath-functions/README.md | 66 +++++++++++-------------- kmath-functions/docs/README-TEMPLATE.md | 4 +- kmath-nd4j/README.md | 66 +++++++++++-------------- kmath-nd4j/docs/README-TEMPLATE.md | 4 +- 19 files changed, 288 insertions(+), 306 deletions(-) diff --git a/README.md b/README.md index cc9439d27..7080c757e 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,8 @@ [![JetBrains Research](https://jb.gg/badges/research.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub) [![DOI](https://zenodo.org/badge/129486382.svg)](https://zenodo.org/badge/latestdoi/129486382) - ![Gradle build](https://github.com/mipt-npm/kmath/workflows/Gradle%20build/badge.svg) - -[![Maven Central](https://img.shields.io/maven-central/v/space.kscience/kmath-core.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22space.kscience%22%20AND%20a:%22kmath-core%22) +[![Maven Central](https://img.shields.io/maven-central/v/space.kscience/kmath-core.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22space.kscience%22) +[![Space](https://img.shields.io/maven-metadata/v?label=Space&metadataUrl=https%3A%2F%2Fmaven.pkg.jetbrains.space%2Fmipt-npm%2Fp%2Fsci%2Fmaven%2Fkscience%2Fkmath%2Fkmath-core%2Fmaven-metadata.xml)](https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven/space/kscience/) # KMath @@ -147,6 +146,12 @@ performance calculations to code generation. > > > **Maturity**: PROTOTYPE +> +> **Features:** +> - [ejml-vector](kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlVector.kt) : The Point implementation using SimpleMatrix. +> - [ejml-matrix](kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt) : The Matrix implementation using SimpleMatrix. +> - [ejml-linear-space](kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt) : The LinearSpace implementation using SimpleMatrix. +
* ### [kmath-for-real](kmath-for-real) diff --git a/build.gradle.kts b/build.gradle.kts index 5f1a8b88a..67cb2a2fc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,6 @@ +import org.jetbrains.dokka.gradle.DokkaTask import ru.mipt.npm.gradle.KSciencePublishingPlugin +import java.net.URL plugins { id("ru.mipt.npm.gradle.project") @@ -9,7 +11,6 @@ allprojects { jcenter() maven("https://clojars.org/repo") maven("https://dl.bintray.com/egor-bogomolov/astminer/") - maven("https://dl.bintray.com/hotkeytlt/maven") maven("https://dl.bintray.com/kotlin/kotlin-eap") maven("https://dl.bintray.com/kotlin/kotlinx") maven("https://dl.bintray.com/mipt-npm/dev") @@ -25,6 +26,27 @@ allprojects { subprojects { if (name.startsWith("kmath")) apply() + + afterEvaluate { + tasks.withType { + dokkaSourceSets.all { + val readmeFile = File(this@subprojects.projectDir, "./README.md") + if (readmeFile.exists()) + includes.setFrom(includes + readmeFile.absolutePath) + + arrayOf( + "http://ejml.org/javadoc/", + "https://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/", + "https://deeplearning4j.org/api/latest/" + ).map { URL("${it}package-list") to URL(it) }.forEach { (a, b) -> + externalDocumentationLink { + packageListUrl.set(a) + url.set(b) + } + } + } + } + } } readme { diff --git a/docs/templates/ARTIFACT-TEMPLATE.md b/docs/templates/ARTIFACT-TEMPLATE.md index cb741bc6f..01d9c51da 100644 --- a/docs/templates/ARTIFACT-TEMPLATE.md +++ b/docs/templates/ARTIFACT-TEMPLATE.md @@ -1,34 +1,28 @@ -> #### Artifact: -> -> This module artifact: `${group}:${name}:${version}`. -> -> Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/${name}/images/download.svg) ](https://bintray.com/mipt-npm/kscience/${name}/_latestVersion) -> -> Bintray development version: [ ![Download](https://api.bintray.com/packages/mipt-npm/dev/${name}/images/download.svg) ](https://bintray.com/mipt-npm/dev/${name}/_latestVersion) -> -> **Gradle:** -> -> ```gradle -> repositories { -> maven { url 'https://repo.kotlin.link' } -> maven { url 'https://dl.bintray.com/hotkeytlt/maven' } -> maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap -> } -> -> dependencies { -> implementation '${group}:${name}:${version}' -> } -> ``` -> **Gradle Kotlin DSL:** -> -> ```kotlin -> repositories { -> maven("https://repo.kotlin.link") -> maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap -> maven("https://dl.bintray.com/hotkeytlt/maven") // required for a -> } -> -> dependencies { -> implementation("${group}:${name}:${version}") -> } -> ``` \ No newline at end of file +## Artifact: + +The Maven coordinates of this project are `${group}:${name}:${version}`. + +**Gradle:** +```gradle +repositories { + maven { url 'https://repo.kotlin.link' } + maven { url 'https://dl.bintray.com/hotkeytlt/maven' } + maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap +} + +dependencies { + implementation '${group}:${name}:${version}' +} +``` +**Gradle Kotlin DSL:** +```kotlin +repositories { + maven("https://repo.kotlin.link") + maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap + maven("https://dl.bintray.com/hotkeytlt/maven") // required for a +} + +dependencies { + implementation("${group}:${name}:${version}") +} +``` \ No newline at end of file diff --git a/docs/templates/README-TEMPLATE.md b/docs/templates/README-TEMPLATE.md index 4366c8fcd..3502cdccd 100644 --- a/docs/templates/README-TEMPLATE.md +++ b/docs/templates/README-TEMPLATE.md @@ -1,9 +1,8 @@ [![JetBrains Research](https://jb.gg/badges/research.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub) [![DOI](https://zenodo.org/badge/129486382.svg)](https://zenodo.org/badge/latestdoi/129486382) - ![Gradle build](https://github.com/mipt-npm/kmath/workflows/Gradle%20build/badge.svg) - -[![Maven Central](https://img.shields.io/maven-central/v/space.kscience/kmath-core.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22space.kscience%22%20AND%20a:%22kmath-core%22) +[![Maven Central](https://img.shields.io/maven-central/v/space.kscience/kmath-core.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22space.kscience%22) +[![Space](https://img.shields.io/maven-metadata/v?label=Space&metadataUrl=https%3A%2F%2Fmaven.pkg.jetbrains.space%2Fmipt-npm%2Fp%2Fsci%2Fmaven%2Fkscience%2Fkmath%2Fkmath-core%2Fmaven-metadata.xml)](https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven/space/kscience/) # KMath diff --git a/gradle.properties b/gradle.properties index 7ff50a435..50123b16c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,5 +4,5 @@ kotlin.mpp.stability.nowarn=true kotlin.native.enableDependencyPropagation=false kotlin.parallel.tasks.in.project=true org.gradle.configureondemand=true -org.gradle.jvmargs=-XX:MaxMetaspaceSize=2G +org.gradle.jvmargs=-XX:MaxMetaspaceSize=9G org.gradle.parallel=true diff --git a/kmath-ast/README.md b/kmath-ast/README.md index ee14604d2..ff954b914 100644 --- a/kmath-ast/README.md +++ b/kmath-ast/README.md @@ -1,6 +1,6 @@ -# Abstract Syntax Tree Expression Representation and Operations (`kmath-ast`) +# Module kmath-ast -This subproject implements the following features: +Abstract syntax tree expression representation and related optimizations. - [expression-language](src/jvmMain/kotlin/space/kscience/kmath/ast/parser.kt) : Expression language and its parser - [mst](src/commonMain/kotlin/space/kscience/kmath/ast/MST.kt) : MST (Mathematical Syntax Tree) as expression language's syntax intermediate representation @@ -10,40 +10,34 @@ This subproject implements the following features: - [mst-js-codegen](src/jsMain/kotlin/space/kscience/kmath/estree/estree.kt) : Dynamic MST to JS compiler -> #### Artifact: -> -> This module artifact: `space.kscience:kmath-ast:0.3.0-dev-3`. -> -> Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-ast/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-ast/_latestVersion) -> -> Bintray development version: [ ![Download](https://api.bintray.com/packages/mipt-npm/dev/kmath-ast/images/download.svg) ](https://bintray.com/mipt-npm/dev/kmath-ast/_latestVersion) -> -> **Gradle:** -> -> ```gradle -> repositories { -> maven { url 'https://repo.kotlin.link' } -> maven { url 'https://dl.bintray.com/hotkeytlt/maven' } -> maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap -> } -> -> dependencies { -> implementation 'space.kscience:kmath-ast:0.3.0-dev-3' -> } -> ``` -> **Gradle Kotlin DSL:** -> -> ```kotlin -> repositories { -> maven("https://repo.kotlin.link") -> maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap -> maven("https://dl.bintray.com/hotkeytlt/maven") // required for a -> } -> -> dependencies { -> implementation("space.kscience:kmath-ast:0.3.0-dev-3") -> } -> ``` +## Artifact: + +The Maven coordinates of this project are `space.kscience:kmath-ast:0.3.0-dev-3`. + +**Gradle:** +```gradle +repositories { + maven { url 'https://repo.kotlin.link' } + maven { url 'https://dl.bintray.com/hotkeytlt/maven' } + maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap +} + +dependencies { + implementation 'space.kscience:kmath-ast:0.3.0-dev-3' +} +``` +**Gradle Kotlin DSL:** +```kotlin +repositories { + maven("https://repo.kotlin.link") + maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap + maven("https://dl.bintray.com/hotkeytlt/maven") // required for a +} + +dependencies { + implementation("space.kscience:kmath-ast:0.3.0-dev-3") +} +``` ## Dynamic expression code generation diff --git a/kmath-ast/docs/README-TEMPLATE.md b/kmath-ast/docs/README-TEMPLATE.md index 80e48008b..db071adb4 100644 --- a/kmath-ast/docs/README-TEMPLATE.md +++ b/kmath-ast/docs/README-TEMPLATE.md @@ -1,6 +1,6 @@ -# Abstract Syntax Tree Expression Representation and Operations (`kmath-ast`) +# Module kmath-ast -This subproject implements the following features: +Abstract syntax tree expression representation and related optimizations. ${features} diff --git a/kmath-complex/README.md b/kmath-complex/README.md index 9e9cd5b6f..d7b2937fd 100644 --- a/kmath-complex/README.md +++ b/kmath-complex/README.md @@ -1,42 +1,36 @@ -# The Core Module (`kmath-core`) +# Module kmath-complex -Complex and hypercomplex number systems in KMath: +Complex and hypercomplex number systems in KMath. - [complex](src/commonMain/kotlin/space/kscience/kmath/complex/Complex.kt) : Complex Numbers - [quaternion](src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt) : Quaternions -> #### Artifact: -> -> This module artifact: `space.kscience:kmath-complex:0.3.0-dev-3`. -> -> Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-complex/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-complex/_latestVersion) -> -> Bintray development version: [ ![Download](https://api.bintray.com/packages/mipt-npm/dev/kmath-complex/images/download.svg) ](https://bintray.com/mipt-npm/dev/kmath-complex/_latestVersion) -> -> **Gradle:** -> -> ```gradle -> repositories { -> maven { url 'https://repo.kotlin.link' } -> maven { url 'https://dl.bintray.com/hotkeytlt/maven' } -> maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap -> } -> -> dependencies { -> implementation 'space.kscience:kmath-complex:0.3.0-dev-3' -> } -> ``` -> **Gradle Kotlin DSL:** -> -> ```kotlin -> repositories { -> maven("https://repo.kotlin.link") -> maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap -> maven("https://dl.bintray.com/hotkeytlt/maven") // required for a -> } -> -> dependencies { -> implementation("space.kscience:kmath-complex:0.3.0-dev-3") -> } -> ``` +## Artifact: + +The Maven coordinates of this project are `space.kscience:kmath-complex:0.3.0-dev-3`. + +**Gradle:** +```gradle +repositories { + maven { url 'https://repo.kotlin.link' } + maven { url 'https://dl.bintray.com/hotkeytlt/maven' } + maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap +} + +dependencies { + implementation 'space.kscience:kmath-complex:0.3.0-dev-3' +} +``` +**Gradle Kotlin DSL:** +```kotlin +repositories { + maven("https://repo.kotlin.link") + maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap + maven("https://dl.bintray.com/hotkeytlt/maven") // required for a +} + +dependencies { + implementation("space.kscience:kmath-complex:0.3.0-dev-3") +} +``` diff --git a/kmath-complex/docs/README-TEMPLATE.md b/kmath-complex/docs/README-TEMPLATE.md index 462fd617e..106d4aff1 100644 --- a/kmath-complex/docs/README-TEMPLATE.md +++ b/kmath-complex/docs/README-TEMPLATE.md @@ -1,6 +1,6 @@ -# The Core Module (`kmath-core`) +# Module kmath-complex -Complex and hypercomplex number systems in KMath: +Complex and hypercomplex number systems in KMath. ${features} diff --git a/kmath-core/README.md b/kmath-core/README.md index 4e4b5273d..096c7d833 100644 --- a/kmath-core/README.md +++ b/kmath-core/README.md @@ -1,6 +1,6 @@ -# The Core Module (`kmath-core`) +# Module kmath-core -The core features of KMath: +The core interfaces of KMath. - [algebras](src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt) : Algebraic structures like rings, spaces and fields. - [nd](src/commonMain/kotlin/space/kscience/kmath/structures/StructureND.kt) : Many-dimensional structures and operations on them. @@ -13,37 +13,31 @@ performance calculations to code generation. - [autodif](src/commonMain/kotlin/space/kscience/kmath/expressions/SimpleAutoDiff.kt) : Automatic differentiation -> #### Artifact: -> -> This module artifact: `space.kscience:kmath-core:0.3.0-dev-3`. -> -> Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-core/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-core/_latestVersion) -> -> Bintray development version: [ ![Download](https://api.bintray.com/packages/mipt-npm/dev/kmath-core/images/download.svg) ](https://bintray.com/mipt-npm/dev/kmath-core/_latestVersion) -> -> **Gradle:** -> -> ```gradle -> repositories { -> maven { url 'https://repo.kotlin.link' } -> maven { url 'https://dl.bintray.com/hotkeytlt/maven' } -> maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap -> } -> -> dependencies { -> implementation 'space.kscience:kmath-core:0.3.0-dev-3' -> } -> ``` -> **Gradle Kotlin DSL:** -> -> ```kotlin -> repositories { -> maven("https://repo.kotlin.link") -> maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap -> maven("https://dl.bintray.com/hotkeytlt/maven") // required for a -> } -> -> dependencies { -> implementation("space.kscience:kmath-core:0.3.0-dev-3") -> } -> ``` +## Artifact: + +The Maven coordinates of this project are `space.kscience:kmath-core:0.3.0-dev-3`. + +**Gradle:** +```gradle +repositories { + maven { url 'https://repo.kotlin.link' } + maven { url 'https://dl.bintray.com/hotkeytlt/maven' } + maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap +} + +dependencies { + implementation 'space.kscience:kmath-core:0.3.0-dev-3' +} +``` +**Gradle Kotlin DSL:** +```kotlin +repositories { + maven("https://repo.kotlin.link") + maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap + maven("https://dl.bintray.com/hotkeytlt/maven") // required for a +} + +dependencies { + implementation("space.kscience:kmath-core:0.3.0-dev-3") +} +``` diff --git a/kmath-core/docs/README-TEMPLATE.md b/kmath-core/docs/README-TEMPLATE.md index 83d1ebdce..41cfe1ccb 100644 --- a/kmath-core/docs/README-TEMPLATE.md +++ b/kmath-core/docs/README-TEMPLATE.md @@ -1,6 +1,6 @@ -# The Core Module (`kmath-core`) +# Module kmath-core -The core features of KMath: +The core interfaces of KMath. ${features} diff --git a/kmath-ejml/README.md b/kmath-ejml/README.md index 1081b2b7f..2551703a4 100644 --- a/kmath-ejml/README.md +++ b/kmath-ejml/README.md @@ -1,43 +1,37 @@ -# ejml-simple support (`kmath-ejml`) +# Module kmath-ejml -This subproject implements the following features: +EJML based linear algebra implementation. - [ejml-vector](src/main/kotlin/space/kscience/kmath/ejml/EjmlVector.kt) : The Point implementation using SimpleMatrix. - [ejml-matrix](src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt) : The Matrix implementation using SimpleMatrix. - [ejml-linear-space](src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt) : The LinearSpace implementation using SimpleMatrix. -> #### Artifact: -> -> This module artifact: `space.kscience:kmath-ejml:0.3.0-dev-3`. -> -> Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-ejml/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-ejml/_latestVersion) -> -> Bintray development version: [ ![Download](https://api.bintray.com/packages/mipt-npm/dev/kmath-ejml/images/download.svg) ](https://bintray.com/mipt-npm/dev/kmath-ejml/_latestVersion) -> -> **Gradle:** -> -> ```gradle -> repositories { -> maven { url 'https://repo.kotlin.link' } -> maven { url 'https://dl.bintray.com/hotkeytlt/maven' } -> maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap -> } -> -> dependencies { -> implementation 'space.kscience:kmath-ejml:0.3.0-dev-3' -> } -> ``` -> **Gradle Kotlin DSL:** -> -> ```kotlin -> repositories { -> maven("https://repo.kotlin.link") -> maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap -> maven("https://dl.bintray.com/hotkeytlt/maven") // required for a -> } -> -> dependencies { -> implementation("space.kscience:kmath-ejml:0.3.0-dev-3") -> } -> ``` +## Artifact: + +The Maven coordinates of this project are `space.kscience:kmath-ejml:0.3.0-dev-3`. + +**Gradle:** +```gradle +repositories { + maven { url 'https://repo.kotlin.link' } + maven { url 'https://dl.bintray.com/hotkeytlt/maven' } + maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap +} + +dependencies { + implementation 'space.kscience:kmath-ejml:0.3.0-dev-3' +} +``` +**Gradle Kotlin DSL:** +```kotlin +repositories { + maven("https://repo.kotlin.link") + maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap + maven("https://dl.bintray.com/hotkeytlt/maven") // required for a +} + +dependencies { + implementation("space.kscience:kmath-ejml:0.3.0-dev-3") +} +``` diff --git a/kmath-ejml/docs/README-TEMPLATE.md b/kmath-ejml/docs/README-TEMPLATE.md index c53f4a81c..27fcedd65 100644 --- a/kmath-ejml/docs/README-TEMPLATE.md +++ b/kmath-ejml/docs/README-TEMPLATE.md @@ -1,6 +1,6 @@ -# ejml-simple support (`kmath-ejml`) +# Module kmath-ejml -This subproject implements the following features: +EJML based linear algebra implementation. ${features} diff --git a/kmath-for-real/README.md b/kmath-for-real/README.md index 139cd3cef..ad3d33062 100644 --- a/kmath-for-real/README.md +++ b/kmath-for-real/README.md @@ -1,41 +1,37 @@ -# Real number specialization module (`kmath-for-real`) +# Module kmath-for-real + +Specialization of KMath APIs for Double numbers. - [DoubleVector](src/commonMain/kotlin/space/kscience/kmath/real/DoubleVector.kt) : Numpy-like operations for Buffers/Points - [DoubleMatrix](src/commonMain/kotlin/space/kscience/kmath/real/DoubleMatrix.kt) : Numpy-like operations for 2d real structures - [grids](src/commonMain/kotlin/space/kscience/kmath/structures/grids.kt) : Uniform grid generators -> #### Artifact: -> -> This module artifact: `space.kscience:kmath-for-real:0.3.0-dev-3`. -> -> Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-for-real/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-for-real/_latestVersion) -> -> Bintray development version: [ ![Download](https://api.bintray.com/packages/mipt-npm/dev/kmath-for-real/images/download.svg) ](https://bintray.com/mipt-npm/dev/kmath-for-real/_latestVersion) -> -> **Gradle:** -> -> ```gradle -> repositories { -> maven { url 'https://repo.kotlin.link' } -> maven { url 'https://dl.bintray.com/hotkeytlt/maven' } -> maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap -> } -> -> dependencies { -> implementation 'space.kscience:kmath-for-real:0.3.0-dev-3' -> } -> ``` -> **Gradle Kotlin DSL:** -> -> ```kotlin -> repositories { -> maven("https://repo.kotlin.link") -> maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap -> maven("https://dl.bintray.com/hotkeytlt/maven") // required for a -> } -> -> dependencies { -> implementation("space.kscience:kmath-for-real:0.3.0-dev-3") -> } -> ``` +## Artifact: + +The Maven coordinates of this project are `space.kscience:kmath-for-real:0.3.0-dev-3`. + +**Gradle:** +```gradle +repositories { + maven { url 'https://repo.kotlin.link' } + maven { url 'https://dl.bintray.com/hotkeytlt/maven' } + maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap +} + +dependencies { + implementation 'space.kscience:kmath-for-real:0.3.0-dev-3' +} +``` +**Gradle Kotlin DSL:** +```kotlin +repositories { + maven("https://repo.kotlin.link") + maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap + maven("https://dl.bintray.com/hotkeytlt/maven") // required for a +} + +dependencies { + implementation("space.kscience:kmath-for-real:0.3.0-dev-3") +} +``` diff --git a/kmath-for-real/docs/README-TEMPLATE.md b/kmath-for-real/docs/README-TEMPLATE.md index 670844bd0..c2ef25aa7 100644 --- a/kmath-for-real/docs/README-TEMPLATE.md +++ b/kmath-for-real/docs/README-TEMPLATE.md @@ -1,4 +1,6 @@ -# Real number specialization module (`kmath-for-real`) +# Module kmath-for-real + +Specialization of KMath APIs for Double numbers. ${features} diff --git a/kmath-functions/README.md b/kmath-functions/README.md index d13c4c107..531e97a44 100644 --- a/kmath-functions/README.md +++ b/kmath-functions/README.md @@ -1,6 +1,6 @@ -# Functions (`kmath-functions`) +# Module kmath-functions -Functions and interpolations: +Functions and interpolations. - [piecewise](Piecewise functions.) : src/commonMain/kotlin/space/kscience/kmath/functions/Piecewise.kt - [polynomials](Polynomial functions.) : src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt @@ -8,37 +8,31 @@ Functions and interpolations: - [spline interpolation](Cubic spline XY interpolator.) : src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt -> #### Artifact: -> -> This module artifact: `space.kscience:kmath-functions:0.3.0-dev-3`. -> -> Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-functions/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-functions/_latestVersion) -> -> Bintray development version: [ ![Download](https://api.bintray.com/packages/mipt-npm/dev/kmath-functions/images/download.svg) ](https://bintray.com/mipt-npm/dev/kmath-functions/_latestVersion) -> -> **Gradle:** -> -> ```gradle -> repositories { -> maven { url 'https://repo.kotlin.link' } -> maven { url 'https://dl.bintray.com/hotkeytlt/maven' } -> maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap -> } -> -> dependencies { -> implementation 'space.kscience:kmath-functions:0.3.0-dev-3' -> } -> ``` -> **Gradle Kotlin DSL:** -> -> ```kotlin -> repositories { -> maven("https://repo.kotlin.link") -> maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap -> maven("https://dl.bintray.com/hotkeytlt/maven") // required for a -> } -> -> dependencies { -> implementation("space.kscience:kmath-functions:0.3.0-dev-3") -> } -> ``` +## Artifact: + +The Maven coordinates of this project are `space.kscience:kmath-functions:0.3.0-dev-3`. + +**Gradle:** +```gradle +repositories { + maven { url 'https://repo.kotlin.link' } + maven { url 'https://dl.bintray.com/hotkeytlt/maven' } + maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap +} + +dependencies { + implementation 'space.kscience:kmath-functions:0.3.0-dev-3' +} +``` +**Gradle Kotlin DSL:** +```kotlin +repositories { + maven("https://repo.kotlin.link") + maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap + maven("https://dl.bintray.com/hotkeytlt/maven") // required for a +} + +dependencies { + implementation("space.kscience:kmath-functions:0.3.0-dev-3") +} +``` diff --git a/kmath-functions/docs/README-TEMPLATE.md b/kmath-functions/docs/README-TEMPLATE.md index 8a34a7cc4..2e163eee5 100644 --- a/kmath-functions/docs/README-TEMPLATE.md +++ b/kmath-functions/docs/README-TEMPLATE.md @@ -1,6 +1,6 @@ -# Functions (`kmath-functions`) +# Module kmath-functions -Functions and interpolations: +Functions and interpolations. ${features} diff --git a/kmath-nd4j/README.md b/kmath-nd4j/README.md index 2771722eb..938d05c33 100644 --- a/kmath-nd4j/README.md +++ b/kmath-nd4j/README.md @@ -1,46 +1,40 @@ -# ND4J NDStructure implementation (`kmath-nd4j`) +# Module kmath-nd4j -This subproject implements the following features: +ND4J based implementations of KMath abstractions. - [nd4jarraystructure](#) : NDStructure wrapper for INDArray - [nd4jarrayrings](#) : Rings over Nd4jArrayStructure of Int and Long - [nd4jarrayfields](#) : Fields over Nd4jArrayStructure of Float and Double -> #### Artifact: -> -> This module artifact: `space.kscience:kmath-nd4j:0.3.0-dev-3`. -> -> Bintray release version: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-nd4j/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-nd4j/_latestVersion) -> -> Bintray development version: [ ![Download](https://api.bintray.com/packages/mipt-npm/dev/kmath-nd4j/images/download.svg) ](https://bintray.com/mipt-npm/dev/kmath-nd4j/_latestVersion) -> -> **Gradle:** -> -> ```gradle -> repositories { -> maven { url 'https://repo.kotlin.link' } -> maven { url 'https://dl.bintray.com/hotkeytlt/maven' } -> maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap -> } -> -> dependencies { -> implementation 'space.kscience:kmath-nd4j:0.3.0-dev-3' -> } -> ``` -> **Gradle Kotlin DSL:** -> -> ```kotlin -> repositories { -> maven("https://repo.kotlin.link") -> maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap -> maven("https://dl.bintray.com/hotkeytlt/maven") // required for a -> } -> -> dependencies { -> implementation("space.kscience:kmath-nd4j:0.3.0-dev-3") -> } -> ``` +## Artifact: + +The Maven coordinates of this project are `space.kscience:kmath-nd4j:0.3.0-dev-3`. + +**Gradle:** +```gradle +repositories { + maven { url 'https://repo.kotlin.link' } + maven { url 'https://dl.bintray.com/hotkeytlt/maven' } + maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } // include for builds based on kotlin-eap +} + +dependencies { + implementation 'space.kscience:kmath-nd4j:0.3.0-dev-3' +} +``` +**Gradle Kotlin DSL:** +```kotlin +repositories { + maven("https://repo.kotlin.link") + maven("https://dl.bintray.com/kotlin/kotlin-eap") // include for builds based on kotlin-eap + maven("https://dl.bintray.com/hotkeytlt/maven") // required for a +} + +dependencies { + implementation("space.kscience:kmath-nd4j:0.3.0-dev-3") +} +``` ## Examples diff --git a/kmath-nd4j/docs/README-TEMPLATE.md b/kmath-nd4j/docs/README-TEMPLATE.md index 9783e74be..5f325cab5 100644 --- a/kmath-nd4j/docs/README-TEMPLATE.md +++ b/kmath-nd4j/docs/README-TEMPLATE.md @@ -1,6 +1,6 @@ -# ND4J NDStructure implementation (`kmath-nd4j`) +# Module kmath-nd4j -This subproject implements the following features: +ND4J based implementations of KMath abstractions. ${features} From 4d160b81b9620c6ab47e244f727db62355948479 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Tue, 23 Mar 2021 19:48:12 +0700 Subject: [PATCH 149/150] Improve KDoc comments for kmath-functions --- .../kscience/kmath/functions/Polynomial.kt | 24 +++++++++++++---- .../kscience/kmath/integration/Integrator.kt | 6 ++--- .../kmath/integration/UnivariateIntegrand.kt | 2 +- .../kmath/interpolation/SplineInterpolator.kt | 7 +++-- .../kmath/interpolation/XYPointSet.kt | 27 +++++++++++++++++++ 5 files changed, 55 insertions(+), 11 deletions(-) diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt index 9f4e21991..550785812 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt @@ -10,8 +10,9 @@ import kotlin.math.max import kotlin.math.pow /** - * Polynomial coefficients without fixation on specific context they are applied to - * @param coefficients constant is the leftmost coefficient + * Polynomial coefficients model without fixation on specific context they are applied to. + * + * @param coefficients constant is the leftmost coefficient. */ public inline class Polynomial(public val coefficients: List) @@ -21,8 +22,14 @@ public inline class Polynomial(public val coefficients: List) @Suppress("FunctionName") public fun Polynomial(vararg coefficients: T): Polynomial = Polynomial(coefficients.toList()) +/** + * Evaluates the value of the given double polynomial for given double argument. + */ public fun Polynomial.value(): Double = coefficients.reduceIndexed { index, acc, d -> acc + d.pow(index) } +/** + * Evaluates the value of the given polynomial for given argument. + */ public fun > Polynomial.value(ring: C, arg: T): T = ring { if (coefficients.isEmpty()) return@ring zero var res = coefficients.first() @@ -38,19 +45,23 @@ public fun > Polynomial.value(ring: C, arg: T): T = ring } /** - * Represent the polynomial as a regular context-less function + * Represent the polynomial as a regular context-less function. */ public fun > Polynomial.asFunction(ring: C): (T) -> T = { value(ring, it) } /** - * An algebra for polynomials + * Space of polynomials. + * + * @param T the type of operated polynomials. + * @param C the intersection of [Ring] of [T] and [ScaleOperations] of [T]. + * @param ring the [C] instance. */ public class PolynomialSpace( private val ring: C, ) : Group>, ScaleOperations> where C : Ring, C : ScaleOperations { public override val zero: Polynomial = Polynomial(emptyList()) - override fun Polynomial.unaryMinus(): Polynomial = with(ring) { + override fun Polynomial.unaryMinus(): Polynomial = ring { Polynomial(coefficients.map { -it }) } @@ -67,6 +78,9 @@ public class PolynomialSpace( public override fun scale(a: Polynomial, value: Double): Polynomial = ring { Polynomial(List(a.coefficients.size) { index -> a.coefficients[index] * value }) } + /** + * Evaluates the polynomial for the given value [arg]. + */ public operator fun Polynomial.invoke(arg: T): T = value(ring, arg) } diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrator.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrator.kt index ebc53ad2e..e421fb680 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrator.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrator.kt @@ -1,11 +1,11 @@ package space.kscience.kmath.integration /** - * A general interface for all integrators + * A general interface for all integrators. */ public interface Integrator { /** - * Run one integration pass and return a new [Integrand] with a new set of features + * Runs one integration pass and return a new [Integrand] with a new set of features. */ public fun integrate(integrand: I): I -} \ No newline at end of file +} diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/UnivariateIntegrand.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/UnivariateIntegrand.kt index 9389318e8..ca4bbf6b8 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/UnivariateIntegrand.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/UnivariateIntegrand.kt @@ -61,4 +61,4 @@ public fun UnivariateIntegrator.integrate( return integrate( UnivariateIntegrand(function, *features.toTypedArray()) ).value ?: error("Unexpected: no value after integration.") -} \ No newline at end of file +} diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt index ddbe743f0..ef75a1ef8 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt @@ -8,8 +8,11 @@ import space.kscience.kmath.operations.invoke import space.kscience.kmath.structures.MutableBufferFactory /** - * Generic spline interpolator. Not recommended for performance critical places, use platform-specific and type specific ones. - * Based on https://github.com/apache/commons-math/blob/eb57d6d457002a0bb5336d789a3381a24599affe/src/main/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolator.java + * Generic spline interpolator. Not recommended for performance critical places, use platform-specific and type + * specific ones. + * + * Based on + * https://github.com/apache/commons-math/blob/eb57d6d457002a0bb5336d789a3381a24599affe/src/main/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolator.java */ public class SplineInterpolator>( public override val algebra: Field, diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/XYPointSet.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/XYPointSet.kt index 1ff7b6351..2b1312c0f 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/XYPointSet.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/XYPointSet.kt @@ -3,13 +3,40 @@ package space.kscience.kmath.interpolation import space.kscience.kmath.nd.Structure2D import space.kscience.kmath.structures.Buffer +/** + * Pair of associated buffers for X and Y axes values. + * + * @param X the type of X values. + * @param Y the type of Y values. + */ public interface XYPointSet { + /** + * The size of all the involved buffers. + */ public val size: Int + + /** + * The buffer of X values. + */ public val x: Buffer + + /** + * The buffer of Y values. + */ public val y: Buffer } +/** + * Triple of associated buffers for X, Y, and Z axes values. + * + * @param X the type of X values. + * @param Y the type of Y values. + * @param Z the type of Z values. + */ public interface XYZPointSet : XYPointSet { + /** + * The buffer of Z values. + */ public val z: Buffer } From cd05ca6e952ad4475301c4e0b47c0f6c100e57d9 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 24 Mar 2021 16:36:06 +0300 Subject: [PATCH 150/150] Initial Optimization API --- build.gradle.kts | 5 +- .../commons/optimization/CMOptimization.kt | 20 ++-- .../kmath/commons/optimization/cmFit.kt | 17 ++-- kmath-core/api/kmath-core.api | 35 +++---- .../space/kscience/kmath/data/ColumnarData.kt | 34 +++++++ .../kscience/kmath/data/XYColumnarData.kt | 55 +++++++++++ .../kscience/kmath/data/XYZColumnarData.kt | 21 ++++ .../space/kscience/kmath/misc/ColumnarData.kt | 15 --- .../space/kscience/kmath/misc/XYPointSet.kt | 98 ------------------- .../kmath/interpolation/Interpolator.kt | 16 +-- .../kmath/interpolation/LinearInterpolator.kt | 6 +- .../kmath/interpolation/SplineInterpolator.kt | 4 +- .../kotlingrad/DifferentiableMstExpression.kt | 6 +- .../kscience/kmath/optimization/DataFit.kt | 17 ---- .../optimization/FunctionOptimization.kt | 80 ++++----------- .../NoDerivFunctionOptimization.kt | 69 +++++++++++++ .../kscience/kmath/optimization/XYFit.kt | 40 ++++++++ settings.gradle.kts | 5 +- 18 files changed, 296 insertions(+), 247 deletions(-) create mode 100644 kmath-core/src/commonMain/kotlin/space/kscience/kmath/data/ColumnarData.kt create mode 100644 kmath-core/src/commonMain/kotlin/space/kscience/kmath/data/XYColumnarData.kt create mode 100644 kmath-core/src/commonMain/kotlin/space/kscience/kmath/data/XYZColumnarData.kt delete mode 100644 kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/ColumnarData.kt delete mode 100644 kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/XYPointSet.kt delete mode 100644 kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/DataFit.kt create mode 100644 kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/NoDerivFunctionOptimization.kt create mode 100644 kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/XYFit.kt diff --git a/build.gradle.kts b/build.gradle.kts index d4453ad5c..cc863a957 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,10 +11,7 @@ allprojects { jcenter() maven("https://clojars.org/repo") maven("https://dl.bintray.com/egor-bogomolov/astminer/") - maven("https://dl.bintray.com/kotlin/kotlin-eap") - maven("https://dl.bintray.com/kotlin/kotlinx") - maven("https://dl.bintray.com/mipt-npm/dev") - maven("https://dl.bintray.com/mipt-npm/kscience") + maven("https://dl.bintray.com/hotkeytlt/maven") maven("https://jitpack.io") maven("http://logicrunch.research.it.uu.se/maven/") mavenCentral() diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/CMOptimization.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/CMOptimization.kt index 93d0f0bba..444c505c9 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/CMOptimization.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/CMOptimization.kt @@ -15,10 +15,7 @@ import space.kscience.kmath.expressions.SymbolIndexer import space.kscience.kmath.expressions.derivative import space.kscience.kmath.misc.Symbol import space.kscience.kmath.misc.UnstableKMathAPI -import space.kscience.kmath.optimization.FunctionOptimization -import space.kscience.kmath.optimization.OptimizationFeature -import space.kscience.kmath.optimization.OptimizationProblemFactory -import space.kscience.kmath.optimization.OptimizationResult +import space.kscience.kmath.optimization.* import kotlin.reflect.KClass public operator fun PointValuePair.component1(): DoubleArray = point @@ -27,7 +24,8 @@ public operator fun PointValuePair.component2(): Double = value @OptIn(UnstableKMathAPI::class) public class CMOptimization( override val symbols: List, -) : FunctionOptimization, SymbolIndexer, OptimizationFeature { +) : FunctionOptimization, NoDerivFunctionOptimization, SymbolIndexer, OptimizationFeature { + private val optimizationData: HashMap, OptimizationData> = HashMap() private var optimizerBuilder: (() -> MultivariateOptimizer)? = null public var convergenceChecker: ConvergenceChecker = SimpleValueChecker( @@ -36,6 +34,12 @@ public class CMOptimization( DEFAULT_MAX_ITER ) + override var maximize: Boolean + get() = optimizationData[GoalType::class] == GoalType.MAXIMIZE + set(value) { + optimizationData[GoalType::class] = if (value) GoalType.MAXIMIZE else GoalType.MINIMIZE + } + public fun addOptimizationData(data: OptimizationData) { optimizationData[data::class] = data } @@ -50,7 +54,7 @@ public class CMOptimization( addOptimizationData(InitialGuess(map.toDoubleArray())) } - public override fun expression(expression: Expression): Unit { + public override fun function(expression: Expression): Unit { val objectiveFunction = ObjectiveFunction { val args = it.toMap() expression(args) @@ -58,8 +62,8 @@ public class CMOptimization( addOptimizationData(objectiveFunction) } - public override fun diffExpression(expression: DifferentiableExpression>) { - expression(expression) + public override fun diffFunction(expression: DifferentiableExpression>) { + function(expression) val gradientFunction = ObjectiveFunctionGradient { val args = it.toMap() DoubleArray(symbols.size) { index -> diff --git a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/cmFit.kt b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/cmFit.kt index 8e9ce7a80..f84dae693 100644 --- a/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/cmFit.kt +++ b/kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/cmFit.kt @@ -1,13 +1,13 @@ package space.kscience.kmath.commons.optimization import org.apache.commons.math3.analysis.differentiation.DerivativeStructure -import org.apache.commons.math3.optim.nonlinear.scalar.GoalType import space.kscience.kmath.commons.expressions.DerivativeStructureField import space.kscience.kmath.expressions.DifferentiableExpression import space.kscience.kmath.expressions.Expression import space.kscience.kmath.misc.Symbol import space.kscience.kmath.optimization.FunctionOptimization import space.kscience.kmath.optimization.OptimizationResult +import space.kscience.kmath.optimization.noDerivOptimizeWith import space.kscience.kmath.optimization.optimizeWith import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.asBuffer @@ -44,7 +44,7 @@ public fun FunctionOptimization.Companion.chiSquared( public fun Expression.optimize( vararg symbols: Symbol, configuration: CMOptimization.() -> Unit, -): OptimizationResult = optimizeWith(CMOptimization, symbols = symbols, configuration) +): OptimizationResult = noDerivOptimizeWith(CMOptimization, symbols = symbols, configuration) /** * Optimize differentiable expression @@ -58,10 +58,11 @@ public fun DifferentiableExpression>.minimize( vararg startPoint: Pair, configuration: CMOptimization.() -> Unit = {}, ): OptimizationResult { - require(startPoint.isNotEmpty()) { "Must provide a list of symbols for optimization" } - val problem = CMOptimization(startPoint.map { it.first }).apply(configuration) - problem.diffExpression(this) - problem.initialGuess(startPoint.toMap()) - problem.goal(GoalType.MINIMIZE) - return problem.optimize() + val symbols = startPoint.map { it.first }.toTypedArray() + return optimize(*symbols){ + maximize = false + initialGuess(startPoint.toMap()) + diffFunction(this@minimize) + configuration() + } } \ No newline at end of file diff --git a/kmath-core/api/kmath-core.api b/kmath-core/api/kmath-core.api index 570e50a86..e6f4697aa 100644 --- a/kmath-core/api/kmath-core.api +++ b/kmath-core/api/kmath-core.api @@ -1,3 +1,18 @@ +public final class space/kscience/kmath/data/ColumnarDataKt { +} + +public final class space/kscience/kmath/data/XYColumnarData$DefaultImpls { + public static fun get (Lspace/kscience/kmath/data/XYColumnarData;Lspace/kscience/kmath/misc/Symbol;)Lspace/kscience/kmath/structures/Buffer; +} + +public final class space/kscience/kmath/data/XYColumnarDataKt { + public static synthetic fun asXYData$default (Lspace/kscience/kmath/nd/Structure2D;IIILjava/lang/Object;)Lspace/kscience/kmath/data/XYColumnarData; +} + +public final class space/kscience/kmath/data/XYZColumnarData$DefaultImpls { + public static fun get (Lspace/kscience/kmath/data/XYZColumnarData;Lspace/kscience/kmath/misc/Symbol;)Lspace/kscience/kmath/structures/Buffer; +} + public abstract interface class space/kscience/kmath/domains/Domain { public abstract fun contains (Lspace/kscience/kmath/structures/Buffer;)Z public abstract fun getDimension ()I @@ -603,15 +618,6 @@ public final class space/kscience/kmath/misc/CumulativeKt { public static final fun cumulativeSumOfLong (Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence; } -public final class space/kscience/kmath/misc/NDStructureColumn : space/kscience/kmath/structures/Buffer { - public fun (Lspace/kscience/kmath/nd/Structure2D;I)V - public fun get (I)Ljava/lang/Object; - public final fun getColumn ()I - public fun getSize ()I - public final fun getStructure ()Lspace/kscience/kmath/nd/Structure2D; - public fun iterator ()Ljava/util/Iterator; -} - public final class space/kscience/kmath/misc/StringSymbol : space/kscience/kmath/misc/Symbol { public static final synthetic fun box-impl (Ljava/lang/String;)Lspace/kscience/kmath/misc/StringSymbol; public static fun constructor-impl (Ljava/lang/String;)Ljava/lang/String; @@ -644,17 +650,6 @@ public final class space/kscience/kmath/misc/SymbolKt { public abstract interface annotation class space/kscience/kmath/misc/UnstableKMathAPI : java/lang/annotation/Annotation { } -public final class space/kscience/kmath/misc/XYPointSet$DefaultImpls { - public static fun get (Lspace/kscience/kmath/misc/XYPointSet;Lspace/kscience/kmath/misc/Symbol;)Lspace/kscience/kmath/structures/Buffer; -} - -public final class space/kscience/kmath/misc/XYPointSetKt { -} - -public final class space/kscience/kmath/misc/XYZPointSet$DefaultImpls { - public static fun get (Lspace/kscience/kmath/misc/XYZPointSet;Lspace/kscience/kmath/misc/Symbol;)Lspace/kscience/kmath/structures/Buffer; -} - public abstract interface class space/kscience/kmath/nd/AlgebraND { public static final field Companion Lspace/kscience/kmath/nd/AlgebraND$Companion; public abstract fun combine (Lspace/kscience/kmath/nd/StructureND;Lspace/kscience/kmath/nd/StructureND;Lkotlin/jvm/functions/Function3;)Lspace/kscience/kmath/nd/StructureND; diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/data/ColumnarData.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/data/ColumnarData.kt new file mode 100644 index 000000000..761255158 --- /dev/null +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/data/ColumnarData.kt @@ -0,0 +1,34 @@ +package space.kscience.kmath.data + +import space.kscience.kmath.misc.Symbol +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.nd.Structure2D +import space.kscience.kmath.structures.Buffer + +/** + * A column-based data set with all columns of the same size (not necessary fixed in time). + * The column could be retrieved by a [get] operation. + */ +@UnstableKMathAPI +public interface ColumnarData { + public val size: Int + + public operator fun get(symbol: Symbol): Buffer +} + +/** + * A zero-copy method to represent a [Structure2D] as a two-column x-y data. + * There could more than two columns in the structure. + */ +@UnstableKMathAPI +public fun Structure2D.asColumnarData(mapping: Map): ColumnarData { + require(shape[1] >= mapping.maxOf { it.value }) { "Column index out of bounds" } + return object : ColumnarData { + override val size: Int get() = shape[0] + override fun get(symbol: Symbol): Buffer { + val index = mapping[symbol] ?: error("No column mapping for symbol $symbol") + return columns[index] + } + } +} + diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/data/XYColumnarData.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/data/XYColumnarData.kt new file mode 100644 index 000000000..15239bca1 --- /dev/null +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/data/XYColumnarData.kt @@ -0,0 +1,55 @@ +package space.kscience.kmath.data + +import space.kscience.kmath.misc.Symbol +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.nd.Structure2D +import space.kscience.kmath.structures.Buffer +import kotlin.math.max + +/** + * The buffer of X values. + */ +@UnstableKMathAPI +public interface XYColumnarData : ColumnarData { + /** + * The buffer of X values + */ + public val x: Buffer + + /** + * The buffer of Y values. + */ + public val y: Buffer + + override fun get(symbol: Symbol): Buffer = when (symbol) { + Symbol.x -> x + Symbol.y -> y + else -> error("A column for symbol $symbol not found") + } +} + +@Suppress("FunctionName") +@UnstableKMathAPI +public fun XYColumnarData(x: Buffer, y: Buffer): XYColumnarData { + require(x.size == y.size) { "Buffer size mismatch. x buffer size is ${x.size}, y buffer size is ${y.size}" } + return object : XYColumnarData { + override val size: Int = x.size + override val x: Buffer = x + override val y: Buffer = y + } +} + + +/** + * A zero-copy method to represent a [Structure2D] as a two-column x-y data. + * There could more than two columns in the structure. + */ +@UnstableKMathAPI +public fun Structure2D.asXYData(xIndex: Int = 0, yIndex: Int = 1): XYColumnarData { + require(shape[1] >= max(xIndex, yIndex)) { "Column index out of bounds" } + return object : XYColumnarData { + override val size: Int get() = this@asXYData.shape[0] + override val x: Buffer get() = columns[xIndex] + override val y: Buffer get() = columns[yIndex] + } +} diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/data/XYZColumnarData.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/data/XYZColumnarData.kt new file mode 100644 index 000000000..f74c6e2d6 --- /dev/null +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/data/XYZColumnarData.kt @@ -0,0 +1,21 @@ +package space.kscience.kmath.data + +import space.kscience.kmath.misc.Symbol +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.structures.Buffer + +/** + * A [XYColumnarData] with guaranteed [x], [y] and [z] columns designated by corresponding symbols. + * Inherits [XYColumnarData]. + */ +@UnstableKMathAPI +public interface XYZColumnarData : XYColumnarData { + public val z: Buffer + + override fun get(symbol: Symbol): Buffer = when (symbol) { + Symbol.x -> x + Symbol.y -> y + Symbol.z -> z + else -> error("A column for symbol $symbol not found") + } +} \ No newline at end of file diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/ColumnarData.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/ColumnarData.kt deleted file mode 100644 index ed5a7e8f0..000000000 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/ColumnarData.kt +++ /dev/null @@ -1,15 +0,0 @@ -package space.kscience.kmath.misc - -import space.kscience.kmath.structures.Buffer - -/** - * A column-based data set with all columns of the same size (not necessary fixed in time). - * The column could be retrieved by a [get] operation. - */ -@UnstableKMathAPI -public interface ColumnarData { - public val size: Int - - public operator fun get(symbol: Symbol): Buffer -} - diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/XYPointSet.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/XYPointSet.kt deleted file mode 100644 index 51582974f..000000000 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/XYPointSet.kt +++ /dev/null @@ -1,98 +0,0 @@ -package space.kscience.kmath.misc - -import space.kscience.kmath.nd.Structure2D -import space.kscience.kmath.structures.Buffer - -/** - * Pair of associated buffers for X and Y axes values. - * - * @param X the type of X values. - * @param Y the type of Y values. - */ -public interface XYPointSet { - /** - * The size of all the involved buffers. - */ - public val size: Int - - /** - * The buffer of X values. - */ -@UnstableKMathAPI -public interface XYPointSet : ColumnarData { - public val x: Buffer - - /** - * The buffer of Y values. - */ - public val y: Buffer - - override fun get(symbol: Symbol): Buffer = when (symbol) { - Symbol.x -> x - Symbol.y -> y - else -> error("A column for symbol $symbol not found") - } -} - -/** - * Triple of associated buffers for X, Y, and Z axes values. - * - * @param X the type of X values. - * @param Y the type of Y values. - * @param Z the type of Z values. - */ -public interface XYZPointSet : XYPointSet { - /** - * The buffer of Z values. - */ -@UnstableKMathAPI -public interface XYZPointSet : XYPointSet { - public val z: Buffer - - override fun get(symbol: Symbol): Buffer = when (symbol) { - Symbol.x -> x - Symbol.y -> y - Symbol.z -> z - else -> error("A column for symbol $symbol not found") - } -} - -internal fun > insureSorted(points: XYPointSet) { - for (i in 0 until points.size - 1) - require(points.x[i + 1] > points.x[i]) { "Input data is not sorted at index $i" } -} - -public class NDStructureColumn(public val structure: Structure2D, public val column: Int) : Buffer { - public override val size: Int - get() = structure.rowNum - - init { - require(column < structure.colNum) { "Column index is outside of structure column range" } - } - - public override operator fun get(index: Int): T = structure[index, column] - public override operator fun iterator(): Iterator = sequence { repeat(size) { yield(get(it)) } }.iterator() -} - -@UnstableKMathAPI -public class BufferXYPointSet( - public override val x: Buffer, - public override val y: Buffer, -) : XYPointSet { - public override val size: Int get() = x.size - - init { - require(x.size == y.size) { "Sizes of x and y buffers should be the same" } - } -} - -@UnstableKMathAPI -public fun Structure2D.asXYPointSet(): XYPointSet { - require(shape[1] == 2) { "Structure second dimension should be of size 2" } - - return object : XYPointSet { - override val size: Int get() = this@asXYPointSet.shape[0] - override val x: Buffer get() = NDStructureColumn(this@asXYPointSet, 0) - override val y: Buffer get() = NDStructureColumn(this@asXYPointSet, 1) - } -} diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/Interpolator.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/Interpolator.kt index 864431d7a..9fad30abb 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/Interpolator.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/Interpolator.kt @@ -1,17 +1,17 @@ @file:OptIn(UnstableKMathAPI::class) + package space.kscience.kmath.interpolation +import space.kscience.kmath.data.XYColumnarData import space.kscience.kmath.functions.PiecewisePolynomial import space.kscience.kmath.functions.value -import space.kscience.kmath.misc.BufferXYPointSet import space.kscience.kmath.misc.UnstableKMathAPI -import space.kscience.kmath.misc.XYPointSet import space.kscience.kmath.operations.Ring import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.asBuffer public fun interface Interpolator { - public fun interpolate(points: XYPointSet): (X) -> Y + public fun interpolate(points: XYColumnarData): (X) -> Y } public interface PolynomialInterpolator> : Interpolator { @@ -19,9 +19,9 @@ public interface PolynomialInterpolator> : Interpolator): PiecewisePolynomial + public fun interpolatePolynomials(points: XYColumnarData): PiecewisePolynomial - override fun interpolate(points: XYPointSet): (T) -> T = { x -> + override fun interpolate(points: XYColumnarData): (T) -> T = { x -> interpolatePolynomials(points).value(algebra, x) ?: getDefaultValue() } } @@ -31,20 +31,20 @@ public fun > PolynomialInterpolator.interpolatePolynomials( x: Buffer, y: Buffer, ): PiecewisePolynomial { - val pointSet = BufferXYPointSet(x, y) + val pointSet = XYColumnarData(x, y) return interpolatePolynomials(pointSet) } public fun > PolynomialInterpolator.interpolatePolynomials( data: Map, ): PiecewisePolynomial { - val pointSet = BufferXYPointSet(data.keys.toList().asBuffer(), data.values.toList().asBuffer()) + val pointSet = XYColumnarData(data.keys.toList().asBuffer(), data.values.toList().asBuffer()) return interpolatePolynomials(pointSet) } public fun > PolynomialInterpolator.interpolatePolynomials( data: List>, ): PiecewisePolynomial { - val pointSet = BufferXYPointSet(data.map { it.first }.asBuffer(), data.map { it.second }.asBuffer()) + val pointSet = XYColumnarData(data.map { it.first }.asBuffer(), data.map { it.second }.asBuffer()) return interpolatePolynomials(pointSet) } diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/LinearInterpolator.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/LinearInterpolator.kt index 89a242ece..37d378ad0 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/LinearInterpolator.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/LinearInterpolator.kt @@ -1,15 +1,15 @@ package space.kscience.kmath.interpolation +import space.kscience.kmath.data.XYColumnarData import space.kscience.kmath.functions.OrderedPiecewisePolynomial import space.kscience.kmath.functions.PiecewisePolynomial import space.kscience.kmath.functions.Polynomial import space.kscience.kmath.misc.UnstableKMathAPI -import space.kscience.kmath.misc.XYPointSet import space.kscience.kmath.operations.Field import space.kscience.kmath.operations.invoke @OptIn(UnstableKMathAPI::class) -internal fun > insureSorted(points: XYPointSet<*, T, *>) { +internal fun > insureSorted(points: XYColumnarData<*, T, *>) { for (i in 0 until points.size - 1) require(points.x[i + 1] > points.x[i]) { "Input data is not sorted at index $i" } } @@ -19,7 +19,7 @@ internal fun > insureSorted(points: XYPointSet<*, T, *>) { */ public class LinearInterpolator>(public override val algebra: Field) : PolynomialInterpolator { @OptIn(UnstableKMathAPI::class) - public override fun interpolatePolynomials(points: XYPointSet): PiecewisePolynomial = algebra { + public override fun interpolatePolynomials(points: XYColumnarData): PiecewisePolynomial = algebra { require(points.size > 0) { "Point array should not be empty" } insureSorted(points) diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt index 0756e2901..3a3dfab59 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt @@ -1,10 +1,10 @@ package space.kscience.kmath.interpolation +import space.kscience.kmath.data.XYColumnarData import space.kscience.kmath.functions.OrderedPiecewisePolynomial import space.kscience.kmath.functions.PiecewisePolynomial import space.kscience.kmath.functions.Polynomial import space.kscience.kmath.misc.UnstableKMathAPI -import space.kscience.kmath.misc.XYPointSet import space.kscience.kmath.operations.Field import space.kscience.kmath.operations.invoke import space.kscience.kmath.structures.MutableBufferFactory @@ -23,7 +23,7 @@ public class SplineInterpolator>( //TODO possibly optimize zeroed buffers @OptIn(UnstableKMathAPI::class) - public override fun interpolatePolynomials(points: XYPointSet): PiecewisePolynomial = algebra { + public override fun interpolatePolynomials(points: XYColumnarData): PiecewisePolynomial = algebra { require(points.size >= 3) { "Can't use spline interpolator with less than 3 points" } insureSorted(points) // Number of intervals. The number of data points is n + 1. diff --git a/kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/DifferentiableMstExpression.kt b/kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/DifferentiableMstExpression.kt index fe27b7e4d..1275b0c90 100644 --- a/kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/DifferentiableMstExpression.kt +++ b/kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/DifferentiableMstExpression.kt @@ -18,8 +18,10 @@ import space.kscience.kmath.operations.NumericAlgebra * @param A the [NumericAlgebra] of [T]. * @property expr the underlying [MstExpression]. */ -public inline class DifferentiableMstExpression(public val expr: MstExpression) : - DifferentiableExpression> where A : NumericAlgebra, T : Number { +public inline class DifferentiableMstExpression( + public val expr: MstExpression, +) : DifferentiableExpression> where A : NumericAlgebra { + public constructor(algebra: A, mst: MST) : this(MstExpression(algebra, mst)) /** diff --git a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/DataFit.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/DataFit.kt deleted file mode 100644 index 70dd8417c..000000000 --- a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/DataFit.kt +++ /dev/null @@ -1,17 +0,0 @@ -package space.kscience.kmath.optimization - -import space.kscience.kmath.expressions.DifferentiableExpression -import space.kscience.kmath.misc.StringSymbol -import space.kscience.kmath.misc.Symbol -import space.kscience.kmath.structures.Buffer - -public interface DataFit : Optimization { - - public fun modelAndData( - x: Buffer, - y: Buffer, - yErr: Buffer, - model: DifferentiableExpression, - xSymbol: Symbol = StringSymbol("x"), - ) -} \ No newline at end of file diff --git a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/FunctionOptimization.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/FunctionOptimization.kt index 02aa9e9bb..528a5744e 100644 --- a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/FunctionOptimization.kt +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/FunctionOptimization.kt @@ -4,45 +4,31 @@ import space.kscience.kmath.expressions.AutoDiffProcessor import space.kscience.kmath.expressions.DifferentiableExpression import space.kscience.kmath.expressions.Expression import space.kscience.kmath.expressions.ExpressionAlgebra -import space.kscience.kmath.misc.StringSymbol import space.kscience.kmath.misc.Symbol import space.kscience.kmath.operations.ExtendedField import space.kscience.kmath.structures.Buffer import space.kscience.kmath.structures.indices -import kotlin.math.pow /** - * A likelihood function optimization problem + * A likelihood function optimization problem with provided derivatives */ -public interface FunctionOptimization: Optimization, DataFit { +public interface FunctionOptimization : Optimization { + /** + * The optimization direction. If true search for function maximum, if false, search for the minimum + */ + public var maximize: Boolean + /** * Define the initial guess for the optimization problem */ public fun initialGuess(map: Map) - /** - * Set an objective function expression - */ - public fun expression(expression: Expression) - /** * Set a differentiable expression as objective function as function and gradient provider */ - public fun diffExpression(expression: DifferentiableExpression>) + public fun diffFunction(expression: DifferentiableExpression>) - override fun modelAndData( - x: Buffer, - y: Buffer, - yErr: Buffer, - model: DifferentiableExpression, - xSymbol: Symbol, - ) { - require(x.size == y.size) { "X and y buffers should be of the same size" } - require(y.size == yErr.size) { "Y and yErr buffer should of the same size" } - - } - - public companion object{ + public companion object { /** * Generate a chi squared expression from given x-y-sigma data and inline model. Provides automatic differentiation */ @@ -70,46 +56,22 @@ public interface FunctionOptimization: Optimization, DataFit { sum } } - - /** - * Generate a chi squared expression from given x-y-sigma model represented by an expression. Does not provide derivatives - */ - public fun chiSquared( - x: Buffer, - y: Buffer, - yErr: Buffer, - model: Expression, - xSymbol: Symbol = StringSymbol("x"), - ): Expression { - require(x.size == y.size) { "X and y buffers should be of the same size" } - require(y.size == yErr.size) { "Y and yErr buffer should of the same size" } - - return Expression { arguments -> - x.indices.sumByDouble { - val xValue = x[it] - val yValue = y[it] - val yErrValue = yErr[it] - val modifiedArgs = arguments + (xSymbol to xValue) - val modelValue = model(modifiedArgs) - ((yValue - modelValue) / yErrValue).pow(2) - } - } - } } } /** - * Optimize expression without derivatives using specific [OptimizationProblemFactory] + * Define a chi-squared-based objective function */ -public fun > Expression.optimizeWith( - factory: OptimizationProblemFactory, - vararg symbols: Symbol, - configuration: F.() -> Unit, -): OptimizationResult { - require(symbols.isNotEmpty()) { "Must provide a list of symbols for optimization" } - val problem = factory(symbols.toList(), configuration) - problem.expression(this) - return problem.optimize() +public fun FunctionOptimization.chiSquared( + autoDiff: AutoDiffProcessor>, + x: Buffer, + y: Buffer, + yErr: Buffer, + model: A.(I) -> I, +) where A : ExtendedField, A : ExpressionAlgebra { + val chiSquared = FunctionOptimization.chiSquared(autoDiff, x, y, yErr, model) + diffFunction(chiSquared) + maximize = false } /** @@ -122,6 +84,6 @@ public fun > DifferentiableExpression { require(symbols.isNotEmpty()) { "Must provide a list of symbols for optimization" } val problem = factory(symbols.toList(), configuration) - problem.diffExpression(this) + problem.diffFunction(this) return problem.optimize() } diff --git a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/NoDerivFunctionOptimization.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/NoDerivFunctionOptimization.kt new file mode 100644 index 000000000..b8785dd8c --- /dev/null +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/NoDerivFunctionOptimization.kt @@ -0,0 +1,69 @@ +package space.kscience.kmath.optimization + +import space.kscience.kmath.expressions.Expression +import space.kscience.kmath.misc.Symbol +import space.kscience.kmath.structures.Buffer +import space.kscience.kmath.structures.indices +import kotlin.math.pow + +/** + * A likelihood function optimization problem + */ +public interface NoDerivFunctionOptimization : Optimization { + /** + * The optimization direction. If true search for function maximum, if false, search for the minimum + */ + public var maximize: Boolean + + /** + * Define the initial guess for the optimization problem + */ + public fun initialGuess(map: Map) + + /** + * Set an objective function expression + */ + public fun function(expression: Expression) + + public companion object { + /** + * Generate a chi squared expression from given x-y-sigma model represented by an expression. Does not provide derivatives + */ + public fun chiSquared( + x: Buffer, + y: Buffer, + yErr: Buffer, + model: Expression, + xSymbol: Symbol = Symbol.x, + ): Expression { + require(x.size == y.size) { "X and y buffers should be of the same size" } + require(y.size == yErr.size) { "Y and yErr buffer should of the same size" } + + return Expression { arguments -> + x.indices.sumByDouble { + val xValue = x[it] + val yValue = y[it] + val yErrValue = yErr[it] + val modifiedArgs = arguments + (xSymbol to xValue) + val modelValue = model(modifiedArgs) + ((yValue - modelValue) / yErrValue).pow(2) + } + } + } + } +} + + +/** + * Optimize expression without derivatives using specific [OptimizationProblemFactory] + */ +public fun > Expression.noDerivOptimizeWith( + factory: OptimizationProblemFactory, + vararg symbols: Symbol, + configuration: F.() -> Unit, +): OptimizationResult { + require(symbols.isNotEmpty()) { "Must provide a list of symbols for optimization" } + val problem = factory(symbols.toList(), configuration) + problem.function(this) + return problem.optimize() +} diff --git a/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/XYFit.kt b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/XYFit.kt new file mode 100644 index 000000000..c3106c819 --- /dev/null +++ b/kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/XYFit.kt @@ -0,0 +1,40 @@ +package space.kscience.kmath.optimization + +import space.kscience.kmath.data.ColumnarData +import space.kscience.kmath.expressions.AutoDiffProcessor +import space.kscience.kmath.expressions.DifferentiableExpression +import space.kscience.kmath.expressions.Expression +import space.kscience.kmath.expressions.ExpressionAlgebra +import space.kscience.kmath.misc.Symbol +import space.kscience.kmath.misc.UnstableKMathAPI +import space.kscience.kmath.operations.ExtendedField +import space.kscience.kmath.operations.Field + +@UnstableKMathAPI +public interface XYFit : Optimization { + + public val algebra: Field + + /** + * Set X-Y data for this fit optionally including x and y errors + */ + public fun data( + dataSet: ColumnarData, + xSymbol: Symbol, + ySymbol: Symbol, + xErrSymbol: Symbol? = null, + yErrSymbol: Symbol? = null, + ) + + public fun model(model: (T) -> DifferentiableExpression) + + /** + * Set the differentiable model for this fit + */ + public fun model( + autoDiff: AutoDiffProcessor>, + modelFunction: A.(I) -> I, + ): Unit where A : ExtendedField, A : ExpressionAlgebra = model { arg -> + autoDiff.process { modelFunction(const(arg)) } + } +} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index b4d7b3049..4467d5ed6 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -4,12 +4,11 @@ pluginManagement { mavenLocal() gradlePluginPortal() jcenter() - maven("https://dl.bintray.com/kotlin/kotlin-eap") maven("https://dl.bintray.com/kotlin/kotlinx") } - val toolsVersion = "0.9.1" - val kotlinVersion = "1.4.31" + val toolsVersion = "0.9.3" + val kotlinVersion = "1.4.32" plugins { id("kotlinx.benchmark") version "0.2.0-dev-20"