Theoretica
Mathematical Library
Loading...
Searching...
No Matches
complex_types.h
Go to the documentation of this file.
1
5
6#ifndef THEORETICA_COMPLEX_TYPES_H
7#define THEORETICA_COMPLEX_TYPES_H
8
9#include <type_traits>
10#include "../core/core_traits.h"
11#include "../core/constants.h"
12#include "./complex.h"
13
14
15namespace theoretica {
16
17
19 template<typename Type = real>
20 using bicomplex = complex<complex<Type>>;
21
22
23 // Type trait to check whether the given type is a specialization
24 // of the complex number class or not, using the
25 // static boolean element is_complex_type<T>::value
26 template<typename T>
27 struct is_complex_type : std::false_type {};
28
29 // Type trait to check whether the given type is a specialization
30 // of the complex number class or not, using the
31 // static boolean element is_complex_type<T>::value
32 template<typename T>
33 struct is_complex_type<complex<T>> : std::true_type {};
34
35
36 // Type trait to check whether a container has complex elements.
37 template<typename Structure>
38 using has_complex_elements = is_complex_type<vector_element_t<Structure>>;
39
40
41 // Enable a function overload if the template typename
42 // is considerable a complex number. The std::enable_if structure
43 // is used, with type T which defaults to bool.
44 template<typename Structure, typename T = bool>
45 using enable_complex = std::enable_if_t<is_complex_type<Structure>::value, T>;
46
47}
48
49
50#endif
Complex number class.
Main namespace of the library which contains all functions and objects.
Definition algebra.h:27
complex< complex< Type > > bicomplex
A bi-complex number.
Definition complex_types.h:20