Skip to content

Instantly share code, notes, and snippets.

@khalednasr
Created May 27, 2014 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khalednasr/ae85d6d13fbe572e2bdc to your computer and use it in GitHub Desktop.
Save khalednasr/ae85d6d13fbe572e2bdc to your computer and use it in GitHub Desktop.
#include <shogun/mathematics/linalg/linalg.h>
#include <viennacl/matrix.hpp>
#include <viennacl/vector.hpp>
namespace shogun
{
namespace linalg
{
template <class T, unsigned int Info = 1>
using VCLMatrix= viennacl::matrix<T, viennacl::column_major, Info>;
namespace implementation
{
template <> template <class T,unsigned int Info>
struct sum<unsigned int,Backend::VIENNACL,VCLMatrix,T,Info>
{
typedef VCLMatrix<T, Info> matrix_type;
static T compute(matrix_type m, bool no_diag)
{
return 0;
}
static T compute(Block<unsigned int,VCLMatrix,T> b, bool no_diag)
{
return 0;
}
};
}
template <Backend backend,template <class,unsigned int> class Matrix, class T, unsigned int Info>
T sum(Matrix<T,Info> m, bool no_diag=false)
{
return implementation::sum<unsigned int,backend,Matrix,T,Info>::compute(m, no_diag);
}
}
}
using namespace shogun;
int main()
{
linalg::VCLMatrix<float64_t> mat(3,4);
// This line doesn't compile
float64_t sum = linalg::sum<linalg::Backend::VIENNACL>(mat);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment