You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that the data type of initial_state in pulser.EmulatorConfig is too strict. Indeed, I am defining the state as a numpy array, and it is not recognized as a valid Sequence[Complex].
Here is my code:
ifinitial_state=="plus":
initial_state=np.ones(2**L, dtype=np.complex128)
elifinitial_state=="down":
initial_state="all-ground"else:
raiseValueError(f"Initial state '{initial_state}' is not valid.")
config=pulser.EmulatorConfig(
sampling_rate=sampling_rate,
evaluation_times="Full",
initial_state=initial_state,
)
PyLance in VSCode complains:
Argument of type "NDArray[float64] | Literal['all-ground']" cannot be assigned to parameter "initial_state" of type "Sequence[complex] | Literal['all-ground']" in function "__init__"
Type "NDArray[float64] | Literal['all-ground']" is not assignable to type "Sequence[complex] | Literal['all-ground']"
Type "NDArray[float64]" is not assignable to type "Sequence[complex] | Literal['all-ground']"
"ndarray[Any, dtype[float64]]" is not assignable to "Sequence[complex]"
"ndarray[Any, dtype[float64]]" is not assignable to "Literal['all-ground']"Pylance[reportArgumentType](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportArgumentType)
(parameter) initial_state: NDArray[float64] | Literal['all-ground']
Specifying that dtype=complex gives NDArray[Any] and dtype=np.complex128 gives NDArray[complexfloating[_64Bit, _64Bit]], none of them recognized as Sequence[complex].
The text was updated successfully, but these errors were encountered:
It seems that the data type of
initial_state
inpulser.EmulatorConfig
is too strict. Indeed, I am defining the state as a numpy array, and it is not recognized as a validSequence[Complex]
.Here is my code:
PyLance in VSCode complains:
Specifying that
dtype=complex
givesNDArray[Any]
anddtype=np.complex128
givesNDArray[complexfloating[_64Bit, _64Bit]]
, none of them recognized asSequence[complex]
.The text was updated successfully, but these errors were encountered: