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 
60 #include <blaze/util/DisableIf.h>
61 #include <blaze/util/EnableIf.h>
63 #include <blaze/util/mpl/Or.h>
64 #include <blaze/util/Types.h>
65 
66 
67 namespace blaze {
68 
69 //=================================================================================================
70 //
71 // GLOBAL OPERATORS
72 //
73 //=================================================================================================
74 
75 //*************************************************************************************************
103 template< typename MT // Type of the matrix
104  , bool SO > // Storage order
105 inline typename DisableIf< Or< IsComputation<MT>, IsTransExpr<MT> >
106  , typename ColumnExprTrait<MT>::Type >::Type
107  column( Matrix<MT,SO>& matrix, size_t index )
108 {
110 
111  typedef typename ColumnExprTrait<MT>::Type ReturnType;
112  return ReturnType( ~matrix, index );
113 }
114 //*************************************************************************************************
115 
116 
117 //*************************************************************************************************
145 template< typename MT // Type of the matrix
146  , bool SO > // Storage order
147 inline typename DisableIf< Or< IsComputation<MT>, IsTransExpr<MT> >
148  , typename ColumnExprTrait<const MT>::Type >::Type
149  column( const Matrix<MT,SO>& matrix, size_t index )
150 {
152 
154  return ReturnType( ~matrix, index );
155 }
156 //*************************************************************************************************
157 
158 
159 
160 
161 //=================================================================================================
162 //
163 // GLOBAL RESTRUCTURING OPERATORS
164 //
165 //=================================================================================================
166 
167 //*************************************************************************************************
179 template< typename MT // Type of the matrix
180  , bool SO > // Storage order
181 inline typename EnableIf< IsMatMatAddExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
182  column( const Matrix<MT,SO>& matrix, size_t index )
183 {
185 
186  return column( (~matrix).leftOperand(), index ) + column( (~matrix).rightOperand(), index );
187 }
189 //*************************************************************************************************
190 
191 
192 //*************************************************************************************************
204 template< typename MT // Type of the matrix
205  , bool SO > // Storage order
206 inline typename EnableIf< IsMatMatSubExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
207  column( const Matrix<MT,SO>& matrix, size_t index )
208 {
210 
211  return column( (~matrix).leftOperand(), index ) - column( (~matrix).rightOperand(), index );
212 }
214 //*************************************************************************************************
215 
216 
217 //*************************************************************************************************
229 template< typename MT // Type of the matrix
230  , bool SO > // Storage order
231 inline typename EnableIf< IsMatMatMultExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
232  column( const Matrix<MT,SO>& matrix, size_t index )
233 {
235 
236  return (~matrix).leftOperand() * column( (~matrix).rightOperand(), index );
237 }
239 //*************************************************************************************************
240 
241 
242 //*************************************************************************************************
254 template< typename MT // Type of the matrix
255  , bool SO > // Storage order
256 inline typename EnableIf< IsVecTVecMultExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
257  column( const Matrix<MT,SO>& matrix, size_t index )
258 {
260 
261  return (~matrix).leftOperand() * (~matrix).rightOperand()[index];
262 }
264 //*************************************************************************************************
265 
266 
267 //*************************************************************************************************
279 template< typename MT // Type of the matrix
280  , bool SO > // Storage order
281 inline typename EnableIf< IsMatScalarMultExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
282  column( const Matrix<MT,SO>& matrix, size_t index )
283 {
285 
286  return column( (~matrix).leftOperand(), index ) * (~matrix).rightOperand();
287 }
289 //*************************************************************************************************
290 
291 
292 //*************************************************************************************************
304 template< typename MT // Type of the matrix
305  , bool SO > // Storage order
306 inline typename EnableIf< IsMatScalarDivExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
307  column( const Matrix<MT,SO>& matrix, size_t index )
308 {
310 
311  return column( (~matrix).leftOperand(), index ) / (~matrix).rightOperand();
312 }
314 //*************************************************************************************************
315 
316 
317 //*************************************************************************************************
329 template< typename MT // Type of the matrix
330  , bool SO > // Storage order
331 inline typename EnableIf< IsMatAbsExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
332  column( const Matrix<MT,SO>& matrix, size_t index )
333 {
335 
336  return abs( column( (~matrix).operand(), index ) );
337 }
339 //*************************************************************************************************
340 
341 
342 //*************************************************************************************************
354 template< typename MT // Type of the matrix
355  , bool SO > // Storage order
356 inline typename EnableIf< IsMatConjExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
357  column( const Matrix<MT,SO>& matrix, size_t index )
358 {
360 
361  return conj( column( (~matrix).operand(), index ) );
362 }
364 //*************************************************************************************************
365 
366 
367 //*************************************************************************************************
379 template< typename MT // Type of the matrix
380  , bool SO > // Storage order
381 inline typename EnableIf< IsMatRealExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
382  column( const Matrix<MT,SO>& matrix, size_t index )
383 {
385 
386  return real( column( (~matrix).operand(), index ) );
387 }
389 //*************************************************************************************************
390 
391 
392 //*************************************************************************************************
404 template< typename MT // Type of the matrix
405  , bool SO > // Storage order
406 inline typename EnableIf< IsMatImagExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
407  column( const Matrix<MT,SO>& matrix, size_t index )
408 {
410 
411  return imag( column( (~matrix).operand(), index ) );
412 }
414 //*************************************************************************************************
415 
416 
417 //*************************************************************************************************
429 template< typename MT // Type of the matrix
430  , bool SO > // Storage order
431 inline typename EnableIf< IsMatEvalExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
432  column( const Matrix<MT,SO>& matrix, size_t index )
433 {
435 
436  return eval( column( (~matrix).operand(), index ) );
437 }
439 //*************************************************************************************************
440 
441 
442 //*************************************************************************************************
454 template< typename MT // Type of the matrix
455  , bool SO > // Storage order
456 inline typename EnableIf< IsMatSerialExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
457  column( const Matrix<MT,SO>& matrix, size_t index )
458 {
460 
461  return serial( column( (~matrix).operand(), index ) );
462 }
464 //*************************************************************************************************
465 
466 
467 //*************************************************************************************************
479 template< typename MT // Type of the matrix
480  , bool SO > // Storage order
481 inline typename EnableIf< IsMatTransExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
482  column( const Matrix<MT,SO>& matrix, size_t index )
483 {
485 
486  return trans( row( (~matrix).operand(), index ) );
487 }
489 //*************************************************************************************************
490 
491 } // namespace blaze
492 
493 #endif
Header file for basic type definitions.
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:107
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:938
Header file for the IsTransExpr type trait class.
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:721
Header file for the IsMatMatAddExpr type trait class.
const ImagExprTrait< MT >::Type imag(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the imaginary part of each single element of dm.
Definition: DMatImagExpr.h:920
Header file for the IsMatTransExpr type trait class.
ConjExprTrait< typename DiagonalProxy< MT >::RepresentedType >::Type conj(const DiagonalProxy< MT > &proxy)
Computing the complex conjugate of the represented element.
Definition: DiagonalProxy.h:487
Header file for the IsMatAbsExpr type trait class.
Header file for the DisableIf class template.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
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 IsMatSerialExpr type trait class.
Header file for the IsMatScalarMultExpr type trait class.
const RealExprTrait< MT >::Type real(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the real part of each single element of dm.
Definition: DMatRealExpr.h:920
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:107
Header file for the Matrix base class.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2587
Header file for the IsMatScalarDivExpr type trait class.
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:94
const DMatEvalExpr< MT, SO > eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition: DMatEvalExpr.h:703
Header file for the IsMatMatSubExpr type trait class.
Header file for the IsMatRealExpr 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:944
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 the IsMatConjExpr type trait class.
Header file for the IsMatImagExpr type trait class.
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.