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
7f57220e
Commit
7f57220e
authored
Feb 15, 2018
by
Mccaskey, Alex
Browse files
fixing clang warnings in quantum package
Signed-off-by:
Alex McCaskey
<
mccaskeyaj@ornl.gov
>
parent
b52c27aa
Changes
5
Hide whitespace changes
Inline
Side-by-side
quantum/aqc/ir/DWKernel.hpp
View file @
7f57220e
...
...
@@ -15,7 +15,7 @@
#include
"Function.hpp"
#include
"DWQMI.hpp"
#include
"
Utils
.hpp"
#include
"
XACC
.hpp"
namespace
xacc
{
namespace
quantum
{
...
...
@@ -37,6 +37,7 @@ public:
/**
* The constructor, takes the function unique id and its name.
*
*
* @param id
* @param name
*/
...
...
@@ -48,11 +49,13 @@ public:
}
virtual
InstPtr
getInstruction
(
const
int
idx
)
{
InstPtr
i
;
if
(
instructions
.
size
()
>
idx
)
{
return
*
std
::
next
(
instructions
.
begin
(),
idx
);
i
=
*
std
::
next
(
instructions
.
begin
(),
idx
);
}
else
{
XACCLogger
::
instance
()
->
error
(
"Invalid instruction index
."
);
xacc
::
error
(
"DWKernel getInstruction invalid instruction index - "
+
std
::
to_string
(
idx
)
+
"
."
);
}
return
i
;
}
virtual
std
::
list
<
InstPtr
>
getInstructions
()
{
...
...
@@ -149,19 +152,21 @@ public:
}
virtual
InstructionParameter
getParameter
(
const
int
idx
)
const
{
XACCLogger
::
instance
()
->
error
(
"DWKernel does not contain runtime parameters."
);
xacc
::
error
(
"DWKernel does not contain runtime parameters."
);
return
InstructionParameter
(
0
);
}
virtual
void
setParameter
(
const
int
idx
,
InstructionParameter
&
p
)
{
XACCLogger
::
instance
()
->
error
(
"DWKernel does not contain runtime parameters."
);
xacc
::
error
(
"DWKernel does not contain runtime parameters."
);
}
virtual
std
::
vector
<
InstructionParameter
>
getParameters
()
{
XACCLogger
::
instance
()
->
error
(
"DWKernel does not contain runtime parameters."
);
xacc
::
error
(
"DWKernel does not contain runtime parameters."
);
return
{};
}
virtual
void
addParameter
(
InstructionParameter
instParam
)
{
XACCLogger
::
instance
()
->
error
(
"DWKernel does not contain runtime parameters."
);
xacc
::
error
(
"DWKernel does not contain runtime parameters."
);
}
virtual
bool
isParameterized
()
{
...
...
@@ -173,7 +178,7 @@ public:
}
virtual
void
evaluateVariableParameters
(
std
::
vector
<
InstructionParameter
>
parameters
)
{
XACCLogger
::
instance
()
->
error
(
"DWKernel does not contain runtime parameters."
);
xacc
::
error
(
"DWKernel does not contain runtime parameters."
);
}
...
...
quantum/gate/ir/GateFunction.hpp
View file @
7f57220e
...
...
@@ -15,7 +15,7 @@
#include
"Registry.hpp"
#include
"Function.hpp"
#include
"
Utils
.hpp"
#include
"
XACC
.hpp"
namespace
xacc
{
namespace
quantum
{
...
...
@@ -90,11 +90,13 @@ public:
}
virtual
InstPtr
getInstruction
(
const
int
idx
)
{
InstPtr
i
;
if
(
instructions
.
size
()
>
idx
)
{
return
*
std
::
next
(
instructions
.
begin
(),
idx
);
i
=
*
std
::
next
(
instructions
.
begin
(),
idx
);
}
else
{
XACCLogger
::
instance
()
->
error
(
"Invalid instruction index
."
);
xacc
::
error
(
"GateFunction getInstruction invalid instruction index - "
+
std
::
to_string
(
idx
)
+
"
."
);
}
return
i
;
}
virtual
std
::
list
<
InstPtr
>
getInstructions
()
{
...
...
quantum/gate/ir/GateQIR.hpp
View file @
7f57220e
...
...
@@ -106,12 +106,16 @@ public:
}
virtual
std
::
shared_ptr
<
Function
>
getKernel
(
const
std
::
string
&
name
)
{
std
::
shared_ptr
<
Function
>
ret
;
for
(
auto
f
:
kernels
)
{
if
(
f
->
getName
()
==
name
)
{
ret
urn
f
;
ret
=
f
;
}
}
XACCLogger
::
instance
()
->
error
(
"Invalid kernel name."
);
if
(
!
ret
)
{
xacc
::
error
(
"Invalid kernel name."
);
}
return
ret
;
}
virtual
bool
kernelExists
(
const
std
::
string
&
name
)
{
...
...
quantum/gate/ir/ReadoutErrorIRPreprocessor.cpp
View file @
7f57220e
...
...
@@ -28,6 +28,7 @@ std::shared_ptr<AcceleratorBufferPostprocessor> ReadoutErrorIRPreprocessor::proc
int
nQubits
=
0
;
//std::stoi(xacc::getOption("n-qubits")); //ir.maxBit() + 1;
auto
gateRegistry
=
GateInstructionRegistry
::
instance
();
// Get the true number of qubits
std
::
set
<
int
>
qubits
;
for
(
auto
kernel
:
ir
.
getKernels
())
{
...
...
quantum/gate/utils/Registry.hpp
View file @
7f57220e
...
...
@@ -14,7 +14,7 @@
#define XACC_UTILS_REGISTRY_HPP_
#include
"Singleton.hpp"
#include
"
Utils
.hpp"
#include
"
XACC
.hpp"
#include
"RuntimeOptions.hpp"
#include
<map>
#include
<iostream>
...
...
@@ -61,11 +61,11 @@ public:
if
(
RuntimeOptions
::
instance
()
->
exists
(
"verbose-registry"
))
XACCLogger
::
instance
()
->
info
(
"Registry adding "
+
id
);
bool
s
=
registry
.
emplace
(
std
::
make_pair
(
id
,
f
)).
second
;
if
(
!
s
)
{
XACCLogger
::
instance
()
->
error
(
"Could not add "
+
id
+
" to the Registry."
);
}
else
{
return
s
;
if
(
s
)
{
return
true
;
}
xacc
::
error
(
"Could not add "
+
id
+
" to the Registry."
);
return
false
;
}
/**
...
...
@@ -81,14 +81,14 @@ public:
bool
add
(
const
std
::
string
&
id
,
CreatorFunctionPtr
f
,
std
::
shared_ptr
<
options_description
>
options
)
{
if
(
registry
.
find
(
id
)
!=
registry
.
end
())
{
XACCLogger
::
instance
()
->
info
(
id
+
" already exists in Registry. Ignoring and retaining previous Registry entry"
);
return
true
;
}
if
(
RuntimeOptions
::
instance
()
->
exists
(
"verbose-registry"
))
XACCLogger
::
instance
()
->
info
(
"Registry adding "
+
id
);
bool
s
=
registry
.
emplace
(
std
::
make_pair
(
id
,
f
)).
second
;
bool
s2
=
registryOptions
.
insert
(
std
::
make_pair
(
id
,
std
::
move
(
options
))).
second
;
if
(
!
s
||
!
s2
)
{
XACCLogger
::
instance
()
->
error
(
"Could not add "
+
id
+
" to the Registry."
);
xacc
::
error
(
"Could not add "
+
id
+
" to the Registry."
);
return
false
;
}
else
{
return
true
;
}
...
...
@@ -110,7 +110,8 @@ public:
registryOptions
.
insert
(
std
::
make_pair
(
id
,
std
::
move
(
options
))).
second
;
bool
s3
=
registryOptionHandlers
.
insert
(
std
::
make_pair
(
id
,
std
::
move
(
optionsHandler
))).
second
;
if
(
!
s
||
!
s2
)
{
XACCLogger
::
instance
()
->
error
(
"Could not add "
+
id
+
" to the Registry."
);
xacc
::
error
(
"Could not add "
+
id
+
" to the Registry."
);
return
false
;
}
else
{
return
true
;
}
...
...
@@ -128,7 +129,8 @@ public:
if
(
search
!=
registry
.
end
())
{
return
registry
[
id
]
->
operator
()(
args
...);
}
else
{
XACCLogger
::
instance
()
->
error
(
"Invalid Registry map id string - "
+
id
);
xacc
::
error
(
"Invalid Registry map id string - "
+
id
);
return
std
::
make_shared
<
T
>
(
args
...);
}
}
...
...
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