| 1 | #ifndef VECTOR_HPP_
 | 
|---|
| 2 | #define VECTOR_HPP_
 | 
|---|
| 3 | 
 | 
|---|
| 4 | /** Single vector.
 | 
|---|
| 5 |  * basically, just a x[3] but with helpful functions
 | 
|---|
| 6 |  */
 | 
|---|
| 7 | class vector {   
 | 
|---|
| 8 |   public:
 | 
|---|
| 9 |     double x[NDIM];
 | 
|---|
| 10 | 
 | 
|---|
| 11 |   vector();
 | 
|---|
| 12 |   ~vector();
 | 
|---|
| 13 | 
 | 
|---|
| 14 |   double Distance(const vector *y) const;
 | 
|---|
| 15 |   double PeriodicDistance(const vector *y, const double *cell_size) const;
 | 
|---|
| 16 |   double ScalarProduct(const vector *y) const;
 | 
|---|
| 17 |   double Projection(const vector *y) const;
 | 
|---|
| 18 |   double Norm() const ;
 | 
|---|
| 19 |   double Angle(vector *y) const;
 | 
|---|
| 20 | 
 | 
|---|
| 21 |   void AddVector(const vector *y);
 | 
|---|
| 22 |   void SubtractVector(const vector *y);
 | 
|---|
| 23 |   void CopyVector(const vector *y);
 | 
|---|
| 24 |   void RotateVector(const vector *y, const double alpha);
 | 
|---|
| 25 |   void Zero(); 
 | 
|---|
| 26 |   void Normalize();
 | 
|---|
| 27 |   void Translate(const vector *x);
 | 
|---|
| 28 |   void Mirror(const vector *x);
 | 
|---|
| 29 |   void Scale(double **factor);
 | 
|---|
| 30 |   void Scale(double *factor);
 | 
|---|
| 31 |   void Scale(double factor);
 | 
|---|
| 32 |   void MatrixMultiplication(double *M);
 | 
|---|
| 33 |   void InverseMatrixMultiplication(double *M);
 | 
|---|
| 34 |   void KeepPeriodic(ofstream *out, double *matrix);
 | 
|---|
| 35 |   void LinearCombinationOfVectors(const vector *x1, const vector *x2, const vector *x3, double *factors);
 | 
|---|
| 36 |   
 | 
|---|
| 37 |   bool GetOneNormalVector(const vector *x1);
 | 
|---|
| 38 |   bool MakeNormalVector(const vector *y1);
 | 
|---|
| 39 |   bool MakeNormalVector(const vector *y1, const vector *y2);
 | 
|---|
| 40 |   bool MakeNormalVector(const vector *x1, const vector *x2, const vector *x3);
 | 
|---|
| 41 |   bool SolveSystem(vector *x1, vector *x2, vector *y, double alpha, double beta, double c);
 | 
|---|
| 42 |   bool LSQdistance(vector **vectors, int dim);
 | 
|---|
| 43 | 
 | 
|---|
| 44 |   void AskPosition(double *cell_size, bool check);
 | 
|---|
| 45 |   bool Output(ofstream *out) const;
 | 
|---|
| 46 | };
 | 
|---|
| 47 | 
 | 
|---|
| 48 | ofstream& operator<<(ofstream& ost, vector& m);
 | 
|---|
| 49 | vector& operator+=(vector& a, const vector& b);
 | 
|---|
| 50 | vector& operator*=(vector& a, const double m);
 | 
|---|
| 51 | vector& operator*(const vector& a, const double m);
 | 
|---|
| 52 | vector& operator+(const vector& a, const vector& b);
 | 
|---|
| 53 | 
 | 
|---|
| 54 | #endif /*VECTOR_HPP_*/
 | 
|---|