I’m interested in writing an OpenGL app in JOGL 2, using shaders instead of the fixed-function pipeline. I’ll need to do a fair bit of 4×4 double-precision matrix math CPU-side, to replace the fixed function pipeline’s push/pop/transform business. The same app is also going to include some machine learning code that will require operations on large matrices. I’ve looked at JBLAS for machine learning stuff (and since I’m already using JNI for JOGL, there’re minimal downsides to depending on another native library)), but I’m not sure if it’s the best choice for GL-related matrices. Thoughts?
Share
Do you only need to manipulate 4×4 matrices? Most general purpose linear algebra libraries have been highly optimized for large matrices with little attention put into smaller ones. Part of the reason I wrote EJML was to address this issue and to motivate other developers to optimize for small matrices. EJML is the fastest for small matrices, but it is possible to do better.
If you really need a lot of performance I would not use any of the usual suspects and instead roll your own highly specialized code. It should be possible to beat general purpose libraries by several times.
Simple example for 2×2 matrix:
Note I have not tried to compile this code, it is just an example.