tminres
Public Member Functions | Private Attributes | Friends
SimpleVector Class Reference

Implementation of a dense serial vector according to Vector_traits. More...

#include <SimpleVector.hpp>

List of all members.

Public Member Functions

 SimpleVector (int size)
 Constructor.
virtual ~SimpleVector ()
 Destructor.
SimpleVectoroperator= (const double &val)
 Set all the entry of the Vector equal to val.
SimpleVectoroperator= (const SimpleVector &RHS)
 Set the entry of the Vector equal to the entries in RHS.
void Scale (const double &val)
 multiply THIS by a scalar value
SimpleVectorClone ()
 Create a new vector with the same structure of THIS. Values are not initialized.
double & operator[] (const int i)
 Access entry i (non const version)
const double & operator[] (const int i) const
 Access entry i (const version)
const double at (const int i) const
 Access entry i. if i < 0 return 0.
void Randomize (int seed)
 Fill the entries of the vector with random numbers. The vector is normalized with norm 1.
void Print (std::ostream &os)
 Print all the entries of the vector.

Private Attributes

double * vals
int size

Friends

void add (const SimpleVector &v1, const double &c2, const SimpleVector &v2, SimpleVector &result)
 result = v1 + c2*v2
void add (const double &c1, const SimpleVector &v1, const double &c2, const SimpleVector &v2, SimpleVector &result)
 result = c1*v1 + c2*v2
void add (const double &alpha, const SimpleVector &v1, const SimpleVector &v2, SimpleVector &result)
 result = alpha(v1 + v2)
void add (const SimpleVector &v1, const SimpleVector &v2, const SimpleVector &v3, SimpleVector &result)
 result = v1 + v2 + v3
void subtract (const SimpleVector &v1, const SimpleVector &v2, SimpleVector &result)
 result = v1 - v2
double InnerProduct (const SimpleVector &v1, const SimpleVector &v2)
 return the inner product of v1 and v2

Detailed Description

Implementation of a dense serial vector according to Vector_traits.

Examples:
SerialExample/ex1.cpp, and SerialExample/ex2.cpp.

Definition at line 27 of file SimpleVector.hpp.


Constructor & Destructor Documentation

Constructor.

Parameters:
sizeint : the size of the vector

Definition at line 22 of file SimpleVector.cpp.


The documentation for this class was generated from the following files:
 All Classes Files Functions Friends