a set of C++ library classes
for neural networks development



class vect

Class for manipulating vector of real numbers

Public Methods

[more] vect ()
Constructor.
[more] vect (int n, double val = 0.0)
Constructor.
[more] vect (double* array, int n)
Constructor.
[more] vect (const vect&)
Copy Constructor
[more] ~vect ()
Destructor
[more]vect& operator= (const vect&)
Overloading assignment operator
[more]int dim () const
Returns the dimension of the vector.
[more]double& operator[] (int i)
Index overloading.
[more]double operator[] (int) const
Index overloading.
[more]double sqr_length () const
Returns the square of the Euclidean length of the vector.
[more]double length () const
Returns the Euclidean length of the vector.
[more]vect norm () const
Returns the vector normalized.
[more]vect& operator+= (const vect&)
Overloading += operator
[more]vect& operator-= (const vect&)
Overloading -= operator
[more]vect operator+ (const vect& v1) const
Overloading addition
[more]vect operator- (const vect& v1) const
Overloading subtraction
[more]double operator* (const vect& v1) const
Overloading Scalar multiplication
[more]vect operator* (double r) const
Componentwise multiplication
[more]vect operator- () const
Unary minus
[more]vect operator/ (double) const
Componentwise division
[more]bool operator== (const vect& w) const
Boolean equality test
[more]bool operator!= (const vect& w) const
Boolean inequality test
[more]void print (ostream& O)
Prints the vector componentwise to ostream
[more]void print ()
Prints the vector componentwise to cout
[more]void read (istream& I)
Reads numbers from an istream
Reads d = vdim() numbers from input stream I and writes them into v[0] .
[more]void read ()
Reads numbers from cin


Documentation

Class for manipulating vector of real numbers
o vect()
Constructor. Dummy constructor initialized to the zero-dimensional vector

o vect(int n, double val = 0.0)
Constructor. The vector is initialized to the dimension n. All its elements are initialized to zero
Parameters:
- n vector dimension

o vect(double* array, int n)
Constructor. The vector is initialized using the array of double array.
Parameters:
array - array of double
- n vector dimension

o vect(const vect&)
Copy Constructor

o ~vect()
Destructor

ovect& operator=(const vect&)
Overloading assignment operator

oint dim() const
Returns the dimension of the vector.
Returns:
dimension of the vector

odouble& operator[](int i)
Index overloading.
It returns the i-th componenet of the vector.
Parameters:
i - i-th component of the vector
Returns:
value of i-th component of the vector

odouble operator[](int) const
Index overloading.
It returns the i-th componenet of the vector.
Parameters:
i - i-th component of the vector
Returns:
value of i-th component of the vector

odouble sqr_length() const
Returns the square of the Euclidean length of the vector.
Returns:
square of the Euclidean length of the vector

odouble length() const
Returns the Euclidean length of the vector.
Returns:
Euclidean length of the vector

ovect norm() const
Returns the vector normalized.

ovect& operator+=(const vect&)
Overloading += operator

ovect& operator-=(const vect&)
Overloading -= operator

ovect operator+(const vect& v1) const
Overloading addition

ovect operator-(const vect& v1) const
Overloading subtraction

odouble operator*(const vect& v1) const
Overloading Scalar multiplication

ovect operator*(double r) const
Componentwise multiplication

ovect operator-() const
Unary minus

ovect operator/(double) const
Componentwise division

obool operator==(const vect& w) const
Boolean equality test

obool operator!=(const vect& w) const
Boolean inequality test

ovoid print(ostream& O)
Prints the vector componentwise to ostream

ovoid print()
Prints the vector componentwise to cout

ovoid read(istream& I)
Reads numbers from an istream
Reads d = vdim() numbers from input stream I and writes them into v[0] . v[d-1].

ovoid read()
Reads numbers from cin


This class has no child classes.
Friends:
class matrix
vect operator*(double f, const vect& v) { return v *f
ostream& operator<<(ostream& O, const vect& v)
istream& operator>>(istream& I, vect& v)

Alphabetic index HTML hierarchy of classes or Java


Last Updated February 2001
For comments and suggestions mail to Giorgio Valentini