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
999effda
Commit
999effda
authored
Nov 14, 2019
by
Mccaskey, Alex
Browse files
update to docs
Signed-off-by:
Alex McCaskey
<
mccaskeyaj@ornl.gov
>
parent
e50e68dd
Pipeline
#80041
passed with stage
in 4 minutes and 47 seconds
Changes
5
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
docs/source/extensions.rst
View file @
999effda
...
...
@@ -673,7 +673,7 @@ To use this Observable, ensure you have Psi4 installed under the same
$ git clone https://github.com/psi4/psi4 && cd psi4 && mkdir build && cd build
$ cmake .. -DPYTHON_EXECUTABLE=$(which python3) -DCMAKE_INSTALL_PREFIX=$(python3 -m site --user-site)/psi4
$ make -j8 install
$ export PYTHONPATH=$(python3 -m site --user-site)/psi4:$PYTHONPATH
$ export PYTHONPATH=$(python3 -m site --user-site)/psi4
/lib
:$PYTHONPATH
This observable type takes an dictionary of options describing the
molecular geometry (key ``geometry``), the basis set (key ``basis``),
...
...
python/examples/nah_vqe_ucc1.py
View file @
999effda
import
xacc
import
sys
import
numpy
as
np
# Get access to the desired QPU and
# allocate some qubits to run on
...
...
python/py_observable.cpp
View file @
999effda
...
...
@@ -114,6 +114,9 @@ void bind_observable(py::module &m) {
t
=
xacc
::
getContributedService
<
Observable
>
(
type
,
false
);
}
if
(
!
t
)
{
xacc
::
error
(
"Invalid Observable type name "
+
type
+
", can't find in service registry."
);
}
HeterogeneousMap
m
;
for
(
auto
&
item
:
options
)
{
PyHeterogeneousMap2HeterogeneousMap
vis
(
m
,
item
.
first
);
...
...
@@ -122,4 +125,21 @@ void bind_observable(py::module &m) {
t
->
fromOptions
(
m
);
return
t
;
});
m
.
def
(
"getObservable"
,
[](
const
std
::
string
&
type
)
->
std
::
shared_ptr
<
Observable
>
{
std
::
shared_ptr
<
Observable
>
t
;
if
(
xacc
::
hasService
<
Observable
>
(
type
))
{
t
=
xacc
::
getService
<
Observable
>
(
type
,
false
);
}
else
if
(
xacc
::
hasContributedService
<
Observable
>
(
type
))
{
t
=
xacc
::
getContributedService
<
Observable
>
(
type
,
false
);
}
if
(
!
t
)
{
xacc
::
error
(
"Invalid Observable type name "
+
type
+
", can't find in service registry."
);
}
HeterogeneousMap
m
;
t
->
fromOptions
(
m
);
return
t
;
});
}
\ No newline at end of file
python/xacc-py.cpp
View file @
999effda
...
...
@@ -115,6 +115,18 @@ PYBIND11_MODULE(_pyxacc, m) {
accd
->
setDecorated
(
acc
);
return
accd
;
});
m
.
def
(
"getAcceleratorDecorator"
,
[](
const
std
::
string
name
,
std
::
shared_ptr
<
Accelerator
>
acc
,
const
PyHeterogeneousMap
&
options
)
{
auto
accd
=
xacc
::
getService
<
AcceleratorDecorator
>
(
name
);
accd
->
setDecorated
(
acc
);
HeterogeneousMap
m
;
for
(
auto
&
item
:
options
)
{
PyHeterogeneousMap2HeterogeneousMap
vis
(
m
,
item
.
first
);
mpark
::
visit
(
vis
,
item
.
second
);
}
accd
->
initialize
(
m
);
return
accd
;
});
m
.
def
(
"asComposite"
,
&
xacc
::
ir
::
asComposite
,
""
);
m
.
def
(
"asInstruction"
,
&
xacc
::
ir
::
asInstruction
,
""
);
m
.
def
(
...
...
python/xacc.py
View file @
999effda
...
...
@@ -290,7 +290,8 @@ class PyServiceRegistry(object):
def
initialize
(
self
):
serviceList
=
[
'decorator_algorithm_service'
,
'benchmark_algorithm'
,
'hamiltonian_generator'
,
'ansatz_generator'
,
'accelerator'
,
'irtransformation'
,
'observable'
]
'hamiltonian_generator'
,
'ansatz_generator'
,
'accelerator'
,
'irtransformation'
,
'observable'
]
xaccLocation
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
self
.
pluginDir
=
xaccLocation
+
'/py-plugins'
if
not
os
.
path
.
exists
(
self
.
pluginDir
):
...
...
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