|
@ -1,3 +1,33 @@ |
|
|
|
|
|
/**
|
|
|
|
|
|
* @addtogroup testsuite |
|
|
|
|
|
* @{ |
|
|
|
|
|
* @addtogroup matrixtests |
|
|
|
|
|
* @{ |
|
|
|
|
|
* @author Philipp Schoenberger <ph.schoenberger@googlemail.com> |
|
|
|
|
|
* @version 1.0 |
|
|
|
|
|
* |
|
|
|
|
|
* @section LICENSE |
|
|
|
|
|
* |
|
|
|
|
|
* This program is free software; you can redistribute it and/or |
|
|
|
|
|
* modify it under the terms of the GNU General Public License as |
|
|
|
|
|
* published by the Free Software Foundation; either version 2 of |
|
|
|
|
|
* the License, or (at your option) any later version. |
|
|
|
|
|
* |
|
|
|
|
|
* This program is distributed in the hope that it will be useful, but |
|
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
|
|
|
|
* General Public License for more details at |
|
|
|
|
|
* https://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
|
* |
|
|
|
|
|
* @section DESCRIPTION |
|
|
|
|
|
* |
|
|
|
|
|
* This file contains the Trajectory for a bang bang trajectory. |
|
|
|
|
|
* The bang bang trajectory is a trajectory with linear acceleration |
|
|
|
|
|
* phase followed by a direct de-acceleration phase |
|
|
|
|
|
* |
|
|
|
|
|
* The slowest joint is defining the speed of the other joints. |
|
|
|
|
|
* By that all joints start and stop the movement synchronously |
|
|
|
|
|
*/ |
|
|
#include "CppUTest/TestHarness.h"
|
|
|
#include "CppUTest/TestHarness.h"
|
|
|
#include "CppUTest/TestRegistry.h"
|
|
|
#include "CppUTest/TestRegistry.h"
|
|
|
#include "CppUTest/TestOutput.h"
|
|
|
#include "CppUTest/TestOutput.h"
|
|
@ -10,10 +40,18 @@ int testMat [TESTSIZE][TESTSIZE]; |
|
|
int testVec [TESTSIZE]; |
|
|
int testVec [TESTSIZE]; |
|
|
float tolerance = 0.00001f; |
|
|
float tolerance = 0.00001f; |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* testgroup for the matrix class |
|
|
|
|
|
*/ |
|
|
TEST_GROUP(Matrix) |
|
|
TEST_GROUP(Matrix) |
|
|
{ |
|
|
{ |
|
|
|
|
|
/**
|
|
|
|
|
|
* setup for for all test suite |
|
|
|
|
|
* This Function is called before every Test case |
|
|
|
|
|
*/ |
|
|
void setup() |
|
|
void setup() |
|
|
{ |
|
|
{ |
|
|
|
|
|
// initializing the testmatrix
|
|
|
int i = 1; |
|
|
int i = 1; |
|
|
int j = 1; |
|
|
int j = 1; |
|
|
for (int x = 0; x <TESTSIZE ; x++) |
|
|
for (int x = 0; x <TESTSIZE ; x++) |
|
@ -26,13 +64,22 @@ TEST_GROUP(Matrix) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* exit for for all test suite |
|
|
|
|
|
* This Function is called after every Test case |
|
|
|
|
|
*/ |
|
|
void teardown() |
|
|
void teardown() |
|
|
{ |
|
|
{ |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Test the matrix for invert an non identity matrix |
|
|
|
|
|
* with a x rotation |
|
|
|
|
|
*/ |
|
|
TEST(Matrix, vectorInvRotX) |
|
|
TEST(Matrix, vectorInvRotX) |
|
|
{ |
|
|
{ |
|
|
|
|
|
// setup the test matrix to an identity matrix
|
|
|
Mat<float, TESTSIZE> a; |
|
|
Mat<float, TESTSIZE> a; |
|
|
for(int x = 0 ; x < TESTSIZE ; ++x) |
|
|
for(int x = 0 ; x < TESTSIZE ; ++x) |
|
|
{ |
|
|
{ |
|
@ -44,62 +91,70 @@ TEST(Matrix, vectorInvRotX) |
|
|
a(x,x) = val; |
|
|
a(x,x) = val; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// set the rotation matrix to 45 degree in z
|
|
|
a(0,0) = 1.0f; |
|
|
a(0,0) = 1.0f; |
|
|
a(1,1) = cos(45.0f *M_PI/180.0f); |
|
|
a(1,1) = cos(45.0f *M_PI/180.0f); |
|
|
a(1,2) = -sin(45.0f *M_PI/180.0f); |
|
|
a(1,2) = -sin(45.0f *M_PI/180.0f); |
|
|
a(2,2) = cos(45.0f *M_PI/180.0f); |
|
|
a(2,2) = cos(45.0f *M_PI/180.0f); |
|
|
a(2,1) = sin(45.0f *M_PI/180.0f); |
|
|
a(2,1) = sin(45.0f *M_PI/180.0f); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float deg = 45.0f*M_PI/180.0f; |
|
|
float deg = 45.0f*M_PI/180.0f; |
|
|
|
|
|
|
|
|
|
|
|
// check the matrix after setting it up
|
|
|
DOUBLES_EQUAL(1.0f,a(0,0), tolerance); |
|
|
DOUBLES_EQUAL(1.0f,a(0,0), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(0,1), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(0,1), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(0,2), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(0,2), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(0,3), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(0,3), tolerance); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DOUBLES_EQUAL(0.0f,a(1,0), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(1,0), tolerance); |
|
|
DOUBLES_EQUAL(cos(deg),a(1,1), tolerance); |
|
|
DOUBLES_EQUAL(cos(deg),a(1,1), tolerance); |
|
|
DOUBLES_EQUAL(-sin(deg),a(1,2), tolerance); |
|
|
DOUBLES_EQUAL(-sin(deg),a(1,2), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(1,3), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(1,3), tolerance); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DOUBLES_EQUAL(0.0f,a(2,0), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(2,0), tolerance); |
|
|
DOUBLES_EQUAL(sin(deg),a(2,1), tolerance); |
|
|
DOUBLES_EQUAL(sin(deg),a(2,1), tolerance); |
|
|
DOUBLES_EQUAL(cos(deg),a(2,2), tolerance); |
|
|
DOUBLES_EQUAL(cos(deg),a(2,2), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(2,3), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(2,3), tolerance); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DOUBLES_EQUAL(0.0f,a(3,0), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(3,0), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(3,1), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(3,1), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(3,2), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(3,2), tolerance); |
|
|
DOUBLES_EQUAL(1.0f,a(3,3), tolerance); |
|
|
DOUBLES_EQUAL(1.0f,a(3,3), tolerance); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// invert the matrix
|
|
|
a = a.inv(); |
|
|
a = a.inv(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check for the negative angle for a z rotation
|
|
|
deg = -45.0f*M_PI/180.0f; |
|
|
deg = -45.0f*M_PI/180.0f; |
|
|
DOUBLES_EQUAL(1.0f,a(0,0), tolerance); |
|
|
DOUBLES_EQUAL(1.0f,a(0,0), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(0,1), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(0,1), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(0,2), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(0,2), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(0,3), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(0,3), tolerance); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DOUBLES_EQUAL(0.0f,a(1,0), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(1,0), tolerance); |
|
|
DOUBLES_EQUAL(cos(deg),a(1,1), tolerance); |
|
|
DOUBLES_EQUAL(cos(deg),a(1,1), tolerance); |
|
|
DOUBLES_EQUAL(-sin(deg),a(1,2), tolerance); |
|
|
DOUBLES_EQUAL(-sin(deg),a(1,2), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(1,3), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(1,3), tolerance); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DOUBLES_EQUAL(0.0f,a(2,0), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(2,0), tolerance); |
|
|
DOUBLES_EQUAL(sin(deg),a(2,1), tolerance); |
|
|
DOUBLES_EQUAL(sin(deg),a(2,1), tolerance); |
|
|
DOUBLES_EQUAL(cos(deg),a(2,2), tolerance); |
|
|
DOUBLES_EQUAL(cos(deg),a(2,2), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(2,3), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(2,3), tolerance); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DOUBLES_EQUAL(0.0f,a(3,0), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(3,0), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(3,1), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(3,1), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(3,2), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(3,2), tolerance); |
|
|
DOUBLES_EQUAL(1.0f,a(3,3), tolerance); |
|
|
DOUBLES_EQUAL(1.0f,a(3,3), tolerance); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Test the matrix for invert an non identity matrix |
|
|
|
|
|
* with a y rotation |
|
|
|
|
|
*/ |
|
|
TEST(Matrix, vectorInvRotY) |
|
|
TEST(Matrix, vectorInvRotY) |
|
|
{ |
|
|
{ |
|
|
|
|
|
// setup the test matrix to an identity matrix
|
|
|
Mat<float, TESTSIZE> a(0.0f); |
|
|
Mat<float, TESTSIZE> a(0.0f); |
|
|
|
|
|
|
|
|
float deg = 45.0f*M_PI/180.0f; |
|
|
float deg = 45.0f*M_PI/180.0f; |
|
@ -136,12 +191,17 @@ TEST(Matrix, vectorInvRotY) |
|
|
DOUBLES_EQUAL(1.0f,a(3,3), tolerance); |
|
|
DOUBLES_EQUAL(1.0f,a(3,3), tolerance); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Test the matrix for invert an identity matrix |
|
|
|
|
|
*/ |
|
|
TEST(Matrix, matrixInvEye) |
|
|
TEST(Matrix, matrixInvEye) |
|
|
{ |
|
|
{ |
|
|
Mat<float, TESTSIZE> a(0.0f , 1.0f); |
|
|
Mat<float, TESTSIZE> a(0.0f , 1.0f); |
|
|
|
|
|
|
|
|
// do the invert
|
|
|
// do the invert
|
|
|
a = a.inv(); |
|
|
a = a.inv(); |
|
|
|
|
|
|
|
|
|
|
|
// check if the matrix is still an identity matrix
|
|
|
DOUBLES_EQUAL(1.0f,a(0,0), tolerance); |
|
|
DOUBLES_EQUAL(1.0f,a(0,0), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(0,1), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(0,1), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(0,2), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(0,2), tolerance); |
|
@ -162,6 +222,11 @@ TEST(Matrix, matrixInvEye) |
|
|
DOUBLES_EQUAL(0.0f,a(3,2), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(3,2), tolerance); |
|
|
DOUBLES_EQUAL(1.0f,a(3,3), tolerance); |
|
|
DOUBLES_EQUAL(1.0f,a(3,3), tolerance); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Test if the matrix constructor for identity matrix is working |
|
|
|
|
|
*/ |
|
|
TEST(Matrix, matrixEye) |
|
|
TEST(Matrix, matrixEye) |
|
|
{ |
|
|
{ |
|
|
Mat<float, TESTSIZE> a(0.0f , 1.0f); |
|
|
Mat<float, TESTSIZE> a(0.0f , 1.0f); |
|
@ -186,6 +251,11 @@ TEST(Matrix, matrixEye) |
|
|
DOUBLES_EQUAL(0.0f,a(3,2), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(3,2), tolerance); |
|
|
DOUBLES_EQUAL(1.0f,a(3,3), tolerance); |
|
|
DOUBLES_EQUAL(1.0f,a(3,3), tolerance); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Test if the determinant function is working with an identity matrix |
|
|
|
|
|
* This should always return an 1 |
|
|
|
|
|
*/ |
|
|
TEST(Matrix, matrixDeterminantEye) |
|
|
TEST(Matrix, matrixDeterminantEye) |
|
|
{ |
|
|
{ |
|
|
//eye matrix
|
|
|
//eye matrix
|
|
@ -193,6 +263,12 @@ TEST(Matrix, matrixDeterminantEye) |
|
|
|
|
|
|
|
|
DOUBLES_EQUAL(1.0f,a.determinant(),tolerance); |
|
|
DOUBLES_EQUAL(1.0f,a.determinant(),tolerance); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Test if the determinant function is working with an identity matrix |
|
|
|
|
|
* with only 3 dimensions. |
|
|
|
|
|
* This should always return an 1 |
|
|
|
|
|
*/ |
|
|
TEST(Matrix, matrixDeterminantEye3) |
|
|
TEST(Matrix, matrixDeterminantEye3) |
|
|
{ |
|
|
{ |
|
|
//eye matrix
|
|
|
//eye matrix
|
|
@ -200,6 +276,11 @@ TEST(Matrix, matrixDeterminantEye3) |
|
|
|
|
|
|
|
|
DOUBLES_EQUAL(1.0f,a.determinant(),tolerance); |
|
|
DOUBLES_EQUAL(1.0f,a.determinant(),tolerance); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Test if the determinant function is working with an identity matrix |
|
|
|
|
|
* with 1 dimension should always return the first cell |
|
|
|
|
|
*/ |
|
|
TEST(Matrix, matrixDeterminantSimple) |
|
|
TEST(Matrix, matrixDeterminantSimple) |
|
|
{ |
|
|
{ |
|
|
Mat<float, 1> a; |
|
|
Mat<float, 1> a; |
|
@ -207,6 +288,11 @@ TEST(Matrix, matrixDeterminantSimple) |
|
|
|
|
|
|
|
|
DOUBLES_EQUAL(50.0f,a.determinant(), tolerance); |
|
|
DOUBLES_EQUAL(50.0f,a.determinant(), tolerance); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Test if the determinant function is working with an identity matrix |
|
|
|
|
|
* with 2 dimension should always return the multiplication of the diagonal |
|
|
|
|
|
*/ |
|
|
TEST(Matrix, matrixDeterminantSimple2) |
|
|
TEST(Matrix, matrixDeterminantSimple2) |
|
|
{ |
|
|
{ |
|
|
Mat<float, 2> a; |
|
|
Mat<float, 2> a; |
|
@ -215,6 +301,11 @@ TEST(Matrix, matrixDeterminantSimple2) |
|
|
DOUBLES_EQUAL(50.0f,a.determinant(), tolerance); |
|
|
DOUBLES_EQUAL(50.0f,a.determinant(), tolerance); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Test if the determinant function is working with an complete non zero matrix |
|
|
|
|
|
* with 2 dimension should always return the multiplication of the diagonal |
|
|
|
|
|
* and negative counter diagonal multiplication |
|
|
|
|
|
*/ |
|
|
TEST(Matrix, matrixDeterminantSimple3) |
|
|
TEST(Matrix, matrixDeterminantSimple3) |
|
|
{ |
|
|
{ |
|
|
Mat<float, 2> a; |
|
|
Mat<float, 2> a; |
|
@ -225,6 +316,11 @@ TEST(Matrix, matrixDeterminantSimple3) |
|
|
DOUBLES_EQUAL(0.0f,a.determinant(), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a.determinant(), tolerance); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Test if the determinant function is working with an complete non zero matrix |
|
|
|
|
|
* with 2 dimension should always return the multiplication of the diagonal |
|
|
|
|
|
* and negative counter diagonal multiplication |
|
|
|
|
|
*/ |
|
|
TEST(Matrix, matrixDeterminantSimple4) |
|
|
TEST(Matrix, matrixDeterminantSimple4) |
|
|
{ |
|
|
{ |
|
|
Mat<float, 2> a; |
|
|
Mat<float, 2> a; |
|
@ -235,20 +331,16 @@ TEST(Matrix, matrixDeterminantSimple4) |
|
|
DOUBLES_EQUAL(75.0f,a.determinant(), tolerance); |
|
|
DOUBLES_EQUAL(75.0f,a.determinant(), tolerance); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Test if the transpose function is working with an identity matrix |
|
|
|
|
|
* with 4 dimension should always be the same again |
|
|
|
|
|
*/ |
|
|
TEST(Matrix, matrixTransposeEye) |
|
|
TEST(Matrix, matrixTransposeEye) |
|
|
{ |
|
|
{ |
|
|
Mat<float, TESTSIZE> a; |
|
|
|
|
|
for(int x = 0 ; x < TESTSIZE ; ++x) |
|
|
|
|
|
{ |
|
|
|
|
|
for (int y = 0; y <TESTSIZE ; ++y) |
|
|
|
|
|
{ |
|
|
|
|
|
float val = 0.0f; |
|
|
|
|
|
if (x == y ) |
|
|
|
|
|
val = 1.0f; |
|
|
|
|
|
a(x,y) = val; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//eye matrix
|
|
|
|
|
|
Mat<float, TESTSIZE> a(0.0f,1.0f); |
|
|
|
|
|
|
|
|
|
|
|
// check if the identity matrix is correctly created
|
|
|
DOUBLES_EQUAL(1.0f,a(0,0), tolerance); |
|
|
DOUBLES_EQUAL(1.0f,a(0,0), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(0,1), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(0,1), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(0,2), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(0,2), tolerance); |
|
@ -269,9 +361,10 @@ TEST(Matrix, matrixTransposeEye) |
|
|
DOUBLES_EQUAL(0.0f,a(3,2), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(3,2), tolerance); |
|
|
DOUBLES_EQUAL(1.0f,a(3,3), tolerance); |
|
|
DOUBLES_EQUAL(1.0f,a(3,3), tolerance); |
|
|
|
|
|
|
|
|
|
|
|
// invert the identity matrix
|
|
|
a = a.inv(); |
|
|
a = a.inv(); |
|
|
|
|
|
|
|
|
// should stille be the same
|
|
|
|
|
|
|
|
|
// should still be the same
|
|
|
DOUBLES_EQUAL(1.0f,a(0,0), tolerance); |
|
|
DOUBLES_EQUAL(1.0f,a(0,0), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(0,1), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(0,1), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(0,2), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(0,2), tolerance); |
|
@ -292,12 +385,17 @@ TEST(Matrix, matrixTransposeEye) |
|
|
DOUBLES_EQUAL(0.0f,a(3,2), tolerance); |
|
|
DOUBLES_EQUAL(0.0f,a(3,2), tolerance); |
|
|
DOUBLES_EQUAL(1.0f,a(3,3), tolerance); |
|
|
DOUBLES_EQUAL(1.0f,a(3,3), tolerance); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Test if the transpose function is working with an identity matrix |
|
|
|
|
|
* with 4 dimension should always be the same again |
|
|
|
|
|
*/ |
|
|
TEST(Matrix, vectorMultiply) |
|
|
TEST(Matrix, vectorMultiply) |
|
|
{ |
|
|
{ |
|
|
Mat<int, TESTSIZE> a = testMat; |
|
|
Mat<int, TESTSIZE> a = testMat; |
|
|
Vec<int, TESTSIZE> v = testVec; |
|
|
Vec<int, TESTSIZE> v = testVec; |
|
|
|
|
|
|
|
|
//Vec<int, TESTSIZE> b = a * v;
|
|
|
|
|
|
|
|
|
Vec<int, TESTSIZE> b = a * v; |
|
|
for (int x = 0; x <TESTSIZE ; x++) |
|
|
for (int x = 0; x <TESTSIZE ; x++) |
|
|
{ |
|
|
{ |
|
|
int val = 0; |
|
|
int val = 0; |
|
@ -305,7 +403,7 @@ TEST(Matrix, vectorMultiply) |
|
|
{ |
|
|
{ |
|
|
val += testMat[x][y] * testVec[x]; |
|
|
val += testMat[x][y] * testVec[x]; |
|
|
} |
|
|
} |
|
|
//CHECK_EQUAL(val,b(x));
|
|
|
|
|
|
|
|
|
CHECK_EQUAL(val,b(x)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|