The Gnome Chemistry Utils  0.14.0
matrix.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*
4  * Gnome Chemistry Utils
5  * matrix.h
6  *
7  * Copyright (C) 2000-2010 Jean Bréfort <jean.brefort@normalesup.org>
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License as
11  * published by the Free Software Foundation; either version 3 of the
12  * License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
22  * USA
23  */
24 
25 #ifndef GCU_MATRIX_H
26 #define GCU_MATRIX_H
27 
29 namespace gcu
30 {
31 
32 class Vector;
33 
44 enum MatrixType {euler, antieuler, rotation};
45 
49 class Matrix
50 {
51 public:
52 
56  Matrix ();
62  Matrix (double d);
68  Matrix (double d[3][3]);
74  Matrix (Matrix const &m);
83  Matrix (Vector const &v1, Vector const &v2, Vector const &v3, bool as_rows = true);
87  virtual ~Matrix ();
106  Matrix (double Psi, double Theta, double Phi, MatrixType Type);
120  Matrix (double x11, double x12, double x13, double x21, double x22, double x23, double x31, double x32, double x33);
126  Matrix& operator* (Matrix const &cMat) const;
132  Matrix& operator= (Matrix const &cMat);
140  void Euler (double& Psi, double& Theta, double& Phi);
149  void Transform (double &dx, double &dy , double &dz) const;
156  Vector operator* (Vector const &v) const;
163  Vector glmult (Vector const &v) const;
170  double &operator() (unsigned i, unsigned j) {return x[i][j];}
177  double operator() (unsigned i, unsigned j) const {return x[i][j];}
178 
179 private:
180  double x[3][3];
181 };
182 
186 class GLMatrix
187 {
188 public:
192  GLMatrix ();
196  virtual ~GLMatrix ();
197 
203  double &operator() (int i, int j) {return x[i][j];}
207  double *array () {return (double*) x;}
208 
209 private:
210  double x[4][4];
211 };
212 
213 } //namespace gcu
214 
215 #endif //GCRYSTAL_MATRIX_H