The functions module

A module which contains various reference functions which are useful for frequency combination functions.

functions.identity(vec)[source]

Apply the identity function to the input value (x).

We recall that the identify function is expressed as follows: \(f(x) = x\)

Parameters

vec (float array like) – the input vector

Warning

No verifications are carried out within the function so the user must make sure the input vector only has one component, as implicitely assumed.

functions.identity_gradient(vec)[source]

Apply the gradient of the identity function to the input value (x).

We recall that the gradient of the identify function is expressed as follows: \(\vec{\Delta} f(x) = 1\)

Parameters

vec (float array like) – the input vector

Warning

No verifications are carried out within the function so the user must make sure the input vector only has one component, as implicitely assumed.

functions.norm(vec)[source]

Return the norm of an input vector.

We recall that the norm is expressed as follows: \(\|(\vec{v})\| = \sqrt{\sum_i v_i^2}\)

Parameters

vec (float array like) – the input vector

functions.norm_gradient(vec)[source]

Return the gradient of the norm function for an input vector.

We recall that the gradient of the norm function takes on the following expression: \(\vec{\Delta}\|(\vec{v})\| = \frac{\vec{v}}{\|\vec{v}\|}\)

Parameters

vec (float array like) – the input vector

functions.ratio(vec)[source]

Return the ratio for input values (x,y).

We recall that the ratio function is expressed as follows: \(f(x,y) = \frac{x}{y}\)

Parameters

vec (float array like) – the input vector

Warning

No verifications are carried out within the function so the user must make sure the input vector only has two components, as implicitely assumed.

functions.ratio_gradient(vec)[source]

Return the gradient of the ratio function for input values (x,y).

We recall that gradient of the ratio function is expressed as follows: \(\vec{\Delta} f(x,y) = \left(\frac{1}{y},-\frac{x}{y^2}\right)\)

Parameters

vec (float array like) – the input vector

Warning

No verifications are carried out within the function so the user must make sure the input vector only has two components, as implicitely assumed.