abs

abs

template<class T>
    valarray<T> abs(const valarray<T>& x);

The template function returns an object of class valarray<T>, each of whose elements I is the absolute value of x[I].

See the related sample program.