Skip to content

Commit

Permalink
solovay_kitaev_decompose finished
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferayer committed Mar 9, 2024
1 parent 28b0add commit 1cb38b4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/tensor/tensor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ bool Tensor<DT>::create_gate_list(int length) {
for (int j = 0; j < b; j++)
{
bool bit = bits[j];
u = (bit)? u * base[1] : u * base[0];
u = (bit)? tensor_multiply(u ,base[1]) : tensor_multiply(u ,base[0]);
}
gate_list.push_back(u);
}
Expand Down Expand Up @@ -894,9 +894,11 @@ double Tensor<DT>::trace_distance(Tensor<DT>& t1, Tensor<DT>& t2) {
// TODO
Tensor<DT> t1_t2 = t1 - t2;
t1_t2.adjoint();
t1_t2.sqrt();
Tensor<DT> t1_t2_sqrt = tensor_multiply(t1_t2, (t1 - t2));
t1_t2_sqrt.sqrt();

std::complex<double> t(0.5,0);
return (0.5 * t1_t2.trace()).real();
return (0.5 * t1_t2_sqrt.trace()).real();
}

// tensor-dot two tensors
Expand Down

0 comments on commit 1cb38b4

Please sign in to comment.