Example: 2D Jacobi iteration Stencil code
data dependencies of selected cell in 2d array.
to illustrate formal definition, ll have @ how 2 dimensional jacobi iteration can defined. update function computes arithmetic mean of cell s 4 neighbors. in case set off initial solution of 0. left , right boundary fixed @ 1, while upper , lower boundaries set 0. after sufficient number of iterations, system converges against saddle-shape.
i
=
[
0
,
…
,
99
]
2
s
=
r
s
0
:
z
2
→
r
s
0
(
(
x
,
y
)
)
=
{
1
,
x
<
0
0
,
0
≤
x
<
100
1
,
x
≥
100
s
=
(
(
0
,
−
1
)
,
(
−
1
,
0
)
,
(
1
,
0
)
,
(
0
,
1
)
)
t
:
r
4
→
r
t
(
(
x
1
,
x
2
,
x
3
,
x
4
)
)
=
0.25
⋅
(
x
1
+
x
2
+
x
3
+
x
4
)
{\displaystyle {\begin{aligned}i&=[0,\ldots ,99]^{2}\\s&=\mathbb {r} \\s_{0}&:\mathbb {z} ^{2}\to \mathbb {r} \\s_{0}((x,y))&={\begin{cases}1,&x<0\\0,&0\leq x<100\\1,&x\geq 100\end{cases}}\\s&=((0,-1),(-1,0),(1,0),(0,1))\\t&\colon \mathbb {r} ^{4}\to \mathbb {r} \\t((x_{1},x_{2},x_{3},x_{4}))&=0.25\cdot (x_{1}+x_{2}+x_{3}+x_{4})\end{aligned}}}
Comments
Post a Comment