All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
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 FUNCTION
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 RowExprTrait<MT>::Type >::Type
103  row( Matrix<MT,SO>& matrix, size_t index )
104 {
106 
107  typedef typename RowExprTrait<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 RowExprTrait<const MT>::Type >::Type
145  row( const Matrix<MT,SO>& matrix, size_t index )
146 {
148 
149  typedef typename RowExprTrait<const MT>::Type ReturnType;
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 RowExprTrait<MT>::Type >::Type
178  row( const Matrix<MT,SO>& matrix, size_t index )
179 {
181 
182  return row( (~matrix).leftOperand(), index ) + row( (~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 RowExprTrait<MT>::Type >::Type
203  row( const Matrix<MT,SO>& matrix, size_t index )
204 {
206 
207  return row( (~matrix).leftOperand(), index ) - row( (~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 RowExprTrait<MT>::Type >::Type
228  row( const Matrix<MT,SO>& matrix, size_t index )
229 {
231 
232  return row( (~matrix).leftOperand(), index ) * (~matrix).rightOperand();
233 }
235 //*************************************************************************************************
236 
237 
238 //*************************************************************************************************
249 template< typename MT // Type of the matrix
250  , bool SO > // Storage order
251 inline typename EnableIf< IsVecTVecMultExpr<MT>, typename RowExprTrait<MT>::Type >::Type
252  row( const Matrix<MT,SO>& matrix, size_t index )
253 {
255 
256  return (~matrix).leftOperand()[index] * (~matrix).rightOperand();
257 }
259 //*************************************************************************************************
260 
261 
262 //*************************************************************************************************
274 template< typename MT // Type of the matrix
275  , bool SO > // Storage order
276 inline typename EnableIf< IsMatScalarMultExpr<MT>, typename RowExprTrait<MT>::Type >::Type
277  row( const Matrix<MT,SO>& matrix, size_t index )
278 {
280 
281  return row( (~matrix).leftOperand(), index ) * (~matrix).rightOperand();
282 }
284 //*************************************************************************************************
285 
286 
287 //*************************************************************************************************
299 template< typename MT // Type of the matrix
300  , bool SO > // Storage order
301 inline typename EnableIf< IsMatScalarDivExpr<MT>, typename RowExprTrait<MT>::Type >::Type
302  row( const Matrix<MT,SO>& matrix, size_t index )
303 {
305 
306  return row( (~matrix).leftOperand(), index ) / (~matrix).rightOperand();
307 }
309 //*************************************************************************************************
310 
311 
312 //*************************************************************************************************
324 template< typename MT // Type of the matrix
325  , bool SO > // Storage order
326 inline typename EnableIf< IsMatAbsExpr<MT>, typename RowExprTrait<MT>::Type >::Type
327  row( const Matrix<MT,SO>& matrix, size_t index )
328 {
330 
331  return abs( row( (~matrix).operand(), index ) );
332 }
334 //*************************************************************************************************
335 
336 
337 //*************************************************************************************************
349 template< typename MT // Type of the matrix
350  , bool SO > // Storage order
351 inline typename EnableIf< IsMatEvalExpr<MT>, typename RowExprTrait<MT>::Type >::Type
352  row( const Matrix<MT,SO>& matrix, size_t index )
353 {
355 
356  return eval( row( (~matrix).operand(), index ) );
357 }
359 //*************************************************************************************************
360 
361 
362 //*************************************************************************************************
374 template< typename MT // Type of the matrix
375  , bool SO > // Storage order
376 inline typename EnableIf< IsMatTransExpr<MT>, typename RowExprTrait<MT>::Type >::Type
377  row( const Matrix<MT,SO>& matrix, size_t index )
378 {
380 
381  return trans( column( (~matrix).operand(), index ) );
382 }
384 //*************************************************************************************************
385 
386 } // namespace blaze
387 
388 #endif
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:903
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.
Evaluation of the expression type type of a row operation.Via this type trait it is possible to evalu...
Definition: RowExprTrait.h:77
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:103
Header file for the Matrix base class.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2407
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:672
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:907
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.
Header file for the FunctionTrace class.