GOffice.CSpline

Fields

Name Type Access Description
a float r/w  
b float r/w  
c float r/w  
n int r/w  
ref_count int r/w  
x float r/w  
y float r/w  

Methods

class destroyl (sp)
class init (x, y, n, limits, c0, cn)
  destroy ()
  get_deriv (x)
  get_derivs (x, n)
  get_integrals (x, n)
  get_value (x)
  get_values (x, n)

Details

class GOffice.CSpline
classmethod destroyl(sp)
Parameters:sp (GOffice.CSplinel) –
classmethod init(x, y, n, limits, c0, cn)
Parameters:
  • x (float) – the x values
  • y (float) – the y values
  • n (int) – the number of x and y values
  • limits (int) – how the limits must be treated, four values are allowed: GOffice.CSplineType.NATURAL: first and least second derivatives are 0. GOffice.CSplineType.PARABOLIC: the curve will be a parabole arc outside of the limits. GOffice.CSplineType.CUBIC: the curve will be cubic outside of the limits. GOffice.CSplineType.CLAMPED: the first and last derivatives are imposed.
  • c0 (float) – the first derivative when using clamped splines, not used in the other limit types.
  • cn (float) – the first derivative when using clamped splines, not used in the other limit types.
Returns:

a newly created GOffice.CSpline instance which should be destroyed by a call to GOffice.CSpline.destroy.

Return type:

GOffice.CSpline

Creates a spline structure, and computes the coefficients associated with the polynoms. The ith polynome (between x[i-1] and x[i] is: y(x) = y[i-1] + (c[i-1] + (b[i-1] + a[i] * (x - x[i-1])) * (x - x[i-1])) * (x - x[i-1]) where a[i-1], b[i-1], c[i-1], x[i-1] and y[i-1] are the corresponding members of the new structure.

destroy()

Frees the spline structure when done.

get_deriv(x)
Parameters:x (float) – the GOffice.value
Returns:the interpolated derivative at x, or 0 if an error occurred.
Return type:float

sp must be a valid spline structure as returned by GOffice.CSpline.init.

get_derivs(x, n)
Parameters:
  • x (float) – a vector a values at which interpolation is requested.
  • n (int) – the number of interpolation requested.
Returns:

a newly allocated array of the n interpolated derivatives which should be destroyed by a call to GLib.free when not anymore needed, or None if an error occurred.

Return type:

float

sp must be a valid spline structure as returned by GOffice.CSpline.init. The x values must be sorted in increasing order.

get_integrals(x, n)
Parameters:
  • x (float) – a vector a values at which interpolation is requested.
  • n (int) – the number of interpolation requested.
Returns:

a newly allocated array of the n-1 integrals on the intervals between two consecutive values stored in x. which should be destroyed by a call to GLib.free when not anymore needed, or None if an error occurred.

Return type:

float

sp must be a valid spline structure as returned by GOffice.CSpline.init. The x values must be sorted in increasing order.

get_value(x)
Parameters:x (float) – The GOffice.value
Returns:the interpolated GOffice.value for x, or 0 if an error occurred.
Return type:float

sp must be a valid spline structure as returned by GOffice.CSpline.init.

get_values(x, n)
Parameters:
  • x (float) – a vector a values at which interpolation is requested.
  • n (int) – the number of interpolation requested.
Returns:

a newly allocated array of interpolated values which should be destroyed by a call to GLib.free when not anymore needed, or None if an error occurred.

Return type:

float

sp must be a valid spline structure as returned by GOffice.CSpline.init. The x values must be sorted in increasing order.