Linear algebraNDArray::traceOn this pageNDArray::tracepublic static function trace(NDArray|array $a): float;Computes the sum of the diagonal elements of a square array, also known as the trace of the array.NotestipGPU SUPPORTEDThis operation is supported by GPU (VRAM) and contains a custom CUDA kernel.