Blaze
3.9
Toggle main menu visibility
Loading...
Searching...
No Matches
blaze
math
shims
InvSqrt.h
Go to the documentation of this file.
1
//=================================================================================================
33
//=================================================================================================
34
35
#ifndef _BLAZE_MATH_SHIMS_INVSQRT_H_
36
#define _BLAZE_MATH_SHIMS_INVSQRT_H_
37
38
39
//*************************************************************************************************
40
// Includes
41
//*************************************************************************************************
42
43
#include <
blaze/math/shims/Invert.h
>
44
#include <
blaze/math/shims/Sqrt.h
>
45
#include <
blaze/util/Assert.h
>
46
#include <
blaze/util/Complex.h
>
47
#include <
blaze/util/EnableIf.h
>
48
#include <
blaze/util/typetraits/IsBuiltin.h
>
49
50
51
namespace
blaze {
52
53
//=================================================================================================
54
//
55
// INVSQRT SHIM
56
//
57
//=================================================================================================
58
59
//*************************************************************************************************
69
template
<
typename
T,
typename
= EnableIf_t< IsBuiltin_v<T> > >
70
inline
auto
invsqrt
( T a )
noexcept
->
decltype
(
inv
(
sqrt
( a ) ) )
71
{
72
BLAZE_USER_ASSERT
( a > T(0),
"Invalid built-in value detected"
);
73
74
return
inv
(
sqrt
( a ) );
75
}
76
//*************************************************************************************************
77
78
79
//*************************************************************************************************
89
template
<
typename
T,
typename
= EnableIf_t< IsBuiltin_v<T> > >
90
inline
auto
invsqrt
(
const
complex<T>& a )
noexcept
->
decltype
(
inv
(
sqrt
( a ) ) )
91
{
92
BLAZE_USER_ASSERT
(
abs
( a ) != T(0),
"Invalid complex value detected"
);
93
94
return
inv
(
sqrt
( a ) );
95
}
96
//*************************************************************************************************
97
98
}
// namespace blaze
99
100
#endif
Assert.h
Header file for run time assertion macros.
Complex.h
Header file for the complex data type.
EnableIf.h
Header file for the EnableIf class template.
Invert.h
Header file for the invert shim.
IsBuiltin.h
Header file for the IsBuiltin type trait.
blaze::invsqrt
decltype(auto) invsqrt(const DenseMatrix< MT, SO > &dm)
Computes the inverse square root of each single element of the dense matrix dm.
Definition
DMatMapExpr.h:1647
blaze::abs
decltype(auto) abs(const DenseMatrix< MT, SO > &dm)
Applies the abs() function to each single element of the dense matrix dm.
Definition
DMatMapExpr.h:1296
blaze::inv
decltype(auto) inv(const DenseMatrix< MT, SO > &dm)
Calculation of the inverse of the given dense matrix.
Definition
DMatInvExpr.h:405
blaze::sqrt
decltype(auto) sqrt(const DenseMatrix< MT, SO > &dm)
Computes the square root of each single element of the dense matrix dm.
Definition
DMatMapExpr.h:1616
BLAZE_USER_ASSERT
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.
Definition
Assert.h:117
Sqrt.h
Header file for the sqrt shim.
Generated by
1.18.0