/*
	AUTOMATICALLY GENERATED FILE - DO NOT EDIT!
	Please change MatrixNxN.py and re-run it
*/
/* Generated with ./MatrixNxN.py n = 2, TYPE = float */

#include "ZUnitTest.hpp"
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <SST/SST_Mat22.h>
#include <SST/SST_Vec2.h>




static const char* testSST_Math_Mat22fAdd();
static const char* testSST_Math_Mat22fAddLocal();
static const char* testSST_Math_Mat22fSubtract();
static const char* testSST_Math_Mat22fSubtractLocal();
static const char* testSST_Math_Mat22fMultiplyElementwise();
static const char* testSST_Math_Mat22fMultiplyElementwiseLocal();
static const char* testSST_Math_Mat22fMultiplyScalar();
static const char* testSST_Math_Mat22fMultiplyScalarLocal();
static const char* testSST_Math_Mat22fMultiplyMatrix();
static const char* testSST_Math_Mat22fMultiplyMatrixLocal();
static const char* testSST_Math_Mat22fMultiplyVector();
static const char* testSST_Math_Mat22fMultiplyVectorLocal();
static const char* testSST_Math_Mat22fTranspose();
static const char* testSST_Math_Mat22fTransposeLocal();
static const char* testSST_Math_Mat22fDeterminant();
static const char* testSST_Math_Mat22fCheckOrthonormal();
static const char* testSST_Math_Mat22fInvert();
static const char* testSST_Math_Mat22fInvertLocal();
static const char* testSST_Math_Mat22fCreateLU();
static const char* testSST_Math_Mat22fCreateLULocal();
static const char* testSST_Math_Mat22fApplyLUMat();
static const char* testSST_Math_Mat22fApplyLUMatLocal();
static const char* testSST_Math_Mat22fApplyLUVec();
static const char* testSST_Math_Mat22fApplyLUVecLocal();
// List of unit tests 
ZUnitTest SST_Math_Mat22fUnitTests[] = 
{
{ "testSST_Math_Mat22fAdd                       " , testSST_Math_Mat22fAdd                        },
{ "testSST_Math_Mat22fAddLocal                  " , testSST_Math_Mat22fAddLocal                   },
{ "testSST_Math_Mat22fSubtract                  " , testSST_Math_Mat22fSubtract                   },
{ "testSST_Math_Mat22fSubtractLocal             " , testSST_Math_Mat22fSubtractLocal              },
{ "testSST_Math_Mat22fMultiplyElementwise       " , testSST_Math_Mat22fMultiplyElementwise        },
{ "testSST_Math_Mat22fMultiplyElementwiseLocal  " , testSST_Math_Mat22fMultiplyElementwiseLocal   },
{ "testSST_Math_Mat22fMultiplyScalar            " , testSST_Math_Mat22fMultiplyScalar             },
{ "testSST_Math_Mat22fMultiplyScalarLocal       " , testSST_Math_Mat22fMultiplyScalarLocal        },
{ "testSST_Math_Mat22fMultiplyMatrix            " , testSST_Math_Mat22fMultiplyMatrix             },
{ "testSST_Math_Mat22fMultiplyMatrixLocal       " , testSST_Math_Mat22fMultiplyMatrixLocal        },
{ "testSST_Math_Mat22fMultiplyVector            " , testSST_Math_Mat22fMultiplyVector             },
{ "testSST_Math_Mat22fMultiplyVectorLocal       " , testSST_Math_Mat22fMultiplyVectorLocal        },
{ "testSST_Math_Mat22fDeterminant               " , testSST_Math_Mat22fDeterminant                },
{ "testSST_Math_Mat22fCheckOrthonormal          " , testSST_Math_Mat22fCheckOrthonormal           },
{ "testSST_Math_Mat22fInvert                    " , testSST_Math_Mat22fInvert                     },
{ "testSST_Math_Mat22fInvertLocal               " , testSST_Math_Mat22fInvertLocal                },
{ "testSST_Math_Mat22fCreateLU                  " , testSST_Math_Mat22fCreateLU                   },
{ "testSST_Math_Mat22fCreateLULocal             " , testSST_Math_Mat22fCreateLULocal              },
{ "testSST_Math_Mat22fApplyLUMat                " , testSST_Math_Mat22fApplyLUMat                 },
{ "testSST_Math_Mat22fApplyLUMatLocal           " , testSST_Math_Mat22fApplyLUMatLocal            },
{ "testSST_Math_Mat22fApplyLUVec                " , testSST_Math_Mat22fApplyLUVec                 },
{ "testSST_Math_Mat22fApplyLUVecLocal           " , testSST_Math_Mat22fApplyLUVecLocal            },
{ "testSST_Math_Mat22fTranspose                 " , testSST_Math_Mat22fTranspose                  },
{ "testSST_Math_Mat22fTransposeLocal            " , testSST_Math_Mat22fTransposeLocal             }
};
DECLARE_ZTESTBLOCK(SST_Math_Mat22f)

/******************************************************************************/

static const char* testSST_Math_Mat22fAdd(){
    SST_Mat22f X; /* 2 x 2 matrix */
    SST_Mat22f Y; /* 2 x 2 matrix */
    SST_Mat22f A; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
    X.v[0] = 1.000000f;
    X.v[1] = 19.000000f;
    X.v[2] = 3.000000f;
    X.v[3] = -13.000000f;
    Y.v[0] = -13.000000f;
    Y.v[1] = -4.000000f;
    Y.v[2] = -18.000000f;
    Y.v[3] = 19.000000f;
/*
[[  1.   3.]
 [ 19. -13.]]
[[-13. -18.]
 [ -4.  19.]]
[[-12. -15.]
 [ 15.   6.]]
*/
    SST_Math_Mat22fAdd(&X,&Y,&A);
    TASSERT(fabsf((A.v[0])-(-12.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a11 failed!");
    TASSERT(fabsf((A.v[2])-(-15.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a12 failed!");
    TASSERT(fabsf((A.v[1])-(15.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a21 failed!");
    TASSERT(fabsf((A.v[3])-(6.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a22 failed!");
    return ZTEST_SUCCESS;
}

/******************************************************************************/

static const char* testSST_Math_Mat22fAddLocal(){
    SST_Mat22f X; /* 2 x 2 matrix */
    SST_Mat22f Y; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
    X.v[0] = -16.000000f;
    X.v[1] = 15.000000f;
    X.v[2] = 16.000000f;
    X.v[3] = 9.000000f;
    Y.v[0] = 12.000000f;
    Y.v[1] = -11.000000f;
    Y.v[2] = 6.000000f;
    Y.v[3] = 6.000000f;
/*
[[-16.  16.]
 [ 15.   9.]]
[[ 12.   6.]
 [-11.   6.]]
[[ -4.  22.]
 [  4.  15.]]
*/
    SST_Math_Mat22fAddLocal(&X,&Y); /* for accuracy */
    TASSERT(fabsf((X.v[0])-(-4.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a11 failed!");
    TASSERT(fabsf((X.v[2])-(22.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a12 failed!");
    TASSERT(fabsf((X.v[1])-(4.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a21 failed!");
    TASSERT(fabsf((X.v[3])-(15.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a22 failed!");
    return ZTEST_SUCCESS;
}

/******************************************************************************/

static const char* testSST_Math_Mat22fSubtract(){
    SST_Mat22f X; /* 2 x 2 matrix */
    SST_Mat22f Y; /* 2 x 2 matrix */
    SST_Mat22f A; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
    X.v[0] = -17.000000f;
    X.v[1] = 0.000000f;
    X.v[2] = -20.000000f;
    X.v[3] = -13.000000f;
    Y.v[0] = -15.000000f;
    Y.v[1] = 9.000000f;
    Y.v[2] = -19.000000f;
    Y.v[3] = -6.000000f;
/*
[[-17. -20.]
 [  0. -13.]]
[[-15. -19.]
 [  9.  -6.]]
[[-2. -1.]
 [-9. -7.]]
*/
    SST_Math_Mat22fSubtract(&X,&Y,&A);
    TASSERT(fabsf((A.v[0])-(-2.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a11 failed!");
    TASSERT(fabsf((A.v[2])-(-1.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a12 failed!");
    TASSERT(fabsf((A.v[1])-(-9.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a21 failed!");
    TASSERT(fabsf((A.v[3])-(-7.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a22 failed!");
    return ZTEST_SUCCESS;
}

/******************************************************************************/

static const char* testSST_Math_Mat22fSubtractLocal(){
    SST_Mat22f X; /* 2 x 2 matrix */
    SST_Mat22f Y; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
    X.v[0] = -3.000000f;
    X.v[1] = -20.000000f;
    X.v[2] = -3.000000f;
    X.v[3] = 2.000000f;
    Y.v[0] = 17.000000f;
    Y.v[1] = -16.000000f;
    Y.v[2] = -14.000000f;
    Y.v[3] = 8.000000f;
/*
[[ -3.  -3.]
 [-20.   2.]]
[[ 17. -14.]
 [-16.   8.]]
[[-20.  11.]
 [ -4.  -6.]]
*/
    SST_Math_Mat22fSubtractLocal(&X,&Y); /* for accuracy */
    TASSERT(fabsf((X.v[0])-(-20.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a11 failed!");
    TASSERT(fabsf((X.v[2])-(11.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a12 failed!");
    TASSERT(fabsf((X.v[1])-(-4.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a21 failed!");
    TASSERT(fabsf((X.v[3])-(-6.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a22 failed!");
    return ZTEST_SUCCESS;
}

/******************************************************************************/

static const char* testSST_Math_Mat22fMultiplyElementwise(){
    SST_Mat22f X; /* 2 x 2 matrix */
    SST_Mat22f Y; /* 2 x 2 matrix */
    SST_Mat22f A; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
    X.v[0] = -8.000000f;
    X.v[1] = -16.000000f;
    X.v[2] = -17.000000f;
    X.v[3] = 8.000000f;
    Y.v[0] = -7.000000f;
    Y.v[1] = -8.000000f;
    Y.v[2] = -5.000000f;
    Y.v[3] = -16.000000f;
/*
[[ -8. -17.]
 [-16.   8.]]
[[ -7.  -5.]
 [ -8. -16.]]
[[  56.   85.]
 [ 128. -128.]]
*/
    SST_Math_Mat22fMultiplyElementwise(&X, &Y, &A);
    TASSERT(fabsf((A.v[0])-(56.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a11 failed!");
    TASSERT(fabsf((A.v[2])-(85.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a12 failed!");
    TASSERT(fabsf((A.v[1])-(128.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a21 failed!");
    TASSERT(fabsf((A.v[3])-(-128.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a22 failed!");
    return ZTEST_SUCCESS;
}

/******************************************************************************/

static const char* testSST_Math_Mat22fMultiplyElementwiseLocal(){
    SST_Mat22f X; /* 2 x 2 matrix */
    SST_Mat22f Y; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
    X.v[0] = -6.000000f;
    X.v[1] = 16.000000f;
    X.v[2] = -1.000000f;
    X.v[3] = 7.000000f;
    Y.v[0] = 8.000000f;
    Y.v[1] = -1.000000f;
    Y.v[2] = 5.000000f;
    Y.v[3] = -11.000000f;
/*
[[ -6.  -1.]
 [ 16.   7.]]
[[  8.   5.]
 [ -1. -11.]]
[[-48.  -5.]
 [-16. -77.]]
*/
    SST_Math_Mat22fMultiplyElementwiseLocal(&X,&Y);
    TASSERT(fabsf((X.v[0])-(-48.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a11 failed!");
    TASSERT(fabsf((X.v[2])-(-5.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a12 failed!");
    TASSERT(fabsf((X.v[1])-(-16.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a21 failed!");
    TASSERT(fabsf((X.v[3])-(-77.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a22 failed!");
    return ZTEST_SUCCESS;
}

/******************************************************************************/

static const char* testSST_Math_Mat22fMultiplyScalar(){
    SST_Mat22f X; /* 2 x 2 matrix */
    SST_Mat22f A; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
    X.v[0] = 11.000000f;
    X.v[1] = -16.000000f;
    X.v[2] = 12.000000f;
    X.v[3] = -8.000000f;
/*
[[ 11.  12.]
 [-16.  -8.]]
[[ 22.  24.]
 [-32. -16.]]
*/
    SST_Math_Mat22fMultiplyScalar(&X,2.000000f,&A);
    TASSERT(fabsf((A.v[0])-(22.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a11 failed!");
    TASSERT(fabsf((A.v[2])-(24.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a12 failed!");
    TASSERT(fabsf((A.v[1])-(-32.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a21 failed!");
    TASSERT(fabsf((A.v[3])-(-16.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a22 failed!");
    return ZTEST_SUCCESS;
}

/******************************************************************************/

static const char* testSST_Math_Mat22fMultiplyScalarLocal(){
    SST_Mat22f X; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
    X.v[0] = 19.000000f;
    X.v[1] = -6.000000f;
    X.v[2] = 18.000000f;
    X.v[3] = -3.000000f;
/*
[[ 19.  18.]
 [ -6.  -3.]]
[[ 38.  36.]
 [-12.  -6.]]
*/
    SST_Math_Mat22fMultiplyScalarLocal(&X,2.000000f);
    TASSERT(fabsf((X.v[0])-(38.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a11 failed!");
    TASSERT(fabsf((X.v[2])-(36.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a12 failed!");
    TASSERT(fabsf((X.v[1])-(-12.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a21 failed!");
    TASSERT(fabsf((X.v[3])-(-6.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a22 failed!");
    return ZTEST_SUCCESS;
}

/******************************************************************************/

static const char* testSST_Math_Mat22fMultiplyMatrix(){
    SST_Mat22f X; /* 2 x 2 matrix */
    SST_Mat22f Y; /* 2 x 2 matrix */
    SST_Mat22f A; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
    X.v[0] = -6.000000f;
    X.v[1] = -17.000000f;
    X.v[2] = 1.000000f;
    X.v[3] = 1.000000f;
    Y.v[0] = -7.000000f;
    Y.v[1] = 18.000000f;
    Y.v[2] = 19.000000f;
    Y.v[3] = 13.000000f;
/*
X
[[ -6.   1.]
 [-17.   1.]]
Y
[[ -7.  19.]
 [ 18.  13.]]
[[  60. -101.]
 [ 137. -310.]]
*/
    SST_Math_Mat22fMultiplyMatrix(&X,&Y,&A);
    TASSERT(fabsf((A.v[0])-(60.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a11 failed!");
    TASSERT(fabsf((A.v[2])-(-101.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a12 failed!");
    TASSERT(fabsf((A.v[1])-(137.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a21 failed!");
    TASSERT(fabsf((A.v[3])-(-310.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a22 failed!");
    return ZTEST_SUCCESS;
}

/******************************************************************************/

static const char* testSST_Math_Mat22fMultiplyMatrixLocal(){
    SST_Mat22f X; /* 2 x 2 matrix */
    SST_Mat22f Y; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
    X.v[0] = 15.000000f;
    X.v[1] = -15.000000f;
    X.v[2] = -1.000000f;
    X.v[3] = -2.000000f;
    Y.v[0] = -15.000000f;
    Y.v[1] = -16.000000f;
    Y.v[2] = -7.000000f;
    Y.v[3] = 7.000000f;
/*
X
[[ 15.  -1.]
 [-15.  -2.]]
Y
[[-15.  -7.]
 [-16.   7.]]
X
[[-209. -112.]
 [ 257.   91.]]
*/
    SST_Math_Mat22fMultiplyMatrixLocal(&X,&Y);
    TASSERT(fabsf((X.v[0])-(-209.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a11 failed!");
    TASSERT(fabsf((X.v[2])-(-112.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a12 failed!");
    TASSERT(fabsf((X.v[1])-(257.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a21 failed!");
    TASSERT(fabsf((X.v[3])-(91.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a22 failed!");
    return ZTEST_SUCCESS;
}

/******************************************************************************/

static const char* testSST_Math_Mat22fMultiplyVector(){
    SST_Mat22f X; /* 2 x 2 matrix */
    SST_Vec2f v; /* 2 vector */
    SST_Vec2f w; /* 2 vector */
/* Resetting test vectors / mats */
    v.v[0] = -14.000000f;
    v.v[1] = -14.000000f;
    X.v[0] = 10.000000f;
    X.v[1] = -8.000000f;
    X.v[2] = 13.000000f;
    X.v[3] = -9.000000f;
/*
X
[[ 10.  13.]
 [ -8.  -9.]]
v
[-14. -14.]
w
[-322.  238.]
*/
    SST_Math_Mat22fMultiplyVector(&X,&v,&w);
    TASSERT(fabsf((w.v[0])-(-322.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry .v[0] failed!");
    TASSERT(fabsf((w.v[1])-(238.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry .v[1] failed!");
    return ZTEST_SUCCESS;
}

/******************************************************************************/

static const char* testSST_Math_Mat22fMultiplyVectorLocal(){
    SST_Mat22f X; /* 2 x 2 matrix */
    SST_Vec2f v; /* 2 vector */
/* Resetting test vectors / mats */
    v.v[0] = 10.000000f;
    v.v[1] = 18.000000f;
    X.v[0] = -14.000000f;
    X.v[1] = 10.000000f;
    X.v[2] = 17.000000f;
    X.v[3] = -15.000000f;
/*
X
[[-14.  17.]
 [ 10. -15.]]
v
[ 10.  18.]
v
[ 166. -170.]
*/
    SST_Math_Mat22fMultiplyVectorLocal(&X,&v);
    TASSERT(fabsf((v.v[0])-(166.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry .v[0] failed!");
    TASSERT(fabsf((v.v[1])-(-170.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry .v[1] failed!");
    return ZTEST_SUCCESS;
}

/******************************************************************************/

static const char* testSST_Math_Mat22fTranspose(){
    SST_Mat22f X; /* 2 x 2 matrix */
    SST_Mat22f A; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
    X.v[0] = -14.000000f;
    X.v[1] = -9.000000f;
    X.v[2] = 11.000000f;
    X.v[3] = -5.000000f;
    SST_Math_Mat22fTranspose(&X,&A);
    TASSERT(fabsf((A.v[0])-(-14.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a11 failed!");
    TASSERT(fabsf((A.v[2])-(-9.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a12 failed!");
    TASSERT(fabsf((A.v[1])-(11.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a21 failed!");
    TASSERT(fabsf((A.v[3])-(-5.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a22 failed!");
    return ZTEST_SUCCESS;
}

/******************************************************************************/

static const char* testSST_Math_Mat22fTransposeLocal(){
    SST_Mat22f X; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
    X.v[0] = -17.000000f;
    X.v[1] = 14.000000f;
    X.v[2] = 17.000000f;
    X.v[3] = -1.000000f;
    SST_Math_Mat22fTransposeLocal(&X);
    TASSERT(fabsf((X.v[0])-(-17.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a11 failed!");
    TASSERT(fabsf((X.v[2])-(14.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a12 failed!");
    TASSERT(fabsf((X.v[1])-(17.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a21 failed!");
    TASSERT(fabsf((X.v[3])-(-1.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a22 failed!");
    return ZTEST_SUCCESS;
}

/******************************************************************************/

static const char* testSST_Math_Mat22fCheckOrthonormal(){
    SST_Mat22f X; /* 2 x 2 matrix */
    SST_Mat22f Y; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
    X.v[0] = -19.000000f;
    X.v[1] = 2.000000f;
    X.v[2] = -10.000000f;
    X.v[3] = -3.000000f;
    Y.v[0] = 12.000000f;
    Y.v[1] = -18.000000f;
    Y.v[2] = 1.000000f;
    Y.v[3] = -3.000000f;
/*
[[-0.99450547  0.10468479]
 [ 0.10468479  0.99450547]]
[[ 1.  0.]
 [ 0.  1.]]
*/
/* Set X to orthogonal matrix Q */
    X.v[0] = (float)-0.994505f;
    X.v[1] = (float)0.104685f;
    X.v[2] = (float)0.104685f;
    X.v[3] = (float)0.994505f;
/* Check Positive Test */
    TASSERT(SST_Math_Mat22fCheckOrthonormal(&X),"CheckOrthonormal failed when it should have passed");
/* Check Negative Test */
    TASSERT(!SST_Math_Mat22fCheckOrthonormal(&Y),"CheckOrthonormal succeeded when it should have failed");
    return ZTEST_SUCCESS;
}

/******************************************************************************/

static const char* testSST_Math_Mat22fDeterminant(){
    SST_Mat22f X; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
    X.v[0] = -16.000000f;
    X.v[1] = -6.000000f;
    X.v[2] = 11.000000f;
    X.v[3] = -15.000000f;
/* det(X) = 
306.0
 */
    float result = SST_Math_Mat22fDeterminant(&X);
    TASSERT(fabsf( (result)/(306.000000f) - 1.000000f ) <= 100*FLT_EPSILON,"Determinant failed!");
    return ZTEST_SUCCESS;
}

/******************************************************************************/

static const char* testSST_Math_Mat22fInvert(){
    SST_Mat22f X; /* 2 x 2 matrix */
    SST_Mat22f B; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
    X.v[0] = 11.000000f;
    X.v[1] = -16.000000f;
    X.v[2] = 7.000000f;
    X.v[3] = -1.000000f;
/*
[[-0.00990099 -0.06930693]
 [ 0.15841584  0.10891089]]
*/
    SST_Math_Mat22fInvert(&X,&B);
    TASSERT(fabsf((B.v[0])-(-0.009901f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a11 failed!");
    TASSERT(fabsf((B.v[1])-(0.158416f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a21 failed!");
    TASSERT(fabsf((B.v[2])-(-0.069307f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a12 failed!");
    TASSERT(fabsf((B.v[3])-(0.108911f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a22 failed!");
    return ZTEST_SUCCESS;
}

/******************************************************************************/

static const char* testSST_Math_Mat22fInvertLocal(){
    SST_Mat22f X; /* 2 x 2 matrix */
/* Resetting test vectors / mats */
    X.v[0] = -2.000000f;
    X.v[1] = 1.000000f;
    X.v[2] = 14.000000f;
    X.v[3] = -4.000000f;
/*
()
[[ 0.66666669  2.33333325]
 [ 0.16666667  0.33333334]]
*/
    SST_Math_Mat22fInvertLocal(&X);
    TASSERT(fabsf((X.v[0])-(0.666667f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a11 failed!");
    TASSERT(fabsf((X.v[1])-(0.166667f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a21 failed!");
    TASSERT(fabsf((X.v[2])-(2.333333f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a12 failed!");
    TASSERT(fabsf((X.v[3])-(0.333333f)) <=100*FLT_EPSILON /* yes this is bad */,"Entry _a22 failed!");
    return ZTEST_SUCCESS;
}

/******************************************************************************/

static const char* testSST_Math_Mat22fCreateLU(){
    SST_Mat22f X; /* 2 x 2 matrix */
    SST_Mat22f LU; /* 2 x 2 matrix */
    X.v[0] = 2.000000f;
    X.v[1] = -3.000000f;
    X.v[2] = -1.000000f;
    X.v[3] = 1.000000f;
    SST_Math_Mat22fCreateLU(&X,&LU);
/*
[[ 2 -1]
 [-3  1]]
*/
/*
[[ 2.   0. ]
 [-3.  -0.5]]
*/
/*
[[ 1.  -0.5]
 [ 0.   1. ]]
*/
    TASSERT(fabsf((LU.v[0])-(2.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"L:Entry A_a11 failed!");
    TASSERT(fabsf((LU.v[2])-(-0.500000f)) <=100*FLT_EPSILON /* yes this is bad */,"U:Entry B_a12 failed!");
    TASSERT(fabsf((LU.v[1])-(-3.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"L:Entry A_a21 failed!");
    TASSERT(fabsf((LU.v[3])-(-0.500000f)) <=100*FLT_EPSILON /* yes this is bad */,"L:Entry A_a22 failed!");
    return ZTEST_SUCCESS;
}
static const char* testSST_Math_Mat22fCreateLULocal(){
    SST_Mat22f X; /* 2 x 2 matrix */
    X.v[0] = 2.000000f;
    X.v[1] = -3.000000f;
    X.v[2] = -1.000000f;
    X.v[3] = 1.000000f;
    SST_Math_Mat22fCreateLULocal(&X);
    TASSERT(fabsf((X.v[0])-(2.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"L:Entry A_a11 failed!");
    TASSERT(fabsf((X.v[2])-(-0.500000f)) <=100*FLT_EPSILON /* yes this is bad */,"U:Entry B_a12 failed!");
    TASSERT(fabsf((X.v[1])-(-3.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"L:Entry A_a21 failed!");
    TASSERT(fabsf((X.v[3])-(-0.500000f)) <=100*FLT_EPSILON /* yes this is bad */,"L:Entry A_a22 failed!");
    return ZTEST_SUCCESS;
}
static const char* testSST_Math_Mat22fApplyLUMat(){
    SST_Mat22f X; /* 2 x 2 matrix */
    SST_Mat22f LU; /* 2 x 2 matrix */
    SST_Mat22f I; /* 2 x 2 matrix */
    X.v[0] = 2.000000f;
    X.v[1] = -3.000000f;
    X.v[2] = -1.000000f;
    X.v[3] = 1.000000f;
    SST_Math_Mat22fCreateLU(&X,&LU);
/*
[[ 2 -1]
 [-3  1]]
*/
/*
[[ 2.   0. ]
 [-3.  -0.5]]
*/
/*
[[ 1.  -0.5]
 [ 0.   1. ]]
*/
    TASSERT(fabsf((LU.v[0])-(2.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"L:Entry A_a11 failed!");
    TASSERT(fabsf((LU.v[2])-(-0.500000f)) <=100*FLT_EPSILON /* yes this is bad */,"U:Entry B_a12 failed!");
    TASSERT(fabsf((LU.v[1])-(-3.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"L:Entry A_a21 failed!");
    TASSERT(fabsf((LU.v[3])-(-0.500000f)) <=100*FLT_EPSILON /* yes this is bad */,"L:Entry A_a22 failed!");
    SST_Math_Mat22fApplyLUMat(&LU,&X,&I);
    TASSERT(fabsf((I.v[0])-(1.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"I:Entry I_a11 failed!");
    TASSERT(fabsf((I.v[1])-(0.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"I:Entry I_a21 failed!");
    TASSERT(fabsf((I.v[2])-(0.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"I:Entry I_a12 failed!");
    TASSERT(fabsf((I.v[3])-(1.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"I:Entry I_a22 failed!");
    return ZTEST_SUCCESS;
}
static const char* testSST_Math_Mat22fApplyLUMatLocal(){
    SST_Mat22f X; /* 2 x 2 matrix */
    SST_Mat22f Xinv; /* 2 x 2 matrix */
    X.v[0] = 2.000000f;
    X.v[1] = -3.000000f;
    X.v[2] = -1.000000f;
    X.v[3] = 1.000000f;
    Xinv.v[0] = 2.000000f;
    Xinv.v[1] = -3.000000f;
    Xinv.v[2] = -1.000000f;
    Xinv.v[3] = 1.000000f;
    SST_Math_Mat22fCreateLULocal(&X);
    TASSERT(fabsf((X.v[0])-(2.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"L:Entry A_a11 failed!");
    TASSERT(fabsf((X.v[2])-(-0.500000f)) <=100*FLT_EPSILON /* yes this is bad */,"U:Entry B_a12 failed!");
    TASSERT(fabsf((X.v[1])-(-3.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"L:Entry A_a21 failed!");
    TASSERT(fabsf((X.v[3])-(-0.500000f)) <=100*FLT_EPSILON /* yes this is bad */,"L:Entry A_a22 failed!");
    SST_Math_Mat22fApplyLUMatLocal(&X,&Xinv);
    TASSERT(fabsf((Xinv.v[0])-(1.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Xinv:Entry Xinv_a11 failed!");
    TASSERT(fabsf((Xinv.v[1])-(0.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Xinv:Entry Xinv_a21 failed!");
    TASSERT(fabsf((Xinv.v[2])-(0.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Xinv:Entry Xinv_a12 failed!");
    TASSERT(fabsf((Xinv.v[3])-(1.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"Xinv:Entry Xinv_a22 failed!");
    return ZTEST_SUCCESS;
}
static const char* testSST_Math_Mat22fApplyLUVec(){
    SST_Mat22f X; /* 2 x 2 matrix */
    SST_Mat22f LU; /* 2 x 2 matrix */
    SST_Vec2f b; /* 2 x 2 vector */
    SST_Vec2f x; /* 2 x 2 vector */
    X.v[0] = 2.000000f;
    X.v[1] = -3.000000f;
    X.v[2] = -1.000000f;
    X.v[3] = 1.000000f;
    b.v[0] = 2.000000f;
    b.v[1] = -1.000000f;
    SST_Math_Mat22fCreateLU(&X,&LU);
    SST_Math_Mat22fApplyLUVec(&LU,&b,&x);
    TASSERT(fabsf((x.v[0])-(-1.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"x:Entry x_a1 failed!");
    TASSERT(fabsf((x.v[1])-(-4.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"x:Entry x_a2 failed!");
    return ZTEST_SUCCESS;
}
static const char* testSST_Math_Mat22fApplyLUVecLocal(){
    SST_Mat22f X; /* 2 x 2 matrix */
    SST_Mat22f LU; /* 2 x 2 matrix */
    SST_Vec2f b; /* 2 x 2 vector */
    X.v[0] = 2.000000f;
    X.v[1] = -3.000000f;
    X.v[2] = -1.000000f;
    X.v[3] = 1.000000f;
    b.v[0] = 2.000000f;
    b.v[1] = -1.000000f;
    SST_Math_Mat22fCreateLU(&X,&LU);
    SST_Math_Mat22fApplyLUVecLocal(&LU,&b);
    TASSERT(fabsf((b.v[0])-(-1.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"x:Entry x_a1 failed!");
    TASSERT(fabsf((b.v[1])-(-4.000000f)) <=100*FLT_EPSILON /* yes this is bad */,"x:Entry x_a2 failed!");
    return ZTEST_SUCCESS;
}
