MatrixImplementation.hpp
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4 //
5 // The GNSSTk 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 GNSSTk 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 GNSSTk; 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-2022, 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 
44 #ifndef GNSSTK_MATRIX_IMPLEMENTATION_HPP
45 #define GNSSTK_MATRIX_IMPLEMENTATION_HPP
46 
47 namespace gnsstk
48 {
49 
51 
52 
53  template <class T>
55  : v((size_t)0), r(0), c(0), s(0)
56  {}
57 
58 
59  template <class T>
60  Matrix<T>::Matrix(size_t rows, size_t cols)
61  : v(rows * cols), r(rows), c(cols), s(rows * cols)
62  {}
63 
64  template <class T>
65  Matrix<T>::Matrix(size_t rows, size_t cols,
66  T initialValue)
67  : v(rows * cols, initialValue), r(rows), c(cols), s(rows * cols)
68  {}
69 
70  template <class T>
71  Matrix<T>::Matrix(size_t rows, size_t cols,
72  const T* vec)
73  : v(rows * cols), r(rows), c(cols), s(rows * cols)
74  {
75  this->assignFrom(vec);
76  }
77 
78  template <class T>
79  MatrixRowSlice<T> Matrix<T>::rowRef(size_t rowNum, const std::slice& s)
80  {
81  return MatrixRowSlice<T>(*this, rowNum, s);
82  }
83 
84  template <class T>
85  MatrixRowSlice<T> Matrix<T>::rowRef(size_t rowNum, size_t colNum)
86  {
87  return MatrixRowSlice<T>(*this, rowNum,
88  std::slice(colNum, cols()-colNum, 1));
89  }
90 
91  template <class T>
92  ConstMatrixRowSlice<T> Matrix<T>::row(size_t rowNum, const std::slice& s)
93  const
94  {
95  return ConstMatrixRowSlice<T>(*this, rowNum, s);
96  }
97 
98  template <class T>
99  ConstMatrixRowSlice<T> Matrix<T>::row(size_t rowNum, size_t colNum)
100  const
101  {
102  return ConstMatrixRowSlice<T>(*this, rowNum,
103  std::slice(colNum, cols()-colNum, 1));
104  }
105 
106  template <class T>
107  MatrixColSlice<T> Matrix<T>::colRef(size_t colNum, const std::slice& s)
108  {
109  return MatrixColSlice<T>(*this, colNum, s);
110  }
111 
112  template <class T>
113  MatrixColSlice<T> Matrix<T>::colRef(size_t colNum, size_t rowNum)
114  {
115  return MatrixColSlice<T>(*this, colNum,
116  std::slice(rowNum, rows() - rowNum, 1));
117  }
118 
119  template <class T>
121  const std::slice& s) const
122  {
123  return ConstMatrixColSlice<T>(*this, colNum, s);
124  }
125 
126  template <class T>
128  size_t rowNum) const
129  {
130  return ConstMatrixColSlice<T>(*this, colNum,
131  std::slice(colNum * r + rowNum, r - rowNum, 1));
132  }
133 
134  template <class T>
135  Matrix<T>& Matrix<T>::resize(size_t rows, size_t cols)
136  {
137  v.resize(rows * cols);
138  c = cols;
139  r = rows;
140  s = rows * cols;
141  return *this;
142  }
143 
144  template <class T>
145  Matrix<T>& Matrix<T>::resize(size_t rows, size_t cols,
146  const T initialValue)
147  {
148  v.resize(rows * cols, initialValue);
149  c = cols;
150  r = rows;
151  s = rows * cols;
152  return *this;
153  }
154 
156 
157 } // namespace
158 
159 #endif
gnsstk::Matrix::resize
Matrix & resize(size_t rows, size_t cols)
Definition: MatrixImplementation.hpp:135
gnsstk::MatrixRowSlice
Definition: Matrix.hpp:57
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::Matrix
Definition: Matrix.hpp:72
gnsstk::ConstMatrixRowSlice
Definition: Matrix.hpp:58
gnsstk::Matrix::Matrix
Matrix()
default constructor
Definition: MatrixImplementation.hpp:54
gnsstk::ConstMatrixColSlice
Definition: Matrix.hpp:60
gnsstk::MatrixColSlice
Definition: Matrix.hpp:59


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:40