| 
1604 | 1604 | (*Check Methods based on Householder decomposition*)  | 
1605 | 1605 | 
 
  | 
1606 | 1606 | 
 
  | 
1607 |  | -checkDenseHouseholder[v_]:=Module[{st,iso},(   | 
 | 1607 | +checkDenseHouseholder[v_]:=Module[{st,iso,n,nIso},(   | 
1608 | 1608 | st=DenseHouseholderDec[v];  | 
 | 1609 | +n = Log2[Dimensions[v][[1]]];  | 
1609 | 1610 | iso=NCreateOperationFromGateList[st];  | 
 | 1611 | +nIso = Log2[Dimensions[iso][[1]]];  | 
 | 1612 | +If[nIso < n,  | 
 | 1613 | +iso=NCreateOperationFromGateList[st,n];  | 
 | 1614 | +(*Ensure that the dimension is correct, even if the gates are  | 
 | 1615 | +only acting on a part of the available qubits*)  | 
 | 1616 | +];  | 
1610 | 1617 | isIdentityUpToPhase[N[ConjugateTranspose[v] . iso]]  | 
1611 | 1618 | )  | 
1612 | 1619 | ]  | 
1613 |  | -checkSparseHouseholder[v_]:=Module[{st,iso},(   | 
 | 1620 | +checkSparseHouseholder[v_]:=Module[{st,iso,n,nIso},(   | 
1614 | 1621 | st=SparseHouseholderDec[v];  | 
 | 1622 | +n = Log2[Dimensions[v][[1]]];  | 
1615 | 1623 | iso=NCreateOperationFromGateList[st];  | 
 | 1624 | +nIso = Log2[Dimensions[iso][[1]]];  | 
 | 1625 | +If[nIso < n,  | 
 | 1626 | +iso=NCreateOperationFromGateList[st,n];  | 
 | 1627 | +(*Ensure that the dimension is correct, even if the gates are  | 
 | 1628 | +only acting on a part of the available qubits*)  | 
 | 1629 | +];  | 
1616 | 1630 | isIdentityUpToPhase[N[ConjugateTranspose[v] . iso]]  | 
1617 | 1631 | )  | 
1618 | 1632 | ]  | 
 | 
0 commit comments