Skip to content

Conversation

adjs
Copy link
Contributor

@adjs adjs commented Dec 3, 2017

Description

After #167. When I run the attached file I get “AttributeError: 'BinaryOp' object has no attribute 'sym'”. I reverted the file that originates the error.

bug.py.txt

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • [ X ] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@awcross1
Copy link
Member

awcross1 commented Dec 4, 2017

Thank you for catching this! Instead of changing the call from sym() to real() in the dagbackend, I think the expression node objects need to all have sym() methods. The same problem occurs with unary operators too, eg. writing "u1(-2.7) q[0];" (see the "add sym() to Prefix()" commit in PR #171). We should add these examples as tests.

@1ucian0 1ucian0 mentioned this pull request Dec 4, 2017
diego-plan9 pushed a commit to awcross1/qiskit-terra that referenced this pull request Dec 5, 2017
@diego-plan9
Copy link
Member

Closing this PR in favour of #171, in order to fix it with the approach suggested by Andrew - thanks a lot @adjs for catching it and for the test, and looking forward to more contributions!

@diego-plan9 diego-plan9 closed this Dec 5, 2017
@diego-plan9 diego-plan9 mentioned this pull request Dec 5, 2017
9 tasks
diego-plan9 pushed a commit to awcross1/qiskit-terra that referenced this pull request Dec 12, 2017
diego-plan9 pushed a commit that referenced this pull request Dec 12, 2017
* optimize_1q_gates behavior change: remove u1(2*pi).

Address issue #159.
Modifications to use of sympy in optimize_1q_gates.
Updated tests.

* Remove comment.

* Add sym() method to Prefix().

Fixes a problem with sympy integration for negated parameters.

* Remove print().

* Add sym() to binaryop.

* new test to check the bug in #172

* doc

* Linting and style fixes

* Fix test_mapper test that depends on Python vers.

Modify `test_math_domain_error` in order to expect different results
depending on the version of Python. This is a work-around to allow the
test to pass, but should be handled higher up.

* moving toffoli_gate test to test_quantumprogram

* removing not necessary N () to improve performance

* add new tests.

* add corresponding test qasm files.

* tests and corrections.

* Restyle test_mapper tests, update example qasms

* Allow test_mapper to compare QASM for Python 3.5

Revise "test_optimize_1q_gates_issue159" comparing the output of the
compilation with two similar expected outputs.
taalexander pushed a commit to taalexander/qiskit-terra that referenced this pull request May 2, 2019
lia-approves pushed a commit to edasgupta/qiskit-terra that referenced this pull request Jul 30, 2019
* optimize_1q_gates behavior change: remove u1(2*pi).

Address issue Qiskit#159.
Modifications to use of sympy in optimize_1q_gates.
Updated tests.

* Remove comment.

* Add sym() method to Prefix().

Fixes a problem with sympy integration for negated parameters.

* Remove print().

* Add sym() to binaryop.

* new test to check the bug in Qiskit#172

* doc

* Linting and style fixes

* Fix test_mapper test that depends on Python vers.

Modify `test_math_domain_error` in order to expect different results
depending on the version of Python. This is a work-around to allow the
test to pass, but should be handled higher up.

* moving toffoli_gate test to test_quantumprogram

* removing not necessary N () to improve performance

* add new tests.

* add corresponding test qasm files.

* tests and corrections.

* Restyle test_mapper tests, update example qasms

* Allow test_mapper to compare QASM for Python 3.5

Revise "test_optimize_1q_gates_issue159" comparing the output of the
compilation with two similar expected outputs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants