%config

Summary

Allows setting or querying configuration options.

Description

This magic command allows for setting or querying configuration options used to control the behavior of the IQ# kernel (such as state visualization options). It also allows for saving those options to a JSON file in the current working directory (using the --save option).

Configuration settings

dump.basisStateLabelingConvention

Value: "LittleEndian" (default), "BigEndian", or "Bitstring"

The convention to be used when labeling computational basis states in output from callables such as DumpMachine or DumpRegister.

dump.truncateSmallAmplitudes

Value: true or false (default)

Hides basis states of a state vector whose measurement probabilities (i.e., squared amplitudes) are smaller than a particular threshold, as determined by the dump.truncationThreshold setting.

dump.truncationThreshold

Value: floating point number such as 0.001 or 1E-8 (default 1E-10)

If dump.truncateSmallAmplitudes is set to true, determines the threshold for measurement probabilities (i.e., squared amplitudes) below which to hide the display of basis states of a state vector.

dump.phaseDisplayStyle

Value: "ArrowOnly" (default), "NumberOnly", "ArrowAndNumber", or "None"

Configures the phase visualization style in output from callables such as DumpMachine or DumpRegister. Supports displaying phase as arrows, numbers (in radians), both, or neither.

Example

Print a list of all currently set configuration options:

In []: %config
Out[]: Configuration key                 Value
       --------------------------------- -----------
       dump.basisStateLabelingConvention "BigEndian"
       dump.truncateSmallAmplitudes      true

Example

Configure the DumpMachine and DumpRegister callables to use big-endian convention:

In []: %config dump.basisStateLabelingConvention="BigEndian"
Out[]: "BigEndian"

Example

Save current configuration options to .iqsharp-config.json in the current working directory:

In []: %config --save
Out[]:

Note that options saved this way will be applied automatically the next time a notebook in the current working directory is loaded.