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™.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.