diagonal

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

Diagonal of a matrix, as a vector.

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

Diagonal of a matrix, as a vector.

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

Diagonal of a matrix, as a vector.

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.