Learn R Programming

bases (version 0.2.0)

kernel-arith: Kernel arithmetic

Description

Kernel functions (see ?kernels) may be multiplied by constants, multiplied by each other, or added together.

Usage

# S3 method for kernel
*(x, k2)

# S3 method for kernel +(k1, k2)

Value

A new kernel function, with class c("kernel", "function").

Arguments

x

a numeric or a kernel function

k2

a kernel function

k1

a kernel function

Examples

Run this code
x = seq(-1, 1, 0.5)
k = k_rbf()
k2 = k_per(scale=0.2, period=0.3)

k_add = k2 + 0.5*k
print(k_add)
image(k_add(x, x))

Run the code above in your browser using DataLab