bug fixed second
This commit is contained in:
@@ -52,25 +52,6 @@ TEST(PIMathMatrixT_Test, element) {
|
||||
ASSERT_TRUE(true);
|
||||
}
|
||||
|
||||
TEST(PIMathMatrixT_Test, element) {
|
||||
auto matrix = PIMathMatrix<double>::identity(3, 3);
|
||||
for(int i = 0; i < 3; i++){
|
||||
for(int j = 0; j < 3; j++){
|
||||
if(i != j){
|
||||
if(matrix[i][j] != 0.0){
|
||||
ASSERT_TRUE(false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(matrix.element(i,i) != 1.0) {
|
||||
ASSERT_TRUE(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ASSERT_TRUE(true);
|
||||
}
|
||||
|
||||
TEST(PIMathMatrix_Test, matrixRow) {
|
||||
PIMathVector<double> vector;
|
||||
vector.resize(3, 3.0);
|
||||
@@ -573,58 +554,3 @@ TEST(PIMathMatrix_Test, hermitian) {
|
||||
}
|
||||
ASSERT_TRUE(true);
|
||||
}
|
||||
|
||||
TEST(PIMathMatrix_Test, matrixMultiplication)
|
||||
{
|
||||
PIMathMatrix<double> matrix1(2, 2, 1.5);
|
||||
PIMathMatrix<double> matrix2(2, 2, 2.5);
|
||||
ASSERT_TRUE(cmpSquareMatrixWithValue(matrix1 * matrix2, 7.5, 2));
|
||||
}
|
||||
|
||||
TEST(PIMathMatrix_Test, matrixAndVectorMultiplication) {
|
||||
PIMathMatrix<double> matrix1(2, 2, 1.5);
|
||||
PIMathVector<double> vector;
|
||||
vector.resize(2, 2.5);
|
||||
for(uint i = 0; i < 2; i++) {
|
||||
if((matrix1 * vector)[i] != 7.5) {
|
||||
ASSERT_TRUE(false);
|
||||
}
|
||||
}
|
||||
ASSERT_TRUE(true);
|
||||
}
|
||||
|
||||
TEST(PIMathMatrix_Test, vectorAndMatrixMultiplication) {
|
||||
PIMathMatrix<double> matrix1(2, 2, 1.5);
|
||||
PIMathVector<double> vector;
|
||||
vector.resize(2, 2.5);
|
||||
for(uint i = 0; i < 2; i++) {
|
||||
if((vector * matrix1)[i] != 7.5) {
|
||||
ASSERT_TRUE(false);
|
||||
}
|
||||
}
|
||||
ASSERT_TRUE(true);
|
||||
}
|
||||
|
||||
TEST(PIMathMatrix_Test, valAndMatrixMultiplication) {
|
||||
PIMathMatrix<double> matrix1(3, 3, 1.5);
|
||||
ASSERT_TRUE(cmpSquareMatrixWithValue(25.0*matrix1, 37.5, 3));
|
||||
}
|
||||
|
||||
TEST(PIMathMatrix_Test, hermitian) {
|
||||
complex<double> val;
|
||||
complex<double> res;
|
||||
val.imag(1.0);
|
||||
val.real(1.0);
|
||||
PIMathMatrix<complex<double>> matrix(3, 3, val);
|
||||
res.imag(-1.0);
|
||||
res.real(1.0);
|
||||
auto matr = hermitian(matrix);
|
||||
for(uint i = 0; i < 3; i++) {
|
||||
for(uint j = 0; j < 3; j++) {
|
||||
if(matr.element(i, j) != res) {
|
||||
ASSERT_TRUE(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
ASSERT_TRUE(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user