# Trace

Advanced Analysis Library Only

AnalysisLibErrType Trace (void *inputMatrix, int matrixSize, double *trace);

## Purpose

Finds the trace of the 2D input matrix. The trace is the sum of the matrix elements along the main diagonal. Trace obtains the trace using the following formula:

The input matrix must be a matrixSize-by-matrixSize square matrix.

## Parameters

Input
Name | Type | Description
inputMatrix | numeric array | Input matrix. This matrix must be an array of doubles.
matrixSize | integer | Size of the input matrix.
Output
Name | Type | Description
trace | double-precision | Trace of the input matrix.

## Return Value

Name | Type | Description
status | AnalysisLibErrType | A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.