qml.labs.trotter_error.VibronicHO

class VibronicHO(states, modes, gridpoints, ho_states)[source]

Bases: object

Represent the tensor product of harmonic oscillator states.

Parameters:
  • states (int) – the number of electronic states

  • modes (int) – the number of vibrational modes

  • gridpoints (int) – the number of gridpoints used to discretize the state

  • ho_states (Sequence[HOState]) – a sequence of HOState objects representing the harmonic oscillator states

Example

>>> from pennylane.labs.trotter_error import HOState, VibronicHO
>>> n_modes = 3
>>> n_states = 2
>>> gridpoints = 5
>>> state_dict = {(1, 2, 3): 1, (0, 3, 2): 1}
>>> state = HOState(n_modes, gridpoints, state_dict)
>>> VibronicHO(n_states, n_modes, gridpoints, [state, state])
VibronicHO([HOState(modes=3, gridpoints=5, <Compressed Sparse Row sparse array of dtype 'int64'
    with 2 stored elements and shape (125, 1)>
  Coords    Values
  (17, 0)   1
  (38, 0)   1), HOState(modes=3, gridpoints=5, <Compressed Sparse Row sparse array of dtype 'int64'
    with 2 stored elements and shape (125, 1)>
  Coords    Values
  (17, 0)   1
  (38, 0)   1)])

dot(other)

Return the dot product of two VibronicHO objects.

zero_state(states, modes, gridpoints)

Construct a VibronicHO representing the zero state.

dot(other)[source]

Return the dot product of two VibronicHO objects.

Parameters:

other (VibronicHO) – the state to take the dot product with

Returns:

the dot product of the two states

Return type:

float

Example

>>> from pennylane.labs.trotter_error import HOState, VibronicHO
>>> n_modes = 3
>>> n_states = 2
>>> gridpoints = 5
>>> state_dict = {(1, 2, 3): 1, (0, 3, 2): 1}
>>> state = HOState(n_modes, gridpoints, state_dict)
>>> vo_state = VibronicHO(n_states, n_modes, gridpoints, [state, state])
>>> vo_state.dot(vo_state)
4
classmethod zero_state(states, modes, gridpoints)[source]

Construct a VibronicHO representing the zero state.

Parameters:
  • states (int) – the number of electronic states

  • modes (int) – the number of vibrational modes

  • gridpoints (int) – the number of gridpoints used to discretize the state

Returns:

a VibronicHO representing the zero state

Return type:

VibronicHO

Example

>>> from pennylane.labs.trotter_error import VibronicHO
>>> VibronicHO.zero_state(2, 3, 5)
VibronicHO([HOState(modes=3, gridpoints=5, <Compressed Sparse Row sparse array of dtype 'float64'
    with 0 stored elements and shape (125, 1)>), HOState(modes=3, gridpoints=5, <Compressed Sparse Row sparse array of dtype 'float64'
    with 0 stored elements and shape (125, 1)>)])