content
stringlengths
6
1.03M
input_ids
sequencelengths
4
535k
ratio_char_token
float64
0.68
8.61
token_count
int64
4
535k
nn = 20 tot = collect(1:nn) trnidx = view(tot, [1,3,6,9,10,11,12,13,14,15,19]) res
[ 20471, 796, 1160, 198, 83, 313, 796, 2824, 7, 16, 25, 20471, 8, 198, 2213, 77, 312, 87, 796, 1570, 7, 83, 313, 11, 685, 16, 11, 18, 11, 21, 11, 24, 11, 940, 11, 1157, 11, 1065, 11, 1485, 11, 1415, 11, 1314, 11, 1129, 12962, 198, 198, 411, 198 ]
1.647059
51
# SPD-License-Identifier: MIT using ArgParse using JLD2 using MarkovModels using TOML function parse_commandline() s = ArgParseSettings() @add_arg_table s begin "topology" required = true help = "hmm topology in TOML format" "units" required = true help = "list of units with their categories" "hmms" required = true help = "output hmms in BSON format" end s.description = """ Build a set of HMM. The topology file should be formatted as: states = [ \ua0\ua0{ id = 1, initweight = 1.0, finalweight = 0.0 }, \ua0\ua0... ] links = [ \ua0\ua0{ src = 1, dest = 2, weight = 0.5 }, \ua0\ua0... ] tiestates = false | true """ parse_args(s) end function loadunits(file) units, categories = [], [] open(file, "r") do f for line in eachline(f) tokens = split(line) push!(units, tokens[1]) push!(categories, tokens[2:end]) end end units, categories end function get_unit_topo(topo, category) i = 1 while i <= length(category) && category[i] ∈ keys(topo) topo = topo[category[i]] i += 1 end topo end function makehmm!(pdfid_mapping, unit, topo, pdfid) SF = LogSemifield{Float32} fsm = VectorFSM{SF}() states = Dict() for (i, state) in enumerate(topo["states"]) initweight = SF(log(state["initweight"])) finalweight = SF(log(state["finalweight"])) s = addstate!(fsm, i; initweight, finalweight) states[i] = s pdfid_mapping[(unit, i)] = pdfid pdfid += 1 end for arc in topo["arcs"] addarc!(fsm, states[arc["src"]], states[arc["dest"]], SF(log(arc["weight"]))) end fsm |> renormalize, pdfid end function main(args) topo = TOML.parsefile(args["topology"]) units, categories = loadunits(args["units"]) hmms = Dict() pdfid_mapping = Dict() pdfid = 1 for (unit, category) in zip(units, categories) unit_topo = get_unit_topo(topo, category) hmms[unit], pdfid = makehmm!(pdfid_mapping, unit, topo, pdfid) end data = Dict( "units" => hmms, "pdfid_mapping" => pdfid_mapping ) save(args["hmms"], data) end args = parse_commandline() main(args)
[ 2, 30628, 12, 34156, 12, 33234, 7483, 25, 17168, 198, 198, 3500, 20559, 10044, 325, 198, 3500, 449, 11163, 17, 198, 3500, 2940, 709, 5841, 1424, 198, 3500, 41526, 43, 198, 198, 8818, 21136, 62, 21812, 1370, 3419, 198, 220, 220, 220, 264, 796, 20559, 10044, 325, 26232, 3419, 198, 220, 220, 220, 2488, 2860, 62, 853, 62, 11487, 264, 2221, 198, 220, 220, 220, 220, 220, 220, 220, 366, 4852, 1435, 1, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2672, 796, 2081, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1037, 796, 366, 71, 3020, 1353, 1435, 287, 41526, 43, 5794, 1, 198, 220, 220, 220, 220, 220, 220, 220, 366, 41667, 1, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2672, 796, 2081, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1037, 796, 366, 4868, 286, 4991, 351, 511, 9376, 1, 198, 220, 220, 220, 220, 220, 220, 220, 366, 23940, 907, 1, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2672, 796, 2081, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1037, 796, 366, 22915, 289, 76, 907, 287, 347, 11782, 5794, 1, 198, 220, 220, 220, 886, 198, 220, 220, 220, 264, 13, 11213, 796, 37227, 198, 220, 220, 220, 10934, 257, 900, 286, 367, 12038, 13, 383, 1353, 1435, 2393, 815, 307, 39559, 355, 25, 628, 198, 220, 220, 220, 2585, 796, 685, 628, 198, 220, 220, 220, 3467, 6413, 15, 59, 6413, 15, 90, 4686, 796, 352, 11, 2315, 6551, 796, 352, 13, 15, 11, 2457, 6551, 796, 657, 13, 15, 8964, 628, 198, 220, 220, 220, 3467, 6413, 15, 59, 6413, 15, 986, 628, 198, 220, 220, 220, 2361, 628, 628, 198, 220, 220, 220, 6117, 796, 685, 628, 198, 220, 220, 220, 3467, 6413, 15, 59, 6413, 15, 90, 12351, 796, 352, 11, 2244, 796, 362, 11, 3463, 796, 657, 13, 20, 8964, 628, 198, 220, 220, 220, 3467, 6413, 15, 59, 6413, 15, 986, 628, 198, 220, 220, 220, 2361, 628, 628, 198, 220, 220, 220, 256, 6386, 689, 796, 3991, 930, 2081, 628, 628, 220, 220, 220, 37227, 198, 220, 220, 220, 21136, 62, 22046, 7, 82, 8, 198, 437, 198, 198, 8818, 3440, 41667, 7, 7753, 8, 198, 220, 220, 220, 4991, 11, 9376, 796, 685, 4357, 17635, 198, 220, 220, 220, 1280, 7, 7753, 11, 366, 81, 4943, 466, 277, 198, 220, 220, 220, 220, 220, 220, 220, 329, 1627, 287, 1123, 1370, 7, 69, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 16326, 796, 6626, 7, 1370, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4574, 0, 7, 41667, 11, 16326, 58, 16, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4574, 0, 7, 66, 26129, 11, 16326, 58, 17, 25, 437, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 886, 198, 220, 220, 220, 4991, 11, 9376, 198, 437, 198, 198, 8818, 651, 62, 20850, 62, 4852, 78, 7, 4852, 78, 11, 6536, 8, 198, 220, 220, 220, 1312, 796, 352, 198, 220, 220, 220, 981, 1312, 19841, 4129, 7, 22872, 8, 11405, 6536, 58, 72, 60, 18872, 230, 8251, 7, 4852, 78, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1353, 78, 796, 1353, 78, 58, 22872, 58, 72, 11907, 198, 220, 220, 220, 220, 220, 220, 220, 1312, 15853, 352, 198, 220, 220, 220, 886, 198, 220, 220, 220, 1353, 78, 198, 437, 198, 198, 8818, 787, 71, 3020, 0, 7, 12315, 312, 62, 76, 5912, 11, 4326, 11, 1353, 78, 11, 37124, 312, 8, 198, 220, 220, 220, 14362, 796, 5972, 13900, 361, 1164, 90, 43879, 2624, 92, 198, 220, 220, 220, 277, 5796, 796, 20650, 10652, 44, 90, 20802, 92, 3419, 628, 220, 220, 220, 2585, 796, 360, 713, 3419, 198, 220, 220, 220, 329, 357, 72, 11, 1181, 8, 287, 27056, 378, 7, 4852, 78, 14692, 27219, 8973, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2315, 6551, 796, 14362, 7, 6404, 7, 5219, 14692, 15003, 6551, 8973, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 2457, 6551, 796, 14362, 7, 6404, 7, 5219, 14692, 20311, 6551, 8973, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 264, 796, 751, 5219, 0, 7, 69, 5796, 11, 1312, 26, 2315, 6551, 11, 2457, 6551, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2585, 58, 72, 60, 796, 264, 198, 220, 220, 220, 220, 220, 220, 220, 37124, 312, 62, 76, 5912, 58, 7, 20850, 11, 1312, 15437, 796, 37124, 312, 198, 220, 220, 220, 220, 220, 220, 220, 37124, 312, 15853, 352, 198, 220, 220, 220, 886, 628, 220, 220, 220, 329, 10389, 287, 1353, 78, 14692, 5605, 82, 8973, 198, 220, 220, 220, 220, 220, 220, 220, 751, 5605, 0, 7, 69, 5796, 11, 2585, 58, 5605, 14692, 10677, 8973, 4357, 2585, 58, 5605, 14692, 16520, 8973, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 14362, 7, 6404, 7, 5605, 14692, 6551, 8973, 22305, 198, 220, 220, 220, 886, 628, 220, 220, 220, 277, 5796, 930, 29, 8851, 6636, 1096, 11, 37124, 312, 198, 437, 198, 198, 8818, 1388, 7, 22046, 8, 198, 220, 220, 220, 1353, 78, 796, 41526, 43, 13, 29572, 7753, 7, 22046, 14692, 4852, 1435, 8973, 8, 628, 220, 220, 220, 4991, 11, 9376, 796, 3440, 41667, 7, 22046, 14692, 41667, 8973, 8, 198, 220, 220, 220, 289, 76, 907, 796, 360, 713, 3419, 198, 220, 220, 220, 37124, 312, 62, 76, 5912, 796, 360, 713, 3419, 198, 220, 220, 220, 37124, 312, 796, 352, 198, 220, 220, 220, 329, 357, 20850, 11, 6536, 8, 287, 19974, 7, 41667, 11, 9376, 8, 198, 220, 220, 220, 220, 220, 220, 220, 4326, 62, 4852, 78, 796, 651, 62, 20850, 62, 4852, 78, 7, 4852, 78, 11, 6536, 8, 198, 220, 220, 220, 220, 220, 220, 220, 289, 76, 907, 58, 20850, 4357, 37124, 312, 796, 787, 71, 3020, 0, 7, 12315, 312, 62, 76, 5912, 11, 4326, 11, 1353, 78, 11, 37124, 312, 8, 198, 220, 220, 220, 886, 628, 220, 220, 220, 1366, 796, 360, 713, 7, 198, 220, 220, 220, 220, 220, 220, 220, 366, 41667, 1, 5218, 289, 76, 907, 11, 198, 220, 220, 220, 220, 220, 220, 220, 366, 12315, 312, 62, 76, 5912, 1, 5218, 37124, 312, 62, 76, 5912, 198, 220, 220, 220, 1267, 198, 220, 220, 220, 3613, 7, 22046, 14692, 23940, 907, 33116, 1366, 8, 198, 437, 198, 198, 22046, 796, 21136, 62, 21812, 1370, 3419, 198, 12417, 7, 22046, 8, 628 ]
2.116711
1,131
# This file was generated by the Julia Swagger Code Generator # Do not modify this file directly. Modify the swagger specification instead. mutable struct IoK8sApiCoreV1SELinuxOptions <: SwaggerModel level::Any # spec type: Union{ Nothing, String } # spec name: level role::Any # spec type: Union{ Nothing, String } # spec name: role type::Any # spec type: Union{ Nothing, String } # spec name: type user::Any # spec type: Union{ Nothing, String } # spec name: user function IoK8sApiCoreV1SELinuxOptions(;level=nothing, role=nothing, type=nothing, user=nothing) o = new() validate_property(IoK8sApiCoreV1SELinuxOptions, Symbol("level"), level) setfield!(o, Symbol("level"), level) validate_property(IoK8sApiCoreV1SELinuxOptions, Symbol("role"), role) setfield!(o, Symbol("role"), role) validate_property(IoK8sApiCoreV1SELinuxOptions, Symbol("type"), type) setfield!(o, Symbol("type"), type) validate_property(IoK8sApiCoreV1SELinuxOptions, Symbol("user"), user) setfield!(o, Symbol("user"), user) o end end # type IoK8sApiCoreV1SELinuxOptions const _property_map_IoK8sApiCoreV1SELinuxOptions = Dict{Symbol,Symbol}(Symbol("level")=>Symbol("level"), Symbol("role")=>Symbol("role"), Symbol("type")=>Symbol("type"), Symbol("user")=>Symbol("user")) const _property_types_IoK8sApiCoreV1SELinuxOptions = Dict{Symbol,String}(Symbol("level")=>"String", Symbol("role")=>"String", Symbol("type")=>"String", Symbol("user")=>"String") Base.propertynames(::Type{ IoK8sApiCoreV1SELinuxOptions }) = collect(keys(_property_map_IoK8sApiCoreV1SELinuxOptions)) Swagger.property_type(::Type{ IoK8sApiCoreV1SELinuxOptions }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_IoK8sApiCoreV1SELinuxOptions[name]))} Swagger.field_name(::Type{ IoK8sApiCoreV1SELinuxOptions }, property_name::Symbol) = _property_map_IoK8sApiCoreV1SELinuxOptions[property_name] function check_required(o::IoK8sApiCoreV1SELinuxOptions) true end function validate_property(::Type{ IoK8sApiCoreV1SELinuxOptions }, name::Symbol, val) end
[ 2, 770, 2393, 373, 7560, 416, 262, 22300, 2451, 7928, 6127, 35986, 198, 2, 2141, 407, 13096, 428, 2393, 3264, 13, 3401, 1958, 262, 1509, 7928, 20855, 2427, 13, 628, 198, 76, 18187, 2878, 27853, 42, 23, 82, 32, 14415, 14055, 53, 16, 50, 3698, 259, 2821, 29046, 1279, 25, 2451, 7928, 17633, 198, 220, 220, 220, 1241, 3712, 7149, 1303, 1020, 2099, 25, 4479, 90, 10528, 11, 10903, 1782, 1303, 1020, 1438, 25, 1241, 198, 220, 220, 220, 2597, 3712, 7149, 1303, 1020, 2099, 25, 4479, 90, 10528, 11, 10903, 1782, 1303, 1020, 1438, 25, 2597, 198, 220, 220, 220, 2099, 3712, 7149, 1303, 1020, 2099, 25, 4479, 90, 10528, 11, 10903, 1782, 1303, 1020, 1438, 25, 2099, 198, 220, 220, 220, 2836, 3712, 7149, 1303, 1020, 2099, 25, 4479, 90, 10528, 11, 10903, 1782, 1303, 1020, 1438, 25, 2836, 628, 220, 220, 220, 2163, 27853, 42, 23, 82, 32, 14415, 14055, 53, 16, 50, 3698, 259, 2821, 29046, 7, 26, 5715, 28, 22366, 11, 2597, 28, 22366, 11, 2099, 28, 22366, 11, 2836, 28, 22366, 8, 198, 220, 220, 220, 220, 220, 220, 220, 267, 796, 649, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 26571, 62, 26745, 7, 40, 78, 42, 23, 82, 32, 14415, 14055, 53, 16, 50, 3698, 259, 2821, 29046, 11, 38357, 7203, 5715, 12340, 1241, 8, 198, 220, 220, 220, 220, 220, 220, 220, 900, 3245, 0, 7, 78, 11, 38357, 7203, 5715, 12340, 1241, 8, 198, 220, 220, 220, 220, 220, 220, 220, 26571, 62, 26745, 7, 40, 78, 42, 23, 82, 32, 14415, 14055, 53, 16, 50, 3698, 259, 2821, 29046, 11, 38357, 7203, 18090, 12340, 2597, 8, 198, 220, 220, 220, 220, 220, 220, 220, 900, 3245, 0, 7, 78, 11, 38357, 7203, 18090, 12340, 2597, 8, 198, 220, 220, 220, 220, 220, 220, 220, 26571, 62, 26745, 7, 40, 78, 42, 23, 82, 32, 14415, 14055, 53, 16, 50, 3698, 259, 2821, 29046, 11, 38357, 7203, 4906, 12340, 2099, 8, 198, 220, 220, 220, 220, 220, 220, 220, 900, 3245, 0, 7, 78, 11, 38357, 7203, 4906, 12340, 2099, 8, 198, 220, 220, 220, 220, 220, 220, 220, 26571, 62, 26745, 7, 40, 78, 42, 23, 82, 32, 14415, 14055, 53, 16, 50, 3698, 259, 2821, 29046, 11, 38357, 7203, 7220, 12340, 2836, 8, 198, 220, 220, 220, 220, 220, 220, 220, 900, 3245, 0, 7, 78, 11, 38357, 7203, 7220, 12340, 2836, 8, 198, 220, 220, 220, 220, 220, 220, 220, 267, 198, 220, 220, 220, 886, 198, 437, 1303, 2099, 27853, 42, 23, 82, 32, 14415, 14055, 53, 16, 50, 3698, 259, 2821, 29046, 198, 198, 9979, 4808, 26745, 62, 8899, 62, 40, 78, 42, 23, 82, 32, 14415, 14055, 53, 16, 50, 3698, 259, 2821, 29046, 796, 360, 713, 90, 13940, 23650, 11, 13940, 23650, 92, 7, 13940, 23650, 7203, 5715, 4943, 14804, 13940, 23650, 7203, 5715, 12340, 38357, 7203, 18090, 4943, 14804, 13940, 23650, 7203, 18090, 12340, 38357, 7203, 4906, 4943, 14804, 13940, 23650, 7203, 4906, 12340, 38357, 7203, 7220, 4943, 14804, 13940, 23650, 7203, 7220, 48774, 198, 9979, 4808, 26745, 62, 19199, 62, 40, 78, 42, 23, 82, 32, 14415, 14055, 53, 16, 50, 3698, 259, 2821, 29046, 796, 360, 713, 90, 13940, 23650, 11, 10100, 92, 7, 13940, 23650, 7203, 5715, 4943, 14804, 1, 10100, 1600, 38357, 7203, 18090, 4943, 14804, 1, 10100, 1600, 38357, 7203, 4906, 4943, 14804, 1, 10100, 1600, 38357, 7203, 7220, 4943, 14804, 1, 10100, 4943, 198, 14881, 13, 26745, 14933, 7, 3712, 6030, 90, 27853, 42, 23, 82, 32, 14415, 14055, 53, 16, 50, 3698, 259, 2821, 29046, 32092, 796, 2824, 7, 13083, 28264, 26745, 62, 8899, 62, 40, 78, 42, 23, 82, 32, 14415, 14055, 53, 16, 50, 3698, 259, 2821, 29046, 4008, 198, 10462, 7928, 13, 26745, 62, 4906, 7, 3712, 6030, 90, 27853, 42, 23, 82, 32, 14415, 14055, 53, 16, 50, 3698, 259, 2821, 29046, 8964, 1438, 3712, 13940, 23650, 8, 796, 4479, 90, 18465, 11, 18206, 7, 14881, 13, 48526, 13, 29572, 28264, 26745, 62, 19199, 62, 40, 78, 42, 23, 82, 32, 14415, 14055, 53, 16, 50, 3698, 259, 2821, 29046, 58, 3672, 60, 4008, 92, 198, 10462, 7928, 13, 3245, 62, 3672, 7, 3712, 6030, 90, 27853, 42, 23, 82, 32, 14415, 14055, 53, 16, 50, 3698, 259, 2821, 29046, 8964, 3119, 62, 3672, 3712, 13940, 23650, 8, 796, 220, 4808, 26745, 62, 8899, 62, 40, 78, 42, 23, 82, 32, 14415, 14055, 53, 16, 50, 3698, 259, 2821, 29046, 58, 26745, 62, 3672, 60, 198, 198, 8818, 2198, 62, 35827, 7, 78, 3712, 40, 78, 42, 23, 82, 32, 14415, 14055, 53, 16, 50, 3698, 259, 2821, 29046, 8, 198, 220, 220, 220, 2081, 198, 437, 198, 198, 8818, 26571, 62, 26745, 7, 3712, 6030, 90, 27853, 42, 23, 82, 32, 14415, 14055, 53, 16, 50, 3698, 259, 2821, 29046, 8964, 1438, 3712, 13940, 23650, 11, 1188, 8, 198, 437, 198 ]
2.579075
822
<reponame>kernelmethod/HTTP.jl using Test using HTTP using HTTP.IOExtras, HTTP.Sockets using Sockets @testset "websockets.jl" begin p = 8085 # rand(8000:8999) socket_type = ["wss", "ws"] function listen_localhost() @async HTTP.listen(Sockets.localhost, p) do http if HTTP.WebSockets.is_upgrade(http.message) HTTP.WebSockets.upgrade(http) do ws while !eof(ws) data = readavailable(ws) write(ws, data) end end end end end @testset "External Host - $s" for s in socket_type HTTP.WebSockets.open("$s://echo.websocket.org") do io write(io, "Foo") @test !eof(io) @test String(readavailable(io)) == "Foo" write(io, "Hello") write(io, " There") write(io, " World", "!") closewrite(io) buf = IOBuffer() write(buf, io) @test String(take!(buf)) == "Hello There World!" end end @testset "Localhost" begin listen_localhost() HTTP.WebSockets.open("ws://127.0.0.1:$(p)") do ws write(ws, "Foo") @test String(readavailable(ws)) == "Foo" write(ws, "Bar") @test String(readavailable(ws)) == "Bar" end end @testset "extened feautre support for listen" begin port=UInt16(8086) tcpserver = listen(port) target = "/query?k1=v1&k2=v2" servertask = @async HTTP.WebSockets.listen("127.0.0.1", port; server=tcpserver) do ws @testset "request access" begin @test ws.request isa HTTP.Request write(ws, ws.request.target) while !eof(ws) write(ws, readavailable(ws)) end close(ws) end end HTTP.WebSockets.open("ws://127.0.0.1:$(port)$(target)") do ws @test String(readavailable(ws)) == target @test write(ws, "Bye!") == 4 @test String(readavailable(ws)) == "Bye!" close(ws) end close(tcpserver) @test timedwait(()->servertask.state === :failed, 5.0) === :ok @test_throws Exception wait(servertask) end end
[ 27, 7856, 261, 480, 29, 33885, 24396, 14, 40717, 13, 20362, 198, 3500, 6208, 198, 3500, 14626, 198, 3500, 14626, 13, 9399, 11627, 8847, 11, 14626, 13, 50, 11603, 198, 3500, 311, 11603, 198, 198, 31, 9288, 2617, 366, 732, 1443, 11603, 13, 20362, 1, 2221, 198, 220, 220, 220, 279, 796, 41241, 20, 1303, 43720, 7, 33942, 25, 23, 17032, 8, 198, 220, 220, 220, 17802, 62, 4906, 796, 14631, 86, 824, 1600, 366, 18504, 8973, 628, 220, 220, 220, 2163, 6004, 62, 36750, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 292, 13361, 14626, 13, 4868, 268, 7, 50, 11603, 13, 36750, 11, 279, 8, 466, 2638, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 14626, 13, 13908, 50, 11603, 13, 271, 62, 929, 9526, 7, 4023, 13, 20500, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 14626, 13, 13908, 50, 11603, 13, 929, 9526, 7, 4023, 8, 466, 266, 82, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 981, 5145, 68, 1659, 7, 18504, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1366, 796, 1100, 15182, 7, 18504, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3551, 7, 18504, 11, 1366, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 886, 628, 220, 220, 220, 2488, 9288, 2617, 366, 41506, 14504, 532, 720, 82, 1, 329, 264, 287, 17802, 62, 4906, 198, 220, 220, 220, 220, 220, 220, 220, 14626, 13, 13908, 50, 11603, 13, 9654, 7203, 3, 82, 1378, 30328, 13, 732, 1443, 5459, 13, 2398, 4943, 466, 33245, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3551, 7, 952, 11, 366, 37, 2238, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 5145, 68, 1659, 7, 952, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 10903, 7, 961, 15182, 7, 952, 4008, 6624, 366, 37, 2238, 1, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3551, 7, 952, 11, 366, 15496, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3551, 7, 952, 11, 366, 1318, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3551, 7, 952, 11, 366, 2159, 1600, 366, 2474, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1969, 13564, 7, 952, 8, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 42684, 796, 314, 9864, 13712, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3551, 7, 29325, 11, 33245, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 10903, 7, 20657, 0, 7, 29325, 4008, 6624, 366, 15496, 1318, 2159, 2474, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 886, 628, 220, 220, 220, 2488, 9288, 2617, 366, 14565, 4774, 1, 2221, 198, 220, 220, 220, 220, 220, 220, 6004, 62, 36750, 3419, 628, 220, 220, 220, 220, 220, 220, 220, 14626, 13, 13908, 50, 11603, 13, 9654, 7203, 18504, 1378, 16799, 13, 15, 13, 15, 13, 16, 25, 3, 7, 79, 8, 4943, 466, 266, 82, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3551, 7, 18504, 11, 366, 37, 2238, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 10903, 7, 961, 15182, 7, 18504, 4008, 6624, 366, 37, 2238, 1, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3551, 7, 18504, 11, 366, 10374, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 10903, 7, 961, 15182, 7, 18504, 4008, 6624, 366, 10374, 1, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 886, 628, 220, 220, 220, 2488, 9288, 2617, 366, 2302, 2945, 730, 2306, 260, 1104, 329, 6004, 1, 2221, 198, 220, 220, 220, 220, 220, 220, 220, 2493, 28, 52, 5317, 1433, 7, 1795, 4521, 8, 198, 220, 220, 220, 220, 220, 220, 220, 37096, 862, 18497, 796, 6004, 7, 634, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2496, 796, 12813, 22766, 30, 74, 16, 28, 85, 16, 5, 74, 17, 28, 85, 17, 1, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 1055, 1851, 2093, 796, 220, 2488, 292, 13361, 14626, 13, 13908, 50, 11603, 13, 4868, 268, 7203, 16799, 13, 15, 13, 15, 13, 16, 1600, 2493, 26, 4382, 28, 23047, 862, 18497, 8, 466, 266, 82, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 2617, 366, 25927, 1895, 1, 2221, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 266, 82, 13, 25927, 318, 64, 14626, 13, 18453, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3551, 7, 18504, 11, 266, 82, 13, 25927, 13, 16793, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 981, 5145, 68, 1659, 7, 18504, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3551, 7, 18504, 11, 1100, 15182, 7, 18504, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1969, 7, 18504, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 886, 628, 220, 220, 220, 220, 220, 220, 220, 14626, 13, 13908, 50, 11603, 13, 9654, 7203, 18504, 1378, 16799, 13, 15, 13, 15, 13, 16, 25, 3, 7, 634, 8, 3, 7, 16793, 8, 4943, 466, 266, 82, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 10903, 7, 961, 15182, 7, 18504, 4008, 6624, 2496, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 3551, 7, 18504, 11, 366, 3886, 68, 2474, 8, 6624, 604, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 10903, 7, 961, 15182, 7, 18504, 4008, 6624, 366, 3886, 68, 2474, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1969, 7, 18504, 8, 198, 220, 220, 220, 220, 220, 220, 220, 886, 628, 220, 220, 220, 220, 220, 220, 220, 1969, 7, 23047, 862, 18497, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 28805, 17077, 7, 3419, 3784, 2655, 1851, 2093, 13, 5219, 24844, 1058, 47904, 11, 642, 13, 15, 8, 24844, 1058, 482, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 62, 400, 8516, 35528, 4043, 7, 2655, 1851, 2093, 8, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 886, 198, 437 ]
1.840998
1,283
# Use baremodule to shave off a few KB from the serialized `.ji` file baremodule OpenLSTO_jll using Base using Base: UUID import JLLWrappers JLLWrappers.@generate_main_file_header("OpenLSTO") JLLWrappers.@generate_main_file("OpenLSTO", UUID("a318411f-452f-5433-884b-1f6a35676cea")) end # module OpenLSTO_jll
[ 2, 5765, 6247, 21412, 284, 34494, 572, 257, 1178, 14204, 422, 262, 11389, 1143, 4600, 13, 7285, 63, 2393, 198, 49382, 21412, 4946, 43, 2257, 46, 62, 73, 297, 198, 3500, 7308, 198, 3500, 7308, 25, 471, 27586, 198, 11748, 449, 3069, 36918, 11799, 198, 198, 41, 3069, 36918, 11799, 13, 31, 8612, 378, 62, 12417, 62, 7753, 62, 25677, 7203, 11505, 43, 2257, 46, 4943, 198, 41, 3069, 36918, 11799, 13, 31, 8612, 378, 62, 12417, 62, 7753, 7203, 11505, 43, 2257, 46, 1600, 471, 27586, 7203, 64, 18, 22883, 1157, 69, 12, 37730, 69, 12, 4051, 2091, 12, 40353, 65, 12, 16, 69, 21, 64, 2327, 42548, 344, 64, 48774, 198, 437, 220, 1303, 8265, 4946, 43, 2257, 46, 62, 73, 297, 198 ]
2.48
125
<filename>src/Functors.jl module Functors using MacroTools export @functor, fmap, fmapstructure, fcollect include("functor.jl") end # module
[ 27, 34345, 29, 10677, 14, 24629, 5217, 13, 20362, 198, 21412, 11138, 5217, 198, 198, 3500, 42755, 33637, 198, 198, 39344, 2488, 12543, 2715, 11, 277, 8899, 11, 277, 8899, 301, 5620, 11, 277, 33327, 198, 198, 17256, 7203, 12543, 2715, 13, 20362, 4943, 198, 198, 437, 1303, 8265, 198 ]
2.9
50
cd(@__DIR__) using Pkg Pkg.activate(".") Pkg.instantiate() module TestModule export plusOne, multiply # functions, structs, and other objects that will be directly available once `using ModuleName` is typed plusOne(x) = x + 1 multiply(x,y) = x * y end using .TestModule plusOne(1.0) plusOne(1) multiply(2,3) include("includedfoo.jl") # which strings will be printed ? x # error not defined foo.x using foo # error: looking up for a package and of course can't find it using .foo x foo.z() foo.c()
[ 198, 10210, 7, 31, 834, 34720, 834, 8, 198, 3500, 350, 10025, 198, 47, 10025, 13, 39022, 7203, 19570, 198, 47, 10025, 13, 8625, 415, 9386, 3419, 198, 198, 21412, 6208, 26796, 198, 39344, 5556, 3198, 11, 29162, 1303, 5499, 11, 2878, 82, 11, 290, 584, 5563, 326, 481, 307, 3264, 1695, 1752, 4600, 3500, 19937, 5376, 63, 318, 25683, 198, 198, 9541, 3198, 7, 87, 8, 796, 2124, 1343, 352, 198, 16680, 541, 306, 7, 87, 11, 88, 8, 796, 2124, 1635, 331, 220, 198, 198, 437, 198, 198, 3500, 764, 14402, 26796, 198, 198, 9541, 3198, 7, 16, 13, 15, 8, 198, 9541, 3198, 7, 16, 8, 198, 198, 16680, 541, 306, 7, 17, 11, 18, 8, 198, 198, 17256, 7203, 259, 10341, 21943, 13, 20362, 4943, 1303, 543, 13042, 481, 307, 10398, 5633, 198, 198, 87, 1303, 4049, 407, 5447, 198, 21943, 13, 87, 198, 3500, 22944, 1303, 4049, 25, 2045, 510, 329, 257, 5301, 290, 286, 1781, 460, 470, 1064, 340, 198, 3500, 764, 21943, 198, 87, 198, 21943, 13, 89, 3419, 198, 21943, 13, 66, 3419 ]
2.79558
181
<filename>src/newton_method_ad.jl ##### NewtonsMethodAD export NewtonsMethodAD """ NewtonsMethodAD(f!::F!, x_init::A) where {F!, A <: AbstractArray} A non-linear system of equations type. # Fields $(DocStringExtensions.FIELDS) """ struct NewtonsMethodAD{FT, F!, A, JA} <: AbstractNonlinearSolverMethod{FT} "Function to find the root of" f!::F! "Initial guess" x_init::A "Storage" x1::A "Storage" J::JA "Storage" J⁻¹::JA "Storage" F::A function NewtonsMethodAD(f!::F!, x_init::A) where {F!, A <: AbstractArray} x1 = similar(x_init) J = similar(x_init, (length(x_init), length(x_init))) J⁻¹ = similar(J) F = similar(x_init) JA = typeof(J) FT = eltype(x_init) return new{FT, F!, A, JA}(f!, x_init, x1, J, J⁻¹, F) end end method_args(m::NewtonsMethodAD) = (m.x_init, m.x1, m.f!, m.F, m.J, m.J⁻¹) function solve!( ::NewtonsMethodAD, x0::AT, x1::AT, f!::F!, F::FA, J::JA, J⁻¹::J⁻¹A, soltype::SolutionType, tol::AbstractTolerance{FT}, maxiters::Int, ) where {FA, J⁻¹A, JA, F! <: Function, AT, FT} x_history = init_history(soltype, AT) F_history = init_history(soltype, AT) if soltype isa VerboseSolution f!(F, x0) ForwardDiff.jacobian!(J, f!, F, x0) push_history!(x_history, x0, soltype) push_history!(F_history, F, soltype) end for i in 1:maxiters f!(F, x0) ForwardDiff.jacobian!(J, f!, F, x0) x1 .= x0 .- J \ F push_history!(x_history, x1, soltype) push_history!(F_history, F, soltype) if tol(x0, x1, F) return SolutionResults( soltype, x1, true, F, i, x_history, F_history, ) end x0 = x1 end return SolutionResults( soltype, x0, false, F, maxiters, x_history, F_history, ) end
[ 27, 34345, 29, 10677, 14, 3605, 1122, 62, 24396, 62, 324, 13, 20362, 198, 4242, 2, 968, 27288, 17410, 2885, 198, 198, 39344, 968, 27288, 17410, 2885, 198, 198, 37811, 198, 220, 220, 220, 968, 27288, 17410, 2885, 7, 69, 0, 3712, 37, 28265, 2124, 62, 15003, 3712, 32, 8, 810, 1391, 37, 28265, 317, 1279, 25, 27741, 19182, 92, 198, 198, 32, 1729, 12, 29127, 1080, 286, 27490, 2099, 13, 198, 198, 2, 23948, 198, 3, 7, 23579, 10100, 11627, 5736, 13, 11674, 3698, 5258, 8, 198, 37811, 198, 7249, 968, 27288, 17410, 2885, 90, 9792, 11, 376, 28265, 317, 11, 41722, 92, 1279, 25, 27741, 15419, 29127, 50, 14375, 17410, 90, 9792, 92, 198, 220, 220, 220, 366, 22203, 284, 1064, 262, 6808, 286, 1, 198, 220, 220, 220, 277, 0, 3712, 37, 0, 198, 220, 220, 220, 366, 24243, 4724, 1, 198, 220, 220, 220, 2124, 62, 15003, 3712, 32, 198, 220, 220, 220, 366, 31425, 1, 198, 220, 220, 220, 2124, 16, 3712, 32, 198, 220, 220, 220, 366, 31425, 1, 198, 220, 220, 220, 449, 3712, 37048, 198, 220, 220, 220, 366, 31425, 1, 198, 220, 220, 220, 449, 46256, 119, 126, 117, 3712, 37048, 198, 220, 220, 220, 366, 31425, 1, 198, 220, 220, 220, 376, 3712, 32, 198, 220, 220, 220, 2163, 968, 27288, 17410, 2885, 7, 69, 0, 3712, 37, 28265, 2124, 62, 15003, 3712, 32, 8, 810, 1391, 37, 28265, 317, 1279, 25, 27741, 19182, 92, 198, 220, 220, 220, 220, 220, 220, 220, 2124, 16, 796, 2092, 7, 87, 62, 15003, 8, 198, 220, 220, 220, 220, 220, 220, 220, 449, 796, 2092, 7, 87, 62, 15003, 11, 357, 13664, 7, 87, 62, 15003, 828, 4129, 7, 87, 62, 15003, 22305, 198, 220, 220, 220, 220, 220, 220, 220, 449, 46256, 119, 126, 117, 796, 2092, 7, 41, 8, 198, 220, 220, 220, 220, 220, 220, 220, 376, 796, 2092, 7, 87, 62, 15003, 8, 198, 220, 220, 220, 220, 220, 220, 220, 41722, 796, 2099, 1659, 7, 41, 8, 198, 220, 220, 220, 220, 220, 220, 220, 19446, 796, 1288, 4906, 7, 87, 62, 15003, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 649, 90, 9792, 11, 376, 28265, 317, 11, 41722, 92, 7, 69, 28265, 2124, 62, 15003, 11, 2124, 16, 11, 449, 11, 449, 46256, 119, 126, 117, 11, 376, 8, 198, 220, 220, 220, 886, 198, 437, 198, 198, 24396, 62, 22046, 7, 76, 3712, 3791, 27288, 17410, 2885, 8, 796, 357, 76, 13, 87, 62, 15003, 11, 285, 13, 87, 16, 11, 285, 13, 69, 28265, 285, 13, 37, 11, 285, 13, 41, 11, 285, 13, 41, 46256, 119, 126, 117, 8, 198, 8818, 8494, 0, 7, 198, 220, 220, 220, 7904, 3791, 27288, 17410, 2885, 11, 198, 220, 220, 220, 2124, 15, 3712, 1404, 11, 198, 220, 220, 220, 2124, 16, 3712, 1404, 11, 198, 220, 220, 220, 277, 0, 3712, 37, 28265, 198, 220, 220, 220, 376, 3712, 7708, 11, 198, 220, 220, 220, 449, 3712, 37048, 11, 198, 220, 220, 220, 449, 46256, 119, 126, 117, 3712, 41, 46256, 119, 126, 117, 32, 11, 198, 220, 220, 220, 1540, 4906, 3712, 46344, 6030, 11, 198, 220, 220, 220, 284, 75, 3712, 23839, 51, 37668, 90, 9792, 5512, 198, 220, 220, 220, 3509, 270, 364, 3712, 5317, 11, 198, 8, 810, 1391, 7708, 11, 449, 46256, 119, 126, 117, 32, 11, 41722, 11, 376, 0, 1279, 25, 15553, 11, 5161, 11, 19446, 92, 628, 220, 220, 220, 2124, 62, 23569, 796, 2315, 62, 23569, 7, 34453, 4906, 11, 5161, 8, 198, 220, 220, 220, 376, 62, 23569, 796, 2315, 62, 23569, 7, 34453, 4906, 11, 5161, 8, 198, 220, 220, 220, 611, 1540, 4906, 318, 64, 49973, 577, 46344, 198, 220, 220, 220, 220, 220, 220, 220, 277, 0, 7, 37, 11, 2124, 15, 8, 198, 220, 220, 220, 220, 220, 220, 220, 19530, 28813, 13, 30482, 672, 666, 0, 7, 41, 11, 277, 28265, 376, 11, 2124, 15, 8, 198, 220, 220, 220, 220, 220, 220, 220, 4574, 62, 23569, 0, 7, 87, 62, 23569, 11, 2124, 15, 11, 1540, 4906, 8, 198, 220, 220, 220, 220, 220, 220, 220, 4574, 62, 23569, 0, 7, 37, 62, 23569, 11, 376, 11, 1540, 4906, 8, 198, 220, 220, 220, 886, 198, 220, 220, 220, 329, 1312, 287, 352, 25, 9806, 270, 364, 198, 220, 220, 220, 220, 220, 220, 220, 277, 0, 7, 37, 11, 2124, 15, 8, 198, 220, 220, 220, 220, 220, 220, 220, 19530, 28813, 13, 30482, 672, 666, 0, 7, 41, 11, 277, 28265, 376, 11, 2124, 15, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2124, 16, 764, 28, 2124, 15, 764, 12, 449, 3467, 376, 198, 220, 220, 220, 220, 220, 220, 220, 4574, 62, 23569, 0, 7, 87, 62, 23569, 11, 2124, 16, 11, 1540, 4906, 8, 198, 220, 220, 220, 220, 220, 220, 220, 4574, 62, 23569, 0, 7, 37, 62, 23569, 11, 376, 11, 1540, 4906, 8, 198, 220, 220, 220, 220, 220, 220, 220, 611, 284, 75, 7, 87, 15, 11, 2124, 16, 11, 376, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 28186, 25468, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1540, 4906, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2124, 16, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2081, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 376, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1312, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2124, 62, 23569, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 376, 62, 23569, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1267, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 2124, 15, 796, 2124, 16, 198, 220, 220, 220, 886, 198, 220, 220, 220, 1441, 28186, 25468, 7, 198, 220, 220, 220, 220, 220, 220, 220, 1540, 4906, 11, 198, 220, 220, 220, 220, 220, 220, 220, 2124, 15, 11, 198, 220, 220, 220, 220, 220, 220, 220, 3991, 11, 198, 220, 220, 220, 220, 220, 220, 220, 376, 11, 198, 220, 220, 220, 220, 220, 220, 220, 3509, 270, 364, 11, 198, 220, 220, 220, 220, 220, 220, 220, 2124, 62, 23569, 11, 198, 220, 220, 220, 220, 220, 220, 220, 376, 62, 23569, 11, 198, 220, 220, 220, 1267, 198, 437, 198 ]
1.8058
1,138
# Methods for accessing Cartesian Tuple metadata. Base.summary(t::CartesianTuple{N,T,U}) where {N,T,U} = "$(N)-dimensional $(T) $(name(U))" Base.show(io::IO, t::CartesianTuple) = print(io, "$(summary(t)) $(t.coordinates)") # Iteration, indexing, and field access. Base.iterate(t::CartesianTuple, state...) = iterate(t.coordinates, state...) Base.length(t::CartesianTuple{N,T,U}) where {N,T,U} = size(N) Base.size(::Type{CartesianTuple{N,T,U}}) where {N,T,U} = N Base.eltype(::Type{CartesianTuple{N,T,U}}) where {N,T,U} = T Base.getindex(a::CartesianTuple, inds...) = getindex(a.coordinates, inds...) Base.getproperty(p::CartesianPair, s::Symbol) = @match s begin :x => p[1] :y => p[2] _ => getfield(p, s) end Base.getproperty(t::CartesianTriple, s::Symbol) = @match s begin :x => t[1] :y => t[2] :z => t[3] _ => getfield(t, s) end # General operations on Cartesian Tuples. @inline Base.:(+)(a::CartesianTuple, b::CartesianTuple) = promote_type(typeof(a), typeof(b))(a.coordinates + b.coordinates) @inline Base.:(-)(a::VectorLike, b::VectorLike) = promote_type(typeof(a), typeof(b))(a.coordinates - b.coordinates) @inline function Base.:(*)(a::CartesianTuple, b::Number) @assert !isnan(b) promote_type(typeof(a), typeof(b))(a.coordinates .* b) end @inline Base.:(*)(a::Number, b::CartesianTuple) = b * a @inline function Base.:(/)(a::CartesianTuple, b::Number) @assert b != zero(typeof(b)) inverse = one(eltype(a)) / b a * inverse end @inline Base.:(==)(a::CartesianTuple{N,S,U}, b::CartesianTuple{N,T,U}) where {N,S,T,U} = a.coordinates == b.coordinates @inline Base.:(==)(a::CartesianTuple{N,S,U}, b::CartesianTuple{N,T,V}) where {N,S,T,U,V} = false @inline Base.abs(a::CartesianTuple) = typeof(a)(abs.(a.coordinates)...) @inline Base.:(-)(a::CartesianTuple) = typeof(a)((-).(a.coordinates)...) # Special behaviors for Point-Vector operations. @inline Base.:(+)(a::Point{N,S}, b::Vect{N,T}) where {N,S,T} = promote_type(typeof(a), typeof(b))(a.coordinates + b.coordinates) @inline Base.:(-)(a::Point{N,S}, b::Vect{N,T}) where {N,S,T} = promote_type(typeof(a), typeof(b))(a.coordinates - b.coordinates)
[ 2, 25458, 329, 22534, 13690, 35610, 309, 29291, 20150, 13, 198, 198, 14881, 13, 49736, 7, 83, 3712, 43476, 35610, 51, 29291, 90, 45, 11, 51, 11, 52, 30072, 810, 1391, 45, 11, 51, 11, 52, 92, 796, 17971, 7, 45, 13219, 19577, 29568, 51, 8, 29568, 3672, 7, 52, 4008, 1, 198, 14881, 13, 12860, 7, 952, 3712, 9399, 11, 256, 3712, 43476, 35610, 51, 29291, 8, 796, 3601, 7, 952, 11, 17971, 7, 49736, 7, 83, 4008, 29568, 83, 13, 37652, 17540, 8, 4943, 198, 198, 2, 40806, 341, 11, 6376, 278, 11, 290, 2214, 1895, 13, 198, 198, 14881, 13, 2676, 378, 7, 83, 3712, 43476, 35610, 51, 29291, 11, 1181, 23029, 796, 11629, 378, 7, 83, 13, 37652, 17540, 11, 1181, 23029, 198, 14881, 13, 13664, 7, 83, 3712, 43476, 35610, 51, 29291, 90, 45, 11, 51, 11, 52, 30072, 810, 1391, 45, 11, 51, 11, 52, 92, 796, 2546, 7, 45, 8, 198, 14881, 13, 7857, 7, 3712, 6030, 90, 43476, 35610, 51, 29291, 90, 45, 11, 51, 11, 52, 11709, 8, 810, 1391, 45, 11, 51, 11, 52, 92, 796, 399, 198, 14881, 13, 417, 4906, 7, 3712, 6030, 90, 43476, 35610, 51, 29291, 90, 45, 11, 51, 11, 52, 11709, 8, 810, 1391, 45, 11, 51, 11, 52, 92, 796, 309, 198, 198, 14881, 13, 1136, 9630, 7, 64, 3712, 43476, 35610, 51, 29291, 11, 773, 82, 23029, 796, 651, 9630, 7, 64, 13, 37652, 17540, 11, 773, 82, 23029, 198, 198, 14881, 13, 1136, 26745, 7, 79, 3712, 43476, 35610, 47, 958, 11, 264, 3712, 13940, 23650, 8, 796, 2488, 15699, 264, 2221, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 87, 5218, 279, 58, 16, 60, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 88, 5218, 279, 58, 17, 60, 198, 220, 220, 220, 220, 220, 220, 220, 4808, 220, 5218, 651, 3245, 7, 79, 11, 264, 8, 198, 220, 220, 220, 886, 198, 198, 14881, 13, 1136, 26745, 7, 83, 3712, 43476, 35610, 14824, 1154, 11, 264, 3712, 13940, 23650, 8, 796, 2488, 15699, 264, 2221, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 87, 5218, 256, 58, 16, 60, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 88, 5218, 256, 58, 17, 60, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 89, 5218, 256, 58, 18, 60, 198, 220, 220, 220, 220, 220, 220, 220, 4808, 220, 5218, 651, 3245, 7, 83, 11, 264, 8, 198, 220, 220, 220, 886, 198, 198, 2, 3611, 4560, 319, 13690, 35610, 16749, 2374, 13, 198, 198, 31, 45145, 7308, 11207, 7, 10, 5769, 64, 3712, 43476, 35610, 51, 29291, 11, 275, 3712, 43476, 35610, 51, 29291, 8, 796, 7719, 62, 4906, 7, 4906, 1659, 7, 64, 828, 2099, 1659, 7, 65, 4008, 7, 64, 13, 37652, 17540, 1343, 275, 13, 37652, 17540, 8, 198, 198, 31, 45145, 7308, 11207, 32590, 5769, 64, 3712, 38469, 7594, 11, 275, 3712, 38469, 7594, 8, 796, 7719, 62, 4906, 7, 4906, 1659, 7, 64, 828, 2099, 1659, 7, 65, 4008, 7, 64, 13, 37652, 17540, 532, 275, 13, 37652, 17540, 8, 198, 198, 31, 45145, 2163, 7308, 11207, 46491, 5769, 64, 3712, 43476, 35610, 51, 29291, 11, 275, 3712, 15057, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2488, 30493, 5145, 271, 12647, 7, 65, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7719, 62, 4906, 7, 4906, 1659, 7, 64, 828, 2099, 1659, 7, 65, 4008, 7, 64, 13, 37652, 17540, 764, 9, 275, 8, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 198, 31, 45145, 7308, 11207, 46491, 5769, 64, 3712, 15057, 11, 275, 3712, 43476, 35610, 51, 29291, 8, 796, 275, 1635, 257, 198, 198, 31, 45145, 2163, 7308, 11207, 7, 14, 5769, 64, 3712, 43476, 35610, 51, 29291, 11, 275, 3712, 15057, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2488, 30493, 275, 14512, 6632, 7, 4906, 1659, 7, 65, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 34062, 796, 530, 7, 417, 4906, 7, 64, 4008, 1220, 275, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 257, 1635, 34062, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 198, 31, 45145, 7308, 11207, 7, 855, 5769, 64, 3712, 43476, 35610, 51, 29291, 90, 45, 11, 50, 11, 52, 5512, 275, 3712, 43476, 35610, 51, 29291, 90, 45, 11, 51, 11, 52, 30072, 810, 1391, 45, 11, 50, 11, 51, 11, 52, 92, 796, 257, 13, 37652, 17540, 6624, 275, 13, 37652, 17540, 198, 198, 31, 45145, 7308, 11207, 7, 855, 5769, 64, 3712, 43476, 35610, 51, 29291, 90, 45, 11, 50, 11, 52, 5512, 275, 3712, 43476, 35610, 51, 29291, 90, 45, 11, 51, 11, 53, 30072, 810, 1391, 45, 11, 50, 11, 51, 11, 52, 11, 53, 92, 796, 3991, 198, 198, 31, 45145, 7308, 13, 8937, 7, 64, 3712, 43476, 35610, 51, 29291, 8, 796, 2099, 1659, 7, 64, 5769, 8937, 12195, 64, 13, 37652, 17540, 8, 23029, 198, 198, 31, 45145, 7308, 11207, 32590, 5769, 64, 3712, 43476, 35610, 51, 29291, 8, 796, 2099, 1659, 7, 64, 5769, 32590, 737, 7, 64, 13, 37652, 17540, 8, 23029, 198, 198, 2, 6093, 14301, 329, 6252, 12, 38469, 4560, 13, 198, 198, 31, 45145, 7308, 11207, 7, 10, 5769, 64, 3712, 12727, 90, 45, 11, 50, 5512, 275, 3712, 53, 478, 90, 45, 11, 51, 30072, 810, 1391, 45, 11, 50, 11, 51, 92, 796, 7719, 62, 4906, 7, 4906, 1659, 7, 64, 828, 2099, 1659, 7, 65, 4008, 7, 64, 13, 37652, 17540, 1343, 275, 13, 37652, 17540, 8, 198, 198, 31, 45145, 7308, 11207, 32590, 5769, 64, 3712, 12727, 90, 45, 11, 50, 5512, 275, 3712, 53, 478, 90, 45, 11, 51, 30072, 810, 1391, 45, 11, 50, 11, 51, 92, 796, 7719, 62, 4906, 7, 4906, 1659, 7, 64, 828, 2099, 1659, 7, 65, 4008, 7, 64, 13, 37652, 17540, 532, 275, 13, 37652, 17540, 8, 198 ]
2.213178
1,032
<filename>toy_nlp_tools/idf.jl<gh_stars>0 struct FileHolder fileProcessor::Dict{String, Function} FileHolder(processor::Dict{String, Function}) = new(processor) end function FileHolder(filenames::Vector{String}) processor(line::String) = split(line, ' ') FileHolder(Dict{String, Function}(filename => processor) for filename in filenames) end struct OutSetting outFilename::String outFileFormat::Symbol OutSetting(filename::String) = new(filename, :json) end __idfCaculator(value, documentCount) = log(documentCount / (value != 0 ? value : 1)) mutable struct IDF idfDict::Dict{String, Int64} idfCalculator::Function documentCount::Int64 fileHolder::FileHolder outSetting::OutSetting IDF(fileHolder::FileHolder, outSetting::OutSetting=OutSetting("out.txt"); idfCalculator::Function=__idfCaculator) = new(Dict{String, Int64}(), idfCalculator, 0, fileHolder, outSetting) end function fit!(self::IDF) # TODO: parallize it for (filename, processor) in self.fileHolder.fileProcessor open(filename) do file statisticIDF!(self, file, processor) end end return self end function statisticIDF!(self::IDF, file, processor::Function) for (i, line) in enumerate(eachline(file)) tokens = processor(line) for token in Set(tokens) self.idfDict[token] = get(self.idfDict, token, 0) + 1 end self.documentCount += 1 if i % 1e4 == 0 println(i) end end end function transform() end getIdfValue(self::IDF, key::String) = self.caculator(get(self.idfDict, key, 0), documentCount) function main() # 空格分隔后的,分隔词性,取词 processor(line::String) = map(t -> t[1], map(s -> split(s, "\x01"), split(line, " "))) fh = FileHolder(Dict{String, Function}("filePath" => processor)) idf = IDF(fh) fit!(idf) end #main()
[ 27, 34345, 29, 83, 726, 62, 21283, 79, 62, 31391, 14, 312, 69, 13, 20362, 27, 456, 62, 30783, 29, 15, 198, 7249, 9220, 39, 19892, 198, 220, 220, 220, 2393, 18709, 273, 3712, 35, 713, 90, 10100, 11, 15553, 92, 628, 220, 220, 220, 9220, 39, 19892, 7, 41341, 3712, 35, 713, 90, 10100, 11, 15553, 30072, 796, 649, 7, 41341, 8, 198, 437, 198, 198, 8818, 9220, 39, 19892, 7, 10379, 268, 1047, 3712, 38469, 90, 10100, 30072, 198, 220, 220, 220, 12649, 7, 1370, 3712, 10100, 8, 796, 6626, 7, 1370, 11, 705, 705, 8, 198, 220, 220, 220, 9220, 39, 19892, 7, 35, 713, 90, 10100, 11, 15553, 92, 7, 34345, 5218, 12649, 8, 329, 29472, 287, 1226, 268, 1047, 8, 198, 437, 198, 198, 7249, 3806, 34149, 198, 220, 220, 220, 503, 35063, 3712, 10100, 198, 220, 220, 220, 503, 8979, 26227, 3712, 13940, 23650, 198, 220, 220, 220, 220, 198, 220, 220, 220, 3806, 34149, 7, 34345, 3712, 10100, 8, 796, 649, 7, 34345, 11, 1058, 17752, 8, 198, 437, 198, 198, 834, 312, 69, 34, 330, 8927, 7, 8367, 11, 3188, 12332, 8, 796, 2604, 7, 22897, 12332, 1220, 357, 8367, 14512, 657, 5633, 1988, 1058, 352, 4008, 198, 198, 76, 18187, 2878, 33389, 198, 220, 220, 220, 4686, 69, 35, 713, 3712, 35, 713, 90, 10100, 11, 2558, 2414, 92, 198, 220, 220, 220, 4686, 69, 9771, 3129, 1352, 3712, 22203, 198, 220, 220, 220, 3188, 12332, 3712, 5317, 2414, 628, 220, 220, 220, 2393, 39, 19892, 3712, 8979, 39, 19892, 198, 220, 220, 220, 503, 34149, 3712, 7975, 34149, 198, 220, 220, 220, 33389, 7, 7753, 39, 19892, 3712, 8979, 39, 19892, 11, 503, 34149, 3712, 7975, 34149, 28, 7975, 34149, 7203, 448, 13, 14116, 15341, 4686, 69, 9771, 3129, 1352, 3712, 22203, 28, 834, 312, 69, 34, 330, 8927, 8, 796, 220, 198, 220, 220, 220, 220, 220, 220, 220, 649, 7, 35, 713, 90, 10100, 11, 2558, 2414, 92, 22784, 4686, 69, 9771, 3129, 1352, 11, 657, 11, 2393, 39, 19892, 11, 503, 34149, 8, 198, 437, 198, 198, 8818, 4197, 0, 7, 944, 3712, 2389, 37, 8, 198, 220, 220, 220, 1303, 16926, 46, 25, 1582, 439, 1096, 340, 198, 220, 220, 220, 329, 357, 34345, 11, 12649, 8, 287, 2116, 13, 7753, 39, 19892, 13, 7753, 18709, 273, 198, 220, 220, 220, 220, 220, 220, 220, 1280, 7, 34345, 8, 466, 2393, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 24696, 2389, 37, 0, 7, 944, 11, 2393, 11, 12649, 8, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 886, 198, 220, 220, 220, 1441, 2116, 198, 437, 198, 198, 8818, 24696, 2389, 37, 0, 7, 944, 3712, 2389, 37, 11, 2393, 11, 12649, 3712, 22203, 8, 198, 220, 220, 220, 329, 357, 72, 11, 1627, 8, 287, 27056, 378, 7, 27379, 1370, 7, 7753, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 16326, 796, 12649, 7, 1370, 8, 198, 220, 220, 220, 220, 220, 220, 220, 329, 11241, 287, 5345, 7, 83, 482, 641, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 312, 69, 35, 713, 58, 30001, 60, 796, 651, 7, 944, 13, 312, 69, 35, 713, 11, 11241, 11, 657, 8, 1343, 352, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 22897, 12332, 15853, 352, 628, 220, 220, 220, 220, 220, 220, 220, 611, 1312, 4064, 352, 68, 19, 6624, 657, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 44872, 7, 72, 8, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 886, 198, 437, 198, 198, 8818, 6121, 3419, 198, 198, 437, 198, 198, 1136, 7390, 69, 11395, 7, 944, 3712, 2389, 37, 11, 1994, 3712, 10100, 8, 796, 2116, 13, 66, 330, 8927, 7, 1136, 7, 944, 13, 312, 69, 35, 713, 11, 1994, 11, 657, 828, 3188, 12332, 8, 198, 198, 8818, 1388, 3419, 198, 220, 220, 220, 1303, 13328, 102, 118, 43718, 120, 26344, 228, 49694, 242, 28938, 236, 21410, 171, 120, 234, 26344, 228, 49694, 242, 46237, 235, 45250, 100, 171, 120, 234, 20998, 244, 46237, 235, 198, 220, 220, 220, 12649, 7, 1370, 3712, 10100, 8, 796, 3975, 7, 83, 4613, 256, 58, 16, 4357, 3975, 7, 82, 4613, 6626, 7, 82, 11, 37082, 87, 486, 12340, 6626, 7, 1370, 11, 366, 366, 22305, 198, 220, 220, 220, 277, 71, 796, 9220, 39, 19892, 7, 35, 713, 90, 10100, 11, 15553, 92, 7203, 7753, 15235, 1, 5218, 12649, 4008, 198, 220, 220, 220, 4686, 69, 796, 33389, 7, 69, 71, 8, 628, 220, 220, 220, 4197, 0, 7, 312, 69, 8, 198, 437, 198, 198, 2, 12417, 3419, 198 ]
2.356877
807
<filename>test/runtests.jl<gh_stars>0 using Pda using Test @testset "Pda.jl" begin # Write your tests here. end
[ 27, 34345, 29, 9288, 14, 81, 2797, 3558, 13, 20362, 27, 456, 62, 30783, 29, 15, 198, 3500, 350, 6814, 198, 3500, 6208, 198, 198, 31, 9288, 2617, 366, 47, 6814, 13, 20362, 1, 2221, 198, 220, 220, 220, 1303, 19430, 534, 5254, 994, 13, 198, 437, 198 ]
2.4375
48
<reponame>alejandroclaro/Cryptography.jl # # @description Unit tests for RC4 stream-cipher. # # @author <NAME> (<EMAIL>) # # Copyright 2017 All rights reserved. # Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. # @testset "RC4 cipher tests" begin cipher = Rc4Cipher([ 0x01, 0x02, 0x03, 0x04, 0x05 ]) @test key_size(cipher) == 5 @test_throws ArgumentError Rc4Cipher(UInt8[]) @test_throws ArgumentError Rc4Cipher(zeros(UInt8, 33)) @test encrypt!(cipher, [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]) == UInt8[ 0xb2, 0x39, 0x63, 0x05, 0xf0, 0x3d, 0xc0, 0x27 ] reset!(cipher) @test decrypt!(cipher, UInt8[ 0xb2, 0x39, 0x63, 0x05, 0xf0, 0x3d, 0xc0, 0x27 ]) == [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ] end
[ 27, 7856, 261, 480, 29, 1000, 47983, 565, 12022, 14, 23919, 4867, 13, 20362, 198, 2, 201, 198, 2, 2488, 11213, 11801, 5254, 329, 13987, 19, 4269, 12, 66, 10803, 13, 201, 198, 2, 201, 198, 2, 2488, 9800, 1279, 20608, 29, 38155, 27630, 4146, 43734, 201, 198, 2, 201, 198, 2, 15069, 2177, 1439, 2489, 10395, 13, 201, 198, 2, 5765, 286, 428, 2723, 2438, 318, 21825, 416, 257, 17168, 12, 7635, 5964, 326, 460, 307, 1043, 287, 262, 38559, 24290, 2393, 13, 201, 198, 2, 201, 198, 31, 9288, 2617, 366, 7397, 19, 38012, 5254, 1, 2221, 201, 198, 220, 38012, 796, 371, 66, 19, 34, 10803, 26933, 657, 87, 486, 11, 657, 87, 2999, 11, 657, 87, 3070, 11, 657, 87, 3023, 11, 657, 87, 2713, 33761, 201, 198, 201, 198, 220, 2488, 9288, 1994, 62, 7857, 7, 66, 10803, 8, 6624, 642, 201, 198, 201, 198, 220, 2488, 9288, 62, 400, 8516, 45751, 12331, 371, 66, 19, 34, 10803, 7, 52, 5317, 23, 58, 12962, 201, 198, 220, 2488, 9288, 62, 400, 8516, 45751, 12331, 371, 66, 19, 34, 10803, 7, 9107, 418, 7, 52, 5317, 23, 11, 4747, 4008, 201, 198, 201, 198, 220, 2488, 9288, 34117, 0, 7, 66, 10803, 11, 685, 657, 87, 405, 11, 657, 87, 405, 11, 657, 87, 405, 11, 657, 87, 405, 11, 657, 87, 405, 11, 657, 87, 405, 11, 657, 87, 405, 11, 657, 87, 405, 33761, 6624, 471, 5317, 23, 58, 657, 30894, 17, 11, 657, 87, 2670, 11, 657, 87, 5066, 11, 657, 87, 2713, 11, 657, 26152, 15, 11, 657, 87, 18, 67, 11, 657, 25306, 15, 11, 657, 87, 1983, 2361, 201, 198, 201, 198, 220, 13259, 0, 7, 66, 10803, 8, 201, 198, 201, 198, 220, 2488, 9288, 42797, 0, 7, 66, 10803, 11, 471, 5317, 23, 58, 657, 30894, 17, 11, 657, 87, 2670, 11, 657, 87, 5066, 11, 657, 87, 2713, 11, 657, 26152, 15, 11, 657, 87, 18, 67, 11, 657, 25306, 15, 11, 657, 87, 1983, 33761, 6624, 685, 657, 87, 405, 11, 657, 87, 405, 11, 657, 87, 405, 11, 657, 87, 405, 11, 657, 87, 405, 11, 657, 87, 405, 11, 657, 87, 405, 11, 657, 87, 405, 2361, 201, 198, 437, 201, 198, 201, 198 ]
2.128947
380
using Plots pyplot() # Use PyPlot as a backend (may already be the default) #x = collect(1:7) #y = [] #for item in x #push!(y, 2 - 2*item + item^2/4) #end #plot(x,y) #plot!(x, y, marker = :diamond, linewidth=2) #plot!(title = "Sample plot", leg=false) x = [1 2 3 4 5 6]' #y = (x-3).^2/4 y = [] for item in x push!(y, (item-3).^2/4) end plot(x,y, marker = :hex, leg=false, linewidth = 2, linecolor=:black) plot!(title="Plot for graded quiz") gui() # To show plot on atom
[ 3500, 1345, 1747, 198, 9078, 29487, 3419, 1303, 5765, 9485, 43328, 355, 257, 30203, 357, 11261, 1541, 307, 262, 4277, 8, 198, 198, 2, 87, 796, 2824, 7, 16, 25, 22, 8, 198, 2, 88, 796, 17635, 198, 198, 2, 1640, 2378, 287, 2124, 198, 220, 220, 220, 1303, 14689, 0, 7, 88, 11, 362, 532, 362, 9, 9186, 1343, 2378, 61, 17, 14, 19, 8, 198, 2, 437, 628, 198, 198, 2, 29487, 7, 87, 11, 88, 8, 198, 2, 29487, 0, 7, 87, 11, 331, 11, 18364, 796, 1058, 67, 8446, 11, 9493, 413, 5649, 28, 17, 8, 198, 2, 29487, 0, 7, 7839, 796, 366, 36674, 7110, 1600, 1232, 28, 9562, 8, 198, 198, 87, 796, 685, 16, 362, 513, 604, 642, 718, 49946, 198, 2, 88, 796, 357, 87, 12, 18, 737, 61, 17, 14, 19, 198, 88, 796, 17635, 198, 198, 1640, 2378, 287, 2124, 198, 220, 220, 220, 4574, 0, 7, 88, 11, 357, 9186, 12, 18, 737, 61, 17, 14, 19, 8, 198, 437, 198, 198, 29487, 7, 87, 11, 88, 11, 18364, 796, 1058, 33095, 11, 1232, 28, 9562, 11, 9493, 413, 5649, 796, 362, 11, 1627, 8043, 28, 25, 13424, 8, 198, 29487, 0, 7, 7839, 2625, 43328, 329, 44545, 38964, 4943, 198, 48317, 3419, 220, 220, 220, 1303, 1675, 905, 7110, 319, 22037 ]
2.188341
223
import DataFrames """ """ function fit!( transformer::ImmutablePredictionsSingleLabelInt2StringTransformer, varargs...; kwargs... ) if length(varargs) == 1 return varargs[1] else return varargs end end """ """ function predict( transformer::ImmutablePredictionsSingleLabelInt2StringTransformer, single_labelpredictions::AbstractVector, varargs...; kwargs... ) single_labelpredictions = parse.(Int, single_labelpredictions) labelint2stringmap = getlabelint2stringmap( transformer.levels, transformer.index, ) result = Vector{String}( undef, length(single_labelpredictions), ) for i = 1:length(result) result[i] = labelint2stringmap[single_labelpredictions[i]] end return result end """ """ function predict( transformer::ImmutablePredictionsSingleLabelInt2StringTransformer, single_labelpredictions::DataFrames.AbstractDataFrame, varargs...; kwargs... ) label_names = DataFrames.names(single_labelpredictions) result = DataFrames.DataFrame() for i = 1:length(label_names) result[label_names[i]] = predict( transformer, single_labelpredictions[label_names[i]]; kwargs... ) end return result end """ """ function predict_proba( transformer::ImmutablePredictionsSingleLabelInt2StringTransformer, varargs...; kwargs... ) if length(varargs) == 1 return varargs[1] else return varargs end end
[ 11748, 6060, 35439, 198, 198, 37811, 198, 37811, 198, 8818, 4197, 0, 7, 198, 220, 220, 220, 220, 220, 220, 220, 47385, 3712, 24675, 18187, 39156, 9278, 28008, 33986, 5317, 17, 10100, 8291, 16354, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1401, 22046, 986, 26, 198, 220, 220, 220, 220, 220, 220, 220, 479, 86, 22046, 986, 198, 220, 220, 220, 220, 220, 220, 220, 1267, 198, 220, 220, 220, 611, 4129, 7, 7785, 22046, 8, 6624, 352, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 1401, 22046, 58, 16, 60, 198, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 1401, 22046, 198, 220, 220, 220, 886, 198, 437, 198, 198, 37811, 198, 37811, 198, 8818, 4331, 7, 198, 220, 220, 220, 220, 220, 220, 220, 47385, 3712, 24675, 18187, 39156, 9278, 28008, 33986, 5317, 17, 10100, 8291, 16354, 11, 198, 220, 220, 220, 220, 220, 220, 220, 2060, 62, 18242, 28764, 9278, 3712, 23839, 38469, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1401, 22046, 986, 26, 198, 220, 220, 220, 220, 220, 220, 220, 479, 86, 22046, 986, 198, 220, 220, 220, 220, 220, 220, 220, 1267, 198, 220, 220, 220, 2060, 62, 18242, 28764, 9278, 796, 21136, 12195, 5317, 11, 2060, 62, 18242, 28764, 9278, 8, 198, 220, 220, 220, 6167, 600, 17, 8841, 8899, 796, 651, 18242, 600, 17, 8841, 8899, 7, 198, 220, 220, 220, 220, 220, 220, 220, 47385, 13, 46170, 11, 198, 220, 220, 220, 220, 220, 220, 220, 47385, 13, 9630, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1267, 198, 220, 220, 220, 1255, 796, 20650, 90, 10100, 92, 7, 198, 220, 220, 220, 220, 220, 220, 220, 3318, 891, 11, 198, 220, 220, 220, 220, 220, 220, 220, 4129, 7, 29762, 62, 18242, 28764, 9278, 828, 198, 220, 220, 220, 220, 220, 220, 220, 1267, 198, 220, 220, 220, 329, 1312, 796, 352, 25, 13664, 7, 20274, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1255, 58, 72, 60, 796, 6167, 600, 17, 8841, 8899, 58, 29762, 62, 18242, 28764, 9278, 58, 72, 11907, 198, 220, 220, 220, 886, 198, 220, 220, 220, 1441, 1255, 198, 437, 198, 198, 37811, 198, 37811, 198, 8818, 4331, 7, 198, 220, 220, 220, 220, 220, 220, 220, 47385, 3712, 24675, 18187, 39156, 9278, 28008, 33986, 5317, 17, 10100, 8291, 16354, 11, 198, 220, 220, 220, 220, 220, 220, 220, 2060, 62, 18242, 28764, 9278, 3712, 6601, 35439, 13, 23839, 6601, 19778, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1401, 22046, 986, 26, 198, 220, 220, 220, 220, 220, 220, 220, 479, 86, 22046, 986, 198, 220, 220, 220, 220, 220, 220, 220, 1267, 198, 220, 220, 220, 6167, 62, 14933, 796, 6060, 35439, 13, 14933, 7, 29762, 62, 18242, 28764, 9278, 8, 198, 220, 220, 220, 1255, 796, 6060, 35439, 13, 6601, 19778, 3419, 198, 220, 220, 220, 329, 1312, 796, 352, 25, 13664, 7, 18242, 62, 14933, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1255, 58, 18242, 62, 14933, 58, 72, 11907, 796, 4331, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 47385, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2060, 62, 18242, 28764, 9278, 58, 18242, 62, 14933, 58, 72, 60, 11208, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 479, 86, 22046, 986, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1267, 198, 220, 220, 220, 886, 198, 220, 220, 220, 1441, 1255, 198, 437, 198, 198, 37811, 198, 37811, 198, 8818, 4331, 62, 1676, 7012, 7, 198, 220, 220, 220, 220, 220, 220, 220, 47385, 3712, 24675, 18187, 39156, 9278, 28008, 33986, 5317, 17, 10100, 8291, 16354, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1401, 22046, 986, 26, 198, 220, 220, 220, 220, 220, 220, 220, 479, 86, 22046, 986, 198, 220, 220, 220, 220, 220, 220, 220, 1267, 198, 220, 220, 220, 611, 4129, 7, 7785, 22046, 8, 6624, 352, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 1401, 22046, 58, 16, 60, 198, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 1401, 22046, 198, 220, 220, 220, 886, 198, 437, 198 ]
2.298883
716
function chop_sections(set1, set2, n :: Integer, spacing = "cosine"; flip = false) if lowercase(spacing) == "uniform" space = uniform_spacing(0., 1., n + 1) elseif lowercase(spacing) == "sine" space = sine_spacing(0., 1., (n + 1) * ifelse(flip, -1, 1)) else space = cosine_spacing(0.5, 1., n + 1) end @views [ weighted_vector.(set1, set2, μ) for μ ∈ space ][1:end-1] end chop_coordinates(coords, n, spacings = "cosine", flip = false) = @views [ reduce(vcat, chop_sections.(coords[1:end-1], coords[2:end], n, spacings; flip = flip)); [ coords[end] ] ] chord_sections(lead, trail) = [ [ l'; t' ] for (l, t) ∈ zip(lead, trail) ] chop_chords(coords, n) = @views [ [ weighted_vector(chord[1,:], chord[2,:], μ) for μ ∈ cosine_spacing(0.5, 1., n + 1) ] for chord ∈ coords ] chop_spans(lead, trail, div, spacing = "cosine", flip = false) = chop_coordinates(lead, div, spacing, flip), chop_coordinates(trail, div, spacing, flip) chop_wing(lead, trail, span_num, chord_num; span_spacing = "cosine", flip = false) = let (lead, trail) = chop_spans(lead, trail, span_num, span_spacing, flip); chop_chords(chord_sections(lead, trail), chord_num) end """ make_panels(xyzs) Convert an array of coordinates corresponding to a wing, ordered from root to tip and leading-edge to trailing-edge, into panels. """ make_panels(xyzs) = @views Panel3D.(xyzs[1:end-1,1:end-1], xyzs[2:end,1:end-1], xyzs[2:end,2:end], xyzs[1:end-1,2:end]) # WTF was I thinking? # spanlist = vectarray.(coords) # spanlist = zip(coords, coords[2:end,:]) # adjacent_sections = zip(spanlist, spanlist[2:end]) # @views hcat(( Panel3D.(root[1:end-1], root[2:end], tip[2:end], tip[1:end-1]) for (root, tip) ∈ adjacent_sections )...)
[ 8818, 30506, 62, 23946, 7, 2617, 16, 11, 900, 17, 11, 299, 7904, 34142, 11, 31050, 796, 366, 6966, 500, 8172, 14283, 796, 3991, 8, 198, 220, 220, 220, 611, 2793, 7442, 7, 2777, 4092, 8, 6624, 366, 403, 6933, 1, 198, 220, 220, 220, 220, 220, 220, 220, 2272, 796, 8187, 62, 2777, 4092, 7, 15, 1539, 352, 1539, 299, 1343, 352, 8, 198, 220, 220, 220, 2073, 361, 2793, 7442, 7, 2777, 4092, 8, 6624, 366, 82, 500, 1, 198, 220, 220, 220, 220, 220, 220, 220, 2272, 796, 264, 500, 62, 2777, 4092, 7, 15, 1539, 352, 1539, 357, 77, 1343, 352, 8, 1635, 611, 17772, 7, 2704, 541, 11, 532, 16, 11, 352, 4008, 198, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 2272, 796, 8615, 500, 62, 2777, 4092, 7, 15, 13, 20, 11, 352, 1539, 299, 1343, 352, 8, 198, 220, 220, 220, 886, 628, 220, 220, 220, 2488, 33571, 685, 26356, 62, 31364, 12195, 2617, 16, 11, 900, 17, 11, 18919, 8, 329, 18919, 18872, 230, 2272, 41832, 16, 25, 437, 12, 16, 60, 198, 437, 198, 198, 354, 404, 62, 37652, 17540, 7, 1073, 3669, 11, 299, 11, 34752, 654, 796, 366, 6966, 500, 1600, 14283, 796, 3991, 8, 796, 2488, 33571, 685, 4646, 7, 85, 9246, 11, 30506, 62, 23946, 12195, 1073, 3669, 58, 16, 25, 437, 12, 16, 4357, 763, 3669, 58, 17, 25, 437, 4357, 299, 11, 34752, 654, 26, 14283, 796, 14283, 18125, 685, 763, 3669, 58, 437, 60, 2361, 2361, 198, 198, 354, 585, 62, 23946, 7, 28230, 11, 8025, 8, 796, 685, 685, 300, 17020, 256, 6, 2361, 329, 357, 75, 11, 256, 8, 18872, 230, 19974, 7, 28230, 11, 8025, 8, 2361, 198, 198, 354, 404, 62, 354, 3669, 7, 1073, 3669, 11, 299, 8, 796, 2488, 33571, 685, 685, 26356, 62, 31364, 7, 354, 585, 58, 16, 11, 25, 4357, 25594, 58, 17, 11, 25, 4357, 18919, 8, 329, 18919, 18872, 230, 8615, 500, 62, 2777, 4092, 7, 15, 13, 20, 11, 352, 1539, 299, 1343, 352, 8, 2361, 329, 25594, 18872, 230, 763, 3669, 2361, 198, 198, 354, 404, 62, 2777, 504, 7, 28230, 11, 8025, 11, 2659, 11, 31050, 796, 366, 6966, 500, 1600, 14283, 796, 3991, 8, 796, 30506, 62, 37652, 17540, 7, 28230, 11, 2659, 11, 31050, 11, 14283, 828, 30506, 62, 37652, 17540, 7, 9535, 346, 11, 2659, 11, 31050, 11, 14283, 8, 198, 198, 354, 404, 62, 5469, 7, 28230, 11, 8025, 11, 11506, 62, 22510, 11, 25594, 62, 22510, 26, 11506, 62, 2777, 4092, 796, 366, 6966, 500, 1600, 14283, 796, 3991, 8, 796, 1309, 357, 28230, 11, 8025, 8, 796, 30506, 62, 2777, 504, 7, 28230, 11, 8025, 11, 11506, 62, 22510, 11, 11506, 62, 2777, 4092, 11, 14283, 1776, 30506, 62, 354, 3669, 7, 354, 585, 62, 23946, 7, 28230, 11, 8025, 828, 25594, 62, 22510, 8, 886, 198, 198, 37811, 198, 220, 220, 220, 787, 62, 6839, 1424, 7, 5431, 89, 82, 8, 198, 198, 3103, 1851, 281, 7177, 286, 22715, 11188, 284, 257, 8539, 11, 6149, 422, 6808, 284, 8171, 290, 3756, 12, 14907, 284, 25462, 12, 14907, 11, 656, 13043, 13, 198, 37811, 198, 15883, 62, 6839, 1424, 7, 5431, 89, 82, 8, 796, 2488, 33571, 18810, 18, 35, 12195, 5431, 89, 82, 58, 16, 25, 437, 12, 16, 11, 16, 25, 437, 12, 16, 4357, 2124, 45579, 82, 58, 17, 25, 437, 11, 16, 25, 437, 12, 16, 4357, 2124, 45579, 82, 58, 17, 25, 437, 11, 17, 25, 437, 4357, 2124, 45579, 82, 58, 16, 25, 437, 12, 16, 11, 17, 25, 437, 12962, 198, 198, 2, 370, 10234, 373, 314, 3612, 30, 198, 2, 11506, 4868, 796, 1569, 310, 18747, 12195, 1073, 3669, 8, 198, 2, 11506, 4868, 796, 19974, 7, 1073, 3669, 11, 763, 3669, 58, 17, 25, 437, 11, 25, 12962, 198, 2, 15909, 62, 23946, 796, 19974, 7, 12626, 4868, 11, 11506, 4868, 58, 17, 25, 437, 12962, 198, 2, 2488, 33571, 289, 9246, 19510, 18810, 18, 35, 12195, 15763, 58, 16, 25, 437, 12, 16, 4357, 6808, 58, 17, 25, 437, 4357, 8171, 58, 17, 25, 437, 4357, 8171, 58, 16, 25, 437, 12, 16, 12962, 329, 357, 15763, 11, 8171, 8, 18872, 230, 15909, 62, 23946, 1267, 23029 ]
2.420613
718
<filename>hsic.jl using LinearAlgebra using Distances # unittest performance # versus python hsic_varioustests_npy.py unittest: # 20sec elapsed / 52sec user (i.e. multithreaded) # using distmat1: 10.3sec # using Distances.jl pairwise 13.2sec # using distmatvec: 10.7sec # performance discussion see https://discourse.julialang.org/t/sum-of-hadamard-products/3531/5 # for comparison, do the non-vectorized calculation # points are in columns, dimensions(variables) across rows # note transposed from previous convention! function distmatslow(X,Y) m = size(X,2) @assert m==size(Y,2) #"size mismatch" D = Array{Float32}(undef,m,m) for ix = 1:m @inbounds for iy = 1:m x = X[:,ix] y = Y[:,iy] d = norm(x-y) D[ix,iy] = d*d end end return D end function distmat(X,Y) m = size(X,2) @assert m==size(Y,2) #"size mismatch" D = Array{Float32}(undef,m,m) for ix = 1:m @inbounds for iy = ix:m x = X[:,ix] y = Y[:,iy] d = x-y d2 = d'*d D[ix,iy] = d2 D[iy,ix] = d2 end end return D end # function distmatvec(X,Y) """ points are in columns, dimensions(variables) down rows """ m = size(X,2) @assert m==size(Y,2) #"size mismatch" XY = sum(X .* Y,dims=1) #XY = XY.reshape(m,1) #R1 = n_.tile(XY,(1,Y.shape[0])) R1 = repeat(XY',1,m) # outer=(1,m) not suported by autograd R2 = repeat(XY,m,1) #xy_ = X * Y' D = R1 + R2 - 2.f0 * X' * Y D end # python-ish version requires broadcasting different shapes - "outer sum" function distmat1(X,Y) A = sum(X .* X,dims=1)' B = sum(Y .* Y,dims=1) C = X' * Y A .+ B .- 2.f0 * C end function eye(n) Matrix{Float32}(I,n,n) end function hsic(X,Y,sigma) #= # 1/m^2 Tr Kx H Ky H X,Y have data in COLUMNS, each row is a dimension # NB is transposed from python =# #println("X=\n", X'[1:2,:]) #Yt = Y;; println("Y=\n", Yt[1:2:]) m = size(X,2) println("hsic between ",m,"points") H = eye(m) - (1.f0 / m) * ones(Float32,m,m) #Dxx = distmatvec(X,X) #Dyy = distmatvec(Y,Y) Dxx = distmat1(X,X) Dyy = distmat1(Y,Y) #Dxx = pairwise(SqEuclidean(),X,X,dims=2) #Dyy = pairwise(SqEuclidean(),Y,Y,dims=2) sigma2 = 2.f0 * sigma*sigma Kx = exp.( -Dxx / sigma2 ) Ky = exp.( -Dyy / sigma2 ) Kxc = Kx * H Kyc = Ky * H thehsic = (1.f0 / (m*m)) * sum(Kxc' .* Kyc) return thehsic # type float32 end # Pkg.add("NPZ") using NPZ # aug19: this matches the output of the unittest in hsic_varioustests_npy function unittest() X = Float32[0.1 0.2 0.3; 5 4 3] Y = Float32[1 2 3; 2 2 2] X = transpose(X) Y = transpose(Y) println(distmatslow(X,X)) println(distmat(X,X)) println(distmatslow(Y,Y)) println(distmat(Y,Y)) println("hsic(X,Y,0.5)=",hsic(X,Y,0.5f0)) # larger test data = npzread("/tmp/_data.npz") # todo convert arrays to float32 X = data["arr_0"] Y = data["arr_1"] X = convert(Array{Float32,2},X') Y = convert(Array{Float32,2},Y') println("X=\n", X'[1:2,:]) println("Y=\n", Y'[1:2,:]) println("\nindependent hsic(X,Y,1)=",hsic(X,Y,1.f0)) println("\nidentical hsic(X,X,1)=",hsic(X,copy(X),1.f0)) Y2 = X .* X println("Y2=",Y2'[1:2,:]) println("\nnonlinear hsic(X,Y*Y,1)=",hsic(X,Y2,1.f0)) end
[ 27, 34345, 29, 11994, 291, 13, 20362, 198, 3500, 44800, 2348, 29230, 198, 3500, 4307, 1817, 198, 198, 2, 555, 715, 395, 2854, 198, 2, 9051, 21015, 289, 21383, 62, 25641, 23968, 3558, 62, 77, 9078, 13, 9078, 555, 715, 395, 25, 198, 2, 220, 220, 220, 1160, 2363, 42118, 1220, 6740, 2363, 2836, 357, 72, 13, 68, 13, 1963, 342, 961, 276, 8, 198, 2, 1262, 1233, 6759, 16, 25, 838, 13, 18, 2363, 198, 2, 1262, 4307, 1817, 13, 20362, 5166, 3083, 1511, 13, 17, 2363, 198, 2, 1262, 1233, 6759, 35138, 25, 838, 13, 22, 2363, 198, 198, 2, 2854, 5114, 766, 3740, 1378, 15410, 9047, 13, 73, 377, 498, 648, 13, 2398, 14, 83, 14, 16345, 12, 1659, 12, 18108, 321, 446, 12, 29498, 14, 2327, 3132, 14, 20, 198, 198, 2, 329, 7208, 11, 466, 262, 1729, 12, 31364, 1143, 17952, 198, 2, 2173, 389, 287, 15180, 11, 15225, 7, 25641, 2977, 8, 1973, 15274, 198, 2, 3465, 1007, 29813, 422, 2180, 9831, 0, 198, 8818, 1233, 76, 1381, 9319, 7, 55, 11, 56, 8, 198, 220, 285, 796, 2546, 7, 55, 11, 17, 8, 198, 220, 2488, 30493, 285, 855, 7857, 7, 56, 11, 17, 8, 1303, 1, 7857, 46318, 1, 198, 220, 360, 796, 15690, 90, 43879, 2624, 92, 7, 917, 891, 11, 76, 11, 76, 8, 198, 220, 329, 220, 844, 796, 352, 25, 76, 198, 220, 220, 220, 2488, 259, 65, 3733, 329, 1312, 88, 796, 352, 25, 76, 198, 220, 220, 220, 220, 220, 2124, 796, 1395, 58, 45299, 844, 60, 198, 220, 220, 220, 220, 220, 331, 796, 575, 58, 45299, 7745, 60, 198, 220, 220, 220, 220, 220, 288, 796, 2593, 7, 87, 12, 88, 8, 198, 220, 220, 220, 220, 220, 360, 58, 844, 11, 7745, 60, 796, 288, 9, 67, 198, 220, 220, 220, 886, 198, 220, 886, 198, 220, 1441, 360, 198, 437, 198, 198, 8818, 1233, 6759, 7, 55, 11, 56, 8, 198, 220, 285, 796, 2546, 7, 55, 11, 17, 8, 198, 220, 2488, 30493, 285, 855, 7857, 7, 56, 11, 17, 8, 1303, 1, 7857, 46318, 1, 198, 220, 360, 796, 15690, 90, 43879, 2624, 92, 7, 917, 891, 11, 76, 11, 76, 8, 198, 220, 329, 220, 844, 796, 352, 25, 76, 198, 220, 220, 220, 2488, 259, 65, 3733, 329, 1312, 88, 796, 220, 844, 25, 76, 198, 220, 220, 220, 220, 220, 2124, 796, 1395, 58, 45299, 844, 60, 198, 220, 220, 220, 220, 220, 331, 796, 575, 58, 45299, 7745, 60, 198, 220, 220, 220, 220, 220, 288, 796, 2124, 12, 88, 198, 220, 220, 220, 220, 220, 288, 17, 796, 288, 6, 9, 67, 198, 220, 220, 220, 220, 220, 360, 58, 844, 11, 7745, 60, 796, 288, 17, 198, 220, 220, 220, 220, 220, 360, 58, 7745, 11, 844, 60, 796, 288, 17, 198, 220, 220, 220, 886, 198, 220, 886, 198, 220, 1441, 360, 198, 437, 198, 198, 2, 198, 8818, 1233, 6759, 35138, 7, 55, 11, 56, 8, 198, 220, 37227, 198, 220, 2173, 389, 287, 15180, 11, 15225, 7, 25641, 2977, 8, 866, 15274, 198, 220, 37227, 198, 220, 285, 796, 2546, 7, 55, 11, 17, 8, 198, 220, 2488, 30493, 285, 855, 7857, 7, 56, 11, 17, 8, 1303, 1, 7857, 46318, 1, 628, 220, 41420, 796, 2160, 7, 55, 764, 9, 575, 11, 67, 12078, 28, 16, 8, 198, 220, 1303, 34278, 796, 41420, 13, 3447, 1758, 7, 76, 11, 16, 8, 198, 220, 1303, 49, 16, 796, 299, 44807, 40927, 7, 34278, 11, 7, 16, 11, 56, 13, 43358, 58, 15, 60, 4008, 198, 220, 371, 16, 796, 9585, 7, 34278, 3256, 16, 11, 76, 8, 220, 1303, 12076, 16193, 16, 11, 76, 8, 407, 424, 9213, 416, 1960, 519, 6335, 198, 220, 371, 17, 796, 9585, 7, 34278, 11, 76, 11, 16, 8, 198, 220, 1303, 5431, 62, 796, 1395, 1635, 575, 6, 198, 220, 360, 796, 371, 16, 1343, 371, 17, 532, 362, 13, 69, 15, 1635, 1395, 6, 1635, 575, 198, 220, 360, 198, 437, 198, 198, 2, 21015, 12, 680, 2196, 4433, 22978, 1180, 15268, 532, 366, 39605, 2160, 1, 198, 8818, 1233, 6759, 16, 7, 55, 11, 56, 8, 198, 220, 317, 796, 2160, 7, 55, 764, 9, 1395, 11, 67, 12078, 28, 16, 33047, 198, 220, 347, 796, 2160, 7, 56, 764, 9, 575, 11, 67, 12078, 28, 16, 8, 198, 220, 327, 796, 1395, 6, 1635, 575, 198, 220, 317, 764, 10, 347, 764, 12, 362, 13, 69, 15, 1635, 327, 198, 437, 198, 198, 8818, 4151, 7, 77, 8, 198, 220, 24936, 90, 43879, 2624, 92, 7, 40, 11, 77, 11, 77, 8, 198, 437, 198, 198, 8818, 289, 21383, 7, 55, 11, 56, 11, 82, 13495, 8, 198, 220, 1303, 28, 198, 220, 1303, 352, 14, 76, 61, 17, 833, 509, 87, 367, 11118, 367, 198, 220, 1395, 11, 56, 423, 1366, 287, 20444, 5883, 8035, 11, 1123, 5752, 318, 257, 15793, 198, 220, 1303, 41354, 318, 1007, 29813, 422, 21015, 198, 220, 796, 2, 198, 220, 1303, 35235, 7203, 55, 28, 59, 77, 1600, 1395, 6, 58, 16, 25, 17, 11, 25, 12962, 198, 220, 1303, 56, 83, 796, 575, 7665, 44872, 7203, 56, 28, 59, 77, 1600, 575, 83, 58, 16, 25, 17, 25, 12962, 198, 220, 285, 796, 2546, 7, 55, 11, 17, 8, 198, 220, 44872, 7203, 11994, 291, 1022, 33172, 76, 553, 13033, 4943, 198, 220, 367, 796, 4151, 7, 76, 8, 532, 357, 16, 13, 69, 15, 1220, 285, 8, 1635, 3392, 7, 43879, 2624, 11, 76, 11, 76, 8, 198, 220, 1303, 35, 5324, 796, 1233, 6759, 35138, 7, 55, 11, 55, 8, 198, 220, 1303, 35, 22556, 796, 1233, 6759, 35138, 7, 56, 11, 56, 8, 198, 220, 360, 5324, 796, 1233, 6759, 16, 7, 55, 11, 55, 8, 198, 220, 360, 22556, 796, 1233, 6759, 16, 7, 56, 11, 56, 8, 198, 220, 1303, 35, 5324, 796, 5166, 3083, 7, 50, 80, 36, 36616, 485, 272, 22784, 55, 11, 55, 11, 67, 12078, 28, 17, 8, 198, 220, 1303, 35, 22556, 796, 5166, 3083, 7, 50, 80, 36, 36616, 485, 272, 22784, 56, 11, 56, 11, 67, 12078, 28, 17, 8, 198, 220, 264, 13495, 17, 796, 362, 13, 69, 15, 1635, 264, 13495, 9, 82, 13495, 198, 220, 509, 87, 796, 1033, 12195, 532, 35, 5324, 1220, 264, 13495, 17, 1267, 198, 220, 11118, 796, 1033, 12195, 532, 35, 22556, 1220, 264, 13495, 17, 1267, 198, 220, 509, 25306, 796, 509, 87, 1635, 367, 198, 220, 11118, 66, 796, 11118, 1635, 367, 198, 220, 262, 11994, 291, 796, 357, 16, 13, 69, 15, 1220, 357, 76, 9, 76, 4008, 1635, 2160, 7, 42, 25306, 6, 764, 9, 11118, 66, 8, 198, 220, 1441, 262, 11994, 291, 197, 2, 2099, 12178, 2624, 198, 437, 198, 198, 2, 350, 10025, 13, 2860, 7203, 22182, 57, 4943, 198, 3500, 28498, 57, 198, 2, 16339, 1129, 25, 428, 7466, 262, 5072, 286, 262, 555, 715, 395, 287, 289, 21383, 62, 25641, 23968, 3558, 62, 77, 9078, 198, 8818, 555, 715, 395, 3419, 198, 220, 1395, 796, 48436, 2624, 58, 15, 13, 16, 657, 13, 17, 657, 13, 18, 26, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 642, 604, 513, 60, 198, 220, 575, 796, 48436, 2624, 58, 16, 362, 513, 26, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 362, 362, 362, 60, 198, 220, 1395, 796, 1007, 3455, 7, 55, 8, 198, 220, 575, 796, 1007, 3455, 7, 56, 8, 198, 220, 44872, 7, 17080, 76, 1381, 9319, 7, 55, 11, 55, 4008, 198, 220, 44872, 7, 17080, 6759, 7, 55, 11, 55, 4008, 198, 220, 44872, 7, 17080, 76, 1381, 9319, 7, 56, 11, 56, 4008, 198, 220, 44872, 7, 17080, 6759, 7, 56, 11, 56, 4008, 198, 220, 44872, 7203, 11994, 291, 7, 55, 11, 56, 11, 15, 13, 20, 47505, 1600, 11994, 291, 7, 55, 11, 56, 11, 15, 13, 20, 69, 15, 4008, 628, 220, 1303, 4025, 1332, 198, 220, 1366, 796, 45941, 89, 961, 7203, 14, 22065, 47835, 7890, 13, 37659, 89, 4943, 198, 220, 1303, 284, 4598, 10385, 26515, 284, 12178, 2624, 198, 220, 1395, 796, 1366, 14692, 3258, 62, 15, 8973, 198, 220, 575, 796, 1366, 14692, 3258, 62, 16, 8973, 198, 220, 1395, 796, 10385, 7, 19182, 90, 43879, 2624, 11, 17, 5512, 55, 11537, 198, 220, 575, 796, 10385, 7, 19182, 90, 43879, 2624, 11, 17, 5512, 56, 11537, 198, 220, 44872, 7203, 55, 28, 59, 77, 1600, 1395, 6, 58, 16, 25, 17, 11, 25, 12962, 198, 220, 44872, 7203, 56, 28, 59, 77, 1600, 575, 6, 58, 16, 25, 17, 11, 25, 12962, 628, 220, 44872, 7203, 59, 77, 34750, 289, 21383, 7, 55, 11, 56, 11, 16, 47505, 1600, 11994, 291, 7, 55, 11, 56, 11, 16, 13, 69, 15, 4008, 628, 220, 44872, 7203, 59, 77, 738, 605, 289, 21383, 7, 55, 11, 55, 11, 16, 47505, 1600, 11994, 291, 7, 55, 11, 30073, 7, 55, 828, 16, 13, 69, 15, 4008, 628, 220, 575, 17, 796, 1395, 764, 9, 1395, 198, 220, 44872, 7203, 56, 17, 28, 1600, 56, 17, 6, 58, 16, 25, 17, 11, 25, 12962, 198, 220, 44872, 7203, 59, 77, 13159, 29127, 289, 21383, 7, 55, 11, 56, 9, 56, 11, 16, 47505, 1600, 11994, 291, 7, 55, 11, 56, 17, 11, 16, 13, 69, 15, 4008, 198, 437, 198 ]
2.048428
1,590
using Cosmology using Test, Unitful, UnitfulAstro, QuadGK # values from http://icosmos.co.uk/ dist_rtol = 1e-6 age_rtol = 2e-4 # Integrating a unitful function would require UnitfulIntegration.jl. Without using it, we # strip the units away from the integrand function integrand(c, z) = 4pi*ustrip(comoving_volume_element(c, z)) @testset "FlatLCDM" begin c = cosmology(h=0.7, OmegaM=0.3, OmegaR=0) @test angular_diameter_dist(c,1,rtol=dist_rtol) ≈ 1651.9145u"Mpc" rtol = dist_rtol @test angular_diameter_dist(c,1,2,rtol=dist_rtol) ≈ 625.3444u"Mpc" rtol = dist_rtol @test angular_diameter_dist(c,pi,rtol=dist_rtol) ≈ angular_diameter_dist(c,0,pi,rtol=dist_rtol) rtol = dist_rtol @test comoving_radial_dist(c,1,rtol=dist_rtol) ≈ 3303.829u"Mpc" rtol = dist_rtol @test comoving_volume(c,1,rtol=dist_rtol) ≈ 151.0571u"Gpc^3" rtol = dist_rtol @test quadgk(z -> integrand(c, z), 0, 2.5)[1] ≈ ustrip(comoving_volume(c, 2.5)) @test luminosity_dist(c,1,rtol=dist_rtol) ≈ 6607.6579u"Mpc" rtol = dist_rtol @test distmod(c,1,rtol=dist_rtol) ≈ 44.1002 rtol = dist_rtol @test age(c,0,rtol=age_rtol) ≈ 13.4694u"Gyr" rtol = age_rtol @test age(c,1,rtol=age_rtol) ≈ 5.7527u"Gyr" rtol = age_rtol @test lookback_time(c,1,rtol=age_rtol) ≈ (13.4694-5.7527)u"Gyr" rtol = age_rtol @test age(c, 1) + lookback_time(c, 1) ≈ age(c, 0) end @testset "OpenLCDM" begin c = cosmology(h=0.7, OmegaK=0.1, OmegaM=0.3, OmegaR=0) @test angular_diameter_dist(c,1,rtol=dist_rtol) ≈ 1619.9588u"Mpc" rtol = dist_rtol @test angular_diameter_dist(c,1,2,rtol=dist_rtol) ≈ 598.9118u"Mpc" rtol = dist_rtol @test angular_diameter_dist(c,pi,rtol=dist_rtol) ≈ angular_diameter_dist(c,0,pi,rtol=dist_rtol) rtol = dist_rtol @test comoving_radial_dist(c,1,rtol=dist_rtol) ≈ 3209.784u"Mpc" rtol = dist_rtol @test comoving_volume(c,1,rtol=dist_rtol) ≈ 140.0856u"Gpc^3" rtol = dist_rtol @test quadgk(z -> integrand(c, z), 0, 2.5)[1] ≈ ustrip(comoving_volume(c, 2.5)) @test luminosity_dist(c,1,rtol=dist_rtol) ≈ 6479.8352u"Mpc" rtol = dist_rtol @test distmod(c,1,rtol=dist_rtol) ≈ 44.0578 rtol = dist_rtol @test age(c,0,rtol=age_rtol) ≈ 13.064u"Gyr" rtol = age_rtol @test age(c,1,rtol=age_rtol) ≈ 5.5466u"Gyr" rtol = age_rtol @test lookback_time(c,1,rtol=age_rtol) ≈ (13.064-5.5466)u"Gyr" rtol = age_rtol @test age(c, 1) + lookback_time(c, 1) ≈ age(c, 0) end @testset "ClosedLCDM" begin c = cosmology(h=0.7, OmegaK=-0.1, OmegaM=0.3, OmegaR=0) @test angular_diameter_dist(c,1,rtol=dist_rtol) ≈ 1686.5272u"Mpc" rtol = dist_rtol @test angular_diameter_dist(c,1,2,rtol=dist_rtol) ≈ 655.6019u"Mpc" rtol = dist_rtol @test angular_diameter_dist(c,pi,rtol=dist_rtol) ≈ angular_diameter_dist(c,0,pi,rtol=dist_rtol) rtol = dist_rtol @test comoving_radial_dist(c,1,rtol=dist_rtol) ≈ 3408.937u"Mpc" rtol = dist_rtol @test comoving_volume(c,1,rtol=dist_rtol) ≈ 163.8479u"Gpc^3" rtol = dist_rtol @test quadgk(z -> integrand(c, z), 0, 2.5)[1] ≈ ustrip(comoving_volume(c, 2.5)) @test luminosity_dist(c,1,rtol=dist_rtol) ≈ 6746.1088u"Mpc" rtol = dist_rtol @test distmod(c,1,rtol=dist_rtol) ≈ 44.1453 rtol = dist_rtol @test age(c,0,rtol=age_rtol) ≈ 13.925u"Gyr" rtol = age_rtol @test age(c,1,rtol=age_rtol) ≈ 5.9868u"Gyr" rtol = age_rtol @test lookback_time(c,1,rtol=age_rtol) ≈ (13.925-5.9868)u"Gyr" rtol = age_rtol @test age(c, 1) + lookback_time(c, 1) ≈ age(c, 0) end @testset "FlatWCDM" begin c = cosmology(h=0.7, OmegaM=0.3, OmegaR=0, w0=-0.9, wa=0.1) @test angular_diameter_dist(c,1,rtol=dist_rtol) ≈ 1612.0585u"Mpc" rtol = dist_rtol @test angular_diameter_dist(c,1,2,rtol=dist_rtol) ≈ 607.6802u"Mpc" rtol = dist_rtol @test angular_diameter_dist(c,pi,rtol=dist_rtol) ≈ angular_diameter_dist(c,0,pi,rtol=dist_rtol) rtol = dist_rtol @test comoving_radial_dist(c,1,rtol=dist_rtol) ≈ 3224.1169u"Mpc" rtol = dist_rtol @test comoving_volume(c,1,rtol=dist_rtol) ≈ 140.3851u"Gpc^3" rtol = dist_rtol @test quadgk(z -> integrand(c, z), 0, 2.5)[1] ≈ ustrip(comoving_volume(c, 2.5)) @test luminosity_dist(c,1,rtol=dist_rtol) ≈ 6448.2338u"Mpc" rtol = dist_rtol @test distmod(c,1,rtol=dist_rtol) ≈ 44.0472 rtol = dist_rtol @test age(c,0,rtol=age_rtol) ≈ 13.1915u"Gyr" rtol = age_rtol @test age(c,1,rtol=age_rtol) ≈ 5.6464u"Gyr" rtol = age_rtol @test lookback_time(c,1,rtol=age_rtol) ≈ (13.1915-5.6464)u"Gyr" rtol = age_rtol @test age(c, 1) + lookback_time(c, 1) ≈ age(c, 0) end @testset "OpenWCDM" begin c = cosmology(h=0.7, OmegaK=0.1, OmegaM=0.3, OmegaR=0, w0=-0.9, wa=0.1) @test angular_diameter_dist(c,1,rtol=dist_rtol) ≈ 1588.0181u"Mpc" rtol = dist_rtol @test angular_diameter_dist(c,1,2,rtol=dist_rtol) ≈ 585.4929u"Mpc" rtol = dist_rtol @test angular_diameter_dist(c,pi,rtol=dist_rtol) ≈ angular_diameter_dist(c,0,pi,rtol=dist_rtol) rtol = dist_rtol @test comoving_radial_dist(c,rtol=dist_rtol,1) ≈ 3147.6227u"Mpc" rtol = dist_rtol @test comoving_volume(c,1,rtol=dist_rtol) ≈ 132.0466u"Gpc^3" rtol = dist_rtol @test quadgk(z -> integrand(c, z), 0, 2.5)[1] ≈ ustrip(comoving_volume(c, 2.5)) @test luminosity_dist(c,1,rtol=dist_rtol) ≈ 6352.0723u"Mpc" rtol = dist_rtol @test distmod(c,1,rtol=dist_rtol) ≈ 44.0146 rtol = dist_rtol @test age(c,0,rtol=age_rtol) ≈ 12.8488u"Gyr" rtol = age_rtol @test age(c,1,rtol=age_rtol) ≈ 5.4659u"Gyr" rtol = age_rtol @test lookback_time(c,1,rtol=age_rtol) ≈ (12.8488-5.4659)u"Gyr" rtol = age_rtol @test age(c, 1) + lookback_time(c, 1) ≈ age(c, 0) end @testset "ClosedWCDM" begin c = cosmology(h=0.7, OmegaK=-0.1, OmegaM=0.3, OmegaR=0, w0=-0.9, wa=0.1) @test angular_diameter_dist(c,1,rtol=dist_rtol) ≈ 1637.5993u"Mpc" rtol = dist_rtol @test angular_diameter_dist(c,1,2,rtol=dist_rtol) ≈ 632.5829u"Mpc" rtol = dist_rtol @test angular_diameter_dist(c,pi,rtol=dist_rtol) ≈ angular_diameter_dist(c,0,pi,rtol=dist_rtol) rtol = dist_rtol @test comoving_radial_dist(c,1,rtol=dist_rtol) ≈ 3307.9932u"Mpc" rtol = dist_rtol @test comoving_volume(c,1,rtol=dist_rtol) ≈ 149.8301u"Gpc^3" rtol = dist_rtol @test quadgk(z -> integrand(c, z), 0, 2.5)[1] ≈ ustrip(comoving_volume(c, 2.5)) @test luminosity_dist(c,1,rtol=dist_rtol) ≈ 6550.3973u"Mpc" rtol = dist_rtol @test distmod(c,1,rtol=dist_rtol) ≈ 44.0813 rtol = dist_rtol @test age(c,0,rtol=age_rtol) ≈ 13.5702u"Gyr" rtol = age_rtol @test age(c,1,rtol=age_rtol) ≈ 5.8482u"Gyr" rtol = age_rtol @test lookback_time(c,1,rtol=age_rtol) ≈ (13.5702-5.8482)u"Gyr" rtol = age_rtol @test age(c, 1) + lookback_time(c, 1) ≈ age(c, 0) end @testset "Non-Float64" begin # Test that FlatLCDM works with non-Float64 (BigFloat in this example) c = cosmology(h=0.7, OmegaM=big(0.3), OmegaR=0) @test angular_diameter_dist(c,1,rtol=dist_rtol) ≈ 1651.9145u"Mpc" rtol = dist_rtol @test angular_diameter_dist(c,1,2,rtol=dist_rtol) ≈ 625.3444u"Mpc" rtol = dist_rtol @test angular_diameter_dist(c,pi,rtol=dist_rtol) ≈ angular_diameter_dist(c,0,pi,rtol=dist_rtol) rtol = dist_rtol @test comoving_volume_element(c, big(1.41)) ≈ 3.4030879e10u"Mpc^3" rtol = dist_rtol # Test that FlatWCDM works with non-Float64 (BigFloat in this example) c = cosmology(h=big(0.7), OmegaM=0.3, OmegaR=0, w0=-0.9, wa=0.1) @test angular_diameter_dist(c,1,rtol=dist_rtol) ≈ 1612.0585u"Mpc" rtol = dist_rtol @test angular_diameter_dist(c,1,2,rtol=dist_rtol) ≈ 607.6802u"Mpc" rtol = dist_rtol @test angular_diameter_dist(c,pi,rtol=dist_rtol) ≈ angular_diameter_dist(c,0,pi,rtol=dist_rtol) rtol = dist_rtol @test comoving_volume_element(c, big(1.41)) ≈ 3.1378625e10u"Mpc^3" rtol = dist_rtol end @testset "Unit conversion" begin c = cosmology(h=0.9, OmegaM=0.5, OmegaR=0) for u in (u"m", u"pc", u"ly") @test unit(luminosity_dist(u, c, 1)) == u @test unit(angular_diameter_dist(u, c, 2)) == u end for u in (u"s", u"yr") @test unit(age(u, c, 3)) == u @test unit(lookback_time(u, c, 4)) == u end end @testset "Utilities" begin c = cosmology(h = 0.7) @test hubble_time(c, 0) ≈ Cosmology.hubble_time0(c) @test hubble_dist(c, 0) ≈ Cosmology.hubble_dist0(c) @test H(c, 0) ≈ 70u"km/s/Mpc" end
[ 3500, 10437, 29126, 198, 3500, 6208, 11, 11801, 913, 11, 11801, 913, 32, 20661, 11, 20648, 38, 42, 198, 198, 2, 3815, 422, 2638, 1378, 291, 418, 16785, 13, 1073, 13, 2724, 14, 198, 198, 17080, 62, 17034, 349, 796, 352, 68, 12, 21, 198, 496, 62, 17034, 349, 796, 362, 68, 12, 19, 198, 2, 15995, 8821, 257, 4326, 913, 2163, 561, 2421, 11801, 913, 34500, 1358, 13, 20362, 13, 220, 9170, 1262, 340, 11, 356, 198, 2, 10283, 262, 4991, 1497, 422, 262, 4132, 25192, 2163, 198, 18908, 25192, 7, 66, 11, 1976, 8, 796, 604, 14415, 9, 436, 5528, 7, 785, 5165, 62, 29048, 62, 30854, 7, 66, 11, 1976, 4008, 198, 198, 31, 9288, 2617, 366, 7414, 265, 5639, 23127, 1, 2221, 198, 220, 220, 220, 269, 796, 8615, 29126, 7, 71, 28, 15, 13, 22, 11, 19839, 44, 28, 15, 13, 18, 11, 19839, 49, 28, 15, 8, 198, 220, 220, 220, 2488, 9288, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 1467, 4349, 13, 24, 18781, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 16, 11, 17, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 48868, 13, 18, 30272, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 14415, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 15, 11, 14415, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 401, 5165, 62, 6335, 498, 62, 17080, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 513, 22572, 13, 23, 1959, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 401, 5165, 62, 29048, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 25326, 13, 2713, 4869, 84, 1, 38, 14751, 61, 18, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 15094, 70, 74, 7, 89, 4613, 4132, 25192, 7, 66, 11, 1976, 828, 657, 11, 362, 13, 20, 38381, 16, 60, 15139, 230, 334, 36311, 7, 785, 5165, 62, 29048, 7, 66, 11, 362, 13, 20, 4008, 198, 220, 220, 220, 2488, 9288, 29763, 16579, 62, 17080, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 718, 31980, 13, 2996, 3720, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 1233, 4666, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 5846, 13, 3064, 17, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 2479, 7, 66, 11, 15, 11, 17034, 349, 28, 496, 62, 17034, 349, 8, 15139, 230, 1511, 13, 42947, 19, 84, 1, 38, 2417, 1, 374, 83, 349, 796, 2479, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 2479, 7, 66, 11, 16, 11, 17034, 349, 28, 496, 62, 17034, 349, 8, 15139, 230, 642, 13, 2425, 1983, 84, 1, 38, 2417, 1, 374, 83, 349, 796, 2479, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 804, 1891, 62, 2435, 7, 66, 11, 16, 11, 17034, 349, 28, 496, 62, 17034, 349, 8, 15139, 230, 357, 1485, 13, 42947, 19, 12, 20, 13, 2425, 1983, 8, 84, 1, 38, 2417, 1, 374, 83, 349, 796, 2479, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 2479, 7, 66, 11, 352, 8, 1343, 804, 1891, 62, 2435, 7, 66, 11, 352, 8, 15139, 230, 2479, 7, 66, 11, 657, 8, 198, 437, 198, 198, 31, 9288, 2617, 366, 11505, 5639, 23127, 1, 2221, 198, 220, 220, 220, 269, 796, 8615, 29126, 7, 71, 28, 15, 13, 22, 11, 19839, 42, 28, 15, 13, 16, 11, 19839, 44, 28, 15, 13, 18, 11, 19839, 49, 28, 15, 8, 198, 220, 220, 220, 2488, 9288, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 1467, 1129, 13, 24, 39118, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 16, 11, 17, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 642, 4089, 13, 24, 16817, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 14415, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 15, 11, 14415, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 401, 5165, 62, 6335, 498, 62, 17080, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 20959, 24, 13, 37688, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 401, 5165, 62, 29048, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 12713, 13, 2919, 3980, 84, 1, 38, 14751, 61, 18, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 15094, 70, 74, 7, 89, 4613, 4132, 25192, 7, 66, 11, 1976, 828, 657, 11, 362, 13, 20, 38381, 16, 60, 15139, 230, 334, 36311, 7, 785, 5165, 62, 29048, 7, 66, 11, 362, 13, 20, 4008, 198, 220, 220, 220, 2488, 9288, 29763, 16579, 62, 17080, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 718, 31714, 13, 23, 33394, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 1233, 4666, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 5846, 13, 2713, 3695, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 2479, 7, 66, 11, 15, 11, 17034, 349, 28, 496, 62, 17034, 349, 8, 15139, 230, 1511, 13, 15, 2414, 84, 1, 38, 2417, 1, 374, 83, 349, 796, 2479, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 2479, 7, 66, 11, 16, 11, 17034, 349, 28, 496, 62, 17034, 349, 8, 15139, 230, 642, 13, 4051, 2791, 84, 1, 38, 2417, 1, 374, 83, 349, 796, 2479, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 804, 1891, 62, 2435, 7, 66, 11, 16, 11, 17034, 349, 28, 496, 62, 17034, 349, 8, 15139, 230, 357, 1485, 13, 15, 2414, 12, 20, 13, 4051, 2791, 8, 84, 1, 38, 2417, 1, 374, 83, 349, 796, 2479, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 2479, 7, 66, 11, 352, 8, 1343, 804, 1891, 62, 2435, 7, 66, 11, 352, 8, 15139, 230, 2479, 7, 66, 11, 657, 8, 198, 437, 198, 198, 31, 9288, 2617, 366, 2601, 1335, 5639, 23127, 1, 2221, 198, 220, 220, 220, 269, 796, 8615, 29126, 7, 71, 28, 15, 13, 22, 11, 19839, 42, 10779, 15, 13, 16, 11, 19839, 44, 28, 15, 13, 18, 11, 19839, 49, 28, 15, 8, 198, 220, 220, 220, 2488, 9288, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 1467, 4521, 13, 20, 29807, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 16, 11, 17, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 45021, 13, 21, 30484, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 14415, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 15, 11, 14415, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 401, 5165, 62, 6335, 498, 62, 17080, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 513, 26200, 13, 24, 2718, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 401, 5165, 62, 29048, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 26826, 13, 23, 31714, 84, 1, 38, 14751, 61, 18, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 15094, 70, 74, 7, 89, 4613, 4132, 25192, 7, 66, 11, 1976, 828, 657, 11, 362, 13, 20, 38381, 16, 60, 15139, 230, 334, 36311, 7, 785, 5165, 62, 29048, 7, 66, 11, 362, 13, 20, 4008, 198, 220, 220, 220, 2488, 9288, 29763, 16579, 62, 17080, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 8275, 3510, 13, 940, 3459, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 1233, 4666, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 5846, 13, 1415, 4310, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 2479, 7, 66, 11, 15, 11, 17034, 349, 28, 496, 62, 17034, 349, 8, 15139, 230, 1511, 13, 46351, 84, 1, 38, 2417, 1, 374, 83, 349, 796, 2479, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 2479, 7, 66, 11, 16, 11, 17034, 349, 28, 496, 62, 17034, 349, 8, 15139, 230, 642, 13, 4089, 3104, 84, 1, 38, 2417, 1, 374, 83, 349, 796, 2479, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 804, 1891, 62, 2435, 7, 66, 11, 16, 11, 17034, 349, 28, 496, 62, 17034, 349, 8, 15139, 230, 357, 1485, 13, 46351, 12, 20, 13, 4089, 3104, 8, 84, 1, 38, 2417, 1, 374, 83, 349, 796, 2479, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 2479, 7, 66, 11, 352, 8, 1343, 804, 1891, 62, 2435, 7, 66, 11, 352, 8, 15139, 230, 2479, 7, 66, 11, 657, 8, 198, 437, 198, 198, 31, 9288, 2617, 366, 7414, 265, 54, 8610, 44, 1, 2221, 198, 220, 220, 220, 269, 796, 8615, 29126, 7, 71, 28, 15, 13, 22, 11, 19839, 44, 28, 15, 13, 18, 11, 19839, 49, 28, 15, 11, 266, 15, 10779, 15, 13, 24, 11, 2082, 28, 15, 13, 16, 8, 198, 220, 220, 220, 2488, 9288, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 1467, 1065, 13, 2713, 5332, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 16, 11, 17, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 718, 2998, 13, 21, 30863, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 14415, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 15, 11, 14415, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 401, 5165, 62, 6335, 498, 62, 17080, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 3933, 1731, 13, 1157, 3388, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 401, 5165, 62, 29048, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 12713, 13, 2548, 4349, 84, 1, 38, 14751, 61, 18, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 15094, 70, 74, 7, 89, 4613, 4132, 25192, 7, 66, 11, 1976, 828, 657, 11, 362, 13, 20, 38381, 16, 60, 15139, 230, 334, 36311, 7, 785, 5165, 62, 29048, 7, 66, 11, 362, 13, 20, 4008, 198, 220, 220, 220, 2488, 9288, 29763, 16579, 62, 17080, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 718, 31115, 13, 1954, 2548, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 1233, 4666, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 5846, 13, 15, 37856, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 2479, 7, 66, 11, 15, 11, 17034, 349, 28, 496, 62, 17034, 349, 8, 15139, 230, 1511, 13, 1129, 1314, 84, 1, 38, 2417, 1, 374, 83, 349, 796, 2479, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 2479, 7, 66, 11, 16, 11, 17034, 349, 28, 496, 62, 17034, 349, 8, 15139, 230, 642, 13, 2414, 2414, 84, 1, 38, 2417, 1, 374, 83, 349, 796, 2479, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 804, 1891, 62, 2435, 7, 66, 11, 16, 11, 17034, 349, 28, 496, 62, 17034, 349, 8, 15139, 230, 357, 1485, 13, 1129, 1314, 12, 20, 13, 2414, 2414, 8, 84, 1, 38, 2417, 1, 374, 83, 349, 796, 2479, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 2479, 7, 66, 11, 352, 8, 1343, 804, 1891, 62, 2435, 7, 66, 11, 352, 8, 15139, 230, 2479, 7, 66, 11, 657, 8, 198, 437, 198, 198, 31, 9288, 2617, 366, 11505, 54, 8610, 44, 1, 2221, 198, 220, 220, 220, 269, 796, 8615, 29126, 7, 71, 28, 15, 13, 22, 11, 19839, 42, 28, 15, 13, 16, 11, 19839, 44, 28, 15, 13, 18, 11, 19839, 49, 28, 15, 11, 266, 15, 10779, 15, 13, 24, 11, 2082, 28, 15, 13, 16, 8, 198, 220, 220, 220, 2488, 9288, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 1315, 3459, 13, 486, 6659, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 16, 11, 17, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 642, 5332, 13, 2920, 1959, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 14415, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 15, 11, 14415, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 401, 5165, 62, 6335, 498, 62, 17080, 7, 66, 11, 17034, 349, 28, 17080, 62, 17034, 349, 11, 16, 8, 15139, 230, 513, 20198, 13, 21, 24403, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 401, 5165, 62, 29048, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 21761, 13, 3023, 2791, 84, 1, 38, 14751, 61, 18, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 15094, 70, 74, 7, 89, 4613, 4132, 25192, 7, 66, 11, 1976, 828, 657, 11, 362, 13, 20, 38381, 16, 60, 15139, 230, 334, 36311, 7, 785, 5165, 62, 29048, 7, 66, 11, 362, 13, 20, 4008, 198, 220, 220, 220, 2488, 9288, 29763, 16579, 62, 17080, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 718, 33394, 13, 2998, 1954, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 1233, 4666, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 5846, 13, 486, 3510, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 2479, 7, 66, 11, 15, 11, 17034, 349, 28, 496, 62, 17034, 349, 8, 15139, 230, 1105, 13, 23, 33646, 84, 1, 38, 2417, 1, 374, 83, 349, 796, 2479, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 2479, 7, 66, 11, 16, 11, 17034, 349, 28, 496, 62, 17034, 349, 8, 15139, 230, 642, 13, 19, 36445, 84, 1, 38, 2417, 1, 374, 83, 349, 796, 2479, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 804, 1891, 62, 2435, 7, 66, 11, 16, 11, 17034, 349, 28, 496, 62, 17034, 349, 8, 15139, 230, 357, 1065, 13, 23, 33646, 12, 20, 13, 19, 36445, 8, 84, 1, 38, 2417, 1, 374, 83, 349, 796, 2479, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 2479, 7, 66, 11, 352, 8, 1343, 804, 1891, 62, 2435, 7, 66, 11, 352, 8, 15139, 230, 2479, 7, 66, 11, 657, 8, 198, 437, 198, 198, 31, 9288, 2617, 366, 2601, 1335, 54, 8610, 44, 1, 2221, 198, 220, 220, 220, 269, 796, 8615, 29126, 7, 71, 28, 15, 13, 22, 11, 19839, 42, 10779, 15, 13, 16, 11, 19839, 44, 28, 15, 13, 18, 11, 19839, 49, 28, 15, 11, 266, 15, 10779, 15, 13, 24, 11, 2082, 28, 15, 13, 16, 8, 198, 220, 220, 220, 2488, 9288, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 1467, 2718, 13, 43452, 18, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 16, 11, 17, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 718, 2624, 13, 3365, 1959, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 14415, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 15, 11, 14415, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 401, 5165, 62, 6335, 498, 62, 17080, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 513, 22996, 13, 2079, 2624, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 401, 5165, 62, 29048, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 24041, 13, 5999, 486, 84, 1, 38, 14751, 61, 18, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 15094, 70, 74, 7, 89, 4613, 4132, 25192, 7, 66, 11, 1976, 828, 657, 11, 362, 13, 20, 38381, 16, 60, 15139, 230, 334, 36311, 7, 785, 5165, 62, 29048, 7, 66, 11, 362, 13, 20, 4008, 198, 220, 220, 220, 2488, 9288, 29763, 16579, 62, 17080, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 6135, 1120, 13, 2670, 4790, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 1233, 4666, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 5846, 13, 2919, 1485, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 2479, 7, 66, 11, 15, 11, 17034, 349, 28, 496, 62, 17034, 349, 8, 15139, 230, 1511, 13, 20, 36680, 84, 1, 38, 2417, 1, 374, 83, 349, 796, 2479, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 2479, 7, 66, 11, 16, 11, 17034, 349, 28, 496, 62, 17034, 349, 8, 15139, 230, 642, 13, 23, 40149, 84, 1, 38, 2417, 1, 374, 83, 349, 796, 2479, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 804, 1891, 62, 2435, 7, 66, 11, 16, 11, 17034, 349, 28, 496, 62, 17034, 349, 8, 15139, 230, 357, 1485, 13, 20, 36680, 12, 20, 13, 23, 40149, 8, 84, 1, 38, 2417, 1, 374, 83, 349, 796, 2479, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 2479, 7, 66, 11, 352, 8, 1343, 804, 1891, 62, 2435, 7, 66, 11, 352, 8, 15139, 230, 2479, 7, 66, 11, 657, 8, 198, 437, 198, 198, 31, 9288, 2617, 366, 15419, 12, 43879, 2414, 1, 2221, 198, 220, 220, 220, 1303, 6208, 326, 21939, 5639, 23127, 2499, 351, 1729, 12, 43879, 2414, 357, 12804, 43879, 287, 428, 1672, 8, 198, 220, 220, 220, 269, 796, 8615, 29126, 7, 71, 28, 15, 13, 22, 11, 19839, 44, 28, 14261, 7, 15, 13, 18, 828, 19839, 49, 28, 15, 8, 198, 220, 220, 220, 2488, 9288, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 1467, 4349, 13, 24, 18781, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 16, 11, 17, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 48868, 13, 18, 30272, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 14415, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 15, 11, 14415, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 401, 5165, 62, 29048, 62, 30854, 7, 66, 11, 1263, 7, 16, 13, 3901, 4008, 15139, 230, 513, 13, 1821, 21495, 3720, 68, 940, 84, 1, 44, 14751, 61, 18, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 1303, 6208, 326, 21939, 54, 8610, 44, 2499, 351, 1729, 12, 43879, 2414, 357, 12804, 43879, 287, 428, 1672, 8, 198, 220, 220, 220, 269, 796, 8615, 29126, 7, 71, 28, 14261, 7, 15, 13, 22, 828, 19839, 44, 28, 15, 13, 18, 11, 19839, 49, 28, 15, 11, 266, 15, 10779, 15, 13, 24, 11, 2082, 28, 15, 13, 16, 8, 198, 220, 220, 220, 2488, 9288, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 16, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 1467, 1065, 13, 2713, 5332, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 16, 11, 17, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 718, 2998, 13, 21, 30863, 84, 1, 44, 14751, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 14415, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 15139, 230, 32558, 62, 67, 13173, 62, 17080, 7, 66, 11, 15, 11, 14415, 11, 17034, 349, 28, 17080, 62, 17034, 349, 8, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 220, 220, 220, 2488, 9288, 401, 5165, 62, 29048, 62, 30854, 7, 66, 11, 1263, 7, 16, 13, 3901, 4008, 15139, 230, 513, 13, 1485, 3695, 26704, 68, 940, 84, 1, 44, 14751, 61, 18, 1, 374, 83, 349, 796, 1233, 62, 17034, 349, 198, 437, 198, 198, 31, 9288, 2617, 366, 26453, 11315, 1, 2221, 198, 220, 220, 220, 269, 796, 8615, 29126, 7, 71, 28, 15, 13, 24, 11, 19839, 44, 28, 15, 13, 20, 11, 19839, 49, 28, 15, 8, 198, 220, 220, 220, 329, 334, 287, 357, 84, 1, 76, 1600, 334, 1, 14751, 1600, 334, 1, 306, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 4326, 7, 75, 7230, 16579, 62, 17080, 7, 84, 11, 269, 11, 352, 4008, 6624, 334, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 4326, 7, 21413, 62, 67, 13173, 62, 17080, 7, 84, 11, 269, 11, 362, 4008, 6624, 334, 198, 220, 220, 220, 886, 198, 220, 220, 220, 329, 334, 287, 357, 84, 1, 82, 1600, 334, 1, 2417, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 4326, 7, 496, 7, 84, 11, 269, 11, 513, 4008, 6624, 334, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 4326, 7, 5460, 1891, 62, 2435, 7, 84, 11, 269, 11, 604, 4008, 6624, 334, 198, 220, 220, 220, 886, 198, 437, 198, 198, 31, 9288, 2617, 366, 18274, 2410, 1, 2221, 198, 220, 220, 220, 269, 796, 8615, 29126, 7, 71, 796, 657, 13, 22, 8, 198, 220, 220, 220, 2488, 9288, 12575, 903, 62, 2435, 7, 66, 11, 657, 8, 15139, 230, 10437, 29126, 13, 40140, 903, 62, 2435, 15, 7, 66, 8, 198, 220, 220, 220, 2488, 9288, 12575, 903, 62, 17080, 7, 66, 11, 657, 8, 15139, 230, 10437, 29126, 13, 40140, 903, 62, 17080, 15, 7, 66, 8, 198, 220, 220, 220, 2488, 9288, 367, 7, 66, 11, 657, 8, 15139, 230, 4317, 84, 1, 13276, 14, 82, 14, 44, 14751, 1, 198, 437, 198 ]
1.908986
4,329
# Libraries include("./get_h10_dataset.jl"); using MessyTimeSeriesOptim; using FileIO, JLD; using Random, Statistics; #= Load arguments passed through the command line =# # VAR or VMA is_var = parse(Bool, ARGS[1]); log_folder_path = ARGS[2]; #= Load benchmark grid of candidates from any run =# candidates = load("./VAR_output/err_type_2.jld")["candidates"]; #= Presample: 53 weeks (1999) -> compute weights Out-of-sample sample: from the 54th week onwards (2000 to 2020) -> run pseudo out-of-sample exercise Test sample: from the 158th week onwards (2002 to 2020) -> compute realised error =# # Download estimation and test samples df = get_h10_dataset(fred_tickers, mnemonics, transform, to_include, "1999-01-01", "2020-12-25"); # Extract relevant data presample = df[1:53, 2:end] |> JMatrix{Float64}; oos_sample = df[54:end, 2:end] |> JMatrix{Float64}; test_sample = df[158:end, 2:end] |> JMatrix{Float64}; test_dates = df[158:end, :date]; # Periods not indicated as NBER recession in the test sample nber_recessions = vcat(collect(Date(2007, 12, 07):Week(1):Date(2009, 05, 29)), Date(2020, 02, 07):Week(1):Date(2020, 03, 27)); test_periods_excl_recessions = [findfirst(test_dates .== x) for x in setdiff(test_dates, nber_recessions)]; # Remove NaNs nan_to_missing!(presample); nan_to_missing!(oos_sample); nan_to_missing!(test_sample); # Transpose data presample = permutedims(presample); oos_sample = permutedims(oos_sample); test_sample = permutedims(test_sample); # Compute benchmark weights weights = 1 ./ (std_skipmissing(presample).^2); #= Out-of-sample exercise =# # Validation settings model_kwargs = (tol=1e-3, check_quantile=true, verb=false); # Dimensions t0 = 158-54; n, T = size(oos_sample); grid_length = size(candidates, 2); # One-step ahead forecast output weighted_errors = zeros(size(candidates,2)); weighted_errors_excl_recessions = zeros(size(candidates,2)); forecast_per_series = Array{FloatMatrix,1}(undef, size(candidates,2)); # Setup data for estimation and forecast estimation_sample = @view oos_sample[:, 1:t0]; estimation_sample_mean = mean_skipmissing(estimation_sample); estimation_sample_std = std_skipmissing(estimation_sample); zscored_oos_sample = (oos_sample .- estimation_sample_mean) ./ estimation_sample_std; # Loop over each candidate vector of hyperparameters for i in axes(candidates, 2) @info("Iteration $(i) out of $(grid_length)") # Current candidate vector of hyperparameters p_float, λ, α, β = candidates[:,i]; p = Int64(p_float); # Select appropriate EstimSettings if is_var estim = VARSettings(zscored_oos_sample[:, 1:t0], p, λ, α, β; model_kwargs...); else estim = VMASettings(zscored_oos_sample[:, 1:t0], p, λ, α, β; model_kwargs...); end # Estimate model sspace = ecm(estim, output_sspace_data=zscored_oos_sample); # Run Kalman filter status = kfilter_full_sample(sspace); # Forecast X_prior = mapreduce(Xt -> sspace.B*Xt, hcat, status.history_X_prior); forecast_per_series[i] = (X_prior[:, t0+1:end] .* estimation_sample_std) .+ estimation_sample_mean; weighted_se = weights .* (test_sample .- forecast_per_series[i]).^2; weighted_errors[i] = MessyTimeSeriesOptim.compute_loss(weighted_se)[1]; weighted_errors_excl_recessions[i] = MessyTimeSeriesOptim.compute_loss(weighted_se[:, test_periods_excl_recessions])[1]; end # Save output to JLD save("$(log_folder_path)/realised_error.jld", Dict("candidates" => candidates, "weighted_errors" => weighted_errors, "weighted_errors_excl_recessions" => weighted_errors_excl_recessions, "test_periods_excl_recessions" => test_periods_excl_recessions, "forecast_per_series" => forecast_per_series));
[ 2, 46267, 198, 17256, 7, 1911, 14, 1136, 62, 71, 940, 62, 19608, 292, 316, 13, 20362, 15341, 198, 3500, 10626, 88, 7575, 27996, 27871, 320, 26, 198, 3500, 9220, 9399, 11, 449, 11163, 26, 198, 3500, 14534, 11, 14370, 26, 198, 198, 2, 28, 198, 8912, 7159, 3804, 832, 262, 3141, 1627, 198, 46249, 198, 198, 2, 569, 1503, 393, 569, 5673, 198, 271, 62, 7785, 796, 21136, 7, 33, 970, 11, 5923, 14313, 58, 16, 36563, 198, 6404, 62, 43551, 62, 6978, 796, 5923, 14313, 58, 17, 11208, 198, 198, 2, 28, 220, 198, 8912, 18335, 10706, 286, 5871, 422, 597, 1057, 198, 46249, 198, 198, 46188, 37051, 796, 3440, 7, 1911, 14, 53, 1503, 62, 22915, 14, 8056, 62, 4906, 62, 17, 13, 73, 335, 4943, 14692, 46188, 37051, 8973, 26, 198, 198, 2, 28, 198, 25460, 1403, 25, 7192, 2745, 357, 18946, 8, 4613, 24061, 19590, 198, 7975, 12, 1659, 12, 39873, 6291, 25, 422, 262, 7175, 400, 1285, 31719, 357, 11024, 284, 12131, 8, 4613, 1057, 24543, 503, 12, 1659, 12, 39873, 5517, 220, 198, 14402, 6291, 25, 422, 262, 24063, 400, 1285, 31719, 357, 16942, 284, 12131, 8, 4613, 24061, 19169, 4049, 198, 46249, 198, 198, 2, 10472, 31850, 290, 1332, 8405, 198, 7568, 796, 651, 62, 71, 940, 62, 19608, 292, 316, 7, 39193, 62, 83, 21630, 11, 285, 77, 7966, 873, 11, 6121, 11, 284, 62, 17256, 11, 366, 18946, 12, 486, 12, 486, 1600, 366, 42334, 12, 1065, 12, 1495, 15341, 198, 198, 2, 29677, 5981, 1366, 198, 18302, 1403, 796, 47764, 58, 16, 25, 4310, 11, 362, 25, 437, 60, 930, 29, 449, 46912, 90, 43879, 2414, 19629, 198, 16426, 62, 39873, 796, 47764, 58, 4051, 25, 437, 11, 362, 25, 437, 60, 930, 29, 449, 46912, 90, 43879, 2414, 19629, 198, 9288, 62, 39873, 796, 47764, 58, 21273, 25, 437, 11, 362, 25, 437, 60, 930, 29, 449, 46912, 90, 43879, 2414, 19629, 198, 9288, 62, 19581, 796, 47764, 58, 21273, 25, 437, 11, 1058, 4475, 11208, 198, 198, 2, 18581, 82, 407, 8203, 355, 399, 13246, 16457, 287, 262, 1332, 6291, 198, 77, 527, 62, 260, 919, 507, 796, 410, 9246, 7, 33327, 7, 10430, 7, 12726, 11, 1105, 11, 8753, 2599, 20916, 7, 16, 2599, 10430, 7, 10531, 11, 8870, 11, 2808, 36911, 7536, 7, 42334, 11, 7816, 11, 8753, 2599, 20916, 7, 16, 2599, 10430, 7, 42334, 11, 7643, 11, 2681, 18125, 198, 9288, 62, 41007, 82, 62, 1069, 565, 62, 260, 919, 507, 796, 685, 19796, 11085, 7, 9288, 62, 19581, 764, 855, 2124, 8, 329, 2124, 287, 900, 26069, 7, 9288, 62, 19581, 11, 299, 527, 62, 260, 919, 507, 8, 11208, 198, 198, 2, 17220, 11013, 47503, 198, 12647, 62, 1462, 62, 45688, 0, 7, 18302, 1403, 1776, 198, 12647, 62, 1462, 62, 45688, 0, 7, 16426, 62, 39873, 1776, 198, 12647, 62, 1462, 62, 45688, 0, 7, 9288, 62, 39873, 1776, 198, 198, 2, 3602, 3455, 1366, 198, 18302, 1403, 796, 9943, 7241, 12078, 7, 18302, 1403, 1776, 198, 16426, 62, 39873, 796, 9943, 7241, 12078, 7, 16426, 62, 39873, 1776, 198, 9288, 62, 39873, 796, 9943, 7241, 12078, 7, 9288, 62, 39873, 1776, 198, 198, 2, 3082, 1133, 18335, 19590, 198, 43775, 796, 352, 24457, 357, 19282, 62, 48267, 45688, 7, 18302, 1403, 737, 61, 17, 1776, 198, 198, 2, 28, 198, 7975, 12, 1659, 12, 39873, 5517, 198, 46249, 198, 198, 2, 3254, 24765, 6460, 198, 19849, 62, 46265, 22046, 796, 357, 83, 349, 28, 16, 68, 12, 18, 11, 2198, 62, 40972, 576, 28, 7942, 11, 15942, 28, 9562, 1776, 198, 198, 2, 41265, 198, 83, 15, 796, 24063, 12, 4051, 26, 198, 77, 11, 309, 796, 2546, 7, 16426, 62, 39873, 1776, 198, 25928, 62, 13664, 796, 2546, 7, 46188, 37051, 11, 362, 1776, 198, 198, 2, 1881, 12, 9662, 4058, 11092, 5072, 198, 6551, 276, 62, 48277, 796, 1976, 27498, 7, 7857, 7, 46188, 37051, 11, 17, 18125, 198, 6551, 276, 62, 48277, 62, 1069, 565, 62, 260, 919, 507, 796, 1976, 27498, 7, 7857, 7, 46188, 37051, 11, 17, 18125, 198, 754, 2701, 62, 525, 62, 25076, 796, 15690, 90, 43879, 46912, 11, 16, 92, 7, 917, 891, 11, 2546, 7, 46188, 37051, 11, 17, 18125, 198, 198, 2, 31122, 1366, 329, 31850, 290, 11092, 198, 395, 18991, 62, 39873, 796, 2488, 1177, 267, 418, 62, 39873, 58, 45299, 352, 25, 83, 15, 11208, 198, 395, 18991, 62, 39873, 62, 32604, 796, 1612, 62, 48267, 45688, 7, 395, 18991, 62, 39873, 1776, 198, 395, 18991, 62, 39873, 62, 19282, 796, 14367, 62, 48267, 45688, 7, 395, 18991, 62, 39873, 1776, 198, 89, 1416, 1850, 62, 16426, 62, 39873, 796, 357, 16426, 62, 39873, 764, 12, 31850, 62, 39873, 62, 32604, 8, 24457, 31850, 62, 39873, 62, 19282, 26, 198, 198, 2, 26304, 625, 1123, 4540, 15879, 286, 8718, 17143, 7307, 198, 1640, 1312, 287, 34197, 7, 46188, 37051, 11, 362, 8, 628, 220, 220, 220, 2488, 10951, 7203, 29993, 341, 29568, 72, 8, 503, 286, 29568, 25928, 62, 13664, 8, 4943, 628, 220, 220, 220, 1303, 9236, 4540, 15879, 286, 8718, 17143, 7307, 198, 220, 220, 220, 279, 62, 22468, 11, 7377, 119, 11, 26367, 11, 27169, 796, 5871, 58, 45299, 72, 11208, 198, 220, 220, 220, 279, 796, 2558, 2414, 7, 79, 62, 22468, 1776, 628, 220, 220, 220, 1303, 9683, 5035, 10062, 320, 26232, 198, 220, 220, 220, 611, 318, 62, 7785, 198, 220, 220, 220, 220, 220, 220, 220, 3959, 796, 569, 1503, 26232, 7, 89, 1416, 1850, 62, 16426, 62, 39873, 58, 45299, 352, 25, 83, 15, 4357, 279, 11, 7377, 119, 11, 26367, 11, 27169, 26, 2746, 62, 46265, 22046, 986, 1776, 198, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 3959, 796, 16990, 1921, 12374, 7, 89, 1416, 1850, 62, 16426, 62, 39873, 58, 45299, 352, 25, 83, 15, 4357, 279, 11, 7377, 119, 11, 26367, 11, 27169, 26, 2746, 62, 46265, 22046, 986, 1776, 198, 220, 220, 220, 886, 628, 220, 220, 220, 1303, 10062, 1920, 2746, 198, 220, 220, 220, 264, 13200, 796, 9940, 76, 7, 395, 320, 11, 5072, 62, 824, 10223, 62, 7890, 28, 89, 1416, 1850, 62, 16426, 62, 39873, 1776, 628, 220, 220, 220, 1303, 5660, 12612, 805, 8106, 198, 220, 220, 220, 3722, 796, 479, 24455, 62, 12853, 62, 39873, 7, 824, 10223, 1776, 628, 220, 220, 220, 1303, 4558, 2701, 198, 220, 220, 220, 1395, 62, 3448, 273, 796, 3975, 445, 7234, 7, 55, 83, 4613, 264, 13200, 13, 33, 9, 55, 83, 11, 289, 9246, 11, 3722, 13, 23569, 62, 55, 62, 3448, 273, 1776, 198, 220, 220, 220, 11092, 62, 525, 62, 25076, 58, 72, 60, 796, 357, 55, 62, 3448, 273, 58, 45299, 256, 15, 10, 16, 25, 437, 60, 764, 9, 31850, 62, 39873, 62, 19282, 8, 764, 10, 31850, 62, 39873, 62, 32604, 26, 198, 220, 220, 220, 26356, 62, 325, 796, 19590, 764, 9, 357, 9288, 62, 39873, 764, 12, 11092, 62, 525, 62, 25076, 58, 72, 35944, 61, 17, 26, 198, 220, 220, 220, 26356, 62, 48277, 58, 72, 60, 796, 10626, 88, 7575, 27996, 27871, 320, 13, 5589, 1133, 62, 22462, 7, 6551, 276, 62, 325, 38381, 16, 11208, 198, 220, 220, 220, 26356, 62, 48277, 62, 1069, 565, 62, 260, 919, 507, 58, 72, 60, 796, 10626, 88, 7575, 27996, 27871, 320, 13, 5589, 1133, 62, 22462, 7, 6551, 276, 62, 325, 58, 45299, 1332, 62, 41007, 82, 62, 1069, 565, 62, 260, 919, 507, 12962, 58, 16, 11208, 198, 437, 198, 198, 2, 12793, 5072, 284, 449, 11163, 198, 21928, 7203, 3, 7, 6404, 62, 43551, 62, 6978, 20679, 5305, 1417, 62, 18224, 13, 73, 335, 1600, 360, 713, 7203, 46188, 37051, 1, 5218, 5871, 11, 366, 6551, 276, 62, 48277, 1, 5218, 26356, 62, 48277, 11, 366, 6551, 276, 62, 48277, 62, 1069, 565, 62, 260, 919, 507, 1, 5218, 26356, 62, 48277, 62, 1069, 565, 62, 260, 919, 507, 11, 366, 9288, 62, 41007, 82, 62, 1069, 565, 62, 260, 919, 507, 1, 5218, 1332, 62, 41007, 82, 62, 1069, 565, 62, 260, 919, 507, 11, 366, 754, 2701, 62, 525, 62, 25076, 1, 5218, 11092, 62, 525, 62, 25076, 18125 ]
2.696
1,375
module KhepriRadiance using KhepriBase # functions that need specialization include(khepribase_interface_file()) include("Radiance.jl") function __init__() set_material(radiance, material_basic, radiance_material_neutral) set_material(radiance, material_metal, radiance_generic_metal) set_material(radiance, material_glass, radiance_generic_glass_80) set_material(radiance, material_wood, radiance_light_wood) set_material(radiance, material_concrete, radiance_outside_facade_30) set_material(radiance, material_plaster, radiance_generic_interior_wall_70) add_current_backend(radiance) end end
[ 21412, 48888, 3448, 15546, 3610, 198, 3500, 48888, 3448, 14881, 198, 198, 2, 5499, 326, 761, 43135, 198, 17256, 7, 74, 258, 79, 822, 589, 62, 39994, 62, 7753, 28955, 198, 17256, 7203, 15546, 3610, 13, 20362, 4943, 198, 198, 8818, 11593, 15003, 834, 3419, 198, 220, 900, 62, 33665, 7, 6335, 3610, 11, 2587, 62, 35487, 11, 2511, 3610, 62, 33665, 62, 29797, 8, 198, 220, 900, 62, 33665, 7, 6335, 3610, 11, 2587, 62, 28469, 11, 2511, 3610, 62, 41357, 62, 28469, 8, 198, 220, 900, 62, 33665, 7, 6335, 3610, 11, 2587, 62, 20721, 11, 2511, 3610, 62, 41357, 62, 20721, 62, 1795, 8, 198, 220, 900, 62, 33665, 7, 6335, 3610, 11, 2587, 62, 3822, 11, 2511, 3610, 62, 2971, 62, 3822, 8, 198, 220, 900, 62, 33665, 7, 6335, 3610, 11, 2587, 62, 1102, 38669, 11, 2511, 3610, 62, 43435, 62, 38942, 671, 62, 1270, 8, 198, 220, 900, 62, 33665, 7, 6335, 3610, 11, 2587, 62, 489, 1603, 11, 2511, 3610, 62, 41357, 62, 3849, 1504, 62, 11930, 62, 2154, 8, 628, 220, 751, 62, 14421, 62, 1891, 437, 7, 6335, 3610, 8, 198, 437, 198, 437, 198 ]
3.149485
194
@system VaporPressure begin # Campbell and Norman (1998), p 41 Saturation vapor pressure in kPa a => 0.611 ~ preserve(u"kPa", parameter) b => 17.502 ~ preserve(parameter) c => 240.97 ~ preserve(parameter) # °C es(a, b, c; T(u"°C")): saturation => (t = Cropbox.deunitfy(T); a*exp((b*t)/(c+t))) ~ call(u"kPa") ea(es; T(u"°C"), RH(u"percent")): ambient => es(T) * RH ~ call(u"kPa") D(es; T(u"°C"), RH(u"percent")): deficit => es(T) * (1 - RH) ~ call(u"kPa") RH(es; T(u"°C"), VPD(u"kPa")): relative_humidity => 1 - VPD / es(T) ~ call(u"NoUnits") # slope of the sat vapor pressure curve: first order derivative of Es with respect to T Δ(es, b, c; T(u"°C")): saturation_slope_delta => (e = es(T); t = Cropbox.deunitfy(T); e*(b*c)/(c+t)^2 / u"K") ~ call(u"kPa/K") s(Δ; T(u"°C"), P(u"kPa")): saturation_slope => Δ(T) / P ~ call(u"K^-1") end
[ 31, 10057, 43382, 13800, 495, 2221, 198, 220, 220, 220, 1303, 14327, 290, 19636, 357, 21113, 828, 279, 6073, 311, 36921, 20199, 3833, 287, 479, 28875, 198, 220, 220, 220, 257, 5218, 657, 13, 21, 1157, 5299, 12201, 7, 84, 1, 74, 28875, 1600, 11507, 8, 198, 220, 220, 220, 275, 5218, 1596, 13, 35126, 5299, 12201, 7, 17143, 2357, 8, 198, 220, 220, 220, 269, 5218, 14956, 13, 5607, 5299, 12201, 7, 17143, 2357, 8, 1303, 22074, 34, 628, 220, 220, 220, 1658, 7, 64, 11, 275, 11, 269, 26, 309, 7, 84, 1, 7200, 34, 4943, 2599, 36275, 5218, 357, 83, 796, 327, 1773, 3524, 13, 2934, 20850, 24928, 7, 51, 1776, 257, 9, 11201, 19510, 65, 9, 83, 20679, 7, 66, 10, 83, 22305, 5299, 869, 7, 84, 1, 74, 28875, 4943, 198, 220, 220, 220, 304, 64, 7, 274, 26, 309, 7, 84, 1, 7200, 34, 12340, 35662, 7, 84, 1, 25067, 4943, 2599, 25237, 5218, 1658, 7, 51, 8, 1635, 35662, 5299, 869, 7, 84, 1, 74, 28875, 4943, 198, 220, 220, 220, 360, 7, 274, 26, 309, 7, 84, 1, 7200, 34, 12340, 35662, 7, 84, 1, 25067, 4943, 2599, 11807, 5218, 1658, 7, 51, 8, 1635, 357, 16, 532, 35662, 8, 5299, 869, 7, 84, 1, 74, 28875, 4943, 198, 220, 220, 220, 35662, 7, 274, 26, 309, 7, 84, 1, 7200, 34, 12340, 569, 5760, 7, 84, 1, 74, 28875, 4943, 2599, 3585, 62, 17047, 17995, 5218, 352, 532, 569, 5760, 1220, 1658, 7, 51, 8, 5299, 869, 7, 84, 1, 2949, 3118, 896, 4943, 628, 220, 220, 220, 1303, 22638, 286, 262, 3332, 20199, 3833, 12133, 25, 717, 1502, 27255, 286, 8678, 351, 2461, 284, 309, 198, 220, 220, 220, 37455, 7, 274, 11, 275, 11, 269, 26, 309, 7, 84, 1, 7200, 34, 4943, 2599, 36275, 62, 6649, 3008, 62, 67, 12514, 5218, 357, 68, 796, 1658, 7, 51, 1776, 256, 796, 327, 1773, 3524, 13, 2934, 20850, 24928, 7, 51, 1776, 304, 9, 7, 65, 9, 66, 20679, 7, 66, 10, 83, 8, 61, 17, 1220, 334, 1, 42, 4943, 5299, 869, 7, 84, 1, 74, 28875, 14, 42, 4943, 198, 220, 220, 220, 264, 7, 138, 242, 26, 309, 7, 84, 1, 7200, 34, 12340, 350, 7, 84, 1, 74, 28875, 4943, 2599, 36275, 62, 6649, 3008, 5218, 37455, 7, 51, 8, 1220, 350, 5299, 869, 7, 84, 1, 42, 61, 12, 16, 4943, 198, 437, 198 ]
2.149144
409
# __precompile__() module LightDarkPOMDPs importall POMDPs using StaticArrays using Plots using POMDPToolbox using Parameters # for @with_kw using ParticleFilters # for AbstractParticleBelief export AbstractLD2, LightDark2D, LightDark2DTarget, LightDark2DKalman, SymmetricNormal2, Vec2 include("lightdark2d.jl") include("lightdark2dtarget.jl") include("lightdark2dfilter.jl") include("lightdark2dvis.jl") end # module
[ 2, 11593, 3866, 5589, 576, 834, 3419, 198, 198, 21412, 4401, 17367, 47, 2662, 6322, 82, 198, 198, 11748, 439, 350, 2662, 6322, 82, 198, 198, 3500, 36125, 3163, 20477, 198, 3500, 1345, 1747, 198, 3500, 350, 2662, 6322, 25391, 3524, 198, 3500, 40117, 1303, 329, 2488, 4480, 62, 46265, 198, 3500, 2142, 1548, 11928, 1010, 1303, 329, 27741, 7841, 1548, 12193, 2086, 198, 198, 39344, 220, 198, 220, 220, 220, 27741, 11163, 17, 11, 198, 220, 220, 220, 4401, 17367, 17, 35, 11, 198, 220, 220, 220, 4401, 17367, 17, 35, 21745, 11, 198, 220, 220, 220, 4401, 17367, 17, 35, 41428, 805, 11, 198, 220, 220, 220, 1632, 3020, 19482, 26447, 17, 11, 198, 220, 220, 220, 38692, 17, 198, 198, 17256, 7203, 2971, 21953, 17, 67, 13, 20362, 4943, 198, 17256, 7203, 2971, 21953, 17, 67, 16793, 13, 20362, 4943, 198, 17256, 7203, 2971, 21953, 17, 7568, 346, 353, 13, 20362, 4943, 198, 17256, 7203, 2971, 21953, 17, 67, 4703, 13, 20362, 4943, 198, 198, 437, 1303, 8265, 198 ]
2.610465
172
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Desription # ============================================================================== # # Tests related to conversion from Euler angles to quaternion. # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # File: ./src/conversions/angle_to_quat.jl # ======================================== # Functions: angle_to_quat # ------------------------ @testset "Euler angles => Quaternion (Float64)" begin T = Float64 for rot_seq in valid_rot_seqs # Sample Euler angles. ea = EulerAngles(_rand_ang(T), _rand_ang(T), _rand_ang(T), rot_seq) # Convert to quaternion. q = angle_to_quat(ea) @test eltype(q) === T # Create the quaternion by composing the rotations. rot_seq_str = string(rot_seq) q₁ = if rot_seq_str[1] == 'X' Quaternion(cos(ea.a1 / 2), T[1, 0, 0] * sin(ea.a1 / 2)) elseif rot_seq_str[1] == 'Y' Quaternion(cos(ea.a1 / 2), T[0, 1, 0] * sin(ea.a1 / 2)) elseif rot_seq_str[1] == 'Z' Quaternion(cos(ea.a1 / 2), T[0, 0, 1] * sin(ea.a1 / 2)) end q₂ = if rot_seq_str[2] == 'X' Quaternion(cos(ea.a2 / 2), T[1, 0, 0] * sin(ea.a2 / 2)) elseif rot_seq_str[2] == 'Y' Quaternion(cos(ea.a2 / 2), T[0, 1, 0] * sin(ea.a2 / 2)) elseif rot_seq_str[2] == 'Z' Quaternion(cos(ea.a2 / 2), T[0, 0, 1] * sin(ea.a2 / 2)) end q₃ = if rot_seq_str[3] == 'X' Quaternion(cos(ea.a3 / 2), T[1, 0, 0] * sin(ea.a3 / 2)) elseif rot_seq_str[3] == 'Y' Quaternion(cos(ea.a3 / 2), T[0, 1, 0] * sin(ea.a3 / 2)) elseif rot_seq_str[3] == 'Z' Quaternion(cos(ea.a3 / 2), T[0, 0, 1] * sin(ea.a3 / 2)) end qe = q₁ * q₂ * q₃ # Make sure q0 is positive. (qe.q0 < 0) && (qe = -qe) # Compare. @test q ≈ qe end end @testset "Euler angles => Quaternion (Float32)" begin T = Float32 for rot_seq in valid_rot_seqs # Sample Euler angles. ea = EulerAngles(_rand_ang(T), _rand_ang(T), _rand_ang(T), rot_seq) # Convert to quaternion. q = angle_to_quat(ea) @test eltype(q) === T # Create the quaternion by composing the rotations. rot_seq_str = string(rot_seq) q₁ = if rot_seq_str[1] == 'X' Quaternion(cos(ea.a1 / 2), T[1, 0, 0] * sin(ea.a1 / 2)) elseif rot_seq_str[1] == 'Y' Quaternion(cos(ea.a1 / 2), T[0, 1, 0] * sin(ea.a1 / 2)) elseif rot_seq_str[1] == 'Z' Quaternion(cos(ea.a1 / 2), T[0, 0, 1] * sin(ea.a1 / 2)) end q₂ = if rot_seq_str[2] == 'X' Quaternion(cos(ea.a2 / 2), T[1, 0, 0] * sin(ea.a2 / 2)) elseif rot_seq_str[2] == 'Y' Quaternion(cos(ea.a2 / 2), T[0, 1, 0] * sin(ea.a2 / 2)) elseif rot_seq_str[2] == 'Z' Quaternion(cos(ea.a2 / 2), T[0, 0, 1] * sin(ea.a2 / 2)) end q₃ = if rot_seq_str[3] == 'X' Quaternion(cos(ea.a3 / 2), T[1, 0, 0] * sin(ea.a3 / 2)) elseif rot_seq_str[3] == 'Y' Quaternion(cos(ea.a3 / 2), T[0, 1, 0] * sin(ea.a3 / 2)) elseif rot_seq_str[3] == 'Z' Quaternion(cos(ea.a3 / 2), T[0, 0, 1] * sin(ea.a3 / 2)) end qe = q₁ * q₂ * q₃ # Make sure q0 is positive. (qe.q0 < 0) && (qe = -qe) # Compare. @test q ≈ qe end end @testset "Euler angles => Quaternion (Errors)" begin @test_throws ArgumentError angle_to_quat(1, 2, 3, :ZZY) end # Functions: smallangle_to_quat # ----------------------------- @testset "Small Euler angles => Quaternion (Float64)" begin T = Float64 # Sample three small angles. θx = _rand_ang(T) * T(0.001) θy = _rand_ang(T) * T(0.001) θz = _rand_ang(T) * T(0.001) # Create the quaternion. q = smallangle_to_quat(θx, θy, θz) # Expected result. qe = Quaternion(1, θx / 2, θy / 2, θz / 2) qe = qe / norm(qe) @test qe ≈ q end @testset "Small Euler angles => Quaternion (Float32)" begin T = Float32 # Sample three small angles. θx = _rand_ang(T) * T(0.001) θy = _rand_ang(T) * T(0.001) θz = _rand_ang(T) * T(0.001) # Create the quaternion. q = smallangle_to_quat(θx, θy, θz) # Expected result. qe = Quaternion(1, θx / 2, θy / 2, θz / 2) qe = qe / norm(qe) @test qe ≈ q end
[ 2, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 198, 2, 198, 2, 2935, 2918, 198, 2, 38093, 25609, 28, 198, 2, 198, 2, 220, 220, 30307, 3519, 284, 11315, 422, 412, 18173, 18333, 284, 627, 9205, 295, 13, 198, 2, 198, 2, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 198, 198, 2, 9220, 25, 24457, 10677, 14, 1102, 47178, 14, 9248, 62, 1462, 62, 421, 265, 13, 20362, 198, 2, 46111, 1421, 18604, 198, 198, 2, 40480, 25, 9848, 62, 1462, 62, 421, 265, 198, 2, 220, 22369, 198, 198, 31, 9288, 2617, 366, 36, 18173, 18333, 5218, 2264, 9205, 295, 357, 43879, 2414, 16725, 2221, 198, 220, 220, 220, 309, 796, 48436, 2414, 628, 220, 220, 220, 329, 5724, 62, 41068, 287, 4938, 62, 10599, 62, 41068, 82, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 27565, 412, 18173, 18333, 13, 198, 220, 220, 220, 220, 220, 220, 220, 304, 64, 796, 412, 18173, 13450, 829, 28264, 25192, 62, 648, 7, 51, 828, 4808, 25192, 62, 648, 7, 51, 828, 4808, 25192, 62, 648, 7, 51, 828, 5724, 62, 41068, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 38240, 284, 627, 9205, 295, 13, 198, 220, 220, 220, 220, 220, 220, 220, 10662, 796, 9848, 62, 1462, 62, 421, 265, 7, 18213, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 1288, 4906, 7, 80, 8, 24844, 309, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 13610, 262, 627, 9205, 295, 416, 49760, 262, 5724, 602, 13, 198, 220, 220, 220, 220, 220, 220, 220, 5724, 62, 41068, 62, 2536, 796, 4731, 7, 10599, 62, 41068, 8, 628, 220, 220, 220, 220, 220, 220, 220, 10662, 158, 224, 223, 796, 611, 5724, 62, 41068, 62, 2536, 58, 16, 60, 6624, 705, 55, 6, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2264, 9205, 295, 7, 6966, 7, 18213, 13, 64, 16, 1220, 362, 828, 309, 58, 16, 11, 657, 11, 657, 60, 1635, 7813, 7, 18213, 13, 64, 16, 1220, 362, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 5724, 62, 41068, 62, 2536, 58, 16, 60, 6624, 705, 56, 6, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2264, 9205, 295, 7, 6966, 7, 18213, 13, 64, 16, 1220, 362, 828, 309, 58, 15, 11, 352, 11, 657, 60, 1635, 7813, 7, 18213, 13, 64, 16, 1220, 362, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 5724, 62, 41068, 62, 2536, 58, 16, 60, 6624, 705, 57, 6, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2264, 9205, 295, 7, 6966, 7, 18213, 13, 64, 16, 1220, 362, 828, 309, 58, 15, 11, 657, 11, 352, 60, 1635, 7813, 7, 18213, 13, 64, 16, 1220, 362, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 886, 628, 220, 220, 220, 220, 220, 220, 220, 10662, 158, 224, 224, 796, 611, 5724, 62, 41068, 62, 2536, 58, 17, 60, 6624, 705, 55, 6, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2264, 9205, 295, 7, 6966, 7, 18213, 13, 64, 17, 1220, 362, 828, 309, 58, 16, 11, 657, 11, 657, 60, 1635, 7813, 7, 18213, 13, 64, 17, 1220, 362, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 5724, 62, 41068, 62, 2536, 58, 17, 60, 6624, 705, 56, 6, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2264, 9205, 295, 7, 6966, 7, 18213, 13, 64, 17, 1220, 362, 828, 309, 58, 15, 11, 352, 11, 657, 60, 1635, 7813, 7, 18213, 13, 64, 17, 1220, 362, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 5724, 62, 41068, 62, 2536, 58, 17, 60, 6624, 705, 57, 6, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2264, 9205, 295, 7, 6966, 7, 18213, 13, 64, 17, 1220, 362, 828, 309, 58, 15, 11, 657, 11, 352, 60, 1635, 7813, 7, 18213, 13, 64, 17, 1220, 362, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 886, 628, 220, 220, 220, 220, 220, 220, 220, 10662, 158, 224, 225, 796, 611, 5724, 62, 41068, 62, 2536, 58, 18, 60, 6624, 705, 55, 6, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2264, 9205, 295, 7, 6966, 7, 18213, 13, 64, 18, 1220, 362, 828, 309, 58, 16, 11, 657, 11, 657, 60, 1635, 7813, 7, 18213, 13, 64, 18, 1220, 362, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 5724, 62, 41068, 62, 2536, 58, 18, 60, 6624, 705, 56, 6, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2264, 9205, 295, 7, 6966, 7, 18213, 13, 64, 18, 1220, 362, 828, 309, 58, 15, 11, 352, 11, 657, 60, 1635, 7813, 7, 18213, 13, 64, 18, 1220, 362, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 5724, 62, 41068, 62, 2536, 58, 18, 60, 6624, 705, 57, 6, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2264, 9205, 295, 7, 6966, 7, 18213, 13, 64, 18, 1220, 362, 828, 309, 58, 15, 11, 657, 11, 352, 60, 1635, 7813, 7, 18213, 13, 64, 18, 1220, 362, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 10662, 68, 796, 10662, 158, 224, 223, 1635, 10662, 158, 224, 224, 1635, 10662, 158, 224, 225, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 6889, 1654, 10662, 15, 318, 3967, 13, 198, 220, 220, 220, 220, 220, 220, 220, 357, 80, 68, 13, 80, 15, 1279, 657, 8, 11405, 357, 80, 68, 796, 532, 80, 68, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 27814, 13, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 10662, 15139, 230, 10662, 68, 198, 220, 220, 220, 886, 198, 437, 198, 198, 31, 9288, 2617, 366, 36, 18173, 18333, 5218, 2264, 9205, 295, 357, 43879, 2624, 16725, 2221, 198, 220, 220, 220, 309, 796, 48436, 2624, 628, 220, 220, 220, 329, 5724, 62, 41068, 287, 4938, 62, 10599, 62, 41068, 82, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 27565, 412, 18173, 18333, 13, 198, 220, 220, 220, 220, 220, 220, 220, 304, 64, 796, 412, 18173, 13450, 829, 28264, 25192, 62, 648, 7, 51, 828, 4808, 25192, 62, 648, 7, 51, 828, 4808, 25192, 62, 648, 7, 51, 828, 5724, 62, 41068, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 38240, 284, 627, 9205, 295, 13, 198, 220, 220, 220, 220, 220, 220, 220, 10662, 796, 9848, 62, 1462, 62, 421, 265, 7, 18213, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 1288, 4906, 7, 80, 8, 24844, 309, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 13610, 262, 627, 9205, 295, 416, 49760, 262, 5724, 602, 13, 198, 220, 220, 220, 220, 220, 220, 220, 5724, 62, 41068, 62, 2536, 796, 4731, 7, 10599, 62, 41068, 8, 628, 220, 220, 220, 220, 220, 220, 220, 10662, 158, 224, 223, 796, 611, 5724, 62, 41068, 62, 2536, 58, 16, 60, 6624, 705, 55, 6, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2264, 9205, 295, 7, 6966, 7, 18213, 13, 64, 16, 1220, 362, 828, 309, 58, 16, 11, 657, 11, 657, 60, 1635, 7813, 7, 18213, 13, 64, 16, 1220, 362, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 5724, 62, 41068, 62, 2536, 58, 16, 60, 6624, 705, 56, 6, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2264, 9205, 295, 7, 6966, 7, 18213, 13, 64, 16, 1220, 362, 828, 309, 58, 15, 11, 352, 11, 657, 60, 1635, 7813, 7, 18213, 13, 64, 16, 1220, 362, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 5724, 62, 41068, 62, 2536, 58, 16, 60, 6624, 705, 57, 6, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2264, 9205, 295, 7, 6966, 7, 18213, 13, 64, 16, 1220, 362, 828, 309, 58, 15, 11, 657, 11, 352, 60, 1635, 7813, 7, 18213, 13, 64, 16, 1220, 362, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 886, 628, 220, 220, 220, 220, 220, 220, 220, 10662, 158, 224, 224, 796, 611, 5724, 62, 41068, 62, 2536, 58, 17, 60, 6624, 705, 55, 6, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2264, 9205, 295, 7, 6966, 7, 18213, 13, 64, 17, 1220, 362, 828, 309, 58, 16, 11, 657, 11, 657, 60, 1635, 7813, 7, 18213, 13, 64, 17, 1220, 362, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 5724, 62, 41068, 62, 2536, 58, 17, 60, 6624, 705, 56, 6, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2264, 9205, 295, 7, 6966, 7, 18213, 13, 64, 17, 1220, 362, 828, 309, 58, 15, 11, 352, 11, 657, 60, 1635, 7813, 7, 18213, 13, 64, 17, 1220, 362, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 5724, 62, 41068, 62, 2536, 58, 17, 60, 6624, 705, 57, 6, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2264, 9205, 295, 7, 6966, 7, 18213, 13, 64, 17, 1220, 362, 828, 309, 58, 15, 11, 657, 11, 352, 60, 1635, 7813, 7, 18213, 13, 64, 17, 1220, 362, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 886, 628, 220, 220, 220, 220, 220, 220, 220, 10662, 158, 224, 225, 796, 611, 5724, 62, 41068, 62, 2536, 58, 18, 60, 6624, 705, 55, 6, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2264, 9205, 295, 7, 6966, 7, 18213, 13, 64, 18, 1220, 362, 828, 309, 58, 16, 11, 657, 11, 657, 60, 1635, 7813, 7, 18213, 13, 64, 18, 1220, 362, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 5724, 62, 41068, 62, 2536, 58, 18, 60, 6624, 705, 56, 6, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2264, 9205, 295, 7, 6966, 7, 18213, 13, 64, 18, 1220, 362, 828, 309, 58, 15, 11, 352, 11, 657, 60, 1635, 7813, 7, 18213, 13, 64, 18, 1220, 362, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 5724, 62, 41068, 62, 2536, 58, 18, 60, 6624, 705, 57, 6, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2264, 9205, 295, 7, 6966, 7, 18213, 13, 64, 18, 1220, 362, 828, 309, 58, 15, 11, 657, 11, 352, 60, 1635, 7813, 7, 18213, 13, 64, 18, 1220, 362, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 10662, 68, 796, 10662, 158, 224, 223, 1635, 10662, 158, 224, 224, 1635, 10662, 158, 224, 225, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 6889, 1654, 10662, 15, 318, 3967, 13, 198, 220, 220, 220, 220, 220, 220, 220, 357, 80, 68, 13, 80, 15, 1279, 657, 8, 11405, 357, 80, 68, 796, 532, 80, 68, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 27814, 13, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 10662, 15139, 230, 10662, 68, 198, 220, 220, 220, 886, 198, 437, 198, 198, 31, 9288, 2617, 366, 36, 18173, 18333, 5218, 2264, 9205, 295, 357, 9139, 5965, 16725, 2221, 198, 220, 220, 220, 2488, 9288, 62, 400, 8516, 45751, 12331, 9848, 62, 1462, 62, 421, 265, 7, 16, 11, 362, 11, 513, 11, 1058, 30148, 56, 8, 198, 437, 198, 198, 2, 40480, 25, 1402, 9248, 62, 1462, 62, 421, 265, 198, 2, 34400, 32501, 198, 198, 31, 9288, 2617, 366, 18712, 412, 18173, 18333, 5218, 2264, 9205, 295, 357, 43879, 2414, 16725, 2221, 198, 220, 220, 220, 309, 796, 48436, 2414, 628, 220, 220, 220, 1303, 27565, 1115, 1402, 18333, 13, 198, 220, 220, 220, 7377, 116, 87, 796, 4808, 25192, 62, 648, 7, 51, 8, 1635, 309, 7, 15, 13, 8298, 8, 198, 220, 220, 220, 7377, 116, 88, 796, 4808, 25192, 62, 648, 7, 51, 8, 1635, 309, 7, 15, 13, 8298, 8, 198, 220, 220, 220, 7377, 116, 89, 796, 4808, 25192, 62, 648, 7, 51, 8, 1635, 309, 7, 15, 13, 8298, 8, 628, 220, 220, 220, 1303, 13610, 262, 627, 9205, 295, 13, 198, 220, 220, 220, 10662, 796, 1402, 9248, 62, 1462, 62, 421, 265, 7, 138, 116, 87, 11, 7377, 116, 88, 11, 7377, 116, 89, 8, 628, 220, 220, 220, 1303, 1475, 7254, 1255, 13, 198, 220, 220, 220, 10662, 68, 796, 2264, 9205, 295, 7, 16, 11, 7377, 116, 87, 1220, 362, 11, 7377, 116, 88, 1220, 362, 11, 7377, 116, 89, 1220, 362, 8, 198, 220, 220, 220, 10662, 68, 796, 10662, 68, 1220, 2593, 7, 80, 68, 8, 628, 220, 220, 220, 2488, 9288, 10662, 68, 15139, 230, 10662, 198, 437, 198, 198, 31, 9288, 2617, 366, 18712, 412, 18173, 18333, 5218, 2264, 9205, 295, 357, 43879, 2624, 16725, 2221, 198, 220, 220, 220, 309, 796, 48436, 2624, 628, 220, 220, 220, 1303, 27565, 1115, 1402, 18333, 13, 198, 220, 220, 220, 7377, 116, 87, 796, 4808, 25192, 62, 648, 7, 51, 8, 1635, 309, 7, 15, 13, 8298, 8, 198, 220, 220, 220, 7377, 116, 88, 796, 4808, 25192, 62, 648, 7, 51, 8, 1635, 309, 7, 15, 13, 8298, 8, 198, 220, 220, 220, 7377, 116, 89, 796, 4808, 25192, 62, 648, 7, 51, 8, 1635, 309, 7, 15, 13, 8298, 8, 628, 220, 220, 220, 1303, 13610, 262, 627, 9205, 295, 13, 198, 220, 220, 220, 10662, 796, 1402, 9248, 62, 1462, 62, 421, 265, 7, 138, 116, 87, 11, 7377, 116, 88, 11, 7377, 116, 89, 8, 628, 220, 220, 220, 1303, 1475, 7254, 1255, 13, 198, 220, 220, 220, 10662, 68, 796, 2264, 9205, 295, 7, 16, 11, 7377, 116, 87, 1220, 362, 11, 7377, 116, 88, 1220, 362, 11, 7377, 116, 89, 1220, 362, 8, 198, 220, 220, 220, 10662, 68, 796, 10662, 68, 1220, 2593, 7, 80, 68, 8, 628, 220, 220, 220, 2488, 9288, 10662, 68, 15139, 230, 10662, 198, 437, 198 ]
1.845088
2,453
export Grid, δx, δy, δz, δ, x, y, z, x⃗, xc, yc, zc, x⃗c, N, g⃗, _fftaxes, Nranges, ∫ struct Grid{ND,T} Δx::T Δy::T Δz::T Nx::Int Ny::Int Nz::Int end Grid(Δx::T, Δy::T, Δz::T, Nx::Int, Ny::Int, Nz::Int) where {T<:Real} = Grid{3,T}( Δx, Δy, Δz, Nx, Ny, Nz, ) Grid(Δx::T, Δy::T, Nx::Int, Ny::Int) where {T<:Real} = Grid{2,T}( Δx, Δy, 1., Nx, Ny, 1, ) function Base.size(gr::Grid{3})::NTuple{3,Int} (gr.Nx, gr.Ny, gr.Nz) end function Base.size(gr::Grid{2})::NTuple{2,Int} (gr.Nx, gr.Ny) end Base.size(gr::Grid,d::Int) = Base.size(gr)[d] δx(g::Grid) = g.Δx / g.Nx δy(g::Grid) = g.Δy / g.Ny δz(g::Grid) = g.Δz / g.Nz δ(g::Grid{2}) = g.Δx * g.Δy / ( g.Nx * g.Ny ) δ(g::Grid{3}) = g.Δx * g.Δy * g.Δz / ( g.Nx * g.Ny * g.Nz ) ∫(intgnd;g::Grid) = sum(intgnd)*δ(g) # integrate a scalar field over the grid # voxel/pixel center positions function x(g::Grid{ND,T})::Vector{T} where {ND,T<:Real} # ( ( g.Δx / g.Nx ) .* (0:(g.Nx-1))) .- g.Δx/2. LinRange(-g.Δx/2, g.Δx/2 - g.Δx/g.Nx, g.Nx) end function y(g::Grid{ND,T})::Vector{T} where {ND,T<:Real} # ( ( g.Δy / g.Ny ) .* (0:(g.Ny-1))) .- g.Δy/2. LinRange(-g.Δy/2, g.Δy/2 - g.Δy/g.Ny, g.Ny) end function z(g::Grid{ND,T})::Vector{T} where {ND,T<:Real} # ( ( g.Δz / g.Nz ) .* (0:(g.Nz-1))) .- g.Δz/2. LinRange(-g.Δz/2, g.Δz/2 - g.Δz/g.Nz, g.Nz) end function x⃗(g::Grid{2,T})::Array{SVector{3,T},2} where T<:Real ( (xx,yy) = (x(g),y(g)); [SVector{3,T}(xx[ix],yy[iy],0.) for ix=1:g.Nx,iy=1:g.Ny] ) # (Nx × Ny ) 2D-Array of (x,y,z) vectors at pixel/voxel centers end function x⃗(g::Grid{3,T})::Array{SVector{3,T},3} where T<:Real ( (xx,yy,zz) = (x(g),y(g),z(g)); [SVector{3,T}(xx[ix],yy[iy],zz[iz]) for ix=1:g.Nx,iy=1:g.Ny,iz=1:g.Nz] ) # (Nx × Ny × Nz) 3D-Array of (x,y,z) vectors at pixel/voxel centers end # voxel/pixel corner positions function xc(g::Grid{ND,T})::Vector{T} where {ND,T<:Real} collect( ( ( g.Δx / g.Nx ) .* (0:g.Nx) ) .- ( g.Δx/2. * ( 1 + 1. / g.Nx ) ) ) # collect(range(-g.Δx/2.0, g.Δx/2.0, length=g.Nx+1)) end function yc(g::Grid{ND,T})::Vector{T} where {ND,T<:Real} collect( ( ( g.Δy / g.Ny ) .* (0:g.Ny) ) .- ( g.Δy/2. * ( 1 + 1. / g.Ny ) ) ) # collect(range(-g.Δy/2.0, g.Δy/2.0, length=g.Ny+1)) end function zc(g::Grid{3,T})::Vector{T} where T<:Real collect( ( ( g.Δz / g.Nz ) .* (0:g.Nz) ) .- ( g.Δz/2. * ( 1 + 1. / g.Nz ) ) ) # collect(range(-g.Δz/2.0, g.Δz/2.0, length=g.Nz+1)) end function x⃗c(g::Grid{2,T})::Array{SVector{3,T},2} where T<:Real ( (xx,yy) = (xc(g),yc(g)); [SVector{3}(xx[ix],yy[iy],0.) for ix=1:(g.Nx+1),iy=1:(g.Ny+1)] ) end function x⃗c(g::Grid{3,T})::Array{SVector{3,T},3} where T<:Real ( (xx,yy,zz) = (xc(g),yc(g),zc(g)); [SVector{3}(xx[ix],yy[iy],zz[iz]) for ix=1:(g.Nx+1),iy=1:(g.Ny+1),iz=1:(g.Nz+1)] ) end # grid size @inline N(g::Grid)::Int = *(size(g)...) import Base: eachindex @inline eachindex(g::Grid) = CartesianIndices(size(g)) #(1:NN for NN in size(g)) # reciprocal lattice vectors (from fftfreqs) function g⃗(gr::Grid{3,T})::Array{SVector{3, T}, 3} where T<:Real [ SVector(gx,gy,gz) for gx in fftfreq(gr.Nx,gr.Nx/gr.Δx), gy in fftfreq(gr.Ny,gr.Ny/gr.Δy), gz in fftfreq(gr.Nz,gr.Nz/gr.Δz) ] end _fftaxes(gr::Grid{3}) = (2:4) function g⃗(gr::Grid{2,T})::Array{SVector{3, T}, 2} where T [ SVector(gx,gy,0.) for gx in fftfreq(gr.Nx,gr.Nx/gr.Δx), gy in fftfreq(gr.Ny,gr.Ny/gr.Δy) ] end _fftaxes(gr::Grid{2}) = (2:3) """ ################################################################################ # # # Plotting methods # # # ################################################################################ """
[ 39344, 24846, 11, 7377, 112, 87, 11, 7377, 112, 88, 11, 7377, 112, 89, 11, 7377, 112, 11, 2124, 11, 331, 11, 1976, 11, 2124, 158, 225, 245, 11, 2124, 66, 11, 331, 66, 11, 1976, 66, 11, 2124, 158, 225, 245, 66, 11, 399, 11, 308, 158, 225, 245, 11, 4808, 487, 19290, 274, 11, 399, 81, 6231, 11, 18872, 104, 198, 198, 7249, 24846, 90, 8575, 11, 51, 92, 198, 197, 138, 242, 87, 3712, 51, 198, 220, 220, 220, 37455, 88, 3712, 51, 198, 220, 220, 220, 37455, 89, 3712, 51, 198, 197, 45, 87, 3712, 5317, 198, 220, 220, 220, 17735, 3712, 5317, 198, 220, 220, 220, 399, 89, 3712, 5317, 198, 437, 198, 198, 41339, 7, 138, 242, 87, 3712, 51, 11, 37455, 88, 3712, 51, 11, 37455, 89, 3712, 51, 11, 399, 87, 3712, 5317, 11, 17735, 3712, 5317, 11, 399, 89, 3712, 5317, 8, 810, 1391, 51, 27, 25, 15633, 92, 796, 24846, 90, 18, 11, 51, 92, 7, 198, 197, 138, 242, 87, 11, 198, 220, 220, 220, 37455, 88, 11, 198, 220, 220, 220, 37455, 89, 11, 198, 197, 45, 87, 11, 198, 220, 220, 220, 17735, 11, 198, 220, 220, 220, 399, 89, 11, 198, 8, 198, 198, 41339, 7, 138, 242, 87, 3712, 51, 11, 37455, 88, 3712, 51, 11, 399, 87, 3712, 5317, 11, 17735, 3712, 5317, 8, 810, 1391, 51, 27, 25, 15633, 92, 796, 24846, 90, 17, 11, 51, 92, 7, 198, 197, 138, 242, 87, 11, 198, 220, 220, 220, 37455, 88, 11, 198, 220, 220, 220, 352, 1539, 198, 197, 45, 87, 11, 198, 220, 220, 220, 17735, 11, 198, 220, 220, 220, 352, 11, 198, 8, 198, 198, 8818, 7308, 13, 7857, 7, 2164, 3712, 41339, 90, 18, 92, 2599, 25, 11251, 29291, 90, 18, 11, 5317, 92, 198, 197, 7, 2164, 13, 45, 87, 11, 1036, 13, 45, 88, 11, 1036, 13, 45, 89, 8, 198, 437, 198, 8818, 7308, 13, 7857, 7, 2164, 3712, 41339, 90, 17, 92, 2599, 25, 11251, 29291, 90, 17, 11, 5317, 92, 198, 197, 7, 2164, 13, 45, 87, 11, 1036, 13, 45, 88, 8, 198, 437, 198, 14881, 13, 7857, 7, 2164, 3712, 41339, 11, 67, 3712, 5317, 8, 796, 7308, 13, 7857, 7, 2164, 38381, 67, 60, 628, 198, 138, 112, 87, 7, 70, 3712, 41339, 8, 796, 308, 13, 138, 242, 87, 1220, 308, 13, 45, 87, 198, 138, 112, 88, 7, 70, 3712, 41339, 8, 796, 308, 13, 138, 242, 88, 1220, 308, 13, 45, 88, 198, 138, 112, 89, 7, 70, 3712, 41339, 8, 796, 308, 13, 138, 242, 89, 1220, 308, 13, 45, 89, 198, 198, 138, 112, 7, 70, 3712, 41339, 90, 17, 30072, 796, 308, 13, 138, 242, 87, 1635, 308, 13, 138, 242, 88, 1220, 357, 308, 13, 45, 87, 1635, 308, 13, 45, 88, 1267, 198, 138, 112, 7, 70, 3712, 41339, 90, 18, 30072, 796, 308, 13, 138, 242, 87, 1635, 308, 13, 138, 242, 88, 1635, 308, 13, 138, 242, 89, 1220, 357, 308, 13, 45, 87, 1635, 308, 13, 45, 88, 1635, 308, 13, 45, 89, 1267, 198, 198, 24861, 104, 7, 600, 70, 358, 26, 70, 3712, 41339, 8, 796, 2160, 7, 600, 70, 358, 27493, 138, 112, 7, 70, 8, 197, 2, 19386, 257, 16578, 283, 2214, 625, 262, 10706, 198, 198, 2, 410, 1140, 417, 14, 32515, 3641, 6116, 198, 8818, 2124, 7, 70, 3712, 41339, 90, 8575, 11, 51, 92, 2599, 25, 38469, 90, 51, 92, 220, 810, 1391, 8575, 11, 51, 27, 25, 15633, 92, 198, 220, 197, 2, 357, 357, 308, 13, 138, 242, 87, 1220, 308, 13, 45, 87, 1267, 764, 9, 357, 15, 37498, 70, 13, 45, 87, 12, 16, 22305, 764, 12, 308, 13, 138, 242, 87, 14, 17, 13, 198, 197, 14993, 17257, 32590, 70, 13, 138, 242, 87, 14, 17, 11, 308, 13, 138, 242, 87, 14, 17, 532, 308, 13, 138, 242, 87, 14, 70, 13, 45, 87, 11, 308, 13, 45, 87, 8, 198, 437, 198, 8818, 331, 7, 70, 3712, 41339, 90, 8575, 11, 51, 92, 2599, 25, 38469, 90, 51, 92, 220, 810, 1391, 8575, 11, 51, 27, 25, 15633, 92, 198, 220, 197, 2, 357, 357, 308, 13, 138, 242, 88, 1220, 308, 13, 45, 88, 1267, 764, 9, 357, 15, 37498, 70, 13, 45, 88, 12, 16, 22305, 764, 12, 308, 13, 138, 242, 88, 14, 17, 13, 198, 197, 14993, 17257, 32590, 70, 13, 138, 242, 88, 14, 17, 11, 308, 13, 138, 242, 88, 14, 17, 532, 308, 13, 138, 242, 88, 14, 70, 13, 45, 88, 11, 308, 13, 45, 88, 8, 198, 437, 198, 8818, 1976, 7, 70, 3712, 41339, 90, 8575, 11, 51, 92, 2599, 25, 38469, 90, 51, 92, 220, 810, 1391, 8575, 11, 51, 27, 25, 15633, 92, 198, 220, 197, 2, 357, 357, 308, 13, 138, 242, 89, 1220, 308, 13, 45, 89, 1267, 764, 9, 357, 15, 37498, 70, 13, 45, 89, 12, 16, 22305, 764, 12, 308, 13, 138, 242, 89, 14, 17, 13, 198, 197, 14993, 17257, 32590, 70, 13, 138, 242, 89, 14, 17, 11, 308, 13, 138, 242, 89, 14, 17, 532, 308, 13, 138, 242, 89, 14, 70, 13, 45, 89, 11, 308, 13, 45, 89, 8, 198, 437, 198, 8818, 2124, 158, 225, 245, 7, 70, 3712, 41339, 90, 17, 11, 51, 92, 2599, 25, 19182, 90, 50, 38469, 90, 18, 11, 51, 5512, 17, 92, 810, 309, 27, 25, 15633, 198, 197, 7, 357, 5324, 11, 22556, 8, 796, 357, 87, 7, 70, 828, 88, 7, 70, 18125, 685, 50, 38469, 90, 18, 11, 51, 92, 7, 5324, 58, 844, 4357, 22556, 58, 7745, 4357, 15, 2014, 329, 220, 844, 28, 16, 25, 70, 13, 45, 87, 11, 7745, 28, 16, 25, 70, 13, 45, 88, 60, 1267, 1303, 357, 45, 87, 13958, 17735, 1267, 362, 35, 12, 19182, 286, 357, 87, 11, 88, 11, 89, 8, 30104, 379, 17465, 14, 85, 1140, 417, 10399, 198, 437, 198, 8818, 2124, 158, 225, 245, 7, 70, 3712, 41339, 90, 18, 11, 51, 92, 2599, 25, 19182, 90, 50, 38469, 90, 18, 11, 51, 5512, 18, 92, 810, 309, 27, 25, 15633, 198, 197, 7, 357, 5324, 11, 22556, 11, 3019, 8, 796, 357, 87, 7, 70, 828, 88, 7, 70, 828, 89, 7, 70, 18125, 685, 50, 38469, 90, 18, 11, 51, 92, 7, 5324, 58, 844, 4357, 22556, 58, 7745, 4357, 3019, 58, 528, 12962, 329, 220, 844, 28, 16, 25, 70, 13, 45, 87, 11, 7745, 28, 16, 25, 70, 13, 45, 88, 11, 528, 28, 16, 25, 70, 13, 45, 89, 60, 1267, 1303, 357, 45, 87, 13958, 17735, 13958, 399, 89, 8, 513, 35, 12, 19182, 286, 357, 87, 11, 88, 11, 89, 8, 30104, 379, 17465, 14, 85, 1140, 417, 10399, 198, 437, 198, 198, 2, 410, 1140, 417, 14, 32515, 5228, 6116, 198, 8818, 2124, 66, 7, 70, 3712, 41339, 90, 8575, 11, 51, 92, 2599, 25, 38469, 90, 51, 92, 810, 1391, 8575, 11, 51, 27, 25, 15633, 92, 198, 197, 33327, 7, 357, 357, 308, 13, 138, 242, 87, 1220, 308, 13, 45, 87, 1267, 764, 9, 357, 15, 25, 70, 13, 45, 87, 8, 1267, 764, 12, 357, 308, 13, 138, 242, 87, 14, 17, 13, 1635, 357, 352, 1343, 352, 13, 1220, 308, 13, 45, 87, 1267, 1267, 1267, 198, 197, 2, 2824, 7, 9521, 32590, 70, 13, 138, 242, 87, 14, 17, 13, 15, 11, 308, 13, 138, 242, 87, 14, 17, 13, 15, 11, 4129, 28, 70, 13, 45, 87, 10, 16, 4008, 198, 437, 198, 8818, 331, 66, 7, 70, 3712, 41339, 90, 8575, 11, 51, 92, 2599, 25, 38469, 90, 51, 92, 810, 1391, 8575, 11, 51, 27, 25, 15633, 92, 198, 197, 33327, 7, 357, 357, 308, 13, 138, 242, 88, 1220, 308, 13, 45, 88, 1267, 764, 9, 357, 15, 25, 70, 13, 45, 88, 8, 1267, 764, 12, 357, 308, 13, 138, 242, 88, 14, 17, 13, 1635, 357, 352, 1343, 352, 13, 1220, 308, 13, 45, 88, 1267, 1267, 1267, 198, 197, 2, 2824, 7, 9521, 32590, 70, 13, 138, 242, 88, 14, 17, 13, 15, 11, 308, 13, 138, 242, 88, 14, 17, 13, 15, 11, 4129, 28, 70, 13, 45, 88, 10, 16, 4008, 198, 437, 198, 8818, 1976, 66, 7, 70, 3712, 41339, 90, 18, 11, 51, 92, 2599, 25, 38469, 90, 51, 92, 810, 309, 27, 25, 15633, 198, 197, 33327, 7, 357, 357, 308, 13, 138, 242, 89, 1220, 308, 13, 45, 89, 1267, 764, 9, 357, 15, 25, 70, 13, 45, 89, 8, 1267, 764, 12, 357, 308, 13, 138, 242, 89, 14, 17, 13, 1635, 357, 352, 1343, 352, 13, 1220, 308, 13, 45, 89, 1267, 1267, 1267, 198, 197, 2, 2824, 7, 9521, 32590, 70, 13, 138, 242, 89, 14, 17, 13, 15, 11, 308, 13, 138, 242, 89, 14, 17, 13, 15, 11, 4129, 28, 70, 13, 45, 89, 10, 16, 4008, 198, 437, 198, 8818, 2124, 158, 225, 245, 66, 7, 70, 3712, 41339, 90, 17, 11, 51, 92, 2599, 25, 19182, 90, 50, 38469, 90, 18, 11, 51, 5512, 17, 92, 220, 810, 309, 27, 25, 15633, 198, 197, 7, 357, 5324, 11, 22556, 8, 796, 357, 25306, 7, 70, 828, 88, 66, 7, 70, 18125, 685, 50, 38469, 90, 18, 92, 7, 5324, 58, 844, 4357, 22556, 58, 7745, 4357, 15, 2014, 329, 220, 844, 28, 16, 37498, 70, 13, 45, 87, 10, 16, 828, 7745, 28, 16, 37498, 70, 13, 45, 88, 10, 16, 15437, 1267, 198, 437, 198, 8818, 2124, 158, 225, 245, 66, 7, 70, 3712, 41339, 90, 18, 11, 51, 92, 2599, 25, 19182, 90, 50, 38469, 90, 18, 11, 51, 5512, 18, 92, 220, 810, 309, 27, 25, 15633, 198, 197, 7, 357, 5324, 11, 22556, 11, 3019, 8, 796, 357, 25306, 7, 70, 828, 88, 66, 7, 70, 828, 89, 66, 7, 70, 18125, 685, 50, 38469, 90, 18, 92, 7, 5324, 58, 844, 4357, 22556, 58, 7745, 4357, 3019, 58, 528, 12962, 329, 220, 844, 28, 16, 37498, 70, 13, 45, 87, 10, 16, 828, 7745, 28, 16, 37498, 70, 13, 45, 88, 10, 16, 828, 528, 28, 16, 37498, 70, 13, 45, 89, 10, 16, 15437, 1267, 198, 437, 198, 198, 2, 10706, 2546, 198, 31, 45145, 399, 7, 70, 3712, 41339, 2599, 25, 5317, 796, 1635, 7, 7857, 7, 70, 8, 23029, 198, 198, 11748, 7308, 25, 1123, 9630, 198, 31, 45145, 1123, 9630, 7, 70, 3712, 41339, 8, 796, 13690, 35610, 5497, 1063, 7, 7857, 7, 70, 4008, 1303, 7, 16, 25, 6144, 329, 399, 45, 287, 2546, 7, 70, 4008, 628, 198, 2, 48135, 47240, 501, 30104, 357, 6738, 277, 701, 19503, 48382, 8, 198, 8818, 308, 158, 225, 245, 7, 2164, 3712, 41339, 90, 18, 11, 51, 92, 2599, 25, 19182, 90, 50, 38469, 90, 18, 11, 309, 5512, 513, 92, 810, 309, 27, 25, 15633, 198, 197, 58, 197, 50, 38469, 7, 70, 87, 11, 1360, 11, 34586, 8, 329, 220, 220, 308, 87, 287, 277, 701, 19503, 80, 7, 2164, 13, 45, 87, 11, 2164, 13, 45, 87, 14, 2164, 13, 138, 242, 87, 828, 198, 197, 197, 197, 197, 197, 197, 197, 197, 1360, 287, 277, 701, 19503, 80, 7, 2164, 13, 45, 88, 11, 2164, 13, 45, 88, 14, 2164, 13, 138, 242, 88, 828, 198, 197, 197, 197, 197, 197, 197, 197, 220, 220, 220, 308, 89, 287, 277, 701, 19503, 80, 7, 2164, 13, 45, 89, 11, 2164, 13, 45, 89, 14, 2164, 13, 138, 242, 89, 8, 197, 197, 60, 198, 437, 198, 62, 487, 19290, 274, 7, 2164, 3712, 41339, 90, 18, 30072, 796, 357, 17, 25, 19, 8, 198, 198, 8818, 308, 158, 225, 245, 7, 2164, 3712, 41339, 90, 17, 11, 51, 92, 2599, 25, 19182, 90, 50, 38469, 90, 18, 11, 309, 5512, 362, 92, 810, 309, 198, 197, 685, 197, 50, 38469, 7, 70, 87, 11, 1360, 11, 15, 2014, 329, 220, 220, 308, 87, 287, 277, 701, 19503, 80, 7, 2164, 13, 45, 87, 11, 2164, 13, 45, 87, 14, 2164, 13, 138, 242, 87, 828, 198, 197, 197, 197, 197, 197, 197, 197, 197, 1360, 287, 277, 701, 19503, 80, 7, 2164, 13, 45, 88, 11, 2164, 13, 45, 88, 14, 2164, 13, 138, 242, 88, 8, 197, 197, 60, 198, 437, 198, 62, 487, 19290, 274, 7, 2164, 3712, 41339, 90, 17, 30072, 796, 357, 17, 25, 18, 8, 628, 198, 37811, 198, 29113, 29113, 14468, 198, 2, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 220, 220, 1303, 198, 2, 197, 197, 197, 197, 197, 197, 197, 220, 220, 28114, 889, 5050, 197, 197, 197, 197, 197, 220, 220, 220, 197, 197, 197, 220, 220, 1303, 198, 2, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 220, 220, 1303, 198, 29113, 29113, 14468, 198, 37811, 198 ]
1.692449
2,185
<reponame>isrlab/Multibody-Dynamics<filename>UdKaDyn/Examples/testGimbal.jl # To test a simplified 2 axis gimbal. # Modeling the system as a cube and the gimbal placed on top. # We need two revolute joints between the cube and gimbal. include("../src/plotSol.jl") include("../src/simulate.jl") include("../src/OrientationConversion.jl") clearconsole() ## Inertial Properties mb = 0.755; mg = 0.215; mp = 0.02; Ib = [ 0.0009 0.0000 -0.0000; 0.0000 0.0053 0.0000; -0.0000 0.0000 0.0054]#*(10^-3) Ip = [ 0.0029 0.0000 0.0000; 0.0000 0.5824 0.0000; 0.0000 0.0000 0.5805]*(10^-4) Ig = [ 0.1435 0.0000 0.0000; 0.0000 0.0498 0.0000; 0.0000 0.0000 0.1381]*(10^-3) ## Initialisation InFrame = InertialFrameAsRB() Body = RigidBody(mb,Ib,2) Gimbal = RigidBody(mg,Ig,3) x0Body = [zeros(3);[1;zeros(3)];zeros(3);zeros(4)] initialiseRigidBody!(Body,x0Body) x0Gimbal = [[0.0;0.0;0.143];[1;zeros(3)];zeros(3);zeros(4)] initialiseRigidBody!(Gimbal,x0Gimbal) ## Joint Descriptions # Joint 1 (Free) between the inertial frame and body. j1 = Joint(InFrame,Body,zeros(3),zeros(3)) # Joint 2 (Revolute2) between the body and gimbal axisZ = [0.0 0.0 1.0][:] rjBody = [0.0 0.0 0.134][:] rjGimbal = [0.0 0.0 -0.009][:] j2 = Joint(Body,Gimbal,rjBody,rjGimbal, type = "Revolute",axis = axisZ, jointTorque = [0.0 0.0 0.0][:]) ## Simulation tEnd = 1.0 tSpan = 0.01 g = [0.0;0.0;0.0] tSim, solFinal = simulate(tEnd,tSpan,j1,j2,g=g)#,extFVec = extFList) @time simulate(tEnd,tSpan,j1,j2,g=g) solBody = solFinal[1] solGimbal = solFinal[2] ## Plotting plotErrNorm(tSim,solBody.β) plotErrNorm(tSim,solGimbal.β) # Check if joint location has moved jointLoc = Matrix{Float64}(undef,length(tSim),3) ωBody = Matrix{Float64}(undef,length(tSim),3) ωGimbal = Matrix{Float64}(undef,length(tSim),3) ωGimbalInBody = Matrix{Float64}(undef,length(tSim),3) ωRel = Matrix{Float64}(undef,length(tSim),3) # Relative for i=1:length(tSim) Body.dcm = quat2dcm(solBody.β[i,:]) Gimbal.dcm = quat2dcm(solGimbal.β[i,:]) ωBody[i,:] = angVel(solBody.β[i,:],solBody.βdot[i,:]) ωGimbal[i,:] = angVel(solGimbal.β[i,:],solGimbal.βdot[i,:]) ωGimbalInBody[i,:] = quat2dcm(solBody.β[i,:])* transpose(quat2dcm(solGimbal.β[i,:]))* ωGimbal[i,:] ωRel[i,:] = ωGimbalInBody[i,:] - ωBody[i,:] jointLoc[i,:] = solBody.r[i,:] + transpose(Body.dcm)*rjBody - solGimbal.r[i,:] - transpose(Gimbal.dcm)*rjGimbal end plotPos(tSim,jointLoc) plotPos(tSim,solBody.r) plotPos(tSim,solGimbal.r) plotVel(tSim,solBody.v) plotVel(tSim,solGimbal.v) plotAngVel(tSim,ωBody) plotAngVel(tSim,ωGimbal) plotAngVel(tSim,ωGimbalInBody) plotAngVel(tSim,ωRel) # plotAngVel(tSim,ωCube - ωProp) # # Check revJoint axis # axisSol = Matrix{Float64}(undef,length(tSim),3) # errAxis = Matrix{Float64}(undef,length(tSim),3) # errAxisNorm = Vector{Float64}(undef,length(tSim)) # for i=1:length(tSim) # axisSol[i,:] = solProp.β[i,2:4]/norm(solProp.β[i,2:4],2) # # # β1inv = [solQuad.β[i,1];solQuad.β[i,2:4]] # # βRev = quaternionProduct(solProp.β[i,:],β1inv) # # axisSol[i,:] = βRev[2:4]/norm(βRev[2:4]) # # # axisSol[i,:] = (solQuad.β[i,:])*solProp.β[i,2:4]/norm(solProp.β[i,2:4],2) # # # axisSol[i,:] = axixRev(solQuad.β[i,:],solProp.β[i,:]) # errAxis[i,:] = axisSol[i,:] - axis # errAxisNorm[i] = norm(axisSol[i,:],2) - 1.0 # end # plot(tSim[2:end],errAxisNorm[2:end]) # plotPos(tSim,errAxis)
[ 27, 7856, 261, 480, 29, 271, 81, 23912, 14, 15205, 571, 1118, 12, 35, 4989, 873, 27, 34345, 29, 52, 67, 37281, 35, 2047, 14, 27730, 14, 9288, 38, 320, 6893, 13, 20362, 198, 2, 1675, 1332, 257, 27009, 362, 16488, 308, 320, 6893, 13, 198, 2, 9104, 278, 262, 1080, 355, 257, 23441, 290, 262, 308, 320, 6893, 4624, 319, 1353, 13, 198, 2, 775, 761, 734, 2710, 3552, 24039, 1022, 262, 23441, 290, 308, 320, 6893, 13, 198, 198, 17256, 7203, 40720, 10677, 14, 29487, 36949, 13, 20362, 4943, 198, 17256, 7203, 40720, 10677, 14, 14323, 5039, 13, 20362, 4943, 198, 17256, 7203, 40720, 10677, 14, 46, 8289, 341, 3103, 9641, 13, 20362, 4943, 198, 20063, 41947, 3419, 198, 198, 2235, 554, 861, 498, 24946, 198, 2022, 796, 657, 13, 38172, 26, 10527, 796, 657, 13, 23349, 26, 29034, 796, 657, 13, 2999, 26, 198, 198, 40, 65, 796, 220, 685, 657, 13, 830, 24, 220, 220, 220, 657, 13, 2388, 220, 220, 532, 15, 13, 2388, 26, 198, 220, 220, 220, 220, 220, 220, 220, 657, 13, 2388, 220, 220, 220, 657, 13, 405, 4310, 220, 220, 220, 657, 13, 2388, 26, 198, 220, 220, 220, 220, 220, 220, 532, 15, 13, 2388, 220, 220, 220, 657, 13, 2388, 220, 220, 220, 657, 13, 405, 4051, 60, 2, 9, 7, 940, 61, 12, 18, 8, 198, 198, 40, 79, 796, 220, 220, 220, 685, 657, 13, 405, 1959, 220, 220, 220, 657, 13, 2388, 220, 220, 220, 657, 13, 2388, 26, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 657, 13, 2388, 220, 220, 220, 657, 13, 3365, 1731, 220, 220, 220, 657, 13, 2388, 26, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 657, 13, 2388, 220, 220, 220, 657, 13, 2388, 220, 220, 220, 657, 13, 20, 28256, 60, 9, 7, 940, 61, 12, 19, 8, 198, 198, 40, 70, 796, 220, 220, 220, 685, 657, 13, 1415, 2327, 220, 220, 220, 657, 13, 2388, 220, 220, 220, 657, 13, 2388, 26, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 657, 13, 2388, 220, 220, 220, 657, 13, 15, 36260, 220, 220, 220, 657, 13, 2388, 26, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 657, 13, 2388, 220, 220, 220, 657, 13, 2388, 220, 220, 220, 657, 13, 1485, 6659, 60, 9, 7, 940, 61, 12, 18, 8, 198, 198, 2235, 20768, 5612, 198, 818, 19778, 796, 554, 861, 498, 19778, 1722, 27912, 3419, 198, 25842, 796, 24666, 312, 25842, 7, 2022, 11, 40, 65, 11, 17, 8, 198, 38, 320, 6893, 796, 24666, 312, 25842, 7, 11296, 11, 40, 70, 11, 18, 8, 198, 198, 87, 15, 25842, 796, 685, 9107, 418, 7, 18, 1776, 58, 16, 26, 9107, 418, 7, 18, 8, 11208, 9107, 418, 7, 18, 1776, 9107, 418, 7, 19, 15437, 198, 36733, 786, 49, 328, 312, 25842, 0, 7, 25842, 11, 87, 15, 25842, 8, 198, 87, 15, 38, 320, 6893, 796, 16410, 15, 13, 15, 26, 15, 13, 15, 26, 15, 13, 21139, 11208, 58, 16, 26, 9107, 418, 7, 18, 8, 11208, 9107, 418, 7, 18, 1776, 9107, 418, 7, 19, 15437, 198, 36733, 786, 49, 328, 312, 25842, 0, 7, 38, 320, 6893, 11, 87, 15, 38, 320, 6893, 8, 198, 198, 2235, 16798, 2935, 24370, 198, 2, 16798, 352, 357, 11146, 8, 1022, 262, 29824, 498, 5739, 290, 1767, 13, 198, 73, 16, 796, 16798, 7, 818, 19778, 11, 25842, 11, 9107, 418, 7, 18, 828, 9107, 418, 7, 18, 4008, 198, 198, 2, 16798, 362, 357, 18009, 3552, 17, 8, 1022, 262, 1767, 290, 308, 320, 6893, 198, 22704, 57, 796, 685, 15, 13, 15, 657, 13, 15, 352, 13, 15, 7131, 47715, 198, 81, 73, 25842, 796, 685, 15, 13, 15, 657, 13, 15, 657, 13, 19880, 7131, 47715, 198, 81, 73, 38, 320, 6893, 796, 685, 15, 13, 15, 657, 13, 15, 532, 15, 13, 28694, 7131, 47715, 198, 73, 17, 796, 16798, 7, 25842, 11, 38, 320, 6893, 11, 81, 73, 25842, 11, 81, 73, 38, 320, 6893, 11, 198, 220, 220, 220, 220, 2099, 796, 366, 18009, 3552, 1600, 22704, 796, 16488, 57, 11, 6466, 15884, 4188, 796, 685, 15, 13, 15, 657, 13, 15, 657, 13, 15, 7131, 25, 12962, 198, 198, 2235, 41798, 198, 83, 12915, 796, 352, 13, 15, 198, 83, 4561, 272, 796, 657, 13, 486, 198, 70, 796, 685, 15, 13, 15, 26, 15, 13, 15, 26, 15, 13, 15, 60, 198, 83, 8890, 11, 1540, 19006, 796, 29308, 7, 83, 12915, 11, 83, 4561, 272, 11, 73, 16, 11, 73, 17, 11, 70, 28, 70, 8, 2, 11, 2302, 37, 53, 721, 796, 1070, 3697, 396, 8, 198, 31, 2435, 29308, 7, 83, 12915, 11, 83, 4561, 272, 11, 73, 16, 11, 73, 17, 11, 70, 28, 70, 8, 198, 34453, 25842, 796, 1540, 19006, 58, 16, 60, 198, 34453, 38, 320, 6893, 796, 1540, 19006, 58, 17, 60, 198, 198, 2235, 28114, 889, 198, 29487, 9139, 81, 35393, 7, 83, 8890, 11, 34453, 25842, 13, 26638, 8, 198, 29487, 9139, 81, 35393, 7, 83, 8890, 11, 34453, 38, 320, 6893, 13, 26638, 8, 198, 2, 6822, 611, 6466, 4067, 468, 3888, 198, 73, 1563, 33711, 796, 24936, 90, 43879, 2414, 92, 7, 917, 891, 11, 13664, 7, 83, 8890, 828, 18, 8, 198, 49535, 25842, 796, 24936, 90, 43879, 2414, 92, 7, 917, 891, 11, 13664, 7, 83, 8890, 828, 18, 8, 198, 49535, 38, 320, 6893, 796, 24936, 90, 43879, 2414, 92, 7, 917, 891, 11, 13664, 7, 83, 8890, 828, 18, 8, 198, 49535, 38, 320, 6893, 818, 25842, 796, 24936, 90, 43879, 2414, 92, 7, 917, 891, 11, 13664, 7, 83, 8890, 828, 18, 8, 198, 49535, 6892, 796, 24936, 90, 43879, 2414, 92, 7, 917, 891, 11, 13664, 7, 83, 8890, 828, 18, 8, 1303, 45344, 198, 1640, 1312, 28, 16, 25, 13664, 7, 83, 8890, 8, 198, 220, 220, 220, 12290, 13, 67, 11215, 796, 627, 265, 17, 67, 11215, 7, 34453, 25842, 13, 26638, 58, 72, 11, 25, 12962, 198, 220, 220, 220, 41123, 6893, 13, 67, 11215, 796, 627, 265, 17, 67, 11215, 7, 34453, 38, 320, 6893, 13, 26638, 58, 72, 11, 25, 12962, 198, 220, 220, 220, 18074, 231, 25842, 58, 72, 11, 47715, 796, 3550, 46261, 7, 34453, 25842, 13, 26638, 58, 72, 11, 25, 4357, 34453, 25842, 13, 26638, 26518, 58, 72, 11, 25, 12962, 198, 220, 220, 220, 18074, 231, 38, 320, 6893, 58, 72, 11, 47715, 796, 3550, 46261, 7, 34453, 38, 320, 6893, 13, 26638, 58, 72, 11, 25, 4357, 34453, 38, 320, 6893, 13, 26638, 26518, 58, 72, 11, 25, 12962, 198, 220, 220, 220, 18074, 231, 38, 320, 6893, 818, 25842, 58, 72, 11, 47715, 796, 627, 265, 17, 67, 11215, 7, 34453, 25842, 13, 26638, 58, 72, 11, 25, 12962, 9, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1007, 3455, 7, 421, 265, 17, 67, 11215, 7, 34453, 38, 320, 6893, 13, 26638, 58, 72, 11, 47715, 4008, 9, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 18074, 231, 38, 320, 6893, 58, 72, 11, 47715, 198, 220, 220, 220, 18074, 231, 6892, 58, 72, 11, 47715, 796, 18074, 231, 38, 320, 6893, 818, 25842, 58, 72, 11, 47715, 532, 18074, 231, 25842, 58, 72, 11, 47715, 198, 220, 220, 220, 6466, 33711, 58, 72, 11, 47715, 796, 1540, 25842, 13, 81, 58, 72, 11, 47715, 1343, 1007, 3455, 7, 25842, 13, 67, 11215, 27493, 81, 73, 25842, 532, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1540, 38, 320, 6893, 13, 81, 58, 72, 11, 47715, 532, 1007, 3455, 7, 38, 320, 6893, 13, 67, 11215, 27493, 81, 73, 38, 320, 6893, 198, 437, 198, 29487, 21604, 7, 83, 8890, 11, 73, 1563, 33711, 8, 198, 29487, 21604, 7, 83, 8890, 11, 34453, 25842, 13, 81, 8, 198, 29487, 21604, 7, 83, 8890, 11, 34453, 38, 320, 6893, 13, 81, 8, 198, 29487, 46261, 7, 83, 8890, 11, 34453, 25842, 13, 85, 8, 198, 29487, 46261, 7, 83, 8890, 11, 34453, 38, 320, 6893, 13, 85, 8, 198, 29487, 13450, 46261, 7, 83, 8890, 11, 49535, 25842, 8, 198, 29487, 13450, 46261, 7, 83, 8890, 11, 49535, 38, 320, 6893, 8, 198, 29487, 13450, 46261, 7, 83, 8890, 11, 49535, 38, 320, 6893, 818, 25842, 8, 198, 29487, 13450, 46261, 7, 83, 8890, 11, 49535, 6892, 8, 198, 2, 7110, 13450, 46261, 7, 83, 8890, 11, 49535, 29071, 532, 18074, 231, 24331, 8, 198, 198, 2, 1303, 6822, 2710, 41, 1563, 16488, 198, 2, 16488, 36949, 796, 24936, 90, 43879, 2414, 92, 7, 917, 891, 11, 13664, 7, 83, 8890, 828, 18, 8, 198, 2, 11454, 31554, 271, 796, 24936, 90, 43879, 2414, 92, 7, 917, 891, 11, 13664, 7, 83, 8890, 828, 18, 8, 198, 2, 11454, 31554, 271, 35393, 796, 20650, 90, 43879, 2414, 92, 7, 917, 891, 11, 13664, 7, 83, 8890, 4008, 198, 2, 329, 1312, 28, 16, 25, 13664, 7, 83, 8890, 8, 198, 2, 220, 220, 220, 220, 16488, 36949, 58, 72, 11, 47715, 796, 1540, 24331, 13, 26638, 58, 72, 11, 17, 25, 19, 60, 14, 27237, 7, 34453, 24331, 13, 26638, 58, 72, 11, 17, 25, 19, 4357, 17, 8, 198, 2, 198, 2, 220, 220, 220, 220, 1303, 27169, 16, 16340, 796, 685, 34453, 4507, 324, 13, 26638, 58, 72, 11, 16, 11208, 34453, 4507, 324, 13, 26638, 58, 72, 11, 17, 25, 19, 11907, 198, 2, 220, 220, 220, 220, 1303, 27169, 18009, 796, 627, 9205, 295, 15667, 7, 34453, 24331, 13, 26638, 58, 72, 11, 25, 4357, 26638, 16, 16340, 8, 198, 2, 220, 220, 220, 220, 1303, 16488, 36949, 58, 72, 11, 47715, 796, 27169, 18009, 58, 17, 25, 19, 60, 14, 27237, 7, 26638, 18009, 58, 17, 25, 19, 12962, 198, 2, 198, 2, 220, 220, 220, 220, 1303, 16488, 36949, 58, 72, 11, 47715, 796, 357, 34453, 4507, 324, 13, 26638, 58, 72, 11, 25, 12962, 9, 34453, 24331, 13, 26638, 58, 72, 11, 17, 25, 19, 60, 14, 27237, 7, 34453, 24331, 13, 26638, 58, 72, 11, 17, 25, 19, 4357, 17, 8, 198, 2, 198, 2, 220, 220, 220, 220, 1303, 16488, 36949, 58, 72, 11, 47715, 796, 7877, 844, 18009, 7, 34453, 4507, 324, 13, 26638, 58, 72, 11, 25, 4357, 34453, 24331, 13, 26638, 58, 72, 11, 25, 12962, 198, 2, 220, 220, 220, 220, 11454, 31554, 271, 58, 72, 11, 47715, 796, 16488, 36949, 58, 72, 11, 47715, 532, 16488, 198, 2, 220, 220, 220, 220, 11454, 31554, 271, 35393, 58, 72, 60, 796, 2593, 7, 22704, 36949, 58, 72, 11, 25, 4357, 17, 8, 532, 352, 13, 15, 198, 2, 886, 198, 2, 7110, 7, 83, 8890, 58, 17, 25, 437, 4357, 8056, 31554, 271, 35393, 58, 17, 25, 437, 12962, 198, 2, 7110, 21604, 7, 83, 8890, 11, 8056, 31554, 271, 8, 198 ]
1.893276
1,874
<reponame>UnofficialJuliaMirror/Octo.jl-16905944-f982-529b-abb2-b839f98f160b module test_octo_as using Test using Octo.Adapters.SQL # from to_sql @test to_sql([as(AVG(:n), :avg_n)]) == "AVG(n) AS avg_n" struct User end u = from(User) n = as(u.name, :n) @test to_sql([n]) == "name AS n" end # module test_octo_as
[ 27, 7856, 261, 480, 29, 3118, 16841, 16980, 544, 27453, 1472, 14, 12349, 78, 13, 20362, 12, 22172, 46712, 2598, 12, 69, 4089, 17, 12, 49721, 65, 12, 6485, 17, 12, 65, 23, 2670, 69, 4089, 69, 14198, 65, 198, 21412, 1332, 62, 38441, 78, 62, 292, 198, 198, 3500, 6208, 198, 3500, 2556, 78, 13, 2782, 12126, 13, 17861, 1303, 422, 284, 62, 25410, 198, 198, 31, 9288, 284, 62, 25410, 26933, 292, 7, 10116, 38, 7, 25, 77, 828, 1058, 615, 70, 62, 77, 8, 12962, 6624, 366, 10116, 38, 7, 77, 8, 7054, 42781, 62, 77, 1, 198, 198, 7249, 11787, 198, 437, 198, 198, 84, 796, 422, 7, 12982, 8, 198, 77, 796, 355, 7, 84, 13, 3672, 11, 1058, 77, 8, 198, 198, 31, 9288, 284, 62, 25410, 26933, 77, 12962, 6624, 366, 3672, 7054, 299, 1, 198, 198, 437, 1303, 8265, 1332, 62, 38441, 78, 62, 292, 198 ]
2.064935
154
using AppliSales using Test @testset "AppliSales.jl" begin orders = process() first_order = orders[1] second_order = orders[2] @test length(orders) == 3 @test first_order.org.name == "Scrooge Investment Bank" @test first_order.contact_name == "<NAME>" @test length(second_order.students) == 2 @test second_order.students[1] == "Mini Mouse" end
[ 3500, 2034, 4528, 44490, 198, 3500, 6208, 198, 198, 31, 9288, 2617, 366, 4677, 4528, 44490, 13, 20362, 1, 2221, 198, 220, 220, 220, 6266, 796, 1429, 3419, 198, 220, 220, 220, 717, 62, 2875, 796, 6266, 58, 16, 60, 198, 220, 220, 220, 1218, 62, 2875, 796, 6266, 58, 17, 60, 628, 220, 220, 220, 2488, 9288, 4129, 7, 6361, 8, 6624, 513, 198, 220, 220, 220, 2488, 9288, 717, 62, 2875, 13, 2398, 13, 3672, 6624, 366, 3351, 42407, 469, 20877, 5018, 1, 198, 220, 220, 220, 2488, 9288, 717, 62, 2875, 13, 32057, 62, 3672, 6624, 33490, 20608, 24618, 628, 220, 220, 220, 2488, 9288, 4129, 7, 12227, 62, 2875, 13, 19149, 658, 8, 6624, 362, 198, 220, 220, 220, 2488, 9288, 1218, 62, 2875, 13, 19149, 658, 58, 16, 60, 6624, 366, 39234, 21839, 1, 198, 437, 198 ]
2.669014
142
<reponame>ericjang/CircularArrays.jl type CircularArray{T,N} data::AbstractArray{T,N} cdim::Integer # dimension to cycle along cl::Integer # size of cycle dimension head::Integer # starting point of the array end # CONSTRUCTORS function CircularArray(A,cdim) if cdim > ndims(A) error("A does not have enough dimensions to be indexed along dimension $c_dim") end CircularArray(A,cdim,size(A,cdim),1) end function CircularArray(A) CircularArray(A,ndims(A)) end # helper function function circ_slice(A::CircularArray, index...) slice = vcat([A.head:A.cl],[1:A.head-1]) idx::Array{Any,1} = [i for i in index] # enables indexing by slicing, etc. idx[A.cdim] = slice[index[A.cdim]] return idx end # ACCESSOR # colons dont seem to work in native julia getindex, setindex function getindex(A::CircularArray, index...) idx = circ_slice(A,index...) getindex(A.data,idx...) end # MUTATORS function setindex!(A::CircularArray, newdata, index...) idx = circ_slice(A,index...) setindex!(A.data,newdata,idx...) end function advance_head!(A::CircularArray, offset::Integer) A.head += offset end function reset_head!(A::CircularArray) A.head = 1 end
[ 27, 7856, 261, 480, 29, 35626, 73, 648, 14, 31560, 934, 3163, 20477, 13, 20362, 198, 4906, 7672, 934, 19182, 90, 51, 11, 45, 92, 198, 197, 7890, 3712, 23839, 19182, 90, 51, 11, 45, 92, 198, 197, 10210, 320, 3712, 46541, 1303, 15793, 284, 6772, 1863, 198, 197, 565, 3712, 46541, 1303, 2546, 286, 6772, 15793, 198, 197, 2256, 3712, 46541, 1303, 3599, 966, 286, 262, 7177, 198, 437, 198, 198, 2, 7102, 46126, 20673, 198, 198, 8818, 7672, 934, 19182, 7, 32, 11, 10210, 320, 8, 198, 197, 361, 22927, 320, 1875, 299, 67, 12078, 7, 32, 8, 198, 197, 197, 18224, 7203, 32, 857, 407, 423, 1576, 15225, 284, 307, 41497, 1863, 15793, 720, 66, 62, 27740, 4943, 198, 197, 437, 198, 197, 31560, 934, 19182, 7, 32, 11, 10210, 320, 11, 7857, 7, 32, 11, 10210, 320, 828, 16, 8, 198, 437, 198, 198, 8818, 7672, 934, 19182, 7, 32, 8, 198, 197, 31560, 934, 19182, 7, 32, 11, 358, 12078, 7, 32, 4008, 198, 437, 198, 198, 2, 31904, 2163, 198, 8818, 2498, 62, 48369, 7, 32, 3712, 31560, 934, 19182, 11, 6376, 23029, 198, 197, 48369, 796, 410, 9246, 26933, 32, 13, 2256, 25, 32, 13, 565, 38430, 16, 25, 32, 13, 2256, 12, 16, 12962, 198, 197, 312, 87, 3712, 19182, 90, 7149, 11, 16, 92, 796, 685, 72, 329, 1312, 287, 6376, 60, 1303, 13536, 6376, 278, 416, 49289, 11, 3503, 13, 198, 197, 312, 87, 58, 32, 13, 10210, 320, 60, 796, 16416, 58, 9630, 58, 32, 13, 10210, 320, 11907, 198, 197, 7783, 4686, 87, 198, 437, 198, 198, 2, 15859, 7597, 1581, 198, 2, 951, 684, 17666, 1283, 284, 670, 287, 6868, 474, 43640, 651, 9630, 11, 900, 9630, 198, 8818, 651, 9630, 7, 32, 3712, 31560, 934, 19182, 11, 6376, 23029, 198, 197, 312, 87, 796, 2498, 62, 48369, 7, 32, 11, 9630, 23029, 198, 197, 1136, 9630, 7, 32, 13, 7890, 11, 312, 87, 23029, 198, 437, 628, 198, 198, 2, 337, 3843, 1404, 20673, 198, 8818, 900, 9630, 0, 7, 32, 3712, 31560, 934, 19182, 11, 649, 7890, 11, 6376, 23029, 198, 197, 312, 87, 796, 2498, 62, 48369, 7, 32, 11, 9630, 23029, 198, 197, 2617, 9630, 0, 7, 32, 13, 7890, 11, 3605, 7890, 11, 312, 87, 23029, 220, 198, 437, 198, 198, 8818, 5963, 62, 2256, 0, 7, 32, 3712, 31560, 934, 19182, 11, 11677, 3712, 46541, 8, 198, 197, 32, 13, 2256, 15853, 11677, 198, 437, 198, 198, 8818, 13259, 62, 2256, 0, 7, 32, 3712, 31560, 934, 19182, 8, 198, 197, 32, 13, 2256, 796, 352, 198, 437, 628 ]
2.659817
438
<filename>test/extract_domain_polyopt.jl # Test for the example https://github.com/JuliaOpt/SumOfSquares.jl/blob/master/examples/Polynomial_Optimization.ipynb using JuMP using SumOfSquares using MultivariateMoments @testset "Polynomial Optimization example with $(factory.constructor)" for factory in sdp_factories isscs(factory) && continue @polyvar x y p = x^3 - x^2 + 2x*y -y^2 + y^3 S = @set x >= 0 && y >= 0 && x + y >= 1 for (maxdeg, found) in [(3, false), (4, true), (5, true)] m = SOSModel(factory) @variable m α @objective m Max α c = @constraint m p >= α domain = S maxdegree = maxdeg JuMP.optimize!(m) @test JuMP.termination_status(m) == MOI.Success @test JuMP.objective_value(m) ≈ 0 atol=1e-4 for λ in lagrangian_multipliers(c) @test all(eigvals(Matrix(JuMP.value(λ).Q)) .>= -1e-2) end μ = JuMP.dual(c) X = certificate_monomials(c) ν = matmeasure(μ, X) ranktol = 1e-3 atoms = extractatoms(ν, ranktol) @test (atoms === nothing) == !found if atoms !== nothing η = atoms @test η.atoms[1].weight ≈ 1/2 atol=1e-2 @test η.atoms[2].weight ≈ 1/2 atol=1e-2 @test isapprox(η.atoms[1].center, [0, 1], atol=1e-2) || isapprox(η.atoms[1].center, [1, 0], atol=1e-2) @test isapprox(η.atoms[2].center, [0, 1], atol=1e-2) || isapprox(η.atoms[2].center, [1, 0], atol=1e-2) end end end
[ 27, 34345, 29, 9288, 14, 2302, 974, 62, 27830, 62, 35428, 8738, 13, 20362, 198, 2, 6208, 329, 262, 1672, 3740, 1378, 12567, 13, 785, 14, 16980, 544, 27871, 14, 13065, 5189, 22266, 3565, 13, 20362, 14, 2436, 672, 14, 9866, 14, 1069, 12629, 14, 34220, 26601, 498, 62, 27871, 320, 1634, 13, 541, 2047, 65, 198, 198, 3500, 12585, 7378, 198, 3500, 5060, 5189, 22266, 3565, 198, 3500, 7854, 42524, 29252, 658, 198, 198, 31, 9288, 2617, 366, 34220, 26601, 498, 30011, 1634, 1672, 351, 29568, 69, 9548, 13, 41571, 273, 16725, 329, 8860, 287, 264, 26059, 62, 22584, 1749, 198, 220, 220, 220, 1189, 6359, 7, 69, 9548, 8, 11405, 2555, 198, 220, 220, 220, 2488, 35428, 7785, 2124, 331, 198, 220, 220, 220, 279, 796, 2124, 61, 18, 532, 2124, 61, 17, 1343, 362, 87, 9, 88, 532, 88, 61, 17, 1343, 331, 61, 18, 198, 220, 220, 220, 311, 796, 2488, 2617, 2124, 18189, 657, 11405, 331, 18189, 657, 11405, 2124, 1343, 331, 18189, 352, 628, 220, 220, 220, 329, 357, 9806, 13500, 11, 1043, 8, 287, 47527, 18, 11, 3991, 828, 357, 19, 11, 2081, 828, 357, 20, 11, 2081, 15437, 198, 220, 220, 220, 220, 220, 220, 220, 285, 796, 42707, 17633, 7, 69, 9548, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 45286, 285, 26367, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 15252, 425, 285, 5436, 26367, 198, 220, 220, 220, 220, 220, 220, 220, 269, 796, 2488, 1102, 2536, 2913, 285, 279, 18189, 26367, 7386, 796, 311, 3509, 16863, 796, 3509, 13500, 628, 220, 220, 220, 220, 220, 220, 220, 12585, 7378, 13, 40085, 1096, 0, 7, 76, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 12585, 7378, 13, 41382, 62, 13376, 7, 76, 8, 6624, 13070, 40, 13, 33244, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 12585, 7378, 13, 15252, 425, 62, 8367, 7, 76, 8, 15139, 230, 657, 379, 349, 28, 16, 68, 12, 19, 628, 220, 220, 220, 220, 220, 220, 220, 329, 7377, 119, 287, 19470, 36985, 666, 62, 47945, 3183, 7, 66, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 477, 7, 68, 328, 12786, 7, 46912, 7, 33018, 7378, 13, 8367, 7, 39377, 737, 48, 4008, 764, 29, 28, 532, 16, 68, 12, 17, 8, 198, 220, 220, 220, 220, 220, 220, 220, 886, 628, 220, 220, 220, 220, 220, 220, 220, 18919, 796, 12585, 7378, 13, 646, 282, 7, 66, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1395, 796, 10703, 62, 2144, 296, 8231, 7, 66, 8, 198, 220, 220, 220, 220, 220, 220, 220, 7377, 121, 796, 2603, 1326, 5015, 7, 34703, 11, 1395, 8, 198, 220, 220, 220, 220, 220, 220, 220, 4279, 83, 349, 796, 352, 68, 12, 18, 198, 220, 220, 220, 220, 220, 220, 220, 23235, 796, 7925, 265, 3150, 7, 26180, 11, 4279, 83, 349, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 357, 265, 3150, 24844, 2147, 8, 6624, 5145, 9275, 198, 220, 220, 220, 220, 220, 220, 220, 611, 23235, 5145, 855, 2147, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7377, 115, 796, 23235, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 7377, 115, 13, 265, 3150, 58, 16, 4083, 6551, 15139, 230, 352, 14, 17, 379, 349, 28, 16, 68, 12, 17, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 7377, 115, 13, 265, 3150, 58, 17, 4083, 6551, 15139, 230, 352, 14, 17, 379, 349, 28, 16, 68, 12, 17, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 318, 1324, 13907, 7, 138, 115, 13, 265, 3150, 58, 16, 4083, 16159, 11, 685, 15, 11, 352, 4357, 379, 349, 28, 16, 68, 12, 17, 8, 8614, 318, 1324, 13907, 7, 138, 115, 13, 265, 3150, 58, 16, 4083, 16159, 11, 685, 16, 11, 657, 4357, 379, 349, 28, 16, 68, 12, 17, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 318, 1324, 13907, 7, 138, 115, 13, 265, 3150, 58, 17, 4083, 16159, 11, 685, 15, 11, 352, 4357, 379, 349, 28, 16, 68, 12, 17, 8, 8614, 318, 1324, 13907, 7, 138, 115, 13, 265, 3150, 58, 17, 4083, 16159, 11, 685, 16, 11, 657, 4357, 379, 349, 28, 16, 68, 12, 17, 8, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 886, 198, 437, 198 ]
1.971391
769
using LTC using Plots gr() using BenchmarkTools using DiffEqSensitivity using OrdinaryDiffEq using DiffEqFlux using GalacticOptim using Juno using Cthulhu using Profile #using PProf function generate_data() in_features = 2 out_features = 1 N = 48 data_x = [sin.(range(0,stop=3π,length=N)), cos.(range(0,stop=3π,length=N))] data_x = [reshape([Float32(data_x[1][i]),Float32(data_x[2][i])],2,1) for i in 1:N]# |> f32 data_y = [reshape([Float32(y)],1) for y in sin.(range(0,stop=6π,length=N))]# |> f32 #data_x = [repeat(x,1,20) for x in data_x] #data_y = [repeat(x,1,20) for x in data_y] data_x, data_y end function data(iter; data_x=nothing, data_y=nothing, short=false, noisy=false) #noisy_data = Vector{Tuple{Vector{Matrix{Float64}}, Vector{Vector{Float64}}}}([]) if data_y === nothing data_x, data_y = generate_data() end noisy_data = Vector{Tuple{Vector{Matrix{eltype(data_x[1])}}, Vector{Vector{eltype(data_y[1])}}}}([]) for i in 1:iter x = data_x y = data_y if short isa Array x = x[short[1]:short[2]] y = y[short[1]:short[2]] end push!(noisy_data, (x , noisy ? add_gauss.(y,0.02) : y)) end noisy_data end function loss(x,y,m::LTCNet{<:Mapper,<:Mapper,<:LTC.LTCCell,<:AbstractMatrix}) GalacticOptim.Flux.reset!(m) #m = re(θ) #ŷ = m.(x) #ŷ = map(xi -> m(xi)[end-m.cell.wiring.n_motor+1:end, :], x) ŷ = [m(xi)[end-m.cell.wiring.n_motor+1:end, :] for xi in x] #ŷ = m.(x) #length(ŷ) < length(y) && return Inf #sum(Flux.Losses.mse.(ŷ, y; agg=mean)) sum(sum([(ŷ[i][end,:] .- y[i]) .^ 2 for i in 1:length(y)]))/length(y)#, ŷ #sum([sum((ŷ[i] .- y[i]) .^ 2) for i in 1:length(y)])/length(y) end function cb(x,y,l,m) println(l) # pred = m.(x) # # isnan(l) && return false # fig = plot([ŷ[size(ŷ,1),1] for ŷ in pred]) # plot!(fig, [yi[size(yi,1),1] for yi in y]) # display(fig) return false end function traintest(n, solver=VCABM(), sensealg=InterpolatingAdjoint(autojacvec=ReverseDiffVJP(true))) function lg(p,x,y,model) # reset_state!(model,p) reset!(model) # d = train_data[1] # x,y = d[1], d[2] m = model ŷ = [m(xi,p)[end-m.cell.wiring.n_motor+1:end, :] for xi in x] #ŷ = m.(x,[p]) #losses = [Flux.Losses.mse(ŷ[i][end,:], y[i]) for i in 1:length(y)] #sum(losses)/length(losses), ŷ sum(sum([(ŷ[i][end,:] .- y[i]) .^ 2 for i in 1:length(y)]))/length(y), ŷ end cbg = function (p,l,pred;doplot=false) #callback function to observe training display(l) # plot current prediction against data if doplot fig = plot([ŷ[end,1] for ŷ in pred]) plot!(fig, [yi[end,1] for yi in y]) display(fig) end return false end x,y = generate_data() model = LTC.LTCNet(Wiring(2,1), solver, sensealg) #pp, re = Flux.destructure(model) # pp = DiffEqFlux.initial_params(model) # lower,upper = get_bounds(model) lower,upper = [],[] #θ = Flux.params(model) #θ = Flux.params(pp) pp = DiffEqFlux.initial_params(model) @show length(pp) @show length(pp) #@show sum(length.(θ)) @show length(lower) train_data = data(n) opt = GalacticOptim.Flux.Optimiser(ClipValue(0.5), ADAM(0.05)) # Juno.@profiler gs = Flux.Zygote.gradient(θ) do # loss(first(train_data)...,model) # end # @time gs = Flux.Zygote.gradient(θ) do # loss(first(train_data)...,model) # end # @time gs = Flux.Zygote.gradient(θ) do # loss(first(train_data)...,model) # end # # # Juno.@profiler train_loss, back = Flux.Zygote.pullback(() -> loss(x,y,model), θ) # Juno.@profiler gs = back(one(train_loss)) # train_loss, back = Flux.Zygote.pullback(() -> loss(x,y,model), θ) # gs = back(one(train_loss)) # @time train_loss, back = Flux.Zygote.pullback(() -> loss(x,y,model), θ) # @time gs = back(one(train_loss)) # use GalacticOptim.jl to solve the problem #adtype = GalacticOptim.AutoZygote() # #optf = GalacticOptim.OptimizationFunction((x, p) -> lg(x,model), adtype) #optfunc = GalacticOptim.instantiate_function(optf, model.cell.p, adtype, nothing) #optprob = GalacticOptim.OptimizationProblem(optfunc, model.cell.p, lb=lower, ub=upper) # #result_neuralode = GalacticOptim.solve(optprob, # ParticleSwarm(;lower,upper,n_particles=6), # cb = cbg, # maxiters = 300) ## #optfun = OptimizationFunction((x,p,dx,dy)->lg(x,dx,dy,model), GalacticOptim.AutoZygote()) #optprob = OptimizationProblem(optfun, θ[1], lb=lower, ub=upper) ##using IterTools: ncycle #res1 = GalacticOptim.solve(optprob, opt, train_data, cb = cbg, maxiters = n) #return res1 #Flux.train!((x,y) -> loss(x,y,model), θ, train_data, opt; cb) Profile.clear() Profile.clear_malloc_data() optfun = OptimizationFunction((θ, p, x, y) -> lg(θ,x,y,model), GalacticOptim.AutoZygote()) optprob = OptimizationProblem(optfun, pp) #using IterTools: ncycle #Juno.@profiler GalacticOptim.solve(optprob, opt, train_data, cb = cbg, maxiters = n) C = true GalacticOptim.solve(optprob, opt, train_data, cb = cbg, maxiters = 1000) # sciml_train(p->lg(p,model), pp, opt, cb = cbg, maxiters=100) #Juno.@profiler my_custom_train!(model, (x,y) -> loss(x,y,model), θ, train_data, opt; cb, lower, upper) C = true end function cthulu_test() m = LTC.LTCNet(Wiring(2,1), VCABM(), InterpolatingAdjoint(autojacvec=ReverseDiffVJP(true))) x = [rand(Float32,2,1) for _ in 1:10] p = initial_params(m) m.(x,[p]) @time m.(x,[p]) # @profile m.(x) #d = Dense(2,2) # r = RNN(2,2) # @descend_code_warntype r(x) #Flux.reset!(m) @descend_code_warntype m(x[1],p) end # cthulu_test() #Profile.print() # model = NCP(Wiring(2,1), VCABM(), InterpolatingAdjoint(autojacvec=ReverseDiffVJP(true))) # ppp = Flux.params(model) # sum(length.(ppp)) # Flux.trainable(model) #@time traintest(10, AutoTsit5(Rosenbrock23())) @time traintest(40) #@time traintest(10) #00:53 - 01:02 = 9 min compilation time #@time traintest(300, VCABM(), ForwardDiffSensitivity()) #@time traintest(300, VCABM(), ReverseDiffAdjoint()) # @time traintest(300, Euler(), ForwardDiffSensitivity()) #@time traintest(300, VCABM(), InterpolatingAdjoint(autojacvec=ReverseDiffVJP(true))) #@time traintest(300, VCABM(), InterpolatingAdjoint(autojacvec=false)) #@time traintest(300, VCABM(), InterpolatingAdjoint(autojacvec=ZygoteVJP())) #@time traintest(300, VCABM(), InterpolatingAdjoint(checkpointing=true)) #traintest(300, AutoTsit5(Rosenbrock23()), InterpolatingAdjoint(autojacvec=ReverseDiffVJP(true))) #@btime traintest(3, CVODE_BDF(linear_solver=:GMRES), InterpolatingAdjoint(autojacvec=ZygoteVJP())) #@time traintest(300, CVODE_BDF(linear_solver=:GMRES), InterpolatingAdjoint(autojacvec=ZygoteVJP())) #@time traintest(300, CVODE_BDF(linear_solver=:GMRES), InterpolatingAdjoint(autojacvec=ReverseDiffVJP(true))) # 601.084 ms (1153411 allocations: 98.26 MiB) # 8.510164 seconds (35.02 M allocations: 3.450 GiB, 5.96% gc time) #@time traintest(300, VCABM(), InterpolatingAdjoint(autojacvec=ReverseDiffVJP(true))) #@time traintest(3, AutoTsit5(Rosenbrock23()), InterpolatingAdjoint(autojacvec=ReverseDiffVJP(true))) #@time traintest(300, AutoTsit5(Rosenbrock23()), InterpolatingAdjoint(autojacvec=ReverseDiffVJP(true))) # 2.118 s (6965793 allocations: 461.57 MiB) #ltc = Flux.Chain(Dense(2,5),Flux.LSTM(5,5),Flux.Dense(5,1)) # Flux.reset!(ltc) # opt = GalacticOptim.Flux.Optimiser(ClipValue(0.1), ADAM(0.001)) # # my_custom_train!(ltc, (x,y) -> lossf(x,y)[1], Flux.params(ltc), data(3), opt; cb=()->cbf(data_x,data_y,ltc),lower,upper) # my_custom_train!(ltc, (x,y) -> lossf(x,y)[1], Flux.params(ltc), data(1000), opt; cb=()->cbf(data_x,data_y,ltc),lower,upper) # my_custom_train!(ltc, (x,y) -> lossf(x,y)[1], Flux.params(ltc), data(100), opt; data_range=[1,8], cb=()->cbf(data_x,data_y,ltc),lower,upper) # my_custom_train!(ltc, (x,y) -> lossf(x,y)[1], Flux.params(ltc), data(100), opt; data_range=[15,20], cb=()->cbf(data_x,data_y,ltc),lower,upper) # my_custom_train!(ltc, (x,y) -> lossf(x,y)[1], Flux.params(ltc), data(100), opt; data_range=[10,30], cb=()->cbf(data_x,data_y,ltc),lower,upper) # my_custom_train!(ltc, (x,y) -> lossf(x,y)[1], Flux.params(ltc), data(100), opt; data_range=[1,35], cb=()->cbf(data_x,data_y,ltc),lower,upper) # my_custom_train!(ltc, (x,y) -> lossf(x,y)[1], Flux.params(ltc), data(100, short=[1,20]), ADAM(0.001); cb=()->cbf(data_x,data_y,ltc),lower,upper) # my_custom_train!(ltc, (x,y) -> lossf(x,y)[1], Flux.params(ltc), data(100, short=[1,30]), ADAM(0.001); cb=()->cbf(data_x,data_y,ltc),lower,upper) # my_custom_train!(ltc, (x,y) -> lossf(x,y)[1], Flux.params(ltc), data(3000), ADAM(0.001); cb=()->cbf(data_x,data_y,ltc),lower,upper) # # Flux.train!((x,y)->lossf(x,y)[1],Flux.params(ltc),data(200),ADAM(0.02); cb = ()->cbf(data_x,data_y,ltc))
[ 3500, 406, 4825, 198, 3500, 1345, 1747, 198, 2164, 3419, 198, 3500, 25187, 4102, 33637, 198, 3500, 10631, 36, 80, 50, 40545, 198, 3500, 14230, 3219, 28813, 36, 80, 198, 3500, 10631, 36, 80, 37, 22564, 198, 3500, 23509, 27871, 320, 198, 3500, 49458, 198, 3500, 39316, 198, 3500, 13118, 198, 2, 3500, 350, 15404, 198, 198, 8818, 7716, 62, 7890, 3419, 198, 220, 220, 220, 287, 62, 40890, 796, 362, 198, 220, 220, 220, 503, 62, 40890, 796, 352, 198, 220, 220, 220, 399, 796, 4764, 198, 220, 220, 220, 1366, 62, 87, 796, 685, 31369, 12195, 9521, 7, 15, 11, 11338, 28, 18, 46582, 11, 13664, 28, 45, 36911, 8615, 12195, 9521, 7, 15, 11, 11338, 28, 18, 46582, 11, 13664, 28, 45, 4008, 60, 198, 220, 220, 220, 1366, 62, 87, 796, 685, 3447, 1758, 26933, 43879, 2624, 7, 7890, 62, 87, 58, 16, 7131, 72, 46570, 43879, 2624, 7, 7890, 62, 87, 58, 17, 7131, 72, 12962, 4357, 17, 11, 16, 8, 329, 1312, 287, 352, 25, 45, 60, 2, 930, 29, 277, 2624, 198, 220, 220, 220, 1366, 62, 88, 796, 685, 3447, 1758, 26933, 43879, 2624, 7, 88, 8, 4357, 16, 8, 329, 331, 287, 7813, 12195, 9521, 7, 15, 11, 11338, 28, 21, 46582, 11, 13664, 28, 45, 4008, 60, 2, 930, 29, 277, 2624, 628, 220, 220, 220, 1303, 7890, 62, 87, 796, 685, 44754, 7, 87, 11, 16, 11, 1238, 8, 329, 2124, 287, 1366, 62, 87, 60, 198, 220, 220, 220, 1303, 7890, 62, 88, 796, 685, 44754, 7, 87, 11, 16, 11, 1238, 8, 329, 2124, 287, 1366, 62, 88, 60, 628, 220, 220, 220, 1366, 62, 87, 11, 1366, 62, 88, 198, 437, 198, 198, 8818, 1366, 7, 2676, 26, 1366, 62, 87, 28, 22366, 11, 1366, 62, 88, 28, 22366, 11, 1790, 28, 9562, 11, 31210, 28, 9562, 8, 198, 220, 220, 220, 1303, 3919, 13560, 62, 7890, 796, 20650, 90, 51, 29291, 90, 38469, 90, 46912, 90, 43879, 2414, 92, 5512, 20650, 90, 38469, 90, 43879, 2414, 11709, 11709, 26933, 12962, 198, 220, 220, 220, 611, 1366, 62, 88, 24844, 2147, 198, 220, 220, 220, 220, 220, 1366, 62, 87, 11, 1366, 62, 88, 796, 7716, 62, 7890, 3419, 198, 220, 220, 220, 886, 198, 220, 220, 220, 31210, 62, 7890, 796, 20650, 90, 51, 29291, 90, 38469, 90, 46912, 90, 417, 4906, 7, 7890, 62, 87, 58, 16, 12962, 92, 5512, 20650, 90, 38469, 90, 417, 4906, 7, 7890, 62, 88, 58, 16, 12962, 11709, 11709, 26933, 12962, 198, 220, 220, 220, 329, 1312, 287, 352, 25, 2676, 198, 220, 220, 220, 220, 220, 220, 220, 2124, 796, 1366, 62, 87, 198, 220, 220, 220, 220, 220, 220, 220, 331, 796, 1366, 62, 88, 198, 220, 220, 220, 220, 220, 220, 220, 611, 1790, 318, 64, 15690, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2124, 796, 2124, 58, 19509, 58, 16, 5974, 19509, 58, 17, 11907, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 331, 796, 331, 58, 19509, 58, 16, 5974, 19509, 58, 17, 11907, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 4574, 0, 7, 3919, 13560, 62, 7890, 11, 357, 87, 837, 31210, 5633, 751, 62, 4908, 1046, 12195, 88, 11, 15, 13, 2999, 8, 1058, 331, 4008, 198, 220, 220, 220, 886, 198, 220, 220, 220, 31210, 62, 7890, 198, 437, 628, 198, 8818, 2994, 7, 87, 11, 88, 11, 76, 3712, 43, 4825, 7934, 90, 27, 25, 44, 11463, 11, 27, 25, 44, 11463, 11, 27, 25, 43, 4825, 13, 27734, 4093, 695, 11, 27, 25, 23839, 46912, 30072, 198, 220, 23509, 27871, 320, 13, 37, 22564, 13, 42503, 0, 7, 76, 8, 198, 220, 1303, 76, 796, 302, 7, 138, 116, 8, 198, 220, 1303, 129, 115, 796, 285, 12195, 87, 8, 198, 220, 1303, 129, 115, 796, 3975, 7, 29992, 4613, 285, 7, 29992, 38381, 437, 12, 76, 13, 3846, 13, 86, 3428, 13, 77, 62, 76, 20965, 10, 16, 25, 437, 11, 1058, 4357, 2124, 8, 198, 220, 25370, 115, 796, 685, 76, 7, 29992, 38381, 437, 12, 76, 13, 3846, 13, 86, 3428, 13, 77, 62, 76, 20965, 10, 16, 25, 437, 11, 1058, 60, 329, 2124, 72, 287, 2124, 60, 198, 220, 1303, 129, 115, 796, 285, 12195, 87, 8, 198, 220, 1303, 13664, 7, 129, 115, 8, 1279, 4129, 7, 88, 8, 11405, 1441, 4806, 198, 220, 1303, 16345, 7, 37, 22564, 13, 43, 793, 274, 13, 76, 325, 12195, 88, 136, 224, 11, 331, 26, 4194, 28, 32604, 4008, 198, 220, 2160, 7, 16345, 26933, 7, 129, 115, 58, 72, 7131, 437, 11, 47715, 764, 12, 331, 58, 72, 12962, 764, 61, 362, 329, 1312, 287, 352, 25, 13664, 7, 88, 15437, 4008, 14, 13664, 7, 88, 8, 2, 11, 25370, 115, 198, 220, 1303, 16345, 26933, 16345, 19510, 129, 115, 58, 72, 60, 764, 12, 331, 58, 72, 12962, 764, 61, 362, 8, 329, 1312, 287, 352, 25, 13664, 7, 88, 8, 12962, 14, 13664, 7, 88, 8, 198, 437, 198, 8818, 269, 65, 7, 87, 11, 88, 11, 75, 11, 76, 8, 198, 220, 44872, 7, 75, 8, 198, 220, 1303, 2747, 796, 285, 12195, 87, 8, 198, 220, 1303, 1303, 2125, 272, 7, 75, 8, 11405, 1441, 3991, 198, 220, 1303, 2336, 796, 7110, 26933, 129, 115, 58, 7857, 7, 129, 115, 11, 16, 828, 16, 60, 329, 25370, 115, 287, 2747, 12962, 198, 220, 1303, 7110, 0, 7, 5647, 11, 685, 48111, 58, 7857, 7, 48111, 11, 16, 828, 16, 60, 329, 331, 72, 287, 331, 12962, 198, 220, 1303, 3359, 7, 5647, 8, 198, 220, 1441, 3991, 198, 437, 198, 198, 8818, 491, 2913, 395, 7, 77, 11, 1540, 332, 28, 15922, 6242, 44, 22784, 2565, 14016, 28, 9492, 16104, 803, 2782, 73, 1563, 7, 2306, 13210, 330, 35138, 28, 49, 964, 325, 28813, 53, 12889, 7, 7942, 22305, 628, 220, 2163, 300, 70, 7, 79, 11, 87, 11, 88, 11, 19849, 8, 198, 220, 220, 220, 1303, 13259, 62, 5219, 0, 7, 19849, 11, 79, 8, 198, 220, 220, 220, 13259, 0, 7, 19849, 8, 198, 220, 220, 220, 1303, 288, 796, 4512, 62, 7890, 58, 16, 60, 198, 220, 220, 220, 1303, 2124, 11, 88, 796, 288, 58, 16, 4357, 288, 58, 17, 60, 198, 220, 220, 220, 285, 796, 2746, 198, 220, 220, 220, 25370, 115, 796, 685, 76, 7, 29992, 11, 79, 38381, 437, 12, 76, 13, 3846, 13, 86, 3428, 13, 77, 62, 76, 20965, 10, 16, 25, 437, 11, 1058, 60, 329, 2124, 72, 287, 2124, 60, 198, 220, 220, 220, 1303, 129, 115, 796, 285, 12195, 87, 17414, 79, 12962, 198, 220, 220, 220, 1303, 22462, 274, 796, 685, 37, 22564, 13, 43, 793, 274, 13, 76, 325, 7, 129, 115, 58, 72, 7131, 437, 11, 25, 4357, 331, 58, 72, 12962, 329, 1312, 287, 352, 25, 13664, 7, 88, 15437, 198, 220, 220, 220, 1303, 16345, 7, 22462, 274, 20679, 13664, 7, 22462, 274, 828, 25370, 115, 198, 220, 220, 220, 2160, 7, 16345, 26933, 7, 129, 115, 58, 72, 7131, 437, 11, 47715, 764, 12, 331, 58, 72, 12962, 764, 61, 362, 329, 1312, 287, 352, 25, 13664, 7, 88, 15437, 4008, 14, 13664, 7, 88, 828, 25370, 115, 198, 220, 886, 198, 220, 269, 35904, 796, 2163, 357, 79, 11, 75, 11, 28764, 26, 67, 20106, 313, 28, 9562, 8, 1303, 47423, 2163, 284, 12414, 3047, 198, 220, 220, 220, 3359, 7, 75, 8, 198, 220, 220, 220, 1303, 7110, 1459, 17724, 1028, 1366, 198, 220, 220, 220, 611, 288, 20106, 313, 198, 220, 220, 220, 220, 220, 2336, 796, 7110, 26933, 129, 115, 58, 437, 11, 16, 60, 329, 25370, 115, 287, 2747, 12962, 198, 220, 220, 220, 220, 220, 7110, 0, 7, 5647, 11, 685, 48111, 58, 437, 11, 16, 60, 329, 331, 72, 287, 331, 12962, 198, 220, 220, 220, 220, 220, 3359, 7, 5647, 8, 198, 220, 220, 220, 886, 198, 220, 220, 220, 1441, 3991, 198, 220, 886, 628, 220, 2124, 11, 88, 796, 7716, 62, 7890, 3419, 198, 220, 2746, 796, 406, 4825, 13, 43, 4825, 7934, 7, 54, 3428, 7, 17, 11, 16, 828, 1540, 332, 11, 2565, 14016, 8, 198, 220, 1303, 381, 11, 302, 796, 1610, 2821, 13, 16520, 5620, 7, 19849, 8, 198, 220, 1303, 9788, 796, 10631, 36, 80, 37, 22564, 13, 36733, 62, 37266, 7, 19849, 8, 198, 220, 1303, 2793, 11, 45828, 796, 651, 62, 65, 3733, 7, 19849, 8, 198, 220, 2793, 11, 45828, 796, 685, 4357, 21737, 198, 220, 1303, 138, 116, 796, 1610, 2821, 13, 37266, 7, 19849, 8, 198, 220, 1303, 138, 116, 796, 1610, 2821, 13, 37266, 7, 381, 8, 628, 220, 9788, 796, 10631, 36, 80, 37, 22564, 13, 36733, 62, 37266, 7, 19849, 8, 198, 220, 2488, 12860, 4129, 7, 381, 8, 198, 220, 2488, 12860, 4129, 7, 381, 8, 628, 220, 1303, 31, 12860, 2160, 7, 13664, 12195, 138, 116, 4008, 198, 220, 2488, 12860, 4129, 7, 21037, 8, 628, 220, 4512, 62, 7890, 796, 1366, 7, 77, 8, 628, 220, 2172, 796, 23509, 27871, 320, 13, 37, 22564, 13, 27871, 320, 5847, 7, 2601, 541, 11395, 7, 15, 13, 20, 828, 5984, 2390, 7, 15, 13, 2713, 4008, 628, 198, 220, 1303, 49458, 13, 31, 5577, 5329, 308, 82, 796, 1610, 2821, 13, 57, 35641, 1258, 13, 49607, 7, 138, 116, 8, 466, 198, 220, 1303, 220, 220, 2994, 7, 11085, 7, 27432, 62, 7890, 26513, 11, 19849, 8, 198, 220, 1303, 886, 198, 220, 1303, 2488, 2435, 220, 308, 82, 796, 1610, 2821, 13, 57, 35641, 1258, 13, 49607, 7, 138, 116, 8, 466, 198, 220, 1303, 220, 220, 2994, 7, 11085, 7, 27432, 62, 7890, 26513, 11, 19849, 8, 198, 220, 1303, 886, 198, 220, 1303, 2488, 2435, 220, 308, 82, 796, 1610, 2821, 13, 57, 35641, 1258, 13, 49607, 7, 138, 116, 8, 466, 198, 220, 1303, 220, 220, 2994, 7, 11085, 7, 27432, 62, 7890, 26513, 11, 19849, 8, 198, 220, 1303, 886, 198, 220, 1303, 198, 220, 1303, 198, 220, 1303, 49458, 13, 31, 5577, 5329, 4512, 62, 22462, 11, 736, 796, 1610, 2821, 13, 57, 35641, 1258, 13, 31216, 1891, 7, 3419, 4613, 2994, 7, 87, 11, 88, 11, 19849, 828, 7377, 116, 8, 198, 220, 1303, 49458, 13, 31, 5577, 5329, 308, 82, 796, 736, 7, 505, 7, 27432, 62, 22462, 4008, 198, 220, 1303, 4512, 62, 22462, 11, 736, 796, 1610, 2821, 13, 57, 35641, 1258, 13, 31216, 1891, 7, 3419, 4613, 2994, 7, 87, 11, 88, 11, 19849, 828, 7377, 116, 8, 198, 220, 1303, 308, 82, 796, 736, 7, 505, 7, 27432, 62, 22462, 4008, 198, 220, 1303, 2488, 2435, 4512, 62, 22462, 11, 736, 796, 1610, 2821, 13, 57, 35641, 1258, 13, 31216, 1891, 7, 3419, 4613, 2994, 7, 87, 11, 88, 11, 19849, 828, 7377, 116, 8, 198, 220, 1303, 2488, 2435, 308, 82, 796, 736, 7, 505, 7, 27432, 62, 22462, 4008, 628, 220, 1303, 779, 23509, 27871, 320, 13, 20362, 284, 8494, 262, 1917, 198, 220, 1303, 324, 4906, 796, 23509, 27871, 320, 13, 27722, 57, 35641, 1258, 3419, 198, 220, 1303, 198, 220, 1303, 8738, 69, 796, 23509, 27871, 320, 13, 27871, 320, 1634, 22203, 19510, 87, 11, 279, 8, 4613, 300, 70, 7, 87, 11, 19849, 828, 512, 4906, 8, 198, 220, 1303, 8738, 20786, 796, 23509, 27871, 320, 13, 8625, 415, 9386, 62, 8818, 7, 8738, 69, 11, 2746, 13, 3846, 13, 79, 11, 512, 4906, 11, 2147, 8, 198, 220, 1303, 8738, 1676, 65, 796, 23509, 27871, 320, 13, 27871, 320, 1634, 40781, 7, 8738, 20786, 11, 2746, 13, 3846, 13, 79, 11, 18360, 28, 21037, 11, 20967, 28, 45828, 8, 198, 220, 1303, 198, 220, 1303, 20274, 62, 710, 1523, 1098, 796, 23509, 27871, 320, 13, 82, 6442, 7, 8738, 1676, 65, 11, 198, 220, 1303, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2142, 1548, 10462, 1670, 7, 26, 21037, 11, 45828, 11, 77, 62, 3911, 2983, 28, 21, 828, 198, 220, 1303, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 269, 65, 796, 269, 35904, 11, 198, 220, 1303, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3509, 270, 364, 796, 5867, 8, 628, 628, 220, 22492, 198, 220, 1303, 8738, 12543, 796, 30011, 1634, 22203, 19510, 87, 11, 79, 11, 34350, 11, 9892, 8, 3784, 75, 70, 7, 87, 11, 34350, 11, 9892, 11, 19849, 828, 23509, 27871, 320, 13, 27722, 57, 35641, 1258, 28955, 198, 220, 1303, 8738, 1676, 65, 796, 30011, 1634, 40781, 7, 8738, 12543, 11, 7377, 116, 58, 16, 4357, 18360, 28, 21037, 11, 20967, 28, 45828, 8, 198, 220, 22492, 3500, 40806, 33637, 25, 299, 13696, 198, 220, 1303, 411, 16, 796, 23509, 27871, 320, 13, 82, 6442, 7, 8738, 1676, 65, 11, 2172, 11, 4512, 62, 7890, 11, 269, 65, 796, 269, 35904, 11, 3509, 270, 364, 796, 299, 8, 198, 220, 1303, 7783, 581, 16, 628, 220, 1303, 37, 22564, 13, 27432, 0, 19510, 87, 11, 88, 8, 4613, 2994, 7, 87, 11, 88, 11, 19849, 828, 7377, 116, 11, 4512, 62, 7890, 11, 2172, 26, 269, 65, 8, 628, 220, 13118, 13, 20063, 3419, 198, 220, 13118, 13, 20063, 62, 76, 32332, 62, 7890, 3419, 628, 220, 2172, 12543, 796, 30011, 1634, 22203, 19510, 138, 116, 11, 279, 11, 2124, 11, 331, 8, 4613, 300, 70, 7, 138, 116, 11, 87, 11, 88, 11, 19849, 828, 23509, 27871, 320, 13, 27722, 57, 35641, 1258, 28955, 198, 220, 2172, 1676, 65, 796, 30011, 1634, 40781, 7, 8738, 12543, 11, 9788, 8, 198, 220, 1303, 3500, 40806, 33637, 25, 299, 13696, 198, 220, 1303, 22396, 78, 13, 31, 5577, 5329, 23509, 27871, 320, 13, 82, 6442, 7, 8738, 1676, 65, 11, 2172, 11, 4512, 62, 7890, 11, 269, 65, 796, 269, 35904, 11, 3509, 270, 364, 796, 299, 8, 327, 796, 2081, 198, 220, 23509, 27871, 320, 13, 82, 6442, 7, 8738, 1676, 65, 11, 2172, 11, 4512, 62, 7890, 11, 269, 65, 796, 269, 35904, 11, 3509, 270, 364, 796, 8576, 8, 628, 628, 220, 1303, 629, 320, 75, 62, 27432, 7, 79, 3784, 75, 70, 7, 79, 11, 19849, 828, 9788, 11, 2172, 11, 269, 65, 796, 269, 35904, 11, 3509, 270, 364, 28, 3064, 8, 628, 628, 220, 1303, 22396, 78, 13, 31, 5577, 5329, 616, 62, 23144, 62, 27432, 0, 7, 19849, 11, 357, 87, 11, 88, 8, 4613, 2994, 7, 87, 11, 88, 11, 19849, 828, 7377, 116, 11, 4512, 62, 7890, 11, 2172, 26, 269, 65, 11, 2793, 11, 6727, 8, 327, 796, 2081, 198, 437, 628, 198, 198, 8818, 269, 400, 15712, 62, 9288, 3419, 628, 220, 285, 796, 406, 4825, 13, 43, 4825, 7934, 7, 54, 3428, 7, 17, 11, 16, 828, 26706, 6242, 44, 22784, 4225, 16104, 803, 2782, 73, 1563, 7, 2306, 13210, 330, 35138, 28, 49, 964, 325, 28813, 53, 12889, 7, 7942, 22305, 198, 220, 2124, 796, 685, 25192, 7, 43879, 2624, 11, 17, 11, 16, 8, 329, 4808, 287, 352, 25, 940, 60, 198, 220, 279, 796, 4238, 62, 37266, 7, 76, 8, 198, 220, 285, 12195, 87, 17414, 79, 12962, 198, 220, 2488, 2435, 285, 12195, 87, 17414, 79, 12962, 198, 220, 1303, 2488, 13317, 285, 12195, 87, 8, 198, 220, 1303, 67, 796, 360, 1072, 7, 17, 11, 17, 8, 198, 220, 1303, 374, 796, 371, 6144, 7, 17, 11, 17, 8, 198, 220, 1303, 2488, 20147, 437, 62, 8189, 62, 5767, 429, 2981, 374, 7, 87, 8, 198, 220, 1303, 37, 22564, 13, 42503, 0, 7, 76, 8, 198, 220, 2488, 20147, 437, 62, 8189, 62, 5767, 429, 2981, 285, 7, 87, 58, 16, 4357, 79, 8, 198, 437, 198, 2, 269, 400, 15712, 62, 9288, 3419, 198, 2, 37046, 13, 4798, 3419, 198, 198, 2, 2746, 796, 399, 8697, 7, 54, 3428, 7, 17, 11, 16, 828, 26706, 6242, 44, 22784, 4225, 16104, 803, 2782, 73, 1563, 7, 2306, 13210, 330, 35138, 28, 49, 964, 325, 28813, 53, 12889, 7, 7942, 22305, 198, 2, 279, 381, 796, 1610, 2821, 13, 37266, 7, 19849, 8, 198, 2, 2160, 7, 13664, 12195, 381, 79, 4008, 198, 2, 1610, 2821, 13, 27432, 540, 7, 19849, 8, 198, 198, 2, 31, 2435, 491, 2913, 395, 7, 940, 11, 11160, 33758, 270, 20, 7, 49, 5233, 7957, 694, 1954, 3419, 4008, 198, 31, 2435, 491, 2913, 395, 7, 1821, 8, 198, 2, 31, 2435, 491, 2913, 395, 7, 940, 8, 198, 2, 405, 25, 4310, 532, 5534, 25, 2999, 796, 860, 949, 23340, 640, 628, 198, 2, 31, 2435, 491, 2913, 395, 7, 6200, 11, 26706, 6242, 44, 22784, 19530, 28813, 50, 40545, 28955, 198, 2, 31, 2435, 491, 2913, 395, 7, 6200, 11, 26706, 6242, 44, 22784, 31849, 28813, 2782, 73, 1563, 28955, 198, 2, 2488, 2435, 491, 2913, 395, 7, 6200, 11, 412, 18173, 22784, 19530, 28813, 50, 40545, 28955, 198, 2, 31, 2435, 491, 2913, 395, 7, 6200, 11, 26706, 6242, 44, 22784, 4225, 16104, 803, 2782, 73, 1563, 7, 2306, 13210, 330, 35138, 28, 49, 964, 325, 28813, 53, 12889, 7, 7942, 22305, 198, 2, 31, 2435, 491, 2913, 395, 7, 6200, 11, 26706, 6242, 44, 22784, 4225, 16104, 803, 2782, 73, 1563, 7, 2306, 13210, 330, 35138, 28, 9562, 4008, 198, 2, 31, 2435, 491, 2913, 395, 7, 6200, 11, 26706, 6242, 44, 22784, 4225, 16104, 803, 2782, 73, 1563, 7, 2306, 13210, 330, 35138, 28, 57, 35641, 1258, 53, 12889, 3419, 4008, 198, 2, 31, 2435, 491, 2913, 395, 7, 6200, 11, 26706, 6242, 44, 22784, 4225, 16104, 803, 2782, 73, 1563, 7, 9122, 4122, 278, 28, 7942, 4008, 198, 2, 2213, 2913, 395, 7, 6200, 11, 11160, 33758, 270, 20, 7, 49, 5233, 7957, 694, 1954, 3419, 828, 4225, 16104, 803, 2782, 73, 1563, 7, 2306, 13210, 330, 35138, 28, 49, 964, 325, 28813, 53, 12889, 7, 7942, 22305, 198, 2, 31, 65, 2435, 491, 2913, 395, 7, 18, 11, 26196, 16820, 62, 33, 8068, 7, 29127, 62, 82, 14375, 28, 25, 38, 13599, 1546, 828, 4225, 16104, 803, 2782, 73, 1563, 7, 2306, 13210, 330, 35138, 28, 57, 35641, 1258, 53, 12889, 3419, 4008, 198, 2, 31, 2435, 491, 2913, 395, 7, 6200, 11, 26196, 16820, 62, 33, 8068, 7, 29127, 62, 82, 14375, 28, 25, 38, 13599, 1546, 828, 4225, 16104, 803, 2782, 73, 1563, 7, 2306, 13210, 330, 35138, 28, 57, 35641, 1258, 53, 12889, 3419, 4008, 198, 2, 31, 2435, 491, 2913, 395, 7, 6200, 11, 26196, 16820, 62, 33, 8068, 7, 29127, 62, 82, 14375, 28, 25, 38, 13599, 1546, 828, 4225, 16104, 803, 2782, 73, 1563, 7, 2306, 13210, 330, 35138, 28, 49, 964, 325, 28813, 53, 12889, 7, 7942, 22305, 198, 198, 2, 220, 49231, 13, 2919, 19, 13845, 357, 15363, 2682, 1157, 49157, 25, 9661, 13, 2075, 13756, 33, 8, 198, 2, 220, 807, 13, 4349, 486, 2414, 4201, 357, 2327, 13, 2999, 337, 49157, 25, 513, 13, 17885, 8118, 33, 11, 642, 13, 4846, 4, 308, 66, 640, 8, 198, 198, 2, 31, 2435, 491, 2913, 395, 7, 6200, 11, 26706, 6242, 44, 22784, 4225, 16104, 803, 2782, 73, 1563, 7, 2306, 13210, 330, 35138, 28, 49, 964, 325, 28813, 53, 12889, 7, 7942, 22305, 198, 198, 2, 31, 2435, 491, 2913, 395, 7, 18, 11, 11160, 33758, 270, 20, 7, 49, 5233, 7957, 694, 1954, 3419, 828, 4225, 16104, 803, 2782, 73, 1563, 7, 2306, 13210, 330, 35138, 28, 49, 964, 325, 28813, 53, 12889, 7, 7942, 22305, 198, 2, 31, 2435, 491, 2913, 395, 7, 6200, 11, 11160, 33758, 270, 20, 7, 49, 5233, 7957, 694, 1954, 3419, 828, 4225, 16104, 803, 2782, 73, 1563, 7, 2306, 13210, 330, 35138, 28, 49, 964, 325, 28813, 53, 12889, 7, 7942, 22305, 628, 198, 2, 220, 362, 13, 16817, 264, 357, 3388, 2996, 44750, 49157, 25, 604, 5333, 13, 3553, 13756, 33, 8, 198, 198, 2, 2528, 66, 796, 1610, 2821, 13, 35491, 7, 35, 1072, 7, 17, 11, 20, 828, 37, 22564, 13, 43, 2257, 44, 7, 20, 11, 20, 828, 37, 22564, 13, 35, 1072, 7, 20, 11, 16, 4008, 198, 198, 2, 1610, 2821, 13, 42503, 0, 7, 2528, 66, 8, 198, 2, 2172, 796, 23509, 27871, 320, 13, 37, 22564, 13, 27871, 320, 5847, 7, 2601, 541, 11395, 7, 15, 13, 16, 828, 5984, 2390, 7, 15, 13, 8298, 4008, 198, 2, 198, 2, 616, 62, 23144, 62, 27432, 0, 7, 2528, 66, 11, 357, 87, 11, 88, 8, 4613, 2994, 69, 7, 87, 11, 88, 38381, 16, 4357, 1610, 2821, 13, 37266, 7, 2528, 66, 828, 1366, 7, 18, 828, 2172, 26, 269, 65, 28, 3419, 3784, 66, 19881, 7, 7890, 62, 87, 11, 7890, 62, 88, 11, 2528, 66, 828, 21037, 11, 45828, 8, 198, 2, 616, 62, 23144, 62, 27432, 0, 7, 2528, 66, 11, 357, 87, 11, 88, 8, 4613, 2994, 69, 7, 87, 11, 88, 38381, 16, 4357, 1610, 2821, 13, 37266, 7, 2528, 66, 828, 1366, 7, 12825, 828, 2172, 26, 269, 65, 28, 3419, 3784, 66, 19881, 7, 7890, 62, 87, 11, 7890, 62, 88, 11, 2528, 66, 828, 21037, 11, 45828, 8, 198, 198, 2, 616, 62, 23144, 62, 27432, 0, 7, 2528, 66, 11, 357, 87, 11, 88, 8, 4613, 2994, 69, 7, 87, 11, 88, 38381, 16, 4357, 1610, 2821, 13, 37266, 7, 2528, 66, 828, 1366, 7, 3064, 828, 2172, 26, 1366, 62, 9521, 41888, 16, 11, 23, 4357, 269, 65, 28, 3419, 3784, 66, 19881, 7, 7890, 62, 87, 11, 7890, 62, 88, 11, 2528, 66, 828, 21037, 11, 45828, 8, 198, 2, 616, 62, 23144, 62, 27432, 0, 7, 2528, 66, 11, 357, 87, 11, 88, 8, 4613, 2994, 69, 7, 87, 11, 88, 38381, 16, 4357, 1610, 2821, 13, 37266, 7, 2528, 66, 828, 1366, 7, 3064, 828, 2172, 26, 1366, 62, 9521, 41888, 1314, 11, 1238, 4357, 269, 65, 28, 3419, 3784, 66, 19881, 7, 7890, 62, 87, 11, 7890, 62, 88, 11, 2528, 66, 828, 21037, 11, 45828, 8, 198, 2, 616, 62, 23144, 62, 27432, 0, 7, 2528, 66, 11, 357, 87, 11, 88, 8, 4613, 2994, 69, 7, 87, 11, 88, 38381, 16, 4357, 1610, 2821, 13, 37266, 7, 2528, 66, 828, 1366, 7, 3064, 828, 2172, 26, 1366, 62, 9521, 41888, 940, 11, 1270, 4357, 269, 65, 28, 3419, 3784, 66, 19881, 7, 7890, 62, 87, 11, 7890, 62, 88, 11, 2528, 66, 828, 21037, 11, 45828, 8, 198, 2, 616, 62, 23144, 62, 27432, 0, 7, 2528, 66, 11, 357, 87, 11, 88, 8, 4613, 2994, 69, 7, 87, 11, 88, 38381, 16, 4357, 1610, 2821, 13, 37266, 7, 2528, 66, 828, 1366, 7, 3064, 828, 2172, 26, 1366, 62, 9521, 41888, 16, 11, 2327, 4357, 269, 65, 28, 3419, 3784, 66, 19881, 7, 7890, 62, 87, 11, 7890, 62, 88, 11, 2528, 66, 828, 21037, 11, 45828, 8, 198, 2, 616, 62, 23144, 62, 27432, 0, 7, 2528, 66, 11, 357, 87, 11, 88, 8, 4613, 2994, 69, 7, 87, 11, 88, 38381, 16, 4357, 1610, 2821, 13, 37266, 7, 2528, 66, 828, 1366, 7, 3064, 11, 1790, 41888, 16, 11, 1238, 46570, 5984, 2390, 7, 15, 13, 8298, 1776, 269, 65, 28, 3419, 3784, 66, 19881, 7, 7890, 62, 87, 11, 7890, 62, 88, 11, 2528, 66, 828, 21037, 11, 45828, 8, 198, 2, 616, 62, 23144, 62, 27432, 0, 7, 2528, 66, 11, 357, 87, 11, 88, 8, 4613, 2994, 69, 7, 87, 11, 88, 38381, 16, 4357, 1610, 2821, 13, 37266, 7, 2528, 66, 828, 1366, 7, 3064, 11, 1790, 41888, 16, 11, 1270, 46570, 5984, 2390, 7, 15, 13, 8298, 1776, 269, 65, 28, 3419, 3784, 66, 19881, 7, 7890, 62, 87, 11, 7890, 62, 88, 11, 2528, 66, 828, 21037, 11, 45828, 8, 198, 2, 616, 62, 23144, 62, 27432, 0, 7, 2528, 66, 11, 357, 87, 11, 88, 8, 4613, 2994, 69, 7, 87, 11, 88, 38381, 16, 4357, 1610, 2821, 13, 37266, 7, 2528, 66, 828, 1366, 7, 23924, 828, 5984, 2390, 7, 15, 13, 8298, 1776, 269, 65, 28, 3419, 3784, 66, 19881, 7, 7890, 62, 87, 11, 7890, 62, 88, 11, 2528, 66, 828, 21037, 11, 45828, 8, 198, 2, 198, 2, 1610, 2821, 13, 27432, 0, 19510, 87, 11, 88, 8, 3784, 22462, 69, 7, 87, 11, 88, 38381, 16, 4357, 37, 22564, 13, 37266, 7, 2528, 66, 828, 7890, 7, 2167, 828, 2885, 2390, 7, 15, 13, 2999, 1776, 269, 65, 796, 7499, 3784, 66, 19881, 7, 7890, 62, 87, 11, 7890, 62, 88, 11, 2528, 66, 4008, 198 ]
2.129502
4,193
<filename>src/filetypes/cd.jl<gh_stars>0 function DataFrames.rename!(df, ::DataFile{Val{Symbol("C&D")}}) namemap = Dict("WE(1).Potential (V)"=>"Potential (V)", "Time (s)"=>"Other Time (s)", "Corrected time (s)"=>"Time (s)") rename!(df, namemap) end function find_pair(datafile, list, ending) findfirst(f -> filevalue(f) == filevalue(datafile) && foldervalue(f) == foldervalue(datafile) && endswith(f.filename, ending), list) end function add_CD(filename) parts = rsplit(filename, '.', limit=2) parts[1][1:end-1] * "CD." * parts[2] end function process_data(::Val{Symbol("C&D")}, data; insert_D, continue_col) done = Vector{Int}() for (i,f) in enumerate(data["C&D"]) if i in done continue else push!(done, i) df = read_file(f) valid_idx = setdiff(axes(data["C&D"], 1), done) pair_idx = find_pair(f, data["C&D"], endswith(f.filename, "_C") ? "_D" : "_C") if isnothing(pair_idx) if endswith(f.filename, "_D") pushfirst(df, insert_D) write_file(f, df, ';') end continue end f_pair = data["C&D"][pair_idx] push!(done, pair_idx) df_pair = read_file(f_pair) df_C, df_D = endswith(f.filename, "_C") ? (df, df_pair) : (df_pair, df) df_CD, df_D = postprocess(f, df_C, df_D, insert_D, continue_col) new_name = add_CD(f.savename) mergedf = DataFile{Val{Symbol("C&D")}}(f.filename, new_name, f.units, f.legend_units, f.idx) write_file(mergedf, df_CD, ';') write_file(endswith(f.filename, "_D") ? f : f_pair, df_D, ';') end end return nothing end function pushfirst(df, value) types = eltype.(eachcol(df)) line = (Vector{types[i]}([v]) for (i,v) in enumerate(value)) to_add = DataFrame(;zip(propertynames(df), line)...) append!(to_add, df) end function postprocess(datafile::DataFile{Val{Symbol("C&D")}}, df_C, df_D, value, cont_col) # Insert values in _D file df_D_mod = pushfirst(df_D, value) # Append column with types df_C[!, :Type] .= "C" df_D[!, :Type] .= "D" # Add last value of cont_col form _C to _D values last_time = df_C[end, cont_col] df_D[!, cont_col] .+= last_time # Append DataFrames append!(df_C, df_D) return df_C, df_D_mod end
[ 27, 34345, 29, 10677, 14, 7753, 19199, 14, 10210, 13, 20362, 27, 456, 62, 30783, 29, 15, 198, 8818, 6060, 35439, 13, 918, 480, 0, 7, 7568, 11, 7904, 6601, 8979, 90, 7762, 90, 13940, 23650, 7203, 34, 5, 35, 4943, 11709, 8, 198, 220, 220, 220, 299, 321, 368, 499, 796, 360, 713, 7203, 8845, 7, 16, 737, 25396, 1843, 357, 53, 16725, 14804, 1, 25396, 1843, 357, 53, 42501, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 7575, 357, 82, 16725, 14804, 1, 6395, 3862, 357, 82, 42501, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 42779, 276, 640, 357, 82, 16725, 14804, 1, 7575, 357, 82, 8, 4943, 198, 220, 220, 220, 36265, 0, 7, 7568, 11, 299, 321, 368, 499, 8, 198, 437, 198, 198, 8818, 1064, 62, 24874, 7, 7890, 7753, 11, 1351, 11, 7464, 8, 198, 220, 220, 220, 1064, 11085, 7, 69, 4613, 2393, 8367, 7, 69, 8, 6624, 2393, 8367, 7, 7890, 7753, 8, 11405, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5591, 712, 282, 518, 7, 69, 8, 6624, 5591, 712, 282, 518, 7, 7890, 7753, 8, 11405, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 2032, 342, 7, 69, 13, 34345, 11, 7464, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1351, 8, 198, 437, 198, 198, 8818, 751, 62, 8610, 7, 34345, 8, 198, 220, 220, 220, 3354, 796, 374, 35312, 7, 34345, 11, 705, 2637, 11, 4179, 28, 17, 8, 198, 220, 220, 220, 3354, 58, 16, 7131, 16, 25, 437, 12, 16, 60, 1635, 366, 8610, 526, 1635, 3354, 58, 17, 60, 198, 437, 198, 198, 8818, 1429, 62, 7890, 7, 3712, 7762, 90, 13940, 23650, 7203, 34, 5, 35, 4943, 5512, 1366, 26, 7550, 62, 35, 11, 2555, 62, 4033, 8, 198, 220, 220, 220, 1760, 796, 20650, 90, 5317, 92, 3419, 198, 220, 220, 220, 329, 357, 72, 11, 69, 8, 287, 27056, 378, 7, 7890, 14692, 34, 5, 35, 8973, 8, 198, 220, 220, 220, 220, 220, 220, 220, 611, 1312, 287, 1760, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2555, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4574, 0, 7, 28060, 11, 1312, 8, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 47764, 796, 1100, 62, 7753, 7, 69, 8, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4938, 62, 312, 87, 796, 900, 26069, 7, 897, 274, 7, 7890, 14692, 34, 5, 35, 33116, 352, 828, 1760, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5166, 62, 312, 87, 796, 1064, 62, 24874, 7, 69, 11, 1366, 14692, 34, 5, 35, 33116, 886, 2032, 342, 7, 69, 13, 34345, 11, 45434, 34, 4943, 5633, 45434, 35, 1, 1058, 45434, 34, 4943, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 318, 22366, 7, 24874, 62, 312, 87, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 886, 2032, 342, 7, 69, 13, 34345, 11, 45434, 35, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4574, 11085, 7, 7568, 11, 7550, 62, 35, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3551, 62, 7753, 7, 69, 11, 47764, 11, 705, 26, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2555, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 277, 62, 24874, 796, 1366, 14692, 34, 5, 35, 1, 7131, 24874, 62, 312, 87, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4574, 0, 7, 28060, 11, 5166, 62, 312, 87, 8, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 47764, 62, 24874, 796, 1100, 62, 7753, 7, 69, 62, 24874, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 47764, 62, 34, 11, 47764, 62, 35, 796, 886, 2032, 342, 7, 69, 13, 34345, 11, 45434, 34, 4943, 5633, 357, 7568, 11, 47764, 62, 24874, 8, 1058, 357, 7568, 62, 24874, 11, 47764, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 47764, 62, 8610, 11, 47764, 62, 35, 796, 1281, 14681, 7, 69, 11, 47764, 62, 34, 11, 47764, 62, 35, 11, 7550, 62, 35, 11, 2555, 62, 4033, 8, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 649, 62, 3672, 796, 751, 62, 8610, 7, 69, 13, 82, 4005, 480, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 23791, 69, 796, 6060, 8979, 90, 7762, 90, 13940, 23650, 7203, 34, 5, 35, 4943, 11709, 7, 69, 13, 34345, 11, 649, 62, 3672, 11, 277, 13, 41667, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 277, 13, 1455, 437, 62, 41667, 11, 277, 13, 312, 87, 8, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3551, 62, 7753, 7, 647, 2004, 69, 11, 47764, 62, 8610, 11, 705, 26, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3551, 62, 7753, 7, 437, 2032, 342, 7, 69, 13, 34345, 11, 45434, 35, 4943, 5633, 277, 1058, 277, 62, 24874, 11, 47764, 62, 35, 11, 705, 26, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 886, 628, 220, 220, 220, 1441, 2147, 198, 437, 198, 198, 8818, 4574, 11085, 7, 7568, 11, 1988, 8, 198, 220, 220, 220, 3858, 796, 1288, 4906, 12195, 27379, 4033, 7, 7568, 4008, 198, 220, 220, 220, 1627, 796, 357, 38469, 90, 19199, 58, 72, 48999, 26933, 85, 12962, 329, 357, 72, 11, 85, 8, 287, 27056, 378, 7, 8367, 4008, 198, 220, 220, 220, 284, 62, 2860, 796, 6060, 19778, 7, 26, 13344, 7, 26745, 14933, 7, 7568, 828, 1627, 8, 23029, 198, 220, 220, 220, 24443, 0, 7, 1462, 62, 2860, 11, 47764, 8, 198, 437, 198, 198, 8818, 1281, 14681, 7, 7890, 7753, 3712, 6601, 8979, 90, 7762, 90, 13940, 23650, 7203, 34, 5, 35, 4943, 92, 5512, 47764, 62, 34, 11, 47764, 62, 35, 11, 1988, 11, 542, 62, 4033, 8, 198, 220, 220, 220, 1303, 35835, 3815, 287, 4808, 35, 2393, 198, 220, 220, 220, 47764, 62, 35, 62, 4666, 796, 4574, 11085, 7, 7568, 62, 35, 11, 1988, 8, 198, 220, 220, 220, 1303, 2034, 437, 5721, 351, 3858, 198, 220, 220, 220, 47764, 62, 34, 58, 28265, 1058, 6030, 60, 764, 28, 366, 34, 1, 198, 220, 220, 220, 47764, 62, 35, 58, 28265, 1058, 6030, 60, 764, 28, 366, 35, 1, 198, 220, 220, 220, 1303, 3060, 938, 1988, 286, 542, 62, 4033, 1296, 4808, 34, 284, 4808, 35, 3815, 198, 220, 220, 220, 938, 62, 2435, 796, 47764, 62, 34, 58, 437, 11, 542, 62, 4033, 60, 198, 220, 220, 220, 47764, 62, 35, 58, 28265, 542, 62, 4033, 60, 764, 47932, 938, 62, 2435, 198, 220, 220, 220, 1303, 2034, 437, 6060, 35439, 198, 220, 220, 220, 24443, 0, 7, 7568, 62, 34, 11, 47764, 62, 35, 8, 198, 220, 220, 220, 1441, 47764, 62, 34, 11, 47764, 62, 35, 62, 4666, 198, 437, 198 ]
1.910861
1,335
# ========================================== # Cell - a single piece of table data # ========================================== """ A `Cell` is a single piece of data annotated by a column name """ immutable Cell{Name, ElType} data::ElType function Cell{T}(x::T) check_Cell(Val{Name},ElType) new(convert(ElType,x)) end end @compat @inline (::Type{Cell{Name}}){Name, ElType}(x::ElType) = Cell{Name,ElType}(x) Base.convert{Name, T1, T2}(::Type{Cell{Name, T2}}, x::Cell{Name,T1}) = Cell{Name,T2}(x.data) @generated function check_Cell{Name, ElType}(::Type{Val{Name}}, ::Type{ElType}) if !isa(Name, Symbol) return :(error("Field name $F should be a symbol")) elseif Name == :Row return :( error("Field name cannot be :Row") ) elseif !isa(ElType, DataType) return :(error("ElType $ElType should be a data type")) else return nothing end end @compat Base.:(==){Name}(cell1::Cell{Name}, cell2::Cell{Name}) = (cell1.data == cell2.data) @inline rename{Name1, Name2, ElType}(x::Cell{Name1, ElType}, ::Type{Val{Name2}}) = Cell{Name2, ElType}(x.data) @inline name{Name,ElType}(::Cell{Name,ElType}) = Name @inline name{Name}(::Type{Cell{Name}}) = Name @inline name{Name,ElType}(::Type{Cell{Name,ElType}}) = Name @inline Base.eltype{Name,ElType}(::Cell{Name,ElType}) = ElType @inline Base.eltype{Name,ElType}(::Type{Cell{Name,ElType}}) = ElType @inline Base.length{Name,ElType}(::Cell{Name,ElType}) = 1 @inline Base.length{Name,ElType}(::Type{Cell{Name,ElType}}) = 1 @inline nrow(::Cell) = 1 @inline ncol(::Cell) = 1 @inline ncol{C <: Cell}(::Type{C}) = 1 Base.getindex{Name}(c::Cell{Name}, ::Type{Val{Name}}) = c.data Base.getindex{Name1, Name2}(c::Cell{Name1}, ::Type{Val{Name2}}) = error("Tried to index cell of field name :$Name1 with field name :$Name2") Base.start(c::Cell) = false # Similar iterators as Julia scalars Base.next(c::Cell, i::Bool) = (c.data, true) Base.done(c::Cell, i::Bool) = i Base.endof(c::Cell) = 1 Base.getindex(c::Cell) = c.data Base.getindex(c::Cell, i::Integer) = ((i == 1) ? c.data : throw(BoundsError())) # This matches the behaviour of other scalars in Julia Base.getindex(c::Cell, ::Colon) = c Base.copy{F,ElType}(cell::Cell{F,ElType}) = Cell{F,ElType}(copy(cell.data)) # @Column and @Cell are very similar macro Cell(expr) if expr.head != :(=) && expr.head != :(kw) # strange Julia bug, see issue 7669 error("A Expecting expression like @Cell(name::Type = value) or @Cell(name = value)") end local field value = expr.args[2] if isa(expr.args[1], Symbol) name = expr.args[1] return :( TypedTables.Cell{$(QuoteNode(name))}($(esc(value))) ) elseif isa(expr.args[1],Expr) if expr.args[1].head != :(::) || length(expr.args[1].args) != 2 || !isa(expr.args[1].args[1], Symbol) error("B Expecting expression like @Cell(name::Type = value) or @Cell(name = value)") end name = expr.args[1].args[1] eltype = expr.args[1].args[2] field = :( TypedTables.Cell{$(QuoteNode(name)), $(esc(eltype))}($(esc(value))) ) else error("C Expecting expression like @Cell(name::Type = value) or @Cell(name = value)") end end
[ 2, 46111, 2559, 28, 198, 2, 220, 220, 220, 12440, 532, 257, 2060, 3704, 286, 3084, 1366, 198, 2, 46111, 2559, 28, 198, 198, 37811, 198, 32, 4600, 28780, 63, 318, 257, 2060, 3704, 286, 1366, 24708, 515, 416, 257, 5721, 1438, 198, 37811, 198, 8608, 18187, 12440, 90, 5376, 11, 2574, 6030, 92, 198, 220, 220, 220, 1366, 3712, 9527, 6030, 198, 220, 220, 220, 2163, 12440, 90, 51, 92, 7, 87, 3712, 51, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2198, 62, 28780, 7, 7762, 90, 5376, 5512, 9527, 6030, 8, 198, 220, 220, 220, 220, 220, 220, 220, 649, 7, 1102, 1851, 7, 9527, 6030, 11, 87, 4008, 198, 220, 220, 220, 886, 198, 437, 198, 31, 5589, 265, 2488, 45145, 357, 3712, 6030, 90, 28780, 90, 5376, 11709, 19953, 5376, 11, 2574, 6030, 92, 7, 87, 3712, 9527, 6030, 8, 796, 12440, 90, 5376, 11, 9527, 6030, 92, 7, 87, 8, 198, 198, 14881, 13, 1102, 1851, 90, 5376, 11, 309, 16, 11, 309, 17, 92, 7, 3712, 6030, 90, 28780, 90, 5376, 11, 309, 17, 92, 5512, 2124, 3712, 28780, 90, 5376, 11, 51, 16, 30072, 796, 12440, 90, 5376, 11, 51, 17, 92, 7, 87, 13, 7890, 8, 198, 198, 31, 27568, 2163, 2198, 62, 28780, 90, 5376, 11, 2574, 6030, 92, 7, 3712, 6030, 90, 7762, 90, 5376, 92, 5512, 7904, 6030, 90, 9527, 6030, 30072, 198, 220, 220, 220, 611, 5145, 9160, 7, 5376, 11, 38357, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 36147, 18224, 7203, 15878, 1438, 720, 37, 815, 307, 257, 6194, 48774, 198, 220, 220, 220, 2073, 361, 6530, 6624, 1058, 25166, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 36147, 4049, 7203, 15878, 1438, 2314, 307, 1058, 25166, 4943, 1267, 198, 220, 220, 220, 2073, 361, 5145, 9160, 7, 9527, 6030, 11, 6060, 6030, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 36147, 18224, 7203, 9527, 6030, 720, 9527, 6030, 815, 307, 257, 1366, 2099, 48774, 198, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2147, 198, 220, 220, 220, 886, 198, 437, 198, 198, 31, 5589, 265, 7308, 11207, 7, 855, 19953, 5376, 92, 7, 3846, 16, 3712, 28780, 90, 5376, 5512, 2685, 17, 3712, 28780, 90, 5376, 30072, 796, 357, 3846, 16, 13, 7890, 6624, 2685, 17, 13, 7890, 8, 198, 198, 31, 45145, 36265, 90, 5376, 16, 11, 6530, 17, 11, 2574, 6030, 92, 7, 87, 3712, 28780, 90, 5376, 16, 11, 2574, 6030, 5512, 7904, 6030, 90, 7762, 90, 5376, 17, 11709, 8, 796, 12440, 90, 5376, 17, 11, 2574, 6030, 92, 7, 87, 13, 7890, 8, 198, 198, 31, 45145, 1438, 90, 5376, 11, 9527, 6030, 92, 7, 3712, 28780, 90, 5376, 11, 9527, 6030, 30072, 796, 6530, 198, 31, 45145, 1438, 90, 5376, 92, 7, 3712, 6030, 90, 28780, 90, 5376, 11709, 8, 796, 6530, 198, 31, 45145, 1438, 90, 5376, 11, 9527, 6030, 92, 7, 3712, 6030, 90, 28780, 90, 5376, 11, 9527, 6030, 11709, 8, 796, 6530, 198, 31, 45145, 7308, 13, 417, 4906, 90, 5376, 11, 9527, 6030, 92, 7, 3712, 28780, 90, 5376, 11, 9527, 6030, 30072, 796, 2574, 6030, 198, 31, 45145, 7308, 13, 417, 4906, 90, 5376, 11, 9527, 6030, 92, 7, 3712, 6030, 90, 28780, 90, 5376, 11, 9527, 6030, 11709, 8, 796, 2574, 6030, 198, 31, 45145, 7308, 13, 13664, 90, 5376, 11, 9527, 6030, 92, 7, 3712, 28780, 90, 5376, 11, 9527, 6030, 30072, 796, 352, 198, 31, 45145, 7308, 13, 13664, 90, 5376, 11, 9527, 6030, 92, 7, 3712, 6030, 90, 28780, 90, 5376, 11, 9527, 6030, 11709, 8, 796, 352, 198, 198, 31, 45145, 299, 808, 7, 3712, 28780, 8, 796, 352, 198, 31, 45145, 299, 4033, 7, 3712, 28780, 8, 796, 352, 198, 31, 45145, 299, 4033, 90, 34, 1279, 25, 12440, 92, 7, 3712, 6030, 90, 34, 30072, 796, 352, 198, 198, 14881, 13, 1136, 9630, 90, 5376, 92, 7, 66, 3712, 28780, 90, 5376, 5512, 7904, 6030, 90, 7762, 90, 5376, 11709, 8, 796, 269, 13, 7890, 198, 14881, 13, 1136, 9630, 90, 5376, 16, 11, 6530, 17, 92, 7, 66, 3712, 28780, 90, 5376, 16, 5512, 7904, 6030, 90, 7762, 90, 5376, 17, 11709, 8, 796, 4049, 7203, 51, 2228, 284, 6376, 2685, 286, 2214, 1438, 1058, 3, 5376, 16, 351, 2214, 1438, 1058, 3, 5376, 17, 4943, 198, 198, 14881, 13, 9688, 7, 66, 3712, 28780, 8, 796, 3991, 1303, 11014, 11629, 2024, 355, 22300, 16578, 945, 198, 14881, 13, 19545, 7, 66, 3712, 28780, 11, 1312, 3712, 33, 970, 8, 796, 357, 66, 13, 7890, 11, 2081, 8, 198, 14881, 13, 28060, 7, 66, 3712, 28780, 11, 1312, 3712, 33, 970, 8, 796, 1312, 198, 14881, 13, 437, 1659, 7, 66, 3712, 28780, 8, 796, 352, 198, 198, 14881, 13, 1136, 9630, 7, 66, 3712, 28780, 8, 796, 269, 13, 7890, 198, 14881, 13, 1136, 9630, 7, 66, 3712, 28780, 11, 1312, 3712, 46541, 8, 796, 14808, 72, 6624, 352, 8, 5633, 269, 13, 7890, 1058, 3714, 7, 33, 3733, 12331, 3419, 4008, 1303, 770, 7466, 262, 9172, 286, 584, 16578, 945, 287, 22300, 198, 14881, 13, 1136, 9630, 7, 66, 3712, 28780, 11, 7904, 5216, 261, 8, 796, 269, 628, 198, 14881, 13, 30073, 90, 37, 11, 9527, 6030, 92, 7, 3846, 3712, 28780, 90, 37, 11, 9527, 6030, 30072, 796, 12440, 90, 37, 11, 9527, 6030, 92, 7, 30073, 7, 3846, 13, 7890, 4008, 198, 198, 2, 2488, 39470, 290, 2488, 28780, 389, 845, 2092, 198, 20285, 305, 12440, 7, 31937, 8, 198, 220, 220, 220, 611, 44052, 13, 2256, 14512, 36147, 28, 8, 11405, 44052, 13, 2256, 14512, 36147, 46265, 8, 1303, 6283, 22300, 5434, 11, 766, 2071, 767, 36657, 198, 220, 220, 220, 220, 220, 220, 220, 4049, 7203, 32, 23600, 278, 5408, 588, 2488, 28780, 7, 3672, 3712, 6030, 796, 1988, 8, 393, 2488, 28780, 7, 3672, 796, 1988, 8, 4943, 198, 220, 220, 220, 886, 198, 220, 220, 220, 1957, 2214, 198, 220, 220, 220, 1988, 796, 44052, 13, 22046, 58, 17, 60, 198, 220, 220, 220, 611, 318, 64, 7, 31937, 13, 22046, 58, 16, 4357, 38357, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1438, 796, 44052, 13, 22046, 58, 16, 60, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 36147, 17134, 276, 51, 2977, 13, 28780, 90, 3, 7, 25178, 19667, 7, 3672, 4008, 92, 16763, 7, 3798, 7, 8367, 22305, 1267, 198, 220, 220, 220, 2073, 361, 318, 64, 7, 31937, 13, 22046, 58, 16, 4357, 3109, 1050, 8, 198, 220, 220, 220, 220, 220, 220, 220, 611, 44052, 13, 22046, 58, 16, 4083, 2256, 14512, 36147, 3712, 8, 8614, 4129, 7, 31937, 13, 22046, 58, 16, 4083, 22046, 8, 14512, 362, 8614, 5145, 9160, 7, 31937, 13, 22046, 58, 16, 4083, 22046, 58, 16, 4357, 38357, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4049, 7203, 33, 23600, 278, 5408, 588, 2488, 28780, 7, 3672, 3712, 6030, 796, 1988, 8, 393, 2488, 28780, 7, 3672, 796, 1988, 8, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 1438, 796, 44052, 13, 22046, 58, 16, 4083, 22046, 58, 16, 60, 198, 220, 220, 220, 220, 220, 220, 220, 1288, 4906, 796, 44052, 13, 22046, 58, 16, 4083, 22046, 58, 17, 60, 198, 220, 220, 220, 220, 220, 220, 220, 2214, 796, 36147, 17134, 276, 51, 2977, 13, 28780, 90, 3, 7, 25178, 19667, 7, 3672, 36911, 29568, 3798, 7, 417, 4906, 4008, 92, 16763, 7, 3798, 7, 8367, 22305, 1267, 198, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 4049, 7203, 34, 23600, 278, 5408, 588, 2488, 28780, 7, 3672, 3712, 6030, 796, 1988, 8, 393, 2488, 28780, 7, 3672, 796, 1988, 8, 4943, 198, 220, 220, 220, 886, 198, 437, 198 ]
2.448485
1,320
export Portfolio function Portfolio(cbmo::Float64,mu::Vector, Q::Any,u::Vector{Float64}, kappa::Int64,z0::Vector{Float64} ;relax::Function=NL, t::Float64=0.0, n::Int64=5, tol::Float64=1e-6) c1=z->sum(z[1:n]);lc1=1.0;uc1=1.0; c2=z->sum(z[n+1:2*n]);lc2=n-kappa;uc2=Inf; c3=z->z[1:n].*z[n+1:2*n];lc3=-Inf*ones(n);uc3=zeros(n); #c3=z->sum(z[1:n].*z[n+1:2*n]);lc3=-Inf;uc3=zeros(1); c3=z->relax(z[1:n],z[n+1:2*n],t=t);lc3=-Inf*ones(n);uc3=zeros(n); cons=z->vcat(c1(z),c2(z),c3(z)); fobj=z->cbmo*sqrt(z[1:n]'*Q*z[1:n])-z[1:n]'*mu; lvar=zeros(2*n);uvar=vcat(u,ones(n)); mp=ADNLPModel(fobj, z0, lvar=lvar, uvar=uvar, c=cons, lcon=vcat(lc1,lc2,lc3), ucon=vcat(uc1,uc2,uc3)) return mp end function Portfolio(cbmo::Float64,mu::Vector, Q::Any,u::Vector{Float64}, kappa::Int64,z0::Vector{Float64}, tol::Float64=1e-6) n=size(Q,1) c1=z->sum(z[1:n]);lc1=1.0;uc1=1.0; c2=z->sum(z[n+1:2*n]);lc2=n-kappa;uc2=Inf; c3=z->z[1:n].*z[n+1:2*n];lc3=-Inf*ones(n);uc3=zeros(n); cons=z->vcat(c1(z),c2(z),c3(z)); fobj=z->cbmo*sqrt(z[1:n]'*Q*z[1:n])-z[1:n]'*mu; lvar=zeros(2*n);uvar=vcat(u,ones(n)); mp=ADNLPModel(fobj, z0, lvar=lvar, uvar=uvar, c=cons, lcon=vcat(lc1,lc2,lc3), ucon=vcat(uc1,uc2,uc3)) #ex1=JuMP.Model() #JuMP.@variable(ex1,x[1:2],start=1.0) #JuMP.@NLobjective(ex1,Min,x[1]-x[2]) #JuMP.@constraint(ex1,1-x[2]>=0) #ex1=MathProgNLPModel(ex1) #cG=z->z[1:n] #G=ADNLPModel(x->(), z0, c=cG, lcon=zeros(n)) #cH=z->z[n+1:2*n] #H=ADNLPModel(x->(), z0, c=cH, lcon=zeros(n)) G=JuMP.Model() JuMP.@variable(G,x[1:2*n],start=1.0) JuMP.@constraint(G,x[1:n].>=0) JuMP.@NLobjective(G,Min,0.0) G=MathProgNLPModel(G) H=JuMP.Model() JuMP.@variable(H,x[1:2*n],start=1.0) JuMP.@constraint(H,x[n+1:2*n].>=0) JuMP.@NLobjective(H,Min,0.0) H=MathProgNLPModel(H) return mp,G,H end
[ 39344, 4347, 13652, 198, 198, 8818, 4347, 13652, 7, 21101, 5908, 3712, 43879, 2414, 11, 30300, 3712, 38469, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1195, 3712, 7149, 11, 84, 3712, 38469, 90, 43879, 2414, 5512, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 479, 20975, 3712, 5317, 2414, 11, 89, 15, 3712, 38469, 90, 43879, 2414, 92, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2162, 2411, 897, 3712, 22203, 28, 32572, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 256, 3712, 43879, 2414, 28, 15, 13, 15, 11, 198, 197, 197, 220, 220, 299, 3712, 5317, 2414, 28, 20, 11, 198, 197, 197, 220, 220, 284, 75, 3712, 43879, 2414, 28, 16, 68, 12, 21, 8, 628, 197, 66, 16, 28, 89, 3784, 16345, 7, 89, 58, 16, 25, 77, 36563, 44601, 16, 28, 16, 13, 15, 26, 1229, 16, 28, 16, 13, 15, 26, 198, 197, 66, 17, 28, 89, 3784, 16345, 7, 89, 58, 77, 10, 16, 25, 17, 9, 77, 36563, 44601, 17, 28, 77, 12, 74, 20975, 26, 1229, 17, 28, 18943, 26, 198, 197, 66, 18, 28, 89, 3784, 89, 58, 16, 25, 77, 4083, 9, 89, 58, 77, 10, 16, 25, 17, 9, 77, 11208, 44601, 18, 10779, 18943, 9, 1952, 7, 77, 1776, 1229, 18, 28, 9107, 418, 7, 77, 1776, 198, 197, 2, 66, 18, 28, 89, 3784, 16345, 7, 89, 58, 16, 25, 77, 4083, 9, 89, 58, 77, 10, 16, 25, 17, 9, 77, 36563, 44601, 18, 10779, 18943, 26, 1229, 18, 28, 9107, 418, 7, 16, 1776, 198, 197, 66, 18, 28, 89, 3784, 2411, 897, 7, 89, 58, 16, 25, 77, 4357, 89, 58, 77, 10, 16, 25, 17, 9, 77, 4357, 83, 28, 83, 1776, 44601, 18, 10779, 18943, 9, 1952, 7, 77, 1776, 1229, 18, 28, 9107, 418, 7, 77, 1776, 198, 197, 5936, 28, 89, 3784, 85, 9246, 7, 66, 16, 7, 89, 828, 66, 17, 7, 89, 828, 66, 18, 7, 89, 18125, 198, 197, 69, 26801, 28, 89, 3784, 21101, 5908, 9, 31166, 17034, 7, 89, 58, 16, 25, 77, 49946, 9, 48, 9, 89, 58, 16, 25, 77, 12962, 12, 89, 58, 16, 25, 77, 49946, 9, 30300, 26, 198, 197, 6780, 283, 28, 9107, 418, 7, 17, 9, 77, 1776, 84, 7785, 28, 85, 9246, 7, 84, 11, 1952, 7, 77, 18125, 198, 197, 3149, 28, 2885, 45, 19930, 17633, 7, 69, 26801, 11, 1976, 15, 11, 300, 7785, 28, 6780, 283, 11, 334, 7785, 28, 84, 7785, 11, 269, 28, 5936, 11, 300, 1102, 28, 85, 9246, 7, 44601, 16, 11, 44601, 17, 11, 44601, 18, 828, 334, 1102, 28, 85, 9246, 7, 1229, 16, 11, 1229, 17, 11, 1229, 18, 4008, 628, 1441, 29034, 198, 437, 198, 198, 8818, 4347, 13652, 7, 21101, 5908, 3712, 43879, 2414, 11, 30300, 3712, 38469, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1195, 3712, 7149, 11, 84, 3712, 38469, 90, 43879, 2414, 5512, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 479, 20975, 3712, 5317, 2414, 11, 89, 15, 3712, 38469, 90, 43879, 2414, 5512, 198, 197, 197, 220, 220, 284, 75, 3712, 43879, 2414, 28, 16, 68, 12, 21, 8, 198, 197, 77, 28, 7857, 7, 48, 11, 16, 8, 628, 197, 66, 16, 28, 89, 3784, 16345, 7, 89, 58, 16, 25, 77, 36563, 44601, 16, 28, 16, 13, 15, 26, 1229, 16, 28, 16, 13, 15, 26, 198, 197, 66, 17, 28, 89, 3784, 16345, 7, 89, 58, 77, 10, 16, 25, 17, 9, 77, 36563, 44601, 17, 28, 77, 12, 74, 20975, 26, 1229, 17, 28, 18943, 26, 198, 197, 66, 18, 28, 89, 3784, 89, 58, 16, 25, 77, 4083, 9, 89, 58, 77, 10, 16, 25, 17, 9, 77, 11208, 44601, 18, 10779, 18943, 9, 1952, 7, 77, 1776, 1229, 18, 28, 9107, 418, 7, 77, 1776, 198, 197, 5936, 28, 89, 3784, 85, 9246, 7, 66, 16, 7, 89, 828, 66, 17, 7, 89, 828, 66, 18, 7, 89, 18125, 198, 197, 69, 26801, 28, 89, 3784, 21101, 5908, 9, 31166, 17034, 7, 89, 58, 16, 25, 77, 49946, 9, 48, 9, 89, 58, 16, 25, 77, 12962, 12, 89, 58, 16, 25, 77, 49946, 9, 30300, 26, 198, 197, 6780, 283, 28, 9107, 418, 7, 17, 9, 77, 1776, 84, 7785, 28, 85, 9246, 7, 84, 11, 1952, 7, 77, 18125, 198, 197, 3149, 28, 2885, 45, 19930, 17633, 7, 69, 26801, 11, 1976, 15, 11, 300, 7785, 28, 6780, 283, 11, 334, 7785, 28, 84, 7785, 11, 269, 28, 5936, 11, 300, 1102, 28, 85, 9246, 7, 44601, 16, 11, 44601, 17, 11, 44601, 18, 828, 334, 1102, 28, 85, 9246, 7, 1229, 16, 11, 1229, 17, 11, 1229, 18, 4008, 628, 197, 2, 1069, 16, 28, 33018, 7378, 13, 17633, 3419, 198, 197, 2, 33018, 7378, 13, 31, 45286, 7, 1069, 16, 11, 87, 58, 16, 25, 17, 4357, 9688, 28, 16, 13, 15, 8, 198, 197, 2, 33018, 7378, 13, 31, 32572, 15252, 425, 7, 1069, 16, 11, 9452, 11, 87, 58, 16, 45297, 87, 58, 17, 12962, 198, 197, 2, 33018, 7378, 13, 31, 1102, 2536, 2913, 7, 1069, 16, 11, 16, 12, 87, 58, 17, 60, 29, 28, 15, 8, 198, 197, 2, 1069, 16, 28, 37372, 2964, 70, 45, 19930, 17633, 7, 1069, 16, 8, 628, 197, 2, 66, 38, 28, 89, 3784, 89, 58, 16, 25, 77, 60, 198, 197, 2, 38, 28, 2885, 45, 19930, 17633, 7, 87, 3784, 22784, 1976, 15, 11, 269, 28, 66, 38, 11, 300, 1102, 28, 9107, 418, 7, 77, 4008, 198, 197, 2, 66, 39, 28, 89, 3784, 89, 58, 77, 10, 16, 25, 17, 9, 77, 60, 198, 197, 2, 39, 28, 2885, 45, 19930, 17633, 7, 87, 3784, 22784, 1976, 15, 11, 269, 28, 66, 39, 11, 300, 1102, 28, 9107, 418, 7, 77, 4008, 628, 197, 38, 28, 33018, 7378, 13, 17633, 3419, 198, 197, 33018, 7378, 13, 31, 45286, 7, 38, 11, 87, 58, 16, 25, 17, 9, 77, 4357, 9688, 28, 16, 13, 15, 8, 198, 197, 33018, 7378, 13, 31, 1102, 2536, 2913, 7, 38, 11, 87, 58, 16, 25, 77, 4083, 29, 28, 15, 8, 198, 197, 33018, 7378, 13, 31, 32572, 15252, 425, 7, 38, 11, 9452, 11, 15, 13, 15, 8, 198, 197, 38, 28, 37372, 2964, 70, 45, 19930, 17633, 7, 38, 8, 198, 197, 39, 28, 33018, 7378, 13, 17633, 3419, 198, 197, 33018, 7378, 13, 31, 45286, 7, 39, 11, 87, 58, 16, 25, 17, 9, 77, 4357, 9688, 28, 16, 13, 15, 8, 198, 197, 33018, 7378, 13, 31, 1102, 2536, 2913, 7, 39, 11, 87, 58, 77, 10, 16, 25, 17, 9, 77, 4083, 29, 28, 15, 8, 198, 197, 33018, 7378, 13, 31, 32572, 15252, 425, 7, 39, 11, 9452, 11, 15, 13, 15, 8, 198, 197, 39, 28, 37372, 2964, 70, 45, 19930, 17633, 7, 39, 8, 628, 1441, 29034, 11, 38, 11, 39, 198, 437, 628 ]
1.551417
1,235
function code_js(ex, A) cinfo = code_lowered(ex, A)[1] restructure(cinfo.code) end macro code_js(ex) isexpr(ex, :call) || error("@code_wasm f(xs...)") :(code_js($(esc(ex.args[1])), Tuple{$(map(_ -> Any, ex.args[2:end])...)})) end
[ 8818, 2438, 62, 8457, 7, 1069, 11, 317, 8, 198, 220, 269, 10951, 796, 2438, 62, 9319, 1068, 7, 1069, 11, 317, 38381, 16, 60, 198, 220, 1334, 5620, 7, 66, 10951, 13, 8189, 8, 198, 437, 198, 198, 20285, 305, 2438, 62, 8457, 7, 1069, 8, 198, 220, 318, 31937, 7, 1069, 11, 1058, 13345, 8, 8614, 4049, 7203, 31, 8189, 62, 86, 8597, 277, 7, 34223, 23029, 4943, 198, 220, 36147, 8189, 62, 8457, 16763, 7, 3798, 7, 1069, 13, 22046, 58, 16, 12962, 828, 309, 29291, 90, 3, 7, 8899, 28264, 4613, 4377, 11, 409, 13, 22046, 58, 17, 25, 437, 12962, 23029, 92, 4008, 198, 437, 198 ]
2.153153
111
<gh_stars>0 # --- # title: 1003. Check If Word Is Valid After Substitutions # id: problem1003 # author: <NAME> # date: 2020-10-31 # difficulty: Medium # categories: String, Stack # link: <https://leetcode.com/problems/check-if-word-is-valid-after-substitutions/description/> # hidden: true # --- # # Given a string `s`, determine if it is **valid**. # # A string `s` is **valid** if, starting with an empty string `t = ""`, you can # **transform**`t` **into**`s` after performing the following operation **any # number of times** : # # * Insert string `"abc"` into any position in `t`. More formally, `t` becomes `tleft + "abc" + tright`, where `t == tleft + tright`. Note that `tleft` and `tright` may be **empty**. # # Return `true` _if_`s` _is a **valid** string, otherwise, return_ `false`. # # # # **Example 1:** # # # # Input: s = "aabcbc" # Output: true # Explanation: # "" -> " _abc_ " -> "a _abc_ bc" # Thus, "aabcbc" is valid. # # **Example 2:** # # # # Input: s = "abcabcababcc" # Output: true # Explanation: # "" -> " _abc_ " -> "abc _abc_ " -> "abcabc _abc_ " -> "abcabcab _abc_ c" # Thus, "abcabcababcc" is valid. # # # **Example 3:** # # # # Input: s = "abccba" # Output: false # Explanation: It is impossible to get "abccba" using the operation. # # # **Example 4:** # # # # Input: s = "cababc" # Output: false # Explanation: It is impossible to get "cababc" using the operation. # # # # # **Constraints:** # # * `1 <= s.length <= 2 * 104` # * `s` consists of letters `'a'`, `'b'`, and `'c'` # # ## @lc code=start using LeetCode ## add your code here: ## @lc code=end
[ 27, 456, 62, 30783, 29, 15, 198, 2, 11420, 198, 2, 3670, 25, 1802, 18, 13, 6822, 1002, 9678, 1148, 48951, 2293, 24944, 270, 3508, 198, 2, 4686, 25, 1917, 3064, 18, 198, 2, 1772, 25, 1279, 20608, 29, 198, 2, 3128, 25, 12131, 12, 940, 12, 3132, 198, 2, 8722, 25, 13398, 198, 2, 9376, 25, 10903, 11, 23881, 198, 2, 2792, 25, 1279, 5450, 1378, 293, 316, 8189, 13, 785, 14, 1676, 22143, 14, 9122, 12, 361, 12, 4775, 12, 271, 12, 12102, 12, 8499, 12, 7266, 301, 270, 3508, 14, 11213, 15913, 198, 2, 7104, 25, 2081, 198, 2, 11420, 198, 2, 220, 198, 2, 11259, 257, 4731, 4600, 82, 47671, 5004, 611, 340, 318, 12429, 12102, 1174, 13, 198, 2, 220, 198, 2, 317, 4731, 4600, 82, 63, 318, 12429, 12102, 1174, 611, 11, 3599, 351, 281, 6565, 4731, 4600, 83, 796, 13538, 47671, 345, 460, 198, 2, 12429, 35636, 1174, 63, 83, 63, 12429, 20424, 1174, 63, 82, 63, 706, 9489, 262, 1708, 4905, 12429, 1092, 198, 2, 1271, 286, 1661, 1174, 1058, 198, 2, 220, 198, 2, 220, 220, 1635, 35835, 4731, 4600, 1, 39305, 1, 63, 656, 597, 2292, 287, 4600, 83, 44646, 3125, 15832, 11, 4600, 83, 63, 4329, 4600, 7100, 701, 1343, 366, 39305, 1, 1343, 491, 432, 47671, 810, 4600, 83, 6624, 256, 9464, 1343, 491, 432, 44646, 5740, 326, 4600, 7100, 701, 63, 290, 4600, 2213, 432, 63, 743, 307, 12429, 28920, 1174, 13, 198, 2, 220, 198, 2, 8229, 4600, 7942, 63, 4808, 361, 62, 63, 82, 63, 4808, 271, 257, 12429, 12102, 1174, 4731, 11, 4306, 11, 1441, 62, 4600, 9562, 44646, 198, 2, 220, 198, 2, 220, 198, 2, 220, 198, 2, 12429, 16281, 352, 25, 1174, 198, 2, 220, 198, 2, 220, 220, 220, 220, 220, 198, 2, 220, 220, 220, 220, 220, 198, 2, 220, 220, 220, 220, 23412, 25, 264, 796, 366, 64, 39305, 15630, 1, 198, 2, 220, 220, 220, 220, 25235, 25, 2081, 198, 2, 220, 220, 220, 220, 50125, 341, 25, 198, 2, 220, 220, 220, 220, 13538, 4613, 366, 4808, 39305, 62, 366, 4613, 366, 64, 4808, 39305, 62, 47125, 1, 198, 2, 220, 220, 220, 220, 6660, 11, 366, 64, 39305, 15630, 1, 318, 4938, 13, 198, 2, 220, 198, 2, 12429, 16281, 362, 25, 1174, 198, 2, 220, 198, 2, 220, 220, 220, 220, 220, 198, 2, 220, 220, 220, 220, 220, 198, 2, 220, 220, 220, 220, 23412, 25, 264, 796, 366, 39305, 39305, 397, 397, 535, 1, 198, 2, 220, 220, 220, 220, 25235, 25, 2081, 198, 2, 220, 220, 220, 220, 50125, 341, 25, 198, 2, 220, 220, 220, 220, 13538, 4613, 366, 4808, 39305, 62, 366, 4613, 366, 39305, 4808, 39305, 62, 366, 4613, 366, 39305, 39305, 4808, 39305, 62, 366, 4613, 366, 39305, 39305, 397, 4808, 39305, 62, 269, 1, 198, 2, 220, 220, 220, 220, 6660, 11, 366, 39305, 39305, 397, 397, 535, 1, 318, 4938, 13, 198, 2, 220, 220, 220, 220, 220, 198, 2, 220, 198, 2, 12429, 16281, 513, 25, 1174, 198, 2, 220, 198, 2, 220, 220, 220, 220, 220, 198, 2, 220, 220, 220, 220, 220, 198, 2, 220, 220, 220, 220, 23412, 25, 264, 796, 366, 397, 535, 7012, 1, 198, 2, 220, 220, 220, 220, 25235, 25, 3991, 198, 2, 220, 220, 220, 220, 50125, 341, 25, 632, 318, 5340, 284, 651, 366, 397, 535, 7012, 1, 1262, 262, 4905, 13, 198, 2, 220, 220, 220, 220, 220, 198, 2, 220, 198, 2, 12429, 16281, 604, 25, 1174, 198, 2, 220, 198, 2, 220, 220, 220, 220, 220, 198, 2, 220, 220, 220, 220, 220, 198, 2, 220, 220, 220, 220, 23412, 25, 264, 796, 366, 66, 397, 39305, 1, 198, 2, 220, 220, 220, 220, 25235, 25, 3991, 198, 2, 220, 220, 220, 220, 50125, 341, 25, 632, 318, 5340, 284, 651, 366, 66, 397, 39305, 1, 1262, 262, 4905, 13, 198, 2, 220, 220, 220, 220, 220, 198, 2, 220, 198, 2, 220, 198, 2, 220, 198, 2, 12429, 3103, 2536, 6003, 25, 1174, 198, 2, 220, 198, 2, 220, 220, 1635, 4600, 16, 19841, 264, 13, 13664, 19841, 362, 1635, 14436, 63, 198, 2, 220, 220, 1635, 4600, 82, 63, 10874, 286, 7475, 4600, 6, 64, 6, 47671, 4600, 6, 65, 6, 47671, 290, 4600, 6, 66, 6, 63, 198, 2, 220, 198, 2, 220, 198, 2235, 2488, 44601, 2438, 28, 9688, 198, 3500, 1004, 316, 10669, 198, 198, 2235, 751, 534, 2438, 994, 25, 198, 2235, 2488, 44601, 2438, 28, 437, 198 ]
2.270341
762
<gh_stars>10-100 export unary_operators, binary_operators, nary_operators, compute export AbstractExpression # Define abstract base type abstract type AbstractExpression end # Define Algebraic Operators include("abstract_operations.jl") # Define Domains include("abstract_domains.jl") # Define Fields include("abstract_fields.jl") # Define Data include("abstract_data.jl") # Define equations and systems include("abstract_equations.jl") # Define Wrapper functions and derivative utils include("abstract_utils.jl") # compute function compute(a::AbstractExpression) = throw(error("compute not defined for $(typeof(a))")) # Include Generic Evaluation Rules and Output Format and Exports for unary_operator in unary_operators b_name, b_symbol = Meta.parse.(unary_operator) @eval compute(a::$b_name{𝒮}) where {𝒮} = $b_symbol(compute(a.term)) @eval function Base.show(io::IO, operation::$b_name{𝒮}) where {𝒮} print(io, $b_symbol, "(", operation.term, ")") end @eval export $b_name end for binary_operator in binary_operators b_name, b_symbol = Meta.parse.(binary_operator) @eval compute(a::$b_name{𝒮, 𝒯}) where {𝒮, 𝒯} = $b_symbol(compute(a.term1), compute(a.term2)) @eval function Base.show(io::IO, operation::$b_name{𝒮, 𝒯}) where {𝒮, 𝒯} # print(io, "(", operation.term1, $b_symbol , operation.term2, ")") # clearly a great option color_numbers = [30:33, 65:69, 136:142, 202:207] choices = collect(Iterators.flatten(color_numbers)) color = 226 # rand(choices) printstyled(io, "(", color = color) print(io, operation.term1) printstyled(io, $b_symbol, color = color ) print(io, operation.term2) printstyled(io, ")", color = color) end @eval export $b_name end for nary_operator in nary_operators b_name, b_symbol = Meta.parse.(nary_operator) @eval compute(a::$b_name{𝒮}) where {𝒮} = $b_symbol(compute.(a.terms)...) @eval function Base.show(io::IO, operation::$b_name{𝒮}) where {𝒮} print(io, $b_symbol, "(" ) for term in operation.terms print(io, term, ",") end print(io, "0)") end @eval export $b_name end
[ 27, 456, 62, 30783, 29, 940, 12, 3064, 198, 39344, 555, 560, 62, 3575, 2024, 11, 13934, 62, 3575, 2024, 11, 299, 560, 62, 3575, 2024, 11, 24061, 198, 39344, 27741, 16870, 2234, 198, 198, 2, 2896, 500, 12531, 2779, 2099, 198, 397, 8709, 2099, 27741, 16870, 2234, 886, 198, 198, 2, 2896, 500, 978, 29230, 291, 6564, 2024, 198, 17256, 7203, 397, 8709, 62, 3575, 602, 13, 20362, 4943, 198, 198, 2, 2896, 500, 9666, 1299, 198, 17256, 7203, 397, 8709, 62, 3438, 1299, 13, 20362, 4943, 198, 198, 2, 2896, 500, 23948, 198, 17256, 7203, 397, 8709, 62, 25747, 13, 20362, 4943, 198, 198, 2, 2896, 500, 6060, 198, 17256, 7203, 397, 8709, 62, 7890, 13, 20362, 4943, 198, 198, 2, 2896, 500, 27490, 290, 3341, 198, 17256, 7203, 397, 8709, 62, 4853, 602, 13, 20362, 4943, 198, 198, 2, 2896, 500, 27323, 2848, 5499, 290, 27255, 3384, 4487, 198, 17256, 7203, 397, 8709, 62, 26791, 13, 20362, 4943, 198, 198, 2, 24061, 2163, 198, 5589, 1133, 7, 64, 3712, 23839, 16870, 2234, 8, 796, 3714, 7, 18224, 7203, 5589, 1133, 407, 5447, 329, 29568, 4906, 1659, 7, 64, 4008, 48774, 198, 198, 2, 40348, 42044, 34959, 14252, 290, 25235, 18980, 290, 1475, 3742, 198, 1640, 555, 560, 62, 46616, 287, 555, 560, 62, 3575, 2024, 198, 220, 220, 220, 275, 62, 3672, 11, 275, 62, 1837, 23650, 796, 30277, 13, 29572, 12195, 403, 560, 62, 46616, 8, 198, 220, 220, 220, 2488, 18206, 24061, 7, 64, 3712, 3, 65, 62, 3672, 90, 47728, 240, 106, 30072, 810, 1391, 47728, 240, 106, 92, 796, 720, 65, 62, 1837, 23650, 7, 5589, 1133, 7, 64, 13, 4354, 4008, 198, 220, 220, 220, 2488, 18206, 2163, 7308, 13, 12860, 7, 952, 3712, 9399, 11, 4905, 3712, 3, 65, 62, 3672, 90, 47728, 240, 106, 30072, 810, 1391, 47728, 240, 106, 92, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 7, 952, 11, 720, 65, 62, 1837, 23650, 11, 30629, 1600, 4905, 13, 4354, 11, 366, 8, 4943, 198, 220, 220, 220, 886, 198, 220, 220, 220, 2488, 18206, 10784, 720, 65, 62, 3672, 198, 437, 198, 198, 1640, 13934, 62, 46616, 287, 13934, 62, 3575, 2024, 198, 220, 220, 220, 275, 62, 3672, 11, 275, 62, 1837, 23650, 796, 30277, 13, 29572, 12195, 39491, 62, 46616, 8, 198, 220, 220, 220, 2488, 18206, 24061, 7, 64, 3712, 3, 65, 62, 3672, 90, 47728, 240, 106, 11, 220, 47728, 240, 107, 30072, 810, 1391, 47728, 240, 106, 11, 220, 47728, 240, 107, 92, 796, 720, 65, 62, 1837, 23650, 7, 5589, 1133, 7, 64, 13, 4354, 16, 828, 24061, 7, 64, 13, 4354, 17, 4008, 198, 220, 220, 220, 2488, 18206, 2163, 7308, 13, 12860, 7, 952, 3712, 9399, 11, 4905, 3712, 3, 65, 62, 3672, 90, 47728, 240, 106, 11, 220, 47728, 240, 107, 30072, 810, 1391, 47728, 240, 106, 11, 220, 47728, 240, 107, 92, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 3601, 7, 952, 11, 30629, 1600, 4905, 13, 4354, 16, 11, 720, 65, 62, 1837, 23650, 837, 4905, 13, 4354, 17, 11, 366, 8, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 4084, 257, 1049, 3038, 198, 220, 220, 220, 220, 220, 220, 220, 3124, 62, 77, 17024, 796, 685, 1270, 25, 2091, 11, 6135, 25, 3388, 11, 21056, 25, 23726, 11, 22131, 25, 22745, 60, 198, 220, 220, 220, 220, 220, 220, 220, 7747, 796, 2824, 7, 29993, 2024, 13, 2704, 41769, 7, 8043, 62, 77, 17024, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 3124, 796, 31510, 1303, 43720, 7, 6679, 1063, 8, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 34365, 992, 7, 952, 11, 30629, 1600, 3124, 796, 3124, 8, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 7, 952, 11, 4905, 13, 4354, 16, 8, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 34365, 992, 7, 952, 11, 720, 65, 62, 1837, 23650, 11, 3124, 796, 3124, 1267, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 7, 952, 11, 220, 4905, 13, 4354, 17, 8, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 34365, 992, 7, 952, 11, 366, 42501, 3124, 796, 3124, 8, 198, 220, 220, 220, 886, 198, 220, 220, 220, 2488, 18206, 10784, 720, 65, 62, 3672, 198, 437, 198, 198, 1640, 299, 560, 62, 46616, 287, 299, 560, 62, 3575, 2024, 198, 220, 220, 220, 275, 62, 3672, 11, 275, 62, 1837, 23650, 796, 30277, 13, 29572, 12195, 77, 560, 62, 46616, 8, 198, 220, 220, 220, 2488, 18206, 24061, 7, 64, 3712, 3, 65, 62, 3672, 90, 47728, 240, 106, 30072, 810, 1391, 47728, 240, 106, 92, 796, 720, 65, 62, 1837, 23650, 7, 5589, 1133, 12195, 64, 13, 38707, 8, 23029, 198, 220, 220, 220, 2488, 18206, 2163, 7308, 13, 12860, 7, 952, 3712, 9399, 11, 4905, 3712, 3, 65, 62, 3672, 90, 47728, 240, 106, 30072, 810, 1391, 47728, 240, 106, 92, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 7, 952, 11, 720, 65, 62, 1837, 23650, 11, 366, 7203, 1267, 198, 220, 220, 220, 220, 220, 220, 220, 329, 3381, 287, 4905, 13, 38707, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 7, 952, 11, 3381, 11, 366, 553, 8, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 7, 952, 11, 366, 15, 8, 4943, 198, 220, 220, 220, 886, 198, 220, 220, 220, 2488, 18206, 10784, 720, 65, 62, 3672, 198, 437, 198 ]
2.372845
928
# https://adventofcode.com/2020/day/9 # XMAS starts by transmitting a preamble of 25 numbers. After that, each number # you receive should be the sum of any two of the 25 immediately previous numbers. # The two numbers will have different values, and there might be more than one # such pair. function is_xmas_seq(numbers; preamble_size=25) number = numbers[end] preamble = sort(numbers[(end - preamble_size):(end - 1)], rev=true) @assert length(preamble) == preamble_size for (i, x) in enumerate(preamble) if x > number continue end if (number - x) in preamble[(i + 1):end] return true end end return false end @assert is_xmas_seq([1:25; 26]) @assert is_xmas_seq([1:25; 6]) @assert is_xmas_seq([1:25; 49]) @assert !is_xmas_seq([1:25; 100]) @assert !is_xmas_seq([1:25; 50]) @assert !is_xmas_seq([1:25; 2]) function read_array(string::AbstractString)::Vector{Int} return parse.(Int, split(string, '\n', keepempty=false)) end example = read_array(" 35 20 15 25 47 40 62 55 65 95 102 117 150 182 127 219 299 277 309 576 ") function find_first_invalid(numbers; preamble_size=25) for pos = (preamble_size + 1):length(numbers) if !is_xmas_seq(numbers[1:pos], preamble_size=preamble_size) return numbers[pos], pos end end end @assert find_first_invalid([1:25; 100]) == (100, 26) @assert find_first_invalid([1:25; 27; 100]) == (100, 27) @assert find_first_invalid(example, preamble_size=5) == (127, 15) function part1(numbers) number, _ = find_first_invalid(numbers) return number end function sum_until(numbers, target) tot = numbers[1] for i = 2:length(numbers) tot += numbers[i] if tot == target return numbers[1:i] end end return nothing end @assert sum_until(1:10, 10) == [1:4;] @assert isnothing(sum_until(1:10, 100)) function find_weak_sequence(numbers; preamble_size=25) number, pos = find_first_invalid(numbers, preamble_size=preamble_size) for (i, x) in enumerate(numbers) if i == pos break end weak_sequence = sum_until(numbers[i:(pos - 1)], number) if !isnothing(weak_sequence) return weak_sequence end end end @assert find_weak_sequence(example, preamble_size=5) == [15, 25, 47, 40] function part2(numbers; preamble_size=25) weak_sequence = find_weak_sequence(numbers, preamble_size=preamble_size) return minimum(weak_sequence) + maximum(weak_sequence) end @assert part2(example, preamble_size=5) == 62 test = read_array(read("data/day-09.txt", String)) println("Part 1: $(result1 = part1(test))") println("Part 2: $(result2 = part2(test))") @assert result1 == 25918798 @assert result2 == 3340942
[ 198, 2, 3740, 1378, 324, 1151, 1659, 8189, 13, 785, 14, 42334, 14, 820, 14, 24, 198, 198, 2, 1395, 31180, 4940, 416, 39573, 257, 662, 321, 903, 286, 1679, 3146, 13, 2293, 326, 11, 1123, 1271, 198, 2, 345, 3328, 815, 307, 262, 2160, 286, 597, 734, 286, 262, 1679, 3393, 2180, 3146, 13, 198, 2, 383, 734, 3146, 481, 423, 1180, 3815, 11, 290, 612, 1244, 307, 517, 621, 530, 198, 2, 884, 5166, 13, 198, 198, 8818, 318, 62, 87, 5356, 62, 41068, 7, 77, 17024, 26, 662, 321, 903, 62, 7857, 28, 1495, 8, 198, 220, 220, 220, 1271, 796, 3146, 58, 437, 60, 198, 220, 220, 220, 662, 321, 903, 796, 3297, 7, 77, 17024, 58, 7, 437, 532, 662, 321, 903, 62, 7857, 2599, 7, 437, 532, 352, 8, 4357, 2710, 28, 7942, 8, 198, 220, 220, 220, 2488, 30493, 4129, 7, 79, 1476, 903, 8, 6624, 662, 321, 903, 62, 7857, 628, 220, 220, 220, 329, 357, 72, 11, 2124, 8, 287, 27056, 378, 7, 79, 1476, 903, 8, 198, 220, 220, 220, 220, 220, 220, 220, 611, 2124, 1875, 1271, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2555, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 611, 357, 17618, 532, 2124, 8, 287, 662, 321, 903, 58, 7, 72, 1343, 352, 2599, 437, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 2081, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 886, 198, 220, 220, 220, 1441, 3991, 198, 437, 198, 198, 31, 30493, 318, 62, 87, 5356, 62, 41068, 26933, 16, 25, 1495, 26, 2608, 12962, 198, 31, 30493, 318, 62, 87, 5356, 62, 41068, 26933, 16, 25, 1495, 26, 718, 12962, 198, 31, 30493, 318, 62, 87, 5356, 62, 41068, 26933, 16, 25, 1495, 26, 5125, 12962, 198, 31, 30493, 5145, 271, 62, 87, 5356, 62, 41068, 26933, 16, 25, 1495, 26, 1802, 12962, 198, 31, 30493, 5145, 271, 62, 87, 5356, 62, 41068, 26933, 16, 25, 1495, 26, 2026, 12962, 198, 31, 30493, 5145, 271, 62, 87, 5356, 62, 41068, 26933, 16, 25, 1495, 26, 362, 12962, 198, 198, 8818, 1100, 62, 18747, 7, 8841, 3712, 23839, 10100, 2599, 25, 38469, 90, 5317, 92, 198, 220, 220, 220, 1441, 21136, 12195, 5317, 11, 6626, 7, 8841, 11, 705, 59, 77, 3256, 1394, 28920, 28, 9562, 4008, 198, 437, 198, 198, 20688, 796, 1100, 62, 18747, 7203, 198, 2327, 198, 1238, 198, 1314, 198, 1495, 198, 2857, 198, 1821, 198, 5237, 198, 2816, 198, 2996, 198, 3865, 198, 15377, 198, 17657, 198, 8628, 198, 24294, 198, 16799, 198, 28896, 198, 22579, 198, 27019, 198, 26895, 198, 37452, 198, 4943, 198, 198, 8818, 1064, 62, 11085, 62, 259, 12102, 7, 77, 17024, 26, 662, 321, 903, 62, 7857, 28, 1495, 8, 198, 220, 220, 220, 329, 1426, 796, 357, 79, 1476, 903, 62, 7857, 1343, 352, 2599, 13664, 7, 77, 17024, 8, 198, 220, 220, 220, 220, 220, 220, 220, 611, 5145, 271, 62, 87, 5356, 62, 41068, 7, 77, 17024, 58, 16, 25, 1930, 4357, 662, 321, 903, 62, 7857, 28, 79, 1476, 903, 62, 7857, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 3146, 58, 1930, 4357, 1426, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 886, 198, 437, 198, 198, 31, 30493, 1064, 62, 11085, 62, 259, 12102, 26933, 16, 25, 1495, 26, 1802, 12962, 6624, 357, 3064, 11, 2608, 8, 198, 31, 30493, 1064, 62, 11085, 62, 259, 12102, 26933, 16, 25, 1495, 26, 2681, 26, 1802, 12962, 6624, 357, 3064, 11, 2681, 8, 198, 31, 30493, 1064, 62, 11085, 62, 259, 12102, 7, 20688, 11, 662, 321, 903, 62, 7857, 28, 20, 8, 6624, 357, 16799, 11, 1315, 8, 198, 198, 8818, 636, 16, 7, 77, 17024, 8, 198, 220, 220, 220, 1271, 11, 4808, 796, 1064, 62, 11085, 62, 259, 12102, 7, 77, 17024, 8, 198, 220, 220, 220, 1441, 1271, 198, 437, 198, 198, 8818, 2160, 62, 28446, 7, 77, 17024, 11, 2496, 8, 198, 220, 220, 220, 2006, 796, 3146, 58, 16, 60, 198, 220, 220, 220, 329, 1312, 796, 362, 25, 13664, 7, 77, 17024, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2006, 15853, 3146, 58, 72, 60, 198, 220, 220, 220, 220, 220, 220, 220, 611, 2006, 6624, 2496, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 3146, 58, 16, 25, 72, 60, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 886, 198, 220, 220, 220, 1441, 2147, 198, 437, 198, 198, 31, 30493, 2160, 62, 28446, 7, 16, 25, 940, 11, 838, 8, 6624, 685, 16, 25, 19, 26, 60, 198, 31, 30493, 318, 22366, 7, 16345, 62, 28446, 7, 16, 25, 940, 11, 1802, 4008, 198, 198, 8818, 1064, 62, 38695, 62, 43167, 7, 77, 17024, 26, 662, 321, 903, 62, 7857, 28, 1495, 8, 198, 220, 220, 220, 1271, 11, 1426, 796, 1064, 62, 11085, 62, 259, 12102, 7, 77, 17024, 11, 662, 321, 903, 62, 7857, 28, 79, 1476, 903, 62, 7857, 8, 198, 220, 220, 220, 329, 357, 72, 11, 2124, 8, 287, 27056, 378, 7, 77, 17024, 8, 198, 220, 220, 220, 220, 220, 220, 220, 611, 1312, 6624, 1426, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2270, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 4939, 62, 43167, 796, 2160, 62, 28446, 7, 77, 17024, 58, 72, 37498, 1930, 532, 352, 8, 4357, 1271, 8, 198, 220, 220, 220, 220, 220, 220, 220, 611, 5145, 271, 22366, 7, 38695, 62, 43167, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 4939, 62, 43167, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 886, 198, 437, 198, 198, 31, 30493, 1064, 62, 38695, 62, 43167, 7, 20688, 11, 662, 321, 903, 62, 7857, 28, 20, 8, 6624, 685, 1314, 11, 1679, 11, 6298, 11, 2319, 60, 198, 198, 8818, 636, 17, 7, 77, 17024, 26, 662, 321, 903, 62, 7857, 28, 1495, 8, 198, 220, 220, 220, 4939, 62, 43167, 796, 1064, 62, 38695, 62, 43167, 7, 77, 17024, 11, 662, 321, 903, 62, 7857, 28, 79, 1476, 903, 62, 7857, 8, 198, 220, 220, 220, 1441, 5288, 7, 38695, 62, 43167, 8, 1343, 5415, 7, 38695, 62, 43167, 8, 198, 437, 198, 198, 31, 30493, 636, 17, 7, 20688, 11, 662, 321, 903, 62, 7857, 28, 20, 8, 6624, 8190, 198, 198, 9288, 796, 1100, 62, 18747, 7, 961, 7203, 7890, 14, 820, 12, 2931, 13, 14116, 1600, 10903, 4008, 198, 35235, 7203, 7841, 352, 25, 29568, 20274, 16, 796, 636, 16, 7, 9288, 4008, 4943, 198, 35235, 7203, 7841, 362, 25, 29568, 20274, 17, 796, 636, 17, 7, 9288, 4008, 4943, 198, 198, 31, 30493, 1255, 16, 6624, 37831, 1507, 43240, 198, 31, 30493, 1255, 17, 6624, 4747, 29416, 3682, 198 ]
2.343434
1,188
<reponame>JuliaGPU/VulkanAbstraction<gh_stars>0 is_optional(member::SpecStructMember) = member.name == :pNext || member.requirement ∈ [OPTIONAL, POINTER_OPTIONAL] || is_inferable_length(member) is_optional(param::SpecFuncParam) = param.requirement ∈ [OPTIONAL, POINTER_OPTIONAL] """ Represent an integer that gives the start of a C pointer. """ function is_pointer_start(spec::Spec) params = children(parent_spec(spec)) any(params) do param !isempty(param.arglen) && spec.type == :UInt32 && string(spec.name) == string("first", uppercasefirst(replace(string(param.name), r"Count$" => ""))) end end is_semantic_ptr(type) = is_ptr(type) || type == :Cstring needs_deps(spec::SpecStruct) = any(is_semantic_ptr, spec.members.type) must_return_success_code(spec::SpecFunc) = length(spec.success_codes) > 1 && :VK_INCOMPLETE ∉ spec.success_codes must_repeat_while_incomplete(spec::SpecFunc) = !must_return_success_code(spec) && :VK_INCOMPLETE ∈ spec.success_codes is_data_with_retrievable_size(spec::SpecFuncParam) = is_data(spec) && len(spec).requirement == POINTER_REQUIRED is_opaque_data(spec) = is_data(spec) && len(spec).requirement ≠ POINTER_REQUIRED is_opaque_pointer(type) = is_ptr(type) && is_void(ptr_type(type)) is_opaque_pointer(spec::Spec) = is_opaque_pointer(spec.type) is_opaque(spec) = is_opaque_data(spec) || is_opaque_pointer(spec) is_implicit_return(spec::SpecFuncParam) = !is_opaque_data(spec) && !spec.is_constant && is_ptr(spec.type) && !is_length(spec) && spec.type ∉ extension_types && ptr_type(spec.type) ∉ extension_types has_implicit_return_parameters(spec::SpecFunc) = any(is_implicit_return, children(spec)) is_flag(type) = type in spec_flags.name is_flag(spec::Union{SpecFuncParam,SpecStructMember}) = spec.type in spec_flags.name is_flag_bitmask(type) = type ∈ getproperty.(filter(!isnothing, spec_flags.bitmask), :name) is_fn_ptr(type) = startswith(string(type), "PFN_") is_fn_ptr(spec::Spec) = is_fn_ptr(spec.type) function is_hl(type) vktype = Symbol(:Vk, type) vktype in [spec_structs.name; spec_unions.name] end is_intermediate(type) = startswith(string(type), '_') has_intermediate_type(::SpecHandle) = false has_intermediate_type(spec::Union{SpecStruct,SpecUnion}) = true
[ 27, 7856, 261, 480, 29, 16980, 544, 33346, 14, 53, 31263, 4826, 301, 7861, 27, 456, 62, 30783, 29, 15, 198, 271, 62, 25968, 7, 19522, 3712, 22882, 44909, 27608, 8, 796, 2888, 13, 3672, 6624, 1058, 79, 10019, 8614, 2888, 13, 8897, 24615, 18872, 230, 685, 3185, 24131, 1847, 11, 19922, 41358, 62, 3185, 24131, 1847, 60, 8614, 318, 62, 259, 2232, 540, 62, 13664, 7, 19522, 8, 198, 271, 62, 25968, 7, 17143, 3712, 22882, 37, 19524, 22973, 8, 796, 5772, 13, 8897, 24615, 18872, 230, 685, 3185, 24131, 1847, 11, 19922, 41358, 62, 3185, 24131, 1847, 60, 198, 198, 37811, 198, 40171, 281, 18253, 326, 3607, 262, 923, 286, 257, 327, 17562, 13, 198, 37811, 198, 8818, 318, 62, 29536, 62, 9688, 7, 16684, 3712, 22882, 8, 198, 220, 220, 220, 42287, 796, 1751, 7, 8000, 62, 16684, 7, 16684, 4008, 198, 220, 220, 220, 597, 7, 37266, 8, 466, 5772, 198, 220, 220, 220, 220, 220, 220, 220, 5145, 271, 28920, 7, 17143, 13, 853, 11925, 8, 11405, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1020, 13, 4906, 6624, 1058, 52, 5317, 2624, 11405, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4731, 7, 16684, 13, 3672, 8, 6624, 4731, 7203, 11085, 1600, 334, 39921, 589, 11085, 7, 33491, 7, 8841, 7, 17143, 13, 3672, 828, 374, 1, 12332, 3, 1, 5218, 13538, 22305, 198, 220, 220, 220, 886, 198, 437, 198, 198, 271, 62, 43616, 5109, 62, 20692, 7, 4906, 8, 796, 318, 62, 20692, 7, 4906, 8, 8614, 2099, 6624, 1058, 34, 8841, 198, 50032, 62, 10378, 82, 7, 16684, 3712, 22882, 44909, 8, 796, 597, 7, 271, 62, 43616, 5109, 62, 20692, 11, 1020, 13, 30814, 13, 4906, 8, 198, 27238, 62, 7783, 62, 13138, 62, 8189, 7, 16684, 3712, 22882, 37, 19524, 8, 796, 4129, 7, 16684, 13, 13138, 62, 40148, 8, 1875, 352, 11405, 1058, 47191, 62, 1268, 41335, 9328, 18872, 231, 1020, 13, 13138, 62, 40148, 198, 27238, 62, 44754, 62, 4514, 62, 259, 20751, 7, 16684, 3712, 22882, 37, 19524, 8, 796, 5145, 27238, 62, 7783, 62, 13138, 62, 8189, 7, 16684, 8, 11405, 1058, 47191, 62, 1268, 41335, 9328, 18872, 230, 1020, 13, 13138, 62, 40148, 198, 271, 62, 7890, 62, 4480, 62, 1186, 380, 1990, 540, 62, 7857, 7, 16684, 3712, 22882, 37, 19524, 22973, 8, 796, 318, 62, 7890, 7, 16684, 8, 11405, 18896, 7, 16684, 737, 8897, 24615, 6624, 19922, 41358, 62, 2200, 10917, 37819, 198, 271, 62, 404, 18251, 62, 7890, 7, 16684, 8, 796, 318, 62, 7890, 7, 16684, 8, 11405, 18896, 7, 16684, 737, 8897, 24615, 15139, 254, 19922, 41358, 62, 2200, 10917, 37819, 198, 271, 62, 404, 18251, 62, 29536, 7, 4906, 8, 796, 318, 62, 20692, 7, 4906, 8, 11405, 318, 62, 19382, 7, 20692, 62, 4906, 7, 4906, 4008, 198, 271, 62, 404, 18251, 62, 29536, 7, 16684, 3712, 22882, 8, 796, 318, 62, 404, 18251, 62, 29536, 7, 16684, 13, 4906, 8, 198, 271, 62, 404, 18251, 7, 16684, 8, 796, 318, 62, 404, 18251, 62, 7890, 7, 16684, 8, 8614, 318, 62, 404, 18251, 62, 29536, 7, 16684, 8, 198, 271, 62, 23928, 3628, 62, 7783, 7, 16684, 3712, 22882, 37, 19524, 22973, 8, 796, 198, 220, 220, 220, 5145, 271, 62, 404, 18251, 62, 7890, 7, 16684, 8, 11405, 198, 220, 220, 220, 5145, 16684, 13, 271, 62, 9979, 415, 11405, 198, 220, 220, 220, 318, 62, 20692, 7, 16684, 13, 4906, 8, 11405, 198, 220, 220, 220, 5145, 271, 62, 13664, 7, 16684, 8, 11405, 198, 220, 220, 220, 1020, 13, 4906, 18872, 231, 7552, 62, 19199, 11405, 198, 220, 220, 220, 50116, 62, 4906, 7, 16684, 13, 4906, 8, 18872, 231, 7552, 62, 19199, 198, 10134, 62, 23928, 3628, 62, 7783, 62, 17143, 7307, 7, 16684, 3712, 22882, 37, 19524, 8, 796, 597, 7, 271, 62, 23928, 3628, 62, 7783, 11, 1751, 7, 16684, 4008, 198, 271, 62, 32109, 7, 4906, 8, 796, 2099, 287, 1020, 62, 33152, 13, 3672, 198, 271, 62, 32109, 7, 16684, 3712, 38176, 90, 22882, 37, 19524, 22973, 11, 22882, 44909, 27608, 30072, 796, 1020, 13, 4906, 287, 1020, 62, 33152, 13, 3672, 198, 271, 62, 32109, 62, 2545, 27932, 7, 4906, 8, 796, 2099, 18872, 230, 651, 26745, 12195, 24455, 7, 0, 271, 22366, 11, 1020, 62, 33152, 13, 2545, 27932, 828, 1058, 3672, 8, 198, 271, 62, 22184, 62, 20692, 7, 4906, 8, 796, 923, 2032, 342, 7, 8841, 7, 4906, 828, 366, 42668, 45, 62, 4943, 198, 271, 62, 22184, 62, 20692, 7, 16684, 3712, 22882, 8, 796, 318, 62, 22184, 62, 20692, 7, 16684, 13, 4906, 8, 198, 198, 8818, 318, 62, 18519, 7, 4906, 8, 198, 220, 220, 220, 410, 74, 4906, 796, 38357, 7, 25, 53, 74, 11, 2099, 8, 198, 220, 220, 220, 410, 74, 4906, 287, 685, 16684, 62, 7249, 82, 13, 3672, 26, 1020, 62, 403, 507, 13, 3672, 60, 198, 437, 198, 198, 271, 62, 3849, 13857, 7, 4906, 8, 796, 923, 2032, 342, 7, 8841, 7, 4906, 828, 705, 62, 11537, 198, 198, 10134, 62, 3849, 13857, 62, 4906, 7, 3712, 22882, 37508, 8, 796, 3991, 198, 10134, 62, 3849, 13857, 62, 4906, 7, 16684, 3712, 38176, 90, 22882, 44909, 11, 22882, 38176, 30072, 796, 2081, 198 ]
2.572072
888
<gh_stars>1-10 include("params.jl") include("run_rtaa.jl") include("run_cmax.jl") include("run_finite_model_class.jl") include("run_model_search.jl") include("run_agnostic_sysid.jl") include("run_online_model_search.jl") function mountaincar_all_main() rtaa_steps = mountaincar_rtaa_main() cmax_steps = mountaincar_cmax_main() true_steps = mountaincar_true_main() # finite_model_class_steps = mountaincar_finite_model_class_main() # true_finite_model_class_steps = mountaincar_finite_model_class_main(true_model = true) # local_finite_model_class_steps = mountaincar_finite_model_class_main(local_agent = true) return_based_model_search_steps = mountaincar_return_based_model_search_main() bellman_based_model_search_steps = mountaincar_bellman_based_model_search_main() plot(range_of_values, rtaa_steps, lw = 3, label = "RTAA*", legend = :topleft) plot!(range_of_values, cmax_steps, lw = 3, label = "CMAX") plot!(range_of_values, true_steps, lw = 3, label = "True") # plot!(range_of_values, finite_model_class_steps, lw = 3, label = "Finite Model Class") # plot!( # range_of_values, # true_finite_model_class_steps, # lw = 3, # label = "Finite Model Class with true model", # ) # plot!( # range_of_values, # local_finite_model_class_steps, # lw = 3, # label = "Finite Model Class with Local Data", # ) plot!(range_of_values, return_based_model_search_steps, lw = 3, label = "RBMS") plot!(range_of_values, bellman_based_model_search_steps, lw = 3, label = "BBMS") xlabel!("Misspecification") ylabel!("Number of steps to reach goal") end
[ 27, 456, 62, 30783, 29, 16, 12, 940, 198, 17256, 7203, 37266, 13, 20362, 4943, 198, 17256, 7203, 5143, 62, 17034, 7252, 13, 20362, 4943, 198, 17256, 7203, 5143, 62, 66, 9806, 13, 20362, 4943, 198, 17256, 7203, 5143, 62, 69, 9504, 62, 19849, 62, 4871, 13, 20362, 4943, 198, 17256, 7203, 5143, 62, 19849, 62, 12947, 13, 20362, 4943, 198, 17256, 7203, 5143, 62, 4660, 15132, 62, 17597, 312, 13, 20362, 4943, 198, 17256, 7203, 5143, 62, 25119, 62, 19849, 62, 12947, 13, 20362, 4943, 198, 198, 8818, 8598, 7718, 62, 439, 62, 12417, 3419, 198, 220, 220, 220, 374, 83, 7252, 62, 20214, 796, 8598, 7718, 62, 17034, 7252, 62, 12417, 3419, 198, 220, 220, 220, 269, 9806, 62, 20214, 796, 8598, 7718, 62, 66, 9806, 62, 12417, 3419, 198, 220, 220, 220, 2081, 62, 20214, 796, 8598, 7718, 62, 7942, 62, 12417, 3419, 198, 220, 220, 220, 1303, 27454, 62, 19849, 62, 4871, 62, 20214, 796, 8598, 7718, 62, 69, 9504, 62, 19849, 62, 4871, 62, 12417, 3419, 198, 220, 220, 220, 1303, 2081, 62, 69, 9504, 62, 19849, 62, 4871, 62, 20214, 796, 8598, 7718, 62, 69, 9504, 62, 19849, 62, 4871, 62, 12417, 7, 7942, 62, 19849, 796, 2081, 8, 198, 220, 220, 220, 1303, 1957, 62, 69, 9504, 62, 19849, 62, 4871, 62, 20214, 796, 8598, 7718, 62, 69, 9504, 62, 19849, 62, 4871, 62, 12417, 7, 12001, 62, 25781, 796, 2081, 8, 198, 220, 220, 220, 1441, 62, 3106, 62, 19849, 62, 12947, 62, 20214, 796, 8598, 7718, 62, 7783, 62, 3106, 62, 19849, 62, 12947, 62, 12417, 3419, 198, 220, 220, 220, 8966, 805, 62, 3106, 62, 19849, 62, 12947, 62, 20214, 796, 8598, 7718, 62, 7923, 805, 62, 3106, 62, 19849, 62, 12947, 62, 12417, 3419, 628, 198, 220, 220, 220, 7110, 7, 9521, 62, 1659, 62, 27160, 11, 374, 83, 7252, 62, 20214, 11, 300, 86, 796, 513, 11, 6167, 796, 366, 14181, 3838, 9, 1600, 8177, 796, 1058, 83, 643, 701, 8, 198, 220, 220, 220, 7110, 0, 7, 9521, 62, 1659, 62, 27160, 11, 269, 9806, 62, 20214, 11, 300, 86, 796, 513, 11, 6167, 796, 366, 34, 22921, 4943, 198, 220, 220, 220, 7110, 0, 7, 9521, 62, 1659, 62, 27160, 11, 2081, 62, 20214, 11, 300, 86, 796, 513, 11, 6167, 796, 366, 17821, 4943, 198, 220, 220, 220, 1303, 7110, 0, 7, 9521, 62, 1659, 62, 27160, 11, 27454, 62, 19849, 62, 4871, 62, 20214, 11, 300, 86, 796, 513, 11, 6167, 796, 366, 37, 9504, 9104, 5016, 4943, 198, 220, 220, 220, 1303, 7110, 0, 7, 198, 220, 220, 220, 1303, 220, 220, 220, 220, 2837, 62, 1659, 62, 27160, 11, 198, 220, 220, 220, 1303, 220, 220, 220, 220, 2081, 62, 69, 9504, 62, 19849, 62, 4871, 62, 20214, 11, 198, 220, 220, 220, 1303, 220, 220, 220, 220, 300, 86, 796, 513, 11, 198, 220, 220, 220, 1303, 220, 220, 220, 220, 6167, 796, 366, 37, 9504, 9104, 5016, 351, 2081, 2746, 1600, 198, 220, 220, 220, 1303, 1267, 198, 220, 220, 220, 1303, 7110, 0, 7, 198, 220, 220, 220, 1303, 220, 220, 220, 220, 2837, 62, 1659, 62, 27160, 11, 198, 220, 220, 220, 1303, 220, 220, 220, 220, 1957, 62, 69, 9504, 62, 19849, 62, 4871, 62, 20214, 11, 198, 220, 220, 220, 1303, 220, 220, 220, 220, 300, 86, 796, 513, 11, 198, 220, 220, 220, 1303, 220, 220, 220, 220, 6167, 796, 366, 37, 9504, 9104, 5016, 351, 10714, 6060, 1600, 198, 220, 220, 220, 1303, 1267, 198, 220, 220, 220, 7110, 0, 7, 9521, 62, 1659, 62, 27160, 11, 1441, 62, 3106, 62, 19849, 62, 12947, 62, 20214, 11, 300, 86, 796, 513, 11, 6167, 796, 366, 27912, 5653, 4943, 198, 220, 220, 220, 7110, 0, 7, 9521, 62, 1659, 62, 27160, 11, 8966, 805, 62, 3106, 62, 19849, 62, 12947, 62, 20214, 11, 300, 86, 796, 513, 11, 6167, 796, 366, 15199, 5653, 4943, 198, 220, 220, 220, 2124, 18242, 0, 7203, 17140, 43106, 2649, 4943, 198, 220, 220, 220, 331, 18242, 0, 7203, 15057, 286, 4831, 284, 3151, 3061, 4943, 198, 437, 198 ]
2.444122
689
<filename>JuliaBasics.jl # to create vector, put comma V = [1, 2, 3, 4, 5, 6] # to create matrix just add space V1 = [1 2 3 4 5 6] # to declare an array just put semicolon M1 = [1 2 3; 4 5 6; 7 8 9] # to resahepe vector or matrix just use resahepe() V3 = [1, 2, 3, 4, 5, 6, 7, 8, 9] reshape(V3, 3,3) # for vector M2 = [1 2 3; 4 5 6] reshape(M2, 3, 2) # for matrix 2x3 to 3x2 # to create identitiy matirx using LinearAlgebra Matrix{Int}(I, 4, 4) # for dimensions and size of matrix use ndims() and size(), and to see type of elements in matrix using eltype() ndims(M2) size(M2) eltype(M1) # to concatenate two vector use vcat (similar to cbind() in R) and use hcat similar to (rbind() in R) d1 = [1 2 3; 4 5 6] d2 = [6 7 8; 9 10 11] hcat(d1, d2) vcat(d1, d2) # functions in julia function f(x, y, z) x + y + z end # or just assign g(a, b, c) = a + b + c # function with return function β(a, b, c) result = a + b + c return result end β(2,π,3) # we can use opetator as function 2 * 3 * 4 *(2,3,4) # function with default parameters z(x, y, a = 1, b = 2) = a*x + b*y z(3,5) # Anonymous function x -> x + 1 # or function (x) x +1 end # Anonymous function generally useing with other first class function map(x -> x + 1, [1, 2]) # multiple return values function ff( a, b, c) a * b * c, a + b + c end; ff(1, 2, 3) x, y = ff(1, 2, 3); display(x) display(y) function fff(a, b, c) multi = a * b * c add = a + b + c return multi, add end fff(1, 2, 3) # using Anonymous function with multiple piece of code, do-blocks will help map(x -> x + 1, [1, 2, 3, 4]) # basic way map([1, 2, 3, 4]) do x # other way x + 1 end # control flow # compound expression x = (a = 5; b = 6; a*b) # other way x = begin a = 5 b = 6 a * b end # conditional evaluation function ineq(x, y) if x > y x = 2 elseif x < y x = 1 else x = 0 end end ineq(1, 2) # repeated evaluatins: loops j = 3; while j > 0 println(j^2) global j -= 1 end # for loops for j in [1, 2, 3] println(j) end # we can add ∈ to loops for j ∈ [1, 2, 3] println(j) end # warning and informational messages function f(x) if x<1 @warn "x must be positive!" else return x^2 end end f(2) function g(x) if x < 1 @info "X must be positive!" else return x^2 end end g(-2) # Plotting using PyPlot x = 1:100 y = rand(100) display(gcf()) plot(x,y, color = "tomato") title("basic graphs in PyPlot")
[ 27, 34345, 29, 16980, 544, 15522, 873, 13, 20362, 198, 2, 284, 2251, 15879, 11, 1234, 39650, 198, 53, 796, 685, 16, 11, 362, 11, 513, 11, 604, 11, 642, 11, 718, 60, 198, 198, 2, 1849, 1462, 2251, 17593, 655, 751, 2272, 198, 53, 16, 796, 685, 16, 362, 513, 604, 642, 718, 60, 198, 198, 2, 1849, 1462, 13627, 281, 7177, 655, 1234, 5026, 27045, 261, 198, 44, 16, 796, 685, 16, 362, 513, 26, 604, 642, 718, 26, 767, 807, 860, 60, 198, 198, 2, 284, 581, 64, 258, 431, 15879, 393, 17593, 655, 779, 581, 64, 258, 431, 3419, 198, 198, 53, 18, 796, 685, 16, 11, 362, 11, 513, 11, 604, 11, 642, 11, 718, 11, 767, 11, 807, 11, 860, 60, 198, 3447, 1758, 7, 53, 18, 11, 513, 11, 18, 8, 1303, 1849, 1640, 15879, 198, 198, 44, 17, 796, 685, 16, 362, 513, 26, 604, 642, 718, 60, 220, 198, 3447, 1758, 7, 44, 17, 11, 513, 11, 362, 8, 1303, 329, 17593, 362, 87, 18, 284, 513, 87, 17, 198, 198, 2, 284, 2251, 1852, 270, 7745, 2603, 343, 87, 220, 198, 3500, 44800, 2348, 29230, 198, 46912, 90, 5317, 92, 7, 40, 11, 604, 11, 604, 8, 198, 198, 2, 329, 15225, 290, 2546, 286, 17593, 779, 299, 67, 12078, 3419, 290, 2546, 22784, 290, 284, 766, 2099, 286, 4847, 287, 17593, 1262, 1288, 4906, 3419, 198, 358, 12078, 7, 44, 17, 8, 198, 7857, 7, 44, 17, 8, 198, 417, 4906, 7, 44, 16, 8, 198, 198, 2, 1849, 1462, 1673, 36686, 378, 734, 15879, 779, 410, 9246, 357, 38610, 284, 269, 21653, 3419, 287, 371, 8, 290, 779, 289, 9246, 2092, 284, 357, 81, 21653, 3419, 287, 371, 8, 198, 198, 67, 16, 796, 685, 16, 362, 513, 26, 604, 642, 718, 60, 198, 67, 17, 796, 685, 21, 767, 807, 26, 860, 838, 1367, 60, 198, 198, 71, 9246, 7, 67, 16, 11, 288, 17, 8, 198, 85, 9246, 7, 67, 16, 11, 288, 17, 8, 198, 198, 2, 5499, 287, 474, 43640, 198, 198, 8818, 277, 7, 87, 11, 331, 11, 1976, 8, 198, 220, 220, 220, 2124, 1343, 331, 1343, 1976, 198, 437, 198, 198, 2, 393, 655, 8333, 198, 198, 70, 7, 64, 11, 275, 11, 269, 8, 796, 257, 1343, 275, 1343, 269, 198, 198, 2, 2163, 351, 1441, 198, 198, 8818, 27169, 7, 64, 11, 275, 11, 269, 8, 198, 220, 220, 220, 1255, 796, 257, 1343, 275, 1343, 269, 198, 220, 220, 220, 1441, 1255, 198, 437, 198, 198, 26638, 7, 17, 11, 46582, 11, 18, 8, 198, 198, 2, 356, 460, 779, 1034, 316, 1352, 355, 2163, 198, 198, 17, 1635, 513, 1635, 604, 198, 9, 7, 17, 11, 18, 11, 19, 8, 198, 198, 2, 1849, 8818, 351, 4277, 10007, 198, 198, 89, 7, 87, 11, 331, 11, 257, 796, 352, 11, 275, 796, 362, 8, 796, 257, 9, 87, 1343, 275, 9, 88, 198, 89, 7, 18, 11, 20, 8, 628, 1303, 19200, 2163, 198, 198, 87, 4613, 2124, 1343, 352, 1303, 393, 198, 198, 8818, 357, 87, 8, 198, 220, 220, 220, 2124, 1343, 16, 198, 437, 198, 198, 2, 1849, 20660, 2163, 4143, 779, 278, 351, 584, 717, 1398, 2163, 198, 8899, 7, 87, 4613, 2124, 1343, 352, 11, 685, 16, 11, 362, 12962, 198, 198, 2, 1849, 48101, 1441, 3815, 198, 198, 8818, 31246, 7, 257, 11, 275, 11, 269, 8, 198, 220, 220, 220, 257, 1635, 275, 1635, 269, 11, 257, 1343, 275, 1343, 269, 198, 437, 26, 198, 198, 487, 7, 16, 11, 362, 11, 513, 8, 198, 198, 87, 11, 331, 220, 796, 31246, 7, 16, 11, 362, 11, 513, 1776, 198, 198, 13812, 7, 87, 8, 198, 13812, 7, 88, 8, 198, 198, 8818, 277, 487, 7, 64, 11, 275, 11, 269, 8, 198, 220, 220, 220, 5021, 796, 257, 1635, 275, 1635, 269, 198, 220, 220, 220, 751, 796, 257, 1343, 275, 1343, 269, 628, 220, 220, 220, 1441, 5021, 11, 751, 198, 437, 628, 198, 20972, 7, 16, 11, 362, 11, 513, 8, 628, 198, 2, 1262, 19200, 2163, 351, 3294, 3704, 286, 2438, 11, 466, 12, 27372, 481, 1037, 198, 198, 8899, 7, 87, 4613, 2124, 1343, 352, 11, 685, 16, 11, 362, 11, 513, 11, 604, 12962, 1303, 1849, 35487, 835, 198, 198, 8899, 26933, 16, 11, 362, 11, 513, 11, 604, 12962, 466, 2124, 1303, 1849, 847, 835, 220, 198, 220, 220, 220, 220, 2124, 1343, 352, 198, 437, 220, 628, 198, 2, 1849, 13716, 5202, 198, 2, 1849, 5589, 633, 5408, 198, 198, 87, 796, 357, 64, 796, 642, 26, 275, 796, 718, 26, 257, 9, 65, 8, 198, 198, 2, 584, 835, 198, 198, 87, 796, 2221, 198, 220, 220, 220, 257, 796, 642, 198, 220, 220, 220, 275, 796, 718, 198, 220, 220, 220, 257, 1635, 275, 198, 437, 628, 198, 2, 26340, 12660, 198, 198, 8818, 287, 27363, 7, 87, 11, 331, 8, 198, 220, 220, 220, 611, 2124, 1875, 331, 198, 220, 220, 220, 220, 220, 220, 220, 2124, 796, 362, 198, 220, 220, 220, 2073, 361, 2124, 1279, 331, 198, 220, 220, 220, 220, 220, 220, 220, 2124, 796, 352, 198, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 2124, 796, 657, 198, 220, 220, 220, 886, 220, 220, 220, 220, 198, 437, 198, 198, 500, 80, 7, 16, 11, 362, 8, 198, 198, 2, 5100, 5418, 84, 265, 1040, 25, 23607, 198, 198, 73, 796, 513, 26, 198, 198, 4514, 474, 1875, 657, 198, 220, 220, 220, 44872, 7, 73, 61, 17, 8, 198, 220, 220, 220, 3298, 220, 474, 48185, 352, 198, 437, 628, 198, 2, 329, 23607, 198, 198, 1640, 474, 287, 685, 16, 11, 362, 11, 513, 60, 198, 220, 220, 220, 44872, 7, 73, 8, 198, 437, 198, 198, 2, 1849, 732, 460, 751, 18872, 230, 284, 23607, 198, 198, 1640, 474, 18872, 230, 685, 16, 11, 362, 11, 513, 60, 198, 220, 220, 220, 44872, 7, 73, 8, 198, 437, 628, 198, 2, 1849, 43917, 290, 21524, 6218, 198, 198, 8818, 277, 7, 87, 8, 198, 220, 220, 220, 611, 2124, 27, 16, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 40539, 366, 87, 1276, 307, 3967, 2474, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 2124, 61, 17, 198, 220, 220, 220, 886, 198, 437, 628, 198, 69, 7, 17, 8, 198, 198, 8818, 308, 7, 87, 8, 198, 220, 220, 220, 611, 2124, 1279, 352, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 10951, 366, 55, 1276, 307, 3967, 2474, 198, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2124, 61, 17, 198, 220, 220, 220, 886, 220, 220, 220, 220, 198, 437, 198, 198, 70, 32590, 17, 8, 628, 198, 2, 28114, 889, 220, 198, 198, 3500, 9485, 43328, 198, 87, 796, 352, 25, 3064, 198, 88, 796, 43720, 7, 3064, 8, 198, 13812, 7, 70, 12993, 28955, 198, 29487, 7, 87, 11, 88, 11, 3124, 796, 366, 39532, 5549, 4943, 198, 7839, 7203, 35487, 28770, 287, 9485, 43328, 4943, 198 ]
2.13278
1,205
<filename>src/sum0.jl function sum0(a) # create variable to store ouput out = 0.0 # loop for i in a out += i end # return return out end
[ 27, 34345, 29, 10677, 14, 16345, 15, 13, 20362, 198, 8818, 2160, 15, 7, 64, 8, 198, 220, 220, 220, 1303, 2251, 7885, 284, 3650, 267, 929, 315, 198, 220, 220, 220, 503, 796, 657, 13, 15, 628, 220, 220, 220, 1303, 9052, 198, 220, 220, 220, 329, 1312, 287, 257, 198, 220, 220, 220, 220, 220, 220, 220, 503, 15853, 1312, 198, 220, 220, 220, 886, 628, 220, 220, 220, 1303, 1441, 198, 220, 220, 220, 1441, 503, 198, 437 ]
2.148148
81
using Test using NeXLCore @testset "MIP" begin @test all(map(z -> isapprox(J(Bloch1933, z) / z, 13.5, rtol = 1.0e-8), 1:99)) @test all( map( z -> isapprox( J(Jensen1937, z) / z, 9.0 * (1.0 + 0.5 * z^(-2.0 / 3.0)), rtol = 1.0e-8, ), 1:99, ), ) @test all(map(z -> isapprox(J(Wilson1941, z) / z, 11.5, rtol = 1.0e-8), 1:99)) @test all( map( z -> isapprox(J(Sternheimer1964, z) / z, 9.76 + 58.82 * z^-1.19, rtol = 1.0e-8), 12:99, ), ) @test all( map( z -> isapprox( J(Springer1967, z) / z, 9.0 * (1.0 + z^(-2.0 / 3.0)) + 0.03 * z, rtol = 1.0e-8, ), 1:99, ), ) @test all( map( z -> isapprox( J(Zeller1973, z) / z, 10.04 + 8.25 * exp(-z / 11.22), rtol = 1.0e-8, ), 1:99, ), ) @test all( map(z -> isapprox(J(Brizuela1990, z) / z, 22.4 * z^-0.172, rtol = 1.0e-8), 1:99), ) @test J(Berger1982, n"C") == 78.0 @test J(Berger1982, n"Fe") == 286.0 @test J(Berger1982, n"Pb") == 823.0 @test J(Berger1982, n"Pu") == 921.0 end
[ 3500, 6208, 198, 3500, 3169, 55, 5639, 382, 198, 198, 31, 9288, 2617, 366, 44, 4061, 1, 2221, 198, 220, 220, 220, 2488, 9288, 477, 7, 8899, 7, 89, 4613, 318, 1324, 13907, 7, 41, 7, 3629, 5374, 1129, 2091, 11, 1976, 8, 1220, 1976, 11, 1511, 13, 20, 11, 374, 83, 349, 796, 352, 13, 15, 68, 12, 23, 828, 352, 25, 2079, 4008, 198, 220, 220, 220, 2488, 9288, 477, 7, 198, 220, 220, 220, 220, 220, 220, 220, 3975, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1976, 4613, 318, 1324, 13907, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 449, 7, 41, 18756, 1129, 2718, 11, 1976, 8, 1220, 1976, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 860, 13, 15, 1635, 357, 16, 13, 15, 1343, 657, 13, 20, 1635, 1976, 61, 32590, 17, 13, 15, 1220, 513, 13, 15, 36911, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 83, 349, 796, 352, 13, 15, 68, 12, 23, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 10612, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 352, 25, 2079, 11, 198, 220, 220, 220, 220, 220, 220, 220, 10612, 198, 220, 220, 220, 1267, 198, 220, 220, 220, 2488, 9288, 477, 7, 8899, 7, 89, 4613, 318, 1324, 13907, 7, 41, 7, 37349, 1129, 3901, 11, 1976, 8, 1220, 1976, 11, 1367, 13, 20, 11, 374, 83, 349, 796, 352, 13, 15, 68, 12, 23, 828, 352, 25, 2079, 4008, 198, 220, 220, 220, 2488, 9288, 477, 7, 198, 220, 220, 220, 220, 220, 220, 220, 3975, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1976, 4613, 318, 1324, 13907, 7, 41, 7, 50, 759, 16288, 46477, 11, 1976, 8, 1220, 1976, 11, 860, 13, 4304, 1343, 7618, 13, 6469, 1635, 1976, 61, 12, 16, 13, 1129, 11, 374, 83, 349, 796, 352, 13, 15, 68, 12, 23, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1105, 25, 2079, 11, 198, 220, 220, 220, 220, 220, 220, 220, 10612, 198, 220, 220, 220, 1267, 198, 220, 220, 220, 2488, 9288, 477, 7, 198, 220, 220, 220, 220, 220, 220, 220, 3975, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1976, 4613, 318, 1324, 13907, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 449, 7, 38454, 3889, 42830, 11, 1976, 8, 1220, 1976, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 860, 13, 15, 1635, 357, 16, 13, 15, 1343, 1976, 61, 32590, 17, 13, 15, 1220, 513, 13, 15, 4008, 1343, 657, 13, 3070, 1635, 1976, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 83, 349, 796, 352, 13, 15, 68, 12, 23, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 10612, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 352, 25, 2079, 11, 198, 220, 220, 220, 220, 220, 220, 220, 10612, 198, 220, 220, 220, 1267, 198, 220, 220, 220, 2488, 9288, 477, 7, 198, 220, 220, 220, 220, 220, 220, 220, 3975, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1976, 4613, 318, 1324, 13907, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 449, 7, 57, 12368, 40220, 11, 1976, 8, 1220, 1976, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 838, 13, 3023, 1343, 807, 13, 1495, 1635, 1033, 32590, 89, 1220, 1367, 13, 1828, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 83, 349, 796, 352, 13, 15, 68, 12, 23, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 10612, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 352, 25, 2079, 11, 198, 220, 220, 220, 220, 220, 220, 220, 10612, 198, 220, 220, 220, 1267, 198, 220, 220, 220, 2488, 9288, 477, 7, 198, 220, 220, 220, 220, 220, 220, 220, 3975, 7, 89, 4613, 318, 1324, 13907, 7, 41, 7, 33, 47847, 2731, 64, 19891, 11, 1976, 8, 1220, 1976, 11, 2534, 13, 19, 1635, 1976, 61, 12, 15, 13, 23628, 11, 374, 83, 349, 796, 352, 13, 15, 68, 12, 23, 828, 352, 25, 2079, 828, 198, 220, 220, 220, 1267, 198, 220, 220, 220, 2488, 9288, 449, 7, 24814, 1362, 30763, 11, 299, 1, 34, 4943, 6624, 8699, 13, 15, 198, 220, 220, 220, 2488, 9288, 449, 7, 24814, 1362, 30763, 11, 299, 1, 14304, 4943, 6624, 39697, 13, 15, 198, 220, 220, 220, 2488, 9288, 449, 7, 24814, 1362, 30763, 11, 299, 1, 47, 65, 4943, 6624, 807, 1954, 13, 15, 198, 220, 220, 220, 2488, 9288, 449, 7, 24814, 1362, 30763, 11, 299, 1, 47, 84, 4943, 6624, 860, 2481, 13, 15, 198, 437, 198 ]
1.496045
885
# ------------------------------------------------------------------------------------------ # # 多重派发 # # **多重派发**是这篇notebook要探索的Julia的一个关键特性。 # # 它有助于快速开发。它也让软件可拓展、可设计和更好把玩。 # # 它可能是并行计算取得重大突破的预兆。 # # ## 大纲 # 1. 罗马数字 # 2. 函数 # 3. 并行计算 # ------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------ # ## 1. 罗马数字(玩玩) # ------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------ # 我们来定义一个**新结构**表示罗马数字。为了方便写代码,我们将只考虑 0 到 9。 # # **练习**:拓展到更大的数字。(别忘了罗马数字是十进制计数系统!) # ------------------------------------------------------------------------------------------ struct Roman n::Int end Base.show(io::IO, r::Roman) = print(io, 'ⅰ' + (r.n - 1) % 10 ) # 漂亮的显示;'ⅰ'是一个Unicode罗马数字 # ------------------------------------------------------------------------------------------ # 我们可以像这样创建一个这个类型的对象: # ------------------------------------------------------------------------------------------ Roman(4) typeof.([5 5.0 Roman(5) "Five" '5' 5//1]) # ------------------------------------------------------------------------------------------ # 用罗马数字漂亮地打印数组: # ------------------------------------------------------------------------------------------ x = [7 1 2 5 8 9] Roman.(x) # equivalent to map(Roman, x) or [Roman(w) for w in x] # ------------------------------------------------------------------------------------------ # 要是能像普通数字那样给罗马数字做加法就好了: # ------------------------------------------------------------------------------------------ Roman(4) + Roman(5) # ------------------------------------------------------------------------------------------ # 但 Julia 不知道该怎么做。 # 我们可以通过 `import` 函数 `+` 并拓展它的定义来教 Julia 给罗马数字做加法: # ------------------------------------------------------------------------------------------ import Base: +, * +(a::Roman, b::Roman) = Roman(a.n + b.n) Roman(4) + Roman(5) # ------------------------------------------------------------------------------------------ # 这样就给函数 `+` **添加了一个新方法**: # ------------------------------------------------------------------------------------------ methods(+) @which Roman(4) + Roman(5) import Base.* *(i::Roman, j::Roman) = Roman(i.n * j.n) # Multiply like a Roman Roman(3) * Roman(2) Roman.(1:3) .* [Roman(1) Roman(2) Roman(3)] # ------------------------------------------------------------------------------------------ # 但是我们的乘法仍有一些问题 # ------------------------------------------------------------------------------------------ Roman(3) * 2 # mytimes 函数目前基于类型来判断该做什么,很复杂 # 不用担心,更好的方法马上就来 function mytimes(i,j) if isa(i,Roman) & isa(j,Number) return fill(1, i.n, j) # i by j matrix with ones elseif isa(i,Number) & isa(j,Roman) return "😄"^ (i*j.n) # i * j happy faces else return("I Don't know") end end mytimes(4,Roman(3)) # 12个笑脸 mytimes(Roman(4),3) # 4x3的全1矩阵 # ------------------------------------------------------------------------------------------ # 最简单的实现方式是明确定义一个 `Roman` 和一个数字的乘法。我们可以按我们的想法来定义: # ------------------------------------------------------------------------------------------ *(i::Number, j::Roman) = "😄"^ (i*j.n) # i * j个笑脸 *(i::Roman, j::Number) = fill(1, i.n, j) # i * j的矩阵 3 * Roman(3) # 9个笑脸 Roman(3) * 5 # 3*5的全1矩阵 t(x::Roman,y::Roman) = x.n * y.n t(Roman(5),Roman(4)) # 注意它的汇编代码是多紧凑! @code_native t(Roman(2),Roman(4)) # ------------------------------------------------------------------------------------------ # ## 函数 # ------------------------------------------------------------------------------------------ import Base: *, +, ^ *(α::Number, g::Function) = x -> α * g(x) # 标量乘以函数 *(f::Function, λ::Number) = x -> f(λ * x) # Scale the argument *(f::Function, g::Function) = x -> f(g(x)) # 复合函数 -- 滥用符号! 在Julia0.6中使用 \circ ^(f::Function, n::Integer) = n == 1 ? f : f*f^(n-1) # 一个通过递归乘法实现的天真的求幂算法 +(f::Function, g::Function) = x -> f(x) + g(x) # ------------------------------------------------------------------------------------------ # 举个例子,定义成这样的指数函数 # # $$\exp(x) = \sum_{n=0}^\infty \frac{1}{n!} x^n.$$ # # 我们可以把它看成是这样的函数: # # $$\exp = \sum_{n=0}^\infty \frac{1}{n!} \mathrm{pow}_n,$$ # # 其中 $\mathrm{pow}_n(x) = x^n$. # # (开始用数字模糊符号!) # ------------------------------------------------------------------------------------------ pow(n) = x -> x^n myexp = sum(1/factorial(big(n)) * pow(n) for n in 0:100) # 效率低的泰勒级数! [myexp(1); exp(1); exp(big(1))] f = x -> x^2 f(10) g = 3f g(10) (f^2)(10) # 因为我们已经定义了函数乘法为符合函数 using Plots; gr() x = pi*(0:0.001:4) plot( x, sin.(x), c="black", label="Fun") plot!(x, (12*sin).(x), c="green", label="Num * Fun") plot!(x, (sin*12).(x), c="red", alpha=0.9, label="Fun * Num") plot!(x, (5*sin*exp).(x), c="blue", alpha=0.2, label="Num * Fun * Fun") plot([12*sin, sin*12, 5*sin*exp], 0:.01:4π, α=[1 .9 .2], c=[:green :red :blue]) # ------------------------------------------------------------------------------------------ # > “我很讨厌 $sin^2 \phi$,虽然 Laplace 用过它; # > 应该要担心 $sin^2 \phi$ 可能会引起歧义,如果说 $sin(\phi^2)$ 就不会或者说几乎不会引起歧义了,那么我们应该写 $(sin \phi)^2$,而不是 # $sin^2 \phi$,以此类推 $sin^2 \phi$应该指的是 $sin(sin \phi)$。” # > # > —— Gauss # ------------------------------------------------------------------------------------------ x=(0:.01:2) * pi; plot(x, (sin^2).(x), c="blue") # 乘方能工作,y=sin(sin(x)),Gauss会开心的! plot!(x, sin.(x).^2, c="red") # ------------------------------------------------------------------------------------------ # ## 练习 # ------------------------------------------------------------------------------------------ h(a, b::Any) = "fallback" h(a::Number, b::Number) = "a and b are both numbers" h(a::Number, b) = "a is a number" h(a, b::Number) = "b is a number" h(a::Integer, b::Integer) = "a and b are both integers" # 试着把玩 h,尝试使用 h 的 5 种方法 # 在此作答
[ 198, 2, 16529, 22369, 438, 198, 2, 1303, 36469, 21253, 229, 235, 162, 112, 122, 20998, 239, 198, 2, 198, 2, 12429, 13783, 21253, 229, 235, 162, 112, 122, 20998, 239, 1174, 42468, 32573, 247, 163, 107, 229, 11295, 2070, 17358, 223, 162, 236, 95, 163, 112, 95, 21410, 16980, 544, 21410, 31660, 10310, 103, 17739, 111, 165, 242, 106, 31965, 117, 45250, 100, 16764, 198, 2, 198, 2, 10263, 106, 225, 17312, 231, 27950, 102, 12859, 236, 33232, 104, 34460, 253, 28156, 222, 20998, 239, 16764, 22522, 225, 20046, 253, 164, 106, 102, 164, 121, 107, 20015, 114, 20998, 107, 162, 233, 241, 161, 109, 243, 23513, 20998, 107, 164, 106, 122, 164, 106, 94, 161, 240, 234, 162, 249, 112, 25001, 121, 162, 232, 232, 163, 236, 102, 16764, 198, 2, 198, 2, 10263, 106, 225, 20998, 107, 47797, 121, 42468, 33176, 114, 26193, 234, 164, 106, 94, 163, 106, 245, 20998, 244, 36181, 245, 34932, 235, 32014, 163, 103, 223, 163, 254, 112, 21410, 165, 95, 226, 17739, 228, 16764, 198, 2, 198, 2, 22492, 36469, 100, 163, 118, 110, 198, 2, 352, 13, 13328, 121, 245, 165, 102, 105, 46763, 108, 27764, 245, 198, 2, 362, 13, 10263, 229, 121, 46763, 108, 198, 2, 513, 13, 10263, 117, 114, 26193, 234, 164, 106, 94, 163, 106, 245, 198, 2, 16529, 22369, 438, 198, 198, 2, 16529, 22369, 438, 198, 2, 22492, 352, 13, 13328, 121, 245, 165, 102, 105, 46763, 108, 27764, 245, 171, 120, 230, 163, 236, 102, 163, 236, 102, 171, 120, 231, 198, 2, 16529, 22369, 438, 198, 198, 2, 16529, 22369, 438, 198, 2, 10545, 230, 239, 20015, 105, 30266, 98, 22522, 248, 20046, 231, 31660, 10310, 103, 1174, 23877, 108, 163, 119, 241, 162, 252, 226, 1174, 26193, 101, 163, 97, 118, 163, 121, 245, 165, 102, 105, 46763, 108, 27764, 245, 16764, 10310, 118, 12859, 228, 43095, 160, 122, 123, 37863, 247, 47987, 163, 254, 223, 171, 120, 234, 22755, 239, 20015, 105, 49546, 20998, 103, 32003, 225, 164, 247, 239, 657, 10263, 230, 108, 860, 16764, 198, 2, 198, 2, 12429, 163, 119, 225, 20046, 254, 1174, 171, 120, 248, 162, 233, 241, 161, 109, 243, 26344, 108, 162, 249, 112, 32014, 21410, 46763, 108, 27764, 245, 16764, 171, 120, 230, 26344, 104, 33232, 246, 12859, 228, 163, 121, 245, 165, 102, 105, 46763, 108, 27764, 245, 42468, 39355, 223, 32573, 249, 26344, 114, 164, 106, 94, 46763, 108, 163, 111, 119, 163, 119, 253, 171, 120, 223, 171, 120, 231, 198, 2, 16529, 22369, 438, 198, 198, 7249, 7993, 198, 220, 220, 220, 299, 3712, 5317, 198, 437, 198, 198, 14881, 13, 12860, 7, 952, 3712, 9399, 11, 374, 3712, 32454, 8, 796, 3601, 7, 952, 11, 705, 158, 227, 108, 6, 1343, 357, 81, 13, 77, 532, 352, 8, 4064, 838, 1267, 220, 1303, 10545, 120, 224, 12859, 106, 21410, 23626, 122, 163, 97, 118, 171, 120, 249, 6, 158, 227, 108, 6, 42468, 31660, 10310, 103, 3118, 291, 1098, 163, 121, 245, 165, 102, 105, 46763, 108, 27764, 245, 198, 198, 2, 16529, 22369, 438, 198, 2, 10545, 230, 239, 20015, 105, 20998, 107, 20015, 98, 161, 225, 237, 32573, 247, 43718, 115, 26344, 249, 161, 119, 118, 31660, 10310, 103, 32573, 247, 10310, 103, 163, 109, 119, 161, 252, 233, 21410, 43380, 117, 164, 109, 94, 171, 120, 248, 198, 2, 16529, 22369, 438, 198, 198, 32454, 7, 19, 8, 198, 198, 4906, 1659, 12195, 58, 20, 642, 13, 15, 7993, 7, 20, 8, 366, 20029, 1, 705, 20, 6, 220, 642, 1003, 16, 12962, 198, 198, 2, 16529, 22369, 438, 198, 2, 13328, 242, 101, 163, 121, 245, 165, 102, 105, 46763, 108, 27764, 245, 162, 120, 224, 12859, 106, 28839, 108, 33699, 241, 39355, 108, 46763, 108, 163, 119, 226, 171, 120, 248, 198, 2, 16529, 22369, 438, 198, 198, 87, 796, 685, 22, 352, 362, 642, 807, 860, 60, 198, 32454, 12195, 87, 8, 220, 220, 1303, 7548, 284, 3975, 7, 32454, 11, 2124, 8, 220, 393, 220, 685, 32454, 7, 86, 8, 329, 266, 287, 2124, 60, 198, 198, 2, 16529, 22369, 438, 198, 2, 5525, 99, 223, 42468, 47797, 121, 161, 225, 237, 162, 247, 106, 34460, 248, 46763, 108, 27764, 245, 165, 224, 96, 43718, 115, 163, 119, 247, 163, 121, 245, 165, 102, 105, 46763, 108, 27764, 245, 161, 223, 248, 27950, 254, 37345, 243, 22887, 109, 25001, 121, 12859, 228, 171, 120, 248, 198, 2, 16529, 22369, 438, 198, 198, 32454, 7, 19, 8, 1343, 7993, 7, 20, 8, 198, 198, 2, 16529, 22369, 438, 198, 2, 220, 19526, 228, 22300, 220, 38834, 163, 253, 98, 34402, 241, 46237, 98, 45250, 236, 20046, 230, 161, 223, 248, 16764, 198, 2, 10545, 230, 239, 20015, 105, 20998, 107, 20015, 98, 34460, 248, 32573, 229, 4600, 11748, 63, 10263, 229, 121, 46763, 108, 4600, 10, 63, 10263, 117, 35050, 233, 241, 161, 109, 243, 22522, 225, 21410, 22522, 248, 20046, 231, 30266, 98, 46763, 247, 22300, 13328, 119, 247, 163, 121, 245, 165, 102, 105, 46763, 108, 27764, 245, 161, 223, 248, 27950, 254, 37345, 243, 171, 120, 248, 198, 2, 16529, 22369, 438, 198, 198, 11748, 7308, 25, 1343, 11, 1635, 198, 198, 33747, 64, 3712, 32454, 11, 275, 3712, 32454, 8, 796, 7993, 7, 64, 13, 77, 1343, 275, 13, 77, 8, 198, 198, 32454, 7, 19, 8, 1343, 7993, 7, 20, 8, 198, 198, 2, 16529, 22369, 438, 198, 2, 5525, 123, 247, 43718, 115, 22887, 109, 163, 119, 247, 49035, 121, 46763, 108, 4600, 10, 63, 12429, 162, 115, 119, 27950, 254, 12859, 228, 31660, 10310, 103, 23877, 108, 43095, 37345, 243, 1174, 171, 120, 248, 198, 2, 16529, 22369, 438, 198, 198, 24396, 82, 7, 28988, 198, 198, 31, 4758, 7993, 7, 19, 8, 1343, 7993, 7, 20, 8, 198, 198, 11748, 7308, 15885, 198, 9, 7, 72, 3712, 32454, 11, 474, 3712, 32454, 8, 796, 7993, 7, 72, 13, 77, 1635, 474, 13, 77, 8, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 7854, 541, 306, 588, 257, 7993, 198, 198, 32454, 7, 18, 8, 1635, 7993, 7, 17, 8, 198, 198, 32454, 12195, 16, 25, 18, 8, 764, 9, 685, 32454, 7, 16, 8, 7993, 7, 17, 8, 7993, 7, 18, 15437, 198, 198, 2, 16529, 22369, 438, 198, 2, 220, 19526, 228, 42468, 22755, 239, 20015, 105, 21410, 20046, 246, 37345, 243, 20015, 235, 17312, 231, 31660, 12859, 249, 29785, 106, 165, 95, 246, 198, 2, 16529, 22369, 438, 198, 198, 32454, 7, 18, 8, 1635, 362, 198, 198, 2, 616, 22355, 10263, 229, 121, 46763, 108, 33566, 106, 30298, 235, 161, 253, 118, 12859, 236, 163, 109, 119, 161, 252, 233, 30266, 98, 26344, 97, 23877, 255, 46237, 98, 161, 223, 248, 20015, 222, 20046, 230, 171, 120, 234, 36181, 230, 13783, 235, 30266, 224, 198, 2, 220, 38834, 18796, 101, 162, 233, 227, 33232, 225, 171, 120, 234, 162, 249, 112, 25001, 121, 21410, 43095, 37345, 243, 165, 102, 105, 41468, 22887, 109, 30266, 98, 198, 8818, 616, 22355, 7, 72, 11, 73, 8, 198, 220, 611, 318, 64, 7, 72, 11, 32454, 8, 1222, 318, 64, 7, 73, 11, 15057, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 220, 6070, 7, 16, 11, 1312, 13, 77, 11, 474, 8, 220, 220, 1303, 1312, 416, 474, 17593, 351, 3392, 198, 220, 220, 220, 2073, 361, 220, 220, 220, 318, 64, 7, 72, 11, 15057, 8, 1222, 318, 64, 7, 73, 11, 32454, 8, 220, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 366, 47249, 226, 1, 61, 357, 72, 9, 73, 13, 77, 8, 220, 220, 1303, 220, 1312, 1635, 474, 3772, 6698, 198, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 7203, 40, 2094, 470, 760, 4943, 198, 220, 220, 220, 886, 198, 437, 198, 198, 1820, 22355, 7, 19, 11, 32454, 7, 18, 4008, 1303, 1105, 10310, 103, 163, 105, 239, 164, 226, 116, 198, 198, 1820, 22355, 7, 32454, 7, 19, 828, 18, 8, 1303, 604, 87, 18, 21410, 17739, 101, 16, 163, 253, 102, 165, 246, 113, 198, 198, 2, 16529, 22369, 438, 198, 2, 42164, 222, 163, 106, 222, 39355, 243, 21410, 22522, 252, 163, 236, 108, 43095, 28156, 237, 42468, 23626, 236, 163, 94, 106, 22522, 248, 20046, 231, 31660, 10310, 103, 4600, 32454, 63, 10263, 240, 234, 31660, 10310, 103, 46763, 108, 27764, 245, 21410, 20046, 246, 37345, 243, 16764, 22755, 239, 20015, 105, 20998, 107, 20015, 98, 162, 234, 231, 22755, 239, 20015, 105, 21410, 46349, 111, 37345, 243, 30266, 98, 22522, 248, 20046, 231, 171, 120, 248, 198, 2, 16529, 22369, 438, 198, 198, 9, 7, 72, 3712, 15057, 11, 474, 3712, 32454, 8, 796, 366, 47249, 226, 1, 61, 357, 72, 9, 73, 13, 77, 8, 220, 220, 220, 1303, 1312, 1635, 474, 10310, 103, 163, 105, 239, 164, 226, 116, 198, 198, 9, 7, 72, 3712, 32454, 11, 474, 3712, 15057, 8, 796, 220, 220, 6070, 7, 16, 11, 1312, 13, 77, 11, 474, 8, 1303, 1312, 1635, 474, 21410, 163, 253, 102, 165, 246, 113, 198, 198, 18, 1635, 7993, 7, 18, 8, 1303, 860, 10310, 103, 163, 105, 239, 164, 226, 116, 198, 198, 32454, 7, 18, 8, 1635, 642, 220, 1303, 513, 9, 20, 21410, 17739, 101, 16, 163, 253, 102, 165, 246, 113, 198, 198, 83, 7, 87, 3712, 32454, 11, 88, 3712, 32454, 8, 796, 2124, 13, 77, 1635, 331, 13, 77, 198, 198, 83, 7, 32454, 7, 20, 828, 32454, 7, 19, 4008, 198, 198, 2, 10545, 111, 101, 35707, 237, 22522, 225, 21410, 162, 109, 229, 163, 120, 244, 47987, 163, 254, 223, 42468, 13783, 248, 163, 112, 100, 49035, 239, 171, 120, 223, 198, 31, 8189, 62, 30191, 256, 7, 32454, 7, 17, 828, 32454, 7, 19, 4008, 198, 198, 2, 16529, 22369, 438, 198, 2, 22492, 10263, 229, 121, 46763, 108, 198, 2, 16529, 22369, 438, 198, 198, 11748, 7308, 25, 1635, 11, 1343, 11, 10563, 198, 198, 9, 7, 17394, 3712, 15057, 11, 220, 220, 308, 3712, 22203, 8, 796, 2124, 4613, 26367, 1635, 308, 7, 87, 8, 220, 220, 1303, 10545, 254, 229, 34932, 237, 20046, 246, 20015, 98, 49035, 121, 46763, 108, 198, 198, 9, 7, 69, 3712, 22203, 11, 7377, 119, 3712, 15057, 8, 220, 220, 796, 2124, 4613, 277, 7, 39377, 1635, 2124, 8, 220, 220, 1303, 21589, 262, 4578, 198, 198, 9, 7, 69, 3712, 22203, 11, 308, 3712, 22203, 8, 796, 2124, 4613, 277, 7, 70, 7, 87, 4008, 220, 220, 220, 1303, 36469, 235, 28938, 230, 49035, 121, 46763, 108, 220, 1377, 10545, 119, 98, 18796, 101, 163, 105, 99, 20998, 115, 171, 120, 223, 220, 10263, 250, 101, 16980, 544, 15, 13, 21, 40792, 45635, 18796, 101, 3467, 21170, 198, 198, 61, 7, 69, 3712, 22203, 11, 299, 3712, 46541, 8, 796, 299, 6624, 352, 5633, 277, 1058, 277, 9, 69, 61, 7, 77, 12, 16, 8, 1303, 220, 31660, 10310, 103, 34460, 248, 32573, 229, 34460, 240, 37605, 240, 20046, 246, 37345, 243, 22522, 252, 163, 236, 108, 21410, 25465, 40367, 253, 21410, 162, 109, 224, 33176, 224, 163, 106, 245, 37345, 243, 198, 198, 33747, 69, 3712, 22203, 11, 308, 3712, 22203, 8, 796, 2124, 4613, 277, 7, 87, 8, 1343, 308, 7, 87, 8, 198, 198, 2, 16529, 22369, 438, 198, 2, 220, 10310, 122, 10310, 103, 160, 122, 233, 36310, 171, 120, 234, 22522, 248, 20046, 231, 22755, 238, 32573, 247, 43718, 115, 21410, 162, 234, 229, 46763, 108, 49035, 121, 46763, 108, 198, 2, 198, 2, 32382, 59, 11201, 7, 87, 8, 796, 3467, 16345, 23330, 77, 28, 15, 92, 61, 59, 259, 19628, 3467, 31944, 90, 16, 18477, 77, 0, 92, 2124, 61, 77, 13, 13702, 198, 2, 198, 2, 10545, 230, 239, 20015, 105, 20998, 107, 20015, 98, 162, 232, 232, 22522, 225, 40367, 233, 22755, 238, 42468, 32573, 247, 43718, 115, 21410, 49035, 121, 46763, 108, 171, 120, 248, 198, 2, 198, 2, 32382, 59, 11201, 796, 3467, 16345, 23330, 77, 28, 15, 92, 61, 59, 259, 19628, 3467, 31944, 90, 16, 18477, 77, 0, 92, 3467, 11018, 26224, 90, 79, 322, 92, 62, 77, 11, 13702, 198, 2, 198, 2, 10263, 227, 114, 40792, 39280, 11018, 26224, 90, 79, 322, 92, 62, 77, 7, 87, 8, 796, 2124, 61, 77, 35307, 198, 2, 198, 2, 27332, 120, 230, 28156, 222, 34650, 233, 18796, 101, 46763, 108, 27764, 245, 162, 101, 94, 163, 111, 232, 163, 105, 99, 20998, 115, 171, 120, 223, 171, 120, 231, 198, 2, 16529, 22369, 438, 198, 198, 79, 322, 7, 77, 8, 796, 2124, 4613, 2124, 61, 77, 198, 198, 1820, 11201, 796, 2160, 7, 16, 14, 22584, 5132, 7, 14261, 7, 77, 4008, 1635, 7182, 7, 77, 8, 329, 299, 287, 657, 25, 3064, 8, 220, 220, 1303, 10545, 243, 230, 163, 236, 229, 19526, 236, 21410, 37345, 108, 47947, 240, 163, 118, 100, 46763, 108, 171, 120, 223, 198, 198, 58, 1820, 11201, 7, 16, 1776, 1033, 7, 16, 1776, 1033, 7, 14261, 7, 16, 4008, 60, 198, 198, 69, 796, 2124, 4613, 2124, 61, 17, 198, 69, 7, 940, 8, 198, 198, 70, 796, 513, 69, 198, 70, 7, 940, 8, 198, 198, 7, 69, 61, 17, 5769, 940, 8, 220, 1303, 10263, 249, 254, 10310, 118, 22755, 239, 20015, 105, 32432, 110, 163, 119, 237, 22522, 248, 20046, 231, 12859, 228, 49035, 121, 46763, 108, 20046, 246, 37345, 243, 10310, 118, 163, 105, 99, 28938, 230, 49035, 121, 46763, 108, 198, 198, 3500, 1345, 1747, 26, 198, 2164, 3419, 198, 198, 87, 796, 31028, 9, 7, 15, 25, 15, 13, 8298, 25, 19, 8, 198, 198, 29487, 7, 2124, 11, 220, 7813, 12195, 87, 828, 220, 220, 220, 220, 220, 220, 220, 269, 2625, 13424, 1600, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6167, 2625, 24629, 4943, 198, 29487, 0, 7, 87, 11, 357, 1065, 9, 31369, 737, 7, 87, 828, 220, 220, 220, 269, 2625, 14809, 1600, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6167, 2625, 33111, 1635, 11138, 4943, 198, 29487, 0, 7, 87, 11, 357, 31369, 9, 1065, 737, 7, 87, 828, 220, 220, 220, 269, 2625, 445, 1600, 220, 220, 17130, 28, 15, 13, 24, 11, 6167, 2625, 24629, 1635, 31835, 4943, 198, 29487, 0, 7, 87, 11, 357, 20, 9, 31369, 9, 11201, 737, 7, 87, 828, 269, 2625, 17585, 1600, 220, 17130, 28, 15, 13, 17, 11, 6167, 2625, 33111, 1635, 11138, 1635, 11138, 4943, 198, 198, 29487, 26933, 1065, 9, 31369, 11, 7813, 9, 1065, 11, 642, 9, 31369, 9, 11201, 4357, 657, 25, 13, 486, 25, 19, 46582, 11, 26367, 41888, 16, 764, 24, 764, 17, 4357, 269, 41888, 25, 14809, 1058, 445, 1058, 17585, 12962, 198, 198, 2, 16529, 22369, 438, 198, 2, 1875, 564, 250, 22755, 239, 36181, 42062, 106, 101, 43889, 234, 720, 31369, 61, 17, 3467, 34846, 3, 171, 120, 234, 164, 50159, 47078, 114, 4689, 5372, 13328, 242, 101, 32573, 229, 22522, 225, 171, 120, 249, 198, 2, 1875, 10263, 118, 242, 46237, 98, 17358, 223, 162, 233, 227, 33232, 225, 720, 31369, 61, 17, 3467, 34846, 3, 10263, 237, 107, 47797, 121, 27670, 248, 28156, 243, 164, 113, 115, 29826, 100, 20046, 231, 171, 120, 234, 36685, 224, 162, 252, 250, 46237, 112, 720, 31369, 38016, 34846, 61, 17, 8, 3, 10263, 108, 109, 38834, 27670, 248, 22755, 244, 38519, 46237, 112, 49035, 254, 20046, 236, 38834, 27670, 248, 28156, 243, 164, 113, 115, 29826, 100, 20046, 231, 12859, 228, 171, 120, 234, 165, 224, 96, 20046, 230, 22755, 239, 20015, 105, 41753, 242, 46237, 98, 37863, 247, 29568, 31369, 3467, 34846, 8, 61, 17, 3, 171, 120, 234, 32003, 234, 38834, 42468, 198, 2, 720, 31369, 61, 17, 3467, 34846, 3, 171, 120, 234, 20015, 98, 29826, 97, 163, 109, 119, 162, 236, 101, 720, 31369, 61, 17, 3467, 34846, 3, 41753, 242, 46237, 98, 162, 234, 229, 21410, 42468, 720, 31369, 7, 31369, 3467, 34846, 8, 3, 16764, 447, 251, 198, 2, 1875, 198, 2, 1875, 851, 960, 12822, 1046, 198, 2, 16529, 22369, 438, 198, 198, 87, 16193, 15, 25, 13, 486, 25, 17, 8, 1635, 31028, 26, 198, 198, 29487, 7, 87, 11, 357, 31369, 61, 17, 737, 7, 87, 828, 269, 2625, 17585, 4943, 220, 220, 220, 220, 1303, 220, 20046, 246, 43095, 47797, 121, 32432, 98, 43291, 171, 120, 234, 88, 28, 31369, 7, 31369, 7, 87, 4008, 171, 120, 234, 35389, 1046, 27670, 248, 28156, 222, 33232, 225, 21410, 171, 120, 223, 198, 29487, 0, 7, 87, 11, 7813, 12195, 87, 737, 61, 17, 11, 269, 2625, 445, 4943, 220, 220, 220, 220, 220, 220, 220, 220, 220, 198, 198, 2, 16529, 22369, 438, 198, 2, 22492, 13328, 119, 225, 20046, 254, 198, 2, 16529, 22369, 438, 198, 198, 71, 7, 64, 11, 275, 3712, 7149, 8, 796, 366, 7207, 1891, 1, 198, 71, 7, 64, 3712, 15057, 11, 275, 3712, 15057, 8, 796, 366, 64, 290, 275, 389, 1111, 3146, 1, 198, 71, 7, 64, 3712, 15057, 11, 275, 8, 796, 366, 64, 318, 257, 1271, 1, 198, 71, 7, 64, 11, 275, 3712, 15057, 8, 796, 366, 65, 318, 257, 1271, 1, 198, 71, 7, 64, 3712, 46541, 11, 275, 3712, 46541, 8, 796, 366, 64, 290, 275, 389, 1111, 37014, 1, 198, 198, 2, 5525, 107, 243, 163, 251, 222, 162, 232, 232, 163, 236, 102, 289, 171, 120, 234, 22887, 251, 46237, 243, 45635, 18796, 101, 289, 13328, 248, 226, 642, 13328, 100, 235, 43095, 37345, 243, 198, 2, 10263, 250, 101, 29826, 97, 43291, 163, 18433, 198 ]
2.029293
2,970
<gh_stars>1-10 module ImageNoise using Reexport include("NoiseAPI/NoiseAPI.jl") include("ApplyNoise/ApplyNoise.jl") include("ReduceNoise/ReduceNoise.jl") @reexport using .ApplyNoise @reexport using .ReduceNoise end # module
[ 27, 456, 62, 30783, 29, 16, 12, 940, 198, 21412, 7412, 2949, 786, 198, 198, 3500, 797, 39344, 198, 198, 17256, 7203, 2949, 786, 17614, 14, 2949, 786, 17614, 13, 20362, 4943, 198, 17256, 7203, 44836, 2949, 786, 14, 44836, 2949, 786, 13, 20362, 4943, 198, 17256, 7203, 7738, 7234, 2949, 786, 14, 7738, 7234, 2949, 786, 13, 20362, 4943, 198, 198, 31, 631, 87, 634, 1262, 764, 44836, 2949, 786, 198, 31, 631, 87, 634, 1262, 764, 7738, 7234, 2949, 786, 198, 198, 437, 1303, 8265, 198 ]
2.590909
88
using CompileBot snoop_bench(BotConfig("RecipesPipeline"))
[ 3500, 3082, 576, 20630, 198, 198, 82, 3919, 404, 62, 26968, 7, 20630, 16934, 7203, 6690, 18636, 47, 541, 4470, 48774, 198 ]
2.727273
22
module Synthesize using Random, Distributions export musicFromNotes export Music export default, flute, flute2, organ # instrument profiles (just a bunch of random numbers, needs revising) default = Dict{Rational, Float64}(1 => 1) flute = Dict{Rational, Float64}(1//2 => 1, 1 => 10^0.7, 2 => 10^0.6, 3 => 10^0.6, 4 => 10^-0.1, 5 => 1, 6 => 10^-0.3, 7 => 10^-0.7, 8 => 10^-0.7) flute2 = Dict{Rational, Float64}(1//2 => 2^-8, 1 => 2^-7, 2 => 2^-1.4, 3 => 2^-6, 4 => 2^-1.8, 5 => 2^-6.7, 6 => 2^-3.3, 7 => 2^-6.6, 8 => 2^-3.4, 10 => 2^-4.6, 12 => 2^-5.1, 14 => 2^-5.9, 16 => 2^-5.8, 18 => 2^-6.4, 26 => 2^-7) organ = Dict{Rational, Float64}(1//16 => 0.5, 1//4 => 2, 1//2 => 0.2, 1 => 6, 2 => 0.2, 3 => 0.1, 4 => 4, 5 => 0.1, 6 => 0.1, 8 => 2, 12 => 1, 16 => 0.5, 20 => 0.2) # generate sound with given frequency (Hz), duration (s), and instrument profile function genSound(freq :: Real, duration :: Real, harmonics :: Dict{<:Rational, <:Real}) :: Array{Float64,1} data = Array{Float64, 1}(undef, Int64(floor(duration * 44100))) Random.seed!(123) d = Normal() multiplier = repeat([1.0], length(data)) # first and last n signals are decaying to avoid sudden bumps in signal decayLength = 500 multiplier[1:decayLength] = (1:decayLength) / decayLength multiplier[end+1-decayLength:end] = (decayLength:-1:1) / decayLength t = (1:length(data)) / 44100 data = 1000 * sum(h -> h[2] * sin.(h[1] * freq * 2 * π * t), harmonics) noise = (freq != 0 ? 20 : 0) * rand(d, length(data)) return (data + noise) .* multiplier end # generate given duration of silence silence(duration :: Real) = repeat([0], Int64(floor(duration * 44100))) # list of common note frequencies freqlist = Dict("0" => 0, "C" => 440.0 * 2^(-9/12), "C#" => 440.0 * 2^(-8/12), "D" => 440.0 * 2^(-7/12), "D#" => 440.0 * 2^(-6/12), "E" => 440.0 * 2^(-5/12), "F" => 440.0 * 2^(-4/12), "F#" => 440.0 * 2^(-3/12), "G" => 440.0 * 2^(-2/12), "G#" => 440.0 * 2^(-1/12), "A" => 440.0, "A#" => 440.0 * 2^(1/12), "H" => 440.0 * 2^(2/12)) struct Music notes :: String speed :: Number end # generate a music from list of notes in a string, with given instrument profile function musicFromNotes(music :: Music, harmonics :: Dict{<:Rational, <:Real}) :: Array{Float64,1} notelist = split(music.notes) sound = [] for note in notelist duration = 1 notedata = split(note, "-") if length(notedata) > 1 duration = parse(Float64, notedata[2]) end octave = count(isequal('\''), notedata[1]) notedata[1] = split(notedata[1], "'")[1] # append sound to current signal sound = vcat(sound, genSound(freqlist[notedata[1]] * 2^octave, duration*60/music.speed, harmonics)) # append a short silence after note sound = vcat(sound, silence(0.05*duration*60/music.speed)) end return sound end end
[ 21412, 26375, 956, 1096, 198, 198, 3500, 14534, 11, 46567, 507, 198, 198, 39344, 2647, 4863, 16130, 198, 39344, 7849, 198, 39344, 4277, 11, 781, 1133, 11, 781, 1133, 17, 11, 1618, 198, 198, 2, 8875, 16545, 357, 3137, 257, 7684, 286, 4738, 3146, 11, 2476, 2710, 1710, 8, 198, 12286, 796, 360, 713, 90, 49, 864, 11, 48436, 2414, 92, 7, 16, 5218, 352, 8, 198, 2704, 1133, 796, 360, 713, 90, 49, 864, 11, 48436, 2414, 92, 7, 16, 1003, 17, 5218, 352, 11, 352, 5218, 838, 61, 15, 13, 22, 11, 362, 5218, 838, 61, 15, 13, 21, 11, 513, 5218, 838, 61, 15, 13, 21, 11, 604, 5218, 838, 61, 12, 15, 13, 16, 11, 642, 5218, 352, 11, 718, 5218, 838, 61, 12, 15, 13, 18, 11, 767, 5218, 838, 61, 12, 15, 13, 22, 11, 807, 5218, 838, 61, 12, 15, 13, 22, 8, 198, 2704, 1133, 17, 796, 360, 713, 90, 49, 864, 11, 48436, 2414, 92, 7, 16, 1003, 17, 5218, 362, 61, 12, 23, 11, 352, 5218, 362, 61, 12, 22, 11, 362, 5218, 362, 61, 12, 16, 13, 19, 11, 513, 5218, 362, 61, 12, 21, 11, 604, 5218, 362, 61, 12, 16, 13, 23, 11, 642, 5218, 362, 61, 12, 21, 13, 22, 11, 718, 5218, 362, 61, 12, 18, 13, 18, 11, 767, 5218, 362, 61, 12, 21, 13, 21, 11, 807, 5218, 362, 61, 12, 18, 13, 19, 11, 838, 5218, 362, 61, 12, 19, 13, 21, 11, 1105, 5218, 362, 61, 12, 20, 13, 16, 11, 1478, 5218, 362, 61, 12, 20, 13, 24, 11, 1467, 5218, 362, 61, 12, 20, 13, 23, 11, 1248, 5218, 362, 61, 12, 21, 13, 19, 11, 2608, 5218, 362, 61, 12, 22, 8, 198, 9971, 796, 360, 713, 90, 49, 864, 11, 48436, 2414, 92, 7, 16, 1003, 1433, 5218, 657, 13, 20, 11, 352, 1003, 19, 5218, 362, 11, 352, 1003, 17, 5218, 657, 13, 17, 11, 352, 5218, 718, 11, 362, 5218, 657, 13, 17, 11, 513, 5218, 657, 13, 16, 11, 604, 5218, 604, 11, 642, 5218, 657, 13, 16, 11, 718, 5218, 657, 13, 16, 11, 807, 5218, 362, 11, 1105, 5218, 352, 11, 1467, 5218, 657, 13, 20, 11, 1160, 5218, 657, 13, 17, 8, 198, 198, 2, 7716, 2128, 351, 1813, 8373, 357, 7399, 828, 9478, 357, 82, 828, 290, 8875, 7034, 198, 8818, 2429, 21369, 7, 19503, 80, 7904, 6416, 11, 9478, 7904, 6416, 11, 25625, 873, 7904, 360, 713, 90, 27, 25, 49, 864, 11, 1279, 25, 15633, 30072, 7904, 15690, 90, 43879, 2414, 11, 16, 92, 198, 220, 220, 220, 1366, 796, 15690, 90, 43879, 2414, 11, 352, 92, 7, 917, 891, 11, 2558, 2414, 7, 28300, 7, 32257, 1635, 5846, 3064, 22305, 198, 220, 220, 220, 14534, 13, 28826, 0, 7, 10163, 8, 198, 220, 220, 220, 288, 796, 14435, 3419, 198, 220, 220, 220, 33090, 796, 9585, 26933, 16, 13, 15, 4357, 4129, 7, 7890, 4008, 198, 220, 220, 220, 1303, 717, 290, 938, 299, 10425, 389, 49240, 284, 3368, 4802, 34029, 287, 6737, 198, 220, 220, 220, 22119, 24539, 796, 5323, 198, 220, 220, 220, 33090, 58, 16, 25, 12501, 323, 24539, 60, 796, 357, 16, 25, 12501, 323, 24539, 8, 1220, 22119, 24539, 198, 220, 220, 220, 33090, 58, 437, 10, 16, 12, 12501, 323, 24539, 25, 437, 60, 796, 357, 12501, 323, 24539, 21912, 16, 25, 16, 8, 1220, 22119, 24539, 198, 220, 220, 220, 256, 796, 357, 16, 25, 13664, 7, 7890, 4008, 1220, 5846, 3064, 198, 220, 220, 220, 1366, 796, 8576, 1635, 2160, 7, 71, 4613, 289, 58, 17, 60, 1635, 7813, 12195, 71, 58, 16, 60, 1635, 2030, 80, 1635, 362, 1635, 18074, 222, 1635, 256, 828, 25625, 873, 8, 198, 220, 220, 220, 7838, 796, 357, 19503, 80, 14512, 657, 5633, 1160, 1058, 657, 8, 1635, 43720, 7, 67, 11, 4129, 7, 7890, 4008, 198, 220, 220, 220, 1441, 357, 7890, 1343, 7838, 8, 764, 9, 33090, 198, 437, 198, 198, 2, 7716, 1813, 9478, 286, 9550, 198, 18217, 594, 7, 32257, 7904, 6416, 8, 796, 9585, 26933, 15, 4357, 2558, 2414, 7, 28300, 7, 32257, 1635, 5846, 3064, 22305, 198, 198, 2, 1351, 286, 2219, 3465, 19998, 198, 19503, 80, 4868, 796, 360, 713, 7203, 15, 1, 5218, 657, 11, 366, 34, 1, 5218, 33879, 13, 15, 1635, 362, 61, 32590, 24, 14, 1065, 828, 366, 34, 2, 1, 5218, 33879, 13, 15, 1635, 362, 61, 32590, 23, 14, 1065, 828, 366, 35, 1, 5218, 33879, 13, 15, 1635, 362, 61, 32590, 22, 14, 1065, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 35, 2, 1, 5218, 33879, 13, 15, 1635, 362, 61, 32590, 21, 14, 1065, 828, 366, 36, 1, 5218, 33879, 13, 15, 1635, 362, 61, 32590, 20, 14, 1065, 828, 366, 37, 1, 5218, 33879, 13, 15, 1635, 362, 61, 32590, 19, 14, 1065, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 37, 2, 1, 5218, 33879, 13, 15, 1635, 362, 61, 32590, 18, 14, 1065, 828, 366, 38, 1, 5218, 33879, 13, 15, 1635, 362, 61, 32590, 17, 14, 1065, 828, 366, 38, 2, 1, 5218, 33879, 13, 15, 1635, 362, 61, 32590, 16, 14, 1065, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 32, 1, 5218, 33879, 13, 15, 11, 366, 32, 2, 1, 5218, 33879, 13, 15, 1635, 362, 61, 7, 16, 14, 1065, 828, 366, 39, 1, 5218, 33879, 13, 15, 1635, 362, 61, 7, 17, 14, 1065, 4008, 198, 198, 7249, 7849, 198, 220, 220, 220, 4710, 7904, 10903, 198, 220, 220, 220, 2866, 7904, 7913, 198, 437, 198, 198, 2, 7716, 257, 2647, 422, 1351, 286, 4710, 287, 257, 4731, 11, 351, 1813, 8875, 7034, 198, 8818, 2647, 4863, 16130, 7, 28965, 7904, 7849, 11, 25625, 873, 7904, 360, 713, 90, 27, 25, 49, 864, 11, 1279, 25, 15633, 30072, 7904, 15690, 90, 43879, 2414, 11, 16, 92, 198, 220, 220, 220, 407, 46331, 796, 6626, 7, 28965, 13, 17815, 8, 198, 220, 220, 220, 2128, 796, 17635, 198, 220, 220, 220, 329, 3465, 287, 407, 46331, 198, 220, 220, 220, 220, 220, 220, 220, 9478, 796, 352, 198, 220, 220, 220, 220, 220, 220, 220, 4367, 1045, 796, 6626, 7, 11295, 11, 27444, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 611, 4129, 7, 1662, 276, 1045, 8, 1875, 352, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 9478, 796, 21136, 7, 43879, 2414, 11, 4367, 1045, 58, 17, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 19318, 1015, 796, 954, 7, 786, 13255, 10786, 59, 7061, 828, 4367, 1045, 58, 16, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 4367, 1045, 58, 16, 60, 796, 6626, 7, 1662, 276, 1045, 58, 16, 4357, 24018, 4943, 58, 16, 60, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 24443, 2128, 284, 1459, 6737, 198, 220, 220, 220, 220, 220, 220, 220, 2128, 796, 410, 9246, 7, 23661, 11, 2429, 21369, 7, 19503, 80, 4868, 58, 1662, 276, 1045, 58, 16, 11907, 1635, 362, 61, 38441, 1015, 11, 9478, 9, 1899, 14, 28965, 13, 12287, 11, 25625, 873, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 24443, 257, 1790, 9550, 706, 3465, 198, 220, 220, 220, 220, 220, 220, 220, 2128, 796, 410, 9246, 7, 23661, 11, 9550, 7, 15, 13, 2713, 9, 32257, 9, 1899, 14, 28965, 13, 12287, 4008, 198, 220, 220, 220, 886, 198, 220, 220, 220, 1441, 2128, 198, 437, 628, 198, 437, 198 ]
2.281931
1,284
############################################################################################ """ $(TYPEDEF) Default arguments for PMCMC constructor. # Fields $(TYPEDFIELDS) """ struct ParticleGibbs{P<:ParticleFilter,M<:MCMC} <: PMCMCKernel "Particle Filter kernel to estimate latent trajectory." pf::P "MCMC kernel to sample continuous model parameter." mcmc::M function ParticleGibbs(pf::P, mcmc::M) where {P<:ParticleFilter,M<:MCMC} @argcheck !isa(pf.tune.referencing, Marginal) "Cannot use Marginal Filter in Conditional setting, use Ancestral or Conditional referencing" return new{P,M}(pf, mcmc) end end function ParticleGibbs( filter::F, mcmc::M; kwargs... ) where {F<:ParticleFilterConstructor,M<:MCMCConstructor} return PMCMC(ParticleGibbs, filter, mcmc; kwargs...) end ############################################################################################ """ $(SIGNATURES) Propose new parameter with mcmc psampler. If update=true, objective function will be updated with input model and data. # Examples ```julia ``` """ function propose!( _rng::Random.AbstractRNG, pmcmc::ParticleGibbs, model::ModelWrapper, data::D, temperature::F = model.info.reconstruct.default.output(1.0), update::U=BaytesCore.UpdateTrue(), ) where {D,F<:AbstractFloat, U<:BaytesCore.UpdateBool} ## Get trajectory via PF - always update data.latent in model _, pf_diagnostics = propose!(_rng, pmcmc.pf, model, data, temperature, update) ## Propose new θₜ - if accepted, model is updated accordingly _, mcmc_diagnostics = propose!(_rng, pmcmc.mcmc, model, data, temperature, update) ## Assign base diagnostics - ℓobjective and predictions are taken from particle filter diagnostics = BaytesCore.BaseDiagnostics( pf_diagnostics.base.ℓobjective, pf_diagnostics.base.temperature, pf_diagnostics.base.prediction, mcmc_diagnostics.base.iter ) ## Return pmcmc output return model.val, PMCMCDiagnostics(diagnostics, pf_diagnostics, mcmc_diagnostics) end ############################################################################################ #export export ParticleGibbs, propose!
[ 29113, 29113, 14468, 7804, 4242, 198, 37811, 198, 3, 7, 9936, 47, 1961, 25425, 8, 198, 198, 19463, 7159, 329, 3122, 34, 9655, 23772, 13, 198, 198, 2, 23948, 198, 3, 7, 9936, 47, 1961, 11674, 3698, 5258, 8, 198, 37811, 198, 7249, 2142, 1548, 38, 571, 1443, 90, 47, 27, 25, 7841, 1548, 22417, 11, 44, 27, 25, 9655, 9655, 92, 1279, 25, 3122, 34, 9655, 42, 7948, 198, 220, 220, 220, 366, 7841, 1548, 25853, 9720, 284, 8636, 41270, 22942, 526, 198, 220, 220, 220, 279, 69, 3712, 47, 198, 220, 220, 220, 366, 9655, 9655, 9720, 284, 6291, 12948, 2746, 11507, 526, 198, 220, 220, 220, 285, 11215, 66, 3712, 44, 198, 220, 220, 220, 2163, 2142, 1548, 38, 571, 1443, 7, 79, 69, 3712, 47, 11, 285, 11215, 66, 3712, 44, 8, 810, 1391, 47, 27, 25, 7841, 1548, 22417, 11, 44, 27, 25, 9655, 9655, 92, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 853, 9122, 5145, 9160, 7, 79, 69, 13, 83, 1726, 13, 5420, 14226, 2259, 11, 11899, 1292, 8, 366, 34, 34574, 779, 11899, 1292, 25853, 287, 9724, 1859, 4634, 11, 779, 31200, 1373, 393, 9724, 1859, 32578, 1, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 649, 90, 47, 11, 44, 92, 7, 79, 69, 11, 285, 11215, 66, 8, 198, 220, 220, 220, 886, 198, 437, 198, 8818, 2142, 1548, 38, 571, 1443, 7, 198, 220, 220, 220, 8106, 3712, 37, 11, 285, 11215, 66, 3712, 44, 26, 479, 86, 22046, 986, 198, 8, 810, 1391, 37, 27, 25, 7841, 1548, 22417, 42316, 273, 11, 44, 27, 25, 9655, 9655, 42316, 273, 92, 198, 220, 220, 220, 1441, 3122, 34, 9655, 7, 7841, 1548, 38, 571, 1443, 11, 8106, 11, 285, 11215, 66, 26, 479, 86, 22046, 23029, 198, 437, 198, 198, 29113, 29113, 14468, 7804, 4242, 198, 37811, 198, 3, 7, 46224, 47471, 8, 198, 24331, 577, 649, 11507, 351, 285, 11215, 66, 26692, 321, 20053, 13, 1002, 4296, 28, 7942, 11, 9432, 2163, 481, 307, 6153, 351, 5128, 2746, 290, 1366, 13, 198, 198, 2, 21066, 198, 15506, 63, 73, 43640, 198, 15506, 63, 198, 198, 37811, 198, 8818, 18077, 0, 7, 198, 220, 220, 220, 4808, 81, 782, 3712, 29531, 13, 23839, 49, 10503, 11, 198, 220, 220, 220, 9114, 11215, 66, 3712, 7841, 1548, 38, 571, 1443, 11, 198, 220, 220, 220, 2746, 3712, 17633, 36918, 2848, 11, 198, 220, 220, 220, 1366, 3712, 35, 11, 198, 220, 220, 220, 5951, 3712, 37, 796, 2746, 13, 10951, 13, 260, 41571, 13, 12286, 13, 22915, 7, 16, 13, 15, 828, 198, 220, 220, 220, 4296, 3712, 52, 28, 15262, 4879, 14055, 13, 10260, 17821, 22784, 198, 8, 810, 1391, 35, 11, 37, 27, 25, 23839, 43879, 11, 471, 27, 25, 15262, 4879, 14055, 13, 10260, 33, 970, 92, 198, 220, 220, 220, 22492, 3497, 22942, 2884, 28223, 532, 1464, 4296, 1366, 13, 15460, 298, 287, 2746, 198, 220, 220, 220, 4808, 11, 279, 69, 62, 47356, 34558, 796, 18077, 0, 28264, 81, 782, 11, 9114, 11215, 66, 13, 79, 69, 11, 2746, 11, 1366, 11, 5951, 11, 4296, 8, 198, 220, 220, 220, 22492, 1041, 3455, 649, 7377, 116, 158, 224, 250, 532, 611, 6292, 11, 2746, 318, 6153, 16062, 198, 220, 220, 220, 4808, 11, 285, 11215, 66, 62, 47356, 34558, 796, 18077, 0, 28264, 81, 782, 11, 9114, 11215, 66, 13, 76, 11215, 66, 11, 2746, 11, 1366, 11, 5951, 11, 4296, 8, 198, 220, 220, 220, 22492, 2195, 570, 2779, 6689, 34558, 532, 2343, 226, 241, 15252, 425, 290, 16277, 389, 2077, 422, 18758, 8106, 198, 220, 220, 220, 6689, 34558, 796, 4696, 4879, 14055, 13, 14881, 18683, 4660, 34558, 7, 198, 220, 220, 220, 220, 220, 220, 220, 279, 69, 62, 47356, 34558, 13, 8692, 13, 158, 226, 241, 15252, 425, 11, 279, 69, 62, 47356, 34558, 13, 8692, 13, 11498, 21069, 11, 279, 69, 62, 47356, 34558, 13, 8692, 13, 28764, 2867, 11, 198, 220, 220, 220, 220, 220, 220, 220, 285, 11215, 66, 62, 47356, 34558, 13, 8692, 13, 2676, 198, 220, 220, 220, 1267, 198, 220, 220, 220, 22492, 8229, 9114, 11215, 66, 5072, 198, 220, 220, 220, 1441, 2746, 13, 2100, 11, 3122, 24187, 8610, 72, 4660, 34558, 7, 47356, 34558, 11, 279, 69, 62, 47356, 34558, 11, 285, 11215, 66, 62, 47356, 34558, 8, 198, 437, 198, 198, 29113, 29113, 14468, 7804, 4242, 198, 2, 39344, 198, 39344, 2142, 1548, 38, 571, 1443, 11, 18077, 0, 198 ]
2.925433
751
<gh_stars>0 # --- # title: 363. Max Sum of Rectangle No Larger Than K # id: problem363 # author: <NAME> # date: 2020-10-31 # difficulty: Hard # categories: Binary Search, Dynamic Programming, Queue # link: <https://leetcode.com/problems/max-sum-of-rectangle-no-larger-than-k/description/> # hidden: true # --- # # Given a non-empty 2D matrix _matrix_ and an integer _k_ , find the max sum of # a rectangle in the _matrix_ such that its sum is no larger than _k_. # # **Example:** # # # # Input: matrix = [[1,0,1],[0,-2,3]], k = 2 # Output: 2 # Explanation: Because the sum of rectangle [[0, 1], [-2, 3]] is 2, # and 2 is the max number no larger than k (k = 2). # # **Note:** # # 1. The rectangle inside the matrix must have an area > 0. # 2. What if the number of rows is much larger than the number of columns? # # ## @lc code=start using LeetCode ## add your code here: ## @lc code=end
[ 27, 456, 62, 30783, 29, 15, 198, 2, 11420, 198, 2, 3670, 25, 49327, 13, 5436, 5060, 286, 48599, 9248, 1400, 406, 32270, 17924, 509, 198, 2, 4686, 25, 1917, 35447, 198, 2, 1772, 25, 1279, 20608, 29, 198, 2, 3128, 25, 12131, 12, 940, 12, 3132, 198, 2, 8722, 25, 6912, 198, 2, 9376, 25, 45755, 11140, 11, 26977, 30297, 11, 4670, 518, 198, 2, 2792, 25, 1279, 5450, 1378, 293, 316, 8189, 13, 785, 14, 1676, 22143, 14, 9806, 12, 16345, 12, 1659, 12, 2554, 9248, 12, 3919, 12, 15521, 263, 12, 14813, 12, 74, 14, 11213, 15913, 198, 2, 7104, 25, 2081, 198, 2, 11420, 198, 2, 220, 198, 2, 11259, 257, 1729, 12, 28920, 362, 35, 17593, 4808, 6759, 8609, 62, 290, 281, 18253, 4808, 74, 62, 837, 1064, 262, 3509, 2160, 286, 198, 2, 257, 35991, 287, 262, 4808, 6759, 8609, 62, 884, 326, 663, 2160, 318, 645, 4025, 621, 4808, 74, 44807, 198, 2, 220, 198, 2, 12429, 16281, 25, 1174, 198, 2, 220, 198, 2, 220, 220, 220, 220, 220, 198, 2, 220, 220, 220, 220, 220, 198, 2, 220, 220, 220, 220, 23412, 25, 17593, 796, 16410, 16, 11, 15, 11, 16, 38430, 15, 12095, 17, 11, 18, 60, 4357, 479, 796, 362, 198, 2, 220, 220, 220, 220, 25235, 25, 362, 220, 198, 2, 220, 220, 220, 220, 50125, 341, 25, 220, 4362, 262, 2160, 286, 35991, 16410, 15, 11, 352, 4357, 25915, 17, 11, 513, 11907, 318, 362, 11, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 290, 362, 318, 262, 3509, 1271, 645, 4025, 621, 479, 357, 74, 796, 362, 737, 198, 2, 220, 198, 2, 12429, 6425, 25, 1174, 198, 2, 220, 198, 2, 220, 220, 352, 13, 383, 35991, 2641, 262, 17593, 1276, 423, 281, 1989, 1875, 657, 13, 198, 2, 220, 220, 362, 13, 1867, 611, 262, 1271, 286, 15274, 318, 881, 4025, 621, 262, 1271, 286, 15180, 30, 198, 2, 220, 198, 2, 220, 198, 2235, 2488, 44601, 2438, 28, 9688, 198, 3500, 1004, 316, 10669, 198, 198, 2235, 751, 534, 2438, 994, 25, 198, 2235, 2488, 44601, 2438, 28, 437, 198 ]
2.559783
368
<reponame>MattWillFlood/EntropyHub.jl<filename>src/_MSEn.jl<gh_stars>1-10 module _MSEn export MSEn, EMD using Statistics: std, mean, median, var #using DataInterpolations: CubicSpline using Dierckx: Spline1D using Plots #=function __init__() @warn("\n\n Methodx option IMF (Intrinisic Mode Function) is not stable. Random or highly aperiodic signals may not decompose fully. Access to the IMFs decomposed by the empirical mode decomposition (EMD) function can be found by calling EntropyHub.EMD(`Sig`,`MaxIMFs`). A stable EMD function will be included in future releases.\n\n") end=# """ MSx, CI = MSEn(Sig, Mobj) Returns a vector of multiscale entropy values `MSx` and the complexity index `CI` of the data sequence `Sig` using the parameters specified by the multiscale object `Mobj` over 3 temporal scales with coarse- graining (default). MSx, CI = MSEn(Sig::AbstractArray{T,1} where T<:Real, Mobj::NamedTuple; Scales::Int=3, Methodx::String="coarse", RadNew::Int=0, Plotx::Bool=false) Returns a vector of multiscale entropy values `MSx` and the complexity index `CI` of the data sequence `Sig` using the parameters specified by the multiscale object `Mobj` and the following 'keyword' arguments: # Arguments: `Scales` - Number of temporal scales, an integer > 1 (default: 3) \n `Method` - Graining method, one of the following: {`coarse`,`modified`,`imf`,`timeshift`} [default = `coarse`] For further info on these graining procedures, see the EntropyHub guide. \n `RadNew` - Radius rescaling method, an integer in the range [1 4]. When the entropy specified by `Mobj` is `SampEn` or `ApEn`, RadNew allows the radius threshold to be updated at each time scale (Xt). If a radius value is specified by `Mobj` (`r`), this becomes the rescaling coefficient, otherwise it is set to 0.2 (default). The value of RadNew specifies one of the following methods:\n [1] Standard Deviation - r*std(Xt)\n [2] Variance - r*var(Xt) \n [3] Mean Absolute Deviation - r*mean_ad(Xt) \n [4] Median Absolute Deviation - r*med_ad(Xt)\n `Plotx` - When Plotx == true, returns a plot of the entropy value at each time scale (i.e. the multiscale entropy curve) [default: false]\n `For further info on these graining procedures see the EntropyHub guide.` # See also `MSobject`, `rMSEn`, `cMSEn`, `hMSEn`, `SampEn`, `ApEn`, `XMSEn` # References: [1] <NAME>, <NAME>, and <NAME>, "Multiscale entropy analysis of complex physiologic time series." Physical review letters 89.6 (2002): 068102. [2] <NAME>, and <NAME>, "Comment on “Multiscale entropy analysis of complex physiologic time series”." Physical review letters 92.8 (2004): 089803. [3] <NAME>, <NAME>, and <NAME>. "<NAME>, and Peng reply." Physical Review Letters 92.8 (2004): 089804. [4] <NAME>, <NAME> and <NAME>, "Multiscale entropy analysis of biological signals." Physical review E 71.2 (2005): 021906. [5] <NAME> and <NAME>, "On multiscale entropy analysis for physiological data." Physica A: Statistical Mechanics and its Applications 366 (2006): 323-332. [6] <NAME> and <NAME>, "Intrinsic mode entropy based on multivariate empirical mode decomposition and its application to neural data analysis." Cognitive neurodynamics 5.3 (2011): 277-284. [7] <NAME> "The multiscale entropy algorithm and its variants: A review." Entropy 17.5 (2015): 3110-3123. [8] <NAME>, et al., "Multiscale entropy analysis of biological signals: a fundamental bi-scaling law." Frontiers in computational neuroscience 9 (2015): 64. [9] <NAME>, et al., "Multiscale Sample Entropy of cardiovascular signals: Does the choice between fixed-or varying-tolerance among scales influence its evaluation and interpretation?." Entropy 19.11 (2017): 590. [10] <NAME>, "Time-shift multiscale entropy analysis of physiological signals." Entropy 19.6 (2017): 257. [11] <NAME> and <NAME>, "Coarse-graining approaches in univariate multiscale sample and dispersion entropy." Entropy 20.2 (2018): 138. """ function MSEn(Sig::AbstractArray{T,1} where T<:Real, Mobj::NamedTuple; Scales::Int=3, Methodx::String="coarse", RadNew::Int=0, Plotx::Bool=false) (size(Sig,1)>10) ? nothing : error("Sig: must be a numeric vector" ) (length(Mobj) >= 1) ? nothing : error("Mobj: must be a multiscale entropy object created with the function EntropyHub.MSobject") (Scales>1) ? nothing : error("Scales: must be an integer > 1") (lowercase(Methodx) in ["coarse","modified","imf","timeshift"]) ? nothing : error("Method: must be one of the following string names - 'coarse','modified','imf','timeshift'") (RadNew==0 || (RadNew in 1:4 && String(Symbol(Mobj.Func)) in ("SampEn","ApEn"))) ? nothing : error("RadNew: must be 0, or an integer in range [1 4] with entropy function 'SampEn' or 'ApEn'") if lowercase(Methodx)=="imf" Sig,_ = EMD(Sig,Scales-1) sum(all(Sig.==0,dims=2))==0 ? nothing : Sig = Sig[all(Sig.!=0,dims=2),:] Scales >= size(Sig,1) ? nothing : @warn("Max number of IMF's decomposed from EMD is less than number of Scales. MSEn evaluated over $(size(Sig,1)) scales instead of $Scales.") Scales = size(Sig,1) end MSx = zeros(Scales) Args = NamedTuple{keys(Mobj)[2:end]}(Mobj) Func2 = getfield(_MSEn,Symbol(lowercase(Methodx))) if RadNew > 0 if RadNew == 1 Rnew = x -> std(x, corrected=false) elseif RadNew == 2 Rnew = x -> var(x, corrected=false) elseif RadNew == 3 Rnew = x -> mean(abs.(x .- mean(x))) elseif RadNew == 4 Rnew = x -> median(abs.(x .- median(x))) end if haskey(Mobj,:r) Cx = Mobj.r else Cy = ("Standard Deviation","Variance","Mean Abs Deviation", "Median Abs Deviation") @warn("No radius value provided in Mobj. Default set to 0.2*$(Cy[RadNew]) of each new time-series.") Cx = .2 end end for T = 1:Scales print(". ") Temp = Func2(Sig,T) if lowercase(Methodx) == "timeshift" Tempx = zeros(T) for k = 1:T RadNew > 0 ? Args = (Args..., r=Cx*Rnew(Temp[k,:])) : nothing Tempy = Mobj.Func(Temp[k,:]; Args...) typeof(Tempy)<:Tuple ? Tempx[k] = Tempy[1][end] : Tempx[k] = Tempy[end] # Tempx[k] = Tempy[end] end Temp2 = mean(Tempx) else RadNew > 0 ? Args = (Args..., r=Cx*Rnew(Temp[:])) : nothing Tempx = Mobj.Func(Temp[:]; Args...) typeof(Tempx)<:Tuple ? Temp2 = Tempx[1][end] : Temp2 = Tempx[end] #Temp2 = Tempx[1][end] end MSx[T] = Temp2 end CI = sum(MSx) print("\n") if any(isnan.(MSx)) println("Some entropy values may be undefined.") end if Plotx p1 = plot(1:Scales, MSx, c=RGB(8/255, 63/255, 77/255), lw=3) scatter!(1:Scales, MSx, markersize=6, c=RGB(1, 0, 1), xlabel = "Scale Factor", ylabel = "Entropy Value", guidefont = font(12, "arial", RGB(7/255, 54/255, 66/255)), tickfontsize = 10, tickfontfamily="arial", legend=false, title = "Multiscale $(Mobj.Func) ($(titlecase(Methodx))-graining method)", plot_titlefontsize=16, plot_titlefontcolor=RGB(7/255, 54/255, 66/255)) #ylim=(0,maximum(MSx)+.2), display(p1) end return MSx, CI end function coarse(Z,sx) Ns = Int(floor(size(Z,1)/sx)) Y = mean(reshape(Z[1:sx*Ns],sx,Ns),dims=1) return Y end function modified(Z,sx) Ns = size(Z,1) - sx + 1 Y = zeros(Ns) for k = 1:Ns Y[k] = mean(Z[k:k+sx-1]) end return Y end function imf(Z,sx) Y = sum(Z[1:sx,:],dims=1) return Y end function timeshift(Z,sx) Y = reshape(Z[1:Int(sx*floor(length(Z)/sx))], (sx,Int(floor(length(Z)/sx)))) return Y end function PkFind(X) Nx = length(X) Indx = zeros(Int,Nx); for n = 2:Nx-1 if X[n-1]< X[n] > X[n+1] Indx[n] = n elseif X[n-1] < X[n] == X[n+1] k = 1 Indx[n] = n while (n+k)<Nx && X[n] == X[n+k] Indx[n+k] = n+k k+=1 end n+=k end end Indx = Indx[Indx.!==0] return Indx end function EMD(X, Scales::Int) Xt = copy(X); N = size(Xt,1); n=1; IMFs = zeros(Scales+1,N) MaxER = 20; MinTN = 2; #Xt .-= mean(Xt) r1 = Xt while n <= Scales r0 = Xt x = 0; Upx = PkFind(r0); Lwx = PkFind(-r0) UpEnv = Spline1D(Upx,r0[Upx],k=3,bc="nearest") LwEnv = Spline1D(Lwx,r0[Lwx],k=3,bc="nearest") r1 = r0.- (UpEnv.(1:N) .+ LwEnv.(1:N))./2 RT = (sum(r0.*r0) - sum(r1.*r1))/sum(r0.*r0) length(vcat(Upx,Lwx)) <= MinTN ? (LOG = "Decomposition hit minimal extrema criteria."; break) : nothing while x < 100 && RT > 0.2 r0 = 1*r1 Upx = PkFind(r0); Lwx = PkFind(-r0) UpEnv = Spline1D(Upx,r0[Upx],k=3,bc="nearest") LwEnv = Spline1D(Lwx,r0[Lwx],k=3,bc="nearest") r1 = r0.- (UpEnv.(1:N) .+ LwEnv.(1:N))./2 RT = (sum(r0.*r0) - sum(r1.*r1))/sum(r0.*r0) x += 1; 10*log10(sqrt(sum(r0.*r0))/sqrt(sum(r1.*r1))) > MaxER ? (LOG = "Decomposition hit energy ratio criteria."; break) : nothing end IMFs[n,:] = r1 Xt .-= r1 IMFs[Scales+1,:] = r0 .+ mean(X) n+=1 end LOG = "All went well :) " return IMFs, LOG end end """ Copyright 2021 <NAME>, EntropyHub Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. For Terms of Use see https://github.com/MattWillFlood/EntropyHub """
[ 27, 7856, 261, 480, 29, 13448, 8743, 7414, 702, 14, 14539, 28338, 16066, 13, 20362, 27, 34345, 29, 10677, 47835, 5653, 4834, 13, 20362, 27, 456, 62, 30783, 29, 16, 12, 940, 198, 21412, 4808, 5653, 4834, 198, 39344, 6579, 4834, 11, 412, 12740, 198, 3500, 14370, 25, 14367, 11, 1612, 11, 14288, 11, 1401, 198, 2, 3500, 6060, 9492, 16104, 602, 25, 7070, 291, 26568, 500, 198, 3500, 360, 959, 694, 87, 25, 13341, 500, 16, 35, 198, 3500, 1345, 1747, 198, 2, 28, 8818, 11593, 15003, 834, 3419, 198, 2488, 40539, 7203, 59, 77, 59, 77, 11789, 87, 3038, 25375, 357, 5317, 12769, 271, 291, 10363, 15553, 8, 318, 407, 8245, 13, 198, 14534, 393, 4047, 257, 41007, 291, 10425, 743, 407, 26969, 3455, 3938, 13, 198, 8798, 284, 262, 25375, 82, 38237, 1335, 416, 262, 21594, 4235, 26969, 9150, 357, 3620, 35, 8, 2163, 198, 460, 307, 1043, 416, 4585, 7232, 28338, 16066, 13, 3620, 35, 7, 63, 50, 328, 47671, 63, 11518, 3955, 42388, 63, 737, 198, 317, 8245, 412, 12740, 2163, 481, 307, 3017, 287, 2003, 10050, 13, 59, 77, 59, 77, 4943, 198, 437, 46249, 628, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 6579, 87, 11, 14514, 796, 6579, 4834, 7, 50, 328, 11, 16540, 73, 8, 220, 628, 220, 220, 220, 16409, 257, 15879, 286, 1963, 2304, 1000, 40709, 3815, 4600, 5653, 87, 63, 290, 262, 13357, 220, 198, 220, 220, 220, 6376, 4600, 25690, 63, 286, 262, 1366, 8379, 4600, 50, 328, 63, 1262, 262, 10007, 7368, 220, 198, 220, 220, 220, 416, 262, 1963, 2304, 1000, 2134, 4600, 44, 26801, 63, 625, 513, 21964, 16252, 351, 36076, 12, 198, 220, 220, 220, 1036, 1397, 357, 12286, 737, 220, 628, 220, 220, 220, 220, 220, 220, 220, 6579, 87, 11, 14514, 796, 6579, 4834, 7, 50, 328, 3712, 23839, 19182, 90, 51, 11, 16, 92, 810, 309, 27, 25, 15633, 11, 16540, 73, 3712, 45, 2434, 51, 29291, 26, 1446, 2040, 3712, 5317, 28, 18, 11, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 11789, 87, 3712, 10100, 2625, 1073, 17208, 1600, 5325, 3791, 3712, 5317, 28, 15, 11, 28114, 87, 3712, 33, 970, 28, 9562, 8, 628, 220, 220, 220, 16409, 257, 15879, 286, 1963, 2304, 1000, 40709, 3815, 4600, 5653, 87, 63, 290, 262, 13357, 220, 198, 220, 220, 220, 6376, 4600, 25690, 63, 286, 262, 1366, 8379, 4600, 50, 328, 63, 1262, 262, 10007, 7368, 416, 198, 220, 220, 220, 262, 1963, 2304, 1000, 2134, 4600, 44, 26801, 63, 290, 262, 1708, 705, 2539, 4775, 6, 7159, 25, 628, 220, 220, 220, 1303, 20559, 2886, 25, 198, 220, 220, 220, 4600, 3351, 2040, 63, 220, 220, 532, 7913, 286, 21964, 16252, 11, 281, 18253, 1875, 352, 220, 220, 357, 12286, 25, 513, 8, 3467, 77, 198, 220, 220, 220, 4600, 17410, 63, 220, 220, 532, 1902, 1397, 2446, 11, 530, 286, 262, 1708, 25, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1391, 63, 1073, 17208, 47671, 63, 41771, 47671, 63, 320, 69, 47671, 63, 22355, 29323, 63, 92, 685, 12286, 796, 4600, 1073, 17208, 63, 60, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1114, 2252, 7508, 319, 777, 1036, 1397, 9021, 11, 766, 262, 7232, 28338, 16066, 5698, 13, 220, 3467, 77, 198, 220, 220, 220, 4600, 15546, 3791, 63, 220, 220, 532, 48838, 6811, 4272, 2446, 11, 281, 18253, 287, 262, 2837, 685, 16, 604, 4083, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1649, 262, 40709, 7368, 416, 4600, 44, 26801, 63, 318, 4600, 50, 696, 4834, 63, 393, 4600, 25189, 4834, 47671, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5325, 3791, 3578, 262, 16874, 11387, 284, 307, 6153, 379, 1123, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 640, 5046, 357, 55, 83, 737, 1002, 257, 16874, 1988, 318, 7368, 416, 4600, 44, 26801, 63, 357, 63, 81, 63, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 428, 4329, 262, 6811, 4272, 35381, 11, 4306, 340, 318, 900, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 284, 657, 13, 17, 357, 12286, 737, 383, 1988, 286, 5325, 3791, 26052, 530, 286, 262, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1708, 5050, 7479, 77, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 685, 16, 60, 220, 220, 220, 8997, 6245, 3920, 220, 220, 220, 220, 220, 220, 220, 220, 220, 532, 374, 9, 19282, 7, 55, 83, 19415, 77, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 685, 17, 60, 220, 220, 220, 15965, 590, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 532, 374, 9, 7785, 7, 55, 83, 8, 3467, 77, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 685, 18, 60, 220, 220, 220, 22728, 36532, 6245, 3920, 220, 220, 220, 220, 532, 374, 9, 32604, 62, 324, 7, 55, 83, 8, 3467, 77, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 685, 19, 60, 220, 220, 220, 26178, 36532, 6245, 3920, 220, 220, 532, 374, 9, 1150, 62, 324, 7, 55, 83, 19415, 77, 198, 220, 220, 220, 4600, 43328, 87, 63, 220, 220, 220, 532, 1649, 28114, 87, 6624, 2081, 11, 5860, 257, 7110, 286, 262, 40709, 1988, 379, 1123, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 640, 5046, 357, 72, 13, 68, 13, 262, 1963, 2304, 1000, 40709, 12133, 8, 685, 12286, 25, 3991, 60, 59, 77, 628, 198, 220, 220, 4600, 1890, 2252, 7508, 319, 777, 1036, 1397, 9021, 766, 262, 7232, 28338, 16066, 5698, 13, 63, 628, 220, 220, 220, 1303, 4091, 635, 4600, 5653, 15252, 47671, 4600, 81, 5653, 4834, 47671, 4600, 66, 5653, 4834, 47671, 4600, 71, 5653, 4834, 47671, 4600, 50, 696, 4834, 47671, 4600, 25189, 4834, 47671, 4600, 55, 5653, 4834, 63, 628, 220, 220, 220, 1303, 31458, 25, 198, 220, 220, 220, 220, 220, 220, 220, 685, 16, 60, 1279, 20608, 22330, 1279, 20608, 22330, 290, 1279, 20608, 22330, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 15205, 2304, 1000, 40709, 3781, 286, 3716, 42087, 20781, 640, 2168, 526, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 16331, 2423, 7475, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 9919, 13, 21, 357, 16942, 2599, 657, 3104, 15377, 13, 628, 220, 220, 220, 220, 220, 220, 220, 685, 17, 60, 1279, 20608, 22330, 290, 1279, 20608, 22330, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 21357, 319, 564, 250, 15205, 2304, 1000, 40709, 3781, 286, 3716, 42087, 20781, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 640, 2168, 447, 251, 526, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 16331, 2423, 7475, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 10190, 13, 23, 357, 15724, 2599, 657, 4531, 43564, 13, 628, 220, 220, 220, 220, 220, 220, 220, 685, 18, 60, 1279, 20608, 22330, 1279, 20608, 22330, 290, 1279, 20608, 28401, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 33490, 20608, 22330, 290, 42341, 10971, 526, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 16331, 6602, 24501, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 10190, 13, 23, 357, 15724, 2599, 657, 4531, 36088, 13, 628, 220, 220, 220, 220, 220, 220, 220, 685, 19, 60, 1279, 20608, 22330, 1279, 20608, 29, 290, 1279, 20608, 22330, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 15205, 2304, 1000, 40709, 3781, 286, 10685, 10425, 526, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 16331, 2423, 412, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 9166, 13, 17, 357, 14315, 2599, 7816, 1129, 3312, 13, 628, 220, 220, 220, 220, 220, 220, 220, 685, 20, 60, 1279, 20608, 29, 290, 1279, 20608, 22330, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 2202, 1963, 2304, 1000, 40709, 3781, 329, 25033, 1366, 526, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8687, 3970, 317, 25, 34931, 47570, 290, 663, 26622, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 44856, 357, 13330, 2599, 38446, 12, 32148, 13, 628, 220, 220, 220, 220, 220, 220, 220, 685, 21, 60, 1279, 20608, 29, 290, 1279, 20608, 22330, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 5317, 81, 1040, 291, 4235, 40709, 1912, 319, 1963, 42524, 21594, 4235, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 26969, 9150, 290, 663, 3586, 284, 17019, 1366, 3781, 526, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 38655, 7669, 67, 4989, 873, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 642, 13, 18, 357, 9804, 2599, 38703, 12, 30336, 13, 628, 220, 220, 220, 220, 220, 220, 220, 685, 22, 60, 1279, 20608, 29, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 464, 1963, 2304, 1000, 40709, 11862, 290, 663, 17670, 25, 317, 2423, 526, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7232, 28338, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1596, 13, 20, 357, 4626, 2599, 3261, 940, 12, 18, 10163, 13, 628, 220, 220, 220, 220, 220, 220, 220, 685, 23, 60, 1279, 20608, 22330, 2123, 435, 1539, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 15205, 2304, 1000, 40709, 3781, 286, 10685, 10425, 25, 257, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7531, 3182, 12, 1416, 4272, 1099, 526, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8880, 3183, 287, 31350, 39738, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 860, 357, 4626, 2599, 5598, 13, 628, 220, 220, 220, 220, 220, 220, 220, 685, 24, 60, 220, 1279, 20608, 22330, 2123, 435, 1539, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 15205, 2304, 1000, 27565, 7232, 28338, 286, 21134, 10425, 25, 8314, 262, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3572, 1022, 5969, 12, 273, 15874, 12, 83, 37668, 1871, 16252, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4588, 663, 12660, 290, 10794, 30, 526, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7232, 28338, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 678, 13, 1157, 357, 5539, 2599, 642, 3829, 13, 628, 220, 220, 220, 220, 220, 220, 220, 685, 940, 60, 1279, 20608, 22330, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 7575, 12, 30846, 1963, 2304, 1000, 40709, 3781, 286, 25033, 10425, 526, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7232, 28338, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 678, 13, 21, 357, 5539, 2599, 36100, 13, 628, 220, 220, 220, 220, 220, 220, 220, 685, 1157, 60, 1279, 20608, 29, 290, 1279, 20608, 22330, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 7222, 17208, 12, 2164, 1397, 10581, 287, 555, 42524, 1963, 2304, 1000, 6291, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 290, 4596, 6900, 40709, 526, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7232, 28338, 1160, 13, 17, 357, 7908, 2599, 21503, 13, 628, 220, 220, 220, 37227, 198, 220, 220, 220, 2163, 6579, 4834, 7, 50, 328, 3712, 23839, 19182, 90, 51, 11, 16, 92, 810, 309, 27, 25, 15633, 11, 16540, 73, 3712, 45, 2434, 51, 29291, 26, 1446, 2040, 3712, 5317, 28, 18, 11, 220, 198, 220, 220, 220, 220, 220, 220, 220, 11789, 87, 3712, 10100, 2625, 1073, 17208, 1600, 5325, 3791, 3712, 5317, 28, 15, 11, 28114, 87, 3712, 33, 970, 28, 9562, 8, 628, 220, 220, 220, 357, 7857, 7, 50, 328, 11, 16, 8, 29, 940, 8, 5633, 2147, 1058, 4049, 7203, 50, 328, 25, 220, 220, 1276, 307, 257, 35575, 15879, 1, 1267, 198, 220, 220, 220, 357, 13664, 7, 44, 26801, 8, 18189, 352, 8, 5633, 2147, 1058, 220, 4049, 7203, 44, 26801, 25, 220, 220, 220, 1276, 307, 257, 1963, 2304, 1000, 40709, 2134, 2727, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 351, 262, 2163, 7232, 28338, 16066, 13, 5653, 15252, 4943, 198, 220, 220, 220, 357, 3351, 2040, 29, 16, 8, 5633, 2147, 1058, 4049, 7203, 3351, 2040, 25, 220, 220, 220, 220, 1276, 307, 281, 18253, 1875, 352, 4943, 198, 220, 220, 220, 357, 21037, 7442, 7, 17410, 87, 8, 287, 14631, 1073, 17208, 2430, 41771, 2430, 320, 69, 2430, 22355, 29323, 8973, 8, 5633, 2147, 1058, 198, 220, 220, 220, 220, 220, 220, 220, 4049, 7203, 17410, 25, 220, 1276, 307, 530, 286, 262, 1708, 4731, 3891, 532, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 1073, 17208, 41707, 41771, 41707, 320, 69, 41707, 22355, 29323, 6, 4943, 198, 220, 220, 220, 357, 15546, 3791, 855, 15, 8614, 357, 15546, 3791, 287, 352, 25, 19, 11405, 10903, 7, 13940, 23650, 7, 44, 26801, 13, 37, 19524, 4008, 287, 5855, 50, 696, 4834, 2430, 25189, 4834, 1, 22305, 5633, 2147, 1058, 198, 220, 220, 220, 220, 220, 220, 220, 4049, 7203, 15546, 3791, 25, 220, 220, 220, 220, 1276, 307, 657, 11, 393, 281, 18253, 287, 2837, 685, 16, 604, 60, 351, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 40709, 2163, 705, 50, 696, 4834, 6, 393, 705, 25189, 4834, 6, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 611, 2793, 7442, 7, 17410, 87, 8, 855, 1, 320, 69, 1, 220, 198, 220, 220, 220, 220, 220, 220, 220, 21984, 11, 62, 220, 796, 412, 12740, 7, 50, 328, 11, 3351, 2040, 12, 16, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2160, 7, 439, 7, 50, 328, 13, 855, 15, 11, 67, 12078, 28, 17, 4008, 855, 15, 5633, 2147, 1058, 21984, 796, 21984, 58, 439, 7, 50, 328, 13, 0, 28, 15, 11, 67, 12078, 28, 17, 828, 47715, 198, 220, 220, 220, 220, 220, 220, 220, 1446, 2040, 18189, 2546, 7, 50, 328, 11, 16, 8, 5633, 2147, 1058, 220, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 40539, 7203, 11518, 1271, 286, 25375, 338, 38237, 1335, 422, 412, 12740, 318, 1342, 621, 1271, 286, 1446, 2040, 13, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6579, 4834, 16726, 625, 29568, 7857, 7, 50, 328, 11, 16, 4008, 16252, 2427, 286, 720, 3351, 2040, 19570, 198, 220, 220, 220, 220, 220, 220, 220, 1446, 2040, 796, 2546, 7, 50, 328, 11, 16, 8, 198, 220, 220, 220, 886, 198, 220, 220, 220, 6579, 87, 796, 1976, 27498, 7, 3351, 2040, 8, 198, 220, 220, 220, 943, 14542, 796, 34441, 51, 29291, 90, 13083, 7, 44, 26801, 38381, 17, 25, 437, 48999, 7, 44, 26801, 8, 198, 220, 220, 220, 11138, 66, 17, 796, 651, 3245, 28264, 5653, 4834, 11, 13940, 23650, 7, 21037, 7442, 7, 17410, 87, 22305, 198, 220, 220, 220, 611, 5325, 3791, 1875, 657, 198, 220, 220, 220, 220, 220, 220, 220, 611, 5325, 3791, 6624, 352, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 371, 3605, 796, 2124, 4613, 14367, 7, 87, 11, 19267, 28, 9562, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 5325, 3791, 6624, 362, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 371, 3605, 796, 2124, 4613, 1401, 7, 87, 11, 19267, 28, 9562, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 5325, 3791, 6624, 513, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 371, 3605, 796, 2124, 4613, 1612, 7, 8937, 12195, 87, 764, 12, 1612, 7, 87, 22305, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 5325, 3791, 6624, 604, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 371, 3605, 796, 2124, 4613, 14288, 7, 8937, 12195, 87, 764, 12, 14288, 7, 87, 22305, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 886, 628, 220, 220, 220, 220, 220, 220, 220, 611, 468, 2539, 7, 44, 26801, 11, 25, 81, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 327, 87, 796, 16540, 73, 13, 81, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5934, 796, 5855, 23615, 6245, 3920, 2430, 23907, 590, 2430, 5308, 272, 13051, 6245, 3920, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 9921, 666, 13051, 6245, 3920, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2488, 40539, 7203, 2949, 16874, 1988, 2810, 287, 16540, 73, 13, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 15161, 900, 284, 657, 13, 17, 9, 3, 7, 20418, 58, 15546, 3791, 12962, 286, 1123, 649, 640, 12, 25076, 19570, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 327, 87, 796, 764, 17, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 886, 628, 220, 220, 220, 329, 309, 796, 352, 25, 3351, 2040, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 7, 1911, 366, 8, 198, 220, 220, 220, 220, 220, 220, 220, 24189, 796, 11138, 66, 17, 7, 50, 328, 11, 51, 8, 220, 628, 220, 220, 220, 220, 220, 220, 220, 611, 2793, 7442, 7, 17410, 87, 8, 6624, 366, 22355, 29323, 1, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5825, 8416, 796, 1976, 27498, 7, 51, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 479, 796, 352, 25, 51, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5325, 3791, 1875, 657, 5633, 943, 14542, 796, 357, 42035, 986, 11, 374, 28, 34, 87, 9, 49, 3605, 7, 30782, 58, 74, 11, 47715, 4008, 1058, 2147, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5825, 9078, 796, 16540, 73, 13, 37, 19524, 7, 30782, 58, 74, 11, 25, 11208, 943, 14542, 23029, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2099, 1659, 7, 12966, 9078, 8, 27, 25, 51, 29291, 5633, 5825, 8416, 58, 74, 60, 796, 5825, 9078, 58, 16, 7131, 437, 60, 1058, 5825, 8416, 58, 74, 60, 796, 5825, 9078, 58, 437, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 5825, 8416, 58, 74, 60, 796, 5825, 9078, 58, 437, 60, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 24189, 17, 796, 1612, 7, 12966, 8416, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5325, 3791, 1875, 657, 5633, 943, 14542, 796, 357, 42035, 986, 11, 374, 28, 34, 87, 9, 49, 3605, 7, 30782, 58, 47715, 4008, 1058, 2147, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5825, 8416, 796, 16540, 73, 13, 37, 19524, 7, 30782, 58, 25, 11208, 943, 14542, 23029, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2099, 1659, 7, 12966, 8416, 8, 27, 25, 51, 29291, 5633, 24189, 17, 796, 5825, 8416, 58, 16, 7131, 437, 60, 1058, 24189, 17, 796, 5825, 8416, 58, 437, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 30782, 17, 796, 5825, 8416, 58, 16, 7131, 437, 60, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 886, 628, 220, 220, 220, 220, 220, 220, 220, 6579, 87, 58, 51, 60, 796, 24189, 17, 198, 220, 220, 220, 886, 198, 220, 220, 220, 14514, 796, 2160, 7, 5653, 87, 8, 198, 220, 220, 220, 3601, 7203, 59, 77, 4943, 198, 220, 220, 220, 611, 597, 7, 271, 12647, 12195, 5653, 87, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 44872, 7203, 4366, 40709, 3815, 743, 307, 28721, 19570, 198, 220, 220, 220, 886, 198, 220, 220, 220, 628, 220, 220, 220, 611, 28114, 87, 628, 220, 220, 220, 220, 220, 220, 220, 279, 16, 796, 7110, 7, 16, 25, 3351, 2040, 11, 6579, 87, 11, 269, 28, 36982, 7, 23, 14, 13381, 11, 8093, 14, 13381, 11, 8541, 14, 13381, 828, 300, 86, 28, 18, 8, 198, 220, 220, 220, 220, 220, 220, 220, 41058, 0, 7, 16, 25, 3351, 2040, 11, 6579, 87, 11, 19736, 1096, 28, 21, 11, 269, 28, 36982, 7, 16, 11, 657, 11, 352, 828, 198, 220, 220, 220, 220, 220, 220, 220, 2124, 18242, 796, 366, 29990, 27929, 1600, 331, 18242, 796, 366, 14539, 28338, 11052, 1600, 220, 198, 220, 220, 220, 220, 220, 220, 220, 5698, 10331, 796, 10369, 7, 1065, 11, 366, 36098, 1600, 25228, 7, 22, 14, 13381, 11, 7175, 14, 13381, 11, 7930, 14, 13381, 36911, 198, 220, 220, 220, 220, 220, 220, 220, 4378, 10331, 7857, 796, 838, 11, 4378, 10331, 17989, 2625, 36098, 1600, 8177, 28, 9562, 11, 198, 220, 220, 220, 220, 220, 220, 220, 3670, 796, 366, 15205, 2304, 1000, 29568, 44, 26801, 13, 37, 19524, 8, 7198, 7, 7839, 7442, 7, 17410, 87, 4008, 12, 2164, 1397, 2446, 42501, 198, 220, 220, 220, 220, 220, 220, 220, 7110, 62, 7839, 10331, 7857, 28, 1433, 11, 7110, 62, 7839, 10331, 8043, 28, 36982, 7, 22, 14, 13381, 11, 7175, 14, 13381, 11, 7930, 14, 13381, 4008, 1303, 88, 2475, 16193, 15, 11, 47033, 7, 5653, 87, 8, 27613, 17, 828, 198, 220, 220, 220, 220, 220, 220, 220, 3359, 7, 79, 16, 8, 198, 220, 220, 220, 886, 628, 220, 220, 220, 1441, 6579, 87, 11, 14514, 198, 220, 220, 220, 886, 628, 198, 220, 220, 220, 2163, 36076, 7, 57, 11, 82, 87, 8, 198, 220, 220, 220, 220, 220, 220, 220, 399, 82, 796, 2558, 7, 28300, 7, 7857, 7, 57, 11, 16, 20679, 82, 87, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 575, 796, 1612, 7, 3447, 1758, 7, 57, 58, 16, 25, 82, 87, 9, 47503, 4357, 82, 87, 11, 47503, 828, 67, 12078, 28, 16, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 575, 198, 220, 220, 220, 886, 198, 220, 220, 220, 2163, 9518, 7, 57, 11, 82, 87, 8, 198, 220, 220, 220, 220, 220, 220, 220, 399, 82, 796, 2546, 7, 57, 11, 16, 8, 532, 264, 87, 1343, 352, 198, 220, 220, 220, 220, 220, 220, 220, 575, 796, 1976, 27498, 7, 47503, 8, 198, 220, 220, 220, 220, 220, 220, 220, 329, 479, 796, 352, 25, 47503, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 575, 58, 74, 60, 796, 1612, 7, 57, 58, 74, 25, 74, 10, 82, 87, 12, 16, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 575, 220, 198, 220, 220, 220, 886, 198, 220, 220, 220, 2163, 545, 69, 7, 57, 11, 82, 87, 8, 198, 220, 220, 220, 220, 220, 220, 220, 575, 796, 2160, 7, 57, 58, 16, 25, 82, 87, 11, 25, 4357, 67, 12078, 28, 16, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 575, 198, 220, 220, 220, 886, 198, 220, 220, 220, 2163, 1661, 29323, 7, 57, 11, 82, 87, 8, 198, 220, 220, 220, 220, 220, 220, 220, 575, 796, 220, 27179, 1758, 7, 57, 58, 16, 25, 5317, 7, 82, 87, 9, 28300, 7, 13664, 7, 57, 20679, 82, 87, 4008, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 357, 82, 87, 11, 5317, 7, 28300, 7, 13664, 7, 57, 20679, 82, 87, 35514, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 575, 198, 220, 220, 220, 886, 628, 220, 220, 220, 2163, 350, 74, 16742, 7, 55, 8, 198, 220, 220, 220, 220, 220, 220, 220, 399, 87, 796, 4129, 7, 55, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1423, 87, 796, 1976, 27498, 7, 5317, 11, 45, 87, 1776, 198, 220, 220, 220, 220, 220, 220, 220, 329, 299, 796, 362, 25, 45, 87, 12, 16, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1395, 58, 77, 12, 16, 60, 27, 1395, 58, 77, 60, 1875, 1395, 58, 77, 10, 16, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1423, 87, 58, 77, 60, 796, 299, 198, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 1395, 58, 77, 12, 16, 60, 1279, 1395, 58, 77, 60, 6624, 1395, 58, 77, 10, 16, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 479, 796, 352, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1423, 87, 58, 77, 60, 796, 299, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 981, 357, 77, 10, 74, 8, 27, 45, 87, 11405, 1395, 58, 77, 60, 6624, 1395, 58, 77, 10, 74, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1423, 87, 58, 77, 10, 74, 60, 796, 299, 10, 74, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 479, 47932, 16, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 299, 47932, 74, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 1423, 87, 796, 1423, 87, 58, 5497, 87, 13, 0, 855, 15, 60, 198, 220, 220, 220, 1441, 1423, 87, 198, 220, 220, 220, 886, 198, 220, 220, 220, 220, 198, 220, 220, 220, 2163, 412, 12740, 7, 55, 11, 1446, 2040, 3712, 5317, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1395, 83, 796, 4866, 7, 55, 1776, 399, 796, 2546, 7, 55, 83, 11, 16, 1776, 299, 28, 16, 26, 25375, 82, 796, 1976, 27498, 7, 3351, 2040, 10, 16, 11, 45, 8, 198, 220, 220, 220, 220, 220, 220, 220, 5436, 1137, 796, 1160, 26, 220, 1855, 46559, 796, 362, 26, 220, 1303, 55, 83, 764, 12, 28, 1612, 7, 55, 83, 8, 198, 220, 220, 220, 220, 220, 220, 220, 374, 16, 796, 1395, 83, 198, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 981, 299, 19841, 1446, 2040, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 15, 796, 1395, 83, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2124, 796, 657, 26, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3205, 87, 796, 350, 74, 16742, 7, 81, 15, 1776, 220, 406, 49345, 796, 350, 74, 16742, 32590, 81, 15, 8, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3205, 4834, 85, 796, 13341, 500, 16, 35, 7, 4933, 87, 11, 81, 15, 58, 4933, 87, 4357, 74, 28, 18, 11, 15630, 2625, 710, 12423, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 406, 86, 4834, 85, 796, 13341, 500, 16, 35, 7, 43, 49345, 11, 81, 15, 58, 43, 49345, 4357, 74, 28, 18, 11, 15630, 2625, 710, 12423, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 16, 796, 374, 15, 7874, 357, 4933, 4834, 85, 12195, 16, 25, 45, 8, 764, 10, 406, 86, 4834, 85, 12195, 16, 25, 45, 29720, 14, 17, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 11923, 796, 357, 16345, 7, 81, 15, 15885, 81, 15, 8, 532, 2160, 7, 81, 16, 15885, 81, 16, 4008, 14, 16345, 7, 81, 15, 15885, 81, 15, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4129, 7, 85, 9246, 7, 4933, 87, 11, 43, 49345, 4008, 19841, 1855, 46559, 5633, 357, 25294, 796, 366, 10707, 296, 9150, 2277, 10926, 1070, 260, 2611, 9987, 526, 26, 2270, 8, 1058, 2147, 198, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 981, 2124, 1279, 1802, 11405, 11923, 1875, 657, 13, 17, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 15, 796, 352, 9, 81, 16, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3205, 87, 796, 350, 74, 16742, 7, 81, 15, 1776, 220, 406, 49345, 796, 350, 74, 16742, 32590, 81, 15, 8, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3205, 4834, 85, 796, 13341, 500, 16, 35, 7, 4933, 87, 11, 81, 15, 58, 4933, 87, 4357, 74, 28, 18, 11, 15630, 2625, 710, 12423, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 406, 86, 4834, 85, 796, 13341, 500, 16, 35, 7, 43, 49345, 11, 81, 15, 58, 43, 49345, 4357, 74, 28, 18, 11, 15630, 2625, 710, 12423, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 16, 796, 374, 15, 7874, 357, 4933, 4834, 85, 12195, 16, 25, 45, 8, 764, 10, 406, 86, 4834, 85, 12195, 16, 25, 45, 29720, 14, 17, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 11923, 796, 357, 16345, 7, 81, 15, 15885, 81, 15, 8, 532, 2160, 7, 81, 16, 15885, 81, 16, 4008, 14, 16345, 7, 81, 15, 15885, 81, 15, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2124, 15853, 352, 26, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 838, 9, 6404, 940, 7, 31166, 17034, 7, 16345, 7, 81, 15, 15885, 81, 15, 4008, 14, 31166, 17034, 7, 16345, 7, 81, 16, 15885, 81, 16, 22305, 1875, 5436, 1137, 5633, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 357, 25294, 796, 366, 10707, 296, 9150, 2277, 2568, 8064, 9987, 526, 26, 2270, 8, 1058, 2147, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 25375, 82, 58, 77, 11, 47715, 796, 374, 16, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1395, 83, 764, 12, 28, 374, 16, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 25375, 82, 58, 3351, 2040, 10, 16, 11, 47715, 796, 374, 15, 764, 10, 1612, 7, 55, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 299, 47932, 16, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 41605, 796, 366, 3237, 1816, 880, 14373, 366, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 25375, 82, 11, 41605, 198, 220, 220, 220, 886, 198, 198, 437, 198, 198, 37811, 198, 15269, 33448, 1279, 20608, 22330, 7232, 28338, 16066, 198, 198, 26656, 15385, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 5832, 743, 407, 779, 428, 2393, 2845, 287, 11846, 351, 262, 13789, 13, 198, 1639, 743, 7330, 257, 4866, 286, 262, 13789, 379, 628, 220, 220, 220, 2638, 1378, 2503, 13, 43073, 13, 2398, 14, 677, 4541, 14, 43, 2149, 24290, 12, 17, 13, 15, 198, 198, 28042, 2672, 416, 9723, 1099, 393, 4987, 284, 287, 3597, 11, 3788, 198, 17080, 6169, 739, 262, 13789, 318, 9387, 319, 281, 366, 1921, 3180, 1, 29809, 1797, 11, 198, 54, 10554, 12425, 34764, 11015, 6375, 7102, 49828, 11053, 3963, 15529, 509, 12115, 11, 2035, 4911, 393, 17142, 13, 198, 6214, 262, 13789, 329, 262, 2176, 3303, 15030, 21627, 290, 198, 2475, 20597, 739, 262, 13789, 13, 198, 198, 1890, 17637, 286, 5765, 766, 3740, 1378, 12567, 13, 785, 14, 13448, 8743, 7414, 702, 14, 14539, 28338, 16066, 198, 37811 ]
1.982796
5,929
<reponame>MisterBiggs/BeautifulMakie<filename>_assets/scripts/BoxErrorBarsCmap.jl<gh_stars>100-1000 # by lazarusA # HIDE #using GLMakie, Random # HIDE using CairoMakie, Random CairoMakie.activate!() #HIDE let Random.seed!(145) x, y, yerr = 1:2:20, 5*rand(10), 0.4*abs.(randn(10)) fig = Figure(resolution = (700, 450), font = "sans") ax = Axis(fig, xlabel = "variables", ylabel = "values") barplot!(ax, x,y,strokewidth = 1,color = x,colormap = (:Spectral_10, 0.85), strokecolor = :black) errorbars!(ax, x, y, yerr, whiskerwidth = 12) fig[1,1] = ax fig save(joinpath(@__DIR__, "output", "BoxErrorBarsCmap.png"), fig, px_per_unit = 2.0) # HIDE end using Pkg # HIDE Pkg.status(["CairoMakie", "Random"]) # HIDE
[ 27, 7856, 261, 480, 29, 44, 1694, 33, 20340, 14, 38413, 4135, 44, 461, 494, 27, 34345, 29, 62, 19668, 14, 46521, 14, 14253, 12331, 33, 945, 34, 8899, 13, 20362, 27, 456, 62, 30783, 29, 3064, 12, 12825, 198, 2, 416, 37296, 20272, 32, 1303, 367, 14114, 198, 2, 3500, 10188, 44, 461, 494, 11, 14534, 1303, 367, 14114, 198, 3500, 23732, 44, 461, 494, 11, 14534, 198, 34, 18131, 44, 461, 494, 13, 39022, 0, 3419, 1303, 39, 14114, 198, 1616, 198, 220, 220, 220, 14534, 13, 28826, 0, 7, 18781, 8, 198, 220, 220, 220, 2124, 11, 331, 11, 331, 8056, 796, 352, 25, 17, 25, 1238, 11, 642, 9, 25192, 7, 940, 828, 657, 13, 19, 9, 8937, 12195, 25192, 77, 7, 940, 4008, 198, 220, 220, 220, 2336, 796, 11291, 7, 29268, 796, 357, 9879, 11, 18523, 828, 10369, 796, 366, 82, 504, 4943, 198, 220, 220, 220, 7877, 796, 38349, 7, 5647, 11, 2124, 18242, 796, 366, 25641, 2977, 1600, 331, 18242, 796, 366, 27160, 4943, 198, 220, 220, 220, 2318, 29487, 0, 7, 897, 11, 2124, 11, 88, 11, 30757, 10394, 796, 352, 11, 8043, 796, 2124, 11, 4033, 579, 499, 796, 357, 25, 49738, 1373, 62, 940, 11, 657, 13, 5332, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 14000, 8043, 796, 1058, 13424, 8, 198, 220, 220, 220, 4049, 34046, 0, 7, 897, 11, 2124, 11, 331, 11, 331, 8056, 11, 21060, 263, 10394, 796, 1105, 8, 198, 220, 220, 220, 2336, 58, 16, 11, 16, 60, 796, 7877, 198, 220, 220, 220, 2336, 198, 220, 220, 220, 3613, 7, 22179, 6978, 7, 31, 834, 34720, 834, 11, 366, 22915, 1600, 366, 14253, 12331, 33, 945, 34, 8899, 13, 11134, 12340, 2336, 11, 279, 87, 62, 525, 62, 20850, 796, 362, 13, 15, 8, 1303, 367, 14114, 198, 437, 198, 3500, 350, 10025, 1303, 367, 14114, 198, 47, 10025, 13, 13376, 7, 14692, 34, 18131, 44, 461, 494, 1600, 366, 29531, 8973, 8, 1303, 367, 14114, 198 ]
2.211144
341
<reponame>ericbdaniels/dash-vtk # AUTO GENERATED FILE - DO NOT EDIT export vtk_imagedata """ vtk_imagedata(;kwargs...) vtk_imagedata(children::Any;kwargs...) vtk_imagedata(children_maker::Function;kwargs...) An ImageData component. ImageData is exposing a vtkImageData to a downstream filter It takes the following set of properties: - dimensions: [nx, ny, nz], - origin: [0, 0, 0] - spacing: [1, 1, 1] - direction: [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ] Keyword arguments: - `children` (Array of a list of or a singular dash component, string or numbers | a list of or a singular dash component, string or number; optional) - `id` (String; optional): The ID used to identify this component. - `port` (Real; optional): downstream connection port - `dimensions` (Array of Reals; optional): Number of points along x, y, z - `spacing` (Array of Reals; optional): Spacing along x, y, z between points in world coordinates - `origin` (Array of Reals; optional): World coordinate of the lower left corner of your vtkImageData (i=0, j=0, k=0). - `direction` (Array of Reals; optional): 3x3 matrix use to orient the image data """ function vtk_imagedata(; kwargs...) available_props = Symbol[:children, :id, :port, :dimensions, :spacing, :origin, :direction] wild_props = Symbol[] return Component("vtk_imagedata", "ImageData", "dash_vtk", available_props, wild_props; kwargs...) end vtk_imagedata(children::Any; kwargs...) = vtk_imagedata(;kwargs..., children = children) vtk_imagedata(children_maker::Function; kwargs...) = vtk_imagedata(children_maker(); kwargs...)
[ 27, 7856, 261, 480, 29, 35626, 17457, 3216, 1424, 14, 42460, 12, 85, 30488, 198, 2, 47044, 46, 24700, 1137, 11617, 45811, 532, 8410, 5626, 48483, 198, 198, 39344, 410, 30488, 62, 320, 1886, 1045, 198, 198, 37811, 198, 220, 220, 220, 410, 30488, 62, 320, 1886, 1045, 7, 26, 46265, 22046, 23029, 198, 220, 220, 220, 410, 30488, 62, 320, 1886, 1045, 7, 17197, 3712, 7149, 26, 46265, 22046, 23029, 198, 220, 220, 220, 410, 30488, 62, 320, 1886, 1045, 7, 17197, 62, 10297, 3712, 22203, 26, 46265, 22046, 23029, 628, 198, 2025, 7412, 6601, 7515, 13, 198, 5159, 6601, 318, 21294, 257, 410, 30488, 5159, 6601, 284, 257, 33218, 8106, 198, 1026, 2753, 262, 1708, 900, 286, 6608, 25, 198, 220, 532, 15225, 25, 685, 77, 87, 11, 299, 88, 11, 299, 89, 4357, 198, 220, 532, 8159, 25, 685, 15, 11, 657, 11, 657, 60, 198, 220, 532, 31050, 25, 685, 16, 11, 352, 11, 352, 60, 198, 220, 532, 4571, 25, 685, 198, 220, 220, 220, 220, 220, 352, 11, 657, 11, 657, 11, 198, 220, 220, 220, 220, 220, 657, 11, 352, 11, 657, 11, 198, 220, 220, 220, 220, 220, 657, 11, 657, 11, 352, 198, 220, 220, 220, 2361, 198, 9218, 4775, 7159, 25, 198, 12, 4600, 17197, 63, 357, 19182, 286, 257, 1351, 286, 393, 257, 18032, 14470, 7515, 11, 4731, 393, 3146, 930, 257, 1351, 286, 393, 257, 18032, 14470, 7515, 11, 4731, 393, 1271, 26, 11902, 8, 198, 12, 4600, 312, 63, 357, 10100, 26, 11902, 2599, 383, 4522, 973, 284, 5911, 428, 7515, 13, 198, 12, 4600, 634, 63, 357, 15633, 26, 11902, 2599, 33218, 4637, 2493, 198, 12, 4600, 27740, 5736, 63, 357, 19182, 286, 797, 874, 26, 11902, 2599, 7913, 286, 2173, 1863, 2124, 11, 331, 11, 1976, 198, 12, 4600, 2777, 4092, 63, 357, 19182, 286, 797, 874, 26, 11902, 2599, 1338, 4092, 1863, 2124, 11, 331, 11, 1976, 1022, 2173, 287, 995, 22715, 198, 12, 4600, 47103, 63, 357, 19182, 286, 797, 874, 26, 11902, 2599, 2159, 20435, 286, 262, 2793, 1364, 5228, 286, 534, 410, 30488, 5159, 6601, 357, 72, 28, 15, 11, 474, 28, 15, 11, 479, 28, 15, 737, 198, 12, 4600, 37295, 63, 357, 19182, 286, 797, 874, 26, 11902, 2599, 513, 87, 18, 17593, 779, 284, 11367, 262, 2939, 1366, 198, 37811, 198, 8818, 410, 30488, 62, 320, 1886, 1045, 7, 26, 479, 86, 22046, 23029, 198, 220, 220, 220, 220, 220, 220, 220, 1695, 62, 1676, 862, 796, 38357, 58, 25, 17197, 11, 1058, 312, 11, 1058, 634, 11, 1058, 27740, 5736, 11, 1058, 2777, 4092, 11, 1058, 47103, 11, 1058, 37295, 60, 198, 220, 220, 220, 220, 220, 220, 220, 4295, 62, 1676, 862, 796, 38357, 21737, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 35100, 7203, 85, 30488, 62, 320, 1886, 1045, 1600, 366, 5159, 6601, 1600, 366, 42460, 62, 85, 30488, 1600, 1695, 62, 1676, 862, 11, 4295, 62, 1676, 862, 26, 479, 86, 22046, 23029, 198, 437, 198, 198, 85, 30488, 62, 320, 1886, 1045, 7, 17197, 3712, 7149, 26, 479, 86, 22046, 23029, 796, 410, 30488, 62, 320, 1886, 1045, 7, 26, 46265, 22046, 986, 11, 1751, 796, 1751, 8, 198, 85, 30488, 62, 320, 1886, 1045, 7, 17197, 62, 10297, 3712, 22203, 26, 479, 86, 22046, 23029, 796, 410, 30488, 62, 320, 1886, 1045, 7, 17197, 62, 10297, 9783, 479, 86, 22046, 23029, 628 ]
2.839161
572
""" hasconverged(s::ConvergenceState) Returns true if `s.converged` is true. """ hasconverged(s::ConvergenceState) = s.converged """ hasconverged(s::Solution) Returns true if `hasconverged(s.convstate)` is true. """ hasconverged(s::Solution) = hasconverged(s.convstate) """ ``` assess_convergence!( solution::Solution, model::AbstractModel, tol::Tolerance, criteria::ConvergenceCriteria, ) ``` Evaluates the convergence state `solution.convstate` given the current solution, `solution`, the tolerance, `tol`, and the convergence criteria `criteria`. `solution.convstate.converged` is then updated. If `criteria` is an instance of `GenericCriteria`, `converged = (x_converged || f_converged) && infeas_converged`. `x_converged`, `f_converged` and `infeas_converged` are explained in [`Tolerance`](@ref). If `criteria` is an instance of `KKTCriteria` or `ScaledKKTCriteria`, `converged = kkt_converged && infeas_converged`. `kkt_converged` and `infeas_converged` are explained in [`Tolerance`](@ref). If `criteria` is an instance of `IpoptCriteria`, `converged = ipopt_converged && infeas_converged`. `ipopt_converged` and `infeas_converged` are explained in [`Tolerance`](@ref). """ function assess_convergence!( solution::Solution, model::AbstractModel, tol::Tolerance, criteria::ConvergenceCriteria, ) xtol, fabstol, freltol, kkttol, infeastol = tol.x, tol.fabs, tol.frel, tol.kkt, tol.infeas Δx, Δf, infeas = getresiduals(solution, model, GenericCriteria()) relΔf = Δf / (abs(solution.f) + freltol) kkt_residual, infeas = getresiduals(solution, model, KKTCriteria()) ipopt_residual, infeas = getresiduals(solution, model, IpoptCriteria()) if show_residuals[] @show kkt_residual, ipopt_residual, kkttol end x_converged = Δx < xtol fabs_converged = Δf < fabstol frel_converged = relΔf < freltol if criteria isa ScaledKKTCriteria if debugging[] #@show get_objective_multiple(model) end m = get_objective_multiple(model) kkt_residual = kkt_residual / max(m, 1/m) end kkt_converged = kkt_residual < kkttol ipopt_converged = ipopt_residual < kkttol infeas_converged = infeas <= infeastol f_increased = solution.f > solution.prevf if criteria isa GenericCriteria converged = (x_converged || fabs_converged || frel_converged) && infeas_converged elseif criteria isa KKTCriteria || criteria isa ScaledKKTCriteria converged = kkt_converged && infeas_converged elseif criteria isa IpoptCriteria converged = ipopt_converged && infeas_converged else throw("Unsupported convergence criteria for MMA.") end @pack! solution.convstate = x_converged, fabs_converged, frel_converged, kkt_converged, ipopt_converged, infeas_converged, Δx, Δf, relΔf, kkt_residual, ipopt_residual, infeas, f_increased, converged return solution end function getresiduals(solution::Solution, ::AbstractModel, ::GenericCriteria) @unpack prevx, x, prevf, f, g = solution Δx = maximum(abs(x[j] - prevx[j]) for j in 1:length(x)) Δf = abs(f - prevf) infeas = length(g) == 0 ? zero(eltype(g)) : max(0, maximum(g)) return Δx, Δf, infeas end function getresiduals(solution::Solution, model::AbstractModel, ::KKTCriteria) @unpack ∇f, g, ∇g, λ, x = solution xmin, xmax = getmin(model), getmax(model) T = eltype(x) res = maximum(1:length(x)) do j @views temp = ∇f[j] + dot(∇g[:,j], λ) if xmin[j] >= x[j] return abs(min(0, temp)) elseif x[j] >= xmax[j] return max(0, temp) else return abs(temp) end end if debugging[] @show λ, g end res = length(g) == 0 ? res : max(res, maximum(abs.(λ .* g))) if debugging[] @show maximum(abs, g) @show maximum(abs, λ) @show maximum(x) end infeas = length(g) == 0 ? zero(eltype(g)) : max(maximum(g), 0) return res, infeas end function getresiduals(solution::Solution, model::AbstractModel, ::IpoptCriteria) @unpack ∇f, g, ∇g, λ, x = solution xmin, xmax = getmin(model), getmax(model) T = eltype(x) n, m, s = length(x), length(λ), zero(T) res = maximum(1:n) do j @views temp = ∇f[j] + dot(∇g[:,j], λ) if xmin[j] >= x[j] dj = temp s += max(dj, 0) return abs(min(0, dj)) elseif x[j] >= xmax[j] yj = -temp s += max(yj, 0) return abs(min(0, yj)) else return abs(temp) end end sd = max(100, (sum(abs, λ) + s) / (n + m)) / 100 res = length(g) == 0 ? res : max(res, maximum(abs.(λ .* g))) res = res / sd infeas = length(g) == 0 ? zero(eltype(g)) : max(maximum(g), 0) if debugging[] println("Agg infeas = ", infeas) end return res, infeas end
[ 198, 37811, 198, 10134, 1102, 332, 2004, 7, 82, 3712, 3103, 332, 12745, 9012, 8, 198, 198, 35561, 2081, 611, 4600, 82, 13, 1102, 332, 2004, 63, 318, 2081, 13, 198, 37811, 198, 10134, 1102, 332, 2004, 7, 82, 3712, 3103, 332, 12745, 9012, 8, 796, 264, 13, 1102, 332, 2004, 198, 198, 37811, 198, 10134, 1102, 332, 2004, 7, 82, 3712, 46344, 8, 198, 198, 35561, 2081, 611, 4600, 10134, 1102, 332, 2004, 7, 82, 13, 42946, 5219, 8, 63, 318, 2081, 13, 198, 37811, 198, 10134, 1102, 332, 2004, 7, 82, 3712, 46344, 8, 796, 468, 1102, 332, 2004, 7, 82, 13, 42946, 5219, 8, 628, 198, 37811, 198, 15506, 63, 198, 562, 408, 62, 1102, 332, 12745, 0, 7, 198, 220, 220, 220, 4610, 3712, 46344, 11, 198, 220, 220, 220, 2746, 3712, 23839, 17633, 11, 198, 220, 220, 220, 284, 75, 3712, 51, 37668, 11, 198, 220, 220, 220, 9987, 3712, 3103, 332, 12745, 18559, 5142, 11, 198, 8, 198, 15506, 63, 198, 198, 36, 2100, 12632, 262, 40826, 1181, 4600, 82, 2122, 13, 42946, 5219, 63, 1813, 262, 1459, 4610, 11, 4600, 82, 2122, 47671, 262, 15621, 11, 4600, 83, 349, 47671, 290, 262, 40826, 9987, 4600, 22213, 5142, 44646, 4600, 82, 2122, 13, 42946, 5219, 13, 1102, 332, 2004, 63, 318, 788, 6153, 13, 198, 198, 1532, 4600, 22213, 5142, 63, 318, 281, 4554, 286, 4600, 46189, 18559, 5142, 47671, 4600, 1102, 332, 2004, 796, 357, 87, 62, 1102, 332, 2004, 8614, 277, 62, 1102, 332, 2004, 8, 11405, 1167, 30412, 62, 1102, 332, 2004, 44646, 4600, 87, 62, 1102, 332, 2004, 47671, 4600, 69, 62, 1102, 332, 2004, 63, 290, 4600, 259, 5036, 292, 62, 1102, 332, 2004, 63, 389, 4893, 287, 685, 63, 51, 37668, 63, 16151, 31, 5420, 737, 1002, 4600, 22213, 5142, 63, 318, 281, 4554, 286, 4600, 16601, 4825, 799, 5142, 63, 393, 4600, 3351, 3021, 16601, 4825, 799, 5142, 47671, 4600, 1102, 332, 2004, 796, 479, 21841, 62, 1102, 332, 2004, 11405, 1167, 30412, 62, 1102, 332, 2004, 44646, 4600, 74, 21841, 62, 1102, 332, 2004, 63, 290, 4600, 259, 5036, 292, 62, 1102, 332, 2004, 63, 389, 4893, 287, 685, 63, 51, 37668, 63, 16151, 31, 5420, 737, 1002, 4600, 22213, 5142, 63, 318, 281, 4554, 286, 4600, 40, 79, 8738, 18559, 5142, 47671, 4600, 1102, 332, 2004, 796, 20966, 8738, 62, 1102, 332, 2004, 11405, 1167, 30412, 62, 1102, 332, 2004, 44646, 4600, 541, 8738, 62, 1102, 332, 2004, 63, 290, 4600, 259, 5036, 292, 62, 1102, 332, 2004, 63, 389, 4893, 287, 685, 63, 51, 37668, 63, 16151, 31, 5420, 737, 198, 37811, 198, 8818, 4659, 62, 1102, 332, 12745, 0, 7, 198, 220, 220, 220, 4610, 3712, 46344, 11, 198, 220, 220, 220, 2746, 3712, 23839, 17633, 11, 198, 220, 220, 220, 284, 75, 3712, 51, 37668, 11, 198, 220, 220, 220, 9987, 3712, 3103, 332, 12745, 18559, 5142, 11, 198, 8, 198, 220, 220, 220, 220, 742, 349, 11, 7843, 301, 349, 11, 2030, 2528, 349, 11, 479, 74, 926, 349, 11, 1167, 23316, 349, 796, 284, 75, 13, 87, 11, 284, 75, 13, 69, 8937, 11, 284, 75, 13, 69, 2411, 11, 284, 75, 13, 74, 21841, 11, 284, 75, 13, 259, 5036, 292, 198, 220, 220, 220, 37455, 87, 11, 37455, 69, 11, 1167, 30412, 796, 651, 411, 312, 723, 82, 7, 82, 2122, 11, 2746, 11, 42044, 18559, 5142, 28955, 198, 220, 220, 220, 823, 138, 242, 69, 796, 37455, 69, 1220, 357, 8937, 7, 82, 2122, 13, 69, 8, 1343, 2030, 2528, 349, 8, 198, 220, 220, 220, 479, 21841, 62, 411, 312, 723, 11, 1167, 30412, 796, 651, 411, 312, 723, 82, 7, 82, 2122, 11, 2746, 11, 509, 42, 4825, 799, 5142, 28955, 198, 220, 220, 220, 20966, 8738, 62, 411, 312, 723, 11, 1167, 30412, 796, 651, 411, 312, 723, 82, 7, 82, 2122, 11, 2746, 11, 314, 79, 8738, 18559, 5142, 28955, 198, 220, 220, 220, 611, 905, 62, 411, 312, 723, 82, 21737, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 12860, 479, 21841, 62, 411, 312, 723, 11, 20966, 8738, 62, 411, 312, 723, 11, 479, 74, 926, 349, 198, 220, 220, 220, 886, 628, 220, 220, 220, 2124, 62, 1102, 332, 2004, 796, 37455, 87, 1279, 220, 742, 349, 198, 220, 220, 220, 7843, 82, 62, 1102, 332, 2004, 796, 37455, 69, 1279, 7843, 301, 349, 198, 220, 220, 220, 2030, 75, 62, 1102, 332, 2004, 796, 823, 138, 242, 69, 1279, 2030, 2528, 349, 198, 220, 220, 220, 611, 9987, 318, 64, 1446, 3021, 16601, 4825, 799, 5142, 198, 220, 220, 220, 220, 220, 220, 220, 611, 28769, 21737, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 31, 12860, 651, 62, 15252, 425, 62, 48101, 7, 19849, 8, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 285, 796, 651, 62, 15252, 425, 62, 48101, 7, 19849, 8, 198, 220, 220, 220, 220, 220, 220, 220, 479, 21841, 62, 411, 312, 723, 796, 479, 21841, 62, 411, 312, 723, 1220, 3509, 7, 76, 11, 352, 14, 76, 8, 198, 220, 220, 220, 886, 198, 220, 220, 220, 479, 21841, 62, 1102, 332, 2004, 796, 479, 21841, 62, 411, 312, 723, 1279, 479, 74, 926, 349, 198, 220, 220, 220, 20966, 8738, 62, 1102, 332, 2004, 796, 20966, 8738, 62, 411, 312, 723, 1279, 479, 74, 926, 349, 198, 220, 220, 220, 1167, 30412, 62, 1102, 332, 2004, 796, 1167, 30412, 19841, 1167, 23316, 349, 198, 220, 220, 220, 277, 62, 24988, 839, 796, 4610, 13, 69, 1875, 4610, 13, 47050, 69, 628, 220, 220, 220, 611, 9987, 318, 64, 42044, 18559, 5142, 198, 220, 220, 220, 220, 220, 220, 220, 6718, 2004, 796, 357, 87, 62, 1102, 332, 2004, 8614, 7843, 82, 62, 1102, 332, 2004, 8614, 2030, 75, 62, 1102, 332, 2004, 8, 11405, 1167, 30412, 62, 1102, 332, 2004, 198, 220, 220, 220, 2073, 361, 9987, 318, 64, 509, 42, 4825, 799, 5142, 8614, 9987, 318, 64, 1446, 3021, 16601, 4825, 799, 5142, 198, 220, 220, 220, 220, 220, 220, 220, 6718, 2004, 796, 479, 21841, 62, 1102, 332, 2004, 11405, 1167, 30412, 62, 1102, 332, 2004, 198, 220, 220, 220, 2073, 361, 9987, 318, 64, 314, 79, 8738, 18559, 5142, 198, 220, 220, 220, 220, 220, 220, 220, 6718, 2004, 796, 20966, 8738, 62, 1102, 332, 2004, 11405, 1167, 30412, 62, 1102, 332, 2004, 198, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 3714, 7203, 3118, 15999, 40826, 9987, 329, 19055, 19570, 198, 220, 220, 220, 886, 198, 220, 220, 220, 2488, 8002, 0, 4610, 13, 42946, 5219, 796, 2124, 62, 1102, 332, 2004, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7843, 82, 62, 1102, 332, 2004, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2030, 75, 62, 1102, 332, 2004, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 479, 21841, 62, 1102, 332, 2004, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 20966, 8738, 62, 1102, 332, 2004, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1167, 30412, 62, 1102, 332, 2004, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 37455, 87, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 37455, 69, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 823, 138, 242, 69, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 479, 21841, 62, 411, 312, 723, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 20966, 8738, 62, 411, 312, 723, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1167, 30412, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 277, 62, 24988, 839, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6718, 2004, 198, 220, 220, 220, 1441, 4610, 198, 437, 198, 198, 8818, 651, 411, 312, 723, 82, 7, 82, 2122, 3712, 46344, 11, 7904, 23839, 17633, 11, 7904, 46189, 18559, 5142, 8, 198, 220, 220, 220, 2488, 403, 8002, 8654, 87, 11, 2124, 11, 8654, 69, 11, 277, 11, 308, 796, 4610, 198, 220, 220, 220, 37455, 87, 796, 5415, 7, 8937, 7, 87, 58, 73, 60, 532, 8654, 87, 58, 73, 12962, 329, 474, 287, 352, 25, 13664, 7, 87, 4008, 198, 220, 220, 220, 37455, 69, 796, 2352, 7, 69, 532, 8654, 69, 8, 198, 220, 220, 220, 1167, 30412, 796, 4129, 7, 70, 8, 6624, 657, 5633, 6632, 7, 417, 4906, 7, 70, 4008, 1058, 3509, 7, 15, 11, 5415, 7, 70, 4008, 198, 220, 220, 220, 1441, 37455, 87, 11, 37455, 69, 11, 1167, 30412, 198, 437, 198, 8818, 651, 411, 312, 723, 82, 7, 82, 2122, 3712, 46344, 11, 2746, 3712, 23839, 17633, 11, 7904, 16601, 4825, 799, 5142, 8, 198, 220, 220, 220, 2488, 403, 8002, 18872, 229, 69, 11, 308, 11, 18872, 229, 70, 11, 7377, 119, 11, 2124, 796, 4610, 198, 220, 220, 220, 2124, 1084, 11, 2124, 9806, 796, 651, 1084, 7, 19849, 828, 651, 9806, 7, 19849, 8, 198, 220, 220, 220, 309, 796, 1288, 4906, 7, 87, 8, 198, 220, 220, 220, 581, 796, 5415, 7, 16, 25, 13664, 7, 87, 4008, 466, 474, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 33571, 20218, 796, 18872, 229, 69, 58, 73, 60, 1343, 16605, 7, 24861, 229, 70, 58, 45299, 73, 4357, 7377, 119, 8, 198, 220, 220, 220, 220, 220, 220, 220, 611, 2124, 1084, 58, 73, 60, 18189, 2124, 58, 73, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 2352, 7, 1084, 7, 15, 11, 20218, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 2124, 58, 73, 60, 18189, 2124, 9806, 58, 73, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 3509, 7, 15, 11, 20218, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 2352, 7, 29510, 8, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 886, 198, 220, 220, 220, 611, 28769, 21737, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 12860, 7377, 119, 11, 308, 198, 220, 220, 220, 886, 198, 220, 220, 220, 581, 796, 4129, 7, 70, 8, 6624, 657, 5633, 581, 1058, 3509, 7, 411, 11, 5415, 7, 8937, 12195, 39377, 764, 9, 308, 22305, 198, 220, 220, 220, 611, 28769, 21737, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 12860, 5415, 7, 8937, 11, 308, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 12860, 5415, 7, 8937, 11, 7377, 119, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 12860, 5415, 7, 87, 8, 198, 220, 220, 220, 886, 198, 220, 220, 220, 1167, 30412, 796, 4129, 7, 70, 8, 6624, 657, 5633, 6632, 7, 417, 4906, 7, 70, 4008, 1058, 3509, 7, 47033, 7, 70, 828, 657, 8, 198, 220, 220, 220, 1441, 581, 11, 1167, 30412, 198, 437, 198, 8818, 651, 411, 312, 723, 82, 7, 82, 2122, 3712, 46344, 11, 2746, 3712, 23839, 17633, 11, 7904, 40, 79, 8738, 18559, 5142, 8, 198, 220, 220, 220, 2488, 403, 8002, 18872, 229, 69, 11, 308, 11, 18872, 229, 70, 11, 7377, 119, 11, 2124, 796, 4610, 198, 220, 220, 220, 2124, 1084, 11, 2124, 9806, 796, 651, 1084, 7, 19849, 828, 651, 9806, 7, 19849, 8, 198, 220, 220, 220, 309, 796, 1288, 4906, 7, 87, 8, 198, 220, 220, 220, 299, 11, 285, 11, 264, 796, 4129, 7, 87, 828, 4129, 7, 39377, 828, 6632, 7, 51, 8, 198, 220, 220, 220, 581, 796, 5415, 7, 16, 25, 77, 8, 466, 474, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 33571, 20218, 796, 18872, 229, 69, 58, 73, 60, 1343, 16605, 7, 24861, 229, 70, 58, 45299, 73, 4357, 7377, 119, 8, 198, 220, 220, 220, 220, 220, 220, 220, 611, 2124, 1084, 58, 73, 60, 18189, 2124, 58, 73, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 42625, 796, 20218, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 264, 15853, 3509, 7, 28241, 11, 657, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 2352, 7, 1084, 7, 15, 11, 42625, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 2124, 58, 73, 60, 18189, 2124, 9806, 58, 73, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 331, 73, 796, 532, 29510, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 264, 15853, 3509, 7, 88, 73, 11, 657, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 2352, 7, 1084, 7, 15, 11, 331, 73, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 2352, 7, 29510, 8, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 886, 198, 220, 220, 220, 45647, 796, 3509, 7, 3064, 11, 357, 16345, 7, 8937, 11, 7377, 119, 8, 1343, 264, 8, 1220, 357, 77, 1343, 285, 4008, 1220, 1802, 198, 220, 220, 220, 581, 796, 4129, 7, 70, 8, 6624, 657, 5633, 581, 1058, 3509, 7, 411, 11, 5415, 7, 8937, 12195, 39377, 764, 9, 308, 22305, 198, 220, 220, 220, 581, 796, 581, 1220, 45647, 198, 220, 220, 220, 1167, 30412, 796, 4129, 7, 70, 8, 6624, 657, 5633, 6632, 7, 417, 4906, 7, 70, 4008, 1058, 3509, 7, 47033, 7, 70, 828, 657, 8, 198, 220, 220, 220, 611, 28769, 21737, 198, 220, 220, 220, 220, 220, 220, 220, 44872, 7203, 46384, 1167, 30412, 796, 33172, 1167, 30412, 8, 198, 220, 220, 220, 886, 198, 220, 220, 220, 1441, 581, 11, 1167, 30412, 198, 437, 198 ]
2.02207
2,628
using MakieLayout using Makie using KernelDensity function kdepoly!(la::LAxis, vec, reverse=false; kwargs...) kderesult = kde(vec; npoints=32) x = kderesult.x y = kderesult.density if reverse poly!(la, Point2.(y, x); kwargs...) else poly!(la, Point2.(x, y); kwargs...) end end begin scene = Scene(resolution = (1000, 1000)); screen = display(scene) campixel!(scene); la1 = LAxis(scene) la2 = LAxis(scene) la3 = LAxis(scene) la4 = LAxis(scene) la5 = LAxis(scene) linkxaxes!(la3, la4) linkyaxes!(la3, la5) fakeaudiox = LinRange(0f0, 1000f0, 100_000) fakeaudioy = (rand(Float32, 100_000) .- 0.5f0) .+ 2 .* sin.(fakeaudiox .* 10) lines!(la1, fakeaudiox, fakeaudioy, show_axis=false) la1.attributes.title[] = "A fake audio signal" la1.attributes.ypanlock[] = true la1.attributes.yzoomlock[] = true linkeddata = randn(200, 2) .* 15 .+ 50 green = RGBAf0(0.05, 0.8, 0.3, 0.6) scatter!(la3, linkeddata, markersize=3, color=green, show_axis=false) kdepoly!(la4, linkeddata[:, 1], false, color=green, linewidth=2, show_axis=false) kdepoly!(la5, linkeddata[:, 2], true, color=green, linewidth=2, show_axis=false) linkeddata2 = randn(200, 2) .* 20 .+ 70 red = RGBAf0(0.9, 0.1, 0.05, 0.6) scatter!(la3, linkeddata2, markersize=3, color=red, show_axis=false) kdepoly!(la4, linkeddata2[:, 1], false, color=red, linewidth=2, show_axis=false) kdepoly!(la5, linkeddata2[:, 2], true, color=red, linewidth=2, show_axis=false) maingl = GridLayout(scene, 2, 1, alignmode=Outside(40)) #makie error in the tutorial #scene rendering function sledg = maingl[2, 1] = LSlider(scene, range = LinRange(0.0, 150.0, 200)) gl = maingl[1, 1] = GridLayout( 2, 2; rowsizes = [Aspect(1, 1.0), Auto()], #Comment:Aspect Ratio is not a Golden Ratio colsizes = [Relative(0.5), Auto()], addedrowgaps = Fixed(20), addedcolgaps = Fixed(20), alignmode = Outside(0)) on(slalign.value) do v with_updates_suspended(maingl) do gl.addedrowgaps = MakieLayout.GapSize[Fixed(v)] gl.addedcolgaps = MakieLayout.GapSize[Fixed(v)] end end gl_slider = gl[1, 2] = GridLayout( 3, 1; rowsizes = [Auto(), Auto(), Auto()], colsizes = [Relative(1)], addedrowgaps = [Fixed(15), Fixed(15)]) gl_colorbar = gl_slider[1, 1] = GridLayout(1, 2; colsizes=[Auto(), Relative(0.1)]) gl_colorbar[1, 1] = la2 # gl_colorbar[1, 2] = LColorbar(scene) sl1 = gl_slider[2, 1] = LSlider(scene, range = 1:0.01:10) sl2 = gl_slider[3, 1] = LSlider(scene, range = 0.1:0.01:1) xrange = LinRange(0, 2pi, 500) lines!( la2, xrange ./ 2pi .* 100, lift((x, y)->sin.(xrange .* x) .* 40 .* y .+ 50, sl1.value, sl2.value), color=:blue, linewidth=2, show_axis=false) gl[2, :] = la1 gl2 = gl[1, 1] = GridLayout( 2, 2, rowsizes = [Auto(), Relative(0.8)], colsizes = [Aspect(2, 1.0), Auto()], addedrowgaps = [Fixed(10)], addedcolgaps = [Fixed(10)]) gl2[2, 1] = la3 la3.titlevisible[] = false gl2[1, 1] = la4 la4.xlabelvisible[] = false la4.xticklabelsvisible[] = false la4.xticksvisible[] = false la4.titlevisible[] = false la4.ypanlock[] = true la4.yzoomlock[] = true gl2[2, 2] = la5 la5.ylabelvisible[] = false la5.yticklabelsvisible[] = false la5.yticksvisible[] = false la5.titlevisible[] = false la5.xpanlock[] = true la5.xzoomlock[] = true end
[ 3500, 15841, 494, 32517, 198, 3500, 15841, 494, 198, 3500, 32169, 35, 6377, 628, 198, 8818, 479, 10378, 3366, 0, 7, 5031, 3712, 13534, 87, 271, 11, 43030, 11, 9575, 28, 9562, 26, 479, 86, 22046, 23029, 198, 220, 220, 220, 479, 2934, 20274, 796, 479, 2934, 7, 35138, 26, 299, 13033, 28, 2624, 8, 628, 220, 220, 220, 2124, 796, 479, 2934, 20274, 13, 87, 198, 220, 220, 220, 331, 796, 479, 2934, 20274, 13, 43337, 628, 220, 220, 220, 611, 9575, 198, 220, 220, 220, 220, 220, 220, 220, 7514, 0, 7, 5031, 11, 6252, 17, 12195, 88, 11, 2124, 1776, 479, 86, 22046, 23029, 198, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 7514, 0, 7, 5031, 11, 6252, 17, 12195, 87, 11, 331, 1776, 479, 86, 22046, 23029, 198, 220, 220, 220, 886, 198, 437, 198, 198, 27471, 198, 220, 220, 220, 3715, 796, 28315, 7, 29268, 796, 357, 12825, 11, 8576, 18125, 198, 220, 220, 220, 3159, 796, 3359, 7, 29734, 8, 198, 220, 220, 220, 1413, 7168, 0, 7, 29734, 1776, 628, 220, 220, 220, 8591, 16, 796, 9131, 87, 271, 7, 29734, 8, 198, 220, 220, 220, 8591, 17, 796, 9131, 87, 271, 7, 29734, 8, 198, 220, 220, 220, 8591, 18, 796, 9131, 87, 271, 7, 29734, 8, 198, 220, 220, 220, 8591, 19, 796, 9131, 87, 271, 7, 29734, 8, 198, 220, 220, 220, 8591, 20, 796, 9131, 87, 271, 7, 29734, 8, 628, 220, 220, 220, 2792, 87, 897, 274, 0, 7, 5031, 18, 11, 8591, 19, 8, 198, 220, 220, 220, 2792, 88, 897, 274, 0, 7, 5031, 18, 11, 8591, 20, 8, 628, 220, 220, 220, 8390, 3885, 12190, 796, 5164, 17257, 7, 15, 69, 15, 11, 8576, 69, 15, 11, 1802, 62, 830, 8, 198, 220, 220, 220, 8390, 31330, 726, 796, 357, 25192, 7, 43879, 2624, 11, 1802, 62, 830, 8, 764, 12, 657, 13, 20, 69, 15, 8, 764, 10, 362, 764, 9, 7813, 12195, 30706, 3885, 12190, 764, 9, 838, 8, 198, 220, 220, 220, 3951, 0, 7, 5031, 16, 11, 8390, 3885, 12190, 11, 8390, 31330, 726, 11, 905, 62, 22704, 28, 9562, 8, 198, 220, 220, 220, 8591, 16, 13, 1078, 7657, 13, 7839, 21737, 796, 366, 32, 8390, 6597, 6737, 1, 198, 220, 220, 220, 8591, 16, 13, 1078, 7657, 13, 4464, 272, 5354, 21737, 796, 2081, 198, 220, 220, 220, 8591, 16, 13, 1078, 7657, 13, 45579, 4207, 5354, 21737, 796, 2081, 628, 220, 220, 220, 2792, 6048, 1045, 796, 43720, 77, 7, 2167, 11, 362, 8, 764, 9, 1315, 764, 10, 2026, 198, 220, 220, 220, 4077, 796, 34359, 4339, 69, 15, 7, 15, 13, 2713, 11, 657, 13, 23, 11, 657, 13, 18, 11, 657, 13, 21, 8, 198, 220, 220, 220, 41058, 0, 7, 5031, 18, 11, 2792, 6048, 1045, 11, 19736, 1096, 28, 18, 11, 3124, 28, 14809, 11, 905, 62, 22704, 28, 9562, 8, 198, 220, 220, 220, 479, 10378, 3366, 0, 7, 5031, 19, 11, 2792, 6048, 1045, 58, 45299, 352, 4357, 3991, 11, 3124, 28, 14809, 11, 9493, 413, 5649, 28, 17, 11, 905, 62, 22704, 28, 9562, 8, 198, 220, 220, 220, 479, 10378, 3366, 0, 7, 5031, 20, 11, 2792, 6048, 1045, 58, 45299, 362, 4357, 2081, 11, 3124, 28, 14809, 11, 9493, 413, 5649, 28, 17, 11, 905, 62, 22704, 28, 9562, 8, 628, 220, 220, 220, 2792, 6048, 1045, 17, 796, 43720, 77, 7, 2167, 11, 362, 8, 764, 9, 1160, 764, 10, 4317, 198, 220, 220, 220, 2266, 796, 34359, 4339, 69, 15, 7, 15, 13, 24, 11, 657, 13, 16, 11, 657, 13, 2713, 11, 657, 13, 21, 8, 198, 220, 220, 220, 41058, 0, 7, 5031, 18, 11, 2792, 6048, 1045, 17, 11, 19736, 1096, 28, 18, 11, 3124, 28, 445, 11, 905, 62, 22704, 28, 9562, 8, 198, 220, 220, 220, 479, 10378, 3366, 0, 7, 5031, 19, 11, 2792, 6048, 1045, 17, 58, 45299, 352, 4357, 3991, 11, 3124, 28, 445, 11, 9493, 413, 5649, 28, 17, 11, 905, 62, 22704, 28, 9562, 8, 198, 220, 220, 220, 479, 10378, 3366, 0, 7, 5031, 20, 11, 2792, 6048, 1045, 17, 58, 45299, 362, 4357, 2081, 11, 3124, 28, 445, 11, 9493, 413, 5649, 28, 17, 11, 905, 62, 22704, 28, 9562, 8, 628, 220, 220, 220, 17266, 278, 75, 796, 24846, 32517, 7, 29734, 11, 362, 11, 352, 11, 10548, 14171, 28, 30815, 7, 1821, 4008, 1303, 76, 461, 494, 4049, 287, 262, 11808, 1303, 29734, 14837, 220, 2163, 628, 220, 220, 220, 46822, 70, 796, 17266, 278, 75, 58, 17, 11, 352, 60, 796, 406, 11122, 1304, 7, 29734, 11, 2837, 796, 5164, 17257, 7, 15, 13, 15, 11, 6640, 13, 15, 11, 939, 4008, 628, 198, 220, 220, 220, 1278, 796, 17266, 278, 75, 58, 16, 11, 352, 60, 796, 24846, 32517, 7, 198, 220, 220, 220, 220, 220, 220, 220, 362, 11, 362, 26, 198, 220, 220, 220, 220, 220, 220, 220, 15274, 4340, 796, 685, 1722, 806, 7, 16, 11, 352, 13, 15, 828, 11160, 3419, 4357, 1303, 21357, 25, 1722, 806, 33956, 318, 407, 257, 8407, 33956, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 951, 82, 4340, 796, 685, 6892, 876, 7, 15, 13, 20, 828, 11160, 3419, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 2087, 808, 70, 1686, 796, 10832, 7, 1238, 828, 198, 220, 220, 220, 220, 220, 220, 220, 2087, 4033, 70, 1686, 796, 10832, 7, 1238, 828, 198, 220, 220, 220, 220, 220, 220, 220, 10548, 14171, 796, 22151, 7, 15, 4008, 628, 220, 220, 220, 319, 7, 6649, 31494, 13, 8367, 8, 466, 410, 198, 220, 220, 220, 220, 220, 220, 220, 351, 62, 929, 19581, 62, 40409, 1631, 7, 2611, 278, 75, 8, 466, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1278, 13, 29373, 808, 70, 1686, 796, 15841, 494, 32517, 13, 38, 499, 10699, 58, 13715, 7, 85, 15437, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1278, 13, 29373, 4033, 70, 1686, 796, 15841, 494, 32517, 13, 38, 499, 10699, 58, 13715, 7, 85, 15437, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 886, 628, 220, 220, 220, 1278, 62, 6649, 1304, 796, 1278, 58, 16, 11, 362, 60, 796, 24846, 32517, 7, 198, 220, 220, 220, 220, 220, 220, 220, 513, 11, 352, 26, 198, 220, 220, 220, 220, 220, 220, 220, 15274, 4340, 796, 685, 27722, 22784, 11160, 22784, 11160, 3419, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 951, 82, 4340, 796, 685, 6892, 876, 7, 16, 8, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 2087, 808, 70, 1686, 796, 685, 13715, 7, 1314, 828, 10832, 7, 1314, 8, 12962, 628, 220, 220, 220, 1278, 62, 8043, 5657, 796, 1278, 62, 6649, 1304, 58, 16, 11, 352, 60, 796, 24846, 32517, 7, 16, 11, 362, 26, 951, 82, 4340, 41888, 27722, 22784, 45344, 7, 15, 13, 16, 8, 12962, 628, 220, 220, 220, 1278, 62, 8043, 5657, 58, 16, 11, 352, 60, 796, 8591, 17, 198, 220, 220, 220, 1303, 1278, 62, 8043, 5657, 58, 16, 11, 362, 60, 796, 406, 10258, 5657, 7, 29734, 8, 628, 220, 220, 220, 1017, 16, 796, 1278, 62, 6649, 1304, 58, 17, 11, 352, 60, 796, 406, 11122, 1304, 7, 29734, 11, 2837, 796, 352, 25, 15, 13, 486, 25, 940, 8, 198, 220, 220, 220, 1017, 17, 796, 1278, 62, 6649, 1304, 58, 18, 11, 352, 60, 796, 406, 11122, 1304, 7, 29734, 11, 2837, 796, 657, 13, 16, 25, 15, 13, 486, 25, 16, 8, 628, 220, 220, 220, 2124, 9521, 796, 5164, 17257, 7, 15, 11, 362, 14415, 11, 5323, 8, 198, 220, 220, 220, 3951, 0, 7, 198, 220, 220, 220, 220, 220, 220, 220, 8591, 17, 11, 198, 220, 220, 220, 220, 220, 220, 220, 2124, 9521, 24457, 362, 14415, 764, 9, 1802, 11, 198, 220, 220, 220, 220, 220, 220, 220, 10303, 19510, 87, 11, 331, 8, 3784, 31369, 12195, 87, 9521, 764, 9, 2124, 8, 764, 9, 2319, 764, 9, 331, 764, 10, 2026, 11, 1017, 16, 13, 8367, 11, 1017, 17, 13, 8367, 828, 198, 220, 220, 220, 220, 220, 220, 220, 3124, 28, 25, 17585, 11, 9493, 413, 5649, 28, 17, 11, 905, 62, 22704, 28, 9562, 8, 628, 220, 220, 220, 1278, 58, 17, 11, 1058, 60, 796, 8591, 16, 628, 220, 220, 220, 1278, 17, 796, 1278, 58, 16, 11, 352, 60, 796, 24846, 32517, 7, 198, 220, 220, 220, 220, 220, 220, 220, 362, 11, 362, 11, 198, 220, 220, 220, 220, 220, 220, 220, 15274, 4340, 796, 685, 27722, 22784, 45344, 7, 15, 13, 23, 8, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 951, 82, 4340, 796, 685, 1722, 806, 7, 17, 11, 352, 13, 15, 828, 11160, 3419, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 2087, 808, 70, 1686, 796, 685, 13715, 7, 940, 8, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 2087, 4033, 70, 1686, 796, 685, 13715, 7, 940, 8, 12962, 628, 220, 220, 220, 1278, 17, 58, 17, 11, 352, 60, 796, 8591, 18, 198, 220, 220, 220, 8591, 18, 13, 7839, 23504, 21737, 796, 3991, 628, 220, 220, 220, 1278, 17, 58, 16, 11, 352, 60, 796, 8591, 19, 198, 220, 220, 220, 8591, 19, 13, 87, 18242, 23504, 21737, 796, 3991, 198, 220, 220, 220, 8591, 19, 13, 742, 624, 23912, 1424, 23504, 21737, 796, 3991, 198, 220, 220, 220, 8591, 19, 13, 742, 3378, 23504, 21737, 796, 3991, 198, 220, 220, 220, 8591, 19, 13, 7839, 23504, 21737, 796, 3991, 198, 220, 220, 220, 8591, 19, 13, 4464, 272, 5354, 21737, 796, 2081, 198, 220, 220, 220, 8591, 19, 13, 45579, 4207, 5354, 21737, 796, 2081, 628, 220, 220, 220, 1278, 17, 58, 17, 11, 362, 60, 796, 8591, 20, 198, 220, 220, 220, 8591, 20, 13, 2645, 9608, 23504, 21737, 796, 3991, 198, 220, 220, 220, 8591, 20, 13, 20760, 624, 23912, 1424, 23504, 21737, 796, 3991, 198, 220, 220, 220, 8591, 20, 13, 20760, 3378, 23504, 21737, 796, 3991, 198, 220, 220, 220, 8591, 20, 13, 7839, 23504, 21737, 796, 3991, 198, 220, 220, 220, 8591, 20, 13, 87, 6839, 5354, 21737, 796, 2081, 198, 220, 220, 220, 8591, 20, 13, 87, 89, 4207, 5354, 21737, 796, 2081, 198, 437 ]
2.085485
1,743
module Ripser export ripser using SparseArrays: AbstractSparseMatrix, findnz const depsfile = joinpath(dirname(@__DIR__), "deps", "deps.jl") if isfile(depsfile) include("../deps/deps.jl") else error("Ripser in not properly installed. Please run Pkg.build(\"Ripser\").") end __init__() = check_deps() # The value_t type from ripser source code. const Cvalue_t = Cfloat # RawResult contains pointers to all output arrays required by ripser. struct RawResult{T} dim_max ::Int n_intervals ::Ref{Ptr{Cint}} births_deaths ::Ref{Ptr{Cvalue_t}} cocycle_length ::Ref{Ptr{Cint}} cocycles ::Ref{Ptr{Cint}} end RawResult{T}(dim_max) where T = RawResult{T}(dim_max, Ref{Ptr{Cint}}(), Ref{Ptr{Cvalue_t}}(), Ref{Ptr{Cint}}(), Ref{Ptr{Cint}}()) # Converts a Matrix to Vector{Cvalue_t} since ripser expects a flat array as input. function flatten_distmat(dists) dists_flat = Cvalue_t[] for i in 1:size(dists, 1)-1, j in i+1:size(dists, 1) push!(dists_flat, Cvalue_t(dists[j, i])) end dists_flat end function isprime(n) if iseven(n) || n < 2 n == 2 else p = 3 q = n / p while p ≤ q iszero(n % p) && return false p += 2 q = n / p end true end end function check_args(dists, modulus, dim_max, threshold) size(dists, 1) == size(dists, 2) || throw(ArgumentError("distance matrix must be square")) isprime(modulus) || throw(ArgumentError("modulus must be a prime number")) dim_max ≥ 0 || throw(ArgumentError("dim_max must be non-negative")) threshold > 0 || throw(ArgumentError("threshold must be positive")) end function split_cocycle(cocycle, dim) c = Tuple{Vector{Int}, Int}[] for i in 1:dim+2:length(cocycle)-dim-1 push!(c, (cocycle[i:i+dim] .+ 1, cocycle[i+dim+1])) end c end # Unpack RawResult{T} to barcode and cocycles (if return_cocycles is true) function unpack_results(raw::RawResult{T}, return_cocycles) where T dim_max = raw.dim_max n_intervals = unsafe_wrap(Vector{Cint}, raw.n_intervals[], raw.dim_max + 1, own = true) intervals = unsafe_wrap(Matrix{Cvalue_t}, raw.births_deaths[], (2, sum(n_intervals)), own = true) cocycle_length = unsafe_wrap(Vector{Cint}, raw.cocycle_length[], sum(n_intervals), own = true) if sum(cocycle_length) > 0 cocycles_flat = unsafe_wrap(Vector{Cint}, raw.cocycles[], sum(cocycle_length), own = true) else cocycles_flat = Cint[] end if !return_cocycles barcodes = Matrix{T}[] start = 0 for int in n_intervals push!(barcodes, T.(intervals[:, start+1:start+int])) start += int end map(barcodes) do bc collect(vec(reinterpret(Tuple{T, T}, bc))) end else barcodes = Matrix{T}[] cocycles = Vector{Vector{Tuple{Vector{Int}, Int}}}[] start_bc = 0 start_cc = 0 for int in n_intervals push!(barcodes, T.(intervals[:, start_bc+1:start_bc+int])) push!(cocycles, Int[]) for i in 1:int len = cocycle_length[start_bc + i] push!(cocycles[end], split_cocycle(cocycles_flat[start_cc+1:start_cc+len], length(cocycles)-1)) start_cc += len end start_bc += int end map(barcodes) do bc collect(vec(reinterpret(Tuple{T, T}, bc))) end, cocycles end end """ ripser(dists; modulus = 2, dim_max = 1, threshold = Inf, cocycles = false) """ function ripser(dists ::AbstractMatrix{T}; modulus ::Integer = 2, dim_max ::Integer = 1, threshold ::Real = Inf, cocycles ::Bool = false) where T<:AbstractFloat check_args(dists, modulus, dim_max, threshold) res = RawResult{T}(dim_max) dists_flat = flatten_distmat(dists) ripser_fptr = Libdl.dlsym(Libdl.dlopen(libripser), :c_rips_dm) n_edges = ccall(ripser_fptr, Cint, (Ptr{Ptr{Cint}}, Ptr{Ptr{Cvalue_t}}, Ptr{Ptr{Cint}}, Ptr{Ptr{Cint}}, Ptr{Cvalue_t}, Cint, Cint, Cint, Cvalue_t, Cint), res.n_intervals, res.births_deaths, res.cocycle_length, res.cocycles, dists_flat, length(dists_flat), modulus, dim_max, threshold, cocycles) unpack_results(res, cocycles) end function ripser(dists ::AbstractSparseMatrix{T}; modulus ::Integer = 2, dim_max ::Integer = 1, threshold ::Real = Inf, cocycles ::Bool = false) where T<:AbstractFloat check_args(dists, modulus, dim_max, threshold) J, I, V = findnz(dists) I .-= 1 J .-= 1 res = RawResult{T}(dim_max) ripser_fptr = Libdl.dlsym(Libdl.dlopen(libripser), :c_rips_dm_sparse) n_edges = ccall(ripser_fptr, Cint, (Ptr{Ptr{Cint}}, Ptr{Ptr{Cvalue_t}}, Ptr{Ptr{Cint}}, Ptr{Ptr{Cint}}, Ptr{Cint}, Ptr{Cint}, Ptr{Cvalue_t}, Cint, Cint, Cint, Cint, Cvalue_t, Cint), res.n_intervals, res.births_deaths, res.cocycle_length, res.cocycles, Cint.(I), Cint.(J), Cvalue_t.(V), length(I), size(dists, 1), modulus, dim_max, threshold, cocycles) unpack_results(res, cocycles) end end
[ 21412, 371, 2419, 263, 198, 39344, 374, 2419, 263, 198, 198, 3500, 1338, 17208, 3163, 20477, 25, 27741, 50, 29572, 46912, 11, 1064, 27305, 198, 198, 9979, 390, 862, 7753, 796, 4654, 6978, 7, 15908, 3672, 7, 31, 834, 34720, 834, 828, 366, 10378, 82, 1600, 366, 10378, 82, 13, 20362, 4943, 198, 361, 318, 7753, 7, 10378, 82, 7753, 8, 198, 220, 220, 220, 2291, 7203, 40720, 10378, 82, 14, 10378, 82, 13, 20362, 4943, 198, 17772, 198, 220, 220, 220, 4049, 7203, 49, 2419, 263, 287, 407, 6105, 6589, 13, 4222, 1057, 350, 10025, 13, 11249, 7, 7879, 49, 2419, 263, 59, 4943, 19570, 198, 437, 198, 834, 15003, 834, 3419, 796, 2198, 62, 10378, 82, 3419, 198, 198, 2, 383, 1988, 62, 83, 2099, 422, 374, 2419, 263, 2723, 2438, 13, 198, 9979, 327, 8367, 62, 83, 796, 327, 22468, 198, 198, 2, 16089, 23004, 4909, 32007, 284, 477, 5072, 26515, 2672, 416, 374, 2419, 263, 13, 198, 7249, 16089, 23004, 90, 51, 92, 198, 220, 220, 220, 5391, 62, 9806, 220, 220, 220, 220, 220, 220, 220, 7904, 5317, 198, 220, 220, 220, 299, 62, 3849, 12786, 220, 220, 220, 7904, 8134, 90, 46745, 90, 34, 600, 11709, 198, 220, 220, 220, 27244, 62, 22595, 82, 220, 7904, 8134, 90, 46745, 90, 34, 8367, 62, 83, 11709, 198, 220, 220, 220, 8954, 39297, 62, 13664, 7904, 8134, 90, 46745, 90, 34, 600, 11709, 198, 220, 220, 220, 8954, 88, 5427, 220, 220, 220, 220, 220, 220, 7904, 8134, 90, 46745, 90, 34, 600, 11709, 198, 437, 198, 198, 27369, 23004, 90, 51, 92, 7, 27740, 62, 9806, 8, 810, 309, 796, 198, 220, 220, 220, 16089, 23004, 90, 51, 92, 7, 27740, 62, 9806, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6524, 90, 46745, 90, 34, 600, 11709, 22784, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6524, 90, 46745, 90, 34, 8367, 62, 83, 11709, 22784, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6524, 90, 46745, 90, 34, 600, 11709, 22784, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6524, 90, 46745, 90, 34, 600, 11709, 28955, 198, 198, 2, 1482, 24040, 257, 24936, 284, 20650, 90, 34, 8367, 62, 83, 92, 1201, 374, 2419, 263, 13423, 257, 6228, 7177, 355, 5128, 13, 198, 8818, 27172, 268, 62, 17080, 6759, 7, 67, 1023, 8, 198, 220, 220, 220, 288, 1023, 62, 38568, 796, 327, 8367, 62, 83, 21737, 198, 220, 220, 220, 329, 1312, 287, 352, 25, 7857, 7, 67, 1023, 11, 352, 13219, 16, 11, 474, 287, 1312, 10, 16, 25, 7857, 7, 67, 1023, 11, 352, 8, 198, 220, 220, 220, 220, 220, 220, 220, 4574, 0, 7, 67, 1023, 62, 38568, 11, 327, 8367, 62, 83, 7, 67, 1023, 58, 73, 11, 1312, 60, 4008, 198, 220, 220, 220, 886, 198, 220, 220, 220, 288, 1023, 62, 38568, 198, 437, 198, 198, 8818, 318, 35505, 7, 77, 8, 198, 220, 220, 220, 611, 318, 10197, 7, 77, 8, 8614, 299, 1279, 362, 198, 220, 220, 220, 220, 220, 220, 220, 299, 6624, 362, 198, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 279, 796, 513, 198, 220, 220, 220, 220, 220, 220, 220, 10662, 796, 299, 1220, 279, 198, 220, 220, 220, 220, 220, 220, 220, 981, 279, 41305, 10662, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 318, 22570, 7, 77, 4064, 279, 8, 11405, 1441, 3991, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 279, 15853, 362, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 10662, 796, 299, 1220, 279, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 2081, 198, 220, 220, 220, 886, 198, 437, 198, 198, 8818, 2198, 62, 22046, 7, 67, 1023, 11, 953, 23515, 11, 5391, 62, 9806, 11, 11387, 8, 198, 220, 220, 220, 2546, 7, 67, 1023, 11, 352, 8, 6624, 2546, 7, 67, 1023, 11, 362, 8, 8614, 3714, 7, 28100, 1713, 12331, 7203, 30246, 17593, 1276, 307, 6616, 48774, 198, 220, 220, 220, 318, 35505, 7, 4666, 23515, 8, 8614, 3714, 7, 28100, 1713, 12331, 7203, 4666, 23515, 1276, 307, 257, 6994, 1271, 48774, 198, 220, 220, 220, 5391, 62, 9806, 26870, 657, 220, 220, 220, 220, 220, 8614, 3714, 7, 28100, 1713, 12331, 7203, 27740, 62, 9806, 1276, 307, 1729, 12, 31591, 48774, 198, 220, 220, 220, 11387, 1875, 657, 220, 220, 220, 8614, 3714, 7, 28100, 1713, 12331, 7203, 400, 10126, 1276, 307, 3967, 48774, 198, 437, 198, 198, 8818, 6626, 62, 66, 13733, 2375, 7, 66, 13733, 2375, 11, 5391, 8, 198, 220, 220, 220, 269, 796, 309, 29291, 90, 38469, 90, 5317, 5512, 2558, 92, 21737, 198, 220, 220, 220, 329, 1312, 287, 352, 25, 27740, 10, 17, 25, 13664, 7, 66, 13733, 2375, 13219, 27740, 12, 16, 198, 220, 220, 220, 220, 220, 220, 220, 4574, 0, 7, 66, 11, 357, 66, 13733, 2375, 58, 72, 25, 72, 10, 27740, 60, 764, 10, 352, 11, 8954, 39297, 58, 72, 10, 27740, 10, 16, 60, 4008, 198, 220, 220, 220, 886, 198, 220, 220, 220, 269, 198, 437, 198, 198, 2, 791, 8002, 16089, 23004, 90, 51, 92, 284, 2318, 8189, 290, 8954, 88, 5427, 357, 361, 1441, 62, 66, 13733, 5427, 318, 2081, 8, 198, 8818, 555, 8002, 62, 43420, 7, 1831, 3712, 27369, 23004, 90, 51, 5512, 1441, 62, 66, 13733, 5427, 8, 810, 309, 198, 220, 220, 220, 5391, 62, 9806, 796, 8246, 13, 27740, 62, 9806, 628, 220, 220, 220, 299, 62, 3849, 12786, 796, 21596, 62, 37150, 7, 38469, 90, 34, 600, 5512, 8246, 13, 77, 62, 3849, 12786, 58, 4357, 8246, 13, 27740, 62, 9806, 1343, 352, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 898, 796, 2081, 8, 198, 220, 220, 220, 20016, 796, 21596, 62, 37150, 7, 46912, 90, 34, 8367, 62, 83, 5512, 8246, 13, 24280, 82, 62, 22595, 82, 58, 4357, 357, 17, 11, 2160, 7, 77, 62, 3849, 12786, 36911, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 898, 796, 2081, 8, 198, 220, 220, 220, 8954, 39297, 62, 13664, 796, 21596, 62, 37150, 7, 38469, 90, 34, 600, 5512, 8246, 13, 66, 13733, 2375, 62, 13664, 58, 4357, 2160, 7, 77, 62, 3849, 12786, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 898, 796, 2081, 8, 198, 220, 220, 220, 611, 2160, 7, 66, 13733, 2375, 62, 13664, 8, 1875, 657, 198, 220, 220, 220, 220, 220, 220, 220, 8954, 88, 5427, 62, 38568, 796, 21596, 62, 37150, 7, 38469, 90, 34, 600, 5512, 8246, 13, 66, 13733, 5427, 58, 4357, 2160, 7, 66, 13733, 2375, 62, 13664, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 898, 796, 2081, 8, 198, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 8954, 88, 5427, 62, 38568, 796, 327, 600, 21737, 198, 220, 220, 220, 886, 628, 220, 220, 220, 611, 5145, 7783, 62, 66, 13733, 5427, 198, 220, 220, 220, 220, 220, 220, 220, 2318, 40148, 796, 24936, 90, 51, 92, 21737, 198, 220, 220, 220, 220, 220, 220, 220, 923, 796, 657, 198, 220, 220, 220, 220, 220, 220, 220, 329, 493, 287, 299, 62, 3849, 12786, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4574, 0, 7, 65, 5605, 4147, 11, 309, 12195, 3849, 12786, 58, 45299, 923, 10, 16, 25, 9688, 10, 600, 60, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 923, 15853, 493, 198, 220, 220, 220, 220, 220, 220, 220, 886, 628, 220, 220, 220, 220, 220, 220, 220, 3975, 7, 65, 5605, 4147, 8, 466, 47125, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2824, 7, 35138, 7, 260, 27381, 7, 51, 29291, 90, 51, 11, 309, 5512, 47125, 22305, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 2318, 40148, 796, 24936, 90, 51, 92, 21737, 198, 220, 220, 220, 220, 220, 220, 220, 8954, 88, 5427, 796, 20650, 90, 38469, 90, 51, 29291, 90, 38469, 90, 5317, 5512, 2558, 42535, 21737, 628, 220, 220, 220, 220, 220, 220, 220, 923, 62, 15630, 796, 657, 198, 220, 220, 220, 220, 220, 220, 220, 923, 62, 535, 796, 657, 198, 220, 220, 220, 220, 220, 220, 220, 329, 493, 287, 299, 62, 3849, 12786, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4574, 0, 7, 65, 5605, 4147, 11, 309, 12195, 3849, 12786, 58, 45299, 923, 62, 15630, 10, 16, 25, 9688, 62, 15630, 10, 600, 60, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4574, 0, 7, 66, 13733, 5427, 11, 2558, 58, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 1312, 287, 352, 25, 600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 18896, 796, 8954, 39297, 62, 13664, 58, 9688, 62, 15630, 1343, 1312, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4574, 0, 7, 66, 13733, 5427, 58, 437, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6626, 62, 66, 13733, 2375, 7, 66, 13733, 5427, 62, 38568, 58, 9688, 62, 535, 10, 16, 25, 9688, 62, 535, 10, 11925, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4129, 7, 66, 13733, 5427, 13219, 16, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 923, 62, 535, 15853, 18896, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 923, 62, 15630, 15853, 493, 198, 220, 220, 220, 220, 220, 220, 220, 886, 628, 220, 220, 220, 220, 220, 220, 220, 3975, 7, 65, 5605, 4147, 8, 466, 47125, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2824, 7, 35138, 7, 260, 27381, 7, 51, 29291, 90, 51, 11, 309, 5512, 47125, 22305, 198, 220, 220, 220, 220, 220, 220, 220, 886, 11, 8954, 88, 5427, 198, 220, 220, 220, 886, 198, 437, 198, 198, 37811, 198, 220, 220, 220, 374, 2419, 263, 7, 67, 1023, 26, 953, 23515, 796, 362, 11, 5391, 62, 9806, 796, 352, 11, 11387, 796, 4806, 11, 8954, 88, 5427, 796, 3991, 8, 198, 37811, 198, 8818, 374, 2419, 263, 7, 67, 1023, 220, 220, 220, 220, 7904, 23839, 46912, 90, 51, 19629, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 953, 23515, 220, 220, 7904, 46541, 796, 362, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5391, 62, 9806, 220, 220, 7904, 46541, 796, 352, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 11387, 7904, 15633, 796, 4806, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8954, 88, 5427, 220, 7904, 33, 970, 796, 3991, 8, 810, 309, 27, 25, 23839, 43879, 198, 220, 220, 220, 2198, 62, 22046, 7, 67, 1023, 11, 953, 23515, 11, 5391, 62, 9806, 11, 11387, 8, 628, 220, 220, 220, 581, 796, 16089, 23004, 90, 51, 92, 7, 27740, 62, 9806, 8, 198, 220, 220, 220, 288, 1023, 62, 38568, 796, 27172, 268, 62, 17080, 6759, 7, 67, 1023, 8, 628, 220, 220, 220, 374, 2419, 263, 62, 69, 20692, 796, 7980, 25404, 13, 25404, 37047, 7, 25835, 25404, 13, 25404, 9654, 7, 8019, 380, 862, 263, 828, 1058, 66, 62, 380, 862, 62, 36020, 8, 198, 220, 220, 220, 299, 62, 276, 3212, 796, 269, 13345, 7, 380, 862, 263, 62, 69, 20692, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 327, 600, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 357, 46745, 90, 46745, 90, 34, 600, 92, 5512, 350, 2213, 90, 46745, 90, 34, 8367, 62, 83, 92, 5512, 350, 2213, 90, 46745, 90, 34, 600, 92, 5512, 350, 2213, 90, 46745, 90, 34, 600, 92, 5512, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 350, 2213, 90, 34, 8367, 62, 83, 5512, 327, 600, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 327, 600, 11, 327, 600, 11, 327, 8367, 62, 83, 11, 327, 600, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 581, 13, 77, 62, 3849, 12786, 11, 581, 13, 24280, 82, 62, 22595, 82, 11, 581, 13, 66, 13733, 2375, 62, 13664, 11, 581, 13, 66, 13733, 5427, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 288, 1023, 62, 38568, 11, 4129, 7, 67, 1023, 62, 38568, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 953, 23515, 11, 5391, 62, 9806, 11, 11387, 11, 8954, 88, 5427, 8, 628, 220, 220, 220, 555, 8002, 62, 43420, 7, 411, 11, 8954, 88, 5427, 8, 198, 437, 198, 198, 8818, 374, 2419, 263, 7, 67, 1023, 220, 220, 220, 220, 7904, 23839, 50, 29572, 46912, 90, 51, 19629, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 953, 23515, 220, 220, 7904, 46541, 796, 362, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5391, 62, 9806, 220, 220, 7904, 46541, 796, 352, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 11387, 7904, 15633, 796, 4806, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8954, 88, 5427, 220, 7904, 33, 970, 796, 3991, 8, 810, 309, 27, 25, 23839, 43879, 198, 220, 220, 220, 2198, 62, 22046, 7, 67, 1023, 11, 953, 23515, 11, 5391, 62, 9806, 11, 11387, 8, 628, 220, 220, 220, 449, 11, 314, 11, 569, 796, 1064, 27305, 7, 67, 1023, 8, 198, 220, 220, 220, 314, 764, 12, 28, 352, 198, 220, 220, 220, 449, 764, 12, 28, 352, 198, 220, 220, 220, 581, 796, 16089, 23004, 90, 51, 92, 7, 27740, 62, 9806, 8, 628, 220, 220, 220, 374, 2419, 263, 62, 69, 20692, 796, 7980, 25404, 13, 25404, 37047, 7, 25835, 25404, 13, 25404, 9654, 7, 8019, 380, 862, 263, 828, 1058, 66, 62, 380, 862, 62, 36020, 62, 82, 29572, 8, 198, 220, 220, 220, 299, 62, 276, 3212, 796, 269, 13345, 7, 380, 862, 263, 62, 69, 20692, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 327, 600, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 357, 46745, 90, 46745, 90, 34, 600, 92, 5512, 350, 2213, 90, 46745, 90, 34, 8367, 62, 83, 92, 5512, 350, 2213, 90, 46745, 90, 34, 600, 92, 5512, 350, 2213, 90, 46745, 90, 34, 600, 92, 5512, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 350, 2213, 90, 34, 600, 5512, 350, 2213, 90, 34, 600, 5512, 350, 2213, 90, 34, 8367, 62, 83, 5512, 327, 600, 11, 327, 600, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 327, 600, 11, 327, 600, 11, 327, 8367, 62, 83, 11, 327, 600, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 581, 13, 77, 62, 3849, 12786, 11, 581, 13, 24280, 82, 62, 22595, 82, 11, 581, 13, 66, 13733, 2375, 62, 13664, 11, 581, 13, 66, 13733, 5427, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 327, 600, 12195, 40, 828, 327, 600, 12195, 41, 828, 327, 8367, 62, 83, 12195, 53, 828, 4129, 7, 40, 828, 2546, 7, 67, 1023, 11, 352, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 953, 23515, 11, 5391, 62, 9806, 11, 11387, 11, 8954, 88, 5427, 8, 628, 220, 220, 220, 555, 8002, 62, 43420, 7, 411, 11, 8954, 88, 5427, 8, 198, 437, 198, 437, 198 ]
1.91151
3,006
<reponame>DelMaestroGroup/OperationalEntanglementFreeFermions module FreeFermionsOEE using Printf export operational_entanglement include("operational_entanglement.jl") end
[ 27, 7856, 261, 480, 29, 13856, 21467, 47692, 13247, 14, 18843, 864, 14539, 648, 1732, 11146, 37, 7780, 507, 198, 21412, 3232, 37, 7780, 507, 46, 6500, 198, 198, 3500, 12578, 69, 198, 198, 39344, 198, 220, 220, 220, 13919, 62, 298, 648, 1732, 198, 17256, 7203, 3575, 864, 62, 298, 648, 1732, 13, 20362, 4943, 198, 198, 437, 198 ]
3
60
using KitBase, FluxReconstruction, OrdinaryDiffEq, Langevin, LinearAlgebra, Plots using ProgressMeter: @showprogress begin x0 = 0 x1 = 1 ncell = 100 nface = ncell + 1 dx = (x1 - x0) / ncell deg = 2 # polynomial degree nsp = deg + 1 γ = 7 / 5 cfl = 0.05 dt = cfl * dx / (2.0) t = 0.0 tspan = (0.0, 0.15) uqMethod = "galerkin" nr = 9 nRec = 18 opType = "uniform" parameter1 = 0.95 parameter2 = 1.05 end ps = FRPSpace1D(x0, x1, ncell, deg) uq = UQ1D(nr, nRec, parameter1, parameter2, opType, uqMethod) V = vandermonde_matrix(ps.deg,ps.xpl) VInv = inv(Array(ps.V)) l2 = [uq.t2Product[j-1, j-1] for j = 1:uq.nm+1] cd(@__DIR__) include("rhs.jl") include("../filter.jl") begin isRandomLocation = false#true isPrefilter = false#true u = zeros(ncell, nsp, 3, uq.nm+1) if isRandomLocation # stochastic location for i = 1:ncell, j = 1:nsp prim = zeros(3, uq.nq) for k = 1:uq.nq if ps.x[i] <= 0.5 + 0.05 * uq.op.quad.nodes[k] prim[:, k] .= [1.0, 0.0, 0.5] else prim[:, k] .= [0.125, 0.0, 0.625] end end prim_chaos = zeros(3, uq.nm+1) for k = 1:3 prim_chaos[k, :] .= ran_chaos(prim[k, :], uq) end u[i, j, :, :] .= uq_prim_conserve(prim_chaos, γ, uq) end else # stochastic density for i = 1:ncell, j = 1:nsp prim = zeros(3, uq.nm+1) if ps.x[i] <= 0.5 #prim[1, :] .= uq.pce prim[1, 1] = 1.0 prim[2, 1] = 0.0 prim[3, 1] = 0.5 else prim[:, 1] .= [0.125, 0.0, 0.625] end u[i, j, :, :] .= uq_prim_conserve(prim, γ, uq) end end if isPrefilter # pre-filtering for j = 1:size(u, 1) for s = 1:size(u, 3) uModal = VInv * u[j, :, s, :] #FR.modal_filter!(uModal, 15e-2, 10e-5; filter = :l2opt) #FR.modal_filter!(uModal, 5e-2, 5e-2; filter = :l2) #FR.modal_filter!(uModal, 5, 5; filter = :exp) FR.modal_filter!(uModal; filter = :lasso) u[j, :, s, :] .= V * uModal end end end end p = (ps.J, ps.ll, ps.lr, ps.dl, ps.dhl, ps.dhr, γ, uq) prob = ODEProblem(dudt!, u, tspan, p) nt = tspan[2] ÷ dt |> Int itg = init(prob, Midpoint(), saveat = tspan[2], adaptive = false, dt = dt) @showprogress for iter = 1:nt step!(itg) for i = 1:size(itg.u, 1) #= ũ = VInv * itg.u[i, :, 1, 1] su = log10(ũ[end]^2 / sum(ũ.^2)) isShock = detector(su, ps.deg) if isShock for j in axes(itg.u, 3), k in axes(itg.u, 4) û = VInv * itg.u[i, :, j, k] FR.modal_filter!(û, 1e-2; filter = :l2) itg.u[i, :, j, k] .= ps.V * û end end ṽ = itg.u[i, end÷2, 1, :] sv = log10(ṽ[end]^2 / sum(ṽ.^2)) isShock = detector(sv, ps.deg) if isShock for j in axes(itg.u, 2), k in axes(itg.u, 3) ṽ = @view itg.u[i, j, k, :] FR.modal_filter!(ṽ, 5e-4; filter = :l2) end end=# #=ũ = VInv * itg.u[i, :, 1, 1] ṽ = itg.u[i, end÷2, 1, :] su = log10(ũ[end]^2 / sum(ũ.^2)) sv = log10(ṽ[end]^2 / sum(ṽ.^2)) isShock = max(shock_detector(su, ps.deg), shock_detector(sv, ps.deg)) if isShock for s = 1:size(itg.u, 3) û = VInv * itg.u[i, :, s, :] #FR.filter_exp!(û, 10, 100) #FR.modal_filter!(û, 0.8e-2, 1e-6; filter = :l2) FR.modal_filter!(û, 10e-2, 5e-5; filter = :l2opt) #FR.modal_filter!(û, 5e-2, 5e-5; filter = :l2) #FR.modal_filter!(û, 5e-2, 5e-5; filter = :l2) itg.u[i, :, s, :] .= ps.V * û end end=# ũ = VInv * itg.u[i, :, 1, :] su = maximum([ũ[end, j]^2 / sum(ũ[:, j].^2) for j = 1:uq.nm+1]) sv = maximum([ũ[j, end]^2 * uq.t2Product[uq.nm, uq.nm] / sum(ũ[j, :].^2 .* l2) for j = 1:nsp]) isShock = max(shock_detector(log10(su), ps.deg), shock_detector(log10(sv), ps.deg)) if isShock λ1 = dt * (su) λ2 = dt * (sv) for s = 1:size(itg.u, 3) û = VInv * itg.u[i, :, s, :] #FR.modal_filter!(û, λ1, λ2; filter = :l2) #FR.modal_filter!(û, λ1, λ2; filter = :l2opt) #FR.modal_filter!(û, 1e-2, 1e-3; filter = :l2) FR.modal_filter!(û; filter = :lasso) itg.u[i, :, s, :] .= ps.V * û end end tmp = @view itg.u[i, :, :, 1] positive_limiter(tmp, γ, ps.wp/2, ps.ll, ps.lr) end end begin x = zeros(ncell * nsp) w = zeros(ncell * nsp, 3, uq.nm+1) for i = 1:ncell idx0 = (i - 1) * nsp for j = 1:nsp idx = idx0 + j x[idx] = ps.xpg[i, j] w[idx, :, :] .= itg.u[i, j, :, :] end end sol = zeros(ncell*nsp, 3, 2) for i in axes(sol, 1) p1 = zeros(3, uq.nm+1) p1 = uq_conserve_prim(w[i, :, :], γ, uq) p1[end, :] .= lambda_tchaos(p1[end, :], 1.0, uq) for k = 1:3 sol[i, k, 1] = mean(p1[k, :], uq.op) sol[i, k, 2] = std(p1[k, :], uq.op) end end pic1 = plot(x, sol[:, 1, 1], label="ρ", xlabel="x", ylabel="mean") plot!(pic1, x, sol[:, 2, 1], label="U") plot!(pic1, x, sol[:, 3, 1], label="T") pic2 = plot(x, sol[:, 1, 2], label="ρ", xlabel="x", ylabel="std") plot!(pic2, x, sol[:, 2, 2], label="U") plot!(pic2, x, sol[:, 3, 2], label="T") plot(pic1, pic2) end plot(x, sol0[:, 1, 2], label="No filter", xlabel="x", ylabel="ρ") plot!(x, sol[:, 1, 2], label="adaptive L²") sol0 = deepcopy(sol)
[ 3500, 10897, 14881, 11, 1610, 2821, 6690, 261, 15019, 11, 14230, 3219, 28813, 36, 80, 11, 47579, 7114, 11, 44800, 2348, 29230, 11, 1345, 1747, 198, 3500, 18387, 44, 2357, 25, 2488, 12860, 33723, 198, 198, 27471, 198, 220, 220, 220, 2124, 15, 796, 657, 198, 220, 220, 220, 2124, 16, 796, 352, 198, 220, 220, 220, 299, 3846, 796, 1802, 198, 220, 220, 220, 299, 2550, 796, 299, 3846, 1343, 352, 198, 220, 220, 220, 44332, 796, 357, 87, 16, 532, 2124, 15, 8, 1220, 299, 3846, 198, 220, 220, 220, 3396, 796, 362, 1303, 745, 6213, 49070, 4922, 198, 220, 220, 220, 299, 2777, 796, 3396, 1343, 352, 198, 220, 220, 220, 7377, 111, 796, 767, 1220, 642, 198, 220, 220, 220, 269, 2704, 796, 657, 13, 2713, 198, 220, 220, 220, 288, 83, 796, 269, 2704, 1635, 44332, 1220, 357, 17, 13, 15, 8, 198, 220, 220, 220, 256, 796, 657, 13, 15, 198, 220, 220, 220, 256, 12626, 796, 357, 15, 13, 15, 11, 657, 13, 1314, 8, 628, 220, 220, 220, 334, 80, 17410, 796, 366, 13528, 263, 5116, 1, 198, 220, 220, 220, 299, 81, 796, 860, 198, 220, 220, 220, 299, 6690, 796, 1248, 198, 220, 220, 220, 1034, 6030, 796, 366, 403, 6933, 1, 198, 220, 220, 220, 11507, 16, 796, 657, 13, 3865, 198, 220, 220, 220, 11507, 17, 796, 352, 13, 2713, 198, 437, 198, 862, 796, 8782, 3705, 10223, 16, 35, 7, 87, 15, 11, 2124, 16, 11, 299, 3846, 11, 3396, 8, 198, 84, 80, 796, 471, 48, 16, 35, 7, 48624, 11, 299, 6690, 11, 11507, 16, 11, 11507, 17, 11, 1034, 6030, 11, 334, 80, 17410, 8, 198, 53, 796, 410, 4066, 6327, 68, 62, 6759, 8609, 7, 862, 13, 13500, 11, 862, 13, 87, 489, 8, 198, 53, 19904, 796, 800, 7, 19182, 7, 862, 13, 53, 4008, 198, 75, 17, 796, 685, 84, 80, 13, 83, 17, 15667, 58, 73, 12, 16, 11, 474, 12, 16, 60, 329, 474, 796, 352, 25, 84, 80, 13, 21533, 10, 16, 60, 198, 198, 10210, 7, 31, 834, 34720, 834, 8, 198, 17256, 7203, 81, 11994, 13, 20362, 4943, 198, 17256, 7203, 40720, 24455, 13, 20362, 4943, 198, 198, 27471, 198, 220, 220, 220, 318, 29531, 14749, 796, 3991, 2, 7942, 198, 220, 220, 220, 318, 36698, 346, 353, 796, 3991, 2, 7942, 628, 220, 220, 220, 334, 796, 1976, 27498, 7, 1198, 297, 11, 299, 2777, 11, 513, 11, 334, 80, 13, 21533, 10, 16, 8, 198, 220, 220, 220, 611, 318, 29531, 14749, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 3995, 354, 3477, 4067, 198, 220, 220, 220, 220, 220, 220, 220, 329, 1312, 796, 352, 25, 1198, 297, 11, 474, 796, 352, 25, 77, 2777, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2684, 796, 1976, 27498, 7, 18, 11, 334, 80, 13, 77, 80, 8, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 479, 796, 352, 25, 84, 80, 13, 77, 80, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 26692, 13, 87, 58, 72, 60, 19841, 657, 13, 20, 1343, 657, 13, 2713, 1635, 334, 80, 13, 404, 13, 47003, 13, 77, 4147, 58, 74, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2684, 58, 45299, 479, 60, 764, 28, 685, 16, 13, 15, 11, 657, 13, 15, 11, 657, 13, 20, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2684, 58, 45299, 479, 60, 764, 28, 685, 15, 13, 11623, 11, 657, 13, 15, 11, 657, 13, 26704, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2684, 62, 354, 7495, 796, 1976, 27498, 7, 18, 11, 334, 80, 13, 21533, 10, 16, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 479, 796, 352, 25, 18, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2684, 62, 354, 7495, 58, 74, 11, 1058, 60, 764, 28, 4966, 62, 354, 7495, 7, 19795, 58, 74, 11, 1058, 4357, 334, 80, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 334, 58, 72, 11, 474, 11, 1058, 11, 1058, 60, 764, 28, 334, 80, 62, 19795, 62, 5936, 3760, 7, 19795, 62, 354, 7495, 11, 7377, 111, 11, 334, 80, 8, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 3995, 354, 3477, 12109, 198, 220, 220, 220, 220, 220, 220, 220, 329, 1312, 796, 352, 25, 1198, 297, 11, 474, 796, 352, 25, 77, 2777, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2684, 796, 1976, 27498, 7, 18, 11, 334, 80, 13, 21533, 10, 16, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 26692, 13, 87, 58, 72, 60, 19841, 657, 13, 20, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 19795, 58, 16, 11, 1058, 60, 764, 28, 334, 80, 13, 79, 344, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2684, 58, 16, 11, 352, 60, 796, 352, 13, 15, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2684, 58, 17, 11, 352, 60, 796, 657, 13, 15, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2684, 58, 18, 11, 352, 60, 796, 657, 13, 20, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2684, 58, 45299, 352, 60, 764, 28, 685, 15, 13, 11623, 11, 657, 13, 15, 11, 657, 13, 26704, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 334, 58, 72, 11, 474, 11, 1058, 11, 1058, 60, 764, 28, 334, 80, 62, 19795, 62, 5936, 3760, 7, 19795, 11, 7377, 111, 11, 334, 80, 8, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 886, 628, 220, 220, 220, 611, 318, 36698, 346, 353, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 662, 12, 10379, 20212, 198, 220, 220, 220, 220, 220, 220, 220, 329, 474, 796, 352, 25, 7857, 7, 84, 11, 352, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 264, 796, 352, 25, 7857, 7, 84, 11, 513, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 334, 5841, 282, 796, 569, 19904, 1635, 334, 58, 73, 11, 1058, 11, 264, 11, 1058, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 10913, 13, 4666, 282, 62, 24455, 0, 7, 84, 5841, 282, 11, 1315, 68, 12, 17, 11, 838, 68, 12, 20, 26, 8106, 796, 1058, 75, 17, 8738, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 10913, 13, 4666, 282, 62, 24455, 0, 7, 84, 5841, 282, 11, 642, 68, 12, 17, 11, 642, 68, 12, 17, 26, 8106, 796, 1058, 75, 17, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 10913, 13, 4666, 282, 62, 24455, 0, 7, 84, 5841, 282, 11, 642, 11, 642, 26, 8106, 796, 1058, 11201, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8782, 13, 4666, 282, 62, 24455, 0, 7, 84, 5841, 282, 26, 8106, 796, 1058, 75, 28372, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 334, 58, 73, 11, 1058, 11, 264, 11, 1058, 60, 764, 28, 569, 1635, 334, 5841, 282, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 886, 198, 437, 198, 198, 79, 796, 357, 862, 13, 41, 11, 26692, 13, 297, 11, 26692, 13, 14050, 11, 26692, 13, 25404, 11, 26692, 13, 67, 18519, 11, 26692, 13, 67, 11840, 11, 7377, 111, 11, 334, 80, 8, 198, 1676, 65, 796, 440, 7206, 40781, 7, 67, 463, 83, 28265, 334, 11, 256, 12626, 11, 279, 8, 198, 429, 796, 256, 12626, 58, 17, 60, 6184, 115, 288, 83, 930, 29, 2558, 198, 270, 70, 796, 2315, 7, 1676, 65, 11, 7215, 4122, 22784, 3613, 265, 796, 256, 12626, 58, 17, 4357, 29605, 796, 3991, 11, 288, 83, 796, 288, 83, 8, 198, 198, 31, 12860, 33723, 329, 11629, 796, 352, 25, 429, 198, 220, 220, 220, 2239, 0, 7, 270, 70, 8, 628, 220, 220, 220, 329, 1312, 796, 352, 25, 7857, 7, 270, 70, 13, 84, 11, 352, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 28, 198, 220, 220, 220, 220, 220, 220, 220, 334, 136, 225, 796, 569, 19904, 1635, 340, 70, 13, 84, 58, 72, 11, 1058, 11, 352, 11, 352, 60, 198, 220, 220, 220, 220, 220, 220, 220, 424, 796, 2604, 940, 7, 84, 136, 225, 58, 437, 60, 61, 17, 1220, 2160, 7, 84, 136, 225, 13, 61, 17, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 318, 31646, 796, 31029, 7, 2385, 11, 26692, 13, 13500, 8, 198, 220, 220, 220, 220, 220, 220, 220, 611, 318, 31646, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 474, 287, 34197, 7, 270, 70, 13, 84, 11, 513, 828, 479, 287, 34197, 7, 270, 70, 13, 84, 11, 604, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 334, 136, 224, 796, 569, 19904, 1635, 340, 70, 13, 84, 58, 72, 11, 1058, 11, 474, 11, 479, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8782, 13, 4666, 282, 62, 24455, 0, 7, 84, 136, 224, 11, 352, 68, 12, 17, 26, 8106, 796, 1058, 75, 17, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 340, 70, 13, 84, 58, 72, 11, 1058, 11, 474, 11, 479, 60, 764, 28, 26692, 13, 53, 1635, 334, 136, 224, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 886, 628, 220, 220, 220, 220, 220, 220, 220, 410, 136, 225, 796, 340, 70, 13, 84, 58, 72, 11, 886, 127, 115, 17, 11, 352, 11, 1058, 60, 198, 220, 220, 220, 220, 220, 220, 220, 38487, 796, 2604, 940, 7, 85, 136, 225, 58, 437, 60, 61, 17, 1220, 2160, 7, 85, 136, 225, 13, 61, 17, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 318, 31646, 796, 31029, 7, 21370, 11, 26692, 13, 13500, 8, 198, 220, 220, 220, 220, 220, 220, 220, 611, 318, 31646, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 474, 287, 34197, 7, 270, 70, 13, 84, 11, 362, 828, 479, 287, 34197, 7, 270, 70, 13, 84, 11, 513, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 410, 136, 225, 796, 2488, 1177, 340, 70, 13, 84, 58, 72, 11, 474, 11, 479, 11, 1058, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8782, 13, 4666, 282, 62, 24455, 0, 7, 85, 136, 225, 11, 642, 68, 12, 19, 26, 8106, 796, 1058, 75, 17, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 886, 46249, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 28, 84, 136, 225, 796, 569, 19904, 1635, 340, 70, 13, 84, 58, 72, 11, 1058, 11, 352, 11, 352, 60, 198, 220, 220, 220, 220, 220, 220, 220, 410, 136, 225, 796, 340, 70, 13, 84, 58, 72, 11, 886, 127, 115, 17, 11, 352, 11, 1058, 60, 198, 220, 220, 220, 220, 220, 220, 220, 424, 796, 2604, 940, 7, 84, 136, 225, 58, 437, 60, 61, 17, 1220, 2160, 7, 84, 136, 225, 13, 61, 17, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 38487, 796, 2604, 940, 7, 85, 136, 225, 58, 437, 60, 61, 17, 1220, 2160, 7, 85, 136, 225, 13, 61, 17, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 318, 31646, 796, 3509, 7, 39563, 62, 15255, 9250, 7, 2385, 11, 26692, 13, 13500, 828, 6380, 62, 15255, 9250, 7, 21370, 11, 26692, 13, 13500, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 611, 318, 31646, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 264, 796, 352, 25, 7857, 7, 270, 70, 13, 84, 11, 513, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 334, 136, 224, 796, 569, 19904, 1635, 340, 70, 13, 84, 58, 72, 11, 1058, 11, 264, 11, 1058, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 10913, 13, 24455, 62, 11201, 0, 7, 84, 136, 224, 11, 838, 11, 1802, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 10913, 13, 4666, 282, 62, 24455, 0, 7, 84, 136, 224, 11, 657, 13, 23, 68, 12, 17, 11, 352, 68, 12, 21, 26, 8106, 796, 1058, 75, 17, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8782, 13, 4666, 282, 62, 24455, 0, 7, 84, 136, 224, 11, 838, 68, 12, 17, 11, 642, 68, 12, 20, 26, 8106, 796, 1058, 75, 17, 8738, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 10913, 13, 4666, 282, 62, 24455, 0, 7, 84, 136, 224, 11, 642, 68, 12, 17, 11, 642, 68, 12, 20, 26, 8106, 796, 1058, 75, 17, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 10913, 13, 4666, 282, 62, 24455, 0, 7, 84, 136, 224, 11, 642, 68, 12, 17, 11, 642, 68, 12, 20, 26, 8106, 796, 1058, 75, 17, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 340, 70, 13, 84, 58, 72, 11, 1058, 11, 264, 11, 1058, 60, 764, 28, 26692, 13, 53, 1635, 334, 136, 224, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 886, 46249, 628, 220, 220, 220, 220, 220, 220, 220, 334, 136, 225, 796, 569, 19904, 1635, 340, 70, 13, 84, 58, 72, 11, 1058, 11, 352, 11, 1058, 60, 198, 220, 220, 220, 220, 220, 220, 220, 424, 796, 5415, 26933, 84, 136, 225, 58, 437, 11, 474, 60, 61, 17, 1220, 2160, 7, 84, 136, 225, 58, 45299, 474, 4083, 61, 17, 8, 329, 474, 796, 352, 25, 84, 80, 13, 21533, 10, 16, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 38487, 796, 5415, 26933, 84, 136, 225, 58, 73, 11, 886, 60, 61, 17, 1635, 334, 80, 13, 83, 17, 15667, 58, 84, 80, 13, 21533, 11, 334, 80, 13, 21533, 60, 1220, 2160, 7, 84, 136, 225, 58, 73, 11, 1058, 4083, 61, 17, 764, 9, 300, 17, 8, 329, 474, 796, 352, 25, 77, 2777, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 318, 31646, 796, 3509, 7, 39563, 62, 15255, 9250, 7, 6404, 940, 7, 2385, 828, 26692, 13, 13500, 828, 6380, 62, 15255, 9250, 7, 6404, 940, 7, 21370, 828, 26692, 13, 13500, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 611, 318, 31646, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7377, 119, 16, 796, 288, 83, 1635, 357, 2385, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7377, 119, 17, 796, 288, 83, 1635, 357, 21370, 8, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 264, 796, 352, 25, 7857, 7, 270, 70, 13, 84, 11, 513, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 334, 136, 224, 796, 569, 19904, 1635, 340, 70, 13, 84, 58, 72, 11, 1058, 11, 264, 11, 1058, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 10913, 13, 4666, 282, 62, 24455, 0, 7, 84, 136, 224, 11, 7377, 119, 16, 11, 7377, 119, 17, 26, 8106, 796, 1058, 75, 17, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 10913, 13, 4666, 282, 62, 24455, 0, 7, 84, 136, 224, 11, 7377, 119, 16, 11, 7377, 119, 17, 26, 8106, 796, 1058, 75, 17, 8738, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 10913, 13, 4666, 282, 62, 24455, 0, 7, 84, 136, 224, 11, 352, 68, 12, 17, 11, 352, 68, 12, 18, 26, 8106, 796, 1058, 75, 17, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8782, 13, 4666, 282, 62, 24455, 0, 7, 84, 136, 224, 26, 8106, 796, 1058, 75, 28372, 8, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 340, 70, 13, 84, 58, 72, 11, 1058, 11, 264, 11, 1058, 60, 764, 28, 26692, 13, 53, 1635, 334, 136, 224, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 886, 628, 220, 220, 220, 220, 220, 220, 220, 45218, 796, 2488, 1177, 340, 70, 13, 84, 58, 72, 11, 1058, 11, 1058, 11, 352, 60, 198, 220, 220, 220, 220, 220, 220, 220, 3967, 62, 2475, 2676, 7, 22065, 11, 7377, 111, 11, 26692, 13, 24142, 14, 17, 11, 26692, 13, 297, 11, 26692, 13, 14050, 8, 628, 220, 220, 220, 886, 198, 437, 198, 198, 27471, 198, 220, 220, 220, 2124, 796, 1976, 27498, 7, 1198, 297, 1635, 299, 2777, 8, 198, 220, 220, 220, 266, 796, 1976, 27498, 7, 1198, 297, 1635, 299, 2777, 11, 513, 11, 334, 80, 13, 21533, 10, 16, 8, 198, 220, 220, 220, 329, 1312, 796, 352, 25, 1198, 297, 198, 220, 220, 220, 220, 220, 220, 220, 4686, 87, 15, 796, 357, 72, 532, 352, 8, 1635, 299, 2777, 628, 220, 220, 220, 220, 220, 220, 220, 329, 474, 796, 352, 25, 77, 2777, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4686, 87, 796, 4686, 87, 15, 1343, 474, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2124, 58, 312, 87, 60, 796, 26692, 13, 87, 6024, 58, 72, 11, 474, 60, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 266, 58, 312, 87, 11, 1058, 11, 1058, 60, 764, 28, 340, 70, 13, 84, 58, 72, 11, 474, 11, 1058, 11, 1058, 60, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 886, 628, 220, 220, 220, 1540, 796, 1976, 27498, 7, 1198, 297, 9, 77, 2777, 11, 513, 11, 362, 8, 198, 220, 220, 220, 329, 1312, 287, 34197, 7, 34453, 11, 352, 8, 198, 220, 220, 220, 220, 220, 220, 220, 279, 16, 796, 1976, 27498, 7, 18, 11, 334, 80, 13, 21533, 10, 16, 8, 198, 220, 220, 220, 220, 220, 220, 220, 279, 16, 796, 334, 80, 62, 5936, 3760, 62, 19795, 7, 86, 58, 72, 11, 1058, 11, 1058, 4357, 7377, 111, 11, 334, 80, 8, 198, 220, 220, 220, 220, 220, 220, 220, 279, 16, 58, 437, 11, 1058, 60, 764, 28, 37456, 62, 38664, 7495, 7, 79, 16, 58, 437, 11, 1058, 4357, 352, 13, 15, 11, 334, 80, 8, 628, 220, 220, 220, 220, 220, 220, 220, 329, 479, 796, 352, 25, 18, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1540, 58, 72, 11, 479, 11, 352, 60, 796, 1612, 7, 79, 16, 58, 74, 11, 1058, 4357, 334, 80, 13, 404, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1540, 58, 72, 11, 479, 11, 362, 60, 796, 14367, 7, 79, 16, 58, 74, 11, 1058, 4357, 334, 80, 13, 404, 8, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 886, 628, 220, 220, 220, 8301, 16, 796, 7110, 7, 87, 11, 1540, 58, 45299, 352, 11, 352, 4357, 6167, 2625, 33643, 1600, 2124, 18242, 2625, 87, 1600, 331, 18242, 2625, 32604, 4943, 198, 220, 220, 220, 7110, 0, 7, 16564, 16, 11, 2124, 11, 1540, 58, 45299, 362, 11, 352, 4357, 6167, 2625, 52, 4943, 198, 220, 220, 220, 7110, 0, 7, 16564, 16, 11, 2124, 11, 1540, 58, 45299, 513, 11, 352, 4357, 6167, 2625, 51, 4943, 198, 220, 220, 220, 8301, 17, 796, 7110, 7, 87, 11, 1540, 58, 45299, 352, 11, 362, 4357, 6167, 2625, 33643, 1600, 2124, 18242, 2625, 87, 1600, 331, 18242, 2625, 19282, 4943, 198, 220, 220, 220, 7110, 0, 7, 16564, 17, 11, 2124, 11, 1540, 58, 45299, 362, 11, 362, 4357, 6167, 2625, 52, 4943, 198, 220, 220, 220, 7110, 0, 7, 16564, 17, 11, 2124, 11, 1540, 58, 45299, 513, 11, 362, 4357, 6167, 2625, 51, 4943, 198, 220, 220, 220, 7110, 7, 16564, 16, 11, 8301, 17, 8, 198, 437, 198, 198, 29487, 7, 87, 11, 1540, 15, 58, 45299, 352, 11, 362, 4357, 6167, 2625, 2949, 8106, 1600, 2124, 18242, 2625, 87, 1600, 331, 18242, 2625, 33643, 4943, 198, 29487, 0, 7, 87, 11, 1540, 58, 45299, 352, 11, 362, 4357, 6167, 2625, 42552, 425, 406, 31185, 4943, 628, 198, 198, 34453, 15, 796, 2769, 30073, 7, 34453, 8 ]
1.585946
3,828
module ComputationalHomology using LinearAlgebra using Hungarian: hungarian using SmithNormalForm: smith using Distances: Metric, Euclidean, pairwise, colwise, pairwise! using Random: shuffle!, randperm using BoundingSphere: boundingsphere using SparseArrays: SparseMatrixCSC, spzeros, findnz using Combinatorics: combinations import Base: ==, -, +, *, union, keys, values, hash, first, last, isless, show, length, eltype, valtype, getindex, setindex!, size, iterate, push!, append!, in, similar, read, write, vec, complex, iszero, convert, reduce, keytype, copy, map, map!, minimum, maximum, parse, isempty import Base.Iterators: pairs import SparseArrays: sparse import Statistics: mean import LinearAlgebra: diag export AbstractCell, dim, faces, cofaces, volume, AbstractSimplex, indices, vertices, Simplex, Cube, Cell, AbstractChain, Chain, simplify, AbstractComplex, boundary, coboundary, cells, SimplicialComplex, addsimplex!, addsimplices!, CWComplex, BitmapComplex, vietorisrips, witness, cech, čech, AbstractHomology, grouptype, group, Homology, homology, withgenerators, generators, betti, euler, Filtration, filtration, order, simplices, similarity, AbstractPersistenceReduction, StandardReduction, TwistReduction, pairs, reduce!, PersistentHomology, persistenthomology, PersistentCocycleReduction, persistentcohomology, PersistentCocycleReduction, AbstractInterval, birth, death, Interval, AnnotatedInterval, PersistenceDiagram, diagram, Landscape, landscape, mean, PersistentImage, wasserstein, tropic include("abstractchain.jl") include("chains.jl") include("abstractcell.jl") include("simplex.jl") include("cube.jl") include("cwcell.jl") include("complex.jl") include("simplicialcomplex.jl") include("cwcomplex.jl") include("constructions.jl") include("filtration.jl") include("bitmapcomplex.jl") include("homology.jl") include("intervals.jl") include("persistence.jl") include("landscape.jl") include("pimage.jl") include("examples.jl") include("distances.jl") include("iterators.jl") include("tropic.jl") @deprecate intervals(d, ps...) diagram(d, ps...) @deprecate celltype(cplx) eltype(cplx) end # module
[ 21412, 22476, 864, 28718, 1435, 198, 198, 3500, 44800, 2348, 29230, 198, 3500, 27304, 25, 9174, 3699, 198, 3500, 4176, 26447, 8479, 25, 895, 342, 198, 3500, 4307, 1817, 25, 3395, 1173, 11, 48862, 485, 272, 11, 5166, 3083, 11, 951, 3083, 11, 5166, 3083, 0, 198, 3500, 14534, 25, 36273, 28265, 43720, 16321, 198, 3500, 347, 9969, 38882, 25, 5421, 654, 79, 1456, 198, 3500, 1338, 17208, 3163, 20477, 25, 1338, 17208, 46912, 34, 6173, 11, 599, 9107, 418, 11, 1064, 27305, 198, 3500, 955, 8800, 1352, 873, 25, 17790, 198, 198, 11748, 7308, 25, 6624, 11, 532, 11, 1343, 11, 1635, 11, 6441, 11, 8251, 11, 3815, 11, 12234, 11, 717, 11, 938, 11, 318, 1203, 11, 905, 11, 4129, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1288, 4906, 11, 1188, 4906, 11, 651, 9630, 11, 900, 9630, 28265, 2546, 11, 11629, 378, 11, 4574, 28265, 24443, 28265, 287, 11, 2092, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1100, 11, 3551, 11, 43030, 11, 3716, 11, 318, 22570, 11, 10385, 11, 4646, 11, 1994, 4906, 11, 4866, 11, 3975, 11, 3975, 28265, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5288, 11, 5415, 11, 21136, 11, 318, 28920, 198, 11748, 7308, 13, 29993, 2024, 25, 14729, 198, 11748, 1338, 17208, 3163, 20477, 25, 29877, 198, 11748, 14370, 25, 1612, 198, 11748, 44800, 2348, 29230, 25, 2566, 363, 198, 198, 39344, 27741, 28780, 11, 198, 220, 220, 220, 220, 220, 220, 5391, 11, 6698, 11, 763, 32186, 11, 6115, 11, 198, 220, 220, 220, 220, 220, 220, 27741, 8890, 11141, 11, 198, 220, 220, 220, 220, 220, 220, 36525, 11, 9421, 1063, 11, 198, 220, 220, 220, 220, 220, 220, 3184, 11141, 11, 23315, 11, 12440, 11, 628, 220, 220, 220, 220, 220, 220, 27741, 35491, 11, 198, 220, 220, 220, 220, 220, 220, 21853, 11, 30276, 11, 628, 220, 220, 220, 220, 220, 220, 27741, 5377, 11141, 11, 198, 220, 220, 220, 220, 220, 220, 18645, 11, 22843, 633, 560, 11, 4778, 11, 198, 220, 220, 220, 220, 220, 220, 45157, 6652, 5377, 11141, 11, 6673, 320, 11141, 28265, 6673, 23928, 1063, 28265, 198, 220, 220, 220, 220, 220, 220, 24006, 5377, 11141, 11, 4722, 8899, 5377, 11141, 11, 198, 220, 220, 220, 220, 220, 220, 410, 1155, 37279, 380, 862, 11, 4973, 11, 2906, 354, 11, 34754, 235, 3055, 11, 628, 220, 220, 220, 220, 220, 220, 27741, 28718, 1435, 11, 1132, 457, 2981, 11, 1448, 11, 198, 220, 220, 220, 220, 220, 220, 8074, 1435, 11, 3488, 1435, 11, 351, 8612, 2024, 11, 27298, 11, 198, 220, 220, 220, 220, 220, 220, 731, 20259, 11, 304, 18173, 11, 628, 220, 220, 220, 220, 220, 220, 376, 36055, 11, 1226, 83, 1358, 11, 1502, 11, 7106, 1063, 11, 26789, 11, 628, 220, 220, 220, 220, 220, 220, 27741, 30946, 13274, 7738, 8110, 11, 198, 220, 220, 220, 220, 220, 220, 8997, 7738, 8110, 11, 44088, 7738, 8110, 11, 198, 220, 220, 220, 220, 220, 220, 14729, 11, 4646, 28265, 198, 220, 220, 220, 220, 220, 220, 9467, 7609, 28718, 1435, 11, 16218, 26452, 1435, 11, 198, 220, 220, 220, 220, 220, 220, 9467, 7609, 34, 13733, 2375, 7738, 8110, 11, 16218, 1073, 26452, 1435, 11, 9467, 7609, 34, 13733, 2375, 7738, 8110, 11, 628, 220, 220, 220, 220, 220, 220, 27741, 9492, 2100, 11, 4082, 11, 1918, 11, 198, 220, 220, 220, 220, 220, 220, 4225, 2100, 11, 1052, 1662, 515, 9492, 2100, 11, 198, 220, 220, 220, 220, 220, 220, 9467, 13274, 18683, 6713, 11, 16362, 11, 198, 220, 220, 220, 220, 220, 220, 6379, 6794, 11, 10747, 11, 1612, 11, 198, 220, 220, 220, 220, 220, 220, 9467, 7609, 5159, 11, 198, 220, 220, 220, 220, 220, 220, 373, 2655, 5714, 11, 198, 220, 220, 220, 220, 220, 220, 14673, 291, 198, 198, 17256, 7203, 397, 8709, 7983, 13, 20362, 4943, 198, 17256, 7203, 38861, 13, 20362, 4943, 198, 17256, 7203, 397, 8709, 3846, 13, 20362, 4943, 198, 17256, 7203, 14323, 11141, 13, 20362, 4943, 198, 17256, 7203, 40296, 13, 20362, 4943, 198, 17256, 7203, 66, 86, 3846, 13, 20362, 4943, 198, 17256, 7203, 41887, 13, 20362, 4943, 198, 17256, 7203, 14323, 489, 6652, 41887, 13, 20362, 4943, 198, 17256, 7203, 66, 86, 41887, 13, 20362, 4943, 198, 17256, 7203, 41571, 507, 13, 20362, 4943, 198, 17256, 7203, 69, 36055, 13, 20362, 4943, 198, 17256, 7203, 2545, 8899, 41887, 13, 20362, 4943, 198, 17256, 7203, 26452, 1435, 13, 20362, 4943, 198, 17256, 7203, 3849, 12786, 13, 20362, 4943, 198, 17256, 7203, 19276, 13274, 13, 20362, 4943, 198, 17256, 7203, 1044, 6794, 13, 20362, 4943, 198, 17256, 7203, 79, 9060, 13, 20362, 4943, 198, 17256, 7203, 1069, 12629, 13, 20362, 4943, 198, 17256, 7203, 17080, 1817, 13, 20362, 4943, 198, 17256, 7203, 2676, 2024, 13, 20362, 4943, 198, 17256, 7203, 48385, 291, 13, 20362, 4943, 198, 198, 31, 10378, 8344, 378, 20016, 7, 67, 11, 26692, 23029, 16362, 7, 67, 11, 26692, 23029, 198, 31, 10378, 8344, 378, 2685, 4906, 7, 66, 489, 87, 8, 1288, 4906, 7, 66, 489, 87, 8, 198, 198, 437, 1303, 8265, 198 ]
2.712974
871
using Sockets include("header.jl") include("strings.jl") function play_roulette(p :: Player) result = rand(1:36) total_bet = 0 winnings = 0 print_dict(p, "roulette_0") printBalance(p) print_dict(p, "roulette_1") while true print_dict(p, "roulette_2") s = readline(p.socket) lines = split(s) if s == "" continue elseif s == "d" if total_bet > 0 break else print_dict(p, "roulette_3") p.status = reception return end elseif size(lines,1) != 2 print_dict(p, "repeat") continue else bet = tryparse(Int64, lines[1]) if bet == nothing || bet < 0 print_dict(p, "repeat") continue elseif bet > (p.balance - total_bet) print_dict(p, "roulette_4") continue elseif bet == 0 print_dict(p, "roulette_3") p.status = reception return end number = tryparse(Int, lines[2]) if number == nothing if lines[2] == "red" if (result < 19 && result % 2 == 1) || (result > 19 && result % 2 == 0) winnings += bet else winnings -= bet end total_bet += bet continue elseif lines[2] == "black" if (result < 19 && result % 2 == 0) || (result > 19 && result % 2 == 1) winnings += bet else winnings -= bet end total_bet += bet continue elseif lines[2] == "1-12" if result <= 12 winnings += 3 * bet else winnings -= bet end total_bet += bet continue elseif lines[2] == "13-24" if result > 12 && result <= 24 winnings += 3 * bet else winnings -= bet end total_bet += bet continue elseif lines[2] == "25-36" if result > 24 && result <= 36 winnings += 3 * bet else winnings -= bet end total_bet += bet continue else print_dict(p, "repeat") continue end elseif number >= 1 && number <= 36 if number == result winnings += 36 * bet else winnings -= bet end total_bet += bet continue else print_dict(p, "repeat") continue end end end print_dict(p, "roulette_5") write(p.socket, "Congratulations the number is.. $result. Your total winnings are: $winnings\n") p.balance += winnings end
[ 3500, 311, 11603, 198, 17256, 7203, 25677, 13, 20362, 4943, 198, 17256, 7203, 37336, 13, 20362, 4943, 198, 198, 8818, 711, 62, 472, 21348, 7, 79, 7904, 7853, 8, 198, 220, 220, 220, 1255, 796, 43720, 7, 16, 25, 2623, 8, 198, 220, 220, 220, 2472, 62, 11181, 796, 657, 198, 220, 220, 220, 1592, 23400, 796, 657, 198, 220, 220, 220, 3601, 62, 11600, 7, 79, 11, 366, 472, 21348, 62, 15, 4943, 198, 220, 220, 220, 3601, 45866, 7, 79, 8, 198, 220, 220, 220, 3601, 62, 11600, 7, 79, 11, 366, 472, 21348, 62, 16, 4943, 198, 220, 220, 220, 981, 2081, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 62, 11600, 7, 79, 11, 366, 472, 21348, 62, 17, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 264, 796, 1100, 1370, 7, 79, 13, 44971, 8, 198, 220, 220, 220, 220, 220, 220, 220, 3951, 796, 6626, 7, 82, 8, 198, 220, 220, 220, 220, 220, 220, 220, 611, 264, 6624, 13538, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2555, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 264, 6624, 366, 67, 1, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 2472, 62, 11181, 1875, 657, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2270, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 62, 11600, 7, 79, 11, 366, 472, 21348, 62, 18, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 279, 13, 13376, 796, 16307, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 2546, 7, 6615, 11, 16, 8, 14512, 362, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 62, 11600, 7, 79, 11, 366, 44754, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2555, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 731, 796, 1949, 29572, 7, 5317, 2414, 11, 3951, 58, 16, 12962, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 731, 6624, 2147, 8614, 731, 1279, 657, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 62, 11600, 7, 79, 11, 366, 44754, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2555, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 731, 1875, 357, 79, 13, 20427, 532, 2472, 62, 11181, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 62, 11600, 7, 79, 11, 366, 472, 21348, 62, 19, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2555, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 731, 6624, 657, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 62, 11600, 7, 79, 11, 366, 472, 21348, 62, 18, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 279, 13, 13376, 796, 16307, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1271, 796, 1949, 29572, 7, 5317, 11, 3951, 58, 17, 12962, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1271, 6624, 2147, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 3951, 58, 17, 60, 6624, 366, 445, 1, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 357, 20274, 1279, 678, 11405, 1255, 4064, 362, 6624, 352, 8, 8614, 357, 20274, 1875, 678, 11405, 1255, 4064, 362, 6624, 657, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1592, 23400, 15853, 731, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1592, 23400, 48185, 731, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2472, 62, 11181, 15853, 731, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2555, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 3951, 58, 17, 60, 6624, 366, 13424, 1, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 357, 20274, 1279, 678, 11405, 1255, 4064, 362, 6624, 657, 8, 8614, 357, 20274, 1875, 678, 11405, 1255, 4064, 362, 6624, 352, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1592, 23400, 15853, 731, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1592, 23400, 48185, 731, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2472, 62, 11181, 15853, 731, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2555, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 3951, 58, 17, 60, 6624, 366, 16, 12, 1065, 1, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1255, 19841, 1105, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1592, 23400, 15853, 513, 1635, 731, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1592, 23400, 48185, 731, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2472, 62, 11181, 15853, 731, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2555, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 3951, 58, 17, 60, 6624, 366, 1485, 12, 1731, 1, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1255, 1875, 1105, 11405, 1255, 19841, 1987, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1592, 23400, 15853, 513, 1635, 731, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1592, 23400, 48185, 731, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2472, 62, 11181, 15853, 731, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2555, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 3951, 58, 17, 60, 6624, 366, 1495, 12, 2623, 1, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1255, 1875, 1987, 11405, 1255, 19841, 4570, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1592, 23400, 15853, 513, 1635, 731, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1592, 23400, 48185, 731, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2472, 62, 11181, 15853, 731, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2555, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 62, 11600, 7, 79, 11, 366, 44754, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2555, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 361, 1271, 18189, 352, 11405, 1271, 19841, 4570, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1271, 6624, 1255, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1592, 23400, 15853, 4570, 1635, 731, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1592, 23400, 48185, 731, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2472, 62, 11181, 15853, 731, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2555, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 62, 11600, 7, 79, 11, 366, 44754, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2555, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 628, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 886, 628, 220, 220, 220, 3601, 62, 11600, 7, 79, 11, 366, 472, 21348, 62, 20, 4943, 198, 220, 220, 220, 3551, 7, 79, 13, 44971, 11, 366, 45048, 262, 1271, 318, 492, 720, 20274, 13, 3406, 2472, 1592, 23400, 389, 25, 720, 86, 3732, 654, 59, 77, 4943, 628, 220, 220, 220, 279, 13, 20427, 15853, 1592, 23400, 198, 437, 198 ]
1.610024
2,095
using ThreeBodyDecay using Plots using Zygote tbs = let m1 = 0.938, m2 = 0.49367, m3 = 0.13957, m0 = 2.46867 ThreeBodySystem(m1,m2,m3,m0) end # # let # σ1v = LinRange(tbs.mthsq[1], tbs.sthsq[1],300) # σ3m = [σ3of1(σ,-1.0,tbs) for σ in σ1v] # σ3p = [σ3of1(σ, 1.0,tbs) for σ in σ1v] # plot(σ1v, [σ3m σ3p], lab="") # end # # let # σ3v, σ1v = flatDalitzPlotSample31(tbs; Nev=10000) # histogram2d(σ1v, σ3v, lab="", bins=100) # end const Ks892 = BreitWigner(0.89176, 0.05) const Λ1520 = BreitWigner(1.5195, 0.0156) const Δ1232 = BreitWigner(1.232, 0.112) model = [(1,Ks892), (3,Λ1520), (2,Δ1232)] function scalar_amplitude(σs, model, cs) mod = [1.1,2.2im, 3.3] # A = 0.0im for (me,c) in zip(model,cs) (ch,ξ) = me # for (m,c) in zip(mod,cs) # A += c * amp(σs[ch],ξ) A += c * mod[ch] end return A end const cs0 = [1.2im, 2.1, 2.3+1im] let σ1 = 1.0, σ3=4.0 scalar_amplitude([σ1,gσ2(σ3,σ1,tbs),σ3], model, cs0) end scalar_amplitude_squared(σs, model, cs) = abs2(scalar_amplitude(σs, model, cs)) # @time let # σ3v, σ1v = flatDalitzPlotSample31(tbs; Nev=100000) # weights = [scalar_amplitude_squared([σ1,gσ2(σ3,σ1,tbs),σ3], model, cs0) for (σ3, σ1) in zip(σ3v, σ1v)] # histogram2d(σ1v, σ3v, lab="", bins=100, weights=weights) # end # getbinned2dDensity(g, xlim, ylim, Nrows, Ncols) diff_through_pars(cs) = let σ1 = 1.0, σ3=4.0, σs = [σ1,gσ2(σ3,σ1,tbs),σ3] return gradient(x->scalar_amplitude_squared(σs, model, x), cs) end diff_through_pars([1.1im,1.1,1.1]) let end # function amp_b2bzz(two_λ,two_Λ,σs,CS,tbs,Cs) # σ2 = gσ2(σ3,σ1,tbs) # # Wigner rotations # D1 = [two_λ==two_λp ? 1.0 : 0.0 for two_λp=-1:2:1] # D2 = [((two_λp-two_λ) % 4 == 2 ? -1 : 1) * # wignerd_doublearg(1,two_λp,two_λ,cosζ12_for1(σ1,σ2,tbs)) # for two_λp=-1:2:1] # D3 = [wignerd_doublearg(1,two_λp,two_λ,cosζ31_for1(σ3,σ1,tbs)) # for two_λp=-1:2:1] # # # σs = (σ1,σ2,σ3) # Ds = (D1,D2,D3) # # # val = zero(Cs[1][1,1]+0.0im) # for (cs,W) in zip(CS, Cs) # coupling scheme and couplings # (k,ξ,chains) = cs # length(chains) == 0 && continue # decay_amp = zero(Cs[1][1,1]+0.0im) # for two_τ in -two_j(chains[1]):2:two_j(chains[1]), two_λp = -1:2:1 # Wc = [v1+v2*1im for (v1,v2) in zip(W[:,1],W[:,1])] # decay_amp += RkΛsτ(k,two_λp,two_Λ,two_τ,chains, Wc) * # ZkΛsτ(k,two_λp,two_Λ,two_j(chains[1]),two_τ,σ3,σ1,tbs) * # Ds[k][div(two_λp+3,2)] # end # val += decay_amp * amp(σs[k],ξ) # end # return val; # end
[ 3500, 7683, 25842, 10707, 323, 198, 3500, 1345, 1747, 198, 3500, 1168, 35641, 1258, 628, 198, 83, 1443, 796, 1309, 285, 16, 796, 657, 13, 24, 2548, 11, 285, 17, 796, 657, 13, 2920, 27824, 11, 285, 18, 796, 657, 13, 20219, 3553, 11, 285, 15, 796, 362, 13, 38472, 3134, 198, 220, 220, 220, 7683, 25842, 11964, 7, 76, 16, 11, 76, 17, 11, 76, 18, 11, 76, 15, 8, 198, 437, 198, 198, 2, 198, 2, 1309, 198, 2, 220, 220, 220, 220, 18074, 225, 16, 85, 796, 5164, 17257, 7, 83, 1443, 13, 76, 9998, 80, 58, 16, 4357, 256, 1443, 13, 301, 11994, 80, 58, 16, 4357, 6200, 8, 198, 2, 220, 220, 220, 220, 18074, 225, 18, 76, 796, 685, 38392, 18, 1659, 16, 7, 38392, 12095, 16, 13, 15, 11, 83, 1443, 8, 329, 18074, 225, 287, 18074, 225, 16, 85, 60, 198, 2, 220, 220, 220, 220, 18074, 225, 18, 79, 796, 685, 38392, 18, 1659, 16, 7, 38392, 11, 352, 13, 15, 11, 83, 1443, 8, 329, 18074, 225, 287, 18074, 225, 16, 85, 60, 198, 2, 220, 220, 220, 220, 7110, 7, 38392, 16, 85, 11, 685, 38392, 18, 76, 18074, 225, 18, 79, 4357, 2248, 2625, 4943, 198, 2, 886, 198, 2, 198, 2, 1309, 198, 2, 220, 220, 220, 220, 18074, 225, 18, 85, 11, 18074, 225, 16, 85, 796, 6228, 35, 282, 4224, 43328, 36674, 3132, 7, 83, 1443, 26, 9873, 28, 49388, 8, 198, 2, 220, 220, 220, 220, 1554, 21857, 17, 67, 7, 38392, 16, 85, 11, 18074, 225, 18, 85, 11, 2248, 2625, 1600, 41701, 28, 3064, 8, 198, 2, 886, 198, 198, 9979, 509, 82, 4531, 17, 220, 796, 3719, 270, 54, 570, 263, 7, 15, 13, 4531, 24096, 11, 657, 13, 2713, 8, 198, 9979, 7377, 249, 1314, 1238, 220, 796, 3719, 270, 54, 570, 263, 7, 16, 13, 20, 22186, 11, 220, 657, 13, 486, 3980, 8, 198, 9979, 37455, 1065, 2624, 220, 796, 3719, 270, 54, 570, 263, 7, 16, 13, 24339, 11, 220, 220, 657, 13, 14686, 8, 198, 198, 19849, 796, 47527, 16, 11, 42, 82, 4531, 17, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 357, 18, 11, 138, 249, 1314, 1238, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 357, 17, 11, 138, 242, 1065, 2624, 15437, 198, 198, 8818, 16578, 283, 62, 321, 489, 3984, 7, 38392, 82, 11, 2746, 11, 50115, 8, 198, 220, 220, 220, 953, 796, 685, 16, 13, 16, 11, 17, 13, 17, 320, 11, 513, 13, 18, 60, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 317, 796, 657, 13, 15, 320, 198, 220, 220, 220, 329, 357, 1326, 11, 66, 8, 287, 19974, 7, 19849, 11, 6359, 8, 198, 220, 220, 220, 220, 220, 220, 220, 357, 354, 11, 138, 122, 8, 796, 502, 198, 220, 220, 220, 1303, 329, 357, 76, 11, 66, 8, 287, 19974, 7, 4666, 11, 6359, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 317, 15853, 269, 1635, 20766, 7, 38392, 82, 58, 354, 4357, 138, 122, 8, 198, 220, 220, 220, 220, 220, 220, 220, 317, 15853, 269, 1635, 953, 58, 354, 60, 198, 220, 220, 220, 886, 198, 220, 220, 220, 1441, 317, 198, 437, 198, 198, 9979, 50115, 15, 796, 685, 16, 13, 17, 320, 11, 362, 13, 16, 11, 362, 13, 18, 10, 16, 320, 60, 198, 198, 1616, 18074, 225, 16, 796, 352, 13, 15, 11, 18074, 225, 18, 28, 19, 13, 15, 198, 220, 220, 220, 16578, 283, 62, 321, 489, 3984, 26933, 38392, 16, 11, 70, 38392, 17, 7, 38392, 18, 11, 38392, 16, 11, 83, 1443, 828, 38392, 18, 4357, 2746, 11, 50115, 15, 8, 198, 437, 198, 198, 1416, 282, 283, 62, 321, 489, 3984, 62, 16485, 1144, 7, 38392, 82, 11, 2746, 11, 50115, 8, 796, 2352, 17, 7, 1416, 282, 283, 62, 321, 489, 3984, 7, 38392, 82, 11, 2746, 11, 50115, 4008, 198, 198, 2, 2488, 2435, 1309, 198, 2, 220, 220, 220, 220, 18074, 225, 18, 85, 11, 18074, 225, 16, 85, 796, 6228, 35, 282, 4224, 43328, 36674, 3132, 7, 83, 1443, 26, 9873, 28, 3064, 830, 8, 198, 2, 220, 220, 220, 220, 19590, 796, 685, 1416, 282, 283, 62, 321, 489, 3984, 62, 16485, 1144, 26933, 38392, 16, 11, 70, 38392, 17, 7, 38392, 18, 11, 38392, 16, 11, 83, 1443, 828, 38392, 18, 4357, 2746, 11, 50115, 15, 8, 329, 357, 38392, 18, 11, 18074, 225, 16, 8, 287, 19974, 7, 38392, 18, 85, 11, 18074, 225, 16, 85, 15437, 198, 2, 220, 220, 220, 220, 1554, 21857, 17, 67, 7, 38392, 16, 85, 11, 18074, 225, 18, 85, 11, 2248, 2625, 1600, 41701, 28, 3064, 11, 19590, 28, 43775, 8, 198, 2, 886, 198, 198, 2, 651, 8800, 2817, 17, 67, 35, 6377, 7, 70, 11, 2124, 2475, 11, 331, 2475, 11, 220, 399, 8516, 11, 399, 4033, 82, 8, 198, 198, 26069, 62, 9579, 62, 79, 945, 7, 6359, 8, 796, 1309, 18074, 225, 16, 796, 352, 13, 15, 11, 18074, 225, 18, 28, 19, 13, 15, 11, 198, 220, 220, 220, 18074, 225, 82, 796, 685, 38392, 16, 11, 70, 38392, 17, 7, 38392, 18, 11, 38392, 16, 11, 83, 1443, 828, 38392, 18, 60, 198, 220, 220, 220, 1441, 31312, 7, 87, 3784, 1416, 282, 283, 62, 321, 489, 3984, 62, 16485, 1144, 7, 38392, 82, 11, 2746, 11, 2124, 828, 50115, 8, 198, 437, 198, 198, 26069, 62, 9579, 62, 79, 945, 26933, 16, 13, 16, 320, 11, 16, 13, 16, 11, 16, 13, 16, 12962, 198, 198, 1616, 198, 437, 628, 198, 2, 2163, 20766, 62, 65, 17, 65, 3019, 7, 11545, 62, 39377, 11, 11545, 62, 138, 249, 11, 38392, 82, 11, 7902, 11, 83, 1443, 11, 32274, 8, 198, 2, 220, 220, 220, 220, 18074, 225, 17, 796, 308, 38392, 17, 7, 38392, 18, 11, 38392, 16, 11, 83, 1443, 8, 198, 2, 220, 220, 220, 220, 1303, 370, 570, 263, 5724, 602, 198, 2, 220, 220, 220, 220, 360, 16, 796, 685, 11545, 62, 39377, 855, 11545, 62, 39377, 79, 5633, 352, 13, 15, 1058, 657, 13, 15, 329, 734, 62, 39377, 79, 10779, 16, 25, 17, 25, 16, 60, 198, 2, 220, 220, 220, 220, 360, 17, 796, 685, 19510, 11545, 62, 39377, 79, 12, 11545, 62, 39377, 8, 4064, 604, 6624, 362, 5633, 532, 16, 1058, 352, 8, 1635, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 266, 570, 45744, 62, 23352, 853, 7, 16, 11, 11545, 62, 39377, 79, 11, 11545, 62, 39377, 11, 6966, 138, 114, 1065, 62, 1640, 16, 7, 38392, 16, 11, 38392, 17, 11, 83, 1443, 4008, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 734, 62, 39377, 79, 10779, 16, 25, 17, 25, 16, 60, 198, 2, 220, 220, 220, 220, 360, 18, 796, 685, 86, 570, 45744, 62, 23352, 853, 7, 16, 11, 11545, 62, 39377, 79, 11, 11545, 62, 39377, 11, 6966, 138, 114, 3132, 62, 1640, 16, 7, 38392, 18, 11, 38392, 16, 11, 83, 1443, 4008, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 734, 62, 39377, 79, 10779, 16, 25, 17, 25, 16, 60, 198, 2, 220, 220, 220, 220, 1303, 198, 2, 220, 220, 220, 220, 18074, 225, 82, 796, 357, 38392, 16, 11, 38392, 17, 11, 38392, 18, 8, 198, 2, 220, 220, 220, 220, 360, 82, 796, 357, 35, 16, 11, 35, 17, 11, 35, 18, 8, 198, 2, 220, 220, 220, 220, 1303, 198, 2, 220, 220, 220, 220, 1188, 796, 6632, 7, 32274, 58, 16, 7131, 16, 11, 16, 48688, 15, 13, 15, 320, 8, 198, 2, 220, 220, 220, 220, 329, 357, 6359, 11, 54, 8, 287, 19974, 7, 7902, 11, 327, 82, 8, 1303, 40204, 7791, 290, 2284, 47093, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 357, 74, 11, 138, 122, 11, 38861, 8, 796, 50115, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 4129, 7, 38861, 8, 6624, 657, 11405, 2555, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 22119, 62, 696, 796, 6632, 7, 32274, 58, 16, 7131, 16, 11, 16, 48688, 15, 13, 15, 320, 8, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 329, 734, 62, 32830, 287, 532, 11545, 62, 73, 7, 38861, 58, 16, 60, 2599, 17, 25, 11545, 62, 73, 7, 38861, 58, 16, 46570, 734, 62, 39377, 79, 796, 532, 16, 25, 17, 25, 16, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 370, 66, 796, 685, 85, 16, 10, 85, 17, 9, 16, 320, 329, 357, 85, 16, 11, 85, 17, 8, 287, 19974, 7, 54, 58, 45299, 16, 4357, 54, 58, 45299, 16, 12962, 60, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 22119, 62, 696, 15853, 371, 74, 138, 249, 82, 32830, 7, 74, 11, 11545, 62, 39377, 79, 11, 11545, 62, 138, 249, 11, 11545, 62, 32830, 11, 38861, 11, 370, 66, 8, 1635, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1168, 74, 138, 249, 82, 32830, 7, 74, 11, 11545, 62, 39377, 79, 11, 11545, 62, 138, 249, 11, 11545, 62, 73, 7, 38861, 58, 16, 46570, 11545, 62, 32830, 11, 38392, 18, 11, 38392, 16, 11, 83, 1443, 8, 1635, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 360, 82, 58, 74, 7131, 7146, 7, 11545, 62, 39377, 79, 10, 18, 11, 17, 15437, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 886, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 1188, 15853, 22119, 62, 696, 1635, 20766, 7, 38392, 82, 58, 74, 4357, 138, 122, 8, 198, 2, 220, 220, 220, 220, 886, 198, 2, 220, 220, 220, 220, 1441, 1188, 26, 198, 2, 886, 198 ]
1.600355
1,689
<reponame>Alchemist-yao/Julia4Derivatives using Random,StatsBase,Distributions,Polynomials Random.seed!(150000) #LSM原始算法,针对美式PUT function LSM_PRIMAL(S0::Float64,K::Float64,T::Float64,r::Float64,σ::Float64,I::Int,M::Int) """ # Arguments - `S0`: 初始标的值. - `K`: 行权值 - `T`: 到期时间,年为单位 - `r`: 无风险利率 - `σ`: 波动率 - `I`: 原始算法中路径数 - `M`: 时间步数 """ dt=T/M df=exp(-r*dt) p1=(r-0.5*(σ^2))*dt p2=rand(Normal(0,1),M+1,I) p3=p1 .+σ*√(dt)*p2 p4=cumsum(p3,dims=1) S=S0*(p4.|>exp) S[1,:]=repeat([S0],I) h=map(x->max(K-x,0),S) V=copy(h[end,:]) @simd for t=M:-1:1 rg=polyfit(S[t,:],V*df,5) C=map(x->polyval(rg,x),S[t,:]) res=h[t,:].>C for i=1:I if res[i]==true V[i]=h[t,i] else V[i]=V[i]*df end end end v0=df*sum(V)/I end #LSM对偶算法 function LSM_DUAL(S0::Float64,K::Float64,T::Float64,r::Float64,σ::Float64,J::Int,I1::Int,I2::Int,M::Int,reg::Int) """ # Arguments - `S0`: 初始::Int标的值::Int. ::Int- ::Int`K`: 行权值 - `T`: 到期时间,年为单位 - `r`: 无风险利率 - `σ`: 波动率 - `J`: 对偶算法中子循环模拟路径 - `I1`: 原始算法中路径数 - `I2`: 对偶算法中路径数 - `M`: 时间步数 - `reg`: 多项是回归阶数 """ dt=T/M df=exp(-r*dt) #路径I1,产生回归系数 S1=genrate_path(S0,r,σ,dt,M,I1) h1=map(x->max(K-x,0),S1) V1=map(x->max(K-x,0),S1) #路径I1,产生回归系数 rg0=[] a=Poly(0) push!(rg0,a) @simd for t=M:-1:2 rgr=polyfit(S1[t,:],V1[t+1,:]*df,5) push!(rg0,rgr) end push!(rg0,a) rg=reverse(rg0) #路径I2,对偶算法 Q=zeros(M+1,I2) U=zeros(M+1,I2) S=genrate_path(S0,r,σ,dt,M,I2) h=map(x->max(K-x,0),S) V=map(x->max(K-x,0),S) @simd for t=2:M+1 for i=1:I2 tmp=polyval(rg[t],S[t,i]) Vt=max(h[t,i],tmp) St=generate_nest_mc(r,σ,dt,S[t-1,i],J) Ct=map(x->polyval(rg[t],x),St) ht=map(x->max(K-x),St) res=ht.>Ct Vtj=zeros(J) for k=1:length(res) if res[k]==true Vtj[k]=ht[k] else Vtj[k]=Ct[k] end end sum_VT=sum(Vtj)/length(St) Q[t,i]=Q[t-1,i]/df+(Vt-sum_VT) U[t,i]=max(U[t-1,i]/df,(h[t,i]-Q[t,i])) if t==M+1 U[t,i]=max(U[t-1,i]/df,mean(ht)-Q[t,i]) end end end k=df^M U0=sum(U[M,:])/I2*(df^M) end #产生标的仿真路径-单路径 function generate_nest_mc(r::Float64,σ::Float64,dt::Float64,st::Float64,J::Int) p1=(r-0.5*(σ^2))*dt p2=rand(Normal(0,1),J) p3=p1 .+σ*√(dt)*p2 S=st*(p3.|>exp) return S end #产生标的仿真路径-多路径 function genrate_path(S0::Float64,r::Float64,σ::Float64,dt::Float64,M::Int,I::Int) p1=(r-0.5*(σ^2))*dt S=zeros(M+1,I) S[1,:]=map(x->x=S0,S[1,:]) @simd for t=2:M+1 p2=rand(Normal(0,1),I) p3=p1 .+σ*√(dt)*p2 S[t,:]=S[t-1,:].*(p3.|>exp) end return S end S0=36.0 K=40.0 T=1.0 r=0.06 σ=0.2 I1=16384 I2=1024 M=10 J=50 reg=5 res=LSM_DUAL(S0,K,T,r,σ,J,I1,I2,M,reg) println(res)
[ 27, 7856, 261, 480, 29, 2348, 28899, 12, 3972, 78, 14, 16980, 544, 19, 28532, 452, 2929, 198, 3500, 14534, 11, 29668, 14881, 11, 20344, 2455, 507, 11, 34220, 26601, 8231, 201, 198, 29531, 13, 28826, 0, 7, 1314, 2388, 8, 201, 198, 201, 198, 2, 6561, 44, 43889, 253, 34650, 233, 163, 106, 245, 37345, 243, 171, 120, 234, 165, 240, 230, 43380, 117, 163, 122, 236, 28156, 237, 30076, 201, 198, 8818, 406, 12310, 62, 4805, 3955, 1847, 7, 50, 15, 3712, 43879, 2414, 11, 42, 3712, 43879, 2414, 11, 51, 3712, 43879, 2414, 11, 81, 3712, 43879, 2414, 11, 38392, 3712, 43879, 2414, 11, 40, 3712, 5317, 11, 44, 3712, 5317, 8, 201, 198, 220, 220, 220, 37227, 201, 198, 201, 198, 220, 220, 220, 1303, 20559, 2886, 201, 198, 220, 220, 220, 532, 4600, 50, 15, 63, 25, 10263, 230, 251, 34650, 233, 43718, 229, 21410, 161, 222, 120, 13, 201, 198, 220, 220, 220, 532, 4600, 42, 63, 25, 5525, 94, 234, 30266, 225, 161, 222, 120, 201, 198, 220, 220, 220, 532, 4600, 51, 63, 25, 10263, 230, 108, 17312, 253, 33768, 114, 29785, 112, 171, 120, 234, 33176, 112, 10310, 118, 39355, 243, 19526, 235, 201, 198, 220, 220, 220, 532, 4600, 81, 63, 25, 10545, 245, 254, 45617, 236, 165, 247, 102, 26344, 102, 163, 236, 229, 201, 198, 220, 220, 220, 532, 4600, 38392, 63, 25, 10545, 111, 95, 27950, 101, 163, 236, 229, 201, 198, 220, 220, 220, 532, 4600, 40, 63, 25, 10263, 236, 253, 34650, 233, 163, 106, 245, 37345, 243, 40792, 164, 115, 107, 36181, 226, 46763, 108, 201, 198, 220, 220, 220, 532, 4600, 44, 63, 25, 10545, 245, 114, 29785, 112, 29826, 98, 46763, 108, 201, 198, 201, 198, 220, 220, 220, 37227, 201, 198, 201, 198, 220, 220, 220, 288, 83, 28, 51, 14, 44, 201, 198, 220, 220, 220, 47764, 28, 11201, 32590, 81, 9, 28664, 8, 201, 198, 201, 198, 201, 198, 220, 220, 220, 279, 16, 16193, 81, 12, 15, 13, 20, 9, 7, 38392, 61, 17, 4008, 9, 28664, 201, 198, 220, 220, 220, 279, 17, 28, 25192, 7, 26447, 7, 15, 11, 16, 828, 44, 10, 16, 11, 40, 8, 201, 198, 220, 220, 220, 279, 18, 28, 79, 16, 764, 10, 38392, 9, 24861, 248, 7, 28664, 27493, 79, 17, 201, 198, 220, 220, 220, 279, 19, 28, 66, 5700, 388, 7, 79, 18, 11, 67, 12078, 28, 16, 8, 201, 198, 201, 198, 220, 220, 220, 311, 28, 50, 15, 9, 7, 79, 19, 13, 91, 29, 11201, 8, 201, 198, 220, 220, 220, 311, 58, 16, 11, 25, 22241, 44754, 26933, 50, 15, 4357, 40, 8, 201, 198, 220, 220, 220, 289, 28, 8899, 7, 87, 3784, 9806, 7, 42, 12, 87, 11, 15, 828, 50, 8, 201, 198, 201, 198, 220, 220, 220, 569, 28, 30073, 7, 71, 58, 437, 11, 25, 12962, 201, 198, 201, 198, 220, 220, 220, 2488, 14323, 67, 329, 256, 28, 44, 21912, 16, 25, 16, 201, 198, 220, 220, 220, 220, 220, 220, 220, 48670, 28, 35428, 11147, 7, 50, 58, 83, 11, 25, 4357, 53, 9, 7568, 11, 20, 8, 201, 198, 220, 220, 220, 220, 220, 220, 220, 327, 28, 8899, 7, 87, 3784, 35428, 2100, 7, 41345, 11, 87, 828, 50, 58, 83, 11, 25, 12962, 201, 198, 220, 220, 220, 220, 220, 220, 220, 581, 28, 71, 58, 83, 11, 25, 4083, 29, 34, 201, 198, 220, 220, 220, 220, 220, 220, 220, 329, 1312, 28, 16, 25, 40, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 581, 58, 72, 60, 855, 7942, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 569, 58, 72, 22241, 71, 58, 83, 11, 72, 60, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 569, 58, 72, 22241, 53, 58, 72, 60, 9, 7568, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 201, 198, 220, 220, 220, 220, 220, 220, 220, 886, 201, 198, 220, 220, 220, 886, 201, 198, 201, 198, 220, 220, 220, 410, 15, 28, 7568, 9, 16345, 7, 53, 20679, 40, 201, 198, 201, 198, 437, 201, 198, 201, 198, 201, 198, 2, 6561, 44, 43380, 117, 161, 223, 114, 163, 106, 245, 37345, 243, 201, 198, 8818, 406, 12310, 62, 35, 25620, 7, 50, 15, 3712, 43879, 2414, 11, 42, 3712, 43879, 2414, 11, 51, 3712, 43879, 2414, 11, 81, 3712, 43879, 2414, 11, 38392, 3712, 43879, 2414, 11, 41, 3712, 5317, 11, 40, 16, 3712, 5317, 11, 40, 17, 3712, 5317, 11, 44, 3712, 5317, 11, 2301, 3712, 5317, 8, 201, 198, 220, 220, 220, 37227, 201, 198, 201, 198, 220, 220, 220, 1303, 20559, 2886, 201, 198, 220, 220, 220, 532, 4600, 50, 15, 63, 25, 10263, 230, 251, 34650, 233, 3712, 5317, 43718, 229, 21410, 161, 222, 120, 3712, 5317, 13, 201, 198, 220, 220, 220, 7904, 5317, 12, 7904, 5317, 63, 42, 63, 25, 5525, 94, 234, 30266, 225, 161, 222, 120, 201, 198, 220, 220, 220, 532, 4600, 51, 63, 25, 10263, 230, 108, 17312, 253, 33768, 114, 29785, 112, 171, 120, 234, 33176, 112, 10310, 118, 39355, 243, 19526, 235, 201, 198, 220, 220, 220, 532, 4600, 81, 63, 25, 10545, 245, 254, 45617, 236, 165, 247, 102, 26344, 102, 163, 236, 229, 201, 198, 220, 220, 220, 532, 4600, 38392, 63, 25, 10545, 111, 95, 27950, 101, 163, 236, 229, 201, 198, 220, 220, 220, 532, 4600, 41, 63, 25, 10263, 107, 117, 161, 223, 114, 163, 106, 245, 37345, 243, 40792, 36310, 36181, 103, 163, 236, 107, 162, 101, 94, 162, 233, 253, 164, 115, 107, 36181, 226, 201, 198, 220, 220, 220, 532, 4600, 40, 16, 63, 25, 10263, 236, 253, 34650, 233, 163, 106, 245, 37345, 243, 40792, 164, 115, 107, 36181, 226, 46763, 108, 201, 198, 220, 220, 220, 532, 4600, 40, 17, 63, 25, 10263, 107, 117, 161, 223, 114, 163, 106, 245, 37345, 243, 40792, 164, 115, 107, 36181, 226, 46763, 108, 201, 198, 220, 220, 220, 532, 4600, 44, 63, 25, 10545, 245, 114, 29785, 112, 29826, 98, 46763, 108, 201, 198, 220, 220, 220, 532, 4600, 2301, 63, 25, 36469, 21253, 94, 117, 42468, 32368, 252, 37605, 240, 165, 246, 35050, 243, 108, 201, 198, 201, 198, 220, 220, 220, 37227, 201, 198, 220, 220, 220, 288, 83, 28, 51, 14, 44, 201, 198, 220, 220, 220, 47764, 28, 11201, 32590, 81, 9, 28664, 8, 201, 198, 201, 198, 220, 220, 220, 1303, 164, 115, 107, 36181, 226, 40, 16, 11, 12859, 100, 37955, 32368, 252, 37605, 240, 163, 111, 119, 46763, 108, 201, 198, 220, 220, 220, 311, 16, 28, 5235, 4873, 62, 6978, 7, 50, 15, 11, 81, 11, 38392, 11, 28664, 11, 44, 11, 40, 16, 8, 201, 198, 220, 220, 220, 289, 16, 28, 8899, 7, 87, 3784, 9806, 7, 42, 12, 87, 11, 15, 828, 50, 16, 8, 201, 198, 220, 220, 220, 569, 16, 28, 8899, 7, 87, 3784, 9806, 7, 42, 12, 87, 11, 15, 828, 50, 16, 8, 201, 198, 201, 198, 220, 220, 220, 1303, 164, 115, 107, 36181, 226, 40, 16, 11, 12859, 100, 37955, 32368, 252, 37605, 240, 163, 111, 119, 46763, 108, 201, 198, 220, 220, 220, 48670, 15, 28, 21737, 201, 198, 220, 220, 220, 257, 28, 34220, 7, 15, 8, 201, 198, 220, 220, 220, 4574, 0, 7, 41345, 15, 11, 64, 8, 201, 198, 220, 220, 220, 2488, 14323, 67, 329, 256, 28, 44, 21912, 16, 25, 17, 201, 198, 220, 220, 220, 220, 220, 220, 220, 374, 2164, 28, 35428, 11147, 7, 50, 16, 58, 83, 11, 25, 4357, 53, 16, 58, 83, 10, 16, 11, 47715, 9, 7568, 11, 20, 8, 201, 198, 220, 220, 220, 220, 220, 220, 220, 4574, 0, 7, 41345, 15, 11, 81, 2164, 8, 201, 198, 220, 220, 220, 886, 201, 198, 220, 220, 220, 4574, 0, 7, 41345, 15, 11, 64, 8, 201, 198, 220, 220, 220, 48670, 28, 50188, 7, 41345, 15, 8, 201, 198, 201, 198, 220, 220, 220, 1303, 164, 115, 107, 36181, 226, 40, 17, 171, 120, 234, 43380, 117, 161, 223, 114, 163, 106, 245, 37345, 243, 201, 198, 220, 220, 220, 1195, 28, 9107, 418, 7, 44, 10, 16, 11, 40, 17, 8, 201, 198, 220, 220, 220, 471, 28, 9107, 418, 7, 44, 10, 16, 11, 40, 17, 8, 201, 198, 220, 220, 220, 311, 28, 5235, 4873, 62, 6978, 7, 50, 15, 11, 81, 11, 38392, 11, 28664, 11, 44, 11, 40, 17, 8, 201, 198, 220, 220, 220, 289, 28, 8899, 7, 87, 3784, 9806, 7, 42, 12, 87, 11, 15, 828, 50, 8, 201, 198, 220, 220, 220, 569, 28, 8899, 7, 87, 3784, 9806, 7, 42, 12, 87, 11, 15, 828, 50, 8, 201, 198, 201, 198, 201, 198, 220, 220, 220, 2488, 14323, 67, 329, 256, 28, 17, 25, 44, 10, 16, 201, 198, 220, 220, 220, 220, 220, 220, 220, 329, 1312, 28, 16, 25, 40, 17, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 45218, 28, 35428, 2100, 7, 41345, 58, 83, 4357, 50, 58, 83, 11, 72, 12962, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 569, 83, 28, 9806, 7, 71, 58, 83, 11, 72, 4357, 22065, 8, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 520, 28, 8612, 378, 62, 77, 395, 62, 23209, 7, 81, 11, 38392, 11, 28664, 11, 50, 58, 83, 12, 16, 11, 72, 4357, 41, 8, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 43166, 28, 8899, 7, 87, 3784, 35428, 2100, 7, 41345, 58, 83, 4357, 87, 828, 1273, 8, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 289, 83, 28, 8899, 7, 87, 3784, 9806, 7, 42, 12, 87, 828, 1273, 8, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 581, 28, 4352, 13, 29, 33707, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 569, 83, 73, 28, 9107, 418, 7, 41, 8, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 479, 28, 16, 25, 13664, 7, 411, 8, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 581, 58, 74, 60, 855, 7942, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 569, 83, 73, 58, 74, 22241, 4352, 58, 74, 60, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 569, 83, 73, 58, 74, 22241, 33707, 58, 74, 60, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2160, 62, 36392, 28, 16345, 7, 53, 83, 73, 20679, 13664, 7, 1273, 8, 201, 198, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1195, 58, 83, 11, 72, 22241, 48, 58, 83, 12, 16, 11, 72, 60, 14, 7568, 33747, 53, 83, 12, 16345, 62, 36392, 8, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 471, 58, 83, 11, 72, 22241, 9806, 7, 52, 58, 83, 12, 16, 11, 72, 60, 14, 7568, 11, 7, 71, 58, 83, 11, 72, 45297, 48, 58, 83, 11, 72, 60, 4008, 201, 198, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 256, 855, 44, 10, 16, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 471, 58, 83, 11, 72, 22241, 9806, 7, 52, 58, 83, 12, 16, 11, 72, 60, 14, 7568, 11, 32604, 7, 4352, 13219, 48, 58, 83, 11, 72, 12962, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 886, 201, 198, 220, 220, 220, 220, 220, 220, 220, 886, 201, 198, 220, 220, 220, 886, 201, 198, 220, 220, 220, 479, 28, 7568, 61, 44, 201, 198, 220, 220, 220, 471, 15, 28, 16345, 7, 52, 58, 44, 11, 25, 12962, 14, 40, 17, 9, 7, 7568, 61, 44, 8, 201, 198, 201, 198, 437, 201, 198, 201, 198, 2, 12859, 100, 37955, 43718, 229, 21410, 20015, 123, 40367, 253, 164, 115, 107, 36181, 226, 12, 39355, 243, 164, 115, 107, 36181, 226, 201, 198, 8818, 7716, 62, 77, 395, 62, 23209, 7, 81, 3712, 43879, 2414, 11, 38392, 3712, 43879, 2414, 11, 28664, 3712, 43879, 2414, 11, 301, 3712, 43879, 2414, 11, 41, 3712, 5317, 8, 201, 198, 201, 198, 220, 220, 220, 279, 16, 16193, 81, 12, 15, 13, 20, 9, 7, 38392, 61, 17, 4008, 9, 28664, 201, 198, 220, 220, 220, 279, 17, 28, 25192, 7, 26447, 7, 15, 11, 16, 828, 41, 8, 201, 198, 220, 220, 220, 279, 18, 28, 79, 16, 764, 10, 38392, 9, 24861, 248, 7, 28664, 27493, 79, 17, 201, 198, 220, 220, 220, 311, 28, 301, 9, 7, 79, 18, 13, 91, 29, 11201, 8, 201, 198, 201, 198, 220, 220, 220, 1441, 311, 201, 198, 201, 198, 437, 201, 198, 201, 198, 2, 12859, 100, 37955, 43718, 229, 21410, 20015, 123, 40367, 253, 164, 115, 107, 36181, 226, 12, 13783, 248, 164, 115, 107, 36181, 226, 201, 198, 8818, 2429, 4873, 62, 6978, 7, 50, 15, 3712, 43879, 2414, 11, 81, 3712, 43879, 2414, 11, 38392, 3712, 43879, 2414, 11, 28664, 3712, 43879, 2414, 11, 44, 3712, 5317, 11, 40, 3712, 5317, 8, 201, 198, 220, 220, 220, 279, 16, 16193, 81, 12, 15, 13, 20, 9, 7, 38392, 61, 17, 4008, 9, 28664, 201, 198, 220, 220, 220, 311, 28, 9107, 418, 7, 44, 10, 16, 11, 40, 8, 201, 198, 220, 220, 220, 311, 58, 16, 11, 25, 22241, 8899, 7, 87, 3784, 87, 28, 50, 15, 11, 50, 58, 16, 11, 25, 12962, 201, 198, 220, 220, 220, 2488, 14323, 67, 329, 256, 28, 17, 25, 44, 10, 16, 201, 198, 220, 220, 220, 220, 220, 220, 220, 279, 17, 28, 25192, 7, 26447, 7, 15, 11, 16, 828, 40, 8, 201, 198, 220, 220, 220, 220, 220, 220, 220, 279, 18, 28, 79, 16, 764, 10, 38392, 9, 24861, 248, 7, 28664, 27493, 79, 17, 201, 198, 220, 220, 220, 220, 220, 220, 220, 311, 58, 83, 11, 25, 22241, 50, 58, 83, 12, 16, 11, 25, 4083, 9, 7, 79, 18, 13, 91, 29, 11201, 8, 201, 198, 220, 220, 220, 886, 201, 198, 201, 198, 220, 220, 220, 1441, 311, 201, 198, 437, 201, 198, 201, 198, 50, 15, 28, 2623, 13, 15, 201, 198, 42, 28, 1821, 13, 15, 201, 198, 51, 28, 16, 13, 15, 201, 198, 81, 28, 15, 13, 3312, 201, 198, 38392, 28, 15, 13, 17, 201, 198, 40, 16, 28, 1433, 22842, 201, 198, 40, 17, 28, 35500, 201, 198, 201, 198, 44, 28, 940, 201, 198, 41, 28, 1120, 201, 198, 2301, 28, 20, 201, 198, 201, 198, 201, 198, 411, 28, 6561, 44, 62, 35, 25620, 7, 50, 15, 11, 42, 11, 51, 11, 81, 11, 38392, 11, 41, 11, 40, 16, 11, 40, 17, 11, 44, 11, 2301, 8, 201, 198, 35235, 7, 411, 8, 201, 198 ]
1.259134
2,655
@testset "testing GoF, multinomial distribution" begin df = DataFrame(CSV.File(joinpath(dirname(Base.find_package("PhyloNetworks")),"..","examples","buckyCF.csv")), copycols=false) d0 = readTableCF(df) d = deepcopy(d0) net3 = readTopology("((((D:0.4,C:0.4):4.8,((A:0.8,B:0.8):2.2)#H1:2.2::0.7):4.0,(#H1:0::0.3,E:3.0):6.2):2.0,O:11.2);"); @testset "using Pearson statistic" begin # without optimizing branch lengths netresult1 = quarnetGoFtest!(net3,df,false; quartetstat=:pearson, correction=:none); @test length(netresult1) == 6 @test netresult1[2] ≈ 8.589058727506838 # z stat @test netresult1[1] ≈ 4.384234705965304e-18 # p-value @test df[!,:p_value] ≈ [1.2435633419824544e-11,0.0009280577186649157,0.0009280577186649157,1.2435633419824544e-11,0.007580817260552542,0.9998389684303506,0.012895416058219087,0.9438090044657973,0.9471103615208266,0.9438090044657973,0.012895416058219087,0.9471103615208266,0.9956830628718893,0.24055486863965628,0.007580817260552542] @test netresult1[5].loglik ≈ 105.30058282649648 end @testset "LRT statistic for 4-taxon set with small expected values" begin # without optimizing branch lengths netresult1 = quarnetGoFtest!(net3,d,false; correction=:none); # modified d: fills in CFs expected from net3 @test netresult1[2] ≈ 6.21966321647047 # z stat @test netresult1[3] ≈ 1.0 # sigma @test netresult1[1] ≈ 2.491115579898031e-10 # p-value @test netresult1[4] ≈ [0.0024449826689709165,0.01496306673600063,0.01496306673600063,0.0024449826689709165,0.04086460431063039,0.9998541057240138,0.1901450501005025,0.8909735618259936,0.9058717147295428,0.8909735618259936,0.1901450501005025,0.9058717147295428,0.9913859984840471,0.3656465603640152,0.04086460431063039] end @testset "Qlog statistic for 4-taxon set with small expected values" begin netresult1 = QuartetNetworkGoodnessFit.quarnetGoFtest(d.quartet, QuartetNetworkGoodnessFit.multinom_qlog!); @test netresult1[1] ≈ 6.21966321647047 # z stat @test netresult1[2] ≈ [6.188115021844278e-7,.0038172375225786225,.0038172375225786225,6.188115021844278e-7,.016885279326279496,.999846547125979,.054779352829667574,.8909734349100712,.9229400733753065,.8909734349100712,.054779352829667574,.9229400733753065,.9913859984246092,.2975827064317875,.016885279326279496] end @testset "check for exceptions" begin @test_throws ErrorException ticr!(net3,d,false; quartetstat = :Qlog) @test_throws ErrorException ticr!(net3,d,false; test = :bad); @test_throws ErrorException quarnetGoFtest!(net3,d,false; quartetstat=:maxCF); @test_throws ErrorException quarnetGoFtest!(net3,d,false; correction=:foo) d.quartet[1].ngenes = -1 @test_throws ErrorException quarnetGoFtest!(net3,d,false); end d = deepcopy(d0) @testset "with dependence correction" begin # test of expectedCF_ordered for i in 1:15 d.quartet[i].qnet.expCF = [i+0.1, i+0.2, i+0.3]; end expCF, taxa = QuartetNetworkGoodnessFit.expectedCF_ordered(d, net3) taxa == ["A","B","C","D","E","O"] expCF ≈ [13.1 13.2 13.3; 3.2 3.1 3.3; 2.2 2.1 2.3; 8.2 8.3 8.1; 10.3 10.2 10.1; 15.2 15.1 15.3; 5.2 5.1 5.3; 12.2 12.3 12.1; 9.3 9.2 9.1; 14.3 14.1 14.2; 4.1 4.3 4.2; 7.3 7.2 7.1; 1.1 1.3 1.2; 11.3 11.2 11.1; 6.1 6.2 6.3] # test of quarnetGoFtest! with correction netresult1 = quarnetGoFtest!(net3,d,false; seed=4321, verbose=true, nsim=1, keepfiles=true, quartetstat=:pearson); @test netresult1[4] ≈ [1.244e-11,.0009281,.0009281,1.244e-11,.007581,.9998,.0129,.9438,.9471,.9438,.0129,.9471,.9957,.2406,.007581] rtol=1e-4 @test netresult1[2] ≈ 8.589058727506838 # z stat, uncorrected @test netresult1[3] != 1.0 # sigma: 0.8885233166386386 = |single simulated z| hldir = filter!(f -> startswith(f, "jl_"), readdir()) @test length(hldir) == 1 @test length(readdir(hldir[1])) == 1 rm(hldir[1], recursive=true) # similar test, but with multiple processors and other options, and interesting seed: # for s in 1:200 netresult1 = quarnetGoFtest!(net3,d,false; seed=s, nsim=5); # if netresult1[3] > 3.0; @show (s, netresult1); break; end;end; Distributed.addprocs(2) # start with: julia -p 2 --project # or: using Distributed; @everywhere begin; using Pkg; Pkg.activate("."); using PhyloNetworks; end @everywhere using QuartetNetworkGoodnessFit netresult1 = quarnetGoFtest!(net3,d,false; seed=2298, nsim=5); @test netresult1[4] ≈ [0.0024449826689709165,0.01496306673600063,0.01496306673600063,0.0024449826689709165,0.04086460431063039,0.9998541057240138,0.1901450501005025,0.8909735618259936,0.9058717147295428,0.8909735618259936,0.1901450501005025,0.9058717147295428,0.9913859984840471,0.3656465603640152,0.04086460431063039] @test netresult1[2] ≈ 6.21966321647047 # z stat, uncorrected @test netresult1[3] ≈ 3.405362128771355 # sigma @test netresult1[6] ≈ vcat(7.4043609719886545, repeat([-0.8885233166386386],4)) netresult1 = (@test_logs (:warn, r"far from 0") quarnetGoFtest!(net3,d,true; seed=182, nsim=2, quartetstat=:Qlog)); # just because 2 simulated z's only, and same values bc tiny network. may break with different RNG # note: with verbose=true, we see hybrid-lambda's warnings: # WARNING! NOT ULTRAMETRIC!!! # WARNING: Gene tree is not ultrametric # ... until hybrid-lambda can accommodate non-time-consistent networks reliably Distributed.rmprocs(workers()) @test netresult1[4] ≈ [.73,.073,.073,.73,.115,.997,.706,.997,1.,.997,.706,1.,1.,.885,.115] rtol=0.01 @test netresult1[2] ≈ -0.8885233166386386 # z stat, uncorrected # network that caused a bug in hybrid-Lambda v0.6.2-beta, see # https://github.com/hybridLambda/hybrid-Lambda/issues/36 net = readTopology("(((A:7.13,(B:5.98)#H18:1.15::0.79):0.1,C:7.23):0.07,((D:0.0)#H19:6.2::0.89,(E:5.64,(O:0.0,#H19:0.0::0.11):5.64):0.56):1.1,#H18:1.32::0.21);") @test_logs quarnetGoFtest!(net,d,false; seed=419, nsim=5); end end
[ 31, 9288, 2617, 366, 33407, 1514, 37, 11, 1963, 259, 49070, 6082, 1, 2221, 198, 198, 7568, 796, 6060, 19778, 7, 7902, 53, 13, 8979, 7, 22179, 6978, 7, 15908, 3672, 7, 14881, 13, 19796, 62, 26495, 7203, 2725, 2645, 78, 7934, 5225, 48774, 553, 492, 2430, 1069, 12629, 2430, 65, 5309, 22495, 13, 40664, 4943, 828, 4866, 4033, 82, 28, 9562, 8, 198, 67, 15, 796, 1100, 10962, 22495, 7, 7568, 8, 198, 67, 796, 2769, 30073, 7, 67, 15, 8, 198, 3262, 18, 796, 1100, 9126, 1435, 7203, 19510, 19510, 35, 25, 15, 13, 19, 11, 34, 25, 15, 13, 19, 2599, 19, 13, 23, 11, 19510, 32, 25, 15, 13, 23, 11, 33, 25, 15, 13, 23, 2599, 17, 13, 17, 8, 2, 39, 16, 25, 17, 13, 17, 3712, 15, 13, 22, 2599, 19, 13, 15, 11, 7, 2, 39, 16, 25, 15, 3712, 15, 13, 18, 11, 36, 25, 18, 13, 15, 2599, 21, 13, 17, 2599, 17, 13, 15, 11, 46, 25, 1157, 13, 17, 1776, 15341, 198, 198, 31, 9288, 2617, 366, 3500, 31074, 24696, 1, 2221, 198, 2, 1231, 45780, 8478, 20428, 198, 3262, 20274, 16, 796, 627, 1501, 316, 5247, 37, 9288, 0, 7, 3262, 18, 11, 7568, 11, 9562, 26, 28176, 316, 14269, 28, 25, 431, 12613, 11, 17137, 28, 25, 23108, 1776, 198, 31, 9288, 4129, 7, 3262, 20274, 16, 8, 6624, 718, 198, 31, 9288, 2010, 20274, 16, 58, 17, 60, 15139, 230, 807, 13, 44169, 2713, 5774, 1983, 1120, 3104, 2548, 220, 1303, 1976, 1185, 198, 31, 9288, 2010, 20274, 16, 58, 16, 60, 15139, 230, 604, 13, 22842, 24409, 2154, 3270, 2996, 21288, 68, 12, 1507, 220, 220, 1303, 279, 12, 8367, 198, 31, 9288, 47764, 58, 28265, 25, 79, 62, 8367, 60, 15139, 230, 685, 16, 13, 1731, 32066, 31380, 22337, 22995, 2598, 68, 12, 1157, 11, 15, 13, 830, 5892, 28256, 3324, 25096, 33300, 18458, 11, 15, 13, 830, 5892, 28256, 3324, 25096, 33300, 18458, 11, 16, 13, 1731, 32066, 31380, 22337, 22995, 2598, 68, 12, 1157, 11, 15, 13, 405, 2425, 28362, 1558, 21719, 2816, 1495, 3682, 11, 15, 13, 2079, 4089, 29769, 3104, 31794, 14877, 21, 11, 15, 13, 486, 2078, 3865, 35218, 2713, 6469, 1129, 2919, 22, 11, 15, 13, 24, 3559, 1795, 12865, 2598, 2996, 3720, 4790, 11, 15, 13, 24, 2857, 11442, 2623, 1314, 21315, 25540, 11, 15, 13, 24, 3559, 1795, 12865, 2598, 2996, 3720, 4790, 11, 15, 13, 486, 2078, 3865, 35218, 2713, 6469, 1129, 2919, 22, 11, 15, 13, 24, 2857, 11442, 2623, 1314, 21315, 25540, 11, 15, 13, 33438, 3104, 20548, 27800, 1507, 49682, 11, 15, 13, 1731, 47838, 2780, 33808, 2670, 37466, 2078, 11, 15, 13, 405, 2425, 28362, 1558, 21719, 2816, 1495, 3682, 60, 198, 31, 9288, 2010, 20274, 16, 58, 20, 4083, 6404, 46965, 15139, 230, 13343, 13, 6200, 3365, 2078, 2075, 2920, 34287, 198, 437, 198, 198, 31, 9288, 2617, 366, 43, 14181, 24696, 329, 604, 12, 19290, 261, 900, 351, 1402, 2938, 3815, 1, 2221, 198, 2, 1231, 45780, 8478, 20428, 198, 3262, 20274, 16, 796, 627, 1501, 316, 5247, 37, 9288, 0, 7, 3262, 18, 11, 67, 11, 9562, 26, 17137, 28, 25, 23108, 1776, 1303, 9518, 288, 25, 23816, 287, 18551, 82, 2938, 422, 2010, 18, 198, 31, 9288, 2010, 20274, 16, 58, 17, 60, 15139, 230, 718, 13, 28896, 2791, 2624, 23237, 2154, 2857, 1303, 1976, 1185, 198, 31, 9288, 2010, 20274, 16, 58, 18, 60, 15139, 230, 352, 13, 15, 1303, 264, 13495, 198, 31, 9288, 2010, 20274, 16, 58, 16, 60, 15139, 230, 362, 13, 2920, 1157, 1314, 3553, 4089, 40022, 3132, 68, 12, 940, 220, 1303, 279, 12, 8367, 198, 31, 9288, 2010, 20274, 16, 58, 19, 60, 15139, 230, 685, 15, 13, 405, 1731, 2598, 4089, 2075, 40523, 31495, 20986, 11, 15, 13, 486, 2920, 30005, 28933, 2623, 830, 5066, 11, 15, 13, 486, 2920, 30005, 28933, 2623, 830, 5066, 11, 15, 13, 405, 1731, 2598, 4089, 2075, 40523, 31495, 20986, 11, 15, 13, 15, 26200, 2414, 1899, 3559, 15801, 1270, 2670, 11, 15, 13, 2079, 4089, 4051, 940, 3553, 1731, 486, 2548, 11, 15, 13, 1129, 486, 17885, 33548, 405, 1120, 1495, 11, 15, 13, 4531, 2931, 22, 32066, 1507, 1495, 2079, 2623, 11, 15, 13, 44928, 5774, 1558, 20198, 1959, 4051, 2078, 11, 15, 13, 4531, 2931, 22, 32066, 1507, 1495, 2079, 2623, 11, 15, 13, 1129, 486, 17885, 33548, 405, 1120, 1495, 11, 15, 13, 44928, 5774, 1558, 20198, 1959, 4051, 2078, 11, 15, 13, 2079, 1485, 5332, 34808, 2780, 1821, 38339, 11, 15, 13, 24760, 2414, 2996, 1899, 26780, 486, 4309, 11, 15, 13, 15, 26200, 2414, 1899, 3559, 15801, 1270, 2670, 60, 198, 437, 198, 198, 31, 9288, 2617, 366, 48, 6404, 24696, 329, 604, 12, 19290, 261, 900, 351, 1402, 2938, 3815, 1, 2221, 198, 3262, 20274, 16, 796, 48748, 316, 26245, 10248, 1108, 31805, 13, 421, 1501, 316, 5247, 37, 9288, 7, 67, 13, 36008, 316, 11, 48748, 316, 26245, 10248, 1108, 31805, 13, 16680, 259, 296, 62, 80, 6404, 0, 1776, 198, 31, 9288, 2010, 20274, 16, 58, 16, 60, 15139, 230, 718, 13, 28896, 2791, 2624, 23237, 2154, 2857, 220, 1303, 1976, 1185, 198, 31, 9288, 2010, 20274, 16, 58, 17, 60, 15139, 230, 685, 21, 13, 20356, 1157, 1120, 28727, 2598, 25870, 68, 12, 22, 38508, 405, 2548, 1558, 1954, 2425, 18182, 3695, 5237, 1495, 38508, 405, 2548, 1558, 1954, 2425, 18182, 3695, 5237, 1495, 11, 21, 13, 20356, 1157, 1120, 28727, 2598, 25870, 68, 12, 22, 38508, 486, 3104, 5332, 1983, 6052, 2075, 26050, 37747, 38508, 2079, 4089, 42018, 2857, 1065, 3270, 3720, 38508, 2713, 2857, 3720, 2327, 2078, 1959, 2791, 2425, 4524, 38508, 4531, 2931, 22, 2682, 27371, 44318, 1065, 38508, 24, 1828, 5824, 25816, 2091, 2425, 1270, 2996, 38508, 4531, 2931, 22, 2682, 27371, 44318, 1065, 38508, 2713, 2857, 3720, 2327, 2078, 1959, 2791, 2425, 4524, 38508, 24, 1828, 5824, 25816, 2091, 2425, 1270, 2996, 38508, 2079, 1485, 5332, 2079, 5705, 1731, 1899, 5892, 38508, 1959, 38569, 20233, 41813, 23188, 2425, 38508, 486, 3104, 5332, 1983, 6052, 2075, 26050, 37747, 60, 198, 437, 198, 198, 31, 9288, 2617, 366, 9122, 329, 13269, 1, 2221, 198, 31, 9288, 62, 400, 8516, 13047, 16922, 256, 291, 81, 0, 7, 3262, 18, 11, 67, 11, 9562, 26, 28176, 316, 14269, 796, 1058, 48, 6404, 8, 198, 31, 9288, 62, 400, 8516, 13047, 16922, 256, 291, 81, 0, 7, 3262, 18, 11, 67, 11, 9562, 26, 1332, 796, 1058, 14774, 1776, 198, 31, 9288, 62, 400, 8516, 13047, 16922, 627, 1501, 316, 5247, 37, 9288, 0, 7, 3262, 18, 11, 67, 11, 9562, 26, 28176, 316, 14269, 28, 25, 9806, 22495, 1776, 198, 31, 9288, 62, 400, 8516, 13047, 16922, 627, 1501, 316, 5247, 37, 9288, 0, 7, 3262, 18, 11, 67, 11, 9562, 26, 17137, 28, 25, 21943, 8, 198, 67, 13, 36008, 316, 58, 16, 4083, 782, 18719, 796, 532, 16, 198, 31, 9288, 62, 400, 8516, 13047, 16922, 627, 1501, 316, 5247, 37, 9288, 0, 7, 3262, 18, 11, 67, 11, 9562, 1776, 198, 437, 198, 198, 67, 796, 2769, 30073, 7, 67, 15, 8, 198, 31, 9288, 2617, 366, 4480, 21403, 17137, 1, 2221, 198, 2, 1332, 286, 2938, 22495, 62, 24071, 198, 1640, 1312, 287, 352, 25, 1314, 288, 13, 36008, 316, 58, 72, 4083, 80, 3262, 13, 11201, 22495, 796, 685, 72, 10, 15, 13, 16, 11, 1312, 10, 15, 13, 17, 11, 1312, 10, 15, 13, 18, 11208, 886, 198, 11201, 22495, 11, 1687, 64, 796, 48748, 316, 26245, 10248, 1108, 31805, 13, 40319, 22495, 62, 24071, 7, 67, 11, 2010, 18, 8, 198, 19290, 64, 6624, 14631, 32, 2430, 33, 2430, 34, 2430, 35, 2430, 36, 2430, 46, 8973, 198, 11201, 22495, 15139, 230, 685, 1485, 13, 16, 1511, 13, 17, 1511, 13, 18, 26, 513, 13, 17, 513, 13, 16, 513, 13, 18, 26, 362, 13, 17, 362, 13, 16, 362, 13, 18, 26, 807, 13, 17, 807, 13, 18, 807, 13, 16, 26, 838, 13, 18, 838, 13, 17, 838, 13, 16, 26, 1315, 13, 17, 1315, 13, 16, 1315, 13, 18, 26, 642, 13, 17, 642, 13, 16, 642, 13, 18, 26, 1105, 13, 17, 1105, 13, 18, 1105, 13, 16, 26, 860, 13, 18, 860, 13, 17, 860, 13, 16, 26, 1478, 13, 18, 1478, 13, 16, 1478, 13, 17, 26, 604, 13, 16, 604, 13, 18, 604, 13, 17, 26, 767, 13, 18, 767, 13, 17, 767, 13, 16, 26, 352, 13, 16, 352, 13, 18, 352, 13, 17, 26, 1367, 13, 18, 1367, 13, 17, 1367, 13, 16, 26, 718, 13, 16, 718, 13, 17, 718, 13, 18, 60, 198, 2, 1332, 286, 627, 1501, 316, 5247, 37, 9288, 0, 351, 17137, 198, 3262, 20274, 16, 796, 627, 1501, 316, 5247, 37, 9288, 0, 7, 3262, 18, 11, 67, 11, 9562, 26, 9403, 28, 3559, 2481, 11, 15942, 577, 28, 7942, 11, 299, 14323, 28, 16, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1394, 16624, 28, 7942, 11, 28176, 316, 14269, 28, 25, 431, 12613, 1776, 198, 31, 9288, 2010, 20274, 16, 58, 19, 60, 15139, 230, 685, 16, 13, 25707, 68, 12, 1157, 38508, 830, 24, 30368, 38508, 830, 24, 30368, 11, 16, 13, 25707, 68, 12, 1157, 38508, 405, 2425, 6659, 38508, 2079, 4089, 38508, 486, 1959, 38508, 5824, 2548, 38508, 24, 38339, 38508, 5824, 2548, 38508, 486, 1959, 38508, 24, 38339, 38508, 2079, 3553, 38508, 1731, 3312, 38508, 405, 2425, 6659, 60, 374, 83, 349, 28, 16, 68, 12, 19, 198, 31, 9288, 2010, 20274, 16, 58, 17, 60, 15139, 230, 807, 13, 44169, 2713, 5774, 1983, 1120, 3104, 2548, 1303, 1976, 1185, 11, 4591, 47315, 276, 198, 31, 9288, 2010, 20274, 16, 58, 18, 60, 14512, 352, 13, 15, 1303, 264, 13495, 25, 657, 13, 3459, 5332, 25429, 23055, 21734, 21734, 796, 930, 29762, 28590, 1976, 91, 198, 71, 335, 343, 796, 8106, 0, 7, 69, 4613, 923, 2032, 342, 7, 69, 11, 366, 20362, 62, 12340, 1100, 15908, 28955, 198, 31, 9288, 4129, 7, 71, 335, 343, 8, 6624, 352, 198, 31, 9288, 4129, 7, 961, 15908, 7, 71, 335, 343, 58, 16, 60, 4008, 6624, 352, 198, 26224, 7, 71, 335, 343, 58, 16, 4357, 45115, 28, 7942, 8, 198, 2, 2092, 1332, 11, 475, 351, 3294, 20399, 290, 584, 3689, 11, 290, 3499, 9403, 25, 198, 2, 329, 264, 287, 352, 25, 2167, 2010, 20274, 16, 796, 627, 1501, 316, 5247, 37, 9288, 0, 7, 3262, 18, 11, 67, 11, 9562, 26, 9403, 28, 82, 11, 299, 14323, 28, 20, 1776, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 2010, 20274, 16, 58, 18, 60, 1875, 513, 13, 15, 26, 2488, 12860, 357, 82, 11, 2010, 20274, 16, 1776, 2270, 26, 886, 26, 437, 26, 198, 20344, 6169, 13, 2860, 1676, 6359, 7, 17, 8, 198, 2, 923, 351, 25, 474, 43640, 532, 79, 362, 1377, 16302, 198, 2, 393, 25, 1262, 4307, 6169, 26, 2488, 16833, 3003, 2221, 26, 1262, 350, 10025, 26, 350, 10025, 13, 39022, 7203, 526, 1776, 1262, 1380, 2645, 78, 7934, 5225, 26, 886, 198, 31, 16833, 3003, 1262, 48748, 316, 26245, 10248, 1108, 31805, 198, 3262, 20274, 16, 796, 627, 1501, 316, 5247, 37, 9288, 0, 7, 3262, 18, 11, 67, 11, 9562, 26, 9403, 28, 1828, 4089, 11, 299, 14323, 28, 20, 1776, 198, 31, 9288, 2010, 20274, 16, 58, 19, 60, 15139, 230, 685, 15, 13, 405, 1731, 2598, 4089, 2075, 40523, 31495, 20986, 11, 15, 13, 486, 2920, 30005, 28933, 2623, 830, 5066, 11, 15, 13, 486, 2920, 30005, 28933, 2623, 830, 5066, 11, 15, 13, 405, 1731, 2598, 4089, 2075, 40523, 31495, 20986, 11, 15, 13, 15, 26200, 2414, 1899, 3559, 15801, 1270, 2670, 11, 15, 13, 2079, 4089, 4051, 940, 3553, 1731, 486, 2548, 11, 15, 13, 1129, 486, 17885, 33548, 405, 1120, 1495, 11, 15, 13, 4531, 2931, 22, 32066, 1507, 1495, 2079, 2623, 11, 15, 13, 44928, 5774, 1558, 20198, 1959, 4051, 2078, 11, 15, 13, 4531, 2931, 22, 32066, 1507, 1495, 2079, 2623, 11, 15, 13, 1129, 486, 17885, 33548, 405, 1120, 1495, 11, 15, 13, 44928, 5774, 1558, 20198, 1959, 4051, 2078, 11, 15, 13, 2079, 1485, 5332, 34808, 2780, 1821, 38339, 11, 15, 13, 24760, 2414, 2996, 1899, 26780, 486, 4309, 11, 15, 13, 15, 26200, 2414, 1899, 3559, 15801, 1270, 2670, 60, 198, 31, 9288, 2010, 20274, 16, 58, 17, 60, 15139, 230, 718, 13, 28896, 2791, 2624, 23237, 2154, 2857, 1303, 1976, 1185, 11, 4591, 47315, 276, 198, 31, 9288, 2010, 20274, 16, 58, 18, 60, 15139, 230, 513, 13, 26598, 35667, 12762, 3324, 1485, 2816, 1303, 264, 13495, 198, 31, 9288, 2010, 20274, 16, 58, 21, 60, 15139, 230, 410, 9246, 7, 22, 13, 1821, 3559, 1899, 5607, 26709, 2996, 2231, 11, 9585, 26933, 12, 15, 13, 3459, 5332, 25429, 23055, 21734, 21734, 4357, 19, 4008, 198, 3262, 20274, 16, 796, 4275, 9288, 62, 6404, 82, 357, 25, 40539, 11, 374, 1, 16370, 422, 657, 4943, 627, 1501, 316, 5247, 37, 9288, 0, 7, 3262, 18, 11, 67, 11, 7942, 26, 9403, 28, 24294, 11, 299, 14323, 28, 17, 11, 28176, 316, 14269, 28, 25, 48, 6404, 18125, 198, 2, 655, 780, 362, 28590, 1976, 338, 691, 11, 290, 976, 3815, 47125, 7009, 3127, 13, 743, 2270, 351, 1180, 371, 10503, 198, 2, 3465, 25, 351, 15942, 577, 28, 7942, 11, 356, 766, 14554, 12, 50033, 338, 14601, 25, 198, 2, 39410, 0, 5626, 44475, 5446, 2390, 2767, 41132, 10185, 198, 2, 39410, 25, 13005, 5509, 318, 407, 3789, 859, 19482, 198, 2, 2644, 1566, 14554, 12, 50033, 460, 15550, 1729, 12, 2435, 12, 5936, 7609, 7686, 26995, 198, 20344, 6169, 13, 26224, 1676, 6359, 7, 22896, 28955, 198, 31, 9288, 2010, 20274, 16, 58, 19, 60, 15139, 230, 685, 13, 4790, 38508, 2998, 18, 38508, 2998, 18, 38508, 4790, 38508, 15363, 38508, 39647, 38508, 35402, 38508, 39647, 11, 16, 1539, 13, 39647, 38508, 35402, 11, 16, 1539, 16, 1539, 13, 44230, 38508, 15363, 60, 374, 83, 349, 28, 15, 13, 486, 198, 31, 9288, 2010, 20274, 16, 58, 17, 60, 15139, 230, 532, 15, 13, 3459, 5332, 25429, 23055, 21734, 21734, 1303, 1976, 1185, 11, 4591, 47315, 276, 198, 198, 2, 3127, 326, 4073, 257, 5434, 287, 14554, 12, 43, 4131, 6814, 410, 15, 13, 21, 13, 17, 12, 31361, 11, 766, 198, 2, 3740, 1378, 12567, 13, 785, 14, 12114, 10236, 43, 4131, 6814, 14, 12114, 10236, 12, 43, 4131, 6814, 14, 37165, 14, 2623, 198, 3262, 796, 1100, 9126, 1435, 7203, 19510, 7, 32, 25, 22, 13, 1485, 11, 7, 33, 25, 20, 13, 4089, 8, 2, 39, 1507, 25, 16, 13, 1314, 3712, 15, 13, 3720, 2599, 15, 13, 16, 11, 34, 25, 22, 13, 1954, 2599, 15, 13, 2998, 11, 19510, 35, 25, 15, 13, 15, 8, 2, 39, 1129, 25, 21, 13, 17, 3712, 15, 13, 4531, 11, 7, 36, 25, 20, 13, 2414, 11, 7, 46, 25, 15, 13, 15, 11, 2, 39, 1129, 25, 15, 13, 15, 3712, 15, 13, 1157, 2599, 20, 13, 2414, 2599, 15, 13, 3980, 2599, 16, 13, 16, 11, 2, 39, 1507, 25, 16, 13, 2624, 3712, 15, 13, 2481, 1776, 4943, 198, 31, 9288, 62, 6404, 82, 627, 1501, 316, 5247, 37, 9288, 0, 7, 3262, 11, 67, 11, 9562, 26, 9403, 28, 45068, 11, 299, 14323, 28, 20, 1776, 198, 198, 437, 198, 198, 437, 198 ]
2.202299
2,610
#==========================================================================================# # INTERFACE function fit(M::Type{<: OneStageModel}, MD::Microdata; novar::Bool = false, kwargs...) obj = M(MD; kwargs...) _fit!(obj, MD.weights) novar || _vcov!(obj, getcorr(obj), MD.weights) return obj end #==========================================================================================# # ESTIMATES coef(obj::ParObject) = switch_stage(obj).β vcov(obj::ParObject) = switch_stage(obj).V stderror(obj::ParObject) = sqrt.(diag(vcov(obj))) tstat(obj::ParObject) = coef(obj) ./ stderror(obj) pval(obj::ParObject) = 2.0 * normccdf.(abs.(tstat(obj))) function confint(obj::ParObject, level::Real = 0.95) return coef(obj) .+ norminvcdf((1.0 - level) / 2.0) * stderror(obj) .* [1.0 -1.0] end #==========================================================================================# # SUMMARY STATISTICS nobs(obj::Microdata) = sum(obj.weights) nobs(obj::AnyModel) = nobs(switch_stage(obj).sample) dof(obj::ParModel) = length(coef(obj)) dof_residual(obj::ParModel) = nobs(obj) - dof(obj) loglikelihood(obj::MLE) = _loglikelihood(obj, getweights(obj)) nullloglikelihood(obj::MLE) = _nullloglikelihood(obj::MLE, getweights(obj)) deviance(obj::MLE) = _deviance(obj::MLE, getweights(obj)) nulldeviance(obj::MLE) = _nulldeviance(obj::MLE, getweights(obj)) #==========================================================================================# # PREDICTION linear_predictor(obj::AnyModel) = linear_predictor(obj, switch_stage(obj).sample) predict(obj::AnyModel) = predict(obj, switch_stage(obj).sample) fitted(obj::AnyModel) = predict(obj) residuals(obj::AnyModel) = residuals(obj, switch_stage(obj).sample) response(obj::AnyModel) = getvector(obj, :response) function residuals(obj::AnyModel, MD::Microdata) y = response(obj) r = predict(obj, MD) r .= y .- r return r end #==========================================================================================# # COEFFICIENT LABELS coefnames(obj::ParEstimate) = obj.names # OUTPUT function coeftable(obj::ParObject; level::Float64 = 0.95, digits::Int = 4) table = formatter(hcat(coef(obj), stderror(obj), tstat(obj), pval(obj)), digits) label = [" Estimate", " St. Err.", " t-stat.", " p-value"] if level > 0.0 table = hcat(table, formatter(confint(obj, level), digits)) label = vcat(label, [" C.I.", "($(format("{:.0d}", 100 * level))%) "]) end return CoefTable(table, label, coefnames(obj)) end function Base.show(io::IO, obj::ParObject) isdefined(switch_stage(obj), :V) ? println(io, coeftable(obj)) : println(io, coef(obj)) end
[ 2, 23926, 4770, 2559, 855, 2, 198, 198, 2, 23255, 49836, 198, 198, 8818, 4197, 7, 44, 3712, 6030, 90, 27, 25, 1881, 29391, 17633, 5512, 10670, 3712, 13031, 7890, 26, 645, 7785, 3712, 33, 970, 796, 3991, 11, 479, 86, 22046, 23029, 628, 220, 220, 220, 26181, 796, 337, 7, 12740, 26, 479, 86, 22046, 23029, 628, 220, 220, 220, 4808, 11147, 0, 7, 26801, 11, 10670, 13, 43775, 8, 198, 220, 220, 220, 645, 7785, 8614, 4808, 28435, 709, 0, 7, 26801, 11, 651, 10215, 81, 7, 26801, 828, 10670, 13, 43775, 8, 628, 220, 220, 220, 1441, 26181, 198, 437, 198, 198, 2, 23926, 4770, 2559, 855, 2, 198, 198, 2, 17160, 3955, 29462, 198, 198, 1073, 891, 7, 26801, 3712, 10044, 10267, 8, 220, 220, 220, 220, 796, 5078, 62, 14247, 7, 26801, 737, 26638, 198, 28435, 709, 7, 26801, 3712, 10044, 10267, 8, 220, 220, 220, 220, 796, 5078, 62, 14247, 7, 26801, 737, 53, 198, 301, 1082, 1472, 7, 26801, 3712, 10044, 10267, 8, 796, 19862, 17034, 12195, 10989, 363, 7, 28435, 709, 7, 26801, 22305, 198, 83, 14269, 7, 26801, 3712, 10044, 10267, 8, 220, 220, 220, 796, 763, 891, 7, 26801, 8, 24457, 336, 1082, 1472, 7, 26801, 8, 198, 79, 2100, 7, 26801, 3712, 10044, 10267, 8, 220, 220, 220, 220, 796, 362, 13, 15, 1635, 2593, 535, 7568, 12195, 8937, 12195, 83, 14269, 7, 26801, 22305, 198, 198, 8818, 1013, 600, 7, 26801, 3712, 10044, 10267, 11, 1241, 3712, 15633, 796, 657, 13, 3865, 8, 198, 220, 220, 220, 1441, 763, 891, 7, 26801, 8, 764, 10, 2593, 16340, 66, 7568, 19510, 16, 13, 15, 532, 1241, 8, 1220, 362, 13, 15, 8, 1635, 336, 1082, 1472, 7, 26801, 8, 764, 9, 685, 16, 13, 15, 532, 16, 13, 15, 60, 198, 437, 198, 198, 2, 23926, 4770, 2559, 855, 2, 198, 198, 2, 35683, 44, 13153, 15486, 8808, 19505, 198, 198, 77, 8158, 7, 26801, 3712, 13031, 7890, 8, 796, 2160, 7, 26801, 13, 43775, 8, 198, 77, 8158, 7, 26801, 3712, 7149, 17633, 8, 220, 796, 645, 1443, 7, 31943, 62, 14247, 7, 26801, 737, 39873, 8, 198, 198, 67, 1659, 7, 26801, 3712, 10044, 17633, 8, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 4129, 7, 1073, 891, 7, 26801, 4008, 198, 67, 1659, 62, 411, 312, 723, 7, 26801, 3712, 10044, 17633, 8, 796, 645, 1443, 7, 26801, 8, 532, 466, 69, 7, 26801, 8, 198, 198, 6404, 2339, 11935, 7, 26801, 3712, 44, 2538, 8, 220, 220, 220, 220, 796, 4808, 6404, 2339, 11935, 7, 26801, 11, 651, 43775, 7, 26801, 4008, 198, 8423, 6404, 2339, 11935, 7, 26801, 3712, 44, 2538, 8, 796, 4808, 8423, 6404, 2339, 11935, 7, 26801, 3712, 44, 2538, 11, 651, 43775, 7, 26801, 4008, 198, 7959, 3610, 7, 26801, 3712, 44, 2538, 8, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 4808, 7959, 3610, 7, 26801, 3712, 44, 2538, 11, 651, 43775, 7, 26801, 4008, 198, 8423, 7959, 3610, 7, 26801, 3712, 44, 2538, 8, 220, 220, 220, 220, 220, 796, 4808, 8423, 7959, 3610, 7, 26801, 3712, 44, 2538, 11, 651, 43775, 7, 26801, 4008, 198, 198, 2, 23926, 4770, 2559, 855, 2, 198, 198, 2, 4810, 1961, 18379, 2849, 198, 198, 29127, 62, 79, 17407, 273, 7, 26801, 3712, 7149, 17633, 8, 796, 14174, 62, 79, 17407, 273, 7, 26801, 11, 5078, 62, 14247, 7, 26801, 737, 39873, 8, 198, 79, 17407, 7, 26801, 3712, 7149, 17633, 8, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 4331, 7, 26801, 11, 5078, 62, 14247, 7, 26801, 737, 39873, 8, 198, 38631, 7, 26801, 3712, 7149, 17633, 8, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 4331, 7, 26801, 8, 198, 411, 312, 723, 82, 7, 26801, 3712, 7149, 17633, 8, 220, 220, 220, 220, 220, 220, 220, 796, 29598, 82, 7, 26801, 11, 5078, 62, 14247, 7, 26801, 737, 39873, 8, 198, 26209, 7, 26801, 3712, 7149, 17633, 8, 220, 220, 220, 220, 220, 220, 220, 220, 796, 651, 31364, 7, 26801, 11, 1058, 26209, 8, 198, 198, 8818, 29598, 82, 7, 26801, 3712, 7149, 17633, 11, 10670, 3712, 13031, 7890, 8, 198, 220, 220, 220, 331, 220, 796, 2882, 7, 26801, 8, 198, 220, 220, 220, 374, 220, 796, 4331, 7, 26801, 11, 10670, 8, 198, 220, 220, 220, 374, 764, 28, 331, 764, 12, 374, 198, 220, 220, 220, 1441, 374, 198, 437, 198, 198, 2, 23926, 4770, 2559, 855, 2, 198, 198, 2, 7375, 37267, 2149, 28495, 406, 6242, 37142, 198, 198, 1073, 891, 14933, 7, 26801, 3712, 10044, 22362, 1920, 8, 796, 26181, 13, 14933, 198, 198, 2, 16289, 30076, 198, 198, 8818, 763, 68, 701, 540, 7, 26801, 3712, 10044, 10267, 26, 1241, 3712, 43879, 2414, 796, 657, 13, 3865, 11, 19561, 3712, 5317, 796, 604, 8, 628, 220, 220, 220, 3084, 796, 1296, 1436, 7, 71, 9246, 7, 1073, 891, 7, 26801, 828, 336, 1082, 1472, 7, 26801, 828, 256, 14269, 7, 26801, 828, 279, 2100, 7, 26801, 36911, 19561, 8, 198, 220, 220, 220, 6167, 796, 14631, 10062, 1920, 1600, 366, 520, 13, 41512, 33283, 366, 220, 256, 12, 14269, 33283, 366, 220, 279, 12, 8367, 8973, 628, 220, 220, 220, 611, 1241, 1875, 657, 13, 15, 198, 220, 220, 220, 220, 220, 220, 220, 3084, 220, 796, 289, 9246, 7, 11487, 11, 1296, 1436, 7, 10414, 600, 7, 26801, 11, 1241, 828, 19561, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 6167, 220, 796, 410, 9246, 7, 18242, 11, 14631, 220, 220, 220, 220, 327, 13, 40, 33283, 366, 16763, 7, 18982, 7203, 90, 25, 13, 15, 67, 92, 1600, 1802, 1635, 1241, 4008, 4407, 220, 366, 12962, 198, 220, 220, 220, 886, 628, 220, 220, 220, 1441, 1766, 891, 10962, 7, 11487, 11, 6167, 11, 763, 891, 14933, 7, 26801, 4008, 198, 437, 198, 198, 8818, 7308, 13, 12860, 7, 952, 3712, 9399, 11, 26181, 3712, 10044, 10267, 8, 198, 220, 220, 220, 318, 23211, 7, 31943, 62, 14247, 7, 26801, 828, 1058, 53, 8, 5633, 44872, 7, 952, 11, 763, 68, 701, 540, 7, 26801, 4008, 1058, 44872, 7, 952, 11, 763, 891, 7, 26801, 4008, 198, 437, 198 ]
2.665706
1,041
<filename>test/estimate/regime_switching_mh.jl using DSGE, ModelConstructors, HDF5, Random, FileIO, Test, Dates writing_output = false regenerate_sim_data = false if VERSION < v"1.5" ver = "111" else ver = "150" end ######################### # Regime-switching test # # w/ An-Schorfheide # ######################### path = dirname(@__FILE__) m = AnSchorfheide() # Set up SMC m <= Setting(:sampling_method, :MH) m <= Setting(:data_vintage, "210101") m <= Setting(:cond_vintage, "210101") m <= Setting(:n_mh_simulations, 500) m <= Setting(:n_mh_blocks, 1) m <= Setting(:n_mh_burn, 0) m <= Setting(:n_mh_thin, 1) m <= Setting(:mh_cc, 0.0005) m <= Setting(:mh_adaptive_accept, false) m <= Setting(:hessian_path, joinpath(path, "..", "reference", "hessian_rs2=true_vint=210101.h5")) sim_filepath = joinpath(path, "..", "reference", "sim_data_regswitch_anschorfheide.h5") if regenerate_sim_data simulate_data(m; filepath = sim_filepath) end data = h5read(sim_filepath, "data") true_lik = DSGE.likelihood(m, data) m <= Setting(:saveroot, normpath(joinpath(dirname(@__FILE__), "..", "..", "save"))) # With regime-switching m <= Setting(:regime_switching, true, true, "rs2", "") # For file output purposes m <= Setting(:n_regimes, 3) m <= Setting(:regime_dates, Dict(1 => date_presample_start(m), 2 => DSGE.iterate_quarters(Date(1960, 3, 31), 50), 3 => DSGE.iterate_quarters(Date(1960, 3, 31), 100))) setup_regime_switching_inds!(m) m <= Setting(:model2para_regimes, Dict{Int, Int}(1 => 1, 2 => 1, 3 => 2)) for i in 1:length(m.parameters) for k in 1:2 ModelConstructors.set_regime_val!(m.parameters[i], k, m.parameters[i].value) end end param_mat = repeat([1 1 2], length(m.parameters)) DSGE.setup_param_regimes!(m, param_mat) sys = compute_system(m) regswitch_lik = DSGE.likelihood(m, data) true_para = ModelConstructors.get_values(m.parameters) Random.seed!(1793) @testset "Search for posterior mode of regime-switching AnSchorfheide with csminwel (approx. 5s)" begin m <= Setting(:optimization_attempts, 1) m <= Setting(:optimization_iterations, 3) DSGE.estimate(m, data; sampling = false) θ = load_draws(m, :mode) if writing_output h5open(joinpath(path, "..", "reference", "regime_switching_anschorfheide_paramsmode_output.h5"), "w") do file write(file, "params", θ) end else @test θ ≈ h5read(joinpath(path, "..", "reference", "regime_switching_anschorfheide_paramsmode_output.h5"), "params") end end m <= Setting(:reoptimize, false) @testset "Calculate Hessian of regime-switching AnSchorfheide (approx. 10s)" begin out_hessian, _ = DSGE.hessian!(m, h5read(joinpath(path, "..", "reference", "regime_switching_anschorfheide_paramsmode_output.h5"), "params"), data; check_neg_diag = false) if writing_output h5open(joinpath(path, "..", "reference", "hessian_rs2=true_vint=210101.h5"), "w") do file write(file, "hessian", out_hessian) end else # when saving the output in REPL, the results seem different from testing, but the Hessian is still fairly close if maximum(abs.(h5read(joinpath(path, "..", "reference", "hessian_rs2=true_vint=210101.h5"), "hessian") - out_hessian)) < 8e-2 @test maximum(abs.(h5read(joinpath(path, "..", "reference", "hessian_rs2=true_vint=210101.h5"), "hessian") - out_hessian)) < 8e-2 else # usually, in REPL and in test mode, the Hessian satisfies the error bound, but occassionally, # the maximum difference is very large (e.g. on the order of 100 - 1000), for some spurious reason. # To avoid having tests break, we only run the test when we know it is satisfied. Otherwise, we mark it as broken @warn "Test for Hessian of regime-switching AnSchorfheide failed, double check if the error is spurious or not." @test_broken maximum(abs.(h5read(joinpath(path, "..", "reference", "hessian_rs2=true_vint=210101.h5"), "hessian") - out_hessian)) < 8e-2 end end end m <= Setting(:calculate_hessian, false) m <= Setting(:hessian_path, joinpath(path, "..", "reference", "hessian_rs2=true_vint=210101.h5")) @testset "Estimate regime-switching AnSchorfheide with MH (approx. 10s)" begin @test true_lik ≈ regswitch_lik # Regime switching estimation Random.seed!(1793) DSGE.update!(m, h5read(joinpath(path, "..", "reference", "regime_switching_anschorfheide_paramsmode_output.h5"), "params")) DSGE.estimate(m, data) posterior_means = vec(mean(load_draws(m, :full), dims = 1)) @test length(posterior_means) == length(m.parameters) * 2 @test maximum(abs.(true_para - posterior_means)) < .55 end
[ 27, 34345, 29, 9288, 14, 395, 1920, 14, 2301, 524, 62, 2032, 19811, 62, 76, 71, 13, 20362, 198, 3500, 17400, 8264, 11, 9104, 42316, 669, 11, 5572, 37, 20, 11, 14534, 11, 9220, 9399, 11, 6208, 11, 44712, 198, 198, 16502, 62, 22915, 796, 3991, 198, 2301, 877, 378, 62, 14323, 62, 7890, 796, 3991, 198, 198, 361, 44156, 2849, 1279, 410, 1, 16, 13, 20, 1, 198, 220, 220, 220, 3326, 796, 366, 16243, 1, 198, 17772, 198, 220, 220, 220, 3326, 796, 366, 8628, 1, 198, 437, 198, 198, 14468, 7804, 2, 198, 2, 3310, 524, 12, 2032, 19811, 1332, 1303, 198, 2, 266, 14, 1052, 12, 14874, 24263, 258, 485, 220, 220, 220, 220, 1303, 198, 14468, 7804, 2, 198, 6978, 796, 26672, 3672, 7, 31, 834, 25664, 834, 8, 198, 198, 76, 796, 1052, 14874, 24263, 258, 485, 3419, 198, 198, 2, 5345, 510, 9447, 34, 198, 76, 19841, 25700, 7, 25, 37687, 11347, 62, 24396, 11, 1058, 36208, 8, 198, 76, 19841, 25700, 7, 25, 7890, 62, 85, 14630, 11, 366, 2481, 486, 486, 4943, 198, 76, 19841, 25700, 7, 25, 17561, 62, 85, 14630, 11, 366, 2481, 486, 486, 4943, 198, 76, 19841, 25700, 7, 25, 77, 62, 76, 71, 62, 14323, 5768, 11, 5323, 8, 198, 76, 19841, 25700, 7, 25, 77, 62, 76, 71, 62, 27372, 11, 352, 8, 198, 76, 19841, 25700, 7, 25, 77, 62, 76, 71, 62, 10899, 11, 657, 8, 198, 76, 19841, 25700, 7, 25, 77, 62, 76, 71, 62, 40871, 11, 352, 8, 198, 76, 19841, 25700, 7, 25, 76, 71, 62, 535, 11, 657, 13, 830, 20, 8, 198, 76, 19841, 25700, 7, 25, 76, 71, 62, 42552, 425, 62, 13635, 11, 3991, 8, 198, 76, 19841, 25700, 7, 25, 33979, 666, 62, 6978, 11, 4654, 6978, 7, 6978, 11, 366, 492, 1600, 366, 35790, 1600, 366, 33979, 666, 62, 3808, 17, 28, 7942, 62, 85, 600, 28, 2481, 486, 486, 13, 71, 20, 48774, 198, 198, 14323, 62, 7753, 6978, 796, 4654, 6978, 7, 6978, 11, 366, 492, 1600, 366, 35790, 1600, 366, 14323, 62, 7890, 62, 2301, 31943, 62, 504, 354, 24263, 258, 485, 13, 71, 20, 4943, 198, 361, 43519, 62, 14323, 62, 7890, 198, 220, 220, 220, 29308, 62, 7890, 7, 76, 26, 2393, 6978, 796, 985, 62, 7753, 6978, 8, 198, 437, 198, 7890, 796, 289, 20, 961, 7, 14323, 62, 7753, 6978, 11, 366, 7890, 4943, 198, 198, 7942, 62, 46965, 796, 17400, 8264, 13, 2339, 11935, 7, 76, 11, 1366, 8, 198, 198, 76, 19841, 25700, 7, 25, 82, 8770, 1025, 11, 2593, 6978, 7, 22179, 6978, 7, 15908, 3672, 7, 31, 834, 25664, 834, 828, 366, 492, 1600, 366, 492, 1600, 366, 21928, 1, 22305, 198, 198, 2, 2080, 7142, 12, 2032, 19811, 198, 76, 19841, 25700, 7, 25, 2301, 524, 62, 2032, 19811, 11, 2081, 11, 2081, 11, 366, 3808, 17, 1600, 366, 4943, 1303, 1114, 2393, 5072, 4959, 198, 76, 19841, 25700, 7, 25, 77, 62, 2301, 999, 11, 513, 8, 198, 76, 19841, 25700, 7, 25, 2301, 524, 62, 19581, 11, 360, 713, 7, 16, 5218, 3128, 62, 18302, 1403, 62, 9688, 7, 76, 828, 362, 5218, 17400, 8264, 13, 2676, 378, 62, 8230, 7, 10430, 7, 38503, 11, 513, 11, 3261, 828, 2026, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 513, 5218, 17400, 8264, 13, 2676, 378, 62, 8230, 7, 10430, 7, 38503, 11, 513, 11, 3261, 828, 1802, 22305, 198, 40406, 62, 2301, 524, 62, 2032, 19811, 62, 521, 82, 0, 7, 76, 8, 198, 76, 19841, 25700, 7, 25, 19849, 17, 1845, 64, 62, 2301, 999, 11, 360, 713, 90, 5317, 11, 2558, 92, 7, 16, 5218, 352, 11, 362, 5218, 352, 11, 513, 5218, 362, 4008, 198, 198, 1640, 1312, 287, 352, 25, 13664, 7, 76, 13, 17143, 7307, 8, 198, 220, 220, 220, 329, 479, 287, 352, 25, 17, 198, 220, 220, 220, 220, 220, 220, 220, 9104, 42316, 669, 13, 2617, 62, 2301, 524, 62, 2100, 0, 7, 76, 13, 17143, 7307, 58, 72, 4357, 479, 11, 285, 13, 17143, 7307, 58, 72, 4083, 8367, 8, 198, 220, 220, 220, 886, 198, 437, 198, 198, 17143, 62, 6759, 796, 9585, 26933, 16, 352, 362, 4357, 4129, 7, 76, 13, 17143, 7307, 4008, 198, 198, 5258, 8264, 13, 40406, 62, 17143, 62, 2301, 999, 0, 7, 76, 11, 5772, 62, 6759, 8, 198, 198, 17597, 796, 24061, 62, 10057, 7, 76, 8, 198, 198, 2301, 31943, 62, 46965, 796, 17400, 8264, 13, 2339, 11935, 7, 76, 11, 1366, 8, 198, 198, 7942, 62, 1845, 64, 796, 9104, 42316, 669, 13, 1136, 62, 27160, 7, 76, 13, 17143, 7307, 8, 198, 198, 29531, 13, 28826, 0, 7, 1558, 6052, 8, 198, 31, 9288, 2617, 366, 18243, 329, 34319, 4235, 286, 7142, 12, 2032, 19811, 1052, 14874, 24263, 258, 485, 351, 50115, 1084, 86, 417, 357, 1324, 13907, 13, 642, 82, 16725, 2221, 198, 220, 220, 220, 285, 19841, 25700, 7, 25, 40085, 1634, 62, 1078, 1791, 82, 11, 352, 8, 198, 220, 220, 220, 285, 19841, 25700, 7, 25, 40085, 1634, 62, 2676, 602, 11, 513, 8, 198, 220, 220, 220, 17400, 8264, 13, 395, 1920, 7, 76, 11, 1366, 26, 19232, 796, 3991, 8, 198, 220, 220, 220, 7377, 116, 796, 3440, 62, 19334, 82, 7, 76, 11, 1058, 14171, 8, 198, 220, 220, 220, 611, 3597, 62, 22915, 198, 220, 220, 220, 220, 220, 220, 220, 289, 20, 9654, 7, 22179, 6978, 7, 6978, 11, 366, 492, 1600, 366, 35790, 1600, 366, 2301, 524, 62, 2032, 19811, 62, 504, 354, 24263, 258, 485, 62, 37266, 14171, 62, 22915, 13, 71, 20, 12340, 366, 86, 4943, 466, 2393, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3551, 7, 7753, 11, 366, 37266, 1600, 7377, 116, 8, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 7377, 116, 15139, 230, 289, 20, 961, 7, 22179, 6978, 7, 6978, 11, 366, 492, 1600, 366, 35790, 1600, 366, 2301, 524, 62, 2032, 19811, 62, 504, 354, 24263, 258, 485, 62, 37266, 14171, 62, 22915, 13, 71, 20, 12340, 366, 37266, 4943, 198, 220, 220, 220, 886, 198, 437, 198, 76, 19841, 25700, 7, 25, 260, 40085, 1096, 11, 3991, 8, 198, 198, 31, 9288, 2617, 366, 9771, 3129, 378, 46305, 666, 286, 7142, 12, 2032, 19811, 1052, 14874, 24263, 258, 485, 357, 1324, 13907, 13, 838, 82, 16725, 2221, 198, 220, 220, 220, 503, 62, 33979, 666, 11, 4808, 796, 17400, 8264, 13, 33979, 666, 0, 7, 76, 11, 289, 20, 961, 7, 22179, 6978, 7, 6978, 11, 366, 492, 1600, 366, 35790, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 2301, 524, 62, 2032, 19811, 62, 504, 354, 24263, 258, 485, 62, 37266, 14171, 62, 22915, 13, 71, 20, 12340, 366, 37266, 12340, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1366, 26, 2198, 62, 12480, 62, 10989, 363, 796, 3991, 8, 198, 220, 220, 220, 611, 3597, 62, 22915, 198, 220, 220, 220, 220, 220, 220, 220, 289, 20, 9654, 7, 22179, 6978, 7, 6978, 11, 366, 492, 1600, 366, 35790, 1600, 366, 33979, 666, 62, 3808, 17, 28, 7942, 62, 85, 600, 28, 2481, 486, 486, 13, 71, 20, 12340, 366, 86, 4943, 466, 2393, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3551, 7, 7753, 11, 366, 33979, 666, 1600, 503, 62, 33979, 666, 8, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 618, 8914, 262, 5072, 287, 45285, 11, 262, 2482, 1283, 1180, 422, 4856, 11, 475, 262, 46305, 666, 318, 991, 6547, 1969, 198, 220, 220, 220, 220, 220, 220, 220, 611, 5415, 7, 8937, 12195, 71, 20, 961, 7, 22179, 6978, 7, 6978, 11, 366, 492, 1600, 366, 35790, 1600, 366, 33979, 666, 62, 3808, 17, 28, 7942, 62, 85, 600, 28, 2481, 486, 486, 13, 71, 20, 12340, 366, 33979, 666, 4943, 532, 503, 62, 33979, 666, 4008, 1279, 807, 68, 12, 17, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 5415, 7, 8937, 12195, 71, 20, 961, 7, 22179, 6978, 7, 6978, 11, 366, 492, 1600, 366, 35790, 1600, 366, 33979, 666, 62, 3808, 17, 28, 7942, 62, 85, 600, 28, 2481, 486, 486, 13, 71, 20, 12340, 366, 33979, 666, 4943, 532, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 503, 62, 33979, 666, 4008, 1279, 807, 68, 12, 17, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 3221, 11, 287, 45285, 290, 287, 1332, 4235, 11, 262, 46305, 666, 45104, 262, 4049, 5421, 11, 475, 1609, 11857, 453, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 262, 5415, 3580, 318, 845, 1588, 357, 68, 13, 70, 13, 319, 262, 1502, 286, 1802, 532, 8576, 828, 329, 617, 49062, 1738, 13, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 1675, 3368, 1719, 5254, 2270, 11, 356, 691, 1057, 262, 1332, 618, 356, 760, 340, 318, 11378, 13, 15323, 11, 356, 1317, 340, 355, 5445, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2488, 40539, 366, 14402, 329, 46305, 666, 286, 7142, 12, 2032, 19811, 1052, 14874, 24263, 258, 485, 4054, 11, 4274, 2198, 611, 262, 4049, 318, 49062, 393, 407, 526, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2488, 9288, 62, 25826, 5415, 7, 8937, 12195, 71, 20, 961, 7, 22179, 6978, 7, 6978, 11, 366, 492, 1600, 366, 35790, 1600, 366, 33979, 666, 62, 3808, 17, 28, 7942, 62, 85, 600, 28, 2481, 486, 486, 13, 71, 20, 12340, 366, 33979, 666, 4943, 532, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 503, 62, 33979, 666, 4008, 1279, 807, 68, 12, 17, 198, 220, 220, 220, 220, 220, 220, 220, 886, 198, 220, 220, 220, 886, 198, 437, 198, 198, 76, 19841, 25700, 7, 25, 9948, 3129, 378, 62, 33979, 666, 11, 3991, 8, 198, 76, 19841, 25700, 7, 25, 33979, 666, 62, 6978, 11, 4654, 6978, 7, 6978, 11, 366, 492, 1600, 366, 35790, 1600, 366, 33979, 666, 62, 3808, 17, 28, 7942, 62, 85, 600, 28, 2481, 486, 486, 13, 71, 20, 48774, 198, 198, 31, 9288, 2617, 366, 22362, 1920, 7142, 12, 2032, 19811, 1052, 14874, 24263, 258, 485, 351, 20752, 357, 1324, 13907, 13, 838, 82, 16725, 2221, 628, 220, 220, 220, 2488, 9288, 2081, 62, 46965, 15139, 230, 842, 31943, 62, 46965, 628, 220, 220, 220, 1303, 3310, 524, 15430, 31850, 198, 220, 220, 220, 14534, 13, 28826, 0, 7, 1558, 6052, 8, 198, 220, 220, 220, 17400, 8264, 13, 19119, 0, 7, 76, 11, 289, 20, 961, 7, 22179, 6978, 7, 6978, 11, 366, 492, 1600, 366, 35790, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 2301, 524, 62, 2032, 19811, 62, 504, 354, 24263, 258, 485, 62, 37266, 14171, 62, 22915, 13, 71, 20, 12340, 366, 37266, 48774, 198, 220, 220, 220, 17400, 8264, 13, 395, 1920, 7, 76, 11, 1366, 8, 628, 220, 220, 220, 34319, 62, 1326, 504, 796, 43030, 7, 32604, 7, 2220, 62, 19334, 82, 7, 76, 11, 1058, 12853, 828, 5391, 82, 796, 352, 4008, 628, 220, 220, 220, 2488, 9288, 4129, 7, 79, 6197, 1504, 62, 1326, 504, 8, 6624, 4129, 7, 76, 13, 17143, 7307, 8, 1635, 362, 198, 220, 220, 220, 2488, 9288, 5415, 7, 8937, 12195, 7942, 62, 1845, 64, 532, 34319, 62, 1326, 504, 4008, 1279, 764, 2816, 198, 437, 198 ]
2.308161
2,132
using SymbolicRegression, Test include("test_params.jl") _inv(x::Float32)::Float32 = 1.0f0 / x X = rand(Float32, 5, 100) .+ 1 y = 1.2f0 .+ 2 ./ X[3, :] options = SymbolicRegression.Options(; default_params..., binary_operators=(+, *), unary_operators=(_inv,), npopulations=8 ) hallOfFame = EquationSearch(X, y; niterations=8, options=options, numprocs=4) dominating = calculate_pareto_frontier(X, y, hallOfFame, options) best = dominating[end] # Test the score @test best.loss < maximum_residual / 10
[ 3500, 41327, 4160, 8081, 2234, 11, 6208, 198, 17256, 7203, 9288, 62, 37266, 13, 20362, 4943, 198, 198, 62, 16340, 7, 87, 3712, 43879, 2624, 2599, 25, 43879, 2624, 796, 352, 13, 15, 69, 15, 1220, 2124, 198, 55, 796, 43720, 7, 43879, 2624, 11, 642, 11, 1802, 8, 764, 10, 352, 198, 88, 796, 352, 13, 17, 69, 15, 764, 10, 362, 24457, 1395, 58, 18, 11, 1058, 60, 198, 198, 25811, 796, 41327, 4160, 8081, 2234, 13, 29046, 7, 26, 198, 220, 220, 220, 4277, 62, 37266, 986, 11, 13934, 62, 3575, 2024, 16193, 28200, 1635, 828, 555, 560, 62, 3575, 2024, 16193, 62, 16340, 11, 828, 299, 12924, 5768, 28, 23, 198, 8, 198, 18323, 5189, 37, 480, 796, 7889, 341, 18243, 7, 55, 11, 331, 26, 299, 2676, 602, 28, 23, 11, 3689, 28, 25811, 11, 299, 931, 305, 6359, 28, 19, 8, 198, 198, 3438, 6010, 796, 15284, 62, 79, 533, 1462, 62, 8534, 959, 7, 55, 11, 331, 11, 6899, 5189, 37, 480, 11, 3689, 8, 198, 198, 13466, 796, 30651, 58, 437, 60, 198, 2, 6208, 262, 4776, 198, 31, 9288, 1266, 13, 22462, 1279, 5415, 62, 411, 312, 723, 1220, 838, 198 ]
2.545
200
""" Covariance Matrix Adaptation Evolution Strategy Implementation: (μ/μ_I,λ)-CMA-ES The constructor takes following keyword arguments: - `μ` is the number of parents - `λ` is the number of offspring - `τ` is a time constant for a direction vector `s` - `τ_c` is a time constant for a covariance matrix `C` - `τ_σ` is a time constant for a global step size `σ` """ @kwdef struct CMAES{TT} <: AbstractOptimizer μ::Int = 1 λ::Int = μ+1 τ::TT = NaN τ_c::TT = NaN τ_σ::TT = NaN end population_size(method::CMAES) = method.μ default_options(method::CMAES) = (iterations=1500, abstol=1e-10) mutable struct CMAESState{T, TI, TT} <: AbstractOptimizerState N::Int τ::TT τ_c::TT τ_σ::TT fitpop::Vector{T} C::Matrix{T} s::Vector{T} s_σ::Vector{T} σ::T parent::TI fittest::TI function CMAESState(N::Int, τ::T1, τ_c::T2, τ_σ::T3, fitpop::Vector{T}, C::Matrix{T}, s::Vector{T}, s_σ::Vector{T}, σ::T, parent::TI, fittest::TI) where {T, TI, T1, T2, T3} TP = promote_type(T1,T2,T3) new{T,TI,TP}(N, TP(τ), TP(τ_c), TP(τ_σ), fitpop, C, s, s_σ, σ, parent, fittest) end end value(s::CMAESState) = first(s.fitpop) minimizer(s::CMAESState) = s.fittest """Initialization of CMA-ES algorithm state""" function initial_state(method::CMAES, options, objfun, population) @unpack μ,λ,τ,τ_c,τ_σ = method @assert μ < λ "Offspring population must be larger then parent population" T = typeof(value(objfun)) individual = first(population) N = length(individual) # setup time constraints τ = isnan(τ) ? sqrt(N) : τ τ_c = isnan(τ_c) ? N^2 : τ_c τ_σ = isnan(τ_σ) ? sqrt(N) : τ_σ # setup initial state return CMAESState(N, τ, τ_c, τ_σ, fill(convert(T, Inf), μ), diagm(0=>ones(T,N)), zeros(T, N), zeros(T, N), one(T), copy(individual), copy(individual) ) end function update_state!(objfun, state, population::AbstractVector{IT}, method::CMAES) where {IT} @unpack μ,λ,τ,τ_c,τ_σ = method N,σ,τ,τ_c,τ_σ = state.N, state.σ, state.τ, state.τ_c, state.τ_σ E = zeros(N, λ) W = zeros(N, λ) offspring = Array{IT}(undef, λ) fitoff = fill(Inf, λ) SqrtC = (state.C + state.C') / 2.0 try SqrtC = cholesky(SqrtC).U catch ex @error "Break on Cholesky: $ex: $(state.C)" return true end for i in 1:λ # offspring are generated by transforming standard normally distributed random vectors using a transformation matrix E[:,i] = randn(N) W[:,i] = σ * (SqrtC * E[:,i]) offspring[i] = state.parent + W[:,i] # (L1) fitoff[i] = value(objfun, offspring[i]) # Evaluate fitness end # Select new parent population idx = sortperm(fitoff)[1:μ] for i in 1:μ population[i] = offspring[idx[i]] state.fitpop[i] = fitoff[idx[i]] end w = vec(mean(W[:,idx], dims=2)) ɛ = vec(mean(E[:,idx], dims=2)) state.parent += w # forming recombinant perent for next generation (L2) state.s = (1.0 - 1.0/τ)*state.s + (sqrt(μ/τ * (2.0 - 1.0/τ))/σ)*w # (L3) state.C = (1.0 - 1.0/τ_c).*state.C + (state.s./τ_c)*state.s' # (L4) state.s_σ = (1.0 - 1.0/τ_σ)*state.s_σ + sqrt(μ/τ_σ*(2.0 - 1.0/τ_σ))*ɛ # (L5) state.σ = σ*exp(((state.s_σ'*state.s_σ)[1] - N)/(2*N*sqrt(N))) state.fittest = population[1] return false end
[ 37811, 198, 34, 709, 2743, 590, 24936, 30019, 341, 15815, 20561, 46333, 25, 357, 34703, 14, 34703, 62, 40, 11, 39377, 13219, 34, 5673, 12, 1546, 198, 198, 464, 23772, 2753, 1708, 21179, 7159, 25, 198, 198, 12, 4600, 34703, 63, 318, 262, 1271, 286, 3397, 198, 12, 4600, 39377, 63, 318, 262, 1271, 286, 20791, 198, 12, 4600, 32830, 63, 318, 257, 640, 6937, 329, 257, 4571, 15879, 4600, 82, 63, 198, 12, 4600, 32830, 62, 66, 63, 318, 257, 640, 6937, 329, 257, 44829, 590, 17593, 4600, 34, 63, 198, 12, 4600, 32830, 62, 38392, 63, 318, 257, 640, 6937, 329, 257, 3298, 2239, 2546, 4600, 38392, 63, 198, 37811, 198, 31, 46265, 4299, 2878, 327, 5673, 1546, 90, 15751, 92, 1279, 25, 27741, 27871, 320, 7509, 198, 220, 220, 220, 18919, 3712, 5317, 796, 352, 198, 220, 220, 220, 7377, 119, 3712, 5317, 796, 18919, 10, 16, 198, 220, 220, 220, 46651, 3712, 15751, 220, 220, 220, 796, 11013, 45, 198, 220, 220, 220, 46651, 62, 66, 3712, 15751, 220, 796, 11013, 45, 198, 220, 220, 220, 46651, 62, 38392, 3712, 15751, 220, 796, 11013, 45, 198, 437, 198, 39748, 62, 7857, 7, 24396, 3712, 34, 5673, 1546, 8, 796, 2446, 13, 34703, 198, 12286, 62, 25811, 7, 24396, 3712, 34, 5673, 1546, 8, 796, 357, 2676, 602, 28, 33698, 11, 16552, 349, 28, 16, 68, 12, 940, 8, 198, 198, 76, 18187, 2878, 327, 5673, 1546, 9012, 90, 51, 11, 31598, 11, 26653, 92, 1279, 25, 27741, 27871, 320, 7509, 9012, 198, 220, 220, 220, 399, 3712, 5317, 198, 220, 220, 220, 46651, 3712, 15751, 198, 220, 220, 220, 46651, 62, 66, 3712, 15751, 198, 220, 220, 220, 46651, 62, 38392, 3712, 15751, 198, 220, 220, 220, 4197, 12924, 3712, 38469, 90, 51, 92, 198, 220, 220, 220, 327, 3712, 46912, 90, 51, 92, 198, 220, 220, 220, 264, 3712, 38469, 90, 51, 92, 198, 220, 220, 220, 264, 62, 38392, 3712, 38469, 90, 51, 92, 198, 220, 220, 220, 18074, 225, 3712, 51, 198, 220, 220, 220, 2560, 3712, 25621, 198, 220, 220, 220, 43500, 395, 3712, 25621, 198, 220, 220, 220, 2163, 327, 5673, 1546, 9012, 7, 45, 3712, 5317, 11, 46651, 3712, 51, 16, 11, 46651, 62, 66, 3712, 51, 17, 11, 46651, 62, 38392, 3712, 51, 18, 11, 4197, 12924, 3712, 38469, 90, 51, 5512, 327, 3712, 46912, 90, 51, 5512, 198, 220, 220, 220, 220, 220, 220, 220, 264, 3712, 38469, 90, 51, 5512, 264, 62, 38392, 3712, 38469, 90, 51, 5512, 18074, 225, 3712, 51, 11, 2560, 3712, 25621, 11, 43500, 395, 3712, 25621, 8, 810, 1391, 51, 11, 31598, 11, 309, 16, 11, 309, 17, 11, 309, 18, 92, 198, 220, 220, 220, 220, 220, 220, 220, 24525, 796, 7719, 62, 4906, 7, 51, 16, 11, 51, 17, 11, 51, 18, 8, 198, 220, 220, 220, 220, 220, 220, 220, 649, 90, 51, 11, 25621, 11, 7250, 92, 7, 45, 11, 24525, 7, 32830, 828, 24525, 7, 32830, 62, 66, 828, 24525, 7, 32830, 62, 38392, 828, 4197, 12924, 11, 327, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 264, 11, 264, 62, 38392, 11, 18074, 225, 11, 2560, 11, 43500, 395, 8, 198, 220, 220, 220, 886, 198, 437, 198, 8367, 7, 82, 3712, 34, 5673, 1546, 9012, 8, 796, 717, 7, 82, 13, 11147, 12924, 8, 198, 1084, 320, 7509, 7, 82, 3712, 34, 5673, 1546, 9012, 8, 796, 264, 13, 69, 715, 395, 198, 198, 37811, 24243, 1634, 286, 327, 5673, 12, 1546, 11862, 1181, 37811, 198, 8818, 4238, 62, 5219, 7, 24396, 3712, 34, 5673, 1546, 11, 3689, 11, 26181, 12543, 11, 3265, 8, 198, 220, 220, 220, 2488, 403, 8002, 18919, 11, 39377, 11, 32830, 11, 32830, 62, 66, 11, 32830, 62, 38392, 796, 2446, 198, 220, 220, 220, 2488, 30493, 18919, 1279, 7377, 119, 366, 9362, 16469, 3265, 1276, 307, 4025, 788, 2560, 3265, 1, 628, 220, 220, 220, 309, 796, 2099, 1659, 7, 8367, 7, 26801, 12543, 4008, 198, 220, 220, 220, 1981, 796, 717, 7, 39748, 8, 198, 220, 220, 220, 399, 796, 4129, 7, 43129, 8, 628, 220, 220, 220, 1303, 9058, 640, 17778, 198, 220, 220, 220, 46651, 796, 2125, 272, 7, 32830, 8, 5633, 19862, 17034, 7, 45, 8, 1058, 46651, 198, 220, 220, 220, 46651, 62, 66, 796, 2125, 272, 7, 32830, 62, 66, 8, 5633, 399, 61, 17, 1058, 46651, 62, 66, 198, 220, 220, 220, 46651, 62, 38392, 796, 2125, 272, 7, 32830, 62, 38392, 8, 5633, 19862, 17034, 7, 45, 8, 1058, 46651, 62, 38392, 628, 220, 220, 220, 1303, 9058, 4238, 1181, 198, 220, 220, 220, 1441, 327, 5673, 1546, 9012, 7, 45, 11, 46651, 11, 46651, 62, 66, 11, 46651, 62, 38392, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6070, 7, 1102, 1851, 7, 51, 11, 4806, 828, 18919, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2566, 363, 76, 7, 15, 14804, 1952, 7, 51, 11, 45, 36911, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1976, 27498, 7, 51, 11, 399, 828, 1976, 27498, 7, 51, 11, 399, 828, 530, 7, 51, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4866, 7, 43129, 828, 4866, 7, 43129, 8, 1267, 198, 437, 198, 198, 8818, 4296, 62, 5219, 0, 7, 26801, 12543, 11, 1181, 11, 3265, 3712, 23839, 38469, 90, 2043, 5512, 2446, 3712, 34, 5673, 1546, 8, 810, 1391, 2043, 92, 198, 220, 220, 220, 2488, 403, 8002, 18919, 11, 39377, 11, 32830, 11, 32830, 62, 66, 11, 32830, 62, 38392, 796, 2446, 198, 220, 220, 220, 399, 11, 38392, 11, 32830, 11, 32830, 62, 66, 11, 32830, 62, 38392, 796, 1181, 13, 45, 11, 1181, 13, 38392, 11, 1181, 13, 32830, 11, 1181, 13, 32830, 62, 66, 11, 1181, 13, 32830, 62, 38392, 628, 220, 220, 220, 412, 796, 1976, 27498, 7, 45, 11, 7377, 119, 8, 198, 220, 220, 220, 370, 796, 1976, 27498, 7, 45, 11, 7377, 119, 8, 198, 220, 220, 220, 20791, 796, 15690, 90, 2043, 92, 7, 917, 891, 11, 7377, 119, 8, 198, 220, 220, 220, 4197, 2364, 796, 6070, 7, 18943, 11, 7377, 119, 8, 628, 220, 220, 220, 311, 80, 17034, 34, 796, 357, 5219, 13, 34, 1343, 1181, 13, 34, 11537, 1220, 362, 13, 15, 198, 220, 220, 220, 1949, 198, 220, 220, 220, 220, 220, 220, 220, 311, 80, 17034, 34, 796, 442, 4316, 2584, 7, 50, 80, 17034, 34, 737, 52, 198, 220, 220, 220, 4929, 409, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 18224, 366, 31737, 319, 609, 4316, 2584, 25, 720, 1069, 25, 29568, 5219, 13, 34, 16725, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2081, 198, 220, 220, 220, 886, 628, 220, 220, 220, 329, 1312, 287, 352, 25, 39377, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 20791, 389, 7560, 416, 25449, 3210, 7685, 9387, 4738, 30104, 1262, 257, 13389, 17593, 198, 220, 220, 220, 220, 220, 220, 220, 412, 58, 45299, 72, 60, 796, 43720, 77, 7, 45, 8, 198, 220, 220, 220, 220, 220, 220, 220, 370, 58, 45299, 72, 60, 796, 18074, 225, 1635, 357, 50, 80, 17034, 34, 1635, 412, 58, 45299, 72, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 20791, 58, 72, 60, 796, 1181, 13, 8000, 1343, 370, 58, 45299, 72, 60, 220, 220, 1303, 357, 43, 16, 8, 198, 220, 220, 220, 220, 220, 220, 220, 4197, 2364, 58, 72, 60, 796, 1988, 7, 26801, 12543, 11, 20791, 58, 72, 12962, 1303, 26439, 4985, 13547, 198, 220, 220, 220, 886, 628, 220, 220, 220, 1303, 9683, 649, 2560, 3265, 198, 220, 220, 220, 4686, 87, 796, 3297, 16321, 7, 11147, 2364, 38381, 16, 25, 34703, 60, 198, 220, 220, 220, 329, 1312, 287, 352, 25, 34703, 198, 220, 220, 220, 220, 220, 220, 220, 3265, 58, 72, 60, 796, 20791, 58, 312, 87, 58, 72, 11907, 198, 220, 220, 220, 220, 220, 220, 220, 1181, 13, 11147, 12924, 58, 72, 60, 796, 4197, 2364, 58, 312, 87, 58, 72, 11907, 198, 220, 220, 220, 886, 628, 220, 220, 220, 266, 796, 43030, 7, 32604, 7, 54, 58, 45299, 312, 87, 4357, 5391, 82, 28, 17, 4008, 198, 220, 220, 220, 220, 133, 249, 796, 43030, 7, 32604, 7, 36, 58, 45299, 312, 87, 4357, 5391, 82, 28, 17, 4008, 198, 220, 220, 220, 1181, 13, 8000, 15853, 266, 220, 220, 220, 220, 1303, 220, 14583, 44759, 42483, 279, 9100, 329, 1306, 5270, 357, 43, 17, 8, 198, 220, 220, 220, 1181, 13, 82, 796, 357, 16, 13, 15, 532, 352, 13, 15, 14, 32830, 27493, 5219, 13, 82, 1343, 357, 31166, 17034, 7, 34703, 14, 32830, 1635, 357, 17, 13, 15, 532, 352, 13, 15, 14, 32830, 4008, 14, 38392, 27493, 86, 220, 220, 220, 220, 1303, 357, 43, 18, 8, 198, 220, 220, 220, 1181, 13, 34, 796, 357, 16, 13, 15, 532, 352, 13, 15, 14, 32830, 62, 66, 737, 9, 5219, 13, 34, 1343, 357, 5219, 13, 82, 19571, 32830, 62, 66, 27493, 5219, 13, 82, 6, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 357, 43, 19, 8, 198, 220, 220, 220, 1181, 13, 82, 62, 38392, 796, 357, 16, 13, 15, 532, 352, 13, 15, 14, 32830, 62, 38392, 27493, 5219, 13, 82, 62, 38392, 1343, 19862, 17034, 7, 34703, 14, 32830, 62, 38392, 9, 7, 17, 13, 15, 532, 352, 13, 15, 14, 32830, 62, 38392, 4008, 9, 133, 249, 1303, 357, 43, 20, 8, 198, 220, 220, 220, 1181, 13, 38392, 796, 18074, 225, 9, 11201, 19510, 7, 5219, 13, 82, 62, 38392, 6, 9, 5219, 13, 82, 62, 38392, 38381, 16, 60, 532, 399, 20679, 7, 17, 9, 45, 9, 31166, 17034, 7, 45, 22305, 628, 220, 220, 220, 1181, 13, 69, 715, 395, 796, 3265, 58, 16, 60, 628, 220, 220, 220, 1441, 3991, 198, 437, 198 ]
2.058577
1,673