Missing overload of evaluate function for scalars

Issue #144 resolved
Marcin Copik created an issue

I noticed that evaluate can't be apply to expressions which result is a scalar value, for example:

blaze::DynamicVector<double> v1(10), v2(10);
auto x = blaze::evaluate(blaze::trans(v1) * v2);

does not compile since evaluate is defined only for Matrix and Vector types. I fixed it by adding another overload

template< typename T, typename = std::enable_if_t<std::is_floating_point<T>::value || std::is_integral<T>::value> >
inline T evaluate( const T & result)
{
   return result;
}

It seems to work. I'd like to contribute a patch but I'm not sure where this function should be declared. Should I create a new file math/expressions/Scalar.h?

Comments (6)

  1. Klaus Iglberger

    Commit ca310df adds a generic evaluate() function for fundamental and complex data types. The new evaluate() function is immediately available via cloning the Blaze repository and will be officially released in Blaze 3.3.

  2. Log in to comment