1 | // Copyright (C) 2008-2012 Conrad Sanderson |
---|
2 | // Copyright (C) 2008-2012 NICTA (www.nicta.com.au) |
---|
3 | // |
---|
4 | // This Source Code Form is subject to the terms of the Mozilla Public |
---|
5 | // License, v. 2.0. If a copy of the MPL was not distributed with this |
---|
6 | // file, You can obtain one at http://mozilla.org/MPL/2.0/. |
---|
7 | |
---|
8 | |
---|
9 | //! \addtogroup Glue |
---|
10 | //! @{ |
---|
11 | |
---|
12 | |
---|
13 | |
---|
14 | //! Class for storing data required for delayed binary operations, |
---|
15 | //! such as the operands (e.g. two matrices) and the binary operator (e.g. addition). |
---|
16 | //! The operands are stored as references (which can be optimised away), |
---|
17 | //! while the operator is "stored" through the template definition (glue_type). |
---|
18 | //! The operands can be 'Mat', 'Row', 'Col', 'Op', and 'Glue'. |
---|
19 | //! Note that as 'Glue' can be one of the operands, more than two matrices can be stored. |
---|
20 | //! |
---|
21 | //! For example, we could have: Glue<Mat, Mat, glue_times> |
---|
22 | //! |
---|
23 | //! Another example is: Glue< Op<Mat, op_htrans>, Op<Mat, op_inv>, glue_times > |
---|
24 | |
---|
25 | |
---|
26 | |
---|
27 | template<typename T1, typename T2, typename glue_type> |
---|
28 | class Glue : public Base<typename T1::elem_type, Glue<T1, T2, glue_type> > |
---|
29 | { |
---|
30 | public: |
---|
31 | |
---|
32 | typedef typename T1::elem_type elem_type; |
---|
33 | typedef typename get_pod_type<elem_type>::result pod_type; |
---|
34 | |
---|
35 | static const bool is_row = (is_same_type<glue_type, glue_times>::value) ? T1::is_row : false; |
---|
36 | static const bool is_col = (is_same_type<glue_type, glue_times>::value) ? T2::is_col : false; |
---|
37 | |
---|
38 | arma_inline Glue(const T1& in_A, const T2& in_B); |
---|
39 | arma_inline Glue(const T1& in_A, const T2& in_B, const uword in_aux_uword); |
---|
40 | arma_inline ~Glue(); |
---|
41 | |
---|
42 | const T1& A; //!< first operand |
---|
43 | const T2& B; //!< second operand |
---|
44 | uword aux_uword; //!< storage of auxiliary data, uword format |
---|
45 | }; |
---|
46 | |
---|
47 | |
---|
48 | |
---|
49 | //! @} |
---|