ParameterVar

MCBB.ParameterVarType
ParameterVar

Parameter Variation types, these structs holds information about the parameters and how they should be varied. For many cases this struct is automaticlly initialized when calling DEMCBBProblem with appropiate Tuples. It assumes that the parameters are itself structs most commonly with a field that has to be varied.

Type Hierachy

  • OneDimParameterVar, MultiDimParameterVar <: ParameterVar
  • ParameterVarArray, ParameterVarFunc <: OneDimParameterVar
  • MulitDimParameterVarArray, MultiDimParameterVarFunc <: MultiDimParameterVar
source
MCBB.ParameterVarArrayType
ParameterVarArray

Type for the parameter variation with an array that holds all parameter values. The struct has the fields:

  • name: Symbol of the name of the parameter
  • new_val:: Function that returns a new value, signature: (i::Int) -> new_value::Number or ()-> new_value::Number
  • new_par:: Function that returns a new parameter struct, default: Parameters.reconstruct, signature: (old_par; Dict(name=>new_val)) = new_par
  • N :: Length of the array / Number of parameter values
  • arr :: The input array saved

Initialization

  • ParameterVar(name::Symbol, arr::AbstractArray, new_par::Function)
  • ParameterVar(name::Symbol, arr::AbstractArray)
  • name is the name of the field of the parameter struct that should be varied
  • arr is the array that containts all values the parameter should be varied to.
source
MCBB.ParameterVarFuncType
ParameterVarFunc

Struct for the parameter variation with a function that generates new values. The struct has the fields:

  • name: Symbol of the name of the parameter
  • new_val:: Function that returns a new value, signature: (i::Int) -> new_value::Number
  • new_par:: Function that returns a new parameter struct, default: Parameters.reconstruct, signature: (old_par; Dict(name=>new_val)) = new_par

Initialization

  • ParameterVar(name::Symbol, func::Function, new_par::Function)
  • ParameterVar(name::Symbol, func::Function)
  • name is the name of the field of the parameter struct that should be varied
  • func is the function that generates the parameter values, signature: (i::Int) -> new_value::Number
source
MCBB.MultiDimParameterVarType
MultiDimParameterVar

Holds information about multiple parameters that should be varied simultaneously. The struct has the fields:

  • data: 1-D Array of OneDimParamterVar
  • Function: function that returns a new parameter struct given keyword arguments of all parameters that should be varied. signature: (old_par; Dict(name_1=>new_val_1, name_2=>new_val_2, ...)) = new_par
  • N: Number of parameters that are varied.

Internally there are two different main types, MultiDimParameterVarFunc and MultiDimParameterVarArray. The only difference is what type of ParameterVar they store. The different types are needed for dispatching on them in the routines that setups DEMCBBProblem

For Hidden Parameter Varition (see HiddenParameterVar) there is MultiDimHiddenParameterVar. It always takes the hidden parameters from the first HiddenParameterVar it is initialized with.

Initialization

  • MultiDimParameterVar(data::Array{ParameterVarFunc,1}, func::Function)
  • MultiDimParameterVar(data::Array{ParameterVarArray,1}, func::Function)
  • MultiDimParameterVar(parvar::ParameterVar, func::Function)
  • MultiDimParameterVar(parvar::ParameterVar): default function is Parameters.reconstruct
source
MCBB.HiddenParameterVarType
struct HiddenParameterVar <: ParameterVar

Subtype of ParameterVar that varies a lot of "hidden"/"background" parameters randomly and one control parameter. If multiple control parameters need to varied, MultiDimHiddenParameterVar has to be used.

Fields

  • name::Symbol
  • pars::AbstractArray stores the values of the hidden parameters
  • new_par::Function function that returns new parameter instance with signature (pars[i,:]..., name=>new_val()) -> new_parameters
  • new_val::Function:: Function that returns new values for the control parameters (i::Int)->new_val::Number
  • N_control_par::Int: Number of control parameters drawn/used
  • N_hidden_par::Int: Number of 'hidden' parameters
  • flag_repeat_hidden_pars::Bool: If true the values pars for the hidden parameters are repeated for every value of the control parameter. If false, then N_control_par==N_hidden_par.

Initialization

HiddenParameterVar(name::Symbol, pars::AbstractArray, new_par::Function, new_val::Function, N_control_par::Int, N_hidden_par::Union{Int, Nothing}=nothing, flag_repeat_hidden_pars::Bool=true)

HiddenParameterVar(name::Symbol, f::Function, new_par, new_val, N_control_par::Int, N_hidden_par::Int, flag_repeat_hidden_pars::Bool=true)

* `f` : Is the function that returns the hidden parameters. Signature `(i)->pars[i,:]` or `()->pars[i,:]`.
source
Base.getindexMethod
getindex(parvar::MultiDimParameterVar, i::Int)

Like regular arrays the individual ParameterVar entries can be accessed with square brackets e.g.: parvar[i].

source
Base.lengthMethod
length(parvar::MultiDimParameterVar)

Length returns the amount of Parameters that are setup to be varied.

source
MCBB.ParameterVarMethod
ParameterVar(prob::myMCProblem)

Given one of the problem types of this library its ParameterVar is returned.

source