1 /*
2  *_________________________________________________________________________*
3  *      POEMS: PARALLELIZABLE OPEN SOURCE EFFICIENT MULTIBODY SOFTWARE     *
4  *      DESCRIPTION: SEE READ-ME                                           *
5  *      FILE NAME: mat4x4.h                                                *
6  *      AUTHORS: See Author List                                           *
7  *      GRANTS: See Grants List                                            *
8  *      COPYRIGHT: (C) 2005 by Authors as listed in Author's List          *
9  *      LICENSE: Please see License Agreement                              *
10  *      DOWNLOAD: Free at www.rpi.edu/~anderk5                             *
11  *      ADMINISTRATOR: Prof. Kurt Anderson                                 *
12  *                     Computational Dynamics Lab                          *
13  *                     Rensselaer Polytechnic Institute                    *
14  *                     110 8th St. Troy NY 12180                           *
15  *      CONTACT:        anderk5@rpi.edu                                    *
16  *_________________________________________________________________________*/
17 
18 #ifndef MAT4X4_H
19 #define MAT4X4_H
20 
21 #include "virtualmatrix.h"
22 #include "matrix.h"
23 
24 
25 class Vect4;
26 
27 class Mat4x4 : public VirtualMatrix  {
28   double elements[4][4];
29 public:
30   Mat4x4();
31   ~Mat4x4();
32   Mat4x4(const Mat4x4& A);  // copy constructor
33   Mat4x4(const VirtualMatrix& A);  // copy constructor
34 
35   double& operator_2int (int i, int j); // array access
36   double Get_2int(int i, int j) const;
37   void Set_2int(int i, int j, double value);
38   double BasicGet_2int(int i, int j) const;
39   void BasicSet_2int(int i, int j, double value);
40   void BasicIncrement_2int(int i, int j, double value);
41 
42   void Const(double value);
43   MatrixType GetType() const;
44   std::istream& ReadData(std::istream& c); // input
45   std::ostream& WriteData(std::ostream& c) const; // output
46 
47   void AssignVM(const VirtualMatrix& A);
48   Mat4x4& operator=(const Mat4x4& A); // assignment operator
49   Mat4x4& operator=(const VirtualMatrix& A); // overloaded =
50   Mat4x4& operator*=(double b);
51 
52   Mat4x4& Identity();
53 
54   friend Mat4x4 T(const Mat4x4& A);  // a wasteful transpose
55   friend Mat4x4 CrossMat(Vect4& a);  // a wasteful cross matrix implementation
56 
57   friend void FastLU(Mat4x4& A, Mat4x4& LU, int *indx);
58   friend void FastLUSubs(Mat4x4& LU, Matrix& B, Matrix& C, int *indx);
59   friend void FastMult(Mat4x4& A, Vect4& B, Vect4& C);
60   friend void FastTMult(Mat4x4& A, Vect4& B, Vect4& C);
61   friend void FastNegMult(Mat4x4& A, Vect4& B, Vect4& C);
62   friend void FastNegTMult(Mat4x4& A, Vect4& B, Vect4& C);
63   friend void FastMult(Mat4x4& A, Mat4x4& B, Mat4x4& C);
64   friend void FastMultT(Mat4x4& A, Mat4x4& B, Mat4x4& C);
65   friend void FastAssignT(Mat4x4& A, Mat4x4& C);
66 };
67 
68 #endif
69