Stellarator-Tools
All Classes Namespaces Files Functions Variables Typedefs Enumerations Macros Pages
guassian_process Module Reference

Defines the base class of the type guassian_process_class. The guassian_process contains code to compuet guassian process profiles. More...

Data Types

type  gaussp_class
 Base class representing a gaussian process. More...
 
type  gaussp_class_pointer
 Pointer to a gaussian process object. Used for creating arrays of gaussian process pointers. This is needed because fortran does not allow arrays of pointers directly. More...
 

Functions/Subroutines

type(gaussp_class) function, pointer gaussp_construct (a_model, n_signals, gaussp_type, profile_index, vrnc, tolerance, cholesky_fac)
 Construct a gaussp_class. More...
 
subroutine gaussp_destruct (this)
 Deconstruct a gaussp_class object. More...
 
subroutine gaussp_set_signal (this, signal, index)
 Set the object and coefficient for an index. More...
 
subroutine gaussp_set_profile (this, a_model)
 Set the object and coefficient for an index. More...
 
real(rprec) function gaussp_get_evidence (this, a_model)
 Calculates the evidence. More...
 

Detailed Description

Defines the base class of the type guassian_process_class. The guassian_process contains code to compuet guassian process profiles.

Function/Subroutine Documentation

◆ gaussp_construct()

type (gaussp_class) function, pointer guassian_process::gaussp_construct ( class (model_class), intent(in)  a_model,
integer, intent(in)  n_signals,
character(len=*), intent(in)  gaussp_type,
integer, intent(in)  profile_index,
real (rprec), dimension(:)  vrnc,
real (rprec)  tolerance,
real (rprec)  cholesky_fac 
)

Construct a gaussp_class.

Allocates memory and initializes a gaussp_class object. This just allocates the gaussp_class::signals, gaussp_class::a array, and matrixices for the GP computataion. The indices of these arrays are set by gaussp_set_signal, and the matrices are calculated in gaussp_get_modeled_signal

Parameters
[in]a_modelA model::model_class instance.
[in]n_signalsNumber of signals in this gaussian process.
[in]gaussp_typeThe type of profile modeled by the gaussian process.
[in]profile_indexIndex of the profile of the sxrem profile.
[in]vrncVariance values for the hyper parameters.
[in]toleranceConvergence value to maximize the log evidence.
[in]choleskey_facValue added to diagnoal element to ensure K is PSD.
Returns
A pointer to a constructed gaussp_class object.
Todo:
FIXME: The guassian process kernels should know the correct ranges. Query those instead. For now set all to infinity.

◆ gaussp_destruct()

subroutine guassian_process::gaussp_destruct ( type (gaussp_class), pointer  this)

Deconstruct a gaussp_class object.

Deallocates memory and uninitializes a gaussp_class object.

Parameters
[in,out]thisA gaussp_class instance.
Note
The destructors of the signals in the signal array are not called her because the gaussian process signals do not own the memory for those signals.

◆ gaussp_get_evidence()

real (rprec) function guassian_process::gaussp_get_evidence ( type (gaussp_class), intent(inout)  this,
class (model_class), pointer  a_model 
)

Calculates the evidence.

This method finds a gaussian process evidence. The matrices computed can be later used to set the profile.

Parameters
[in]thisA gaussp_class instance.
[in,out]a_modelA model instance.
Returns
The log evidence for the current hyper parameters.

◆ gaussp_set_profile()

subroutine guassian_process::gaussp_set_profile ( type (gaussp_class), intent(inout)  this,
class (model_class), pointer  a_model 
)

Set the object and coefficient for an index.

This method uses a gaussian process to set a model using the signals pointed in the gaussp_class::signals array. Hyper parameters are determined by maximizing the evidence.

Parameters
[in]thisA gaussp_class instance.
[in,out]a_modelA model instance.

◆ gaussp_set_signal()

subroutine guassian_process::gaussp_set_signal ( type (gaussp_class), intent(inout)  this,
class (signal_class), pointer  signal,
integer, intent(in)  index 
)

Set the object and coefficient for an index.

Parameters
[in,out]thisA gaussp_class instance.
[in]signalA signal_class instance.
[in]aA weight for the signal
[in]indexThe index to place the gaussp signal.
Note
Only signals that were created before this gaussian process can be added. Otherwise it will creat an infinitely recursive loop in gaussp_get_modeled_signal