Commit 60660fec authored by Andreas J. Guelzow 's avatar Andreas J. Guelzow

Fix moving averages, exponential smothing and principal

	  component tools. [#769659]

2016-08-08  Andreas J. Guelzow <aguelzow@pyrshep.ca>

	* analysis-exp-smoothing.c
	(analysis_tool_exponential_smoothing_engine_ses_h_run): specify GnmEvalPos
	(analysis_tool_exponential_smoothing_engine_ses_r_run): ditto
	(analysis_tool_exponential_smoothing_engine_des_run): ditto
	(analysis_tool_exponential_smoothing_engine_ates_run): ditto
	(analysis_tool_exponential_smoothing_engine_mtes_run): ditto
	* analysis-principal-components.c
	(analysis_tool_principal_components_engine_run): ditto
	* analysis-tools.c
	(analysis_tool_sampling_engine_run): ditto
	(analysis_tool_sampling_engine): ditto
	(analysis_tool_moving_average_engine_run): ditto
parent dde00b40
Gnumeric 1.12.32
Andreas:
* improve html4.0 fragment export. [#769343]
* Improve html4.0 fragment export. [#769343]
* Fix moving averages, exponential smothing and principal
component tools. [#769659]
Jean:
* Fix paradox plugin build with pxlib-0.6.7. [#769319]
......
2016-08-08 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* analysis-exp-smoothing.c
(analysis_tool_exponential_smoothing_engine_ses_h_run): specify GnmEvalPos
(analysis_tool_exponential_smoothing_engine_ses_r_run): ditto
(analysis_tool_exponential_smoothing_engine_des_run): ditto
(analysis_tool_exponential_smoothing_engine_ates_run): ditto
(analysis_tool_exponential_smoothing_engine_mtes_run): ditto
* analysis-principal-components.c
(analysis_tool_principal_components_engine_run): ditto
* analysis-tools.c
(analysis_tool_sampling_engine_run): ditto
(analysis_tool_sampling_engine): ditto
(analysis_tool_moving_average_engine_run): ditto
2016-06-29 Morten Welinder <terra@gnome.org>
* Release 1.12.31
......
......@@ -130,6 +130,10 @@ analysis_tool_exponential_smoothing_engine_ses_h_run (data_analysis_output_t *da
guint delta_y = 1;
gint row;
Sheet *sheet;
GnmEvalPos ep;
sheet = val->v_range.cell.a.sheet;
eval_pos_init_sheet (&ep, sheet);
dao_set_italic (dao, col, 0, col, 0);
if (info->base.labels) {
......@@ -155,16 +159,15 @@ analysis_tool_exponential_smoothing_engine_ses_h_run (data_analysis_output_t *da
switch (info->base.group_by) {
case GROUPED_BY_ROW:
height = value_area_get_width (val, NULL);
height = value_area_get_width (val, &ep);
mover = &x;
break;
default:
height = value_area_get_height (val, NULL);
height = value_area_get_height (val, &ep);
mover = &y;
break;
}
sheet = val->v_range.cell.a.sheet;
expr_input = gnm_expr_new_constant (val);
if (plot != NULL) {
......@@ -306,6 +309,10 @@ analysis_tool_exponential_smoothing_engine_ses_r_run (data_analysis_output_t *da
guint delta_y = 1;
gint row;
Sheet *sheet;
GnmEvalPos ep;
sheet = val->v_range.cell.a.sheet;
eval_pos_init_sheet (&ep, sheet);
dao_set_italic (dao, col, 0, col, 0);
if (info->base.labels) {
......@@ -331,16 +338,15 @@ analysis_tool_exponential_smoothing_engine_ses_r_run (data_analysis_output_t *da
switch (info->base.group_by) {
case GROUPED_BY_ROW:
height = value_area_get_width (val, NULL);
height = value_area_get_width (val, &ep);
mover = &x;
break;
default:
height = value_area_get_height (val, NULL);
height = value_area_get_height (val, &ep);
mover = &y;
break;
}
sheet = val->v_range.cell.a.sheet;
expr_input = gnm_expr_new_constant (val);
if (plot != NULL) {
......@@ -494,6 +500,10 @@ analysis_tool_exponential_smoothing_engine_des_run (data_analysis_output_t *dao,
guint delta_y = 1;
gint row;
Sheet *sheet;
GnmEvalPos ep;
sheet = val->v_range.cell.a.sheet;
eval_pos_init_sheet (&ep, sheet);
dao_set_italic (dao, col, 0, col, 0);
if (info->base.labels) {
......@@ -519,16 +529,15 @@ analysis_tool_exponential_smoothing_engine_des_run (data_analysis_output_t *dao,
switch (info->base.group_by) {
case GROUPED_BY_ROW:
height = value_area_get_width (val, NULL);
height = value_area_get_width (val, &ep);
mover = &x;
break;
default:
height = value_area_get_height (val, NULL);
height = value_area_get_height (val, &ep);
mover = &y;
break;
}
sheet = val->v_range.cell.a.sheet;
expr_input = gnm_expr_new_constant (val);
if (plot != NULL) {
......@@ -751,6 +760,9 @@ analysis_tool_exponential_smoothing_engine_ates_run (data_analysis_output_t *dao
GnmExpr const *expr_linest_intercept;
GnmExpr const *expr_linest_slope;
gint height;
GnmEvalPos ep;
eval_pos_init_sheet (&ep, val->v_range.cell.a.sheet);
if (dao_cell_is_visible (dao, col+3, 1))
{
......@@ -784,14 +796,14 @@ analysis_tool_exponential_smoothing_engine_ates_run (data_analysis_output_t *dao
switch (info->base.group_by) {
case GROUPED_BY_ROW:
height = value_area_get_width (val, NULL);
height = value_area_get_width (val, &ep);
expr_input = gnm_expr_new_constant (val);
expr_index = gnm_expr_new_funcall3 (fd_index, gnm_expr_copy (expr_input),
gnm_expr_new_constant (value_new_int (1)),
make_cellref (-1 - col, 0));
break;
default:
height = value_area_get_height (val, NULL);
height = value_area_get_height (val, &ep);
expr_input = gnm_expr_new_constant (val);
expr_index = gnm_expr_new_funcall3 (fd_index, gnm_expr_copy (expr_input),
make_cellref (-1 - col, 0),
......@@ -1073,6 +1085,9 @@ analysis_tool_exponential_smoothing_engine_mtes_run (data_analysis_output_t *dao
GnmExpr const *expr_linest_slope;
gint height, starting_length, i;
GnmExprList *args = NULL;
GnmEvalPos ep;
eval_pos_init_sheet (&ep, val->v_range.cell.a.sheet);
if (dao_cell_is_visible (dao, col+3, 1))
{
......@@ -1106,14 +1121,14 @@ analysis_tool_exponential_smoothing_engine_mtes_run (data_analysis_output_t *dao
switch (info->base.group_by) {
case GROUPED_BY_ROW:
height = value_area_get_width (val, NULL);
height = value_area_get_width (val, &ep);
expr_input = gnm_expr_new_constant (val);
expr_index = gnm_expr_new_funcall3 (fd_index, gnm_expr_copy (expr_input),
gnm_expr_new_constant (value_new_int (1)),
make_cellref (-1 - col, 0));
break;
default:
height = value_area_get_height (val, NULL);
height = value_area_get_height (val, &ep);
expr_input = gnm_expr_new_constant (val);
expr_index = gnm_expr_new_funcall3 (fd_index, gnm_expr_copy (expr_input),
make_cellref (-1 - col, 0),
......
......@@ -59,6 +59,7 @@ analysis_tool_principal_components_engine_run (data_analysis_output_t *dao,
int data_points;
GnmExprList *and_args = NULL;
GnmEvalPos ep;
if (!dao_cell_is_visible (dao, l, 9 + 3 * l)) {
dao_set_bold (dao, 0, 0, 0, 0);
......@@ -107,8 +108,11 @@ analysis_tool_principal_components_engine_run (data_analysis_output_t *dao,
for (i = 1, inputdata = info->input; inputdata != NULL; i++, inputdata = inputdata->next)
analysis_tools_write_label (inputdata->data, dao, info, 0, 9 + 2 * l + i, i);
data_points = value_area_get_width (info->input->data, NULL) *
value_area_get_height (info->input->data, NULL);
eval_pos_init_sheet (&ep,
((GnmValue *)(info->input->data))->v_range.cell.a.sheet);
data_points = value_area_get_width (info->input->data, &ep) *
value_area_get_height (info->input->data, &ep);
for (i = 0; i < l; i++)
and_args = gnm_expr_list_prepend
(and_args,
......
......@@ -1189,6 +1189,9 @@ analysis_tool_sampling_engine_run (data_analysis_output_t *dao,
GnmExpr const *expr_input = NULL;
char const *format = NULL;
guint offset = info->periodic ? ((info->offset == 0) ? info->period : info->offset): 0;
GnmEvalPos ep;
eval_pos_init_sheet (&ep, val->v_range.cell.a.sheet);
dao_set_italic (dao, col, 0, col + info->number - 1, 0);
......@@ -1231,8 +1234,8 @@ analysis_tool_sampling_engine_run (data_analysis_output_t *dao,
if (info->periodic) {
guint i;
gint height = value_area_get_height (val, NULL);
gint width = value_area_get_width (val, NULL);
gint height = value_area_get_height (val, &ep);
gint width = value_area_get_width (val, &ep);
GnmExpr const *expr_period;
for (i=0; i < info->size; i++, offset += info->period) {
......@@ -1327,10 +1330,14 @@ analysis_tool_sampling_engine (G_GNUC_UNUSED GOCmdContext *gcc, data_analysis_ou
if (info->periodic) {
info->size = 1;
for (l = info->base.input; l; l = l->next) {
GnmEvalPos ep;
GnmValue *val = ((GnmValue *)l->data);
gint size = (value_area_get_width (val, NULL) *
value_area_get_height (val, NULL));
guint usize = (size > 0) ? size : 1;
gint size;
guint usize;
eval_pos_init_sheet (&ep, val->v_range.cell.a.sheet);
size = (value_area_get_width (val, &ep) *
value_area_get_height (val, &ep));
usize = (size > 0) ? size : 1;
if (info->offset == 0)
usize = usize/info->period;
......@@ -3716,6 +3723,9 @@ analysis_tool_moving_average_engine_run (data_analysis_output_t *dao,
guint delta_y = 1;
gint row, base;
Sheet *sheet;
GnmEvalPos ep;
eval_pos_init_sheet (&ep, val->v_range.cell.a.sheet);
if (info->base.labels) {
val_c = value_dup (val);
......@@ -3746,12 +3756,12 @@ analysis_tool_moving_average_engine_run (data_analysis_output_t *dao,
switch (info->base.group_by) {
case GROUPED_BY_ROW:
height = value_area_get_width (val, NULL);
height = value_area_get_width (val, &ep);
mover = &x;
delta_mover = &delta_x;
break;
default:
height = value_area_get_height (val, NULL);
height = value_area_get_height (val, &ep);
mover = &y;
delta_mover = &delta_y;
break;
......
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