forked from JuliaFirstOrder/ProximalOperators.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_epicompose.jl
51 lines (43 loc) · 927 Bytes
/
test_epicompose.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using Test
using LinearAlgebra
using SparseArrays
using ProximalOperators
@testset "Epicompose (Gram-diagonal)" begin
n = 5
for R in [Float64] # TODO: enable Float32?
for T in [R, Complex{R}]
A = randn(T, n, n)
Q, _ = qr(A)
mu = R(2)
L = mu*Q
Lfs = [
(L, NormL1(R(1))),
(sparse(L), NormL1(R(1))),
]
for (L, f) in Lfs
g = Epicompose(L, f, mu)
x = randn(T, n)
prox_test(g, x, R(2))
end
end
end
end
@testset "Epicompose (Quadratic)" begin
n = 5
m = 3
for R in [Float64] # TODO: enable Float32?
W = randn(R, n, n)
Q = W' * W
q = randn(R, n)
L = randn(R, m, n)
Lfs = [
(L, Quadratic(Q, q)),
(sparse(L), Quadratic(sparse(Q), q)),
]
for (L, f) in Lfs
g = Epicompose(L, f)
x = randn(R, m)
prox_test(g, x, R(2))
end
end
end