Octomind
Same model as opencode, same endpoint, same prices — octomind solved 24/25 to its 19/25, at half the cost. Open-source agent runtime: one binary, any model, runs unattended in CI. Apache 2.0.
Multidiagonal sparse operator algebra for C++QED
Translation pending
Developer toolsC++ · PythonGitHub @WignerQuantumOpticsOnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
Owners of public repositories under a personal GitHub account can sign in to verify ownership and manage the introduction themselves. No administrator approval is needed.
Sign in, generate a verification file, and commit it to this repository’s default branch within 30 minutes. Files on other branches or forks do not count. Then check the file below to manage the project without administrator approval. Keep the file to retain your access.
If needed, you will go to sign-in. After signing in, return here and press your chosen verification button again.
Run /nomorevibe verify in your project folder to verify ownership and manage the introduction yourself.
Verify in one minuteAsk about other verification options
The maker's introduction consists of the line above. Read the repository README for more details. Repository README ↗
Loading the full README.
Read the full README ↗A header-only C++ library implementing sparse multidiagonal operator algebra for quantum systems of arbitrary arity, extracted from the C++QED framework.
A multidiagonal operator over a Hilbert space of dimension $N$ is a sparse matrix storing an arbitrary set of diagonals at arbitrary offsets. In the context of quantum optics and cavity QED, Hamiltonians and jump operators naturally take this form. For example, the harmonic oscillator ladder operators $a$, $a^\dagger$ are single off-diagonals; number operators $a^\dagger a$ are main diagonals, and so is the Kerr term $(a^\dagger)^2 a^2 = a^\dagger a,(a^\dagger a - 1)$; two-photon terms like $a^2$ sit two diagonals off the main one.
For a composite system of $R$ subsystems, MultiDiagonal<RANK> stores an operator of the form
$$A = \sum_{\mathbf{o} \in \mathbb{K}} \sum_{\mathbf{n}} \alpha^{\mathbf{o}}_{\mathbf{n}} \left|\mathbf{n}\right\rangle\left\langle \mathbf{n}+\mathbf{o}\right|$$
with $\mathbb{K} \subset \mathbb{Z}^R$ an arbitrary set of signed offset vectors, one entry per subsystem axis, and $\mathbf{n}$ running over the multi-indices for which both $\mathbf{n}$ and $\mathbf{n}+\mathbf{o}$ lie in the truncated Hilbert space. A positive entry thus means an upper diagonal on that axis. The coefficients need not factorize over the subsystems; direct products, built with operator*, are the special case where they do.
Each diagonal is keyed by a signed offset per axis — positive = upper, negative = lower, zero = main diagonal. The offset counts the quanta a diagonal moves along each axis, and the algebra reduces to arithmetic on these counts:
The diagonal at signed offset $o$ (per axis, dimension $D$) has extent $D-|o|$, and entry $k$ holds the matrix element $A_{k+o^-,,k+o^+}$ with $o^\pm=\max(\pm o,0)$. This min(row,col)-anchored storage is symmetric under transposition, which is what makes conjugation a pure key negation. Application to a state vector costs $O(N \cdot d)$ for $d$ diagonals; composition runs over the $d_A \cdot d_B$ diagonal pairs, each in one pass over the window where the two diagonals overlap.
Tridiagonal?The predecessor class Tridiagonal<RANK> in C++QED v2 stored exactly three diagonals per axis — at positions $-K$, $0$, $+K$ for a single shared offset $K$ — and was not closed under composition: the product of two tridiagonal operators is in general pentadiagonal, and with different offsets is not tridiagonal at all. MultiDiagonal lifts all these restrictions — any number of diagonals at independent arbitrary offsets, and the operator algebra is closed under composition (operator|), direct product (operator*), addition, and Hermitian conjugation.
The truncated algebra is represented exactly, including its physical deviations from the untruncated one: e.g. $[a,a^\dagger]$ at cutoff $D$ is $\mathrm{diag}(1,\ldots,1,1-D)$, not $\mathbb{1}$ — as it must be for any finite-dimensional representation.
MultiDiagonal<RANK> for any compile-time arity $M$, including composition at arbitrary rankcopy)tag_invoke, useful for testing and debuggingOn the reference machine (Intel Core i7-7700, GCC 16, Eigen 5.0.1), with the operator in cache, applying a MultiDiagonal is:
These figures are for the default build of both. The speed-up depends on the processor: on a 2022 laptop core it was 1.5–2.4× and 1.0–1.6×. -fcx-limited-range makes Eigen 10–17% faster and leaves the library unchanged, since its kernel multiplies in real arithmetic. Before the application loop was rewritten (#1, #23), the Jaynes–Cummings coupling was 3.4–4.5× slower than Eigen.
For operators as large as the state, the library is between 1.5× faster and 1.45× slower than Eigen. Once both sides are limited by memory bandwidth, no format gains much over a sparse matrix. What still holds the library back is its loop shape, one diagonal at a time with a store to the output for each:
That is a matter of the loop, not of the representation.
Measurements, causes and outlook, including what is not yet measured (the interaction picture): Performance of MultiDiagonal.
include/ to the include path and writing #include <multidiagonal/MultiDiagonal.h>)The library itself is header-only — nothing to build. Configuring and building compiles the test suite:
cmake -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build
ctest --test-dir build --output-on-failure
(Debug enables the library's bounds and dimension checks, which the test suite exercises; CI runs the Debug×Release matrix on GCC and Clang.)
include(FetchContent)
FetchContent_Declare(cppqed-multidiagonal
GIT_REPOSITORY https://github.com/WignerQuantumOptics/cppqed-multidiagonal.git
GIT_TAG <full commit SHA of a release>
FIND_PACKAGE_ARGS 0.4) # an installed version is used when found
FetchContent_MakeAvailable(cppqed-multidiagonal)
target_link_libraries(MyTarget PUBLIC cppqed::multidiagonal)
A copy of the source tree in your project works too, via add_subdirectory.
find_package (after installation)cmake --install build
find_package(cppqed-multidiagonal REQUIRED)
target_link_libraries(MyTarget PUBLIC cppqed::multidiagonal)
Either way, the headers are included with their directory prefix, e.g. #include <multidiagonal/MultiDiagonal.h>.
include/multidiagonal/
Traits.h — FWD, Boost.Hana/JSON setup, passByValue_v, ReferenceMF
MultiArray.h — generic rank-N array with strided view
MultiArrayComplex.h — dcomp specializations, directProduct, Eigen interop
MultiDiagonal.h — multidiagonal operator algebra (incl. identity and composition)
tests/
testMultiArray.cc, testMultiArrayComplex.cc, testMultiDiagonal.cc
consumer/ — downstream project used by CI (find_package and FetchContent)
benchmarks/
benchmarkMultiDiagonal.cc, plot.py — comparison with Eigen sparse and dense
kernels.cc — application loop experiments (built with and without -fcx-limited-range)
performance.md — measurements, causes and outlook
cmake/
cppqed-multidiagonalConfig.cmake.in
Doxyfile, doxygen-math.sed — API docs; this README is their main page
Distributed under the Boost Software License, Version 1.0.
András Vukics — extracted from C++QED, originally developed 2006–2026.