-
Notifications
You must be signed in to change notification settings - Fork 5
Description
As compile time optimization of expressions are not possible due to constexpr limitations. We fall back to runtime optimization strategy that uses std::variant to optimize the expression at runtime. This has already been implemented for scalar law at this branch.
We will add this support to the main expr template branch and provide a compile-time configuration flag like BOOST_UBLAS_ENABLE_OPTIMIZATION to turn the optimizations before evaluation.
We wish to support some basic optimization operations as of now, they are mentioned below :
- a + a = 2a (scalar addition)
- 3b - 2b = b (scalar subtraction)
- ab + ac = a(b+c) (Distributive law)
We will also provide a way to enable recursive optimization to some of the above rules to some extent.
This will still be experimental feature and we cannot guarantee that we could always optimize an expression that could be optimized. Simplifying Expression is an NP Hard problem.
BY DEFAULT THE EXPRESSIONS WILL NOT BE OPTIMIZED, UNLESS USER DEFINES THE CONFIGURATION MACRO. IF ENABLED, USER MUST MAKE SURE THAT ALL FUNDAMENTAL OPERATOR OVERLOADS FOR tensor::value_type EXISTS,