Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

LA::Vector Class Reference

#include <LA_Vector.h>

List of all members.

Public Member Functions

 Vector ()
 Standard constructor.

 Vector (int n)
 Constructs a vector with the specified dimension.

 Vector (int n, const double *v)
 Constructs a vector with the specified dimension.

 Vector (const Vector &v)
 Copy constructor.

 Vector (const Vector3< double > &v)
 Copy constructor.

virtual ~Vector ()
 Destructor.

void create (int n)
 Recreates the vector with specified dimension and initalizes all entries to 0.0.

void create (int n, const double *v)
 Recreates the vector with specified dimension and initalizes all entries with the values in the passed array.

Vectoroperator= (const Vector &v)
 Copy operator.

Vectoroperator= (const Vector3< double > &v)
 Copy operator.

const double & operator[] (int i) const
 Constant element access operator (zero-based).

double & operator[] (int i)
 Element access operator (zero-based).

const double & operator() (int i) const
 Constant element access operator (one-based).

double & operator() (int i)
 Element access operator (one-based).

int dim () const
 Dimension of vector.

Vector sub (int index, int length) const
 Extracts a subvector.

void set_sub (int index, const Vector &subv)
 Sets a subvector inside this vector.

Vectoroperator+= (const Vector &v)
 Adds the passed vector to this vector.

Vectoroperator-= (const Vector &v)
 Substracts the passed vector from this vector.

Vectoroperator *= (const double &s)
 Multiplies this vector with the passed scalar.

Vectoroperator/= (const double &s)
 Divides this vector by the passed scalar.

std::string asString () const
 Returns a human-readable representation of the vector.

double length () const
 Returns the euclidian length of the vector.


Private Member Functions

void destroy ()

Private Attributes

int n
double * content

Friends

class Matrix
Vector operator+ (const Vector &v1, const Vector &v2)
 Adds to vectors.

Vector operator- (const Vector &v1, const Vector &v2)
 Subtracts to vectors.

Vector operator * (const double &s, const Vector &v)
 Multiplies a vector with a scalar.

Vector operator * (const Vector &v, const double &s)
 Multiplies a vector with a scalar.

Vector operator * (const Matrix &M, const Vector &v)
 Multiplies a matrix with a vector.

Vector operator/ (const Vector &v, const double &s)
 Divides a vector by a scalar.

double operator * (const Vector &v1, const Vector &v2)
 Calculates the inner product of two vector.

Matrix operator * (const Matrix &M1, const Matrix &M2)
 Multiplies to matrices.

Outoperator<< (Out &stream, const Vector &v)
 Out operator for GT-streams.

Inoperator>> (In &stream, Vector &v)
 In operator for GT-streams.

Outoperator<< (Out &stream, const Matrix &M)
 Out operator for GT-streams.

Inoperator>> (In &stream, Matrix &M)
 In operator for GT-streams.


Detailed Description

Author:
Stefan Uhrig
Represents a vector with arbitrary entries of type double.

Definition at line 29 of file LA_Vector.h.


Constructor & Destructor Documentation

LA::Vector::Vector  ) 
 

Standard constructor.

Constructed vector has no entries.

Definition at line 11 of file LA_Vector.cpp.

Referenced by sub().

LA::Vector::Vector int  n  ) 
 

Constructs a vector with the specified dimension.

Entries are initialized with 0.0.

Parameters:
n Dimension of vector.

Definition at line 15 of file LA_Vector.cpp.

References create().

Here is the call graph for this function:

LA::Vector::Vector int  n,
const double *  v
 

Constructs a vector with the specified dimension.

Entries are intialized with the values in the passed double array.

Parameters:
n Dimension of vector.
v Array with double values that are used to initialize the vector.

Definition at line 20 of file LA_Vector.cpp.

References create().

Here is the call graph for this function:

LA::Vector::Vector const Vector v  ) 
 

Copy constructor.

Parameters:
v Vector to copy.

Definition at line 25 of file LA_Vector.cpp.

LA::Vector::Vector const Vector3< double > &  v  ) 
 

Copy constructor.

Parameters:
v Vector3 to copy.

Definition at line 30 of file LA_Vector.cpp.

LA::Vector::~Vector  )  [virtual]
 

Destructor.

Definition at line 35 of file LA_Vector.cpp.

References destroy().

Here is the call graph for this function:


Member Function Documentation

void LA::Vector::create int  n  ) 
 

Recreates the vector with specified dimension and initalizes all entries to 0.0.

Parameters:
n Dimension of recreated vector.

Definition at line 40 of file LA_Vector.cpp.

References destroy().

Referenced by interpol::SplineInterpolation::CalcSplines(), LA::Eigenvalues::Eigenvalues(), operator=(), LA::operator>>(), LA::QR::QR(), and Vector().

Here is the call graph for this function:

void LA::Vector::create int  n,
const double *  v
 

Recreates the vector with specified dimension and initalizes all entries with the values in the passed array.

Parameters:
n Dimension of recreated vector.
v Array with double values that are used to initialize the vector.

Definition at line 52 of file LA_Vector.cpp.

References destroy().

Here is the call graph for this function:

Vector & LA::Vector::operator= const Vector v  ) 
 

Copy operator.

Parameters:
v Vector to copy.
Returns:
Reference to this vector.

Definition at line 64 of file LA_Vector.cpp.

References content, create(), and n.

Here is the call graph for this function:

Vector & LA::Vector::operator= const Vector3< double > &  v  ) 
 

Copy operator.

Parameters:
v Vector3 to copy.
Returns:
Reference to this vector.

Definition at line 70 of file LA_Vector.cpp.

References create(), Vector3< V >::x, Vector3< V >::y, and Vector3< V >::z.

Here is the call graph for this function:

const double & LA::Vector::operator[] int  i  )  const
 

Constant element access operator (zero-based).

Parameters:
i Index of element to access (zero-based).
Returns:
Constant reference to entry.

Definition at line 79 of file LA_Vector.cpp.

double & LA::Vector::operator[] int  i  ) 
 

Element access operator (zero-based).

Parameters:
i Index of element to access (zero-based).
Returns:
Reference to entry.

Definition at line 85 of file LA_Vector.cpp.

const double & LA::Vector::operator() int  i  )  const
 

Constant element access operator (one-based).

Parameters:
i Index of element to access (one-based).
Returns:
Constant reference to entry.

Definition at line 91 of file LA_Vector.cpp.

double & LA::Vector::operator() int  i  ) 
 

Element access operator (one-based).

Parameters:
i Index of element to access (one-based).
Returns:
Reference to entry.

Definition at line 97 of file LA_Vector.cpp.

int LA::Vector::dim  )  const
 

Dimension of vector.

Returns:
Dimension of vector.

Definition at line 103 of file LA_Vector.cpp.

Referenced by interpol::SplineInterpolation::CalcSplines(), interpol::SplineInterpolation::GetInterpolatedY(), LA::operator<<(), LA::LU::permute_copy(), LA::QR::solve(), and LA::LU::solve().

Vector LA::Vector::sub int  index,
int  length
const
 

Extracts a subvector.

Parameters:
index Index of first entry to extract (one-based).
length Number of entries to extract.
Returns:
The subvector.

Definition at line 108 of file LA_Vector.cpp.

References Vector().

Referenced by LA::Matrix::get_sub().

Here is the call graph for this function:

void LA::Vector::set_sub int  index,
const Vector subv
 

Sets a subvector inside this vector.

Parameters:
index Index where to map the first entry of subv
subv The subvector to set.

Definition at line 114 of file LA_Vector.cpp.

References content, and n.

Referenced by interpol::SplineInterpolation::CalcSplines(), and LA::Matrix::set_sub().

Vector & LA::Vector::operator+= const Vector v  ) 
 

Adds the passed vector to this vector.

Parameters:
v Vector to add.
Returns:
Reference to this vector.

Definition at line 122 of file LA_Vector.cpp.

References content, and n.

Vector & LA::Vector::operator-= const Vector v  ) 
 

Substracts the passed vector from this vector.

Parameters:
v Vector to subtract.
Returns:
Reference to this vector.

Definition at line 130 of file LA_Vector.cpp.

References content, and n.

Vector & LA::Vector::operator *= const double &  s  ) 
 

Multiplies this vector with the passed scalar.

Parameters:
s Scalar to multiply this vector with.
Returns:
Reference to this vector.

Definition at line 138 of file LA_Vector.cpp.

Vector & LA::Vector::operator/= const double &  s  ) 
 

Divides this vector by the passed scalar.

Parameters:
s Scalar to divide this vector by.
Returns:
Reference to this vector.

Definition at line 145 of file LA_Vector.cpp.

std::string LA::Vector::asString  )  const
 

Returns a human-readable representation of the vector.

Returns:
Human-readable representation of the vector.

Definition at line 152 of file LA_Vector.cpp.

double LA::Vector::length  )  const
 

Returns the euclidian length of the vector.

Returns:
The euclidian length of the vector.

Definition at line 159 of file LA_Vector.cpp.

void LA::Vector::destroy  )  [private]
 

Definition at line 167 of file LA_Vector.cpp.

Referenced by create(), and ~Vector().


Friends And Related Function Documentation

friend class Matrix [friend]
 

Definition at line 209 of file LA_Vector.h.

Vector operator+ const Vector v1,
const Vector v2
[friend]
 

Adds to vectors.

Parameters:
v1 First vector.
v2 Second vector.
Returns:
v1 + v2.

Definition at line 176 of file LA_Vector.cpp.

Vector operator- const Vector v1,
const Vector v2
[friend]
 

Subtracts to vectors.

Parameters:
v1 First vector.
v2 Second vector.
Returns:
v1 - v2.

Definition at line 183 of file LA_Vector.cpp.

Vector operator * const double &  s,
const Vector v
[friend]
 

Multiplies a vector with a scalar.

Parameters:
s Scalar.
v Vector.
Returns:
s*v.

Definition at line 190 of file LA_Vector.cpp.

Vector operator * const Vector v,
const double &  s
[friend]
 

Multiplies a vector with a scalar.

Parameters:
v Vector.
s Scalar.
Returns:
v*s.

Definition at line 197 of file LA_Vector.cpp.

Vector operator * const Matrix M,
const Vector v
[friend]
 

Multiplies a matrix with a vector.

Parameters:
M A matrix.
v A vector.
Returns:
M*v.

Definition at line 353 of file LA_Matrix.cpp.

Vector operator/ const Vector v,
const double &  s
[friend]
 

Divides a vector by a scalar.

Parameters:
v Vector.
s Scalar.
Returns:
v/s.

Definition at line 204 of file LA_Vector.cpp.

double operator * const Vector v1,
const Vector v2
[friend]
 

Calculates the inner product of two vector.

Parameters:
v1 First vector.
v2 Second vector.
Returns:
<v1, v2>.

Definition at line 211 of file LA_Vector.cpp.

Matrix operator * const Matrix M1,
const Matrix M2
[friend]
 

Multiplies to matrices.

Parameters:
M1 First matrix.
M2 Second matrix.
Returns:
M1*M2.

Definition at line 333 of file LA_Matrix.cpp.

Out& operator<< Out stream,
const Vector v
[friend]
 

Out operator for GT-streams.

Parameters:
stream Out-stream.
v Vector to output.
Returns:
Reference to passed Out-stream.

Definition at line 231 of file LA_Vector.cpp.

In& operator>> In stream,
Vector v
[friend]
 

In operator for GT-streams.

Parameters:
stream In-stream.
v Vector to read to.
Returns:
Reference to passed In-stream.

Definition at line 240 of file LA_Vector.cpp.

Out& operator<< Out stream,
const Matrix M
[friend]
 

Out operator for GT-streams.

Parameters:
stream Out-stream.
v Vector to output.
Returns:
Reference to passed Out-stream.

Definition at line 435 of file LA_Matrix.cpp.

In& operator>> In stream,
Matrix M
[friend]
 

In operator for GT-streams.

Parameters:
stream In-stream.
v Vector to read to.
Returns:
Reference to passed In-stream.

Definition at line 445 of file LA_Matrix.cpp.


Member Data Documentation

int LA::Vector::n [private]
 

Definition at line 193 of file LA_Vector.h.

Referenced by LA::operator *(), operator+=(), operator-=(), LA::operator<<(), operator=(), LA::Matrix::set_column(), LA::Matrix::set_row(), set_sub(), and LA::Matrix::solve().

double* LA::Vector::content [private]
 

Definition at line 194 of file LA_Vector.h.

Referenced by LA::operator *(), LA::Matrix::operator()(), operator+=(), operator-=(), LA::operator<<(), operator=(), LA::operator>>(), LA::Matrix::set_column(), set_sub(), and LA::Matrix::transpose().


The documentation for this class was generated from the following files:
Generated on Mon Mar 20 22:24:14 2006 for GT2005 by doxygen 1.3.6