diag

From DavinciWiki
Jump to: navigation, search

Description

Returns values along diagonal of input matrix

Arguments and Return Values

Parameters: A square matrix (dimensions [n, n, 1])

Return Value: A row vector (dimensions [n, 1, 1]) of the same format as the input, giving the values along the diagonal of the input

Usage

Syntax: diag(matrix)

When diag() is entered without any arguments, it prints its description, as shown below.

Examples

dv> diag()

Returns elements along diagonal of a square matrix
Returned array is a row of the same format as the input
S.Marshall 11-10-2010
dv> a = create(3,3, start=1)
3x3x1 array of int, bsq format [36 bytes]
1       2       3
4       5       6
7       8       9
dv> diag(a)
3x1x1 array of int, bsq format [12 bytes]
1       5       9

DavinciWiki Mini-Nav Bar

Contents


Contact Developers

  • davinci-dev [AT] mars.asu.edu

All other topics

  • See navigation on the left

Related Functions

Recent Library Changes

Created On: 12-02-2010
Modified On: 12-04-2010

Personal tools