1 #ifndef VIENNACL_LINALG_VECTOR_OPERATIONS_HPP_
2 #define VIENNACL_LINALG_VECTOR_OPERATIONS_HPP_
37 #ifdef VIENNACL_WITH_OPENCL
41 #ifdef VIENNACL_WITH_CUDA
49 template<
typename T,
typename ScalarType1>
51 vector_base<T> const & vec2, ScalarType1
const & alpha,
vcl_size_t len_alpha,
bool reciprocal_alpha,
bool flip_sign_alpha)
60 #ifdef VIENNACL_WITH_OPENCL
65 #ifdef VIENNACL_WITH_CUDA
78 template<
typename T,
typename ScalarType1,
typename ScalarType2>
80 vector_base<T> const & vec2, ScalarType1
const & alpha,
vcl_size_t len_alpha,
bool reciprocal_alpha,
bool flip_sign_alpha,
81 vector_base<T> const & vec3, ScalarType2
const & beta,
vcl_size_t len_beta,
bool reciprocal_beta,
bool flip_sign_beta)
90 vec2, alpha, len_alpha, reciprocal_alpha, flip_sign_alpha,
91 vec3, beta, len_beta, reciprocal_beta, flip_sign_beta);
93 #ifdef VIENNACL_WITH_OPENCL
96 vec2, alpha, len_alpha, reciprocal_alpha, flip_sign_alpha,
97 vec3, beta, len_beta, reciprocal_beta, flip_sign_beta);
100 #ifdef VIENNACL_WITH_CUDA
103 vec2, alpha, len_alpha, reciprocal_alpha, flip_sign_alpha,
104 vec3, beta, len_beta, reciprocal_beta, flip_sign_beta);
115 template<
typename T,
typename ScalarType1,
typename ScalarType2>
117 vector_base<T> const & vec2, ScalarType1
const & alpha,
vcl_size_t len_alpha,
bool reciprocal_alpha,
bool flip_sign_alpha,
118 vector_base<T> const & vec3, ScalarType2
const & beta,
vcl_size_t len_beta,
bool reciprocal_beta,
bool flip_sign_beta)
127 vec2, alpha, len_alpha, reciprocal_alpha, flip_sign_alpha,
128 vec3, beta, len_beta, reciprocal_beta, flip_sign_beta);
130 #ifdef VIENNACL_WITH_OPENCL
133 vec2, alpha, len_alpha, reciprocal_alpha, flip_sign_alpha,
134 vec3, beta, len_beta, reciprocal_beta, flip_sign_beta);
137 #ifdef VIENNACL_WITH_CUDA
140 vec2, alpha, len_alpha, reciprocal_alpha, flip_sign_alpha,
141 vec3, beta, len_beta, reciprocal_beta, flip_sign_beta);
166 #ifdef VIENNACL_WITH_OPENCL
171 #ifdef VIENNACL_WITH_CUDA
199 #ifdef VIENNACL_WITH_OPENCL
204 #ifdef VIENNACL_WITH_CUDA
226 template<
typename T,
typename OP>
237 #ifdef VIENNACL_WITH_OPENCL
242 #ifdef VIENNACL_WITH_CUDA
257 #define VIENNACL_GENERATE_BINARY_ELEMENTOPERATION_OVERLOADS(OPNAME) \
258 template<typename T> \
259 viennacl::vector_expression<const vector_base<T>, const vector_base<T>, op_element_binary<op_##OPNAME> > \
260 element_##OPNAME(vector_base<T> const & v1, vector_base<T> const & v2) \
262 return viennacl::vector_expression<const vector_base<T>, const vector_base<T>, op_element_binary<op_##OPNAME> >(v1, v2); \
265 template<typename V1, typename V2, typename OP, typename T> \
266 viennacl::vector_expression<const vector_expression<const V1, const V2, OP>, const vector_base<T>, op_element_binary<op_##OPNAME> > \
267 element_##OPNAME(vector_expression<const V1, const V2, OP> const & proxy, vector_base<T> const & v2) \
269 return viennacl::vector_expression<const vector_expression<const V1, const V2, OP>, const vector_base<T>, op_element_binary<op_##OPNAME> >(proxy, v2); \
272 template<typename T, typename V2, typename V3, typename OP> \
273 viennacl::vector_expression<const vector_base<T>, const vector_expression<const V2, const V3, OP>, op_element_binary<op_##OPNAME> > \
274 element_##OPNAME(vector_base<T> const & v1, vector_expression<const V2, const V3, OP> const & proxy) \
276 return viennacl::vector_expression<const vector_base<T>, const vector_expression<const V2, const V3, OP>, op_element_binary<op_##OPNAME> >(v1, proxy); \
279 template<typename V1, typename V2, typename OP1, \
280 typename V3, typename V4, typename OP2> \
281 viennacl::vector_expression<const vector_expression<const V1, const V2, OP1>, \
282 const vector_expression<const V3, const V4, OP2>, \
283 op_element_binary<op_##OPNAME> > \
284 element_##OPNAME(vector_expression<const V1, const V2, OP1> const & proxy1, \
285 vector_expression<const V3, const V4, OP2> const & proxy2) \
287 return viennacl::vector_expression<const vector_expression<const V1, const V2, OP1>, \
288 const vector_expression<const V3, const V4, OP2>, \
289 op_element_binary<op_##OPNAME> >(proxy1, proxy2); \
292 VIENNACL_GENERATE_BINARY_ELEMENTOPERATION_OVERLOADS(
prod)
293 VIENNACL_GENERATE_BINARY_ELEMENTOPERATION_OVERLOADS(div)
294 VIENNACL_GENERATE_BINARY_ELEMENTOPERATION_OVERLOADS(pow)
296 VIENNACL_GENERATE_BINARY_ELEMENTOPERATION_OVERLOADS(eq)
297 VIENNACL_GENERATE_BINARY_ELEMENTOPERATION_OVERLOADS(neq)
298 VIENNACL_GENERATE_BINARY_ELEMENTOPERATION_OVERLOADS(greater)
299 VIENNACL_GENERATE_BINARY_ELEMENTOPERATION_OVERLOADS(less)
300 VIENNACL_GENERATE_BINARY_ELEMENTOPERATION_OVERLOADS(geq)
301 VIENNACL_GENERATE_BINARY_ELEMENTOPERATION_OVERLOADS(leq)
303 #undef VIENNACL_GENERATE_BINARY_ELEMENTOPERATION_OVERLOADS
306 #define VIENNACL_MAKE_UNARY_ELEMENT_OP(funcname) \
307 template<typename T> \
308 viennacl::vector_expression<const vector_base<T>, const vector_base<T>, op_element_unary<op_##funcname> > \
309 element_##funcname(vector_base<T> const & v) \
311 return viennacl::vector_expression<const vector_base<T>, const vector_base<T>, op_element_unary<op_##funcname> >(v, v); \
313 template<typename LHS, typename RHS, typename OP> \
314 viennacl::vector_expression<const vector_expression<const LHS, const RHS, OP>, \
315 const vector_expression<const LHS, const RHS, OP>, \
316 op_element_unary<op_##funcname> > \
317 element_##funcname(vector_expression<const LHS, const RHS, OP> const & proxy) \
319 return viennacl::vector_expression<const vector_expression<const LHS, const RHS, OP>, \
320 const vector_expression<const LHS, const RHS, OP>, \
321 op_element_unary<op_##funcname> >(proxy, proxy); \
342 #undef VIENNACL_MAKE_UNARY_ELEMENT_OP
363 assert( vec1.
size() == vec2.
size() && bool(
"Size mismatch") );
370 #ifdef VIENNACL_WITH_OPENCL
375 #ifdef VIENNACL_WITH_CUDA
388 template<
typename LHS,
typename RHS,
typename OP,
typename T>
399 template<
typename T,
typename LHS,
typename RHS,
typename OP>
410 template<
typename LHS1,
typename RHS1,
typename OP1,
411 typename LHS2,
typename RHS2,
typename OP2,
typename T>
435 assert( vec1.
size() == vec2.
size() && bool(
"Size mismatch") );
442 #ifdef VIENNACL_WITH_OPENCL
447 #ifdef VIENNACL_WITH_CUDA
460 template<
typename LHS,
typename RHS,
typename OP,
typename T>
471 template<
typename T,
typename LHS,
typename RHS,
typename OP>
482 template<
typename LHS1,
typename RHS1,
typename OP1,
483 typename LHS2,
typename RHS2,
typename OP2,
typename S3>
506 assert( x.
size() == y_tuple.
const_at(0).size() && bool(
"Size mismatch") );
507 assert( result.
size() == y_tuple.
const_size() && bool(
"Number of elements does not match result size") );
514 #ifdef VIENNACL_WITH_OPENCL
519 #ifdef VIENNACL_WITH_CUDA
546 #ifdef VIENNACL_WITH_OPENCL
551 #ifdef VIENNACL_WITH_CUDA
569 template<
typename LHS,
typename RHS,
typename OP,
typename S2>
593 #ifdef VIENNACL_WITH_OPENCL
598 #ifdef VIENNACL_WITH_CUDA
615 template<
typename LHS,
typename RHS,
typename OP,
typename S2>
640 #ifdef VIENNACL_WITH_OPENCL
645 #ifdef VIENNACL_WITH_CUDA
662 template<
typename LHS,
typename RHS,
typename OP,
typename T>
685 #ifdef VIENNACL_WITH_OPENCL
690 #ifdef VIENNACL_WITH_CUDA
707 template<
typename LHS,
typename RHS,
typename OP,
typename S2>
732 #ifdef VIENNACL_WITH_OPENCL
737 #ifdef VIENNACL_WITH_CUDA
754 template<
typename LHS,
typename RHS,
typename OP,
typename T>
777 #ifdef VIENNACL_WITH_OPENCL
782 #ifdef VIENNACL_WITH_CUDA
799 template<
typename LHS,
typename RHS,
typename OP,
typename S2>
823 #ifdef VIENNACL_WITH_OPENCL
827 #ifdef VIENNACL_WITH_CUDA
842 template<
typename LHS,
typename RHS,
typename OP>
855 template<
typename NumericT>
863 #ifdef VIENNACL_WITH_OPENCL
868 #ifdef VIENNACL_WITH_CUDA
885 template<
typename LHS,
typename RHS,
typename OP,
typename NumericT>
906 #ifdef VIENNACL_WITH_OPENCL
911 #ifdef VIENNACL_WITH_CUDA
928 template<
typename LHS,
typename RHS,
typename OP,
typename S2>
941 template<
typename NumericT>
949 #ifdef VIENNACL_WITH_OPENCL
954 #ifdef VIENNACL_WITH_CUDA
971 template<
typename LHS,
typename RHS,
typename OP,
typename NumericT>
992 #ifdef VIENNACL_WITH_OPENCL
997 #ifdef VIENNACL_WITH_CUDA
1014 template<
typename LHS,
typename RHS,
typename OP,
typename S2>
1032 template<
typename T>
1042 #ifdef VIENNACL_WITH_OPENCL
1047 #ifdef VIENNACL_WITH_CUDA
1061 template<
typename T,
typename LHS,
typename RHS,
typename OP>
1065 assert( (v1.
size() > 0) &&
bool(
"Vector not yet initialized!") );
1072 template<
typename T,
typename LHS,
typename RHS,
typename OP>
1076 assert( (v1.
size() > 0) &&
bool(
"Vector not yet initialized!") );
void min_cpu(vector_base< NumericT > const &x, NumericT &result)
Computes the supremum-norm of a vector.
void norm_2_cpu(vector_base< NumericT > const &x, NumericT &result)
Computes the l^1-norm of a vector with final reduction on CPU.
vcl_size_t const_size() const
vcl_size_t index_norm_inf(vector_base< T > const &vec)
Computes the index of the first entry that is equal to the supremum-norm in modulus.
void vector_assign(vector_base< NumericT > &vec1, ScalarT1 const &alpha, bool up_to_internal_size=false)
Assign a constant value to a vector (-range/-slice)
This class represents a single scalar value on the GPU and behaves mostly like a built-in scalar type...
void norm_2_cpu(vector_base< NumericT > const &vec1, NumericT &result)
Computes the l^2-norm of a vector - implementation.
void norm_1_cpu(vector_base< NumericT > const &x, NumericT &result)
Computes the l^1-norm of a vector with final reduction on CPU.
Worker class for decomposing expression templates.
void inner_prod_cpu(vector_base< T > const &vec1, vector_base< T > const &vec2, T &result)
Computes the inner product of two vectors with the final reduction step on the CPU - dispatcher inter...
void norm_1_impl(vector_base< NumericT > const &vec1, ScalarT &result)
Computes the l^1-norm of a vector.
void min_cpu(vector_base< T > const &vec, T &result)
Computes the minimum of a vector with final reduction on the CPU.
vector< NumericT > operator-=(vector_base< NumericT > &v1, const viennacl::vector_expression< const matrix_base< NumericT >, const vector_base< NumericT >, viennacl::op_prod > &proxy)
Implementation of the operation v1 -= A * v2, where A is a matrix.
Implementations of NMF operations using OpenCL.
void inner_prod_cpu(vector_base< NumericT > const &x, vector_base< NumericT > const &y, NumericT &result)
Exception class in case of memory errors.
void max_cpu(vector_base< T > const &vec, T &result)
Computes the maximum of a vector with final reduction on the CPU.
Generic size and resize functionality for different vector and matrix types.
void norm_inf_impl(vector_base< NumericT > const &vec1, ScalarT &result)
Computes the supremum-norm of a vector.
void plane_rotation(vector_base< NumericT > &x, vector_base< NumericT > &y, NumericT alpha, NumericT beta)
Computes a plane rotation of two vectors.
void norm_inf_cpu(vector_base< NumericT > const &x, NumericT &result)
Computes the supremum-norm of a vector.
void av(vector_base< NumericT > &vec1, vector_base< NumericT > const &vec2, ScalarT1 const &alpha, vcl_size_t, bool reciprocal_alpha, bool flip_sign_alpha)
Extracts the underlying OpenCL start index handle from a vector, a matrix, an expression etc...
vector< NumericT > operator+=(vector_base< NumericT > &v1, const viennacl::vector_expression< const matrix_base< NumericT >, const vector_base< NumericT >, viennacl::op_prod > &proxy)
Implementation of the operation v1 += A * v2, where A is a matrix.
void plane_rotation(vector_base< T > &vec1, vector_base< T > &vec2, T alpha, T beta)
Computes a plane rotation of two vectors.
void norm_2_cpu(vector_base< T > const &vec, T &result)
Computes the l^2-norm of a vector with final reduction on the CPU - dispatcher interface.
void av(vector_base< NumericT > &vec1, vector_base< NumericT > const &vec2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha)
void avbv_v(vector_base< T > &vec1, vector_base< T > const &vec2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha, vector_base< T > const &vec3, ScalarType2 const &beta, vcl_size_t len_beta, bool reciprocal_beta, bool flip_sign_beta)
cl_uint index_norm_inf(vector_base< NumericT > const &x)
Computes the index of the first entry that is equal to the supremum-norm in modulus.
void norm_1_impl(vector_base< NumericT > const &x, scalar< NumericT > &result)
Computes the l^1-norm of a vector.
void avbv_v(vector_base< NumericT > &x, vector_base< NumericT > const &y, ScalarT1 const &alpha, vcl_size_t, bool reciprocal_alpha, bool flip_sign_alpha, vector_base< NumericT > const &z, ScalarT2 const &beta, vcl_size_t, bool reciprocal_beta, bool flip_sign_beta)
void max_impl(vector_base< NumericT > const &vec1, scalar< NumericT > &result)
Computes the maximum of a vector, both reduction stages run on the GPU.
This file provides the forward declarations for the main types used within ViennaCL.
Determines row and column increments for matrices and matrix proxies.
void min_impl(vector_base< NumericT > const &x, scalar< NumericT > &result)
Computes the minimum of a vector.
void norm_1_cpu(vector_base< NumericT > const &vec1, NumericT &result)
Computes the l^1-norm of a vector.
An expression template class that represents a binary operation that yields a vector.
void element_op(matrix_base< T > &A, matrix_expression< const matrix_base< T >, const matrix_base< T >, OP > const &proxy)
Implementation of the element-wise operation A = B .* C and A = B ./ C for matrices (using MATLAB syn...
void vector_assign(vector_base< NumericT > &vec1, const NumericT &alpha, bool up_to_internal_size=false)
Assign a constant value to a vector (-range/-slice)
A tag class representing inplace addition.
void vector_assign(vector_base< NumericT > &x, const NumericT &alpha, bool up_to_internal_size=false)
Assign a constant value to a vector (-range/-slice)
void max_cpu(vector_base< NumericT > const &vec1, NumericT &result)
Computes the maximum of a vector, first reduction stage on the GPU, second stage on the CPU...
void vector_swap(vector_base< NumericT > &vec1, vector_base< NumericT > &vec2)
Swaps the contents of two vectors, data is copied.
void element_op(matrix_base< NumericT > &A, matrix_expression< const matrix_base< NumericT >, const matrix_base< NumericT >, op_element_binary< OpT > > const &proxy)
Implementation of binary element-wise operations A = OP(B,C)
void norm_2_impl(vector_base< T > const &vec, scalar< T > &result)
Computes the l^2-norm of a vector - dispatcher interface.
viennacl::vector< float > v1
VectorT prod(std::vector< std::vector< T, A1 >, A2 > const &matrix, VectorT const &vector)
void max_impl(vector_base< T > const &vec, scalar< T > &result)
vcl_size_t size(VectorType const &vec)
Generic routine for obtaining the size of a vector (ViennaCL, uBLAS, etc.)
void norm_2_impl(vector_base< NumericT > const &vec1, ScalarT &result)
Computes the l^2-norm of a vector - implementation.
void max_impl(vector_base< NumericT > const &x, scalar< NumericT > &result)
Computes the maximum of a vector.
void inner_prod_impl(vector_base< T > const &vec1, vector_base< T > const &vec2, scalar< T > &result)
Computes the inner product of two vectors - dispatcher interface.
void max_cpu(vector_base< NumericT > const &x, NumericT &result)
Computes the supremum-norm of a vector.
void norm_1_cpu(vector_base< T > const &vec, T &result)
Computes the l^1-norm of a vector with final reduction on the CPU.
vcl_size_t index_norm_inf(vector_base< NumericT > const &vec1)
Computes the index of the first entry that is equal to the supremum-norm in modulus.
Tuple class holding pointers to multiple vectors. Mainly used as a temporary object returned from vie...
void min_impl(vector_base< NumericT > const &vec1, ScalarT &result)
Computes the maximum of a vector.
void norm_2_impl(vector_base< NumericT > const &x, scalar< NumericT > &result)
Computes the l^2-norm of a vector - implementation using OpenCL summation at second step...
void vector_swap(vector_base< NumericT > &vec1, vector_base< NumericT > &vec2)
Swaps the contents of two vectors, data is copied.
#define VIENNACL_MAKE_UNARY_ELEMENT_OP(funcname)
void inner_prod_impl(vector_base< NumericT > const &x, vector_base< NumericT > const &y, scalar< NumericT > &result)
Computes the inner product of two vectors - implementation. Library users should call inner_prod(x...
void norm_inf_impl(vector_base< NumericT > const &vec1, scalar< NumericT > &result)
Computes the supremum-norm of a vector.
void element_op(matrix_base< NumericT > &A, matrix_expression< const matrix_base< NumericT >, const matrix_base< NumericT >, op_element_binary< OpT > > const &proxy)
Implementation of the element-wise operations A = B .* C and A = B ./ C (using MATLAB syntax) ...
void inner_prod_cpu(vector_base< NumericT > const &vec1, vector_base< NumericT > const &vec2, NumericT &result)
Computes the inner product of two vectors - implementation. Library users should call inner_prod(vec1...
void vector_swap(vector_base< T > &vec1, vector_base< T > &vec2)
Swaps the contents of two vectors, data is copied.
void avbv(vector_base< NumericT > &vec1, vector_base< NumericT > const &vec2, ScalarT1 const &alpha, vcl_size_t, bool reciprocal_alpha, bool flip_sign_alpha, vector_base< NumericT > const &vec3, ScalarT2 const &beta, vcl_size_t, bool reciprocal_beta, bool flip_sign_beta)
void norm_inf_impl(vector_base< T > const &vec, scalar< T > &result)
Computes the supremum-norm of a vector.
void norm_1_impl(vector_base< T > const &vec, scalar< T > &result)
Computes the l^1-norm of a vector - dispatcher interface.
Common base class for dense vectors, vector ranges, and vector slices.
void avbv_v(vector_base< NumericT > &vec1, vector_base< NumericT > const &vec2, ScalarT1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha, vector_base< NumericT > const &vec3, ScalarT2 const &beta, vcl_size_t len_beta, bool reciprocal_beta, bool flip_sign_beta)
void min_impl(vector_base< T > const &vec, scalar< T > &result)
void norm_inf_impl(vector_base< NumericT > const &x, scalar< NumericT > &result)
Computes the supremum-norm of a vector.
void min_cpu(vector_base< NumericT > const &vec1, NumericT &result)
Computes the maximum of a vector, first reduction stage on the GPU, second stage on the CPU...
void norm_1_impl(vector_base< NumericT > const &vec1, scalar< NumericT > &result)
Computes the l^1-norm of a vector.
void avbv(vector_base< T > &vec1, vector_base< T > const &vec2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha, vector_base< T > const &vec3, ScalarType2 const &beta, vcl_size_t len_beta, bool reciprocal_beta, bool flip_sign_beta)
vcl_size_t index_norm_inf(vector_base< NumericT > const &vec1)
Computes the index of the first entry that is equal to the supremum-norm in modulus.
void vector_swap(vector_base< NumericT > &x, vector_base< NumericT > &y)
Swaps the contents of two vectors, data is copied.
All the predicates used within ViennaCL. Checks for expressions to be vectors, etc.
void plane_rotation(vector_base< NumericT > &vec1, vector_base< NumericT > &vec2, NumericT alpha, NumericT beta)
Computes a plane rotation of two vectors.
void inner_prod_impl(vector_base< NumericT > const &vec1, vector_base< NumericT > const &vec2, ScalarT &result)
Computes the inner product of two vectors - implementation. Library users should call inner_prod(vec1...
void min_impl(vector_base< NumericT > const &vec1, scalar< NumericT > &result)
Computes the maximum of a vector, both reduction stages run on the GPU.
A tag class representing inplace subtraction.
void max_impl(vector_base< NumericT > const &vec1, ScalarT &result)
Computes the maximum of a vector.
void av(vector_base< NumericT > &x, vector_base< NumericT > const &y, ScalarT1 const &alpha, vcl_size_t, bool reciprocal_alpha, bool flip_sign_alpha)
void element_op(matrix_base< NumericT, SizeT > &A, matrix_expression< const matrix_base< NumericT, SizeT >, const matrix_base< NumericT, SizeT >, op_element_binary< OpT > > const &proxy)
void inner_prod_impl(vector_base< NumericT > const &vec1, vector_base< NumericT > const &vec2, ScalarT &result)
Computes the inner product of two vectors - implementation. Library users should call inner_prod(vec1...
void norm_inf_cpu(vector_base< NumericT > const &vec1, NumericT &result)
Computes the supremum-norm of a vector.
size_type size() const
Returns the length of the vector (cf. std::vector)
void av(vector_base< T > &vec1, vector_base< T > const &vec2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha)
void avbv(vector_base< NumericT > &x, vector_base< NumericT > const &y, ScalarT1 const &alpha, vcl_size_t, bool reciprocal_alpha, bool flip_sign_alpha, vector_base< NumericT > const &z, ScalarT2 const &beta, vcl_size_t, bool reciprocal_beta, bool flip_sign_beta)
VectorType const & const_at(vcl_size_t i) const
Implementation of a range object for use with proxy objects.
void vector_assign(vector_base< T > &vec1, const T &alpha, bool up_to_internal_size=false)
Assign a constant value to a vector (-range/-slice)
Extracts the underlying OpenCL handle from a vector, a matrix, an expression etc. ...
viennacl::backend::mem_handle & handle(T &obj)
Returns the generic memory handle of an object. Non-const version.
void plane_rotation(vector_base< NumericT > &vec1, vector_base< NumericT > &vec2, NumericT alpha, NumericT beta)
Computes a plane rotation of two vectors.
Implementation of the ViennaCL scalar class.
Implementations of NMF operations using CUDA.
void norm_2_impl(vector_base< NumericT > const &vec1, scalar< NumericT > &result)
Computes the l^2-norm of a vector - implementation.
void avbv_v(vector_base< NumericT > &vec1, vector_base< NumericT > const &vec2, ScalarT1 const &alpha, vcl_size_t, bool reciprocal_alpha, bool flip_sign_alpha, vector_base< NumericT > const &vec3, ScalarT2 const &beta, vcl_size_t, bool reciprocal_beta, bool flip_sign_beta)
void norm_inf_cpu(vector_base< T > const &vec, T &result)
Computes the supremum-norm of a vector with final reduction on the CPU.
void avbv(vector_base< NumericT > &vec1, vector_base< NumericT > const &vec2, ScalarT1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha, vector_base< NumericT > const &vec3, ScalarT2 const &beta, vcl_size_t len_beta, bool reciprocal_beta, bool flip_sign_beta)
Simple enable-if variant that uses the SFINAE pattern.
memory_types get_active_handle_id() const
Returns an ID for the currently active memory buffer. Other memory buffers might contain old or no da...
Implementations of NMF operations using a plain single-threaded or OpenMP-enabled execution on CPU...