Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ORNL Quantum Computing Institute
xacc
Commits
1d2d12fd
Unverified
Commit
1d2d12fd
authored
Sep 07, 2021
by
Mccaskey, Alex
Committed by
GitHub
Sep 07, 2021
Browse files
Merge pull request #484 from ausbin/feature/qpp-post-meas
qpp Accelerator: Check for post-measure gates more accurately
parents
17c30f48
e741af2d
Pipeline
#162949
passed with stage
in 12 minutes and 32 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
quantum/plugins/qpp/accelerator/QppAccelerator.cpp
View file @
1d2d12fd
...
...
@@ -148,9 +148,9 @@ namespace {
bool
shotCountFromFinalStateVec
(
const
std
::
shared_ptr
<
CompositeInstruction
>&
in_composite
)
{
InstructionIterator
it
(
in_composite
);
bool
measureAtTheEnd
=
true
;
bool
measureEncountered
=
false
;
std
::
set
<
std
::
size_t
>
bitsMeasured
;
bool
hasReset
=
false
;
bool
postMeasureGates
=
false
;
while
(
it
.
hasNext
())
{
auto
nextInst
=
it
.
next
();
...
...
@@ -158,25 +158,32 @@ namespace {
{
if
(
nextInst
->
name
()
==
"Reset"
)
{
hasReset
=
true
;
break
;
}
auto
bits
=
nextInst
->
bits
();
if
(
isMeasureGate
(
nextInst
))
{
// Flag that we have seen a Measure gate.
measureEncountered
=
true
;
bitsMeasured
.
insert
(
bits
.
begin
(),
bits
.
end
());
}
// We have seen a Measure gate but this one is not another Measure gate.
if
(
measureEncountered
&&
!
isMeasureGate
(
nextInst
))
else
{
measureAtTheEnd
=
false
;
postMeasureGates
=
std
::
any_of
(
bits
.
begin
(),
bits
.
end
(),
[
&
](
std
::
size_t
bit
)
{
return
bitsMeasured
.
count
(
bit
);
});
if
(
postMeasureGates
)
{
break
;
}
}
}
}
// If Measure gates are at the very end and no reset,
// this Composite can be simulated by random sampling from the state vec.
return
!
hasReset
&&
measureAtTheEnd
;
return
!
hasReset
&&
!
postMeasureGates
;
}
Eigen
::
MatrixXcd
convertToEigenMat
(
const
NoiseModelUtils
::
cMat
&
in_stdMat
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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