The maximum eigenvalue of a matrix, \(\lambda_{\max}(A)\).

lambda_max(A)

Arguments

A

An Expression or matrix.

Value

An Expression representing the maximum eigenvalue of the input.

Examples

A <- Variable(2,2)
prob <- Problem(Minimize(lambda_max(A)), list(A >= 2))
result <- solve(prob)
result$value
#> [1] 4.000017
result$getValue(A)
#>          [,1]     [,2]
#> [1,] 1.999999 2.000008
#> [2,] 2.000008 1.999999

obj <- Maximize(A[2,1] - A[1,2])
prob <- Problem(obj, list(lambda_max(A) <= 100, A[1,1] == 2, A[2,2] == 2, A[2,1] == 2))
result <- solve(prob)
result$value
#> [1] -5.015088e-08
result$getValue(A)
#>          [,1]     [,2]
#> [1,] 1.999998 2.000000
#> [2,] 2.000000 1.999998