Skip to content

Commit

Permalink
taken care of the case thatan x-array with 2 entries only needs to be…
Browse files Browse the repository at this point in the history
… splined by using the natural_spline and not the estimated derivative spline method by default in this particular case
  • Loading branch information
SamuelBrieden committed Jul 3, 2018
1 parent 779fc65 commit 61bfe20
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tools/arrays.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,8 @@ int array_spline_table_lines(
return _FAILURE_;
}

if (x_size==2) spline_mode = _SPLINE_NATURAL_; // in the case of only 2 x-values, only the natural spline method is appropriate, for _SPLINE_EST_DERIV_ at least 3 x-values are needed.


index_x=0;

Expand Down Expand Up @@ -749,6 +751,8 @@ int array_logspline_table_lines(
return _FAILURE_;
}

if (x_size==2) spline_mode = _SPLINE_NATURAL_; // in the case of only 2 x-values, only the natural spline method is appropriate, for _SPLINE_EST_DERIV_ at least 3 x-values are needed.


index_x=0;

Expand Down Expand Up @@ -910,6 +914,8 @@ int array_spline_table_columns(
return _FAILURE_;
}

if (x_size==2) spline_mode = _SPLINE_NATURAL_; // in the case of only 2 x-values, only the natural spline method is appropriate, for _SPLINE_EST_DERIV_ at least 3 x-values are needed.

index_x=0;

if (spline_mode == _SPLINE_NATURAL_) {
Expand Down Expand Up @@ -1079,6 +1085,8 @@ int array_spline_table_columns2(
return _FAILURE_;
}

if (x_size==2) spline_mode = _SPLINE_NATURAL_; // in the case of only 2 x-values, only the natural spline method is appropriate, for _SPLINE_EST_DERIV_ at least 3 x-values are needed.

#pragma omp parallel \
shared(x,x_size,y_array,y_size,ddy_array,spline_mode,p,qn,un,u) \
private(index_y,index_x,sig,dy_first,dy_last)
Expand Down Expand Up @@ -1201,6 +1209,8 @@ int array_spline_table_one_column(
return _FAILURE_;
}

if (x_size==2) spline_mode = _SPLINE_NATURAL_; // in the case of only 2 x-values, only the natural spline method is appropriate, for _SPLINE_EST_DERIV_ at least 3 x-values are needed.

/************************************************/

index_x=0;
Expand Down Expand Up @@ -1334,6 +1344,8 @@ int array_logspline_table_one_column(
return _FAILURE_;
}

if (x_size==2) spline_mode = _SPLINE_NATURAL_; // in the case of only 2 x-values, only the natural spline method is appropriate, for _SPLINE_EST_DERIV_ at least 3 x-values are needed.

/************************************************/

index_x=0;
Expand Down

0 comments on commit 61bfe20

Please sign in to comment.