#include <vector.h>
Inheritance diagram for PLib::Vector< T >:
Public Member Functions | |
int | rows () const |
Vector () | |
Vector (const int r) | |
Vector (const Vector< T > &v) | |
Vector (const BasicArray< T > &v) | |
Vector (T *ap, const int size) | |
Vector (BasicList< T > &list) | |
Vector< T > & | operator= (const Vector< T > &v) |
Vector< T > & | operator= (const BasicArray< T > &b) |
Vector< T > & | operator+= (const Vector< T > &a) |
Vector< T > & | operator-= (const Vector< T > &a) |
T | operator= (const T d) |
void | as (int i, const Vector< T > &b) |
Vector< T > | get (int i, int l) |
int | minIndex () const |
T | minimum () const |
void | qSortStd () |
void | qSort (int M=7) |
void | sortIndex (Vector< int > &index, int M=7) const |
template<> | |
int | minIndex () const |
template<> | |
void | qSort (int) |
template<> | |
void | sortIndex (Vector< int > &, int) const |
template<> | |
void | qSortStd () |
template<> | |
int | minIndex () const |
Friends | |
Vector< T > | operator+ (const Vector< T > &a, const Vector< T > &b) |
Vector< T > | operator- (const Vector< T > &a, const Vector< T > &b) |
T | operator * (const Vector< T > &a, const Vector< T > &b) |
Vector< T > | operator * (const Vector< T > &v, const double d) |
Vector< T > | operator * (const Vector< T > &v, const Complex d) |
Vector< T > | operator * (const double d, const Vector< T > &v) |
Vector< T > | operator * (const Complex d, const Vector< T > &v) |
int | operator== (const Vector< T > &a, const Vector< T > &b) |
int | operator!= (const Vector< T > &a, const Vector< T > &b) |
A simple vector class with basic linear algebraic vector operators defined.
PLib::Vector< T >::Vector | ( | ) | [inline] |
Basic constructor.
int PLib::Vector< T >::rows | ( | ) | const [inline] |
< a reference to the size of the vector
Vector< T > & PLib::Vector< T >::operator= | ( | const Vector< T > & | b | ) |
the assignment operator
The values of a vector are copied to this one
b | the vector to copy |
Vector< T > & PLib::Vector< T >::operator= | ( | const BasicArray< T > & | b | ) |
the assignment operator with a BasicArray
b | the BasicArray to copy |
Reimplemented from PLib::BasicArray< T >.
Vector< T > & PLib::Vector< T >::operator+= | ( | const Vector< T > & | a | ) |
the += operator
Each component of the vector is increased by the components of vector a.
a | the vector to add to itself |
Vector< T > & PLib::Vector< T >::operator-= | ( | const Vector< T > & | a | ) |
the -= operator
Each component of the vector is decreased by the components of vector a.
a | the vector to substract from itself |
T PLib::Vector< T >::operator= | ( | const T | d | ) |
assigns all the components of the vector to a value
All the components of the vector are assigned to the value d
d | the value to assigned the vector to |
Reimplemented from PLib::BasicArray< T >.
void PLib::Vector< T >::as | ( | int | i, | |
const Vector< T > & | b | |||
) |
copies the values of b to the vector starting from the index i.
The values of the vector b replace the values of the vector starting at the index i.
i | the index to start copying from | |
b | the vector to copy from |
Vector< T > PLib::Vector< T >::get | ( | int | i, | |
int | l | |||
) |
extract a vector of size l starting at index i
This extracts a vector of size l by copying the values from the vector starting at index i.
i | the index to start copying from | |
l | the length of the new vector |
int PLib::Vector< T >::minIndex | ( | ) | const |
finds the index of its minimal entry
Scans the vector to find its minimal value and returns the index of that value.
void PLib::Vector< T >::qSortStd | ( | ) |
do a quick sort using the standard C library sort algorithm
Performs a quick sort of the vector. The quick sort algorithm used is the one from the standard C library.
void PLib::Vector< T >::qSort | ( | int | M = 7 |
) |
do a quick sort using an optimized algorithm
Do a quick sort of the vector using an algorithm based on the one described in "Numerical Recipes in C". You should use this method over using qSortStd since it is usually faster.
M | regions smaller than this value are sorted using the insertion method, the default value of 7 is suitable for most cases. |
void PLib::Vector< T >::sortIndex | ( | Vector< int > & | index, | |
int | M = 7 | |||
) | const |
generates sorted index vector
A sorted index vector is generated by this routine. It is based on a routine described in "Numercial Recipes in C".
index | The index vector | |
M | regions smaller than this value are sorted using the insertion method, the default value of 7 is suitable for most cases. |
Adds two vectors.
a | the first vector to add | |
b | the second vector to add |
Substracts two vectors.
a | the first vector to add | |
b | the second vector to add |
the multiplicative operator
a | the first vector | |
b | the second vector to multiply with |
multiplies a vector with a double
Multiplies all the elements of the vector v with a double d.
v | the vector to multiply | |
d | multiply the vector by this value |
multiplies the vector with a complex number
v | the vector to multiply | |
d | the complex value to multiply $v$ with |
v | Multiplies by a double |
v | Multiplies by a Comples |
the equality operator
a | the first vector to check | |
b | the second vector to check |
b | The inequality operator |