# CxTrace

Advanced Analysis Library Only

AnalysisLibErrType CxTrace (void *inputMatrix, int matrixSize, int reserved, ComplexNum *trace);

## Purpose

Calculates the trace of a complex matrix. The trace of a matrix is the sum of all its diagonal elements.

CxTrace uses the following formula to obtain trace:

## Parameters

Input
Name | Type | Description
inputMatrix | numeric array | Input complex matrix. This matrix must be an array of ComplexNum. The following C typedef statement defines the ComplexNum structure: typedef struct { double real; double imaginary; } ComplexNum;
matrixSize | integer | Size of inputMatrix.
reserved | integer | Reserved parameter.
Output
Name | Type | Description
trace | ComplexNum | Sum of the diagonal elements of inputMatrix. The following C typedef statement defines the ComplexNum structure: typedef struct { double real; double imaginary; } ComplexNum;

## 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.