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
7f615c18
Commit
7f615c18
authored
May 19, 2020
by
Mccaskey, Alex
Browse files
minor cleanup, update to qalloc for qcor
Signed-off-by:
Alex McCaskey
<
mccaskeyaj@ornl.gov
>
parent
6ac3bd82
Changes
5
Hide whitespace changes
Inline
Side-by-side
quantum/gate/ir/Gate.hpp
View file @
7f615c18
...
...
@@ -81,7 +81,7 @@ public:
bitIdxExpressions
.
insert
({
bit_idx
,
expr
});
}
std
::
string
getBitExpression
(
const
std
::
size_t
bit_idx
)
override
{
return
bitIdxExpressions
[
bit_idx
];
return
bitIdxExpressions
.
count
(
bit_idx
)
?
bitIdxExpressions
[
bit_idx
]
:
""
;
}
const
InstructionParameter
getParameter
(
const
std
::
size_t
idx
)
const
override
;
...
...
xacc/compiler/Compiler.hpp
View file @
7f615c18
...
...
@@ -28,6 +28,10 @@ public:
std
::
shared_ptr
<
Accelerator
>
acc
)
=
0
;
virtual
std
::
shared_ptr
<
IR
>
compile
(
const
std
::
string
&
src
)
=
0
;
virtual
const
std
::
string
get_statement_terminator
()
{
return
";"
;
}
// By default, we assume this compiler can not parse a given
// source string. Subtypes implement this to indicate if
// they can or not
...
...
xacc/compiler/qalloc.cpp
View file @
7f615c18
...
...
@@ -10,7 +10,9 @@ template <typename T> struct empty_delete {
qreg
::
qreg
(
const
int
n
)
{
buffer
=
xacc
::
qalloc
(
n
).
get
();
}
qreg
::
qreg
(
const
qreg
&
other
)
:
buffer
(
other
.
buffer
)
{}
int
qreg
::
operator
[](
const
int
&
i
)
{
return
i
;
}
qubit
qreg
::
operator
[](
const
std
::
size_t
&
i
)
{
return
std
::
make_pair
(
buffer
->
name
(),
i
);
}
AcceleratorBuffer
*
qreg
::
results
()
{
return
buffer
;
}
std
::
map
<
std
::
string
,
int
>
qreg
::
counts
()
{
return
buffer
->
getMeasurementCounts
();
...
...
xacc/compiler/qalloc.hpp
View file @
7f615c18
...
...
@@ -19,6 +19,7 @@ namespace xacc {
class
AcceleratorBuffer
;
class
Observable
;
namespace
internal_compiler
{
using
qubit
=
std
::
pair
<
std
::
string
,
std
::
size_t
>
;
class
qreg
{
protected:
...
...
@@ -28,7 +29,7 @@ public:
qreg
()
=
default
;
qreg
(
const
int
n
);
qreg
(
const
qreg
&
other
);
i
n
t
operator
[](
const
in
t
&
i
);
qub
it
operator
[](
const
std
::
size_
t
&
i
);
AcceleratorBuffer
*
results
();
std
::
map
<
std
::
string
,
int
>
counts
();
double
exp_val_z
();
...
...
xacc/xacc.hpp
View file @
7f615c18
...
...
@@ -247,7 +247,7 @@ const std::string
translate
(
std
::
shared_ptr
<
CompositeInstruction
>
CompositeInstruction
,
const
std
::
string
toLanguage
);
void
appendCompiled
(
std
::
shared_ptr
<
CompositeInstruction
>
composite
,
bool
_override
=
fals
e
);
void
appendCompiled
(
std
::
shared_ptr
<
CompositeInstruction
>
composite
,
bool
_override
=
tru
e
);
std
::
shared_ptr
<
CompositeInstruction
>
getCompiled
(
const
std
::
string
name
);
bool
hasCompiled
(
const
std
::
string
name
);
...
...
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