Skip to content
DeepForgeby svx
All problems
EasyInformation Theoryinfo-072

Gaussian Distortion-Rate Inverse

Problem

Return the Gaussian distortion-rate rate needed to achieve distortion D for a source with variance var:

R(D) = 0.5 * log2(var / D)

Assume 0 < D <= var.

Hint

This inverts D(R) = var * 2^(-2R).

Test cases

case 1
in: [0.25,1]
expected: 1
case 2
in: [2,4]
expected: 0.5
case 3
in: [0.0625,1]
expected: 2
case 4
in: [0.5,2]
expected: 1
Starter codePython
import math
def gaussian_rate(distortion, var):
    # Your code here
    pass

4 test cases · run your code against them in the editor