Reference documentation for deal.II version 9.5.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
complex_overloads.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (C) 1998 - 2022 by the deal.II authors
4//
5// This file is part of the deal.II library.
6//
7// The deal.II library is free software; you can use it, redistribute
8// it, and/or modify it under the terms of the GNU Lesser General
9// Public License as published by the Free Software Foundation; either
10// version 2.1 of the License, or (at your option) any later version.
11// The full text of the license can be found in the file LICENSE.md at
12// the top level directory of deal.II.
13//
14// ---------------------------------------------------------------------
15
16#ifndef dealii_complex_overloads_h
17#define dealii_complex_overloads_h
18
19#include <deal.II/base/config.h>
20
22
24
25// Forward declarations
26#ifndef DOXYGEN
27template <typename T, typename U>
28struct ProductType;
29#endif
30
31#ifndef DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS
39template <typename T, typename U>
40inline std::enable_if_t<
41 std::is_floating_point<T>::value && std::is_floating_point<U>::value,
42 typename ProductType<std::complex<T>, std::complex<U>>::type>
43operator*(const std::complex<T> &left, const std::complex<U> &right)
44{
45 using result_type =
46 typename ProductType<std::complex<T>, std::complex<U>>::type;
47 return static_cast<result_type>(left) * static_cast<result_type>(right);
48}
49
57template <typename T, typename U>
58inline std::enable_if_t<
59 std::is_floating_point<T>::value && std::is_floating_point<U>::value,
60 typename ProductType<std::complex<T>, std::complex<U>>::type>
61operator/(const std::complex<T> &left, const std::complex<U> &right)
62{
63 using result_type =
64 typename ProductType<std::complex<T>, std::complex<U>>::type;
65 return static_cast<result_type>(left) / static_cast<result_type>(right);
66}
67
75template <typename T, typename U>
76inline std::enable_if_t<std::is_floating_point<T>::value &&
77 std::is_floating_point<U>::value,
79operator*(const std::complex<T> &left, const U &right)
80{
81 using result_type = typename ProductType<std::complex<T>, U>::type;
82 return static_cast<result_type>(left) * static_cast<result_type>(right);
83}
84
92template <typename T, typename U>
93inline std::enable_if_t<std::is_floating_point<T>::value &&
94 std::is_floating_point<U>::value,
96operator/(const std::complex<T> &left, const U &right)
97{
98 using result_type = typename ProductType<std::complex<T>, U>::type;
99 return static_cast<result_type>(left) / static_cast<result_type>(right);
100}
101
109template <typename T, typename U>
110inline std::enable_if_t<std::is_floating_point<T>::value &&
111 std::is_floating_point<U>::value,
113operator*(const T &left, const std::complex<U> &right)
114{
115 using result_type = typename ProductType<T, std::complex<U>>::type;
116 return static_cast<result_type>(left) * static_cast<result_type>(right);
117}
118
126template <typename T, typename U>
127inline std::enable_if_t<std::is_floating_point<T>::value &&
128 std::is_floating_point<U>::value,
130operator/(const T &left, const std::complex<U> &right)
131{
132 using result_type = typename ProductType<T, std::complex<U>>::type;
133 return static_cast<result_type>(left) / static_cast<result_type>(right);
134}
135#endif /* DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS */
136
138
139#endif
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:472
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:473
std::enable_if_t< std::is_floating_point< T >::value &&std::is_floating_point< U >::value, typename ProductType< std::complex< T >, std::complex< U > >::type > operator/(const std::complex< T > &left, const std::complex< U > &right)
std::enable_if_t< std::is_floating_point< T >::value &&std::is_floating_point< U >::value, typename ProductType< std::complex< T >, std::complex< U > >::type > operator*(const std::complex< T > &left, const std::complex< U > &right)
std::enable_if_t< std::is_floating_point< T >::value &&std::is_floating_point< U >::value, typename ProductType< T, std::complex< U > >::type > operator*(const T &left, const std::complex< U > &right)
std::enable_if_t< std::is_floating_point< T >::value &&std::is_floating_point< U >::value, typename ProductType< std::complex< T >, U >::type > operator*(const std::complex< T > &left, const U &right)
typename internal::ProductTypeImpl< typename std::decay< T >::type, typename std::decay< U >::type >::type type
std::enable_if_t< std::is_floating_point< T >::value &&std::is_floating_point< U >::value, typename ProductType< std::complex< T >, U >::type > operator/(const std::complex< T > &left, const U &right)
std::enable_if_t< std::is_floating_point< T >::value &&std::is_floating_point< U >::value, typename ProductType< T, std::complex< U > >::type > operator/(const T &left, const std::complex< U > &right)