Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: xplore
See also: diag diagrv xdiagp

Quantlet: xdiag
Description: extracts diagonal elements from a matrix or array

Usage: d = xdiag(x)
Input:
x n x n x d1 x d2 ... array of square matrices
Output:
d n x 1 x d1 x d2 ... array of diagonal elements

Example:
library("xplore")
xdiag( diag(1:4) )

Result:
Contents of d
[1,]     1
[2,]     2
[3,]     3
[4,]     4
Example:
library("xplore")
xdiag( matrix(2,2,2) )

Result:
Contents of d
[,,1,1,1,1,1,1]
[1,]        1
[2,]        1
[,,2,1,1,1,1,1]
[1,]        1
[2,]        1



Author: MD*Tech 20021120 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006