Expression Templates Library (ETL)
Public Types | Public Member Functions | Public Attributes | List of all members
etl::complex< T > Struct Template Reference

Complex number implementation. More...

#include <complex.hpp>

Collaboration diagram for etl::complex< T >:
Collaboration graph
[legend]

Public Types

using value_type = T
 The value type.
 

Public Member Functions

constexpr complex (const T &re=T(), const T &im=T())
 Construct a complex number. More...
 
constexpr complex (const complex &rhs)=default
 Construct a complex number by copy. More...
 
template<typename X >
constexpr complex (const complex< X > &rhs)
 Construct a complex number by copy from another complex with different inner type. More...
 
complexoperator= (const T &rhs) noexcept
 Assign a real part to the complex number. More...
 
complexoperator= (const complex &rhs) noexcept=default
 Assign a complex number by copy. More...
 
complexoperator= (const std::complex< T > &rhs) noexcept
 Assign a complex number by copy. More...
 
template<typename X >
complexoperator+= (const complex< X > &rhs)
 Adds a complex number. More...
 
template<typename X >
complexoperator-= (const complex< X > &rhs)
 Subtracts a complex number. More...
 
template<typename X >
complexoperator*= (const complex< X > &rhs)
 Multipliies a complex number. More...
 
template<typename X >
complexoperator/= (const complex< X > &rhs)
 Divides a complex number. More...
 

Public Attributes

value_type real
 The real part.
 
value_type imag
 The imaginary part.
 

Detailed Description

template<typename T>
struct etl::complex< T >

Complex number implementation.

This implementation is binary-compatible with std::complex. This implementation is not opaque like std::complex and its operation can be inlined.

Constructor & Destructor Documentation

◆ complex() [1/3]

template<typename T>
constexpr etl::complex< T >::complex ( const T &  re = T(),
const T &  im = T() 
)
inline

Construct a complex number.

Parameters
reThe real part
imThe imaginary part

◆ complex() [2/3]

template<typename T>
constexpr etl::complex< T >::complex ( const complex< T > &  rhs)
default

Construct a complex number by copy.

Parameters
rhsThe complex to copy from

◆ complex() [3/3]

template<typename T>
template<typename X >
constexpr etl::complex< T >::complex ( const complex< X > &  rhs)
inline

Construct a complex number by copy from another complex with different inner type.

Parameters
rhsThe complex to copy from

Member Function Documentation

◆ operator*=()

template<typename T>
template<typename X >
complex& etl::complex< T >::operator*= ( const complex< X > &  rhs)
inline

Multipliies a complex number.

Parameters
rhsThe complex number to add
Returns
a reference to this

◆ operator+=()

template<typename T>
template<typename X >
complex& etl::complex< T >::operator+= ( const complex< X > &  rhs)
inline

Adds a complex number.

Parameters
rhsThe complex number to add
Returns
a reference to this

◆ operator-=()

template<typename T>
template<typename X >
complex& etl::complex< T >::operator-= ( const complex< X > &  rhs)
inline

Subtracts a complex number.

Parameters
rhsThe complex number to add
Returns
a reference to this

◆ operator/=()

template<typename T>
template<typename X >
complex& etl::complex< T >::operator/= ( const complex< X > &  rhs)
inline

Divides a complex number.

Parameters
rhsThe complex number to add
Returns
a reference to this

◆ operator=() [1/3]

template<typename T>
complex& etl::complex< T >::operator= ( const T &  rhs)
inlinenoexcept

Assign a real part to the complex number.

Parameters
rhsThe real part
Returns
a reference to this

◆ operator=() [2/3]

template<typename T>
complex& etl::complex< T >::operator= ( const complex< T > &  rhs)
defaultnoexcept

Assign a complex number by copy.

Parameters
rhsThe complex number to copy
Returns
a reference to this

◆ operator=() [3/3]

template<typename T>
complex& etl::complex< T >::operator= ( const std::complex< T > &  rhs)
inlinenoexcept

Assign a complex number by copy.

Parameters
rhsThe complex number to copy
Returns
a reference to this

The documentation for this struct was generated from the following file: