Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change internal representation of composition #8

Closed
juliohm opened this issue Sep 13, 2020 · 3 comments
Closed

Change internal representation of composition #8

juliohm opened this issue Sep 13, 2020 · 3 comments

Comments

@juliohm
Copy link
Member

juliohm commented Sep 13, 2020

I think we can drop the dependency on static arrays and use plain named tuples moving forward. Given that composition objects are never treated as plain vectors, we don't gain much from the default linear algebra behavior of static arrays.

@mralbu
Copy link
Member

mralbu commented Sep 13, 2020

I'd like to experiment with compositional data kriging, using GeoStats.jl, in the future.
Do you think there could be gains of maintaining the compositions as static arrays for this application?

@juliohm
Copy link
Member Author

juliohm commented Sep 13, 2020

Oh that is nice! I had this application in mind as well. It would be great if you could push it forward and see if it already works, or what needs to be changed to make it work.

The idea of working with composition objects and Julia generics is that we don't need to know about the internal representation of the type. I think the transformations ilr, alr, clr should still return static vectors, I agree.

Hopefully we will be able to just have a spatial set of composition objects and feed it into Kriging without issues. But let's see how it goes. :)

@juliohm
Copy link
Member Author

juliohm commented Sep 28, 2020

I did some refactoring, and ended up preserving the internal SVector as well. The only thing I don't like about this representation is that the getproperty implementation is not very elegant. The getproprety method allows us to access specific parts of the composition by name:

c = Composition(a=1.0, b=2.0, c=missing)

c.a == 1
c.b == 2

ismissing(c.c)

and currently it loops in the names of the parts until it finds the symbol. Maybe the compiler is optimizing this loop given that everything is static. I didn't have time to check though.

@juliohm juliohm closed this as completed Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants