[shark] 56/79: added const_expression template which produces the const expression type (which is the same as const_closure except for container types for which it is const ContainerType). This is necessary to simplify expression generation as it is virtually impossible to write a non-const-> const conversion when the types are Proxy<Matrix> -> Proxy<matrix_reference<const Matrix> >. This is going to be used in the typedefs for const_closure
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Thu Nov 26 15:41:01 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch master
in repository shark.
commit dfecdec687756852206fbdb6467b6e790110792b
Author: Oswin <oswin.krause at di.ku.dk>
Date: Mon Oct 26 08:14:14 2015 +0100
added const_expression template which produces the const expression type (which is the same as const_closure except for container types for which it is const ContainerType). This is necessary to simplify expression generation as it is virtually impossible to write a non-const-> const conversion when the types are Proxy<Matrix> -> Proxy<matrix_reference<const Matrix> >. This is going to be used in the typedefs for const_closure
---
include/shark/LinAlg/BLAS/detail/traits.hpp | 5 +++++
include/shark/LinAlg/BLAS/matrix.hpp | 10 ++++++++++
include/shark/LinAlg/BLAS/matrix_sparse.hpp | 9 +++++++++
include/shark/LinAlg/BLAS/triangular_matrix.hpp | 9 +++++++++
include/shark/LinAlg/BLAS/vector.hpp | 9 +++++++++
include/shark/LinAlg/BLAS/vector_sparse.hpp | 9 +++++++++
6 files changed, 51 insertions(+)
diff --git a/include/shark/LinAlg/BLAS/detail/traits.hpp b/include/shark/LinAlg/BLAS/detail/traits.hpp
index d81af9f..7c3bd26 100644
--- a/include/shark/LinAlg/BLAS/detail/traits.hpp
+++ b/include/shark/LinAlg/BLAS/detail/traits.hpp
@@ -326,6 +326,11 @@ struct closure: public boost::mpl::if_<
typename E::const_closure_type,
typename E::closure_type
>{};
+
+template<class E>
+struct const_expression{
+ typedef typename E::const_closure_type type;
+};
template<class E>
struct reference: public boost::mpl::if_<
diff --git a/include/shark/LinAlg/BLAS/matrix.hpp b/include/shark/LinAlg/BLAS/matrix.hpp
index 8d1b2ba..1415ad2 100644
--- a/include/shark/LinAlg/BLAS/matrix.hpp
+++ b/include/shark/LinAlg/BLAS/matrix.hpp
@@ -445,6 +445,16 @@ private:
VectorType m_diagonal;
};
+
+template<class T, class Orientation>
+struct const_expression<matrix<T,Orientation> >{
+ typedef matrix<T,Orientation> const type;
+};
+template<class T, class Orientation>
+struct const_expression<matrix<T,Orientation> const>{
+ typedef matrix<T,Orientation> const type;
+};
+
}
}
diff --git a/include/shark/LinAlg/BLAS/matrix_sparse.hpp b/include/shark/LinAlg/BLAS/matrix_sparse.hpp
index d29d7f1..adff645 100644
--- a/include/shark/LinAlg/BLAS/matrix_sparse.hpp
+++ b/include/shark/LinAlg/BLAS/matrix_sparse.hpp
@@ -451,6 +451,15 @@ struct matrix_temporary_type<T,row_major,sparse_bidirectional_iterator_tag> {
typedef compressed_matrix<T> type;
};
+template<class T, class I>
+struct const_expression<compressed_matrix<T,I> >{
+ typedef compressed_matrix<T,I> const type;
+};
+template<class T, class I>
+struct const_expression<compressed_matrix<T,I> const>{
+ typedef compressed_matrix<T,I> const type;
+};
+
}
}
diff --git a/include/shark/LinAlg/BLAS/triangular_matrix.hpp b/include/shark/LinAlg/BLAS/triangular_matrix.hpp
index db5ba1e..485163a 100644
--- a/include/shark/LinAlg/BLAS/triangular_matrix.hpp
+++ b/include/shark/LinAlg/BLAS/triangular_matrix.hpp
@@ -495,6 +495,15 @@ private:
array_type m_data;
};
+template<class T, class Orientation, class TriangularType>
+struct const_expression<triangular_matrix<T,Orientation, TriangularType> >{
+ typedef triangular_matrix<T,Orientation, TriangularType> const type;
+};
+template<class T, class Orientation, class TriangularType>
+struct const_expression<triangular_matrix<T,Orientation, TriangularType> const>{
+ typedef triangular_matrix<T,Orientation, TriangularType> const type;
+};
+
}
}
diff --git a/include/shark/LinAlg/BLAS/vector.hpp b/include/shark/LinAlg/BLAS/vector.hpp
index fdd3e01..6d3dcdc 100644
--- a/include/shark/LinAlg/BLAS/vector.hpp
+++ b/include/shark/LinAlg/BLAS/vector.hpp
@@ -322,6 +322,15 @@ struct vector_temporary_type<T,dense_random_access_iterator_tag>{
typedef vector<T> type;
};
+template<class T>
+struct const_expression<vector<T> >{
+ typedef vector<T> const type;
+};
+template<class T>
+struct const_expression<vector<T> const>{
+ typedef vector<T> const type;
+};
+
}
}
diff --git a/include/shark/LinAlg/BLAS/vector_sparse.hpp b/include/shark/LinAlg/BLAS/vector_sparse.hpp
index 3f9cf21..53d81a8 100644
--- a/include/shark/LinAlg/BLAS/vector_sparse.hpp
+++ b/include/shark/LinAlg/BLAS/vector_sparse.hpp
@@ -350,6 +350,15 @@ struct vector_temporary_type<T,sparse_bidirectional_iterator_tag>{
typedef compressed_vector<T> type;
};
+template<class T,class I>
+struct const_expression<compressed_vector<T,I> >{
+ typedef compressed_vector<T,I> const type;
+};
+template<class T,class I>
+struct const_expression<compressed_vector<T,I> const>{
+ typedef compressed_vector<T,I> const type;
+};
+
}}
#endif
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/shark.git
More information about the debian-science-commits
mailing list