MatrixBuilder#

class MCEq.core.MatrixBuilder(particle_manager)[source]#

Bases: object

This class constructs the interaction and decay matrices.

Attributes Summary

dim

Energy grid (dimension)

dim_states

Number of cascade particles times dimension of grid (dimension of the equation system)

Methods Summary

construct_matrices([skip_decay_matrix])

Constructs the matrices for calculation.

cont_loss_operator(pdg_id)

Returns continuous loss operator that can be summed with appropriate position in the C matrix.

Attributes Documentation

dim#

Energy grid (dimension)

dim_states#

Number of cascade particles times dimension of grid (dimension of the equation system)

Methods Documentation

construct_matrices(skip_decay_matrix=False)[source]#

Constructs the matrices for calculation.

These are:

  • :math:`boldsymbol{M}_{int} = (-boldsymbol{1} +

    boldsymbol{C}){boldsymbol{Lambda}}_{int}`,

  • :math:`boldsymbol{M}_{dec} = (-boldsymbol{1} +

    boldsymbol{D}){boldsymbol{Lambda}}_{dec}`.

For debug_levels >= 2 some general information about matrix shape and the number of non-zero elements is printed. The intermediate matrices \(\boldsymbol{C}\) and \(\boldsymbol{D}\) are deleted afterwards to save memory.

Set the skip_decay_matrix flag to avoid recreating the decay matrix. This is not necessary if, for example, particle production is modified, or the interaction model is changed.

Parameters:

skip_decay_matrix (bool) – Omit re-creating D matrix

cont_loss_operator(pdg_id)[source]#

Returns continuous loss operator that can be summed with appropriate position in the C matrix.