BlyxDocumentation
Browse chapters
Documentation / Workflow recipes

Skimmer · Read parity alongside two-bit marginals

Compare parity and marginal balance in two-bit shot data.

Read parity alongside two-bit marginals

Balanced single-bit frequencies can mask different joint outcomes. Inspect parity alongside both marginals. Four 00 and four 11 shots have equally balanced individual bits, while every shot has even parity.

Run the framework with your own input

Install Blyx 0.2.1 and a Rust toolchain with a host linker, then run the versioned project. Each positional argument is a number or a comma-separated numerical vector. The CLI accepts up to 16 entries per vector. The imported module accepts longer inputs.

git clone --depth 1 --branch v0.1.0 https://github.com/Rahulchaube1/blyx-skimmer.git
cd blyx-skimmer
blyxc native-run project.blyx -- "4,0,0,4" 1 0.1

API and return values

Returns [parity expectation, left-one frequency, right-one frequency, parity matches target]. A single measurement basis characterizes this histogram only. Invalid input returns an empty vector.

ArgumentAccepted input
countsVector of: nonnegative exact integer
expected_evenprobability in [0,1]
toleranceprobability in [0,1]

Use the libraries independently

The framework vendors the same library source published in these two repositories. Each module has its own package page, input contract and regression suite.

Try the program

Output Ready
Expected output
1
0.5
0.5
1
Open in the full playground →

Practice

Change counts = [2, 2, 2, 2]. Predict the result, then run the program.

Hint

Returns [parity expectation, left-one frequency, right-one frequency, parity matches target]. A single measurement basis characterizes this histogram only.

Worked solution

The result vector is [0, 0.5, 0.5, 0]. Compare its fields with the return layout in the API section.

Find

    let counts = [4, 0, 0, 4];

Replace with

    let counts = [2, 2, 2, 2];

Output after the change

0
0.5
0.5
0