Skip to content

Support np.sign for parameter #10360

@nkanazawa1989

Description

@nkanazawa1989

What should we add?

I sometime want to check sign of parameter value, but this is not currently supported.

from qiskit.circuit import Parameter
import numpy as np

v = Parameter("value")
np.sign(v)

(temporary hack)

from qiskit.circuit import ParameterExpression
import symengine as sym

sign_of_v = ParameterExpression(
    symbol_map={v: v._symbol_expr},
    expr=sym.sign(v._symbol_expr),
)

It would be great if Qiskit can support this without above ugly hack.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions