@@ -338,17 +338,30 @@ Base.:(==)(a::UniqueInterval, b::UniqueInterval) = (@assert a.parentinterval ==
338
338
end
339
339
end
340
340
341
- @testset " ProductFun " begin
341
+ @testset " Bivariate " begin
342
342
f = (x,y)-> x^ 2 * y^ 3
343
343
P = ProductFun (f, Chebyshev ()⊗ Chebyshev ())
344
344
x = 0.2 ; y = 0.3 ;
345
345
@test P (x, y) ≈ f (x,y)
346
346
347
+ @test (P * one (P))(x,y) ≈ P (x,y)
348
+ @test (P + zero (P))(x,y) ≈ P (x,y)
349
+
347
350
# coefficients copied from P above
348
351
coeffs = SVector {4} (zeros (3 ), [0.375 , 0 , 0.375 ], zeros (3 ), [0.125 , 0 , 0.125 ])
349
352
fv = [Fun (Chebyshev (), c) for c in coeffs]
350
353
P2 = @inferred ProductFun (fv, Chebyshev ())
351
354
@test P2 (x, y) ≈ f (x, y)
355
+
356
+ L = LowRankFun (f, Chebyshev ()⊗ Chebyshev ())
357
+ @test (@inferred L * P)(x, y) ≈ (@inferred P * L)(x, y) ≈ f (x,y)^ 2
358
+
359
+ @test (L^ 0 * L)(x,y) ≈ L (x,y)
360
+ @test (@inferred ((L -> L^ 1 )(L)))(x,y) ≈ L (x,y)
361
+ @test (@inferred ((L -> L^ 2 )(L)))(x,y) ≈ (L* L)(x,y)
362
+ @test (@inferred ((L -> L^ 4 )(L)))(x,y) ≈ (L* L* L* L)(x,y)
363
+ @test (L * one (L))(x,y) ≈ L (x,y)
364
+ @test (L + zero (L))(x,y) ≈ L (x,y)
352
365
end
353
366
end
354
367
0 commit comments