BaseVector Class Template Reference

Base class for the Dakota::Matrix and Dakota::Vector classes. More...

Inheritance diagram for BaseVector:

Matrix Vector List of all members.

Public Member Functions

 BaseVector ()
 Default constructor.
 BaseVector (size_t size)
 Constructor, creates vector of size.
 BaseVector (size_t size, const T &initial_val)
 Constructor, creates vector of size with initial value of initial_val.
 ~BaseVector ()
 Destructor.
 BaseVector (const BaseVector< T > &a)
 Copy constructor.
BaseVector< T > & operator= (const BaseVector< T > &a)
 Normal assignment operator.
BaseVector< T > & operator= (const T &ival)
 Assigns all values of vector to ival.
T & operator[] (int i)
 alternate bounds-checked indexing operator for int indices
const T & operator[] (int i) const
 alternate bounds-checked const indexing operator for int indices
T & operator[] (size_t i)
 Returns the object at index i, (can use as lvalue).
const T & operator[] (size_t i) const
 Returns the object at index i, const (can't use as lvalue).
T & operator() (size_t i)
 Index operator, not bounds checked.
const T & operator() (size_t i) const
 Index operator const , not bounds checked.
size_t length () const
 Returns size of vector.
void reshape (size_t sz)
 Resizes vector to size sz.
const T * data () const
 Returns const pointer to standard C array. Use with care.

Protected Member Functions

T * array () const
 Returns pointer to standard C array. Use with care.

Detailed Description

template<class T>
class Dakota::BaseVector< T >

Base class for the Dakota::Matrix and Dakota::Vector classes.

The Dakota::BaseVector class is the base class for the Dakota::Matrix class. It is used to define a common vector interface for both the STL and RW vector classes. If the STL version is based on the valarray class then some basic vector operations such as + , * are available.


Constructor & Destructor Documentation

BaseVector ( size_t  size,
const T &  initial_val 
) [inline]

Constructor, creates vector of size with initial value of initial_val.

Constructor which takes an initial size and an initial value, allocates an area of initial size and initializes it with input value. Calls base class constructor


Member Function Documentation

T & operator[] ( size_t  i  )  [inline]

Returns the object at index i, (can use as lvalue).

Index operator, calls the STL method at() which is bounds checked. Mimics the RW vector class. Note: the at() method is not supported by the __GNUC__ STL implementation or by builds omitting exceptions (e.g., SIERRA).

const T & operator[] ( size_t  i  )  const [inline]

Returns the object at index i, const (can't use as lvalue).

Const versions of the index operator calls the STL method at() which is bounds checked. Mimics the RW vector class. Note: the at() method is not supported by the __GNUC__ STL implementation or by builds omitting exceptions (e.g., SIERRA).

T & operator() ( size_t  i  )  [inline]

Index operator, not bounds checked.

Non bounds check index operator, calls the STL operator[] which is not bounds checked. Needed to mimic the RW vector class

const T & operator() ( size_t  i  )  const [inline]

Index operator const , not bounds checked.

Const version of the non-bounds check index operator, calls the STL operator[] which is not bounds checked. Needed to mimic the RW vector class

size_t length (  )  const [inline]

Returns size of vector.

Returns the length of the array by calling the STL size method. Needed to mimic the RW vector class

void reshape ( size_t  sz  )  [inline]

Resizes vector to size sz.

Resizes the array to size sz by calling the STL resize method. Needed to mimic the RW vector class

const T * data (  )  const [inline]

Returns const pointer to standard C array. Use with care.

Returns a const pointer to the data within the array. USE WITH CARE. Needed to mimic RW vector class.

T * array (  )  const [inline, protected]

Returns pointer to standard C array. Use with care.

Returns a non-const pointer to the data within the array. Non-const version of data() used by derived classes.


The documentation for this class was generated from the following file:
Generated on Wed Nov 5 19:54:06 2008 for DAKOTA by  doxygen 1.5.1