integer vector types

This commit is contained in:
2026-04-13 12:16:10 -04:00
parent e3be5a8a2c
commit 4530ed3603
23 changed files with 757 additions and 126 deletions

View File

@ -16,7 +16,7 @@
return;
}
__host__ __device__ float& cuvec2::operator[](const int &I)
__host__ __device__ double& cuvec2::operator[](const int &I)
{
switch(I)
{
@ -29,7 +29,7 @@
return x;
}
__host__ __device__ const float& cuvec2::operator[](const int &I) const
__host__ __device__ const double& cuvec2::operator[](const int &I) const
{
switch(I)
{
@ -198,7 +198,7 @@
return;
}
__host__ __device__ float& cumat2::operator[](const int &I)
__host__ __device__ double& cumat2::operator[](const int &I)
{
switch(I)
{
@ -215,7 +215,7 @@
return m00;
}
__host__ __device__ const float& cumat2::operator[](const int &I) const
__host__ __device__ const double& cumat2::operator[](const int &I) const
{
switch(I)
{
@ -232,22 +232,22 @@
return m00;
}
__host__ __device__ float& cumat2::operator()(const int &I, const int &J)
__host__ __device__ double& cumat2::operator()(const int &I, const int &J)
{
return (*this)[I+2*J];
}
__host__ __device__ const float& cumat2::operator()(const int &I, const int &J) const
__host__ __device__ const double& cumat2::operator()(const int &I, const int &J) const
{
return (*this)[I+2*J];
}
__host__ __device__ float& cumat2::at(const int &I, const int &J)
__host__ __device__ double& cumat2::at(const int &I, const int &J)
{
return (*this)[I+2*J];
}
__host__ __device__ const float& cumat2::at(const int &I, const int &J) const
__host__ __device__ const double& cumat2::at(const int &I, const int &J) const
{
return (*this)[I+2*J];
}

View File

@ -1,8 +1,8 @@
__host__ __device__ cuvec2();
__host__ __device__ ~cuvec2();
__host__ __device__ cuvec2(const double &_x, const double &_y);
__host__ __device__ float& operator[](const int &I);
__host__ __device__ const float& operator[](const int &I) const;
__host__ __device__ double& operator[](const int &I);
__host__ __device__ const double& operator[](const int &I) const;
__host__ __device__ cuvec2 operator+(const cuvec2& rhs) const;
__host__ __device__ cuvec2 operator-(const cuvec2& rhs) const;
__host__ __device__ cuvec2 operator*(const cuvec2& rhs) const; //elementwise product
@ -29,14 +29,14 @@ double m01,m11;
const double& _m10, const double& _m11
);
__host__ __device__ cumat2(const double* 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__ double* data(); //pointer to float4 representation of matrix
__host__ __device__ const double* data() const; //pointer to float4 representation of matrix
__host__ __device__ double& operator[](const int &I);
__host__ __device__ const double& operator[](const int &I) const;
__host__ __device__ double& operator()(const int &I, const int &J);
__host__ __device__ const double& operator()(const int &I, const int &J) const;
__host__ __device__ double& at(const int &I, const int &J);
__host__ __device__ const double& at(const int &I, const int &J) const;
__host__ __device__ double* data(); //pointer to double4 representation of matrix
__host__ __device__ const double* data() const; //pointer to double4 representation of matrix
__host__ __device__ cumat2 operator+(const cumat2& rhs) const;
__host__ __device__ cumat2 operator-(const cumat2& rhs) const;
__host__ __device__ cumat2 operator*(const cumat2& rhs) const;

View File

@ -16,7 +16,7 @@
return;
}
__host__ __device__ float& cuvec2i::operator[](const int &I)
__host__ __device__ int& cuvec2i::operator[](const int &I)
{
switch(I)
{
@ -29,7 +29,7 @@
return x;
}
__host__ __device__ const float& cuvec2i::operator[](const int &I) const
__host__ __device__ const int& cuvec2i::operator[](const int &I) const
{
switch(I)
{
@ -198,7 +198,7 @@
return;
}
__host__ __device__ float& cumat2i::operator[](const int &I)
__host__ __device__ int& cumat2i::operator[](const int &I)
{
switch(I)
{
@ -215,7 +215,7 @@
return m00;
}
__host__ __device__ const float& cumat2i::operator[](const int &I) const
__host__ __device__ const int& cumat2i::operator[](const int &I) const
{
switch(I)
{
@ -232,22 +232,22 @@
return m00;
}
__host__ __device__ float& cumat2i::operator()(const int &I, const int &J)
__host__ __device__ int& cumat2i::operator()(const int &I, const int &J)
{
return (*this)[I+2*J];
}
__host__ __device__ const float& cumat2i::operator()(const int &I, const int &J) const
__host__ __device__ const int& cumat2i::operator()(const int &I, const int &J) const
{
return (*this)[I+2*J];
}
__host__ __device__ float& cumat2i::at(const int &I, const int &J)
__host__ __device__ int& cumat2i::at(const int &I, const int &J)
{
return (*this)[I+2*J];
}
__host__ __device__ const float& cumat2i::at(const int &I, const int &J) const
__host__ __device__ const int& cumat2i::at(const int &I, const int &J) const
{
return (*this)[I+2*J];
}

View File

@ -1,8 +1,8 @@
__host__ __device__ cuvec2i();
__host__ __device__ ~cuvec2i();
__host__ __device__ cuvec2i(const int &_x, const int &_y);
__host__ __device__ float& operator[](const int &I);
__host__ __device__ const float& operator[](const int &I) const;
__host__ __device__ int& operator[](const int &I);
__host__ __device__ const int& operator[](const int &I) const;
__host__ __device__ cuvec2i operator+(const cuvec2i& rhs) const;
__host__ __device__ cuvec2i operator-(const cuvec2i& rhs) const;
__host__ __device__ cuvec2i operator*(const cuvec2i& rhs) const; //elementwise product
@ -29,14 +29,14 @@ int m01,m11;
const int& _m10, const int& _m11
);
__host__ __device__ cumat2i(const int* 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__ int* data(); //pointer to float4 representation of matrix
__host__ __device__ const int* data() const; //pointer to float4 representation of matrix
__host__ __device__ int& operator[](const int &I);
__host__ __device__ const int& operator[](const int &I) const;
__host__ __device__ int& operator()(const int &I, const int &J);
__host__ __device__ const int& operator()(const int &I, const int &J) const;
__host__ __device__ int& at(const int &I, const int &J);
__host__ __device__ const int& at(const int &I, const int &J) const;
__host__ __device__ int* data(); //pointer to int4 representation of matrix
__host__ __device__ const int* data() const; //pointer to int4 representation of matrix
__host__ __device__ cumat2i operator+(const cumat2i& rhs) const;
__host__ __device__ cumat2i operator-(const cumat2i& rhs) const;
__host__ __device__ cumat2i operator*(const cumat2i& rhs) const;

View File

@ -16,7 +16,7 @@
return;
}
__host__ __device__ float& cuvec3::operator[](const int &I)
__host__ __device__ double& cuvec3::operator[](const int &I)
{
switch(I)
{
@ -31,7 +31,7 @@
return x;
}
__host__ __device__ const float& cuvec3::operator[](const int &I) const
__host__ __device__ const double& cuvec3::operator[](const int &I) const
{
switch(I)
{
@ -240,7 +240,7 @@
return;
}
__host__ __device__ float& cumat3::operator[](const int &I)
__host__ __device__ double& cumat3::operator[](const int &I)
{
switch(I)
{
@ -267,7 +267,7 @@
return m00;
}
__host__ __device__ const float& cumat3::operator[](const int &I) const
__host__ __device__ const double& cumat3::operator[](const int &I) const
{
switch(I)
{
@ -294,22 +294,22 @@
return m00;
}
__host__ __device__ float& cumat3::operator()(const int &I, const int &J)
__host__ __device__ double& cumat3::operator()(const int &I, const int &J)
{
return (*this)[I+3*J];
}
__host__ __device__ const float& cumat3::operator()(const int &I, const int &J) const
__host__ __device__ const double& cumat3::operator()(const int &I, const int &J) const
{
return (*this)[I+3*J];
}
__host__ __device__ float& cumat3::at(const int &I, const int &J)
__host__ __device__ double& cumat3::at(const int &I, const int &J)
{
return (*this)[I+3*J];
}
__host__ __device__ const float& cumat3::at(const int &I, const int &J) const
__host__ __device__ const double& cumat3::at(const int &I, const int &J) const
{
return (*this)[I+3*J];
}

View File

@ -1,8 +1,8 @@
__host__ __device__ cuvec3();
__host__ __device__ ~cuvec3();
__host__ __device__ cuvec3(const double &_x, const double &_y, const double &_z);
__host__ __device__ float& operator[](const int &I);
__host__ __device__ const float& operator[](const int &I) const;
__host__ __device__ double& operator[](const int &I);
__host__ __device__ const double& operator[](const int &I) const;
__host__ __device__ cuvec3 operator+(const cuvec3& rhs) const;
__host__ __device__ cuvec3 operator-(const cuvec3& rhs) const;
__host__ __device__ cuvec3 operator*(const cuvec3& rhs) const; //elementwise product
@ -31,14 +31,14 @@ double m02,m12,m22;
const double& _m20, const double& _m21, const double& _m22
);
__host__ __device__ cumat3(const double* data9);
__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__ double* data(); //pointer to float9 representation of matrix
__host__ __device__ const double* data() const; //pointer to float9 representation of matrix
__host__ __device__ double& operator[](const int &I);
__host__ __device__ const double& operator[](const int &I) const;
__host__ __device__ double& operator()(const int &I, const int &J);
__host__ __device__ const double& operator()(const int &I, const int &J) const;
__host__ __device__ double& at(const int &I, const int &J);
__host__ __device__ const double& at(const int &I, const int &J) const;
__host__ __device__ double* data(); //pointer to double9 representation of matrix
__host__ __device__ const double* data() const; //pointer to double9 representation of matrix
__host__ __device__ cumat3 operator+(const cumat3& rhs) const;
__host__ __device__ cumat3 operator-(const cumat3& rhs) const;
__host__ __device__ cumat3 operator*(const cumat3& rhs) const;

View File

@ -16,7 +16,7 @@
return;
}
__host__ __device__ float& cuvec3i::operator[](const int &I)
__host__ __device__ int& cuvec3i::operator[](const int &I)
{
switch(I)
{
@ -31,7 +31,7 @@
return x;
}
__host__ __device__ const float& cuvec3i::operator[](const int &I) const
__host__ __device__ const int& cuvec3i::operator[](const int &I) const
{
switch(I)
{
@ -240,7 +240,7 @@
return;
}
__host__ __device__ float& cumat3i::operator[](const int &I)
__host__ __device__ int& cumat3i::operator[](const int &I)
{
switch(I)
{
@ -267,7 +267,7 @@
return m00;
}
__host__ __device__ const float& cumat3i::operator[](const int &I) const
__host__ __device__ const int& cumat3i::operator[](const int &I) const
{
switch(I)
{
@ -294,22 +294,22 @@
return m00;
}
__host__ __device__ float& cumat3i::operator()(const int &I, const int &J)
__host__ __device__ int& cumat3i::operator()(const int &I, const int &J)
{
return (*this)[I+3*J];
}
__host__ __device__ const float& cumat3i::operator()(const int &I, const int &J) const
__host__ __device__ const int& cumat3i::operator()(const int &I, const int &J) const
{
return (*this)[I+3*J];
}
__host__ __device__ float& cumat3i::at(const int &I, const int &J)
__host__ __device__ int& cumat3i::at(const int &I, const int &J)
{
return (*this)[I+3*J];
}
__host__ __device__ const float& cumat3i::at(const int &I, const int &J) const
__host__ __device__ const int& cumat3i::at(const int &I, const int &J) const
{
return (*this)[I+3*J];
}

View File

@ -1,8 +1,8 @@
__host__ __device__ cuvec3i();
__host__ __device__ ~cuvec3i();
__host__ __device__ cuvec3i(const int &_x, const int &_y, const int &_z);
__host__ __device__ float& operator[](const int &I);
__host__ __device__ const float& operator[](const int &I) const;
__host__ __device__ int& operator[](const int &I);
__host__ __device__ const int& operator[](const int &I) const;
__host__ __device__ cuvec3i operator+(const cuvec3i& rhs) const;
__host__ __device__ cuvec3i operator-(const cuvec3i& rhs) const;
__host__ __device__ cuvec3i operator*(const cuvec3i& rhs) const; //elementwise product
@ -31,14 +31,14 @@ int m02,m12,m22;
const int& _m20, const int& _m21, const int& _m22
);
__host__ __device__ cumat3i(const int* data9);
__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__ int* data(); //pointer to float9 representation of matrix
__host__ __device__ const int* data() const; //pointer to float9 representation of matrix
__host__ __device__ int& operator[](const int &I);
__host__ __device__ const int& operator[](const int &I) const;
__host__ __device__ int& operator()(const int &I, const int &J);
__host__ __device__ const int& operator()(const int &I, const int &J) const;
__host__ __device__ int& at(const int &I, const int &J);
__host__ __device__ const int& at(const int &I, const int &J) const;
__host__ __device__ int* data(); //pointer to int9 representation of matrix
__host__ __device__ const int* data() const; //pointer to int9 representation of matrix
__host__ __device__ cumat3i operator+(const cumat3i& rhs) const;
__host__ __device__ cumat3i operator-(const cumat3i& rhs) const;
__host__ __device__ cumat3i operator*(const cumat3i& rhs) const;

View File

@ -16,7 +16,7 @@
return;
}
__host__ __device__ float& cuvec4::operator[](const int &I)
__host__ __device__ double& cuvec4::operator[](const int &I)
{
switch(I)
{
@ -33,7 +33,7 @@
return x;
}
__host__ __device__ const float& cuvec4::operator[](const int &I) const
__host__ __device__ const double& cuvec4::operator[](const int &I) const
{
switch(I)
{
@ -290,7 +290,7 @@
return;
}
__host__ __device__ float& cumat4::operator[](const int &I)
__host__ __device__ double& cumat4::operator[](const int &I)
{
switch(I)
{
@ -331,7 +331,7 @@
return m00;
}
__host__ __device__ const float& cumat4::operator[](const int &I) const
__host__ __device__ const double& cumat4::operator[](const int &I) const
{
switch(I)
{
@ -372,22 +372,22 @@
return m00;
}
__host__ __device__ float& cumat4::operator()(const int &I, const int &J)
__host__ __device__ double& cumat4::operator()(const int &I, const int &J)
{
return (*this)[I+4*J];
}
__host__ __device__ const float& cumat4::operator()(const int &I, const int &J) const
__host__ __device__ const double& cumat4::operator()(const int &I, const int &J) const
{
return (*this)[I+4*J];
}
__host__ __device__ float& cumat4::at(const int &I, const int &J)
__host__ __device__ double& cumat4::at(const int &I, const int &J)
{
return (*this)[I+4*J];
}
__host__ __device__ const float& cumat4::at(const int &I, const int &J) const
__host__ __device__ const double& cumat4::at(const int &I, const int &J) const
{
return (*this)[I+4*J];
}

View File

@ -1,8 +1,8 @@
__host__ __device__ cuvec4();
__host__ __device__ ~cuvec4();
__host__ __device__ cuvec4(const double &_x, const double &_y, const double &_z, const double &_w);
__host__ __device__ float& operator[](const int &I);
__host__ __device__ const float& operator[](const int &I) const;
__host__ __device__ double& operator[](const int &I);
__host__ __device__ const double& operator[](const int &I) const;
__host__ __device__ cuvec4 operator+(const cuvec4& rhs) const;
__host__ __device__ cuvec4 operator-(const cuvec4& rhs) const;
__host__ __device__ cuvec4 operator*(const cuvec4& rhs) const; //elementwise product
@ -33,14 +33,14 @@ double m03,m13,m23,m33;
const double& _m30, const double& _m31, const double& _m32, const double& _m33
);
__host__ __device__ cumat4(const double* data16);
__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__ double* data(); //pointer to float16 representation of matrix
__host__ __device__ const double* data() const; //pointer to float16 representation of matrix
__host__ __device__ double& operator[](const int &I);
__host__ __device__ const double& operator[](const int &I) const;
__host__ __device__ double& operator()(const int &I, const int &J);
__host__ __device__ const double& operator()(const int &I, const int &J) const;
__host__ __device__ double& at(const int &I, const int &J);
__host__ __device__ const double& at(const int &I, const int &J) const;
__host__ __device__ double* data(); //pointer to double16 representation of matrix
__host__ __device__ const double* data() const; //pointer to double16 representation of matrix
__host__ __device__ cumat4 operator+(const cumat4& rhs) const;
__host__ __device__ cumat4 operator-(const cumat4& rhs) const;
__host__ __device__ cumat4 operator*(const cumat4& rhs) const;

View File

@ -16,7 +16,7 @@
return;
}
__host__ __device__ float& cuvec4i::operator[](const int &I)
__host__ __device__ int& cuvec4i::operator[](const int &I)
{
switch(I)
{
@ -33,7 +33,7 @@
return x;
}
__host__ __device__ const float& cuvec4i::operator[](const int &I) const
__host__ __device__ const int& cuvec4i::operator[](const int &I) const
{
switch(I)
{
@ -290,7 +290,7 @@
return;
}
__host__ __device__ float& cumat4i::operator[](const int &I)
__host__ __device__ int& cumat4i::operator[](const int &I)
{
switch(I)
{
@ -331,7 +331,7 @@
return m00;
}
__host__ __device__ const float& cumat4i::operator[](const int &I) const
__host__ __device__ const int& cumat4i::operator[](const int &I) const
{
switch(I)
{
@ -372,22 +372,22 @@
return m00;
}
__host__ __device__ float& cumat4i::operator()(const int &I, const int &J)
__host__ __device__ int& cumat4i::operator()(const int &I, const int &J)
{
return (*this)[I+4*J];
}
__host__ __device__ const float& cumat4i::operator()(const int &I, const int &J) const
__host__ __device__ const int& cumat4i::operator()(const int &I, const int &J) const
{
return (*this)[I+4*J];
}
__host__ __device__ float& cumat4i::at(const int &I, const int &J)
__host__ __device__ int& cumat4i::at(const int &I, const int &J)
{
return (*this)[I+4*J];
}
__host__ __device__ const float& cumat4i::at(const int &I, const int &J) const
__host__ __device__ const int& cumat4i::at(const int &I, const int &J) const
{
return (*this)[I+4*J];
}

View File

@ -1,8 +1,8 @@
__host__ __device__ cuvec4i();
__host__ __device__ ~cuvec4i();
__host__ __device__ cuvec4i(const int &_x, const int &_y, const int &_z, const int &_w);
__host__ __device__ float& operator[](const int &I);
__host__ __device__ const float& operator[](const int &I) const;
__host__ __device__ int& operator[](const int &I);
__host__ __device__ const int& operator[](const int &I) const;
__host__ __device__ cuvec4i operator+(const cuvec4i& rhs) const;
__host__ __device__ cuvec4i operator-(const cuvec4i& rhs) const;
__host__ __device__ cuvec4i operator*(const cuvec4i& rhs) const; //elementwise product
@ -33,14 +33,14 @@ int m03,m13,m23,m33;
const int& _m30, const int& _m31, const int& _m32, const int& _m33
);
__host__ __device__ cumat4i(const int* data16);
__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__ int* data(); //pointer to float16 representation of matrix
__host__ __device__ const int* data() const; //pointer to float16 representation of matrix
__host__ __device__ int& operator[](const int &I);
__host__ __device__ const int& operator[](const int &I) const;
__host__ __device__ int& operator()(const int &I, const int &J);
__host__ __device__ const int& operator()(const int &I, const int &J) const;
__host__ __device__ int& at(const int &I, const int &J);
__host__ __device__ const int& at(const int &I, const int &J) const;
__host__ __device__ int* data(); //pointer to int16 representation of matrix
__host__ __device__ const int* data() const; //pointer to int16 representation of matrix
__host__ __device__ cumat4i operator+(const cumat4i& rhs) const;
__host__ __device__ cumat4i operator-(const cumat4i& rhs) const;
__host__ __device__ cumat4i operator*(const cumat4i& rhs) const;