Skip to content

Commit 703e29e

Browse files
Add batch tests
1 parent 7287e33 commit 703e29e

File tree

1 file changed

+60
-2
lines changed

1 file changed

+60
-2
lines changed

test/func.jl

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ K = 12
6363

6464
@test op1' === op1
6565

66-
@test size(op1) == (N,N)
66+
@test size(op1) == (N*K,N*K)
6767
@test has_adjoint(op1)
6868
@test has_mul(op1)
6969
@test !has_mul!(op1)
7070
@test has_ldiv(op1)
7171
@test !has_ldiv!(op1)
7272

73-
@test size(op2) == (N,N)
73+
@test size(op2) == (N*K,N*K)
7474
@test has_adjoint(op2)
7575
@test has_mul(op2)
7676
@test has_mul!(op2)
@@ -100,6 +100,64 @@ K = 12
100100
v = copy(u); @test A \ v ldiv!(op2, u)
101101
end
102102

103+
@testset "Batch FunctionOperator" begin
104+
# out of place
105+
op1 = FunctionOperator(f1, u, A*u;
106+
107+
op_inverse=f1i,
108+
109+
ifcache = false,
110+
batch = true,
111+
islinear=true,
112+
opnorm=true,
113+
issymmetric=true,
114+
ishermitian=true,
115+
isposdef=true,
116+
)
117+
118+
# in place
119+
op2 = FunctionOperator(f2, u, A*u;
120+
121+
op_inverse=f2i,
122+
123+
ifcache = false,
124+
batch = true,
125+
islinear=true,
126+
opnorm=true,
127+
issymmetric=true,
128+
ishermitian=true,
129+
isposdef=true,
130+
)
131+
132+
@test issquare(op1)
133+
@test issquare(op2)
134+
135+
@test islinear(op1)
136+
@test islinear(op2)
137+
138+
@test op1' === op1
139+
140+
@test size(op1) == (N,N)
141+
@test has_adjoint(op1)
142+
@test has_mul(op1)
143+
@test !has_mul!(op1)
144+
@test has_ldiv(op1)
145+
@test !has_ldiv!(op1)
146+
147+
@test size(op2) == (N,N)
148+
@test has_adjoint(op2)
149+
@test has_mul(op2)
150+
@test has_mul!(op2)
151+
@test has_ldiv(op2)
152+
@test has_ldiv!(op2)
153+
154+
@test !iscached(op1)
155+
@test !iscached(op2)
156+
157+
@test !op1.traits.has_mul5
158+
@test op2.traits.has_mul5
159+
end
160+
103161
@testset "FunctionOperator update test" begin
104162
u = rand(N,K)
105163
p = rand(N)

0 commit comments

Comments
 (0)