Skip to content
DeepForgeby svx
All problems
MediumInformation Theoryinfo-184

Tensor Product of States

Problem

Return the 2x2 tensor product (outer product) of two state vectors u and v: entry (i, j) is u[i] * v[j]. The Kronecker product of state vectors describes composite quantum systems.

Hint

The flattened 4-vector lists the amplitudes of |00>, |01>, |10>, |11>.

Test cases

case 1
in: [[1,0],[0,1]]
expected: [[0,1],[0,0]]
case 2
in: [[1,0],[1,0]]
expected: [[1,0],[0,0]]
case 3
in: [[0.5,0.5],[0.5,-0.5]]
expected: [[0.25,-0.25],[0.25,-0.25]]
case 4
in: [[0.6,0.8],[1,0]]
expected: [[0.6,0],[0.8,0]]
Starter codePython
def tensor_product(u, v):
    # Your code here
    pass

4 test cases · run your code against them in the editor