UltraScan III
List of all members | Public Member Functions | Private Attributes
US_Vector Class Reference

us_vector.h More...

#include "us_vector.h"

Inheritance diagram for US_Vector:
Inheritance graph
[legend]
Collaboration diagram for US_Vector:
Collaboration graph
[legend]

Public Member Functions

 US_Vector (int, double=0.0)
 Create a vector of doubles. More...
 
void add (const US_Vector &)
 Add two vectors. More...
 
void add (double)
 Add a constant to every element of a vector. More...
 
double dot (const US_Vector &)
 Calculate the dot product of two vectors. More...
 
void mult (const US_Vector &)
 Multiply the elements of two vectors, element by element. More...
 
void scale (double)
 Scale a vector by a constant value. More...
 
double distance (const US_Vector &)
 Calculate the Euclidean distance between two vectors. More...
 
double L2norm (void)
 Calculate the L2 norm of the vector. More...
 
int size (void) const
 Return the number of elements in the vector. More...
 
void assign (int i, double d)
 Assign a value to a vector element. More...
 
double operator[] (int i) const
 Return an element using the [] operator. More...
 

Private Attributes

QVector< double > v
 

Detailed Description

us_vector.h

A collecion of vector routines for doubles.

Definition at line 9 of file us_vector.h.

Constructor & Destructor Documentation

US_Vector::US_Vector ( int  size,
double  value = 0.0 
)

Create a vector of doubles.

Parameters
sizeThe length of the vector
valueThe initial values of the vector

Definition at line 6 of file us_vector.cpp.

Member Function Documentation

void US_Vector::add ( const US_Vector other)

Add two vectors.

other The vector to be added

Definition at line 12 of file us_vector.cpp.

void US_Vector::add ( double  value)

Add a constant to every element of a vector.

value The constant to add to the vector elements

Definition at line 20 of file us_vector.cpp.

void US_Vector::assign ( int  i,
double  d 
)
inline

Assign a value to a vector element.

Parameters
iThe element to change
dThe value to assign to the element

Definition at line 54 of file us_vector.h.

double US_Vector::distance ( const US_Vector other)

Calculate the Euclidean distance between two vectors.

Parameters
otherThe second vector of the calculation

Definition at line 52 of file us_vector.cpp.

double US_Vector::dot ( const US_Vector other)

Calculate the dot product of two vectors.

Parameters
otherThe second vector of the calculation

Definition at line 26 of file us_vector.cpp.

double US_Vector::L2norm ( void  )

Calculate the L2 norm of the vector.

Definition at line 63 of file us_vector.cpp.

void US_Vector::mult ( const US_Vector other)

Multiply the elements of two vectors, element by element.

Parameters
otherThe second vector of the calculation

Definition at line 38 of file us_vector.cpp.

double US_Vector::operator[] ( int  i) const
inline

Return an element using the [] operator.

Parameters
iThe element to return

Definition at line 58 of file us_vector.h.

void US_Vector::scale ( double  value)

Scale a vector by a constant value.

Parameters
valueThe constant to scale each element of the vector

Definition at line 46 of file us_vector.cpp.

int US_Vector::size ( void  ) const
inline

Return the number of elements in the vector.

Definition at line 45 of file us_vector.h.

Member Data Documentation

QVector< double > US_Vector::v
private

Definition at line 58 of file us_vector.h.


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