TRACE

The TRACE function computes the trace of an n by n array.

This routine is written in the IDL language. Its source code can be found in the file trace.pro in the lib subdirectory of the IDL distribution.

Calling Sequence

Result = TRACE( A )

Arguments

A

An n by n real or complex array.

Keywords

DOUBLE

Set this keyword to force the computation to be done in double-precision arithmetic.

Example

Define an array.

A = [[ 2.0,1.0, 1.0, 1.5], $

[ 4.0, -6.0, 0.0, 0.0], $

[-2.0, 7.0, 2.0, 2.5], $

[ 1.0, 0.5, 0.0, 5.0]]

result = TRACE(A) ; Compute the trace of A.

PRINT, result ; Print Result.

IDL prints:

3.00000

See Also

TOTAL