Gadget
Public Member Functions | Protected Attributes | List of all members
DoubleMatrix Class Reference

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

#include <doublematrix.h>

Collaboration diagram for DoubleMatrix:
Collaboration graph

Public Member Functions

 DoubleMatrix ()
 This is the default DoubleMatrix constructor. More...
 
 DoubleMatrix (int nr, int nc, double initial)
 This is the DoubleMatrix constructor for a specified size. More...
 
 DoubleMatrix (const DoubleMatrix &initial)
 This is the DoubleMatrix constructor that creates a copy of an existing DoubleMatrix. More...
 
 ~DoubleMatrix ()
 This is the DoubleMatrix destructor. More...
 
int Ncol (int i=0) const
 This will return the number of columns in row i of the vector. More...
 
int Nrow () const
 This will return the number of rows of the vector. More...
 
DoubleVectoroperator[] (int pos)
 This will return the value of an element of the vector. More...
 
const DoubleVectoroperator[] (int pos) const
 This will return the value of an element of the vector. More...
 
void AddRows (int add, int length, double value)
 This will add new entries to the vector. More...
 
void Delete (int pos)
 This will delete an entry from 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...
 
void Print (ofstream &outfile) const
 This function will print the data stored in the vector. More...
 
DoubleMatrixoperator= (const DoubleMatrix &d)
 This operator will set the vector equal to an existing DoubleMatrix. More...
 

Protected Attributes

int nrow
 This is number of rows of the vector. More...
 
DoubleVector ** v
 This is the vector of DoubleVector values. More...
 

Detailed Description

This class implements a dynamic vector of DoubleVector values.

Constructor & Destructor Documentation

◆ DoubleMatrix() [1/3]

DoubleMatrix::DoubleMatrix ( )
inline

This is the default DoubleMatrix constructor.

◆ DoubleMatrix() [2/3]

DoubleMatrix::DoubleMatrix ( int  nr,
int  nc,
double  initial 
)

This is the DoubleMatrix constructor for a specified size.

Parameters
nris the size of the vector to be created
ncis the length of each row to be created (ie. the size of the DoubleVector to be created for each row)
initialis the initial value for all the entries of the vector

◆ DoubleMatrix() [3/3]

DoubleMatrix::DoubleMatrix ( const DoubleMatrix initial)

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

Parameters
initialis the DoubleMatrix to copy

◆ ~DoubleMatrix()

DoubleMatrix::~DoubleMatrix ( )

This is the DoubleMatrix destructor.

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

Member Function Documentation

◆ AddRows()

void DoubleMatrix::AddRows ( int  add,
int  length,
double  value 
)

This will add new entries to the vector.

Parameters
addis the number of new entries to the vector
lengthis the number of entries to the DoubleVector that is created
valueis the value that will be entered for the new entries

◆ Delete()

void DoubleMatrix::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

◆ Ncol()

int DoubleMatrix::Ncol ( int  i = 0) const
inline

This will return the number of columns in row i of the vector.

Parameters
iis the row of the vector to have the number of columns counted
Returns
the number of columns in row i of the vector
Note
This is the number of entries in the DoubleVector that is entry i of the DoubleMatrix

◆ Nrow()

int DoubleMatrix::Nrow ( ) const
inline

This will return the number of rows of the vector.

Returns
the number of rows of the vector

◆ operator=()

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

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

Parameters
dis the DoubleMatrix to copy

◆ operator[]() [1/2]

DoubleVector& DoubleMatrix::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 DoubleVector& DoubleMatrix::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

◆ Print()

void DoubleMatrix::Print ( ofstream &  outfile) const

This function will print the data stored in the vector.

Parameters
outfileis the ofstream that all the model information gets sent to

◆ Reset()

void DoubleMatrix::Reset ( )

This will reset the vector.

Note
This will delete every entry from the vector and set the number of rows to zero

◆ setToZero()

void DoubleMatrix::setToZero ( )

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

Member Data Documentation

◆ nrow

int DoubleMatrix::nrow
protected

This is number of rows of the vector.

◆ v

DoubleVector** DoubleMatrix::v
protected

This is the vector of DoubleVector values.


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