scalanlp / breeze

Breeze is/was a numerical processing library for Scala.
https://www.scalanlp.org
Apache License 2.0
3.45k stars 692 forks source link

Put Spire into Breeze? #727

Closed Make42 closed 5 years ago

Make42 commented 6 years ago

I use breeze's collections (namely DenseVector), in which I have integers and doubles and the like, and use them a little like you might use numpy's arrays. I stumbled upon https://github.com/non/spire. My impression is, it is not so strong on collection, but stronger on types that I might want to put inside of collections - e.g. Interval sounds awesome. Is my impression right and would be combining them a good idea?

From https://stackoverflow.com/a/40474914/4533188 I learned that Breeze uses netlib-java to be really fast. Would I destroy that speed if I put descendants of AnyRef (in this case from Spire) into the DenseVectors back-end Arrays instead of descendants of AnyVal?

dlwh commented 5 years ago

combining them has come up many times before, and if I had the time and inclination, i would probably replace Breeze's algebra typeclasses with Spire's. But to answer your question, yes, you will lose a lot of performance if you use anything other than floats or doubles. Ints are reasonably fast, but they're backed by java/scala code, not by fortran or native code.