wrathematics / float

Single precision (float) matrices for R.
Other
46 stars 12 forks source link

Internal float representation #5

Closed dselivanov closed 6 years ago

dselivanov commented 6 years ago

Don't you think that approach taken by bit64 package can be useful for float? Similarly we can store float32 as R's int but with additional attribute. This will allow to overcome some issues you described in readme. Also it will allow to easily serialize/deserialize objects..

wrathematics commented 6 years ago

What issues are you referring to?

I originally decided against something like that because strictly speaking, an int and a float are not guaranteed to be the same size. I suppose I could configure test. The other advantage to this approach is that it's pretty easy to create a no-copy-on-modify interface.

I don't think it would be too hard to modify what's already there to operate on ints instead. I'll play around with it this evening.

dselivanov commented 6 years ago

Minor issue when small objects have storage overhead due to usage of xptr.

wrathematics commented 6 years ago

Unfortunately the storage overhead is mostly from the S4 object, which is necessary for the multiple dispatch. It definitely makes serializing easier though.

I've started the conversion in this branch. There were a few representation problems I had to think about for a bit longer than I expected. But I've converted over binary arithmetic operations, which I think will be the hardest. So the rest is just making some minor changes. I'll try to finish the conversion this weekend.

wrathematics commented 6 years ago

Implemented in latest.

dselivanov commented 6 years ago

Cool! Will try it out tomorrow.

18 окт. 2017 г. 21:01 пользователь "Drew Schmidt" notifications@github.com написал:

Implemented in latest.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/wrathematics/float/issues/5#issuecomment-337658243, or mute the thread https://github.com/notifications/unsubscribe-auth/AE4u3SBywe8tnLZI4SGgjl7RAVbHfpaCks5sti7MgaJpZM4Pz5Zd .

dselivanov commented 6 years ago

Sorry haven't had a chance to check today. Will be traveling next 2 weeks, so will take a look and leave feedback after returning.

18 окт. 2017 г. 21:09 пользователь "Dmitriy Selivanov" < selivanov.dmitriy@gmail.com> написал:

Cool! Will try it out tomorrow.

18 окт. 2017 г. 21:01 пользователь "Drew Schmidt" < notifications@github.com> написал:

Implemented in latest.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/wrathematics/float/issues/5#issuecomment-337658243, or mute the thread https://github.com/notifications/unsubscribe-auth/AE4u3SBywe8tnLZI4SGgjl7RAVbHfpaCks5sti7MgaJpZM4Pz5Zd .

wrathematics commented 6 years ago

No worries. I'd definitely appreciate any feedback you have whenever you get a chance.

dselivanov commented 6 years ago

Works amazingly! Also I believe now it is much simpler to create Rcpp extensions. Excellent work, thank you very much.

wrathematics commented 6 years ago

Thanks! Yes, long-term I'd like to create (or see someone else create) an RcppArmadillo counterpart that uses the fmat / Mat<float> interface. There's a package vignette now that describes the things a developer might need to know about the package. Hopefully it's useful.