Skip to content

Commit

Permalink
added some simple matrix3x3 functions
Browse files Browse the repository at this point in the history
  • Loading branch information
kingofthebongo2008 committed Jul 21, 2020
1 parent 8a9fdc9 commit 1f84260
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions wavelet_spline/include/svd_hlslpp/svd_hlsl_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

#include "svd_hlsl_math.h"

#if defined(__cplusplus)
#include <cmath>
#endif

namespace svdhlslcpp
{
struct matrix3x3
Expand Down Expand Up @@ -109,6 +113,46 @@ namespace svdhlslcpp

return r;
}

#if defined(__cplusplus)
float norm_inf(matrix3x3 b)
{
float r = 0;

r = std::max<float>(std::abs(b.a11), r);
r = std::max<float>(std::abs(b.a12), r);
r = std::max<float>(std::abs(b.a13), r);

r = std::max<float>(std::abs(b.a21), r);
r = std::max<float>(std::abs(b.a22), r);
r = std::max<float>(std::abs(b.a23), r);


r = std::max<float>(std::abs(b.a31), r);
r = std::max<float>(std::abs(b.a32), r);
r = std::max<float>(std::abs(b.a33), r);
return r;
}

matrix3x3 sub(matrix3x3 a, matrix3x3 b)
{
matrix3x3 r;

r.a11 = a.a11 - b.a11;
r.a12 = a.a12 - b.a12;
r.a13 = a.a13 - b.a13;

r.a21 = a.a21 - b.a21;
r.a22 = a.a22 - b.a22;
r.a23 = a.a23 - b.a23;

r.a31 = a.a31 - b.a31;
r.a32 = a.a32 - b.a32;
r.a33 = a.a33 - b.a33;

return r;
}
#endif
}


Expand Down

0 comments on commit 1f84260

Please sign in to comment.