Question

Although a feature-rich library, Alglib seems to lack support for the most common, basic operators out there (involved in matrix/vector algebra).

Is the user supposed to overload whatever operators they need themselves, or is there a more performance-friendly/advisable way of achieving multiplication, addition, subtraction, division (by scalars) etc. using the existing Alglib interface?

As a related question, I find the proposed and accepted solution quite dissatisfactory. Usually, one does not simply switch to another library when they already have a good one in place. I just found the need to perform these operations more often and switching to another, more cumbersome alternative is not the best thing (MTL4 uses boost, and that is quite a burden). The idea of using expression templates seems nice though, but I don't know if it's worth implementing this technique over Alglib (that is, if Alglib has a better way of dealing with simple algebra).

Was it helpful?

Solution

I have overloaded the operators in order to achieve these relative basic functions in Alglib. I didn't find any other way to do this in Alglib and don't believe it's available looking at the other questions and answers about the topic.

I read that don't like to switch to another library, but I would suggest to take a quick look at Eigen. For me it was quite easy to set it up as I've already had the libraries as part of the PointCloudLibrary that I have installed. Furthermore the documentation is quite good and I perform the needed operations much faster.

The normal library documentation can be found: (Check section Arithmic Operators)
Eigen Quick Reference Guide

Beside the normal documentation it also has an unsupported section with less documentation but with more algorithms like solvers, FFT, polynomials, fitting:
Eigen Unsupported

I know that for my application I will remove the Alglib stuff and change to Eigen as it works more intuitive and according to me the documentation is better.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top