1 # a "yield" version of the REMAP algorithm. a little easier to read
2 # than the Finite State Machine version
4 from remapyield
import iterate_indices
7 def matrixscheduledemo():
8 ydim2
, xdim2
, ydim1
= (3, 4, 3)
10 print ("ydim2 xdim2 ydim1", ydim2
, xdim2
, ydim1
)
12 # got this from running an earlier version
54 # result uses SVSHAPE0
56 SVSHAPE0
.lims
= [xdim2
, ydim2
, 1]
57 SVSHAPE0
.order
= [0,1,2] # result iterates through i and j (modulo)
60 SVSHAPE0
.offset
= 0 # no offset
61 SVSHAPE0
.invxyz
= [0,0,0] # no inversion
64 SVSHAPE1
.lims
= [xdim2
, ydim2
, ydim1
]
65 SVSHAPE1
.order
= [0,2,1] # X iterates through i and k
68 SVSHAPE1
.offset
= 0 # no offset
69 SVSHAPE1
.invxyz
= [0,0,0] # no inversion
70 # y-selector uses SHAPE2
72 SVSHAPE2
.lims
= [xdim2
, ydim2
, ydim1
]
73 SVSHAPE2
.order
= [0,2,1] # X iterates through i and k
76 SVSHAPE2
.offset
= 0 # no offset
77 SVSHAPE2
.invxyz
= [0,0,0] # no inversion
79 # perform the iteration over the *linear* arrays using the
81 VL
= ydim2
* xdim2
* ydim1
83 for i
, idxs
in enumerate(zip(iterate_indices(SVSHAPE0
),
84 iterate_indices(SVSHAPE1
),
85 iterate_indices(SVSHAPE2
))):
89 print ("(", i
, ",", idxs
, "),", "expected", expected
[i
])
90 if expected
[i
] != (i
, idxs
):
91 print ("row incorrect")
95 if __name__
== '__main__':