From a59cb0bbed5270601cadffff5e69dff418f29f83 Mon Sep 17 00:00:00 2001 From: Lukas Cejka <lukas.ostatek@gmail.com> Date: Sun, 11 Nov 2018 22:19:50 +0100 Subject: [PATCH] Impletemented Types for SORIteration test. --- src/UnitTests/Matrices/SparseMatrixTest.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/UnitTests/Matrices/SparseMatrixTest.h b/src/UnitTests/Matrices/SparseMatrixTest.h index 1e69262d3b..b724e8d5a1 100644 --- a/src/UnitTests/Matrices/SparseMatrixTest.h +++ b/src/UnitTests/Matrices/SparseMatrixTest.h @@ -565,31 +565,38 @@ void test_PerformSORIteration() m.setElement( 3, 2, 1.0 ); // 3rd row m.setElement( 3, 3, 4.0 ); - float bVector [ 4 ] = { 1.0, 1.0, 1.0, 1.0 }; - float xVector [ 4 ] = { 1.0, 1.0, 1.0, 1.0 }; + typedef typename Matrix::RealType RealType; + typedef typename Matrix::DeviceType DeviceType; + typedef typename Matrix::IndexType IndexType; + + RealType bVector [ 4 ] = { 1, 1, 1, 1 }; + RealType xVector [ 4 ] = { 1, 1, 1, 1 }; + + IndexType row = 0; + RealType omega = 1; - m.performSORIteration( bVector, 0, xVector, 1); + m.performSORIteration( bVector, row++, xVector, omega); EXPECT_EQ( xVector[ 0 ], 0.0 ); EXPECT_EQ( xVector[ 1 ], 1.0 ); EXPECT_EQ( xVector[ 2 ], 1.0 ); EXPECT_EQ( xVector[ 3 ], 1.0 ); - m.performSORIteration( bVector, 1, xVector, 1); + m.performSORIteration( bVector, row++, xVector, omega); EXPECT_EQ( xVector[ 0 ], 0.0 ); EXPECT_EQ( xVector[ 1 ], 0.0 ); EXPECT_EQ( xVector[ 2 ], 1.0 ); EXPECT_EQ( xVector[ 3 ], 1.0 ); - m.performSORIteration( bVector, 2, xVector, 1); + m.performSORIteration( bVector, row++, xVector, omega); EXPECT_EQ( xVector[ 0 ], 0.0 ); EXPECT_EQ( xVector[ 1 ], 0.0 ); EXPECT_EQ( xVector[ 2 ], 0.0 ); EXPECT_EQ( xVector[ 3 ], 1.0 ); - m.performSORIteration( bVector, 3, xVector, 1); + m.performSORIteration( bVector, row++, xVector, omega); EXPECT_EQ( xVector[ 0 ], 0.0 ); EXPECT_EQ( xVector[ 1 ], 0.0 ); -- GitLab