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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/mid-to-low/eval-kern.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/mid-to-low/eval-kern.sml

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

revision 4056, Mon Jun 27 15:26:20 2016 UTC revision 4057, Mon Jun 27 16:11:09 2016 UTC
# Line 17  Line 17 
17     *               to twice the support of the kernel     *               to twice the support of the kernel
18     *    h       -- the kernel     *    h       -- the kernel
19     *    k       -- the derivative of the kernel to evaluate     *    k       -- the derivative of the kernel to evaluate
20       *    x       -- the d-wide vector that specifies the values at which the
21       *               kernel is being evaluated.
22     *     *
23     * The generated code is computing     * The generated code is computing
24     *     *
25     *    result = a_0 + x*(a_1 + x*(a_2 + ... x*a_n) ... )     *    result = a_0 + x*(a_1 + x*(a_2 + ... x*a_n) ... )
26     *     *
27     * as a d-wide vector operation, where n is the degree of the kth derivative     * as a d-wide vector operation, where n is the degree of the kth derivative
28     * of h and the a_i are coefficient vectors that have an element for each     * of h and the a_i are d-wide coefficient vectors that have an element for
29     * piece of h.  The computation is implemented as follows     * each piece of h.  The computation is implemented as follows
30     *     *
31     *    m_n     = x * a_n     *    m_n     = x * a_n
32     *    s_{n-1} = a_{n-1} + m_n     *    s_{n-1} = a_{n-1} + m_n
# Line 36  Line 38 
38     *    m_1     = x * s_1     *    m_1     = x * s_1
39     *    result  = a_0 + m_1     *    result  = a_0 + m_1
40     *     *
41     * Note that the coeffient vectors are flipped (cf high-to-low/probe.sml).     * Note that the coeffient vectors are flipped.
42     *)     *)
43      val expand : LowIR.var * int * Kernel.t * int * LowIR.var list      val expand : LowIR.var * int * Kernel.t * int * LowIR.var list
44            -> (LowIR.var * LowIR.rhs) list            -> (LowIR.var * LowIR.rhs) list
# Line 108  Line 110 
110            fun coefficient d i =            fun coefficient d i =
111                  Literal.Real(ratToFloat (Vector.sub (Vector.sub(segs, i), d)))                  Literal.Real(ratToFloat (Vector.sub (Vector.sub(segs, i), d)))
112            val ty = Ty.vecTy d            val ty = Ty.vecTy d
113            val coeffs = List.tabulate (deg+1,            val coeffs = List.tabulate (deg+1, fn i => IR.Var.new("a"^Int.toString i, ty))
                 fn i => IR.Var.new("a"^Int.toString i, ty))  
114          (* code to define the coefficient vectors *)          (* code to define the coefficient vectors *)
115            val coeffVecs = let            val coeffVecs = let
116                  fun mk (x, (i, code)) = let                  fun mk (x, (i, code)) = let

Legend:
Removed from v.4056  
changed lines
  Added in v.4057

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