dg: A Modified diag Function

Description Usage Arguments Value Author(s) Examples

View source: R/dg.R

Description

This function works in the way analogous to the diag function of Matlab.

Usage

1
dg(x)

Arguments

x

a number, vector or square matrix.

Value

If x is a number, dg returns itself. If x is a vector, a one-row matrix or a one-column matrix, dg returns a matrix with x as the main diagnol. Otherwise dg returns diag(x).

Author(s)

LI Wu <liwu@staff.shu.edu.cn>

Examples

1
2
diag(matrix(2, 3))
dg(matrix(2, 3))

CGE documentation built on July 8, 2020, 5:16 p.m.

Related to dg in CGE...