diagonal

function diagonal(x:Real, length:Integer) -> Real[_,_]

Create diagonal matrix, filling the diagonal with a given scalar value.

  • x: The value.
  • length: Number of rows/columns.

function diagonal(x:Integer, length:Integer) -> Integer[_,_]

Create diagonal matrix, filling the diagonal with a given scalar value.

  • x: The value.
  • length: Number of rows/columns.

function diagonal(x:Boolean, length:Integer) -> Boolean[_,_]

Create diagonal matrix, filling the diagonal with a given scalar value.

  • x: The value.
  • length: Number of rows/columns.