1 /*
2  *_________________________________________________________________________*
3  *      POEMS: PARALLELIZABLE OPEN SOURCE EFFICIENT MULTIBODY SOFTWARE     *
4  *      DESCRIPTION: SEE READ-ME                                           *
5  *      FILE NAME: matrix.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 MATRIX_H
19 #define MATRIX_H
20 
21 #include "virtualmatrix.h"
22 
23 class Mat3x3;
24 class Mat4x4;
25 class Mat6x6;
26 class Vect6;
27 class ColMatrix;
28 
29 
30 class Matrix : public VirtualMatrix {
31   double **rows;          // row pointer
32   double *elements;
33 public:
34   Matrix();
35   ~Matrix();
36   Matrix(const Matrix& A);  // copy constructor
37   Matrix(const VirtualMatrix& A);  // copy constructor
38   Matrix(int m, int n);  // size constructor
39 
40   double& operator_2int (int i, int j); // array access
41   double Get_2int(int i, int j) const;
42   void Set_2int(int i, int j, double value);
43   double BasicGet_2int(int i, int j) const;
44   void BasicSet_2int(int i, int j, double value);
45   void BasicIncrement_2int(int i, int j, double value);
46 
47   void Const(double value);
48   MatrixType GetType() const;
49   std::istream& ReadData(std::istream& c);
50   std::ostream& WriteData(std::ostream& c) const;
51 
52   Matrix& Dim(int m, int n);    // allocate size
53 
54   void AssignVM(const VirtualMatrix& A);
55   Matrix& operator=(const Matrix& A); // assignment operator
56   Matrix& operator=(const VirtualMatrix& A); // overloaded =
57   Matrix& operator*=(double b);
58 
59   friend void FastLDLT(Matrix& A, Matrix& C);
60   friend void FastLDLTSubs(Matrix& LD, Matrix& B, Matrix& C);
61   friend void FastLDLTSubsLH(Matrix& B, Matrix& LD, Matrix& C);
62   friend void FastLU(Matrix& A, Matrix& LU, int *indx);
63   friend void FastLUSubs(Matrix& LU, Matrix& B, Matrix& C, int *indx);
64   friend void FastLUSubs(Mat3x3& LU, Matrix& B, Matrix& C, int *indx);
65   friend void FastLUSubs(Mat4x4& LU, Matrix& B, Matrix& C, int *indx);
66   friend void FastLUSubs(Mat6x6& LU, Matrix& B, Matrix& C, int *indx);
67   friend void FastLUSubsLH(Matrix& B, Matrix& LU, Matrix& C, int *indx);
68   friend void FastMult(Matrix& A, Matrix& B, Matrix& C);
69   friend void FastTMult(Matrix& A, Matrix& B, Matrix& C);
70   friend void FastTMult(Matrix& A, Vect6& B, ColMatrix& C);
71   friend void FastMult(Mat6x6& A, Matrix& B, Matrix& C);
72   friend void FastMult(Matrix& A, ColMatrix& B, Vect6& C);
73   friend void FastMultT(Matrix& A, Matrix& B, Mat6x6& C);
74 
75 };
76 
77 #endif
78