MPQC  2.3.1
matrix3.h
1 //
2 // matrix3.h
3 //
4 // Copyright (C) 1996 Limit Point Systems, Inc.
5 //
6 // Author: Curtis Janssen <cljanss@limitpt.com>
7 // Maintainer: LPS
8 //
9 // This file is part of the SC Toolkit.
10 //
11 // The SC Toolkit is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU Library General Public License as published by
13 // the Free Software Foundation; either version 2, or (at your option)
14 // any later version.
15 //
16 // The SC Toolkit is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU Library General Public License for more details.
20 //
21 // You should have received a copy of the GNU Library General Public License
22 // along with the SC Toolkit; see the file COPYING.LIB. If not, write to
23 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24 //
25 // The U.S. Government is granted a limited license as per AL 91-7.
26 //
27 
28 #ifndef _math_scmat_matrix3_h
29 #define _math_scmat_matrix3_h
30 #ifdef __GNUC__
31 #pragma interface
32 #endif
33 
34 #include <iostream>
35 #include <math.h>
36 
37 #include <math/scmat/vector3.h>
38 
39 namespace sc {
40 
41 class RefSCmatrix;
42 
43 class SCMatrix3
44 {
45  private:
46  double _m[9];
47  public:
48  SCMatrix3() {}
49  SCMatrix3(const SCMatrix3&);
50 #if 0
51  SCMatrix3(const RefSCMatrix3&);
52 #endif
53  SCMatrix3(double x[9]);
54  SCMatrix3(const SCVector3&p1, const SCVector3&p2, const SCVector3&p3);
55  ~SCMatrix3() {}
56  SCMatrix3& operator=(const SCMatrix3&);
57  SCMatrix3 operator*(double) const;
58  SCMatrix3 operator*(const SCMatrix3&) const;
59  SCVector3 operator*(const SCVector3&v) const {
60  SCVector3 result;
61  result._v[0] = _m[0+3*0]*v._v[0]+_m[0+3*1]*v._v[1]+_m[0+3*2]*v._v[2];
62  result._v[1] = _m[1+3*0]*v._v[0]+_m[1+3*1]*v._v[1]+_m[1+3*2]*v._v[2];
63  result._v[2] = _m[2+3*0]*v._v[0]+_m[2+3*1]*v._v[1]+_m[2+3*2]*v._v[2];
64  return result;
65  }
66  SCMatrix3 operator+(const SCMatrix3&) const;
67  SCMatrix3 operator-(const SCMatrix3&) const;
68  double& elem(int i, int j) { return _m[i+3*j]; }
69  const double& elem(int i, int j) const { return _m[i+3*j]; }
70  double& elem(int i) { return _m[i]; }
71  const double& elem(int i) const { return _m[i]; }
72  double& operator[] (int i) { return _m[i]; }
73  const double& operator[] (int i) const { return _m[i]; }
74  double& operator() (int i, int j) { return _m[i+3*j]; }
75  const double& operator() (int i, int j) const { return _m[i+3*j]; }
76  const double* data() const { return _m; }
77  void print(std::ostream& =ExEnv::out0()) const;
78 };
79 SCMatrix3 operator*(double,const SCMatrix3&);
80 SCMatrix3 rotation_mat(const SCVector3&, const SCVector3&, double theta);
81 SCMatrix3 rotation_mat(const SCVector3&, const SCVector3&);
82 SCMatrix3 rotation_mat(const SCVector3&, double theta);
83 SCMatrix3 reflection_mat(const SCVector3&);
84 inline int delta(int i, int j) { return i==j; }
85 
86 }
87 
88 #endif
89 
90 // Local Variables:
91 // mode: c++
92 // c-file-style: "CLJ"
93 // End:
sc::SCMatrix3
Definition: matrix3.h:43
sc::SCVector3
Definition: vector3.h:45
sc::ExEnv::out0
static std::ostream & out0()
Return an ostream that writes from node 0.

Generated at Sun Jan 26 2020 23:33:04 for MPQC 2.3.1 using the documentation package Doxygen 1.8.16.