1 //==============================================================================
2 //
3 //  This file is part of GPSTk, the GPS Toolkit.
4 //
5 //  The GPSTk is free software; you can redistribute it and/or modify
6 //  it under the terms of the GNU Lesser General Public License as published
7 //  by the Free Software Foundation; either version 3.0 of the License, or
8 //  any later version.
9 //
10 //  The GPSTk is distributed in the hope that it will be useful,
11 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 //  GNU Lesser General Public License for more details.
14 //
15 //  You should have received a copy of the GNU Lesser General Public
16 //  License along with GPSTk; if not, write to the Free Software Foundation,
17 //  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 //
19 //  This software was developed by Applied Research Laboratories at the
20 //  University of Texas at Austin.
21 //  Copyright 2004-2020, The Board of Regents of The University of Texas System
22 //
23 //==============================================================================
24 
25 //==============================================================================
26 //
27 //  This software was developed by Applied Research Laboratories at the
28 //  University of Texas at Austin, under contract to an agency or agencies
29 //  within the U.S. Department of Defense. The U.S. Government retains all
30 //  rights to use, duplicate, distribute, disclose, or release this software.
31 //
32 //  Pursuant to DoD Directive 523024
33 //
34 //  DISTRIBUTION STATEMENT A: This software has been approved for public
35 //                            release, distribution is unlimited.
36 //
37 //==============================================================================
38 
39 #ifndef GPSTK_MATRIX_T_HPP
40 #define GPSTK_MATRIX_T_HPP
41 
42 #include "Matrix.hpp"
43 #include "Vector.hpp"
44 #include "TestUtil.hpp"
45 #include <iostream>
46 #include <fstream>
47 #include <sstream>
48 
49 class Matrix_T
50 {
51 public:
Matrix_T()52    Matrix_T() // Default Constructor, set values that will be used frequently
53    {
54       eps = 1e-12;
55       double dat1[6] = {2,5,5,
56                         -3,-7,2};
57 
58       double dat2[12] = {1,0,-2,1,
59                          3,1,-2,2,
60                          -5,-1,9,3};
61       double dat3[20] = {2, 3, 1, 5, 1,
62                          1, 0, 3, 1, 2,
63                          0, 2, -3, 2, 3,
64                          0, 2, 3, 1, 4};
65       double dat4[24] = {8,5,18,-2,1.5,1./6,
66                          7,-9,5,0,7,0,
67                          1,7,10,11,47,52,
68                          -78,24,20,-68,0,0};
69 
70 
71       //Temp values needed b/c can't assign matrix size to public members at initialization
72       //The temps can give the matrices the sizes (and values) needed
73       gpstk::Matrix<double> A1augTemp(2,3), A2augTemp(3,4), A3augTemp(4,5), A4augTemp(4,6);
74 
75       A1augTemp = dat1;
76       A2augTemp = dat2;
77       A3augTemp = dat3;
78       A4augTemp = dat4;
79 
80       gpstk::Matrix<double> A1Temp(A1augTemp, 0, 0, 2, 2);
81       gpstk::Matrix<double> A2Temp(A2augTemp, 0, 0, 3, 3);
82       gpstk::Matrix<double> A3Temp(A3augTemp, 0, 0, 4, 4);
83       gpstk::Matrix<double> A4Temp(A4augTemp, 0, 0, 4, 5);
84 
85       A1aug = A1augTemp;
86       A2aug = A2augTemp;
87       A3aug = A3augTemp;
88       A4aug = A4augTemp;
89 
90       A1 = A1Temp;
91       A2 = A2Temp;
92       A3 = A3Temp;
93       A4 = A4Temp;
94 
95       gpstk::Vector<double> B1Temp(A1aug.colCopy(2));
96       gpstk::Vector<double> B2Temp(A2aug.colCopy(3));
97       gpstk::Vector<double> B3Temp(A3aug.colCopy(4));
98 
99       B1 = B1Temp;
100       B2 = B2Temp;
101       B3 = B3Temp;
102    }
103 
~Matrix_T()104    ~Matrix_T() // Default Desructor
105    {       // finally delete objects
106 
107    }
108 
109    double eps;
110    gpstk::Matrix<double> A1aug, A2aug, A3aug, A4aug, A1, A2, A3, A4;
111    gpstk::Vector<double> B1, B2, B3;
112 
113    //Functions in Matrix_Initialization_T.cpp
114    int initializeConstantsTest(void);
115    int initializeVectorsTest(void);
116    int initializeArrayTest(void);
117 
118    //Functions in Matrix_Sizing_T.cpp
119    int sizeTest(void);
120 
121    //Functions in Matrix_Operators_T.cpp
122    int operatorTest(void);
123 
124    //Functions in Matrix_InverseTranspose_T.cpp
125    int inverseTest(void);
126    int transposeTest(void);
127    int solutionTest(void);
128    int determinantTest(void);
129 
130    //Functions in Matrix_LUDecomp_T.cpp
131    int LUinitializationTest(void);
132    int LUdeterminantTest(void);
133    int LUATest(void);
134    int LUbackSubTest(void);
135 
136    //Functions in Matrix_SVD_T.cpp
137    int SVDATest(void);
138    int SVDBackSubTest(void);
139    int SVDDeterminantTest(void);
140 
141 
142 private:
143    std::stringstream failDescriptionStream;
144    std::string       failDescriptionString;
145    std::string       failMesg;
146 
147 };
148 
149 #endif
150