matrix_trace: Matrix Trace

matrix_traceR Documentation

Matrix Trace

Description

The sum of the diagonal entries in a matrix.

Usage

matrix_trace(expr)

Arguments

expr

An Expression or matrix.

Value

An Expression representing the trace of the input.

Examples

C <- Variable(3,3)
val <- cbind(3:5, 6:8, 9:11)
prob <- Problem(Maximize(matrix_trace(C)), list(C == val))
result <- solve(prob)
result$value

anqif/CVXR documentation built on Feb. 6, 2024, 4:28 a.m.