89 lines
3.3 KiB
C++
89 lines
3.3 KiB
C++
#ifndef __AMSCU_COMP64_HPP__
|
|
#define __AMSCU_COMP64_HPP__
|
|
|
|
namespace amscuda
|
|
{
|
|
namespace cmp
|
|
{
|
|
|
|
class cucomp64
|
|
{
|
|
public:
|
|
float real;
|
|
float imag;
|
|
|
|
__host__ __device__ cucomp64();
|
|
__host__ __device__ ~cucomp64();
|
|
__host__ __device__ cucomp64(const cucomp64 &other);
|
|
__host__ __device__ cucomp64(const float &other);
|
|
|
|
__host__ __device__ cucomp64& operator=(cucomp64& other);
|
|
__host__ __device__ const cucomp64& operator=(const cucomp64& other);
|
|
__host__ __device__ cucomp64& operator=(float& other);
|
|
__host__ __device__ const cucomp64& operator=(const float& other);
|
|
|
|
__host__ __device__ float& operator[](int& ind);
|
|
__host__ __device__ const float& operator[](const int& ind) const;
|
|
|
|
__host__ __device__ cucomp64 operator+(const cucomp64& z);
|
|
__host__ __device__ cucomp64 operator-(const cucomp64& z);
|
|
__host__ __device__ cucomp64 operator*(const cucomp64& z);
|
|
__host__ __device__ cucomp64 operator/(const cucomp64& z);
|
|
|
|
__host__ __device__ cucomp64 operator+(const float& z);
|
|
__host__ __device__ cucomp64 operator-(const float& z);
|
|
__host__ __device__ cucomp64 operator*(const float& z);
|
|
__host__ __device__ cucomp64 operator/(const float& z);
|
|
|
|
__host__ __device__ friend cucomp64 operator-(const cucomp64& z); //negation sign
|
|
|
|
//comparison operators
|
|
__host__ __device__ bool operator==(const cucomp64& z) const;
|
|
__host__ __device__ bool operator!=(const cucomp64& z) const;
|
|
__host__ __device__ bool operator>(const cucomp64& z) const;
|
|
__host__ __device__ bool operator<(const cucomp64& z) const;
|
|
__host__ __device__ bool operator>=(const cucomp64& z) const;
|
|
__host__ __device__ bool operator<=(const cucomp64& 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__ float arg() const;
|
|
__host__ __device__ float mag() const;
|
|
__host__ __device__ cucomp64 conj() const;
|
|
};
|
|
|
|
__host__ __device__ float arg(cucomp64 z);
|
|
|
|
__host__ __device__ cucomp64 dtocomp64(float _r, float _i);
|
|
__host__ __device__ float real(cucomp64 z);
|
|
__host__ __device__ float imag(cucomp64 z);
|
|
__host__ __device__ cucomp64 sin(cucomp64 z);
|
|
__host__ __device__ cucomp64 cos(cucomp64 z);
|
|
__host__ __device__ cucomp64 tan(cucomp64 z);
|
|
__host__ __device__ cucomp64 exp(cucomp64 z);
|
|
__host__ __device__ cucomp64 log(cucomp64 z);
|
|
__host__ __device__ float abs(cucomp64 z);
|
|
__host__ __device__ cucomp64 conj(cucomp64 z);
|
|
|
|
// //need hyperbolic trig Functions
|
|
__host__ __device__ cucomp64 cosh(cucomp64 z);
|
|
__host__ __device__ cucomp64 sinh(cucomp64 z);
|
|
__host__ __device__ cucomp64 tanh(cucomp64 z);
|
|
|
|
__host__ __device__ cucomp64 pow(cucomp64 z1, cucomp64 z2);
|
|
|
|
// //returns "complex sign" of complex number - 0, or a unit number with same argument
|
|
__host__ __device__ cucomp64 csgn(cucomp64 z);
|
|
|
|
void test_cucomp64_1();
|
|
|
|
}; //end namespace cmp
|
|
}; //end namespace amscuda
|
|
|
|
#endif
|
|
|