From d795d24e410a6a082b00f1590d5fc3e159f95571 Mon Sep 17 00:00:00 2001 From: Seren Lee Date: Wed, 11 Dec 2024 14:24:59 -0800 Subject: [PATCH 1/4] Update inprod(a,b) --- src/BUGSPrimitives/functions.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BUGSPrimitives/functions.jl b/src/BUGSPrimitives/functions.jl index 948d18601..b1697cecb 100644 --- a/src/BUGSPrimitives/functions.jl +++ b/src/BUGSPrimitives/functions.jl @@ -31,7 +31,7 @@ end Inner product of ``a`` and ``b``. """ function inprod(a, b) - return a * b + return LinearAlgebra.dot(a,b) end """ From a4cd10dd2429e2aad33dd69a4309988fed772196 Mon Sep 17 00:00:00 2001 From: Seren Lee Date: Fri, 13 Dec 2024 10:01:35 -0800 Subject: [PATCH 2/4] Update test bugs_primitives.jl --- test/bugs_primitives.jl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/bugs_primitives.jl b/test/bugs_primitives.jl index 69505e2f7..357510acc 100644 --- a/test/bugs_primitives.jl +++ b/test/bugs_primitives.jl @@ -27,3 +27,9 @@ end ] LogDensityProblems.logdensity_and_gradient(ad_model, theta) end + +@testset "inprod(a,b)" begin + A = [3, 0.7, 6] + B = [2.6, 1.3, 3] + @test JuliaBUGS.BUGSPrimitives.inprod(A,B) = 26.71 +end From 37dff0cf52d3224d5d375feece19cf3732ec5c59 Mon Sep 17 00:00:00 2001 From: Seren Lee Date: Fri, 13 Dec 2024 12:30:16 -0800 Subject: [PATCH 3/4] Fix typo --- test/bugs_primitives.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/bugs_primitives.jl b/test/bugs_primitives.jl index 357510acc..773d69f22 100644 --- a/test/bugs_primitives.jl +++ b/test/bugs_primitives.jl @@ -31,5 +31,5 @@ end @testset "inprod(a,b)" begin A = [3, 0.7, 6] B = [2.6, 1.3, 3] - @test JuliaBUGS.BUGSPrimitives.inprod(A,B) = 26.71 + @test JuliaBUGS.BUGSPrimitives.inprod(A,B) == 26.71 end From ea0d544382cf0423e8046222b752c97b2e01428d Mon Sep 17 00:00:00 2001 From: Xianda Sun Date: Fri, 13 Dec 2024 16:13:36 -0800 Subject: [PATCH 4/4] formatting --- src/BUGSPrimitives/functions.jl | 2 +- test/bugs_primitives.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BUGSPrimitives/functions.jl b/src/BUGSPrimitives/functions.jl index b1697cecb..c564e15ea 100644 --- a/src/BUGSPrimitives/functions.jl +++ b/src/BUGSPrimitives/functions.jl @@ -31,7 +31,7 @@ end Inner product of ``a`` and ``b``. """ function inprod(a, b) - return LinearAlgebra.dot(a,b) + return LinearAlgebra.dot(a, b) end """ diff --git a/test/bugs_primitives.jl b/test/bugs_primitives.jl index 773d69f22..212e45d01 100644 --- a/test/bugs_primitives.jl +++ b/test/bugs_primitives.jl @@ -31,5 +31,5 @@ end @testset "inprod(a,b)" begin A = [3, 0.7, 6] B = [2.6, 1.3, 3] - @test JuliaBUGS.BUGSPrimitives.inprod(A,B) == 26.71 + @test JuliaBUGS.BUGSPrimitives.inprod(A, B) == 26.71 end