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
1d801d5a
Commit
1d801d5a
authored
Nov 19, 2019
by
Mccaskey, Alex
Browse files
making algorithm cloneable
Signed-off-by:
Alex McCaskey
<
mccaskeyaj@ornl.gov
>
parent
31a6d847
Pipeline
#80601
failed with stage
in 3 minutes and 23 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
quantum/plugins/algorithms/ml/ddcl/ddcl.cpp
View file @
1d801d5a
...
...
@@ -209,6 +209,7 @@ DDCL::execute(const std::shared_ptr<AcceleratorBuffer> buffer,
auto
lossStrategy
=
xacc
::
getService
<
LossStrategy
>
(
loss
);
// Execute!
std
::
cout
<<
"RUNNING ON "
<<
accelerator
->
name
()
<<
"
\n
"
;
auto
tmpBuffer
=
xacc
::
qalloc
(
buffer
->
size
());
accelerator
->
execute
(
tmpBuffer
,
circuits
);
auto
buffers
=
tmpBuffer
->
getChildren
();
...
...
quantum/plugins/algorithms/ml/ddcl/ddcl.hpp
View file @
1d801d5a
...
...
@@ -78,6 +78,9 @@ public:
const
std
::
vector
<
double
>
&
parameters
)
override
;
const
std
::
string
name
()
const
override
{
return
"ddcl"
;
}
const
std
::
string
description
()
const
override
{
return
""
;
}
DEFINE_ALGORITHM_CLONE
(
DDCL
)
};
}
// namespace algorithm
}
// namespace xacc
...
...
quantum/plugins/algorithms/ml/rbm_classification/rbm_classification.hpp
View file @
1d801d5a
...
...
@@ -65,6 +65,7 @@ public:
void
execute
(
const
std
::
shared_ptr
<
AcceleratorBuffer
>
buffer
)
const
override
;
const
std
::
string
name
()
const
override
{
return
"rbm-classification"
;
}
const
std
::
string
description
()
const
override
{
return
""
;
}
DEFINE_ALGORITHM_CLONE
(
RBMClassification
)
};
}
// namespace algorithm
}
// namespace xacc
...
...
quantum/plugins/algorithms/rdm/rdm.hpp
View file @
1d801d5a
...
...
@@ -31,6 +31,7 @@ public:
void
execute
(
const
std
::
shared_ptr
<
AcceleratorBuffer
>
buffer
)
const
override
;
const
std
::
string
name
()
const
override
{
return
"rdm"
;
}
const
std
::
string
description
()
const
override
{
return
""
;
}
DEFINE_ALGORITHM_CLONE
(
RDM
)
};
}
// namespace algorithm
}
// namespace xacc
...
...
quantum/plugins/algorithms/vqe-energy/vqe-energy.hpp
View file @
1d801d5a
...
...
@@ -34,6 +34,8 @@ public:
const
std
::
string
name
()
const
override
{
return
"vqe-energy"
;
}
const
std
::
string
description
()
const
override
{
return
""
;
}
DEFINE_ALGORITHM_CLONE
(
VQEEnergy
)
};
}
// namespace algorithm
}
// namespace xacc
...
...
quantum/plugins/algorithms/vqe/vqe.hpp
View file @
1d801d5a
...
...
@@ -34,6 +34,7 @@ public:
void
execute
(
const
std
::
shared_ptr
<
AcceleratorBuffer
>
buffer
)
const
override
;
const
std
::
string
name
()
const
override
{
return
"vqe"
;
}
const
std
::
string
description
()
const
override
{
return
""
;
}
DEFINE_ALGORITHM_CLONE
(
VQE
)
};
}
// namespace algorithm
}
// namespace xacc
...
...
xacc/algorithm/Algorithm.hpp
View file @
1d801d5a
...
...
@@ -31,7 +31,7 @@ namespace xacc {
//
// Algorithms expose an execute method that persists results
// to the AcceleratorBuffer.
class
Algorithm
:
public
xacc
::
Identifiable
{
class
Algorithm
:
public
xacc
::
Identifiable
,
public
xacc
::
Cloneable
<
Algorithm
>
{
public:
bool
initialize
(
const
HeterogeneousMap
&&
parameters
)
{
...
...
@@ -42,7 +42,7 @@ public:
virtual
void
execute
(
const
std
::
shared_ptr
<
AcceleratorBuffer
>
buffer
)
const
=
0
;
virtual
std
::
vector
<
double
>
execute
(
const
std
::
shared_ptr
<
AcceleratorBuffer
>
buffer
,
const
std
::
vector
<
double
>
&
parameters
)
{
XACCLogger
::
instance
()
->
error
(
...
...
@@ -51,6 +51,11 @@ public:
exit
(
0
);
return
{};
}
#define DEFINE_ALGORITHM_CLONE(CLASS) \
std::shared_ptr<Algorithm> clone() override { \
return std::make_shared<CLASS>(); \
}
};
}
// namespace xacc
...
...
xacc/tests/AlgorithmTester.cpp
View file @
1d801d5a
...
...
@@ -30,6 +30,7 @@ public:
const
std
::
vector
<
std
::
string
>
requiredParameters
()
const
override
{
return
{
"observable"
};
}
DEFINE_ALGORITHM_CLONE
(
TestAlgorithm
)
void
execute
(
const
std
::
shared_ptr
<
AcceleratorBuffer
>
buffer
)
const
override
{
return
;
...
...
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