90 lines
3.4 KiB
C++
90 lines
3.4 KiB
C++
#ifndef __AMSCU_COMP128_HPP__
|
|
#define __AMSCU_COMP128_HPP__
|
|
|
|
namespace amscuda
|
|
{
|
|
namespace cmp
|
|
{
|
|
|
|
class cucomp128
|
|
{
|
|
public:
|
|
double real;
|
|
double imag;
|
|
|
|
__host__ __device__ cucomp128();
|
|
__host__ __device__ ~cucomp128();
|
|
__host__ __device__ cucomp128(const cucomp128 &other);
|
|
__host__ __device__ cucomp128(const double &other);
|
|
|
|
__host__ __device__ cucomp128& operator=(cucomp128& other);
|
|
__host__ __device__ const cucomp128& operator=(const cucomp128& other);
|
|
__host__ __device__ cucomp128& operator=(double& other);
|
|
__host__ __device__ const cucomp128& operator=(const double& other);
|
|
|
|
__host__ __device__ double& operator[](int& ind);
|
|
__host__ __device__ const double& operator[](const int& ind) const;
|
|
|
|
__host__ __device__ cucomp128 operator+(const cucomp128& z);
|
|
__host__ __device__ cucomp128 operator-(const cucomp128& z);
|
|
__host__ __device__ cucomp128 operator*(const cucomp128& z);
|
|
__host__ __device__ cucomp128 operator/(const cucomp128& z);
|
|
|
|
__host__ __device__ cucomp128 operator+(const double& z);
|
|
__host__ __device__ cucomp128 operator-(const double& z);
|
|
__host__ __device__ cucomp128 operator*(const double& z);
|
|
__host__ __device__ cucomp128 operator/(const double& z);
|
|
|
|
__host__ __device__ friend cucomp128 operator-(const cucomp128& z); //negation sign
|
|
|
|
//comparison operators
|
|
__host__ __device__ bool operator==(const cucomp128& z) const;
|
|
__host__ __device__ bool operator!=(const cucomp128& z) const;
|
|
__host__ __device__ bool operator>(const cucomp128& z) const;
|
|
__host__ __device__ bool operator<(const cucomp128& z) const;
|
|
__host__ __device__ bool operator>=(const cucomp128& z) const;
|
|
__host__ __device__ bool operator<=(const cucomp128& z) const;
|
|
|
|
__host__ __device__ bool isnan() const;
|
|
__host__ __device__ bool isinf() const;
|
|
|
|
__host__ __device__ bool isreal() const;
|
|
__host__ __device__ bool isimag() const;
|
|
__host__ __device__ bool iszero() const;
|
|
__host__ __device__ double arg() const;
|
|
__host__ __device__ double mag() const;
|
|
__host__ __device__ cucomp128 conj() const;
|
|
};
|
|
|
|
__host__ __device__ double arg(cucomp128 z);
|
|
|
|
__host__ __device__ cucomp128 dtocomp(double _r, double _i);
|
|
__host__ __device__ double real(cucomp128 z);
|
|
__host__ __device__ double imag(cucomp128 z);
|
|
__host__ __device__ cucomp128 sin(cucomp128 z);
|
|
__host__ __device__ cucomp128 cos(cucomp128 z);
|
|
__host__ __device__ cucomp128 tan(cucomp128 z);
|
|
__host__ __device__ cucomp128 exp(cucomp128 z);
|
|
__host__ __device__ cucomp128 log(cucomp128 z);
|
|
__host__ __device__ double abs(cucomp128 z);
|
|
__host__ __device__ cucomp128 conj(cucomp128 z);
|
|
|
|
// //need hyperbolic trig Functions
|
|
__host__ __device__ cucomp128 cosh(cucomp128 z);
|
|
__host__ __device__ cucomp128 sinh(cucomp128 z);
|
|
__host__ __device__ cucomp128 tanh(cucomp128 z);
|
|
|
|
__host__ __device__ cucomp128 pow(cucomp128 z1, cucomp128 z2);
|
|
|
|
// //returns "complex sign" of complex number - 0, or a unit number with same argument
|
|
__host__ __device__ cucomp128 csgn(cucomp128 z);
|
|
|
|
void test_cucomp128_1();
|
|
|
|
|
|
}; //end namespace cmp
|
|
}; //end namespace amscuda
|
|
|
|
#endif
|
|
|