Skip to content

Commit 4d9bfa9

Browse files
committed
tests
1 parent 08d7050 commit 4d9bfa9

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

test/func.jl

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,34 @@ end
9797

9898
f(du,u,p,t) = mul!(du, Diagonal(p*t), u)
9999

100-
op = FunctionOperator(f, u, u; p=zero(p), t=zero(t))
101-
102-
op = cache_operator(op, u, u)
100+
L = FunctionOperator(f, u, u; p=zero(p), t=zero(t))
103101

104102
ans = @. u * p * t
105-
@test op(u,p,t) ans
106-
v=copy(u); @test op(v,u,p,t) ans
103+
@test L(u,p,t) ans
104+
v=copy(u); @test L(v,u,p,t) ans
105+
106+
A = Diagonal(p * t)
107+
108+
u1 = rand(N, K)
109+
u2 = rand(N, K)
110+
111+
v1 = L * u1
112+
v2 = L * u2
113+
@test v1 + v2 A * (u1 + u2)
114+
115+
v1 .= 0.0
116+
v2 .= 0.0
117+
118+
mul!(v1, L, u1)
119+
mul!(v2, L, u2)
120+
@test v1 + v2 A * (u1 + u2)
121+
122+
v1 = rand(N, K); w1 = copy(v1)
123+
v2 = rand(N, K); w2 = copy(v2)
124+
a1, a2, b1, b2 = rand(4)
125+
126+
mul!(v1, L, u1, a1, b1)
127+
mul!(v2, L, u2, a2, b2)
128+
@test v1 + v2 (a1*A*u1 + b1*w1) + (a2*A*u2 + b2*w2)
107129
end
108130
#

0 commit comments

Comments
 (0)