fixed to work on recent C++ compilers
added support for eigen