q5m.js - Quantum Computing Library - v0.1.1
    Preparing search index...

    Variable defaultConst

    default: {
        H: any;
        X: any;
        Y: any;
        Z: any;
        S: any;
        T: any;
        Tdg: any;
        Sdg: any;
        Identity: any;
        PH: any;
        RX: any;
        RY: any;
        RZ: any;
        CNOT: any;
        CX: any;
        CZ: any;
        CY: any;
        CH: any;
        CU: any;
        SWAP: any;
        CP: any;
        EE: any;
        HH: any;
        Mz: any;
        Mx: any;
        My: any;
        Mp: any;
        Circuit: typeof Circuit;
        QubitState: typeof QubitState;
        algorithms: __module;
        converters: __module;
        math: {
            complex: (re: number, im?: number) => Complex;
            isZero(c: Complex, tolerance?: number): boolean;
            areEqual(a: Complex, b: Complex, tolerance?: number): boolean;
            isUnitary: any;
            createUnitary: any;
            matXvec: any;
            matXmat: any;
            normalize: any;
            innerP: any;
            tensorP: any;
            dagger: any;
            matrixVectorMultiply: any;
            matrixMatrixMultiply: any;
            innerProduct: any;
            tensorProduct: any;
            isHermitian: any;
            createHermitian: any;
            formatAmplitude: any;
            formatComplex: any;
            isValidAmplitude: any;
            createAmplitude: any;
            normalizeAmplitudes: any;
            parseAngle: any;
            create2x2Unitary(
                alpha: Complex,
                beta: Complex,
                theta?: number,
            ): { matrix: Matrix; normalizedAlpha: Complex; normalizedBeta: Complex };
            createUnitaryMatrix(
                alpha: Complex,
                beta: Complex,
                theta?: number,
            ): { matrix: Matrix; normalizedAlpha: Complex; normalizedBeta: Complex };
            isMatrix(value: unknown): value is Matrix;
            createMatrix(matrix: Complex[][]): Matrix;
        };
        notebook: {
            NotebookRenderer: typeof NotebookRenderer;
            enableNotebookMode: () => void;
            extendCircuitForNotebook: (CircuitClass: any) => void;
            extendQubitStateForNotebook: (QubitStateClass: any) => void;
        };
    } = ...

    Type Declaration

    • Circuit: typeof Circuit
    • QubitState: typeof QubitState
    • algorithms: __module
    • converters: __module

      Converters for Qiskit (IBM Quantum).

    • math: {
          complex: (re: number, im?: number) => Complex;
          isZero(c: Complex, tolerance?: number): boolean;
          areEqual(a: Complex, b: Complex, tolerance?: number): boolean;
          isUnitary: any;
          createUnitary: any;
          matXvec: any;
          matXmat: any;
          normalize: any;
          innerP: any;
          tensorP: any;
          dagger: any;
          matrixVectorMultiply: any;
          matrixMatrixMultiply: any;
          innerProduct: any;
          tensorProduct: any;
          isHermitian: any;
          createHermitian: any;
          formatAmplitude: any;
          formatComplex: any;
          isValidAmplitude: any;
          createAmplitude: any;
          normalizeAmplitudes: any;
          parseAngle: any;
          create2x2Unitary(
              alpha: Complex,
              beta: Complex,
              theta?: number,
          ): { matrix: Matrix; normalizedAlpha: Complex; normalizedBeta: Complex };
          createUnitaryMatrix(
              alpha: Complex,
              beta: Complex,
              theta?: number,
          ): { matrix: Matrix; normalizedAlpha: Complex; normalizedBeta: Complex };
          isMatrix(value: unknown): value is Matrix;
          createMatrix(matrix: Complex[][]): Matrix;
      }
      • complex: (re: number, im?: number) => Complex

        Creates a complex number from its real and imaginary parts. Uses caching for performance optimization.

      • isZero: function
        • Checks if a complex number is approximately zero within a given tolerance.

          Parameters

          • c: Complex

            The complex number to check.

          • tolerance: number = 1e-10

            The numerical tolerance for the check. Defaults to 1e-10.

          Returns boolean

          true if the absolute value of the complex number is less than the tolerance.

      • areEqual: function
        • Checks if two complex numbers are approximately equal within a given tolerance.

          Parameters

          • a: Complex

            The first complex number.

          • b: Complex

            The second complex number.

          • tolerance: number = 1e-10

            The numerical tolerance for the comparison. Defaults to 1e-10.

          Returns boolean

          true if the absolute difference between the numbers is less than the tolerance.

      • create2x2Unitary: function
        • Creates a 2x2 unitary matrix from two quantum amplitudes and a global phase. The matrix is constructed as U = e^(iθ) * [[α, -β*], [β, α*]], where * denotes the complex conjugate, after normalizing α and β.

          Parameters

          • alpha: Complex

            The first quantum amplitude.

          • beta: Complex

            The second quantum amplitude.

          • theta: number = 0

            The global phase angle in radians. Defaults to 0.

          Returns { matrix: Matrix; normalizedAlpha: Complex; normalizedBeta: Complex }

          An object containing the unitary matrix and the normalized amplitudes.

          If amplitudes are invalid or result in a zero vector.

      • createUnitaryMatrix: function
        • Creates a 2x2 unitary matrix from two quantum amplitudes and a global phase. The matrix is constructed as U = e^(iθ) * [[α, -β*], [β, α*]], where * denotes the complex conjugate, after normalizing α and β.

          Parameters

          • alpha: Complex

            The first quantum amplitude.

          • beta: Complex

            The second quantum amplitude.

          • theta: number = 0

            The global phase angle in radians. Defaults to 0.

          Returns { matrix: Matrix; normalizedAlpha: Complex; normalizedBeta: Complex }

          An object containing the unitary matrix and the normalized amplitudes.

          If amplitudes are invalid or result in a zero vector.

      • isMatrix: function
        • Type guard to check if a value is a valid Matrix. Validates that the input is a 2D array of Complex numbers.

          Parameters

          • value: unknown

          Returns value is Matrix

      • createMatrix: function
        • Creates a validated Matrix from a 2D complex array. Ensures structural correctness without mathematical properties.

          Parameters

          Returns Matrix

    • notebook: {
          NotebookRenderer: typeof NotebookRenderer;
          enableNotebookMode: () => void;
          extendCircuitForNotebook: (CircuitClass: any) => void;
          extendQubitStateForNotebook: (QubitStateClass: any) => void;
      }
      • NotebookRenderer: typeof NotebookRenderer
      • enableNotebookMode: () => void
      • extendCircuitForNotebook: (CircuitClass: any) => void
      • extendQubitStateForNotebook: (QubitStateClass: any) => void