koffi 2.3.6-beta.6 → 2.3.7
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/CHANGELOG.md +7 -0
- package/package.json +2 -2
- package/src/cnoke/cnoke.js +3 -7
- package/src/cnoke/src/builder.js +9 -6
- package/src/cnoke/src/index.js +2 -2
- package/src/koffi/build/2.3.7/koffi_darwin_arm64/koffi.node +0 -0
- package/src/koffi/build/2.3.7/koffi_darwin_x64/koffi.node +0 -0
- package/src/koffi/build/2.3.7/koffi_freebsd_arm64/koffi.node +0 -0
- package/src/koffi/build/2.3.7/koffi_freebsd_ia32/koffi.node +0 -0
- package/src/koffi/build/2.3.7/koffi_freebsd_x64/koffi.node +0 -0
- package/src/koffi/build/2.3.7/koffi_linux_arm32hf/koffi.node +0 -0
- package/src/koffi/build/2.3.7/koffi_linux_arm64/koffi.node +0 -0
- package/src/koffi/build/2.3.7/koffi_linux_ia32/koffi.node +0 -0
- package/src/koffi/build/2.3.7/koffi_linux_riscv64hf64/koffi.node +0 -0
- package/src/koffi/build/2.3.7/koffi_linux_x64/koffi.node +0 -0
- package/src/koffi/build/2.3.7/koffi_openbsd_ia32/koffi.node +0 -0
- package/src/koffi/build/2.3.7/koffi_openbsd_x64/koffi.node +0 -0
- package/src/koffi/build/2.3.7/koffi_win32_arm64/koffi.node +0 -0
- package/src/koffi/build/2.3.7/koffi_win32_ia32/koffi.node +0 -0
- package/src/koffi/build/2.3.7/koffi_win32_x64/koffi.node +0 -0
- package/src/koffi/src/ffi.cc +2 -2
- package/src/koffi/src/index.d.ts +2 -2
- package/src/koffi/src/index.js +1 -0
- package/src/koffi/build/2.3.6-beta.6/koffi_darwin_arm64/koffi.node +0 -0
- package/src/koffi/build/2.3.6-beta.6/koffi_darwin_x64/koffi.node +0 -0
- package/src/koffi/build/2.3.6-beta.6/koffi_freebsd_arm64/koffi.node +0 -0
- package/src/koffi/build/2.3.6-beta.6/koffi_freebsd_ia32/koffi.node +0 -0
- package/src/koffi/build/2.3.6-beta.6/koffi_freebsd_x64/koffi.node +0 -0
- package/src/koffi/build/2.3.6-beta.6/koffi_linux_arm32hf/koffi.node +0 -0
- package/src/koffi/build/2.3.6-beta.6/koffi_linux_arm64/koffi.node +0 -0
- package/src/koffi/build/2.3.6-beta.6/koffi_linux_ia32/koffi.node +0 -0
- package/src/koffi/build/2.3.6-beta.6/koffi_linux_riscv64hf64/koffi.node +0 -0
- package/src/koffi/build/2.3.6-beta.6/koffi_linux_x64/koffi.node +0 -0
- package/src/koffi/build/2.3.6-beta.6/koffi_openbsd_ia32/koffi.node +0 -0
- package/src/koffi/build/2.3.6-beta.6/koffi_openbsd_x64/koffi.node +0 -0
- package/src/koffi/build/2.3.6-beta.6/koffi_win32_arm64/koffi.node +0 -0
- package/src/koffi/build/2.3.6-beta.6/koffi_win32_arm64/koffi.pdb +0 -0
- package/src/koffi/build/2.3.6-beta.6/koffi_win32_ia32/koffi.node +0 -0
- package/src/koffi/build/2.3.6-beta.6/koffi_win32_ia32/koffi.pdb +0 -0
- package/src/koffi/build/2.3.6-beta.6/koffi_win32_x64/koffi.node +0 -0
- package/src/koffi/build/2.3.6-beta.6/koffi_win32_x64/koffi.pdb +0 -0
- package/vendor/brotli/BUILD +0 -144
- package/vendor/brotli/CMakeLists.txt +0 -421
- package/vendor/brotli/CONTRIBUTING.md +0 -27
- package/vendor/brotli/LICENSE +0 -19
- package/vendor/brotli/MANIFEST.in +0 -17
- package/vendor/brotli/Makefile +0 -55
- package/vendor/brotli/Makefile.am +0 -38
- package/vendor/brotli/README +0 -15
- package/vendor/brotli/README.md +0 -104
- package/vendor/brotli/WORKSPACE +0 -21
- package/vendor/brotli/bootstrap +0 -35
- package/vendor/brotli/c/common/constants.c +0 -15
- package/vendor/brotli/c/common/constants.h +0 -200
- package/vendor/brotli/c/common/context.c +0 -156
- package/vendor/brotli/c/common/context.h +0 -113
- package/vendor/brotli/c/common/dictionary.c +0 -5914
- package/vendor/brotli/c/common/dictionary.h +0 -64
- package/vendor/brotli/c/common/platform.c +0 -22
- package/vendor/brotli/c/common/platform.h +0 -596
- package/vendor/brotli/c/common/transform.c +0 -291
- package/vendor/brotli/c/common/transform.h +0 -85
- package/vendor/brotli/c/common/version.h +0 -26
- package/vendor/brotli/c/dec/bit_reader.c +0 -76
- package/vendor/brotli/c/dec/bit_reader.h +0 -351
- package/vendor/brotli/c/dec/decode.c +0 -2608
- package/vendor/brotli/c/dec/huffman.c +0 -339
- package/vendor/brotli/c/dec/huffman.h +0 -121
- package/vendor/brotli/c/dec/prefix.h +0 -732
- package/vendor/brotli/c/dec/state.c +0 -159
- package/vendor/brotli/c/dec/state.h +0 -365
- package/vendor/brotli/c/enc/backward_references.c +0 -145
- package/vendor/brotli/c/enc/backward_references.h +0 -39
- package/vendor/brotli/c/enc/backward_references_hq.c +0 -843
- package/vendor/brotli/c/enc/backward_references_hq.h +0 -95
- package/vendor/brotli/c/enc/backward_references_inc.h +0 -163
- package/vendor/brotli/c/enc/bit_cost.c +0 -35
- package/vendor/brotli/c/enc/bit_cost.h +0 -63
- package/vendor/brotli/c/enc/bit_cost_inc.h +0 -127
- package/vendor/brotli/c/enc/block_encoder_inc.h +0 -34
- package/vendor/brotli/c/enc/block_splitter.c +0 -194
- package/vendor/brotli/c/enc/block_splitter.h +0 -51
- package/vendor/brotli/c/enc/block_splitter_inc.h +0 -440
- package/vendor/brotli/c/enc/brotli_bit_stream.c +0 -1314
- package/vendor/brotli/c/enc/brotli_bit_stream.h +0 -84
- package/vendor/brotli/c/enc/cluster.c +0 -56
- package/vendor/brotli/c/enc/cluster.h +0 -48
- package/vendor/brotli/c/enc/cluster_inc.h +0 -320
- package/vendor/brotli/c/enc/command.c +0 -28
- package/vendor/brotli/c/enc/command.h +0 -190
- package/vendor/brotli/c/enc/compress_fragment.c +0 -790
- package/vendor/brotli/c/enc/compress_fragment.h +0 -61
- package/vendor/brotli/c/enc/compress_fragment_two_pass.c +0 -645
- package/vendor/brotli/c/enc/compress_fragment_two_pass.h +0 -54
- package/vendor/brotli/c/enc/dictionary_hash.c +0 -1846
- package/vendor/brotli/c/enc/dictionary_hash.h +0 -25
- package/vendor/brotli/c/enc/encode.c +0 -1927
- package/vendor/brotli/c/enc/encoder_dict.c +0 -33
- package/vendor/brotli/c/enc/encoder_dict.h +0 -43
- package/vendor/brotli/c/enc/entropy_encode.c +0 -503
- package/vendor/brotli/c/enc/entropy_encode.h +0 -122
- package/vendor/brotli/c/enc/entropy_encode_static.h +0 -539
- package/vendor/brotli/c/enc/fast_log.c +0 -105
- package/vendor/brotli/c/enc/fast_log.h +0 -66
- package/vendor/brotli/c/enc/find_match_length.h +0 -79
- package/vendor/brotli/c/enc/hash.h +0 -488
- package/vendor/brotli/c/enc/hash_composite_inc.h +0 -125
- package/vendor/brotli/c/enc/hash_forgetful_chain_inc.h +0 -293
- package/vendor/brotli/c/enc/hash_longest_match64_inc.h +0 -267
- package/vendor/brotli/c/enc/hash_longest_match_inc.h +0 -262
- package/vendor/brotli/c/enc/hash_longest_match_quickly_inc.h +0 -266
- package/vendor/brotli/c/enc/hash_rolling_inc.h +0 -212
- package/vendor/brotli/c/enc/hash_to_binary_tree_inc.h +0 -329
- package/vendor/brotli/c/enc/histogram.c +0 -100
- package/vendor/brotli/c/enc/histogram.h +0 -63
- package/vendor/brotli/c/enc/histogram_inc.h +0 -51
- package/vendor/brotli/c/enc/literal_cost.c +0 -175
- package/vendor/brotli/c/enc/literal_cost.h +0 -30
- package/vendor/brotli/c/enc/memory.c +0 -170
- package/vendor/brotli/c/enc/memory.h +0 -114
- package/vendor/brotli/c/enc/metablock.c +0 -663
- package/vendor/brotli/c/enc/metablock.h +0 -105
- package/vendor/brotli/c/enc/metablock_inc.h +0 -183
- package/vendor/brotli/c/enc/params.h +0 -46
- package/vendor/brotli/c/enc/prefix.h +0 -53
- package/vendor/brotli/c/enc/quality.h +0 -165
- package/vendor/brotli/c/enc/ringbuffer.h +0 -167
- package/vendor/brotli/c/enc/static_dict.c +0 -486
- package/vendor/brotli/c/enc/static_dict.h +0 -40
- package/vendor/brotli/c/enc/static_dict_lut.h +0 -5864
- package/vendor/brotli/c/enc/utf8_util.c +0 -85
- package/vendor/brotli/c/enc/utf8_util.h +0 -32
- package/vendor/brotli/c/enc/write_bits.h +0 -87
- package/vendor/brotli/c/include/brotli/decode.h +0 -344
- package/vendor/brotli/c/include/brotli/encode.h +0 -448
- package/vendor/brotli/c/include/brotli/port.h +0 -288
- package/vendor/brotli/c/include/brotli/types.h +0 -83
- package/vendor/brotli/c/tools/brotli.c +0 -1116
- package/vendor/brotli/c/tools/brotli.md +0 -107
- package/vendor/brotli/compiler_config_setting.bzl +0 -28
- package/vendor/brotli/configure +0 -8
- package/vendor/brotli/configure-cmake +0 -318
- package/vendor/brotli/configure.ac +0 -14
- package/vendor/brotli/docs/brotli.1 +0 -132
- package/vendor/brotli/docs/constants.h.3 +0 -47
- package/vendor/brotli/docs/decode.h.3 +0 -415
- package/vendor/brotli/docs/encode.h.3 +0 -586
- package/vendor/brotli/docs/types.h.3 +0 -117
- package/vendor/brotli/premake5.lua +0 -78
- package/vendor/brotli/python/Makefile +0 -57
- package/vendor/brotli/python/README.md +0 -54
- package/vendor/brotli/python/_brotli.cc +0 -753
- package/vendor/brotli/python/bro.py +0 -160
- package/vendor/brotli/python/brotli.py +0 -56
- package/vendor/brotli/python/tests/__init__.py +0 -0
- package/vendor/brotli/python/tests/_test_utils.py +0 -112
- package/vendor/brotli/python/tests/bro_test.py +0 -102
- package/vendor/brotli/python/tests/compress_test.py +0 -41
- package/vendor/brotli/python/tests/compressor_test.py +0 -94
- package/vendor/brotli/python/tests/decompress_test.py +0 -42
- package/vendor/brotli/python/tests/decompressor_test.py +0 -59
- package/vendor/brotli/scripts/libbrotlicommon.pc.in +0 -11
- package/vendor/brotli/scripts/libbrotlidec.pc.in +0 -12
- package/vendor/brotli/scripts/libbrotlienc.pc.in +0 -12
- package/vendor/brotli/scripts/sources.lst +0 -104
- package/vendor/brotli/setup.cfg +0 -5
- package/vendor/brotli/setup.py +0 -293
- package/vendor/brotli/tests/Makefile +0 -17
- package/vendor/brotli/tests/compatibility_test.sh +0 -25
- package/vendor/brotli/tests/roundtrip_test.sh +0 -36
- package/vendor/brotli/tests/run-compatibility-test.cmake +0 -31
- package/vendor/brotli/tests/run-roundtrip-test.cmake +0 -36
- package/vendor/brotli/tests/testdata/empty +0 -0
- package/vendor/brotli/tests/testdata/empty.compressed +0 -1
- package/vendor/brotli/tests/testdata/ukkonooa +0 -1
- package/vendor/brotli/tests/testdata/ukkonooa.compressed +0 -0
- package/vendor/dragonbox/CMakeLists.txt +0 -123
- package/vendor/dragonbox/LICENSE-Apache2-LLVM +0 -218
- package/vendor/dragonbox/LICENSE-Boost +0 -23
- package/vendor/dragonbox/README.md +0 -277
- package/vendor/dragonbox/cmake/dragonboxConfig.cmake +0 -1
- package/vendor/dragonbox/include/dragonbox/dragonbox.h +0 -2674
- package/vendor/dragonbox/include/dragonbox/dragonbox_to_chars.h +0 -108
- package/vendor/dragonbox/other_files/Dragonbox.pdf +0 -0
- package/vendor/dragonbox/other_files/Dragonbox_old.pdf +0 -0
- package/vendor/dragonbox/other_files/milo_benchmark.png +0 -0
- package/vendor/dragonbox/other_files/unknown_win64_vc2019.html +0 -540
- package/vendor/dragonbox/other_files/unknown_win64_vc2019_randomdigit_time.png +0 -0
- package/vendor/dragonbox/source/dragonbox_to_chars.cpp +0 -303
- package/vendor/dragonbox/subproject/3rdparty/grisu_exact/CMakeLists.txt +0 -24
- package/vendor/dragonbox/subproject/3rdparty/grisu_exact/fp_to_chars.cpp +0 -238
- package/vendor/dragonbox/subproject/3rdparty/grisu_exact/fp_to_chars.h +0 -95
- package/vendor/dragonbox/subproject/3rdparty/grisu_exact/grisu_exact.h +0 -2666
- package/vendor/dragonbox/subproject/3rdparty/ryu/CMakeLists.txt +0 -16
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/common.h +0 -114
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/d2s.c +0 -509
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/d2s_full_table.h +0 -367
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/d2s_intrinsics.h +0 -357
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/digit_table.h +0 -35
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/f2s.c +0 -345
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/f2s_full_table.h +0 -55
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/f2s_intrinsics.h +0 -128
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/ryu.h +0 -46
- package/vendor/dragonbox/subproject/3rdparty/schubfach/CMakeLists.txt +0 -22
- package/vendor/dragonbox/subproject/3rdparty/schubfach/schubfach_32.cc +0 -699
- package/vendor/dragonbox/subproject/3rdparty/schubfach/schubfach_32.h +0 -31
- package/vendor/dragonbox/subproject/3rdparty/schubfach/schubfach_64.cc +0 -1354
- package/vendor/dragonbox/subproject/3rdparty/schubfach/schubfach_64.h +0 -31
- package/vendor/dragonbox/subproject/3rdparty/shaded_plots/example_shaded_plots.m +0 -68
- package/vendor/dragonbox/subproject/3rdparty/shaded_plots/license.txt +0 -25
- package/vendor/dragonbox/subproject/3rdparty/shaded_plots/plot_distribution.m +0 -92
- package/vendor/dragonbox/subproject/3rdparty/shaded_plots/plot_distribution_prctile.m +0 -121
- package/vendor/dragonbox/subproject/3rdparty/shaded_plots/plot_histogram_shaded.m +0 -99
- package/vendor/dragonbox/subproject/3rdparty/shaded_plots/plot_shaded.m +0 -93
- package/vendor/dragonbox/subproject/benchmark/CMakeLists.txt +0 -65
- package/vendor/dragonbox/subproject/benchmark/include/benchmark.h +0 -40
- package/vendor/dragonbox/subproject/benchmark/matlab/plot_benchmarks.m +0 -22
- package/vendor/dragonbox/subproject/benchmark/matlab/plot_digit_benchmark.m +0 -78
- package/vendor/dragonbox/subproject/benchmark/matlab/plot_uniform_benchmark.m +0 -95
- package/vendor/dragonbox/subproject/benchmark/results/digits_benchmark_binary32_clang.png +0 -0
- package/vendor/dragonbox/subproject/benchmark/results/digits_benchmark_binary32_msvc.png +0 -0
- package/vendor/dragonbox/subproject/benchmark/results/digits_benchmark_binary64_clang.png +0 -0
- package/vendor/dragonbox/subproject/benchmark/results/digits_benchmark_binary64_msvc.png +0 -0
- package/vendor/dragonbox/subproject/benchmark/results/uniform_benchmark_binary32_clang.png +0 -0
- package/vendor/dragonbox/subproject/benchmark/results/uniform_benchmark_binary32_msvc.png +0 -0
- package/vendor/dragonbox/subproject/benchmark/results/uniform_benchmark_binary64_clang.png +0 -0
- package/vendor/dragonbox/subproject/benchmark/results/uniform_benchmark_binary64_msvc.png +0 -0
- package/vendor/dragonbox/subproject/benchmark/source/benchmark.cpp +0 -238
- package/vendor/dragonbox/subproject/benchmark/source/dragonbox.cpp +0 -30
- package/vendor/dragonbox/subproject/benchmark/source/grisu_exact.cpp +0 -36
- package/vendor/dragonbox/subproject/benchmark/source/ryu.cpp +0 -27
- package/vendor/dragonbox/subproject/benchmark/source/schubfach.cpp +0 -31
- package/vendor/dragonbox/subproject/common/CMakeLists.txt +0 -42
- package/vendor/dragonbox/subproject/common/include/best_rational_approx.h +0 -97
- package/vendor/dragonbox/subproject/common/include/big_uint.h +0 -218
- package/vendor/dragonbox/subproject/common/include/continued_fractions.h +0 -174
- package/vendor/dragonbox/subproject/common/include/good_rational_approx.h +0 -267
- package/vendor/dragonbox/subproject/common/include/random_float.h +0 -182
- package/vendor/dragonbox/subproject/common/include/rational_continued_fractions.h +0 -57
- package/vendor/dragonbox/subproject/common/source/big_uint.cpp +0 -602
- package/vendor/dragonbox/subproject/meta/CMakeLists.txt +0 -41
- package/vendor/dragonbox/subproject/meta/results/binary32_generated_cache.txt +0 -82
- package/vendor/dragonbox/subproject/meta/results/binary64_compressed_cache_error_table.txt +0 -10
- package/vendor/dragonbox/subproject/meta/results/binary64_generated_cache.txt +0 -623
- package/vendor/dragonbox/subproject/meta/source/generate_cache.cpp +0 -126
- package/vendor/dragonbox/subproject/meta/source/live_test.cpp +0 -81
- package/vendor/dragonbox/subproject/meta/source/perf_test.cpp +0 -104
- package/vendor/dragonbox/subproject/meta/source/sandbox.cpp +0 -20
- package/vendor/dragonbox/subproject/test/CMakeLists.txt +0 -70
- package/vendor/dragonbox/subproject/test/results/binary32.csv +0 -255
- package/vendor/dragonbox/subproject/test/results/binary64.csv +0 -2047
- package/vendor/dragonbox/subproject/test/results/plot_required_bits.m +0 -18
- package/vendor/dragonbox/subproject/test/source/test_all_shorter_interval_cases.cpp +0 -88
- package/vendor/dragonbox/subproject/test/source/uniform_random_test.cpp +0 -95
- package/vendor/dragonbox/subproject/test/source/verify_cache_precision.cpp +0 -338
- package/vendor/dragonbox/subproject/test/source/verify_compressed_cache.cpp +0 -154
- package/vendor/dragonbox/subproject/test/source/verify_fast_multiplication.cpp +0 -168
- package/vendor/dragonbox/subproject/test/source/verify_log_computation.cpp +0 -251
- package/vendor/dragonbox/subproject/test/source/verify_magic_division.cpp +0 -113
- package/vendor/miniz/ChangeLog.md +0 -239
- package/vendor/miniz/LICENSE +0 -22
- package/vendor/miniz/examples/example1.c +0 -105
- package/vendor/miniz/examples/example2.c +0 -164
- package/vendor/miniz/examples/example3.c +0 -269
- package/vendor/miniz/examples/example4.c +0 -102
- package/vendor/miniz/examples/example5.c +0 -327
- package/vendor/miniz/examples/example6.c +0 -166
- package/vendor/miniz/miniz.c +0 -7835
- package/vendor/miniz/miniz.h +0 -1422
- package/vendor/miniz/readme.md +0 -46
- /package/src/koffi/build/{2.3.6-beta.6 → 2.3.7}/koffi_win32_arm64/koffi.exp +0 -0
- /package/src/koffi/build/{2.3.6-beta.6 → 2.3.7}/koffi_win32_arm64/koffi.lib +0 -0
- /package/src/koffi/build/{2.3.6-beta.6 → 2.3.7}/koffi_win32_ia32/koffi.exp +0 -0
- /package/src/koffi/build/{2.3.6-beta.6 → 2.3.7}/koffi_win32_ia32/koffi.lib +0 -0
- /package/src/koffi/build/{2.3.6-beta.6 → 2.3.7}/koffi_win32_x64/koffi.exp +0 -0
- /package/src/koffi/build/{2.3.6-beta.6 → 2.3.7}/koffi_win32_x64/koffi.lib +0 -0
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// Copyright 2020 Alexander Bolz
|
|
2
|
-
//
|
|
3
|
-
// Distributed under the Boost Software License, Version 1.0.
|
|
4
|
-
// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
|
|
5
|
-
|
|
6
|
-
#pragma once
|
|
7
|
-
|
|
8
|
-
namespace schubfach {
|
|
9
|
-
|
|
10
|
-
// char* output_end = Dtoa(buffer, value);
|
|
11
|
-
//
|
|
12
|
-
// Converts the given double-precision number into decimal form and stores the result in the given
|
|
13
|
-
// buffer.
|
|
14
|
-
//
|
|
15
|
-
// The buffer must be large enough, i.e. >= DtoaMinBufferLength.
|
|
16
|
-
// The output format is similar to printf("%g").
|
|
17
|
-
// The output is _not_ null-terminted.
|
|
18
|
-
//
|
|
19
|
-
// The output is optimal, i.e. the output string
|
|
20
|
-
// 1. rounds back to the input number when read in (using round-to-nearest-even)
|
|
21
|
-
// 2. is as short as possible,
|
|
22
|
-
// 3. is as close to the input number as possible.
|
|
23
|
-
//
|
|
24
|
-
// Note:
|
|
25
|
-
// This function may temporarily write up to DtoaMinBufferLength characters into the buffer.
|
|
26
|
-
|
|
27
|
-
constexpr int DtoaMinBufferLength = 64;
|
|
28
|
-
|
|
29
|
-
char* Dtoa(char* buffer, double value);
|
|
30
|
-
|
|
31
|
-
} // namespace schubfach
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
%% Shaded line plot
|
|
2
|
-
% Example showing the difference between the standard plot routine and the
|
|
3
|
-
% shaded routine
|
|
4
|
-
|
|
5
|
-
x = -2*pi:pi/100:2*pi;
|
|
6
|
-
fx = sin(x);
|
|
7
|
-
|
|
8
|
-
figure('Color','w');
|
|
9
|
-
subplot(1,2,1);
|
|
10
|
-
hold on
|
|
11
|
-
plot(x,fx);
|
|
12
|
-
plot(2*x+pi/2,0.5*fx+0.1*x);
|
|
13
|
-
hold off
|
|
14
|
-
title('plot');
|
|
15
|
-
|
|
16
|
-
subplot(1,2,2);
|
|
17
|
-
hold on
|
|
18
|
-
plot_shaded(x,fx);
|
|
19
|
-
plot_shaded(2*x+pi/2,0.5*fx+0.1*x);
|
|
20
|
-
hold off
|
|
21
|
-
title('plot\_shaded');
|
|
22
|
-
|
|
23
|
-
%% Histogram plot
|
|
24
|
-
% Plots two histograms for two different distributions
|
|
25
|
-
|
|
26
|
-
X1 = 3 + 2.0*randn([100000,1]);
|
|
27
|
-
X2 = 12 + 4.0*randn([100000,1]);
|
|
28
|
-
|
|
29
|
-
figure('Color','w');
|
|
30
|
-
hold on
|
|
31
|
-
plot_histogram_shaded(X1,'Alpha',0.3);
|
|
32
|
-
plot_histogram_shaded(X2);
|
|
33
|
-
hold off
|
|
34
|
-
title('plot\_histogram\_shaded');
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
%% Distribution plots
|
|
38
|
-
% Show different plot routines to visualize measurement errors/noise
|
|
39
|
-
|
|
40
|
-
X = 1:0.25:10;
|
|
41
|
-
Y = sin(X)+0.25*X;
|
|
42
|
-
Y_error = randn(1000,numel(Y));
|
|
43
|
-
Y_noisy = Y+Y_error.*repmat(0.1*X,[size(Y_error,1) 1]);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
figure('Color','w');
|
|
47
|
-
subplot(3,1,1);
|
|
48
|
-
plot(X,Y,'LineWidth',1.5);
|
|
49
|
-
title('plot (True value y=f(x))');
|
|
50
|
-
ylim([-1 5]);
|
|
51
|
-
|
|
52
|
-
subplot(3,1,2);
|
|
53
|
-
hold on
|
|
54
|
-
plot(X,Y,'LineWidth',1.5);
|
|
55
|
-
plot_distribution(X,Y_noisy);
|
|
56
|
-
hold off
|
|
57
|
-
title('plot\_distribution');
|
|
58
|
-
ylim([-1 5]);
|
|
59
|
-
|
|
60
|
-
subplot(3,1,3);
|
|
61
|
-
hold on
|
|
62
|
-
plot(X,Y,'LineWidth',1.5);
|
|
63
|
-
plot_distribution_prctile(X,Y_noisy,'Prctile',[25 50 75 90]);
|
|
64
|
-
hold off
|
|
65
|
-
title('plot\_distribution\_prctile');
|
|
66
|
-
ylim([-1 5]);
|
|
67
|
-
|
|
68
|
-
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2018, John A. Onofrey
|
|
2
|
-
All rights reserved.
|
|
3
|
-
|
|
4
|
-
Redistribution and use in source and binary forms, with or without
|
|
5
|
-
modification, are permitted provided that the following conditions are met:
|
|
6
|
-
|
|
7
|
-
* Redistributions of source code must retain the above copyright notice, this
|
|
8
|
-
list of conditions and the following disclaimer.
|
|
9
|
-
|
|
10
|
-
* Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
-
this list of conditions and the following disclaimer in the documentation
|
|
12
|
-
and/or other materials provided with the distribution
|
|
13
|
-
* Neither the name of Yale University nor the names of its
|
|
14
|
-
contributors may be used to endorse or promote products derived from this
|
|
15
|
-
software without specific prior written permission.
|
|
16
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
17
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
18
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
19
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
|
20
|
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
21
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
22
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
23
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
24
|
-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
25
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
function plot_distribution(varargin)
|
|
2
|
-
% PLOT_DISTRIBUTION(X,Y) - Plots the mean with standard deviation errors as a shaded region in the open
|
|
3
|
-
% figure window.
|
|
4
|
-
% Inputs:
|
|
5
|
-
% X: vector of n domain values (the x-axis).
|
|
6
|
-
% Y: mxn matrix of distribution of range values (the y-axis), where m
|
|
7
|
-
% corresponds to the number of data samples for each value n.
|
|
8
|
-
%
|
|
9
|
-
% PLOT_DISTRIBUTION(X,Y,...)
|
|
10
|
-
% Parameter options include:
|
|
11
|
-
% 'Alpha': the alpha value of the shaded region, default 0.15.
|
|
12
|
-
% 'Color': the shaded region color.
|
|
13
|
-
% 'LineWidth': the contour line width, default = 2.0.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
[X,Y,color_value,alpha_value,line_width] = parseinputs(varargin{:});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
MU = mean(Y);
|
|
20
|
-
SIGMA = std(Y);
|
|
21
|
-
|
|
22
|
-
hold on
|
|
23
|
-
% Create the polygons for the shaded region
|
|
24
|
-
|
|
25
|
-
Ptop = MU+SIGMA;
|
|
26
|
-
Pbot = MU-SIGMA;
|
|
27
|
-
|
|
28
|
-
for i=1:numel(X)-1
|
|
29
|
-
Px = [X(i) X(i+1) X(i+1) X(i)];
|
|
30
|
-
Py = [Ptop(i) Ptop(i+1) Pbot(i+1) Pbot(i)];
|
|
31
|
-
fill(Px,Py,color_value,'FaceAlpha',alpha_value,'EdgeColor','none');
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
plot(X,MU,'LineWidth',line_width,'Color',color_value);
|
|
35
|
-
hold off
|
|
36
|
-
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
function [X,Y,color_value,alpha_value,line_width] = parseinputs(varargin)
|
|
43
|
-
|
|
44
|
-
% Check the number of input args
|
|
45
|
-
minargs = 2;
|
|
46
|
-
numopts = 3;
|
|
47
|
-
maxargs = minargs + 2*numopts;
|
|
48
|
-
narginchk(minargs,maxargs);
|
|
49
|
-
|
|
50
|
-
ax = gca;
|
|
51
|
-
|
|
52
|
-
% Set the defaults
|
|
53
|
-
alpha_value = 0.15;
|
|
54
|
-
color_value = ax.ColorOrder(ax.ColorOrderIndex,:);
|
|
55
|
-
line_width = 2.0;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
% Get the inputs and check them
|
|
59
|
-
X = varargin{1};
|
|
60
|
-
validateattributes(X,{'numeric'},{'vector','nonnan','finite'},mfilename,'X',2);
|
|
61
|
-
Y = varargin{2};
|
|
62
|
-
validateattributes(Y,{'numeric'},{'2d','nonnan','finite','ncols',numel(X)},mfilename,'Y',2);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if nargin > minargs
|
|
66
|
-
for i=(minargs+1):2:nargin
|
|
67
|
-
PNAME = varargin{i};
|
|
68
|
-
PVALUE = varargin{i+1};
|
|
69
|
-
|
|
70
|
-
PNAME = validatestring(PNAME,{'Alpha','Color','LineWidth','Prctile'},...
|
|
71
|
-
mfilename,'ParameterName',i);
|
|
72
|
-
|
|
73
|
-
switch PNAME
|
|
74
|
-
case 'Alpha'
|
|
75
|
-
validateattributes(PVALUE,{'numeric'},{'scalar','nonnan','finite','nonnegative','<=',1.0},mfilename,PNAME,i+1);
|
|
76
|
-
alpha_value = PVALUE;
|
|
77
|
-
case 'Color'
|
|
78
|
-
validateattributes(PVALUE,{'numeric'},{'real','nonnegative','nonempty','vector','numel',3,'<=',1.0},mfilename,PNAME,i+1);
|
|
79
|
-
color_value = PVALUE;
|
|
80
|
-
case 'LineWidth'
|
|
81
|
-
validateattributes(PVALUE,{'numeric'},{'scalar','finite','nonnegative'},...
|
|
82
|
-
mfilename,PNAME,i+1);
|
|
83
|
-
line_width = PVALUE;
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
function plot_distribution_prctile(varargin)
|
|
2
|
-
% PLOT_DISTRIBUTION_PRCTILE(X,Y) - Plots the median with percentile errors as a shaded region in the open
|
|
3
|
-
% figure window.
|
|
4
|
-
% Inputs:
|
|
5
|
-
% X: vector of n domain values (the x-axis).
|
|
6
|
-
% Y: mxn matrix of distribution of range values (the y-axis), where m
|
|
7
|
-
% corresponds to the number of data samples for each value n.
|
|
8
|
-
%
|
|
9
|
-
% PLOT_DISTRIBUTION_PRCTILE(X,Y,...)
|
|
10
|
-
% Parameter options include:
|
|
11
|
-
% 'Alpha': the alpha value of the shaded region, default 0.15.
|
|
12
|
-
% 'Color': the shaded region color.
|
|
13
|
-
% 'LineWidth': the contour line width, default = 2.0.
|
|
14
|
-
% 'Prctile': the percentile values to plot, default [50] (the middle
|
|
15
|
-
% 50 percentile, or inter-quartile range).
|
|
16
|
-
%
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
[X,Y,prctile_value,color_value,alpha_value,line_width] = parseinputs(varargin{:});
|
|
20
|
-
|
|
21
|
-
p_value = 0.5*(100-sort(prctile_value));
|
|
22
|
-
|
|
23
|
-
hold on
|
|
24
|
-
% Create the polygons for the shaded region
|
|
25
|
-
%%%% This part is modified by Junekey Jeon %%%%
|
|
26
|
-
% for j=1:numel(p_value)
|
|
27
|
-
% Ptop = prctile(Y,100-p_value(j));
|
|
28
|
-
% Pbot = prctile(Y,p_value(j));
|
|
29
|
-
% for i=1:numel(X)-1
|
|
30
|
-
% Px = [X(i) X(i+1) X(i+1) X(i)];
|
|
31
|
-
% Py = [Ptop(i) Ptop(i+1) Pbot(i+1) Pbot(i)];
|
|
32
|
-
% fill(Px,Py,color_value,'FaceAlpha',alpha_value,'EdgeColor','none');
|
|
33
|
-
% end
|
|
34
|
-
% end
|
|
35
|
-
% plot(X,median(Y),'LineWidth',line_width,'Color',color_value);
|
|
36
|
-
Ptop = prctile(Y,100-p_value(1));
|
|
37
|
-
Pbot = prctile(Y,p_value(1));
|
|
38
|
-
block_alpha_value = 1- (1-alpha_value)^numel(p_value);
|
|
39
|
-
for i=1:numel(X)-1
|
|
40
|
-
Px = [X(i) X(i+1) X(i+1) X(i)];
|
|
41
|
-
Py = [Ptop(i) Ptop(i+1) Pbot(i+1) Pbot(i)];
|
|
42
|
-
fill(Px,Py,color_value,'FaceAlpha',block_alpha_value,'EdgeColor','none');
|
|
43
|
-
end
|
|
44
|
-
for j=2:numel(p_value)
|
|
45
|
-
Ptop1 = prctile(Y,100-p_value(j));
|
|
46
|
-
Ptop2 = prctile(Y,100-p_value(j-1));
|
|
47
|
-
Pbot1 = prctile(Y,p_value(j));
|
|
48
|
-
Pbot2 = prctile(Y,p_value(j-1));
|
|
49
|
-
block_alpha_value = 1- (1-alpha_value)^(numel(p_value) - j + 1);
|
|
50
|
-
for i=1:numel(X)-1
|
|
51
|
-
Px = [X(i) X(i+1) X(i+1) X(i)];
|
|
52
|
-
Py = [Ptop1(i) Ptop1(i+1) Ptop2(i+1) Ptop2(i)];
|
|
53
|
-
fill(Px,Py,color_value,'FaceAlpha',block_alpha_value,'EdgeColor','none');
|
|
54
|
-
Px = [X(i) X(i+1) X(i+1) X(i)];
|
|
55
|
-
Py = [Pbot1(i) Pbot1(i+1) Pbot2(i+1) Pbot2(i)];
|
|
56
|
-
fill(Px,Py,color_value,'FaceAlpha',block_alpha_value,'EdgeColor','none');
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
plot(X,median(Y),'--','LineWidth',line_width,'Color',color_value);
|
|
60
|
-
hold off
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
function [X,Y,prctile_value,color_value,alpha_value,line_width] = parseinputs(varargin)
|
|
70
|
-
|
|
71
|
-
% Check the number of input args
|
|
72
|
-
minargs = 2;
|
|
73
|
-
numopts = 4;
|
|
74
|
-
maxargs = minargs + 2*numopts;
|
|
75
|
-
narginchk(minargs,maxargs);
|
|
76
|
-
|
|
77
|
-
ax = gca;
|
|
78
|
-
|
|
79
|
-
% Set the defaults
|
|
80
|
-
prctile_value = 50;
|
|
81
|
-
alpha_value = 0.15;
|
|
82
|
-
color_value = ax.ColorOrder(ax.ColorOrderIndex,:);
|
|
83
|
-
line_width = 2.0;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
% Get the inputs and check them
|
|
87
|
-
X = varargin{1};
|
|
88
|
-
validateattributes(X,{'numeric'},{'vector','nonnan','finite'},mfilename,'X',2);
|
|
89
|
-
Y = varargin{2};
|
|
90
|
-
validateattributes(Y,{'numeric'},{'2d','nonnan','finite','ncols',numel(X)},mfilename,'Y',2);
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if nargin > minargs
|
|
94
|
-
for i=3:2:nargin
|
|
95
|
-
PNAME = varargin{i};
|
|
96
|
-
PVALUE = varargin{i+1};
|
|
97
|
-
|
|
98
|
-
PNAME = validatestring(PNAME,{'Alpha','Color','LineWidth','Prctile'},...
|
|
99
|
-
mfilename,'ParameterName',i);
|
|
100
|
-
|
|
101
|
-
switch PNAME
|
|
102
|
-
case 'Alpha'
|
|
103
|
-
validateattributes(PVALUE,{'numeric'},{'scalar','nonnan','finite','nonnegative','<=',1.0},mfilename,PNAME,i+1);
|
|
104
|
-
alpha_value = PVALUE;
|
|
105
|
-
case 'Color'
|
|
106
|
-
validateattributes(PVALUE,{'numeric'},{'real','nonnegative','nonempty','vector','numel',3,'<=',1.0},mfilename,PNAME,i+1);
|
|
107
|
-
color_value = PVALUE;
|
|
108
|
-
case 'LineWidth'
|
|
109
|
-
validateattributes(PVALUE,{'numeric'},{'scalar','finite','nonnegative'},...
|
|
110
|
-
mfilename,PNAME,i+1);
|
|
111
|
-
line_width = PVALUE;
|
|
112
|
-
case 'Prctile'
|
|
113
|
-
validateattributes(PVALUE,{'numeric'},{'vector','finite','nonnan','nonnegative','<=',100},...
|
|
114
|
-
mfilename,PNAME,i+1);
|
|
115
|
-
prctile_value = PVALUE;
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
end
|
|
121
|
-
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
function [bin_centers,hist_values,bin_edges] = plot_histogram_shaded(varargin)
|
|
2
|
-
% [C,V,E] = PLOT_HISTOGRAM_SHADED(X) - Plots the histogram as a shaded line plot instead of bar plot.
|
|
3
|
-
% Outputs:
|
|
4
|
-
% C: the histogram bin centers.
|
|
5
|
-
% V: the histogram values at each bin.
|
|
6
|
-
% E: the histogram bin edges values.
|
|
7
|
-
%
|
|
8
|
-
% [C,V,E] = PLOT_HISTOGRAM_SHADED(X,_)
|
|
9
|
-
% Optional values:
|
|
10
|
-
% 'alpha': alpha value of the shaded region, default 0.2.
|
|
11
|
-
% 'bins': number of bins, default [].
|
|
12
|
-
% 'color': color of the plot, default [0 0 1].
|
|
13
|
-
% 'edges': the bins edges to use, default [].
|
|
14
|
-
% 'normalization': the normalization type to use (see histogram doc),
|
|
15
|
-
% default 'probability'
|
|
16
|
-
%
|
|
17
|
-
|
|
18
|
-
[X,n_bins,bin_edges,color_value,alpha_value,norm_type] = parseinputs(varargin{:});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if isempty(n_bins) && isempty(bin_edges)
|
|
23
|
-
[hist_values,bin_edges] = histcounts(X,'Normalization',norm_type);
|
|
24
|
-
else
|
|
25
|
-
bin_param = n_bins;
|
|
26
|
-
if ~isempty(bin_edges)
|
|
27
|
-
bin_param = bin_edges;
|
|
28
|
-
end
|
|
29
|
-
[hist_values,bin_edges] = histcounts(X,bin_param,'Normalization',norm_type);
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
x_cat = cat(1,bin_edges,circshift(bin_edges,-1));
|
|
34
|
-
x_mean = mean(x_cat,1);
|
|
35
|
-
bin_centers = x_mean(1:end-1);
|
|
36
|
-
fprintf(1,'Plotting histogram with %d bins\n',numel(bin_centers));
|
|
37
|
-
|
|
38
|
-
% Use a shaded plot
|
|
39
|
-
plot_shaded(bin_centers,hist_values,'Alpha',alpha_value,'Color',color_value,'LineWidth',1.5);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
function [X,n_bins,bin_edges,color_value,alpha_value,norm_type] = parseinputs(varargin)
|
|
46
|
-
|
|
47
|
-
% Get the number of input args
|
|
48
|
-
minargs = 1;
|
|
49
|
-
maxargs = minargs+5*2;
|
|
50
|
-
narginchk(minargs,maxargs);
|
|
51
|
-
|
|
52
|
-
ax = gca;
|
|
53
|
-
|
|
54
|
-
% Set the defaults
|
|
55
|
-
n_bins = [];
|
|
56
|
-
bin_edges = [];
|
|
57
|
-
color_value = ax.ColorOrder(ax.ColorOrderIndex,:);
|
|
58
|
-
alpha_value = 0.2;
|
|
59
|
-
norm_type = 'probability';
|
|
60
|
-
|
|
61
|
-
% Get the inputs and check them
|
|
62
|
-
X = varargin{1};
|
|
63
|
-
validateattributes(X,{'numeric'},{'nonnan','finite'},mfilename,'X',1);
|
|
64
|
-
|
|
65
|
-
if nargin > 1
|
|
66
|
-
for i=2:2:nargin
|
|
67
|
-
PNAME = varargin{i};
|
|
68
|
-
PVALUE = varargin{i+1};
|
|
69
|
-
|
|
70
|
-
PNAME = validatestring(PNAME,...
|
|
71
|
-
{'alpha','bins','color','edges','normalization'},...
|
|
72
|
-
mfilename,'ParameterName',i);
|
|
73
|
-
|
|
74
|
-
switch PNAME
|
|
75
|
-
case 'alpha'
|
|
76
|
-
validateattributes(PVALUE,{'numeric'},{'real','nonnegative','finite','scalar'},...
|
|
77
|
-
mfilename,PNAME,i+1);
|
|
78
|
-
alpha_value = PVALUE;
|
|
79
|
-
case 'bins'
|
|
80
|
-
if ~isempty(PVALUE)
|
|
81
|
-
validateattributes(PVALUE,{'numeric'},{'integer','positive','finite','scalar'},...
|
|
82
|
-
mfilename,PNAME,i+1);
|
|
83
|
-
n_bins = PVALUE;
|
|
84
|
-
end
|
|
85
|
-
case 'color'
|
|
86
|
-
validateattributes(PVALUE,{'numeric'},{'real','nonnegative','nonempty','vector','numel',3,'<=',1.0},mfilename,PNAME,i+1);
|
|
87
|
-
color_value = PVALUE;
|
|
88
|
-
case 'edges'
|
|
89
|
-
validateattributes(PVALUE,{'numeric'},{'real','nonempty','vector','nonnan'},mfilename,PNAME,i+1);
|
|
90
|
-
bin_edges = PVALUE;
|
|
91
|
-
case 'normalization'
|
|
92
|
-
validateattributes(PVALUE,{'char'},{'nonempty'},mfilename,PNAME,i+1);
|
|
93
|
-
norm_type = PVALUE;
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
end
|
|
99
|
-
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
function plot_shaded(varargin)
|
|
2
|
-
% PLOT_SHADED(X,Y) - Plots the line with pretty shaded region under the line in the open
|
|
3
|
-
% figure window.
|
|
4
|
-
% Inputs:
|
|
5
|
-
% X: vector of domain values.
|
|
6
|
-
% Y: vector or range values.
|
|
7
|
-
%
|
|
8
|
-
% PLOT_SHADED(X,Y,...)
|
|
9
|
-
% Parameter options include:
|
|
10
|
-
% 'Alpha': the alpha value of the shaded region, default 0.15.
|
|
11
|
-
% 'Color': the shaded region color.
|
|
12
|
-
% 'LineWidth': the contour line width, default = 2.0.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
[X,Y,color_value,alpha_value,line_width] = parseinputs(varargin{:});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
y_min = min(Y);
|
|
19
|
-
y_max = max(Y);
|
|
20
|
-
V_alpha = alpha_value*((Y-y_min)/y_max);
|
|
21
|
-
F = [1 2 3 4];
|
|
22
|
-
|
|
23
|
-
hold on
|
|
24
|
-
% Create patches for the shaded region
|
|
25
|
-
for i=1:numel(X)-1
|
|
26
|
-
V = [ X(i) y_min ; X(i) Y(i); X(i+1) Y(i+1); X(i+1) y_min ];
|
|
27
|
-
A = [0,V_alpha(i),V_alpha(i+1),0]';
|
|
28
|
-
patch('Faces',F,'Vertices',V,'FaceColor',color_value,...
|
|
29
|
-
'EdgeColor','none',...
|
|
30
|
-
'FaceVertexAlphaData',A,'FaceAlpha','interp','AlphaDataMapping','none');
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
plot(X,Y,'LineWidth',line_width,'Color',color_value);
|
|
34
|
-
hold off
|
|
35
|
-
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
function [X,Y,color_value,alpha_value,line_width] = parseinputs(varargin)
|
|
42
|
-
|
|
43
|
-
% Check the number of input args
|
|
44
|
-
minargs = 2;
|
|
45
|
-
numopts = 3;
|
|
46
|
-
maxargs = minargs + 2*numopts;
|
|
47
|
-
narginchk(minargs,maxargs);
|
|
48
|
-
|
|
49
|
-
ax = gca;
|
|
50
|
-
|
|
51
|
-
% Set the defaults
|
|
52
|
-
alpha_value = 0.15;
|
|
53
|
-
color_value = ax.ColorOrder(ax.ColorOrderIndex,:);
|
|
54
|
-
line_width = 2.0;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
% Get the inputs and check them
|
|
58
|
-
X = varargin{1};
|
|
59
|
-
validateattributes(X,{'numeric'},{'vector','nonnan','finite'},mfilename,'X',2);
|
|
60
|
-
Y = varargin{2};
|
|
61
|
-
validateattributes(Y,{'numeric'},{'vector','nonnan','finite','numel',numel(X)},mfilename,'Y',2);
|
|
62
|
-
% Ensure that X and Y are column vectors
|
|
63
|
-
X = X(:);
|
|
64
|
-
Y = Y(:);
|
|
65
|
-
|
|
66
|
-
if nargin > minargs
|
|
67
|
-
for i=(minargs+1):2:nargin
|
|
68
|
-
PNAME = varargin{i};
|
|
69
|
-
PVALUE = varargin{i+1};
|
|
70
|
-
|
|
71
|
-
PNAME = validatestring(PNAME,{'Alpha','Color','LineWidth','Prctile'},...
|
|
72
|
-
mfilename,'ParameterName',i);
|
|
73
|
-
|
|
74
|
-
switch PNAME
|
|
75
|
-
case 'Alpha'
|
|
76
|
-
validateattributes(PVALUE,{'numeric'},{'scalar','nonnan','finite','nonnegative','<=',1.0},mfilename,PNAME,i+1);
|
|
77
|
-
alpha_value = PVALUE;
|
|
78
|
-
case 'Color'
|
|
79
|
-
validateattributes(PVALUE,{'numeric'},{'real','nonnegative','nonempty','vector','numel',3,'<=',1.0},mfilename,PNAME,i+1);
|
|
80
|
-
color_value = PVALUE;
|
|
81
|
-
case 'LineWidth'
|
|
82
|
-
validateattributes(PVALUE,{'numeric'},{'scalar','finite','nonnegative'},...
|
|
83
|
-
mfilename,PNAME,i+1);
|
|
84
|
-
line_width = PVALUE;
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
|
|
2
|
-
|
|
3
|
-
project(benchmark LANGUAGES CXX)
|
|
4
|
-
|
|
5
|
-
include(FetchContent)
|
|
6
|
-
if (NOT TARGET dragonbox)
|
|
7
|
-
FetchContent_Declare(dragonbox SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../..")
|
|
8
|
-
FetchContent_MakeAvailable(dragonbox)
|
|
9
|
-
endif()
|
|
10
|
-
if (NOT TARGET common)
|
|
11
|
-
FetchContent_Declare(common SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../common")
|
|
12
|
-
FetchContent_MakeAvailable(common)
|
|
13
|
-
endif()
|
|
14
|
-
if (NOT TARGET ryu)
|
|
15
|
-
FetchContent_Declare(ryu SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../3rdparty/ryu")
|
|
16
|
-
FetchContent_MakeAvailable(ryu)
|
|
17
|
-
endif()
|
|
18
|
-
if (NOT TARGET schubfach)
|
|
19
|
-
FetchContent_Declare(schubfach SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../3rdparty/schubfach")
|
|
20
|
-
FetchContent_MakeAvailable(schubfach)
|
|
21
|
-
endif()
|
|
22
|
-
if (NOT TARGET grisu_exact)
|
|
23
|
-
FetchContent_Declare(grisu_exact SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../3rdparty/grisu_exact")
|
|
24
|
-
FetchContent_MakeAvailable(grisu_exact)
|
|
25
|
-
endif()
|
|
26
|
-
|
|
27
|
-
set(benchmark_headers include/benchmark.h)
|
|
28
|
-
|
|
29
|
-
set(benchmark_sources
|
|
30
|
-
source/dragonbox.cpp
|
|
31
|
-
source/grisu_exact.cpp
|
|
32
|
-
source/benchmark.cpp
|
|
33
|
-
source/ryu.cpp
|
|
34
|
-
source/schubfach.cpp)
|
|
35
|
-
|
|
36
|
-
add_executable(benchmark ${benchmark_headers} ${benchmark_sources})
|
|
37
|
-
|
|
38
|
-
target_compile_features(benchmark PRIVATE cxx_std_17)
|
|
39
|
-
|
|
40
|
-
target_include_directories(benchmark
|
|
41
|
-
PRIVATE
|
|
42
|
-
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>)
|
|
43
|
-
|
|
44
|
-
target_link_libraries(benchmark
|
|
45
|
-
PRIVATE
|
|
46
|
-
ryu::ryu
|
|
47
|
-
dragonbox::common
|
|
48
|
-
dragonbox::dragonbox_to_chars
|
|
49
|
-
grisu_exact::grisu_exact
|
|
50
|
-
schubfach::schubfach)
|
|
51
|
-
|
|
52
|
-
# ---- MSVC Specifics ----
|
|
53
|
-
if (MSVC)
|
|
54
|
-
# No need to not generate PDB
|
|
55
|
-
# /permissive- should be the default
|
|
56
|
-
# The compilation will fail without /experimental:newLambdaProcessor
|
|
57
|
-
# See also https://gitlab.kitware.com/cmake/cmake/-/issues/16478
|
|
58
|
-
target_compile_options(benchmark PUBLIC
|
|
59
|
-
/Zi /permissive-
|
|
60
|
-
$<$<NOT:$<CXX_COMPILER_ID:Clang>>:/experimental:newLambdaProcessor>
|
|
61
|
-
$<$<CONFIG:Release>:/GL>)
|
|
62
|
-
target_link_options(benchmark PUBLIC /LTCG /DEBUG:FASTLINK)
|
|
63
|
-
set_target_properties(benchmark PROPERTIES
|
|
64
|
-
VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}")
|
|
65
|
-
endif()
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// Copyright 2020 Junekey Jeon
|
|
2
|
-
//
|
|
3
|
-
// The contents of this file may be used under the terms of
|
|
4
|
-
// the Apache License v2.0 with LLVM Exceptions.
|
|
5
|
-
//
|
|
6
|
-
// (See accompanying file LICENSE-Apache or copy at
|
|
7
|
-
// https://llvm.org/foundation/relicensing/LICENSE.txt)
|
|
8
|
-
//
|
|
9
|
-
// Alternatively, the contents of this file may be used under the terms of
|
|
10
|
-
// the Boost Software License, Version 1.0.
|
|
11
|
-
// (See accompanying file LICENSE-Boost or copy at
|
|
12
|
-
// https://www.boost.org/LICENSE_1_0.txt)
|
|
13
|
-
//
|
|
14
|
-
// Unless required by applicable law or agreed to in writing, this software
|
|
15
|
-
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
-
// KIND, either express or implied.
|
|
17
|
-
|
|
18
|
-
#ifndef JKJ_BENCHMARK
|
|
19
|
-
#define JKJ_BENCHMARK
|
|
20
|
-
|
|
21
|
-
#include <string_view>
|
|
22
|
-
|
|
23
|
-
struct register_function_for_benchmark {
|
|
24
|
-
register_function_for_benchmark() = default;
|
|
25
|
-
|
|
26
|
-
register_function_for_benchmark(
|
|
27
|
-
std::string_view name,
|
|
28
|
-
void(*func)(float, char*));
|
|
29
|
-
|
|
30
|
-
register_function_for_benchmark(
|
|
31
|
-
std::string_view name,
|
|
32
|
-
void(*func)(double, char*));
|
|
33
|
-
|
|
34
|
-
register_function_for_benchmark(
|
|
35
|
-
std::string_view name,
|
|
36
|
-
void(*func_float)(float, char*),
|
|
37
|
-
void(*func_double)(double, char*));
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
#endif
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
% Copyright 2020-2021 Junekey Jeon
|
|
2
|
-
%
|
|
3
|
-
% The contents of this file may be used under the terms of
|
|
4
|
-
% the Apache License v2.0 with LLVM Exceptions.
|
|
5
|
-
%
|
|
6
|
-
% (See accompanying file LICENSE-Apache or copy at
|
|
7
|
-
% https://llvm.org/foundation/relicensing/LICENSE.txt)
|
|
8
|
-
%
|
|
9
|
-
% Alternatively, the contents of this file may be used under the terms of
|
|
10
|
-
% the Boost Software License, Version 1.0.
|
|
11
|
-
% (See accompanying file LICENSE-Boost or copy at
|
|
12
|
-
% https://www.boost.org/LICENSE_1_0.txt)
|
|
13
|
-
%
|
|
14
|
-
% Unless required by applicable law or agreed to in writing, this software
|
|
15
|
-
% is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
-
% KIND, either express or implied.
|
|
17
|
-
|
|
18
|
-
addpath('../../3rdparty/shaded_plots');
|
|
19
|
-
plot_uniform_benchmark('../results/uniform_benchmark_binary32.csv', 32);
|
|
20
|
-
plot_uniform_benchmark('../results/uniform_benchmark_binary64.csv', 64);
|
|
21
|
-
avg32 = plot_digit_benchmark('../results/digits_benchmark_binary32.csv');
|
|
22
|
-
avg64 = plot_digit_benchmark('../results/digits_benchmark_binary64.csv');
|