Commit 7a944307 authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

Fixing a few minor commit bugs


Signed-off-by: Mccaskey, Alex's avataramccaskey <mccaskeyaj@ornl.gov>
parent f71e64d3
...@@ -206,6 +206,7 @@ configure_file("${CMAKE_SOURCE_DIR}/cmake/xacc-config.cmake.in" "${CMAKE_BINARY_ ...@@ -206,6 +206,7 @@ configure_file("${CMAKE_SOURCE_DIR}/cmake/xacc-config.cmake.in" "${CMAKE_BINARY_
install(FILES "${CMAKE_BINARY_DIR}/xacc-config.cmake" DESTINATION .) install(FILES "${CMAKE_BINARY_DIR}/xacc-config.cmake" DESTINATION .)
install(FILES "${CMAKE_SOURCE_DIR}/cmake/Modules/tests.cmake" DESTINATION share/xacc/) install(FILES "${CMAKE_SOURCE_DIR}/cmake/Modules/tests.cmake" DESTINATION share/xacc/)
INSTALL( DIRECTORY "${CMAKE_SOURCE_DIR}/tpls/spdlog" DESTINATION include ) INSTALL( DIRECTORY "${CMAKE_SOURCE_DIR}/tpls/spdlog" DESTINATION include )
INSTALL( DIRECTORY "${CMAKE_SOURCE_DIR}/tpls/exprtk" DESTINATION include )
INSTALL( DIRECTORY "${CMAKE_SOURCE_DIR}/tpls/eigen" DESTINATION include ) INSTALL( DIRECTORY "${CMAKE_SOURCE_DIR}/tpls/eigen" DESTINATION include )
INSTALL( DIRECTORY "${CMAKE_SOURCE_DIR}/tpls/rapidjson" DESTINATION include ) INSTALL( DIRECTORY "${CMAKE_SOURCE_DIR}/tpls/rapidjson" DESTINATION include )
INSTALL( DIRECTORY "${CMAKE_SOURCE_DIR}/tpls/pybind11" DESTINATION include ) INSTALL( DIRECTORY "${CMAKE_SOURCE_DIR}/tpls/pybind11" DESTINATION include )
......
/*******************************************************************************
* Copyright (c) 2017 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:
* Alexander J. McCaskey - initial API and implementation
*******************************************************************************/
#include "CNOT.hpp"
namespace xacc {
namespace quantum {
CNOT::CNOT(std::vector<int> qbits) :
GateInstruction("CNOT", qbits) {
}
CNOT::CNOT(int srcqbit, int tgtqbit) :
CNOT(std::vector<int> { srcqbit, tgtqbit }) {
}
//
//void CNOT::accept(std::shared_ptr<InstructionVisitor> visitor) {
// auto v = std::dynamic_pointer_cast<GateInstructionVisitor>(visitor);
// if (v) {
// v->visit(*this);
// } else {
// visitor->visit(*this);
// }
//}
RegisterGateInstruction<CNOT> CNOTTEMP("CNOT");
}
}
/*******************************************************************************
* Copyright (c) 2017 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:
* Alexander J. McCaskey - initial API and implementation
*******************************************************************************/
#include "CPhase.hpp"
namespace xacc {
namespace quantum {
CPhase::CPhase(int controlQubit, int targetQubit, double theta) :
GateInstruction("CPhase", std::vector<int> { controlQubit, targetQubit },
std::vector<InstructionParameter> { InstructionParameter(theta) }) {
}
CPhase::CPhase(std::vector<int> qbits) :
GateInstruction("CPhase", qbits, std::vector<InstructionParameter> {
InstructionParameter(0.0) }) {
}
RegisterGateInstruction<CPhase> CPHASETEMP("CPhase");
}
}
/*******************************************************************************
* Copyright (c) 2017 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:
* Alexander J. McCaskey - initial API and implementation
*******************************************************************************/
#include "CZ.hpp"
namespace xacc {
namespace quantum {
CZ::CZ(std::vector<int> qbits) :
GateInstruction("CZ", qbits) {
}
CZ::CZ(int srcqbit, int tgtqbit) :
CZ(std::vector<int> { srcqbit, tgtqbit }) {
}
//
//void CZ::accept(std::shared_ptr<InstructionVisitor> visitor) {
// auto v = std::dynamic_pointer_cast<GateInstructionVisitor>(visitor);
// if (v) {
// v->visit(*this);
// } else {
// visitor->visit(*this);
// }
//}
RegisterGateInstruction<CZ> CZTEMP("CZ");
}
}
/*******************************************************************************
* Copyright (c) 2017 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:
* Alexander J. McCaskey - initial API and implementation
*******************************************************************************/
#include "ConditionalFunction.hpp"
namespace xacc {
namespace quantum {
ConditionalFunction::ConditionalFunction(int qbit) :
GateFunction("conditional_" + std::to_string(qbit)), qbitIdx(qbit) {
}
void ConditionalFunction::addInstruction(InstPtr instruction) {
instruction->disable();
instructions.push_back(instruction);
}
const int ConditionalFunction::getConditionalQubit() {
return qbitIdx;
}
void ConditionalFunction::evaluate(const int accBitState) {
if (accBitState == 1) {
for (auto i : instructions) {
i->enable();
}
}
}
const std::string ConditionalFunction::toString(
const std::string& bufferVarName) {
return "";
}
//RegisterGateFunction<ConditionalFunction, int> CONDTEMP("Conditional");
}
}
/*******************************************************************************
* Copyright (c) 2017 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:
* Alexander J. McCaskey - initial API and implementation
*******************************************************************************/
#include "Hadamard.hpp"
namespace xacc {
namespace quantum {
Hadamard::Hadamard(std::vector<int> qbits) :
GateInstruction("H", qbits) {
}
Hadamard::Hadamard(int qbit) :
Hadamard(std::vector<int> { qbit }) {
}
RegisterGateInstruction<Hadamard> HTEMP("H");
}
}
/*******************************************************************************
* Copyright (c) 2017 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:
* Alexander J. McCaskey - initial API and implementation
*******************************************************************************/
#include "Identity.hpp"
namespace xacc {
namespace quantum {
Identity::Identity(std::vector<int> qbits) :
GateInstruction("I", qbits) {
}
Identity::Identity(int qbit) :
Identity(std::vector<int> { qbit }) {
}
RegisterGateInstruction<Identity> ITEMP("I");
}
}
/*******************************************************************************
* Copyright (c) 2017 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:
* Alexander J. McCaskey - initial API and implementation
*******************************************************************************/
#include "Measure.hpp"
namespace xacc {
namespace quantum {
Measure::Measure(std::vector<int> qbit) :
GateInstruction("Measure", qbit, std::vector<InstructionParameter> {
InstructionParameter(0) }) {
}
Measure::Measure(int qbit, int classicalIdx) :
GateInstruction("Measure", std::vector<int> { qbit },
std::vector<InstructionParameter> { InstructionParameter(
classicalIdx) }) {
}
const std::string Measure::toString(const std::string& bufferVarName) {
return gateName + " " + bufferVarName + std::to_string(bits()[0]);
}
RegisterGateInstruction<Measure> MEASURETEMP("Measure");
}
}
/*******************************************************************************
* Copyright (c) 2017 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:
* Alexander J. McCaskey - initial API and implementation
*******************************************************************************/
#include "Rx.hpp"
namespace xacc {
namespace quantum {
Rx::Rx(int qbit, double theta) :
GateInstruction("Rx", std::vector<int> { qbit },
std::vector<InstructionParameter> { InstructionParameter(theta) }) {
}
Rx::Rx(std::vector<int> qbits) :
GateInstruction("Rx", qbits, std::vector<InstructionParameter> {
InstructionParameter(0.0) }) {
}
RegisterGateInstruction<Rx> RXTEMP("Rx");
}
}
/*******************************************************************************
* Copyright (c) 2017 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:
* Alexander J. McCaskey - initial API and implementation
*******************************************************************************/
#include "Ry.hpp"
namespace xacc {
namespace quantum {
Ry::Ry(int qbit, double theta) :
GateInstruction("Ry", std::vector<int> { qbit },
std::vector<InstructionParameter> { InstructionParameter(theta) }) {
}
Ry::Ry(std::vector<int> qbits) :
GateInstruction("Ry", qbits, std::vector<InstructionParameter> {
InstructionParameter(0.0) }) {
}
RegisterGateInstruction<Ry> RYTEMP("Ry");
}
}
/*******************************************************************************
* Copyright (c) 2017 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:
* Alexander J. McCaskey - initial API and implementation
*******************************************************************************/
#include "Rz.hpp"
namespace xacc {
namespace quantum {
Rz::Rz(int qbit, double theta) :
GateInstruction("Rz", std::vector<int> { qbit },
std::vector<InstructionParameter> { InstructionParameter(theta) }) {
}
Rz::Rz(std::vector<int> qbits) :
GateInstruction("Rz", qbits, std::vector<InstructionParameter> {
InstructionParameter(0.0) }) {
}
RegisterGateInstruction<Rz> RZTEMP("Rz");
//RegisterParameterizedGateInstruction<Rz, double> RZTEMP("Rz");
}
}
/*******************************************************************************
* Copyright (c) 2017 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:
* Alexander J. McCaskey - initial API and implementation
*******************************************************************************/
#include "Swap.hpp"
namespace xacc {
namespace quantum {
Swap::Swap(int controlQubit, int targetQubit) :
GateInstruction("Swap", std::vector<int> { controlQubit, targetQubit },
std::vector<InstructionParameter> {}) {
}
Swap::Swap(std::vector<int> qbits) :
GateInstruction("Swap", qbits, std::vector<InstructionParameter> {}) {
}
RegisterGateInstruction<Swap> SWAPTEMP("Swap");
}
}
/*******************************************************************************
* Copyright (c) 2017 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:
* Alexander J. McCaskey - initial API and implementation
*******************************************************************************/
#include "X.hpp"
namespace xacc {
namespace quantum {
X::X(std::vector<int> qbit) :
GateInstruction("X", qbit) {
}
X::X(int qbit) :
X(std::vector<int> { qbit }) {
}
RegisterGateInstruction<X> XTEMP("X");
}
}
/*******************************************************************************
* Copyright (c) 2017 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:
* Alexander J. McCaskey - initial API and implementation
*******************************************************************************/
#include "Y.hpp"
namespace xacc {
namespace quantum {
Y::Y(std::vector<int> qbit) :
GateInstruction("Y", qbit) {
}
Y::Y(int qbit) :
Y(std::vector<int> { qbit }) {
}
RegisterGateInstruction<Y> YTEMP("Y");
}
}
/*******************************************************************************
* Copyright (c) 2017 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:
* Alexander J. McCaskey - initial API and implementation
*******************************************************************************/
#include "Z.hpp"
namespace xacc {
namespace quantum {
Z::Z(std::vector<int> qbit) :
GateInstruction("Z", qbit) {
}
Z::Z(int qbit) :
Z(std::vector<int> { qbit }) {
}
RegisterGateInstruction<Z> ZTEMP("Z");
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment