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

    Class Qubit

    Represents a quantum material specifically for qubit systems.

    Qubit extends Q5mMaterial and is specialized for storing quantum state vectors (Amplitude[]) that represent pure qubit states. This class provides the material representation layer for quantum computations.

    Hierarchy

    Index

    Constructors

    • Creates a new Qubit material instance.

      Parameters

      • stateNum: number

        Number of quantum states (typically 2^n for n qubits)

      • OptionalstateVector: StateVector

        Optional quantum state vector of complex amplitudes

      Returns Qubit

    Methods

    • Gets the number of quantum states.

      Returns number

    • Sets the number of quantum states.

      Parameters

      • stateNum: number

        New number of quantum states

      Returns void

    • Gets the quantum amplitude at a specific basis index.

      Parameters

      • index: number

        The basis state index

      Returns Complex

      The quantum amplitude at the specified index

    • Sets the quantum amplitude at a specific basis index.

      Parameters

      • index: number

        The basis state index

      • amplitude: Complex

        The new quantum amplitude

      Returns void

    • Creates a QubitState from Bloch sphere angles.

      Parameters

      • theta: number

        Polar angle (0 to π)

      • phi: number = 0

        Azimuthal angle (0 to 2π)

      Returns QubitState

      New QubitState instance corresponding to the specified angles

    Properties

    material: StateVector

    The material state of type T.