Skip to content
Snippets Groups Projects
Commit 7db8e3a2 authored by Stephan Hilb's avatar Stephan Hilb
Browse files

fix unit tests

parent a690445d
Branches
No related tags found
No related merge requests found
using Test, BenchmarkTools
using LinearAlgebra
using Random: MersenneTwister
using Test
using BenchmarkTools
using DualTVDD:
DualTVL1ROFOpProblem, ProjGradAlgorithm, ChambolleAlgorithm, DualTVDDAlgorithm, DualTVDDSurrogateAlgorithm,
init, step!, fetch_u, normB
const seed = 47
@testset "B = I" begin
g = Float64[0 2; 1 0]
prob = DualTVL1ROFOpProblem(g, I, 1e-10)
......@@ -21,7 +27,8 @@ end
@testset "B = rand(...)" begin
g = Float64[0 2; 1 0]
B = rand(length(g), length(g))
rng = MersenneTwister(seed)
B = rand(rng, length(g), length(g))
prob = DualTVL1ROFOpProblem(g, B, 1e-10)
@testset for alg in (ProjGradAlgorithm(prob, τ=1/8), ChambolleAlgorithm(prob))
......@@ -38,8 +45,9 @@ end
@testset "DualTVDDAlgorithm" begin
n = 5
ninner = 100
g = rand(n, n)
B = Diagonal(rand(n^2))
rng = MersenneTwister(seed)
g = rand(rng, n, n)
B = Diagonal(rand(rng, n^2))
# big λ is ok, since we test for inter-subdomain communication
prob = DualTVL1ROFOpProblem(g, B, 100.)
......@@ -62,13 +70,14 @@ end
d = 2
n = 5
ninner = 100
g = rand(n, n)
B = rand(n^2, n^2)
rng = MersenneTwister(seed)
g = rand(rng, n, n)
B = rand(rng, n^2, n^2)
B = I + 0.5 .* (B + B') ./ n^2
M = ntuple(_->2, d)
overlap = ntuple(_->2, d)
parallel = true
σ = 1.0
σ = 0.25
# big λ is ok, since we test for inter-subdomain communication
prob = DualTVL1ROFOpProblem(g, B, 1000.)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment