%config
Warning
This documentation refers to the Classic QDK, which has been replaced by the Modern QDK.
The Modern QDK only supports the '%%qsharp' magic command.
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.
dump.measurementDisplayStyle
Value: "NumberOnly"
, "BarOnly"
, "BarAndNumber"
(default), or "None"
Configures the measurement probability visualization style in output of callables such as
DumpMachine
or DumpRegister
. Supports displaying measurement probability as progress bars, numbers, both,
or neither.
dump.measurementDisplayPrecision
Value: non-negative integer (default 4
)
Sets the precision of the measurement probability displayed as a percentage when
dump.measurementDisplayStyle
is set to "NumberOnly"
or "BarAndNumber"
.
dump.measurementDisplayHistogram
Value: true
or false
(default)
If dump.measurementDisplayHistogram
is set to true
, displays an interactive
histogram representation of the state of the simulator underneath the static state visualization.
dump.plainTextOnly
Value: true
or false
(default)
Forces plain-text output from callables such as DumpMachine
and DumpRegister
, even
when using an HTML-enabled client such as Jupyter Notebook.
trace.defaultDepth
Value: positive integer (default 1
)
Configures the default depth used in the %trace
command for visualizing Q# operations.
trace.style
Value: "Default"
(default), "BlackAndWhite"
, or "Inverted"
Configures the default style used in generating the visualization of Q# operations with the %trace
command.
Examples for %config
Example 1
Print a list of all currently set configuration options:
In []: %config
Out[]: Configuration key Value
--------------------------------- -----------
dump.basisStateLabelingConvention "BigEndian"
dump.truncateSmallAmplitudes true
Example 2
Configure the DumpMachine
and DumpRegister
callables
to use big-endian convention:
In []: %config dump.basisStateLabelingConvention="BigEndian"
Out[]: "BigEndian"
Example 3
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.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for