We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello,
I propose this fix to support Eigen Matrix with dynamic column to with an assert.
`template<typename NumericT, unsigned int AlignmentV> void copy( vector<NumericT, AlignmentV> const & gpu_vec, Eigen::Matrix<NumericT, Eigen::Dynamic, Eigen::Dynamic> & eigen_mat) { assert( eigen_mat.cols() == 1 && "copy vector to matrix not a single column: not compatible" ); viennacl::fast_copy( gpu_vec.begin(), gpu_vec.end(), &( eigen_mat[ 0 ] ) ); }
template<typename NumericT, unsigned int AlignmentV, int EigenMapTypeV, typename EigenStrideT> void copy( vector<NumericT, AlignmentV> const & gpu_vec, Eigen::Map<Eigen::Matrix<NumericT, Eigen::Dynamic, Eigen::Dynamic>, EigenMapTypeV, EigenStrideT> & eigen_mat ) { assert( eigen_mat.cols() == 1 && "copy matrix (not a single column) to vector: not compatible" ); viennacl::fast_copy( gpu_vec.begin(), gpu_vec.end(), &( eigen_mat[ 0 ] ) ); }`
And for symmetry: `template<typename NumericT, unsigned int AlignmentV> void copy( vector<NumericT, AlignmentV> const & gpu_vec, Eigen::Matrix<NumericT, Eigen::Dynamic, Eigen::Dynamic> & eigen_mat) { assert( eigen_mat.cols() == 1 && "Dimensions not compatible" ); viennacl::fast_copy( gpu_vec.begin(), gpu_vec.end(), &( eigen_mat( 0, 0 ) ) ); }
template<typename NumericT, unsigned int AlignmentV, int EigenMapTypeV, typename EigenStrideT> void copy( vector<NumericT, AlignmentV> const & gpu_vec, Eigen::Map<Eigen::Matrix<NumericT, Eigen::Dynamic, Eigen::Dynamic>, EigenMapTypeV, EigenStrideT> & eigen_mat ) { assert( eigen_mat.cols() == 1 && "Dimensions not compatible" ); viennacl::fast_copy( gpu_vec.begin(), gpu_vec.end(), &( eigen_mat( 0, 0 ) ) ); }`
Cheers this is the version I use locally
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello,
I propose this fix to support Eigen Matrix with dynamic column to with an assert.
`template<typename NumericT, unsigned int AlignmentV>
void copy( vector<NumericT, AlignmentV> const & gpu_vec,
Eigen::Matrix<NumericT, Eigen::Dynamic, Eigen::Dynamic> & eigen_mat)
{
assert( eigen_mat.cols() == 1 && "copy vector to matrix not a single column: not compatible" );
viennacl::fast_copy( gpu_vec.begin(), gpu_vec.end(), &( eigen_mat[ 0 ] ) );
}
template<typename NumericT, unsigned int AlignmentV, int EigenMapTypeV, typename EigenStrideT>
void copy( vector<NumericT, AlignmentV> const & gpu_vec,
Eigen::Map<Eigen::Matrix<NumericT, Eigen::Dynamic, Eigen::Dynamic>, EigenMapTypeV, EigenStrideT> & eigen_mat )
{
assert( eigen_mat.cols() == 1 && "copy matrix (not a single column) to vector: not compatible" );
viennacl::fast_copy( gpu_vec.begin(), gpu_vec.end(), &( eigen_mat[ 0 ] ) );
}`
And for symmetry:
`template<typename NumericT, unsigned int AlignmentV>
void copy( vector<NumericT, AlignmentV> const & gpu_vec,
Eigen::Matrix<NumericT, Eigen::Dynamic, Eigen::Dynamic> & eigen_mat)
{
assert( eigen_mat.cols() == 1 && "Dimensions not compatible" );
viennacl::fast_copy( gpu_vec.begin(), gpu_vec.end(), &( eigen_mat( 0, 0 ) ) );
}
template<typename NumericT, unsigned int AlignmentV, int EigenMapTypeV, typename EigenStrideT>
void copy( vector<NumericT, AlignmentV> const & gpu_vec,
Eigen::Map<Eigen::Matrix<NumericT, Eigen::Dynamic, Eigen::Dynamic>, EigenMapTypeV, EigenStrideT> & eigen_mat )
{
assert( eigen_mat.cols() == 1 && "Dimensions not compatible" );
viennacl::fast_copy( gpu_vec.begin(), gpu_vec.end(), &( eigen_mat( 0, 0 ) ) );
}`
Cheers this is the version I use locally
The text was updated successfully, but these errors were encountered: