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

SCM Repository

[diderot] Diff of /branches/vis12/src/compiler/fields/test-kernel.sml
ViewVC logotype

Diff of /branches/vis12/src/compiler/fields/test-kernel.sml

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

revision 153, Fri Jul 9 18:59:12 2010 UTC revision 155, Fri Jul 9 21:38:01 2010 UTC
# Line 108  Line 108 
108              OS.Process.system (concat["/usr/bin/open ", name, ".eps"])              OS.Process.system (concat["/usr/bin/open ", name, ".eps"])
109            end            end
110    
111        fun polyToString poly = let
112              fun c2s c = Format.format "%g" [Format.REAL(R.toReal c)]
113              fun toS ([c], l) = c2s c :: l
114                | toS (c::r, l) = c2s c :: " + x*(" :: toS(r, ")"::l)
115              in
116                String.concat (toS (poly, []))
117              end
118    
119        fun printKernel (kern, k) = let
120              val {isCont, isOdd, segs} = K.curve(kern, k)
121              val name = if (k > 0)
122                    then concat(K.name kern::List.tabulate(k, fn _ => "'"))
123                    else K.name kern
124              fun lp (_, []) = ()
125                | lp (i, poly::rest) = (
126                    print(concat[
127                        "  ", name, "(x) = ", polyToString poly, " for ",
128                        Int.toString i, " <= x < ", Int.toString(i+1), "\n"
129                      ]);
130                    lp (i+1, rest))
131              in
132                print(name ^ ":\n");
133                lp (0, segs);
134                if (isOdd)
135                  then print(concat["  ", name, "(x) = -", name, "(-x) for x < 0\n"])
136                  else print(concat["  ", name, "(x) = ", name, "(-x) for x < 0\n"])
137              end
138    
139    end    end

Legend:
Removed from v.153  
changed lines
  Added in v.155

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