Algebra common utilities

diageye

ReactiveMP.diageyeFunction
diageye(::Type{T}, n::Int)

An alias for the Matrix{T}(I, n, n). Returns a matrix of size n x n with ones (of type T) on the diagonal and zeros everywhere else.

source
diageye(n::Int)

An alias for the Matrix{Float64}(I, n, n). Returns a matrix of size n x n with ones (of type Float64) on the diagonal and zeros everywhere else.

source
ReactiveMP.CompanionMatrixType
CompanionMatrix

Represents a matrix of the following structure:

θ1 θ2 θ3 ... θn-1 θn 1 0 0 ... 0 0 0 1 0 ... 0 0 . . . ... . . . . . ... . . 0 0 0 ... 0 0 0 0 0 ... 1 0

source
ReactiveMP.PermutationMatrixType

PermutationMatrix(ind::Array{T}) creates a permutation matrix with ones at coordinates (k, ind[k]) for k = 1:length(ind).

A permutation matrix represents a matrix containing only zeros and ones, which basically permutes the vector or matrix it is multiplied with. These matrices A are constrained by:

\[ A_{ij} = \{0, 1\}\\ ∑_{i} A_{ij} = 1\\ ∑_{j} A_{ij} = 1\]

An example is the 3-dimensional permutation matrix

\[A = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 0 & 1 \\ 1 & 0 & 0 \end{bmatrix}\]

source
ReactiveMP.StandardBasisVectorType
StandardBasisVector{T, len, ind}(scale::T)

StandardBasisVector creates a standard Cartesian basis vector of zeros of length len with a single element scale at index ind.

An example is the 3-dimensional standard basis vector for the first dimension

\[e = \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix}\]

Which can be constructed by calling e = StandardBasisVector(3, 1, 1)

source
ReactiveMP.ImportanceSamplingApproximationType
ImportanceSamplingApproximation

This structure stores all information needed to perform an importance sampling procedure and provides convenient functions to generate samples and weights to approximate expectations

Fields

  • rng: random number generator objects
  • nsamples: number of samples generated by default
source
ReactiveMP.rank1updateFunction
rank1update(A, x)
rank1update(A, x, y)

Helper function for A + x * y'. Uses optimised BLAS version for AbstractFloats and fallbacks to a generic implementation in case of differentiation

source
ReactiveMP.besselmodFunction

Modified-bessel function of second kind

mx, vx : mean and variance of the random variable x my, vy : mean and variance of the random variable y rho : correlation coefficient

source