oschulz / AffineMaps.jl

Affine affine transformations in Julia
Other
3 stars 1 forks source link

Comparison to CoordinateTransformations.jl? #1

Open rafaqz opened 1 year ago

rafaqz commented 1 year ago

Just wondering what the differences are and if AffineMaps.AffineMap can be swapped in for CoordinateTransformations.AffineMap, as CoordinateTransformations.jl is a surprisingly heavy dependency.

oschulz commented 1 year ago

@rafaqz Yes, that's kinda the general motivation behind it, making a lightweight package with a solid CPU/GPU-friendly affine map implementation that heavier packages can reuse.

The design will likely change a bit for v0.2 - I'll move most most dependencies into Pkg extensions and I may get rid of AffineStep in favor of fixed types Add, Mul, MulAdd, AddMul (and their inverses).

oschulz commented 1 year ago

MeasureBase.jl will use this package in the future to generate multivariate normal measures. Space transformations witll be my own main use case. But it might also be useful for simple fully connected ML-layers (activation would be separate), etc.

v0.1 is just a first (but functional) draft and certainly open to changes/suggestions for v0.2 and up.

I also plan to support (via Pkg extensions) APIs like LinearMaps.jl, SciMLOperators.jl (it supports affine operators), Functors.jl and so on.

oschulz commented 1 year ago

On important concept in here is that we have the ability to express both "mul-then-add" and "add-then-mul" which packages like MeasureBase (CC @cscherrer) will need. The "matrix" used in the rotation may not be an actual matrix, it can be an operator that is only defined by it's mul-method. So b + A*x can't be "converted" into A2 * x + b2 if A is implicit and we need to be able to represent both.

rafaqz commented 1 year ago

Thanks. I have a fairly simple use case, mapping to and from rotated or skewed geotransforms in Rasters.jl.

oschulz commented 1 year ago

Ok, I'll make sure that AffineMaps supports StaticArrays properly, then.

oschulz commented 1 year ago

@rafaqz I just released v0.2 with the new API. It should hopefully "just work" with StaticArrays, but if not we can add a Pkg extension to specialize methods.

Let me know if you need additional features, this new API is definitely open for evolution. We can always make a v0.3 and so on.

CC @cscherrer