Array Class Reference

1-D array used in linear algebra. More...

`#include <ql/math/array.hpp>`

## Public Member Functions

Constructors, destructor, and assignment
| Array (Size size=0)
| creates the array with the given dimension
| Array (Size size, Real value)
| creates the array and fills it with `value`
| Array (Size size, Real value, Real increment)
| creates the array and fills it according to \( a_{0} = value, a_{i}=a_{i-1}+increment \)
| Array (const Array &)
| Array (const Disposable< Array > &)
template<class ForwardIterator >
| Array (ForwardIterator begin, ForwardIterator end)
| creates the array from an iterable sequence
Array & | operator= (const Array &)
Array & | operator= (const Disposable< Array > &)
bool | operator== (const Array &) const
bool | operator!= (const Array &) const
Vector algebra

`v += x` and similar operation involving a scalar value are shortcuts for \( \forall i : v_i = v_i + x \)

`v *= w` and similar operation involving two vectors are shortcuts for \( \forall i : v_i = v_i \times w_i \)

Precondition
  all arrays involved in an algebraic expression must have the same size.

const Array & | operator+= (const Array &)
const Array & | operator+= (Real)
const Array & | operator-= (const Array &)
const Array & | operator-= (Real)
const Array & | operator*= (const Array &)
const Array & | operator*= (Real)
const Array & | operator/= (const Array &)
const Array & | operator/= (Real)
Element access
Real | operator[] (Size) const
| read-only
Real | at (Size) const
Real | front () const
Real | back () const
Real & | operator[] (Size)
| read-write
Real & | at (Size)
Real & | front ()
Real & | back ()
Iterator access
const_iterator | begin () const
iterator | begin ()
const_iterator | end () const
iterator | end ()
const_reverse_iterator | rbegin () const
reverse_iterator | rbegin ()
const_reverse_iterator | rend () const
reverse_iterator | rend ()

## Related Functions

(Note that these are not member functions.)
Real | DotProduct (const Array &, const Array &)
Real | Norm2 (const Array &)
Disposable< Array > | operator+ (const Array &v)
Disposable< Array > | operator- (const Array &v)
Disposable< Array > | operator+ (const Array &, const Array &)
Disposable< Array > | operator+ (const Array &, Real)
Disposable< Array > | operator+ (Real, const Array &)
Disposable< Array > | operator- (const Array &, const Array &)
Disposable< Array > | operator- (const Array &, Real)
Disposable< Array > | operator- (Real, const Array &)
Disposable< Array > | operator* (const Array &, const Array &)
Disposable< Array > | operator* (const Array &, Real)
Disposable< Array > | operator* (Real, const Array &)
Disposable< Array > | operator/ (const Array &, const Array &)
Disposable< Array > | operator/ (const Array &, Real)
Disposable< Array > | operator/ (Real, const Array &)
Disposable< Array > | Abs (const Array &)
Disposable< Array > | Sqrt (const Array &)
Disposable< Array > | Log (const Array &)
Disposable< Array > | Exp (const Array &)
Disposable< Array > | Pow (const Array &, Real)
void | swap (Array &, Array &)
std::ostream & | operator<< (std::ostream &, const Array &)

## Inspectors

typedef Size | size_type
typedef Real | value_type
typedef Real * | iterator
typedef const Real * | const_iterator
typedef boost::reverse_iterator< iterator > | reverse_iterator
typedef boost::reverse_iterator< const_iterator > | const_reverse_iterator
Size | size () const
| dimension of the array
bool | empty () const
| whether the array is empty

## Utilities

void | resize (Size n)
void | swap (Array &)

## Detailed Description

1-D array used in linear algebra.

This class implements the concept of vector as used in linear algebra. As such, it is not meant to be used as a container - `std::vector` should be used instead.

Tests:
  construction of arrays is checked in a number of cases

Examples
  Gaussian1dModels.cpp, and GlobalOptimizer.cpp.