Base.ndims
— Methodndims(A::Cholesky)
Extends ndims to return 2 if passed a Cholesky object
GPLinearODEMaker.assert_positive
— Methodassert_positive(vars...)
Examples
julia> GPLinearODEMaker.assert_positive([1,2,3,4])
julia> GPLinearODEMaker.assert_positive([-1,2,3,4])
ERROR: AssertionError: passed a negative/0 variable that needs to be positive
[...]
GPLinearODEMaker.auto_addprocs
— Methodauto_addprocs(;add_procs=0)
Adds either as many workers as there are CPU threads minus 2 if none are active or the amount specified by add_procs
GPLinearODEMaker.log_laplace_approximation
— Methodlog_laplace_approximation(H, g, logh; λ=1)
Compute the logarithm of the Laplace approxmation for the integral of a function of the following form ∫ exp(-λ g(y)) h(y) dy ≈ exp(-λ g(y)) h(y) (2π/λ)^(d/2) |H(y)|^(-1/2) where y is the value of y at the global mode and H is the (Hessian) matrix of second order partial derivatives of g(y) (see slide 10 of http://www.stats.ox.ac.uk/~steffen/teaching/bs2HT9/laplace.pdf). When used to calculate evidences, one can set λ = 1, g(y) = -log-likelihood, h(y) = model prior, and H(y) = the Fisher information matrix (FIM) or the Hessian matrix of the negative log-likelihood. Could possiblly improve with methods from Ruli et al. 2016 (https://arxiv.org/pdf/1502.06440.pdf)?
GPLinearODEMaker.powers_of_negative_one
— Methodpowers_of_negative_one(power)
Finds -1 ^ power without calling ^
Examples
julia> GPLinearODEMaker.powers_of_negative_one(0) == GPLinearODEMaker.powers_of_negative_one(2) == 1
true
julia> GPLinearODEMaker.powers_of_negative_one(1) == GPLinearODEMaker.powers_of_negative_one(3) == -1
true
GPLinearODEMaker.reconstruct_array
— Methodreconstruct_array(non_zero_entries, template_A)
Fill a matrix with non_zero_entries
at the locations of the non-zero entries in template_A
Examples
julia> template_A = [4. 0;5 0];
julia> non_zero_entries = [2., 3];
julia> GPLinearODEMaker.reconstruct_array(non_zero_entries, template_A)
2×2 Array{Float64,2}:
2.0 0.0
3.0 0.0
GPLinearODEMaker.remove_zeros
— Methodremove_zeros(V)
Return the a version of the passed vector after removing all zero entries. Could possibly be replaced with a view-based version.
Examples
julia> V = [1, 2, 0, 3, 0, 4, 5];
julia> GPLinearODEMaker.remove_zeros(V)
5-element Array{Int64,1}:
1
2
3
4
5
GPLinearODEMaker.ridge_chol
— Methodridge_chol(A)
Perform a Cholesky factorization on A
, adding a small ridge when necessary
Examples
julia> A = [4. 2;2 10];
julia> GPLinearODEMaker.ridge_chol(A)
LinearAlgebra.Cholesky{Float64,Array{Float64,2}}
U factor:
2×2 LinearAlgebra.UpperTriangular{Float64,Array{Float64,2}}:
2.0 1.0
⋅ 3.0
GPLinearODEMaker.sendto
— Methodsendto(workers; args...)
Send the args
to the workers
specified by thier number IDs. Stolen shamelessly from ParallelDataTransfer.jl
Examples
julia> sendto([1, 2], x=100, y=rand(2, 3));
julia> z = randn(10, 10); sendto(workers(), z=z);
GPLinearODEMaker.symmetric_A
— Methodsymmetric_A(A; ignore_asymmetry=false, chol=false)
Check if A
is approximately symmetric and then return a symmetrized version or, optionally, the Cholesky factorization
Examples
julia> A = [1. 1; 0 1];
julia> GPLinearODEMaker.symmetric_A(A; ignore_asymmetry=true)
2×2 LinearAlgebra.Symmetric{Float64,Array{Float64,2}}:
1.0 0.5
0.5 1.0
GPLinearODEMaker.symmetrize_A
— Methodsymmetrize_A(A)
Symmetrize A
(i.e. add its transpose and divide by 2)
Examples
julia> A = [1. 1; 0 1];
julia> GPLinearODEMaker.symmetrize_A(A)
2×2 LinearAlgebra.Symmetric{Float64,Array{Float64,2}}:
1.0 0.5
0.5 1.0