20 |
(* kernel name *) |
(* kernel name *) |
21 |
val name : kernel -> string |
val name : kernel -> string |
22 |
|
|
23 |
|
(* are two kernels the same *) |
24 |
|
val same : kernel * kernel -> bool |
25 |
|
|
26 |
|
(* hash value *) |
27 |
|
val hash : kernel -> word |
28 |
|
|
29 |
(* kernel support *) |
(* kernel support *) |
30 |
val support : kernel -> int |
val support : kernel -> int |
31 |
|
|
89 |
|
|
90 |
datatype kernel = K of { |
datatype kernel = K of { |
91 |
name : string, |
name : string, |
92 |
|
id : Stamp.stamp, (* unique ID *) |
93 |
support : int, (* number of samples to left/right *) |
support : int, (* number of samples to left/right *) |
94 |
curves : curve option array (* cache of curves indexed by differentiation level *) |
curves : curve option array (* cache of curves indexed by differentiation level *) |
95 |
} |
} |
114 |
(* kernel support *) |
(* kernel support *) |
115 |
fun support (K{support, ...}) = support |
fun support (K{support, ...}) = support |
116 |
|
|
117 |
|
fun hash (K{id, ...}) = Stamp.hash id |
118 |
|
fun same (K{id=a, ...}, K{id=b, ...}) = Stamp.same (a, b) |
119 |
|
|
120 |
(* representation of i'th derivative of the kernel *) |
(* representation of i'th derivative of the kernel *) |
121 |
fun curve (K{curves, ...}, k) = (case A.sub(curves, k) |
fun curve (K{curves, ...}, k) = (case A.sub(curves, k) |
122 |
of SOME curve => curve |
of SOME curve => curve |
162 |
} |
} |
163 |
in |
in |
164 |
A.update (curves, 0, SOME curve0); |
A.update (curves, 0, SOME curve0); |
165 |
K{name=name, support=support, curves=curves} |
K{name=name, id=Stamp.new(), support=support, curves=curves} |
166 |
end |
end |
167 |
in |
in |
168 |
val tent : kernel = mkKernel{ (* linear interpolation *) |
val tent : kernel = mkKernel{ (* linear interpolation *) |