float (version 0.2-3)

diag: diag

Description

Methods for getting the diagonal of a float matrix, or constructing a float matrix given a float vector.

Usage

# S4 method for float32
diag(x = 1, nrow, ncol)

Arguments

x

A float vector (create a diagonal matrix) or matrix (get its diagonal).

nrow, ncol

As in base R's diag().

Value

A float vector or matrix, depending on the input.

Examples

Run this code
# NOT RUN {
library(float)

s = flrunif(10, 3)
s
diag(s)
diag(diag(s))

# }

Run the code above in your browser using DataCamp Workspace