Commit Graph

3347 Commits

Author SHA1 Message Date
Matthew Treinish 86103724cb Change benchmarks run in CI job (#3388)
* Change benchmarks run in CI job

This commit changes up the benchmarks we run in the travis CI job. This
job is very susceptible to noise because of shifts in CI node
performance. The environment that travis uses to host their environment
has variable performance being that they run on public clouds so to
minimize spurious failures caused by things outside of our control we
should try to limit the benchmarks we run to smaller synthetic ones then
larger full path tests. To this end this commit removes the state
tomography benchmark and replaces it with synthetic benchmarks for
circuit construction, converters, and the assembler. The state
tomography benchmarks involves running a simulation with BasicAer,
ignis, and quantum_info to calculate the state fidelity and while this
is a useful benchmark in dedicated benchmarking environment there is too
much work going on to provide repeatable results for the CI job.

* Remove converters from list of ci benchmarks

This commit removes the converters benchmarks from the list while each
benchmark iteration takes at most a few seconds the matrix of benchmarks
run is quite large and the setup can be expensive for the larger
circuits. While it only takes a few extra minutes locally on a
reasonable system, in the slow ci nodes this pushes things beyond the
45min timeout. To make sure we have enough time budget this commit
removes the converter benchmarks from the list we run in ci.

* Remove QFT from list of benchmarks too

The qft benchmarks also run for a long time and suffer from the same
kind of variability that state_tomography did (although to a lesser
extent). This commit removes it from the list too.

* Add converter benchmarks for depth 8

Running the full range of benchmarks for the converter functions across
takes too much time (mostly in setup). But they can provide valuable
insights. This commit adds just the depth 8 versions of the benchmarks
to the list we run in CI. This should be a tradeoff of actually running
them but having it execute quickly enough in our ci env.
2019-11-07 23:25:33 +00:00
Matthew Treinish 4164568978 Make ibmq imports for backend monitor at runtime (#3429)
After #3325 the import structure of the tools directory was changed so
that sometimes the ibmq imports at the top of the
qiskit.tools.monitor.backend_overview module get evaluated prior to the
pkgutil call in qiskit.providers.__init__ that is used to look for
namespace packages outside of the terra repo. When this happens the
imports from the qiskit-ibmq-provider package fail because they haven't
been added to the python namespace yet. The way the backend monitor was
checking made this non-fatal but would never populate the names. So when
you'd later go to run the function it would fail with a NameError
because the imports didn't work, even if ibmq was installed (and
working otherwise). This commit works around this issue by making the
ibmq imports occur at runtime inside the functions in the module. This
makes the imports happen as late as possible and ensures that if ibmq is
installed and working that we'll be checking that after pkgutil has a
chance to search for the namespace packages.

Related-To Qiskit/qiskit#559
Fixes #3413
2019-11-07 11:32:11 -07:00
abbycross 9d2517403a small apidocs fixes (#3396)
* dist -> dict

* spacing and typos

* add comma so parser doesn't stop after i.e.

* punctuation for clarity

* had been -> were

* punctuation fix for clarity

* missing end parens

* typos and spacing

* more spacing
2019-11-07 15:24:32 +00:00
Ali Javadi-Abhari faf3727fdb
make zeroing of discrete pulses optional (#3419)
* make zeroing of discrete pulses optional

* fix type hint
2019-11-07 09:53:22 -05:00
Christopher J. Wood cf9c3f8d11 Fixes bug in concurrence using ``eigh`` instead of ``eigvals`` for possibly non-hermitian matrices (#3376)
* fix qi.concurrence

* Fix tests for concurrence and entanglement of formation

* unused import
2019-11-06 20:56:54 +00:00
Paul Nation 9134634f43 Module-level docstrings for Terra (#3325)
* add tools.jupyter docs

* execute device visualizations

* add examples to QuantumCircuit and execute

* lint

* update execute docs

* add basicaer docs

* Add workaround for running with IBMQ examples everywhere

* updates

* lint

* Add graphviz to docs job

* add extensions module-level docstirngs

* more module level docs

* updates

* more updates

* transpiler docs and lint

* all but tools

* jupyter tools

* fix import issue

* tools module

* remove automod

* new line

* fix test using function with wrong name

* updates
2019-11-06 18:46:45 +00:00
Ali Javadi-Abhari 2ba8f299df fix zeroed_width issues, make default sampling midpoint (#3314)
* fix zeroed_width for gaussian and gaussian_square

* fix some definitions

* fix test

* make sampler midpoint by default

* fix rescale_amp docstrings, fix tests to reflect midpoint, fix sech
2019-11-06 13:14:09 -05:00
Daniel Puzzuoli d5e9a3b1d0 pulse Schedule not filter (#3361)
* added filter_type argument to pulse.Schedule.filter to enable switching between filtering, inverse filtering (i.e. keeping instructions that fail some filter), or returning both

* fixed error in the way Schedule._filter() was constructing total_filter

* added testing for pulse.Schedule.filter in the filter_type=1 case

* adding tests for Schedule.filter for the new filter_type=1 and filter_type=2; however too much repeated code, will simplify

* simplified test cases in test_schedule.TestScheduleFilter to simultaneously test all options of filter_type=0,1,2. All original tests have been retained

* Removing filter_type argument from Schedule.filter, and adding a Schedule.exclude method

* fixing the way Schedule.filter deals with un-keyed arguments in the filter_func argument. Modified tests to deal with new method signature for Schedule.filter and Schedule.exclude

* updated tests in test_schedule.TestScheduleFilter to reflect new changes to Schedule.filter and Schedule.exclude

* fixed stylistic issues in schedule.py and test_schedule.py

* corrected style in Schedule.filter and Schedule.exclude, and test_schedule.py

* added a new method Schedule._apply_filter to refactor duplicate code from Schedule.filter and Schedule.exclude

* corrected error in Schedule._apply_filter

* minor changes to comments in schedule.py

* Update qiskit/pulse/schedule.py

Co-Authored-By: Lauren Capelluto <laurencapelluto@gmail.com>

* Update qiskit/pulse/schedule.py

Co-Authored-By: Lauren Capelluto <laurencapelluto@gmail.com>

* Update qiskit/pulse/schedule.py

Co-Authored-By: Lauren Capelluto <laurencapelluto@gmail.com>

* Update qiskit/pulse/schedule.py

Co-Authored-By: Lauren Capelluto <laurencapelluto@gmail.com>

* fixing comments in filter and exclude methods in schedule.py

* Removed unnecessary lines from Schedule._construct_filter
2019-11-06 16:11:28 +00:00
Luciano e616caf111 Fake Johannesburg device (20 qubit) (#3381) 2019-11-04 21:59:01 +00:00
Diego M. Rodríguez 0e332a9d6c Docstrings updates for qiskit.transpiler.passes.[a-m] (#3382)
* Update transpiler.passes docstrings

* Update Collect2qBlocks.run docstring

* Minor parenthesis tweak
2019-11-04 13:57:43 -05:00
toural d5d94232ab graphviz installation instructions (#3179)
* fix for #3070 graphviz installation instructions

I have included the URL to the Graphviz software package download page for the different operating systems.

* lint
2019-11-04 17:07:57 +00:00
Luciano edf2c497d5 Add layout score analysis pass (#3321)
* initial commit

* docstring

* docstring

* Update qiskit/transpiler/passes/mapping/layout_score.py

Co-Authored-By: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>

* += -> =

* docstring

* remove initial_layout param

* rename qiskit/transpiler/passes/mapping/layout_score.py qiskit/transpiler/passes/mapping/layout_2q_distance.py

* LayoutScore -> Layout2qDistance

* counter

* dyn property name

* docstring

* release note

* each two qubit gate in the circuit
2019-11-01 21:02:14 +00:00
Matthew Treinish 73c2daf965 Add class's __init__() docstring too (#3258)
Right now many classes document class constructors and they're arguments
in the docstring for the __init__() methods of the class. However, by
default autodoc does not show these for the classes' documentation and
instead relies on only the class docstring. This commit sets the sphinx
autodoc config option [1] to use both the class and init docstring
together.

[1] https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#confval-autoclass_content
2019-11-01 17:27:29 +00:00
Luciano 37d51af53f no more random in test_visualization (#3365)
* no more random in test_visualization

* lint

* lint!

* gate -> qubit
2019-11-01 14:43:13 +00:00
Luciano cd4e2a163a FullAncillaAllocation and EnlargeWithAncilla do not allow initial_layout at construction time (#3363)
* enlarge_with_ancilla

* full_ancilla_allocation

* new refs
2019-11-01 00:36:06 +00:00
Diego M. Rodríguez cfbe64e71d More informative handling of serialization errors (#3228)
* Add make_error_serialize

* Update InstructionParameter._serialize

* Revise other _serialize methods

* Update docstring and fix return
2019-10-31 17:53:18 +00:00
Kevin Krsulich 386995defa Disable QasmQobjInstruction validation during circuit assembly. (#3370) 2019-10-31 15:21:39 +00:00
Diego M. Rodríguez 291d47a12a Allow bypassing validation during model instantiation (#3368)
* Tweaks to validation/base docstrings

* Use "validate" constructor attribute

* Update validation.base docstrings

* Add test

* Adjust quotes in docstrings

Actually doubling as a re-triggering of CI.
2019-10-31 15:02:31 +00:00
Jack J. Woehr 299277d35e Add Instruction.is_parameterized() (#3328)
* added Instruction.is_parameterized()

* Applied new method Instruction.is_parameterized() in obvious places.
Added test case for Instruction.is_parameterized().

* release note for Instruction.is_parameterized

* Cleaned up for linter.
Added typographical style to release note.

* Added bound parameter test to test_is_parameterized()

* Added detail to release note.

* Updated the cases in Collect2qBlocks and CommutationAnalysis

* changed test to bind parameter to instruction in approved fashion

* corrected test
2019-10-30 16:55:29 -04:00
Matthew Treinish 81c5865ca8 Stop setting explicit background color in plot_histogram() (#3277)
Setting an explict background color in the histogram plotgram results
in slightly more pleasing default color (a light grey vs white) but has
the negative side effect of making some plot features illegble for cases
where users have a custom style set. For example, if you set a
background style with matplotlib.pyplot.style.use('dark_background')
this will result in the bar labels being nearly illegible because it is
white on light grey. This commit removes the explicit background color
and enables our users to set their own background color if they desire.
2019-10-30 19:02:40 +00:00
Lauren Capelluto 2ad7a666b4 Add useful methods to PulseBackendConfiguration (#3309)
* Add useful methods to PulseBackendConfiguration. This will remove the need for the redundant PulseChannelsSpec class in pulse.

* Add release notes

* Style: Remove unused import

* Remove old test

* Fix issue in test: plot gate map only works with > 5 qubits

* Respond to feedback: Valid + realistic hamiltonian in mocked configuration, releasenotes augmented to alert users of dt/dtm change, hamiltonian methods on config return whole hamiltonian + tests updated to match, and dt/dtm are put it proper units during init rather than access

* Style
2019-10-30 17:34:25 +00:00
Matthew Treinish cb5287d3a3 Remove duplicated test jobs from travis (#3355)
In #3143 we added back most of the jobs which we removed from travis to
see if we preferred running jobs in travis or azure pipelines. After
having this for a full day it's become apparent that even with the extra
capacity from our travis subscription that the wait times on travis with
the full job load are too high. The travis check returned significantly
slower than the equivalent job in azure pipelines. So for now we'll
stick to running the majority of and required testing in azure pipelines
and use travis only for extra jobs where needed. This commit removes all
the duplicated jobs that we run in azure from the travis config.
2019-10-30 10:37:17 -04:00
faisaldebouni 556c2df4ab Add support for slicing and concatenation of PassManagers (#3209)
* implemented functions to enable slicing and concatenation of PassManagers

* fixed errors, added release notes, added unittests

* resolving conflict

* adapter implementation to new PassManager

* fixes a bug caused by shallow copy

* test name capitalization
2019-10-30 12:01:56 +00:00
Matthew Treinish ca7f2a77dd Fix matplotlib with wide parameters (#3354)
This commit fixes issues reported with long parameter lists in the mpl
drawer. The issue is that when the length of the parameters list exceeds
20 characters the mpl drawer removes the parameters. Multiple attempts
have attempted to address this issue (#2994 #3353) by just increasing
that limit. But this doesn't actually solve the problem because the
boxes are fixed width so the parameters just exceed the width of the
boxes. The proper way to fix this is to dynamically

In addition this whole problem is primarily caused because we don't
round any parameter values. This commit rounds the parameters so that we
rarely have to scale to have super wide parameter lists.

Fixes #2822
2019-10-30 01:56:12 +00:00
Kevin Krsulich c96baad5c6 Unroller and Optimize1QGates to use single node substitution (#3233)
* DAGCircuit.substitute_node should respect name from replacement op.

* Remove unroller error message resolved by #3148.

* Unroller and optimize_1q_gates to use substitute_node when possible.
2019-10-30 01:36:22 +00:00
Luciano 0b52e06117 release note for PR #3290 (#3339)
* release note for 3290

* both?

* issue entry
2019-10-29 22:47:26 +00:00
Matthew Treinish e226d05328
Add mergify config (#3352)
This commit adds a basic configuration for using mergify.io. It simply
will just squash merge the PR if it's been approved and passes ci. The
configuration documentation for the service can be found here:

https://doc.mergify.io/configuration.html
2019-10-29 18:16:22 -04:00
Matthew Treinish 728399afda Remove auto-merge bot configuration file (#3351)
We have not been able to get this bot working, even after numerous
attempts and alternative configuration settings. We're going to abandon
this bot and try a different service. So this commit removes the file
since we no longer need it around.
2019-10-29 16:09:42 -04:00
Paul Nation d630f3dada fix r gate (#3349) 2019-10-29 15:09:31 -04:00
Luciano d3bf2374bb
Update auto-merge.yml (#3347)
reportStatus: true
2019-10-29 14:38:05 -04:00
Christopher J. Wood f95e859379 Add R gate to standard gates (#3341)
* add R gate to standard gates

* lint

* lint

* fix typo in r definition
2019-10-29 14:07:17 -04:00
Lauren Capelluto 600b8b2415 Fix bug in align_acquires where measurement pulses had to be added before AcquireInstructions (#3307) 2019-10-29 13:50:50 -04:00
Luciano 0a45dea238
yet another auto-merge configuration (#3326)
* auto-merge conf from https://github.com/bobvanderlinden/probot-auto-merge/blob/master/.github/auto-merge.yml

* blockingTitleRegex

* mergeMethod: squash
2019-10-29 11:37:08 -04:00
Matthew Treinish 91e31b1aae Stop setting basepython in base tox testenv (#3344)
We started setting the basepython attribute in the root testenv
configuration in the tox.ini in #1761. This was done to ensure that
users on environments with both python2 and python3 installed that jobs
which weren't explicit about the python version (like 'lint') would not
attempt to use python2 in error. However, this had the unintended side
effect of also making jobs which were opinionated about python version
(basically the standard test jobs 'py37', 'py36', and 'py35') would end
up using the 'python3' binary in the standard path instead of the
version specified in the job name. This mostly came up on systems with
more than one python version installed. The basepython declaration is
only needed for jobs that do not specify a python version. This commit
updates the tox.ini to remove the basepython from the base testenv
definition and only use it for jobs where the python version isn't
explicitly set.
2019-10-29 09:05:20 -04:00
Kevin Krsulich a4b03ae34e
Add missing release notes for #3281. (#3340) 2019-10-28 17:05:33 -04:00
Luciano 6745b1ecec
Parallel support for PassManager.run() (#3290)
* split!

* passes()

* max_iteration

* replace

* some RunningPassManager clean up

* callback support

* property_set result

* lint

* cleaning up runninpassmanager

* docstring

* args

* parallel

* test

* parallelize using dill

* dill in requirements.txt

* lint

* runningpassmanager style

* dill in setup

* fix the drawer with the new format from passes

* new refs

* Update qiskit/visualization/pass_manager_visualization.py

Co-Authored-By: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>

* no label for linear

* refs

* _pass_sets

* pass set in a docstring

* lint

* different circuits

* circuit_or_circuits -> circuits
2019-10-28 14:29:23 -04:00
Matthew Treinish fb87e7c2e2 Add dual of mpl mathtext syntax for latex drawer labels (#3224)
* Add dual of mpl mathtext syntax for latex drawer labels

This commit adds a new feature to the latex drawer that adds support for
a similar syntax to matplotlib's mathtext to labels on the latex drawer.
In matplotlib if you specify a string between two dollar signs (for
example $\gamma$) that string will be parsed with mpl's native TeX
expression parser and that will be used to layout and render the string
per the TeX syntax. This uses the same syntax as mathtext, and enables
users to write raw latex syntax as gate labels between a pair of dollar
signs. All characters outside of the dollar signs are treated as utf8
and get encoded by pylatexenc to create valid latex, however all text
inside the dollar signs get passed verbatim to the output latex. This
enables users to mix and match having their unicode encoded for them and
manually passing latex

Fixes #3171

* Fix lint

* Use jupyter-execute instead of describing diagram

* Revert "Use jupyter-execute instead of describing diagram"

This reverts commit ab7bc18c39. Running
the code example in jupyter-execute will require a latex distribution
with qcircuit to be installed. That adds a lot of run time to the doc
build and a non-obvious dependency. To avoid this, we'll just rely on
the code example and a description of the output.
2019-10-28 13:54:59 -04:00
Kevin Krsulich a94e8a5b48 Reset python env for CI benchmarks to 3.5. (#3336)
#3143 restored travis jobs for environments other than 3.6, but
the benchmarks are currently set to run on 3.5, which needed
to be overridden explicitly.
2019-10-28 12:59:41 -04:00
Kevin Krsulich d53197a0c8
Collect2qBlocks, CommutationAnalysis to ignore parameterized gates. (#3288) 2019-10-28 12:18:02 -04:00
Matthew Treinish bc80040f06 Add back travis config for unit tests (#3143)
* Add back travis config for unit tests

Since we now have a subscription for travis we no longer have to worry
as much about longer queue delays. The core team preference is to use
travis for more than for azure. This commit moves the majority of the
testing out of azure and into travis accordingly.

* Add missing echo and cache stestr dir

This commit adds a missing echo for the python hashseed so we can
actually see what we set the hash seed to. It also adds caching for the
.stestr dir which will enable seeding the test runner's scheduler with
data from previous runs to optimize the worker balance and hopefully
improve run time slightly.

* Fix typo

* Also cache stestr on osx

* Restore azure config

* Remove travis wheel build configs

* Default to python 3.7
2019-10-28 11:49:16 -04:00
Diego M. Rodríguez 024f73e2ed Docstrings updates for qiskit.transpiler.passes.mapping (#3332)
* Misc tweaks to passes.mapping docstrings

* Minor updates to passes.mapping docstrings
2019-10-28 10:56:22 -04:00
Ali Javadi-Abhari 07047a2a10 Add mock Burlington and allow htmlrep for FakeBackends (#3317)
Adds Burlington as an example of a 5-qubit backend supporting pulse.
configuration, properties and defaults are included.

Additionally allows FakeBackend instances to be interacted in jupyter 
similar to IBMQBackend instances.

* add mock Burlington and allow htmlrep for FakeBackends

* lint
2019-10-28 09:26:33 -04:00
Paul Nation 96459d330b Fix plot_circuit_layout (#3329)
Fixes #2945

It was assumed that the returned bits were in order when in fact they need not be.
2019-10-28 08:55:51 -04:00
Knabberjoe 152a19b3e2 Update plot_state_city to align labels (#3235)
* Update plot_state_city to align labels

Fixes #3234. Added two attributes in the call of set_ticklabels() in plot_state_city in order to align the labels of the created plot with the ticks on the x and y axes.

* Added indentation

* Corrected Whitespace
2019-10-28 08:35:04 -04:00
Luciano 516607b55b
small refactor of quantum_initializer (#3241)
* _ct is unused

* loose functions as static methods

* loose functions as static methods

* remove _h()

* old code
2019-10-27 14:21:09 -04:00
Matthew Treinish 52b4dc12f2
Fix latex columns count (#3243)
The latex drawer uses a class attribute img_depth to keep track of the
number of columns to put in the output img_depth (along with some other
things related to that). This value was attempted to be figured out by
looking at the number of layers except if there is a cu1 gate in a
layer then that layer has 2 columns (because the label takes up one).
However this count was done incorrectly and instead the number of
columns was equivalent to the number of gates in each layer plus 2
columns for each cu1. This resulted in a huge empty space for circuits
with lots of qubits, especially if they had lots of gates per layer.
This commit corrects the layer count loop to instead properly only
count a layer once and twice if it has a cu1 gate in the layer.

Fixes #3232
2019-10-27 07:56:53 -04:00
dime10 3de9ffaca2 In plot_state_city, make the z=0 plane extend to the axes limits on all sides. (#3211) 2019-10-26 22:09:12 -04:00
Luciano 10896b56e3
CouplingMap.distance was returning non-int (#3323)
* cast!

* internal matrix whats to be float
2019-10-26 21:33:50 -04:00
Matthew Treinish 581bec96df
Add alias for cnot function to cx() (#3255)
* Add alias for cnot function to cx()

We often call the cx gate a cnot. Especially when giving presentations
or intros to quantum information you have to explain that cx == cnot. To
make this a bit simpler this commit adds a alias to the
QuantumCircuit.cx() function QuantumCircuit.cnot(). This way when doing
code examples we can just say run "cnot".

* Add aliases for other common gate names

Just as with cx and cnot there are other common names used for several
other quantum gates that are often used interchangeably. These alias are
also added:

ccx -> toffoli
cswap -> fredkin
s -> p
sdg -> pdg
2019-10-25 16:40:33 -04:00
Paul Nation b6a1c3f379
Add doc templates and make QuantumCircuit class example. (#3320)
* doce_templates

* updates

* updates 2

* updates
2019-10-25 15:02:09 -04:00