本文整理汇总了C++中matrix_base类的典型用法代码示例。如果您正苦于以下问题:C++ matrix_base类的具体用法?C++ matrix_base怎么用?C++ matrix_base使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了matrix_base类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: inplace_solve
void inplace_solve(const matrix_base<NumericT> & mat,
vector_base<NumericT> & vec,
SOLVERTAG)
{
assert( (mat.size1() == vec.size()) && bool("Size check failed in inplace_solve(): size1(A) != size(b)"));
assert( (mat.size2() == vec.size()) && bool("Size check failed in inplace_solve(): size2(A) != size(b)"));
switch (viennacl::traits::handle(mat).get_active_handle_id())
{
case viennacl::MAIN_MEMORY:
viennacl::linalg::host_based::inplace_solve(mat, false, vec, SOLVERTAG());
break;
#ifdef VIENNACL_WITH_OPENCL
case viennacl::OPENCL_MEMORY:
viennacl::linalg::opencl::inplace_solve(mat, false, vec, SOLVERTAG());
break;
#endif
#ifdef VIENNACL_WITH_CUDA
case viennacl::CUDA_MEMORY:
viennacl::linalg::cuda::inplace_solve(mat, false, vec, SOLVERTAG());
break;
#endif
case viennacl::MEMORY_NOT_INITIALIZED:
throw memory_exception("not initialised!");
default:
throw memory_exception("not implemented");
}
}
开发者ID:GnsP,项目名称:viennacl-dev,代码行数:28,代码来源:direct_solve.hpp
示例2: norm_frobenius_cpu
void norm_frobenius_cpu(matrix_base<T> const & A,
T & result)
{
typedef typename matrix_base<T>::handle_type HandleType;
viennacl::vector_base<T> temp(const_cast<HandleType &>(A.handle()), A.internal_size(), 0, 1);
norm_2_cpu(temp, result);
}
开发者ID:GnsP,项目名称:viennacl-dev,代码行数:7,代码来源:matrix_operations.hpp
示例3: operator
result_type operator()(matrix_base<ScalarType, Layout> const & mat) const {
mapped_matrix * p = new mapped_matrix(utils::type_to_string<ScalarType>::value());
p->name_ = create_name(current_arg_, memory_, (void*)&mat);
p->is_row_major_ = static_cast<bool>(utils::is_same_type<Layout, viennacl::row_major>::value);
if(mat.start1() > 0)
p->start1_name_ = p->name_ +"_start1";
if(mat.stride1() > 1)
p->stride1_name_ = p->name_ + "_stride1";
if(mat.start2() > 0)
p->start2_name_ = p->name_ +"_start2";
if(mat.stride2() > 1)
p->stride2_name_ = p->name_ + "_stride2";
return container_ptr_type(p);
}
开发者ID:YannCobigo,项目名称:viennacl-dev,代码行数:14,代码来源:map_functor.hpp
示例4: inplace_solve
void inplace_solve(matrix_base<NumericT> const & mat,
vector_base<NumericT> & vec,
SolverTagT)
{
typedef NumericT value_type;
value_type const * data_A = detail::extract_raw_pointer<value_type>(mat);
value_type * data_v = detail::extract_raw_pointer<value_type>(vec);
vcl_size_t A_start1 = viennacl::traits::start1(mat);
vcl_size_t A_start2 = viennacl::traits::start2(mat);
vcl_size_t A_inc1 = viennacl::traits::stride1(mat);
vcl_size_t A_inc2 = viennacl::traits::stride2(mat);
vcl_size_t A_size2 = viennacl::traits::size2(mat);
vcl_size_t A_internal_size1 = viennacl::traits::internal_size1(mat);
vcl_size_t A_internal_size2 = viennacl::traits::internal_size2(mat);
vcl_size_t start1 = viennacl::traits::start(vec);
vcl_size_t inc1 = viennacl::traits::stride(vec);
if (mat.row_major())
{
detail::matrix_array_wrapper<value_type const, row_major, false> wrapper_A(data_A, A_start1, A_start2, A_inc1, A_inc2, A_internal_size1, A_internal_size2);
detail::vector_array_wrapper<value_type> wrapper_v(data_v, start1, inc1);
detail::inplace_solve_vector(wrapper_A, wrapper_v, A_size2, SolverTagT());
}
else
{
detail::matrix_array_wrapper<value_type const, column_major, false> wrapper_A(data_A, A_start1, A_start2, A_inc1, A_inc2, A_internal_size1, A_internal_size2);
detail::vector_array_wrapper<value_type> wrapper_v(data_v, start1, inc1);
detail::inplace_solve_vector(wrapper_A, wrapper_v, A_size2, SolverTagT());
}
}
开发者ID:10imaging,项目名称:viennacl,代码行数:35,代码来源:direct_solve.hpp
示例5: op_aliasing
bool op_aliasing(matrix_base<NumericT> const & lhs, matrix_base<NumericT> const & b)
{
return lhs.handle() == b.handle();
}
开发者ID:10imaging,项目名称:viennacl,代码行数:4,代码来源:op_executor.hpp
示例6: stride2
typename result_of::size_type< matrix_base<NumericT> >::type
stride2(matrix_base<NumericT> const & s) { return s.stride2(); }
开发者ID:cdeterman,项目名称:RViennaCL,代码行数:2,代码来源:stride.hpp
示例7: row_major
bool row_major(matrix_base<NumericT> const & A) { return A.row_major(); }
开发者ID:Rombur,项目名称:viennacl-dev,代码行数:1,代码来源:row_major.hpp
示例8: internal_size2
vcl_size_t internal_size2(matrix_base<NumericT, F> const & mat) { return mat.internal_size2(); }
开发者ID:KratosCSIC,项目名称:trunk,代码行数:1,代码来源:size.hpp
示例9: nld
vcl_size_t nld(matrix_base<NumericT> const & mat)
{
if (mat.row_major())
return mat.stride2();
return mat.stride1();
}
开发者ID:a9raag,项目名称:mahout,代码行数:6,代码来源:size.hpp
示例10: ld
vcl_size_t ld(matrix_base<NumericT> const & mat)
{
if (mat.row_major())
return mat.internal_size2();
return mat.internal_size1();
}
开发者ID:a9raag,项目名称:mahout,代码行数:6,代码来源:size.hpp
注:本文中的matrix_base类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论