Commit 92ab9ae8 authored by Morten Welinder's avatar Morten Welinder

Fix matrix multiply. I hope.

parent 0d8aadb7
2000-02-15 Morten Welinder <terra@diku.dk>
* src/functions/fn-math.c (gnumeric_mmult): Fix row/col confusion.
* src/mathfunc.c (mmult): Ditto. How did this ever work for
non-square matrices?
2000-02-15 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_col_set_default_size_pts) : There is no notion of
......
2000-02-15 Morten Welinder <terra@diku.dk>
* src/functions/fn-math.c (gnumeric_mmult): Fix row/col confusion.
* src/mathfunc.c (mmult): Ditto. How did this ever work for
non-square matrices?
2000-02-15 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_col_set_default_size_pts) : There is no notion of
......
......@@ -3179,7 +3179,7 @@ gnumeric_mmult (FunctionEvalInfo *ei, Value **argv)
A = g_new (float_t, cols_a * rows_a);
B = g_new (float_t, cols_b * rows_b);
product = g_new (float_t, cols_a * rows_b);
product = g_new (float_t, rows_a * cols_b);
for (c=0; c<cols_a; c++)
for (r=0; r<rows_a; r++) {
......@@ -3198,7 +3198,7 @@ gnumeric_mmult (FunctionEvalInfo *ei, Value **argv)
mmult (A, B, cols_a, rows_a, cols_b, product);
for (c=0; c<cols_b; c++) {
res->v.array.vals [c] = g_new (Value *, rows_a);
res->v.array.vals[c] = g_new (Value *, rows_a);
for (r=0; r<rows_a; r++)
res->v.array.vals[c][r] =
value_new_float (product [r + c*rows_a]);
......
......@@ -3179,7 +3179,7 @@ gnumeric_mmult (FunctionEvalInfo *ei, Value **argv)
A = g_new (float_t, cols_a * rows_a);
B = g_new (float_t, cols_b * rows_b);
product = g_new (float_t, cols_a * rows_b);
product = g_new (float_t, rows_a * cols_b);
for (c=0; c<cols_a; c++)
for (r=0; r<rows_a; r++) {
......@@ -3198,7 +3198,7 @@ gnumeric_mmult (FunctionEvalInfo *ei, Value **argv)
mmult (A, B, cols_a, rows_a, cols_b, product);
for (c=0; c<cols_b; c++) {
res->v.array.vals [c] = g_new (Value *, rows_a);
res->v.array.vals[c] = g_new (Value *, rows_a);
for (r=0; r<rows_a; r++)
res->v.array.vals[c][r] =
value_new_float (product [r + c*rows_a]);
......
......@@ -4193,7 +4193,7 @@ mmult (float_t *A, float_t *B, int cols_a, int rows_a, int cols_b,
float_t tmp;
int c, r, i;
for (c = 0; c < cols_a; ++c) {
for (c = 0; c < cols_b; ++c) {
for (r = 0; r < rows_a; ++r) {
tmp = 0;
for (i = 0; i < cols_a; ++i)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment