comparison src/SbpOperators/volumeops/inference_trouble.txt @ 919:b41180efb6c2 performance/get_region_type_inference

Start refactor to improve type stability for apply(op,::TensorApplication,...)
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 21 Feb 2022 10:33:58 +0100
parents
children f1c2a4fa0ee1
comparison
equal deleted inserted replaced
911:a378ab959b6f 919:b41180efb6c2
1 Innan ändringarna på den här branchen:
2
3 begin
4 using Sbplib
5 using Sbplib.Grids
6 using Sbplib.SbpOperators
7
8 g = EquidistantGrid((10,10),(0.,0.), (1.,1.))
9 v = evalOn(g, (x,y)->x^2+y^2+1)
10 H = inner_product(g, 1., [1/2])
11 end
12
13 # Not type stable
14 LazyTensors.apply(H.t1, H.t2*v, 1,2)
15 @code_warntype LazyTensors.apply(H.t1, H.t2*v, 1,2)
16 @code_warntype LazyTensors.apply(H.t1.tm, view(H.t2*v,:,1), 2)
17
18 # Nedan är halvdåliga
19 @code_warntype LazyTensors.apply(H.t1.tm, view(H.t2*v,1,:), 2)
20 @code_warntype LazyTensors.apply(H.t1.tm, view(v,1,:), 2)
21 @code_warntype LazyTensors.apply(H.t1.tm, view(v,:,1), 2)
22 @code_warntype LazyTensors.apply(H.t1.tm, v[:,1], 2)
23
24
25
26
27
28
29
30
31
32 begin
33 using Sbplib
34 using Sbplib.Grids
35 using Sbplib.SbpOperators
36 import Sbplib.SbpOperators: Stencil
37 using Sbplib.RegionIndices
38
39 g = EquidistantGrid(10,0., 1.)
40 v = evalOn(g, (x)->x^2+1)
41 H = inner_product(g, 1., [1/2])
42 V = SbpOperators.volume_operator(g, Stencil(1.,center=1), (Stencil(1/2,center=1),), SbpOperators.even,1)
43 b = SbpOperators.boundary_operator(g, Stencil(1/2,center=1), CartesianBoundary{1,Lower}())
44 end
45
46 @code_warntype LazyTensors.apply(H, H*v, 2)
47 @code_warntype LazyTensors.apply(V, V*v, 2)
48 @code_warntype LazyTensors.apply(b, b*v, 2)
49
50
51
52 begin
53 end