Question

I need an alternative to the std library's matrix functions, preferably one that is fast and very portable. It needs to be thread safe, able to do operations like matrix multiplication, and it needs to support 16-bit integers. I looked at the "Basic Linear Algebra Subprograms" Wikipedia page, and could not find what I needed. Google isn't much help either. I've run into some near-hits like Eigen and dlib, but nothing that exactly matches my needs. Does anyone know of a good alternative library for me?

Thank you in advance!

Était-ce utile?

La solution

I'm not sure such a thing exists, because making it thread safe without knowing the usage pattern would make it not very parallel. That is the only thing you could do to a matrix lib to make it thread safe would be to lock the entire lib whenever it is being used - essentially making it non-parallel.

Write or find your own mutex class, and then protect your matrix math operations with mutexes.

That is derive from the basic matrix classes to add mutexes, and then right before operating on any matrix object lock its mutex. With a little knowledge of your usage pattern you can make that way more parallel than could be done if the locking happened in the library.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top