DiSMEC++
type_helpers.h
Go to the documentation of this file.
1 // Copyright (c) 2021, Aalto University, developed by Erik Schultheis
2 // All rights reserved.
3 //
4 // SPDX-License-Identifier: MIT
5 
6 #ifndef DISMEC_TYPE_HELPERS_H
7 #define DISMEC_TYPE_HELPERS_H
8 
9 #include <Eigen/Core>
10 #include <Eigen/SparseCore>
11 
12 namespace dismec::types {
13  namespace type_helpers {
14  template<class T, template<class U> typename V>
15  using outer_const = std::conditional_t<std::is_const_v<T>, const V<std::remove_const_t < T>>, V<T>>;
16 
17  template<class T>
18  using dense_vector_h = Eigen::Matrix<T, Eigen::Dynamic, 1>;
19 
20  template<class T>
21  using sparse_vector_h = Eigen::SparseVector<T>;
22 
23  template<class T>
24  using dense_row_major_h = Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>;
25 
26  template<class T>
27  using dense_col_major_h = Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor>;
28 
29  template<class T>
30  using sparse_row_major_h = Eigen::SparseMatrix<T, Eigen::RowMajor>;
31 
32  template<class T>
33  using sparse_col_major_h = Eigen::SparseMatrix<T, Eigen::ColMajor>;
34 
35  namespace definitions {
36  template<class T>
38 
39  template<class T>
41 
42  template<class T>
44 
45  template<class T>
47 
48  template<class T>
50 
51  template<class T>
53  }
54  }
55 
56  using namespace type_helpers::definitions;
57 }
58 
59 #endif //DISMEC_TYPE_HELPERS_H
outer_const< T, sparse_col_major_h > SparseColMajor
Definition: type_helpers.h:52
outer_const< T, sparse_row_major_h > SparseRowMajor
Definition: type_helpers.h:49
outer_const< T, dense_row_major_h > DenseRowMajor
Definition: type_helpers.h:43
outer_const< T, dense_vector_h > DenseVector
Definition: type_helpers.h:37
outer_const< T, sparse_vector_h > SparseVector
Definition: type_helpers.h:40
outer_const< T, dense_col_major_h > DenseColMajor
Definition: type_helpers.h:46
Eigen::SparseMatrix< T, Eigen::ColMajor > sparse_col_major_h
Definition: type_helpers.h:33
std::conditional_t< std::is_const_v< T >, const V< std::remove_const_t< T > >, V< T > > outer_const
Definition: type_helpers.h:15
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > dense_row_major_h
Definition: type_helpers.h:24
Eigen::SparseVector< T > sparse_vector_h
Definition: type_helpers.h:21
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > dense_col_major_h
Definition: type_helpers.h:27
Eigen::Matrix< T, Eigen::Dynamic, 1 > dense_vector_h
Definition: type_helpers.h:18
Eigen::SparseMatrix< T, Eigen::RowMajor > sparse_row_major_h
Definition: type_helpers.h:30