本文整理汇总了C++中viennacl::matrix_expression类的典型用法代码示例。如果您正苦于以下问题:C++ matrix_expression类的具体用法?C++ matrix_expression怎么用?C++ matrix_expression使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了matrix_expression类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prod_impl
void prod_impl(const viennacl::matrix_expression< const matrix_base<NumericT>, const matrix_base<NumericT>, op_trans> & A,
const viennacl::matrix_expression< const matrix_base<NumericT>, const matrix_base<NumericT>, op_trans> & B,
matrix_base<NumericT> & C,
ScalarType alpha,
ScalarType beta)
{
assert(viennacl::traits::size2(A.lhs()) == viennacl::traits::size1(C) && bool("Size check failed at C = prod(trans(A), trans(B)): size2(A) != size1(C)"));
assert(viennacl::traits::size1(A.lhs()) == viennacl::traits::size2(B.lhs()) && bool("Size check failed at C = prod(trans(A), trans(B)): size1(A) != size2(B)"));
assert(viennacl::traits::size1(B.lhs()) == viennacl::traits::size2(C) && bool("Size check failed at C = prod(trans(A), trans(B)): size1(B) != size2(C)"));
switch (viennacl::traits::handle(A.lhs()).get_active_handle_id())
{
case viennacl::MAIN_MEMORY:
viennacl::linalg::host_based::prod_impl(A.lhs(), true, B.lhs(), true, C, alpha, beta);
break;
#ifdef VIENNACL_WITH_OPENCL
case viennacl::OPENCL_MEMORY:
viennacl::linalg::opencl::prod_impl(A.lhs(), true, B.lhs(), true, C, alpha, beta);
break;
#endif
#ifdef VIENNACL_WITH_CUDA
case viennacl::CUDA_MEMORY:
viennacl::linalg::cuda::prod_impl(A.lhs(), true, B.lhs(), true, C, alpha, beta);
break;
#endif
case viennacl::MEMORY_NOT_INITIALIZED:
throw memory_exception("not initialised!");
default:
throw memory_exception("not implemented");
}
}
示例2: prod_impl
typename viennacl::enable_if< viennacl::is_any_sparse_matrix<SparseMatrixType>::value>::type
prod_impl(const SparseMatrixType & sp_mat,
const viennacl::matrix_expression<const viennacl::matrix_base<ScalarType>,
const viennacl::matrix_base<ScalarType>,
viennacl::op_trans>& d_mat,
viennacl::matrix_base<ScalarType> & result)
{
assert( (sp_mat.size1() == result.size1()) && bool("Size check failed for compressed matrix - dense matrix product: size1(sp_mat) != size1(result)"));
assert( (sp_mat.size2() == d_mat.size1()) && bool("Size check failed for compressed matrix - dense matrix product: size2(sp_mat) != size1(d_mat)"));
switch (viennacl::traits::handle(sp_mat).get_active_handle_id())
{
case viennacl::MAIN_MEMORY:
viennacl::linalg::host_based::prod_impl(sp_mat, d_mat, result);
break;
#ifdef VIENNACL_WITH_OPENCL
case viennacl::OPENCL_MEMORY:
viennacl::linalg::opencl::prod_impl(sp_mat, d_mat, result);
break;
#endif
#ifdef VIENNACL_WITH_CUDA
case viennacl::CUDA_MEMORY:
viennacl::linalg::cuda::prod_impl(sp_mat, d_mat, result);
break;
#endif
case viennacl::MEMORY_NOT_INITIALIZED:
throw memory_exception("not initialised!");
default:
throw memory_exception("not implemented");
}
}
示例3: size
static size_t size(const viennacl::matrix_expression< const viennacl::matrix<ScalarType, F, Amat>,
const viennacl::matrix<ScalarType, F, Amat>,
op_trans> & lhs,
const viennacl::vector<ScalarType, A> & rhs) { return lhs.lhs().size2(); }
示例4: size2
static vcl_size_t size2(viennacl::matrix_expression<const LHS, const RHS, OP> const & lhs,
ScalarType const & /*rhs*/) { return MATRIX_SIZE_DEDUCER<const LHS, const RHS, OP>::size2(lhs.lhs(), lhs.rhs()); }
示例5: size1
static vcl_size_t size1(viennacl::matrix_expression<T1,
T1,
op_trans> const & lhs,
viennacl::matrix_base<ScalarType> const & /*rhs*/) { return lhs.lhs().size2(); }
示例6: active_handle_id
viennacl::memory_types active_handle_id(viennacl::matrix_expression<LHS, RHS, OP> const & obj)
{
return active_handle_id(obj.lhs());
}
示例7: size2
static vcl_size_t size2(viennacl::matrix_expression<const LHS1, const RHS1, OP1> const & lhs,
viennacl::matrix_expression<const LHS2, const RHS2, OP2> const & /*rhs*/) { return MATRIX_SIZE_DEDUCER<const LHS1, const RHS1, OP1>::size2(lhs.lhs(), lhs.rhs()); }
示例8: size1
static vcl_size_t size1(ScalarType const & /*lhs*/,
viennacl::matrix_expression<const LHS, const RHS, OP> const & rhs) { return MATRIX_SIZE_DEDUCER<const LHS, const RHS, OP>::size1(rhs.lhs(), rhs.rhs()); }
示例9: size2
static size_t size2(viennacl::matrix<ScalarType, F1, A1> const & lhs,
viennacl::matrix_expression<const viennacl::matrix<ScalarType, F2, A2>,
const viennacl::matrix<ScalarType, F2, A2>,
op_trans> const & rhs) { return rhs.lhs().size1(); }