codegenerated matrix logic
This commit is contained in:
@ -176,8 +176,8 @@ namespace amscuda
|
||||
}
|
||||
|
||||
__host__ __device__ cumat2f::cumat2f(
|
||||
const float& _m00, const float& _m10,
|
||||
const float& _m01, const float& _m11
|
||||
const float& _m00, const float& _m01,
|
||||
const float& _m10, const float& _m11
|
||||
)
|
||||
{
|
||||
m00 = _m00;
|
||||
@ -256,165 +256,163 @@ namespace amscuda
|
||||
return (*this)[I+2*J];
|
||||
}
|
||||
|
||||
__host__ __device__ float* cumat2f::data()
|
||||
{
|
||||
return (float*)this;
|
||||
}
|
||||
__host__ __device__ float* cumat2f::data()
|
||||
{
|
||||
return (float*)this;
|
||||
}
|
||||
|
||||
__host__ __device__ const float* cumat2f::data() const
|
||||
{
|
||||
return (float*)this;
|
||||
}
|
||||
__host__ __device__ const float* cumat2f::data() const
|
||||
{
|
||||
return (float*)this;
|
||||
}
|
||||
|
||||
__host__ __device__ cumat2f cumat2f::operator+(const cumat2f& rhs) const
|
||||
{
|
||||
cumat2f ret;
|
||||
ret.m00 = m00 + rhs.m00;
|
||||
ret.m10 = m10 + rhs.m10;
|
||||
__host__ __device__ cumat2f cumat2f::operator+(const cumat2f& rhs) const
|
||||
{
|
||||
cumat2f ret;
|
||||
ret.m00 = m00 + rhs.m00;
|
||||
ret.m10 = m10 + rhs.m10;
|
||||
|
||||
ret.m01 = m01 + rhs.m01;
|
||||
ret.m11 = m11 + rhs.m11;
|
||||
ret.m01 = m01 + rhs.m01;
|
||||
ret.m11 = m11 + rhs.m11;
|
||||
|
||||
return ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
__host__ __device__ cumat2f cumat2f::operator-(const cumat2f& rhs) const
|
||||
{
|
||||
cumat2f ret;
|
||||
ret.m00 = m00 - rhs.m00;
|
||||
ret.m10 = m10 - rhs.m10;
|
||||
__host__ __device__ cumat2f cumat2f::operator-(const cumat2f& rhs) const
|
||||
{
|
||||
cumat2f ret;
|
||||
ret.m00 = m00 - rhs.m00;
|
||||
ret.m10 = m10 - rhs.m10;
|
||||
|
||||
ret.m01 = m01 - rhs.m01;
|
||||
ret.m11 = m11 - rhs.m11;
|
||||
ret.m01 = m01 - rhs.m01;
|
||||
ret.m11 = m11 - rhs.m11;
|
||||
|
||||
return ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
__host__ __device__ cumat2f cumat2f::operator*(const cumat2f& rhs) const
|
||||
{
|
||||
cumat2f ret; //should be zeroed in constructor
|
||||
ret.m00 = m00*rhs.m00 + m01*rhs.m10;
|
||||
ret.m01 = m00*rhs.m01 + m01*rhs.m11;
|
||||
__host__ __device__ cumat2f cumat2f::operator*(const cumat2f& rhs) const
|
||||
{
|
||||
cumat2f ret; //should be zeroed in constructor
|
||||
ret.m00 = m00*rhs.m00 + m01*rhs.m10;
|
||||
ret.m01 = m00*rhs.m01 + m01*rhs.m11;
|
||||
|
||||
ret.m10 = m10*rhs.m00 + m11*rhs.m10;
|
||||
ret.m11 = m10*rhs.m01 + m11*rhs.m11;
|
||||
ret.m10 = m10*rhs.m00 + m11*rhs.m10;
|
||||
ret.m11 = m10*rhs.m01 + m11*rhs.m11;
|
||||
|
||||
return ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
__host__ __device__ cumat2f operator*(const cumat2f& lhs, const float& rhs)
|
||||
{
|
||||
cumat2f ret;
|
||||
ret.m00=lhs.m00*rhs;
|
||||
ret.m10=lhs.m10*rhs;
|
||||
ret.m01=lhs.m01*rhs;
|
||||
ret.m11=lhs.m11*rhs;
|
||||
return ret;
|
||||
}
|
||||
__host__ __device__ cumat2f operator*(const cumat2f& lhs, const float& rhs)
|
||||
{
|
||||
cumat2f ret;
|
||||
ret.m00=lhs.m00*rhs;
|
||||
ret.m10=lhs.m10*rhs;
|
||||
ret.m01=lhs.m01*rhs;
|
||||
ret.m11=lhs.m11*rhs;
|
||||
return ret;
|
||||
}
|
||||
|
||||
__host__ __device__ cumat2f operator/(const cumat2f& lhs, const float& rhs)
|
||||
{
|
||||
cumat2f ret;
|
||||
ret.m00=lhs.m00/rhs;
|
||||
ret.m10=lhs.m10/rhs;
|
||||
ret.m01=lhs.m01/rhs;
|
||||
ret.m11=lhs.m11/rhs;
|
||||
return ret;
|
||||
}
|
||||
__host__ __device__ cumat2f operator/(const cumat2f& lhs, const float& rhs)
|
||||
{
|
||||
cumat2f ret;
|
||||
ret.m00=lhs.m00/rhs;
|
||||
ret.m10=lhs.m10/rhs;
|
||||
ret.m01=lhs.m01/rhs;
|
||||
ret.m11=lhs.m11/rhs;
|
||||
return ret;
|
||||
}
|
||||
|
||||
__host__ __device__ cumat2f operator*(const float& lhs, const cumat2f& rhs)
|
||||
{
|
||||
cumat2f ret;
|
||||
ret.m00=lhs*rhs.m00;
|
||||
ret.m10=lhs*rhs.m10;
|
||||
ret.m01=lhs*rhs.m01;
|
||||
ret.m11=lhs*rhs.m11;
|
||||
return ret;
|
||||
}
|
||||
__host__ __device__ cumat2f operator*(const float& lhs, const cumat2f& rhs)
|
||||
{
|
||||
cumat2f ret;
|
||||
ret.m00=lhs*rhs.m00;
|
||||
ret.m10=lhs*rhs.m10;
|
||||
ret.m01=lhs*rhs.m01;
|
||||
ret.m11=lhs*rhs.m11;
|
||||
return ret;
|
||||
}
|
||||
|
||||
__host__ __device__ cuvec2f operator*(const cumat2f& lhs, const cuvec2f& rhs)
|
||||
{
|
||||
cuvec2f ret;
|
||||
ret.x = lhs.m00*rhs.x + lhs.m01*rhs.y;
|
||||
ret.y = lhs.m10*rhs.x + lhs.m11*rhs.y;
|
||||
return ret;
|
||||
}
|
||||
__host__ __device__ cuvec2f operator*(const cumat2f& lhs, const cuvec2f& rhs)
|
||||
{
|
||||
cuvec2f ret;
|
||||
ret.x = lhs.m00*rhs.x + lhs.m01*rhs.y;
|
||||
ret.y = lhs.m10*rhs.x + lhs.m11*rhs.y;
|
||||
return ret;
|
||||
}
|
||||
|
||||
__host__ __device__ cuvec2f operator*(const cuvec2f& lhs, const cumat2f& rhs)
|
||||
{
|
||||
cuvec2f ret;
|
||||
ret.x = lhs.x*rhs.m00 + lhs.y*rhs.m10;
|
||||
ret.y = lhs.x*rhs.m01 + lhs.y*rhs.m11;
|
||||
return ret;
|
||||
}
|
||||
__host__ __device__ cuvec2f operator*(const cuvec2f& lhs, const cumat2f& rhs)
|
||||
{
|
||||
cuvec2f ret;
|
||||
ret.x = lhs.x*rhs.m00 + lhs.y*rhs.m10;
|
||||
ret.y = lhs.x*rhs.m01 + lhs.y*rhs.m11;
|
||||
return ret;
|
||||
}
|
||||
|
||||
__host__ __device__ cumat2f operator-(const cumat2f& rhs)
|
||||
{
|
||||
cumat2f ret;
|
||||
ret.m00 = -rhs.m00;
|
||||
ret.m10 = -rhs.m10;
|
||||
ret.m01 = -rhs.m01;
|
||||
ret.m11 = -rhs.m11;
|
||||
return ret;
|
||||
}
|
||||
__host__ __device__ cumat2f operator-(const cumat2f& rhs)
|
||||
{
|
||||
cumat2f ret;
|
||||
ret.m00 = -rhs.m00;
|
||||
ret.m10 = -rhs.m10;
|
||||
ret.m01 = -rhs.m01;
|
||||
ret.m11 = -rhs.m11;
|
||||
return ret;
|
||||
}
|
||||
|
||||
__host__ __device__ cumat2f& cumat2f::operator+=(const cumat2f& rhs)
|
||||
{
|
||||
m00 += rhs.m00;
|
||||
m10 += rhs.m10;
|
||||
m01 += rhs.m01;
|
||||
m11 += rhs.m11;
|
||||
return *this;
|
||||
}
|
||||
__host__ __device__ cumat2f& cumat2f::operator+=(const cumat2f& rhs)
|
||||
{
|
||||
m00 += rhs.m00;
|
||||
m10 += rhs.m10;
|
||||
m01 += rhs.m01;
|
||||
m11 += rhs.m11;
|
||||
return *this;
|
||||
}
|
||||
|
||||
__host__ __device__ cumat2f& cumat2f::operator-=(const cumat2f& rhs)
|
||||
{
|
||||
m00 -= rhs.m00;
|
||||
m10 -= rhs.m10;
|
||||
m01 -= rhs.m01;
|
||||
m11 -= rhs.m11;
|
||||
return *this;
|
||||
}
|
||||
__host__ __device__ cumat2f& cumat2f::operator-=(const cumat2f& rhs)
|
||||
{
|
||||
m00 -= rhs.m00;
|
||||
m10 -= rhs.m10;
|
||||
m01 -= rhs.m01;
|
||||
m11 -= rhs.m11;
|
||||
return *this;
|
||||
}
|
||||
|
||||
__host__ __device__ cumat2f& cumat2f::operator*=(const float& rhs)
|
||||
{
|
||||
m00 *= rhs;
|
||||
m10 *= rhs;
|
||||
m01 *= rhs;
|
||||
m11 *= rhs;
|
||||
return *this;
|
||||
}
|
||||
__host__ __device__ cumat2f& cumat2f::operator*=(const float& rhs)
|
||||
{
|
||||
m00 *= rhs;
|
||||
m10 *= rhs;
|
||||
m01 *= rhs;
|
||||
m11 *= rhs;
|
||||
return *this;
|
||||
}
|
||||
|
||||
__host__ __device__ cumat2f& cumat2f::operator/=(const float& rhs)
|
||||
{
|
||||
m00 /= rhs;
|
||||
m10 /= rhs;
|
||||
m01 /= rhs;
|
||||
m11 /= rhs;
|
||||
return *this;
|
||||
}
|
||||
__host__ __device__ cumat2f& cumat2f::operator/=(const float& rhs)
|
||||
{
|
||||
m00 /= rhs;
|
||||
m10 /= rhs;
|
||||
m01 /= rhs;
|
||||
m11 /= rhs;
|
||||
return *this;
|
||||
}
|
||||
|
||||
__host__ __device__ cumat2f& cumat2f::operator*=(const cumat2f& rhs)
|
||||
{
|
||||
cumat2f tmp = *this;
|
||||
m00 = tmp.m00*rhs.m00 + tmp.m01*rhs.m10;
|
||||
m01 = tmp.m00*rhs.m01 + tmp.m01*rhs.m11;
|
||||
m10 = tmp.m10*rhs.m00 + tmp.m11*rhs.m10;
|
||||
m11 = tmp.m10*rhs.m01 + tmp.m11*rhs.m11;
|
||||
return *this;
|
||||
}
|
||||
__host__ __device__ cumat2f& cumat2f::operator*=(const cumat2f& rhs)
|
||||
{
|
||||
cumat2f tmp = *this;
|
||||
m00 = tmp.m00*rhs.m00 + tmp.m01*rhs.m10;
|
||||
m01 = tmp.m00*rhs.m01 + tmp.m01*rhs.m11;
|
||||
m10 = tmp.m10*rhs.m00 + tmp.m11*rhs.m10;
|
||||
m11 = tmp.m10*rhs.m01 + tmp.m11*rhs.m11;
|
||||
return *this;
|
||||
}
|
||||
|
||||
__host__ __device__ cumat2f cumat2f::transpose() const
|
||||
{
|
||||
cumat2f ret;
|
||||
ret.m00 = m00;
|
||||
ret.m10 = m01;
|
||||
ret.m01 = m10;
|
||||
ret.m11 = m11;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
__host__ __device__ cumat2f cumat2f::transpose() const
|
||||
{
|
||||
cumat2f ret;
|
||||
ret.m00 = m00;
|
||||
ret.m10 = m01;
|
||||
ret.m01 = m10;
|
||||
ret.m11 = m11;
|
||||
return ret;
|
||||
}
|
||||
|
||||
///////////////////
|
||||
//Det and Inverse//
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user