class DVector

Data Vector class.

Inheritance:


Public Classes

enum DVType
DVector data type enumeration.

Public Fields

typedef unsigned int size_t
Size and index data type.

Public Methods

DVector(void)
Default constructor.
virtual ~DVector()
Destructor.
virtual DVector* DupVector(void) const
Duplicate a DVector.
virtual DVector* Extract(size_t length) const
Extract a subset of a vector.
virtual DVector* Extract(size_t inx, size_t length) const
Extract a subset of a vector.
virtual DVector* Extract(size_t inx, size_t length, size_t inc) const
Extract a subset of a vector.
virtual DVType getType(void) const
Get the data type
const char* getTypeName(void) const
Get the data type name.
bool S_data(void) const
Test for short int data.
bool I_data(void) const
Test for float data.
bool F_data(void) const
Test for float data.
bool D_data(void) const
Test for float data.
bool C_data(void) const
Test for fComplex data.
virtual size_t getSize(void) const
Get the size of a data word.
virtual size_t getLength(void) const
Get the data length.
virtual void ReSize(size_t len)
Expand the vector storage.
virtual void setLength(size_t len)
Set the number of data words.
virtual void* refData(void)
Get a pointer to the data.
virtual const void* refData(void) const
Get a constant pointer to the data.
virtual size_t getData(size_t inx, size_t Ndata, short Data[]) const
Copy/Convert data into a short integer array.
virtual size_t getData(size_t inx, size_t Ndata, int Data[]) const
Copy/Convert data into a float array.
virtual size_t getData(size_t inx, size_t Ndata, float Data[]) const
Copy/Convert data into a float array.
virtual size_t getData(size_t inx, size_t Ndata, double Data[]) const
Copy/Convert data into a float array.
virtual size_t getData(size_t inx, size_t Ndata, fComplex Data[]) const
Copy/Convert data into a complex array.
virtual short getShort(size_t inx) const
Get one data word.
virtual int getInt(size_t inx) const
Get one data word.
virtual float getFloat(size_t inx) const
Get one data word.
virtual double getDouble(size_t inx) const
Get one data word.
virtual fComplex getCplx(size_t inx) const
Get one data word.
virtual double getMaximum(void) const
Maximum data value.
virtual double getMinimum(void) const
Minimum data value.
virtual size_t getNBetween(double low, double high) const
Number of entries greater than limit.
virtual size_t getNGreater(double limit) const
Number of entries greater than limit.
virtual size_t getNLess(double limit) const
Number of entries less than limit.
virtual double VSum(size_t inx=0, size_t N=0) const
Sum N data words.
virtual double operator*(const DVector& rhs) const
Inner product.
virtual DVector& operator =(const DVector& rhs)
Assignment operator.
virtual bool operator==(const DVector& rhs) const
Comparison operator.
virtual DVector& operator+=(const DVector& rhs)
Add a DVector.
virtual DVector& operator-=(const DVector& rhs)
Subtract a DVector.
virtual DVector& operator+=(double rhs)
Bias a DVector.
DVector& operator-=(double rhs)
Bias a DVector (negative).
virtual DVector& operator*=(double rhs)
Scale a DVector.
DVector& operator/=(double rhs)
Scale a DVector (divide).
virtual DVector& operator*=(const DVector& rhs)
Element by element multiplication of DVector.
virtual DVector& operator/=(const DVector& rhs)
Divide by a DVector.
virtual ostream& Dump(ostream& out) const
Dump the vector contents.
virtual void Append(size_t N, const short* data)
Append short integer data to a vector.
virtual void Append(size_t N, const int* data)
Append integer data to a vector.
virtual void Append(size_t N, const float* data)
Append float data to a vector.
virtual void Append(size_t N, const double* data)
Append double float data to a vector.
virtual void Append(size_t N, const fComplex* data)
Append complex data to a vector.
virtual void Append(const DVector& data)
Append a DVector to a DVector.
virtual void Clear(void)
Clear a DVector.
virtual void Conjugate(void)
Conjugate a DVector.
void Extend(size_t N)
Extend a DVector.

Documentation

The data vector holds a variable length data vector of arbitrary type. Methods are provided to convert data to a standard type independent of the internal representation of the data. DVector are primarily used for time and frequency series.
enum DVType
DVType enumerates the data types that may be held by a DVector. Some of the data vector types may not be implemented.

typedef unsigned int size_t
Data type used internally for size and index variables.

DVector(void)
Initialize the base class element, the data length.

virtual ~DVector()
Null base class destructor.

virtual DVector* DupVector(void) const
An instance of a class derived from DVector is duplicated and a pointer to the duplicate is returned. All data are copied.
Returns:
a pointer to the DVector clone.

virtual DVector* Extract(size_t length) const
A substring starting at the first element is extracted from the DVector. The substring length is forced to be valid.
Returns:
a pointer to a new DVector containing the extracted data.
Parameters:
length - number of data elements to be extracted.

virtual DVector* Extract(size_t inx, size_t length) const
A substring is extracted from the DVector. The substring length is forced to be valid.
Returns:
a pointer to a new DVector containing the extracted data.
Parameters:
inx - index of first element to be extracted
length - number of data elements to be extracted.

virtual DVector* Extract(size_t inx, size_t length, size_t inc) const
A substring is extracted and decimated from the DVector. The extracted vector contains the elements defined by DVector[N*inc] where N is all the integers 0 <= N < length.
Returns:
pointer to the extracted data vector.
Parameters:
inx - Starting index of the substring to be extracted
length - Number of elements to be extracted
inc - Index increment between successive extracted elements.

virtual DVType getType(void) const
Return the data vector type as a DVector::DVType code.
Returns:
a data vector type code.

const char* getTypeName(void) const
Get the data type name as a constant character string.
Returns:
pointer to a constant character array containing the data type name.

bool S_data(void) const
Test if the vector data type is t_short.
Returns:
true if the vector data contains short integers.

bool I_data(void) const
Test if the vector data type is t_float.
Returns:
true if the vector data contains floats.

bool F_data(void) const
Test if the vector data type is t_float.
Returns:
true if the vector data contains floats.

bool D_data(void) const
Test if the vector data type is t_float.
Returns:
true if the vector data contains floats.

bool C_data(void) const
Test if the vector data type is t_complex.
Returns:
true if the vector data type is t_complex.

virtual size_t getSize(void) const
Get the number of bytes in a data word.
Returns:
The number of bytes in a data word.

virtual size_t getLength(void) const
Get the number of data elements in the vector.
Returns:
The data vector length.

virtual void ReSize(size_t len)
Resize() insures that there is sufficient storage allocated for 'len' data items. No memory is release if the current allocation is greater than the requested size. The vector data are copied if the vector storage must be reallocated.
Parameters:
len - Minimum number of words that must be available,

virtual void setLength(size_t len)
The current number of data words is set to 'len'. No validity checking (e.g. length <= allocated size) or initialization of data words are performed. The allocated storage remains the same.
Parameters:
len - Number of valid words in vector.

virtual void* refData(void)
Get a pointer to the data array.
Returns:
void pointer to the data array.

virtual const void* refData(void) const
Get a constant pointer to the data array.
Returns:
constant void pointer to the data array.

virtual size_t getData(size_t inx, size_t Ndata, short Data[]) const
Copy data into a short integer output array. If the DVector has a different type than the output array, the data are converted to the output type.
Returns:
number of data words actually copied.
Parameters:
inx - Starting index of data to be copied.
Ndata - Maximum number of data words to be copied.
Data - Output short integer array.

virtual size_t getData(size_t inx, size_t Ndata, int Data[]) const
Copy data into an integer output array. If the DVector has a different type than the output array, the data are converted to the output type.
Returns:
number of data words actually copied.
Parameters:
inx - Starting index of data to be copied.
Ndata - Maximum number of data words to be copied.
Data - Output integer array.

virtual size_t getData(size_t inx, size_t Ndata, float Data[]) const
Copy data into a float output array. If the DVector has a different type than the output array, the data are converted to the output type.
Returns:
number of data words actually copied.
Parameters:
inx - Starting index of data to be copied.
Ndata - Maximum number of data words to be copied.
Data - Output float array.

virtual size_t getData(size_t inx, size_t Ndata, double Data[]) const
Copy data into a double float output array. If the DVector has a different type than the output array, the data are converted to the output type.
Returns:
number of data words actually copied.
Parameters:
inx - Starting index of data to be copied.
Ndata - Maximum number of data words to be copied.
Data - Output double float array.

virtual size_t getData(size_t inx, size_t Ndata, fComplex Data[]) const
Copy data into a complex output array. If the DVector has a different type than the output array, the data are converted to the output type.
Returns:
number of data words actually copied.
Parameters:
inx - Starting index of data to be copied.
Ndata - Maximum number of data words to be copied.
Data - Output complex array.

virtual short getShort(size_t inx) const
A specified data word is picked up from the DVector, converted to a short integer and returned. No validity checking is made on the index.
Returns:
value of selected word converted if necessary to short integer.
Parameters:
inx - Index into the data vector of the word to be returned.

virtual int getInt(size_t inx) const
A specified data word is picked up from the DVector, converted to an integer and returned. No validity checking is made on the index.
Returns:
value of selected word converted if necessary to integer.
Parameters:
inx - Index into the data vector of the word to be returned.

virtual float getFloat(size_t inx) const
A specified data word is picked up from the DVector, converted to a float and returned. No validity checking is made on the index.
Returns:
value of selected work converted if necessary to float.
Parameters:
inx - Index into the data vector of the word to be returned.

virtual double getDouble(size_t inx) const
A specified data word is picked up from the DVector, converted to a double float and returned. No validity checking is made on the index.
Returns:
value of selected word converted if necessary to double.
Parameters:
inx - Index into the data vector of the word to be returned.

virtual fComplex getCplx(size_t inx) const
A specified data word is picked up from the DVector, converted to a complex and returned. No validity checking is made on the index.
Returns:
value of selected work converted if necessary to complex.
Parameters:
inx - Index into the data vector of the word to be returned.

virtual double getMaximum(void) const
Return the largest entry. If the vector is complex, the largest real part is returned.
Returns:
Largest data value.

virtual double getMinimum(void) const
Return the smallest entry. If the vector is complex, the smallest real part is returned.
Returns:
Smallest data value.

virtual size_t getNBetween(double low, double high) const
Count the number of entries between two specified limits. If the vector is complex, the real part is compared.
Returns:
Number of entries greater than limit.
Parameters:
limit - Lower limit of entries to be counted.

virtual size_t getNGreater(double limit) const
Count the number of entries with value greater than the specified limit. If the vector is complex, the real part is compared.
Returns:
Number of entries greater than limit.
Parameters:
limit - Lower limit of entries to be counted.

virtual size_t getNLess(double limit) const
Count the number of entries with value less than the specified limit. If the vector is complex, the real part is compared.
Returns:
Number of entries less than limit.
Parameters:
limit - Upper limit of entries to be counted.

virtual double VSum(size_t inx=0, size_t N=0) const
All words in a specified range are converted to double and summed.
Returns:
Sum of specified data vector.
Parameters:
inx - Index into the data vector of first word to be summed.
N - Number of words to be summed.

virtual double operator*(const DVector& rhs) const
Calculate the inner (dot) product of two DVectors. The inner product is defined as the sum of the products of the corresponding elements, i.e. . If the right hand side operand is complex, it is conjugated before the multiplication.
Returns:
The dot product of two DVectors.
Parameters:
rhs - DVector to be multiplied by the other.

virtual DVector& operator =(const DVector& rhs)
The data from the rhs DVector is converted and copied to the lhs DVector. The original data in the lhs DVector are lost.
Returns:
reference to the modified DVector.
Parameters:
rhs - Constant DVector whose value is copied.

virtual bool operator==(const DVector& rhs) const
The data from the rhs DVector is converted and compared to the lhs DVector. The original data are untouched.
Returns:
reference to the modified DVector.
Parameters:
rhs - Constant DVector whose value is copied.

virtual DVector& operator+=(const DVector& rhs)
The data in the rhs DVector are added to the data of the lhs DVector on an element by element basis.
Returns:
reference to the modified DVector.
Parameters:
rhs - DVector whose data are added.

virtual DVector& operator-=(const DVector& rhs)
The data in the rhs DVector are subtracted from the data of the lhs DVector on an element by element basis.
Returns:
reference to the modified DVector.
Parameters:
rhs - DVector whose data are subtracted.

virtual DVector& operator+=(double rhs)
The right hand side (rhs) constant is added to each element of the left hand side DVector.
Returns:
reference to the resulting DVector.
Parameters:
rhs - Scalar constant to be added to each element.

DVector& operator-=(double rhs)
The right hand side constant (rhs) is subtracted to each element of the left hand side DVector.
Returns:
reference to the resulting DVector.
Parameters:
rhs - Scalar constant to be subtracted from each element.

virtual DVector& operator*=(double rhs)
Each element of the lhs DVector is multiplied by the rhs constant.
Returns:
reference to the resulting DVector.
Parameters:
rhs - Scalar constant each element is multiplied by.

DVector& operator/=(double rhs)
Each element of the lhs DVector is divided by the rhs constant.
Returns:
reference to the resulting DVector.
Parameters:
rhs - Scalar constant each element is divided by.

virtual DVector& operator*=(const DVector& rhs)
Each element of the lhs DVector is multiplied by the corresponding element of rhs.
Returns:
Reference to the resulting DVector.
Parameters:
rhs - Multiplier DVector.

virtual DVector& operator/=(const DVector& rhs)
Each element of the lhs DVector is divided by the corresponding element of rhs.
Returns:
Reference to the resulting DVector.
Parameters:
rhs - Denominator DVector.

virtual ostream& Dump(ostream& out) const
A formatted dump of the DVector contents is written to a specified stream.
Returns:
Reference to the output stream.
Parameters:
str - Output stream that is to receive the formatted dump.

virtual void Append(size_t N, const short* data)
Data from a short integer array are converted to the DVector type and appended to the data vector.
Parameters:
N - Number of data words to append to the DVector.
data - short integer data array.

virtual void Append(size_t N, const int* data)
Data from an integer array are converted to the DVector type and appended to the data vector.
Parameters:
N - Number of data words to append to the DVector.
data - integer data to be appended to the DVector.

virtual void Append(size_t N, const float* data)
Data from a float array are converted to the DVector type and appended to the data vector.
Parameters:
N - Number of data words to append to the DVector.
data - float data to be appended to the DVector.

virtual void Append(size_t N, const double* data)
Data from a double float array are converted to the DVector type and appended to the data vector.
Parameters:
N - Number of data words to append to the DVector.
data - double float data to be appended to the DVector.

virtual void Append(size_t N, const fComplex* data)
Data from a complex array are converted to the DVector type and appended to the data vector.
Parameters:
N - Number of data words to append to the DVector.
data - complex data to be appended to the DVector.

virtual void Append(const DVector& data)
Data from the specified DVector are appended to the object vector. The appended data will be converted to the object type if necessary.
Parameters:
data - DVector containing data to be appended.

virtual void Clear(void)
The current data length is set to zero. No allocated memory is released.

virtual void Conjugate(void)
Replace each element of the vector with it's complex conjugate.

void Extend(size_t N)
The data vector is extended to the specified length. New data words are filled with zeros.


Direct child classes:
DVecType
Author:
John G. Zweizig
Version:
2.0; Last modified: February 4, 2000

alphabetic index hierarchy of classes


generated by doc++