Gadget
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | List of all members
DoubleVector Class Reference

This class implements a dynamic vector of double values. More...

#include <doublevector.h>

Collaboration diagram for DoubleVector:
Collaboration graph

Public Member Functions

 DoubleVector ()
 This is the default DoubleVector constructor. More...
 
 DoubleVector (int sz)
 This is the DoubleVector constructor for a specified size. More...
 
 DoubleVector (int sz, double initial)
 This is the DoubleVector constructor for a specified size with an initial value. More...
 
 DoubleVector (const DoubleVector &initial)
 This is the DoubleVector constructor that creates a copy of an existing DoubleVector. More...
 
 ~DoubleVector ()
 This is the DoubleVector destructor. More...
 
void resize (int addsize, double value)
 This will add new entries to the vector. More...
 
void Delete (int pos)
 This will delete an entry from the vector. More...
 
int Size () const
 This will return the size of the vector. More...
 
double & operator[] (int pos)
 This will return the value of an element of the vector. More...
 
const double & operator[] (int pos) const
 This will return the value of an element of the vector. More...
 
void Reset ()
 This will reset the vector. More...
 
void setToZero ()
 This function will set all of the entries of the vector to zero. More...
 
double operator* (const DoubleVector &d) const
 This operator will calculate the dot product of the vector and an existing DoubleVector. More...
 
DoubleVectoroperator= (const DoubleVector &d)
 This operator will set the vector equal to an existing DoubleVector. More...
 

Protected Attributes

double * v
 This is the vector of double values. More...
 
int size
 This is the size of the vector. More...
 

Detailed Description

This class implements a dynamic vector of double values.

Constructor & Destructor Documentation

◆ DoubleVector() [1/4]

DoubleVector::DoubleVector ( )
inline

This is the default DoubleVector constructor.

◆ DoubleVector() [2/4]

DoubleVector::DoubleVector ( int  sz)

This is the DoubleVector constructor for a specified size.

Parameters
szis the size of the vector to be created
Note
The elements of the vector will all be created, and set to zero

◆ DoubleVector() [3/4]

DoubleVector::DoubleVector ( int  sz,
double  initial 
)

This is the DoubleVector constructor for a specified size with an initial value.

Parameters
szis the size of the vector to be created
initialis the initial value for all the entries of the vector

◆ DoubleVector() [4/4]

DoubleVector::DoubleVector ( const DoubleVector initial)

This is the DoubleVector constructor that creates a copy of an existing DoubleVector.

Parameters
initialis the DoubleVector to copy

◆ ~DoubleVector()

DoubleVector::~DoubleVector ( )

This is the DoubleVector destructor.

Note
This will free all the memory allocated to all the elements of the vector

Member Function Documentation

◆ Delete()

void DoubleVector::Delete ( int  pos)

This will delete an entry from the vector.

Parameters
posis the element of the vector to be deleted
Note
This will free the memory allocated to the deleted element of the vector

◆ operator*()

double DoubleVector::operator* ( const DoubleVector d) const

This operator will calculate the dot product of the vector and an existing DoubleVector.

Parameters
dis the DoubleVector to copy
Returns
the dot product of the two vectors

◆ operator=()

DoubleVector & DoubleVector::operator= ( const DoubleVector d)

This operator will set the vector equal to an existing DoubleVector.

Parameters
dis the DoubleVector to copy

◆ operator[]() [1/2]

double& DoubleVector::operator[] ( int  pos)
inline

This will return the value of an element of the vector.

Parameters
posis the element of the vector to be returned
Returns
the value of the specified element

◆ operator[]() [2/2]

const double& DoubleVector::operator[] ( int  pos) const
inline

This will return the value of an element of the vector.

Parameters
posis the element of the vector to be returned
Returns
the value of the specified element

◆ Reset()

void DoubleVector::Reset ( )

This will reset the vector.

Note
This will delete every entry from the vector and set the size to zero

◆ resize()

void DoubleVector::resize ( int  addsize,
double  value 
)

This will add new entries to the vector.

Parameters
addsizeis the number of new entries to the vector
valueis the value that will be entered for the new entries

◆ setToZero()

void DoubleVector::setToZero ( )

This function will set all of the entries of the vector to zero.

◆ Size()

int DoubleVector::Size ( ) const
inline

This will return the size of the vector.

Returns
the size of the vector

Member Data Documentation

◆ size

int DoubleVector::size
protected

This is the size of the vector.

◆ v

double* DoubleVector::v
protected

This is the vector of double values.


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