Skip to content

Commit 6af0d5e

Browse files
committed
add matrix-variate distribution tests
1 parent 3ff9109 commit 6af0d5e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/runtests.jl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ cov_num = 1.0
1818
norm_val = ones(dim)
1919
alpha = ones(4)
2020
dir_val = fill(0.25, 4)
21+
beta_mat = rand(MatrixBeta(dim, dim, dim))
2122

2223
@testset "Univariate discrete distributions" begin
2324
uni_disc_dists = [
@@ -199,3 +200,23 @@ end
199200
end
200201
end
201202
end
203+
204+
@testset "Matrix-variate continuous distributions" begin
205+
matrix_cont_dists = [
206+
DistSpec(:((n1, n2)->MatrixBeta(dim, n1, n2)), (dim, dim), beta_mat),
207+
]
208+
broken_matrix_cont_dists = [
209+
DistSpec(:Wishart, (1.0, cov_mat), cov_mat),
210+
DistSpec(:InverseWishart, (1.0, cov_mat), cov_mat),
211+
DistSpec(:MatrixNormal, (cov_mat, cov_mat, cov_mat), cov_mat),
212+
DistSpec(:(()->MatrixNormal(dim, dim)), (), cov_mat),
213+
DistSpec(:MatrixTDist, (1.0, cov_mat, cov_mat, cov_mat), cov_mat),
214+
DistSpec(:MatrixFDist, (dim, dim, cov_mat), cov_mat),
215+
]
216+
217+
for d in matrix_cont_dists
218+
for testf in get_all_functions(d, true)
219+
test_ad(testf.f, testf.x)
220+
end
221+
end
222+
end

0 commit comments

Comments
 (0)