From 290965d70f2837f6b737c4991dafc7e6403b6ca6 Mon Sep 17 00:00:00 2001 From: Andy Zhang <37402126+AnzhiZhang@users.noreply.github.com> Date: Sun, 11 Aug 2024 13:52:39 +0100 Subject: [PATCH] test(matrices): add kms tests --- test/matrices/kms.jl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test/matrices/kms.jl diff --git a/test/matrices/kms.jl b/test/matrices/kms.jl new file mode 100644 index 0000000..516667d --- /dev/null +++ b/test/matrices/kms.jl @@ -0,0 +1,17 @@ +# constructors +@test allequal([ + KMS(5), + KMS(5, 0.5), + KMS{Float64}(5), + KMS{Float64}(5, 0.5), +]) + +# linear algebra functions +run_test_linearalgrbra_functions(KMS.(1:5)) + +# eltype +@test test_matrix_elements(KMS{Float32}(5)) + +# content +@test KMS(5) ≈ [1.0 0.5 0.25 0.125 0.0625; 0.5 1.0 0.5 0.25 0.125; 0.25 0.5 1.0 0.5 0.25; 0.125 0.25 0.5 1.0 0.5; 0.0625 0.125 0.25 0.5 1.0] +@test KMS(5, 3) ≈ [1 3 9 27 81; 3 1 3 9 27; 9 3 1 3 9; 27 9 3 1 3; 81 27 9 3 1]