uk.ac.starlink.ttools.plot2.layer
Class Kernel1ds

java.lang.Object
  extended by uk.ac.starlink.ttools.plot2.layer.Kernel1ds

public class Kernel1ds
extends Object

Utility class containing various implementations of the Kernel1d interface. The kernels returned by the factory methods in this class are in general normalised to unity.

Since:
2 Mar 2015
Author:
Mark Taylor

Field Summary
static Kernel1d DELTA
          Delta function kernel.
 
Method Summary
static Kernel1d createCos2Kernel(double width)
          Returns a kernel based on the cosine squared function.
static Kernel1d createCosKernel(double width)
          Returns a kernel based on the cosine function.
static Kernel1d createEpanechnikovKernel(double width)
          Returns an Epanechnikov kernel.
static Kernel1d createGaussianKernel(double sigma)
          Returns an untruncated Gaussian kernel.
static Kernel1d createLinearKernel(double width)
          Returns a linear (triangular) kernel.
static Kernel1d createSquareKernel(int extent)
          Returns a rectangular kernel with a given extent.
static Kernel1d createSymmetricNormalisedKernel(double[] levels, boolean isSquare)
          Creates a symmetric normalised kernel based on a fixed array of function values.
static Kernel1d createTruncatedGaussianKernel(double sigma, int extent)
          Returns a kernel based on the Gaussian function with truncation at a given extent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DELTA

public static final Kernel1d DELTA
Delta function kernel. Convolution of a function with this kernel leaves it unaffected.

Method Detail

createSquareKernel

public static Kernel1d createSquareKernel(int extent)
Returns a rectangular kernel with a given extent.

Parameters:
extent - half-width of rectangle
Returns:
new kernel

createCosKernel

public static Kernel1d createCosKernel(double width)
Returns a kernel based on the cosine function.

Parameters:
width - half-width of kernel, corresponding to PI/2
Returns:
new kernel

createCos2Kernel

public static Kernel1d createCos2Kernel(double width)
Returns a kernel based on the cosine squared function.

Parameters:
width - half-width of kernel, corresponding to PI/2
Returns:
new kernel

createEpanechnikovKernel

public static Kernel1d createEpanechnikovKernel(double width)
Returns an Epanechnikov kernel. This is just a truncated parabola. Apparently it's favoured by statisticians.

Parameters:
width - half-width of kernel, corresponding to 1
Returns:
new kernel

createLinearKernel

public static Kernel1d createLinearKernel(double width)
Returns a linear (triangular) kernel.

Parameters:
width - half-width of kernel, corresponding to 1
Returns:
new kernel

createTruncatedGaussianKernel

public static Kernel1d createTruncatedGaussianKernel(double sigma,
                                                     int extent)
Returns a kernel based on the Gaussian function with truncation at a given extent.

Parameters:
sigma - standard deviation of kernel
extent - extent of kernel; values beyond this are effectively zero
Returns:
new kernel

createGaussianKernel

public static Kernel1d createGaussianKernel(double sigma)
Returns an untruncated Gaussian kernel. The extent is unlimited, so use it with care to avoid performance issues.

Parameters:
sigma - standard deviation
Returns:
new kernel

createSymmetricNormalisedKernel

public static Kernel1d createSymmetricNormalisedKernel(double[] levels,
                                                       boolean isSquare)
Creates a symmetric normalised kernel based on a fixed array of function values. The levels array gives a list of the values at x=0, 1 (and -1), 2 (and -2), ....

Parameters:
levels - kernel function values on 1d grid starting from 0
isSquare - true iff the kernel is considered non-smooth
Returns:
new kernel


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.