| Home | Libraries | People | FAQ | More

## Class template valarray

boost::compute::valarray

## Synopsis

    // In header: <boost/compute/container/valarray.hpp>

    template<typename T>
    class valarray {
    public:

      // public member functions
      explicit valarray(const context & = system::default_context());
      explicit valarray(size_t, const context & = system::default_context());
      valarray(const T &, size_t, const context & = system::default_context());
      valarray(const T *, size_t, const context & = system::default_context());
      valarray(const valarray< T > &);
      valarray(const std::valarray< T > &,
               const context & = system::default_context());
      valarray< T > & operator=(const valarray< T > &);
      valarray< T > & operator=(const std::valarray< T > &);
      valarray< T > & operator*=(const T &);
      valarray< T > & operator/=(const T &);
      valarray< T > & operator%=(const T &);
      valarray< T > operator+() const;
      valarray< T > operator-() const;
      valarray< T > operator~() const;
      valarray< char > operator!() const;
      valarray< T > & operator+=(const T &);
      valarray< T > & operator-=(const T &);
      valarray< T > & operator^=(const T &);
      valarray< T > & operator&=(const T &);
      valarray< T > & operator|=(const T &);
      valarray< T > & operator<<=(const T &);
      valarray< T > & operator>>=(const T &);
      valarray< T > & operator*=(const valarray< T > &);
      valarray< T > & operator/=(const valarray< T > &);
      valarray< T > & operator%=(const valarray< T > &);
      valarray< T > & operator+=(const valarray< T > &);
      valarray< T > & operator-=(const valarray< T > &);
      valarray< T > & operator^=(const valarray< T > &);
      valarray< T > & operator&=(const valarray< T > &);
      valarray< T > & operator|=(const valarray< T > &);
      valarray< T > & operator<<=(const valarray< T > &);
      valarray< T > & operator>>=(const valarray< T > &);
      ~valarray();
      size_t size() const;
      void resize(size_t, T = T());
      unspecified operator[](size_t);
      unspecified operator[](size_t) const;
      T() min() const;
      T() max() const;
      T sum() const;
      template<typename UnaryFunction> valarray< T > apply(UnaryFunction) const;
      const buffer & get_buffer() const;

      // private member functions
      buffer_iterator< T > begin() const;
      buffer_iterator< T > end() const;
    };

## Description

### `valarray` public member functions

1.     explicit valarray(const context & context = system::default_context());

2.     explicit valarray(size_t size,
                         const context & context = system::default_context());

3.     valarray(const T & value, size_t size,
                const context & context = system::default_context());

4.     valarray(const T * values, size_t size,
                const context & context = system::default_context());

5.     valarray(const valarray< T > & other);

6.     valarray(const std::valarray< T > & valarray,
                const context & context = system::default_context());

7.     valarray< T > & operator=(const valarray< T > & other);

8.     valarray< T > & operator=(const std::valarray< T > & valarray);

9.     valarray< T > & operator*=(const T &);

10.     valarray< T > & operator/=(const T &);

11.     valarray< T > & operator%=(const T & val);

12.     valarray< T > operator+() const;

13.     valarray< T > operator-() const;

14.     valarray< T > operator~() const;

15.     valarray< char > operator!() const;

    In OpenCL there cannot be memory buffer with bool type, for this reason return type is valarray<char> instead of valarray<bool>. 1 means true, 0 means false.

16.     valarray< T > & operator+=(const T &);

17.     valarray< T > & operator-=(const T &);

18.     valarray< T > & operator^=(const T &);

19.     valarray< T > & operator&=(const T &);

20.     valarray< T > & operator|=(const T &);

21.     valarray< T > & operator<<=(const T &);

22.     valarray< T > & operator>>=(const T &);

23.     valarray< T > & operator*=(const valarray< T > &);

24.     valarray< T > & operator/=(const valarray< T > &);

25.     valarray< T > & operator%=(const valarray< T > &);

26.     valarray< T > & operator+=(const valarray< T > &);

27.     valarray< T > & operator-=(const valarray< T > &);

28.     valarray< T > & operator^=(const valarray< T > &);

29.     valarray< T > & operator&=(const valarray< T > &);

30.     valarray< T > & operator|=(const valarray< T > &);

31.     valarray< T > & operator<<=(const valarray< T > &);

32.     valarray< T > & operator>>=(const valarray< T > &);

33.     ~valarray();

34.     size_t size() const;

35.     void resize(size_t size, T value = T());

36.     unspecified operator[](size_t index);

37.     unspecified operator[](size_t index) const;

38.     T() min() const;

39.     T() max() const;

40.     T sum() const;

41.     template<typename UnaryFunction>
          valarray< T > apply(UnaryFunction function) const;

42.     const buffer & get_buffer() const;

### `valarray` private member functions

1.     buffer_iterator< T > begin() const;

2.     buffer_iterator< T > end() const;