[goffice] GOQuadMatrix: minor code reorg.



commit 51401e4e0ade52570d71586efdc1adf62bcd6455
Author: Morten Welinder <terra gnome org>
Date:   Sun May 12 19:53:38 2013 -0400

    GOQuadMatrix: minor code reorg.

 ChangeLog                |    1 +
 goffice/math/go-matrix.c |   14 ++++++++------
 2 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 12c4cfa..066ccee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 
        * goffice/math/go-matrix.c (go_quad_matrix_dump): New function for
        debugging.
+       (go_quad_qr_determinant): Move the determinant computation here.
 
 2013-05-11  Morten Welinder  <terra gnome org>
 
diff --git a/goffice/math/go-matrix.c b/goffice/math/go-matrix.c
index 7f4f4c0..9cc7261 100644
--- a/goffice/math/go-matrix.c
+++ b/goffice/math/go-matrix.c
@@ -38,7 +38,7 @@
 struct GOQuadQR_ {
        QMATRIX *V;
        QMATRIX *R;
-       QUAD det;
+       int qdet;
 };
 
 
@@ -52,7 +52,7 @@ struct GOQuadQR_ {
 struct GOQuadQRl_ {
        QMATRIX *V;
        QMATRIX *R;
-       QUAD det;
+       int qdet;
 };
 
 #endif
@@ -675,9 +675,7 @@ SUFFIX(go_quad_qr_new) (const QMATRIX *A)
                for (j = 0; j < n; j++)
                        qr->R->data[i][j] = R->data[i][j];
 
-       SUFFIX(go_quad_init) (&qr->det, qdet);
-       for (i = 0; i < n; i++)
-               SUFFIX(go_quad_mul) (&qr->det, &qr->det, &R->data[i][i]);
+       qr->qdet = qdet;
 
        SUFFIX(go_quad_matrix_free) (R);
 
@@ -697,10 +695,14 @@ SUFFIX(go_quad_qr_free) (QQR *qr)
 void
 SUFFIX(go_quad_qr_determinant) (const QQR *qr, QUAD *det)
 {
+       int i;
+
        g_return_if_fail (qr != NULL);
        g_return_if_fail (det != NULL);
 
-       *det = qr->det;
+       SUFFIX(go_quad_init) (det, qr->qdet);
+       for (i = 0; i < qr->R->n; i++)
+               SUFFIX(go_quad_mul) (det, det, &qr->R->data[i][i]);
 }
 
 /**


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]