Skip to content

Commit

Permalink
Merge pull request #398 from atilag/stable-0.3.1
Browse files Browse the repository at this point in the history
Stable 0.3.1
  • Loading branch information
atilag authored Oct 15, 2019
2 parents ef1274c + db66625 commit 2b7f65c
Show file tree
Hide file tree
Showing 116 changed files with 5,603 additions and 1,690 deletions.
369 changes: 369 additions & 0 deletions .clang-tidy

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ contrib/standalone/version.hpp
*.env
*.idea/
test/.asv

.tox/
3 changes: 2 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ disable=no-self-use, # disabled as it is too verbose
too-many-public-methods, too-few-public-methods, too-many-ancestors,
unnecessary-pass, # allow for methods with just "pass", for clarity
no-else-return, # relax "elif" after a clause with a return
docstring-first-line-empty # relax docstring style
docstring-first-line-empty, # relax docstring style
unsubscriptable-object # pylint can't determin this for numpy types



Expand Down
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ stage_generic: &stage_generic
# Installing qiskit-terra master branch...
- pip install https://github.com/Qiskit/qiskit-terra/archive/master.zip
# Installing qiskit-aer...
- pip install -U -r requirements-dev.txt
- pip install -U -c constraints.txt -r requirements-dev.txt

stage_linux: &stage_linux
<<: *stage_generic
Expand Down Expand Up @@ -71,8 +71,6 @@ stage_osx: &stage_osx
virtualenv --python ~/python-interpreters/$PYTHON_VERSION/bin/python venv
source venv/bin/activate
fi
- brew install libomp
- brew install openblas
script:
- python setup.py bdist_wheel -- -- -j4
- pip install dist/qiskit_aer*whl
Expand Down
65 changes: 48 additions & 17 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,69 @@ Changelog](http://keepachangelog.com/en/1.0.0/).
> - **Fixed**: for any bug fixes.
> - **Security**: in case of vulnerabilities.
[UNRELEASED](https://github.com/Qiskit/qiskit-aer/compare/0.2.3...HEAD)
[UNRELEASED](https://github.com/Qiskit/qiskit-aer/compare/0.3.0...HEAD)
=======================================================================

Added
-----
- New simulation method for qasm simulator: tensor_network (\#56)
- Added superop qobj instruction and superoperator matrix utils (\# 289)
- Added support for conditional unitary, kraus, superop qobj instructions (\# 291)
- Add "validation_threshold" config parameter to Aer backends (\# 290)
- Added support for apply_measure in tensor_network_state. Also changed
sample_measure to use apply_measure (\#299)
- Added density matrix simulation method to QasmSimulator (\# 295, \# 253)
- Adds delay measure circuit optimization (\# 317)
- Added sampling for sampling with readout-errors (\# 222)
- Added support of single precision for statevector and density matrix simulation (\# 286, \# 315)

- Noise model inserter module (\# 239)
- Added tests for the Fredkin gate (#357)
- Added tests for the cu1 gate (#360)
- Added tests for statevector and stabilizer snapshots (\#355)
- Added tests for density matrix snapshot (\#374)
- Added tests for probabilities snapshot (\#380)
- Added support for reset() in MPS simulation method (\#393)
- Added tests for matrix and Pauli expectation value snapshot (\#386)

Changed
-------
- Added density matrix method to automatic QasmSimulator methods (\# 316)
- Changes signature of SnapshotExpectationValue extension and the way qubit position parameters are parsed in expectation_value_matrix qobj instructions (\#386)
- Change signature of SnapshotProbabilities extension (\#380)
- Change signature of SnapshotDensityMatrix extension (\#374)
- Stabilizer snapshot returns stabilizer instead of full Clifford table (\#355)
- Signature of SnapshotStatevector and SnapshotStabilizer (\#355)
- Changed all names from tensor_network_state to matrix_product_state (\#356)
- Update device noise model to consume asymmetric readout errors from backends (\#354)
- Update device noise model to use gate_length (\#352)
- Refactoring code and introducing floating point comparison func (\#338)



Removed
-------


Fixed
-----
- Bug in handling parallelization in matrix_product_state.cpp (PR \#292)

- Added support for multiplication by coeff in tensor_network_state expectation value snapshots (PR \#294)

[0.3.0](https://github.com/Qiskit/qiskit-aer/compare/0.2.3...0.3.0) - 2019-08-21
===============================================================================

Added
-----
- New simulation method for qasm simulator: tensor_network (\#56)
- Added superop qobj instruction and superoperator matrix utils (\#289)
- Added support for conditional unitary, kraus, superop qobj instructions (\#291)
- Add "validation_threshold" config parameter to Aer backends (\#290)
- Added support for apply_measure in tensor_network_state. Also changed
sample_measure to use apply_measure (\#299)
- Added density matrix simulation method to QasmSimulator (\#295, \#253)
- Adds delay measure circuit optimization (\#317)
- Added sampling for sampling with readout-errors (\#222)
- Added support of single precision for statevector and density matrix simulation (\#286, \#315)
- Noise model inserter module (\#239)

Changed
-------
- Added density matrix method to automatic QasmSimulator methods (\#316)

Removed
-------


Fixed
-----
- Bug in handling parallelization in matrix_product_state.cpp (PR\#292)
- Added support for multiplication by coeff in tensor_network_state expectation value snapshots (PR\#294)
- Change name of qasm simulation method from tensor_network to matrix_product_state (\#320)


Expand Down
29 changes: 27 additions & 2 deletions cmake/Linter.cmake
Original file line number Diff line number Diff line change
@@ -1,17 +1,42 @@
function(add_linter target)
find_program(CLANG_TIDY_EXE "clang-tidy")
if(NOT CLANG_TIDY_EXE)
message(WARNING "The 'lint' target will not be available: 'clang-tidy' was not found.")
message(WARNING "Bypassing C++ linter because 'clang-tidy' was not found.")
else()
# TODO: Once final checks are decided, add "-warnings-as-errors=*".
set(CLANG_TIDY_PROPERTIES "${CLANG_TIDY_EXE}"
"-checks=*"
"-format-style=google"
"-header-filter=\"${AER_SIMULATOR_CPP_SRC_DIR}\""
"-quiet")
# This will add the linter as part of the build process
set_target_properties(${target} PROPERTIES
CXX_CLANG_TIDY "${CLANG_TIDY_PROPERTIES}")
message("Clang Tidy linter will be passed at build time")

# We create two more custom targets, so we can invoque both linter and
# format from the command line.

# Get all project files
file(GLOB_RECURSE ALL_SOURCE_FILES *.cpp *.hpp)
add_custom_target(
linter
COMMAND ${CLANG_TIDY_EXE}
${ALL_SOURCE_FILES}
${CLANG_TIDY_PROPERTIES}
${INCLUDE_DIRECTORIES}
)

find_program(CLANG_TIDY_FORMAT "clang-format")
if(NOT CLANG_TIDY_FORMAT)
message(WARNING "Bypassing C++ auto-format because 'clang-format' was not found.")
else()
add_custom_target(
format
COMMAND ${CLANG_TIDY_FORMAT}
-style=file
-i
${ALL_SOURCE_FILES}
)
endif()
endif()
endfunction()
2 changes: 2 additions & 0 deletions constraints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pylint==2.4.1
astroid==2.3.0
27 changes: 14 additions & 13 deletions contrib/standalone/qasm_simulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ enum class CmdArguments {
};

inline CmdArguments parse_cmd_options(const std::string& argv){
if(argv == "-v" || argv == "--version"){
if(argv == "-v" || argv == "--version")
return CmdArguments::SHOW_VERSION;
} else if (argv == "-c" || argv == "--config"){

if (argv == "-c" || argv == "--config")
return CmdArguments::INPUT_CONFIG;
}

return CmdArguments::INPUT_DATA;
}

Expand Down Expand Up @@ -92,14 +93,14 @@ int main(int argc, char **argv) {
json_t qobj;
json_t config;

if(argc == 1){
usage(std::string(argv[0]), out);
if(argc == 1){ // NOLINT
usage(std::string(argv[0]), out); // NOLINT
return 1;
}

// Parse command line options
for(auto pos = 1ul; pos < static_cast<unsigned int>(argc); ++pos){
auto option = parse_cmd_options(std::string(argv[pos]));
for(auto pos = 1UL; pos < static_cast<unsigned int>(argc); ++pos){ // NOLINT
auto option = parse_cmd_options(std::string(argv[pos])); // NOLINT
switch(option){
case CmdArguments::SHOW_VERSION:
show_version();
Expand All @@ -119,7 +120,7 @@ int main(int argc, char **argv) {
break;
case CmdArguments::INPUT_DATA:
try {
qobj = JSON::load(std::string(argv[pos]));
qobj = JSON::load(std::string(argv[pos])); // NOLINT
pos = argc; //Exit from the loop
}catch(std::exception &e){
std::string msg = "Invalid input (" + std::string(e.what()) + ")";
Expand All @@ -136,17 +137,17 @@ int main(int argc, char **argv) {
// Check for command line config
// and if present add to qobj config
json_t& config_all = qobj["config"];
if (!config.empty())
if (!config.empty()) // NOLINT
config_all.update(config.begin(), config.end());

// Initialize simulator
AER::Simulator::QasmController sim;
auto result = sim.execute(qobj);
out << result.dump(4) << std::endl;
out << result.json().dump(4) << std::endl;

// Check if execution was succesful.
// Check if execution was successful.
bool success = false;
std::string status = "";
std::string status;
JSON::get_value(success, "success", result);
JSON::get_value(status, "status", result);
if (!success) {
Expand Down
28 changes: 28 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
22 changes: 22 additions & 0 deletions docs/apidocs/aer.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.. _qiskit-providers-aer:

*************************
qiskit.providers.aer
*************************

.. currentmodule:: qiskit.providers.aer


.. automodapi:: qiskit.providers.aer
:no-heading:
:no-inheritance-diagram:
:inherited-members:

Submodules
==========

.. toctree::
:maxdepth: 1

aer_backends
noise/noise
13 changes: 13 additions & 0 deletions docs/apidocs/aer_backends.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. _qiskit-providers-aer-backends:

*****************************
qiskit.providers.aer.backends
*****************************

.. currentmodule:: qiskit.providers.aer.backends


.. automodapi:: qiskit.providers.aer.backends
:no-heading:
:no-inheritance-diagram:
:inherited-members:
13 changes: 13 additions & 0 deletions docs/apidocs/noise/noise.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. _qiskit-providers-aer-noise:

**************************
qiskit.providers.aer.noise
**************************

.. currentmodule:: qiskit.providers.aer.noise


.. automodapi:: qiskit.providers.aer.noise
:no-heading:
:no-inheritance-diagram:
:inherited-members:
Loading

0 comments on commit 2b7f65c

Please sign in to comment.