Guides Quick Start - kennetholsenatm-gif/q_mini_wasm_v2 GitHub Wiki
This guide will help you get started with the q_mini_wasm_v2 framework in minutes.
Before you begin, ensure you have:
- C++17 Compiler: GCC 7+, Clang 5+, or MSVC 2017+
- CMake: Version 3.14 or higher
- Git: For cloning the repository
git clone https://github.com/kennetholsenatm-gif/q_mini_wasm_v2.git
cd q_mini_wasm_v2/q_mini_wasm_v2mkdir build
cd build
cmake ..
cmake --build .mkdir build
cd build
cmake -DBUILD_TESTS=ON ..
cmake --build .mkdir build
cd build
cmake -DUSE_SYCL=ON ..
cmake --build .Run the test suite to ensure everything is working:
cd build
ctest --output-on-failureYou should see output indicating all tests passed.
Let’s create a simple program that demonstrates the core concepts of q_mini_wasm_v2.
Create a file named hello_ternary.cpp:
#include <iostream>
#include <vector>
#include "q_mini_wasm_v2/core/ternary/trit.hpp"
#include "q_mini_wasm_v2/core/stabilizer/tableau.hpp"
#include "q_mini_wasm_v2/core/moe/router.hpp"
using namespace q_mini_wasm_v2;
int main() {
std::cout << "Hello, Ternary World!" << std::endl;
// ... (truncated)
// See source for complete code# Navigate to build directory if not already there
cd build
# Compile (adjust include paths as needed)
g++ -std=c++17 -I../q_mini_wasm_v2 -o hello_ternary ../hello_ternary.cpp./hello_ternaryExpected output:
Hello, Ternary World!
a = 1
b = -1
a + b = 0
a * b = -1
Created 2-qutrit tableau with entanglement
Measurement result: 0
-
a = 1(POSITIVE) -
b = -1(NEGATIVE) -
a + b = 0(1 + (-1) = 0 in GF(3)) -
a * b = -1(1 * (-1) = -1 in GF(3))
- Created a 2-qutrit tableau
- Applied Hadamard gate to put qutrit 0 in superposition
- Applied Controlled-SUM to entangle qutrits 0 and 1
- Measured qutrit 0, collapsing the entangled state
Now that you have a basic understanding, explore these topics:
- Ternary State Space: Understand GF(3) arithmetic and trit encoding
- Stabilizer Tableau: Learn about Clifford gates and quantum-inspired operations
- MoE Routing: Explore tropical geometry and expert selection
// Example: MoE Routing
core::moe::ExpertConfig config{8, 2, 4}; // 8 experts, Top-2, 4 routing qutrits
auto router = core::moe::create_moe_router(config);
std::vector<core::ternary::Trit> input = {
core::ternary::Trit::POSITIVE,
core::ternary::Trit::ZERO,
core::ternary::Trit::NEGATIVE,
core::ternary::Trit::POSITIVE
};
auto selected_experts = router->route_topk(input);
std::cout << "Selected " << selected_experts.size() << " experts" << std::endl;- Forward-Forward Learning: Train networks without backpropagation
- SYCL Acceleration: Enable GPU acceleration for parallel operations
- Runtime Orchestration: Use async task execution
Solution: Ensure you have a C++17 compiler installed:
- Windows: Install Visual Studio 2017+ or MinGW-w64
- Linux: Install GCC 7+ (
sudo apt install g++-7) - macOS: Install Xcode Command Line Tools
Solution: Update CMake to version 3.14+:
# Ubuntu/Debian
sudo apt remove cmake
sudo snap install cmake --classic
# macOS
brew upgrade cmakeSolution: Ensure you built with tests enabled:
cmake -DBUILD_TESTS=ON ..
cmake --build .
ctest --output-on-failureIf you encounter issues:
- Check the Architecture Overview
- Review the [API Reference](API-Core Reference.md)
- Consult the Build Guide
- Open an issue on GitHub
Continue your learning journey:
- Architecture Overview - Understand the system design
- [API Reference](API-Core Reference.md) - Complete API documentation
- Build Guide - Detailed build instructions
- Contributing Guide - How to contribute