outer

outer(vector1, vector2=None)[source]

Construct the outer product of two vectors.

The second vector argument is optional, if absent the projector of the first vector will be returned.

Parameters
  • vector1 (ndarray) – the first vector.

  • vector2 (ndarray) – the (optional) second vector.

Returns

The matrix \(|v1\rangle\langle{v2}|\).

Return type

np.array