Chris@49
|
1 // Copyright (C) 2008-2012 NICTA (www.nicta.com.au)
|
Chris@49
|
2 // Copyright (C) 2008-2012 Conrad Sanderson
|
Chris@49
|
3 //
|
Chris@49
|
4 // This Source Code Form is subject to the terms of the Mozilla Public
|
Chris@49
|
5 // License, v. 2.0. If a copy of the MPL was not distributed with this
|
Chris@49
|
6 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
Chris@49
|
7
|
Chris@49
|
8
|
Chris@49
|
9 //! \addtogroup Base
|
Chris@49
|
10 //! @{
|
Chris@49
|
11
|
Chris@49
|
12
|
Chris@49
|
13
|
Chris@49
|
14 template<typename elem_type, typename derived>
|
Chris@49
|
15 arma_inline
|
Chris@49
|
16 const derived&
|
Chris@49
|
17 Base<elem_type,derived>::get_ref() const
|
Chris@49
|
18 {
|
Chris@49
|
19 return static_cast<const derived&>(*this);
|
Chris@49
|
20 }
|
Chris@49
|
21
|
Chris@49
|
22
|
Chris@49
|
23
|
Chris@49
|
24 template<typename elem_type, typename derived>
|
Chris@49
|
25 arma_inline
|
Chris@49
|
26 const Op<derived,op_htrans>
|
Chris@49
|
27 Base<elem_type,derived>::t() const
|
Chris@49
|
28 {
|
Chris@49
|
29 return Op<derived,op_htrans>( (*this).get_ref() );
|
Chris@49
|
30 }
|
Chris@49
|
31
|
Chris@49
|
32
|
Chris@49
|
33
|
Chris@49
|
34 template<typename elem_type, typename derived>
|
Chris@49
|
35 arma_inline
|
Chris@49
|
36 const Op<derived,op_htrans>
|
Chris@49
|
37 Base<elem_type,derived>::ht() const
|
Chris@49
|
38 {
|
Chris@49
|
39 return Op<derived,op_htrans>( (*this).get_ref() );
|
Chris@49
|
40 }
|
Chris@49
|
41
|
Chris@49
|
42
|
Chris@49
|
43
|
Chris@49
|
44 template<typename elem_type, typename derived>
|
Chris@49
|
45 arma_inline
|
Chris@49
|
46 const Op<derived,op_strans>
|
Chris@49
|
47 Base<elem_type,derived>::st() const
|
Chris@49
|
48 {
|
Chris@49
|
49 return Op<derived,op_strans>( (*this).get_ref() );
|
Chris@49
|
50 }
|
Chris@49
|
51
|
Chris@49
|
52
|
Chris@49
|
53
|
Chris@49
|
54
|
Chris@49
|
55 template<typename elem_type, typename derived>
|
Chris@49
|
56 inline
|
Chris@49
|
57 void
|
Chris@49
|
58 Base<elem_type,derived>::print(const std::string extra_text) const
|
Chris@49
|
59 {
|
Chris@49
|
60 const Proxy<derived> P( (*this).get_ref() );
|
Chris@49
|
61
|
Chris@49
|
62 const quasi_unwrap< typename Proxy<derived>::stored_type > tmp(P.Q);
|
Chris@49
|
63
|
Chris@49
|
64 tmp.M.impl_print(extra_text);
|
Chris@49
|
65 }
|
Chris@49
|
66
|
Chris@49
|
67
|
Chris@49
|
68
|
Chris@49
|
69 template<typename elem_type, typename derived>
|
Chris@49
|
70 inline
|
Chris@49
|
71 void
|
Chris@49
|
72 Base<elem_type,derived>::print(std::ostream& user_stream, const std::string extra_text) const
|
Chris@49
|
73 {
|
Chris@49
|
74 const Proxy<derived> P( (*this).get_ref() );
|
Chris@49
|
75
|
Chris@49
|
76 const quasi_unwrap< typename Proxy<derived>::stored_type > tmp(P.Q);
|
Chris@49
|
77
|
Chris@49
|
78 tmp.M.impl_print(user_stream, extra_text);
|
Chris@49
|
79 }
|
Chris@49
|
80
|
Chris@49
|
81
|
Chris@49
|
82
|
Chris@49
|
83 template<typename elem_type, typename derived>
|
Chris@49
|
84 inline
|
Chris@49
|
85 void
|
Chris@49
|
86 Base<elem_type,derived>::raw_print(const std::string extra_text) const
|
Chris@49
|
87 {
|
Chris@49
|
88 const Proxy<derived> P( (*this).get_ref() );
|
Chris@49
|
89
|
Chris@49
|
90 const quasi_unwrap< typename Proxy<derived>::stored_type > tmp(P.Q);
|
Chris@49
|
91
|
Chris@49
|
92 tmp.M.impl_raw_print(extra_text);
|
Chris@49
|
93 }
|
Chris@49
|
94
|
Chris@49
|
95
|
Chris@49
|
96
|
Chris@49
|
97 template<typename elem_type, typename derived>
|
Chris@49
|
98 inline
|
Chris@49
|
99 void
|
Chris@49
|
100 Base<elem_type,derived>::raw_print(std::ostream& user_stream, const std::string extra_text) const
|
Chris@49
|
101 {
|
Chris@49
|
102 const Proxy<derived> P( (*this).get_ref() );
|
Chris@49
|
103
|
Chris@49
|
104 const quasi_unwrap< typename Proxy<derived>::stored_type > tmp(P.Q);
|
Chris@49
|
105
|
Chris@49
|
106 tmp.M.impl_raw_print(user_stream, extra_text);
|
Chris@49
|
107 }
|
Chris@49
|
108
|
Chris@49
|
109
|
Chris@49
|
110
|
Chris@49
|
111 //
|
Chris@49
|
112 // extra functions defined in Base_blas_elem_type
|
Chris@49
|
113
|
Chris@49
|
114 template<typename derived>
|
Chris@49
|
115 arma_inline
|
Chris@49
|
116 const Op<derived,op_inv>
|
Chris@49
|
117 Base_blas_elem_type<derived>::i(const bool slow) const
|
Chris@49
|
118 {
|
Chris@49
|
119 return Op<derived,op_inv>( static_cast<const derived&>(*this), ((slow == false) ? 0 : 1), 0 );
|
Chris@49
|
120 }
|
Chris@49
|
121
|
Chris@49
|
122
|
Chris@49
|
123
|
Chris@49
|
124 //
|
Chris@49
|
125 // extra functions defined in Base_eval_Mat
|
Chris@49
|
126
|
Chris@49
|
127 template<typename elem_type, typename derived>
|
Chris@49
|
128 arma_inline
|
Chris@49
|
129 const derived&
|
Chris@49
|
130 Base_eval_Mat<elem_type, derived>::eval() const
|
Chris@49
|
131 {
|
Chris@49
|
132 arma_extra_debug_sigprint();
|
Chris@49
|
133
|
Chris@49
|
134 return static_cast<const derived&>(*this);
|
Chris@49
|
135 }
|
Chris@49
|
136
|
Chris@49
|
137
|
Chris@49
|
138
|
Chris@49
|
139 //
|
Chris@49
|
140 // extra functions defined in Base_eval_expr
|
Chris@49
|
141
|
Chris@49
|
142 template<typename elem_type, typename derived>
|
Chris@49
|
143 arma_inline
|
Chris@49
|
144 Mat<elem_type>
|
Chris@49
|
145 Base_eval_expr<elem_type, derived>::eval() const
|
Chris@49
|
146 {
|
Chris@49
|
147 arma_extra_debug_sigprint();
|
Chris@49
|
148
|
Chris@49
|
149 return Mat<elem_type>( static_cast<const derived&>(*this) );
|
Chris@49
|
150 }
|
Chris@49
|
151
|
Chris@49
|
152
|
Chris@49
|
153
|
Chris@49
|
154 //! @}
|