Matrix.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_HPP
45 #define GNSSTK_MATRIX_HPP
46 
47 #include "Vector.hpp"
48 #include "MatrixBase.hpp"
49 
50 namespace gnsstk
51 {
52 
54 
55 
56  // forward declarations
57  template <class T> class MatrixRowSlice;
58  template <class T> class ConstMatrixRowSlice;
59  template <class T> class MatrixColSlice;
60  template <class T> class ConstMatrixColSlice;
61 
62 
71  template <class T>
72  class Matrix : public RefMatrixBase<T, Matrix<T> >
73  {
74  public:
78  typedef typename Vector<T>::reference reference;
79 #ifndef SWIG
82 #endif
83  typedef typename Vector<T>::iterator iterator;
87 
89  Matrix();
91  Matrix(size_t rows, size_t cols);
93  Matrix(size_t rows, size_t cols, T initialValue);
95  Matrix(size_t rows, size_t cols, const T* vec);
97  template <class BaseClass>
98  Matrix(size_t rows, size_t cols, const ConstVectorBase<T, BaseClass>& vec)
99  : v(rows*cols), r(rows), c(cols), s(rows * cols)
100  { this->assignFrom(vec); }
101 
103  template <class BaseClass>
105  : v(mat.size()), r(mat.rows()), c(mat.cols()), s(mat.size())
106  {
107  size_t i,j;
108  for(i = 0; i < r; i++)
109  for(j = 0; j < c; j++)
110  (*this)(i,j) = mat(i, j);
111  }
112 
114  template <class BaseClass>
115  Matrix(const ConstMatrixBase<T, BaseClass>& mat, size_t topRow,
116  size_t topCol, size_t numRows, size_t numCols)
117  : v((size_t)0), r(0), c(0), s(0)
118  {
119  // sanity checks...
120  if ( (topCol > mat.cols()) ||
121  (topRow > mat.rows()) ||
122  ((topRow + numRows) > mat.rows()) ||
123  ((topCol + numCols) > mat.cols()) )
124  {
125  MatrixException e("Invalid dimensions or size for Matrix(MatrixBase)");
126  GNSSTK_THROW(e);
127  }
128 
129  // seems ok - make the valarray and copy column by column
130  r = numRows;
131  c = numCols;
132  s = r * c;
133  v.resize(r * c);
134  size_t i, j;
135  for(i = 0; i < r; i++)
136  for(j = 0; j < c; j++)
137  (*this)(i,j) = mat(topRow + i, topCol + j);
138  }
139 
140  virtual ~Matrix()
141  {}
142 
144  iterator begin() { return v.begin(); }
146  const_iterator begin() const { return v.begin(); }
148  iterator end() { return v.end(); }
150  const_iterator end() const { return v.end(); }
152  value_type front() { return v.front(); }
153 #ifndef SWIG
154  const_reference front() const { return v.front();}
156 #endif
157  bool empty() const { return s == 0; }
160  size_t size() const {return s; }
162  size_t max_size() const { return s; }
163 
165  inline size_t rows() const { return r; }
167  inline size_t cols() const { return c; }
169  inline MatrixRowSlice<T> rowRef(size_t rowNum, const std::slice& s);
171  inline MatrixRowSlice<T> rowRef(size_t rowNum, size_t colNum = 0);
173  inline ConstMatrixRowSlice<T> row(size_t rowNum, const std::slice& s) const;
175  inline ConstMatrixRowSlice<T> row(size_t rowNum, size_t colNum = 0) const;
176 
178  inline MatrixColSlice<T> colRef(size_t colNum, const std::slice& s);
180  inline MatrixColSlice<T> colRef(size_t colNum, size_t rowNum = 0);
182  inline ConstMatrixColSlice<T> col(size_t colNum, const std::slice& s) const;
184  inline ConstMatrixColSlice<T> col(size_t colNum, size_t rowNum = 0) const;
185 
187  inline T& operator() (size_t rowNum, size_t colNum)
188  { return v(rowNum + colNum * r); }
190  inline T operator() (size_t rowNum, size_t colNum) const
191  { return v(rowNum + colNum * r); }
194  { return rowRef(row); }
196  inline ConstMatrixRowSlice<T> operator[] (size_t rowNum) const
197  { return row(rowNum);}
198 
201  inline Matrix& resize(size_t rows, size_t cols);
202 
203  inline Matrix& resize(size_t rows, size_t cols,
204  const T initialValue);
205 
210  inline Matrix& operator=(const T* array)
211  { return this->assignFrom(array); }
214  inline Matrix& operator=(const std::valarray<T> array)
215  { return this->assignFrom(array); }
217  inline Matrix& operator=(const T t)
218  { return this->assignFrom(t); }
220  inline Matrix& operator=(const Matrix& mat)
221  { v = mat.v; r = mat.r; c = mat.c; s = mat.s; return *this; }
223  template <class BaseClass>
225  {
226  v.resize(mat.size());
227  r=mat.rows();
228  c=mat.cols();
229  s=mat.size();
230  return this->assignFrom(mat);
231  }
233  template <class BaseClass>
235  { return this->assignFrom(mat); }
236 
237  private:
240  size_t r,
241  c,
242  s;
243  };
244 
248  template <class T>
249  class MatrixSlice : public RefMatrixSliceBase<T, MatrixSlice<T> >
250  {
251  public:
253  MatrixSlice() : m(NULL), rSlice(std::slice(0,0,0)),
254  cSlice(std::slice(0,0,0)), s(0)
255  {}
256 
259  : m(&mat), rSlice(std::slice(0, mat.rows(), 1)),
260  cSlice(std::slice(0,mat.cols(), 1)), s(mat.size())
261  {
262  this->matSliceCheck(mat.rows(), mat.cols());
263  }
264 
266  MatrixSlice(Matrix<T>& mat, const std::slice& rowSlice,
267  const std::slice& colSlice)
268  : m(&mat), rSlice(rowSlice), cSlice(colSlice),
269  s(rSlice.size() * cSlice.size())
270  {
271  this->matSliceCheck(mat.rows(), mat.cols());
272  }
273 
275  MatrixSlice(Matrix<T>& mat, size_t topRow, size_t topCol,
276  size_t numRows, size_t numCols)
277  : m(&mat), rSlice(std::slice(topRow, numRows, 1)),
278  cSlice(std::slice(topCol, numCols, 1)),
279  s(rSlice.size() * cSlice.size())
280  {
281  this->matSliceCheck(mat.rows(), mat.cols());
282  }
283 
285  template <class V>
287  { return this->assignFrom(x); }
288 
290  template <class V>
292  { return this->assignFrom(x); }
293 
295  MatrixSlice& operator=(const std::valarray<T>& x)
296  { return this->assignFrom(x); }
298  MatrixSlice& operator=(const T x)
299  { return this->assignFrom(x); }
301  MatrixSlice& operator=(const T* x)
302  { return this->assignFrom(x); }
303 
305  size_t size() const { return s; }
307  size_t cols() const { return colSize(); }
309  size_t rows() const { return rowSize(); }
311  T& operator() (size_t i, size_t j)
312  { return (*m)(i * rowStride() + rowStart(),
313  j * colStride() + colStart()); }
315  T operator() (size_t i, size_t j) const
316  { return (*m)(i * rowStride() + rowStart(),
317  j * colStride() + colStart()); }
318 
319 
321  size_t rowSize() const { return rSlice.size(); }
323  size_t rowStart() const{ return rSlice.start(); }
325  size_t rowStride() const { return rSlice.stride(); }
327  size_t colSize() const { return cSlice.size(); }
329  size_t colStart() const { return cSlice.start(); }
331  size_t colStride() const { return cSlice.stride(); }
332 
333  private:
336  std::slice rSlice,
338  size_t s;
339  };
340 
344  template <class T>
345  class ConstMatrixSlice : public ConstMatrixSliceBase<T, ConstMatrixSlice<T> >
346  {
347  public:
349  ConstMatrixSlice(void) : m(NULL), rSlice(std::slice(0,0,0)),
350  cSlice(std::slice(0,0,0)), s(0)
351  {}
352 
355  : m(&mat), rSlice(std::slice(0, mat.rows(), 1)),
356  cSlice(std::slice(0,mat.cols(), 1)), s(mat.size())
357  {
358  this->matSliceCheck(mat.rows(), mat.cols());
359  }
360 
362  ConstMatrixSlice(const Matrix<T>& mat, const std::slice& rowSlice,
363  const std::slice& colSlice)
364  : m(&mat), rSlice(rowSlice), cSlice(colSlice),
365  s(rSlice.size() * cSlice.size())
366  {
367  this->matSliceCheck(mat.rows(), mat.cols());
368  }
369 
371  ConstMatrixSlice(const Matrix<T>& mat, size_t topRow, size_t topCol,
372  size_t numRows, size_t numCols)
373  : m(&mat), rSlice(std::slice(topRow, numRows, 1)),
374  cSlice(std::slice(topCol, numCols, 1)),
375  s(rSlice.size() * cSlice.size())
376  {
377  this->matSliceCheck(mat.rows(), mat.cols());
378  }
379 
381  size_t size() const { return s; }
383  size_t cols() const { return colSize(); }
385  size_t rows() const { return rowSize(); }
387  T operator() (size_t i, size_t j) const
388  { return (*m)(i * rowStride() + rowStart(),
389  j * colStride() + colStart()); }
390 
392  size_t rowSize() const { return rSlice.size(); }
394  size_t rowStart() const{ return rSlice.start(); }
396  size_t rowStride() const { return rSlice.stride(); }
398  size_t colSize() const { return cSlice.size(); }
400  size_t colStart() const { return cSlice.start(); }
402  size_t colStride() const { return cSlice.stride(); }
403  private:
405  const Matrix<T>* m;
406  std::slice rSlice,
408  size_t s;
409  };
410 
414  template <class T>
415  class MatrixColSlice : public RefMatrixSliceBase<T, MatrixColSlice<T> >
416  {
417  public:
419  MatrixColSlice() : m(NULL), c(0), rSlice(std::slice(0,0,0)) {}
421  MatrixColSlice(Matrix<T>& mat, size_t col)
422  : m(&mat), c(col), rSlice(std::slice(0,mat.rows(),1))
423  {
424  this->matSliceCheck(mat.rows(), mat.cols());
425  }
428  MatrixColSlice(Matrix<T>& mat, size_t col, const std::slice& s)
429  : m(&mat), c(col), rSlice(s)
430  {
431  // decide if the input is reasonable
432  this->matSliceCheck(mat.rows(), mat.cols());
433  }
434 
436  template <class V>
438  { return this->assignFrom(x); }
439 
441  template <class V>
443  { return this->assignFrom(x); }
445  MatrixColSlice& operator=(const std::valarray<T>& x)
446  { return this->assignFrom(x); }
449  { return this->assignFrom(x); }
452  { return this->assignFrom(x); }
453 
455  T& operator[] (size_t i)
456  { return (*m)(rowStart() + i * rowStride(), c); }
458  T& operator() (size_t i)
459  { return (*m)(rowStart() + i * rowStride(), c); }
461  T operator[] (size_t i) const
462  { return (*m)(rowStart() + i * rowStride(), c); }
464  T operator() (size_t i) const
465  { return (*m)(rowStart() + i * rowStride(), c); }
466 
468  T& operator() (size_t i, size_t j)
469  { return (*m)(rowStart() + i * rowStride(), j + c); }
471  T operator() (size_t i, size_t j) const
472  { return (*m)(rowStart() + i * rowStride(), j + c); }
473 
475  size_t rows() const {return size();}
477  size_t cols() const {return 1;}
479  size_t size() const {return rowSize();}
480 
482  size_t rowSize() const { return rSlice.size(); }
484  size_t rowStart() const{ return rSlice.start(); }
486  size_t rowStride() const { return rSlice.stride(); }
488  size_t colSize() const { return 1; }
490  size_t colStart() const { return c; }
492  size_t colStride() const { return 1; }
493 
494  private:
498  size_t c;
500  std::slice rSlice;
501 
502  };
503 
507  template <class T>
508  class ConstMatrixColSlice : public ConstMatrixSliceBase<T, ConstMatrixColSlice<T> >
509  {
510  public:
513  : m(NULL), c(0), rSlice(std::slice(0,0,0))
514  {}
515 
517  ConstMatrixColSlice(const Matrix<T>& mat, size_t col)
518  : m(&mat), c(col), rSlice(std::slice(0,mat.rows(),1))
519  { this->matSliceCheck(mat.rows(), mat.cols()); }
520 
523  ConstMatrixColSlice(const Matrix<T>& mat, size_t col,
524  const std::slice& s)
525  : m(&mat), c(col), rSlice(s)
526  {
527  // decide if the input is reasonable
528  this->matSliceCheck(mat.rows(), mat.cols());
529  }
530 
532  T operator[] (size_t i) const
533  { return (*m)(rowStart() + i * rowStride(), c); }
535  T operator() (size_t i) const
536  { return (*m)(rowStart() + i * rowStride(), c); }
537 
539  T operator() (size_t i, size_t j) const
540  { return (*m)(rowStart() + i * rowStride(), j + c); }
541 
543  size_t rows() const {return rowSize();}
545  size_t cols() const {return 1;}
547  size_t size() const {return rowSize();}
548 
550  size_t rowSize() const { return rSlice.size(); }
552  size_t rowStart() const{ return rSlice.start(); }
554  size_t rowStride() const { return rSlice.stride(); }
556  size_t colSize() const { return 1; }
558  size_t colStart() const { return c; }
560  size_t colStride() const { return 1; }
561  private:
563  const Matrix<T>* m;
565  size_t c;
567  std::slice rSlice;
568  };
569 
573  template <class T>
574  class MatrixRowSlice : public RefMatrixSliceBase<T, MatrixRowSlice<T> >
575  {
576  public:
579  : m(NULL), r(0), cSlice(std::slice(0,0,0))
580  {}
582  MatrixRowSlice(Matrix<T>& mat, size_t row)
583  : m(&mat), r(row), cSlice(std::slice(0,mat.cols(),1))
584  { this->matSliceCheck(mat.rows(), mat.cols()); }
585 
587  MatrixRowSlice(Matrix<T>& mat, size_t row,
588  const std::slice& s)
589  : m(&mat), r(row), cSlice(s)
590  {
591  // decide if the input is reasonable
592  this->matSliceCheck(mat.rows(), mat.cols());
593  }
594 
596  template <class V>
598  { return this->assignFrom(x); }
600  template <class V>
602  { return this->assignFrom(x); }
604  MatrixRowSlice& operator=(const std::valarray<T>& x)
605  { return this->assignFrom(x); }
608  { return this->assignFrom(x); }
611  { return this->assignFrom(x); }
612 
614  T& operator[] (size_t j)
615  { return (*m)(r, colStart() + j * colStride()); }
617  T& operator() (size_t j)
618  { return (*m)(r, colStart() + j * colStride()); }
620  T operator[] (size_t j) const
621  { return (*m)(r, colStart() + j * colStride()); }
623  T operator() (size_t j) const
624  { return (*m)(r, colStart() + j * colStride()); }
626  T& operator() (size_t i, size_t j)
627  { return (*m)(i + r, colStart() + j * colStride()); }
629  T operator() (size_t i, size_t j) const
630  { return (*m)(i + r, colStart() + j * colStride()); }
631 
633  size_t rows() const {return 1;}
635  size_t cols() const {return colSize();}
637  size_t size() const {return colSize();}
638 
640  size_t rowSize() const { return 1; }
642  size_t rowStart() const{ return r; }
644  size_t rowStride() const { return 1; }
646  size_t colSize() const { return cSlice.size(); }
648  size_t colStart() const { return cSlice.start(); }
650  size_t colStride() const { return cSlice.stride(); }
651 
652  private:
656  size_t r;
658  std::slice cSlice;
659  };
660 
664  template <class T>
665  class ConstMatrixRowSlice : public ConstMatrixSliceBase<T, ConstMatrixRowSlice<T> >
666  {
667  public:
670  : m(NULL), r(0), cSlice(std::slice(0,0,0))
671  {}
673  ConstMatrixRowSlice(const Matrix<T>& mat, size_t row)
674  : m(&mat), r(row), cSlice(std::slice(0,mat.cols(),1))
675  { this->matSliceCheck(mat.rows(), mat.cols()); }
676 
678  ConstMatrixRowSlice(const Matrix<T>& mat, size_t row,
679  const std::slice& s)
680  : m(&mat), r(row), cSlice(s)
681  {
682  // decide if the input is reasonable
683  this->matSliceCheck(mat.rows(), mat.cols());
684  }
685 
687  T operator[] (size_t i) const
688  { return (*m)(r, colStart() + i * colStride()); }
690  T operator() (size_t i) const
691  { return (*m)(r, colStart() + i * colStride()); }
692 
694  T operator() (size_t i, size_t j) const
695  { return (*m)(i + r, colStart() + j * colStride()); }
696 
698  size_t rows() const {return 1;}
700  size_t cols() const {return colSize();}
702  size_t size() const {return colSize();}
703 
705  size_t rowSize() const { return 1; }
707  size_t rowStart() const{ return r; }
709  size_t rowStride() const { return 1; }
711  size_t colSize() const { return cSlice.size(); }
713  size_t colStart() const { return cSlice.start(); }
715  size_t colStride() const { return cSlice.stride(); }
716  private:
718  const Matrix<T>* m;
720  size_t r;
722  std::slice cSlice;
723  };
724 
726 
727 } // namespace
728 
729 #include "MatrixImplementation.hpp"
730 #include "MatrixOperators.hpp"
731 #include "MatrixFunctors.hpp"
732 
733 #endif
gnsstk::Matrix::iterator
Vector< T >::iterator iterator
STL iterator type.
Definition: Matrix.hpp:84
gnsstk::ConstMatrixRowSlice::colStart
size_t colStart() const
returns the starting row in the base matrix of this slice
Definition: Matrix.hpp:713
gnsstk::RefMatrixBase
Definition: MatrixBase.hpp:217
gnsstk::ConstMatrixRowSlice::rows
size_t rows() const
returns the number of rows in the slice
Definition: Matrix.hpp:698
gnsstk::ConstMatrixSlice::colSize
size_t colSize() const
returns the number of columns in this slice
Definition: Matrix.hpp:398
gnsstk::ConstMatrixRowSlice::m
const Matrix< T > * m
the matrix this slice refers to
Definition: Matrix.hpp:718
gnsstk::MatrixColSlice::operator=
MatrixColSlice & operator=(const T x)
assigns this column to x
Definition: Matrix.hpp:448
gnsstk::ConstMatrixSliceBase
Base class for an unmodifiable matrix slice.
Definition: MatrixBase.hpp:682
gnsstk::MatrixRowSlice::operator=
MatrixRowSlice & operator=(const ConstVectorBase< T, V > &x)
assigns this row to x.
Definition: Matrix.hpp:601
gnsstk::MatrixSlice::colSize
size_t colSize() const
returns the number of columns in this slice
Definition: Matrix.hpp:327
gnsstk::ConstMatrixColSlice::rSlice
std::slice rSlice
a slice down the rows
Definition: Matrix.hpp:567
gnsstk::ConstMatrixColSlice::size
size_t size() const
returns the overall size of the slice
Definition: Matrix.hpp:547
gnsstk::ConstMatrixSlice::rows
size_t rows() const
the number of rows in the slice
Definition: Matrix.hpp:385
MatrixImplementation.hpp
gnsstk::ConstMatrixRowSlice::r
size_t r
the row of the slice
Definition: Matrix.hpp:720
gnsstk::MatrixSlice::size
size_t size() const
returns the size of this slice
Definition: Matrix.hpp:305
gnsstk::Matrix::rowRef
MatrixRowSlice< T > rowRef(size_t rowNum, const std::slice &s)
A reference slice of a row with a given std::slice.
Definition: MatrixImplementation.hpp:79
gnsstk::Matrix::resize
Matrix & resize(size_t rows, size_t cols)
Definition: MatrixImplementation.hpp:135
gnsstk::Vector::iterator
T * iterator
STL iterator type.
Definition: Vector.hpp:77
gnsstk::ConstMatrixSlice::ConstMatrixSlice
ConstMatrixSlice(const Matrix< T > &mat, const std::slice &rowSlice, const std::slice &colSlice)
makes a slice given std::slices for rows and columns
Definition: Matrix.hpp:362
gnsstk::MatrixRowSlice::size
size_t size() const
returns the size of the slice
Definition: Matrix.hpp:637
gnsstk::MatrixColSlice::colSize
size_t colSize() const
returns the number of columns in this slice
Definition: Matrix.hpp:488
gnsstk::Matrix::empty
bool empty() const
STL empty.
Definition: Matrix.hpp:158
gnsstk::ConstMatrixSlice::rowStride
size_t rowStride() const
returns the number of elements between the i'th and i+1'th row
Definition: Matrix.hpp:396
gnsstk::MatrixSlice::rows
size_t rows() const
returns the number of rows in the slice
Definition: Matrix.hpp:309
gnsstk::Matrix::v
Vector< T > v
the matrix stored in column major order
Definition: Matrix.hpp:239
MatrixOperators.hpp
gnsstk::Matrix::col
ConstMatrixColSlice< T > col(size_t colNum, const std::slice &s) const
A const reference column with a given slice.
Definition: MatrixImplementation.hpp:120
gnsstk::Matrix::begin
iterator begin()
STL begin.
Definition: Matrix.hpp:144
gnsstk::Matrix::operator=
Matrix & operator=(const ConstVectorBase< T, BaseClass > &mat)
Copies from any vector.
Definition: Matrix.hpp:234
gnsstk::ConstMatrixSlice::rowStart
size_t rowStart() const
returns the starting row in the base matrix of this slice
Definition: Matrix.hpp:394
gnsstk::MatrixColSlice::MatrixColSlice
MatrixColSlice(Matrix< T > &mat, size_t col, const std::slice &s)
Definition: Matrix.hpp:428
gnsstk::Matrix::Matrix
Matrix(size_t rows, size_t cols, const ConstVectorBase< T, BaseClass > &vec)
copies out the contents of vec to initialize the matrix
Definition: Matrix.hpp:98
gnsstk::MatrixSlice::operator=
MatrixSlice & operator=(const ConstVectorBase< T, V > &x)
Copies from x to (*this).
Definition: Matrix.hpp:291
gnsstk::ConstMatrixRowSlice::operator[]
T operator[](size_t i) const
returns the i'th element of the slice
Definition: Matrix.hpp:687
gnsstk::MatrixColSlice::MatrixColSlice
MatrixColSlice()
default constructor
Definition: Matrix.hpp:419
gnsstk::ConstMatrixRowSlice::cSlice
std::slice cSlice
the slice of the row's columns
Definition: Matrix.hpp:722
gnsstk::Matrix::front
value_type front()
STL front.
Definition: Matrix.hpp:152
gnsstk::Matrix::reference
Vector< T >::reference reference
STL reference type.
Definition: Matrix.hpp:78
gnsstk::ConstMatrixColSlice::colSize
size_t colSize() const
returns the number of columns in this slice
Definition: Matrix.hpp:556
gnsstk::Matrix::cols
size_t cols() const
The number of columns in the matrix.
Definition: Matrix.hpp:167
gnsstk::MatrixRowSlice::rowStride
size_t rowStride() const
returns the number of elements between the i'th and i+1'th row
Definition: Matrix.hpp:644
gnsstk::ConstMatrixRowSlice::rowStart
size_t rowStart() const
returns the starting row in the base matrix of this slice
Definition: Matrix.hpp:707
gnsstk::MatrixRowSlice::colSize
size_t colSize() const
returns the number of columns in this slice
Definition: Matrix.hpp:646
gnsstk::Matrix::max_size
size_t max_size() const
STL max size.
Definition: Matrix.hpp:162
gnsstk::MatrixColSlice::c
size_t c
the column this slice is for
Definition: Matrix.hpp:498
NULL
#define NULL
Definition: getopt1.c:64
gnsstk::ConstMatrixRowSlice::colSize
size_t colSize() const
returns the number of columns in this slice
Definition: Matrix.hpp:711
gnsstk::ConstMatrixColSlice::rowStride
size_t rowStride() const
returns the number of elements between the i'th and i+1'th row
Definition: Matrix.hpp:554
gnsstk::Matrix::rows
size_t rows() const
The number of rows in the matrix.
Definition: Matrix.hpp:165
gnsstk::MatrixRowSlice::operator=
MatrixRowSlice & operator=(const ConstMatrixBase< T, V > &x)
assigns this row to x.
Definition: Matrix.hpp:597
gnsstk::MatrixSlice::operator()
T & operator()(size_t i, size_t j)
returns the (i,j) element of the slice.
Definition: Matrix.hpp:311
gnsstk::Matrix::const_iterator
Vector< T >::const_iterator const_iterator
STL const iterator type.
Definition: Matrix.hpp:86
gnsstk::Matrix::operator[]
MatrixRowSlice< T > operator[](size_t row)
operator[] that returns a row slice
Definition: Matrix.hpp:193
gnsstk::MatrixRowSlice::colStart
size_t colStart() const
returns the starting row in the base matrix of this slice
Definition: Matrix.hpp:648
gnsstk::Vector::value_type
T value_type
STL value type.
Definition: Vector.hpp:71
gnsstk::ConstMatrixColSlice::c
size_t c
the column this slice refers to
Definition: Matrix.hpp:565
gnsstk::Matrix::r
size_t r
the number of rows
Definition: Matrix.hpp:240
gnsstk::Matrix::begin
const_iterator begin() const
STL const begin.
Definition: Matrix.hpp:146
gnsstk::MatrixRowSlice
Definition: Matrix.hpp:57
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::ConstMatrixColSlice::colStride
size_t colStride() const
returns the number of elements between the i'th and i+1'th row
Definition: Matrix.hpp:560
gnsstk::ConstMatrixRowSlice::cols
size_t cols() const
returns the number of columns in the slice
Definition: Matrix.hpp:700
gnsstk::MatrixSlice::MatrixSlice
MatrixSlice(Matrix< T > &mat, size_t topRow, size_t topCol, size_t numRows, size_t numCols)
Submatrix slice.
Definition: Matrix.hpp:275
gnsstk::Matrix::value_type
Vector< T >::value_type value_type
STL value_type.
Definition: Matrix.hpp:76
gnsstk::MatrixColSlice::operator[]
T & operator[](size_t i)
returns the i'th element of the column, non-const
Definition: Matrix.hpp:455
gnsstk::ConstMatrixSlice::size
size_t size() const
the size of the slice
Definition: Matrix.hpp:381
gnsstk::ConstMatrixRowSlice::operator()
T operator()(size_t i) const
returns the i'th element of the slice
Definition: Matrix.hpp:690
gnsstk::ConstMatrixColSlice::operator()
T operator()(size_t i) const
returns the i'th element of the column slice
Definition: Matrix.hpp:535
gnsstk::Matrix::Matrix
Matrix(const ConstMatrixBase< T, BaseClass > &mat)
constructor for a ConstMatrixBase object
Definition: Matrix.hpp:104
gnsstk::MatrixRowSlice::rowStart
size_t rowStart() const
returns the starting row in the base matrix of this slice
Definition: Matrix.hpp:642
gnsstk::ConstMatrixColSlice::rowStart
size_t rowStart() const
returns the starting row in the base matrix of this slice
Definition: Matrix.hpp:552
gnsstk::ConstMatrixRowSlice::rowSize
size_t rowSize() const
returns the number of rows in this slice
Definition: Matrix.hpp:705
gnsstk::ConstMatrixBase::size
size_t size() const
the rows()*cols() size of the matrix.
Definition: MatrixBase.hpp:75
gnsstk::Matrix::operator()
T & operator()(size_t rowNum, size_t colNum)
Non-const matrix operator(row,col)
Definition: Matrix.hpp:187
gnsstk::RefMatrixSliceBase
Base class for a modifiable matrix slice.
Definition: MatrixBase.hpp:691
gnsstk::MatrixColSlice::cols
size_t cols() const
returns the number of columns in the slice
Definition: Matrix.hpp:477
gnsstk::ConstMatrixSlice::rSlice
std::slice rSlice
the row slice
Definition: Matrix.hpp:406
gnsstk::ConstMatrixSlice::cSlice
std::slice cSlice
the column slice
Definition: Matrix.hpp:407
gnsstk::ConstMatrixSlice::ConstMatrixSlice
ConstMatrixSlice(const Matrix< T > &mat)
makes a const slice of the whole matrix
Definition: Matrix.hpp:354
gnsstk::Matrix::size
size_t size() const
STL size.
Definition: Matrix.hpp:160
gnsstk::ConstMatrixSlice::colStride
size_t colStride() const
returns the number of elements between the i'th and i+1'th row
Definition: Matrix.hpp:402
gnsstk::MatrixRowSlice::operator=
MatrixRowSlice & operator=(const std::valarray< T > &x)
assigns this row to x.
Definition: Matrix.hpp:604
gnsstk::ConstMatrixBase::rows
size_t rows() const
the number of rows in the matrix
Definition: MatrixBase.hpp:81
gnsstk::MatrixSliceBase< T, MatrixSlice< T > >::matSliceCheck
void matSliceCheck(size_t sourceRowSize, size_t sourceColSize) const
Definition: MatrixBase.hpp:654
gnsstk::Matrix
Definition: Matrix.hpp:72
gnsstk::MatrixColSlice::colStride
size_t colStride() const
returns the number of elements between the i'th and i+1'th row
Definition: Matrix.hpp:492
gnsstk::MatrixRowSlice::r
size_t r
the row of the slice
Definition: Matrix.hpp:656
gnsstk::ConstMatrixRowSlice
Definition: Matrix.hpp:58
gnsstk::Matrix::Matrix
Matrix()
default constructor
Definition: MatrixImplementation.hpp:54
gnsstk::MatrixColSlice::operator=
MatrixColSlice & operator=(const ConstMatrixBase< T, V > &x)
assigns this column to x
Definition: Matrix.hpp:437
gnsstk::ConstMatrixBase::cols
size_t cols() const
the number of columns in the matrix
Definition: MatrixBase.hpp:78
gnsstk::ConstMatrixSlice::colStart
size_t colStart() const
returns the starting row in the base matrix of this slice
Definition: Matrix.hpp:400
gnsstk::ConstMatrixRowSlice::rowStride
size_t rowStride() const
returns the number of elements between the i'th and i+1'th row
Definition: Matrix.hpp:709
gnsstk::Matrix::end
const_iterator end() const
STL const end.
Definition: Matrix.hpp:150
MatrixBase.hpp
gnsstk::ConstMatrixRowSlice::size
size_t size() const
returns the overall size of the slice
Definition: Matrix.hpp:702
gnsstk::ConstMatrixSlice::ConstMatrixSlice
ConstMatrixSlice(const Matrix< T > &mat, size_t topRow, size_t topCol, size_t numRows, size_t numCols)
submatrix slice
Definition: Matrix.hpp:371
gnsstk::ConstMatrixColSlice::ConstMatrixColSlice
ConstMatrixColSlice(const Matrix< T > &mat, size_t col)
constructor taking a slice of column col from the matrix.
Definition: Matrix.hpp:517
gnsstk::MatrixSlice::operator=
MatrixSlice & operator=(const ConstMatrixBase< T, V > &x)
Copies from x to (*this).
Definition: Matrix.hpp:286
gnsstk::MatrixColSlice::rows
size_t rows() const
returns the number of rows in the slice
Definition: Matrix.hpp:475
gnsstk::Matrix::operator=
Matrix & operator=(const T t)
Assigns all elements of the matrix to t.
Definition: Matrix.hpp:217
gnsstk::ConstMatrixSlice::ConstMatrixSlice
ConstMatrixSlice(void)
default constructor
Definition: Matrix.hpp:349
gnsstk::MatrixSlice::MatrixSlice
MatrixSlice()
default constructor
Definition: Matrix.hpp:253
gnsstk::MatrixSlice::MatrixSlice
MatrixSlice(Matrix< T > &mat, const std::slice &rowSlice, const std::slice &colSlice)
Makes a partial slice of a matrix.
Definition: Matrix.hpp:266
gnsstk::MatrixColSlice::operator=
MatrixColSlice & operator=(const std::valarray< T > &x)
assigns this column to x
Definition: Matrix.hpp:445
gnsstk::MatrixSlice::operator=
MatrixSlice & operator=(const T x)
Copies from x to (*this).
Definition: Matrix.hpp:298
gnsstk::MatrixColSlice::rowStart
size_t rowStart() const
returns the starting row in the base matrix of this slice
Definition: Matrix.hpp:484
gnsstk::Matrix::operator=
Matrix & operator=(const Matrix &mat)
Copies the other matrix.
Definition: Matrix.hpp:220
gnsstk::MatrixRowSlice::operator=
MatrixRowSlice & operator=(const T x)
assigns this row to x.
Definition: Matrix.hpp:607
gnsstk::MatrixRowSlice::rows
size_t rows() const
returns the number of rows in the row slice
Definition: Matrix.hpp:633
gnsstk::ConstMatrixSlice::rowSize
size_t rowSize() const
returns the number of rows in this slice
Definition: Matrix.hpp:392
gnsstk::ConstMatrixRowSlice::ConstMatrixRowSlice
ConstMatrixRowSlice()
default constructor
Definition: Matrix.hpp:669
gnsstk::MatrixColSlice::size
size_t size() const
returns the size of the slice
Definition: Matrix.hpp:479
gnsstk::MatrixSlice::MatrixSlice
MatrixSlice(Matrix< T > &mat)
Makes a slice of the whole matrix.
Definition: Matrix.hpp:258
gnsstk::Matrix::c
size_t c
the number of columns
Definition: Matrix.hpp:241
gnsstk::ConstMatrixSlice::operator()
T operator()(size_t i, size_t j) const
the (i,j) element of the slice, const.
Definition: Matrix.hpp:387
gnsstk::Vector
Definition: Vector.hpp:67
gnsstk::Matrix::operator=
Matrix & operator=(const T *array)
Definition: Matrix.hpp:210
gnsstk::ConstMatrixColSlice::colStart
size_t colStart() const
returns the starting row in the base matrix of this slice
Definition: Matrix.hpp:558
gnsstk::ConstMatrixColSlice::ConstMatrixColSlice
ConstMatrixColSlice()
default constructor
Definition: Matrix.hpp:512
gnsstk::MatrixRowSlice::MatrixRowSlice
MatrixRowSlice(Matrix< T > &mat, size_t row)
makes a slice of row row from the matrix.
Definition: Matrix.hpp:582
gnsstk::ConstMatrixBase
Definition: MatrixBase.hpp:65
gnsstk::MatrixColSlice::rowStride
size_t rowStride() const
returns the number of elements between the i'th and i+1'th row
Definition: Matrix.hpp:486
gnsstk::Matrix::Matrix
Matrix(const ConstMatrixBase< T, BaseClass > &mat, size_t topRow, size_t topCol, size_t numRows, size_t numCols)
submatrix constructor
Definition: Matrix.hpp:115
gnsstk::Vector::reference
T & reference
STL reference type.
Definition: Vector.hpp:73
gnsstk::MatrixColSlice::rSlice
std::slice rSlice
slice down the rows
Definition: Matrix.hpp:500
gnsstk::ConstMatrixColSlice::cols
size_t cols() const
returns the size of the slice in columns
Definition: Matrix.hpp:545
gnsstk::MatrixSlice::rSlice
std::slice rSlice
a row slice
Definition: Matrix.hpp:336
gnsstk::MatrixRowSlice::operator=
MatrixRowSlice & operator=(const T *x)
assigns this row to x.
Definition: Matrix.hpp:610
gnsstk::MatrixRowSlice::operator[]
T & operator[](size_t j)
returns the j'th element of the slice, non-const
Definition: Matrix.hpp:614
gnsstk::ConstMatrixRowSlice::ConstMatrixRowSlice
ConstMatrixRowSlice(const Matrix< T > &mat, size_t row)
makes a const row slice from the matrix
Definition: Matrix.hpp:673
gnsstk::MatrixColSlice::operator=
MatrixColSlice & operator=(const T *x)
assigns this column to x
Definition: Matrix.hpp:451
gnsstk::ConstVectorBase
Definition: VectorBase.hpp:105
gnsstk::MatrixSlice::rowSize
size_t rowSize() const
returns the number of rows in this slice
Definition: Matrix.hpp:321
gnsstk::MatrixRowSlice::MatrixRowSlice
MatrixRowSlice(Matrix< T > &mat, size_t row, const std::slice &s)
makes a slice of row row from the matrix, slicing it by s.
Definition: Matrix.hpp:587
std
Definition: Angle.hpp:142
gnsstk::MatrixColSlice::m
Matrix< T > * m
the matrix this slice refers to.
Definition: Matrix.hpp:496
gnsstk::MatrixRowSlice::operator()
T & operator()(size_t j)
returns the j'th element of the slice, non-const
Definition: Matrix.hpp:617
gnsstk::Matrix::const_reference
Vector< T >::const_reference const_reference
STL const reference type.
Definition: Matrix.hpp:81
gnsstk::MatrixColSlice::operator()
T & operator()(size_t i)
returns the i'th element of the column, non-const
Definition: Matrix.hpp:458
gnsstk::ConstMatrixSlice::m
const Matrix< T > * m
the matrix this slice refers to.
Definition: Matrix.hpp:405
gnsstk::MatrixSlice
Definition: Matrix.hpp:249
gnsstk::ConstMatrixSlice::cols
size_t cols() const
the number of columns in the slice
Definition: Matrix.hpp:383
gnsstk::MatrixSlice::operator=
MatrixSlice & operator=(const std::valarray< T > &x)
Copies from x to (*this).
Definition: Matrix.hpp:295
gnsstk::MatrixColSlice::colStart
size_t colStart() const
returns the starting row in the base matrix of this slice
Definition: Matrix.hpp:490
gnsstk::MatrixSlice::colStart
size_t colStart() const
returns the starting row in the base matrix of this slice
Definition: Matrix.hpp:329
MatrixFunctors.hpp
gnsstk::MatrixRowSlice::rowSize
size_t rowSize() const
returns the number of rows in this slice
Definition: Matrix.hpp:640
gnsstk::ConstMatrixColSlice::operator[]
T operator[](size_t i) const
returns the i'th element of the column slice
Definition: Matrix.hpp:532
gnsstk::Matrix::colRef
MatrixColSlice< T > colRef(size_t colNum, const std::slice &s)
A reference column with a given slice.
Definition: MatrixImplementation.hpp:107
GNSSTK_THROW
#define GNSSTK_THROW(exc)
Definition: Exception.hpp:366
gnsstk::MatrixSlice::cols
size_t cols() const
returns the number of columns in the slice
Definition: Matrix.hpp:307
gnsstk::MatrixSlice::colStride
size_t colStride() const
returns the number of elements between the i'th and i+1'th row
Definition: Matrix.hpp:331
gnsstk::MatrixSlice::rowStride
size_t rowStride() const
returns the number of elements between the i'th and i+1'th row
Definition: Matrix.hpp:325
gnsstk::ConstMatrixRowSlice::ConstMatrixRowSlice
ConstMatrixRowSlice(const Matrix< T > &mat, size_t row, const std::slice &s)
makes a const row slice from the matrix, slicing that row by s.
Definition: Matrix.hpp:678
gnsstk::ConstMatrixColSlice::rows
size_t rows() const
returns the size of the slice in rows
Definition: Matrix.hpp:543
gnsstk::MatrixSlice::cSlice
std::slice cSlice
a column slice
Definition: Matrix.hpp:337
gnsstk::ConstMatrixColSlice::rowSize
size_t rowSize() const
returns the number of rows in this slice
Definition: Matrix.hpp:550
gnsstk::MatrixRowSlice::colStride
size_t colStride() const
returns the number of elements between the i'th and i+1'th row
Definition: Matrix.hpp:650
gnsstk::ConstMatrixRowSlice::colStride
size_t colStride() const
returns the number of elements between the i'th and i+1'th row
Definition: Matrix.hpp:715
gnsstk::Matrix::~Matrix
virtual ~Matrix()
Definition: Matrix.hpp:140
gnsstk::MatrixRowSlice::cSlice
std::slice cSlice
the column slice of the row.
Definition: Matrix.hpp:658
gnsstk::Matrix::s
size_t s
the overall size
Definition: Matrix.hpp:242
gnsstk::RefMatrixBase< T, Matrix< T > >::assignFrom
Matrix< T > & assignFrom(const ConstMatrixBase< T, E > &x)
Definition: MatrixBase.hpp:288
gnsstk::MatrixSlice::operator=
MatrixSlice & operator=(const T *x)
Copies from x to (*this).
Definition: Matrix.hpp:301
gnsstk::Matrix::operator=
Matrix & operator=(const ConstMatrixBase< T, BaseClass > &mat)
Copies from any matrix.
Definition: Matrix.hpp:224
gnsstk::ConstMatrixColSlice
Definition: Matrix.hpp:60
gnsstk::MatrixSlice::rowStart
size_t rowStart() const
returns the starting row in the base matrix of this slice
Definition: Matrix.hpp:323
gnsstk::ConstMatrixColSlice::m
const Matrix< T > * m
the matrix this slice refers to
Definition: Matrix.hpp:563
gnsstk::MatrixRowSlice::m
Matrix< T > * m
the matrix this slice refers to.
Definition: Matrix.hpp:654
gnsstk::ConstMatrixSlice::s
size_t s
the size of the slice
Definition: Matrix.hpp:408
gnsstk::MatrixColSlice
Definition: Matrix.hpp:59
gnsstk::Matrix::operator=
Matrix & operator=(const std::valarray< T > array)
Definition: Matrix.hpp:214
gnsstk::MatrixRowSlice::MatrixRowSlice
MatrixRowSlice()
default constructor
Definition: Matrix.hpp:578
Vector.hpp
gnsstk::MatrixSlice::s
size_t s
the overall size
Definition: Matrix.hpp:338
gnsstk::ConstMatrixColSlice::ConstMatrixColSlice
ConstMatrixColSlice(const Matrix< T > &mat, size_t col, const std::slice &s)
Definition: Matrix.hpp:523
gnsstk::MatrixColSlice::MatrixColSlice
MatrixColSlice(Matrix< T > &mat, size_t col)
makes a slice of the column col from matrix mat.
Definition: Matrix.hpp:421
gnsstk::MatrixRowSlice::cols
size_t cols() const
returns the number of columns in the row slice
Definition: Matrix.hpp:635
gnsstk::MatrixSlice::m
Matrix< T > * m
The matrix this slice refers to.
Definition: Matrix.hpp:335
gnsstk::Matrix::row
ConstMatrixRowSlice< T > row(size_t rowNum, const std::slice &s) const
A const reference slice of a row with a given std::slice.
Definition: MatrixImplementation.hpp:92
gnsstk::ConstMatrixSlice
Definition: Matrix.hpp:345
gnsstk::MatrixColSlice::operator=
MatrixColSlice & operator=(const ConstVectorBase< T, V > &x)
assigns this column to x
Definition: Matrix.hpp:442
gnsstk::Matrix::end
iterator end()
STL end.
Definition: Matrix.hpp:148
gnsstk::MatrixColSlice::rowSize
size_t rowSize() const
returns the number of rows in this slice
Definition: Matrix.hpp:482


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