gnumeric r16775 - in trunk: . src src/tools
- From: guelzow svn gnome org
- To: svn-commits-list gnome org
- Subject: gnumeric r16775 - in trunk: . src src/tools
- Date: Thu, 4 Sep 2008 20:16:10 +0000 (UTC)
Author: guelzow
Date: Thu Sep 4 20:16:10 2008
New Revision: 16775
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16775&view=rev
Log:
2007-09-03 Andreas J. Guelzow <aguelzow pyrshep ca>
Fix for #531852.
* analysis-tools.c (analysis_tool_ttest_paired_engine_run):
change formulas to ensure we only use data pairs where both
components are numbers
2008-09-02 Andreas Guelzow <aguelzow pyrshep ca>
Fix of #516052
* src/selection.c (sv_selection_apply_in_order): new
(selection_to_string): call sv_selection_apply_in_order
rather than sv_selection_apply
Modified:
trunk/ChangeLog
trunk/NEWS
trunk/src/selection.c
trunk/src/tools/ChangeLog
trunk/src/tools/analysis-tools.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Thu Sep 4 20:16:10 2008
@@ -3,6 +3,9 @@
Andreas:
* Do not print hidden sheets. [#525368]
* Print wysiwyg. [#153578]
+ * Fix column ordering in analysis tools. [#516052]
+ * Make the paired t-test analysis tool use only
+ complete pairs. [# 531852]
Jean:
* Fix printing of rotated text. [#539734]
Modified: trunk/src/selection.c
==============================================================================
--- trunk/src/selection.c (original)
+++ trunk/src/selection.c Thu Sep 4 20:16:10 2008
@@ -1031,6 +1031,26 @@
rangeref_as_string (&out, &rr);
}
+static void
+sv_selection_apply_in_order (SheetView *sv, SelectionApplyFunc const func,
+ void * closure)
+{
+ GSList *l, *reverse;
+ GSList *proposed = NULL;
+
+ g_return_if_fail (IS_SHEET_VIEW (sv));
+
+ reverse = g_slist_copy (sv->selections);
+ reverse = g_slist_reverse (reverse);
+ for (l = reverse; l != NULL; l = l->next) {
+ GnmRange const *ss = l->data;
+
+ (*func) (sv, ss, closure);
+ }
+ g_slist_free (reverse);
+}
+
+
char *
selection_to_string (SheetView *sv, gboolean include_sheet_name_prefix)
{
@@ -1040,8 +1060,7 @@
res.str = g_string_new (NULL);
res.include_sheet_name_prefix = include_sheet_name_prefix;
- /* sv_selection_apply will check all necessary invariants. */
- sv_selection_apply (sv, &cb_range_to_string, TRUE, &res);
+ sv_selection_apply_in_order (sv, &cb_range_to_string, &res);
output = res.str->str;
g_string_free (res.str, FALSE);
Modified: trunk/src/tools/analysis-tools.c
==============================================================================
--- trunk/src/tools/analysis-tools.c (original)
+++ trunk/src/tools/analysis-tools.c Thu Sep 4 20:16:10 2008
@@ -1662,6 +1662,7 @@
{
GnmValue *val_1;
GnmValue *val_2;
+
GnmFunc *fd_count;
GnmFunc *fd_mean;
GnmFunc *fd_var;
@@ -1669,9 +1670,16 @@
GnmFunc *fd_abs;
GnmFunc *fd_tinv;
GnmFunc *fd_correl;
+ GnmFunc *fd_isodd;
+ GnmFunc *fd_isnumber;
+ GnmFunc *fd_if;
+ GnmFunc *fd_sum;
+
GnmExpr const *expr_1;
GnmExpr const *expr_2;
GnmExpr const *expr_diff;
+ GnmExpr const *expr_ifisnumber;
+ GnmExpr const *expr_ifisoddifisnumber;
dao_set_cell (dao, 0, 0, "");
set_cell_text_col (dao, 0, 1, _("/Mean"
@@ -1702,6 +1710,14 @@
gnm_func_ref (fd_tdist);
fd_abs = gnm_func_lookup ("ABS", NULL);
gnm_func_ref (fd_abs);
+ fd_isodd = gnm_func_lookup ("ISODD", NULL);
+ gnm_func_ref (fd_isodd);
+ fd_isnumber = gnm_func_lookup ("ISNUMBER", NULL);
+ gnm_func_ref (fd_isnumber);
+ fd_if = gnm_func_lookup ("IF", NULL);
+ gnm_func_ref (fd_if);
+ fd_sum = gnm_func_lookup ("SUM", NULL);
+ gnm_func_ref (fd_sum);
val_1 = value_dup (info->base.range_1);
val_2 = value_dup (info->base.range_2);
@@ -1749,21 +1765,50 @@
/* Hypothesized Mean Difference */
dao_set_cell_float (dao, 1, 5, info->mean_diff);
- /* Observed Mean Difference */
+ /* Some useful expressions for the next field */
+
expr_diff = gnm_expr_new_binary (expr_1, GNM_EXPR_OP_SUB, expr_2);
+
+ /* IF (ISNUMBER (area1), 1, 0) * IF (ISNUMBER (area2), 1, 0) */
+ expr_ifisnumber = gnm_expr_new_binary (gnm_expr_new_funcall3 (
+ fd_if,
+ gnm_expr_new_funcall1 (
+ fd_isnumber,
+ gnm_expr_copy (expr_1)),
+ gnm_expr_new_constant (value_new_int (1)),
+ gnm_expr_new_constant (value_new_int (0))),
+ GNM_EXPR_OP_MULT,
+ gnm_expr_new_funcall3 (
+ fd_if,
+ gnm_expr_new_funcall1 (
+ fd_isnumber,
+ gnm_expr_copy (expr_2)),
+ gnm_expr_new_constant (value_new_int (1)),
+ gnm_expr_new_constant (value_new_int (0)))
+ );
+ /* IF (ISODD (expr_ifisnumber), area1-area2, "NA")*/
+ expr_ifisoddifisnumber = gnm_expr_new_funcall3 (fd_if,
+ gnm_expr_new_funcall1 (fd_isodd,
+ gnm_expr_copy (expr_ifisnumber)),
+ expr_diff,
+ gnm_expr_new_constant (value_new_string ("NA")));
+
+ /* Observed Mean Difference */
dao_set_cell_array_expr (dao, 1, 6,
gnm_expr_new_funcall1 (fd_mean,
- gnm_expr_copy (expr_diff)));
+ gnm_expr_copy (expr_ifisoddifisnumber)));
/* Variance of the Differences */
dao_set_cell_array_expr (dao, 1, 7,
gnm_expr_new_funcall1 (fd_var,
- gnm_expr_copy (expr_diff)));
+ expr_ifisoddifisnumber));
/* df */
dao_set_cell_array_expr (dao, 1, 8,
gnm_expr_new_binary
- (gnm_expr_new_funcall1 (fd_count, expr_diff),
+ (gnm_expr_new_funcall1 (
+ fd_sum,
+ expr_ifisnumber),
GNM_EXPR_OP_SUB,
gnm_expr_new_constant (value_new_int (1))));
@@ -1851,6 +1896,10 @@
gnm_func_unref (fd_tinv);
gnm_func_unref (fd_tdist);
gnm_func_unref (fd_abs);
+ gnm_func_unref (fd_isodd);
+ gnm_func_unref (fd_isnumber);
+ gnm_func_unref (fd_if);
+ gnm_func_unref (fd_sum);
dao_redraw_respan (dao);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]