[gnumeric] Regression: avoid repeated identical SUMSQ calls.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Regression: avoid repeated identical SUMSQ calls.
- Date: Sun, 20 Jan 2013 17:49:42 +0000 (UTC)
commit e830dfc66966819fda7fc6b3ee36221c926c1df1
Author: Morten Welinder <terra gnome org>
Date: Sun Jan 20 12:48:44 2013 -0500
Regression: avoid repeated identical SUMSQ calls.
NEWS | 1 +
src/tools/ChangeLog | 2 ++
src/tools/analysis-tools.c | 17 ++---------------
3 files changed, 5 insertions(+), 15 deletions(-)
---
diff --git a/NEWS b/NEWS
index fbdfbc5..b1e4830 100644
--- a/NEWS
+++ b/NEWS
@@ -27,6 +27,7 @@ Morten:
* Fix text import crash.
* Add LEVERAGE function for regression tool. [#691913]
* Clean up matrix code.
+ * Speed up regressions. [#691984]
--------------------------------------------------------------------------
Gnumeric 1.12.0
diff --git a/src/tools/ChangeLog b/src/tools/ChangeLog
index 7ce79b6..165bf66 100644
--- a/src/tools/ChangeLog
+++ b/src/tools/ChangeLog
@@ -2,6 +2,8 @@
* analysis-tools.c (analysis_tool_regression_engine_run): Simplify
using new LEVERAGE function.
+ (analysis_tool_regression_engine_run): Don't create zillions of
+ identical SUMSQ calls computing a value we already have.
2012-12-18 Morten Welinder <terra gnome org>
diff --git a/src/tools/analysis-tools.c b/src/tools/analysis-tools.c
index 16aae31..05580d8 100644
--- a/src/tools/analysis-tools.c
+++ b/src/tools/analysis-tools.c
@@ -2880,9 +2880,7 @@ analysis_tool_regression_engine_run (data_analysis_output_t *dao,
GnmFunc *fd_cell = NULL;
GnmFunc *fd_offset = NULL;
GnmFunc *fd_sumproduct = NULL;
- GnmFunc *fd_mmult = NULL;
GnmFunc *fd_leverage = NULL;
- GnmFunc *fd_sumsq = NULL;
char const *str = ((info->group_by == GROUPED_BY_ROW) ? "row" : "col");
char const *label = ((info->group_by == GROUPED_BY_ROW) ? _("Row")
@@ -2896,9 +2894,7 @@ analysis_tool_regression_engine_run (data_analysis_output_t *dao,
}
if (info->residual) {
fd_sumproduct = analysis_tool_get_function ("SUMPRODUCT", dao);
- fd_mmult = analysis_tool_get_function ("MMULT", dao);
fd_leverage = analysis_tool_get_function ("LEVERAGE", dao);
- fd_sumsq = analysis_tool_get_function ("SUMSQ", dao);
}
cb_adjust_areas (val_1, NULL);
@@ -3345,11 +3341,7 @@ analysis_tool_regression_engine_run (data_analysis_output_t *dao,
gnm_expr_new_funcall1
(fd_leverage, expr_X);
GnmExpr const *expr_var =
- gnm_expr_new_binary
- (gnm_expr_new_funcall1
- (fd_sumsq, dao_get_rangeref (dao, xdim + 3, 1, xdim + 3, n_obs)),
- GNM_EXPR_OP_DIV,
- dao_get_cellref (dao, 1, - 6 - xdim));
+ dao_get_cellref (dao, 3, - 6 - xdim);
GnmExpr const *expr_int_stud =
gnm_expr_new_binary
(make_cellref (-2, 0),
@@ -3368,8 +3360,7 @@ analysis_tool_regression_engine_run (data_analysis_output_t *dao,
expr_var = gnm_expr_new_binary
(gnm_expr_new_binary
- (gnm_expr_new_funcall1
- (fd_sumsq, dao_get_rangeref (dao, xdim + 3, 1, xdim + 3, n_obs)),
+ (dao_get_cellref (dao, 2, - 6 - xdim),
GNM_EXPR_OP_SUB,
gnm_expr_new_binary
(make_cellref (-3, 0),
@@ -3437,12 +3428,8 @@ analysis_tool_regression_engine_run (data_analysis_output_t *dao,
gnm_func_unref (fd_offset);
if (fd_sumproduct != NULL)
gnm_func_unref (fd_sumproduct);
- if (fd_mmult != NULL)
- gnm_func_unref (fd_mmult);
if (fd_leverage != NULL)
gnm_func_unref (fd_leverage);
- if (fd_sumsq != NULL)
- gnm_func_unref (fd_sumsq);
dao_redraw_respan (dao);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]