118 |
val partial = Partials.partial dim |
val partial = Partials.partial dim |
119 |
fun f (i, axes) = Partials.axis i :: axes |
fun f (i, axes) = Partials.axis i :: axes |
120 |
fun g axes = |
fun g axes = |
121 |
(DstV.new(String.concat("y" :: List.map Partials.axisToString axes)), partial axes) |
(DstV.new(String.concat("r" :: List.map Partials.axisToString axes)), partial axes) |
122 |
in |
in |
123 |
IT.create (k-1, dim, fn _ => (), f, g, []) |
IT.create (k, dim, fn _ => (), f, g, []) |
124 |
|
end |
125 |
|
val _ = let |
126 |
|
val indentWid = ref 2 |
127 |
|
fun inc () = (indentWid := !indentWid + 2) |
128 |
|
fun dec () = (indentWid := !indentWid - 2) |
129 |
|
fun indent () = print(CharVector.tabulate(!indentWid, fn _ => #" ")) |
130 |
|
fun nd () = (indent(); print "ND\n"); |
131 |
|
fun lf (x, partial) = ( |
132 |
|
indent(); print(concat["LF(", DstV.toString x, ", ", Partials.partialToString partial, ")\n"])) |
133 |
|
fun pr (Shape.ND(attr, kids)) = (nd attr; inc(); List.app pr kids; dec()) |
134 |
|
| pr (Shape.LF attr) = lf attr |
135 |
|
in |
136 |
|
print "diffIter:\n"; |
137 |
|
pr diffIter |
138 |
end |
end |
139 |
(* generate code to load the voxel data; since we a vector load operation to load the |
(* generate code to load the voxel data; since we a vector load operation to load the |
140 |
* fastest dimension, the height of the tree is one less than the dimension of space. |
* fastest dimension, the height of the tree is one less than the dimension of space. |
160 |
fun pr (Shape.ND(attr, kids)) = (nd attr; inc(); List.app pr kids; dec()) |
fun pr (Shape.ND(attr, kids)) = (nd attr; inc(); List.app pr kids; dec()) |
161 |
| pr (Shape.LF attr) = lf attr |
| pr (Shape.LF attr) = lf attr |
162 |
in |
in |
163 |
|
print "voxIter:\n"; |
164 |
pr voxIter |
pr voxIter |
165 |
end |
end |
166 |
val loadCode = let |
val loadCode = let |
198 |
fun genProbeCode (IT.LF arg, code) = probeElem arg @ code |
fun genProbeCode (IT.LF arg, code) = probeElem arg @ code |
199 |
fun getProbeVar (IT.LF(t, _)) = t |
fun getProbeVar (IT.LF(t, _)) = t |
200 |
in |
in |
201 |
cons (result, List.map getProbeVar kids) :: List.foldr genProbeCode code kids |
List.foldr genProbeCode (cons (result, List.map getProbeVar kids) :: code) kids |
202 |
end |
end |
203 |
| genProbe (result, IT.ND(_, kids), code) = let |
| genProbe (result, IT.ND(_, kids), code) = let |
204 |
val tmps = List.tabulate(dim, fn i => DstV.new("t"^Int.toString i)) |
val tmps = List.tabulate(dim, fn i => DstV.new("t"^Int.toString i)) |
205 |
|
val code = cons(result, tmps) :: code |
206 |
fun lp ([], [], code) = code |
fun lp ([], [], code) = code |
207 |
| lp (t::ts, kid::kids, code) = genProbe(t, kid, lp(ts, kids, code)) |
| lp (t::ts, kid::kids, code) = genProbe(t, kid, lp(ts, kids, code)) |
|
val code = cons(result, tmps) :: code |
|
208 |
in |
in |
209 |
lp (tmps, kids, code) |
lp (tmps, kids, code) |
210 |
end |
end |