1 /*
2  *_________________________________________________________________________*
3  *      POEMS: PARALLELIZABLE OPEN SOURCE EFFICIENT MULTIBODY SOFTWARE     *
4  *      DESCRIPTION: SEE READ-ME                                           *
5  *      FILE NAME: colmatrix.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 
19 #ifndef COLMATRIX_H
20 #define COLMATRIX_H
21 
22 #include "virtualcolmatrix.h"
23 #include "colmatmap.h"
24 
25 class Matrix;
26 class Vect6;
27 class Mat3x3;
28 class Vect3;
29 
30 class ColMatrix : public VirtualColMatrix  {
31   double* elements;
32 public:
33   ColMatrix();
34   ~ColMatrix();
35   ColMatrix(const ColMatrix& A);  // copy constructor
36   ColMatrix(const VirtualColMatrix& A);  // copy constructor
37   ColMatrix(const VirtualMatrix& A);  // copy constructor
38   ColMatrix(int m);  // size constructor
39 
40   double& operator_1int (int i); // array access
41   double Get_1int(int i) const;
42   void Set_1int(int i, double value);
43   double BasicGet_1int(int i) const;
44   void BasicSet_1int(int i, double value);
45   void BasicIncrement_1int(int i, double value);
46 
47   double* GetElementPointer(int i);
48   void Dim(int m);
49   void Const(double value);
50   MatrixType GetType() const;
51   std::istream& ReadData(std::istream& c);
52   std::ostream& WriteData(std::ostream& c) const;
53 
54   void AssignVM(const VirtualMatrix& A);
55   ColMatrix& operator=(const ColMatrix& A); // assignment operator
56   ColMatrix& operator=(const VirtualColMatrix& A); // overloaded =
57   ColMatrix& operator=(const VirtualMatrix& A); // overloaded =
58   ColMatrix& operator*=(double b);
59 
60         void Abs();
61         void BasicMax(double& value, int& index);
62         void BasicMin(double& value, int& index);
63 
64   // fast matrix operations
65                   friend void FastQuaternions(ColMatrix& q, Mat3x3& C);
66                   friend void FastInvQuaternions(Mat3x3& C, ColMatrix& q);
67                   friend void FastQuaternionDerivatives(ColMatrix& q, ColMatrix& omega, ColMatrix& qdot);
68                   friend void FastTMult(Matrix& A, Vect6& B, ColMatrix& C);
69                   friend void FastMult(Matrix& A, ColMatrix& B, Vect6& C);
70                   friend void FastAssign(ColMatrix& A, ColMatrix& C);
71 
72                   friend void FastMult(Mat3x3& A, ColMatrix& B, Vect3& C);
73                   friend void FastMult(Mat3x3& A, Vect3& B, ColMatrix& C);
74                   friend void FastAssign(ColMatrix&A, Vect3& C);
75 
76                   friend void EP_Derivatives(ColMatrix& q, ColMatrix& u, ColMatrix& qdot);
77                   friend void EP_Transformation(ColMatrix& q, Mat3x3& C);
78                   friend void EP_FromTransformation(ColMatrix& q, Mat3x3& C);
79                   friend void EP_Normalize(ColMatrix& q);
80                   friend void EPdotdot_udot(ColMatrix& Audot, ColMatrix& Aqdot, ColMatrix& Aq,ColMatrix& Aqddot);
81                   friend void qdot_to_u(ColMatrix& q, ColMatrix& u, ColMatrix& qdot);
82 };
83 
84 #endif
85