All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Column.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_VIEWS_COLUMN_H_
36 #define _BLAZE_MATH_VIEWS_COLUMN_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
54 #include <blaze/util/EnableIf.h>
56 #include <blaze/util/Types.h>
57 
58 
59 namespace blaze {
60 
61 //=================================================================================================
62 //
63 // GLOBAL RESTRUCTURING OPERATORS
64 //
65 //=================================================================================================
66 
67 //*************************************************************************************************
79 template< typename MT // Type of the matrix
80  , bool SO > // Storage order
81 inline typename EnableIf< IsMatMatAddExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
82  column( const Matrix<MT,SO>& matrix, size_t index )
83 {
85 
86  return column( (~matrix).leftOperand(), index ) + column( (~matrix).rightOperand(), index );
87 }
89 //*************************************************************************************************
90 
91 
92 //*************************************************************************************************
104 template< typename MT // Type of the matrix
105  , bool SO > // Storage order
106 inline typename EnableIf< IsMatMatSubExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
107  column( const Matrix<MT,SO>& matrix, size_t index )
108 {
110 
111  return column( (~matrix).leftOperand(), index ) - column( (~matrix).rightOperand(), index );
112 }
114 //*************************************************************************************************
115 
116 
117 //*************************************************************************************************
129 template< typename MT // Type of the matrix
130  , bool SO > // Storage order
131 inline typename EnableIf< IsMatMatMultExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
132  column( const Matrix<MT,SO>& matrix, size_t index )
133 {
135 
136  return (~matrix).leftOperand() * column( (~matrix).rightOperand(), index );
137 }
139 //*************************************************************************************************
140 
141 
142 //*************************************************************************************************
154 template< typename MT // Type of the matrix
155  , bool SO > // Storage order
156 inline typename EnableIf< IsVecTVecMultExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
157  column( const Matrix<MT,SO>& matrix, size_t index )
158 {
160 
161  return (~matrix).leftOperand() * (~matrix).rightOperand()[index];
162 }
164 //*************************************************************************************************
165 
166 
167 //*************************************************************************************************
179 template< typename MT // Type of the matrix
180  , bool SO > // Storage order
181 inline typename EnableIf< IsMatScalarMultExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
182  column( const Matrix<MT,SO>& matrix, size_t index )
183 {
185 
186  return column( (~matrix).leftOperand(), index ) * (~matrix).rightOperand();
187 }
189 //*************************************************************************************************
190 
191 
192 //*************************************************************************************************
204 template< typename MT // Type of the matrix
205  , bool SO > // Storage order
206 inline typename EnableIf< IsMatScalarDivExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
207  column( const Matrix<MT,SO>& matrix, size_t index )
208 {
210 
211  return column( (~matrix).leftOperand(), index ) / (~matrix).rightOperand();
212 }
214 //*************************************************************************************************
215 
216 
217 //*************************************************************************************************
229 template< typename MT // Type of the matrix
230  , bool SO > // Storage order
231 inline typename EnableIf< IsMatAbsExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
232  column( const Matrix<MT,SO>& matrix, size_t index )
233 {
235 
236  return abs( column( (~matrix).operand(), index ) );
237 }
239 //*************************************************************************************************
240 
241 
242 //*************************************************************************************************
254 template< typename MT // Type of the matrix
255  , bool SO > // Storage order
256 inline typename EnableIf< IsMatEvalExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
257  column( const Matrix<MT,SO>& matrix, size_t index )
258 {
260 
261  return eval( column( (~matrix).operand(), index ) );
262 }
264 //*************************************************************************************************
265 
266 
267 //*************************************************************************************************
279 template< typename MT // Type of the matrix
280  , bool SO > // Storage order
281 inline typename EnableIf< IsMatTransExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
282  column( const Matrix<MT,SO>& matrix, size_t index )
283 {
285 
286  return trans( row( (~matrix).operand(), index ) );
287 }
289 //*************************************************************************************************
290 
291 } // namespace blaze
292 
293 #endif
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, DenseColumn< MT > >::Type column(DenseMatrix< MT, SO > &dm, size_t index)
Creating a view on a specific column of the given dense matrix.
Definition: DenseColumn.h:3026
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:446
Header file for the ColumnExprTrait class template.
const DMatAbsExpr< MT, SO > abs(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the absolute values of each single element of dm.
Definition: DMatAbsExpr.h:739
Header file for the IsMatMatAddExpr type trait class.
Header file for the IsMatTransExpr type trait class.
Header file for the IsMatAbsExpr type trait class.
Header file for the IsVecTVecMultExpr type trait class.
Header file for the IsMatMatMultExpr type trait class.
Header file for the IsMatScalarMultExpr type trait class.
Header file for the IsMatEvalExpr type trait class.
Header file for the EnableIf class template.
Header file for the Matrix base class.
Header file for the IsMatScalarDivExpr type trait class.
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, DenseRow< MT > >::Type row(DenseMatrix< MT, SO > &dm, size_t index)
Creating a view on a specific row of the given dense matrix.
Definition: DenseRow.h:3025
const DMatEvalExpr< MT, SO > eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition: DMatEvalExpr.h:395
Header file for the IsMatMatSubExpr type trait class.
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
Header file for basic type definitions.
Header file for the FunctionTrace class.