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
b341629d
Commit
b341629d
authored
Jul 15, 2019
by
Mccaskey, Alex
Browse files
Merge branch 'master' into mccaskey/algorithm_optimizer
parents
fd22e045
eb9e71e9
Changes
2
Hide whitespace changes
Inline
Side-by-side
quantum/gate/ir/GateFunction.cpp
View file @
b341629d
...
...
@@ -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 @
b341629d
...
...
@@ -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