Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
99a1e9e
Added heap profiling to sparse example
Nov 11, 2025
90c0c27
Started writing bitset
Nov 11, 2025
3bcff51
Implemented Bitset and BitVector
Nov 25, 2025
46b4a82
Started implementing RepresentativeLookupTable
Nov 25, 2025
61cca1c
made some progress
Dec 2, 2025
5ef5356
switched to safe combinations iterator
Dec 3, 2025
7d85a09
style: remove extra blank line in bitset.hpp
Feb 2, 2026
4d89639
improved bitset and bitvector classes
Feb 3, 2026
7d707a6
merged
Feb 3, 2026
d885a87
Merge branch 'main' into memory
awietek Feb 3, 2026
908205a
Added test for normal ordering
Feb 4, 2026
bf8ec18
Removed clutter
Feb 7, 2026
020b8b8
Latest update
Feb 9, 2026
44462f9
Added Implementation for Bitarray
Feb 18, 2026
a9391a1
merge
Feb 18, 2026
a3243b3
Merge branch 'main' into memory
awietek Feb 18, 2026
d8cc2b2
Added BoundedMultisets
Feb 18, 2026
da63d1f
added combinatorics benchmark
Feb 19, 2026
93504e5
finished basic bounded partitions and subsets
Feb 20, 2026
de6caa7
Finished implementing elementary enumeration classes: Subsets, Combin…
Feb 23, 2026
5866553
Added a few more tests
Feb 23, 2026
1f990c4
Implemented Schaefer table
Feb 23, 2026
3ffe8d4
Implemented basic Basis dispatch
Feb 24, 2026
96ff68a
changed apply dispatch to shared pointers
Feb 24, 2026
361e119
Cleaned up, and updated armadillo version to 12.8.4
Feb 25, 2026
2a1d88b
merge
Feb 25, 2026
d6810d7
Added rewrite system for OpSums
Feb 25, 2026
c84082f
Started generic dispatch for Spinhalf
Feb 26, 2026
a31961f
added instantiation group system to CMake
Feb 27, 2026
24f3be5
Cleaned up instantiation macros
Feb 27, 2026
79ec477
trying to get first ed run working
Mar 2, 2026
bea1f54
added algebra normal_ordering system
Mar 3, 2026
fa2b1cc
started restructuring dispatch mechanisms
Mar 4, 2026
aa5caa3
got new dispatch mechanism working
Mar 5, 2026
803d655
Thinned out dispatch code for apply/matrix
Mar 6, 2026
a0f33a0
finalized matrix dispatch also for sparse matrices
Mar 6, 2026
f227273
finished up sparse apply function for CSR matrices
Mar 6, 2026
848b78d
Started implementing symmetries afresh
Mar 8, 2026
2402abe
Fixed tests of Permutation, PermutationGroup and Representation
Mar 9, 2026
8f1d89f
Added SitePermutations
Mar 9, 2026
b354427
Fixed bug with bitset dynamic permutations, added io tests again
Mar 9, 2026
4822f7d
redesigned bitvector
Mar 10, 2026
f4b242f
first serial implementation of representative_table
Mar 11, 2026
7cbb6ee
inlined a fill function from constexpr
Mar 11, 2026
7b2870f
finished properly parallelizing representative_table
Mar 12, 2026
05a3d39
Fixed cmake issues
Mar 12, 2026
9d00f95
removed a warning
Mar 12, 2026
1017034
replaced exclusive_scan with partial_sum to comply with older compilers
Mar 12, 2026
53410c4
Fixed MKL long long issue, wrote RepresentativeTable benchmark
Mar 12, 2026
804cb73
Small change to get_set_bit.hpp
Apr 15, 2026
bb970f0
Finished BasisSymmetric class
May 2, 2026
7639ec2
got the spinhaf symmetric kernels implemented and compiling
May 4, 2026
3f637d0
Added symmetric Spinhalf constructors
May 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ run.sh
build
build_julia_wrapper.sh
*.prof
*.heap
heap.pdf
*.prof.pdf
*/build/*
install
Expand Down
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.19)

project(
xdiag
VERSION 0.4.1
VERSION 0.5.0
LANGUAGES CXX
)

Expand All @@ -28,7 +28,13 @@ message(STATUS "Compiler version: " ${CMAKE_CXX_COMPILER_VERSION})

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
include("cmake/sources.cmake")
include("cmake/instantiations.cmake")

detect_grouped_sources(
"${XDIAG_SOURCES}"
XDIAG_GROUPED_SOURCES
XDIAG_NORMAL_SOURCES
)

# Set release build as default
if(NOT CMAKE_BUILD_TYPE)
Expand Down
5 changes: 5 additions & 0 deletions benchmarks/bitset/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 3.19)
project(benchmark_heisenberg_chain)
find_package(xdiag REQUIRED HINTS "~/Research/Software/xdiag/install")
add_executable(main main.cpp)
target_link_libraries(main PRIVATE xdiag::xdiag)
30 changes: 30 additions & 0 deletions benchmarks/bitset/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include <xdiag/utils/timing.hpp>
#include <xdiag/bits/bitset.hpp>
#include <xdiag/combinatorics/combinations/combinations.hpp>

using namespace xdiag;

int main() try {
using combinatorics::Combinations;
using bits::Bitset;

int n = 34;
int k = 6;
int64_t cnt1 = 0;
tic();
for (auto s : Combinations<uint64_t>(n, k)) {
++cnt1;
}
toc();

int64_t cnt2 = 0;
tic();
for (auto s : Combinations<Bitset<uint16_t, 4>>(n, k)) {
++cnt2;
}
toc();
Log("{} {}", cnt1, cnt2);

} catch (Error e) {
error_trace(e);
}
15 changes: 15 additions & 0 deletions benchmarks/bitset/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### MEMORY PROFILE ###
- compile xdiag using

cmake -S . -B build -D CMAKE_CXX_COMPILER=icpx -D CMAKE_CXX_FLAGS="-L/home/awietek/Research/Software/gperftools/build -ltcmalloc -g"

- install xdiag
- compile application using

cmake -S . -B build -D CMAKE_CXX_COMPILER=icpx -D CMAKE_CXX_FLAGS="-L/home/awietek/Research/Software/gperftools/build -ltcmalloc -g"

- run using
HEAPPROFILE=heap ./build/main 28

- visualize using
pprof --pdf ./build/main heap.0001.heap > heap.pdf
5 changes: 5 additions & 0 deletions benchmarks/combinatorics/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 3.19)
project(benchmark_heisenberg_chain)
find_package(xdiag REQUIRED HINTS "~/Research/Software/xdiag/install")
add_executable(main main.cpp)
target_link_libraries(main PRIVATE xdiag::xdiag)
194 changes: 194 additions & 0 deletions benchmarks/combinatorics/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
#include <xdiag/bits/bitarray.hpp>
#include <xdiag/bits/bitset.hpp>
#include <xdiag/bits/to_string.hpp>
#include <xdiag/combinatorics/bounded_multisets/bounded_multisets.hpp>
#include <xdiag/combinatorics/bounded_partitions/bounded_partitions.hpp>
#include <xdiag/combinatorics/bounded_partitions/schaefer_table.hpp>
#include <xdiag/combinatorics/combinations/combinations.hpp>
#include <xdiag/combinatorics/combinations/lin_table.hpp>
#include <xdiag/combinatorics/subsets/subsets.hpp>
#include <xdiag/utils/timing.hpp>

using namespace xdiag;

int main() try {
using namespace xdiag::bits;
using namespace xdiag::combinatorics;

constexpr bool time_index = false;

// Subsets
{
int n = 16;
int64_t cnt = 0;
auto subs = Subsets<uint64_t>(n);
auto t0 = rightnow();
for (auto s : subs) {
if constexpr (time_index)
if (subs.index(s) != cnt) {
Log("{} {}", to_string(s, n), subs.index(s));
}
++cnt;
// Log("{}", to_string(make_bitset(s), n));
}
auto t1 = rightnow();
auto td = duration_cast<microseconds>(t1 - t0).count();
double t = (double)td;
Log("Subsets: {} {} {} ", cnt, t, t / cnt);
}

// Combinations
{
int n = 24;
int k = 12;
int64_t cnt = 0;
auto combs = Combinations<uint64_t>(n, k);
auto t0 = rightnow();
for (auto s : combs) {
if constexpr (time_index)

if (combs.index(s) != cnt) {
Log("{} {}", to_string(s, n), combs.index(s));
}
++cnt;
// Log("{}", to_string(make_bitset(s), n));
}
auto t1 = rightnow();
auto td = duration_cast<microseconds>(t1 - t0).count();
double t = (double)td;
Log("Combinations (short): {} {} {} ", cnt, t, t / cnt);
}

// LinTable
{
int n = 24;
int k = 12;
int64_t cnt = 0;
auto combs = LinTable<uint64_t>(n, k);
auto t0 = rightnow();
for (auto s : combs) {
if constexpr (time_index)

if (combs.index(s) != cnt) {
Log("{} {}", to_string(s, n), combs.index(s));
}
++cnt;
// Log("{}", to_string(make_bitset(s), n));
}
auto t1 = rightnow();
auto td = duration_cast<microseconds>(t1 - t0).count();
double t = (double)td;
Log("LinTable: {} {} {} ", cnt, t, t / cnt);
}

{
int n = 80;
int k = 4;
int64_t cnt = 0;
auto combs = Combinations<Bitset<uint64_t, 2>>(n, k);
auto t0 = rightnow();
for (auto s : combs) {
if constexpr (time_index)

if (combs.index(s) != cnt) {
Log("{} {}", to_string(s, n), combs.index(s));
}
++cnt;
// Log("{}", to_string(s, n));
}
auto t1 = rightnow();
auto td = duration_cast<microseconds>(t1 - t0).count();
double t = (double)td;
Log("Combinations (long): {} {} {} ", cnt, t, t / cnt);
}

{
int64_t n = 12;
int64_t q = 4;
int64_t cnt = 0;
using A = BitArray<uint64_t, 2>;
auto bms = BoundedMultisets<A>(n, q);
auto t0 = rightnow();
for (auto s : bms) {
if constexpr (time_index)

if (bms.index(s) != cnt) {
Log("{} {}", to_string(s, n), bms.index(s));
}
++cnt;
// Log("{}", to_string(s, n));
}
auto t1 = rightnow();
auto td = duration_cast<microseconds>(t1 - t0).count();
double t = (double)td;
Log("BoundedMultisets: {} {} {} ", cnt, t, t / cnt);
}

{
int64_t n = 12;
int64_t total = 12;
int64_t q = 4;
int64_t cnt = 0;
using A = BitArray<uint64_t, 2>;
auto bps = BoundedPartitions<A>(n, total, q);
auto t0 = rightnow();
for (auto s : bps) {
if constexpr (time_index)
if (bps.index(s) != cnt) {
Log("{} {}", to_string(s, n), bps.index(s));
}
++cnt;
}
auto t1 = rightnow();
auto td = duration_cast<microseconds>(t1 - t0).count();
double t = (double)td;
Log("BoundedPartitions (short): {} {} {} ", cnt, t, t / cnt);
}


{
int64_t n = 50;
int64_t total = 4;
int64_t q = 4;
int64_t cnt = 0;
using A = BitArray<BitsetStatic2, 2>;
auto bps = BoundedPartitions<A>(n, total, q);
auto t0 = rightnow();
for (auto s : bps) {
if constexpr (time_index)
if (bps.index(s) != cnt) {
Log("{} {}", to_string(s, n), bps.index(s));
}
++cnt;
}
auto t1 = rightnow();
auto td = duration_cast<microseconds>(t1 - t0).count();
double t = (double)td;
Log("BoundedPartitions (long): {} {} {} ", cnt, t, t / cnt);
}


{
int64_t n = 12;
int64_t total = 12;
int64_t q = 4;
int64_t cnt = 0;
using A = BitArray<uint64_t, 2>;
auto bps = SchaeferTable<A>(n, total, q);
auto t0 = rightnow();
for (auto s : bps) {
if constexpr (time_index)
if (bps.index(s) != cnt) {
Log("{} {}", to_string(s, n), bps.index(s));
}
++cnt;
}
auto t1 = rightnow();
auto td = duration_cast<microseconds>(t1 - t0).count();
double t = (double)td;
Log("SchaeferTable: {} {} {} ", cnt, t, t / cnt);
}

} catch (Error e) {
error_trace(e);
}
15 changes: 15 additions & 0 deletions benchmarks/combinatorics/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### MEMORY PROFILE ###
- compile xdiag using

cmake -S . -B build -D CMAKE_CXX_COMPILER=icpx -D CMAKE_CXX_FLAGS="-L/home/awietek/Research/Software/gperftools/build -ltcmalloc -g"

- install xdiag
- compile application using

cmake -S . -B build -D CMAKE_CXX_COMPILER=icpx -D CMAKE_CXX_FLAGS="-L/home/awietek/Research/Software/gperftools/build -ltcmalloc -g"

- run using
HEAPPROFILE=heap ./build/main 28

- visualize using
pprof --pdf ./build/main heap.0001.heap > heap.pdf
5 changes: 5 additions & 0 deletions benchmarks/representative_table/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 3.19)
project(benchmark_heisenberg_chain)
find_package(xdiag REQUIRED HINTS "~/Research/Software/xdiag/install")
add_executable(main main.cpp)
target_link_libraries(main PRIVATE xdiag::xdiag)
25 changes: 25 additions & 0 deletions benchmarks/representative_table/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include <xdiag/combinatorics/combinations/combinations.hpp>
#include <xdiag/symmetries/action/site_permutation.hpp>
#include <xdiag/symmetries/cyclic_group.hpp>
#include <xdiag/symmetries/tables/representative_table.hpp>
#include <xdiag/utils/timing.hpp>

using namespace xdiag;

int main() try {
using bits::Bitset;
using combinatorics::Combinations;
using namespace symmetries;

int n = 36;
int k = 18;
auto combs = Combinations<uint64_t>(n, k);
auto irrep = cyclic_group_irrep(n, 0); // trivial: all chi=1
auto sp = SitePermutation(irrep.group());
tic();
auto table = RepresentativeTable<Combinations<uint64_t>>(combs, sp, irrep);
toc();

} catch (Error e) {
error_trace(e);
}
15 changes: 15 additions & 0 deletions benchmarks/representative_table/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### MEMORY PROFILE ###
- compile xdiag using

cmake -S . -B build -D CMAKE_CXX_COMPILER=icpx -D CMAKE_CXX_FLAGS="-L/home/awietek/Research/Software/gperftools/build -ltcmalloc -g"

- install xdiag
- compile application using

cmake -S . -B build -D CMAKE_CXX_COMPILER=icpx -D CMAKE_CXX_FLAGS="-L/home/awietek/Research/Software/gperftools/build -ltcmalloc -g"

- run using
HEAPPROFILE=heap ./build/main 28

- visualize using
pprof --pdf ./build/main heap.0001.heap > heap.pdf
15 changes: 15 additions & 0 deletions benchmarks/sparse/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### MEMORY PROFILE ###
- compile xdiag using

cmake -S . -B build -D CMAKE_CXX_COMPILER=icpx -D CMAKE_CXX_FLAGS="-L/home/awietek/Research/Software/gperftools/build -ltcmalloc -g"

- install xdiag
- compile application using

cmake -S . -B build -D CMAKE_CXX_COMPILER=icpx -D CMAKE_CXX_FLAGS="-L/home/awietek/Research/Software/gperftools/build -ltcmalloc -g"

- run using
HEAPPROFILE=heap ./build/main 28

- visualize using
pprof --pdf ./build/main heap.0001.heap > heap.pdf
17 changes: 17 additions & 0 deletions cmake/generate_instantiation.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Script-mode entry point for build-time instantiation file generation.
#
# Invoked by add_custom_command as:
# cmake -DSOURCE_FILE=<abs>
# -DSOURCE_ROOT=<abs>
# -DINCLUDE_ROOT=<abs>
# -DOUTPUT_DIR=<abs>
# -P generate_instantiation.cmake

include("${CMAKE_CURRENT_LIST_DIR}/instantiations.cmake")

generate_instantiation_files(
"${SOURCE_FILE}"
"${SOURCE_ROOT}"
"${INCLUDE_ROOT}"
"${OUTPUT_DIR}"
)
Loading
Loading