Logo Search packages:      
Sourcecode: quantlib version File versions

QuantLib::Array Class Reference

#include <array.hpp>

List of all members.


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.

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

Definition at line 49 of file array.hpp.


Public Types

typedef const Real * const_iterator
typedef
boost::reverse_iterator
< const_iterator > 
const_reverse_iterator
typedef Real * iterator
typedef
boost::reverse_iterator
< iterator > 
reverse_iterator
typedef Real value_type

Public Member Functions

Constructors, destructor, and assignment
 Array (const std::vector< Real > &)
 creates the array as a copy of a given stl vector
 Array (const Disposable< Array > &)
 Array (const Array &)
 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 (Size size, Real value)
 creates the array and fills it with value
 Array (Size size=0)
 creates the array with the given dimension
bool operator!= (const Array &) const
Arrayoperator= (const Disposable< Array > &)
Arrayoperator= (const Array &)
bool operator== (const Array &) const
Element access
Real & at (Size)
Real at (Size) const
Real & back ()
Real back () const
Real & front ()
Real front () const
Real & operator[] (Size)
 read-write
Real operator[] (Size) const
 read-only
Iterator access
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 () const
Inspectors
bool empty () const
 whether the array is empty
Size size () const
 dimension of the array
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 Arrayoperator*= (Real)
const Arrayoperator*= (const Array &)
const Arrayoperator+= (Real)
const Arrayoperator+= (const Array &)
const Arrayoperator-= (Real)
const Arrayoperator-= (const Array &)
const Arrayoperator/= (Real)
const Arrayoperator/= (const Array &)
Utilities
void swap (Array &)

Private Attributes

boost::scoped_array< Real > data_
Size n_

Related Functions

(Note that these are not member functions.)

const Disposable< ArrayAbs (const Array &)
Real DotProduct (const Array &, const Array &)
const Disposable< ArrayExp (const Array &)
const Disposable< ArrayLog (const Array &)
const Disposable< Arrayoperator* (Real, const Array &)
const Disposable< Arrayoperator* (const Array &, Real)
const Disposable< Arrayoperator* (const Array &, const Array &)
const Disposable< Arrayoperator+ (Real, const Array &)
const Disposable< Arrayoperator+ (const Array &, Real)
const Disposable< Arrayoperator+ (const Array &, const Array &)
const Disposable< Arrayoperator+ (const Array &v)
const Disposable< Arrayoperator- (Real, const Array &)
const Disposable< Arrayoperator- (const Array &, Real)
const Disposable< Arrayoperator- (const Array &, const Array &)
const Disposable< Arrayoperator- (const Array &v)
const Disposable< Arrayoperator/ (Real, const Array &)
const Disposable< Arrayoperator/ (const Array &, Real)
const Disposable< Arrayoperator/ (const Array &, const Array &)
std::ostream & operator<< (std::ostream &, const Array &)
const Disposable< ArraySqrt (const Array &)
void swap (Array &, Array &)

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index