This repository was archived by the owner on Jan 26, 2026. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ import ddptensor as aa
2+
3+ # import numpy as aa
4+ import numpy as np
5+
6+ aa .init (False )
7+
8+ n = 16
9+ r = 2
10+ A = aa .ones ((n , n ), dtype = aa .int64 )
11+ B = aa .zeros ((n , n ), dtype = aa .int64 )
12+ W = aa .ones (((2 * r + 1 ), (2 * r + 1 )), dtype = aa .int64 )
13+ for i in range (3 ):
14+ # if i:
15+ # C = B[2:n-2,2:n-2]
16+ # B[2:n-2,2:n-2] = C
17+ # else:
18+ # D = B[2:n-2,2:n-2]
19+ B [2 : n - 2 , 2 : n - 2 ] = (
20+ B [2 : n - 2 , 2 : n - 2 ]
21+ + W [2 , 2 ] * A [2 : n - 2 , 2 : n - 2 ]
22+ + W [2 , 0 ] * A [2 : n - 2 , 0 : n - 4 ]
23+ + W [2 , 1 ] * A [2 : n - 2 , 1 : n - 3 ]
24+ + W [2 , 3 ] * A [2 : n - 2 , 3 : n - 1 ]
25+ + W [2 , 4 ] * A [2 : n - 2 , 4 : n - 0 ]
26+ + W [0 , 2 ] * A [0 : n - 4 , 2 : n - 2 ]
27+ + W [1 , 2 ] * A [1 : n - 3 , 2 : n - 2 ]
28+ + W [3 , 2 ] * A [3 : n - 1 , 2 : n - 2 ]
29+ + W [4 , 2 ] * A [4 : n - 0 , 2 : n - 2 ]
30+ )
31+ # A[2:n-2,2:n-2] \
32+ # + A[2:n-2,2:n-2] \
33+ # + A[2:n-2,0:n-4] \
34+ # + A[2:n-2,1:n-3] \
35+ # + A[2:n-2,3:n-1] \
36+ # + A[2:n-2,4:n-0] \
37+ # + A[0:n-4,2:n-2] \
38+ # + A[1:n-3,2:n-2] \
39+ # + A[3:n-1,2:n-2] \
40+ # + A[4:n-0,2:n-2]
41+ A [0 :n , 0 :n ] = A + 1
42+ print (B )
43+
44+ aa .fini ()
You can’t perform that action at this time.
0 commit comments