std::pow(std::valarray)

From cppreference.com
< cpp‎ | numeric‎ | valarray
 
 
 
 
Defined in header <valarray>
template< class T >
valarray<T> pow( const valarray<T>& base, const valarray<T>& exp );
(1)
template< class T >
valarray<T> pow( const valarray<T>& base, const T& vexp );
(2)
template< class T >
valarray<T> pow( const T& vbase, const valarray<T>& exp );
(3)

Raises a value to a power.

1) Computes the values of each element in the numeric array base raised to the power specified by the corresponding element from the numeric array exp.

The behavior is undefined if base.size() != exp.size().

2) Computes the values of each element in the numeric array base raised to the power vexp.
3) Computes the values of vbase raised to the power defined by the elements in the numeric array exp.

Parameters

base - numeric array containing the values of the base
exp - numeric array containing the values of the exponent
vbase - a value defining the base
vexp - a value defining the exponent

Return value

A numeric array containing the results of exponentiation.

Notes

Unqualified function (pow) is used to perform the computation. If such function is not available, std::pow is used due to argument dependent lookup.

The function can be implemented with the return type different from std::valarray. In this case, the replacement type has the following properties:

Example

See also

applies the function std::sqrt to each element of valarray
(function template)
raises a number to the given power (xy)
(function)
complex power, one or both arguments may be a complex number
(function template)