hqs_quantum_solver.util

Contents

hqs_quantum_solver.util#

Miscellaneous utility functions.

Functions

unit_vector(dim, i)

Creates a cannonical unit vector.

unit_vector(dim: int, i: int) ndarray#

Creates a cannonical unit vector.

The i-th cannonical unit vector \(\mathbf{e}_i\) is defined by

\[\begin{split}\big(\mathbf{e}_i\big)_j = \begin{cases} 1 & \text{if $i = j$,} \\ 0 & \text{otherwise.} \end{cases}\end{split}\]
Parameters:
  • dim (int) – The length of the vector.

  • i (int) – The position of the non-zero element.