Row.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_VIEWS_ROW_H_
36 #define _BLAZE_MATH_VIEWS_ROW_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 FUNCTION
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 RowExprTrait<MT>::Type >::Type
107  row( Matrix<MT,SO>& matrix, size_t index )
108 {
110 
111  typedef typename RowExprTrait<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 RowExprTrait<const MT>::Type >::Type
149  row( const Matrix<MT,SO>& matrix, size_t index )
150 {
152 
153  typedef typename RowExprTrait<const MT>::Type ReturnType;
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 RowExprTrait<MT>::Type >::Type
182  row( const Matrix<MT,SO>& matrix, size_t index )
183 {
185 
186  return row( (~matrix).leftOperand(), index ) + row( (~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 RowExprTrait<MT>::Type >::Type
207  row( const Matrix<MT,SO>& matrix, size_t index )
208 {
210 
211  return row( (~matrix).leftOperand(), index ) - row( (~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 RowExprTrait<MT>::Type >::Type
232  row( const Matrix<MT,SO>& matrix, size_t index )
233 {
235 
236  return row( (~matrix).leftOperand(), index ) * (~matrix).rightOperand();
237 }
239 //*************************************************************************************************
240 
241 
242 //*************************************************************************************************
253 template< typename MT // Type of the matrix
254  , bool SO > // Storage order
255 inline typename EnableIf< IsVecTVecMultExpr<MT>, typename RowExprTrait<MT>::Type >::Type
256  row( const Matrix<MT,SO>& matrix, size_t index )
257 {
259 
260  return (~matrix).leftOperand()[index] * (~matrix).rightOperand();
261 }
263 //*************************************************************************************************
264 
265 
266 //*************************************************************************************************
278 template< typename MT // Type of the matrix
279  , bool SO > // Storage order
280 inline typename EnableIf< IsMatScalarMultExpr<MT>, typename RowExprTrait<MT>::Type >::Type
281  row( const Matrix<MT,SO>& matrix, size_t index )
282 {
284 
285  return row( (~matrix).leftOperand(), index ) * (~matrix).rightOperand();
286 }
288 //*************************************************************************************************
289 
290 
291 //*************************************************************************************************
303 template< typename MT // Type of the matrix
304  , bool SO > // Storage order
305 inline typename EnableIf< IsMatScalarDivExpr<MT>, typename RowExprTrait<MT>::Type >::Type
306  row( const Matrix<MT,SO>& matrix, size_t index )
307 {
309 
310  return row( (~matrix).leftOperand(), index ) / (~matrix).rightOperand();
311 }
313 //*************************************************************************************************
314 
315 
316 //*************************************************************************************************
328 template< typename MT // Type of the matrix
329  , bool SO > // Storage order
330 inline typename EnableIf< IsMatAbsExpr<MT>, typename RowExprTrait<MT>::Type >::Type
331  row( const Matrix<MT,SO>& matrix, size_t index )
332 {
334 
335  return abs( row( (~matrix).operand(), index ) );
336 }
338 //*************************************************************************************************
339 
340 
341 //*************************************************************************************************
353 template< typename MT // Type of the matrix
354  , bool SO > // Storage order
355 inline typename EnableIf< IsMatConjExpr<MT>, typename RowExprTrait<MT>::Type >::Type
356  row( const Matrix<MT,SO>& matrix, size_t index )
357 {
359 
360  return conj( row( (~matrix).operand(), index ) );
361 }
363 //*************************************************************************************************
364 
365 
366 //*************************************************************************************************
378 template< typename MT // Type of the matrix
379  , bool SO > // Storage order
380 inline typename EnableIf< IsMatRealExpr<MT>, typename RowExprTrait<MT>::Type >::Type
381  row( const Matrix<MT,SO>& matrix, size_t index )
382 {
384 
385  return real( row( (~matrix).operand(), index ) );
386 }
388 //*************************************************************************************************
389 
390 
391 //*************************************************************************************************
403 template< typename MT // Type of the matrix
404  , bool SO > // Storage order
405 inline typename EnableIf< IsMatImagExpr<MT>, typename RowExprTrait<MT>::Type >::Type
406  row( const Matrix<MT,SO>& matrix, size_t index )
407 {
409 
410  return imag( row( (~matrix).operand(), index ) );
411 }
413 //*************************************************************************************************
414 
415 
416 //*************************************************************************************************
428 template< typename MT // Type of the matrix
429  , bool SO > // Storage order
430 inline typename EnableIf< IsMatEvalExpr<MT>, typename RowExprTrait<MT>::Type >::Type
431  row( const Matrix<MT,SO>& matrix, size_t index )
432 {
434 
435  return eval( row( (~matrix).operand(), index ) );
436 }
438 //*************************************************************************************************
439 
440 
441 //*************************************************************************************************
453 template< typename MT // Type of the matrix
454  , bool SO > // Storage order
455 inline typename EnableIf< IsMatSerialExpr<MT>, typename RowExprTrait<MT>::Type >::Type
456  row( const Matrix<MT,SO>& matrix, size_t index )
457 {
459 
460  return serial( row( (~matrix).operand(), index ) );
461 }
463 //*************************************************************************************************
464 
465 
466 //*************************************************************************************************
478 template< typename MT // Type of the matrix
479  , bool SO > // Storage order
480 inline typename EnableIf< IsMatTransExpr<MT>, typename RowExprTrait<MT>::Type >::Type
481  row( const Matrix<MT,SO>& matrix, size_t index )
482 {
484 
485  return trans( column( (~matrix).operand(), index ) );
486 }
488 //*************************************************************************************************
489 
490 } // namespace blaze
491 
492 #endif
Header file for basic type definitions.
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.
Evaluation of the expression type type of a row operation.Via this type trait it is possible to evalu...
Definition: RowExprTrait.h:78
Header file for the RowExprTrait class template.
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.
Header file for the FunctionTrace class.