matrix.hpp
Go to the documentation of this file.
1 /*!
2  * \brief Dense Matrix class
3  *
4  * \author O. Krause
5  * \date 2013
6  *
7  *
8  * \par Copyright 1995-2015 Shark Development Team
9  *
10  * <BR><HR>
11  * This file is part of Shark.
12  * <http://image.diku.dk/shark/>
13  *
14  * Shark is free software: you can redistribute it and/or modify
15  * it under the terms of the GNU Lesser General Public License as published
16  * by the Free Software Foundation, either version 3 of the License, or
17  * (at your option) any later version.
18  *
19  * Shark is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public License
25  * along with Shark. If not, see <http://www.gnu.org/licenses/>.
26  *
27  */
28 #ifndef REMORA_MATRIX_HPP
29 #define REMORA_MATRIX_HPP
30 
31 #include "expression_types.hpp"
32 #include "detail/traits.hpp"
33 namespace remora {
34 
35 /** \brief A dense matrix of values of type \c T.
36  *
37  * For a \f$(m \times n)\f$-dimensional matrix and \f$ 0 \leq i < m, 0 \leq j < n\f$, every element \f$ m_{i,j} \f$ is mapped to
38  * the \f$(i.n + j)\f$-th element of the container for row major orientation or the \f$ (i + j.m) \f$-th element of
39  * the container for column major orientation. In a dense matrix all elements are represented in memory in a
40  * contiguous chunk of memory by definition.
41  *
42  * Orientation can also be specified, otherwise a \c row_major is used.
43  *
44  * \tparam T the type of object stored in the matrix (like double, float, complex, etc...)
45  * \tparam L the storage organization. It can be either \c row_major or \c column_major. Default is \c row_major
46  */
47 template<class T, class L=row_major, class Tag = cpu_tag>
48 class matrix;
49 
50 
51 template<class T, class L, class Tag>
52 struct matrix_temporary_type<T,L,dense_tag, Tag>{
53  typedef matrix<T,L, Tag> type;
54 };
55 
56 template<class T, class Tag>
57 struct matrix_temporary_type<T,unknown_orientation,dense_tag, Tag>{
58  typedef matrix<T,row_major, Tag> type;
59 };
60 
61 }
62 
63 #include "cpu/matrix.hpp"
64 #ifdef REMORA_USE_GPU
65 #include "gpu/matrix.hpp"
66 #endif
67 
68 #endif