UNPKG

ts-quantum

Version:

TypeScript library for quantum mechanics calculations and utilities

129 lines (128 loc) 4.3 kB
/** * Multi-Spin State Implementation * * Prototype for handling sequential coupling of multiple angular momentum states. * Addresses the limitations identified in T66 research for multi-spin coupling. */ import { StateVector } from '../states/stateVector'; /** * Represents a single coupling step in the sequence */ interface CouplingStep { addedSpin: number; addedM: number; previousJ: number[]; resultingJ: number[]; timestamp: number; } /** * Multi-spin angular momentum state that tracks coupling history * and maintains knowledge of all J components present */ declare class MultiSpinState { private spins; private mValues; private couplingHistory; private currentState; private availableJ; constructor(spins: number[], mValues: number[], currentState: StateVector, couplingHistory?: CouplingStep[], availableJ?: Set<number>); /** * Creates a MultiSpinState from a single spin state * @param j Angular momentum quantum number * @param m Magnetic quantum number * @returns New MultiSpinState with single spin */ static fromSingleSpin(j: number, m: number): MultiSpinState; /** * Creates a MultiSpinState from existing coupled state (for analysis) * @param state Existing StateVector * @param spins Array of individual j values that were coupled * @param mValues Array of individual m values * @returns New MultiSpinState for analysis */ static fromCoupledState(state: StateVector, spins: number[], mValues: number[]): MultiSpinState; /** * Adds another spin to this multi-spin state using proper state decomposition * @param j Angular momentum of spin to add * @param m Magnetic quantum number of spin to add * @returns New MultiSpinState with additional spin coupled */ addSpin(j: number, m: number): MultiSpinState; /** * Extracts a specific J component from the current state * @param targetJ The J value to extract * @returns StateVector for that J component, or null if not present */ extractJComponent(targetJ: number): StateVector | null; /** * Simple heuristic to determine dominant J value * Real implementation would analyze state amplitudes */ private getDominantJ; /** * Gets all currently available J values and their information * @returns Map of J values to basic information */ getJComponents(): Map<number, { available: boolean; estimated: boolean; }>; /** * Gets the valid intertwiner values for spin network vertices * These are the J values that could appear at a vertex with these incident spins * @returns Array of valid J values */ getValidIntertwiners(): number[]; /** * Gets all individual spins in this multi-spin state * @returns Array of individual j values */ getIndividualSpins(): number[]; /** * Gets all individual magnetic quantum numbers * @returns Array of individual m values */ getIndividualMs(): number[]; /** * Gets the coupling history showing how this state was built * @returns Array of coupling steps */ getCouplingHistory(): CouplingStep[]; /** * Gets the current coupled state vector * @returns Current StateVector */ getCurrentState(): StateVector; /** * Gets the total dimension of the current state * @returns Dimension of current state vector */ getDimension(): number; /** * Gets the number of individual spins in this state * @returns Number of spins */ getSpinCount(): number; /** * Gets the norm of the current state * @returns Norm of current state vector */ norm(): number; /** * Checks if the state is normalized * @param tolerance Numerical tolerance * @returns True if state is normalized */ isNormalized(tolerance?: number): boolean; /** * Returns a string representation of the multi-spin state * @returns Human-readable description */ toString(): string; /** * Returns detailed information about the state * @returns Detailed string representation */ toDetailedString(): string; } export { MultiSpinState, CouplingStep };