def __init__(self, state_vector): """Constructor. Args: state_vector: vector representation of the desired quantum state """ if not is_power_of_2(len(state_vector)): raise AquaError('The length of the input state vector needs to be a power of 2.') self._num_qubits = log2(len(state_vector)) self._state_vector = normalize_vector(state_vector)
def __init__(self, state_vector): """Constructor. Args: state_vector (numpy.ndarray): vector representation of the desired quantum state Raises: AquaError: invalid input """ warnings.warn('The StateVectorCircuit class is deprecated as of Qiskit Aqua 0.9.0 and will ' 'be removed no earlier than 3 months after the release. If you need to ' 'initialize a circuit, use the QuantumCircuit.initialize or ' 'QuantumCircuit.isometry methods. For a parameterized initialization, try ' 'the qiskit.ml.circuit.library.RawFeatureVector class.', DeprecationWarning, stacklevel=2) if not is_power_of_2(len(state_vector)): raise AquaError('The length of the input state vector needs to be a power of 2.') self._num_qubits = log2(len(state_vector)) self._state_vector = normalize_vector(state_vector)