Computational Physics - Department of Physics

(Axel Boer) #1

80 3 Numerical differentiation and interpolation


boolredim(intn1);
/****************************************************/
/* (USER-DEFINED) OVERLOADED OPERATORS*/
/****************************************************/
// Member arithmetic operators (unary operators)
// Vector quantities: u, v, w. Scalar: a
// Copy-assignment (assignment by copy) operator
Vector&operator =(constVector&);// v = w
// Add-assignment (assigment by addition) operator
Vector&operator+=(constVector&);// v += w
// Substraction-assignment (assignment by substraction)operator
Vector&operator-=(constVector&);// v -= w
// Multiplication-assignment (assignment by multiplication) operator
Vector&operator*=(double);// v*= a
// Division-assignment (assignment by division) operator
Vector&operator/=(double);// v /= a
const double&operator[](inti)const;
double&operator[](inti);
const double&operator()(inti)const;
double&operator()(inti);
boolindexOk(inti)const;
// Get the euclidian norm (l2norm)
doublel2norm()const;
// Unary operator +
friendVectoroperator+(constVector&); // u = + v
// Unary operator -
friendVectoroperator-(constVector&); // u = - v
/**
*Addition of two vectors:
**/
friendVectoroperator+(constVector&,constVector&);// u = v + w
/**
*Substraction of two vectors:
**/
friendVectoroperator-(constVector&,constVector&);// u = v - w
/**
*Product between two vectors:
**/
friendVectoroperator*(constVector&,constVector&);// u = v*w
/**
*Premultiplication by a floating point number:
**/
friendVectoroperator*(double,constVector&);// u = a*v
/**
*Postmultiplication by a floating point number:
**/
friendVectoroperator*(constVector&,double);// u = v*a
/**
*Matrix-vector product:
**/
friendVectoroperator*(constMatrix&,constVector&);// u = A*v
Free download pdf