34 #ifndef _H_GRB_ALGORITHMS_NORM 35 #define _H_GRB_ALGORITHMS_NORM 44 namespace algorithms {
64 template<
typename OutputType,
typename InputType >
66 return( static_cast< OutputType >( std::sqrt( x ) ) );
90 typename InputType,
typename OutputType,
91 Backend backend,
typename Coords
96 const Ring &ring = Ring(),
97 const std::function< OutputType( OutputType ) > sqrtX =
98 std_sqrt< OutputType, OutputType >,
99 const typename std::enable_if<
100 std::is_floating_point< OutputType >::value,
101 void >::type * =
nullptr 103 InputType yyt = ring.template getZero< InputType >();
104 RC ret = grb::dot< descr >(
105 yyt, y, y, ring.getAdditiveMonoid(),
112 sqrtX( grb::utils::is_complex< InputType >::modulus( yyt ) ),
121 #endif // end ``_H_GRB_ALGORITHMS_NORM'' RC
Return codes of ALP primitives.
Definition: rc.hpp:47
A GraphBLAS vector.
Definition: vector.hpp:64
static constexpr Descriptor no_operation
Indicates no additional pre- or post-processing on any of the GraphBLAS function arguments.
Definition: descriptors.hpp:63
unsigned int Descriptor
Descriptors indicate pre- or post-processing for some or all of the arguments to an ALP/GraphBLAS cal...
Definition: descriptors.hpp:54
Conjugate-multiply operator that conjugates the right-hand operand before multiplication.
Definition: ops.hpp:918
RC foldl(IOType &x, const Vector< InputType, backend, Coords > &y, const Vector< MaskType, backend, Coords > &mask, const Monoid &monoid=Monoid(), const typename std::enable_if< !grb::is_object< IOType >::value &&!grb::is_object< InputType >::value &&!grb::is_object< MaskType >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr)
Reduces, or folds, a vector into a scalar.
Definition: blas1.hpp:3840
OutputType std_sqrt(const InputType x)
An alias of std::sqrt where the input and output types are templated separately.
Definition: norm.hpp:65
RC norm2(OutputType &x, const Vector< InputType, backend, Coords > &y, const Ring &ring=Ring(), const std::function< OutputType(OutputType) > sqrtX=std_sqrt< OutputType, OutputType >, const typename std::enable_if< std::is_floating_point< OutputType >::value, void >::type *=nullptr)
Provides a generic implementation of the 2-norm computation.
Definition: norm.hpp:93
Backend
A collection of all backends.
Definition: backends.hpp:49
This operator takes the sum of the two input parameters and writes it to the output variable.
Definition: ops.hpp:175
The ALP/GraphBLAS namespace.
Definition: graphblas.hpp:477
The main header to include in order to use the ALP/GraphBLAS API.
Indicates the primitive has executed successfully.
Definition: rc.hpp:54