overall PIMathMatrix tests correction
This commit is contained in:
@@ -576,14 +576,14 @@ TEST(PIMathMatrix_Test, hermitian) {
|
|||||||
ASSERT_TRUE(true);
|
ASSERT_TRUE(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PIMathMatrixT_Test, matrixMultiplication)
|
TEST(PIMathMatrix_Test, matrixMultiplication)
|
||||||
{
|
{
|
||||||
PIMathMatrix<double> matrix1(2, 2, 1.5);
|
PIMathMatrix<double> matrix1(2, 2, 1.5);
|
||||||
PIMathMatrix<double> matrix2(2, 2, 2.5);
|
PIMathMatrix<double> matrix2(2, 2, 2.5);
|
||||||
ASSERT_TRUE(cmpSquareMatrixWithValue(matrix1 * matrix2, 7.5, 2));
|
ASSERT_TRUE(cmpSquareMatrixWithValue(matrix1 * matrix2, 7.5, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PIMathMatrixT_Test, matrixAndVectorMultiplication)
|
TEST(PIMathMatrix_Test, matrixAndVectorMultiplication)
|
||||||
{
|
{
|
||||||
PIMathMatrix<double> matrix1(2, 2, 1.5);
|
PIMathMatrix<double> matrix1(2, 2, 1.5);
|
||||||
PIMathVector<double> vector;
|
PIMathVector<double> vector;
|
||||||
@@ -596,7 +596,7 @@ TEST(PIMathMatrixT_Test, matrixAndVectorMultiplication)
|
|||||||
ASSERT_TRUE(true);
|
ASSERT_TRUE(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PIMathMatrixT_Test, vectorAndMatrixMultiplication)
|
TEST(PIMathMatrix_Test, vectorAndMatrixMultiplication)
|
||||||
{
|
{
|
||||||
PIMathMatrix<double> matrix1(2, 2, 1.5);
|
PIMathMatrix<double> matrix1(2, 2, 1.5);
|
||||||
PIMathVector<double> vector;
|
PIMathVector<double> vector;
|
||||||
@@ -609,13 +609,13 @@ TEST(PIMathMatrixT_Test, vectorAndMatrixMultiplication)
|
|||||||
ASSERT_TRUE(true);
|
ASSERT_TRUE(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PIMathMatrixT_Test, valAndMatrixMultiplication)
|
TEST(PIMathMatrix_Test, valAndMatrixMultiplication)
|
||||||
{
|
{
|
||||||
PIMathMatrix<double> matrix1(3, 3, 1.5);
|
PIMathMatrix<double> matrix1(3, 3, 1.5);
|
||||||
ASSERT_TRUE(cmpSquareMatrixWithValue(25.0*matrix1, 37.5, 3));
|
ASSERT_TRUE(cmpSquareMatrixWithValue(25.0*matrix1, 37.5, 3));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PIMathMatrixT_Test, hermitian)
|
TEST(PIMathMatrix_Test, hermitian)
|
||||||
{
|
{
|
||||||
complex<double> val;
|
complex<double> val;
|
||||||
complex<double> res;
|
complex<double> res;
|
||||||
@@ -634,4 +634,3 @@ TEST(PIMathMatrixT_Test, hermitian)
|
|||||||
}
|
}
|
||||||
ASSERT_TRUE(true);
|
ASSERT_TRUE(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -238,8 +238,7 @@ TEST(PIMathMatrixT_Test, operator_Assignment) {
|
|||||||
PIMathMatrixT<rows, cols, double> matrix1;
|
PIMathMatrixT<rows, cols, double> matrix1;
|
||||||
auto matrix2 = PIMathMatrixT<rows, cols, double>::filled(6.72);
|
auto matrix2 = PIMathMatrixT<rows, cols, double>::filled(6.72);
|
||||||
matrix1 = matrix2;
|
matrix1 = matrix2;
|
||||||
b = cmpSquareMatrixWithValue(matrix1, 6.72, rows);
|
ASSERT_TRUE(cmpSquareMatrixWithValue(matrix1, 6.72, rows));
|
||||||
ASSERT_TRUE(b);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PIMathMatrixT_Test, operator_EqualTrue) {
|
TEST(PIMathMatrixT_Test, operator_EqualTrue) {
|
||||||
@@ -310,65 +309,44 @@ TEST(PIMathMatrixT_Test, operator_Subtraction_Assignment) {
|
|||||||
auto matrix1 = PIMathMatrixT<rows, cols, double>::filled(1.0);
|
auto matrix1 = PIMathMatrixT<rows, cols, double>::filled(1.0);
|
||||||
auto matrix2 = PIMathMatrixT<rows, cols, double>::filled(6.72);
|
auto matrix2 = PIMathMatrixT<rows, cols, double>::filled(6.72);
|
||||||
matrix1 -= matrix2;
|
matrix1 -= matrix2;
|
||||||
b = cmpSquareMatrixWithValue(matrix1, -5.72, rows);
|
ASSERT_TRUE(cmpSquareMatrixWithValue(matrix1, -5.72, rows));
|
||||||
ASSERT_TRUE(b);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PIMathMatrixT_Test, operator_Multiplication_Assignment) {
|
TEST(PIMathMatrixT_Test, operator_Multiplication_Assignment) {
|
||||||
auto matrix1 = PIMathMatrixT<rows, cols, double>::filled(6.72);
|
auto matrix1 = PIMathMatrixT<rows, cols, double>::filled(6.72);
|
||||||
matrix1 *= 2.0;
|
matrix1 *= 2.0;
|
||||||
b = cmpSquareMatrixWithValue(matrix1, 13.44, rows);
|
ASSERT_TRUE(cmpSquareMatrixWithValue(matrix1, 13.44, rows));
|
||||||
ASSERT_TRUE(b);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PIMathMatrixT_Test, operator_Division_Assignment) {
|
TEST(PIMathMatrixT_Test, operator_Division_Assignment) {
|
||||||
auto matrix1 = PIMathMatrixT<rows, cols, double>::filled(6.72);
|
auto matrix1 = PIMathMatrixT<rows, cols, double>::filled(6.72);
|
||||||
matrix1 /= 2.0;
|
matrix1 /= 2.0;
|
||||||
b = cmpSquareMatrixWithValue(matrix1, 3.36, rows);
|
ASSERT_TRUE(cmpSquareMatrixWithValue(matrix1, 3.36, rows));
|
||||||
ASSERT_TRUE(b);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PIMathMatrixT_Test, operator_Addition)
|
TEST(PIMathMatrixT_Test, operator_Addition)
|
||||||
{
|
{
|
||||||
PIMathMatrixT<rows, cols, double> matrix1;
|
auto matrix1 = PIMathMatrixT<rows, cols, double>::filled(6.72);
|
||||||
PIMathMatrixT<rows, cols, double> matrix2;
|
auto matrix2 = PIMathMatrixT<rows, cols, double>::filled(8.28);
|
||||||
bool b;
|
ASSERT_TRUE(cmpSquareMatrixWithValue(matrix1 + matrix2, 15.0, rows));
|
||||||
matrix1.fill(6.72);
|
|
||||||
matrix2.fill(8.28);
|
|
||||||
b = cmpSquareMatrixWithValue(matrix1 + matrix2, 15.0, rows);
|
|
||||||
ASSERT_TRUE(b);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PIMathMatrixT_Test, operator_Subtraction)
|
TEST(PIMathMatrixT_Test, operator_Subtraction)
|
||||||
{
|
{
|
||||||
PIMathMatrixT<rows, cols, double> matrix1;
|
auto matrix1 = PIMathMatrixT<rows, cols, double>::filled(6.0);
|
||||||
PIMathMatrixT<rows, cols, double> matrix2;
|
auto matrix2 = PIMathMatrixT<rows, cols, double>::filled(5.0);
|
||||||
bool b;
|
ASSERT_TRUE(cmpSquareMatrixWithValue(matrix1 - matrix2, 1.0, rows));
|
||||||
matrix1.fill(6.0);
|
|
||||||
matrix2.fill(5.0);
|
|
||||||
b = cmpSquareMatrixWithValue(matrix1 - matrix2, 1.0, rows);
|
|
||||||
ASSERT_TRUE(b);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PIMathMatrixT_Test, operator_Multiplication)
|
TEST(PIMathMatrixT_Test, operator_Multiplication)
|
||||||
{
|
{
|
||||||
PIMathMatrixT<rows, cols, double> matrix1;
|
auto matrix1 = PIMathMatrixT<rows, cols, double>::filled(6.72);
|
||||||
PIMathMatrixT<rows, cols, double> matrix2;
|
ASSERT_TRUE(cmpSquareMatrixWithValue(matrix1 * 4.0, 26.88, rows));
|
||||||
bool b;
|
|
||||||
matrix1.fill(6.72);
|
|
||||||
matrix2 = matrix1*4.0;
|
|
||||||
b = cmpSquareMatrixWithValue(matrix2, 26.88, rows);
|
|
||||||
ASSERT_TRUE(b);
|
|
||||||
}
|
}
|
||||||
TEST(PIMathMatrixT_Test, operator_Division)
|
TEST(PIMathMatrixT_Test, operator_Division)
|
||||||
{
|
{
|
||||||
PIMathMatrixT<rows, cols, double> matrix1;
|
auto matrix1 = PIMathMatrixT<rows, cols, double>::filled(6.72);
|
||||||
PIMathMatrixT<rows, cols, double> matrix2;
|
ASSERT_TRUE(cmpSquareMatrixWithValue(matrix1 / 4.0, 1.68, rows));
|
||||||
bool b;
|
|
||||||
matrix1.fill(6.72);
|
|
||||||
matrix2 = matrix1/4.0;
|
|
||||||
b = cmpSquareMatrixWithValue(matrix2, 1.68, rows);
|
|
||||||
ASSERT_TRUE(b);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PIMathMatrixT_Test, determinantIfSquare) {
|
TEST(PIMathMatrixT_Test, determinantIfSquare) {
|
||||||
|
|||||||
Reference in New Issue
Block a user