sequenzo 0.1.21__cp311-cp311-macosx_11_0_arm64.whl
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.
Potentially problematic release.
This version of sequenzo might be problematic. Click here for more details.
- sequenzo/__init__.py +240 -0
- sequenzo/big_data/__init__.py +12 -0
- sequenzo/big_data/clara/__init__.py +26 -0
- sequenzo/big_data/clara/clara.py +467 -0
- sequenzo/big_data/clara/utils/__init__.py +27 -0
- sequenzo/big_data/clara/utils/aggregatecases.py +92 -0
- sequenzo/big_data/clara/utils/davies_bouldin.py +91 -0
- sequenzo/big_data/clara/utils/get_weighted_diss.cpython-311-darwin.so +0 -0
- sequenzo/big_data/clara/utils/wfcmdd.py +205 -0
- sequenzo/big_data/clara/visualization.py +88 -0
- sequenzo/clustering/KMedoids.py +196 -0
- sequenzo/clustering/__init__.py +30 -0
- sequenzo/clustering/clustering_c_code.cpython-311-darwin.so +0 -0
- sequenzo/clustering/hierarchical_clustering.py +1380 -0
- sequenzo/clustering/src/KMedoid.cpp +262 -0
- sequenzo/clustering/src/PAM.cpp +236 -0
- sequenzo/clustering/src/PAMonce.cpp +234 -0
- sequenzo/clustering/src/cluster_quality.cpp +496 -0
- sequenzo/clustering/src/cluster_quality.h +128 -0
- sequenzo/clustering/src/cluster_quality_backup.cpp +570 -0
- sequenzo/clustering/src/module.cpp +228 -0
- sequenzo/clustering/src/weightedinertia.cpp +111 -0
- sequenzo/clustering/utils/__init__.py +27 -0
- sequenzo/clustering/utils/disscenter.py +122 -0
- sequenzo/data_preprocessing/__init__.py +20 -0
- sequenzo/data_preprocessing/helpers.py +256 -0
- sequenzo/datasets/__init__.py +41 -0
- sequenzo/datasets/biofam.csv +2001 -0
- sequenzo/datasets/biofam_child_domain.csv +2001 -0
- sequenzo/datasets/biofam_left_domain.csv +2001 -0
- sequenzo/datasets/biofam_married_domain.csv +2001 -0
- sequenzo/datasets/chinese_colonial_territories.csv +12 -0
- sequenzo/datasets/country_co2_emissions.csv +194 -0
- sequenzo/datasets/country_co2_emissions_global_deciles.csv +195 -0
- sequenzo/datasets/country_co2_emissions_global_quintiles.csv +195 -0
- sequenzo/datasets/country_co2_emissions_local_deciles.csv +195 -0
- sequenzo/datasets/country_co2_emissions_local_quintiles.csv +195 -0
- sequenzo/datasets/country_gdp_per_capita.csv +194 -0
- sequenzo/datasets/mvad.csv +713 -0
- sequenzo/datasets/pairfam_family.csv +1867 -0
- sequenzo/datasets/polyadic_samplec1.csv +61 -0
- sequenzo/datasets/polyadic_samplep1.csv +61 -0
- sequenzo/datasets/polyadic_seqc1.csv +61 -0
- sequenzo/datasets/polyadic_seqp1.csv +61 -0
- sequenzo/define_sequence_data.py +609 -0
- sequenzo/dissimilarity_measures/__init__.py +31 -0
- sequenzo/dissimilarity_measures/c_code.cpython-311-darwin.so +0 -0
- sequenzo/dissimilarity_measures/get_distance_matrix.py +702 -0
- sequenzo/dissimilarity_measures/get_substitution_cost_matrix.py +241 -0
- sequenzo/dissimilarity_measures/src/DHDdistance.cpp +148 -0
- sequenzo/dissimilarity_measures/src/LCPdistance.cpp +114 -0
- sequenzo/dissimilarity_measures/src/OMdistance.cpp +247 -0
- sequenzo/dissimilarity_measures/src/OMspellDistance.cpp +281 -0
- sequenzo/dissimilarity_measures/src/__init__.py +0 -0
- sequenzo/dissimilarity_measures/src/dist2matrix.cpp +63 -0
- sequenzo/dissimilarity_measures/src/dp_utils.h +160 -0
- sequenzo/dissimilarity_measures/src/module.cpp +34 -0
- sequenzo/dissimilarity_measures/src/setup.py +30 -0
- sequenzo/dissimilarity_measures/src/utils.h +25 -0
- sequenzo/dissimilarity_measures/src/xsimd/.github/cmake-test/main.cpp +6 -0
- sequenzo/dissimilarity_measures/src/xsimd/benchmark/main.cpp +159 -0
- sequenzo/dissimilarity_measures/src/xsimd/benchmark/xsimd_benchmark.hpp +565 -0
- sequenzo/dissimilarity_measures/src/xsimd/docs/source/conf.py +37 -0
- sequenzo/dissimilarity_measures/src/xsimd/examples/mandelbrot.cpp +330 -0
- sequenzo/dissimilarity_measures/src/xsimd/examples/pico_bench.hpp +246 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/common/xsimd_common_arithmetic.hpp +266 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/common/xsimd_common_complex.hpp +112 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/common/xsimd_common_details.hpp +323 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/common/xsimd_common_logical.hpp +218 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/common/xsimd_common_math.hpp +2583 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/common/xsimd_common_memory.hpp +880 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/common/xsimd_common_rounding.hpp +72 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/common/xsimd_common_swizzle.hpp +174 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/common/xsimd_common_trigo.hpp +978 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_avx.hpp +1924 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_avx2.hpp +1144 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_avx512bw.hpp +656 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_avx512cd.hpp +28 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_avx512dq.hpp +244 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_avx512er.hpp +20 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_avx512f.hpp +2650 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_avx512ifma.hpp +20 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_avx512pf.hpp +20 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_avx512vbmi.hpp +77 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_avx512vbmi2.hpp +131 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_avx512vnni_avx512bw.hpp +20 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_avx512vnni_avx512vbmi2.hpp +20 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_avxvnni.hpp +20 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_common.hpp +24 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_common_fwd.hpp +77 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_constants.hpp +393 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_emulated.hpp +788 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_fma3_avx.hpp +93 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_fma3_avx2.hpp +46 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_fma3_sse.hpp +97 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_fma4.hpp +92 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_i8mm_neon64.hpp +17 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_isa.hpp +142 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_neon.hpp +3142 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_neon64.hpp +1543 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_rvv.hpp +1513 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_scalar.hpp +1260 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_sse2.hpp +2024 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_sse3.hpp +67 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_sse4_1.hpp +339 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_sse4_2.hpp +44 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_ssse3.hpp +186 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_sve.hpp +1155 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_vsx.hpp +892 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/arch/xsimd_wasm.hpp +1780 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/config/xsimd_arch.hpp +240 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/config/xsimd_config.hpp +484 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/config/xsimd_cpuid.hpp +269 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/config/xsimd_inline.hpp +27 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/math/xsimd_rem_pio2.hpp +719 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/memory/xsimd_aligned_allocator.hpp +349 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/memory/xsimd_alignment.hpp +91 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_all_registers.hpp +55 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_api.hpp +2765 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_avx2_register.hpp +44 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_avx512bw_register.hpp +51 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_avx512cd_register.hpp +51 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_avx512dq_register.hpp +51 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_avx512er_register.hpp +51 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_avx512f_register.hpp +77 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_avx512ifma_register.hpp +51 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_avx512pf_register.hpp +51 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_avx512vbmi2_register.hpp +51 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_avx512vbmi_register.hpp +51 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_avx512vnni_avx512bw_register.hpp +54 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_avx512vnni_avx512vbmi2_register.hpp +53 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_avx_register.hpp +64 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_avxvnni_register.hpp +44 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_batch.hpp +1524 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_batch_constant.hpp +300 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_common_arch.hpp +47 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_emulated_register.hpp +80 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_fma3_avx2_register.hpp +50 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_fma3_avx_register.hpp +50 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_fma3_sse_register.hpp +50 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_fma4_register.hpp +50 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_i8mm_neon64_register.hpp +55 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_neon64_register.hpp +55 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_neon_register.hpp +154 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_register.hpp +94 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_rvv_register.hpp +506 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_sse2_register.hpp +59 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_sse3_register.hpp +49 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_sse4_1_register.hpp +48 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_sse4_2_register.hpp +48 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_ssse3_register.hpp +48 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_sve_register.hpp +156 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_traits.hpp +337 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_utils.hpp +536 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_vsx_register.hpp +77 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/types/xsimd_wasm_register.hpp +59 -0
- sequenzo/dissimilarity_measures/src/xsimd/include/xsimd/xsimd.hpp +75 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/architectures/dummy.cpp +7 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/doc/explicit_use_of_an_instruction_set.cpp +13 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/doc/explicit_use_of_an_instruction_set_mean.cpp +24 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/doc/explicit_use_of_an_instruction_set_mean_aligned.cpp +25 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/doc/explicit_use_of_an_instruction_set_mean_arch_independent.cpp +28 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/doc/explicit_use_of_an_instruction_set_mean_tag_dispatch.cpp +25 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/doc/manipulating_abstract_batches.cpp +7 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/doc/manipulating_parametric_batches.cpp +8 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/doc/sum.hpp +31 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/doc/sum_avx2.cpp +3 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/doc/sum_sse2.cpp +3 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/doc/writing_vectorized_code.cpp +11 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/main.cpp +31 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_api.cpp +230 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_arch.cpp +217 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_basic_math.cpp +183 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_batch.cpp +1049 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_batch_bool.cpp +508 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_batch_cast.cpp +409 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_batch_complex.cpp +712 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_batch_constant.cpp +286 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_batch_float.cpp +141 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_batch_int.cpp +365 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_batch_manip.cpp +308 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_bitwise_cast.cpp +222 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_complex_exponential.cpp +226 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_complex_hyperbolic.cpp +183 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_complex_power.cpp +265 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_complex_trigonometric.cpp +236 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_conversion.cpp +248 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_custom_default_arch.cpp +28 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_error_gamma.cpp +170 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_explicit_batch_instantiation.cpp +32 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_exponential.cpp +202 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_extract_pair.cpp +92 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_fp_manipulation.cpp +77 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_gnu_source.cpp +30 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_hyperbolic.cpp +167 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_load_store.cpp +304 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_memory.cpp +61 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_poly_evaluation.cpp +64 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_power.cpp +184 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_rounding.cpp +199 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_select.cpp +101 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_shuffle.cpp +760 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_sum.cpp +4 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_sum.hpp +34 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_traits.cpp +172 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_trigonometric.cpp +208 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_utils.hpp +611 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_wasm/test_wasm_playwright.py +123 -0
- sequenzo/dissimilarity_measures/src/xsimd/test/test_xsimd_api.cpp +1460 -0
- sequenzo/dissimilarity_measures/utils/__init__.py +16 -0
- sequenzo/dissimilarity_measures/utils/get_LCP_length_for_2_seq.py +44 -0
- sequenzo/dissimilarity_measures/utils/get_sm_trate_substitution_cost_matrix.cpython-311-darwin.so +0 -0
- sequenzo/dissimilarity_measures/utils/seqconc.cpython-311-darwin.so +0 -0
- sequenzo/dissimilarity_measures/utils/seqdss.cpython-311-darwin.so +0 -0
- sequenzo/dissimilarity_measures/utils/seqdur.cpython-311-darwin.so +0 -0
- sequenzo/dissimilarity_measures/utils/seqlength.cpython-311-darwin.so +0 -0
- sequenzo/multidomain/__init__.py +23 -0
- sequenzo/multidomain/association_between_domains.py +311 -0
- sequenzo/multidomain/cat.py +431 -0
- sequenzo/multidomain/combt.py +519 -0
- sequenzo/multidomain/dat.py +89 -0
- sequenzo/multidomain/idcd.py +139 -0
- sequenzo/multidomain/linked_polyad.py +292 -0
- sequenzo/openmp_setup.py +233 -0
- sequenzo/prefix_tree/__init__.py +43 -0
- sequenzo/prefix_tree/individual_level_indicators.py +1274 -0
- sequenzo/prefix_tree/system_level_indicators.py +465 -0
- sequenzo/prefix_tree/utils.py +54 -0
- sequenzo/sequence_characteristics/__init__.py +40 -0
- sequenzo/sequence_characteristics/complexity_index.py +49 -0
- sequenzo/sequence_characteristics/overall_cross_sectional_entropy.py +220 -0
- sequenzo/sequence_characteristics/plot_characteristics.py +593 -0
- sequenzo/sequence_characteristics/simple_characteristics.py +311 -0
- sequenzo/sequence_characteristics/state_frequencies_and_entropy_per_sequence.py +39 -0
- sequenzo/sequence_characteristics/turbulence.py +155 -0
- sequenzo/sequence_characteristics/variance_of_spell_durations.py +86 -0
- sequenzo/sequence_characteristics/within_sequence_entropy.py +43 -0
- sequenzo/suffix_tree/__init__.py +48 -0
- sequenzo/suffix_tree/individual_level_indicators.py +1638 -0
- sequenzo/suffix_tree/system_level_indicators.py +456 -0
- sequenzo/suffix_tree/utils.py +56 -0
- sequenzo/visualization/__init__.py +29 -0
- sequenzo/visualization/plot_mean_time.py +194 -0
- sequenzo/visualization/plot_modal_state.py +276 -0
- sequenzo/visualization/plot_most_frequent_sequences.py +147 -0
- sequenzo/visualization/plot_relative_frequency.py +404 -0
- sequenzo/visualization/plot_sequence_index.py +937 -0
- sequenzo/visualization/plot_single_medoid.py +153 -0
- sequenzo/visualization/plot_state_distribution.py +613 -0
- sequenzo/visualization/plot_transition_matrix.py +190 -0
- sequenzo/visualization/utils/__init__.py +23 -0
- sequenzo/visualization/utils/utils.py +310 -0
- sequenzo/with_event_history_analysis/__init__.py +35 -0
- sequenzo/with_event_history_analysis/sequence_analysis_multi_state_model.py +850 -0
- sequenzo/with_event_history_analysis/sequence_history_analysis.py +283 -0
- sequenzo-0.1.21.dist-info/METADATA +308 -0
- sequenzo-0.1.21.dist-info/RECORD +254 -0
- sequenzo-0.1.21.dist-info/WHEEL +5 -0
- sequenzo-0.1.21.dist-info/licenses/LICENSE +28 -0
- sequenzo-0.1.21.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,978 @@
|
|
|
1
|
+
/***************************************************************************
|
|
2
|
+
* Copyright (c) Johan Mabille, Sylvain Corlay, Wolf Vollprecht and *
|
|
3
|
+
* Martin Renou *
|
|
4
|
+
* Copyright (c) QuantStack *
|
|
5
|
+
* Copyright (c) Serge Guelton *
|
|
6
|
+
* *
|
|
7
|
+
* Distributed under the terms of the BSD 3-Clause License. *
|
|
8
|
+
* *
|
|
9
|
+
* The full license is in the file LICENSE, distributed with this software. *
|
|
10
|
+
****************************************************************************/
|
|
11
|
+
|
|
12
|
+
#ifndef XSIMD_COMMON_TRIGO_HPP
|
|
13
|
+
#define XSIMD_COMMON_TRIGO_HPP
|
|
14
|
+
|
|
15
|
+
#include "./xsimd_common_details.hpp"
|
|
16
|
+
|
|
17
|
+
#include <array>
|
|
18
|
+
|
|
19
|
+
namespace xsimd
|
|
20
|
+
{
|
|
21
|
+
|
|
22
|
+
namespace kernel
|
|
23
|
+
{
|
|
24
|
+
/* origin: boost/simd/arch/common/detail/simd/trig_base.hpp */
|
|
25
|
+
/*
|
|
26
|
+
* ====================================================
|
|
27
|
+
* copyright 2016 NumScale SAS
|
|
28
|
+
*
|
|
29
|
+
* Distributed under the Boost Software License, Version 1.0.
|
|
30
|
+
* (See copy at http://boost.org/LICENSE_1_0.txt)
|
|
31
|
+
* ====================================================
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
using namespace types;
|
|
35
|
+
|
|
36
|
+
// acos
|
|
37
|
+
template <class A, class T>
|
|
38
|
+
XSIMD_INLINE batch<T, A> acos(batch<T, A> const& self, requires_arch<common>) noexcept
|
|
39
|
+
{
|
|
40
|
+
using batch_type = batch<T, A>;
|
|
41
|
+
batch_type x = abs(self);
|
|
42
|
+
auto x_larger_05 = x > batch_type(0.5);
|
|
43
|
+
x = select(x_larger_05, sqrt(fma(batch_type(-0.5), x, batch_type(0.5))), self);
|
|
44
|
+
x = asin(x);
|
|
45
|
+
x = select(x_larger_05, x + x, x);
|
|
46
|
+
x = select(self < batch_type(-0.5), constants::pi<batch_type>() - x, x);
|
|
47
|
+
return select(x_larger_05, x, constants::pio2<batch_type>() - x);
|
|
48
|
+
}
|
|
49
|
+
template <class A, class T>
|
|
50
|
+
XSIMD_INLINE batch<std::complex<T>, A> acos(const batch<std::complex<T>, A>& z, requires_arch<common>) noexcept
|
|
51
|
+
{
|
|
52
|
+
using batch_type = batch<std::complex<T>, A>;
|
|
53
|
+
using real_batch = typename batch_type::real_batch;
|
|
54
|
+
batch_type tmp = asin(z);
|
|
55
|
+
return { constants::pio2<real_batch>() - tmp.real(), -tmp.imag() };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// acosh
|
|
59
|
+
/* origin: boost/simd/arch/common/simd/function/acosh.hpp */
|
|
60
|
+
/*
|
|
61
|
+
* ====================================================
|
|
62
|
+
* copyright 2016 NumScale SAS
|
|
63
|
+
*
|
|
64
|
+
* Distributed under the Boost Software License, Version 1.0.
|
|
65
|
+
* (See copy at http://boost.org/LICENSE_1_0.txt)
|
|
66
|
+
* ====================================================
|
|
67
|
+
*/
|
|
68
|
+
template <class A, class T>
|
|
69
|
+
XSIMD_INLINE batch<T, A> acosh(batch<T, A> const& self, requires_arch<common>) noexcept
|
|
70
|
+
{
|
|
71
|
+
using batch_type = batch<T, A>;
|
|
72
|
+
batch_type x = self - batch_type(1.);
|
|
73
|
+
auto test = x > constants::oneotwoeps<batch_type>();
|
|
74
|
+
batch_type z = select(test, self, x + sqrt(x + x + x * x));
|
|
75
|
+
batch_type l1pz = log1p(z);
|
|
76
|
+
return select(test, l1pz + constants::log_2<batch_type>(), l1pz);
|
|
77
|
+
}
|
|
78
|
+
template <class A, class T>
|
|
79
|
+
XSIMD_INLINE batch<std::complex<T>, A> acosh(const batch<std::complex<T>, A>& z, requires_arch<common>) noexcept
|
|
80
|
+
{
|
|
81
|
+
using batch_type = batch<std::complex<T>, A>;
|
|
82
|
+
batch_type w = acos(z);
|
|
83
|
+
w = batch_type(-w.imag(), w.real());
|
|
84
|
+
return w;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// asin
|
|
88
|
+
template <class A>
|
|
89
|
+
XSIMD_INLINE batch<float, A> asin(batch<float, A> const& self, requires_arch<common>) noexcept
|
|
90
|
+
{
|
|
91
|
+
using batch_type = batch<float, A>;
|
|
92
|
+
batch_type x = abs(self);
|
|
93
|
+
batch_type sign = bitofsign(self);
|
|
94
|
+
auto x_larger_05 = x > batch_type(0.5);
|
|
95
|
+
batch_type z = select(x_larger_05, batch_type(0.5) * (batch_type(1.) - x), x * x);
|
|
96
|
+
x = select(x_larger_05, sqrt(z), x);
|
|
97
|
+
batch_type z1 = detail::horner<batch_type,
|
|
98
|
+
0x3e2aaae4,
|
|
99
|
+
0x3d9980f6,
|
|
100
|
+
0x3d3a3ec7,
|
|
101
|
+
0x3cc617e3,
|
|
102
|
+
0x3d2cb352>(z);
|
|
103
|
+
z1 = fma(z1, z * x, x);
|
|
104
|
+
z = select(x_larger_05, constants::pio2<batch_type>() - (z1 + z1), z1);
|
|
105
|
+
return z ^ sign;
|
|
106
|
+
}
|
|
107
|
+
template <class A>
|
|
108
|
+
XSIMD_INLINE batch<double, A> asin(batch<double, A> const& self, requires_arch<common>) noexcept
|
|
109
|
+
{
|
|
110
|
+
using batch_type = batch<double, A>;
|
|
111
|
+
batch_type x = abs(self);
|
|
112
|
+
auto small_cond = x < constants::sqrteps<batch_type>();
|
|
113
|
+
batch_type ct1 = batch_type(bit_cast<double>(int64_t(0x3fe4000000000000)));
|
|
114
|
+
batch_type zz1 = batch_type(1.) - x;
|
|
115
|
+
batch_type vp = zz1 * detail::horner<batch_type, 0x403c896240f3081dull, 0xc03991aaac01ab68ull, 0x401bdff5baf33e6aull, 0xbfe2079259f9290full, 0x3f684fc3988e9f08ull>(zz1) / detail::horner1<batch_type, 0x40756709b0b644beull, 0xc077fe08959063eeull, 0x40626219af6a7f42ull, 0xc035f2a2b6bf5d8cull>(zz1);
|
|
116
|
+
zz1 = sqrt(zz1 + zz1);
|
|
117
|
+
batch_type z = constants::pio4<batch_type>() - zz1;
|
|
118
|
+
zz1 = fms(zz1, vp, constants::pio_2lo<batch_type>());
|
|
119
|
+
z = z - zz1;
|
|
120
|
+
zz1 = z + constants::pio4<batch_type>();
|
|
121
|
+
batch_type zz2 = self * self;
|
|
122
|
+
z = zz2 * detail::horner<batch_type, 0xc020656c06ceafd5ull, 0x40339007da779259ull, 0xc0304331de27907bull, 0x4015c74b178a2dd9ull, 0xbfe34341333e5c16ull, 0x3f716b9b0bd48ad3ull>(zz2) / detail::horner1<batch_type, 0xc04898220a3607acull, 0x4061705684ffbf9dull, 0xc06265bb6d3576d7ull, 0x40519fc025fe9054ull, 0xc02d7b590b5e0eabull>(zz2);
|
|
123
|
+
zz2 = fma(x, z, x);
|
|
124
|
+
return select(x > batch_type(1.), constants::nan<batch_type>(),
|
|
125
|
+
select(small_cond, x,
|
|
126
|
+
select(x > ct1, zz1, zz2))
|
|
127
|
+
^ bitofsign(self));
|
|
128
|
+
}
|
|
129
|
+
template <class A, class T>
|
|
130
|
+
XSIMD_INLINE batch<std::complex<T>, A> asin(const batch<std::complex<T>, A>& z, requires_arch<common>) noexcept
|
|
131
|
+
{
|
|
132
|
+
using batch_type = batch<std::complex<T>, A>;
|
|
133
|
+
using real_batch = typename batch_type::real_batch;
|
|
134
|
+
real_batch x = z.real();
|
|
135
|
+
real_batch y = z.imag();
|
|
136
|
+
|
|
137
|
+
batch_type ct(-y, x);
|
|
138
|
+
batch_type zz(real_batch(1.) - (x - y) * (x + y), -2 * x * y);
|
|
139
|
+
zz = log(ct + sqrt(zz));
|
|
140
|
+
batch_type resg(zz.imag(), -zz.real());
|
|
141
|
+
|
|
142
|
+
return select(y == real_batch(0.),
|
|
143
|
+
select(fabs(x) > real_batch(1.),
|
|
144
|
+
batch_type(constants::pio2<real_batch>(), real_batch(0.)),
|
|
145
|
+
batch_type(asin(x), real_batch(0.))),
|
|
146
|
+
resg);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// asinh
|
|
150
|
+
/* origin: boost/simd/arch/common/simd/function/asinh.hpp */
|
|
151
|
+
/*
|
|
152
|
+
* ====================================================
|
|
153
|
+
* copyright 2016 NumScale SAS
|
|
154
|
+
*
|
|
155
|
+
* Distributed under the Boost Software License, Version 1.0.
|
|
156
|
+
* (See copy at http://boost.org/LICENSE_1_0.txt)
|
|
157
|
+
* ====================================================
|
|
158
|
+
*/
|
|
159
|
+
namespace detail
|
|
160
|
+
{
|
|
161
|
+
template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value, void>::type>
|
|
162
|
+
XSIMD_INLINE batch<T, A>
|
|
163
|
+
average(const batch<T, A>& x1, const batch<T, A>& x2) noexcept
|
|
164
|
+
{
|
|
165
|
+
return (x1 & x2) + ((x1 ^ x2) >> 1);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
template <class A, class T>
|
|
169
|
+
XSIMD_INLINE batch<T, A>
|
|
170
|
+
averagef(const batch<T, A>& x1, const batch<T, A>& x2) noexcept
|
|
171
|
+
{
|
|
172
|
+
using batch_type = batch<T, A>;
|
|
173
|
+
return fma(x1, batch_type(0.5), x2 * batch_type(0.5));
|
|
174
|
+
}
|
|
175
|
+
template <class A>
|
|
176
|
+
XSIMD_INLINE batch<float, A> average(batch<float, A> const& x1, batch<float, A> const& x2) noexcept
|
|
177
|
+
{
|
|
178
|
+
return averagef(x1, x2);
|
|
179
|
+
}
|
|
180
|
+
template <class A>
|
|
181
|
+
XSIMD_INLINE batch<double, A> average(batch<double, A> const& x1, batch<double, A> const& x2) noexcept
|
|
182
|
+
{
|
|
183
|
+
return averagef(x1, x2);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
template <class A>
|
|
187
|
+
XSIMD_INLINE batch<float, A> asinh(batch<float, A> const& self, requires_arch<common>) noexcept
|
|
188
|
+
{
|
|
189
|
+
using batch_type = batch<float, A>;
|
|
190
|
+
batch_type x = abs(self);
|
|
191
|
+
auto lthalf = x < batch_type(0.5);
|
|
192
|
+
batch_type x2 = x * x;
|
|
193
|
+
batch_type bts = bitofsign(self);
|
|
194
|
+
batch_type z(0.);
|
|
195
|
+
if (any(lthalf))
|
|
196
|
+
{
|
|
197
|
+
z = detail::horner<batch_type,
|
|
198
|
+
0x3f800000,
|
|
199
|
+
0xbe2aa9ad,
|
|
200
|
+
0x3d9949b1,
|
|
201
|
+
0xbd2ee581,
|
|
202
|
+
0x3ca4d6e6>(x2)
|
|
203
|
+
* x;
|
|
204
|
+
if (all(lthalf))
|
|
205
|
+
return z ^ bts;
|
|
206
|
+
}
|
|
207
|
+
batch_type tmp = select(x > constants::oneosqrteps<batch_type>(), x, detail::average(x, hypot(batch_type(1.), x)));
|
|
208
|
+
#ifndef XSIMD_NO_NANS
|
|
209
|
+
return select(isnan(self), constants::nan<batch_type>(), select(lthalf, z, log(tmp) + constants::log_2<batch_type>()) ^ bts);
|
|
210
|
+
#else
|
|
211
|
+
return select(lthalf, z, log(tmp) + constants::log_2<batch_type>()) ^ bts;
|
|
212
|
+
#endif
|
|
213
|
+
}
|
|
214
|
+
template <class A>
|
|
215
|
+
XSIMD_INLINE batch<double, A> asinh(batch<double, A> const& self, requires_arch<common>) noexcept
|
|
216
|
+
{
|
|
217
|
+
using batch_type = batch<double, A>;
|
|
218
|
+
batch_type x = abs(self);
|
|
219
|
+
auto test = x > constants::oneosqrteps<batch_type>();
|
|
220
|
+
batch_type z = select(test, x - batch_type(1.), x + x * x / (batch_type(1.) + hypot(batch_type(1.), x)));
|
|
221
|
+
#ifndef XSIMD_NO_INFINITIES
|
|
222
|
+
z = select(x == constants::infinity<batch_type>(), x, z);
|
|
223
|
+
#endif
|
|
224
|
+
batch_type l1pz = log1p(z);
|
|
225
|
+
z = select(test, l1pz + constants::log_2<batch_type>(), l1pz);
|
|
226
|
+
return bitofsign(self) ^ z;
|
|
227
|
+
}
|
|
228
|
+
template <class A, class T>
|
|
229
|
+
XSIMD_INLINE batch<std::complex<T>, A> asinh(const batch<std::complex<T>, A>& z, requires_arch<common>) noexcept
|
|
230
|
+
{
|
|
231
|
+
using batch_type = batch<std::complex<T>, A>;
|
|
232
|
+
batch_type w = asin(batch_type(-z.imag(), z.real()));
|
|
233
|
+
w = batch_type(w.imag(), -w.real());
|
|
234
|
+
return w;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// atan
|
|
238
|
+
namespace detail
|
|
239
|
+
{
|
|
240
|
+
template <class A>
|
|
241
|
+
static XSIMD_INLINE batch<float, A> kernel_atan(const batch<float, A>& x, const batch<float, A>& recx) noexcept
|
|
242
|
+
{
|
|
243
|
+
using batch_type = batch<float, A>;
|
|
244
|
+
const auto flag1 = x < constants::tan3pio8<batch_type>();
|
|
245
|
+
const auto flag2 = (x >= batch_type(bit_cast<float>((uint32_t)0x3ed413cd))) && flag1;
|
|
246
|
+
batch_type yy = select(flag1, batch_type(0.), constants::pio2<batch_type>());
|
|
247
|
+
yy = select(flag2, constants::pio4<batch_type>(), yy);
|
|
248
|
+
batch_type xx = select(flag1, x, -recx);
|
|
249
|
+
xx = select(flag2, (x - batch_type(1.)) / (x + batch_type(1.)), xx);
|
|
250
|
+
const batch_type z = xx * xx;
|
|
251
|
+
batch_type z1 = detail::horner<batch_type,
|
|
252
|
+
0xbeaaaa2aul,
|
|
253
|
+
0x3e4c925ful,
|
|
254
|
+
0xbe0e1b85ul,
|
|
255
|
+
0x3da4f0d1ul>(z);
|
|
256
|
+
z1 = fma(xx, z1 * z, xx);
|
|
257
|
+
z1 = select(flag2, z1 + constants::pio_4lo<batch_type>(), z1);
|
|
258
|
+
z1 = select(!flag1, z1 + constants::pio_2lo<batch_type>(), z1);
|
|
259
|
+
return yy + z1;
|
|
260
|
+
}
|
|
261
|
+
template <class A>
|
|
262
|
+
static XSIMD_INLINE batch<double, A> kernel_atan(const batch<double, A>& x, const batch<double, A>& recx) noexcept
|
|
263
|
+
{
|
|
264
|
+
using batch_type = batch<double, A>;
|
|
265
|
+
const auto flag1 = x < constants::tan3pio8<batch_type>();
|
|
266
|
+
const auto flag2 = (x >= constants::tanpio8<batch_type>()) && flag1;
|
|
267
|
+
batch_type yy = select(flag1, batch_type(0.), constants::pio2<batch_type>());
|
|
268
|
+
yy = select(flag2, constants::pio4<batch_type>(), yy);
|
|
269
|
+
batch_type xx = select(flag1, x, -recx);
|
|
270
|
+
xx = select(flag2, (x - batch_type(1.)) / (x + batch_type(1.)), xx);
|
|
271
|
+
batch_type z = xx * xx;
|
|
272
|
+
z *= detail::horner<batch_type,
|
|
273
|
+
0xc0503669fd28ec8eull,
|
|
274
|
+
0xc05eb8bf2d05ba25ull,
|
|
275
|
+
0xc052c08c36880273ull,
|
|
276
|
+
0xc03028545b6b807aull,
|
|
277
|
+
0xbfec007fa1f72594ull>(z)
|
|
278
|
+
/ detail::horner1<batch_type,
|
|
279
|
+
0x4068519efbbd62ecull,
|
|
280
|
+
0x407e563f13b049eaull,
|
|
281
|
+
0x407b0e18d2e2be3bull,
|
|
282
|
+
0x4064a0dd43b8fa25ull,
|
|
283
|
+
0x4038dbc45b14603cull>(z);
|
|
284
|
+
z = fma(xx, z, xx);
|
|
285
|
+
z = select(flag2, z + constants::pio_4lo<batch_type>(), z);
|
|
286
|
+
z = z + select(flag1, batch_type(0.), constants::pio_2lo<batch_type>());
|
|
287
|
+
return yy + z;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
template <class A, class T>
|
|
291
|
+
XSIMD_INLINE batch<T, A> atan(batch<T, A> const& self, requires_arch<common>) noexcept
|
|
292
|
+
{
|
|
293
|
+
using batch_type = batch<T, A>;
|
|
294
|
+
const batch_type absa = abs(self);
|
|
295
|
+
const batch_type x = detail::kernel_atan(absa, batch_type(1.) / absa);
|
|
296
|
+
return x ^ bitofsign(self);
|
|
297
|
+
}
|
|
298
|
+
template <class A, class T>
|
|
299
|
+
XSIMD_INLINE batch<std::complex<T>, A> atan(const batch<std::complex<T>, A>& z, requires_arch<common>) noexcept
|
|
300
|
+
{
|
|
301
|
+
using batch_type = batch<std::complex<T>, A>;
|
|
302
|
+
using real_batch = typename batch_type::real_batch;
|
|
303
|
+
real_batch x = z.real();
|
|
304
|
+
real_batch y = z.imag();
|
|
305
|
+
real_batch x2 = x * x;
|
|
306
|
+
real_batch one(1.);
|
|
307
|
+
real_batch a = one - x2 - (y * y);
|
|
308
|
+
real_batch w = 0.5 * atan2(2. * x, a);
|
|
309
|
+
real_batch num = y + one;
|
|
310
|
+
num = x2 + num * num;
|
|
311
|
+
real_batch den = y - one;
|
|
312
|
+
den = x2 + den * den;
|
|
313
|
+
#ifdef __FAST_MATH__
|
|
314
|
+
return batch_type(w, 0.25 * log(num / den));
|
|
315
|
+
#else
|
|
316
|
+
return select((x == real_batch(0.)) && (y == real_batch(1.)),
|
|
317
|
+
batch_type(real_batch(0.), constants::infinity<real_batch>()),
|
|
318
|
+
batch_type(w, 0.25 * log(num / den)));
|
|
319
|
+
#endif
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// atanh
|
|
323
|
+
/* origin: boost/simd/arch/common/simd/function/acosh.hpp */
|
|
324
|
+
/*
|
|
325
|
+
* ====================================================
|
|
326
|
+
* copyright 2016 NumScale SAS
|
|
327
|
+
*
|
|
328
|
+
* Distributed under the Boost Software License, Version 1.0.
|
|
329
|
+
* (See copy at http://boost.org/LICENSE_1_0.txt)
|
|
330
|
+
* ====================================================
|
|
331
|
+
*/
|
|
332
|
+
template <class A, class T>
|
|
333
|
+
XSIMD_INLINE batch<T, A> atanh(batch<T, A> const& self, requires_arch<common>) noexcept
|
|
334
|
+
{
|
|
335
|
+
using batch_type = batch<T, A>;
|
|
336
|
+
batch_type x = abs(self);
|
|
337
|
+
batch_type t = x + x;
|
|
338
|
+
batch_type z = batch_type(1.) - x;
|
|
339
|
+
auto test = x < batch_type(0.5);
|
|
340
|
+
batch_type tmp = select(test, x, t) / z;
|
|
341
|
+
return bitofsign(self) ^ (batch_type(0.5) * log1p(select(test, fma(t, tmp, t), tmp)));
|
|
342
|
+
}
|
|
343
|
+
template <class A, class T>
|
|
344
|
+
XSIMD_INLINE batch<std::complex<T>, A> atanh(const batch<std::complex<T>, A>& z, requires_arch<common>) noexcept
|
|
345
|
+
{
|
|
346
|
+
using batch_type = batch<std::complex<T>, A>;
|
|
347
|
+
batch_type w = atan(batch_type(-z.imag(), z.real()));
|
|
348
|
+
w = batch_type(w.imag(), -w.real());
|
|
349
|
+
return w;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// atan2
|
|
353
|
+
template <class A, class T>
|
|
354
|
+
XSIMD_INLINE batch<T, A> atan2(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
|
|
355
|
+
{
|
|
356
|
+
using batch_type = batch<T, A>;
|
|
357
|
+
const batch_type q = abs(self / other);
|
|
358
|
+
const batch_type z = detail::kernel_atan(q, batch_type(1.) / q);
|
|
359
|
+
return select(other > batch_type(0.), z, constants::pi<batch_type>() - z) * signnz(self);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// cos
|
|
363
|
+
namespace detail
|
|
364
|
+
{
|
|
365
|
+
template <class T, class A>
|
|
366
|
+
XSIMD_INLINE batch<T, A> quadrant(const batch<T, A>& x) noexcept
|
|
367
|
+
{
|
|
368
|
+
return x & batch<T, A>(3);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
template <class A>
|
|
372
|
+
XSIMD_INLINE batch<float, A> quadrant(const batch<float, A>& x) noexcept
|
|
373
|
+
{
|
|
374
|
+
return to_float(quadrant(to_int(x)));
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
template <class A>
|
|
378
|
+
XSIMD_INLINE batch<double, A> quadrant(const batch<double, A>& x) noexcept
|
|
379
|
+
{
|
|
380
|
+
using batch_type = batch<double, A>;
|
|
381
|
+
batch_type a = x * batch_type(0.25);
|
|
382
|
+
return (a - floor(a)) * batch_type(4.);
|
|
383
|
+
}
|
|
384
|
+
/* origin: boost/simd/arch/common/detail/simd/f_trig_evaluation.hpp */
|
|
385
|
+
/*
|
|
386
|
+
* ====================================================
|
|
387
|
+
* copyright 2016 NumScale SAS
|
|
388
|
+
*
|
|
389
|
+
* Distributed under the Boost Software License, Version 1.0.
|
|
390
|
+
* (See copy at http://boost.org/LICENSE_1_0.txt)
|
|
391
|
+
* ====================================================
|
|
392
|
+
*/
|
|
393
|
+
|
|
394
|
+
template <class A>
|
|
395
|
+
XSIMD_INLINE batch<float, A> cos_eval(const batch<float, A>& z) noexcept
|
|
396
|
+
{
|
|
397
|
+
using batch_type = batch<float, A>;
|
|
398
|
+
batch_type y = detail::horner<batch_type,
|
|
399
|
+
0x3d2aaaa5,
|
|
400
|
+
0xbab60619,
|
|
401
|
+
0x37ccf5ce>(z);
|
|
402
|
+
return batch_type(1.) + fma(z, batch_type(-0.5), y * z * z);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
template <class A>
|
|
406
|
+
XSIMD_INLINE batch<float, A> sin_eval(const batch<float, A>& z, const batch<float, A>& x) noexcept
|
|
407
|
+
{
|
|
408
|
+
using batch_type = batch<float, A>;
|
|
409
|
+
batch_type y = detail::horner<batch_type,
|
|
410
|
+
0xbe2aaaa2,
|
|
411
|
+
0x3c08839d,
|
|
412
|
+
0xb94ca1f9>(z);
|
|
413
|
+
return fma(y * z, x, x);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
template <class A>
|
|
417
|
+
static XSIMD_INLINE batch<float, A> base_tancot_eval(const batch<float, A>& z) noexcept
|
|
418
|
+
{
|
|
419
|
+
using batch_type = batch<float, A>;
|
|
420
|
+
batch_type zz = z * z;
|
|
421
|
+
batch_type y = detail::horner<batch_type,
|
|
422
|
+
0x3eaaaa6f,
|
|
423
|
+
0x3e0896dd,
|
|
424
|
+
0x3d5ac5c9,
|
|
425
|
+
0x3cc821b5,
|
|
426
|
+
0x3b4c779c,
|
|
427
|
+
0x3c19c53b>(zz);
|
|
428
|
+
return fma(y, zz * z, z);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
template <class A, class BB>
|
|
432
|
+
static XSIMD_INLINE batch<float, A> tan_eval(const batch<float, A>& z, const BB& test) noexcept
|
|
433
|
+
{
|
|
434
|
+
using batch_type = batch<float, A>;
|
|
435
|
+
batch_type y = base_tancot_eval(z);
|
|
436
|
+
return select(test, y, -batch_type(1.) / y);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
template <class A, class BB>
|
|
440
|
+
static XSIMD_INLINE batch<float, A> cot_eval(const batch<float, A>& z, const BB& test) noexcept
|
|
441
|
+
{
|
|
442
|
+
using batch_type = batch<float, A>;
|
|
443
|
+
batch_type y = base_tancot_eval(z);
|
|
444
|
+
return select(test, batch_type(1.) / y, -y);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/* origin: boost/simd/arch/common/detail/simd/d_trig_evaluation.hpp */
|
|
448
|
+
/*
|
|
449
|
+
* ====================================================
|
|
450
|
+
* copyright 2016 NumScale SAS
|
|
451
|
+
*
|
|
452
|
+
* Distributed under the Boost Software License, Version 1.0.
|
|
453
|
+
* (See copy at http://boost.org/LICENSE_1_0.txt)
|
|
454
|
+
* ====================================================
|
|
455
|
+
*/
|
|
456
|
+
template <class A>
|
|
457
|
+
static XSIMD_INLINE batch<double, A> cos_eval(const batch<double, A>& z) noexcept
|
|
458
|
+
{
|
|
459
|
+
using batch_type = batch<double, A>;
|
|
460
|
+
batch_type y = detail::horner<batch_type,
|
|
461
|
+
0x3fe0000000000000ull,
|
|
462
|
+
0xbfa5555555555551ull,
|
|
463
|
+
0x3f56c16c16c15d47ull,
|
|
464
|
+
0xbefa01a019ddbcd9ull,
|
|
465
|
+
0x3e927e4f8e06d9a5ull,
|
|
466
|
+
0xbe21eea7c1e514d4ull,
|
|
467
|
+
0x3da8ff831ad9b219ull>(z);
|
|
468
|
+
return batch_type(1.) - y * z;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
template <class A>
|
|
472
|
+
static XSIMD_INLINE batch<double, A> sin_eval(const batch<double, A>& z, const batch<double, A>& x) noexcept
|
|
473
|
+
{
|
|
474
|
+
using batch_type = batch<double, A>;
|
|
475
|
+
batch_type y = detail::horner<batch_type,
|
|
476
|
+
0xbfc5555555555548ull,
|
|
477
|
+
0x3f8111111110f7d0ull,
|
|
478
|
+
0xbf2a01a019bfdf03ull,
|
|
479
|
+
0x3ec71de3567d4896ull,
|
|
480
|
+
0xbe5ae5e5a9291691ull,
|
|
481
|
+
0x3de5d8fd1fcf0ec1ull>(z);
|
|
482
|
+
return fma(y * z, x, x);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
template <class A>
|
|
486
|
+
static XSIMD_INLINE batch<double, A> base_tancot_eval(const batch<double, A>& z) noexcept
|
|
487
|
+
{
|
|
488
|
+
using batch_type = batch<double, A>;
|
|
489
|
+
batch_type zz = z * z;
|
|
490
|
+
batch_type num = detail::horner<batch_type,
|
|
491
|
+
0xc1711fead3299176ull,
|
|
492
|
+
0x413199eca5fc9dddull,
|
|
493
|
+
0xc0c992d8d24f3f38ull>(zz);
|
|
494
|
+
batch_type den = detail::horner1<batch_type,
|
|
495
|
+
0xc189afe03cbe5a31ull,
|
|
496
|
+
0x4177d98fc2ead8efull,
|
|
497
|
+
0xc13427bc582abc96ull,
|
|
498
|
+
0x40cab8a5eeb36572ull>(zz);
|
|
499
|
+
return fma(z, (zz * (num / den)), z);
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
template <class A, class BB>
|
|
503
|
+
static XSIMD_INLINE batch<double, A> tan_eval(const batch<double, A>& z, const BB& test) noexcept
|
|
504
|
+
{
|
|
505
|
+
using batch_type = batch<double, A>;
|
|
506
|
+
batch_type y = base_tancot_eval(z);
|
|
507
|
+
return select(test, y, -batch_type(1.) / y);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
template <class A, class BB>
|
|
511
|
+
static XSIMD_INLINE batch<double, A> cot_eval(const batch<double, A>& z, const BB& test) noexcept
|
|
512
|
+
{
|
|
513
|
+
using batch_type = batch<double, A>;
|
|
514
|
+
batch_type y = base_tancot_eval(z);
|
|
515
|
+
return select(test, batch_type(1.) / y, -y);
|
|
516
|
+
}
|
|
517
|
+
/* origin: boost/simd/arch/common/detail/simd/trig_reduction.hpp */
|
|
518
|
+
/*
|
|
519
|
+
* ====================================================
|
|
520
|
+
* copyright 2016 NumScale SAS
|
|
521
|
+
*
|
|
522
|
+
* Distributed under the Boost Software License, Version 1.0.
|
|
523
|
+
* (See copy at http://boost.org/LICENSE_1_0.txt)
|
|
524
|
+
* ====================================================
|
|
525
|
+
*/
|
|
526
|
+
|
|
527
|
+
struct trigo_radian_tag
|
|
528
|
+
{
|
|
529
|
+
};
|
|
530
|
+
struct trigo_pi_tag
|
|
531
|
+
{
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
template <class B, class Tag = trigo_radian_tag>
|
|
535
|
+
struct trigo_reducer
|
|
536
|
+
{
|
|
537
|
+
static XSIMD_INLINE B reduce(const B& x, B& xr) noexcept
|
|
538
|
+
{
|
|
539
|
+
if (all(x <= constants::pio4<B>()))
|
|
540
|
+
{
|
|
541
|
+
xr = x;
|
|
542
|
+
return B(0.);
|
|
543
|
+
}
|
|
544
|
+
else if (all(x <= constants::pio2<B>()))
|
|
545
|
+
{
|
|
546
|
+
auto test = x > constants::pio4<B>();
|
|
547
|
+
xr = x - constants::pio2_1<B>();
|
|
548
|
+
xr -= constants::pio2_2<B>();
|
|
549
|
+
xr -= constants::pio2_3<B>();
|
|
550
|
+
xr = select(test, xr, x);
|
|
551
|
+
return select(test, B(1.), B(0.));
|
|
552
|
+
}
|
|
553
|
+
else if (all(x <= constants::twentypi<B>()))
|
|
554
|
+
{
|
|
555
|
+
B xi = nearbyint(x * constants::twoopi<B>());
|
|
556
|
+
xr = fnma(xi, constants::pio2_1<B>(), x);
|
|
557
|
+
xr -= xi * constants::pio2_2<B>();
|
|
558
|
+
xr -= xi * constants::pio2_3<B>();
|
|
559
|
+
return quadrant(xi);
|
|
560
|
+
}
|
|
561
|
+
else if (all(x <= constants::mediumpi<B>()))
|
|
562
|
+
{
|
|
563
|
+
B fn = nearbyint(x * constants::twoopi<B>());
|
|
564
|
+
B r = x - fn * constants::pio2_1<B>();
|
|
565
|
+
B w = fn * constants::pio2_1t<B>();
|
|
566
|
+
B t = r;
|
|
567
|
+
w = fn * constants::pio2_2<B>();
|
|
568
|
+
r = t - w;
|
|
569
|
+
w = fn * constants::pio2_2t<B>() - ((t - r) - w);
|
|
570
|
+
t = r;
|
|
571
|
+
w = fn * constants::pio2_3<B>();
|
|
572
|
+
r = t - w;
|
|
573
|
+
w = fn * constants::pio2_3t<B>() - ((t - r) - w);
|
|
574
|
+
xr = r - w;
|
|
575
|
+
return quadrant(fn);
|
|
576
|
+
}
|
|
577
|
+
else
|
|
578
|
+
{
|
|
579
|
+
static constexpr std::size_t size = B::size;
|
|
580
|
+
using value_type = typename B::value_type;
|
|
581
|
+
alignas(B) std::array<value_type, size> tmp;
|
|
582
|
+
alignas(B) std::array<value_type, size> txr;
|
|
583
|
+
alignas(B) std::array<value_type, size> args;
|
|
584
|
+
x.store_aligned(args.data());
|
|
585
|
+
|
|
586
|
+
for (std::size_t i = 0; i < size; ++i)
|
|
587
|
+
{
|
|
588
|
+
double arg = args[i];
|
|
589
|
+
#ifndef __FAST_MATH__
|
|
590
|
+
if (arg == std::numeric_limits<value_type>::infinity())
|
|
591
|
+
{
|
|
592
|
+
tmp[i] = 0.;
|
|
593
|
+
txr[i] = std::numeric_limits<value_type>::quiet_NaN();
|
|
594
|
+
}
|
|
595
|
+
else
|
|
596
|
+
#endif
|
|
597
|
+
{
|
|
598
|
+
double y[2];
|
|
599
|
+
std::int32_t n = ::xsimd::detail::__ieee754_rem_pio2(arg, y);
|
|
600
|
+
tmp[i] = value_type(n & 3);
|
|
601
|
+
txr[i] = value_type(y[0]);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
xr = B::load_aligned(&txr[0]);
|
|
605
|
+
B res = B::load_aligned(&tmp[0]);
|
|
606
|
+
return res;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
};
|
|
610
|
+
|
|
611
|
+
template <class B>
|
|
612
|
+
struct trigo_reducer<B, trigo_pi_tag>
|
|
613
|
+
{
|
|
614
|
+
static XSIMD_INLINE B reduce(const B& x, B& xr) noexcept
|
|
615
|
+
{
|
|
616
|
+
B xi = nearbyint(x * B(2.));
|
|
617
|
+
B x2 = x - xi * B(0.5);
|
|
618
|
+
xr = x2 * constants::pi<B>();
|
|
619
|
+
return quadrant(xi);
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
|
|
623
|
+
}
|
|
624
|
+
template <class A, class T>
|
|
625
|
+
XSIMD_INLINE batch<T, A> cos(batch<T, A> const& self, requires_arch<common>) noexcept
|
|
626
|
+
{
|
|
627
|
+
using batch_type = batch<T, A>;
|
|
628
|
+
const batch_type x = abs(self);
|
|
629
|
+
batch_type xr = constants::nan<batch_type>();
|
|
630
|
+
const batch_type n = detail::trigo_reducer<batch_type>::reduce(x, xr);
|
|
631
|
+
auto tmp = select(n >= batch_type(2.), batch_type(1.), batch_type(0.));
|
|
632
|
+
auto swap_bit = fma(batch_type(-2.), tmp, n);
|
|
633
|
+
auto sign_bit = select((swap_bit ^ tmp) != batch_type(0.), constants::signmask<batch_type>(), batch_type(0.));
|
|
634
|
+
const batch_type z = xr * xr;
|
|
635
|
+
const batch_type se = detail::sin_eval(z, xr);
|
|
636
|
+
const batch_type ce = detail::cos_eval(z);
|
|
637
|
+
const batch_type z1 = select(swap_bit != batch_type(0.), se, ce);
|
|
638
|
+
return z1 ^ sign_bit;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
template <class A, class T>
|
|
642
|
+
XSIMD_INLINE batch<std::complex<T>, A> cos(batch<std::complex<T>, A> const& z, requires_arch<common>) noexcept
|
|
643
|
+
{
|
|
644
|
+
return { cos(z.real()) * cosh(z.imag()), -sin(z.real()) * sinh(z.imag()) };
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
// cosh
|
|
648
|
+
|
|
649
|
+
/* origin: boost/simd/arch/common/simd/function/cosh.hpp */
|
|
650
|
+
/*
|
|
651
|
+
* ====================================================
|
|
652
|
+
* copyright 2016 NumScale SAS
|
|
653
|
+
*
|
|
654
|
+
* Distributed under the Boost Software License, Version 1.0.
|
|
655
|
+
* (See copy at http://boost.org/LICENSE_1_0.txt)
|
|
656
|
+
* ====================================================
|
|
657
|
+
*/
|
|
658
|
+
|
|
659
|
+
template <class A, class T>
|
|
660
|
+
XSIMD_INLINE batch<T, A> cosh(batch<T, A> const& self, requires_arch<common>) noexcept
|
|
661
|
+
{
|
|
662
|
+
using batch_type = batch<T, A>;
|
|
663
|
+
batch_type x = abs(self);
|
|
664
|
+
auto test1 = x > (constants::maxlog<batch_type>() - constants::log_2<batch_type>());
|
|
665
|
+
batch_type fac = select(test1, batch_type(0.5), batch_type(1.));
|
|
666
|
+
batch_type tmp = exp(x * fac);
|
|
667
|
+
batch_type tmp1 = batch_type(0.5) * tmp;
|
|
668
|
+
return select(test1, tmp1 * tmp, detail::average(tmp, batch_type(1.) / tmp));
|
|
669
|
+
}
|
|
670
|
+
template <class A, class T>
|
|
671
|
+
XSIMD_INLINE batch<std::complex<T>, A> cosh(const batch<std::complex<T>, A>& z, requires_arch<common>) noexcept
|
|
672
|
+
{
|
|
673
|
+
auto x = z.real();
|
|
674
|
+
auto y = z.imag();
|
|
675
|
+
return { cosh(x) * cos(y), sinh(x) * sin(y) };
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
// sin
|
|
679
|
+
namespace detail
|
|
680
|
+
{
|
|
681
|
+
template <class A, class T, class Tag = trigo_radian_tag>
|
|
682
|
+
XSIMD_INLINE batch<T, A> sin(batch<T, A> const& self, Tag = Tag()) noexcept
|
|
683
|
+
{
|
|
684
|
+
using batch_type = batch<T, A>;
|
|
685
|
+
const batch_type x = abs(self);
|
|
686
|
+
batch_type xr = constants::nan<batch_type>();
|
|
687
|
+
const batch_type n = detail::trigo_reducer<batch_type, Tag>::reduce(x, xr);
|
|
688
|
+
auto tmp = select(n >= batch_type(2.), batch_type(1.), batch_type(0.));
|
|
689
|
+
auto swap_bit = fma(batch_type(-2.), tmp, n);
|
|
690
|
+
auto sign_bit = bitofsign(self) ^ select(tmp != batch_type(0.), constants::signmask<batch_type>(), batch_type(0.));
|
|
691
|
+
const batch_type z = xr * xr;
|
|
692
|
+
const batch_type se = detail::sin_eval(z, xr);
|
|
693
|
+
const batch_type ce = detail::cos_eval(z);
|
|
694
|
+
const batch_type z1 = select(swap_bit == batch_type(0.), se, ce);
|
|
695
|
+
return z1 ^ sign_bit;
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
template <class A, class T>
|
|
700
|
+
XSIMD_INLINE batch<T, A> sin(batch<T, A> const& self, requires_arch<common>) noexcept
|
|
701
|
+
{
|
|
702
|
+
return detail::sin(self);
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
template <class A, class T>
|
|
706
|
+
XSIMD_INLINE batch<std::complex<T>, A> sin(batch<std::complex<T>, A> const& z, requires_arch<common>) noexcept
|
|
707
|
+
{
|
|
708
|
+
return { sin(z.real()) * cosh(z.imag()), cos(z.real()) * sinh(z.imag()) };
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
// sincos
|
|
712
|
+
template <class A, class T>
|
|
713
|
+
XSIMD_INLINE std::pair<batch<T, A>, batch<T, A>> sincos(batch<T, A> const& self, requires_arch<common>) noexcept
|
|
714
|
+
{
|
|
715
|
+
using batch_type = batch<T, A>;
|
|
716
|
+
const batch_type x = abs(self);
|
|
717
|
+
batch_type xr = constants::nan<batch_type>();
|
|
718
|
+
const batch_type n = detail::trigo_reducer<batch_type>::reduce(x, xr);
|
|
719
|
+
auto tmp = select(n >= batch_type(2.), batch_type(1.), batch_type(0.));
|
|
720
|
+
auto swap_bit = fma(batch_type(-2.), tmp, n);
|
|
721
|
+
const batch_type z = xr * xr;
|
|
722
|
+
const batch_type se = detail::sin_eval(z, xr);
|
|
723
|
+
const batch_type ce = detail::cos_eval(z);
|
|
724
|
+
auto sin_sign_bit = bitofsign(self) ^ select(tmp != batch_type(0.), constants::signmask<batch_type>(), batch_type(0.));
|
|
725
|
+
const batch_type sin_z1 = select(swap_bit == batch_type(0.), se, ce);
|
|
726
|
+
auto cos_sign_bit = select((swap_bit ^ tmp) != batch_type(0.), constants::signmask<batch_type>(), batch_type(0.));
|
|
727
|
+
const batch_type cos_z1 = select(swap_bit != batch_type(0.), se, ce);
|
|
728
|
+
return std::make_pair(sin_z1 ^ sin_sign_bit, cos_z1 ^ cos_sign_bit);
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
template <class A, class T>
|
|
732
|
+
XSIMD_INLINE std::pair<batch<std::complex<T>, A>, batch<std::complex<T>, A>>
|
|
733
|
+
sincos(batch<std::complex<T>, A> const& z, requires_arch<common>) noexcept
|
|
734
|
+
{
|
|
735
|
+
using batch_type = batch<std::complex<T>, A>;
|
|
736
|
+
using real_batch = typename batch_type::real_batch;
|
|
737
|
+
real_batch rcos = cos(z.real());
|
|
738
|
+
real_batch rsin = sin(z.real());
|
|
739
|
+
real_batch icosh = cosh(z.imag());
|
|
740
|
+
real_batch isinh = sinh(z.imag());
|
|
741
|
+
return std::make_pair(batch_type(rsin * icosh, rcos * isinh), batch_type(rcos * icosh, -rsin * isinh));
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
// sinh
|
|
745
|
+
namespace detail
|
|
746
|
+
{
|
|
747
|
+
/* origin: boost/simd/arch/common/detail/common/sinh_kernel.hpp */
|
|
748
|
+
/*
|
|
749
|
+
* ====================================================
|
|
750
|
+
* copyright 2016 NumScale SAS
|
|
751
|
+
*
|
|
752
|
+
* Distributed under the Boost Software License, Version 1.0.
|
|
753
|
+
* (See copy at http://boost.org/LICENSE_1_0.txt)
|
|
754
|
+
* ====================================================
|
|
755
|
+
*/
|
|
756
|
+
template <class A>
|
|
757
|
+
XSIMD_INLINE batch<float, A> sinh_kernel(batch<float, A> const& self) noexcept
|
|
758
|
+
{
|
|
759
|
+
using batch_type = batch<float, A>;
|
|
760
|
+
batch_type sqr_self = self * self;
|
|
761
|
+
return detail::horner<batch_type,
|
|
762
|
+
0x3f800000, // 1.0f
|
|
763
|
+
0x3e2aaacc, // 1.66667160211E-1f
|
|
764
|
+
0x3c087bbe, // 8.33028376239E-3f
|
|
765
|
+
0x39559e2f // 2.03721912945E-4f
|
|
766
|
+
>(sqr_self)
|
|
767
|
+
* self;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
template <class A>
|
|
771
|
+
XSIMD_INLINE batch<double, A> sinh_kernel(batch<double, A> const& self) noexcept
|
|
772
|
+
{
|
|
773
|
+
using batch_type = batch<double, A>;
|
|
774
|
+
batch_type sqrself = self * self;
|
|
775
|
+
return fma(self, (detail::horner<batch_type,
|
|
776
|
+
0xc115782bdbf6ab05ull, // -3.51754964808151394800E5
|
|
777
|
+
0xc0c694b8c71d6182ull, // -1.15614435765005216044E4,
|
|
778
|
+
0xc064773a398ff4feull, // -1.63725857525983828727E2,
|
|
779
|
+
0xbfe9435fe8bb3cd6ull // -7.89474443963537015605E-1
|
|
780
|
+
>(sqrself)
|
|
781
|
+
/ detail::horner1<batch_type,
|
|
782
|
+
0xc1401a20e4f90044ull, // -2.11052978884890840399E6
|
|
783
|
+
0x40e1a7ba7ed72245ull, // 3.61578279834431989373E4,
|
|
784
|
+
0xc0715b6096e96484ull // -2.77711081420602794433E2,
|
|
785
|
+
>(sqrself))
|
|
786
|
+
* sqrself,
|
|
787
|
+
self);
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
/* origin: boost/simd/arch/common/simd/function/sinh.hpp */
|
|
791
|
+
/*
|
|
792
|
+
* ====================================================
|
|
793
|
+
* copyright 2016 NumScale SAS
|
|
794
|
+
*
|
|
795
|
+
* Distributed under the Boost Software License, Version 1.0.
|
|
796
|
+
* (See copy at http://boost.org/LICENSE_1_0.txt)
|
|
797
|
+
* ====================================================
|
|
798
|
+
*/
|
|
799
|
+
template <class A, class T>
|
|
800
|
+
XSIMD_INLINE batch<T, A> sinh(batch<T, A> const& a, requires_arch<common>) noexcept
|
|
801
|
+
{
|
|
802
|
+
using batch_type = batch<T, A>;
|
|
803
|
+
batch_type half(0.5);
|
|
804
|
+
batch_type x = abs(a);
|
|
805
|
+
auto lt1 = x < batch_type(1.);
|
|
806
|
+
batch_type bts = bitofsign(a);
|
|
807
|
+
batch_type z(0.);
|
|
808
|
+
if (any(lt1))
|
|
809
|
+
{
|
|
810
|
+
z = detail::sinh_kernel(x);
|
|
811
|
+
if (all(lt1))
|
|
812
|
+
return z ^ bts;
|
|
813
|
+
}
|
|
814
|
+
auto test1 = x > (constants::maxlog<batch_type>() - constants::log_2<batch_type>());
|
|
815
|
+
batch_type fac = select(test1, half, batch_type(1.));
|
|
816
|
+
batch_type tmp = exp(x * fac);
|
|
817
|
+
batch_type tmp1 = half * tmp;
|
|
818
|
+
batch_type r = select(test1, tmp1 * tmp, tmp1 - half / tmp);
|
|
819
|
+
return select(lt1, z, r) ^ bts;
|
|
820
|
+
}
|
|
821
|
+
template <class A, class T>
|
|
822
|
+
XSIMD_INLINE batch<std::complex<T>, A> sinh(const batch<std::complex<T>, A>& z, requires_arch<common>) noexcept
|
|
823
|
+
{
|
|
824
|
+
auto x = z.real();
|
|
825
|
+
auto y = z.imag();
|
|
826
|
+
return { sinh(x) * cos(y), cosh(x) * sin(y) };
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
// tan
|
|
830
|
+
template <class A, class T>
|
|
831
|
+
XSIMD_INLINE batch<T, A> tan(batch<T, A> const& self, requires_arch<common>) noexcept
|
|
832
|
+
{
|
|
833
|
+
using batch_type = batch<T, A>;
|
|
834
|
+
const batch_type x = abs(self);
|
|
835
|
+
batch_type xr = constants::nan<batch_type>();
|
|
836
|
+
const batch_type n = detail::trigo_reducer<batch_type>::reduce(x, xr);
|
|
837
|
+
auto tmp = select(n >= batch_type(2.), batch_type(1.), batch_type(0.));
|
|
838
|
+
auto swap_bit = fma(batch_type(-2.), tmp, n);
|
|
839
|
+
auto test = (swap_bit == batch_type(0.));
|
|
840
|
+
const batch_type y = detail::tan_eval(xr, test);
|
|
841
|
+
return y ^ bitofsign(self);
|
|
842
|
+
}
|
|
843
|
+
template <class A, class T>
|
|
844
|
+
XSIMD_INLINE batch<std::complex<T>, A> tan(batch<std::complex<T>, A> const& z, requires_arch<common>) noexcept
|
|
845
|
+
{
|
|
846
|
+
using batch_type = batch<std::complex<T>, A>;
|
|
847
|
+
using real_batch = typename batch_type::real_batch;
|
|
848
|
+
real_batch d = cos(2 * z.real()) + cosh(2 * z.imag());
|
|
849
|
+
real_batch wreal = sin(2 * z.real()) / d;
|
|
850
|
+
real_batch wimag = sinh(2 * z.imag());
|
|
851
|
+
#ifdef __FAST_MATH__
|
|
852
|
+
return batch_type(wreal, real_batch(1.)), batch_type(wreal, wimag / d);
|
|
853
|
+
#else
|
|
854
|
+
batch_type winf(constants::infinity<real_batch>(), constants::infinity<real_batch>());
|
|
855
|
+
batch_type wres = select(isinf(wimag), batch_type(wreal, real_batch(1.)), batch_type(wreal, wimag / d));
|
|
856
|
+
return select(d == real_batch(0.), winf, wres);
|
|
857
|
+
#endif
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
// tanh
|
|
861
|
+
namespace detail
|
|
862
|
+
{
|
|
863
|
+
/* origin: boost/simd/arch/common/detail/common/tanh_kernel.hpp */
|
|
864
|
+
/*
|
|
865
|
+
* ====================================================
|
|
866
|
+
* copyright 2016 NumScale SAS
|
|
867
|
+
*
|
|
868
|
+
* Distributed under the Boost Software License, Version 1.0.
|
|
869
|
+
* (See copy at http://boost.org/LICENSE_1_0.txt)
|
|
870
|
+
* ====================================================
|
|
871
|
+
*/
|
|
872
|
+
template <class B>
|
|
873
|
+
struct tanh_kernel;
|
|
874
|
+
|
|
875
|
+
template <class A>
|
|
876
|
+
struct tanh_kernel<batch<float, A>>
|
|
877
|
+
{
|
|
878
|
+
using batch_type = batch<float, A>;
|
|
879
|
+
static XSIMD_INLINE batch_type tanh(const batch_type& x) noexcept
|
|
880
|
+
{
|
|
881
|
+
batch_type sqrx = x * x;
|
|
882
|
+
return fma(detail::horner<batch_type,
|
|
883
|
+
0xbeaaaa99, // -3.33332819422E-1F
|
|
884
|
+
0x3e088393, // +1.33314422036E-1F
|
|
885
|
+
0xbd5c1e2d, // -5.37397155531E-2F
|
|
886
|
+
0x3ca9134e, // +2.06390887954E-2F
|
|
887
|
+
0xbbbaf0ea // -5.70498872745E-3F
|
|
888
|
+
>(sqrx)
|
|
889
|
+
* sqrx,
|
|
890
|
+
x, x);
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
static XSIMD_INLINE batch_type cotanh(const batch_type& x) noexcept
|
|
894
|
+
{
|
|
895
|
+
return batch_type(1.) / tanh(x);
|
|
896
|
+
}
|
|
897
|
+
};
|
|
898
|
+
|
|
899
|
+
template <class A>
|
|
900
|
+
struct tanh_kernel<batch<double, A>>
|
|
901
|
+
{
|
|
902
|
+
using batch_type = batch<double, A>;
|
|
903
|
+
static XSIMD_INLINE batch_type tanh(const batch_type& x) noexcept
|
|
904
|
+
{
|
|
905
|
+
batch_type sqrx = x * x;
|
|
906
|
+
return fma(sqrx * p(sqrx) / q(sqrx), x, x);
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
static XSIMD_INLINE batch_type cotanh(const batch_type& x) noexcept
|
|
910
|
+
{
|
|
911
|
+
batch_type sqrx = x * x;
|
|
912
|
+
batch_type qval = q(sqrx);
|
|
913
|
+
return qval / (x * fma(p(sqrx), sqrx, qval));
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
static XSIMD_INLINE batch_type p(const batch_type& x) noexcept
|
|
917
|
+
{
|
|
918
|
+
return detail::horner<batch_type,
|
|
919
|
+
0xc0993ac030580563, // -1.61468768441708447952E3
|
|
920
|
+
0xc058d26a0e26682d, // -9.92877231001918586564E1,
|
|
921
|
+
0xbfeedc5baafd6f4b // -9.64399179425052238628E-1
|
|
922
|
+
>(x);
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
static XSIMD_INLINE batch_type q(const batch_type& x) noexcept
|
|
926
|
+
{
|
|
927
|
+
return detail::horner1<batch_type,
|
|
928
|
+
0x40b2ec102442040c, // 4.84406305325125486048E3
|
|
929
|
+
0x40a176fa0e5535fa, // 2.23548839060100448583E3,
|
|
930
|
+
0x405c33f28a581B86 // 1.12811678491632931402E2,
|
|
931
|
+
>(x);
|
|
932
|
+
}
|
|
933
|
+
};
|
|
934
|
+
|
|
935
|
+
}
|
|
936
|
+
/* origin: boost/simd/arch/common/simd/function/tanh.hpp */
|
|
937
|
+
/*
|
|
938
|
+
* ====================================================
|
|
939
|
+
* copyright 2016 NumScale SAS
|
|
940
|
+
*
|
|
941
|
+
* Distributed under the Boost Software License, Version 1.0.
|
|
942
|
+
* (See copy at http://boost.org/LICENSE_1_0.txt)
|
|
943
|
+
* ====================================================
|
|
944
|
+
*/
|
|
945
|
+
template <class A, class T>
|
|
946
|
+
XSIMD_INLINE batch<T, A> tanh(batch<T, A> const& self, requires_arch<common>) noexcept
|
|
947
|
+
{
|
|
948
|
+
using batch_type = batch<T, A>;
|
|
949
|
+
batch_type one(1.);
|
|
950
|
+
batch_type x = abs(self);
|
|
951
|
+
auto test = x < (batch_type(5.) / batch_type(8.));
|
|
952
|
+
batch_type bts = bitofsign(self);
|
|
953
|
+
batch_type z = one;
|
|
954
|
+
if (any(test))
|
|
955
|
+
{
|
|
956
|
+
z = detail::tanh_kernel<batch_type>::tanh(x);
|
|
957
|
+
if (all(test))
|
|
958
|
+
return z ^ bts;
|
|
959
|
+
}
|
|
960
|
+
batch_type r = fma(batch_type(-2.), one / (one + exp(x + x)), one);
|
|
961
|
+
return select(test, z, r) ^ bts;
|
|
962
|
+
}
|
|
963
|
+
template <class A, class T>
|
|
964
|
+
XSIMD_INLINE batch<std::complex<T>, A> tanh(const batch<std::complex<T>, A>& z, requires_arch<common>) noexcept
|
|
965
|
+
{
|
|
966
|
+
using real_batch = typename batch<std::complex<T>, A>::real_batch;
|
|
967
|
+
auto x = z.real();
|
|
968
|
+
auto y = z.imag();
|
|
969
|
+
real_batch two(2);
|
|
970
|
+
auto d = cosh(two * x) + cos(two * y);
|
|
971
|
+
return { sinh(two * x) / d, sin(two * y) / d };
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
#endif
|