tpapp / TransformVariables.jl

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

Vectorizing scalar transforms? #61

Closed tkf closed 4 years ago

tkf commented 4 years ago

It would be nice if I can create "vectorized" versions of scalar transforms, maybe using something like as(Array, as𝕀, 10) such that

transform(as(Array, as𝕀, size(xs)...), xs) == transform.(as𝕀, xs)

Alternative syntaxes may be

as(Array, 0..1, 10)  # using IntervalSets: (..)
as(Array, 10, Real 0, 1)

Is it in the scope of this package?

tpapp commented 4 years ago

I am not sure I understand the question correctly. The following works fine already:

using TransformVariables
t = as(Array, as𝕀, 10)
x = rand(dimension(t))
t(x)
transform_and_logjac(t, x)

Perhaps I should just improve the docs?

tkf commented 4 years ago

Thanks, I didn't know it works already. To be honest it wasn't clear from the docs that it's possible.

tkf commented 4 years ago

It's great that even things like as(Array, as(Array, as𝕀, 3), 2) work :)