Learn R Programming

RateDistortion (version 1.01)

ChannelDistortion: Compute the channel distortion for a given channel and cost function.

Description

This function computes the expected cost for a given channel (as produced by the function BlahutAlgorithm) and specified cost function given by rho.fn.

Usage

ChannelDistortion(channel, rho.fn, ...)

Arguments

channel
An information channel, as returned by BlahutAlgorithm, FindOptimalChannel, or FindRate.
rho.fn
A cost function used to evaluate the channel distortion. This function should be defined over the input and output alphabet for the channel, and the function should accept vectorized arguments.
...
Optional arguments that are passed to the cost function.

Value

This function returns the distortion for the channel, i.e., a single numeric (non-negative) value.

References

Blahut, R. E. (1972). Computation of channel capacity and rate-distortion functions. IEEE Transactions on Information Theory, 18(4):460--473.

See Also

BlahutAlgorithm, FindOptimalChannel, FindRate

Examples

Run this code
# Define a discretized Gaussian information source
x <- seq(from = -10, to = 10, length.out = 100)
Px <- dnorm(x, mean = 0, sd = 3)
Px <- Px / sum(Px) # Ensure that probability sums to 1
y <- x # The destination alphabet is the same as the source

# Define a quadratic cost function
cost.function <- function(x, y) {
    (y - x)^2
}

# Slope of the rate-distortion curve
s <- -1

# Compute the rate-distortion value at the given point s
channel <- BlahutAlgorithm(x, Px, y, cost.function, s)

# Compute the channel distortion according to a different cost function
abs.cost.function <- function(x, y) {
   abs(y - x)
}

ChannelDistortion(channel, abs.cost.function)

Run the code above in your browser using DataLab