Last active
July 24, 2016 11:56
-
-
Save OXPHOS/8f2d048e71df1dfc98bb7e2f0953c30e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LinalgBackendBase | |
{ | |
public: | |
/** | |
* Wrapper method that computes mean of SGVectors and SGMatrices. | |
* | |
* @see linalg::mean | |
*/ | |
#define BACKEND_GENERIC_COMPLEX_MEAN(Type, Container) \ | |
virtual typename std::enable_if<std::is_same<Type, complex128_t>::type, complex128_t>::type \ | |
mean_test(const Container<Type>& a) const \ | |
{ \ | |
SG_SNOTIMPLEMENTED; \ | |
} | |
BACKEND_GENERIC_COMPLEX_MEAN(int8_t, SGVector) | |
#undef BACKEND_GENERIC_COMPLEX_MEAN | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename T, template <typename> class Container> | |
typename std::enable_if<std::is_same<T, complex128_t>::type, complex128_t>::type | |
mean_test(const Container<T>& a) | |
{ | |
REQUIRE(a.size() > 0, "Vector/Matrix cannot be empty!\n"); | |
return infer_backend(a)->mean(a); | |
} | |
template <typename T, template <typename> class Container> | |
typename std::enable_if<!std::is_same<T, complex128_t>::type, complex128_t>::type | |
mean_test(const Container<T>& a) | |
{ | |
REQUIRE(a.size() > 0, "Vector/Matrix cannot be empty!\n"); | |
return infer_backend(a)->mean(a); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment