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.

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

Create diagonal matrix, filling the diagonal with a given vector.

  • x: The vector.

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

Create diagonal matrix, filling the diagonal with a given vector.

  • x: The vector.

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

Create diagonal matrix, filling the diagonal with a given vector.

  • x: The vector.