diag

diag(x)[source]

Creates an diagonal matrix from a given vector.

Parameters:

x (array, numpy.ndarray, cas.MX, cas.SX or cas.DX, list) – Vector containing the diagonal entries of the matrix.

Returns:

Diagonal matrix with the desired diagonal elements.

Return type:

array