UNPKG

reactqbit

Version:

Quantum computing circuits with React JSX

47 lines (40 loc) 1.56 kB
import * as react_jsx_runtime from 'react/jsx-runtime'; import * as React from 'react'; interface QubitProps { id: string; value?: '0' | '1' | '+' | '-'; className?: string; children?: React.ReactNode; } declare const Qubit: ({ id, value, className, children }: QubitProps) => react_jsx_runtime.JSX.Element; type GateType = 'H' | 'X' | 'Y' | 'Z' | 'CNOT' | 'T' | 'S'; interface QuantumGateProps { type: GateType; targets: string[]; controls?: string[]; className?: string; onClick?: () => void; } declare const QuantumGate: React.FC<QuantumGateProps>; interface QuantumCircuitProps { qubits: number; className?: string; children?: React.ReactNode; } interface QuantumState { states: string[]; probabilities: number[]; } declare const QuantumCircuit: React.FC<QuantumCircuitProps>; interface QuantumWireProps { qubitId: string; className?: string; } declare const QuantumWire: React.FC<QuantumWireProps>; declare const calculateQuantumState: (gates: GateType[], initialState: ("0" | "1")[]) => { states: string[]; probabilities: number[]; }; declare const applyGate: (gate: GateType, qubitValues: ("0" | "1" | "+" | "-")[]) => ("0" | "1" | "+" | "-")[]; declare const calculateEntanglement: (state1: string, state2: string) => 1 | 0.8 | 0.2; export { type GateType, QuantumCircuit, type QuantumCircuitProps, QuantumGate, type QuantumGateProps, type QuantumState, QuantumWire, type QuantumWireProps, Qubit, type QubitProps, applyGate, calculateEntanglement, calculateQuantumState };