File vector_math.hpp

namespace math

Functions

template<typename Iterator>
static inline util::iterator_value<Iterator> l1Norm(Iterator iterator, uint32 n)

Computes and returns the L1 norm of a specific vector, i.e., the sum of the absolute values of its elements.

Template Parameters:

Iterator – The type of the iterator that provides access to the elements in the vector

Parameters:
  • iterator – An iterator of template type Iterator that provides random access to the elements in the vector

  • n – The number of elements in the vector

Returns:

The L1 norm

template<typename Iterator, typename WeightIterator>
static inline util::iterator_value<Iterator> l1Norm(Iterator iterator, WeightIterator weightIterator, uint32 n)

Computes and returns the L1 norm of a specific vector, i.e., the sum of the absolute values of its elements, where each element has a specific weight.

Template Parameters:
  • Iterator – The type of the iterator that provides access to the elements in the vector

  • WeightIterator – The type of the iterator that provides access to the weights of the elements

Parameters:
  • iterator – An iterator of template type Iterator that provides random access to the elements in the vector

  • weightIterator – An iterator of template type WeightIterator that provides random access to the weights of the elements

  • n – The number of elements in the vector

Returns:

The L1 norm

template<typename Iterator>
static inline util::iterator_value<Iterator> l2NormPow(Iterator iterator, uint32 n)

Computes and returns the square of the L2 norm of a specific vector, i.e. the sum of the squares of its elements. To obtain the actual L2 norm, the square-root of the result provided by this function must be computed.

Template Parameters:

Iterator – The type of the iterator that provides access to the elements in the vector

Parameters:
  • iterator – An iterator of template type Iterator that provides random access to the elements in the vector

  • n – The number of elements in the vector

Returns:

The square of the L2 norm

template<typename Iterator, typename WeightIterator>
static inline util::iterator_value<Iterator> l2NormPow(Iterator iterator, WeightIterator weightIterator, uint32 n)

Computes and returns the square of the L2 norm of a specific vector, i.e. the sum of the squares of its elements, where each elements has a specific weight. To obtain the actual L2 norm, the square-root of the result provided by this function must be computed.

Template Parameters:
  • Iterator – The type of the iterator that provides access to the elements in the vector

  • WeightIterator – The type of the iterator that provides access to the weights of the elements

Parameters:
  • iterator – An iterator of template type Iterator that provides random access to the elements in the vector

  • weightIterator – An iterator of template type WeightIterator that provides random access to the weights of the elements

  • n – The number of elements in the vector

Returns:

The square of the L2 norm