updated vector operators

This commit is contained in:
2026-02-20 14:20:30 -05:00
parent f09503abed
commit c28886164e
30 changed files with 55 additions and 2 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -42,6 +42,7 @@ namespace amscuda
__host__ __device__ cumat2 operator/(double lhs);
__host__ __device__ cuvect2 operator*(cuvect2 lhs);
__host__ __device__ cumat2 operator*(cumat2 lhs);
__host__ __device__ friend cumat2 operator-(cumat2 rhs);
__host__ __device__ double det();
__host__ __device__ cumat2 transpose();

View File

@ -42,6 +42,7 @@ namespace amscuda
__host__ __device__ cumat2f operator/(float lhs);
__host__ __device__ cuvect2f operator*(cuvect2f lhs);
__host__ __device__ cumat2f operator*(cumat2f lhs);
__host__ __device__ friend cumat2f operator-(cumat2f rhs);
__host__ __device__ float det();
__host__ __device__ cumat2f transpose();

View File

@ -43,6 +43,7 @@ namespace amscuda
__host__ __device__ cumat3 operator/(double lhs);
__host__ __device__ cuvect3 operator*(cuvect3 lhs);
__host__ __device__ cumat3 operator*(cumat3 lhs);
__host__ __device__ friend cumat3 operator-(cumat3 rhs);
__host__ __device__ double det();
__host__ __device__ cumat3 transpose();

View File

@ -43,10 +43,12 @@ namespace amscuda
__host__ __device__ cumat3f operator/(float lhs);
__host__ __device__ cuvect3f operator*(cuvect3f lhs);
__host__ __device__ cumat3f operator*(cumat3f lhs);
__host__ __device__ friend cumat3f operator-(cumat3f rhs);
__host__ __device__ float det();
__host__ __device__ cumat3f transpose();
__host__ __device__ cumat3f inverse();
};
__host__ __device__ float cuvect3f_dot(cuvect3f a, cuvect3f b);

View File

@ -43,6 +43,7 @@ namespace amscuda
__host__ __device__ cumat4 operator/(double lhs);
__host__ __device__ cuvect4 operator*(cuvect4 lhs);
__host__ __device__ cumat4 operator*(cumat4 lhs);
__host__ __device__ friend cumat4 operator-(cumat4 rhs);
__host__ __device__ double det();
__host__ __device__ cumat4 transpose();

View File

@ -43,6 +43,7 @@ namespace amscuda
__host__ __device__ cumat4f operator/(float lhs);
__host__ __device__ cuvect4f operator*(cuvect4f lhs);
__host__ __device__ cumat4f operator*(cumat4f lhs);
__host__ __device__ friend cumat4f operator-(cumat4f rhs);
__host__ __device__ float det();
__host__ __device__ cumat4f transpose();

View File

@ -359,6 +359,14 @@ __host__ __device__ cuvect2 operator-(cuvect2 rhs)
return ret;
}
__host__ __device__ cumat2 operator-(cumat2 rhs)
{
cumat2 ret;
int I;
for(I=0;I<4;I++) ret[I] = -rhs[I];
return ret;
}
void test_cuvect2_1()
{

View File

@ -359,6 +359,14 @@ __host__ __device__ cuvect2f operator-(cuvect2f rhs)
return ret;
}
__host__ __device__ cumat2f operator-(cumat2f rhs)
{
cumat2f ret;
int I;
for(I=0;I<4;I++) ret[I] = -rhs[I];
return ret;
}
void test_cuvect2f_1()
{

View File

@ -587,6 +587,12 @@ __host__ __device__ cuvect3 operator-(cuvect3 rhs)
return ret;
}
__host__ __device__ cumat3 operator-(cumat3 rhs)
{
cumat3 ret;
int I;
for(I=0;I<9;I++) ret[I] = -rhs[I];
return ret;
}
};

View File

@ -587,4 +587,12 @@ __host__ __device__ cuvect3f operator-(cuvect3f rhs)
return ret;
}
__host__ __device__ cumat3f operator-(cumat3f rhs)
{
cumat3f ret;
int I;
for(I=0;I<9;I++) ret[I] = -rhs[I];
return ret;
}
};

View File

@ -420,5 +420,13 @@ __host__ __device__ cuvect4 operator-(cuvect4 rhs)
return ret;
}
__host__ __device__ cumat4 operator-(cumat4 rhs)
{
cumat4 ret;
int I;
for(I=0;I<16;I++) ret[I] = -rhs[I];
return ret;
}
};

View File

@ -424,4 +424,12 @@ __host__ __device__ cuvect4f operator-(cuvect4f rhs)
return ret;
}
__host__ __device__ cumat4f operator-(cumat4f rhs)
{
cumat4f ret;
int I;
for(I=0;I<16;I++) ret[I] = -rhs[I];
return ret;
}
}; //namespace amscuda