Blaze 3.9
MatScalarDivExpr.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_EXPRESSIONS_MATSCALARDIVEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_MATSCALARDIVEXPR_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <blaze/math/Aliases.h>
48#include <blaze/util/Assert.h>
49#include <blaze/util/EnableIf.h>
51
52
53namespace blaze {
54
55//=================================================================================================
56//
57// CLASS DEFINITION
58//
59//=================================================================================================
60
61//*************************************************************************************************
72template< typename MT > // Matrix base type of the expression
74 : public DivExpr<MT>
75{};
76//*************************************************************************************************
77
78
79
80
81//=================================================================================================
82//
83// GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
84//
85//=================================================================================================
86
87//*************************************************************************************************
100template< typename MT // Matrix base type of the expression
101 , typename ST // Type of the right-hand side scalar
103 ( IsInvertible_v<ST> ||
104 IsInvertible_v< RightOperand_t< MatrixType_t<MT> > > ) >* = nullptr >
105inline decltype(auto) operator*( const MatScalarDivExpr<MT>& mat, ST scalar )
106{
108
109 return (*mat).leftOperand() * ( scalar / (*mat).rightOperand() );
110}
112//*************************************************************************************************
113
114
115//*************************************************************************************************
128template< typename ST // Type of the left-hand side scalar
129 , typename MT // Matrix base type of the expression
130 , EnableIf_t< IsScalar_v<ST> &&
131 ( IsInvertible_v<ST> ||
132 IsInvertible_v< RightOperand_t< MatrixType_t<MT> > > ) >* = nullptr >
133inline decltype(auto) operator*( ST scalar, const MatScalarDivExpr<MT>& mat )
134{
136
137 return (*mat).leftOperand() * ( scalar / (*mat).rightOperand() );
138}
140//*************************************************************************************************
141
142
143//*************************************************************************************************
156template< typename MT // Matrix base type of the expression
157 , typename ST // Type of the right-hand side scalar
158 , EnableIf_t< IsScalar_v<ST> >* = nullptr >
159inline decltype(auto) operator/( const MatScalarDivExpr<MT>& mat, ST scalar )
160{
162
163 BLAZE_USER_ASSERT( scalar != ST(0), "Division by zero detected" );
164
165 return (*mat).leftOperand() / ( (*mat).rightOperand() * scalar );
166}
168//*************************************************************************************************
169
170
171
172
173//=================================================================================================
174//
175// GLOBAL RESTRUCTURING FUNCTIONS
176//
177//=================================================================================================
178
179//*************************************************************************************************
191template< typename MT > // Matrix base type of the expression
192inline decltype(auto) trans( const MatScalarDivExpr<MT>& matrix )
193{
195
196 return trans( (*matrix).leftOperand() ) / (*matrix).rightOperand();
197}
199//*************************************************************************************************
200
201
202//*************************************************************************************************
214template< typename MT > // Matrix base type of the expression
215inline decltype(auto) conj( const MatScalarDivExpr<MT>& matrix )
216{
218
219 return conj( (*matrix).leftOperand() ) / (*matrix).rightOperand();
220}
222//*************************************************************************************************
223
224} // namespace blaze
225
226#endif
Header file for auxiliary alias declarations.
Header file for run time assertion macros.
Header file for the EnableIf class template.
Header file for the function trace functionality.
Header file for the IsInvertible type trait.
Header file for the IsScalar type trait.
Header file for the DivExpr base class.
decltype(auto) conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatMapExpr.h:1464
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:766
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.
Definition: Assert.h:117
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
#define BLAZE_FUNCTION_TRACE
Function trace macro.
Definition: FunctionTrace.h:94
Header file for the exception macros of the math module.
Base class for all division expression templates.
Definition: DivExpr.h:69
Base class for all matrix/scalar division expression templates.
Definition: MatScalarDivExpr.h:75