Functions
Numeric Algorithms

Functions

template<size_t NX, size_t NY, typename T >
void ustl::load_identity (matrix< NX, NY, T > &m)
 Creates an identity matrix in m.
 
template<size_t NX, size_t NY, typename T >
matrix< NY, NY, T > ustl::operator* (const matrix< NX, NY, T > &m1, const matrix< NY, NX, T > &m2)
 Multiplies two matrices.
 
template<size_t NX, size_t NY, typename T >
tuple< NX, T > ustl::operator* (const tuple< NY, T > &t, const matrix< NX, NY, T > &m)
 Transforms vector t with matrix m.
 
template<size_t N, typename T >
void ustl::transpose (matrix< N, N, T > &m)
 Transposes (exchanges rows and columns) matrix m.
 
template<typename InputIterator , typename T >
ustl::accumulate (InputIterator first, InputIterator last, T init)
 
template<typename InputIterator , typename T , typename BinaryFunction >
ustl::accumulate (InputIterator first, InputIterator last, T init, BinaryFunction binary_op)
 
template<typename ForwardIterator , typename T >
void ustl::iota (ForwardIterator first, ForwardIterator last, T value)
 
template<typename InputIterator1 , typename InputIterator2 , typename T >
ustl::inner_product (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, T init)
 
template<typename InputIterator1 , typename InputIterator2 , typename T , typename BinaryOperation1 , typename BinaryOperation2 >
ustl::inner_product (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, T init, BinaryOperation1 sumOp, BinaryOperation2 productOp)
 
template<typename InputIterator , typename OutputIterator >
OutputIterator ustl::partial_sum (InputIterator first, InputIterator last, OutputIterator result)
 
template<typename InputIterator , typename OutputIterator , typename BinaryOperation >
OutputIterator ustl::partial_sum (InputIterator first, InputIterator last, OutputIterator result, BinaryOperation sumOp)
 
template<typename InputIterator , typename OutputIterator >
OutputIterator ustl::adjacent_difference (InputIterator first, InputIterator last, OutputIterator result)
 
template<typename InputIterator , typename OutputIterator , typename BinaryOperation >
OutputIterator ustl::adjacent_difference (InputIterator first, InputIterator last, OutputIterator result, BinaryOperation differenceOp)
 
template<typename T >
ustl::power (T x, unsigned n)
 Returns x^n. Donald Knuth's Russian Peasant algorithm.
 
template<typename T , typename BinaryOperation >
ustl::power (T x, unsigned n, BinaryOperation op)
 Returns x^n, using op instead of multiplication. Donald Knuth's Russian Peasant algorithm.
 

Detailed Description

Algorithms generalizing mathematical operations.

Function Documentation

template<typename InputIterator , typename T >
T ustl::accumulate ( InputIterator  first,
InputIterator  last,
init 
)
inline

Returns the sum of all elements in [first, last) added to init.

template<typename InputIterator , typename T , typename BinaryFunction >
T ustl::accumulate ( InputIterator  first,
InputIterator  last,
init,
BinaryFunction  binary_op 
)
inline

Returns the sum of all elements in [first, last) via op, added to init.

template<typename InputIterator , typename OutputIterator >
OutputIterator ustl::adjacent_difference ( InputIterator  first,
InputIterator  last,
OutputIterator  result 
)
inline

Writes result such that result[i] = first[i] - first[i - 1]

template<typename InputIterator , typename OutputIterator , typename BinaryOperation >
OutputIterator ustl::adjacent_difference ( InputIterator  first,
InputIterator  last,
OutputIterator  result,
BinaryOperation  differenceOp 
)
inline

Writes result such that result[i] = differenceOp (first[i], first[i - 1])

template<typename InputIterator1 , typename InputIterator2 , typename T >
T ustl::inner_product ( InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2,
init 
)
inline

Returns the sum of products of respective elements in the given ranges.

template<typename InputIterator1 , typename InputIterator2 , typename T , typename BinaryOperation1 , typename BinaryOperation2 >
T ustl::inner_product ( InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2,
init,
BinaryOperation1  sumOp,
BinaryOperation2  productOp 
)
inline

Returns the sum of products of respective elements in the given ranges.

template<typename ForwardIterator , typename T >
void ustl::iota ( ForwardIterator  first,
ForwardIterator  last,
value 
)
inline

Assigns range [value, value + (last - first)) to [first, last)

template<typename InputIterator , typename OutputIterator >
OutputIterator ustl::partial_sum ( InputIterator  first,
InputIterator  last,
OutputIterator  result 
)
inline

Writes result such that result[i] = sum (first...first+i)

template<typename InputIterator , typename OutputIterator , typename BinaryOperation >
OutputIterator ustl::partial_sum ( InputIterator  first,
InputIterator  last,
OutputIterator  result,
BinaryOperation  sumOp 
)
inline

Writes result such that result[i] = sumOp (first...first+i)


Generated on Mon Sep 28 2015 17:58:50 for uSTL by Doxygen 1.8.10