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
36f39f16
Commit
36f39f16
authored
Jul 12, 2017
by
Mccaskey, Alex
Browse files
fixing add_edge bug in DWGraph
parent
fbdc2091
Changes
4
Hide whitespace changes
Inline
Side-by-side
impls/dwave/DWQMICompiler.cpp
View file @
36f39f16
...
...
@@ -134,8 +134,6 @@ std::shared_ptr<IR> DWQMICompiler::compile(const std::string& src,
}
}
std
::
cout
<<
"NHARDWARE: "
<<
nHardwareVerts
<<
", "
<<
problemGraph
->
order
()
<<
"
\n
"
;
for
(
int
i
=
0
;
i
<
nHardwareVerts
;
i
++
)
{
for
(
int
j
=
0
;
j
<
nHardwareVerts
;
j
++
)
{
if
(
hardwareGraph
->
edgeExists
(
i
,
j
)
&&
i
<
j
&&
i
!=
j
)
{
...
...
@@ -161,24 +159,17 @@ std::shared_ptr<IR> DWQMICompiler::compile(const std::string& src,
newWeight
=
std
::
get
<
0
>
(
problemGraph
->
getVertexProperties
(
pi
))
+
newWeight
-
1.0
;
}
std
::
cout
<<
"Adding a Edge Instruction.
\n
"
;
auto
embeddedInst
=
std
::
make_shared
<
DWQMI
>
(
i
,
j
,
newWeight
);
dwKernel
->
addInstruction
(
embeddedInst
);
}
// else {
// std::cout << "SUBTREE DID NOT CONTAIN: " << i << " and " << j << "\n";
// }
}
}
}
else
{
std
::
cout
<<
"Edge did not exist between "
<<
i
<<
", "
<<
j
<<
"
\n
"
;
}
}
}
auto
ir
=
std
::
make_shared
<
DWIR
>
();
ir
->
addKernel
(
dwKernel
);
return
ir
;
...
...
impls/dwave/tests/DWQMICompilerTester.cpp
View file @
36f39f16
...
...
@@ -145,7 +145,7 @@ BOOST_AUTO_TEST_CASE(checkSimpleCompile) {
auto
ir
=
compiler
->
compile
(
simpleQMI
,
acc
);
std
::
cout
<<
"STR:
\n
"
<<
ir
->
getKernel
(
"dw-kernel"
)
->
toString
(
""
)
<<
"
\n
"
;
//
std::cout << "STR:\n" << ir->getKernel("dw-kernel")->toString("") << "\n";
}
...
...
quantum/aqc/ir/DWGraph.hpp
View file @
36f39f16
...
...
@@ -37,11 +37,10 @@ public:
std
::
shared_ptr
<
AcceleratorGraph
>
getAcceleratorGraph
()
{
auto
retGraph
=
std
::
make_shared
<
AcceleratorGraph
>
(
order
());
for
(
int
i
=
0
;
i
<
order
();
i
++
)
{
for
(
int
j
=
0
;
j
<
order
();
j
++
)
{
if
(
i
<
j
)
{
addEdge
(
i
,
j
);
retGraph
->
addEdge
(
i
,
j
);
}
}
}
...
...
xacc/utils/Graph.hpp
View file @
36f39f16
...
...
@@ -427,7 +427,7 @@ public:
*
_graph
.
get
());
for
(;
neighbors
.
first
!=
neighbors
.
second
;
++
neighbors
.
first
)
{
std
::
cout
<<
indexMap
[
*
neighbors
.
first
]
<<
" "
;
//
std::cout << indexMap[*neighbors.first] << " ";
int
neighborIdx
=
indexMap
[
*
neighbors
.
first
];
l
.
push_back
(
neighborIdx
);
}
...
...
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