Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ORNL Quantum Computing Institute
xacc
Commits
abe518dc
Unverified
Commit
abe518dc
authored
Nov 19, 2021
by
Thien Nguyen
Committed by
GitHub
Nov 19, 2021
Browse files
Merge pull request #494 from 1tnguyen/tnguyen/fix-single-qubit-decomp
Fixed a bug in single-qubit matrix decomposition
parents
3679fe75
59880522
Changes
1
Hide whitespace changes
Inline
Side-by-side
quantum/plugins/circuits/kak/kak.cpp
View file @
abe518dc
...
@@ -325,6 +325,7 @@ singleQubitGateGen(const Eigen::Matrix2cd &in_mat, size_t in_bitIdx) {
...
@@ -325,6 +325,7 @@ singleQubitGateGen(const Eigen::Matrix2cd &in_mat, size_t in_bitIdx) {
}
}
}
}
assert
(
found
);
assert
(
found
);
return
std
::
make_tuple
(
a
,
bHalf
,
cHalf
,
dHalf
);
}
else
if
(
std
::
abs
(
matrix
(
0
,
0
))
<
TOLERANCE
)
{
}
else
if
(
std
::
abs
(
matrix
(
0
,
0
))
<
TOLERANCE
)
{
auto
two_a
=
fmod
(
std
::
arg
(
-
matrix
(
0
,
1
)
*
matrix
(
1
,
0
)),
2
*
M_PI
);
auto
two_a
=
fmod
(
std
::
arg
(
-
matrix
(
0
,
1
)
*
matrix
(
1
,
0
)),
2
*
M_PI
);
a
=
(
std
::
abs
(
two_a
)
<
TOLERANCE
||
a
=
(
std
::
abs
(
two_a
)
<
TOLERANCE
||
...
@@ -351,6 +352,7 @@ singleQubitGateGen(const Eigen::Matrix2cd &in_mat, size_t in_bitIdx) {
...
@@ -351,6 +352,7 @@ singleQubitGateGen(const Eigen::Matrix2cd &in_mat, size_t in_bitIdx) {
}
}
}
}
assert
(
found
);
assert
(
found
);
return
std
::
make_tuple
(
a
,
bHalf
,
cHalf
,
dHalf
);
}
else
{
}
else
{
auto
two_a
=
fmod
(
std
::
arg
(
matrix
(
0
,
0
)
*
matrix
(
1
,
1
)),
2
*
M_PI
);
auto
two_a
=
fmod
(
std
::
arg
(
matrix
(
0
,
0
)
*
matrix
(
1
,
1
)),
2
*
M_PI
);
a
=
(
std
::
abs
(
two_a
)
<
TOLERANCE
||
a
=
(
std
::
abs
(
two_a
)
<
TOLERANCE
||
...
@@ -392,11 +394,8 @@ singleQubitGateGen(const Eigen::Matrix2cd &in_mat, size_t in_bitIdx) {
...
@@ -392,11 +394,8 @@ singleQubitGateGen(const Eigen::Matrix2cd &in_mat, size_t in_bitIdx) {
}
}
}
}
assert
(
found
);
assert
(
found
);
return
std
::
make_tuple
(
a
,
bHalf
,
cHalf
,
dHalf
);
}
}
// Final check:
assert
(
checkParams
(
a
,
bHalf
,
cHalf
,
dHalf
));
return
std
::
make_tuple
(
a
,
bHalf
,
cHalf
,
dHalf
);
};
};
// Use Z-Y decomposition of Nielsen and Chuang (Theorem 4.1).
// Use Z-Y decomposition of Nielsen and Chuang (Theorem 4.1).
// An arbitrary one qubit gate matrix can be writen as
// An arbitrary one qubit gate matrix can be writen as
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment