Repository: Qiskit/qiskit

Issue:
Support unary operand for ParamterExpression
<!-- ⚠️ If you do not respect this template, your issue will be closed -->
<!-- ⚠️ Make sure to browse the opened and closed issues -->

### Information

- **Qiskit Terra version**: master
- **Python version**: 3.7.4
- **Operating system**: macOS 10.14

### What is the current behavior?
Since `ParameterExpression` does not support `unary` operand, a parameterized circuit might be crashed during transpile, e.g. a circuit with parameterized cu3.

error for unsupporting unary operand.
```
~/Developer/Quantum/qiskit-terra/qiskit/extensions/standard/cu3.py in _define(self)
     46             (CnotGate(), [q[0], q[1]], []),
---> 47             (U3Gate(-self.params[0] / 2, 0, -(self.params[1] + self.params[2]) / 2), [q[1]], []),
     48             (CnotGate(), [q[0], q[1]], []),

TypeError: bad operand type for unary -: 'Parameter'

```

On the other hand, the current parameter expression only the real number operations, is it possible to support the operation with the complex number? I know at the end the gate parameter could be real but it might be complex during the computations.

### Steps to reproduce the problem
```python3
from qiskit import transpile
from qiskit import QuantumRegister, QuantumCircuit
from qiskit.circuit import Parameter

qc = QuantumCircuit(2, name='a')
params = [Parameter('x0'), Parameter('x1'), Parameter('x2')]
qc.cu3(params[0], params[1], params[2], 0, 1)
t_qc = transpile(qc, basis_gates=['u1', 'u2', 'u3', 'cx'])
```

### What is the expected behavior?
Transpiling without crash


### Suggested solutions
Since the definition of cu3 gate uses unary operator, the `ParameterExpression` class needs to support it in order to be compiled to basis gates.

like this
```python
    def __neg__(self):
        return self._apply_operation(operator.mul, -1.0)
```

On the other hand, for supporting complex numbers in `ParameterExpression`. 
I think we can postpone the checking whether or not the parameter is complex at the very end. like here: https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/circuit/parameterexpression.py#L73
I think that since terra has already use sympy to support the `ParameterExpression`, it should not too difficult to support complex number? (Maybe I am wrong, please feel free to correct me)



Discussion:

Resolving patch:
diff --git a/qiskit/circuit/parameterexpression.py b/qiskit/circuit/parameterexpression.py
--- a/qiskit/circuit/parameterexpression.py
+++ b/qiskit/circuit/parameterexpression.py
@@ -159,7 +159,7 @@ def _apply_operation(self, operation, other, reflected=False):
 
         Args:
             operation (function): One of operator.{add,sub,mul,truediv}.
-            other (Parameter or number.real): The second argument to be used
+            other (Parameter or numbers.Real): The second argument to be used
                with self in operation.
             reflected (bool): Optional - The default ordering is
                 "self operator other". If reflected is True, this is switched
@@ -211,6 +211,9 @@ def __rsub__(self, other):
     def __mul__(self, other):
         return self._apply_operation(operator.mul, other)
 
+    def __neg__(self):
+        return self._apply_operation(operator.mul, -1.0)
+
     def __rmul__(self, other):
         return self._apply_operation(operator.mul, other, reflected=True)
 
@@ -232,7 +235,6 @@ def __float__(self):
         if self.parameters:
             raise TypeError('ParameterExpression with unbound parameters ({}) '
                             'cannot be cast to a float.'.format(self.parameters))
-
         return float(self._symbol_expr)
 
     def __copy__(self):


Test patch:
diff --git a/test/python/circuit/test_parameters.py b/test/python/circuit/test_parameters.py
--- a/test/python/circuit/test_parameters.py
+++ b/test/python/circuit/test_parameters.py
@@ -19,6 +19,7 @@
 
 import numpy
 
+import qiskit
 from qiskit import BasicAer
 from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
 from qiskit.circuit import Gate, Parameter, ParameterVector, ParameterExpression
@@ -522,6 +523,32 @@ def test_nested_expressions(self):
 
         self.assertEqual(float(bound_expr2), 5)
 
+    def test_negated_expression(self):
+        """Verify ParameterExpressions can be negated."""
+
+        x = Parameter('x')
+        y = Parameter('y')
+        z = Parameter('z')
+
+        expr1 = -x + y
+        expr2 = -expr1 * (-z)
+        bound_expr2 = expr2.bind({x: 1, y: 2, z: 3})
+
+        self.assertEqual(float(bound_expr2), 3)
+
+    def test_standard_cu3(self):
+        """This tests parameter negation in standard extension gate cu3."""
+        x = Parameter('x')
+        y = Parameter('y')
+        z = Parameter('z')
+        qc = qiskit.QuantumCircuit(2)
+        qc.cu3(x, y, z, 0, 1)
+        try:
+            qc.decompose()
+        except TypeError:
+            self.fail('failed to decompose cu3 gate with negated parameter '
+                      'expression')
+
     def test_name_collision(self):
         """Verify Expressions of distinct Parameters of shared name raises."""