Skip to content

Conversation

@johanvos
Copy link
Collaborator

@johanvos johanvos commented Nov 22, 2025

Instead of referring to qubits by their index, this PR allows to refer to qubits using their assigned name.

Fix #195

This allows to create applications like this:

import org.redfx.strange.*;
import org.redfx.strange.gate.*;
import org.redfx.strange.local.SimpleQuantumExecutionEnvironment;
import java.util.Arrays;

public class ShortStrangeDemo {
    public static void main(String[] args) {
        Qubit controlQubit = new Qubit();
        Qubit targetQubit = new Qubit();
        Program p = new Program(controlQubit, targetQubit);
        p.addSteps(new Step(new Hadamard(controlQubit)), new Step(new Cnot(controlQubit, targetQubit)));
        SimpleQuantumExecutionEnvironment sqee = new SimpleQuantumExecutionEnvironment();
        Qubit[] qubits = sqee.runProgram(p).getQubits();
        Arrays.asList(qubits).forEach(q -> System.out.println("qubit with probability on 1 = "+q.getProbability()+", measured it gives "+ q.measure()));
    }
}

@johanvos johanvos changed the title 195-namedqubits [DRAFT] 195-namedqubits Nov 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add named qubits

1 participant