Engee documentation

Create Diagonal Matrix

Create a square diagonal matrix from the specified vector.

create diagonal matrix

Description

The Create Diagonal Matrix block fills the diagonal of an M by M output matrix with elements contained in a vector D of length M or a matrix of size 1 by M or M by 1. Elements outside the diagonal are zero.

Ports

Input

D - input signal
vector | matrix

Input vector for conversion to diagonal matrix; vector D of length M or matrix of size 1 by M or M by 1.

Data types: Float16, Float32, Float64, Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, Uint128, Fixed, Bool.

Output

A - output matrix
matrix

M by M matrix, where M is the length of the input vector or the size of the input matrix(1 by M or M by 1).

Data types: Float16, Float32, Float64, Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, Uint128, Fixed, Bool.

Additional options

C code generation: Yes