Skip to main content

haar_vector

Overloads

NameDescription
haar_vector(integer size) -> ComplexMatrixGenerates a Haar random vector of a specified size.
haar_vector(integer size, integer seed) -> ComplexMatrixGenerates a Haar random vector of a specified size with a specified seed.

haar_vector(integer size) -> ComplexMatrix

Generates a Haar random vector of a specified size.

This function samples a vector of the specified size according to the Haar measure. This is analogous to sampling a vector randomly on the generalized Bloch sphere for a qudit with a number of dimension equal to the specified size. The produced vector is normalized.

Parameters

  • size: Specifies the number of elements in the output vector.

haar_vector(integer size, integer seed) -> ComplexMatrix

Generates a Haar random vector of a specified size with a specified seed.

This function samples a vector of the specified size according to the Haar measure. This is analogous to sampling a vector randomly on the generalized Bloch sphere for a qudit with a number of dimension equal to the specified size. The produced vector is normalized.

Parameters

  • size: Specifies the number of elements in the output vector.
  • seed: Seed of the random number generator.