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
d98bc2da
Commit
d98bc2da
authored
Aug 10, 2017
by
Mccaskey, Alex
Browse files
Making MPI not required
parent
a9aa9afd
Changes
3
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
d98bc2da
...
...
@@ -54,7 +54,7 @@ set(CppMicroServices_INCLUDE_DIR ${CppMicroServices_BASE_DIR}/include/cppmicrose
set
(
CppMicroServices_LIBRARY_DIR
${
CppMicroServices_BASE_DIR
}
/lib
)
# We require MPI
find_package
(
MPI
REQUIRED
)
find_package
(
MPI
)
# We require Boost
find_package
(
Boost COMPONENTS system program_options filesystem python REQUIRED
)
...
...
quantum/gate/utils/SimulatedQubits.hpp
View file @
d98bc2da
...
...
@@ -35,6 +35,7 @@
#include
<complex>
#include
"Tensor.hpp"
#include
<bitset>
#include
<unsupported/Eigen/KroneckerProduct>
namespace
xacc
{
...
...
@@ -59,6 +60,8 @@ protected:
*/
QubitState
bufferState
;
Eigen
::
MatrixXcd
Z
;
public:
/**
...
...
@@ -70,6 +73,17 @@ public:
SimulatedQubits
(
const
std
::
string
&
str
,
const
int
N
)
:
AcceleratorBuffer
(
str
,
N
),
bufferState
((
int
)
std
::
pow
(
2
,
N
))
{
bufferState
(
0
)
=
1.0
;
Eigen
::
MatrixXcd
z
(
2
,
2
),
temp
;
z
<<
1
,
0
,
0
,
-
1
;
temp
=
z
;
for
(
int
i
=
0
;
i
<
N
-
1
;
i
++
)
{
temp
=
Eigen
::
kroneckerProduct
(
z
,
temp
).
eval
();
}
Z
=
temp
;
assert
(
temp
.
rows
()
==
std
::
pow
(
2
,
N
));
}
/**
...
...
@@ -126,6 +140,12 @@ public:
bufferState
=
st
;
}
virtual
const
double
getExpectationValueZ
()
{
auto
data
=
bufferState
.
createReference
().
first
.
data
();
Eigen
::
VectorXcd
state
=
Eigen
::
Map
<
Eigen
::
VectorXcd
,
Eigen
::
Unaligned
>
(
data
,
bufferState
.
size
());
return
std
::
real
(
state
.
transpose
().
dot
(
Z
*
state
));
}
/**
* Print the state to the provided output stream.
*
...
...
xacc/accelerator/AcceleratorBuffer.hpp
View file @
d98bc2da
...
...
@@ -172,7 +172,7 @@ public:
*
* @return expVal The expectation value
*/
virtual
const
double
getExpectationValueZ
()
const
{
virtual
const
double
getExpectationValueZ
()
{
std
::
stringstream
ss
;
double
aver
=
0.
;
long
n_measurements
=
measurements
.
size
();
...
...
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