---
title: 'RandomMeas.jl: End-to-End Quantum Measurements'
url: https://www.emergentmind.com/topics/randommeas-jl
type: topic
---

# RandomMeas.jl: End-to-End Quantum Measurements

Searching arXiv for recent papers on RandomMeas.jl and closely related randomized measurement protocols.
RandomMeas.jl is a Julia package for randomized measurements in quantum devices, introduced as a modular and high-performance open-source software package for implementing and analyzing randomized measurement protocols in quantum computing [2509.12749]. It is designed around the full randomized measurement workflow, from the generation of measurement settings for use on a quantum computer, through optional classical simulation with tensor networks, to the estimation of physical properties from classical shadows [2509.12749]. Within this scope, the package addresses tasks such as expectation-value estimation, entanglement characterization, fidelity estimation, benchmarking, and uncertainty quantification, while providing a unified and composable software architecture [2509.12749].

## 1. Definition and scope

Randomized measurements are experimental and computational procedures in which measurement bases are varied according to random local or shallow-circuit transformations, and the resulting outcomes are aggregated through classical post-processing. In the formulation reviewed in “A Moment for Random Measurements,” such methods are valuable because they probe properties invariant under local unitaries and can operate without a shared reference frame between observers [2011.10591]. RandomMeas.jl situates itself within this methodological lineage by providing software support for randomized measurement protocols and, most prominently, the classical shadow formalism [2509.12749].

The package is described as covering the full randomized measurement workflow. This includes generation of measurement settings, acquisition of measurement data from a quantum processor or from classical simulation, and post-processing into estimators for physical observables and state properties [2509.12749]. The package supports both experimental data and large-scale simulations, with tensor network methods provided via ITensors.jl for classical simulation of randomized measurements [2509.12749]. This suggests that RandomMeas.jl is intended not merely as a narrow estimator library, but as an end-to-end environment for randomized measurement studies.

The surrounding research context clarifies why such a package is useful. Random measurements have been used to detect entanglement and characterize SLOCC classes through statistical moments of random correlations, including implementations based on spherical designs to reduce the number of settings needed for exact moment estimation up to a given order [2011.10591]. More recent work has extended the randomized measurement paradigm to real randomized measurements and partial real randomized measurements, which replace Haar-random unitaries in \( U(d) \) by Haar-random orthogonals in \( O(d) \) and restrict the observable sector accordingly [2411.06013]. RandomMeas.jl is presented as a platform capable of accommodating such protocol variation through its modular design [2509.12749].

## 2. Software architecture and data structures

The software architecture is organized around three core data structures mirroring the experimental and computational workflow: measurement settings, measurement data, and classical shadows [2509.12749]. This division is central to the package’s composability.

The first layer consists of measurement settings. The abstract type `MeasurementSetting` represents a single setting, with concrete variants including `LocalUnitaryMeasurementSetting`, `ShallowUnitaryMeasurementSetting`, and `ComputationalBasisMeasurementSetting` [2509.12749]. `LocalUnitaryMeasurementSetting` corresponds to products of single-qubit rotations from ensembles such as Haar or Pauli, while `ShallowUnitaryMeasurementSetting` represents low-depth circuits of 1- and 2-qubit gates [2509.12749]. The inclusion of `ComputationalBasisMeasurementSetting` shows that the package also handles the non-random baseline case within the same abstraction. Settings can be exported and imported, which supports reproducibility and interoperation between simulation and experiment [2509.12749].

The second layer consists of measurement outcomes. `MeasurementData` stores bitstrings obtained from measurements performed in a single setting, while `MeasurementGroup` aggregates data from multiple settings across \( N_{\mathrm U} \) [2509.12749]. This makes the package naturally suited to randomized measurement campaigns where many independently sampled settings contribute to a single downstream estimate. Support for simulated data is integrated into the same conceptual layer, with the full measurement process available through tensor network MPS simulation for large systems [2509.12749].

The third layer consists of classical shadows. `AbstractShadow` is the parent type, with `FactorizedShadow`, `DenseShadow`, and `ShallowShadow` as concrete realizations [2509.12749]. `FactorizedShadow` is described as scalable and memory-efficient because it stores single-qubit shadows, whereas `DenseShadow` stores full matrices for smaller subsystems, with the regime \( N_A \lesssim 12 \) explicitly mentioned [2509.12749]. `ShallowShadow` is specialized for shallow-circuit measurement settings [2509.12749]. The package uses ITensors.jl for tensor operations, providing the computational backend for efficient large-scale workflows [2509.12749].

A concise summary of these architectural elements is given below.

| Layer | Types | Role |
|---|---|---|
| Measurement settings | `MeasurementSetting`, `LocalUnitaryMeasurementSetting`, `ShallowUnitaryMeasurementSetting`, `ComputationalBasisMeasurementSetting` | Represent randomized or fixed measurement bases |
| Measurement data | `MeasurementData`, `MeasurementGroup` | Store bitstrings for one or many settings |
| Classical shadows | `AbstractShadow`, `FactorizedShadow`, `DenseShadow`, `ShallowShadow` | Support downstream estimators from measured data |

## 3. Randomized measurement workflow

The package’s workflow begins with the sampling of measurement settings. Unitaries or circuits are randomly drawn from a desired ensemble, with examples including Haar, Pauli, and shallow Clifford ensembles [2509.12749]. In the general randomized measurement literature, one can regard this as drawing local directions or unitary rotations and measuring in a fixed basis after the rotation [2011.10591]. In RandomMeas.jl, the representation of settings as explicit objects makes those choices persistent and exportable, which is important for reproducible numerical or hardware studies [2509.12749].

Data acquisition then proceeds either on a QPU or through classical simulation [2509.12749]. The simulation path is particularly significant because the package supports large-scale tensor-network calculations using MPS methods via ITensors.jl [2509.12749]. A plausible implication is that the package is intended to bridge theoretical protocol development and experimental deployment by allowing the same settings and post-processing pipelines to be applied to both simulated and measured data.

The post-processing stage converts `MeasurementGroup` objects into classical shadows or, in some cases, acts directly on measurement data [2509.12749]. This is aligned with the broader randomized measurement framework, in which moments of measured correlations or shadow reconstructions are averaged over many random settings to infer invariant properties of the state [2011.10591]. RandomMeas.jl systematizes this stage with composable estimator functions and built-in uncertainty estimation [2509.12749].

The package supports import and export of settings and collected data, enabling seamless transfer between simulation and experiment [2509.12749]. This matters because randomized measurements are often performed in hybrid workflows: settings are generated offline, executed on hardware, and analyzed later. The package’s explicit handling of these objects suggests a design aimed at preserving the provenance of each stage.

## 4. Estimation methods and supported quantities

RandomMeas.jl enables extraction of expectation values, entanglement measures, fidelities, state overlaps, benchmarking metrics, and process quantities [2509.12749]. The package therefore covers both linear observables and nonlinear functionals.

For standard classical shadows, the estimator is expressed as
\[
\hat{\rho}
= \bigotimes_{i=1}^N \bigl(3\,U_i^\dag\ket{s_i}\!\bra{s_i}U_i - \openone \bigr),
\]
where \( U_i \) are random single-qubit unitaries and \( \mathbf{s} \) is the measurement outcome [2509.12749]. Observables are then estimated by
\[
\hat{O} = \text{Tr}[O \hat{\rho}] .
\]
This is the canonical shadow-based route to expectation values [2509.12749].

For polynomial and nonlinear functionals, the package implements U-statistics and batching methods [2509.12749]. Trace moments are estimated using
\[
\widehat{p}_k = \frac{(N_U-k)!}{N_U!}
\sum_{\text{all distinct } j_1,\dots,j_k}
\operatorname{tr}[\hat\rho_{j_1}\dotsm\hat\rho_{j_k}] ,
\]
and batch shadows are formed as
\[
\bar\rho_b = \frac{1}{(N_U / N_B) N_M}\sum_{j \in b}\sum_{l=1}^{N_M}\hat\rho_{j, l} .
\]
The package also supports direct-data estimators for quantities such as purity or overlap, bypassing explicit shadow construction when appropriate [2509.12749].

The list of supported physical properties includes generic expectation values \( \langle O \rangle = \text{Tr}[O\rho] \), purity \( \operatorname{tr}(\rho^2) \), Rényi entropy, higher-order trace moments \( \operatorname{tr}(\rho^k) \), fidelities such as \( \langle\psi|\rho|\psi\rangle \), state overlaps, cross-entropy benchmarking (XEB), self-XEB, and support for quantum process tomography [2509.12749]. This range situates the package within both state characterization and device benchmarking workflows.

The broader literature shows why moments are central. Random measurement protocols commonly estimate second and fourth moments of correlation distributions, and those moments can witness genuine multipartite entanglement or distinguish SLOCC classes [2011.10591]. In related work on real randomized measurements, second and fourth moments of orthogonally randomized observables are used to characterize entanglement dimensionality and diagnose imaginarity [2411.06013]. RandomMeas.jl’s focus on moment-based and shadow-based estimation places it directly within this methodological family [2509.12749].

## 5. Advanced protocols: robust, shallow, and real randomized measurements

A notable aspect of RandomMeas.jl is the inclusion of advanced shadow techniques beyond the standard local-unitary protocol [2509.12749]. These include robust shadows, shallow shadows, and batch estimators.

Robust shadows incorporate calibration data to describe and invert measurement or channel noise, producing unbiased estimators even in the presence of hardware errors [2509.12749]. The depolarization parameter vector \( G \) is determined through calibration and used for correction at the level of shadow construction [2509.12749]. This is significant because randomized measurements are often applied on noisy devices, and estimator bias from measurement errors would otherwise contaminate downstream quantities.

Shallow shadow estimation addresses non-local observables through random shallow circuits. In this setting, the measurement map \( \mathcal{M}(\rho) \) is learned numerically, and an unbiased inverse mapping is used in post-processing:
\[
\hat{\rho} = \mathcal{M}^{-1}(U^\dagger \ket{\mathbf{s}\bra{\mathbf{s} U) .
\]
The package states that random shallow circuits can drastically reduce the variance for non-local observables [2509.12749]. This provides a route beyond purely local randomization.

The literature on real randomized measurements is directly relevant to possible protocol extensions. Real randomized measurements (RRMs) use Haar-random orthogonal transformations \( O(d) \) and real symmetric local observables, while partial real randomized measurements (PRRMs) use Haar-random orthogonals with imaginary antisymmetric observables [2411.06013]. These protocols access different sectors of bipartite correlations: RRMs probe real–real sectors, PRRMs probe imaginary–imaginary sectors, and standard randomized measurements probe all sectors [2411.06013]. The implementation guidance given there explicitly notes that a high-level API for a library such as RandomMeas.jl should provide functions to generate random orthogonal matrices, generalized Gell-Mann observables, analytic moment formulas, and the ability to compare RM, RRM, and PRRM data [2411.06013]. This suggests that the package’s modular architecture is suitable for accommodating protocol families that differ in randomization group and observable class.

More generally, “A Moment for Random Measurements” emphasizes the role of spherical designs as finite measurement sets reproducing moments up to degree \( t \), for example six directions for second moments and twelve directions for fourth moments in qubit settings [2011.10591]. Although RandomMeas.jl is described primarily in terms of random settings and classical shadows, this broader framework situates its estimator design within a larger algebra of moment protocols.

## 6. Simulation, statistical uncertainty, and computational considerations

RandomMeas.jl supports optional classical simulation of randomized measurements with tensor networks, using MPS methods through ITensors.jl [2509.12749]. This is central for studies where direct hardware execution is impractical or where controlled numerical experiments are required. Example use cases include extraction of all Pauli expectation values for large MPS-simulated states, such as 50 qubits, using the same randomized measurement data [2509.12749].

Uncertainty quantification is built into the package. For linear estimators, the package uses the sample mean and analytic error propagation [2509.12749]. For nonlinear estimators, it employs jackknife resampling, with jackknife variance
\[
\sigma_{JK}^2 = \frac{N_B-1}{N_B} \sum_i (\hat\theta_{(i)} - \overline{\hat\theta}_{(\cdot)})^2 .
\]
Post-processing routines expose `compute_sem` and `compute_cov` keywords to obtain uncertainty estimates [2509.12749]. This is consequential because randomized measurement estimators frequently involve nontrivial nonlinear aggregation, and uncertainty reporting is essential for both experimental and numerical studies.

The package is also described as including batch estimators, which can reduce variance and computation [2509.12749]. Together with factorized shadows and tensor-network simulation, batching contributes to the package’s scalability. The emphasis on composability and large-system support indicates that the software is designed for contemporary randomized measurement workloads rather than solely pedagogical examples [2509.12749].

An adjacent computational issue appears in work on unbiased sampling over the matrix product state manifold. That work observes that many packages, including RandomMeas.jl, use independent local Haar unitaries in contexts where such sampling may inadvertently induce bias if interpreted as uniform over constrained state manifolds [2505.00073]. Specifically, independent local Haar generation of random MPS is shown not to be uniform with respect to the Fubini–Study metric on the MPS manifold, and an unbiased Metropolis-based correction is proposed [2505.00073]. In the context of RandomMeas.jl, this does not alter the package’s stated functionality, but it clarifies that the statistical meaning of “random” can depend on the manifold and measure under consideration. A plausible implication is that simulation modules based on tensor networks may need careful ensemble specification when used for typical-state studies rather than for protocol emulation.

## 7. Position within the Julia and quantum-software ecosystem

RandomMeas.jl is presented as a unified, extensible environment for randomized measurement workflows, with an open-source implementation and accompanying notebooks [2509.12749]. The package uses ITensors.jl for tensor operations and is suitable for both theoretical algorithm development and direct support for experimentalists collecting quantum data [2509.12749]. This dual orientation distinguishes it from libraries focused solely on hardware execution or solely on numerical simulation.

Its modular and composable design can be interpreted in light of broader Julia package design principles found in MeasureTheory.jl, where measures are treated as central objects, combinators compose complex constructions from simpler ones, and explicit handling of measure-theoretic structure improves extensibility [2110.00602]. RandomMeas.jl is not described as depending on MeasureTheory.jl, and no such claim is warranted. However, the comparison highlights a shared Julia idiom: abstract types, compositional interfaces, and explicit modeling of mathematical structure [2110.00602]. This suggests that RandomMeas.jl belongs to a wider ecosystem of mathematically structured scientific software in Julia.

The package’s practical examples include entanglement entropy by purity measurement, device benchmarking with cross-entropy-based quantities, robust-shadow tomography with calibration groups, and shallow-shadow calibration and application [2509.12749]. Fourteen Jupyter notebooks accompany the codebase [2509.12749]. These examples place the software within active research programs in quantum state characterization, error mitigation, and benchmarking.

A recurring misconception in randomized measurement practice is that the method is merely a substitute for full tomography. The literature indicates a more precise view: randomized measurements are especially useful for local-unitary-invariant properties, for reference-frame-independent settings, and for scalable estimation of selected observables or nonlinear functionals rather than full universal reconstruction in the most general sense [2011.10591]. RandomMeas.jl reflects this specialization. Its feature set centers on shadow-based estimators, moments, and benchmarking quantities, not on exhaustive state tomography as a default endpoint [2509.12749].

Another misconception is that any convenient randomization ensemble is interchangeable with any other. The distinction between unitary randomized measurements, real randomized measurements, and partial real randomized measurements shows that the choice of randomization group and observable sector determines which correlations are accessible [2411.06013]. Likewise, the MPS sampling results show that random local constructions can fail to be unbiased with respect to a target geometric measure [2505.00073]. In this sense, RandomMeas.jl should be understood as a protocol framework whose outputs depend materially on the specified randomization ensemble and estimator family.

Taken together, the available descriptions present RandomMeas.jl as a research-oriented software framework for randomized measurement protocols, distinguished by end-to-end workflow coverage, explicit data abstractions, shadow-based and moment-based estimators, tensor-network simulation support, and built-in uncertainty quantification [2509.12749]. Its significance lies in consolidating a fragmented methodological area into a single extensible Julia package while remaining close to current developments in randomized measurements, real randomized measurements, and advanced shadow protocols [2509.12749; 2411.06013; 2011.10591].

Source: https://www.emergentmind.com/topics/randommeas-jl