You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
2.1 KiB
C++
86 lines
2.1 KiB
C++
#ifndef __AMSMATHUTIL25_COMPLEX128_HPP__
|
|
#define __AMSMATHUTIL25_COMPLEX128_HPP__
|
|
|
|
namespace ams
|
|
{
|
|
namespace cmp
|
|
{
|
|
|
|
class complex
|
|
{
|
|
public:
|
|
double r,i;
|
|
|
|
complex();
|
|
complex(double _r, double _i);
|
|
explicit complex(double _r);
|
|
complex(const complex &other);
|
|
complex& operator=(const complex& other);
|
|
complex& operator=(const double other);
|
|
|
|
friend complex operator-(const complex& z); //negation sign
|
|
|
|
complex operator+(const complex& z);
|
|
complex operator-(const complex& z);
|
|
complex operator*(const complex& z);
|
|
complex operator/(const complex& z);
|
|
|
|
complex operator+(const double & z);
|
|
complex operator-(const double & z);
|
|
complex operator*(const double & z);
|
|
complex operator/(const double & z);
|
|
|
|
double& operator[](int& ind);
|
|
const double& operator[](const int& ind) const;
|
|
|
|
//comparison operators
|
|
bool operator==(const complex& z);
|
|
bool operator!=(const complex& z);
|
|
bool operator>(const complex& z);
|
|
bool operator<(const complex& z);
|
|
bool operator>=(const complex& z);
|
|
bool operator<=(const complex& z);
|
|
bool isnan();
|
|
bool isinf();
|
|
|
|
|
|
|
|
bool isreal();
|
|
bool isimag();
|
|
bool iszero();
|
|
double arg();
|
|
double mag();
|
|
const complex conj();
|
|
};
|
|
|
|
double arg(ams::cmp::complex z);
|
|
|
|
double real(complex z);
|
|
double imag(complex z);
|
|
complex sin(complex z);
|
|
complex cos(complex z);
|
|
complex tan(complex z);
|
|
complex exp(complex z);
|
|
complex log(complex z);
|
|
double abs(complex z);
|
|
complex conj(complex z);
|
|
|
|
//need hyperbolic trig Functions
|
|
complex cosh(complex z);
|
|
complex sinh(complex z);
|
|
complex tanh(complex z);
|
|
|
|
complex pow(complex z1, complex z2);
|
|
|
|
//returns "complex sign" of complex number - 0, or a unit number with same argument
|
|
complex csgn(complex z);
|
|
|
|
|
|
typedef complex complex128;
|
|
|
|
}; //end namespace cmp
|
|
}; //end namespace ams
|
|
|
|
#endif
|
|
|