update cumat3f constructor

This commit is contained in:
2026-04-09 15:20:32 -04:00
parent 61f45c6b88
commit b40bdce4c0
8 changed files with 52 additions and 5 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -45,6 +45,8 @@ namespace amscuda
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);
@ -65,8 +67,8 @@ namespace amscuda
__host__ __device__ cumat2f transpose();
__host__ __device__ cumat2f inverse();
__host__ __device__ float* data(); //pointer to float[9] representation of matrix
__host__ __device__ const float* data() const; //pointer to float[9] representation of matrix
__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);
@ -82,10 +84,21 @@ namespace amscuda
__host__ __device__ cuvect2f cuvect2f_normalize(const cuvect2f &a);
__host__ __device__ cuvect2f cuvect2f_proj(const cuvect2f &a, const cuvect2f &b);
__host__ __device__ cumat2f mat2f_rot_from_angle(const cuvect3f &axis, const float &angle);
__host__ __device__ cumat2f cumat2f_rot_from_angle(const float &angle);
///////////
// Tests //
///////////
void test_cuvect2f_1();
///////////////////////////
//legacy array operations//
///////////////////////////
//2x2 matrix operations
//matrix order is assumed to be mat[I,J] = mat[I+3*J]
//matrix order is assumed to be mat[I,J] = mat[I+2*J]
//transpose a 2x2 matrix in place
__host__ __device__ void mat2f_transpose(float *mat2inout);
@ -106,7 +119,7 @@ namespace amscuda
__host__ __device__ cuvect2f mat2f_mult(float *mat2a, const cuvect2f &b);
void test_cuvect2f_1();
};

View File

@ -47,6 +47,9 @@ namespace amscuda
const float & _m20, const float & _m21, const float & _m22
);
__host__ __device__ explicit cumat3f(const float *data9);
__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);

View File

@ -421,7 +421,24 @@ namespace amscuda
return (const float*) this;
}
__host__ __device__ cumat2f::cumat2f(const float* data2x2)
{
m00 = data2x2[0];
m10 = data2x2[1];
m01 = data2x2[2];
m11 = data2x2[3];
return;
}
__host__ __device__ cumat2f cumat2f_rot_from_angle(const float &angle)
{
cumat2f R;
R(0,0) = ::cosf(angle);
R(1,0) = ::sinf(angle);
R(0,1) = -::sinf(angle);
R(1,1) = ::cosf(angle);
return R;
}
///////////////////////////
//legacy array operations//

View File

@ -191,6 +191,20 @@ __host__ __device__ cumat3f::~cumat3f()
return;
}
__host__ __device__ cumat3f::cumat3f(const float *data9)
{
m00 = data9[0];
m10 = data9[1];
m20 = data9[2];
m01 = data9[3];
m11 = data9[4];
m21 = data9[5];
m02 = data9[6];
m12 = data9[7];
m22 = data9[8];
return;
}
__host__ __device__ float& cumat3f::operator[](const int &I)
{
if(I==0) return m00;