python-quimb/python-quimb.spec

111 lines
3.4 KiB
RPMSpec
Raw Normal View History

- Update to 1.10.0: * Breaking Changes + renamed MatrixProductState.partial_trace and MatrixProductState.ptr to MatrixProductState.partial_trace_to_mpo to avoid confusion with other partial_trace methods that usually produce a dense matrix. * Enhancements: + tensor network fitting: add method="tree" for when ansatz is a tree - tensor_network_fit_tree + tensor network fitting: fix method="als" for complex networks + tensor network fitting: allow method="als" to use a iterative solver suited to much larger tensors, by default a custom conjugate gradient implementation. + tensor_network_distance and fitting: support hyper indices explicitly via output_inds kwarg + add tn.make_overlap and tn.overlap for computing the overlap between two tensor networks, ⟨ O | T ⟩ , with explicit handling of outer indices to address hyper networks. Add output_inds to tn.norm and tn.make_norm also, as well as the squared kwarg. + replace all numba based paralellism (prange and parallel vectorize) with explicit thread pool based parallelism. Should be more reliable and no need to set NUMBA_NUM_THREADS anymore. Remove env var QUIMB_NUMBA_PAR. + Circuit: add dtype and convert_eager options. dtype specifies what the computation should be performed in. convert_eager specifies whether to apply this (and any to_backend calls) as soon as gates are applied (the default for MPS circuit simulation) or just prior to contraction (the default for exact contraction simulation). + tn.full_simplify: add check_zero (by default set of "auto") option which explicitly checks for zero tensor norms when equalizing norms to avoid log10(norm) resulting in -inf or nan. Since it creates a data OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-quimb?expand=0&rev=23
2025-02-26 03:56:17 +00:00
#
# spec file for package python-quimb
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == ""
%define psuffix %{nil}
%bcond_with test
BuildArch: noarch
%else
%bcond_without test
%define psuffix -%{flavor}
# This package does not support 32 bit arch, s390x fails too
ExcludeArch: %{ix86} %{arm} ppc s390x
%endif
Name: python-quimb%{psuffix}
Version: 1.10.0
Release: 0
Summary: Python library for quantum information and many-body calculations
License: Apache-2.0
URL: https://quimb.readthedocs.io/
Source: https://github.com/jcmgray/quimb/archive/refs/tags/v%{version}.tar.gz#/quimb-%{version}.tar.gz
BuildRequires: %{python_module hatch_vcs}
BuildRequires: %{python_module hatchling}
BuildRequires: %{python_module pip}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-autoray >= 0.6.12
Requires: python-cotengra >= 0.6.1
Requires: python-cytoolz >= 0.8.0
Requires: python-numba >= 0.39
Requires: python-numpy >= 1.17
Requires: python-psutil >= 4.3.1
Requires: python-scipy >= 1.0.0
Requires: python-tqdm >= 4
Requires(post): update-alternatives
Requires(postun): update-alternatives
Recommends: python-diskcache >= 3.0
Recommends: python-matplotlib >= 2
Recommends: python-networkx >= 2.3
Suggests: python-mpi4py
Suggests: python-petsc4py
Suggests: python-slepc4py
%if %{with test}
BuildRequires: %{python_module quimb = %{version}}
##
BuildRequires: %{python_module diskcache >= 3.0}
BuildRequires: %{python_module matplotlib >= 2}
BuildRequires: %{python_module networkx >= 2.3}
BuildRequires: %{python_module psutil >= 4.3.1}
BuildRequires: %{python_module pytest-rerunfailures}
BuildRequires: %{python_module pytest-xdist}
BuildRequires: %{python_module pytest}
%endif
%python_subpackages
%description
quimb is an easy but fast python library for quantum information and
many-body calculations, including with tensor networks.
%prep
%setup -q -n quimb-%{version}
sed -i '/addopts/d' pyproject.toml
%build
%if !%{with test}
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
%pyproject_wheel
%endif
%install
%if !%{with test}
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%endif
%if %{with test}
%check
mv quimb quimb.movedsrc
# precision comparison slightly out of tolerance: this one is permament, others are flaky (rerun them)
donttest="(test_subtract_update and float32) or test_contract_double_loopy_approx"
donttest+=" or test_cyclic_solve_big_with_segmenting"
%pytest -n auto --reruns 3 -k "not ($donttest)"
%endif
%if !%{with test}
%files %{python_files}
%doc README.md
%license LICENSE.txt
%{python_sitelib}/quimb
%{python_sitelib}/quimb-%{version}.dist-info
%endif
%changelog