All problems
Smoothness Constant 2x2 Quadratic
Problem
For f(x) = 0.5 x^T A x with symmetric A = [[a, b], [b, d]], the smoothness constant is the larger eigenvalue (a + d + sqrt((a - d)^2 + 4 b^2)) / 2, which bounds the local curvature of the gradient.
Given the entries, return the constant.
Hint
The top eigenvalue of the Hessian controls the gradient Lipschitz bound.
Test cases
case 1
in: [2,0,4]
expected: 4
case 2
in: [1,1,1]
expected: 2
case 3
in: [0,2,0]
expected: 2
Starter codePython
def smoothness_constant_2x2_quadratic(a, b, d):
# Your code here
pass3 test cases · run your code against them in the editor