MPQC  3.0.0-alpha
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 #include <iostream>
31 #include <math.h>
32 
33 #include <math/scmat/vector3.h>
34 
35 namespace sc {
36 
37 class RefSCmatrix;
38 
39 class SCMatrix3
40 {
41  private:
42  double _m[9];
43  public:
44  SCMatrix3() {}
45  SCMatrix3(const SCMatrix3&);
46 #if 0
47  SCMatrix3(const RefSCMatrix3&);
48 #endif
49  SCMatrix3(double x[9]);
50  SCMatrix3(const SCVector3&p1, const SCVector3&p2, const SCVector3&p3);
51  ~SCMatrix3() {}
52  SCMatrix3& operator=(const SCMatrix3&);
53  SCMatrix3 operator*(double) const;
54  SCMatrix3 operator*(const SCMatrix3&) const;
55  SCVector3 operator*(const SCVector3&v) const {
56  SCVector3 result;
57  result._v[0] = _m[0+3*0]*v._v[0]+_m[0+3*1]*v._v[1]+_m[0+3*2]*v._v[2];
58  result._v[1] = _m[1+3*0]*v._v[0]+_m[1+3*1]*v._v[1]+_m[1+3*2]*v._v[2];
59  result._v[2] = _m[2+3*0]*v._v[0]+_m[2+3*1]*v._v[1]+_m[2+3*2]*v._v[2];
60  return result;
61  }
62  SCMatrix3 operator+(const SCMatrix3&) const;
63  SCMatrix3 operator-(const SCMatrix3&) const;
64  double& elem(int i, int j) { return _m[i+3*j]; }
65  const double& elem(int i, int j) const { return _m[i+3*j]; }
66  double& elem(int i) { return _m[i]; }
67  const double& elem(int i) const { return _m[i]; }
68  double& operator[] (int i) { return _m[i]; }
69  const double& operator[] (int i) const { return _m[i]; }
70  double& operator() (int i, int j) { return _m[i+3*j]; }
71  const double& operator() (int i, int j) const { return _m[i+3*j]; }
72  const double* data() const { return _m; }
73  void print(std::ostream& =ExEnv::out0()) const;
74 };
75 SCMatrix3 operator*(double,const SCMatrix3&);
76 SCMatrix3 rotation_mat(const SCVector3&, const SCVector3&, double theta);
77 SCMatrix3 rotation_mat(const SCVector3&, const SCVector3&);
78 SCMatrix3 rotation_mat(const SCVector3&, double theta);
79 SCMatrix3 reflection_mat(const SCVector3&);
80 inline int delta(int i, int j) { return i==j; }
81 
82 }
83 
84 #endif
85 
86 // Local Variables:
87 // mode: c++
88 // c-file-style: "CLJ"
89 // End:
sc::SCMatrix3
Definition: matrix3.h:39
sc::SCVector3
a 3-element version of SCVector
Definition: vector3.h:43
sc::ExEnv::out0
static std::ostream & out0()
Return an ostream that writes from node 0.
sc
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14

Generated at Sun Jan 26 2020 23:24:00 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.