Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/vis12/src/compiler/high-to-mid/probe.sml
ViewVC logotype

Diff of /branches/vis12/src/compiler/high-to-mid/probe.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1685, Sun Jan 22 15:23:36 2012 UTC revision 1795, Thu Apr 5 12:00:08 2012 UTC
# Line 242  Line 242 
242            in            in
243              case ImageInfo.voxelShape v              case ImageInfo.voxelShape v
244               of [] => toImgSpaceCode @ doVoxelSample (result, v, k, s, diffIter(), vars, 0)               of [] => toImgSpaceCode @ doVoxelSample (result, v, k, s, diffIter(), vars, 0)
245    (*
246                | [d] => let                | [d] => let
247                    val sampleTy = DstTy.TensorTy(List.tabulate(k, fn _ => d))                  (* the result will be a vector of k-order tensors; each element of the vector
248                     * has the sampleTy = tensor[dim,...,dim].
249                     *)
250                      val sampleTy = DstTy.TensorTy(List.tabulate(k, fn _ => dim))
251                    fun doSamples (offset, xs, code) = if (offset < 0)                    fun doSamples (offset, xs, code) = if (offset < 0)
252                          then code @ [cons(result, xs)]                          then code @ [cons(result, xs)]
253                          else let                          else let
# Line 255  Line 259 
259                    in                    in
260                      toImgSpaceCode @ doSamples (d-1, [], [])                      toImgSpaceCode @ doSamples (d-1, [], [])
261                    end                    end
262                | _ => raise Fail "image data with order > 1 not supported yet"  *)
263                  | shape => let
264                    (* the result will be a d1 x d2 matrix of k-order tensors; each element of the matrix
265                     * has the sampleTy = tensor[dim,...,dim].
266                     *)
267                      val sampeShape = List.tabulate(k, fn _ => dim)
268                      fun gen (y, d::dd, offset, code) = let
269                            val prefix = DstV.name y
270                            val xs = List.tabulate(d,
271                                  fn i => DstV.new(
272                                    concat[prefix, "_", Int.toString i],
273                                    DstTy.TensorTy(dd @ sampeShape)))
274                            val code = cons(y, xs) :: code
275                            in
276                              List.foldr (fn (x, (off, cd)) => gen(x, dd, off, cd)) (offset, code) xs
277                            end
278                        | gen (y, [], offset, code) =
279                            (offset-1, doVoxelSample (y, v, k, s, diffIter(), vars, offset) @ code)
280                      val (_, code) = gen (result, shape, ImageInfo.stride v - 1, [])
281                      in
282                        toImgSpaceCode @ code
283                      end
284              (* end case *)              (* end case *)
285            end            end
286    

Legend:
Removed from v.1685  
changed lines
  Added in v.1795

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0