Commit 36e7c358 authored by Davis King's avatar Davis King

Fixed a bug in the apply_gate_to() function. Also clarified the spec.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402708
parent 3aef484e
...@@ -314,9 +314,9 @@ namespace dlib ...@@ -314,9 +314,9 @@ namespace dlib
{ {
if (temp.state_vector()(r) != qc_scalar_type(0)) if (temp.state_vector()(r) != qc_scalar_type(0))
{ {
for (long c = 0; c < dims; ++c) for (long i = 0; i < dims; ++i)
{ {
reg.state_vector()(c) += temp.state_vector()(r)*exp(r,c); reg.state_vector()(i) += temp.state_vector()(r)*exp(i,r);
} }
} }
} }
...@@ -458,7 +458,7 @@ namespace dlib ...@@ -458,7 +458,7 @@ namespace dlib
); );
return rowm(data,row_idx)*reg; return (data*reg)(row_idx);
} }
private: private:
......
...@@ -283,7 +283,8 @@ namespace dlib ...@@ -283,7 +283,8 @@ namespace dlib
Then applying a composite gate to reg_all would give you the same thing as Then applying a composite gate to reg_all would give you the same thing as
applying the lhs gate to reg_high and the rhs gate to reg_low and then appending applying the lhs gate to reg_high and the rhs gate to reg_low and then appending
the two resulting registers. the two resulting registers. So the lhs gate of a composite_gate applies to
the high order bits of a regitser and the rhs gate applies to the lower order bits.
!*/ !*/
public: public:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment