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 
56 #include <blaze/util/DisableIf.h>
57 #include <blaze/util/EnableIf.h>
59 #include <blaze/util/mpl/Or.h>
60 #include <blaze/util/Types.h>
61 
62 
63 namespace blaze {
64 
65 //=================================================================================================
66 //
67 // GLOBAL OPERATORS
68 //
69 //=================================================================================================
70 
71 //*************************************************************************************************
99 template< typename MT // Type of the matrix
100  , bool SO > // Storage order
101 inline typename DisableIf< Or< IsComputation<MT>, IsTransExpr<MT> >
102  , typename ColumnExprTrait<MT>::Type >::Type
103  column( Matrix<MT,SO>& matrix, size_t index )
104 {
106 
107  typedef typename ColumnExprTrait<MT>::Type ReturnType;
108  return ReturnType( ~matrix, index );
109 }
110 //*************************************************************************************************
111 
112 
113 //*************************************************************************************************
141 template< typename MT // Type of the matrix
142  , bool SO > // Storage order
143 inline typename DisableIf< Or< IsComputation<MT>, IsTransExpr<MT> >
144  , typename ColumnExprTrait<const MT>::Type >::Type
145  column( const Matrix<MT,SO>& matrix, size_t index )
146 {
148 
150  return ReturnType( ~matrix, index );
151 }
152 //*************************************************************************************************
153 
154 
155 
156 
157 //=================================================================================================
158 //
159 // GLOBAL RESTRUCTURING OPERATORS
160 //
161 //=================================================================================================
162 
163 //*************************************************************************************************
175 template< typename MT // Type of the matrix
176  , bool SO > // Storage order
177 inline typename EnableIf< IsMatMatAddExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
178  column( const Matrix<MT,SO>& matrix, size_t index )
179 {
181 
182  return column( (~matrix).leftOperand(), index ) + column( (~matrix).rightOperand(), index );
183 }
185 //*************************************************************************************************
186 
187 
188 //*************************************************************************************************
200 template< typename MT // Type of the matrix
201  , bool SO > // Storage order
202 inline typename EnableIf< IsMatMatSubExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
203  column( const Matrix<MT,SO>& matrix, size_t index )
204 {
206 
207  return column( (~matrix).leftOperand(), index ) - column( (~matrix).rightOperand(), index );
208 }
210 //*************************************************************************************************
211 
212 
213 //*************************************************************************************************
225 template< typename MT // Type of the matrix
226  , bool SO > // Storage order
227 inline typename EnableIf< IsMatMatMultExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
228  column( const Matrix<MT,SO>& matrix, size_t index )
229 {
231 
232  return (~matrix).leftOperand() * column( (~matrix).rightOperand(), index );
233 }
235 //*************************************************************************************************
236 
237 
238 //*************************************************************************************************
250 template< typename MT // Type of the matrix
251  , bool SO > // Storage order
252 inline typename EnableIf< IsVecTVecMultExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
253  column( const Matrix<MT,SO>& matrix, size_t index )
254 {
256 
257  return (~matrix).leftOperand() * (~matrix).rightOperand()[index];
258 }
260 //*************************************************************************************************
261 
262 
263 //*************************************************************************************************
275 template< typename MT // Type of the matrix
276  , bool SO > // Storage order
277 inline typename EnableIf< IsMatScalarMultExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
278  column( const Matrix<MT,SO>& matrix, size_t index )
279 {
281 
282  return column( (~matrix).leftOperand(), index ) * (~matrix).rightOperand();
283 }
285 //*************************************************************************************************
286 
287 
288 //*************************************************************************************************
300 template< typename MT // Type of the matrix
301  , bool SO > // Storage order
302 inline typename EnableIf< IsMatScalarDivExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
303  column( const Matrix<MT,SO>& matrix, size_t index )
304 {
306 
307  return column( (~matrix).leftOperand(), index ) / (~matrix).rightOperand();
308 }
310 //*************************************************************************************************
311 
312 
313 //*************************************************************************************************
325 template< typename MT // Type of the matrix
326  , bool SO > // Storage order
327 inline typename EnableIf< IsMatAbsExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
328  column( const Matrix<MT,SO>& matrix, size_t index )
329 {
331 
332  return abs( column( (~matrix).operand(), index ) );
333 }
335 //*************************************************************************************************
336 
337 
338 //*************************************************************************************************
350 template< typename MT // Type of the matrix
351  , bool SO > // Storage order
352 inline typename EnableIf< IsMatEvalExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
353  column( const Matrix<MT,SO>& matrix, size_t index )
354 {
356 
357  return eval( column( (~matrix).operand(), index ) );
358 }
360 //*************************************************************************************************
361 
362 
363 //*************************************************************************************************
375 template< typename MT // Type of the matrix
376  , bool SO > // Storage order
377 inline typename EnableIf< IsMatTransExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
378  column( const Matrix<MT,SO>& matrix, size_t index )
379 {
381 
382  return trans( row( (~matrix).operand(), index ) );
383 }
385 //*************************************************************************************************
386 
387 } // namespace blaze
388 
389 #endif
Header file for the ColumnExprTrait class template.
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, typename ColumnExprTrait< MT >::Type >::Type column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:103
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:909
Header file for the IsTransExpr type trait class.
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 DisableIf class template.
Header file for the IsVecTVecMultExpr type trait class.
Header file for the Or class template.
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.
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, typename RowExprTrait< MT >::Type >::Type row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:103
Header file for the Matrix base class.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2477
Header file for the IsMatScalarDivExpr type trait class.
const DMatEvalExpr< MT, SO > eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition: DMatEvalExpr.h:677
Header file for the IsMatMatSubExpr type trait class.
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:932
Header file for the IsComputation 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.
Evaluation of the expression type type of a column operation.Via this type trait it is possible to ev...
Definition: ColumnExprTrait.h:79
Header file for the FunctionTrace class.