summaryrefslogtreecommitdiff
path: root/src/matrixOperations/multiplication
diff options
context:
space:
mode:
authorjofret2009-01-29 09:35:01 +0000
committerjofret2009-01-29 09:35:01 +0000
commit191cedfb25904c4d3a33dd27413f89870f2624ef (patch)
treedd123ff3733612c9af1d63f40a20b336a079bf16 /src/matrixOperations/multiplication
parentf644e23a78ae85e0b1817f070949be8198390b2b (diff)
downloadscilab2c-191cedfb25904c4d3a33dd27413f89870f2624ef.tar.gz
scilab2c-191cedfb25904c4d3a33dd27413f89870f2624ef.tar.bz2
scilab2c-191cedfb25904c4d3a33dd27413f89870f2624ef.zip
adding wired test
Diffstat (limited to 'src/matrixOperations/multiplication')
-rw-r--r--src/matrixOperations/multiplication/testDoubleMatrixMultiplication.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/matrixOperations/multiplication/testDoubleMatrixMultiplication.c b/src/matrixOperations/multiplication/testDoubleMatrixMultiplication.c
index e9b71a87..d1c210ea 100644
--- a/src/matrixOperations/multiplication/testDoubleMatrixMultiplication.c
+++ b/src/matrixOperations/multiplication/testDoubleMatrixMultiplication.c
@@ -118,6 +118,9 @@ static void dmulmaTest(void) {
double M8[6] = {1.0, 3.0, 5.0, 2.0, 4.0, 6.0};
double M7_by_M8[4];
double miscM7_by_M8[9];
+ double M9[6] = {1, 4, 2, 5, 3, 6};
+ double M10[9] = {4, 8, 3, 2, 8, 4, 3, 4, 5};
+ double M9_by_M10[6];
int i = 0;
@@ -192,6 +195,23 @@ static void dmulmaTest(void) {
assert(miscM7_by_M8[6] == 34.0);
assert(miscM7_by_M8[7] == 34.0);
assert(miscM7_by_M8[8] == 44.0);
+
+ /*
+ [ 1 2 3 ] * [ 4 2 3 ] = [ 29 30 26 ]
+ [ 4 5 6 ] [ 8 8 4 ] [ 74 72 62 ]
+ [ 3 4 5 ]
+ */
+ dmulma(M9, 2, 3, M10, 3, 3, M9_by_M10);
+ for (i = 0; i < 6; ++i) {
+ printf("M9_by_M10[%d] = %e\n", i, M9_by_M10[i]);
+ }
+ assert(M9_by_M10[0] == 29.0);
+ assert(M9_by_M10[1] == 74.0);
+ assert(M9_by_M10[2] == 30.0);
+ assert(M9_by_M10[3] == 72.0);
+ assert(M9_by_M10[4] == 26.0);
+ assert(M9_by_M10[5] == 62.0);
+
}
static int testDoubleMultiplication(void) {