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
402c8b11
Commit
402c8b11
authored
Jun 09, 2020
by
Nguyen, Thien Minh
Browse files
Microservices boilerplate for QITE algorithm
Signed-off-by:
Thien Nguyen
<
nguyentm@ornl.gov
>
parent
351f6f8b
Changes
8
Hide whitespace changes
Inline
Side-by-side
quantum/plugins/algorithms/CMakeLists.txt
View file @
402c8b11
...
...
@@ -17,6 +17,7 @@ add_subdirectory(rotoselect)
add_subdirectory
(
qpt
)
add_subdirectory
(
qaoa
)
add_subdirectory
(
qpe
)
add_subdirectory
(
qite
)
file
(
GLOB PYDECORATORS
${
CMAKE_CURRENT_SOURCE_DIR
}
/vqe/python/*.py
${
CMAKE_CURRENT_SOURCE_DIR
}
/ml/ddcl/python/*.py
)
...
...
quantum/plugins/algorithms/qite/CMakeLists.txt
0 → 100644
View file @
402c8b11
# *******************************************************************************
# Copyright (c) 2019 UT-Battelle, LLC.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# and Eclipse Distribution License v.10 which accompany this distribution.
# The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
# and the Eclipse Distribution License is available at
# https://eclipse.org/org/documents/edl-v10.php
#
# Contributors:
# Thien Nguyen - initial API and implementation
# *******************************************************************************/
set
(
LIBRARY_NAME xacc-algorithm-qite
)
file
(
GLOB SRC *.cpp
)
usfunctiongetresourcesource
(
TARGET
${
LIBRARY_NAME
}
OUT SRC
)
usfunctiongeneratebundleinit
(
TARGET
${
LIBRARY_NAME
}
OUT SRC
)
add_library
(
${
LIBRARY_NAME
}
SHARED
${
SRC
}
)
target_include_directories
(
${
LIBRARY_NAME
}
PUBLIC .
)
target_link_libraries
(
${
LIBRARY_NAME
}
PUBLIC xacc CppMicroServices
)
set
(
_bundle_name xacc_algorithm_qite
)
set_target_properties
(
${
LIBRARY_NAME
}
PROPERTIES COMPILE_DEFINITIONS
US_BUNDLE_NAME=
${
_bundle_name
}
US_BUNDLE_NAME
${
_bundle_name
}
)
usfunctionembedresources
(
TARGET
${
LIBRARY_NAME
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
FILES
manifest.json
)
if
(
APPLE
)
set_target_properties
(
${
LIBRARY_NAME
}
PROPERTIES INSTALL_RPATH
"@loader_path/../lib"
)
set_target_properties
(
${
LIBRARY_NAME
}
PROPERTIES LINK_FLAGS
"-undefined dynamic_lookup"
)
else
()
set_target_properties
(
${
LIBRARY_NAME
}
PROPERTIES INSTALL_RPATH
"$ORIGIN/../lib"
)
set_target_properties
(
${
LIBRARY_NAME
}
PROPERTIES LINK_FLAGS
"-shared"
)
endif
()
if
(
XACC_BUILD_TESTS
)
add_subdirectory
(
tests
)
endif
()
install
(
TARGETS
${
LIBRARY_NAME
}
DESTINATION
${
CMAKE_INSTALL_PREFIX
}
/plugins
)
quantum/plugins/algorithms/qite/QITEActivator.cpp
0 → 100644
View file @
402c8b11
/*******************************************************************************
* Copyright (c) 2019 UT-Battelle, LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompanies this
* distribution. The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
*License is available at https://eclipse.org/org/documents/edl-v10.php
*
* Contributors:
* Thien Nguyen - initial API and implementation
*******************************************************************************/
#include
"qite.hpp"
#include
"cppmicroservices/BundleActivator.h"
#include
"cppmicroservices/BundleContext.h"
#include
"cppmicroservices/ServiceProperties.h"
#include
<memory>
#include
<set>
using
namespace
cppmicroservices
;
namespace
{
/**
*/
class
US_ABI_LOCAL
QITEActivator
:
public
BundleActivator
{
public:
QITEActivator
()
{}
/**
*/
void
Start
(
BundleContext
context
)
{
auto
c
=
std
::
make_shared
<
xacc
::
algorithm
::
QITE
>
();
context
.
RegisterService
<
xacc
::
Algorithm
>
(
c
);
}
/**
*/
void
Stop
(
BundleContext
/*context*/
)
{}
};
}
// namespace
CPPMICROSERVICES_EXPORT_BUNDLE_ACTIVATOR
(
QITEActivator
)
quantum/plugins/algorithms/qite/manifest.json
0 → 100644
View file @
402c8b11
{
"bundle.symbolic_name"
:
"xacc_algorithm_qite"
,
"bundle.activator"
:
true
,
"bundle.name"
:
"XACC QITE Algorithm"
,
"bundle.description"
:
""
}
quantum/plugins/algorithms/qite/qite.cpp
0 → 100644
View file @
402c8b11
/*******************************************************************************
* Copyright (c) 2019 UT-Battelle, LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompanies this
* distribution. The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
*License is available at https://eclipse.org/org/documents/edl-v10.php
*
* Contributors:
* Thien Nguyen - initial API and implementation
*******************************************************************************/
#include
"qite.hpp"
#include
"Observable.hpp"
#include
"xacc.hpp"
#include
<memory>
#include
<iomanip>
using
namespace
xacc
;
namespace
xacc
{
namespace
algorithm
{
bool
QITE
::
initialize
(
const
HeterogeneousMap
&
parameters
)
{
// TODO
return
true
;
}
const
std
::
vector
<
std
::
string
>
QITE
::
requiredParameters
()
const
{
// TODO
return
{};
}
void
QITE
::
execute
(
const
std
::
shared_ptr
<
AcceleratorBuffer
>
buffer
)
const
{
// TODO
}
std
::
vector
<
double
>
QITE
::
execute
(
const
std
::
shared_ptr
<
AcceleratorBuffer
>
buffer
,
const
std
::
vector
<
double
>&
x
)
{
// TODO
return
{};
}
}
// namespace algorithm
}
// namespace xacc
\ No newline at end of file
quantum/plugins/algorithms/qite/qite.hpp
0 → 100644
View file @
402c8b11
/*******************************************************************************
* Copyright (c) 2019 UT-Battelle, LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompanies this
* distribution. The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
*License is available at https://eclipse.org/org/documents/edl-v10.php
*
* Contributors:
* Thien Nguyen - initial API and implementation
*******************************************************************************/
#pragma once
#include
"Algorithm.hpp"
namespace
xacc
{
namespace
algorithm
{
class
QITE
:
public
Algorithm
{
public:
bool
initialize
(
const
HeterogeneousMap
&
parameters
)
override
;
const
std
::
vector
<
std
::
string
>
requiredParameters
()
const
override
;
void
execute
(
const
std
::
shared_ptr
<
AcceleratorBuffer
>
buffer
)
const
override
;
std
::
vector
<
double
>
execute
(
const
std
::
shared_ptr
<
AcceleratorBuffer
>
buffer
,
const
std
::
vector
<
double
>
&
parameters
)
override
;
const
std
::
string
name
()
const
override
{
return
"qite"
;
}
const
std
::
string
description
()
const
override
{
return
""
;
}
DEFINE_ALGORITHM_CLONE
(
QITE
)
};
}
// namespace algorithm
}
// namespace xacc
quantum/plugins/algorithms/qite/tests/CMakeLists.txt
0 → 100644
View file @
402c8b11
# *******************************************************************************
# Copyright (c) 2019 UT-Battelle, LLC.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# and Eclipse Distribution License v.10 which accompany this distribution.
# The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
# and the Eclipse Distribution License is available at
# https://eclipse.org/org/documents/edl-v10.php
#
# Contributors:
# Thien Nguyen - initial API and implementation
# *******************************************************************************/
include_directories
(
${
CMAKE_BINARY_DIR
}
)
add_xacc_test
(
QITE
)
target_link_libraries
(
QITETester xacc xacc-pauli
)
\ No newline at end of file
quantum/plugins/algorithms/qite/tests/QITETester.cpp
0 → 100644
View file @
402c8b11
/*******************************************************************************
* Copyright (c) 2019 UT-Battelle, LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompanies this
* distribution. The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
*License is available at https://eclipse.org/org/documents/edl-v10.php
*
* Contributors:
* Thien Nguyen - initial API and implementation
*******************************************************************************/
#include
<gtest/gtest.h>
#include
"xacc.hpp"
#include
"xacc_service.hpp"
#include
"Optimizer.hpp"
#include
"Observable.hpp"
#include
"Algorithm.hpp"
#include
"PauliOperator.hpp"
TEST
(
QITETester
,
checkSimple
)
{
}
int
main
(
int
argc
,
char
**
argv
)
{
xacc
::
Initialize
(
argc
,
argv
);
::
testing
::
InitGoogleTest
(
&
argc
,
argv
);
auto
ret
=
RUN_ALL_TESTS
();
xacc
::
Finalize
();
return
ret
;
}
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