Initial quantum compute and cleaning up win server.
This commit is contained in:
parent
af50eea208
commit
5362b694e0
45 changed files with 884 additions and 429 deletions
12
plugins/quantum_computing/src/BlochSphere.cpp
Normal file
12
plugins/quantum_computing/src/BlochSphere.cpp
Normal file
|
@ -0,0 +1,12 @@
|
|||
#include "BlochSphere.h"
|
||||
|
||||
BlochSphere::BlochSphere(const Qubit& state)
|
||||
: mState(state)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
const Qubit& BlochSphere::getState() const
|
||||
{
|
||||
return mState;
|
||||
}
|
13
plugins/quantum_computing/src/BlochSphere.h
Normal file
13
plugins/quantum_computing/src/BlochSphere.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
#include "Qubit.h"
|
||||
|
||||
class BlochSphere
|
||||
{
|
||||
public:
|
||||
BlochSphere(const Qubit& state);
|
||||
|
||||
const Qubit& getState() const;
|
||||
private:
|
||||
Qubit mState;
|
||||
};
|
30
plugins/quantum_computing/src/CMakeLists.txt
Normal file
30
plugins/quantum_computing/src/CMakeLists.txt
Normal file
|
@ -0,0 +1,30 @@
|
|||
set(PLUGIN_NAME quantum_computing)
|
||||
|
||||
list(APPEND quantum_computing_HEADERS
|
||||
QuantumCircuit.h
|
||||
BlochSphere.h
|
||||
QuantumState.h
|
||||
Qubit.h
|
||||
QuantumGate.h
|
||||
QuantumOperator.h
|
||||
visuals/BlochSphereNode.h
|
||||
)
|
||||
|
||||
list(APPEND quantum_computing_LIB_INCLUDES
|
||||
QuantumCircuit.cpp
|
||||
BlochSphere.cpp
|
||||
QuantumState.cpp
|
||||
Qubit.cpp
|
||||
QuantumGate.cpp
|
||||
QuantumOperator.cpp
|
||||
visuals/BlochSphereNode.cpp
|
||||
)
|
||||
|
||||
add_library(${PLUGIN_NAME} SHARED ${quantum_computing_LIB_INCLUDES} ${quantum_computing_HEADERS})
|
||||
|
||||
target_include_directories(${PLUGIN_NAME} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/visuals
|
||||
)
|
||||
target_link_libraries(${PLUGIN_NAME} PUBLIC core visual_elements ntk_math)
|
||||
set_property(TARGET ${PLUGIN_NAME} PROPERTY FOLDER plugins)
|
0
plugins/quantum_computing/src/QuantumCircuit.cpp
Normal file
0
plugins/quantum_computing/src/QuantumCircuit.cpp
Normal file
0
plugins/quantum_computing/src/QuantumCircuit.h
Normal file
0
plugins/quantum_computing/src/QuantumCircuit.h
Normal file
0
plugins/quantum_computing/src/QuantumGate.cpp
Normal file
0
plugins/quantum_computing/src/QuantumGate.cpp
Normal file
0
plugins/quantum_computing/src/QuantumGate.h
Normal file
0
plugins/quantum_computing/src/QuantumGate.h
Normal file
0
plugins/quantum_computing/src/QuantumOperator.cpp
Normal file
0
plugins/quantum_computing/src/QuantumOperator.cpp
Normal file
0
plugins/quantum_computing/src/QuantumOperator.h
Normal file
0
plugins/quantum_computing/src/QuantumOperator.h
Normal file
0
plugins/quantum_computing/src/QuantumState.cpp
Normal file
0
plugins/quantum_computing/src/QuantumState.cpp
Normal file
0
plugins/quantum_computing/src/QuantumState.h
Normal file
0
plugins/quantum_computing/src/QuantumState.h
Normal file
18
plugins/quantum_computing/src/Qubit.cpp
Normal file
18
plugins/quantum_computing/src/Qubit.cpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "Qubit.h"
|
||||
|
||||
Qubit::Qubit(const ComplexNumber& alpha, const ComplexNumber& beta)
|
||||
: mAlpha(alpha),
|
||||
mBeta(beta)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
const ComplexNumber& Qubit::getAlpha() const
|
||||
{
|
||||
return mAlpha;
|
||||
}
|
||||
|
||||
const ComplexNumber& Qubit::getBeta() const
|
||||
{
|
||||
return mBeta;
|
||||
}
|
16
plugins/quantum_computing/src/Qubit.h
Normal file
16
plugins/quantum_computing/src/Qubit.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
#include "ComplexNumber.h"
|
||||
|
||||
class Qubit
|
||||
{
|
||||
public:
|
||||
Qubit(const ComplexNumber& alpha, const ComplexNumber& beta);
|
||||
|
||||
const ComplexNumber& getAlpha() const;
|
||||
|
||||
const ComplexNumber& getBeta() const;
|
||||
private:
|
||||
ComplexNumber mAlpha;
|
||||
ComplexNumber mBeta;
|
||||
};
|
40
plugins/quantum_computing/src/visuals/BlochSphereNode.cpp
Normal file
40
plugins/quantum_computing/src/visuals/BlochSphereNode.cpp
Normal file
|
@ -0,0 +1,40 @@
|
|||
#include "BlochSphereNode.h"
|
||||
|
||||
#include "CircleNode.h"
|
||||
|
||||
BlochSphereNode::BlochSphereNode(const DiscretePoint& location)
|
||||
: AbstractVisualNode(location, "BlochSphereNode")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BlochSphereNode::setContent(BlochSphere* content)
|
||||
{
|
||||
mContent = content;
|
||||
mContentDirty = true;
|
||||
}
|
||||
|
||||
void BlochSphereNode::setSize(double size)
|
||||
{
|
||||
if (size != mSize)
|
||||
{
|
||||
mSize = size;
|
||||
mContentDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
void BlochSphereNode::update(FontsManager* fontsManager)
|
||||
{
|
||||
if (!mContentDirty)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
mChildren.clear();
|
||||
|
||||
auto loc = DiscretePoint(mSize / 2.0, mSize / 2.0);
|
||||
mOuterCircle = std::make_unique<CircleNode>(loc, mSize/2.0);
|
||||
|
||||
addChild(mOuterCircle.get());
|
||||
|
||||
}
|
34
plugins/quantum_computing/src/visuals/BlochSphereNode.h
Normal file
34
plugins/quantum_computing/src/visuals/BlochSphereNode.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
#pragma once
|
||||
|
||||
#include "AbstractVisualNode.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
class BlochSphere;
|
||||
class CircleNode;
|
||||
class LineNode;
|
||||
|
||||
class BlochSphereNode : public AbstractVisualNode
|
||||
{
|
||||
public:
|
||||
BlochSphereNode(const DiscretePoint& location);
|
||||
|
||||
void setContent(BlochSphere* content);
|
||||
|
||||
void update(FontsManager* fontsManager) override;
|
||||
|
||||
void setSize(double size);
|
||||
private:
|
||||
double mSize{ 1.0 };
|
||||
bool mContentDirty{ true };
|
||||
BlochSphere* mContent{ nullptr };
|
||||
|
||||
std::unique_ptr<CircleNode> mOuterCircle;
|
||||
std::unique_ptr<CircleNode> mInnerCircle;
|
||||
std::unique_ptr<CircleNode> mCentreCircle;
|
||||
std::unique_ptr<CircleNode> mStateMarkerCircle;
|
||||
std::unique_ptr<LineNode> mXAxis;
|
||||
std::unique_ptr<LineNode> mYAxis;
|
||||
std::unique_ptr<LineNode> mZAxis;
|
||||
std::unique_ptr<LineNode> mStateVector;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue