Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
DependentParameter.h File Reference

Defines parameters whose values are lazily computed from other parameters. More...

#include <functional>
#include <memory>
#include <unordered_map>
#include "Parameter.h"
Include dependency graph for DependentParameter.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  DependentParameter
 Parameter whose value is computed from other parameters and cached lazily. More...
 

Typedefs

typedef std::function< void(const ParamSrc &, std::shared_ptr< DependentParameter >)> DepParamUpdateFunc
 Function signature used to recompute a DependentParameter.
 

Functions

std::shared_ptr< Parameter > & operator+= (std::shared_ptr< Parameter > &lhs, const std::shared_ptr< Parameter > &rhs)
 Adds the payload of one shared parameter into another.
 
std::shared_ptr< Parameter > & operator* (std::shared_ptr< Parameter > &lhs, const scalar_t &rhs)
 Scales a shared parameter in place.
 

Detailed Description

Defines parameters whose values are lazily computed from other parameters.

This file declares:

  • DepParamUpdateFunc: callback type used to recompute a dependent parameter
  • DependentParameter: a Parameter whose content is derived from source parameters

A DependentParameter participates in the parameter dependency graph:

  • it observes a set of source parameters,
  • it becomes dirty when one of them changes,
  • and it recomputes its cached value only on demand.

This class is the parameter-level counterpart of DependentBlock.

See also
Parameter
ParamSrc
Block

Definition in file DependentParameter.h.

Typedef Documentation

◆ DepParamUpdateFunc

Function signature used to recompute a DependentParameter.

The callback receives:

  • a ParamSrc view over all source parameters,
  • a shared pointer to the dependent parameter being updated.

The callback is expected to modify the dependent parameter in-place (for example with set_expected_silent(), set_std(), set_scale(), etc.).

Note
In the current implementation, the callback is called from DependentParameter::ensure_up_to_date().

Definition at line 47 of file DependentParameter.h.

Function Documentation

◆ operator*()

std::shared_ptr< Parameter > & operator* ( std::shared_ptr< Parameter > &  lhs,
const scalar_t rhs 
)
inline

Scales a shared parameter in place.

Current behavior:

  • if rhs is non-zero, applies *lhs *= rhs,
  • if rhs is zero, leaves lhs unchanged,
  • if lhs is null, behavior is undefined because it is dereferenced.
Warning
Despite the operator spelling, this function mutates lhs in place and returns it by reference.
Parameters
lhsShared parameter pointer to scale.
rhsMultiplicative factor.
Returns
Reference to lhs after scaling.

Definition at line 371 of file DependentParameter.h.

◆ operator+=()

std::shared_ptr< Parameter > & operator+= ( std::shared_ptr< Parameter > &  lhs,
const std::shared_ptr< Parameter > &  rhs 
)
inline

Adds the payload of one shared parameter into another.

Behavior:

  • if rhs is null: do nothing,
  • if both are non-null and have the same ParamId: performs *lhs += *rhs,
  • otherwise replaces lhs with a new copied Parameter built from *rhs.

This helper is intended for convenient accumulation of parameter values stored as std::shared_ptr<Parameter>.

Parameters
lhsLeft-hand side parameter pointer.
rhsRight-hand side parameter pointer.
Returns
Reference to lhs after modification/replacement.

Definition at line 345 of file DependentParameter.h.