0

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!

Craw
  • 3
  • 1
  • I don't know that it satisfies all of your requirements, but have you looked at Boost UBLAS? – Sam DeHaan Jun 27 '12 at 19:30
  • This may be hard to find, since the spec requires `int` to be 32 bits or larger. A templated library (which a Boost library is likely to be) may be your only hope. – ssube Jun 27 '12 at 20:05

1 Answers1

1

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.

Rafael Baptista
  • 11,181
  • 5
  • 39
  • 59
  • That wasn't exactly the answer I was looking for, but since you're the only one who answered the question (aside from the comments) and since nobody else is going to give an answer, I'm going to say your answer is the accepted answer. Thank you for offering a solution. – Craw Jul 10 '12 at 16:49