diff --git a/.ci/retrofit-worktree.sh b/.ci/retrofit-worktree.sh index eba1b674ecb..4c283f7ff4a 100755 --- a/.ci/retrofit-worktree.sh +++ b/.ci/retrofit-worktree.sh @@ -23,9 +23,10 @@ set -x # If actions/checkout downloaded our source tree using the GitHub REST API # instead of with git (because do not have git installed in our image), # we first make the source tree a repo. -if [ ! -d .git ]; then git init && git add -A && git commit --quiet -m "new"; fi +if [ ! -d .git ]; then git init; fi -# Tag this state of the source tree "new". This is what we want to build and test. +# Commit and tag this state of the source tree "new". This is what we want to build and test. +git add -A && git commit --quiet --allow-empty -m "new" git tag -f new # Our container image contains a source tree in $WORKTREE_DIRECTORY with a full build of Sage. diff --git a/.ci/write-dockerfile.sh b/.ci/write-dockerfile.sh index 67ef594729c..3a4ae5b152d 100755 --- a/.ci/write-dockerfile.sh +++ b/.ci/write-dockerfile.sh @@ -264,6 +264,7 @@ cat <> $GITHUB_OUTPUT + else + echo "build_targets=$build_targets ci-build-with-fallback" >> $GITHUB_OUTPUT + fi + cat $GITHUB_OUTPUT + - uses: actions/checkout@v4 + with: + ref: ${{ github.base_ref }} + path: worktree-base + if: github.base_ref && steps.changed-files.outputs.pkgs_all_changed_files + - name: Compute metrics + run: | + export PATH=build/bin:$PATH + if [ -d worktree-base ]; then + (echo "# $GITHUB_BASE_REF"; SAGE_ROOT=worktree-base sage-package metrics :all:) > base-metrics.txt + (echo "# $GITHUB_REF"; sage-package metrics :all:) > metrics.txt + diff --color=always --width=100 --side-by-side --left-column base-metrics.txt metrics.txt || true + else + sage-package metrics :all: + fi - name: Install test prerequisites # From docker.yml run: | @@ -142,7 +184,7 @@ jobs: # more reliable than "load", for which we observed random failure # conditions in which the built image could not be found. # - push: true + push: ${{ steps.changed-files.outputs.doctests_all_changed_files && true || false }} load: false context: . tags: ${{ env.BUILD_IMAGE }} @@ -153,9 +195,12 @@ jobs: NUMPROC=6 USE_MAKEFLAGS=-k V=0 SAGE_NUM_THREADS=4 --output-sync=recurse TARGETS_PRE=build/make/Makefile - TARGETS=ci-build-with-fallback + TARGETS=${{ steps.build-targets.outputs.build_targets }} - name: Start container + id: container + # Try to continue when "exporting to GitHub Actions Cache" failed with timeout + if: (success() || failure()) && steps.changed-files.outputs.doctests_all_changed_files run: | docker run --name BUILD -dit \ --mount type=bind,src=$(pwd),dst=$(pwd) \ @@ -165,6 +210,7 @@ jobs: # Testing - name: Check that all modules can be imported + if: (success() || failure()) && steps.container.outcome == 'success' && steps.changed-files.outputs.doctests_all_changed_files run: | # Increase the length of the lines in the "short summary" export COLUMNS=120 @@ -175,20 +221,12 @@ jobs: ./sage -python -m pytest -c tox.ini -qq --doctest --collect-only || true shell: sh .ci/docker-exec-script.sh BUILD /sage {0} - - name: Get changed files - id: changed-files - uses: tj-actions/changed-files@v44 - with: - # File extensions per sage.doctest.control.skipfile - files: src/**/*.{py,pyx,pxd,pxi,sage,spyx,rst,tex} - files_ignore: src/{setup,conftest*}.py - - name: Test changed files (sage -t --new) - if: steps.changed-files.outputs.all_changed_files + if: (success() || failure()) && steps.container.outcome == 'success' && steps.changed-files.outputs.doctests_all_changed_files run: | export MAKE="make -j2 --output-sync=recurse" SAGE_NUM_THREADS=4 # https://github.com/tj-actions/changed-files?tab=readme-ov-file#outputs- - ./sage -t --long --format github -p4 ${{ steps.changed-files.outputs.all_changed_files }} + ./sage -t --long --format github -p4 ${{ steps.changed-files.outputs.doctests_all_changed_files }} shell: sh .ci/docker-exec-script.sh BUILD /sage {0} test-mod: @@ -266,9 +304,11 @@ jobs: NUMPROC=6 USE_MAKEFLAGS=-k V=0 SAGE_NUM_THREADS=4 --output-sync=recurse TARGETS_PRE=build/make/Makefile - TARGETS=ci-build-with-fallback + TARGETS=${{ needs.test-new.outputs.build_targets }} - name: Start container + id: container + if: (success() || failure()) run: | docker run --name BUILD -dit \ --mount type=bind,src=$(pwd),dst=$(pwd) \ @@ -278,6 +318,7 @@ jobs: # Testing - name: Test modularized distributions + if: (success() || failure()) && steps.container.outcome == 'success' run: | export MAKE="make -j2 --output-sync=recurse" SAGE_NUM_THREADS=4 make V=0 tox-ensure && make ${{ matrix.targets }} @@ -361,10 +402,11 @@ jobs: NUMPROC=6 USE_MAKEFLAGS=-k V=0 SAGE_NUM_THREADS=4 --output-sync=recurse TARGETS_PRE=build/make/Makefile - TARGETS=ci-build-with-fallback + TARGETS=${{ needs.test-new.outputs.build_targets }} - name: Start container id: container + if: (success() || failure()) run: | docker run --name BUILD -dit \ --mount type=bind,src=$(pwd),dst=$(pwd) \ @@ -374,6 +416,7 @@ jobs: # Testing - name: Test all files (sage -t --long ${{ matrix.tests }}) + if: (success() || failure()) && steps.container.outcome == 'success' run: | mkdir .coverage rm -rf /sage/.coverage @@ -473,10 +516,11 @@ jobs: NUMPROC=6 USE_MAKEFLAGS=-k V=0 SAGE_NUM_THREADS=4 --output-sync=recurse TARGETS_PRE=build/make/Makefile - TARGETS=ci-build-with-fallback + TARGETS=${{ needs.test-new.outputs.build_targets }} - name: Start container id: container + if: (success() || failure()) run: | docker run --name BUILD -dit \ --mount type=bind,src=$(pwd),dst=$(pwd) \ @@ -490,8 +534,10 @@ jobs: with: path: .coverage pattern: coverage-* + if: (success() || failure()) && steps.container.outcome == 'success' - name: Coverage report + if: (success() || failure()) && steps.container.outcome == 'success' # Using --omit to avoid "CoverageWarning: Couldn't parse '/tmp/tmp06qizzie/tmp_ldpu46ob.py': No source for code" run: | rm -rf /sage/.coverage @@ -505,6 +551,7 @@ jobs: shell: sh .ci/docker-exec-script.sh BUILD . {0} - name: Upload coverage to codecov + if: (success() || failure()) && steps.container.outcome == 'success' uses: codecov/codecov-action@v4 with: directory: .coverage/coverage-report diff --git a/.github/workflows/ci-linux-incremental.yml b/.github/workflows/ci-linux-incremental.yml index 88a31a5ce42..ce468ff3a42 100644 --- a/.github/workflows/ci-linux-incremental.yml +++ b/.github/workflows/ci-linux-incremental.yml @@ -41,12 +41,11 @@ jobs: runs-on: ubuntu-latest name: List changed packages outputs: - uninstall_targets: ${{ steps.build-targets.outputs.uninstall_targets }} build_targets: ${{ steps.build-targets.outputs.build_targets }} steps: - uses: actions/checkout@v4 - name: Get all packages that have changed - id: changed-packages + id: changed-files uses: tj-actions/changed-files@v44 with: files_yaml: | @@ -58,14 +57,19 @@ jobs: - name: Determine targets to build id: build-targets run: | - echo "uninstall_targets=$(echo $(for a in '' ${{ steps.changed-packages.outputs.configures_all_changed_files }}; do echo $a | sed -E 's,build/pkgs/([a-z0-9][_.a-z0-9]*)/spkg-configure[.]m4 *,\1-uninstall,'; done | sort -u))" >> $GITHUB_OUTPUT - echo "build_targets=$(echo $(for a in '' ${{ steps.changed-packages.outputs.pkgs_all_changed_files }}; do SPKG=$(echo $a | sed -E 's,-,_,g;s,(build/)?pkgs/([a-z0-9][-_.a-z0-9]*)/[^ ]* *,\2,;'); if [ -f "build/pkgs/$SPKG/checksums.ini" -o -f "build/pkgs/$SPKG/requirements.txt" -o -f "build/pkgs/$SPKG/spkg-install" ]; then echo "$SPKG-ensure"; fi; done | sort -u))" >> $GITHUB_OUTPUT + uninstall_targets=$(echo $(for a in '' ${{ steps.changed-files.outputs.configures_all_changed_files }}; do echo $a | sed -E 's,build/pkgs/([a-z0-9][_.a-z0-9]*)/spkg-configure[.]m4 *,\1-uninstall,'; done | sort -u)) + build_targets=$(echo $(for a in '' ${{ steps.changed-files.outputs.pkgs_all_changed_files }}; do SPKG=$(echo $a | sed -E 's,-,_,g;s,(build/)?pkgs/([a-z0-9][-_.a-z0-9]*)/[^ ]* *,\2,;'); if [ -f "build/pkgs/$SPKG/checksums.ini" -o -f "build/pkgs/$SPKG/requirements.txt" -o -f "build/pkgs/$SPKG/spkg-install" ]; then echo "$SPKG-ensure"; fi; done | sort -u)) + if [ -n "$uninstall_targets" ]; then + echo "build_targets=$uninstall_targets reconfigure $build_targets ci-build-with-fallback" >> $GITHUB_OUTPUT + else + echo "build_targets=$build_targets ci-build-with-fallback" >> $GITHUB_OUTPUT + fi cat $GITHUB_OUTPUT - uses: actions/checkout@v4 with: ref: ${{ github.base_ref }} path: worktree-base - if: github.base_ref + if: github.base_ref && steps.changed-files.outputs.pkgs_all_changed_files - name: Compute metrics run: | export PATH=build/bin:$PATH @@ -88,15 +92,14 @@ jobs: from_docker_target: "with-targets" from_docker_tag: "dev" docker_targets: "with-targets" - targets: "${{needs.changed_files.outputs.uninstall_targets}} reconfigure ${{needs.changed_files.outputs.build_targets}} build doc-html ptest" + targets: "${{needs.changed_files.outputs.build_targets}} doc-html ptest-nodoc" tox_system_factors: >- ["ubuntu-focal", - "ubuntu-jammy", - "ubuntu-mantic", + "ubuntu-noble", "debian-bullseye", "debian-bookworm", "fedora-30", - "fedora-38", + "fedora-40", "gentoo-python3.11", "debian-bullseye-i386"] tox_packages_factors: >- @@ -107,14 +110,6 @@ jobs: site: needs: [changed_files] - if: | - github.event_name != 'pull_request' || - ((github.event.action != 'labeled' && - (contains(github.event.pull_request.labels.*.name, 'c: packages: standard') || - contains(github.event.pull_request.labels.*.name, 'c: packages: optional'))) || - (github.event.action == 'labeled' && - (github.event.label.name == 'c: packages: optional' || - github.event.label.name == 'c: packages: standard'))) uses: ./.github/workflows/docker.yml with: # Build incrementally from published Docker image @@ -124,7 +119,7 @@ jobs: from_docker_target: "with-targets" from_docker_tag: "dev" docker_targets: "with-targets" - targets: "${{needs.changed_files.outputs.uninstall_targets}} reconfigure ${{needs.changed_files.outputs.build_targets}} build doc-html ptest" + targets: "${{needs.changed_files.outputs.build_targets}} doc-html ptest-nodoc" # Only test systems with a usable system python (>= 3.9) # with only a small number of test failures as of 10.2.rc0 tox_system_factors: >- diff --git a/.github/workflows/doc-build-pdf.yml b/.github/workflows/doc-build-pdf.yml index d4cc6ebc6ca..2eac8e17ffc 100644 --- a/.github/workflows/doc-build-pdf.yml +++ b/.github/workflows/doc-build-pdf.yml @@ -101,6 +101,9 @@ jobs: TARGETS=ci-build-with-fallback - name: Start container + id: container + # Try to continue when "exporting to GitHub Actions Cache" failed with timeout + if: (success() || failure()) run: | docker run --name BUILD -dit \ --mount type=bind,src=$(pwd),dst=$(pwd) \ @@ -110,6 +113,8 @@ jobs: # Docs - name: Update system packages + id: packages + if: (success() || failure()) && steps.container.outcome == 'success' run: | export PATH="build/bin:$PATH" eval $(sage-print-system-package-command auto update) @@ -119,6 +124,7 @@ jobs: - name: Build docs (PDF) id: docbuild + if: (success() || failure()) && steps.packages.outcome == 'success' run: | export MAKE="make -j5 --output-sync=recurse" SAGE_NUM_THREADS=5 make doc-clean doc-uninstall; make sagemath_doc_html-build-deps sagemath_doc_pdf-no-deps diff --git a/.github/workflows/doc-build.yml b/.github/workflows/doc-build.yml index 69f17dcd35b..9dfb8d7d221 100644 --- a/.github/workflows/doc-build.yml +++ b/.github/workflows/doc-build.yml @@ -105,6 +105,9 @@ jobs: TARGETS=ci-build-with-fallback - name: Start container + id: container + # Try to continue when "exporting to GitHub Actions Cache" failed with timeout + if: (success() || failure()) run: | docker run --name BUILD -dit \ --mount type=bind,src=$(pwd),dst=$(pwd) \ @@ -115,6 +118,7 @@ jobs: - name: Store old docs id: worktree + if: (success() || failure()) && steps.container.outcome == 'success' run: | git config --global --add safe.directory $(pwd) git config --global user.email "ci-sage@example.com" @@ -141,6 +145,7 @@ jobs: - name: Build docs id: docbuild + if: (success() || failure()) && steps.worktree.outcome == 'success' # Always non-incremental because of the concern that # incremental docbuild may introduce broken links (inter-file references) though build succeeds run: | diff --git a/CITATION.cff b/CITATION.cff index 6a6902fc831..0d43a526e62 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -4,8 +4,8 @@ title: SageMath abstract: SageMath is a free open-source mathematics software system. authors: - name: "The SageMath Developers" -version: 10.4.beta8 +version: 10.4.beta9 doi: 10.5281/zenodo.8042260 -date-released: 2024-06-01 +date-released: 2024-06-09 repository-code: "https://github.com/sagemath/sage" url: "https://www.sagemath.org/" diff --git a/VERSION.txt b/VERSION.txt index 5d451269673..76bb72f1560 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -SageMath version 10.4.beta8, Release Date: 2024-06-01 +SageMath version 10.4.beta9, Release Date: 2024-06-09 diff --git a/build/bin/sage-dist-helpers b/build/bin/sage-dist-helpers index d7ef0a81a8b..d55ac539837 100644 --- a/build/bin/sage-dist-helpers +++ b/build/bin/sage-dist-helpers @@ -247,9 +247,10 @@ sdh_pip_install() { install_options="$install_options $1" ;; -C|--config-settings) - build_options="$build_options --config-setting" shift - build_options="$build_options $1" + # Per 'python -m build --help', options which begin with a hyphen + # must be in the form of "--config-setting=--opt(=value)" or "-C--opt(=value)" + build_options="$build_options --config-setting=$1" ;; *) break diff --git a/build/pkgs/cmake/spkg-configure.m4 b/build/pkgs/cmake/spkg-configure.m4 index 4210442c44c..6149f49a7c5 100644 --- a/build/pkgs/cmake/spkg-configure.m4 +++ b/build/pkgs/cmake/spkg-configure.m4 @@ -1,5 +1,5 @@ SAGE_SPKG_CONFIGURE([cmake], [dnl - AC_CACHE_CHECK([for cmake >= 3.11], [ac_cv_path_CMAKE], [dnl + AC_CACHE_CHECK([for cmake >= 3.18], [ac_cv_path_CMAKE], [dnl dnl Do not accept cmake installed via https://pypi.org/project/cmake/ dnl in the default user scheme; it will not work in our venv because dnl we set PYTHONUSERBASE in sage-env. @@ -8,7 +8,7 @@ SAGE_SPKG_CONFIGURE([cmake], [dnl cmake_version=`$ac_path_CMAKE --version 2>&1 \ | $SED -n -e 's/cmake version *\([[0-9]]*\.[[0-9]]*\.[[0-9]]*\)/\1/p'` AS_IF([test -n "$cmake_version"], [dnl - AX_COMPARE_VERSION([$cmake_version], [ge], [3.11], [dnl + AX_COMPARE_VERSION([$cmake_version], [ge], [3.18], [dnl ac_cv_path_CMAKE="$ac_path_CMAKE" ac_path_CMAKE_found=: ]) diff --git a/build/pkgs/configure/checksums.ini b/build/pkgs/configure/checksums.ini index 63fda81bd69..da9cfbb1ff9 100644 --- a/build/pkgs/configure/checksums.ini +++ b/build/pkgs/configure/checksums.ini @@ -1,3 +1,3 @@ tarball=configure-VERSION.tar.gz -sha1=14af118d49c9381989e4ea2409817248d34ebf19 -sha256=860c9d730e6bd766be52c304e3fc5bef30e022ba35c0a3eb227c0930255426b0 +sha1=f3e560bbf33add8504ba9f7ba93fff9e82e3e445 +sha256=bef93be1bb978fa34cd5aaa9c041d1a97a33ff35f88c9df2f9c25e6764770c56 diff --git a/build/pkgs/configure/package-version.txt b/build/pkgs/configure/package-version.txt index 29b73101191..ca5926f5634 100644 --- a/build/pkgs/configure/package-version.txt +++ b/build/pkgs/configure/package-version.txt @@ -1 +1 @@ -be566915755fbfad85571c4a82e25404b43d10cb +5c12765f7e585b58ab0cd99f7998cfa615f85247 diff --git a/build/pkgs/cryptominisat/SPKG.rst b/build/pkgs/cryptominisat/SPKG.rst deleted file mode 100644 index 45c987baf84..00000000000 --- a/build/pkgs/cryptominisat/SPKG.rst +++ /dev/null @@ -1,38 +0,0 @@ -cryptominisat: A SAT solver -=========================== - -Description ------------ - - CryptoMiniSat is a SAT solver that aims to become a premiere SAT - solver with all the features and speed of successful SAT solvers, - such as MiniSat and PrecoSat. The long-term goals of CryptoMiniSat - are to be an efficient sequential, parallel and distributed - solver. There are solvers that are good at one or the other, - e.g. ManySat (parallel) or PSolver (distributed), but we wish to - excel at all. - - CryptoMiniSat 2.5 won the SAT Race 2010 among 20 solvers submitted - by researchers and industry. - -License -------- - -MIT License - - -Upstream Contact ----------------- - -- Authors: Mate Soos -- Email: soos.mate@gmail.com -- Website: http://www.msoos.org/ -- Releases: https://github.com/msoos/cryptominisat/releases - - -Special Update/Build Instructions ---------------------------------- - -CryptoMiniSat's tarball downloaded from github is called VERSION.tar.gz -and should be renamed to cryptominisat-VERSION.tar.gz -Its Python module is installed by the pycryptosat spkg. diff --git a/build/pkgs/cryptominisat/checksums.ini b/build/pkgs/cryptominisat/checksums.ini deleted file mode 100644 index f3838f6618c..00000000000 --- a/build/pkgs/cryptominisat/checksums.ini +++ /dev/null @@ -1,4 +0,0 @@ -tarball=cryptominisat-VERSION.tar.gz -sha1=f79dfa1ffc6c9c75b3a33f76d3a89a3df2b3f4c2 -sha256=50153025c8503ef32f32fff847ee24871bb0fc1f0b13e17fe01aa762923f6d94 -upstream_url=https://github.com/msoos/cryptominisat/archive/refs/tags/VERSION.tar.gz diff --git a/build/pkgs/cryptominisat/dependencies b/build/pkgs/cryptominisat/dependencies deleted file mode 100644 index e30473e40f6..00000000000 --- a/build/pkgs/cryptominisat/dependencies +++ /dev/null @@ -1,4 +0,0 @@ - m4ri zlib libpng | cmake boost_cropped $(PYTHON) - ----------- -All lines of this file are ignored except the first. diff --git a/build/pkgs/cryptominisat/distros/conda.txt b/build/pkgs/cryptominisat/distros/conda.txt deleted file mode 100644 index 5ba98aa9061..00000000000 --- a/build/pkgs/cryptominisat/distros/conda.txt +++ /dev/null @@ -1 +0,0 @@ -cryptominisat diff --git a/build/pkgs/cryptominisat/distros/homebrew.txt b/build/pkgs/cryptominisat/distros/homebrew.txt deleted file mode 100644 index 5ba98aa9061..00000000000 --- a/build/pkgs/cryptominisat/distros/homebrew.txt +++ /dev/null @@ -1 +0,0 @@ -cryptominisat diff --git a/build/pkgs/cryptominisat/distros/repology.txt b/build/pkgs/cryptominisat/distros/repology.txt deleted file mode 100644 index 5ba98aa9061..00000000000 --- a/build/pkgs/cryptominisat/distros/repology.txt +++ /dev/null @@ -1 +0,0 @@ -cryptominisat diff --git a/build/pkgs/cryptominisat/math b/build/pkgs/cryptominisat/math deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/build/pkgs/cryptominisat/package-version.txt b/build/pkgs/cryptominisat/package-version.txt deleted file mode 100644 index 11d9efa3d5a..00000000000 --- a/build/pkgs/cryptominisat/package-version.txt +++ /dev/null @@ -1 +0,0 @@ -5.8.0 diff --git a/build/pkgs/cryptominisat/patches/679.patch b/build/pkgs/cryptominisat/patches/679.patch deleted file mode 100644 index a7dec833f6f..00000000000 --- a/build/pkgs/cryptominisat/patches/679.patch +++ /dev/null @@ -1,43 +0,0 @@ -From a01179ffd6b0dd47bfdef2d9350d80b575571f24 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Maciej=20Bar=C4=87?= -Date: Sun, 3 Apr 2022 20:02:59 +0200 -Subject: [PATCH] python/setup.py.in: import sysconfig instead of importing it - from distutils -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -setuptools 61 dropped sysconfig module - -Ref: https://github.com/stamparm/pcapy-ng/commit/f6ce5248f78ac0a247d76e48cff152f4e3f26482 -Bug: https://bugs.gentoo.org/836684 - -Signed-off-by: Maciej Barć ---- - python/setup.py.in | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/python/setup.py.in b/python/setup.py.in -index b3ab64af4..293eb1f80 100644 ---- a/python/setup.py.in -+++ b/python/setup.py.in -@@ -27,7 +27,7 @@ import sys - import os - import platform - from distutils.core import setup, Extension --from distutils import sysconfig -+import sysconfig - from distutils.cmd import Command - - __PACKAGE_VERSION__ = "0.2.0" -@@ -59,8 +59,8 @@ def _init_posix(init): - Forces g++ instead of gcc on most systems - credits to eric jones (eric@enthought.com) (found at Google Groups) - """ -- def wrapper(): -- init() -+ def wrapper(vars): -+ init(vars) - - config_vars = sysconfig.get_config_vars() # by reference - if config_vars["MACHDEP"].startswith("sun"): diff --git a/build/pkgs/cryptominisat/patches/cryptominisat-5.8.0-rm_extra_python_vars.patch b/build/pkgs/cryptominisat/patches/cryptominisat-5.8.0-rm_extra_python_vars.patch deleted file mode 100644 index 5ef6f21c948..00000000000 --- a/build/pkgs/cryptominisat/patches/cryptominisat-5.8.0-rm_extra_python_vars.patch +++ /dev/null @@ -1,37 +0,0 @@ -diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt -index f549ca7..4a9f0d8 100644 ---- a/python/CMakeLists.txt -+++ b/python/CMakeLists.txt -@@ -25,19 +25,6 @@ import sysconfig; - print(sysconfig.get_config_var('CFLAGS'), end = '')" - OUTPUT_VARIABLE PY_C_CONFIG) - --execute_process(COMMAND ${PYTHON_EXECUTABLE} -c " --from __future__ import print_function; --import sysconfig; --print(sysconfig.get_config_var('SHLIBS'), end = '')" -- OUTPUT_VARIABLE PY_LD_CONFIG) -- -- --execute_process(COMMAND ${PYTHON_EXECUTABLE} -c " --from __future__ import print_function; --import sysconfig; --print(sysconfig.get_config_var('LINKFORSHARED'), end = '')" -- OUTPUT_VARIABLE PY_LINKFORSHARED_CONFIG) -- - if(DEFINED ENV{PYCRYPTOSAT_INSTALL_PATH}) - set(PY_INSTALL_PREFIX "--prefix=$ENV{PYCRYPTOSAT_INSTALL_PATH}") - elseif(DEFINED ENV{VIRTUAL_ENV}) -@@ -47,12 +34,8 @@ else() - endif() - - string(REPLACE "\n" " " PY_C_CONFIG ${PY_C_CONFIG}) --string(REPLACE "\n" " " PY_LD_CONFIG ${PY_LD_CONFIG}) --string(REPLACE "\n" " " PY_LINKFORSHARED_CONFIG ${PY_LINKFORSHARED_CONFIG}) - - message(STATUS "Python CFLAGS: '${PY_C_CONFIG}'") --message(STATUS "Python LDFLAGS: '${PY_LD_CONFIG}'") --message(STATUS "Python LINKFORSHARED flags: '${PY_LINKFORSHARED_CONFIG}'") - message(STATUS "Python module installation prefix: ${PY_INSTALL_PREFIX}") - - set(PY_LD_CONFIG "${PY_LD_CONFIG} ${PY_LINKFORSHARED_CONFIG}") diff --git a/build/pkgs/cryptominisat/spkg-install.in b/build/pkgs/cryptominisat/spkg-install.in deleted file mode 100644 index edcbcf4f0b2..00000000000 --- a/build/pkgs/cryptominisat/spkg-install.in +++ /dev/null @@ -1,5 +0,0 @@ -cd src - -sdh_cmake -DUSE_GAUSS='ON' -DENABLE_PYTHON_INTERFACE=OFF $EXTRA_OPTS -sdh_make VERBOSE=ON -sdh_make_install VERBOSE=ON diff --git a/build/pkgs/cryptominisat/type b/build/pkgs/cryptominisat/type deleted file mode 100644 index 134d9bc32d5..00000000000 --- a/build/pkgs/cryptominisat/type +++ /dev/null @@ -1 +0,0 @@ -optional diff --git a/build/pkgs/igraph/checksums.ini b/build/pkgs/igraph/checksums.ini index 6d63bbce214..62eafa1aec9 100644 --- a/build/pkgs/igraph/checksums.ini +++ b/build/pkgs/igraph/checksums.ini @@ -1,4 +1,4 @@ tarball=igraph-VERSION.tar.gz -sha1=40efbd2adf3c1cc0a2bb3e14f4c7898d053f1fe4 -sha256=ac5fa94ae6fd1eace651e4b235e99c056479a5c5d0d641aed30240ac33b19403 +sha1=3789f61beac1f1231f8c3832102dcb2720f2a0c9 +sha256=b011f7f9f38a3e59924cc9ff652e6d33105fa03fcaf3792f47d752626a0a4625 upstream_url=https://github.com/igraph/igraph/releases/download/VERSION/igraph-VERSION.tar.gz diff --git a/build/pkgs/igraph/package-version.txt b/build/pkgs/igraph/package-version.txt index 1a46c7f13e7..70016a7c6ad 100644 --- a/build/pkgs/igraph/package-version.txt +++ b/build/pkgs/igraph/package-version.txt @@ -1 +1 @@ -0.10.8 +0.10.12 diff --git a/build/pkgs/igraph/spkg-check.in b/build/pkgs/igraph/spkg-check.in index 27cd9419538..29b0a04f2cc 100644 --- a/build/pkgs/igraph/spkg-check.in +++ b/build/pkgs/igraph/spkg-check.in @@ -1,2 +1,3 @@ cd src -$MAKE check +cd build +sdh_make_check diff --git a/build/pkgs/igraph/spkg-configure.m4 b/build/pkgs/igraph/spkg-configure.m4 index 5133fce98da..0072f6ea6bc 100644 --- a/build/pkgs/igraph/spkg-configure.m4 +++ b/build/pkgs/igraph/spkg-configure.m4 @@ -3,7 +3,7 @@ SAGE_SPKG_CONFIGURE([igraph], [ dnl check for igraph with pkg-config dnl Per upstream in https://github.com/sagemath/sage/pull/36750#issuecomment-1826998762: dnl each python-igraph release is only guaranteed to be compatible with the same C/igraph that it bundles - PKG_CHECK_MODULES([IGRAPH], [igraph >= 0.10.8 igraph < 0.10.9], [], [ + PKG_CHECK_MODULES([IGRAPH], [igraph >= 0.10.12 igraph < 0.10.13], [], [ sage_spkg_install_igraph=yes]) ]) ]) diff --git a/build/pkgs/onetbb/checksums.ini b/build/pkgs/onetbb/checksums.ini index 6573c2f7b99..c7b278c01af 100644 --- a/build/pkgs/onetbb/checksums.ini +++ b/build/pkgs/onetbb/checksums.ini @@ -1,4 +1,4 @@ tarball=onetbb-VERSION.tar.gz -sha1=740e86b703f42446ddde392b73a9db3dc0f5f4cd -sha256=782ce0cab62df9ea125cdea253a50534862b563f1d85d4cda7ad4e77550ac363 +sha1=bd663861ab6bfec2469f3a8133c3ac1244f260cb +sha256=c7bb7aa69c254d91b8f0041a71c5bcc3936acb64408a1719aec0b2b7639dd84f upstream_url=https://github.com/oneapi-src/oneTBB/archive/refs/tags/vVERSION.tar.gz diff --git a/build/pkgs/onetbb/package-version.txt b/build/pkgs/onetbb/package-version.txt index 90431db79ad..5c5abc38ec9 100644 --- a/build/pkgs/onetbb/package-version.txt +++ b/build/pkgs/onetbb/package-version.txt @@ -1 +1 @@ -2021.11.0 +2021.12.0 diff --git a/build/pkgs/openssl/checksums.ini b/build/pkgs/openssl/checksums.ini index 6e2b7e18955..eac86dcdd87 100644 --- a/build/pkgs/openssl/checksums.ini +++ b/build/pkgs/openssl/checksums.ini @@ -1,4 +1,4 @@ tarball=openssl-VERSION.tar.gz -sha1=b48e20c07facfdf6da9ad43a6c5126d51897699b -sha256=f93c9e8edde5e9166119de31755fc87b4aa34863662f67ddfcba14d0b6b69b61 +sha1=b12311372a0277ca0eb218a68a7fd9f5ce66d162 +sha256=197149c18d9e9f292c43f0400acaba12e5f52cacfe050f3d199277ea738ec2e7 upstream_url=https://www.openssl.org/source/openssl-VERSION.tar.gz diff --git a/build/pkgs/openssl/package-version.txt b/build/pkgs/openssl/package-version.txt index f93fc9f42ea..be94e6f53db 100644 --- a/build/pkgs/openssl/package-version.txt +++ b/build/pkgs/openssl/package-version.txt @@ -1 +1 @@ -3.0.12 +3.2.2 diff --git a/build/pkgs/papilo/checksums.ini b/build/pkgs/papilo/checksums.ini index 831334dbdb9..d99180dc1e1 100644 --- a/build/pkgs/papilo/checksums.ini +++ b/build/pkgs/papilo/checksums.ini @@ -1,4 +1,4 @@ tarball=papilo-VERSION.tar.gz -sha1=069f64ff25cfb08c9b2a416d1d215bd5b907c877 -sha256=4ed759e55fe1c74be779137e4e3cdae67e1b64bd62ca31793ca3b321509c27a8 +sha1=55e8416d5512d3f823ae87c4161ccff30e76f4a1 +sha256=b022af82bda3db1a594fe67524d98be82e67279f9d9d645b2fcdfc9349cdc6f7 upstream_url=https://github.com/scipopt/papilo/archive/refs/tags/vVERSION.tar.gz diff --git a/build/pkgs/papilo/package-version.txt b/build/pkgs/papilo/package-version.txt index ccbccc3dc62..c043eea7767 100644 --- a/build/pkgs/papilo/package-version.txt +++ b/build/pkgs/papilo/package-version.txt @@ -1 +1 @@ -2.2.0 +2.2.1 diff --git a/build/pkgs/pycryptosat/SPKG.rst b/build/pkgs/pycryptosat/SPKG.rst index a0b0ef6a510..d09e5b7f6cb 100644 --- a/build/pkgs/pycryptosat/SPKG.rst +++ b/build/pkgs/pycryptosat/SPKG.rst @@ -4,8 +4,18 @@ pycryptosat: Python module of cryptominisat Description ----------- - Build and install pycryptosat into appropriate venv. - See cryptominisat for more details. +Build and install pycryptosat (Python frontend to CryptoMiniSat, which will be built if needed too). + +CryptoMiniSat is a SAT solver that aims to become a premiere SAT solver +with all the features and speed of successful SAT solvers, such as MiniSat +and PrecoSat. The long-term goals of CryptoMiniSat are to be an efficient +sequential, parallel and distributed solver. There are solvers that are +good at one or the other, e.g. ManySat (parallel) or PSolver (distributed), +but we wish to excel at all. + +CryptoMiniSat 2.5 won the SAT Race 2010 among 20 solvers submitted by researchers and industry. + + License ------- diff --git a/build/pkgs/pycryptosat/checksums.ini b/build/pkgs/pycryptosat/checksums.ini deleted file mode 120000 index 93cecdab18f..00000000000 --- a/build/pkgs/pycryptosat/checksums.ini +++ /dev/null @@ -1 +0,0 @@ -../cryptominisat/checksums.ini \ No newline at end of file diff --git a/build/pkgs/pycryptosat/dependencies b/build/pkgs/pycryptosat/dependencies index c51735427aa..58247760d8a 100644 --- a/build/pkgs/pycryptosat/dependencies +++ b/build/pkgs/pycryptosat/dependencies @@ -1,4 +1,4 @@ - m4ri zlib libpng cryptominisat | cmake boost_cropped $(PYTHON_TOOLCHAIN) $(PYTHON) + m4ri zlib libpng | cmake boost_cropped $(PYTHON_TOOLCHAIN) $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pycryptosat/package-version.txt b/build/pkgs/pycryptosat/package-version.txt deleted file mode 120000 index 1743d5359eb..00000000000 --- a/build/pkgs/pycryptosat/package-version.txt +++ /dev/null @@ -1 +0,0 @@ -../cryptominisat/package-version.txt \ No newline at end of file diff --git a/build/pkgs/pycryptosat/patches b/build/pkgs/pycryptosat/patches deleted file mode 120000 index a9b6b7c63e5..00000000000 --- a/build/pkgs/pycryptosat/patches +++ /dev/null @@ -1 +0,0 @@ -../cryptominisat/patches \ No newline at end of file diff --git a/build/pkgs/pycryptosat/version_requirements.txt b/build/pkgs/pycryptosat/requirements.txt similarity index 100% rename from build/pkgs/pycryptosat/version_requirements.txt rename to build/pkgs/pycryptosat/requirements.txt diff --git a/build/pkgs/pycryptosat/spkg-install.in b/build/pkgs/pycryptosat/spkg-install.in deleted file mode 100644 index b218fe1a924..00000000000 --- a/build/pkgs/pycryptosat/spkg-install.in +++ /dev/null @@ -1,9 +0,0 @@ -cd src - -sdh_cmake -DUSE_GAUSS='ON' $EXTRA_OPTS - -cd pycryptosat - -export CFLAGS="$CFLAGS -std=gnu++11" - -sdh_pip_install . diff --git a/build/pkgs/python_igraph/checksums.ini b/build/pkgs/python_igraph/checksums.ini index ecdc7ea2dfe..d7247b21a30 100644 --- a/build/pkgs/python_igraph/checksums.ini +++ b/build/pkgs/python_igraph/checksums.ini @@ -1,4 +1,4 @@ tarball=python-igraph-VERSION.tar.gz -sha1=ef7ee85cb1bc83109c744d5dd6bbe5e37598ce3f -sha256=e55df60f882a51b8e8c1c5e7e940c5f90685d75634ea6df63bebcc983397adfa +sha1=da963213ab22c60938d4e77ffab811875ee43a8a +sha256=2d71d645a4c3344c5910543fabbae10d3163f46a3e824ba7753c14b9036b8233 upstream_url=https://pypi.io/packages/source/i/igraph/igraph-VERSION.tar.gz diff --git a/build/pkgs/python_igraph/package-version.txt b/build/pkgs/python_igraph/package-version.txt index 1a96df19c09..62d5dbdf3c7 100644 --- a/build/pkgs/python_igraph/package-version.txt +++ b/build/pkgs/python_igraph/package-version.txt @@ -1 +1 @@ -0.11.3 +0.11.5 diff --git a/build/pkgs/python_igraph/spkg-install.in b/build/pkgs/python_igraph/spkg-install.in index bafbbda375e..07408c34b0d 100644 --- a/build/pkgs/python_igraph/spkg-install.in +++ b/build/pkgs/python_igraph/spkg-install.in @@ -1,10 +1,2 @@ cd src -# Use --use-pep517 because https://github.com/igraph/python-igraph as of 0.9.11 does not have pyproject.toml -# and so "pip wheel" would use a legacy build method, ignoring --config-settings. -# -# TODO: With setuptools 63.2.0, passing another --config-settings "--global-option=--no-wait" (not really needed) -# kills the "--global-option=--use-pkg-config". -# https://github.com/pypa/setuptools/issues/3380 makes changes to this, so we can revisit this after -# the next setuptools upgrade. -# -sdh_pip_install --use-pep517 --config-settings "--global-option=--use-pkg-config" . +sdh_pip_install --config-settings "--global-option=--use-pkg-config" --config-settings "--global-option=--no-wait" . diff --git a/build/pkgs/sage_conf/version_requirements.txt b/build/pkgs/sage_conf/version_requirements.txt index bc253d58444..bf5142c02e5 100644 --- a/build/pkgs/sage_conf/version_requirements.txt +++ b/build/pkgs/sage_conf/version_requirements.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sage-conf ~= 10.4b8 +sage-conf ~= 10.4b9 diff --git a/build/pkgs/sage_docbuild/version_requirements.txt b/build/pkgs/sage_docbuild/version_requirements.txt index 88c4d5b252f..3bc4e773ff1 100644 --- a/build/pkgs/sage_docbuild/version_requirements.txt +++ b/build/pkgs/sage_docbuild/version_requirements.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sage-docbuild ~= 10.4b8 +sage-docbuild ~= 10.4b9 diff --git a/build/pkgs/sage_setup/version_requirements.txt b/build/pkgs/sage_setup/version_requirements.txt index 8431cb882ad..d04bde41fdd 100644 --- a/build/pkgs/sage_setup/version_requirements.txt +++ b/build/pkgs/sage_setup/version_requirements.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sage-setup ~= 10.4b8 +sage-setup ~= 10.4b9 diff --git a/build/pkgs/sage_sws2rst/version_requirements.txt b/build/pkgs/sage_sws2rst/version_requirements.txt index 45259114676..d3698b0a9ae 100644 --- a/build/pkgs/sage_sws2rst/version_requirements.txt +++ b/build/pkgs/sage_sws2rst/version_requirements.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sage-sws2rst ~= 10.4b8 +sage-sws2rst ~= 10.4b9 diff --git a/build/pkgs/sagelib/version_requirements.txt b/build/pkgs/sagelib/version_requirements.txt index fbefd68c27a..1dd1a4f846b 100644 --- a/build/pkgs/sagelib/version_requirements.txt +++ b/build/pkgs/sagelib/version_requirements.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-standard ~= 10.4b8 +sagemath-standard ~= 10.4b9 diff --git a/build/pkgs/sagemath_bliss/version_requirements.txt b/build/pkgs/sagemath_bliss/version_requirements.txt index 9831109152b..bc95834828a 100644 --- a/build/pkgs/sagemath_bliss/version_requirements.txt +++ b/build/pkgs/sagemath_bliss/version_requirements.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-bliss ~= 10.4b8 +sagemath-bliss ~= 10.4b9 diff --git a/build/pkgs/sagemath_categories/version_requirements.txt b/build/pkgs/sagemath_categories/version_requirements.txt index e22c57defcd..08fa02e2044 100644 --- a/build/pkgs/sagemath_categories/version_requirements.txt +++ b/build/pkgs/sagemath_categories/version_requirements.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-categories ~= 10.4b8 +sagemath-categories ~= 10.4b9 diff --git a/build/pkgs/sagemath_coxeter3/version_requirements.txt b/build/pkgs/sagemath_coxeter3/version_requirements.txt index a16d1a99bd4..13e0b652f36 100644 --- a/build/pkgs/sagemath_coxeter3/version_requirements.txt +++ b/build/pkgs/sagemath_coxeter3/version_requirements.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-coxeter3 ~= 10.4b8 +sagemath-coxeter3 ~= 10.4b9 diff --git a/build/pkgs/sagemath_environment/version_requirements.txt b/build/pkgs/sagemath_environment/version_requirements.txt index c265b92492a..72433ad30cd 100644 --- a/build/pkgs/sagemath_environment/version_requirements.txt +++ b/build/pkgs/sagemath_environment/version_requirements.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-environment ~= 10.4b8 +sagemath-environment ~= 10.4b9 diff --git a/build/pkgs/sagemath_mcqd/version_requirements.txt b/build/pkgs/sagemath_mcqd/version_requirements.txt index 026c86366d5..76e1fd5907c 100644 --- a/build/pkgs/sagemath_mcqd/version_requirements.txt +++ b/build/pkgs/sagemath_mcqd/version_requirements.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-mcqd ~= 10.4b8 +sagemath-mcqd ~= 10.4b9 diff --git a/build/pkgs/sagemath_meataxe/version_requirements.txt b/build/pkgs/sagemath_meataxe/version_requirements.txt index d92e7b1741a..db6dcee5827 100644 --- a/build/pkgs/sagemath_meataxe/version_requirements.txt +++ b/build/pkgs/sagemath_meataxe/version_requirements.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-meataxe ~= 10.4b8 +sagemath-meataxe ~= 10.4b9 diff --git a/build/pkgs/sagemath_objects/version_requirements.txt b/build/pkgs/sagemath_objects/version_requirements.txt index 22c106b51ab..a48fb049cb7 100644 --- a/build/pkgs/sagemath_objects/version_requirements.txt +++ b/build/pkgs/sagemath_objects/version_requirements.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-objects ~= 10.4b8 +sagemath-objects ~= 10.4b9 diff --git a/build/pkgs/sagemath_repl/version_requirements.txt b/build/pkgs/sagemath_repl/version_requirements.txt index 60f6680492b..661b369f395 100644 --- a/build/pkgs/sagemath_repl/version_requirements.txt +++ b/build/pkgs/sagemath_repl/version_requirements.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-repl ~= 10.4b8 +sagemath-repl ~= 10.4b9 diff --git a/build/pkgs/sagemath_sirocco/version_requirements.txt b/build/pkgs/sagemath_sirocco/version_requirements.txt index 4910ccf4f54..af89ffdd30f 100644 --- a/build/pkgs/sagemath_sirocco/version_requirements.txt +++ b/build/pkgs/sagemath_sirocco/version_requirements.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-sirocco ~= 10.4b8 +sagemath-sirocco ~= 10.4b9 diff --git a/build/pkgs/sagemath_tdlib/version_requirements.txt b/build/pkgs/sagemath_tdlib/version_requirements.txt index 919126f9b00..13e940295b6 100644 --- a/build/pkgs/sagemath_tdlib/version_requirements.txt +++ b/build/pkgs/sagemath_tdlib/version_requirements.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-tdlib ~= 10.4b8 +sagemath-tdlib ~= 10.4b9 diff --git a/build/pkgs/scip/checksums.ini b/build/pkgs/scip/checksums.ini index d99a2b7930f..25100a06dad 100644 --- a/build/pkgs/scip/checksums.ini +++ b/build/pkgs/scip/checksums.ini @@ -1,4 +1,4 @@ tarball=scip-${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_MICRO}.tar.gz -sha1=bb28aef4bad00a1ff2c7f4ee982961709d15b9f8 -sha256=ee221bd13a6b24738f2e74321e2efdebd6d7c603574ca6f6cb9d4472ead2c22f +sha1=7bae5feab37e6e602d25d9468d003479d268d6a8 +sha256=08ad3e7ad6f84f457d95bb70ab21fa7fc648dd43103099359ef8a8f30fcce32e upstream_url=https://github.com/scipopt/scip/archive/refs/tags/v${VERSION_MAJOR}${VERSION_MINOR}${VERSION_MICRO}.tar.gz diff --git a/build/pkgs/scip/package-version.txt b/build/pkgs/scip/package-version.txt index 486ff8cd7ba..37ad5c8b19d 100644 --- a/build/pkgs/scip/package-version.txt +++ b/build/pkgs/scip/package-version.txt @@ -1 +1 @@ -9.0.0.p0 +9.0.1 diff --git a/build/pkgs/scip/patches/struct_symmetry_header.patch b/build/pkgs/scip/patches/struct_symmetry_header.patch deleted file mode 100644 index 39d9114a58e..00000000000 --- a/build/pkgs/scip/patches/struct_symmetry_header.patch +++ /dev/null @@ -1,14 +0,0 @@ -From https://github.com/scipopt/SCIP-SDP/issues/12#issuecomment-1969453709 - -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 5392127c5d..b66e86dec5 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -991,6 +991,7 @@ set(scipheaders - set(symheaders - symmetry/build_sassy_graph.h - symmetry/compute_symmetry.h -+ symmetry/struct_symmetry.h - symmetry/type_symmetry.h - ) - diff --git a/build/pkgs/soplex/checksums.ini b/build/pkgs/soplex/checksums.ini index 4eb6d430aff..eadf0896fcf 100644 --- a/build/pkgs/soplex/checksums.ini +++ b/build/pkgs/soplex/checksums.ini @@ -1,4 +1,4 @@ tarball=soplex-VERSION.tar.gz -sha1=5d0e7fa41b45aa0877134a5b8e261d9608505636 -sha256=ab1906d3afb1793a6f129a5baef9dd8eee929ee945aade427cb9f0b17888239c +sha1=a53fecd8d916751ee6e9a8daee0be795ed5222a6 +sha256=80cce994dcbe45fd52b60e31a3aeb5d2c60a7ddbaae495e0ce6bf58481675696 upstream_url=https://github.com/scipopt/soplex/archive/refs/tags/release-${VERSION_MAJOR}${VERSION_MINOR}${VERSION_MICRO}.tar.gz diff --git a/build/pkgs/soplex/package-version.txt b/build/pkgs/soplex/package-version.txt index 66ce77b7ead..9fe9ff9d996 100644 --- a/build/pkgs/soplex/package-version.txt +++ b/build/pkgs/soplex/package-version.txt @@ -1 +1 @@ -7.0.0 +7.0.1 diff --git a/pkgs/sage-conf/VERSION.txt b/pkgs/sage-conf/VERSION.txt index 3ed4d9d5bfe..88de6ab407c 100644 --- a/pkgs/sage-conf/VERSION.txt +++ b/pkgs/sage-conf/VERSION.txt @@ -1 +1 @@ -10.4.beta8 +10.4.beta9 diff --git a/pkgs/sage-conf_conda/VERSION.txt b/pkgs/sage-conf_conda/VERSION.txt index 3ed4d9d5bfe..88de6ab407c 100644 --- a/pkgs/sage-conf_conda/VERSION.txt +++ b/pkgs/sage-conf_conda/VERSION.txt @@ -1 +1 @@ -10.4.beta8 +10.4.beta9 diff --git a/pkgs/sage-conf_pypi/VERSION.txt b/pkgs/sage-conf_pypi/VERSION.txt index 3ed4d9d5bfe..88de6ab407c 100644 --- a/pkgs/sage-conf_pypi/VERSION.txt +++ b/pkgs/sage-conf_pypi/VERSION.txt @@ -1 +1 @@ -10.4.beta8 +10.4.beta9 diff --git a/pkgs/sage-docbuild/VERSION.txt b/pkgs/sage-docbuild/VERSION.txt index 3ed4d9d5bfe..88de6ab407c 100644 --- a/pkgs/sage-docbuild/VERSION.txt +++ b/pkgs/sage-docbuild/VERSION.txt @@ -1 +1 @@ -10.4.beta8 +10.4.beta9 diff --git a/pkgs/sage-setup/VERSION.txt b/pkgs/sage-setup/VERSION.txt index 3ed4d9d5bfe..88de6ab407c 100644 --- a/pkgs/sage-setup/VERSION.txt +++ b/pkgs/sage-setup/VERSION.txt @@ -1 +1 @@ -10.4.beta8 +10.4.beta9 diff --git a/pkgs/sage-sws2rst/VERSION.txt b/pkgs/sage-sws2rst/VERSION.txt index 3ed4d9d5bfe..88de6ab407c 100644 --- a/pkgs/sage-sws2rst/VERSION.txt +++ b/pkgs/sage-sws2rst/VERSION.txt @@ -1 +1 @@ -10.4.beta8 +10.4.beta9 diff --git a/pkgs/sagemath-bliss/VERSION.txt b/pkgs/sagemath-bliss/VERSION.txt index 3ed4d9d5bfe..88de6ab407c 100644 --- a/pkgs/sagemath-bliss/VERSION.txt +++ b/pkgs/sagemath-bliss/VERSION.txt @@ -1 +1 @@ -10.4.beta8 +10.4.beta9 diff --git a/pkgs/sagemath-categories/VERSION.txt b/pkgs/sagemath-categories/VERSION.txt index 3ed4d9d5bfe..88de6ab407c 100644 --- a/pkgs/sagemath-categories/VERSION.txt +++ b/pkgs/sagemath-categories/VERSION.txt @@ -1 +1 @@ -10.4.beta8 +10.4.beta9 diff --git a/pkgs/sagemath-coxeter3/VERSION.txt b/pkgs/sagemath-coxeter3/VERSION.txt index 3ed4d9d5bfe..88de6ab407c 100644 --- a/pkgs/sagemath-coxeter3/VERSION.txt +++ b/pkgs/sagemath-coxeter3/VERSION.txt @@ -1 +1 @@ -10.4.beta8 +10.4.beta9 diff --git a/pkgs/sagemath-environment/VERSION.txt b/pkgs/sagemath-environment/VERSION.txt index 3ed4d9d5bfe..88de6ab407c 100644 --- a/pkgs/sagemath-environment/VERSION.txt +++ b/pkgs/sagemath-environment/VERSION.txt @@ -1 +1 @@ -10.4.beta8 +10.4.beta9 diff --git a/pkgs/sagemath-mcqd/VERSION.txt b/pkgs/sagemath-mcqd/VERSION.txt index 3ed4d9d5bfe..88de6ab407c 100644 --- a/pkgs/sagemath-mcqd/VERSION.txt +++ b/pkgs/sagemath-mcqd/VERSION.txt @@ -1 +1 @@ -10.4.beta8 +10.4.beta9 diff --git a/pkgs/sagemath-meataxe/VERSION.txt b/pkgs/sagemath-meataxe/VERSION.txt index 3ed4d9d5bfe..88de6ab407c 100644 --- a/pkgs/sagemath-meataxe/VERSION.txt +++ b/pkgs/sagemath-meataxe/VERSION.txt @@ -1 +1 @@ -10.4.beta8 +10.4.beta9 diff --git a/pkgs/sagemath-objects/VERSION.txt b/pkgs/sagemath-objects/VERSION.txt index 3ed4d9d5bfe..88de6ab407c 100644 --- a/pkgs/sagemath-objects/VERSION.txt +++ b/pkgs/sagemath-objects/VERSION.txt @@ -1 +1 @@ -10.4.beta8 +10.4.beta9 diff --git a/pkgs/sagemath-repl/VERSION.txt b/pkgs/sagemath-repl/VERSION.txt index 3ed4d9d5bfe..88de6ab407c 100644 --- a/pkgs/sagemath-repl/VERSION.txt +++ b/pkgs/sagemath-repl/VERSION.txt @@ -1 +1 @@ -10.4.beta8 +10.4.beta9 diff --git a/pkgs/sagemath-sirocco/VERSION.txt b/pkgs/sagemath-sirocco/VERSION.txt index 3ed4d9d5bfe..88de6ab407c 100644 --- a/pkgs/sagemath-sirocco/VERSION.txt +++ b/pkgs/sagemath-sirocco/VERSION.txt @@ -1 +1 @@ -10.4.beta8 +10.4.beta9 diff --git a/pkgs/sagemath-tdlib/VERSION.txt b/pkgs/sagemath-tdlib/VERSION.txt index 3ed4d9d5bfe..88de6ab407c 100644 --- a/pkgs/sagemath-tdlib/VERSION.txt +++ b/pkgs/sagemath-tdlib/VERSION.txt @@ -1 +1 @@ -10.4.beta8 +10.4.beta9 diff --git a/src/VERSION.txt b/src/VERSION.txt index 3ed4d9d5bfe..88de6ab407c 100644 --- a/src/VERSION.txt +++ b/src/VERSION.txt @@ -1 +1 @@ -10.4.beta8 +10.4.beta9 diff --git a/src/bin/sage-version.sh b/src/bin/sage-version.sh index 1cf2fdb230e..e07f9f4e32b 100644 --- a/src/bin/sage-version.sh +++ b/src/bin/sage-version.sh @@ -4,6 +4,6 @@ # which stops "setup.py develop" from rewriting it as a Python file. : # This file is auto-generated by the sage-update-version script, do not edit! -SAGE_VERSION='10.4.beta8' -SAGE_RELEASE_DATE='2024-06-01' -SAGE_VERSION_BANNER='SageMath version 10.4.beta8, Release Date: 2024-06-01' +SAGE_VERSION='10.4.beta9' +SAGE_RELEASE_DATE='2024-06-09' +SAGE_VERSION_BANNER='SageMath version 10.4.beta9, Release Date: 2024-06-09' diff --git a/src/doc/en/reference/graphs/index.rst b/src/doc/en/reference/graphs/index.rst index 496f00ebcba..f681c083a08 100644 --- a/src/doc/en/reference/graphs/index.rst +++ b/src/doc/en/reference/graphs/index.rst @@ -78,6 +78,7 @@ Libraries of algorithms sage/graphs/centrality sage/graphs/asteroidal_triples sage/graphs/independent_sets + sage/graphs/cographs sage/graphs/comparability sage/graphs/line_graph sage/graphs/spanning_tree diff --git a/src/doc/en/reference/references/index.rst b/src/doc/en/reference/references/index.rst index 0e8cdaee1cf..3d314f9c466 100644 --- a/src/doc/en/reference/references/index.rst +++ b/src/doc/en/reference/references/index.rst @@ -3638,6 +3638,11 @@ REFERENCES: .. [Jon2005] \V. Jones, The Jones Polynomial, 2005. https://math.berkeley.edu/~vfr/jones.pdf +.. [JPD2018] Átila A. Jones, Fábio Protti and Renata R. Del-Vecchio: + *Cograph generation with linear delay*. + Theoretical Computer Science, 713:1-10, 2018. + :doi:`10.1016/j.tcs.2017.12.037` + .. [JRJ94] Jourdan, Guy-Vincent; Rampon, Jean-Xavier; Jard, Claude (1994), "Computing on-line the lattice of maximal antichains of posets", Order 11 (3) p. 197-210, :doi:`10.1007/BF02115811` diff --git a/src/sage/algebras/lie_algebras/representation.py b/src/sage/algebras/lie_algebras/representation.py index 1eb0a8b6a2e..73c492d382f 100644 --- a/src/sage/algebras/lie_algebras/representation.py +++ b/src/sage/algebras/lie_algebras/representation.py @@ -16,6 +16,7 @@ # https://www.gnu.org/licenses/ # **************************************************************************** +from sage.misc.cachefunc import cached_method from sage.sets.family import Family, AbstractFamily from sage.matrix.constructor import matrix from sage.combinat.free_module import CombinatorialFreeModule @@ -786,3 +787,243 @@ def _acted_upon_(self, scalar, self_on_left=False): return P._project(P._to_pbw(scalar) * self._lift_pbw()) return super()._acted_upon_(scalar, self_on_left) + + +class FaithfulRepresentationPBWPosChar(CombinatorialFreeModule, Representation_abstract): + r""" + A faithful representation of a finite dimensional Lie algebra + in positive characteristic. + + .. WARNING:: + + This is often a very large dimensional representation relative + to the dimension of the Lie algebra. + + ALGORITHM: + + We implement the algorithm given in [deG2000] Section 6.6. Let `L` + be a finite dimensional Lie algebra over a ring of characteristic `p` + with basis `(b_1, \ldots, b_n)`. We compute (monic) `p`-polynomials + `f_i` such that `A = \mathrm{ad}(b_i)` (the adjoint action of `b_i`) + solves `f_i(A) = 0` by using minimal polynomial of `A`. The + `(f_1, \ldots, f_n)` is a Gröbner basis for an ideal `I` of the + universal enveloping algebra `U(L)` such that the quotient `U(L) / I` + is a faithful representation of `L`. + + EXAMPLES:: + + sage: sl2 = LieAlgebra(GF(3), cartan_type=['A',1]) + sage: F = sl2.faithful_representation() + sage: F + Faithful representation with p-multiplicities (1, 3, 1) of Lie algebra + of ['A', 1] in the Chevalley basis + sage: F.dimension() + 243 + """ + def __init__(self, L): + r""" + Initialize ``self``. + + EXAMPLES:: + + sage: sl2 = LieAlgebra(GF(3), cartan_type=['A',1]) + sage: F = sl2.faithful_representation() + sage: TestSuite(F).run() + """ + R = L.base_ring() + self._p = R.characteristic() + if self._p == 0: + raise ValueError("the Lie algebra must be over a ring of positive characteristic") + + self._pbw = L.pbw_basis() + self._key_order = tuple(self._pbw.algebra_generators().keys()) + + # calculate the Gröbner basis and p-exponents + gb = [] + p_exp = [] + B = L.basis() + for k in self._key_order: + b = B[k] + ad = b.adjoint_matrix() + g = ad.minpoly() + d = g.degree() + # TODO: Use the sparse polynomial ring? + x = g.parent().gen() + r = [x**(self._p**i) % g for i in range(d+1)] + deg = max(ri.degree() for ri in r) + mat = matrix(R, [[ri[j] for ri in r] for j in range(deg+1)]) + la = mat.right_kernel_matrix()[0] + if la: + mongen = self._pbw._indices.monoid_generators()[k] + gb.append(self._pbw._from_dict({mongen ** (self._p ** i): val + for i, val in enumerate(la) if val}, + remove_zeros=False)) + p_exp.append(max(la.support())) + + self._groebner_basis = gb + self._p_exp = tuple(p_exp) + self._degrees = [self._p ** m for m in self._p_exp] + + from sage.groups.abelian_gps.abelian_group import AbelianGroup + indices = AbelianGroup(self._degrees) + + Representation_abstract.__init__(self, L) + CombinatorialFreeModule.__init__(self, R, indices, prefix='', bracket=False) + + def _repr_(self): + r""" + Return a string representation of ``self``. + + EXAMPLES:: + + sage: sl3 = LieAlgebra(GF(3), cartan_type=['A',2]) + sage: sl3.faithful_representation() + Faithful representation with p-multiplicities (1, 1, 1, 3, 3, 1, 1, 1) + of Lie algebra of ['A', 2] in the Chevalley basis + """ + return "Faithful representation with p-multiplicities {} of {}".format(self.p_exponents(), self._lie_algebra) + + def _latex_(self): + r""" + Return a string representation of ``self``. + + EXAMPLES:: + + sage: sl2 = LieAlgebra(GF(3), cartan_type=['A',1]) + sage: latex(sl2.faithful_representation()) + U(\mathfrak{g}(A_{1})_{\Bold{F}_{3}}) / \langle PBW_{\alpha_{1}}^{3}, + 2 PBW_{\alpha^\vee_{1}}^{27} + PBW_{\alpha^\vee_{1}}, + PBW_{-\alpha_{1}}^{3} \rangle + """ + from sage.misc.latex import latex + g = latex(self._lie_algebra) + data = ', '.join(latex(f) for f in self._groebner_basis) + return "U({}) / \\langle {} \\rangle".format(g, data) + + @cached_method + def p_exponents(self): + """ + Return the `p`-exponents of ``self``. + + Let `p` be the characteristic of the base ring of ``self``. + The `p`-*exponents* are the exponents `m_i` such that the `i`-th + `p`-polynomial `f_i` is of degree `p^{m_i}`. + + EXAMPLES:: + + sage: sp4 = LieAlgebra(GF(3), cartan_type=['C',2]) + sage: F = sp4.faithful_representation() + sage: F.p_exponents() + (1, 1, 1, 1, 3, 3, 1, 1, 1, 1) + """ + return self._p_exp + + def groebner_basis(self): + """ + Return the defining Gröbner basis of ``self``. + + EXAMPLES:: + + sage: sp4 = LieAlgebra(GF(3), cartan_type=['C',2]) + sage: F = sp4.faithful_representation() + sage: F.groebner_basis() + [PBW[alpha[2]]^3, + PBW[alpha[1]]^3, + PBW[alpha[1] + alpha[2]]^3, + PBW[2*alpha[1] + alpha[2]]^3, + 2*PBW[alphacheck[1]]^27 + PBW[alphacheck[1]], + 2*PBW[alphacheck[2]]^27 + PBW[alphacheck[2]], + PBW[-alpha[2]]^3, + PBW[-alpha[1]]^3, + PBW[-alpha[1] - alpha[2]]^3, + PBW[-2*alpha[1] - alpha[2]]^3] + """ + return self._groebner_basis + + def _project(self, x): + r""" + The projection to ``self`` from the PBW basis. + + EXAMPLES:: + + sage: sl2 = LieAlgebra(GF(3), cartan_type=['A',1]) + sage: F = sl2.faithful_representation() + sage: PBW = F._pbw + sage: elt = PBW.an_element(); elt + PBW[alpha[1]]^2*PBW[alphacheck[1]]^2*PBW[-alpha[1]]^3 + + 2*PBW[alpha[1]] + 1 + sage: F._project(elt) + 1 + 2*f0 + sage: F._project(elt^2) + 1 + f0 + f0^2 + sage: F._project(elt^3) + 1 + + sage: elt = PBW(sum(sl2.basis())); elt + PBW[alpha[1]] + PBW[alphacheck[1]] + PBW[-alpha[1]] + sage: F._project(elt) + f2 + f1 + f0 + sage: F._project(elt^2) + 2*f2 + f2^2 + 2*f1 + 2*f1*f2 + f1^2 + 2*f0 + 2*f0*f2 + 2*f0*f1 + f0^2 + sage: F._project(elt^3) + 2*f2 + f1 + f1^3 + 2*f0 + sage: F._project(elt^4) + f2 + 2*f2^2 + f1 + f1^2 + f1^3*f2 + f1^4 + f0 + f0*f2 + f0*f1^3 + 2*f0^2 + """ + reduction = True + while reduction: + reduction = False + mc = x._monomial_coefficients + for m, c in mc.items(): + d = m.dict() + for k, e, g in zip(self._key_order, self._degrees, self._groebner_basis): + if k not in d: + continue + if d[k] >= e: + d[k] -= e + x -= self._pbw.monomial(self._pbw._indices(d)) * g + reduction = True + break + data = {} + for m, c in x._monomial_coefficients.items(): + d = m.dict() + data[self._indices([d.get(k, 0) for k in self._key_order])] = c + return self.element_class(self, data) + + class Element(CombinatorialFreeModule.Element): + def _acted_upon_(self, scalar, self_on_left=False): + r""" + Return the action of ``scalar`` on ``self``. + + EXAMPLES:: + + sage: sl2 = LieAlgebra(GF(3), cartan_type=['A',1]) + sage: F = sl2.faithful_representation() + sage: v = F.an_element(); v + 1 + 2*f2 + f0*f1*f2 + sage: sl2.an_element() * v + f2 + 2*f2^2 + f1 + 2*f1*f2 + 2*f1^2*f2 + f0 + 2*f0*f2 + 2*f0*f2^2 + + 2*f0*f1*f2 + f0*f1*f2^2 + f0*f1^2*f2 + f0^2*f1*f2 + sage: sl2.pbw_basis().an_element() * v + 1 + 2*f2 + 2*f0 + f0*f2 + f0*f1*f2 + 2*f0^2*f1*f2 + sage: 5 * v + 2 + f2 + 2*f0*f1*f2 + sage: v * 5 + 2 + f2 + 2*f0*f1*f2 + sage: v._acted_upon_(sl2.an_element(), True) is None + True + """ + P = self.parent() + if scalar in P._lie_algebra or scalar in P._pbw: + if self_on_left: + return None + if not self: # we are (already) the zero vector + return self + scalar = P._pbw(scalar) + monoid = P._pbw._indices + I = P._key_order + lift = P._pbw.element_class(P._pbw, {monoid(list(zip(I, m.exponents()))): coeff + for m, coeff in self._monomial_coefficients.items()}) + return P._project(scalar * lift) + + return super()._acted_upon_(scalar, self_on_left) diff --git a/src/sage/categories/finite_dimensional_lie_algebras_with_basis.py b/src/sage/categories/finite_dimensional_lie_algebras_with_basis.py index 30feac64c34..7fd8b76c38f 100644 --- a/src/sage/categories/finite_dimensional_lie_algebras_with_basis.py +++ b/src/sage/categories/finite_dimensional_lie_algebras_with_basis.py @@ -2412,7 +2412,7 @@ def faithful_representation(self, algorithm=None): - ``algorithm`` -- one of the following depending on the classification of the Lie algebra: - Nilpotent Lie algebras: + Nilpotent: * ``'regular'`` -- use the universal enveloping algebra quotient :class:`~sage.algebras.lie_algebras.representation.FaithfulRepresentationNilpotentPBW` @@ -2420,7 +2420,7 @@ def faithful_representation(self, algorithm=None): precise details, see the documentation of :class:`~sage.algebras.lie_algebras.representation.FaithfulRepresentationNilpotentPBW`) - Solvable but not nilpotent: + Solvable: * Not implemented @@ -2430,7 +2430,13 @@ def faithful_representation(self, algorithm=None): General case - * Not implemented + * ``'generic'`` -- generic algortihm (only implemented currently + for positive characteristic) + + Note that the algorithm for any more generic cases can be used + in the specialized cases. For instance, using ``'generic'`` for + any Lie algebra (e.g., even if nilpotent) will use the generic + implementation. EXAMPLES:: @@ -2480,7 +2486,10 @@ def faithful_representation(self, algorithm=None): if algorithm == "minimal": from sage.algebras.lie_algebras.representation import FaithfulRepresentationNilpotentPBW return FaithfulRepresentationNilpotentPBW(self, minimal=True) - else: + if algorithm is None or algorithm == "generic": + if self.base_ring().characteristic() > 0: + from sage.algebras.lie_algebras.representation import FaithfulRepresentationPBWPosChar + return FaithfulRepresentationPBWPosChar(self) raise NotImplementedError("only implemented for nilpotent Lie algebras") raise ValueError("invalid algorithm '{}'".format(algorithm)) diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index b3b54e0a5aa..866e8920c61 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -463,17 +463,17 @@ def __classcall_private__(cls, l, check=True): # if l is a pair of standard tableaux or a pair of lists elif isinstance(l, (tuple, list)) and len(l) == 2 and \ - all(isinstance(x, Tableau) for x in l): + all(isinstance(x, Tableau) for x in l): return RSK_inverse(*l, output='permutation') elif isinstance(l, (tuple, list)) and len(l) == 2 and \ - all(isinstance(x, list) for x in l): - P,Q = (Tableau(_) for _ in l) + all(isinstance(x, list) for x in l): + P, Q = (Tableau(_) for _ in l) return RSK_inverse(P, Q, 'permutation') # if it's a tuple or nonempty list of tuples, also assume cycle # notation elif isinstance(l, tuple) or \ (isinstance(l, list) and l and - all(isinstance(x, tuple) for x in l)): + all(isinstance(x, tuple) for x in l)): if l and (isinstance(l[0], (int, Integer)) or len(l[0]) > 0): if isinstance(l[0], tuple): n = max(max(x) for x in l) @@ -683,8 +683,8 @@ def _latex_(self): return " ".join(f"{let}_{{{i}}}" for i in redword) if display == "twoline": return r"\begin{{pmatrix}} {} \\ {} \end{{pmatrix}}".format( - " & ".join("%s" % i for i in range(1, len(self._list)+1)), - " & ".join("%s" % i for i in self._list)) + " & ".join("%s" % i for i in range(1, len(self._list)+1)), + " & ".join("%s" % i for i in self._list)) if display == "list": return repr(self._list) if display == "cycle": @@ -1083,20 +1083,20 @@ def _to_cycles_set(self, singletons=True): if not singletons: # remove the fixed points - L = {i+1 for i,pi in enumerate(p) if pi != i+1} + L = {i for i, pi in enumerate(p, start=1) if pi != i} else: - L = set(range(1,len(p)+1)) + L = set(range(1, len(p) + 1)) # Go through until we've considered every remaining number while L: # take the first remaining element cycleFirst = L.pop() - next = p[cycleFirst-1] + next = p[cycleFirst - 1] cycle = [cycleFirst] while next != cycleFirst: cycle.append(next) L.remove(next) - next = p[next-1] + next = p[next - 1] # add the cycle cycles.append(tuple(cycle)) @@ -1124,7 +1124,7 @@ def _to_cycles_list(self, singletons=True): if not singletons: # remove the fixed points - L = [i + 1 for i, pi in enumerate(p) if pi != i + 1] + L = [i for i, pi in enumerate(p, start=1) if pi != i] else: L = list(range(1, len(p) + 1)) @@ -1140,7 +1140,7 @@ def _to_cycles_list(self, singletons=True): cycle.append(next) # remove next from L # we use a binary search to find it - L.pop(bisect_left(L,next)) + L.pop(bisect_left(L, next)) next = p[next-1] # add the cycle cycles.append(tuple(cycle)) @@ -1179,7 +1179,7 @@ def signature(self) -> Integer: sage: Permutation([]).sign() 1 """ - return (-1)**(len(self)-len(self.to_cycles())) + return (-1)**(len(self) - len(self.to_cycles())) # one can also use sign as an alias for signature sign = signature @@ -1607,7 +1607,7 @@ def merge_and_countv(ivA_A, ivB_B): else: C.extend(B[j:]) ivC.extend(ivB[j:]) - return ivC,C + return ivC, C def base_case(L): s = sorted(L) @@ -1643,7 +1643,7 @@ def inversions(self) -> list: """ p = self[:] n = len(p) - return [(i+1,j+1) for i in range(n-1) for j in range(i+1,n) + return [(i+1, j+1) for i in range(n-1) for j in range(i+1, n) if p[i] > p[j]] def stack_sort(self) -> Permutation: @@ -1932,7 +1932,7 @@ def absolute_length(self) -> Integer: """ return self.size() - len(self.cycle_type()) - @combinatorial_map(order=2,name='inverse') + @combinatorial_map(order=2, name='inverse') def inverse(self) -> Permutation: r""" Return the inverse of ``self``. @@ -1947,8 +1947,8 @@ def inverse(self) -> Permutation: [3, 1, 5, 2, 4] """ w = list(range(len(self))) - for i, j in enumerate(self): - w[j - 1] = i + 1 + for i, j in enumerate(self, start=1): + w[j - 1] = i return Permutations()(w) __invert__ = inverse @@ -3092,7 +3092,6 @@ def number_of_fixed_points(self) -> Integer: sage: Permutation([1,2,3,4]).number_of_fixed_points() 4 """ - return len(self.fixed_points()) def is_derangement(self) -> bool: @@ -3789,7 +3788,7 @@ def weak_excedences(self) -> list: sage: Permutation([1,4,3,2,5]).weak_excedences() [1, 4, 3, 5] """ - return [pi for i, pi in enumerate(self) if pi >= i + 1] + return [pi for i, pi in enumerate(self, start=1) if pi >= i] def bruhat_inversions(self) -> list: r""" @@ -5381,7 +5380,7 @@ def shifted_shuffle(self, other): True """ return self.shifted_concatenation(other, "right").\ - right_permutohedron_interval(self.shifted_concatenation(other, "left")) + right_permutohedron_interval(self.shifted_concatenation(other, "left")) def nth_roots(self, n): r""" @@ -5491,8 +5490,8 @@ def rewind(L, n): b = True poss = [P.identity()] for pa in partition: - poss = [p*q for p in poss - for q in merging_cycles([rewind(cycles[m][i-1], n//len(pa)) for i in pa])] + poss = [p*q for p in poss + for q in merging_cycles([rewind(cycles[m][i-1], n//len(pa)) for i in pa])] possibilities[i] += poss if not b: return @@ -5624,6 +5623,7 @@ def number_of_nth_roots(self, n): return result + def _tableau_contribution(T): r""" Get the number of SYT of shape(``T``). @@ -5867,21 +5867,21 @@ def __classcall_private__(cls, n=None, k=None, **kwargs): if len(a) == 1 and a[0] != 1: a = a[0] if a in StandardPermutations_all(): - if a == [1,2]: + if a == [1, 2]: return StandardPermutations_avoiding_12(n) - elif a == [2,1]: + elif a == [2, 1]: return StandardPermutations_avoiding_21(n) - elif a == [1,2,3]: + elif a == [1, 2, 3]: return StandardPermutations_avoiding_123(n) - elif a == [1,3,2]: + elif a == [1, 3, 2]: return StandardPermutations_avoiding_132(n) - elif a == [2,1,3]: + elif a == [2, 1, 3]: return StandardPermutations_avoiding_213(n) - elif a == [2,3,1]: + elif a == [2, 3, 1]: return StandardPermutations_avoiding_231(n) - elif a == [3,1,2]: + elif a == [3, 1, 2]: return StandardPermutations_avoiding_312(n) - elif a == [3,2,1]: + elif a == [3, 2, 1]: return StandardPermutations_avoiding_321(n) else: return StandardPermutations_avoiding_generic(n, (a,)) @@ -5981,36 +5981,36 @@ class options(GlobalOptions): NAME = 'Permutations' module = 'sage.combinat.permutation' display = {'default': "list", - 'description': "Specifies how the permutations should be printed", - 'values': {'list': "the permutations are displayed in list notation" - " (aka 1-line notation)", - 'cycle': "the permutations are displayed in cycle notation" - " (i. e., as products of disjoint cycles)", - 'singleton': "the permutations are displayed in cycle notation" - " with singleton cycles shown as well", - 'reduced_word': "the permutations are displayed as reduced words"}, - 'alias': {'word': "reduced_word", 'reduced_expression': "reduced_word"}, - 'case_sensitive': False} - latex = {'default': "list", - 'description': "Specifies how the permutations should be latexed", - 'values': {'list': "latex as a list in one-line notation", - 'twoline': "latex in two-line notation", - 'cycle': "latex in cycle notation", - 'singleton': "latex in cycle notation with singleton cycles shown as well", - 'reduced_word': "latex as reduced words"}, - 'alias': {'word': "reduced_word", 'reduced_expression': "reduced_word", 'oneline': "list"}, + 'description': "Specifies how the permutations should be printed", + 'values': {'list': "the permutations are displayed in list notation" + " (aka 1-line notation)", + 'cycle': "the permutations are displayed in cycle notation" + " (i. e., as products of disjoint cycles)", + 'singleton': "the permutations are displayed in cycle notation" + " with singleton cycles shown as well", + 'reduced_word': "the permutations are displayed as reduced words"}, + 'alias': {'word': "reduced_word", 'reduced_expression': "reduced_word"}, 'case_sensitive': False} + latex = {'default': "list", + 'description': "Specifies how the permutations should be latexed", + 'values': {'list': "latex as a list in one-line notation", + 'twoline': "latex in two-line notation", + 'cycle': "latex in cycle notation", + 'singleton': "latex in cycle notation with singleton cycles shown as well", + 'reduced_word': "latex as reduced words"}, + 'alias': {'word': "reduced_word", 'reduced_expression': "reduced_word", 'oneline': "list"}, + 'case_sensitive': False} latex_empty_str = {'default': "1", - 'description': 'The LaTeX representation of a reduced word when said word is empty', - 'checker': lambda char: isinstance(char,str)} + 'description': 'The LaTeX representation of a reduced word when said word is empty', + 'checker': lambda char: isinstance(char, str)} generator_name = {'default': "s", - 'description': "the letter used in latexing the reduced word", - 'checker': lambda char: isinstance(char,str)} + 'description': "the letter used in latexing the reduced word", + 'checker': lambda char: isinstance(char, str)} mult = {'default': "l2r", - 'description': "The multiplication of permutations", - 'values': {'l2r': r"left to right: `(p_1 \cdot p_2)(x) = p_2(p_1(x))`", - 'r2l': r"right to left: `(p_1 \cdot p_2)(x) = p_1(p_2(x))`"}, - 'case_sensitive': False} + 'description': "The multiplication of permutations", + 'values': {'l2r': r"left to right: `(p_1 \cdot p_2)(x) = p_2(p_1(x))`", + 'r2l': r"right to left: `(p_1 \cdot p_2)(x) = p_1(p_2(x))`"}, + 'case_sensitive': False} class Permutations_nk(Permutations): @@ -6093,7 +6093,8 @@ def __iter__(self) -> Iterator[Permutation]: sage: [p for p in Permutations(3,4)] [] """ - for x in itertools.permutations(range(1,self.n+1), int(self._k)): + for x in itertools.permutations(range(1, self.n + 1), + int(self._k)): yield self.element_class(self, x, check=False) def cardinality(self) -> Integer: @@ -7762,8 +7763,8 @@ def inverse(self): [4, 2, 1, 3] """ w = list(range(len(self))) - for i, j in enumerate(self): - w[j - 1] = i + 1 + for i, j in enumerate(self, start=1): + w[j - 1] = i return self.__class__(self.parent(), w) __invert__ = inverse @@ -7879,8 +7880,8 @@ def from_rank(n, rank): """ # Find the factoradic of rank factoradic = [None] * n - for j in range(1,n+1): - factoradic[n-j] = Integer(rank % j) + for j in range(1, n + 1): + factoradic[n - j] = Integer(rank % j) rank = int(rank) // j return from_lehmer_code(factoradic, Permutations(n)) @@ -7907,8 +7908,8 @@ def from_inversion_vector(iv, parent=None): """ p = iv[:] open_spots = list(range(len(iv))) - for i, ivi in enumerate(iv): - p[open_spots.pop(ivi)] = i + 1 + for i, ivi in enumerate(iv, start=1): + p[open_spots.pop(ivi)] = i if parent is None: parent = Permutations() @@ -8193,16 +8194,16 @@ def bistochastic_as_sum_of_permutations(M, check=True): while G.size() > 0: matching = G.matching(use_edge_labels=True) - matching = [(min(u,v), max(u, v), w) for u,v,w in matching] + matching = [(min(u, v), max(u, v), w) for u, v, w in matching] # This minimum is strictly larger than 0 minimum = min([x[2] for x in matching]) - for (u,v,l) in matching: + for u, v, l in matching: if minimum == l: - G.delete_edge((u,v,l)) + G.delete_edge((u, v, l)) else: - G.set_edge_label(u,v,l-minimum) + G.set_edge_label(u, v, l - minimum) matching.sort(key=lambda x: x[0]) value += minimum * CFM(P([x[1]-n+1 for x in matching])) @@ -8492,9 +8493,9 @@ def descents_composition_last(dc): raise TypeError("The argument must be of type Composition") s = 0 res = [] - for i in reversed(range(len(dc))): - res = list(range(s+1,s+dc[i]+1)) + res - s += dc[i] + for dci in reversed(dc): + res = list(range(s + 1, s + dci + 1)) + res + s += dci return Permutations()(res) @@ -8767,7 +8768,7 @@ def from_major_code(mc, final_descent=False): # the letter i into the word w^(i+1) in such a way that # maj(w^i)-maj(w^(i+1)) = mc[i] - for i in reversed(range(1,len(mc))): + for i in reversed(range(1, len(mc))): # Lemma 2.2 in Skandera # Get the descents of w and place them in reverse order diff --git a/src/sage/graphs/cographs.py b/src/sage/graphs/cographs.py new file mode 100644 index 00000000000..b921375f643 --- /dev/null +++ b/src/sage/graphs/cographs.py @@ -0,0 +1,515 @@ +r""" +Cographs + +A cograph is a `P_4`-free graph, that is a graph without induced path of order +4. Any cograph may be constructed, starting from the single vertex graph, by a +sequence of join and disjoint union operations. See the :wikipedia:`Cograph` for +more details on this graph class, and :oeis:`A000084` to know the number of +cographs of order `n \geq 1`. + +This module implements the folowing methods concerning cographs: + +.. csv-table:: + :class: contentstable + :widths: 30, 70 + :delim: | + + :meth:`cographs` | Return an iterator over the cographs of order `n`. + +Methods +------- +""" +# **************************************************************************** +# Copyright (C) 2017-2024 Marianna Spyrakou +# 2024 David Coudert +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# https://www.gnu.org/licenses/ +# **************************************************************************** + +from sage.combinat.partitions import AccelAsc_next + + +class CoTree: + r""" + Generic cotree node. + + This data structure is used for the generation of cographs in + :meth:`cographs`. + """ + def __init__(self, name='root'): + r""" + Initialize a cotree. + + INPUT: + + - ``name`` -- either an operation ('U' or 'J') or the size of the + subtree rooted at this node + + EXAMPLES:: + + sage: from sage.graphs.cographs import CoTree + sage: CoTree(1) + ( 1 ) + sage: CoTree() + ( root ) + """ + self.name = name + self.children = [] + self.info = None + self.parent = None + + def __str__(self): + r""" + Return a string representation of ``self``. + + The subtree of a node is inside brackets and starts with the operation + to perform between the children ('J' for join or 'U' for disjoint + union). + + EXAMPLES:: + + sage: from sage.graphs.cographs import CoTree + sage: CoTree(1) + ( 1 ) + sage: CoTree('J') + [ J ] + sage: next(graphs.cographs(4, as_graph=False)) # indirect doctest + [ J ( 0 ) ( 1 ) ( 2 ) ( 3 ) ] + """ + first = '[' if self.name in ['J', 'U'] else '(' + last = ' ]' if self.name in ['J', 'U'] else ' )' + s = f"{first} {self.name}" + for child in self.children: + s += f' {child}' + s += last + return s + + __repr__ = __str__ + + def add_child(self, node): + r""" + Add cotree ``node`` in the list of children of ``self``. + + INPUT: + + - ``node`` -- a CoTree + + EXAMPLES:: + + sage: from sage.graphs.cographs import CoTree + sage: T = CoTree('J') + sage: T.add_child(CoTree(1)) + sage: T + [ J ( 1 ) ] + """ + assert isinstance(node, CoTree) + self.children.append(node) + node.parent = self + + def copy_tree(self, T): + r""" + Make `T` a copy of ``self``. + + INPUT: + + - ``T`` -- a CoTree + + EXAMPLES:: + + sage: from sage.graphs.cographs import CoTree + sage: T = CoTree('J') + sage: T.add_child(CoTree(1)) + sage: T.add_child(CoTree(2)) + sage: T + [ J ( 1 ) ( 2 ) ] + sage: B = CoTree('U') + sage: T.copy_tree(B) + sage: B + [ U ( 1 ) ( 2 ) ] + """ + for i, child in enumerate(self.children): + T.add_child(CoTree(child.name)) + child.copy_tree(T.children[i]) + + def reset_info(self): + r""" + Reset parameter ``info`` from all nodes of ``self``. + + EXAMPLES:: + + sage: from sage.graphs.cographs import CoTree + sage: T = CoTree(1) + sage: B = CoTree(2) + sage: T.add_child(B) + sage: C = CoTree(3) + sage: B.add_child(C) + sage: C.info = 'info' + sage: T.reset_info() + sage: C.info is None + True + """ + for child in self.children: + child.reset_info() + self.info = None + + +def rebuild_node(u, P): + r""" + Replace the subtree rooted at `u` by a subtree induced by partition `P`. + + This is a helper method to method :meth:`cographs`. + + INPUT: + + - ``u`` -- a ``CoTree`` + + - ``P`` -- a partition encoding the new structure of the children of `u` + + EXAMPLES:: + + sage: next(graphs.cographs(3, as_graph=True)).vertices() # indirect doctest + [0, 1, 2] + """ + if P is None: + print('P is None') + u.children = [] # delete the subtree rooted at u + for value in P: + this_child = CoTree(value) + u.add_child(this_child) + if value > 1: + for j in range(value): + this_child.add_child(CoTree(1)) + + +def find_pivot(T): + r""" + Search for a pivot node in `T`. + + This is a helper method to method :meth:`cographs`. + + A node in `T` is a ``pivot`` if it is not a leaf, it does not induce a + maximum partition and it is the first such node in the inverse postorder + traversal. + + INPUT: + + - ``T`` -- a ``CoTree`` + + EXAMPLES:: + + sage: next(graphs.cographs(3, as_graph=True)).vertices() # indirect doctest + [0, 1, 2] + """ + for child in reversed(T.children): + pivot = find_pivot(child) + if pivot is not None: + return pivot + + # Check if T is a pivot + i = T.name + if (i != 1 and ((i//2 != T.children[0].name) or + (i//2 + i % 2 != T.children[1].name))): + T.info = 'p' # pivot mark + return T + return None + + +def next_tree(T): + r""" + Check if there is another tree after `T`. + + This is a helper method to method :meth:`cographs`. + + This methods returns ``True`` if there is a tree after `T`, and if so it + modifies the input tree `T` that becomes the next tree. + + INPUT: + + - ``T`` -- a ``CoTree`` + + EXAMPLES:: + + sage: next(graphs.cographs(3, as_graph=True)).vertices() # indirect doctest + [0, 1, 2] + """ + pivot = find_pivot(T) + if pivot is None: + return False + + # Find the next partition induced by the subtree pivot. + # Partitions are represented in ascending order (i.e., `P_i \leq P_{i+1}`) + # and we search for the next partition in lexicographic order. + partition = [c.name for c in pivot.children] + P = AccelAsc_next(partition) + # and rebuild the subtree of pivot accordingly + rebuild_node(pivot, P) + + x = pivot + while x.parent is not None: + ancestor = x.parent + # Modify the bigger siblings of x (i.e., the siblings placed after + # x in the list of children of ancestor) + is_bigger_sibling = False + for y, this_child in enumerate(ancestor.children): + if this_child.info == 'p': + is_bigger_sibling = True + elif is_bigger_sibling: # true only for bigger siblings of x + if x.name == this_child.name: + temp = CoTree(x.name) + x.copy_tree(temp) + ancestor.children[y] = temp # copy subtree T(x) in T(y) + temp.parent = ancestor + else: + P = [1] * ancestor.children[y].name + rebuild_node(ancestor.children[y], P) + + # Make the parent of x (if any) the new pivot + x.info = None # reset the pivot mark + ancestor.info = 'p' # parent gets the pivot mark + x = ancestor + + return True + + +def cographs(n, as_graph=True, immutable=False): + r""" + Return an iterator over the cographs of order `n`. + + A cograph is a `P_4`-free graph, that is a graph without induced path of + order 4. Any cograph may be constructed, starting from the single vertex + graph, by a sequence of :meth:`sage.graphs.graph.Graph.join` and + :meth:`sage.graphs.generic_graph.GenericGraph.disjoint_union` operations. + See the :wikipedia:`Cograph` for more details. + + This method implements the generator of all cographs of order `n` proposed + in [JPD2018]_. The algorithm generates one by one every cotree with `n` + nodes, and each cotree is generated by using its previous cotree. The time + to construct the first cotree is `O(n)` and the time spent between two + consecutive outputs is `O(n)`. Hence, the overall complexity of the + algorithm is `O(n*M_n)`, where `n` is the number of nodes and `M_n` is the + total number of cographs with `n` nodes (see :oeis:`A000084`). + + INPUT: + + - ``n`` -- an integer larger or equal to 1 + + - ``as_graph`` -- boolean (default: ``True``); whether to return graphs or + the tree data structure encoding the graph + + - ``immutable`` -- boolean (default: ``False``); whether to return an + immutable or a mutable graph. This parameter is used only when ``as_graph + is True``. + + EXAMPLES: + + The output can be either cotrees or graphs:: + + sage: for t in graphs.cographs(3, as_graph=False): + ....: print(t) + [ J ( 0 ) ( 1 ) ( 2 ) ] + [ J [ U ( 0 ) ( 1 ) ( 2 ) ] ] + [ J ( 0 ) [ U ( 1 ) ( 2 ) ] ] + [ J [ U ( 0 ) [ J ( 1 ) ( 2 ) ] ] ] + sage: for g in graphs.cographs(3, as_graph=True): + ....: print(g.edges(labels=False, sort=True)) + [(0, 1), (0, 2), (1, 2)] + [] + [(0, 1), (0, 2)] + [(1, 2)] + + Check that we agree with :oeis:`A000084`:: + + sage: [sum(1 for _ in graphs.cographs(n, as_graph=False)) + ....: for n in range(1, 8)] + [1, 2, 4, 10, 24, 66, 180] + + TESTS:: + + sage: g = next(graphs.cographs(2, as_graph=True, immutable=False)) + sage: g.is_immutable() + False + sage: g = next(graphs.cographs(2, as_graph=True, immutable=True)) + sage: g.is_immutable() + True + sage: next(graphs.cographs(0)) + Traceback (most recent call last): + ... + ValueError: parameter n must be at least >= 1 + """ + if n < 1: + raise ValueError('parameter n must be at least >= 1') + if as_graph: + def func(T): + return tree_to_graph(T, immutable=immutable) + else: + def func(T): + return T + + if n == 1: + T = CoTree('J') + B = CoTree('U') + B.add_child(CoTree(0)) + T.add_child(B) + yield func(T) + return + + # Construct the minimum tree + T = CoTree(n) + for j in range(n): + T.add_child(CoTree(1)) + + while True: + # T corresponds to 2 cotrees: one with 'U' root and one with 'J' root + tree_J = CoTree(T.name) + T.copy_tree(tree_J) + tree_U = CoTree(T.name) + T.copy_tree(tree_U) + # tree_J has root 'J' + change_label(tree_J, True, [0]) + # tree 0 has root 'U' + change_label(tree_U, False, [0]) + tree_UU = CoTree('J') + tree_UU.add_child(tree_U) + yield func(tree_J) + yield func(tree_UU) + if not next_tree(T): + break + + +def change_label(tree, status, counter): + r""" + Set the names of the nodes of ``tree``. + + This is a helper method to method :meth:`cographs`. + + The input ``tree`` is such that each node has as label its number of + children. This method changes the label of each node so that a parallel + node is labeled 'U', a series node is labeled 'J' and a leaf node gets a + unique number. + + INPUT: + + - ``tree`` -- the tree to relabel + + - ``status`` -- boolean; used to to detect series (``True``) and parallel + (``False``) internal nodes + + - ``counter`` -- list; the first integer of the list is used to assign a + unique number to the leaves of the tree + + EXAMPLES:: + + sage: next(graphs.cographs(4, as_graph=True)).vertices() # indirect doctest + [0, 1, 2, 3] + """ + if tree.name != 1: + tree.name = 'J' if status else 'U' + else: + tree.name = counter[0] + counter[0] += 1 + for child in tree.children: + if child is not None: + change_label(child, not status, counter) + + +def tree_to_graph(tree, immutable=False): + r""" + Return the cograph represented by ``tree``. + + This is a helper method to method :meth:`cographs`. + + EXAMPLES:: + + sage: for t in graphs.cographs(3, as_graph=True): # indirect doctest + ....: print(t.edges(labels=False, sort=True)) + [(0, 1), (0, 2), (1, 2)] + [] + [(0, 1), (0, 2)] + [(1, 2)] + """ + from sage.graphs.graph import Graph + g = Graph() + _tree_to_graph_rec(tree, g) + return g.copy(immutable=True) if immutable else g + + +def _tree_to_graph_rec(tree, g): + r""" + Add recursively one by one the vertices and edges of ``tree`` to ``g``. + + This is a helper method to method :meth:`tree_to_graph`. + + EXAMPLES:: + + sage: for t in graphs.cographs(3, as_graph=True): # indirect doctest + ....: print(t.edges(labels=False, sort=True)) + [(0, 1), (0, 2), (1, 2)] + [] + [(0, 1), (0, 2)] + [(1, 2)] + """ + for child in tree.children: + _tree_to_graph_rec(child, g) + if tree.name not in ['J', 'U']: + tree.info = 'v' + g.add_vertex(tree.name) + _find_neighbors(tree, g) + tree.reset_info() + + +def _find_neighbors(tree, g): + r""" + Identify the neighbors of node ``tree`` in ``g`` and add needed edges. + + This is a helper method to method :meth:`tree_to_graph`. + + EXAMPLES:: + + sage: for t in graphs.cographs(3, as_graph=True): # indirect doctest + ....: print(t.edges(labels=False, sort=True)) + [(0, 1), (0, 2), (1, 2)] + [] + [(0, 1), (0, 2)] + [(1, 2)] + """ + ancestor = tree.parent + ancestor.info = 'v' + while ancestor is not None: + if ancestor.name == 'J': + for sibling in ancestor.children: + if sibling != tree and sibling.info != 'v': + _add_edge(tree, sibling, g) + elif ancestor.name == 'U': + ancestor.info = 'v' + ancestor = ancestor.parent + + +def _add_edge(u, v, g): + r""" + Add an edge in `g` between the nodes associated to the cotrees `u` and `v`. + + This is a helper method to method :meth:`tree_to_graph`. + + If `v` is not a leaf, then the method add edges between `u` and all leaves + of the subtree rooted at `v`. + + The method assumes that `u` is a leaf (not tested). + + EXAMPLES:: + + sage: for t in graphs.cographs(3, as_graph=True): # indirect doctest + ....: print(t.edges(labels=False, sort=True)) + [(0, 1), (0, 2), (1, 2)] + [] + [(0, 1), (0, 2)] + [(1, 2)] + """ + if v.name in ['J', 'U']: + for child in v.children: + _add_edge(u, child, g) + else: + g.add_edge(u.name, v.name) diff --git a/src/sage/graphs/graph_generators.py b/src/sage/graphs/graph_generators.py index 986ec59a5e5..0461cfb4ccc 100644 --- a/src/sage/graphs/graph_generators.py +++ b/src/sage/graphs/graph_generators.py @@ -232,6 +232,7 @@ def wrap_name(x): "CaiFurerImmermanGraph", "chang_graphs", "CirculantGraph", + "cographs", "cospectral_graphs", "CubeGraph", "CubeConnectedCycle", @@ -2632,6 +2633,7 @@ def quadrangulations(self, order, minimum_degree=None, minimum_connectivity=None ########################################################################### # Families ########################################################################### + from . import cographs as cographs_module from .generators import families from . import strongly_regular_db AlternatingFormsGraph = staticmethod(distance_regular.AlternatingFormsGraph) @@ -2643,6 +2645,7 @@ def quadrangulations(self, order, minimum_degree=None, minimum_connectivity=None CaiFurerImmermanGraph = staticmethod(families.CaiFurerImmermanGraph) chang_graphs = staticmethod(families.chang_graphs) CirculantGraph = staticmethod(families.CirculantGraph) + cographs = staticmethod(cographs_module.cographs) CubeGraph = staticmethod(families.CubeGraph) CubeConnectedCycle = staticmethod(families.CubeConnectedCycle) DipoleGraph = staticmethod(families.DipoleGraph) diff --git a/src/sage/matrix/matrix_mod2_dense.pyx b/src/sage/matrix/matrix_mod2_dense.pyx index 974e5b0eb82..e84601ac37c 100644 --- a/src/sage/matrix/matrix_mod2_dense.pyx +++ b/src/sage/matrix/matrix_mod2_dense.pyx @@ -525,6 +525,45 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse mzd_submatrix(z._entries, self._entries, i, 0, i+1, self._ncols) return z + def columns(self, copy=True): + """ + Return list of the columns of self. + + INPUT: + + - ``copy`` -- (default: ``True``) if True, return a copy so you can + modify it safely + + EXAMPLES: + + An example with a small 3x3 matrix:: + + sage: M2 = Matrix(GF(2), [[1, 0, 0], [0, 1, 0], [0, 1, 1]]) + sage: M2.columns() + [(1, 0, 0), (0, 1, 1), (0, 0, 1)] + """ + x = self.fetch('columns') + if x is not None: + if copy: return list(x) + return x + cdef Py_ssize_t i + + # Note: due to the way M4ri represents values, extracting rows + # is fast, but columns are slow. Therefore we transpose + # then take rows. For more information, see the issue + # https://github.com/sagemath/sage/issues/38150 + C = self.transpose().rows() + + # Make the vectors immutable since we are caching them + for x in C: + x.set_immutable() + + # cache result + self.cache('columns', C) + if copy: + return list(C) + return C + ######################################################################## # LEVEL 2 functionality # * def _pickle diff --git a/src/sage/sat/solvers/cryptominisat.py b/src/sage/sat/solvers/cryptominisat.py index 82f1ffd9086..27955c43eef 100644 --- a/src/sage/sat/solvers/cryptominisat.py +++ b/src/sage/sat/solvers/cryptominisat.py @@ -3,8 +3,6 @@ This solver relies on Python bindings provided by upstream cryptominisat. -The ``cryptominisat`` package should be installed on your Sage installation. - AUTHORS: - Thierry Monteil (2017): complete rewrite, using upstream Python bindings, @@ -26,7 +24,7 @@ from sage.misc.lazy_import import lazy_import from sage.features import PythonModule lazy_import('pycryptosat', ['Solver'], - feature=PythonModule('pycryptosat', spkg='cryptominisat')) + feature=PythonModule('pycryptosat', spkg='pycryptosat')) class CryptoMiniSat(SatSolver): diff --git a/src/sage/sat/solvers/satsolver.pyx b/src/sage/sat/solvers/satsolver.pyx index 2f9ed49bcc0..7b63a1ee87d 100644 --- a/src/sage/sat/solvers/satsolver.pyx +++ b/src/sage/sat/solvers/satsolver.pyx @@ -322,7 +322,7 @@ def SAT(solver=None, *args, **kwds): - ``solver`` (string) -- select a solver. Admissible values are: - - ``"cryptominisat"`` -- note that the cryptominisat package must be + - ``"cryptominisat"`` -- note that the pycryptosat package must be installed. - ``"picosat"`` -- note that the pycosat package must be installed. diff --git a/src/sage/version.py b/src/sage/version.py index 19902d4869d..7aa5469a8ce 100644 --- a/src/sage/version.py +++ b/src/sage/version.py @@ -1,6 +1,5 @@ -# sage_setup: distribution = sagemath-environment # Sage version information for Python scripts # This file is auto-generated by the sage-update-version script, do not edit! -version = '10.4.beta8' -date = '2024-06-01' -banner = 'SageMath version 10.4.beta8, Release Date: 2024-06-01' +version = '10.4.beta9' +date = '2024-06-09' +banner = 'SageMath version 10.4.beta9, Release Date: 2024-06-09'