Skip to content

Releases: krivenko/libcommute

Release v1.0.0

Choose a tag to compare

@krivenko krivenko released this 06 Dec 16:29

New major features in this release:

  • Better support for user-defined scalar types in expression. In particular, it is now possible to use integer-like and rational-like numeric types. Possible incompatibility of a scalar type with a certain algebra generator (e.g. spin operators vs an integer scalar) is checked at runtime. This is achieved by storing the structure constants of the algebra in the tagged union type var_number, which retains information about the category of the stored value (integer, rational or floating point). The compatibility is then checked in the trait method scalar_traits<ScalarType>::make_const(var_number const& vn).

  • Added optional support for boost::rational and GMP C++ types mpz_class, mpq_class, mpf_class as ScalarType.

  • generator and derived classes no longer use the 'virtual copy-constructor' pattern: The virtual clone() method has been removed. Instead, generator is now derived from std::enable_shared_from_this, and instances of the generator classes are managed by shared pointers. This change leads to significant memory savings and speedups when working with long expressions.

  • Introduction of sparse Hilbert spaces. A sparse Hilbert space contains at least one elementary space with a non-power-of-two dimension (for example, the state space of an $S=1$ spin). This change is reflected in the API:

    • New pure virtual method elementary_space::dim() and its implementation in derived classes.
    • New method hilbert_space::is_sparse().
    • New method hilbert_space::vec_size() that returns the minimal size of a state vector compatible with this Hilbert space. The returned size is always a power of 2.
    • Semantics of the existing method hilbert_space::dim() has been changed: Now it returns the exact dimension of the Hilbert space, which is smaller than hilbert_space::vec_size() if the Hilbert space is sparse.
    • The free function foreach(hilbert_space const& hs, Functor&& f) now iterates over only the physical basis states instead of all
      hs.vec_size() basis state indices.
  • New class compressed_state_view. It implements a view of a compressed state vector (continuous array) storing only the amplitudes corresponding to the physical basis states of a sparse Hilbert space.

  • Dimension of elementary_space_boson had to be a power of 2. This restriction is lifted. Arguments of its constructor and of
    make_space_boson() have been adjusted accordingly.

  • n_fermion_sector_view and n_fermion_multisector_view are now parameterized on the type of ranking algorithm used to map basis state indices from a full Hilbert space to a sector. Supported ranking algorithms are combination_ranking (selected by default), staggered_ranking and trie_ranking. All three algorithms are described in M. Wallerberger, K. Held, Phys. Rev. Research 4, 033238 (2022).

  • Changed space_partition to store a constant reference to the Hilbert space being partitioned. This change is necessary to enable support for the sparse hilbert_space objects. space_partition is now templated on the Hilbert space type, whereas its constructors are not.

  • Whenever possible, use compiler intrinsics to speed up complex bit manipulation operations (popcount, tzcount, pdep, pext).

  • Improved performance and stability of space_partition::merge_subspaces() by switching to a non-recursive variant of the algorithm.

  • A conda package is now being provided.

For an exhaustive list of changes see the Changelog.

Release v0.7.2

Choose a tag to compare

@krivenko krivenko released this 12 Nov 14:05
  • Export namespaced CMake target libcommute::libcommute instead of plain libcommute.
  • Install CMake configuration files into ${CMAKE_INSTALL_PREFIX}/lib/cmake/libcommute, which is the recommended location.
  • Upgraded bundled Catch2 to version 2.13.9 (this fixes issue #2 a.k.a. catchorg/Catch2#2178).
  • Fixed compilation with clang/libc++ 15 (issue #5).
  • Added project citation information.

Release v0.7.1

Choose a tag to compare

@krivenko krivenko released this 17 Dec 11:21
  • New methods space_partition::subspace_basis() and space_partition::subspace_bases().
  • New methods sparse_state_vector::prune() (two overloads).
  • New example hubbard_holstein_1d and minor updates to the documentation.

Release v0.7.0

Choose a tag to compare

@krivenko krivenko released this 09 Oct 12:36
  • Added an implementation of the StateVector concept for some Eigen 3 types (vectors, vector segments,
    column-like matrix blocks and one-dimensional Eigen::Map views). The corresponding header file is loperator/state_vector_eigen3.hpp.
  • New classes n_fermion_sector_view and n_fermion_multisector_view that implement N-fermion (multi)sector views of a state vector. The classes are supplemented with free utility functions make_nf(m)s_view(), make_const_nf(m)s_view(), n_fermion_(multi)sector_size() and n_fermion_(multi)sector_basis_states().
  • New member typedef hilbert_space::index_types.
  • New method hilbert_space::has_algebra().
  • New method space_partition::find_connections().
  • Renamed the constexpr integer LIBCOMMUTE_MIN_USER_DEFINED_ALGEBRA_ID to min_user_defined_algebra_id so that it does not appear to be a macro.
  • In the 3-argument constructor of basis_mapper, change the type of the last argument N from int to unsigned int.
  • Removed methods basis_mapper::make_(const_)view_no_ref(). basis_mapper::make_(const_)view() will now return a non-reference view when supplied with a non lvalue-reference argument.
  • New CMake option STATIC_ANALYSIS. When enabled, the clang-tidy and cppcheck static analysis tools will be run on the C++ sources of unit tests and examples as part of build process.
  • Minor bugfixes in unit tests and improvements in coding style.
  • Reformatted C++ sources using clang-format and a style based on LLVM.

Release v0.6.1

Choose a tag to compare

@krivenko krivenko released this 30 Mar 12:30

Added a new method, hilbert_space::index().

Release v0.6

Choose a tag to compare

@krivenko krivenko released this 23 Mar 18:12

Minor corrections and additions to API required for pycommute.

Release v0.5

Choose a tag to compare

@krivenko krivenko released this 05 Oct 09:13

This is the first feature-complete, fully documented release.

libcommute is a C++11/14/17 template library without external dependencies. It is made of two major parts.

  • A Domain-Specific Language (DSL) designed to easily construct and manipulate polynomial expressions with quantum-mechanical operators, especially those used in the theory of many interacting fermions, bosons and spins. The goal here is to make expressions written in C++ code closely resemble the standard mathematical notation.

  • A fast representation of the quantum-mechanical operators that enables their action on finite-dimensional state vectors. This feature provides a basis for writing highly performant Exact Diagonalization (ED) codes without loss of flexibility.

libcommute is designed with extensibility in mind and can be easily adapted to work with new operator algebras, numeric types and matrix/vector algebra libraries (Eigen, Armadillo, etc).

Learn more about libcommute's capabilities at https://krivenko.github.io/libcommute/.