UNPKG

ts-quantum

Version:

TypeScript library for quantum mechanics calculations and utilities

63 lines (62 loc) 2.12 kB
/** * Advanced matrix function implementations for quantum operations * * Provides higher-level matrix functions building on core matrix operations. * Implements functions like matrix logarithm, square root, and arbitrary * function application using eigendecomposition. */ import { Complex } from '../core/types'; import { ComplexMatrix } from './matrixOperations'; /** * Applies an arbitrary function to a diagonalizable matrix * * For a matrix A with eigendecomposition A = UDU†, computes f(A) = Uf(D)U† * where f(D) applies the function to each eigenvalue on the diagonal. * * @param matrix Matrix to apply function to * @param func Function to apply to eigenvalues * @returns Matrix with function applied to eigenvalues */ export declare function matrixFunction(matrix: Complex[][], func: (x: Complex) => Complex): Complex[][]; /** * Calculates the matrix logarithm * * For a positive definite matrix A, computes log(A) such that exp(log(A)) = A * * @param matrix Matrix to calculate logarithm of (must be positive definite) * @returns The matrix logarithm */ export declare function matrixLogarithm(matrix: Complex[][]): Complex[][]; /** * Calculates the matrix square root * * For a matrix A, computes √A such that √A × √A = A * * @param matrix Matrix to calculate square root of * @returns The matrix square root */ export declare function matrixSquareRoot(matrix: ComplexMatrix): ComplexMatrix; /** * Calculates an arbitrary power of a matrix * * For a matrix A and a number p, computes A^p * * @param matrix Base matrix * @param power Power to raise matrix to * @returns The matrix raised to the specified power */ export declare function matrixPower(matrix: Complex[][], power: number): Complex[][]; /** * Calculates the matrix sine function * * @param matrix Input matrix * @returns The matrix sine */ export declare function matrixSin(matrix: Complex[][]): Complex[][]; /** * Calculates the matrix cosine function * * @param matrix Input matrix * @returns The matrix cosine */ export declare function matrixCos(matrix: Complex[][]): Complex[][];