gaioguys / GAIO.jl

A Julia package for set oriented computations.
MIT License
8 stars 4 forks source link

Initialisation of vector #104

Closed b-wuyts closed 6 months ago

b-wuyts commented 6 months ago

I am having difficulties with obtaining the right data structure when creating an initial condition for the Markov chain of a 4D dynamical system. I am trying to initialise a vector x0 with value 1.0 in one box and 0.0 elsewhere (following the example here):

key = point_to_key(S.partition,(274,.1,.1,.1)) weights = Dict(keyi => (keyi == key ? 1.0 : 0.0) for keyi in S.set) x0 = BoxFun(S, weights)

This gives a dictionary in which the keys appear twice:

julia> x0.vals OrderedDict{NTuple{4, Int64}, Pair{NTuple{4, Int64}, Float64}} with 1674000 entries: (113, 73, 56, 78) => (113, 73, 56, 78)=>0.0 (7, 20, 33, 86) => (7, 20, 33, 86)=>0.0 (78, 76, 94, 44) => (78, 76, 94, 44)=>0.0 (30, 24, 17, 64) => (30, 24, 17, 64)=>0.0 (54, 74, 83, 55) => (54, 74, 83, 55)=>0.0 (36, 79, 61, 89) => (36, 79, 61, 89)=>0.0 (67, 79, 59, 89) => (67, 79, 59, 89)=>0.0 (62, 51, 54, 42) => (62, 51, 54, 42)=>0.0 (38, 33, 30, 53) => (38, 33, 30, 53)=>0.0 (11, 44, 57, 62) => (11, 44, 57, 62)=>0.0 (18, 55, 61, 15) => (18, 55, 61, 15)=>0.0 (52, 32, 27, 51) => (52, 32, 27, 51)=>0.0 ⋮ => ⋮

I am not sure whether this is a bug or if I am doing something wrong.

b-wuyts commented 6 months ago

After seeing that BoxFun has several overloaded alternatives, I realised that I used the wrong combination of arguments. This resolved it:

x0=BoxFun(S.partition,weights)