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
eb9e71e9
Commit
eb9e71e9
authored
Jul 15, 2019
by
Mccaskey, Alex
Browse files
fixing bug in gatefunction evaluate
Signed-off-by:
Alex McCaskey
<
mccaskeyaj@ornl.gov
>
parent
7f3f4fb8
Pipeline
#63300
passed with stages
in 10 minutes and 35 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
quantum/gate/ir/GateFunction.cpp
View file @
eb9e71e9
...
...
@@ -257,7 +257,8 @@ auto splitParameter = [](InstructionParameter instParam) {
auto
instParamStr
=
instParam
.
as
<
std
::
string
>
();
split
=
xacc
::
split
(
instParamStr
,
' '
);
for
(
auto
s
:
split
)
{
if
(
!
isNumber
(
s
)
&&
!
s
.
empty
())
{
xacc
::
trim
(
s
);
if
(
!
isNumber
(
s
)
&&
!
s
.
empty
()
&&
s
.
find
(
"pi"
)
==
std
::
string
::
npos
)
{
rawParam
=
s
;
}
}
...
...
quantum/gate/ir/tests/GateFunctionTester.cpp
View file @
eb9e71e9
...
...
@@ -22,7 +22,19 @@ const std::string expectedQasm = "H qreg1\n"
"CNOT qreg1,qreg2
\n
"
"CNOT qreg0,qreg1
\n
"
"H qreg0
\n
"
;
TEST
(
GateFunctionTester
,
checkComplexAngleExpression
)
{
GateFunction
f
(
"foo"
);
auto
rx
=
std
::
make_shared
<
Rx
>
(
std
::
vector
<
int
>
{
0
});
xacc
::
InstructionParameter
p
(
"-theta - pi/2"
);
rx
->
setParameter
(
0
,
p
);
f
.
addInstruction
(
rx
);
std
::
cout
<<
f
.
toString
()
<<
"
\n
"
;
auto
evaled
=
f
({
1.57
});
std
::
cout
<<
evaled
->
toString
()
<<
"
\n
"
;
}
TEST
(
GateFunctionTester
,
checkFunctionMethods
)
{
GateFunction
f
(
"foo"
);
...
...
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