@thi.ng/tensors
Version:
0D/1D/2D/3D/4D tensors with extensible polymorphic operations and customizable storage
15 lines • 455 B
TypeScript
import type { ITensor, ITensor1 } from "./api.js";
/**
* Returns a 1D tensor view of the nD diagonal of the given tensor.
*
* @remarks
* For 1D tensors this will merely by a shallow copy.
*/
export declare const diagonal: <T>(a: ITensor<T>) => ITensor1<T>;
/**
* Computes the trace of given tensor, i.e. the component sum of `diagonal(a)`.
*
* @param a
*/
export declare const trace: (a: ITensor) => number;
//# sourceMappingURL=diagonal.d.ts.map