本文整理汇总了C++中matrix_expression::lhs方法的典型用法代码示例。如果您正苦于以下问题:C++ matrix_expression::lhs方法的具体用法?C++ matrix_expression::lhs怎么用?C++ matrix_expression::lhs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matrix_expression
的用法示例。
在下文中一共展示了matrix_expression::lhs方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: solve
matrix<SCALARTYPE, F2, ALIGNMENT_B> solve(const matrix<SCALARTYPE, F1, ALIGNMENT_A> & A,
const matrix_expression< const matrix<SCALARTYPE, F2, ALIGNMENT_B>,
const matrix<SCALARTYPE, F2, ALIGNMENT_B>,
op_trans> & proxy,
TAG const & tag)
{
// do an inplace solve on the result vector:
matrix<SCALARTYPE, F2, ALIGNMENT_B> result(proxy.lhs().size2(), proxy.lhs().size1());
result = proxy;
inplace_solve(A, result, tag);
return result;
}
示例2: memory_exception
typename viennacl::enable_if< viennacl::is_any_sparse_matrix<SparseMatrixType>::value>::type
block_inplace_solve(const matrix_expression<const SparseMatrixType, const SparseMatrixType, op_trans> & mat,
viennacl::backend::mem_handle const & block_index_array, vcl_size_t num_blocks,
viennacl::vector_base<ScalarType> const & mat_diagonal,
viennacl::vector_base<ScalarType> & vec,
SOLVERTAG tag)
{
assert( (mat.size1() == mat.size2()) && bool("Size check failed for triangular solve on transposed compressed matrix: size1(mat) != size2(mat)"));
assert( (mat.size1() == vec.size()) && bool("Size check failed for transposed compressed matrix triangular solve: size1(mat) != size(x)"));
switch (viennacl::traits::handle(mat.lhs()).get_active_handle_id())
{
case viennacl::MAIN_MEMORY:
viennacl::linalg::host_based::detail::block_inplace_solve(mat, block_index_array, num_blocks, mat_diagonal, vec, tag);
break;
#ifdef VIENNACL_WITH_OPENCL
case viennacl::OPENCL_MEMORY:
viennacl::linalg::opencl::detail::block_inplace_solve(mat, block_index_array, num_blocks, mat_diagonal, vec, tag);
break;
#endif
#ifdef VIENNACL_WITH_CUDA
case viennacl::CUDA_MEMORY:
viennacl::linalg::cuda::detail::block_inplace_solve(mat, block_index_array, num_blocks, mat_diagonal, vec, tag);
break;
#endif
case viennacl::MEMORY_NOT_INITIALIZED:
throw memory_exception("not initialised!");
default:
throw memory_exception("not implemented");
}
}
示例3: assert
typename viennacl::enable_if< viennacl::is_any_dense_nonstructured_matrix<M1>::value
&& viennacl::is_any_dense_nonstructured_matrix<M2>::value
>::type
inplace_solve(const matrix_expression< const M1, const M1, op_trans> & proxy_A,
matrix_expression< const M2, const M2, op_trans> proxy_B,
SOLVERTAG)
{
assert( (viennacl::traits::size1(proxy_A) == viennacl::traits::size2(proxy_A)) && bool("Size check failed in inplace_solve(): size1(A) != size2(A)"));
assert( (viennacl::traits::size1(proxy_A) == viennacl::traits::size1(proxy_B)) && bool("Size check failed in inplace_solve(): size1(A^T) != size1(B^T)"));
switch (viennacl::traits::handle(proxy_A.lhs()).get_active_handle_id())
{
case viennacl::MAIN_MEMORY:
viennacl::linalg::host_based::inplace_solve(proxy_A, proxy_B, SOLVERTAG());
break;
#ifdef VIENNACL_WITH_OPENCL
case viennacl::OPENCL_MEMORY:
viennacl::linalg::opencl::inplace_solve(proxy_A, proxy_B, SOLVERTAG());
break;
#endif
#ifdef VIENNACL_WITH_CUDA
case viennacl::CUDA_MEMORY:
viennacl::linalg::cuda::inplace_solve(proxy_A, proxy_B, SOLVERTAG());
break;
#endif
default:
throw "not implemented";
}
}
示例4: inplace_solve
void inplace_solve(const matrix_expression< const matrix<SCALARTYPE, F, ALIGNMENT>,
const matrix<SCALARTYPE, F, ALIGNMENT>,
op_trans> & proxy,
vector<SCALARTYPE, VEC_ALIGNMENT> & vec,
SOLVERTAG)
{
assert(proxy.lhs().size1() == vec.size());
assert(proxy.lhs().size2() == vec.size());
typedef typename viennacl::tools::MATRIX_KERNEL_CLASS_DEDUCER< matrix<SCALARTYPE, F, ALIGNMENT> >::ResultType KernelClass;
std::stringstream ss;
ss << "trans_" << SOLVERTAG::name() << "_triangular_substitute_inplace";
viennacl::ocl::kernel & k = viennacl::ocl::get_kernel(KernelClass::program_name(), ss.str());
k.global_work_size(0, k.local_work_size());
viennacl::ocl::enqueue(k(proxy.lhs(), proxy.lhs().size1(), proxy.lhs().size2(),
proxy.lhs().internal_size1(), proxy.lhs().internal_size2(), vec));
}
示例5: op_aliasing
bool op_aliasing(matrix_base<NumericT> const & lhs, matrix_expression<const LhsT, const RhsT, OpT> const & rhs)
{
return op_aliasing(lhs, rhs.lhs()) || op_aliasing(lhs, rhs.rhs());
}
示例6: inplace_solve
void inplace_solve(const matrix_base<NumericT> & A,
matrix_expression< const matrix_base<NumericT>, const matrix_base<NumericT>, op_trans> proxy_B,
SOLVERTAG)
{
assert( (viennacl::traits::size1(A) == viennacl::traits::size2(A)) && bool("Size check failed in inplace_solve(): size1(A) != size2(A)"));
assert( (viennacl::traits::size1(A) == viennacl::traits::size1(proxy_B)) && bool("Size check failed in inplace_solve(): size1(A) != size1(B^T)"));
switch (viennacl::traits::handle(A).get_active_handle_id())
{
case viennacl::MAIN_MEMORY:
viennacl::linalg::host_based::inplace_solve(A, false, const_cast<matrix_base<NumericT> &>(proxy_B.lhs()), true, SOLVERTAG());
break;
#ifdef VIENNACL_WITH_OPENCL
case viennacl::OPENCL_MEMORY:
viennacl::linalg::opencl::inplace_solve(A, false, const_cast<matrix_base<NumericT> &>(proxy_B.lhs()), true, SOLVERTAG());
break;
#endif
#ifdef VIENNACL_WITH_CUDA
case viennacl::CUDA_MEMORY:
viennacl::linalg::cuda::inplace_solve(A, false, const_cast<matrix_base<NumericT> &>(proxy_B.lhs()), true, SOLVERTAG());
break;
#endif
case viennacl::MEMORY_NOT_INITIALIZED:
throw memory_exception("not initialised!");
default:
throw memory_exception("not implemented");
}
}
示例7: row_major
bool row_major(matrix_expression<LHS, RHS, OP> const & proxy) { return viennacl::traits::row_major(proxy.lhs()); }