1

I am writing a class wrapper for a linear algebra class - eigen for now - because I do not want to expose my code to the internals of the library (or its design) and was wondering if there is a way to write an interface without destroying the internal optimazations (eigen uses expression templates).

I already found two threads but both seem not to keep these optimizations. Both use template specialization. Here are the threads:

This optimization is not the most critical thing but any advice would be appreciated.

Konrad
  • 11
  • 2
  • 2
    To be honest I don't see why you want to reinvent the wheel. It sounds like a lot of work just because you want to come up with your own syntax. Potentially you want to combine some feature of different libraries, but then I would just write a function for the specific operation you want. – Tom de Geus Jul 03 '18 at 11:38
  • 1
    Thanks, Tom. I do not want to reinvent the wheel but what is important is to stay independent from internals of the linAlg library when requirements change (in particular with respect to robustness). It should be easy to replace the library without digging in the entire code but just in the interface. A second reason for the wrapper is testing (you can test its use of dependencies easier). – Konrad Jul 03 '18 at 13:27
  • Wrapping around Eigen's expression templates without exposing anything from Eigen sounds almost like re-implementing most of Eigen to me as well. You can with some effort write a wrapper which always returns by value (and hope for RVO) -- this could then easily wrap around any BLAS implementation. If you simply don't like the syntax of (parts of) Eigen, you can add your own typedefs and make simple wrapper functions, which just pass-through everything. – chtz Jul 04 '18 at 13:14
  • Thank you, that's what I feared. Iguess the solution with typedefs etc is the simplest and most convenient for now. – Konrad Jul 04 '18 at 13:28

0 Answers0