1 #ifndef VIENNACL_LINALG_NORM_2_HPP_
2 #define VIENNACL_LINALG_NORM_2_HPP_
40 #ifdef VIENNACL_WITH_MTL4
44 template<
typename VectorT >
46 typename VectorT::value_type>::type
49 return mtl::two_norm(v);
53 #ifdef VIENNACL_WITH_ARMADILLO
57 template<
typename NumericT>
64 #ifdef VIENNACL_WITH_EIGEN
68 template<
typename VectorT >
70 typename VectorT::RealScalar>::type
78 #ifdef VIENNACL_WITH_UBLAS
82 template<
typename VectorT >
84 typename VectorT::value_type>::type
95 template<
typename T,
typename A >
99 for (
typename std::vector<T, A>::size_type i=0; i<v1.size(); ++i)
100 result += v1[i] * v1[i];
102 return std::sqrt(result);
108 template<
typename ScalarType>
121 template<
typename LHS,
typename RHS,
typename OP>
Simple enable-if variant that uses the SFINAE pattern.
Dispatch facility for distinguishing between ublas, STL and ViennaCL types.
T norm_2(std::vector< T, A > const &v1)
This file provides the forward declarations for the main types used within ViennaCL.
A proxy for scalar expressions (e.g. from inner vector products)
An expression template class that represents a binary operation that yields a vector.
viennacl::vector< float > v1
Common base class for dense vectors, vector ranges, and vector slices.
viennacl::scalar_expression< const viennacl::vector_expression< const LHS, const RHS, OP >, const viennacl::vector_expression< const LHS, const RHS, OP >, viennacl::op_norm_2 > norm_2(viennacl::vector_expression< const LHS, const RHS, OP > const &vector)
A tag class representing the 2-norm of a vector.
Simple enable-if variant that uses the SFINAE pattern.