Input matrix, specified as a square matrix. A can be full or
sparse.
Data Types: single | double Complex Number Support: Yes
Algorithms
trace extracts the diagonal elements and adds them together with the
command sum(diag(A)). The value of the trace is the same (up to round-off
error) as the sum of the matrix eigenvalues sum(eig(A)).
Extended Capabilities
C/C++ Code Generation Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
Code generation does not support sparse matrix inputs for this
function.
GPU Code Generation Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.
Usage notes and limitations:
Code generation does not support sparse matrix
inputs for this function.
GPU Arrays Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Distributed Arrays Partition large arrays across the combined memory of your cluster using Parallel Computing Toolbox™.