boost.cxx 0.0.2 → 1.90.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -2
- package/boost/cast.hpp +20 -0
- package/boost/numeric/conversion/bounds.hpp +24 -0
- package/boost/numeric/conversion/cast.hpp +61 -0
- package/boost/numeric/conversion/conversion_traits.hpp +32 -0
- package/boost/numeric/conversion/converter.hpp +68 -0
- package/boost/numeric/conversion/converter_policies.hpp +194 -0
- package/boost/numeric/conversion/detail/bounds.hpp +58 -0
- package/boost/numeric/conversion/detail/conversion_traits.hpp +97 -0
- package/boost/numeric/conversion/detail/converter.hpp +593 -0
- package/boost/numeric/conversion/detail/int_float_mixture.hpp +72 -0
- package/boost/numeric/conversion/detail/is_subranged.hpp +234 -0
- package/boost/numeric/conversion/detail/meta.hpp +120 -0
- package/boost/numeric/conversion/detail/numeric_cast_traits.hpp +138 -0
- package/boost/numeric/conversion/detail/old_numeric_cast.hpp +308 -0
- package/boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_common.hpp +1741 -0
- package/boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_long_long.hpp +347 -0
- package/boost/numeric/conversion/detail/sign_mixture.hpp +72 -0
- package/boost/numeric/conversion/detail/udt_builtin_mixture.hpp +69 -0
- package/boost/numeric/conversion/int_float_mixture.hpp +30 -0
- package/boost/numeric/conversion/int_float_mixture_enum.hpp +29 -0
- package/boost/numeric/conversion/is_subranged.hpp +27 -0
- package/boost/numeric/conversion/numeric_cast_traits.hpp +31 -0
- package/boost/numeric/conversion/sign_mixture.hpp +30 -0
- package/boost/numeric/conversion/sign_mixture_enum.hpp +29 -0
- package/boost/numeric/conversion/udt_builtin_mixture.hpp +28 -0
- package/boost/numeric/conversion/udt_builtin_mixture_enum.hpp +26 -0
- package/boost/numeric/interval/arith.hpp +305 -0
- package/boost/numeric/interval/arith2.hpp +304 -0
- package/boost/numeric/interval/arith3.hpp +69 -0
- package/boost/numeric/interval/checking.hpp +130 -0
- package/boost/numeric/interval/compare/certain.hpp +113 -0
- package/boost/numeric/interval/compare/explicit.hpp +248 -0
- package/boost/numeric/interval/compare/lexicographic.hpp +122 -0
- package/boost/numeric/interval/compare/possible.hpp +113 -0
- package/boost/numeric/interval/compare/set.hpp +101 -0
- package/boost/numeric/interval/compare/tribool.hpp +138 -0
- package/boost/numeric/interval/compare.hpp +19 -0
- package/boost/numeric/interval/constants.hpp +85 -0
- package/boost/numeric/interval/detail/alpha_rounding_control.hpp +113 -0
- package/boost/numeric/interval/detail/bcc_rounding_control.hpp +57 -0
- package/boost/numeric/interval/detail/bugs.hpp +48 -0
- package/boost/numeric/interval/detail/c99_rounding_control.hpp +50 -0
- package/boost/numeric/interval/detail/c99sub_rounding_control.hpp +43 -0
- package/boost/numeric/interval/detail/division.hpp +194 -0
- package/boost/numeric/interval/detail/ia64_rounding_control.hpp +83 -0
- package/boost/numeric/interval/detail/interval_prototype.hpp +41 -0
- package/boost/numeric/interval/detail/msvc_rounding_control.hpp +113 -0
- package/boost/numeric/interval/detail/ppc_rounding_control.hpp +99 -0
- package/boost/numeric/interval/detail/sparc_rounding_control.hpp +112 -0
- package/boost/numeric/interval/detail/test_input.hpp +76 -0
- package/boost/numeric/interval/detail/x86_rounding_control.hpp +108 -0
- package/boost/numeric/interval/detail/x86gcc_rounding_control.hpp +51 -0
- package/boost/numeric/interval/ext/integer.hpp +70 -0
- package/boost/numeric/interval/ext/x86_fast_rounding_control.hpp +70 -0
- package/boost/numeric/interval/hw_rounding.hpp +73 -0
- package/boost/numeric/interval/interval.hpp +450 -0
- package/boost/numeric/interval/io.hpp +41 -0
- package/boost/numeric/interval/limits.hpp +49 -0
- package/boost/numeric/interval/policies.hpp +75 -0
- package/boost/numeric/interval/rounded_arith.hpp +120 -0
- package/boost/numeric/interval/rounded_transc.hpp +140 -0
- package/boost/numeric/interval/rounding.hpp +101 -0
- package/boost/numeric/interval/transc.hpp +232 -0
- package/boost/numeric/interval/utility.hpp +335 -0
- package/boost/numeric/interval/utility_fwd.hpp +172 -0
- package/boost/numeric/interval.hpp +32 -0
- package/boost/numeric/odeint/algebra/algebra_dispatcher.hpp +86 -0
- package/boost/numeric/odeint/algebra/array_algebra.hpp +293 -0
- package/boost/numeric/odeint/algebra/default_operations.hpp +599 -0
- package/boost/numeric/odeint/algebra/detail/extract_value_type.hpp +51 -0
- package/boost/numeric/odeint/algebra/detail/for_each.hpp +165 -0
- package/boost/numeric/odeint/algebra/detail/macros.hpp +35 -0
- package/boost/numeric/odeint/algebra/detail/norm_inf.hpp +46 -0
- package/boost/numeric/odeint/algebra/fusion_algebra.hpp +216 -0
- package/boost/numeric/odeint/algebra/fusion_algebra_dispatcher.hpp +48 -0
- package/boost/numeric/odeint/algebra/multi_array_algebra.hpp +146 -0
- package/boost/numeric/odeint/algebra/norm_result_type.hpp +33 -0
- package/boost/numeric/odeint/algebra/operations_dispatcher.hpp +41 -0
- package/boost/numeric/odeint/algebra/range_algebra.hpp +142 -0
- package/boost/numeric/odeint/algebra/vector_space_algebra.hpp +175 -0
- package/boost/numeric/odeint/config.hpp +53 -0
- package/boost/numeric/odeint/external/blaze/blaze_algebra_dispatcher.hpp +55 -0
- package/boost/numeric/odeint/external/blaze/blaze_resize.hpp +64 -0
- package/boost/numeric/odeint/external/compute/compute.hpp +27 -0
- package/boost/numeric/odeint/external/compute/compute_algebra.hpp +65 -0
- package/boost/numeric/odeint/external/compute/compute_algebra_dispatcher.hpp +41 -0
- package/boost/numeric/odeint/external/compute/compute_operations.hpp +198 -0
- package/boost/numeric/odeint/external/compute/compute_operations_dispatcher.hpp +44 -0
- package/boost/numeric/odeint/external/compute/compute_resize.hpp +92 -0
- package/boost/numeric/odeint/external/eigen/eigen.hpp +27 -0
- package/boost/numeric/odeint/external/eigen/eigen_algebra.hpp +98 -0
- package/boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp +49 -0
- package/boost/numeric/odeint/external/eigen/eigen_resize.hpp +103 -0
- package/boost/numeric/odeint/external/gsl/gsl_wrapper.hpp +228 -0
- package/boost/numeric/odeint/external/mkl/mkl_operations.hpp +181 -0
- package/boost/numeric/odeint/external/mpi/mpi.hpp +25 -0
- package/boost/numeric/odeint/external/mpi/mpi_nested_algebra.hpp +62 -0
- package/boost/numeric/odeint/external/mpi/mpi_state.hpp +113 -0
- package/boost/numeric/odeint/external/mpi/mpi_vector_state.hpp +95 -0
- package/boost/numeric/odeint/external/mtl4/implicit_euler_mtl4.hpp +161 -0
- package/boost/numeric/odeint/external/mtl4/mtl4.hpp +23 -0
- package/boost/numeric/odeint/external/mtl4/mtl4_algebra_dispatcher.hpp +99 -0
- package/boost/numeric/odeint/external/mtl4/mtl4_resize.hpp +134 -0
- package/boost/numeric/odeint/external/nt2/nt2_algebra_dispatcher.hpp +25 -0
- package/boost/numeric/odeint/external/nt2/nt2_copy.hpp +33 -0
- package/boost/numeric/odeint/external/nt2/nt2_norm_inf.hpp +31 -0
- package/boost/numeric/odeint/external/nt2/nt2_resize.hpp +54 -0
- package/boost/numeric/odeint/external/openmp/openmp.hpp +31 -0
- package/boost/numeric/odeint/external/openmp/openmp_nested_algebra.hpp +281 -0
- package/boost/numeric/odeint/external/openmp/openmp_range_algebra.hpp +276 -0
- package/boost/numeric/odeint/external/openmp/openmp_state.hpp +172 -0
- package/boost/numeric/odeint/external/thrust/thrust.hpp +27 -0
- package/boost/numeric/odeint/external/thrust/thrust_algebra.hpp +217 -0
- package/boost/numeric/odeint/external/thrust/thrust_algebra_dispatcher.hpp +118 -0
- package/boost/numeric/odeint/external/thrust/thrust_operations.hpp +233 -0
- package/boost/numeric/odeint/external/thrust/thrust_operations_dispatcher.hpp +118 -0
- package/boost/numeric/odeint/external/thrust/thrust_resize.hpp +197 -0
- package/boost/numeric/odeint/external/vexcl/vexcl.hpp +28 -0
- package/boost/numeric/odeint/external/vexcl/vexcl_abs.hpp +61 -0
- package/boost/numeric/odeint/external/vexcl/vexcl_algebra_dispatcher.hpp +51 -0
- package/boost/numeric/odeint/external/vexcl/vexcl_copy.hpp +55 -0
- package/boost/numeric/odeint/external/vexcl/vexcl_norm_inf.hpp +68 -0
- package/boost/numeric/odeint/external/vexcl/vexcl_resize.hpp +96 -0
- package/boost/numeric/odeint/external/vexcl/vexcl_same_instance.hpp +58 -0
- package/boost/numeric/odeint/external/viennacl/viennacl_operations.hpp +226 -0
- package/boost/numeric/odeint/external/viennacl/viennacl_resize.hpp +68 -0
- package/boost/numeric/odeint/integrate/check_adapter.hpp +222 -0
- package/boost/numeric/odeint/integrate/detail/functors.hpp +70 -0
- package/boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp +161 -0
- package/boost/numeric/odeint/integrate/detail/integrate_const.hpp +167 -0
- package/boost/numeric/odeint/integrate/detail/integrate_n_steps.hpp +161 -0
- package/boost/numeric/odeint/integrate/detail/integrate_times.hpp +179 -0
- package/boost/numeric/odeint/integrate/integrate.hpp +133 -0
- package/boost/numeric/odeint/integrate/integrate_adaptive.hpp +127 -0
- package/boost/numeric/odeint/integrate/integrate_const.hpp +195 -0
- package/boost/numeric/odeint/integrate/integrate_n_steps.hpp +178 -0
- package/boost/numeric/odeint/integrate/integrate_times.hpp +220 -0
- package/boost/numeric/odeint/integrate/max_step_checker.hpp +114 -0
- package/boost/numeric/odeint/integrate/null_observer.hpp +38 -0
- package/boost/numeric/odeint/integrate/observer_collection.hpp +55 -0
- package/boost/numeric/odeint/iterator/adaptive_iterator.hpp +183 -0
- package/boost/numeric/odeint/iterator/adaptive_time_iterator.hpp +175 -0
- package/boost/numeric/odeint/iterator/const_step_iterator.hpp +180 -0
- package/boost/numeric/odeint/iterator/const_step_time_iterator.hpp +173 -0
- package/boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp +199 -0
- package/boost/numeric/odeint/iterator/impl/adaptive_iterator_impl.hpp +251 -0
- package/boost/numeric/odeint/iterator/impl/const_step_iterator_impl.hpp +228 -0
- package/boost/numeric/odeint/iterator/impl/n_step_iterator_impl.hpp +239 -0
- package/boost/numeric/odeint/iterator/impl/times_iterator_impl.hpp +369 -0
- package/boost/numeric/odeint/iterator/integrate/detail/functors.hpp +70 -0
- package/boost/numeric/odeint/iterator/integrate/detail/integrate_adaptive.hpp +121 -0
- package/boost/numeric/odeint/iterator/integrate/detail/integrate_const.hpp +111 -0
- package/boost/numeric/odeint/iterator/integrate/detail/integrate_n_steps.hpp +107 -0
- package/boost/numeric/odeint/iterator/integrate/detail/integrate_times.hpp +67 -0
- package/boost/numeric/odeint/iterator/integrate/integrate.hpp +111 -0
- package/boost/numeric/odeint/iterator/integrate/integrate_adaptive.hpp +127 -0
- package/boost/numeric/odeint/iterator/integrate/integrate_const.hpp +158 -0
- package/boost/numeric/odeint/iterator/integrate/integrate_n_steps.hpp +123 -0
- package/boost/numeric/odeint/iterator/integrate/integrate_times.hpp +131 -0
- package/boost/numeric/odeint/iterator/integrate/null_observer.hpp +38 -0
- package/boost/numeric/odeint/iterator/integrate/observer_collection.hpp +55 -0
- package/boost/numeric/odeint/iterator/n_step_iterator.hpp +168 -0
- package/boost/numeric/odeint/iterator/n_step_time_iterator.hpp +169 -0
- package/boost/numeric/odeint/iterator/times_iterator.hpp +189 -0
- package/boost/numeric/odeint/iterator/times_time_iterator.hpp +193 -0
- package/boost/numeric/odeint/stepper/adams_bashforth.hpp +418 -0
- package/boost/numeric/odeint/stepper/adams_bashforth_moulton.hpp +313 -0
- package/boost/numeric/odeint/stepper/adams_moulton.hpp +201 -0
- package/boost/numeric/odeint/stepper/adaptive_adams_bashforth_moulton.hpp +237 -0
- package/boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp +91 -0
- package/boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp +588 -0
- package/boost/numeric/odeint/stepper/base/explicit_error_stepper_fsal_base.hpp +677 -0
- package/boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp +415 -0
- package/boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp +431 -0
- package/boost/numeric/odeint/stepper/bulirsch_stoer.hpp +642 -0
- package/boost/numeric/odeint/stepper/bulirsch_stoer_dense_out.hpp +838 -0
- package/boost/numeric/odeint/stepper/controlled_adams_bashforth_moulton.hpp +322 -0
- package/boost/numeric/odeint/stepper/controlled_runge_kutta.hpp +1018 -0
- package/boost/numeric/odeint/stepper/controlled_step_result.hpp +42 -0
- package/boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp +476 -0
- package/boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp +148 -0
- package/boost/numeric/odeint/stepper/detail/adams_bashforth_coefficients.hpp +168 -0
- package/boost/numeric/odeint/stepper/detail/adams_moulton_call_algebra.hpp +148 -0
- package/boost/numeric/odeint/stepper/detail/adams_moulton_coefficients.hpp +168 -0
- package/boost/numeric/odeint/stepper/detail/adaptive_adams_coefficients.hpp +207 -0
- package/boost/numeric/odeint/stepper/detail/generic_rk_algorithm.hpp +247 -0
- package/boost/numeric/odeint/stepper/detail/generic_rk_call_algebra.hpp +263 -0
- package/boost/numeric/odeint/stepper/detail/generic_rk_operations.hpp +252 -0
- package/boost/numeric/odeint/stepper/detail/pid_step_adjuster.hpp +199 -0
- package/boost/numeric/odeint/stepper/detail/pid_step_adjuster_coefficients.hpp +180 -0
- package/boost/numeric/odeint/stepper/detail/rotating_buffer.hpp +84 -0
- package/boost/numeric/odeint/stepper/euler.hpp +166 -0
- package/boost/numeric/odeint/stepper/explicit_error_generic_rk.hpp +255 -0
- package/boost/numeric/odeint/stepper/explicit_generic_rk.hpp +246 -0
- package/boost/numeric/odeint/stepper/extrapolation_stepper.hpp +288 -0
- package/boost/numeric/odeint/stepper/generation/generation_controlled_adams_bashforth_moulton.hpp +59 -0
- package/boost/numeric/odeint/stepper/generation/generation_controlled_runge_kutta.hpp +61 -0
- package/boost/numeric/odeint/stepper/generation/generation_dense_output_runge_kutta.hpp +65 -0
- package/boost/numeric/odeint/stepper/generation/generation_rosenbrock4.hpp +79 -0
- package/boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54.hpp +47 -0
- package/boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54_classic.hpp +48 -0
- package/boost/numeric/odeint/stepper/generation/generation_runge_kutta_dopri5.hpp +56 -0
- package/boost/numeric/odeint/stepper/generation/generation_runge_kutta_fehlberg78.hpp +46 -0
- package/boost/numeric/odeint/stepper/generation/make_controlled.hpp +103 -0
- package/boost/numeric/odeint/stepper/generation/make_dense_output.hpp +100 -0
- package/boost/numeric/odeint/stepper/generation.hpp +37 -0
- package/boost/numeric/odeint/stepper/implicit_euler.hpp +170 -0
- package/boost/numeric/odeint/stepper/modified_midpoint.hpp +315 -0
- package/boost/numeric/odeint/stepper/rosenbrock4.hpp +346 -0
- package/boost/numeric/odeint/stepper/rosenbrock4_controller.hpp +240 -0
- package/boost/numeric/odeint/stepper/rosenbrock4_dense_output.hpp +204 -0
- package/boost/numeric/odeint/stepper/runge_kutta4.hpp +181 -0
- package/boost/numeric/odeint/stepper/runge_kutta4_classic.hpp +232 -0
- package/boost/numeric/odeint/stepper/runge_kutta_cash_karp54.hpp +231 -0
- package/boost/numeric/odeint/stepper/runge_kutta_cash_karp54_classic.hpp +289 -0
- package/boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp +403 -0
- package/boost/numeric/odeint/stepper/runge_kutta_fehlberg78.hpp +374 -0
- package/boost/numeric/odeint/stepper/stepper_categories.hpp +66 -0
- package/boost/numeric/odeint/stepper/symplectic_euler.hpp +136 -0
- package/boost/numeric/odeint/stepper/symplectic_rkn_sb3a_m4_mclachlan.hpp +160 -0
- package/boost/numeric/odeint/stepper/symplectic_rkn_sb3a_mclachlan.hpp +162 -0
- package/boost/numeric/odeint/stepper/velocity_verlet.hpp +375 -0
- package/boost/numeric/odeint/tools/assert.hpp +30 -0
- package/boost/numeric/odeint/tools/is_standalone.hpp +21 -0
- package/boost/numeric/odeint/tools/traits.hpp +39 -0
- package/boost/numeric/odeint/util/bind.hpp +35 -0
- package/boost/numeric/odeint/util/copy.hpp +88 -0
- package/boost/numeric/odeint/util/detail/is_range.hpp +127 -0
- package/boost/numeric/odeint/util/detail/less_with_sign.hpp +78 -0
- package/boost/numeric/odeint/util/is_pair.hpp +42 -0
- package/boost/numeric/odeint/util/is_resizeable.hpp +84 -0
- package/boost/numeric/odeint/util/multi_array_adaption.hpp +131 -0
- package/boost/numeric/odeint/util/n_ary_helper.hpp +96 -0
- package/boost/numeric/odeint/util/odeint_error.hpp +77 -0
- package/boost/numeric/odeint/util/resize.hpp +120 -0
- package/boost/numeric/odeint/util/resizer.hpp +94 -0
- package/boost/numeric/odeint/util/same_instance.hpp +56 -0
- package/boost/numeric/odeint/util/same_size.hpp +117 -0
- package/boost/numeric/odeint/util/split.hpp +64 -0
- package/boost/numeric/odeint/util/split_adaptor.hpp +103 -0
- package/boost/numeric/odeint/util/state_wrapper.hpp +50 -0
- package/boost/numeric/odeint/util/stepper_traits.hpp +63 -0
- package/boost/numeric/odeint/util/ublas_matrix_expression.patch +6 -0
- package/boost/numeric/odeint/util/ublas_wrapper.hpp +297 -0
- package/boost/numeric/odeint/util/unit_helper.hpp +151 -0
- package/boost/numeric/odeint/util/unwrap_reference.hpp +141 -0
- package/boost/numeric/odeint/version.hpp +55 -0
- package/boost/numeric/odeint.hpp +87 -0
- package/boost/numeric/ublas/assignment.hpp +1288 -0
- package/boost/numeric/ublas/banded.hpp +2372 -0
- package/boost/numeric/ublas/blas.hpp +499 -0
- package/boost/numeric/ublas/detail/concepts.hpp +1465 -0
- package/boost/numeric/ublas/detail/config.hpp +304 -0
- package/boost/numeric/ublas/detail/definitions.hpp +212 -0
- package/boost/numeric/ublas/detail/documentation.hpp +33 -0
- package/boost/numeric/ublas/detail/duff.hpp +56 -0
- package/boost/numeric/ublas/detail/iterator.hpp +1448 -0
- package/boost/numeric/ublas/detail/matrix_assign.hpp +1785 -0
- package/boost/numeric/ublas/detail/raw.hpp +878 -0
- package/boost/numeric/ublas/detail/returntype_deduction.hpp +174 -0
- package/boost/numeric/ublas/detail/temporary.hpp +33 -0
- package/boost/numeric/ublas/detail/vector_assign.hpp +609 -0
- package/boost/numeric/ublas/doxydoc.hpp +58 -0
- package/boost/numeric/ublas/exception.hpp +297 -0
- package/boost/numeric/ublas/experimental/sparse_view.hpp +317 -0
- package/boost/numeric/ublas/expression_types.hpp +506 -0
- package/boost/numeric/ublas/functional.hpp +2112 -0
- package/boost/numeric/ublas/fwd.hpp +229 -0
- package/boost/numeric/ublas/hermitian.hpp +2633 -0
- package/boost/numeric/ublas/io.hpp +355 -0
- package/boost/numeric/ublas/lu.hpp +350 -0
- package/boost/numeric/ublas/matrix.hpp +6013 -0
- package/boost/numeric/ublas/matrix_expression.hpp +5693 -0
- package/boost/numeric/ublas/matrix_proxy.hpp +5457 -0
- package/boost/numeric/ublas/matrix_sparse.hpp +5773 -0
- package/boost/numeric/ublas/matrix_vector.hpp +406 -0
- package/boost/numeric/ublas/opencl/elementwise.hpp +508 -0
- package/boost/numeric/ublas/opencl/library.hpp +38 -0
- package/boost/numeric/ublas/opencl/matrix.hpp +123 -0
- package/boost/numeric/ublas/opencl/misc.hpp +182 -0
- package/boost/numeric/ublas/opencl/operations.hpp +18 -0
- package/boost/numeric/ublas/opencl/prod.hpp +364 -0
- package/boost/numeric/ublas/opencl/transpose.hpp +142 -0
- package/boost/numeric/ublas/opencl/vector.hpp +90 -0
- package/boost/numeric/ublas/opencl.hpp +16 -0
- package/boost/numeric/ublas/operation/begin.hpp +318 -0
- package/boost/numeric/ublas/operation/c_array.hpp +41 -0
- package/boost/numeric/ublas/operation/end.hpp +318 -0
- package/boost/numeric/ublas/operation/num_columns.hpp +45 -0
- package/boost/numeric/ublas/operation/num_rows.hpp +44 -0
- package/boost/numeric/ublas/operation/size.hpp +350 -0
- package/boost/numeric/ublas/operation.hpp +830 -0
- package/boost/numeric/ublas/operation_blocked.hpp +266 -0
- package/boost/numeric/ublas/operation_sparse.hpp +198 -0
- package/boost/numeric/ublas/operations.hpp +26 -0
- package/boost/numeric/ublas/storage.hpp +2131 -0
- package/boost/numeric/ublas/storage_sparse.hpp +578 -0
- package/boost/numeric/ublas/symmetric.hpp +2309 -0
- package/boost/numeric/ublas/tags.hpp +37 -0
- package/boost/numeric/ublas/tensor/algorithms.hpp +345 -0
- package/boost/numeric/ublas/tensor/expression.hpp +181 -0
- package/boost/numeric/ublas/tensor/expression_evaluation.hpp +288 -0
- package/boost/numeric/ublas/tensor/extents.hpp +335 -0
- package/boost/numeric/ublas/tensor/functions.hpp +558 -0
- package/boost/numeric/ublas/tensor/index.hpp +89 -0
- package/boost/numeric/ublas/tensor/multi_index.hpp +110 -0
- package/boost/numeric/ublas/tensor/multi_index_utility.hpp +364 -0
- package/boost/numeric/ublas/tensor/multiplication.hpp +945 -0
- package/boost/numeric/ublas/tensor/operators_arithmetic.hpp +244 -0
- package/boost/numeric/ublas/tensor/operators_comparison.hpp +175 -0
- package/boost/numeric/ublas/tensor/ostream.hpp +122 -0
- package/boost/numeric/ublas/tensor/storage_traits.hpp +84 -0
- package/boost/numeric/ublas/tensor/strides.hpp +251 -0
- package/boost/numeric/ublas/tensor/tensor.hpp +734 -0
- package/boost/numeric/ublas/tensor.hpp +26 -0
- package/boost/numeric/ublas/traits/c_array.hpp +110 -0
- package/boost/numeric/ublas/traits/const_iterator_type.hpp +127 -0
- package/boost/numeric/ublas/traits/iterator_type.hpp +126 -0
- package/boost/numeric/ublas/traits.hpp +753 -0
- package/boost/numeric/ublas/triangular.hpp +2775 -0
- package/boost/numeric/ublas/vector.hpp +2947 -0
- package/boost/numeric/ublas/vector_expression.hpp +1762 -0
- package/boost/numeric/ublas/vector_of_vector.hpp +1347 -0
- package/boost/numeric/ublas/vector_proxy.hpp +1697 -0
- package/boost/numeric/ublas/vector_sparse.hpp +2246 -0
- package/package.json +3 -7
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
// Boost.uBLAS
|
|
2
|
+
//
|
|
3
|
+
// Copyright (c) 2018 Fady Essam
|
|
4
|
+
// Copyright (c) 2018 Stefan Seefeld
|
|
5
|
+
//
|
|
6
|
+
// Distributed under the Boost Software License, Version 1.0.
|
|
7
|
+
// (See accompanying file LICENSE_1_0.txt or
|
|
8
|
+
// copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
9
|
+
|
|
10
|
+
#ifndef boost_numeric_ublas_opencl_elementwise_hpp_
|
|
11
|
+
#define boost_numeric_ublas_opencl_elementwise_hpp_
|
|
12
|
+
|
|
13
|
+
#include <boost/numeric/ublas/opencl/library.hpp>
|
|
14
|
+
#include <boost/numeric/ublas/opencl/vector.hpp>
|
|
15
|
+
#include <boost/numeric/ublas/opencl/matrix.hpp>
|
|
16
|
+
|
|
17
|
+
namespace boost { namespace numeric { namespace ublas { namespace opencl {
|
|
18
|
+
|
|
19
|
+
namespace compute = boost::compute;
|
|
20
|
+
namespace lambda = boost::compute::lambda;
|
|
21
|
+
|
|
22
|
+
template <typename T, typename L1, typename L2, typename L3, class O>
|
|
23
|
+
void element_wise(ublas::matrix<T, L1, opencl::storage> const &a,
|
|
24
|
+
ublas::matrix<T, L2, opencl::storage> const &b,
|
|
25
|
+
ublas::matrix<T, L3, opencl::storage> &result,
|
|
26
|
+
O op, compute::command_queue& queue)
|
|
27
|
+
{
|
|
28
|
+
assert(a.device() == b.device() &&
|
|
29
|
+
a.device() == result.device() &&
|
|
30
|
+
a.device() == queue.get_device());
|
|
31
|
+
assert(a.size1() == b.size1() && a.size2() == b.size2());
|
|
32
|
+
|
|
33
|
+
compute::transform(a.begin(),
|
|
34
|
+
a.end(),
|
|
35
|
+
b.begin(),
|
|
36
|
+
result.begin(),
|
|
37
|
+
op,
|
|
38
|
+
queue);
|
|
39
|
+
queue.finish();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
template <typename T, typename L1, typename L2, typename L3, typename A, class O>
|
|
43
|
+
void element_wise(ublas::matrix<T, L1, A> const &a,
|
|
44
|
+
ublas::matrix<T, L2, A> const &b,
|
|
45
|
+
ublas::matrix<T, L3, A> &result,
|
|
46
|
+
O op,
|
|
47
|
+
compute::command_queue &queue)
|
|
48
|
+
{
|
|
49
|
+
ublas::matrix<T, L1, opencl::storage> adev(a, queue);
|
|
50
|
+
ublas::matrix<T, L2, opencl::storage> bdev(b, queue);
|
|
51
|
+
ublas::matrix<T, L3, opencl::storage> rdev(a.size1(), b.size2(), queue.get_context());
|
|
52
|
+
element_wise(adev, bdev, rdev, op, queue);
|
|
53
|
+
rdev.to_host(result, queue);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
template <typename T, typename L1, typename L2, typename A, typename O>
|
|
57
|
+
ublas::matrix<T, L1, A> element_wise(ublas::matrix<T, L1, A> const &a,
|
|
58
|
+
ublas::matrix<T, L2, A> const &b,
|
|
59
|
+
O op,
|
|
60
|
+
compute::command_queue &queue)
|
|
61
|
+
{
|
|
62
|
+
ublas::matrix<T, L1, A> result(a.size1(), b.size2());
|
|
63
|
+
element_wise(a, b, result, op, queue);
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
template <typename T, typename O>
|
|
68
|
+
void element_wise(ublas::vector<T, opencl::storage> const &a,
|
|
69
|
+
ublas::vector<T, opencl::storage> const &b,
|
|
70
|
+
ublas::vector<T, opencl::storage> &result,
|
|
71
|
+
O op,
|
|
72
|
+
compute::command_queue& queue)
|
|
73
|
+
{
|
|
74
|
+
assert(a.device() == b.device() &&
|
|
75
|
+
a.device() == result.device() &&
|
|
76
|
+
a.device() == queue.get_device());
|
|
77
|
+
assert(a.size() == b.size());
|
|
78
|
+
compute::transform(a.begin(),
|
|
79
|
+
a.end(),
|
|
80
|
+
b.begin(),
|
|
81
|
+
result.begin(),
|
|
82
|
+
op,
|
|
83
|
+
queue);
|
|
84
|
+
queue.finish();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
template <typename T, typename A, typename O>
|
|
88
|
+
void element_wise(ublas::vector<T, A> const &a,
|
|
89
|
+
ublas::vector<T, A> const &b,
|
|
90
|
+
ublas::vector<T, A>& result,
|
|
91
|
+
O op,
|
|
92
|
+
compute::command_queue &queue)
|
|
93
|
+
{
|
|
94
|
+
ublas::vector<T, opencl::storage> adev(a, queue);
|
|
95
|
+
ublas::vector<T, opencl::storage> bdev(b, queue);
|
|
96
|
+
ublas::vector<T, opencl::storage> rdev(a.size(), queue.get_context());
|
|
97
|
+
element_wise(adev, bdev, rdev, op, queue);
|
|
98
|
+
rdev.to_host(result, queue);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
template <typename T, typename A, typename O>
|
|
102
|
+
ublas::vector<T, A> element_wise(ublas::vector<T, A> const &a,
|
|
103
|
+
ublas::vector<T, A> const &b,
|
|
104
|
+
O op,
|
|
105
|
+
compute::command_queue &queue)
|
|
106
|
+
{
|
|
107
|
+
ublas::vector<T, A> result(a.size());
|
|
108
|
+
element_wise(a, b, result, op, queue);
|
|
109
|
+
return result;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
template <typename T, typename L1, typename L2, typename L3>
|
|
113
|
+
void element_add(ublas::matrix<T, L1, opencl::storage> const &a,
|
|
114
|
+
ublas::matrix<T, L2, opencl::storage> const &b,
|
|
115
|
+
ublas::matrix<T, L3, opencl::storage> &result,
|
|
116
|
+
compute::command_queue &queue)
|
|
117
|
+
{
|
|
118
|
+
element_wise(a, b, result, compute::plus<T>(), queue);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
template <typename T, typename L1, typename L2, typename L3, typename A>
|
|
122
|
+
void element_add(ublas::matrix<T, L1, A> const &a,
|
|
123
|
+
ublas::matrix<T, L2, A> const &b,
|
|
124
|
+
ublas::matrix<T, L3, A> &result,
|
|
125
|
+
compute::command_queue &queue)
|
|
126
|
+
{
|
|
127
|
+
element_wise(a, b, result, compute::plus<T>(), queue);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
template <typename T, typename L1, typename L2, typename A>
|
|
131
|
+
ublas::matrix<T, L1, A> element_add(ublas::matrix<T, L1, A> const &a,
|
|
132
|
+
ublas::matrix<T, L2, A> const &b,
|
|
133
|
+
compute::command_queue &queue)
|
|
134
|
+
{
|
|
135
|
+
return element_wise(a, b, compute::plus<T>(), queue);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
template <typename T>
|
|
139
|
+
void element_add(ublas::vector<T, opencl::storage> const &a,
|
|
140
|
+
ublas::vector<T, opencl::storage> const &b,
|
|
141
|
+
ublas::vector<T, opencl::storage> &result,
|
|
142
|
+
compute::command_queue& queue)
|
|
143
|
+
{
|
|
144
|
+
element_wise(a, b, result, compute::plus<T>(), queue);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
template <typename T, typename A>
|
|
148
|
+
void element_add(ublas::vector<T, A> const &a,
|
|
149
|
+
ublas::vector<T, A> const &b,
|
|
150
|
+
ublas::vector<T, A> &result,
|
|
151
|
+
compute::command_queue &queue)
|
|
152
|
+
{
|
|
153
|
+
element_wise(a, b, result, compute::plus<T>(), queue);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
template <typename T, typename A>
|
|
157
|
+
ublas::vector<T, A> element_add(ublas::vector<T, A> const &a,
|
|
158
|
+
ublas::vector<T, A> const &b,
|
|
159
|
+
compute::command_queue &queue)
|
|
160
|
+
{
|
|
161
|
+
return element_wise(a, b, compute::plus<T>(), queue);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
template<typename T, typename L>
|
|
165
|
+
void element_add(ublas::matrix<T, L, opencl::storage> const &m, T value,
|
|
166
|
+
ublas::matrix<T, L, opencl::storage> &result,
|
|
167
|
+
compute::command_queue& queue)
|
|
168
|
+
{
|
|
169
|
+
assert(m.device() == result.device() && m.device() == queue.get_device());
|
|
170
|
+
assert(m.size1() == result.size1() && m.size2() == result.size2());
|
|
171
|
+
compute::transform(m.begin(), m.end(), result.begin(), lambda::_1 + value, queue);
|
|
172
|
+
queue.finish();
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
template<typename T, typename L, typename A>
|
|
176
|
+
void element_add(ublas::matrix<T, L, A> const &m, T value,
|
|
177
|
+
ublas::matrix<T, L, A> &result,
|
|
178
|
+
compute::command_queue& queue)
|
|
179
|
+
{
|
|
180
|
+
ublas::matrix<T, L, opencl::storage> mdev(m, queue);
|
|
181
|
+
ublas::matrix<T, L, opencl::storage> rdev(result.size1(), result.size2(), queue.get_context());
|
|
182
|
+
element_add(mdev, value, rdev, queue);
|
|
183
|
+
rdev.to_host(result, queue);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
template<typename T, typename L, typename A>
|
|
187
|
+
ublas::matrix<T, L, A> element_add(ublas::matrix<T, L, A> const &m, T value,
|
|
188
|
+
compute::command_queue& queue)
|
|
189
|
+
{
|
|
190
|
+
ublas::matrix<T, L, A> result(m.size1(), m.size2());
|
|
191
|
+
element_add(m, value, result, queue);
|
|
192
|
+
return result;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
template<typename T>
|
|
196
|
+
void element_add(ublas::vector<T, opencl::storage> const &v, T value,
|
|
197
|
+
ublas::vector<T, opencl::storage> &result,
|
|
198
|
+
compute::command_queue& queue)
|
|
199
|
+
{
|
|
200
|
+
assert(v.device() == result.device() && v.device() == queue.get_device());
|
|
201
|
+
assert(v.size() == result.size());
|
|
202
|
+
compute::transform(v.begin(), v.end(), result.begin(), lambda::_1 + value, queue);
|
|
203
|
+
queue.finish();
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
template<typename T, typename A>
|
|
207
|
+
void element_add(ublas::vector<T, A> const &v, T value,
|
|
208
|
+
ublas::vector<T, A> &result,
|
|
209
|
+
compute::command_queue& queue)
|
|
210
|
+
{
|
|
211
|
+
ublas::vector<T, opencl::storage> vdev(v, queue);
|
|
212
|
+
ublas::vector<T, opencl::storage> rdev(v.size(), queue.get_context());
|
|
213
|
+
element_add(vdev, value, rdev, queue);
|
|
214
|
+
rdev.to_host(result, queue);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
template <typename T, typename A>
|
|
218
|
+
ublas::vector<T, A> element_add(ublas::vector<T, A> const &v, T value,
|
|
219
|
+
compute::command_queue& queue)
|
|
220
|
+
{
|
|
221
|
+
ublas::vector<T, A> result(v.size());
|
|
222
|
+
element_add(v, value, result, queue);
|
|
223
|
+
return result;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
template <typename T, typename L1, typename L2, typename L3>
|
|
227
|
+
void element_sub(ublas::matrix<T, L1, opencl::storage> const &a,
|
|
228
|
+
ublas::matrix<T, L2, opencl::storage> const &b,
|
|
229
|
+
ublas::matrix<T, L3, opencl::storage> &result,
|
|
230
|
+
compute::command_queue& queue)
|
|
231
|
+
{
|
|
232
|
+
element_wise(a, b, compute::minus<T>(), result, queue);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
template <typename T, typename L1, typename L2, typename L3, typename A>
|
|
236
|
+
void element_sub(ublas::matrix<T, L1, A> const &a,
|
|
237
|
+
ublas::matrix<T, L2, A> const &b,
|
|
238
|
+
ublas::matrix<T, L3, A> &result,
|
|
239
|
+
compute::command_queue &queue)
|
|
240
|
+
{
|
|
241
|
+
element_wise(a, b, result, compute::minus<T>(), queue);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
template <typename T, typename L1, typename L2, typename A>
|
|
245
|
+
ublas::matrix<T, L1, A> element_sub(ublas::matrix<T, L1, A> const &a,
|
|
246
|
+
ublas::matrix<T, L2, A> const &b,
|
|
247
|
+
compute::command_queue &queue)
|
|
248
|
+
{
|
|
249
|
+
return element_wise(a, b, compute::minus<T>(), queue);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
template <typename T>
|
|
253
|
+
void element_sub(ublas::vector<T, opencl::storage> const &a,
|
|
254
|
+
ublas::vector<T, opencl::storage> const &b,
|
|
255
|
+
ublas::vector<T, opencl::storage> &result,
|
|
256
|
+
compute::command_queue& queue)
|
|
257
|
+
{
|
|
258
|
+
element_wise(a, b, result, compute::minus<T>(), queue);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
template <typename T, typename A>
|
|
262
|
+
void element_sub(ublas::vector<T, A> const &a,
|
|
263
|
+
ublas::vector<T, A> const &b,
|
|
264
|
+
ublas::vector<T, A> &result,
|
|
265
|
+
compute::command_queue &queue)
|
|
266
|
+
{
|
|
267
|
+
element_wise(a, b, result, compute::minus<T>(), queue);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
template <typename T, typename A>
|
|
271
|
+
ublas::vector<T, A> element_sub(ublas::vector<T, A> const &a,
|
|
272
|
+
ublas::vector<T, A> const &b,
|
|
273
|
+
compute::command_queue &queue)
|
|
274
|
+
{
|
|
275
|
+
return element_wise(a, b, compute::minus<T>(), queue);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
template <typename T, typename L>
|
|
279
|
+
void element_sub(ublas::matrix<T, L, opencl::storage> const &m, T value,
|
|
280
|
+
ublas::matrix<T, L, opencl::storage> &result,
|
|
281
|
+
compute::command_queue& queue)
|
|
282
|
+
{
|
|
283
|
+
assert(m.device() == result.device() && m.device() == queue.get_device());
|
|
284
|
+
assert(m.size1() == result.size1() && m.size2() == result.size2());
|
|
285
|
+
compute::transform(m.begin(), m.end(), result.begin(), lambda::_1 - value, queue);
|
|
286
|
+
queue.finish();
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
template <typename T, typename L, typename A>
|
|
290
|
+
void element_sub(ublas::matrix<T, L, A> const &m, T value,
|
|
291
|
+
ublas::matrix<T, L, A> &result,
|
|
292
|
+
compute::command_queue& queue)
|
|
293
|
+
{
|
|
294
|
+
ublas::matrix<T, L, opencl::storage> mdev(m, queue);
|
|
295
|
+
ublas::matrix<T, L, opencl::storage> rdev(result.size1(), result.size2(), queue.get_context());
|
|
296
|
+
element_sub(mdev, value, rdev, queue);
|
|
297
|
+
rdev.to_host(result, queue);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
template <typename T, typename L, typename A>
|
|
301
|
+
ublas::matrix<T, L, A> element_sub(ublas::matrix<T, L, A> const &m, T value,
|
|
302
|
+
compute::command_queue& queue)
|
|
303
|
+
{
|
|
304
|
+
ublas::matrix<T, L, A> result(m.size1(), m.size2());
|
|
305
|
+
element_sub(m, value, result, queue);
|
|
306
|
+
return result;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
template <typename T>
|
|
310
|
+
void element_sub(ublas::vector<T, opencl::storage> const &v, T value,
|
|
311
|
+
ublas::vector<T, opencl::storage> &result,
|
|
312
|
+
compute::command_queue& queue)
|
|
313
|
+
{
|
|
314
|
+
assert(v.device() == result.device() && v.device() == queue.get_device());
|
|
315
|
+
assert(v.size() == result.size());
|
|
316
|
+
compute::transform(v.begin(), v.end(), result.begin(), lambda::_1 - value, queue);
|
|
317
|
+
queue.finish();
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
template <typename T, typename A>
|
|
321
|
+
void element_sub(ublas::vector<T, A> const &v, T value,
|
|
322
|
+
ublas::vector<T, A> &result,
|
|
323
|
+
compute::command_queue& queue)
|
|
324
|
+
{
|
|
325
|
+
ublas::vector<T, opencl::storage> vdev(v, queue);
|
|
326
|
+
ublas::vector<T, opencl::storage> rdev(v.size(), queue.get_context());
|
|
327
|
+
element_sub(vdev, value, rdev, queue);
|
|
328
|
+
rdev.to_host(result, queue);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
template <typename T, typename A>
|
|
332
|
+
ublas::vector<T, A> element_sub(ublas::vector<T, A> const &v, T value,
|
|
333
|
+
compute::command_queue& queue)
|
|
334
|
+
{
|
|
335
|
+
ublas::vector<T, A> result(v.size());
|
|
336
|
+
element_sub(v, value, result, queue);
|
|
337
|
+
return result;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
template <typename T, typename L1, typename L2, typename L3>
|
|
341
|
+
void element_prod(ublas::matrix<T, L1, opencl::storage> const &a,
|
|
342
|
+
ublas::matrix<T, L2, opencl::storage> const &b,
|
|
343
|
+
ublas::matrix<T, L3, opencl::storage> &result,
|
|
344
|
+
compute::command_queue& queue)
|
|
345
|
+
{
|
|
346
|
+
element_wise(a, b, result, compute::multiplies<T>(), queue);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
template <typename T, typename L1, typename L2, typename L3, typename A>
|
|
350
|
+
void element_prod(ublas::matrix<T, L1, A> const &a,
|
|
351
|
+
ublas::matrix<T, L2, A> const &b,
|
|
352
|
+
ublas::matrix<T, L3, A> &result,
|
|
353
|
+
compute::command_queue &queue)
|
|
354
|
+
{
|
|
355
|
+
element_wise(a, b, result, compute::multiplies<T>(), queue);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
template <typename T, typename L1, typename L2, typename A>
|
|
359
|
+
ublas::matrix<T, L1, A> element_prod(ublas::matrix<T, L1, A> const &a,
|
|
360
|
+
ublas::matrix<T, L2, A> const &b,
|
|
361
|
+
compute::command_queue &queue)
|
|
362
|
+
{
|
|
363
|
+
return element_wise(a, b, compute::multiplies<T>(), queue);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
template <typename T>
|
|
367
|
+
void element_prod(ublas::vector<T, opencl::storage> const &a,
|
|
368
|
+
ublas::vector<T, opencl::storage> const &b,
|
|
369
|
+
ublas::vector<T, opencl::storage> &result,
|
|
370
|
+
compute::command_queue& queue)
|
|
371
|
+
{
|
|
372
|
+
element_wise(a, b, result, compute::multiplies<T>(), queue);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
template <typename T, typename A>
|
|
376
|
+
void element_prod(ublas::vector<T, A> const &a,
|
|
377
|
+
ublas::vector<T, A> const &b,
|
|
378
|
+
ublas::vector<T, A> &result,
|
|
379
|
+
compute::command_queue &queue)
|
|
380
|
+
{
|
|
381
|
+
element_wise(a, b, result, compute::multiplies<T>(), queue);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
template <typename T, typename A>
|
|
385
|
+
ublas::vector<T, A> element_prod(ublas::vector<T, A> const &a,
|
|
386
|
+
ublas::vector<T, A> const &b,
|
|
387
|
+
compute::command_queue &queue)
|
|
388
|
+
{
|
|
389
|
+
return element_wise(a, b, compute::multiplies<T>(), queue);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
template <typename T, typename L>
|
|
393
|
+
void element_scale(ublas::matrix<T, L, opencl::storage> const &m, T value,
|
|
394
|
+
ublas::matrix<T, L, opencl::storage> &result,
|
|
395
|
+
compute::command_queue& queue)
|
|
396
|
+
{
|
|
397
|
+
assert(m.device() == result.device() && m.device() == queue.get_device());
|
|
398
|
+
assert(m.size1() == result.size1() && m.size2() == result.size2());
|
|
399
|
+
compute::transform(m.begin(), m.end(), result.begin(), lambda::_1 * value, queue);
|
|
400
|
+
queue.finish();
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
template <typename T, typename L, typename A>
|
|
404
|
+
void element_scale(ublas::matrix<T, L, A> const &m, T value,
|
|
405
|
+
ublas::matrix<T, L, A> &result,
|
|
406
|
+
compute::command_queue& queue)
|
|
407
|
+
{
|
|
408
|
+
ublas::matrix<T, L, opencl::storage> mdev(m, queue);
|
|
409
|
+
ublas::matrix<T, L, opencl::storage> rdev(result.size1(), result.size2(), queue.get_context());
|
|
410
|
+
element_scale(mdev, value, rdev, queue);
|
|
411
|
+
rdev.to_host(result, queue);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
template <typename T, typename L, typename A>
|
|
415
|
+
ublas::matrix<T, L, A> element_scale(ublas::matrix<T, L, A> const &m, T value,
|
|
416
|
+
compute::command_queue& queue)
|
|
417
|
+
{
|
|
418
|
+
ublas::matrix<T, L, A> result(m.size1(), m.size2());
|
|
419
|
+
element_scale(m, value, result, queue);
|
|
420
|
+
return result;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
template <typename T>
|
|
424
|
+
void element_scale(ublas::vector<T, opencl::storage> const &v, T value,
|
|
425
|
+
ublas::vector<T, opencl::storage> &result,
|
|
426
|
+
compute::command_queue& queue)
|
|
427
|
+
{
|
|
428
|
+
assert(v.device() == result.device() && v.device() == queue.get_device());
|
|
429
|
+
assert(v.size() == result.size());
|
|
430
|
+
compute::transform(v.begin(), v.end(), result.begin(), lambda::_1 * value, queue);
|
|
431
|
+
queue.finish();
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
template <typename T, typename A>
|
|
435
|
+
void element_scale(ublas::vector<T, A> const &v, T value,
|
|
436
|
+
ublas::vector<T, A> & result,
|
|
437
|
+
compute::command_queue& queue)
|
|
438
|
+
{
|
|
439
|
+
ublas::vector<T, opencl::storage> vdev(v, queue);
|
|
440
|
+
ublas::vector<T, opencl::storage> rdev(v.size(), queue.get_context());
|
|
441
|
+
element_scale(vdev, value, rdev, queue);
|
|
442
|
+
rdev.to_host(result, queue);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
template <typename T, typename A>
|
|
446
|
+
ublas::vector<T,A> element_scale(ublas::vector<T, A> const &v, T value,
|
|
447
|
+
compute::command_queue& queue)
|
|
448
|
+
{
|
|
449
|
+
ublas::vector<T, A> result(v.size());
|
|
450
|
+
element_scale(v, value, result, queue);
|
|
451
|
+
return result;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
template <typename T, typename L1, typename L2, typename L3>
|
|
455
|
+
void element_div(ublas::matrix<T, L1, opencl::storage> const &a,
|
|
456
|
+
ublas::matrix<T, L2, opencl::storage> const &b,
|
|
457
|
+
ublas::matrix<T, L3, opencl::storage> &result,
|
|
458
|
+
compute::command_queue& queue)
|
|
459
|
+
{
|
|
460
|
+
element_wise(a, b, result, compute::divides<T>(), queue);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
template <typename T, typename L1, typename L2, typename L3, typename A>
|
|
464
|
+
void element_div(ublas::matrix<T, L1, A> const &a,
|
|
465
|
+
ublas::matrix<T, L2, A> const &b,
|
|
466
|
+
ublas::matrix<T, L3, A> &result,
|
|
467
|
+
compute::command_queue &queue)
|
|
468
|
+
{
|
|
469
|
+
element_wise(a, b, result, compute::divides<T>(), queue);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
template <typename T, typename L1, typename L2, typename A>
|
|
473
|
+
ublas::matrix<T, L1, A> element_div(ublas::matrix<T, L1, A> const &a,
|
|
474
|
+
ublas::matrix<T, L2, A> const &b,
|
|
475
|
+
compute::command_queue &queue)
|
|
476
|
+
{
|
|
477
|
+
return element_wise(a, b, compute::divides<T>(), queue);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
template <typename T>
|
|
481
|
+
void element_div(ublas::vector<T, opencl::storage> const &a,
|
|
482
|
+
ublas::vector<T, opencl::storage> const &b,
|
|
483
|
+
ublas::vector<T, opencl::storage> &result,
|
|
484
|
+
compute::command_queue& queue)
|
|
485
|
+
{
|
|
486
|
+
element_wise(a, b, result, compute::divides<T>(), queue);
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
template <typename T, typename A>
|
|
490
|
+
void element_div(ublas::vector<T, A> const &a,
|
|
491
|
+
ublas::vector<T, A> const &b,
|
|
492
|
+
ublas::vector<T, A> &result,
|
|
493
|
+
compute::command_queue &queue)
|
|
494
|
+
{
|
|
495
|
+
element_wise(a, b, result, compute::divides<T>(), queue);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
template <typename T, typename A>
|
|
499
|
+
ublas::vector<T, A> element_div(ublas::vector<T, A> const &a,
|
|
500
|
+
ublas::vector<T, A> const &b,
|
|
501
|
+
compute::command_queue &queue)
|
|
502
|
+
{
|
|
503
|
+
return element_wise(a, b, compute::divides<T>(), queue);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
}}}}
|
|
507
|
+
|
|
508
|
+
#endif
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Boost.uBLAS
|
|
2
|
+
//
|
|
3
|
+
// Copyright (c) 2018 Fady Essam
|
|
4
|
+
// Copyright (c) 2018 Stefan Seefeld
|
|
5
|
+
//
|
|
6
|
+
// Distributed under the Boost Software License, Version 1.0.
|
|
7
|
+
// (See accompanying file LICENSE_1_0.txt or
|
|
8
|
+
// copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
9
|
+
|
|
10
|
+
#ifndef boost_numeric_ublas_opencl_library_hpp_
|
|
11
|
+
#define boost_numeric_ublas_opencl_library_hpp_
|
|
12
|
+
|
|
13
|
+
#include <clBLAS.h>
|
|
14
|
+
#include <type_traits>
|
|
15
|
+
#include <complex>
|
|
16
|
+
|
|
17
|
+
namespace boost { namespace numeric { namespace ublas { namespace opencl {
|
|
18
|
+
|
|
19
|
+
class library
|
|
20
|
+
{
|
|
21
|
+
public:
|
|
22
|
+
library() { clblasSetup();}
|
|
23
|
+
~library() { clblasTeardown();}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
template <typename T>
|
|
27
|
+
struct is_numeric
|
|
28
|
+
{
|
|
29
|
+
static bool const value =
|
|
30
|
+
std::is_same<T, float>::value |
|
|
31
|
+
std::is_same<T, double>::value |
|
|
32
|
+
std::is_same<T, std::complex<float>>::value |
|
|
33
|
+
std::is_same<T, std::complex<double>>::value;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
}}}}
|
|
37
|
+
|
|
38
|
+
#endif
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// Boost.uBLAS
|
|
2
|
+
//
|
|
3
|
+
// Copyright (c) 2018 Fady Essam
|
|
4
|
+
// Copyright (c) 2018 Stefan Seefeld
|
|
5
|
+
//
|
|
6
|
+
// Distributed under the Boost Software License, Version 1.0.
|
|
7
|
+
// (See accompanying file LICENSE_1_0.txt or
|
|
8
|
+
// copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
9
|
+
|
|
10
|
+
#ifndef boost_numeric_ublas_opencl_matrix_hpp_
|
|
11
|
+
#define boost_numeric_ublas_opencl_matrix_hpp_
|
|
12
|
+
|
|
13
|
+
#include <boost/numeric/ublas/opencl/library.hpp>
|
|
14
|
+
#include <boost/numeric/ublas/matrix.hpp>
|
|
15
|
+
#include <boost/numeric/ublas/functional.hpp>
|
|
16
|
+
#include <boost/compute/core.hpp>
|
|
17
|
+
#include <boost/compute/algorithm.hpp>
|
|
18
|
+
#include <boost/compute/buffer.hpp>
|
|
19
|
+
|
|
20
|
+
namespace boost { namespace numeric { namespace ublas { namespace opencl {
|
|
21
|
+
|
|
22
|
+
class storage;
|
|
23
|
+
|
|
24
|
+
namespace compute = boost::compute;
|
|
25
|
+
|
|
26
|
+
} // namespace opencl
|
|
27
|
+
|
|
28
|
+
template<class T, class L>
|
|
29
|
+
class matrix<T, L, opencl::storage> : public matrix_container<matrix<T, L, opencl::storage> >
|
|
30
|
+
{
|
|
31
|
+
typedef typename boost::compute::buffer_allocator<T>::size_type size_type;
|
|
32
|
+
typedef L layout_type;
|
|
33
|
+
typedef matrix<T, L, opencl::storage> self_type;
|
|
34
|
+
public:
|
|
35
|
+
matrix()
|
|
36
|
+
: matrix_container<self_type>(),
|
|
37
|
+
size1_(0), size2_(0), data_() , device_()
|
|
38
|
+
{}
|
|
39
|
+
|
|
40
|
+
matrix(size_type size1, size_type size2, compute::context c)
|
|
41
|
+
: matrix_container<self_type>(),
|
|
42
|
+
size1_(size1), size2_(size2), device_(c.get_device())
|
|
43
|
+
{
|
|
44
|
+
compute::buffer_allocator<T> allocator(c);
|
|
45
|
+
data_ = allocator.allocate(layout_type::storage_size(size1, size2)).get_buffer();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
matrix(size_type size1, size_type size2, T const &value, compute::command_queue &q)
|
|
49
|
+
: matrix_container<self_type>(),
|
|
50
|
+
size1_(size1), size2_(size2), device_(q.get_device())
|
|
51
|
+
{
|
|
52
|
+
compute::buffer_allocator<T> allocator(q.get_context());
|
|
53
|
+
data_ = allocator.allocate(layout_type::storage_size(size1, size2)).get_buffer();
|
|
54
|
+
compute::fill(this->begin(), this->end(), value, q);
|
|
55
|
+
q.finish();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
template <typename A>
|
|
59
|
+
matrix(matrix<T, L, A> const &m, compute::command_queue &queue)
|
|
60
|
+
: matrix(m.size1(), m.size2(), queue.get_context())
|
|
61
|
+
{
|
|
62
|
+
this->from_host(m, queue);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
size_type size1() const { return size1_;}
|
|
66
|
+
size_type size2() const { return size2_;}
|
|
67
|
+
|
|
68
|
+
const compute::buffer_iterator<T> begin() const { return compute::make_buffer_iterator<T>(data_);}
|
|
69
|
+
compute::buffer_iterator<T> begin() { return compute::make_buffer_iterator<T>(data_);}
|
|
70
|
+
|
|
71
|
+
compute::buffer_iterator<T> end() { return compute::make_buffer_iterator<T>(data_, layout_type::storage_size(size1_, size2_));}
|
|
72
|
+
const compute::buffer_iterator<T> end() const { return compute::make_buffer_iterator<T>(data_, layout_type::storage_size(size1_, size2_));}
|
|
73
|
+
|
|
74
|
+
const compute::device &device() const { return device_;}
|
|
75
|
+
compute::device &device() { return device_;}
|
|
76
|
+
|
|
77
|
+
void fill(T value, compute::command_queue &queue)
|
|
78
|
+
{
|
|
79
|
+
assert(device_ == queue.get_device());
|
|
80
|
+
compute::fill(this->begin(), this->end(), value, queue);
|
|
81
|
+
queue.finish();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Copies a matrix to a device
|
|
85
|
+
* \param m is a matrix that is not on the device _device and it is copied to it
|
|
86
|
+
* \param queue is the command queue that will execute the operation
|
|
87
|
+
*/
|
|
88
|
+
template<class A>
|
|
89
|
+
void from_host(ublas::matrix<T, L, A> const &m, compute::command_queue &queue)
|
|
90
|
+
{
|
|
91
|
+
assert(device_ == queue.get_device());
|
|
92
|
+
compute::copy(m.data().begin(),
|
|
93
|
+
m.data().end(),
|
|
94
|
+
this->begin(),
|
|
95
|
+
queue);
|
|
96
|
+
queue.finish();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Copies a matrix from a device
|
|
100
|
+
* \param m is a matrix that will be reized to (size1_,size2) and the values of (*this) will be copied in it
|
|
101
|
+
* \param queue is the command queue that will execute the operation
|
|
102
|
+
*/
|
|
103
|
+
template<class A>
|
|
104
|
+
void to_host(ublas::matrix<T, L, A> &m, compute::command_queue &queue) const
|
|
105
|
+
{
|
|
106
|
+
assert(device_ == queue.get_device());
|
|
107
|
+
compute::copy(this->begin(),
|
|
108
|
+
this->end(),
|
|
109
|
+
m.data().begin(),
|
|
110
|
+
queue);
|
|
111
|
+
queue.finish();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private:
|
|
115
|
+
size_type size1_;
|
|
116
|
+
size_type size2_;
|
|
117
|
+
compute::buffer data_;
|
|
118
|
+
compute::device device_;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
}}}
|
|
122
|
+
|
|
123
|
+
#endif
|