Skip to content

Instantly share code, notes, and snippets.

@khalednasr
Created July 8, 2014 13:33
Show Gist options
  • Save khalednasr/92acd8aa23d7ae26196d to your computer and use it in GitHub Desktop.
Save khalednasr/92acd8aa23d7ae26196d to your computer and use it in GitHub Desktop.
// default backend should be set to the global backend
template <class T, Backend backend=Backend::EIGEN3>
class ComputeMatrix
{
};
// If the backend is Eigen3, use SGMatrix
template <> template <class T>
class ComputeMatrix<T,Backend::EIGEN3> : public SGMatrix<T>
{
using SGMatrix<T>::SGMatrix;
public:
ComputeMatrix(const SGMatrix<T>& cpu_mat) : SGMatrix<T>(cpu_mat)
{
}
};
// If the backend is ViennacL, use CGPUMatrix
template <> template <class T>
class ComputeMatrix<T,Backend::VIENNACL> : public CGPUMatrix<T>
{
using CGPUMatrix<T>::CGPUMatrix;
public:
ComputeMatrix(const CGPUMatrix<T>& mat) : CGPUMatrix<T>(mat)
{
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment