tpapp / TransformVariables.jl

Transformations to contrained variables from ℝⁿ.
Other
66 stars 14 forks source link

Nested vector transformations in tuple repeat #59

Closed scheidan closed 5 years ago

scheidan commented 5 years ago

Sorry for the cryptic title!

I hope the example below is clearer. It seems that only the first transformations in the tuple a is used and the output repeated:

tt = as((
    a = as((as(Vector, asℝ₊, 2), as(Vector, asℝ₊, 2), as(Vector, asℝ₊, 2))),
    b = as((UnitVector(2), UnitVector(2), UnitVector(2)))
))

y = 1.0:dimension(tt)
x = tt(y)    

# this are all the same!
x.a[1]
x.a[2]
x.a[3]
x.a[1] .== x.a[2] .== x.a[3] # [true, true]

# works as expected
x.b[1]
x.b[2]
x.b[3]
x.b[1] .== x.b[2] .== x.b[3] # [false, false]

Somehow the index seems to be off.

scheidan commented 5 years ago

My bad, this is already fixed on master. Sorry for the noise!

tpapp commented 5 years ago

No problem. I was waiting for #56 before tagging a release, but if you have no time for a revision now I can just do it before (eg now). No pressure, just let me know.

scheidan commented 5 years ago

Thanks! Any time next week would be handy for me, but no rush