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
9f216f61
Commit
9f216f61
authored
Jun 16, 2020
by
Daniel Claudino
Browse files
Added scientific to real parser
Signed-off-by:
Daniel Claudino
<
6d3@ornl.gov
>
parent
c478dbf6
Changes
10
Hide whitespace changes
Inline
Side-by-side
quantum/observable/fermion/FermionOperator.g4
View file @
9f216f61
...
@@ -12,11 +12,11 @@ op : INT carat?;
...
@@ -12,11 +12,11 @@ op : INT carat?;
carat : '^';
carat : '^';
coeff : complex | real;
coeff : complex | real
;
complex : '('(real | INT | scientific)','(real | INT | scientific)')';
complex : '('(real | INT | scientific)','(real | INT | scientific)')';
real : REAL;
real : REAL
| scientific
;
comment : COMMENT;
comment : COMMENT;
...
...
quantum/observable/fermion/generated/FermionOperator.interp
View file @
9f216f61
...
@@ -45,4 +45,4 @@ scientific
...
@@ -45,4 +45,4 @@ scientific
atn:
atn:
[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 15, 83, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 3, 2, 3, 2, 3, 2, 3, 2, 7, 2, 29, 10, 2, 12, 2, 14, 2, 32, 11, 2, 3, 3, 3, 3, 3, 4, 5, 4, 37, 10, 4, 3, 4, 7, 4, 40, 10, 4, 12, 4, 14, 4, 43, 11, 4, 3, 5, 3, 5, 3, 6, 3, 6, 5, 6, 49, 10, 6, 3, 7, 3, 7, 3, 8, 3, 8, 5, 8, 55, 10, 8, 3, 9, 3, 9, 3, 9, 3, 9, 5, 9, 61, 10, 9, 3, 9, 3, 9, 3, 9, 3, 9, 5, 9, 67, 10, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 11, 3, 11, 3, 12, 5, 12, 76, 10, 12, 3, 12, 5, 12, 79, 10, 12, 3, 12, 3, 12, 3, 12, 2, 2, 13, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 2, 4, 3, 2, 3, 4, 3, 2, 9, 10, 2, 82, 2, 24, 3, 2, 2, 2, 4, 33, 3, 2, 2, 2, 6, 36, 3, 2, 2, 2, 8, 44, 3, 2, 2, 2, 10, 46, 3, 2, 2, 2, 12, 50, 3, 2, 2, 2, 14, 54, 3, 2, 2, 2, 16, 56, 3, 2, 2, 2, 18, 70, 3, 2, 2, 2, 20, 72, 3, 2, 2, 2, 22, 75, 3, 2, 2, 2, 24, 30, 5, 6, 4, 2, 25, 26, 5, 4, 3, 2, 26, 27, 5, 6, 4, 2, 27, 29, 3, 2, 2, 2, 28, 25, 3, 2, 2, 2, 29, 32, 3, 2, 2, 2, 30, 28, 3, 2, 2, 2, 30, 31, 3, 2, 2, 2, 31, 3, 3, 2, 2, 2, 32, 30, 3, 2, 2, 2, 33, 34, 9, 2, 2, 2, 34, 5, 3, 2, 2, 2, 35, 37, 5, 14, 8, 2, 36, 35, 3, 2, 2, 2, 36, 37, 3, 2, 2, 2, 37, 41, 3, 2, 2, 2, 38, 40, 5, 8, 5, 2, 39, 38, 3, 2, 2, 2, 40, 43, 3, 2, 2, 2, 41, 39, 3, 2, 2, 2, 41, 42, 3, 2, 2, 2, 42, 7, 3, 2, 2, 2, 43, 41, 3, 2, 2, 2, 44, 45, 5, 10, 6, 2, 45, 9, 3, 2, 2, 2, 46, 48, 7, 13, 2, 2, 47, 49, 5, 12, 7, 2, 48, 47, 3, 2, 2, 2, 48, 49, 3, 2, 2, 2, 49, 11, 3, 2, 2, 2, 50, 51, 7, 5, 2, 2, 51, 13, 3, 2, 2, 2, 52, 55, 5, 16, 9, 2, 53, 55, 5, 18, 10, 2, 54, 52, 3, 2, 2, 2, 54, 53, 3, 2, 2, 2, 55, 15, 3, 2, 2, 2, 56, 60, 7, 6, 2, 2, 57, 61, 5, 18, 10, 2, 58, 61, 7, 13, 2, 2, 59, 61, 5, 22, 12, 2, 60, 57, 3, 2, 2, 2, 60, 58, 3, 2, 2, 2, 60, 59, 3, 2, 2, 2, 61, 62, 3, 2, 2, 2, 62, 66, 7, 7, 2, 2, 63, 67, 5, 18, 10, 2, 64, 67, 7, 13, 2, 2, 65, 67, 5, 22, 12, 2, 66, 63, 3, 2, 2, 2, 66, 64, 3, 2, 2, 2, 66, 65, 3, 2, 2, 2, 67, 68, 3, 2, 2, 2, 68, 69, 7, 8, 2, 2, 69, 17, 3, 2, 2, 2, 70, 71, 7, 12, 2, 2, 71, 19, 3, 2, 2, 2, 72, 73, 7, 11, 2, 2, 73, 21, 3, 2, 2, 2, 74, 76, 7, 12, 2, 2, 75, 74, 3, 2, 2, 2, 75, 76, 3, 2, 2, 2, 76, 78, 3, 2, 2, 2, 77, 79, 9, 3, 2, 2, 78, 77, 3, 2, 2, 2, 78, 79, 3, 2, 2, 2, 79, 80, 3, 2, 2, 2, 80, 81, 7, 13, 2, 2, 81, 23, 3, 2, 2, 2, 11, 30, 36, 41, 48, 54, 60, 66, 75, 78]
[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 15, 85, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 3, 2, 3, 2, 3, 2, 3, 2, 7, 2, 29, 10, 2, 12, 2, 14, 2, 32, 11, 2, 3, 3, 3, 3, 3, 4, 5, 4, 37, 10, 4, 3, 4, 7, 4, 40, 10, 4, 12, 4, 14, 4, 43, 11, 4, 3, 5, 3, 5, 3, 6, 3, 6, 5, 6, 49, 10, 6, 3, 7, 3, 7, 3, 8, 3, 8, 5, 8, 55, 10, 8, 3, 9, 3, 9, 3, 9, 3, 9, 5, 9, 61, 10, 9, 3, 9, 3, 9, 3, 9, 3, 9, 5, 9, 67, 10, 9, 3, 9, 3, 9, 3, 10, 3, 10, 5, 10, 73, 10, 10, 3, 11, 3, 11, 3, 12, 5, 12, 78, 10, 12, 3, 12, 5, 12, 81, 10, 12, 3, 12, 3, 12, 3, 12, 2, 2, 13, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 2, 4, 3, 2, 3, 4, 3, 2, 9, 10, 2, 85, 2, 24, 3, 2, 2, 2, 4, 33, 3, 2, 2, 2, 6, 36, 3, 2, 2, 2, 8, 44, 3, 2, 2, 2, 10, 46, 3, 2, 2, 2, 12, 50, 3, 2, 2, 2, 14, 54, 3, 2, 2, 2, 16, 56, 3, 2, 2, 2, 18, 72, 3, 2, 2, 2, 20, 74, 3, 2, 2, 2, 22, 77, 3, 2, 2, 2, 24, 30, 5, 6, 4, 2, 25, 26, 5, 4, 3, 2, 26, 27, 5, 6, 4, 2, 27, 29, 3, 2, 2, 2, 28, 25, 3, 2, 2, 2, 29, 32, 3, 2, 2, 2, 30, 28, 3, 2, 2, 2, 30, 31, 3, 2, 2, 2, 31, 3, 3, 2, 2, 2, 32, 30, 3, 2, 2, 2, 33, 34, 9, 2, 2, 2, 34, 5, 3, 2, 2, 2, 35, 37, 5, 14, 8, 2, 36, 35, 3, 2, 2, 2, 36, 37, 3, 2, 2, 2, 37, 41, 3, 2, 2, 2, 38, 40, 5, 8, 5, 2, 39, 38, 3, 2, 2, 2, 40, 43, 3, 2, 2, 2, 41, 39, 3, 2, 2, 2, 41, 42, 3, 2, 2, 2, 42, 7, 3, 2, 2, 2, 43, 41, 3, 2, 2, 2, 44, 45, 5, 10, 6, 2, 45, 9, 3, 2, 2, 2, 46, 48, 7, 13, 2, 2, 47, 49, 5, 12, 7, 2, 48, 47, 3, 2, 2, 2, 48, 49, 3, 2, 2, 2, 49, 11, 3, 2, 2, 2, 50, 51, 7, 5, 2, 2, 51, 13, 3, 2, 2, 2, 52, 55, 5, 16, 9, 2, 53, 55, 5, 18, 10, 2, 54, 52, 3, 2, 2, 2, 54, 53, 3, 2, 2, 2, 55, 15, 3, 2, 2, 2, 56, 60, 7, 6, 2, 2, 57, 61, 5, 18, 10, 2, 58, 61, 7, 13, 2, 2, 59, 61, 5, 22, 12, 2, 60, 57, 3, 2, 2, 2, 60, 58, 3, 2, 2, 2, 60, 59, 3, 2, 2, 2, 61, 62, 3, 2, 2, 2, 62, 66, 7, 7, 2, 2, 63, 67, 5, 18, 10, 2, 64, 67, 7, 13, 2, 2, 65, 67, 5, 22, 12, 2, 66, 63, 3, 2, 2, 2, 66, 64, 3, 2, 2, 2, 66, 65, 3, 2, 2, 2, 67, 68, 3, 2, 2, 2, 68, 69, 7, 8, 2, 2, 69, 17, 3, 2, 2, 2, 70, 73, 7, 12, 2, 2, 71, 73, 5, 22, 12, 2, 72, 70, 3, 2, 2, 2, 72, 71, 3, 2, 2, 2, 73, 19, 3, 2, 2, 2, 74, 75, 7, 11, 2, 2, 75, 21, 3, 2, 2, 2, 76, 78, 7, 12, 2, 2, 77, 76, 3, 2, 2, 2, 77, 78, 3, 2, 2, 2, 78, 80, 3, 2, 2, 2, 79, 81, 9, 3, 2, 2, 80, 79, 3, 2, 2, 2, 80, 81, 3, 2, 2, 2, 81, 82, 3, 2, 2, 2, 82, 83, 7, 13, 2, 2, 83, 23, 3, 2, 2, 2, 12, 30, 36, 41, 48, 54, 60, 66, 72, 77, 80]
\ No newline at end of file
\ No newline at end of file
quantum/observable/fermion/generated/FermionOperatorParser.cpp
View file @
9f216f61
...
@@ -211,12 +211,13 @@ FermionOperatorParser::TermContext* FermionOperatorParser::term() {
...
@@ -211,12 +211,13 @@ FermionOperatorParser::TermContext* FermionOperatorParser::term() {
setState
(
34
);
setState
(
34
);
_errHandler
->
sync
(
this
);
_errHandler
->
sync
(
this
);
_la
=
_input
->
LA
(
1
);
switch
(
getInterpreter
<
atn
::
ParserATNSimulator
>
()
->
adaptivePredict
(
_input
,
1
,
_ctx
))
{
if
(
_la
==
FermionOperatorParser
::
T__3
case
1
:
{
||
_la
==
FermionOperatorParser
::
REAL
)
{
setState
(
33
);
setState
(
33
);
coeff
();
coeff
();
break
;
}
}
}
setState
(
39
);
setState
(
39
);
_errHandler
->
sync
(
this
);
_errHandler
->
sync
(
this
);
...
@@ -444,7 +445,10 @@ FermionOperatorParser::CoeffContext* FermionOperatorParser::coeff() {
...
@@ -444,7 +445,10 @@ FermionOperatorParser::CoeffContext* FermionOperatorParser::coeff() {
break
;
break
;
}
}
case
FermionOperatorParser
::
REAL
:
{
case
FermionOperatorParser
::
T__6
:
case
FermionOperatorParser
::
T__7
:
case
FermionOperatorParser
::
REAL
:
case
FermionOperatorParser
::
INT
:
{
enterOuterAlt
(
_localctx
,
2
);
enterOuterAlt
(
_localctx
,
2
);
setState
(
51
);
setState
(
51
);
real
();
real
();
...
@@ -592,6 +596,10 @@ tree::TerminalNode* FermionOperatorParser::RealContext::REAL() {
...
@@ -592,6 +596,10 @@ tree::TerminalNode* FermionOperatorParser::RealContext::REAL() {
return
getToken
(
FermionOperatorParser
::
REAL
,
0
);
return
getToken
(
FermionOperatorParser
::
REAL
,
0
);
}
}
FermionOperatorParser
::
ScientificContext
*
FermionOperatorParser
::
RealContext
::
scientific
()
{
return
getRuleContext
<
FermionOperatorParser
::
ScientificContext
>
(
0
);
}
size_t
FermionOperatorParser
::
RealContext
::
getRuleIndex
()
const
{
size_t
FermionOperatorParser
::
RealContext
::
getRuleIndex
()
const
{
return
FermionOperatorParser
::
RuleReal
;
return
FermionOperatorParser
::
RuleReal
;
...
@@ -617,9 +625,24 @@ FermionOperatorParser::RealContext* FermionOperatorParser::real() {
...
@@ -617,9 +625,24 @@ FermionOperatorParser::RealContext* FermionOperatorParser::real() {
exitRule
();
exitRule
();
});
});
try
{
try
{
enterOuterAlt
(
_localctx
,
1
);
setState
(
70
);
setState
(
68
);
_errHandler
->
sync
(
this
);
match
(
FermionOperatorParser
::
REAL
);
switch
(
getInterpreter
<
atn
::
ParserATNSimulator
>
()
->
adaptivePredict
(
_input
,
7
,
_ctx
))
{
case
1
:
{
enterOuterAlt
(
_localctx
,
1
);
setState
(
68
);
match
(
FermionOperatorParser
::
REAL
);
break
;
}
case
2
:
{
enterOuterAlt
(
_localctx
,
2
);
setState
(
69
);
scientific
();
break
;
}
}
}
}
catch
(
RecognitionException
&
e
)
{
catch
(
RecognitionException
&
e
)
{
...
@@ -667,7 +690,7 @@ FermionOperatorParser::CommentContext* FermionOperatorParser::comment() {
...
@@ -667,7 +690,7 @@ FermionOperatorParser::CommentContext* FermionOperatorParser::comment() {
});
});
try
{
try
{
enterOuterAlt
(
_localctx
,
1
);
enterOuterAlt
(
_localctx
,
1
);
setState
(
7
0
);
setState
(
7
2
);
match
(
FermionOperatorParser
::
COMMENT
);
match
(
FermionOperatorParser
::
COMMENT
);
}
}
...
@@ -721,22 +744,22 @@ FermionOperatorParser::ScientificContext* FermionOperatorParser::scientific() {
...
@@ -721,22 +744,22 @@ FermionOperatorParser::ScientificContext* FermionOperatorParser::scientific() {
});
});
try
{
try
{
enterOuterAlt
(
_localctx
,
1
);
enterOuterAlt
(
_localctx
,
1
);
setState
(
7
3
);
setState
(
7
5
);
_errHandler
->
sync
(
this
);
_errHandler
->
sync
(
this
);
_la
=
_input
->
LA
(
1
);
_la
=
_input
->
LA
(
1
);
if
(
_la
==
FermionOperatorParser
::
REAL
)
{
if
(
_la
==
FermionOperatorParser
::
REAL
)
{
setState
(
7
2
);
setState
(
7
4
);
match
(
FermionOperatorParser
::
REAL
);
match
(
FermionOperatorParser
::
REAL
);
}
}
setState
(
7
6
);
setState
(
7
8
);
_errHandler
->
sync
(
this
);
_errHandler
->
sync
(
this
);
_la
=
_input
->
LA
(
1
);
_la
=
_input
->
LA
(
1
);
if
(
_la
==
FermionOperatorParser
::
T__6
if
(
_la
==
FermionOperatorParser
::
T__6
||
_la
==
FermionOperatorParser
::
T__7
)
{
||
_la
==
FermionOperatorParser
::
T__7
)
{
setState
(
7
5
);
setState
(
7
7
);
_la
=
_input
->
LA
(
1
);
_la
=
_input
->
LA
(
1
);
if
(
!
(
_la
==
FermionOperatorParser
::
T__6
if
(
!
(
_la
==
FermionOperatorParser
::
T__6
...
@@ -748,7 +771,7 @@ FermionOperatorParser::ScientificContext* FermionOperatorParser::scientific() {
...
@@ -748,7 +771,7 @@ FermionOperatorParser::ScientificContext* FermionOperatorParser::scientific() {
consume
();
consume
();
}
}
}
}
setState
(
7
8
);
setState
(
8
0
);
match
(
FermionOperatorParser
::
INT
);
match
(
FermionOperatorParser
::
INT
);
}
}
...
@@ -802,7 +825,7 @@ FermionOperatorParser::Initializer::Initializer() {
...
@@ -802,7 +825,7 @@ FermionOperatorParser::Initializer::Initializer() {
_serializedATN
=
{
_serializedATN
=
{
0x3
,
0x608b
,
0xa72a
,
0x8133
,
0xb9ed
,
0x417c
,
0x3be7
,
0x7786
,
0x5964
,
0x3
,
0x608b
,
0xa72a
,
0x8133
,
0xb9ed
,
0x417c
,
0x3be7
,
0x7786
,
0x5964
,
0x3
,
0xf
,
0x5
3
,
0x4
,
0x2
,
0x9
,
0x2
,
0x4
,
0x3
,
0x9
,
0x3
,
0x4
,
0x4
,
0x9
,
0x3
,
0xf
,
0x5
5
,
0x4
,
0x2
,
0x9
,
0x2
,
0x4
,
0x3
,
0x9
,
0x3
,
0x4
,
0x4
,
0x9
,
0x4
,
0x4
,
0x5
,
0x9
,
0x5
,
0x4
,
0x6
,
0x9
,
0x6
,
0x4
,
0x7
,
0x9
,
0x7
,
0x4
,
0x4
,
0x4
,
0x5
,
0x9
,
0x5
,
0x4
,
0x6
,
0x9
,
0x6
,
0x4
,
0x7
,
0x9
,
0x7
,
0x4
,
0x8
,
0x9
,
0x8
,
0x4
,
0x9
,
0x9
,
0x9
,
0x4
,
0xa
,
0x9
,
0xa
,
0x4
,
0xb
,
0x9
,
0x8
,
0x9
,
0x8
,
0x4
,
0x9
,
0x9
,
0x9
,
0x4
,
0xa
,
0x9
,
0xa
,
0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x2
,
0x4e
,
0x50
,
0x3
,
0x50
,
0x3
,
0x2
,
0x2
,
0x2
,
0x50
,
0x51
,
0x7
,
0xd
,
0x2
,
0x2
,
0x51
,
0x17
,
0x2
,
0x2
,
0x2
,
0x4f
,
0x51
,
0x9
,
0x3
,
0x2
,
0x2
,
0x50
,
0x4f
,
0x3
,
0x2
,
0x3
,
0x2
,
0x2
,
0x2
,
0xb
,
0x1e
,
0x24
,
0x29
,
0x30
,
0x36
,
0x3c
,
0x42
,
0x4b
,
0x2
,
0x2
,
0x50
,
0x51
,
0x3
,
0x2
,
0x2
,
0x2
,
0x51
,
0x52
,
0x3
,
0x2
,
0x2
,
0x4e
,
0x2
,
0x52
,
0x53
,
0x7
,
0xd
,
0x2
,
0x2
,
0x53
,
0x17
,
0x3
,
0x2
,
0x2
,
0x2
,
0xc
,
0x1e
,
0x24
,
0x29
,
0x30
,
0x36
,
0x3c
,
0x42
,
0x48
,
0x4d
,
0x50
,
};
};
atn
::
ATNDeserializer
deserializer
;
atn
::
ATNDeserializer
deserializer
;
...
...
quantum/observable/fermion/generated/FermionOperatorParser.h
View file @
9f216f61
...
@@ -164,6 +164,7 @@ public:
...
@@ -164,6 +164,7 @@ public:
RealContext
(
antlr4
::
ParserRuleContext
*
parent
,
size_t
invokingState
);
RealContext
(
antlr4
::
ParserRuleContext
*
parent
,
size_t
invokingState
);
virtual
size_t
getRuleIndex
()
const
override
;
virtual
size_t
getRuleIndex
()
const
override
;
antlr4
::
tree
::
TerminalNode
*
REAL
();
antlr4
::
tree
::
TerminalNode
*
REAL
();
ScientificContext
*
scientific
();
virtual
void
enterRule
(
antlr4
::
tree
::
ParseTreeListener
*
listener
)
override
;
virtual
void
enterRule
(
antlr4
::
tree
::
ParseTreeListener
*
listener
)
override
;
virtual
void
exitRule
(
antlr4
::
tree
::
ParseTreeListener
*
listener
)
override
;
virtual
void
exitRule
(
antlr4
::
tree
::
ParseTreeListener
*
listener
)
override
;
...
...
quantum/observable/fermion/tests/FermionOperatorTester.cpp
View file @
9f216f61
...
@@ -71,14 +71,18 @@ TEST(FermionOperatorTester, checkFromStr2) {
...
@@ -71,14 +71,18 @@ TEST(FermionOperatorTester, checkFromStr2) {
}
}
TEST
(
FermionOperatorTester
,
checkSciNot
)
{
TEST
(
FermionOperatorTester
,
checkSciNot
)
{
std
::
string
src
=
"(1.234e-4, 0) 0^ 1^ 0 1"
;
std
::
string
src
=
"1.234e-10 0^ 1^ 3 2"
;
FermionOperator
op
(
src
);
FermionOperator
op1
(
src
);
std
::
cout
<<
op
.
toString
()
<<
"
\n
"
;
std
::
cout
<<
op1
.
toString
()
<<
"
\n
"
;
src
=
"(1.234e-10,0) 0^ 1^ 3 2"
;
FermionOperator
op2
(
src
);
std
::
cout
<<
op2
.
toString
()
<<
"
\n
"
;
}
}
TEST
(
FermionOperatorTester
,
checkMult
)
{
TEST
(
FermionOperatorTester
,
checkMult
)
{
//
FermionOperator op
1
("(-0.5,0) 3^ 2^ 0 1 + (0.5,-0) 1^ 0^ 2 3 + (0.5,-0) 0^ 1^ 3 2 + (0.5,0) 2^ 3^ 0 1 + (0.5,0) 3^ 3^ 1 1 + (-0.5,0) 1^ 1^ 3 3 + (-0.5,0) 1^ 0^ 3 2 + (-0.5,0) 2^ 3^ 1 0"), op
2
("(0.708024, 0)");
FermionOperator
op
3
(
"(-0.5,0) 3^ 2^ 0 1 + (0.5,-0) 1^ 0^ 2 3 + (0.5,-0) 0^ 1^ 3 2 + (0.5,0) 2^ 3^ 0 1 + (0.5,0) 3^ 3^ 1 1 + (-0.5,0) 1^ 1^ 3 3 + (-0.5,0) 1^ 0^ 3 2 + (-0.5,0) 2^ 3^ 1 0"
),
op
4
(
"(0.708024, 0)"
);
FermionOperator
op1
(
"3^ 2^ 3 2"
),
op2
(
"0^ 3 1^ 2"
);
FermionOperator
op1
(
"3^ 2^ 3 2"
),
op2
(
"0^ 3 1^ 2"
);
for
(
auto
b
:
op1
.
getTerms
()){
std
::
cout
<<
"First "
<<
b
.
second
.
id
()
<<
"
\n
"
;}
for
(
auto
b
:
op1
.
getTerms
()){
std
::
cout
<<
"First "
<<
b
.
second
.
id
()
<<
"
\n
"
;}
...
@@ -98,6 +102,8 @@ TEST(FermionOperatorTester, checkMult) {
...
@@ -98,6 +102,8 @@ TEST(FermionOperatorTester, checkMult) {
//auto mult = op1.getTerms().second * op2.getTerms().second;
//auto mult = op1.getTerms().second * op2.getTerms().second;
std
::
cout
<<
"Print op ="
<<
(
op1
*
op2
).
toString
()
<<
"
\n\n
"
;
std
::
cout
<<
"Print op ="
<<
(
op1
*
op2
).
toString
()
<<
"
\n\n
"
;
std
::
cout
<<
op3
.
toString
()
<<
"
\n
"
;
}
}
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
...
...
quantum/observable/pauli/PauliOperator.g4
View file @
9f216f61
...
@@ -26,6 +26,7 @@ complex : '('(real | INT | scientific)','(real | INT | scientific)')';
...
@@ -26,6 +26,7 @@ complex : '('(real | INT | scientific)','(real | INT | scientific)')';
real
real
: REAL
: REAL
| scientific
;
;
comment
comment
...
...
quantum/observable/pauli/generated/PauliOperator.interp
View file @
9f216f61
...
@@ -49,4 +49,4 @@ scientific
...
@@ -49,4 +49,4 @@ scientific
atn:
atn:
[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 18, 76, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 3, 2, 3, 2, 3, 2, 3, 2, 7, 2, 25, 10, 2, 12, 2, 14, 2, 28, 11, 2, 3, 3, 3, 3, 3, 4, 5, 4, 33, 10, 4, 3, 4, 7, 4, 36, 10, 4, 12, 4, 14, 4, 39, 11, 4, 3, 5, 3, 5, 3, 5, 5, 5, 44, 10, 5, 3, 6, 3, 6, 5, 6, 48, 10, 6, 3, 7, 3, 7, 3, 7, 3, 7, 5, 7, 54, 10, 7, 3, 7, 3, 7, 3, 7, 3, 7, 5, 7, 60, 10, 7, 3, 7, 3, 7, 3, 8, 3, 8, 3, 9, 3, 9, 3, 10, 5, 10, 69, 10, 10, 3, 10, 5, 10, 72, 10, 10, 3, 10, 3, 10, 3, 10, 2, 2, 11, 2, 4, 6, 8, 10, 12, 14, 16, 18, 2, 5, 3, 2, 3, 4, 3, 2, 5, 7, 3, 2, 12, 13, 2, 77, 2, 20, 3, 2, 2, 2, 4, 29, 3, 2, 2, 2, 6, 32, 3, 2, 2, 2, 8, 43, 3, 2, 2, 2, 10, 47, 3, 2, 2, 2, 12, 49, 3, 2, 2, 2, 14, 63, 3, 2, 2, 2, 16, 65, 3, 2, 2, 2, 18, 68, 3, 2, 2, 2, 20, 26, 5, 6, 4, 2, 21, 22, 5, 4, 3, 2, 22, 23, 5, 6, 4, 2, 23, 25, 3, 2, 2, 2, 24, 21, 3, 2, 2, 2, 25, 28, 3, 2, 2, 2, 26, 24, 3, 2, 2, 2, 26, 27, 3, 2, 2, 2, 27, 3, 3, 2, 2, 2, 28, 26, 3, 2, 2, 2, 29, 30, 9, 2, 2, 2, 30, 5, 3, 2, 2, 2, 31, 33, 5, 10, 6, 2, 32, 31, 3, 2, 2, 2, 32, 33, 3, 2, 2, 2, 33, 37, 3, 2, 2, 2, 34, 36, 5, 8, 5, 2, 35, 34, 3, 2, 2, 2, 36, 39, 3, 2, 2, 2, 37, 35, 3, 2, 2, 2, 37, 38, 3, 2, 2, 2, 38, 7, 3, 2, 2, 2, 39, 37, 3, 2, 2, 2, 40, 41, 9, 3, 2, 2, 41, 44, 7, 16, 2, 2, 42, 44, 7, 8, 2, 2, 43, 40, 3, 2, 2, 2, 43, 42, 3, 2, 2, 2, 44, 9, 3, 2, 2, 2, 45, 48, 5, 12, 7, 2, 46, 48, 5, 14, 8, 2, 47, 45, 3, 2, 2, 2, 47, 46, 3, 2, 2, 2, 48, 11, 3, 2, 2, 2, 49, 53, 7, 9, 2, 2, 50, 54, 5, 14, 8, 2, 51, 54, 7, 16, 2, 2, 52, 54, 5, 18, 10, 2, 53, 50, 3, 2, 2, 2, 53, 51, 3, 2, 2, 2, 53, 52, 3, 2, 2, 2, 54, 55, 3, 2, 2, 2, 55, 59, 7, 10, 2, 2, 56, 60, 5, 14, 8, 2, 57, 60, 7, 16, 2, 2, 58, 60, 5, 18, 10, 2, 59, 56, 3, 2, 2, 2, 59, 57, 3, 2, 2, 2, 59, 58, 3, 2, 2, 2, 60, 61, 3, 2, 2, 2, 61, 62, 7, 11, 2, 2, 62, 13, 3, 2, 2, 2, 63, 64, 7, 15, 2, 2, 64, 15, 3, 2, 2, 2, 65, 66, 7, 14, 2, 2, 66, 17, 3, 2, 2, 2, 67, 69, 7, 15, 2, 2, 68, 67, 3, 2, 2, 2, 68, 69, 3, 2, 2, 2, 69, 71, 3, 2, 2, 2, 70, 72, 9, 4, 2, 2, 71, 70, 3, 2, 2, 2, 71, 72, 3, 2, 2, 2, 72, 73, 3, 2, 2, 2, 73, 74, 7, 16, 2, 2, 74, 19, 3, 2, 2, 2, 11, 26, 32, 37, 43, 47, 53, 59, 68, 71]
[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 18, 78, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 3, 2, 3, 2, 3, 2, 3, 2, 7, 2, 25, 10, 2, 12, 2, 14, 2, 28, 11, 2, 3, 3, 3, 3, 3, 4, 5, 4, 33, 10, 4, 3, 4, 7, 4, 36, 10, 4, 12, 4, 14, 4, 39, 11, 4, 3, 5, 3, 5, 3, 5, 5, 5, 44, 10, 5, 3, 6, 3, 6, 5, 6, 48, 10, 6, 3, 7, 3, 7, 3, 7, 3, 7, 5, 7, 54, 10, 7, 3, 7, 3, 7, 3, 7, 3, 7, 5, 7, 60, 10, 7, 3, 7, 3, 7, 3, 8, 3, 8, 5, 8, 66, 10, 8, 3, 9, 3, 9, 3, 10, 5, 10, 71, 10, 10, 3, 10, 5, 10, 74, 10, 10, 3, 10, 3, 10, 3, 10, 2, 2, 11, 2, 4, 6, 8, 10, 12, 14, 16, 18, 2, 5, 3, 2, 3, 4, 3, 2, 5, 7, 3, 2, 12, 13, 2, 80, 2, 20, 3, 2, 2, 2, 4, 29, 3, 2, 2, 2, 6, 32, 3, 2, 2, 2, 8, 43, 3, 2, 2, 2, 10, 47, 3, 2, 2, 2, 12, 49, 3, 2, 2, 2, 14, 65, 3, 2, 2, 2, 16, 67, 3, 2, 2, 2, 18, 70, 3, 2, 2, 2, 20, 26, 5, 6, 4, 2, 21, 22, 5, 4, 3, 2, 22, 23, 5, 6, 4, 2, 23, 25, 3, 2, 2, 2, 24, 21, 3, 2, 2, 2, 25, 28, 3, 2, 2, 2, 26, 24, 3, 2, 2, 2, 26, 27, 3, 2, 2, 2, 27, 3, 3, 2, 2, 2, 28, 26, 3, 2, 2, 2, 29, 30, 9, 2, 2, 2, 30, 5, 3, 2, 2, 2, 31, 33, 5, 10, 6, 2, 32, 31, 3, 2, 2, 2, 32, 33, 3, 2, 2, 2, 33, 37, 3, 2, 2, 2, 34, 36, 5, 8, 5, 2, 35, 34, 3, 2, 2, 2, 36, 39, 3, 2, 2, 2, 37, 35, 3, 2, 2, 2, 37, 38, 3, 2, 2, 2, 38, 7, 3, 2, 2, 2, 39, 37, 3, 2, 2, 2, 40, 41, 9, 3, 2, 2, 41, 44, 7, 16, 2, 2, 42, 44, 7, 8, 2, 2, 43, 40, 3, 2, 2, 2, 43, 42, 3, 2, 2, 2, 44, 9, 3, 2, 2, 2, 45, 48, 5, 12, 7, 2, 46, 48, 5, 14, 8, 2, 47, 45, 3, 2, 2, 2, 47, 46, 3, 2, 2, 2, 48, 11, 3, 2, 2, 2, 49, 53, 7, 9, 2, 2, 50, 54, 5, 14, 8, 2, 51, 54, 7, 16, 2, 2, 52, 54, 5, 18, 10, 2, 53, 50, 3, 2, 2, 2, 53, 51, 3, 2, 2, 2, 53, 52, 3, 2, 2, 2, 54, 55, 3, 2, 2, 2, 55, 59, 7, 10, 2, 2, 56, 60, 5, 14, 8, 2, 57, 60, 7, 16, 2, 2, 58, 60, 5, 18, 10, 2, 59, 56, 3, 2, 2, 2, 59, 57, 3, 2, 2, 2, 59, 58, 3, 2, 2, 2, 60, 61, 3, 2, 2, 2, 61, 62, 7, 11, 2, 2, 62, 13, 3, 2, 2, 2, 63, 66, 7, 15, 2, 2, 64, 66, 5, 18, 10, 2, 65, 63, 3, 2, 2, 2, 65, 64, 3, 2, 2, 2, 66, 15, 3, 2, 2, 2, 67, 68, 7, 14, 2, 2, 68, 17, 3, 2, 2, 2, 69, 71, 7, 15, 2, 2, 70, 69, 3, 2, 2, 2, 70, 71, 3, 2, 2, 2, 71, 73, 3, 2, 2, 2, 72, 74, 9, 4, 2, 2, 73, 72, 3, 2, 2, 2, 73, 74, 3, 2, 2, 2, 74, 75, 3, 2, 2, 2, 75, 76, 7, 16, 2, 2, 76, 19, 3, 2, 2, 2, 12, 26, 32, 37, 43, 47, 53, 59, 65, 70, 73]
\ No newline at end of file
\ No newline at end of file
quantum/observable/pauli/generated/PauliOperatorParser.cpp
View file @
9f216f61
...
@@ -212,9 +212,12 @@ PauliOperatorParser::TermContext* PauliOperatorParser::term() {
...
@@ -212,9 +212,12 @@ PauliOperatorParser::TermContext* PauliOperatorParser::term() {
_errHandler
->
sync
(
this
);
_errHandler
->
sync
(
this
);
_la
=
_input
->
LA
(
1
);
_la
=
_input
->
LA
(
1
);
if
(
_la
==
PauliOperatorParser
::
T__6
if
((((
_la
&
~
0x3fULL
)
==
0
)
&&
((
1ULL
<<
_la
)
&
((
1ULL
<<
PauliOperatorParser
::
T__6
)
||
_la
==
PauliOperatorParser
::
REAL
)
{
|
(
1ULL
<<
PauliOperatorParser
::
T__9
)
|
(
1ULL
<<
PauliOperatorParser
::
T__10
)
|
(
1ULL
<<
PauliOperatorParser
::
REAL
)
|
(
1ULL
<<
PauliOperatorParser
::
INT
)))
!=
0
))
{
setState
(
29
);
setState
(
29
);
coeff
();
coeff
();
}
}
...
@@ -373,7 +376,10 @@ PauliOperatorParser::CoeffContext* PauliOperatorParser::coeff() {
...
@@ -373,7 +376,10 @@ PauliOperatorParser::CoeffContext* PauliOperatorParser::coeff() {
break
;
break
;
}
}
case
PauliOperatorParser
::
REAL
:
{
case
PauliOperatorParser
::
T__9
:
case
PauliOperatorParser
::
T__10
:
case
PauliOperatorParser
::
REAL
:
case
PauliOperatorParser
::
INT
:
{
enterOuterAlt
(
_localctx
,
2
);
enterOuterAlt
(
_localctx
,
2
);
setState
(
44
);
setState
(
44
);
real
();
real
();
...
@@ -521,6 +527,10 @@ tree::TerminalNode* PauliOperatorParser::RealContext::REAL() {
...
@@ -521,6 +527,10 @@ tree::TerminalNode* PauliOperatorParser::RealContext::REAL() {
return
getToken
(
PauliOperatorParser
::
REAL
,
0
);
return
getToken
(
PauliOperatorParser
::
REAL
,
0
);
}
}
PauliOperatorParser
::
ScientificContext
*
PauliOperatorParser
::
RealContext
::
scientific
()
{
return
getRuleContext
<
PauliOperatorParser
::
ScientificContext
>
(
0
);
}
size_t
PauliOperatorParser
::
RealContext
::
getRuleIndex
()
const
{
size_t
PauliOperatorParser
::
RealContext
::
getRuleIndex
()
const
{
return
PauliOperatorParser
::
RuleReal
;
return
PauliOperatorParser
::
RuleReal
;
...
@@ -546,9 +556,24 @@ PauliOperatorParser::RealContext* PauliOperatorParser::real() {
...
@@ -546,9 +556,24 @@ PauliOperatorParser::RealContext* PauliOperatorParser::real() {
exitRule
();
exitRule
();
});
});
try
{
try
{
enterOuterAlt
(
_localctx
,
1
);
setState
(
63
);
setState
(
61
);
_errHandler
->
sync
(
this
);
match
(
PauliOperatorParser
::
REAL
);
switch
(
getInterpreter
<
atn
::
ParserATNSimulator
>
()
->
adaptivePredict
(
_input
,
7
,
_ctx
))
{
case
1
:
{
enterOuterAlt
(
_localctx
,
1
);
setState
(
61
);
match
(
PauliOperatorParser
::
REAL
);
break
;
}
case
2
:
{
enterOuterAlt
(
_localctx
,
2
);
setState
(
62
);
scientific
();
break
;
}
}
}
}
catch
(
RecognitionException
&
e
)
{
catch
(
RecognitionException
&
e
)
{
...
@@ -596,7 +621,7 @@ PauliOperatorParser::CommentContext* PauliOperatorParser::comment() {
...
@@ -596,7 +621,7 @@ PauliOperatorParser::CommentContext* PauliOperatorParser::comment() {
});
});
try
{
try
{
enterOuterAlt
(
_localctx
,
1
);
enterOuterAlt
(
_localctx
,
1
);
setState
(
6
3
);
setState
(
6
5
);
match
(
PauliOperatorParser
::
COMMENT
);
match
(
PauliOperatorParser
::
COMMENT
);
}
}
...
@@ -650,22 +675,22 @@ PauliOperatorParser::ScientificContext* PauliOperatorParser::scientific() {
...
@@ -650,22 +675,22 @@ PauliOperatorParser::ScientificContext* PauliOperatorParser::scientific() {
});
});
try
{
try
{
enterOuterAlt
(
_localctx
,
1
);
enterOuterAlt
(
_localctx
,
1
);
setState
(
6
6
);
setState
(
6
8
);
_errHandler
->
sync
(
this
);
_errHandler
->
sync
(
this
);
_la
=
_input
->
LA
(
1
);
_la
=
_input
->
LA
(
1
);
if
(
_la
==
PauliOperatorParser
::
REAL
)
{
if
(
_la
==
PauliOperatorParser
::
REAL
)
{
setState
(
6
5
);
setState
(
6
7
);
match
(
PauliOperatorParser
::
REAL
);
match
(
PauliOperatorParser
::
REAL
);
}
}
setState
(
69
);
setState
(
71
);
_errHandler
->
sync
(
this
);
_errHandler
->
sync
(
this
);
_la
=
_input
->
LA
(
1
);
_la
=
_input
->
LA
(
1
);
if
(
_la
==
PauliOperatorParser
::
T__9
if
(
_la
==
PauliOperatorParser
::
T__9
||
_la
==
PauliOperatorParser
::
T__10
)
{
||
_la
==
PauliOperatorParser
::
T__10
)
{
setState
(
68
);
setState
(
70
);
_la
=
_input
->
LA
(
1
);
_la
=
_input
->
LA
(
1
);
if
(
!
(
_la
==
PauliOperatorParser
::
T__9
if
(
!
(
_la
==
PauliOperatorParser
::
T__9
...
@@ -677,7 +702,7 @@ PauliOperatorParser::ScientificContext* PauliOperatorParser::scientific() {
...
@@ -677,7 +702,7 @@ PauliOperatorParser::ScientificContext* PauliOperatorParser::scientific() {
consume
();
consume
();
}
}
}
}
setState
(
7
1
);
setState
(
7
3
);
match
(
PauliOperatorParser
::
INT
);
match
(
PauliOperatorParser
::
INT
);
}
}
...
@@ -733,7 +758,7 @@ PauliOperatorParser::Initializer::Initializer() {
...
@@ -733,7 +758,7 @@ PauliOperatorParser::Initializer::Initializer() {
_serializedATN
=
{
_serializedATN
=
{
0x3
,
0x608b
,
0xa72a
,
0x8133
,
0xb9ed
,
0x417c
,
0x3be7
,
0x7786
,
0x5964
,
0x3
,
0x608b
,
0xa72a
,
0x8133
,
0xb9ed
,
0x417c
,
0x3be7
,
0x7786
,
0x5964
,
0x3
,
0x12
,
0x4
c
,
0x4
,
0x2
,
0x9
,
0x2
,
0x4
,
0x3
,
0x9
,
0x3
,
0x4
,
0x4
,
0x9
,
0x3
,
0x12
,
0x4
e
,
0x4
,
0x2
,
0x9
,
0x2
,
0x4
,
0x3
,
0x9
,
0x3
,
0x4
,
0x4
,
0x9
,
0x4
,
0x4
,
0x5
,
0x9
,
0x5
,
0x4
,
0x6
,
0x9
,
0x6
,
0x4
,
0x7
,
0x9
,
0x7
,
0x4
,
0x4
,
0x4
,
0x5
,
0x9
,
0x5
,
0x4
,
0x6
,
0x9
,
0x6
,
0x4
,
0x7
,
0x9
,
0x7
,
0x4
,
0x8
,
0x9
,
0x8
,
0x4
,
0x9
,
0x9
,
0x9
,
0x4
,
0xa
,
0x9
,
0xa
,
0x3
,
0x2
,
0x3
,
0x8
,
0x9
,
0x8
,
0x4
,
0x9
,
0x9
,
0x9
,
0x4
,
0xa
,
0x9
,
0xa
,
0x3
,
0x2
,
0x3
,
0x2
,
0x3
,
0x2
,
0x3
,
0x2
,
0x7
,
0x2
,
0x19
,
0xa
,
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