scifir-units 2.0.0
scifir-units is a library of units of measurement, angles, coordinates, fields, and related data, all lightweight, that help in the development of scientific software and scientific machines
Loading...
Searching...
No Matches
Classes | Namespaces | Functions
complex_number.hpp File Reference
#include "./angle.hpp"
#include "../util/is_number.hpp"
#include "../units/scalar_unit.hpp"
#include "../util/types.hpp"
#include "boost/algorithm/string.hpp"
#include <cmath>
#include <string>
Include dependency graph for complex_number.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  scifir::complex_number< T >
 

Namespaces

namespace  scifir
 The namespace scifir contains all scifir-units, excepting the string literals, which are outside.
 

Functions

template<typename T >
string scifir::to_string (const complex_number< T > &x)
 
bool scifir::is_complex (const string &init_complex_number)
 
template<typename T >
T scifir::abs (const complex_number< T > &x)
 
template<typename T >
complex_number< scalar_unitscifir::sqrt (const complex_number< T > &x)
 
template<typename T , typename U >
bool operator== (const scifir::complex_number< T > &x, const scifir::complex_number< U > &y)
 
template<typename T , typename U >
bool operator!= (const scifir::complex_number< T > &x, const scifir::complex_number< U > &y)
 
template<typename T >
bool operator== (const scifir::complex_number< T > &x, const string &init_complex_number)
 
template<typename T >
bool operator!= (const scifir::complex_number< T > &x, const string &init_complex_number)
 
template<typename T >
bool operator== (const string &init_complex_number, const scifir::complex_number< T > &x)
 
template<typename T >
bool operator!= (const string &init_complex_number, const scifir::complex_number< T > &x)
 
template<typename T >
void operator+= (string &x, const scifir::complex_number< T > &y)
 
template<typename T >
string operator+ (const string &x, const scifir::complex_number< T > &y)
 
template<typename T >
string operator+ (const scifir::complex_number< T > &x, const string &y)
 
template<typename T >
ostream & operator<< (ostream &os, const scifir::complex_number< T > &x)
 
template<typename T >
istream & operator>> (istream &is, scifir::complex_number< T > &x)
 

Function Documentation

◆ operator!=() [1/3]

template<typename T , typename U >
bool operator!= ( const scifir::complex_number< T > &  x,
const scifir::complex_number< U > &  y 
)

Definition at line 233 of file complex_number.hpp.

234{
235 return !(x == y);
236}

◆ operator!=() [2/3]

template<typename T >
bool operator!= ( const scifir::complex_number< T > &  x,
const string &  init_complex_number 
)

Definition at line 245 of file complex_number.hpp.

246{
247 return !(x == init_complex_number);
248}

◆ operator!=() [3/3]

template<typename T >
bool operator!= ( const string &  init_complex_number,
const scifir::complex_number< T > &  x 
)

Definition at line 257 of file complex_number.hpp.

258{
259 return !(init_complex_number == x);
260}

◆ operator+() [1/2]

template<typename T >
string operator+ ( const scifir::complex_number< T > &  x,
const string &  y 
)

Definition at line 275 of file complex_number.hpp.

276{
277 return to_string(x) + y;
278}
string to_string(const aid &x)
Creates a string representation of aid, it's for aid equivalent to the display() function of aid.
Definition aid.cpp:582

◆ operator+() [2/2]

template<typename T >
string operator+ ( const string &  x,
const scifir::complex_number< T > &  y 
)

Definition at line 269 of file complex_number.hpp.

270{
271 return x + to_string(y);
272}

◆ operator+=()

template<typename T >
void operator+= ( string &  x,
const scifir::complex_number< T > &  y 
)

Definition at line 263 of file complex_number.hpp.

264{
265 x += to_string(y);
266}

◆ operator<<()

template<typename T >
ostream & operator<< ( ostream &  os,
const scifir::complex_number< T > &  x 
)

Definition at line 281 of file complex_number.hpp.

282{
283 return os << to_string(x);
284}

◆ operator==() [1/3]

template<typename T , typename U >
bool operator== ( const scifir::complex_number< T > &  x,
const scifir::complex_number< U > &  y 
)

Definition at line 220 of file complex_number.hpp.

221{
222 if (x.real == y.real and x.imaginary == y.imaginary)
223 {
224 return true;
225 }
226 else
227 {
228 return false;
229 }
230}

◆ operator==() [2/3]

template<typename T >
bool operator== ( const scifir::complex_number< T > &  x,
const string &  init_complex_number 
)

Definition at line 239 of file complex_number.hpp.

240{
241 return (x == scifir::complex_number<T>(init_complex_number));
242}

◆ operator==() [3/3]

template<typename T >
bool operator== ( const string &  init_complex_number,
const scifir::complex_number< T > &  x 
)

Definition at line 251 of file complex_number.hpp.

252{
253 return (scifir::complex_number<T>(init_complex_number) == x);
254}

◆ operator>>()

template<typename T >
istream & operator>> ( istream &  is,
scifir::complex_number< T > &  x 
)

Definition at line 287 of file complex_number.hpp.

288{
289 char a[256];
290 is.getline(a, 256);
291 string b(a);
293 return is;
294}