Algebra common utilities
diageye
ReactiveMP.diageye — Function
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.
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.
ReactiveMP.CompanionMatrix — Type
CompanionMatrixRepresents 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
ReactiveMP.PermutationMatrix — Type
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}\]
ReactiveMP.StandardBasisVector — Type
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)
ReactiveMP.GammaShapeLikelihood — Type
ν(x) ∝ exp(p*β*x - p*logГ(x)) ≡ exp(γ*x - p*logГ(x))ReactiveMP.ImportanceSamplingApproximation — Type
ImportanceSamplingApproximationThis 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 objectsnsamples: number of samples generated by default
ReactiveMP.mul_inplace! — Function
mul_inplace!(alpha, A)Returns alpha * A, modifying and reusing A storage if possible.
See also: negate_inplace!
ReactiveMP.negate_inplace! — Function
ReactiveMP.mul_trace — Function
mul_trace(A, B)Computes tr(A * B) without allocating A * B.
ReactiveMP.rank1update — Function
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
ReactiveMP.v_a_vT — Function
v_a_vT(v, a)Computes vav^T efficiently.
ReactiveMP.powerset — Function
powerset(iterator)Computes the set of all possible sets of the iterator.
ReactiveMP.besselmod — Function
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
ReactiveMP.isonehot — Function
isonehot(vec::AbstractVector)Checks if the given vector vec is a one-hot vector, i.e., a vector with exactly one entry approximately equal to one(eltype(vec)) and all other entries approximately equal to zero(eltype(vec)).
Returns true if vec is one-hot, otherwise returns false.