isce3  0.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
DenseMatrix.h
1 #pragma once
2 
3 #include "forward.h"
4 
5 #include <cmath>
6 #define EIGEN_MPL2_ONLY
7 #include <Eigen/Dense>
8 #include "Common.h"
9 
10 namespace isce3 { namespace core {
11 
12 template<int N, typename T>
13 class DenseMatrix : public Eigen::Matrix<T, N, N> {
14  using super_t = Eigen::Matrix<T, N, N>;
15  using super_t::super_t;
16 public:
17  DenseMatrix() = default;
18  CUDA_HOSTDEV auto operator[](int i) { return this->row(i); }
19  CUDA_HOSTDEV auto operator[](int i) const { return this->row(i); }
20 
21  CUDA_HOSTDEV auto dot(const super_t& other) const {
22  return *this * other;
23  }
24 
25  CUDA_HOSTDEV auto dot(const Eigen::Matrix<T, N, 1>& other) const {
26  return *this * other;
27  }
28 
29  CUDA_HOSTDEV constexpr DenseMatrix(
30  std::initializer_list<std::initializer_list<T>> lst) {
31  int i = 0, j = 0;
32  for (const auto& l : lst) {
33  for (const auto& v : l) {
34  (*this)(i, j++) = v;
35  }
36  i++, j = 0;
37  }
38  }
39 
41  CUDA_HOSTDEV constexpr DenseMatrix<N, T> transpose() const {
43  for (int i = 0; i < N; i++)
44  for (int j = 0; j < N; j++)
45  out[i][j] = (*this)[j][i];
46  return out;
47  }
48 
53  CUDA_HOSTDEV static Mat3 xyzToEnu(double lat, double lon);
54 };
55 
56 template<int N, typename T>
57 CUDA_HOSTDEV Mat3 DenseMatrix<N, T>::xyzToEnu(double lat, double lon) {
58  using std::cos;
59  using std::sin;
60  return Mat3 {{{ -sin(lon), cos(lon), 0.},
61  {-sin(lat)*cos(lon), -sin(lat)*sin(lon), cos(lat)},
62  { cos(lat)*cos(lon), cos(lat)*sin(lon), sin(lat)}}};
63 }
64 
65 }}
static CUDA_HOSTDEV Mat3 xyzToEnu(double lat, double lon)
Compute ENU basis transformation matrix.
Definition: DenseMatrix.h:57
Definition: DenseMatrix.h:13
CUDA_HOSTDEV constexpr DenseMatrix< N, T > transpose() const
Matrix transposition.
Definition: DenseMatrix.h:41

Generated for ISCE3.0 by doxygen 1.8.5.