autocodegen
This commit is contained in:
@ -10,72 +10,78 @@ namespace amscuda
|
||||
float x;
|
||||
float y;
|
||||
|
||||
__host__ __device__ cuvec2f();
|
||||
__host__ __device__ ~cuvec2f();
|
||||
__host__ __device__ cuvec2f(const float &_x, const float &_y);
|
||||
|
||||
|
||||
__host__ __device__ cuvec2f();
|
||||
__host__ __device__ ~cuvec2f();
|
||||
__host__ __device__ cuvec2f(const float &_x, const float &_y);
|
||||
|
||||
__host__ __device__ float& operator[](const int &I);
|
||||
__host__ __device__ const float& operator[](const int &I) const;
|
||||
|
||||
__host__ __device__ cuvec2f operator+(const cuvec2f &rhs);
|
||||
__host__ __device__ cuvec2f operator-(const cuvec2f &rhs);
|
||||
__host__ __device__ cuvec2f operator*(const float &rhs);
|
||||
__host__ __device__ cuvec2f operator/(const float &rhs);
|
||||
__host__ __device__ friend cuvec2f operator-(const cuvec2f &rhs);
|
||||
|
||||
__host__ __device__ cuvec2f& operator+=(const cuvec2f &rhs);
|
||||
__host__ __device__ cuvec2f& operator-=(const cuvec2f &rhs);
|
||||
__host__ __device__ cuvec2f& operator/=(const float &rhs);
|
||||
__host__ __device__ cuvec2f& operator*=(const float &rhs);
|
||||
__host__ __device__ cuvec2f operator+(const cuvec2f& rhs) const;
|
||||
__host__ __device__ cuvec2f operator-(const cuvec2f& rhs) const;
|
||||
__host__ __device__ cuvec2f operator*(const cuvec2f& rhs) const; //elementwise product
|
||||
__host__ __device__ cuvec2f operator/(const cuvec2f& rhs) const; //elementwise division
|
||||
|
||||
__host__ __device__ friend cuvec2f operator*(const cuvec2f& lhs, const float& rhs);
|
||||
__host__ __device__ friend cuvec2f operator*(const float& lhs, const cuvec2f& rhs);
|
||||
__host__ __device__ friend cuvec2f operator/(const cuvec2f& lhs, const float& rhs);
|
||||
__host__ __device__ friend cuvec2f operator/(const float& lhs, const cuvec2f& rhs);
|
||||
__host__ __device__ friend cuvec2f operator-(const cuvec2f& other);
|
||||
|
||||
__host__ __device__ cuvec2f& operator+=(const cuvec2f& rhs);
|
||||
__host__ __device__ cuvec2f& operator-=(const cuvec2f& rhs);
|
||||
__host__ __device__ cuvec2f& operator*=(const float& rhs);
|
||||
__host__ __device__ cuvec2f& operator/=(const float& rhs);
|
||||
|
||||
|
||||
};
|
||||
|
||||
class cumat2f
|
||||
{
|
||||
public:
|
||||
float m00,m10; //named references to force register use?
|
||||
float m01,m11; //switched to column-major-order to match GLSL/lapack
|
||||
|
||||
__host__ __device__ cumat2f();
|
||||
__host__ __device__ ~cumat2f();
|
||||
|
||||
__host__ __device__ cumat2f(
|
||||
const float & _m00, const float & _m01,
|
||||
const float & _m10, const float & _m11
|
||||
);
|
||||
|
||||
__host__ __device__ explicit cumat2f(const float* data2x2);
|
||||
|
||||
__host__ __device__ float& operator[](const int &I);
|
||||
__host__ __device__ float& operator()(const int &I, const int &J);
|
||||
__host__ __device__ float& at(const int &I, const int &J);
|
||||
|
||||
__host__ __device__ const float& operator[](const int &I) const;
|
||||
__host__ __device__ const float& operator()(const int &I, const int &J) const;
|
||||
__host__ __device__ const float& at(const int &I, const int &J) const;
|
||||
|
||||
__host__ __device__ cumat2f operator+(const cumat2f &rhs);
|
||||
__host__ __device__ cumat2f operator-(const cumat2f &rhs);
|
||||
__host__ __device__ cumat2f operator*(const float &rhs);
|
||||
__host__ __device__ cumat2f operator/(const float &rhs);
|
||||
__host__ __device__ cuvec2f operator*(const cuvec2f &rhs);
|
||||
__host__ __device__ cumat2f operator*(const cumat2f &rhs);
|
||||
__host__ __device__ friend cumat2f operator-(const cumat2f &rhs);
|
||||
float m00,m10;
|
||||
float m01,m11;
|
||||
|
||||
__host__ __device__ cumat2f();
|
||||
__host__ __device__ ~cumat2f();
|
||||
__host__ __device__ cumat2f(
|
||||
const float& _m00, const float& _m10,
|
||||
const float& _m01, const float& _m11
|
||||
);
|
||||
__host__ __device__ cumat2f(const float* data4);
|
||||
|
||||
__host__ __device__ float& operator[](const int &I);
|
||||
__host__ __device__ const float& operator[](const int &I) const;
|
||||
__host__ __device__ float& operator()(const int &I, const int &J);
|
||||
__host__ __device__ const float& operator()(const int &I, const int &J) const;
|
||||
__host__ __device__ float& at(const int &I, const int &J);
|
||||
__host__ __device__ const float& at(const int &I, const int &J) const;
|
||||
|
||||
__host__ __device__ float* data(); //pointer to float4 representation of matrix
|
||||
__host__ __device__ const float* data() const; //pointer to float4 representation of matrix
|
||||
|
||||
//operators
|
||||
__host__ __device__ cumat2f operator+(const cumat2f& rhs) const;
|
||||
__host__ __device__ cumat2f operator-(const cumat2f& rhs) const;
|
||||
__host__ __device__ cumat2f operator*(const cumat2f& rhs) const;
|
||||
__host__ __device__ friend cumat2f operator*(const cumat2f& lhs, const float& rhs);
|
||||
__host__ __device__ friend cumat2f operator/(const cumat2f& lhs, const float& rhs);
|
||||
__host__ __device__ friend cumat2f operator*(const float& lhs, const cumat2f& rhs);
|
||||
__host__ __device__ friend cuvec2f operator*(const cumat2f& lhs, const cuvec2f& rhs);
|
||||
__host__ __device__ friend cuvec2f operator*(const cuvec2f& lhs, const cumat2f& rhs);
|
||||
__host__ __device__ friend cumat2f operator-(const cumat2f& rhs);
|
||||
|
||||
//in place operators to save register use
|
||||
__host__ __device__ cumat2f& operator+=(const cumat2f& rhs);
|
||||
__host__ __device__ cumat2f& operator-=(const cumat2f& rhs);
|
||||
__host__ __device__ cumat2f& operator*=(const float& rhs);
|
||||
__host__ __device__ cumat2f& operator/=(const float& rhs);
|
||||
__host__ __device__ cumat2f& operator*=(const cumat2f& rhs);
|
||||
|
||||
__host__ __device__ cumat2f transpose() const;
|
||||
|
||||
__host__ __device__ float det();
|
||||
__host__ __device__ cumat2f transpose();
|
||||
__host__ __device__ cumat2f inverse();
|
||||
|
||||
__host__ __device__ float* data(); //pointer to float[4] representation of matrix
|
||||
__host__ __device__ const float* data() const; //pointer to float[4] representation of matrix
|
||||
|
||||
//In place operations (to save GPU register use)
|
||||
__host__ __device__ cumat2f& operator+=(const cumat2f &rhs);
|
||||
__host__ __device__ cumat2f& operator-=(const cumat2f &rhs);
|
||||
__host__ __device__ cumat2f& operator/=(const float &rhs);
|
||||
__host__ __device__ cumat2f& operator*=(const float &rhs);
|
||||
__host__ __device__ cumat2f& operator*=(const cumat2f &rhs);
|
||||
};
|
||||
|
||||
__host__ __device__ float cuvec2f_dot(const cuvec2f &a, const cuvec2f &b);
|
||||
|
||||
@ -21,8 +21,12 @@ namespace amscuda
|
||||
|
||||
__host__ __device__ cuvec3f operator+(const cuvec3f &rhs);
|
||||
__host__ __device__ cuvec3f operator-(const cuvec3f &rhs);
|
||||
__host__ __device__ cuvec3f operator*(const float &rhs);
|
||||
__host__ __device__ cuvec3f operator/(const float &rhs);
|
||||
|
||||
__host__ __device__ friend cuvec3f operator*(const cuvec3f& lhs, const float &rhs);
|
||||
__host__ __device__ friend cuvec3f operator/(const cuvec3f& lhs, const float &rhs);
|
||||
__host__ __device__ friend cuvec3f operator*(const float& lhs, const cuvec3f &rhs);
|
||||
__host__ __device__ friend cuvec3f operator/(const float& lhs, const cuvec3f &rhs);
|
||||
|
||||
__host__ __device__ friend cuvec3f operator-(const cuvec3f &rhs);
|
||||
|
||||
__host__ __device__ cuvec3f& operator+=(const cuvec3f &rhs);
|
||||
|
||||
@ -22,8 +22,12 @@ namespace amscuda
|
||||
|
||||
__host__ __device__ cuvec4f operator+(const cuvec4f &rhs);
|
||||
__host__ __device__ cuvec4f operator-(const cuvec4f &rhs);
|
||||
__host__ __device__ cuvec4f operator*(const float &rhs);
|
||||
__host__ __device__ cuvec4f operator/(const float &rhs);
|
||||
|
||||
__host__ __device__ friend cuvec4f operator*(const cuvec4f& lhs, const float &rhs);
|
||||
__host__ __device__ friend cuvec4f operator/(const cuvec4f& lhs, const float &rhs);
|
||||
__host__ __device__ friend cuvec4f operator*(const float& lhs, const cuvec4f &rhs);
|
||||
__host__ __device__ friend cuvec4f operator/(const float& lhs, const cuvec4f &rhs);
|
||||
|
||||
__host__ __device__ friend cuvec4f operator-(const cuvec4f &rhs);
|
||||
|
||||
__host__ __device__ cuvec4f& operator+=(const cuvec4f &rhs);
|
||||
|
||||
Reference in New Issue
Block a user