SH4ZAM! 0.7.0
Fast math library for the Sega Dreamcast's SH4 CPU
Loading...
Searching...
No Matches
shz::complex Struct Reference

#include <shz_complex.hpp>

Inheritance diagram for shz::complex:
Collaboration diagram for shz::complex:

Public Member Functions

Constructors

Members for initializing and constructing.

 complex () noexcept=default
 
 complex (const complex &rhs) noexcept=default
 
 complex (float re, float im=0.0f) noexcept
 
 complex (const shz_complex_t &cplx) noexcept
 
 complex (const volatile shz_complex_t &cplx) noexcept
 
Member Operators

Overloaded operators defined as member functions.

complexoperator+= (const complex &rhs) noexcept
 
complexoperator-= (const complex &rhs) noexcept
 
complexoperator*= (const complex &rhs) noexcept
 
complexoperator*= (float scale) noexcept
 
complexoperator/= (const complex &rhs) noexcept
 

Additional Inherited Members

- Data Fields inherited from shz_complex_t
float real
 
float imag
 

Detailed Description

C++ wrapper around a floating-point complex number, real/imaginary pair.

Definition at line 30 of file shz_complex.hpp.

Constructor & Destructor Documentation

◆ complex() [1/5]

shz::complex::complex ( )
defaultnoexcept

Default constructor.

◆ complex() [2/5]

shz::complex::complex ( const complex & rhs)
defaultnoexcept

Default copy constructor.

◆ complex() [3/5]

shz::complex::complex ( float re,
float im = 0.0f )
inlinenoexcept

Value constructor, sets the imaginary component to 0 if none is supplied.

Definition at line 44 of file shz_complex.hpp.

44 :
45 shz_complex_t({ re, im }) {}

◆ complex() [4/5]

shz::complex::complex ( const shz_complex_t & cplx)
inlinenoexcept

Converting constructor for initializing from the C base type.

Definition at line 48 of file shz_complex.hpp.

48 :
49 complex(cplx.real, cplx.imag) {}
complex() noexcept=default
Default constructor.
float real
The real portion of the complex number.
Definition shz_complex.h:48
float imag
The imaginary portion of the complex number.
Definition shz_complex.h:49

◆ complex() [5/5]

shz::complex::complex ( const volatile shz_complex_t & cplx)
inlinenoexcept

Converting constructor for initialization from a volatile value type.

Definition at line 52 of file shz_complex.hpp.

52 :
53 complex(cplx.real, cplx.imag) {}

Member Function Documentation

◆ operator+=()

complex & shz::complex::operator+= ( const complex & rhs)
inlinenoexcept

Adds and accumulates rhs onto the given complex number.

Definition at line 91 of file shz_complex.hpp.

91 {
92 return (*this = shz_caddf(*this, rhs));
93 }
shz_complex_t shz_caddf(shz_complex_t lhs, shz_complex_t rhs) SHZ_NOEXCEPT
Adds two complex numbers together and returns the result.

◆ operator-=()

complex & shz::complex::operator-= ( const complex & rhs)
inlinenoexcept

Subtracts rhs from the given complex number, assigning it to the result.

Definition at line 96 of file shz_complex.hpp.

96 {
97 return (*this = shz_csubf(*this, rhs));
98 }
shz_complex_t shz_csubf(shz_complex_t lhs, shz_complex_t rhs) SHZ_NOEXCEPT
Subtracts rhs from lhs and returns the complex result.

◆ operator*=() [1/2]

complex & shz::complex::operator*= ( const complex & rhs)
inlinenoexcept

Multiplies and accumulates rhs by the given complex number.

Definition at line 101 of file shz_complex.hpp.

101 {
102 return (*this = shz_cmulf(*this, rhs));
103 }
shz_complex_t shz_cmulf(shz_complex_t lhs, shz_complex_t rhs) SHZ_NOEXCEPT
Multiplies two complex numbers together, returning the complex result.

◆ operator*=() [2/2]

complex & shz::complex::operator*= ( float scale)
inlinenoexcept

Multiplies and accumulates the given complex number by scalar.

Definition at line 106 of file shz_complex.hpp.

106 {
107 return (*this = shz_cscalef(*this, scale));
108 }
shz_complex_t shz_cscalef(shz_complex_t c, float v) SHZ_NOEXCEPT
Scales both componets of the complex number, c, by the value, v, returning the result.

◆ operator/=()

complex & shz::complex::operator/= ( const complex & rhs)
inlinenoexcept

Divides the given complex number by rhs, assigning it to the result.

Definition at line 111 of file shz_complex.hpp.

111 {
112 return (*this = shz_cdivf(*this, rhs));
113 }
shz_complex_t shz_cdivf(shz_complex_t lhs, shz_complex_t rhs) SHZ_NOEXCEPT
Divides lhs by rhs, returning the complex result.

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