Question

I would like to know how one goes about adding functionality from one open source c++ library to another. To make things concrete, here is an example. I really like the "find" function in the Armadillo library and now that i find myself using eigen more i kinda miss it. How hard would it be to write an equivalent of "find" that would be fully integrated into eigen (i.e. using eigen objects etc...)? How does one go about doing this? Where can i find the source code of the "find" function?

thanks in advance,

Was it helpful?

Solution

You will have to write it on your own, taking into consideration differences between libraries. It may require some knowledge about the library that you are trying to extend, though.

Start from reading the code of armadillo, to understand what they do in this function. Then proceed to understand how analogous structures are implemented in eigen and modify the code. If you want to integrate it into eigen, so that you need to link against only one library (only your custom eigen, not standard eigen and your custom eigen extensions), you will need to compile eigen with your files added to a Makefile/Cmake (or whatever eigen is using).

You can find sources of armadillo in tar.gz archive here: http://arma.sourceforge.net/download.html

If you ask where is find operator in armadillo sources, check include/armadillo_bits/op_find_bones.hpp and include/armadillo_bits/op_find_meat.hpp

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