diff --git a/.github/workflows/ci-cygwin-minimal.yml b/.github/workflows/ci-cygwin-minimal.yml new file mode 100644 index 00000000000..9f4a11de432 --- /dev/null +++ b/.github/workflows/ci-cygwin-minimal.yml @@ -0,0 +1,1044 @@ +name: CI cygwin-minimal + +on: + pull_request: + types: [opened, synchronize] + push: + tags: + - '*' + workflow_dispatch: + # Allow to run manually + +env: + MAKE: make -j8 + SAGE_NUM_THREADS: 3 + CYGWIN: winsymlinks:native + EXTRA_CONFIGURE_ARGS: --enable-fat-binary + SAGE_LOCAL: /opt/sage-${{ github.sha }} + +jobs: + +############################################## stage-i ########################################## + + cygwin-stage-i-a: + env: + STAGE: i-a + # builds openblas + TARGETS: iml gsl + LOCAL_ARTIFACT_NAME: sage-local-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + + runs-on: windows-latest + + strategy: + fail-fast: false + matrix: + pkgs: [minimal] + steps: + - run: | + git config --global core.autocrlf false + git config --global core.symlinks true + - uses: actions/checkout@v1 + - name: install cygwin and test prerequisites with choco + shell: bash {0} + run: | + choco --version + PACKAGES="python39 python39-pip" + choco install $PACKAGES --source cygwin + - name: tox + run: | + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cat /proc/cpuinfo' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'python3.8 -m pip install tox' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && PREFIX="${{ env.SAGE_LOCAL }}" tox -e local-cygwin-choco-${{ matrix.pkgs }} -- $TARGETS' + - name: Prepare logs artifact + shell: bash + run: | + mkdir -p "artifacts/$LOGS_ARTIFACT_NAME"; for a in "${{ env.SAGE_LOCAL }}"/var/tmp/sage/build/*; do if [ -d "$a" ]; then tar -c --remove-files -f "artifacts/$LOGS_ARTIFACT_NAME/$(basename "$a").tar" "$a"; fi; done; cp -r logs/* "artifacts/$LOGS_ARTIFACT_NAME" + if: always() + - uses: actions/upload-artifact@v2 + with: + path: artifacts + name: ${{ env.LOGS_ARTIFACT_NAME }} + if: always() + - name: Print out logs for immediate inspection + # The markup in the output is a GitHub Actions logging command + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions + shell: bash + run: | + find "artifacts/$LOGS_ARTIFACT_NAME" -type f -name "*.log" -exec sh -c 'if tail -20 "{}" 2>/dev/null | grep "^Error" >/dev/null; then echo :":"error file={}:":" ==== LOG FILE {} CONTAINS AN ERROR ====; cat {} ; fi' \; + if: always() + - name: Prepare sage-local artifact + # We specifically use the cygwin tar so that symlinks are saved/restored correctly on Windows. + # We remove the $SAGE_LOCAL/lib64 link, which will be recreated by the next stage. + run: | + C:\\tools\\cygwin\\bin\\bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && rm -f "${{ env.SAGE_LOCAL }}"/lib64; tar -cf /tmp/sage-local-${{ env.STAGE }}.tar --remove-files "${{ env.SAGE_LOCAL }}"' + if: always() + - uses: actions/upload-artifact@v2 + # upload-artifact@v2 does not support whitespace in file names. + # so we tar up the directory ourselves + with: + path: C:\\tools\\cygwin\\tmp\\sage-local-${{ env.STAGE }}.tar + name: ${{ env.LOCAL_ARTIFACT_NAME }} + if: always() + + cygwin-stage-i-b: + env: + STAGE: i-b + TARGETS: cython setuptools_scm kiwisolver dateutil cycler pyparsing certifi pkgconfig pplpy + LOCAL_ARTIFACT_NAME: sage-local-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + + runs-on: windows-latest + + strategy: + fail-fast: false + matrix: + pkgs: [minimal] + steps: + - run: | + git config --global core.autocrlf false + git config --global core.symlinks true + - uses: actions/checkout@v1 + - name: install cygwin and test prerequisites with choco + shell: bash {0} + run: | + choco --version + PACKAGES="python39 python39-pip" + choco install $PACKAGES --source cygwin + - name: tox + run: | + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cat /proc/cpuinfo' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'python3.8 -m pip install tox' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && PREFIX="${{ env.SAGE_LOCAL }}" tox -e local-cygwin-choco-${{ matrix.pkgs }} -- $TARGETS' + - name: Prepare logs artifact + shell: bash + run: | + mkdir -p "artifacts/$LOGS_ARTIFACT_NAME"; for a in "${{ env.SAGE_LOCAL }}"/var/tmp/sage/build/*; do if [ -d "$a" ]; then tar -c --remove-files -f "artifacts/$LOGS_ARTIFACT_NAME/$(basename "$a").tar" "$a"; fi; done; cp -r logs/* "artifacts/$LOGS_ARTIFACT_NAME" + if: always() + - uses: actions/upload-artifact@v2 + with: + path: artifacts + name: ${{ env.LOGS_ARTIFACT_NAME }} + if: always() + - name: Print out logs for immediate inspection + # The markup in the output is a GitHub Actions logging command + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions + shell: bash + run: | + find "artifacts/$LOGS_ARTIFACT_NAME" -type f -name "*.log" -exec sh -c 'if tail -20 "{}" 2>/dev/null | grep "^Error" >/dev/null; then echo :":"error file={}:":" ==== LOG FILE {} CONTAINS AN ERROR ====; cat {} ; fi' \; + if: always() + - name: Prepare sage-local artifact + # We specifically use the cygwin tar so that symlinks are saved/restored correctly on Windows. + # We remove the $SAGE_LOCAL/lib64 link, which will be recreated by the next stage. + run: | + C:\\tools\\cygwin\\bin\\bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && rm -f "${{ env.SAGE_LOCAL }}"/lib64; tar -cf /tmp/sage-local-${{ env.STAGE }}.tar --remove-files "${{ env.SAGE_LOCAL }}"' + if: always() + - uses: actions/upload-artifact@v2 + # upload-artifact@v2 does not support whitespace in file names. + # so we tar up the directory ourselves + with: + path: C:\\tools\\cygwin\\tmp\\sage-local-${{ env.STAGE }}.tar + name: ${{ env.LOCAL_ARTIFACT_NAME }} + if: always() + +############################################## stage-ii ########################################## + + cygwin-stage-ii-a: + env: + STAGE: ii-a + PREVIOUS_STAGES: i-* + TARGETS: cvxopt rpy2 + LOCAL_ARTIFACT_NAME: sage-local-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + + needs: [cygwin-stage-i-a, cygwin-stage-i-b] + + runs-on: windows-latest + + strategy: + fail-fast: false + matrix: + pkgs: [minimal] + steps: + - run: | + git config --global core.autocrlf false + git config --global core.symlinks true + - uses: actions/checkout@v1 + - name: install cygwin and test prerequisites with choco + shell: bash {0} + run: | + choco --version + PACKAGES="python39 python39-pip" + choco install $PACKAGES --source cygwin + - uses: actions/download-artifact@v2 + with: + name: ${{ env.LOCAL_ARTIFACT_NAME }} + path: C:\\tools\\cygwin\\tmp + - name: Extract sage-local artifact + run: | + C:\\tools\\cygwin\\bin\\dash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && .github/workflows/extract-sage-local.sh /tmp/sage-local-*.tar && tar --create --listed-incremental=/tmp/sage-local.snar --file /dev/null "${{ env.SAGE_LOCAL }}"' + - name: tox + run: | + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cat /proc/cpuinfo' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'python3.8 -m pip install tox' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && PREFIX="${{ env.SAGE_LOCAL }}" tox -e local-cygwin-choco-${{ matrix.pkgs }} -- $TARGETS' + - name: Prepare logs artifact + shell: bash + run: | + mkdir -p "artifacts/$LOGS_ARTIFACT_NAME"; for a in "${{ env.SAGE_LOCAL }}"/var/tmp/sage/build/*; do if [ -d "$a" ]; then tar -c --remove-files -f "artifacts/$LOGS_ARTIFACT_NAME/$(basename "$a").tar" "$a"; fi; done; cp -r logs/* "artifacts/$LOGS_ARTIFACT_NAME" + if: always() + - uses: actions/upload-artifact@v2 + with: + path: artifacts + name: ${{ env.LOGS_ARTIFACT_NAME }} + if: always() + - name: Print out logs for immediate inspection + # The markup in the output is a GitHub Actions logging command + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions + shell: bash + run: | + find "artifacts/$LOGS_ARTIFACT_NAME" -type f -name "*.log" -exec sh -c 'if tail -20 "{}" 2>/dev/null | grep "^Error" >/dev/null; then echo :":"error file={}:":" ==== LOG FILE {} CONTAINS AN ERROR ====; cat {} ; fi' \; + if: always() + - name: Prepare sage-local artifact + # We specifically use the cygwin tar so that symlinks are saved/restored correctly on Windows. + # We remove the $SAGE_LOCAL/lib64 link, which will be recreated by the next stage. + run: | + C:\\tools\\cygwin\\bin\\bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && rm -f "${{ env.SAGE_LOCAL }}"/lib64; tar -cf /tmp/sage-local-${{ env.STAGE }}.tar --listed-incremental=/tmp/sage-local.snar "${{ env.SAGE_LOCAL }}"' + if: always() + - uses: actions/upload-artifact@v2 + # upload-artifact@v2 does not support whitespace in file names. + # so we tar up the directory ourselves + with: + path: C:\\tools\\cygwin\\tmp\\sage-local-${{ env.STAGE }}.tar + name: ${{ env.LOCAL_ARTIFACT_NAME }} + if: always() + + cygwin-stage-ii-b: + env: + STAGE: ii-b + PREVIOUS_STAGES: i-* + TARGETS: singular maxima gap pari gfan palp flintqs arb ecm givaro + LOCAL_ARTIFACT_NAME: sage-local-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + + needs: [cygwin-stage-i-a, cygwin-stage-i-b] + + runs-on: windows-latest + + strategy: + fail-fast: false + matrix: + pkgs: [minimal] + steps: + - run: | + git config --global core.autocrlf false + git config --global core.symlinks true + - uses: actions/checkout@v1 + - name: install cygwin and test prerequisites with choco + shell: bash {0} + run: | + choco --version + PACKAGES="python39 python39-pip" + choco install $PACKAGES --source cygwin + - uses: actions/download-artifact@v2 + with: + name: ${{ env.LOCAL_ARTIFACT_NAME }} + path: C:\\tools\\cygwin\\tmp + - name: Extract sage-local artifact + run: | + C:\\tools\\cygwin\\bin\\dash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && .github/workflows/extract-sage-local.sh /tmp/sage-local-*.tar && tar --create --listed-incremental=/tmp/sage-local.snar --file /dev/null "${{ env.SAGE_LOCAL }}"' + - name: tox + run: | + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cat /proc/cpuinfo' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'python3.8 -m pip install tox' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && PREFIX="${{ env.SAGE_LOCAL }}" tox -e local-cygwin-choco-${{ matrix.pkgs }} -- $TARGETS' + - name: Prepare logs artifact + shell: bash + run: | + mkdir -p "artifacts/$LOGS_ARTIFACT_NAME"; for a in "${{ env.SAGE_LOCAL }}"/var/tmp/sage/build/*; do if [ -d "$a" ]; then tar -c --remove-files -f "artifacts/$LOGS_ARTIFACT_NAME/$(basename "$a").tar" "$a"; fi; done; cp -r logs/* "artifacts/$LOGS_ARTIFACT_NAME" + if: always() + - uses: actions/upload-artifact@v2 + with: + path: artifacts + name: ${{ env.LOGS_ARTIFACT_NAME }} + if: always() + - name: Print out logs for immediate inspection + # The markup in the output is a GitHub Actions logging command + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions + shell: bash + run: | + find "artifacts/$LOGS_ARTIFACT_NAME" -type f -name "*.log" -exec sh -c 'if tail -20 "{}" 2>/dev/null | grep "^Error" >/dev/null; then echo :":"error file={}:":" ==== LOG FILE {} CONTAINS AN ERROR ====; cat {} ; fi' \; + if: always() + - name: Prepare sage-local artifact + # We specifically use the cygwin tar so that symlinks are saved/restored correctly on Windows. + # We remove the $SAGE_LOCAL/lib64 link, which will be recreated by the next stage. + run: | + C:\\tools\\cygwin\\bin\\bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && rm -f "${{ env.SAGE_LOCAL }}"/lib64; tar -cf /tmp/sage-local-${{ env.STAGE }}.tar --listed-incremental=/tmp/sage-local.snar "${{ env.SAGE_LOCAL }}"' + if: always() + - uses: actions/upload-artifact@v2 + with: + path: C:\\tools\\cygwin\\tmp\\sage-local-${{ env.STAGE }}.tar + name: ${{ env.LOCAL_ARTIFACT_NAME }} + if: always() + + cygwin-stage-ii-c: + env: + STAGE: ii-c + PREVIOUS_STAGES: i-* + TARGETS: cypari eclib fplll linbox giac + LOCAL_ARTIFACT_NAME: sage-local-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + + needs: [cygwin-stage-i-a, cygwin-stage-i-b] + + runs-on: windows-latest + + strategy: + fail-fast: false + matrix: + pkgs: [minimal] + steps: + - run: | + git config --global core.autocrlf false + git config --global core.symlinks true + - uses: actions/checkout@v1 + - name: install cygwin and test prerequisites with choco + shell: bash {0} + run: | + choco --version + PACKAGES="python39 python39-pip" + choco install $PACKAGES --source cygwin + - uses: actions/download-artifact@v2 + with: + name: ${{ env.LOCAL_ARTIFACT_NAME }} + path: C:\\tools\\cygwin\\tmp + - name: Extract sage-local artifact + run: | + C:\\tools\\cygwin\\bin\\dash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && .github/workflows/extract-sage-local.sh /tmp/sage-local-*.tar && tar --create --listed-incremental=/tmp/sage-local.snar --file /dev/null "${{ env.SAGE_LOCAL }}"' + - name: tox + run: | + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cat /proc/cpuinfo' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'python3.8 -m pip install tox' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && PREFIX="${{ env.SAGE_LOCAL }}" tox -e local-cygwin-choco-${{ matrix.pkgs }} -- $TARGETS' + - name: Prepare logs artifact + shell: bash + run: | + mkdir -p "artifacts/$LOGS_ARTIFACT_NAME"; for a in "${{ env.SAGE_LOCAL }}"/var/tmp/sage/build/*; do if [ -d "$a" ]; then tar -c --remove-files -f "artifacts/$LOGS_ARTIFACT_NAME/$(basename "$a").tar" "$a"; fi; done; cp -r logs/* "artifacts/$LOGS_ARTIFACT_NAME" + if: always() + - uses: actions/upload-artifact@v2 + with: + path: artifacts + name: ${{ env.LOGS_ARTIFACT_NAME }} + if: always() + - name: Print out logs for immediate inspection + # The markup in the output is a GitHub Actions logging command + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions + shell: bash + run: | + find "artifacts/$LOGS_ARTIFACT_NAME" -type f -name "*.log" -exec sh -c 'if tail -20 "{}" 2>/dev/null | grep "^Error" >/dev/null; then echo :":"error file={}:":" ==== LOG FILE {} CONTAINS AN ERROR ====; cat {} ; fi' \; + if: always() + - name: Prepare sage-local artifact + # We specifically use the cygwin tar so that symlinks are saved/restored correctly on Windows. + # We remove the $SAGE_LOCAL/lib64 link, which will be recreated by the next stage. + run: | + C:\\tools\\cygwin\\bin\\bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && rm -f "${{ env.SAGE_LOCAL }}"/lib64; tar -cf /tmp/sage-local-${{ env.STAGE }}.tar --listed-incremental=/tmp/sage-local.snar "${{ env.SAGE_LOCAL }}"' + if: always() + - uses: actions/upload-artifact@v2 + with: + path: C:\\tools\\cygwin\\tmp\\sage-local-${{ env.STAGE }}.tar + name: ${{ env.LOCAL_ARTIFACT_NAME }} + if: always() + + cygwin-stage-ii-d: + env: + STAGE: ii-d + PREVIOUS_STAGES: i-* + TARGETS: ipython ipywidgets notebook + LOCAL_ARTIFACT_NAME: sage-local-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + + needs: [cygwin-stage-i-a, cygwin-stage-i-b] + + runs-on: windows-latest + + strategy: + fail-fast: false + matrix: + pkgs: [minimal] + steps: + - run: | + git config --global core.autocrlf false + git config --global core.symlinks true + - uses: actions/checkout@v1 + - name: install cygwin and test prerequisites with choco + shell: bash {0} + run: | + choco --version + PACKAGES="python39 python39-pip" + choco install $PACKAGES --source cygwin + - uses: actions/download-artifact@v2 + with: + name: ${{ env.LOCAL_ARTIFACT_NAME }} + path: C:\\tools\\cygwin\\tmp + - name: Extract sage-local artifact + run: | + C:\\tools\\cygwin\\bin\\dash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && .github/workflows/extract-sage-local.sh /tmp/sage-local-*.tar && tar --create --listed-incremental=/tmp/sage-local.snar --file /dev/null "${{ env.SAGE_LOCAL }}"' + - name: tox + run: | + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cat /proc/cpuinfo' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'python3.8 -m pip install tox' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && PREFIX="${{ env.SAGE_LOCAL }}" tox -e local-cygwin-choco-${{ matrix.pkgs }} -- $TARGETS' + - name: Prepare logs artifact + shell: bash + run: | + mkdir -p "artifacts/$LOGS_ARTIFACT_NAME"; for a in "${{ env.SAGE_LOCAL }}"/var/tmp/sage/build/*; do if [ -d "$a" ]; then tar -c --remove-files -f "artifacts/$LOGS_ARTIFACT_NAME/$(basename "$a").tar" "$a"; fi; done; cp -r logs/* "artifacts/$LOGS_ARTIFACT_NAME" + if: always() + - uses: actions/upload-artifact@v2 + with: + path: artifacts + name: ${{ env.LOGS_ARTIFACT_NAME }} + if: always() + - name: Print out logs for immediate inspection + # The markup in the output is a GitHub Actions logging command + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions + shell: bash + run: | + find "artifacts/$LOGS_ARTIFACT_NAME" -type f -name "*.log" -exec sh -c 'if tail -20 "{}" 2>/dev/null | grep "^Error" >/dev/null; then echo :":"error file={}:":" ==== LOG FILE {} CONTAINS AN ERROR ====; cat {} ; fi' \; + if: always() + - name: Prepare sage-local artifact + # We specifically use the cygwin tar so that symlinks are saved/restored correctly on Windows. + # We remove the $SAGE_LOCAL/lib64 link, which will be recreated by the next stage. + run: | + C:\\tools\\cygwin\\bin\\bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && rm -f "${{ env.SAGE_LOCAL }}"/lib64; tar -cf /tmp/sage-local-${{ env.STAGE }}.tar --listed-incremental=/tmp/sage-local.snar "${{ env.SAGE_LOCAL }}"' + if: always() + - uses: actions/upload-artifact@v2 + with: + path: C:\\tools\\cygwin\\tmp\\sage-local-${{ env.STAGE }}.tar + name: ${{ env.LOCAL_ARTIFACT_NAME }} + if: always() + + cygwin-stage-ii-e: + env: + STAGE: ii-e + PREVIOUS_STAGES: i-* + TARGETS: threejs tachyon pillow jmol m4rie sympy lrcalc lcalc symmetrica cliquer libbraiding planarity rw elliptic_curves combinatorial_designs sympow + LOCAL_ARTIFACT_NAME: sage-local-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + + needs: [cygwin-stage-i-a, cygwin-stage-i-b] + + runs-on: windows-latest + + strategy: + fail-fast: false + matrix: + pkgs: [minimal] + steps: + - run: | + git config --global core.autocrlf false + git config --global core.symlinks true + - uses: actions/checkout@v1 + - name: install cygwin and test prerequisites with choco + shell: bash {0} + run: | + choco --version + PACKAGES="python39 python39-pip" + choco install $PACKAGES --source cygwin + - uses: actions/download-artifact@v2 + with: + name: ${{ env.LOCAL_ARTIFACT_NAME }} + path: C:\\tools\\cygwin\\tmp + - name: Extract sage-local artifact + run: | + C:\\tools\\cygwin\\bin\\dash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && .github/workflows/extract-sage-local.sh /tmp/sage-local-*.tar && tar --create --listed-incremental=/tmp/sage-local.snar --file /dev/null "${{ env.SAGE_LOCAL }}"' + - name: tox + run: | + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cat /proc/cpuinfo' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'python3.8 -m pip install tox' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && PREFIX="${{ env.SAGE_LOCAL }}" tox -e local-cygwin-choco-${{ matrix.pkgs }} -- $TARGETS' + - name: Prepare logs artifact + shell: bash + run: | + mkdir -p "artifacts/$LOGS_ARTIFACT_NAME"; for a in "${{ env.SAGE_LOCAL }}"/var/tmp/sage/build/*; do if [ -d "$a" ]; then tar -c --remove-files -f "artifacts/$LOGS_ARTIFACT_NAME/$(basename "$a").tar" "$a"; fi; done; cp -r logs/* "artifacts/$LOGS_ARTIFACT_NAME" + if: always() + - uses: actions/upload-artifact@v2 + with: + path: artifacts + name: ${{ env.LOGS_ARTIFACT_NAME }} + if: always() + - name: Print out logs for immediate inspection + # The markup in the output is a GitHub Actions logging command + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions + shell: bash + run: | + find "artifacts/$LOGS_ARTIFACT_NAME" -type f -name "*.log" -exec sh -c 'if tail -20 "{}" 2>/dev/null | grep "^Error" >/dev/null; then echo :":"error file={}:":" ==== LOG FILE {} CONTAINS AN ERROR ====; cat {} ; fi' \; + if: always() + - name: Prepare sage-local artifact + # We specifically use the cygwin tar so that symlinks are saved/restored correctly on Windows. + # We remove the $SAGE_LOCAL/lib64 link, which will be recreated by the next stage. + run: | + C:\\tools\\cygwin\\bin\\bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && rm -f "${{ env.SAGE_LOCAL }}"/lib64; tar -cf /tmp/sage-local-${{ env.STAGE }}.tar --listed-incremental=/tmp/sage-local.snar "${{ env.SAGE_LOCAL }}"' + if: always() + - uses: actions/upload-artifact@v2 + with: + path: C:\\tools\\cygwin\\tmp\\sage-local-${{ env.STAGE }}.tar + name: ${{ env.LOCAL_ARTIFACT_NAME }} + if: always() + +############################################## stage-iii ########################################## + + cygwin-stage-iii-a: + env: + STAGE: iii-a + PREVIOUS_STAGES: ii-* + TARGETS: sagelib + LOCAL_ARTIFACT_NAME: sage-local-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + + needs: [cygwin-stage-ii-a, cygwin-stage-ii-b, cygwin-stage-ii-c, cygwin-stage-ii-d, cygwin-stage-ii-e] + + runs-on: windows-latest + + continue-on-error: true + + strategy: + fail-fast: false + matrix: + pkgs: [minimal] + steps: + - run: | + git config --global core.autocrlf false + git config --global core.symlinks true + - uses: actions/checkout@v1 + - name: install cygwin and test prerequisites with choco + shell: bash {0} + run: | + choco --version + PACKAGES="python39 python39-pip" + choco install $PACKAGES --source cygwin + - uses: actions/download-artifact@v2 + with: + name: ${{ env.LOCAL_ARTIFACT_NAME }} + path: C:\\tools\\cygwin\\tmp + - name: Extract sage-local artifact + run: | + C:\\tools\\cygwin\\bin\\dash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && .github/workflows/extract-sage-local.sh /tmp/sage-local-*.tar && tar --create --listed-incremental=/tmp/sage-local.snar --file /dev/null "${{ env.SAGE_LOCAL }}"' + - name: tox + run: | + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cat /proc/cpuinfo' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'python3.8 -m pip install tox' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && PREFIX="${{ env.SAGE_LOCAL }}" tox -e local-cygwin-choco-${{ matrix.pkgs }} -- $TARGETS' + - name: Prepare logs artifact + shell: bash + run: | + mkdir -p "artifacts/$LOGS_ARTIFACT_NAME"; for a in "${{ env.SAGE_LOCAL }}"/var/tmp/sage/build/*; do if [ -d "$a" ]; then tar -c --remove-files -f "artifacts/$LOGS_ARTIFACT_NAME/$(basename "$a").tar" "$a"; fi; done; cp -r logs/* "artifacts/$LOGS_ARTIFACT_NAME" + if: always() + - uses: actions/upload-artifact@v2 + with: + path: artifacts + name: ${{ env.LOGS_ARTIFACT_NAME }} + if: always() + - name: Print out logs for immediate inspection + # The markup in the output is a GitHub Actions logging command + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions + shell: bash + run: | + find "artifacts/$LOGS_ARTIFACT_NAME" -type f -name "*.log" -exec sh -c 'if tail -20 "{}" 2>/dev/null | grep "^Error" >/dev/null; then echo :":"error file={}:":" ==== LOG FILE {} CONTAINS AN ERROR ====; cat {} ; fi' \; + if: always() + - name: Prepare sage-local artifact + # We specifically use the cygwin tar so that symlinks are saved/restored correctly on Windows. + # We remove the $SAGE_LOCAL/lib64 link, which will be recreated by the next stage. + run: | + C:\\tools\\cygwin\\bin\\bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && rm -f "${{ env.SAGE_LOCAL }}"/lib64; tar -cf /tmp/sage-local-${{ env.STAGE }}.tar --listed-incremental=/tmp/sage-local.snar "${{ env.SAGE_LOCAL }}"' + if: always() + - uses: actions/upload-artifact@v2 + # upload-artifact@v2 does not support whitespace in file names. + # so we tar up the directory ourselves + with: + path: C:\\tools\\cygwin\\tmp\\sage-local-${{ env.STAGE }}.tar + name: ${{ env.LOCAL_ARTIFACT_NAME }} + if: always() + + cygwin-stage-iii-b: + env: + STAGE: iii-b + PREVIOUS_STAGES: ii-* + TARGETS: networkx + LOCAL_ARTIFACT_NAME: sage-local-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + + needs: [cygwin-stage-ii-a, cygwin-stage-ii-b, cygwin-stage-ii-c, cygwin-stage-ii-d, cygwin-stage-ii-e] + + runs-on: windows-latest + + continue-on-error: true + + strategy: + fail-fast: false + matrix: + pkgs: [minimal] + steps: + - run: | + git config --global core.autocrlf false + git config --global core.symlinks true + - uses: actions/checkout@v1 + - name: install cygwin and test prerequisites with choco + shell: bash {0} + run: | + choco --version + PACKAGES="python39 python39-pip" + choco install $PACKAGES --source cygwin + - uses: actions/download-artifact@v2 + with: + name: ${{ env.LOCAL_ARTIFACT_NAME }} + path: C:\\tools\\cygwin\\tmp + - name: Extract sage-local artifact + run: | + C:\\tools\\cygwin\\bin\\dash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && .github/workflows/extract-sage-local.sh /tmp/sage-local-*.tar && tar --create --listed-incremental=/tmp/sage-local.snar --file /dev/null "${{ env.SAGE_LOCAL }}"' + - name: tox + run: | + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cat /proc/cpuinfo' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'python3.8 -m pip install tox' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && PREFIX="${{ env.SAGE_LOCAL }}" tox -e local-cygwin-choco-${{ matrix.pkgs }} -- $TARGETS' + - name: Prepare logs artifact + shell: bash + run: | + mkdir -p "artifacts/$LOGS_ARTIFACT_NAME"; for a in "${{ env.SAGE_LOCAL }}"/var/tmp/sage/build/*; do if [ -d "$a" ]; then tar -c --remove-files -f "artifacts/$LOGS_ARTIFACT_NAME/$(basename "$a").tar" "$a"; fi; done; cp -r logs/* "artifacts/$LOGS_ARTIFACT_NAME" + if: always() + - uses: actions/upload-artifact@v2 + with: + path: artifacts + name: ${{ env.LOGS_ARTIFACT_NAME }} + if: always() + - name: Print out logs for immediate inspection + # The markup in the output is a GitHub Actions logging command + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions + shell: bash + run: | + find "artifacts/$LOGS_ARTIFACT_NAME" -type f -name "*.log" -exec sh -c 'if tail -20 "{}" 2>/dev/null | grep "^Error" >/dev/null; then echo :":"error file={}:":" ==== LOG FILE {} CONTAINS AN ERROR ====; cat {} ; fi' \; + if: always() + - name: Prepare sage-local artifact + # We specifically use the cygwin tar so that symlinks are saved/restored correctly on Windows. + # We remove the $SAGE_LOCAL/lib64 link, which will be recreated by the next stage. + run: | + C:\\tools\\cygwin\\bin\\bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && rm -f "${{ env.SAGE_LOCAL }}"/lib64; tar -cf /tmp/sage-local-${{ env.STAGE }}.tar --listed-incremental=/tmp/sage-local.snar "${{ env.SAGE_LOCAL }}"' + if: always() + - uses: actions/upload-artifact@v2 + with: + path: C:\\tools\\cygwin\\tmp\\sage-local-${{ env.STAGE }}.tar + name: ${{ env.LOCAL_ARTIFACT_NAME }} + if: always() + +############################################## stage-iv ########################################## + + cygwin-stage-iv: + env: + STAGE: iv + PREVIOUS_STAGES: iii-* + TARGETS: build + LOCAL_ARTIFACT_NAME: sage-local-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + + needs: [cygwin-stage-iii-a, cygwin-stage-iii-b] + + runs-on: windows-latest + + continue-on-error: true + + strategy: + fail-fast: false + matrix: + pkgs: [minimal] + steps: + - run: | + git config --global core.autocrlf false + git config --global core.symlinks true + - uses: actions/checkout@v1 + - name: install cygwin and test prerequisites with choco + shell: bash {0} + run: | + choco --version + PACKAGES="python39 python39-pip" + choco install $PACKAGES --source cygwin + - uses: actions/download-artifact@v2 + with: + name: ${{ env.LOCAL_ARTIFACT_NAME }} + path: C:\\tools\\cygwin\\tmp + - name: Extract sage-local artifact + run: | + C:\\tools\\cygwin\\bin\\dash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && .github/workflows/extract-sage-local.sh /tmp/sage-local-*.tar && tar --create --listed-incremental=/tmp/sage-local.snar --file /dev/null "${{ env.SAGE_LOCAL }}"' + - name: tox + run: | + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cat /proc/cpuinfo' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'python3.8 -m pip install tox' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && PREFIX="${{ env.SAGE_LOCAL }}" tox -e local-cygwin-choco-${{ matrix.pkgs }} -- $TARGETS' + - name: Prepare logs artifact + shell: bash + run: | + mkdir -p "artifacts/$LOGS_ARTIFACT_NAME"; for a in "${{ env.SAGE_LOCAL }}"/var/tmp/sage/build/*; do if [ -d "$a" ]; then tar -c --remove-files -f "artifacts/$LOGS_ARTIFACT_NAME/$(basename "$a").tar" "$a"; fi; done; cp -r logs/* "artifacts/$LOGS_ARTIFACT_NAME" + if: always() + - uses: actions/upload-artifact@v2 + with: + path: artifacts + name: ${{ env.LOGS_ARTIFACT_NAME }} + if: always() + - name: Print out logs for immediate inspection + # The markup in the output is a GitHub Actions logging command + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions + shell: bash + run: | + find "artifacts/$LOGS_ARTIFACT_NAME" -type f -name "*.log" -exec sh -c 'if tail -20 "{}" 2>/dev/null | grep "^Error" >/dev/null; then echo :":"error file={}:":" ==== LOG FILE {} CONTAINS AN ERROR ====; cat {} ; fi' \; + if: always() + - name: Prepare sage-local artifact + # We specifically use the cygwin tar so that symlinks are saved/restored correctly on Windows. + # We remove the $SAGE_LOCAL/lib64 link, which will be recreated by the next stage. + run: | + C:\\tools\\cygwin\\bin\\bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && rm -f "${{ env.SAGE_LOCAL }}"/lib64; tar -cf /tmp/sage-local-${{ env.STAGE }}.tar --listed-incremental=/tmp/sage-local.snar "${{ env.SAGE_LOCAL }}"' + if: always() + - uses: actions/upload-artifact@v2 + with: + path: C:\\tools\\cygwin\\tmp\\sage-local-${{ env.STAGE }}.tar + name: ${{ env.LOCAL_ARTIFACT_NAME }} + if: always() + +############################################## stage-v ########################################### + + cygwin-stage-v-a: + env: + STAGE: v-a + PREVIOUS_STAGES: iv + TARGETS: ptest-nodoc + LOCAL_ARTIFACT_NAME: sage-local-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + + needs: [cygwin-stage-iv] + + runs-on: windows-latest + + strategy: + fail-fast: false + matrix: + pkgs: [minimal] + steps: + - run: | + git config --global core.autocrlf false + git config --global core.symlinks true + - uses: actions/checkout@v1 + - name: install cygwin and test prerequisites with choco + shell: bash {0} + run: | + choco --version + PACKAGES="python39 python39-pip" + choco install $PACKAGES --source cygwin + - uses: actions/download-artifact@v2 + with: + name: ${{ env.LOCAL_ARTIFACT_NAME }} + path: C:\\tools\\cygwin\\tmp + - name: Extract sage-local artifact + run: | + C:\\tools\\cygwin\\bin\\dash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && .github/workflows/extract-sage-local.sh /tmp/sage-local-*.tar && tar --create --listed-incremental=/tmp/sage-local.snar --file /dev/null "${{ env.SAGE_LOCAL }}"' + - name: tox + run: | + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cat /proc/cpuinfo' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'python3.8 -m pip install tox' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && PREFIX="${{ env.SAGE_LOCAL }}" tox -e local-cygwin-choco-${{ matrix.pkgs }} -- $TARGETS' + - name: Prepare logs artifact + shell: bash + run: | + mkdir -p "artifacts/$LOGS_ARTIFACT_NAME"; for a in "${{ env.SAGE_LOCAL }}"/var/tmp/sage/build/*; do if [ -d "$a" ]; then tar -c --remove-files -f "artifacts/$LOGS_ARTIFACT_NAME/$(basename "$a").tar" "$a"; fi; done; cp -r logs/* "artifacts/$LOGS_ARTIFACT_NAME" + if: always() + - uses: actions/upload-artifact@v2 + with: + path: artifacts + name: ${{ env.LOGS_ARTIFACT_NAME }} + if: always() + - name: Print out logs for immediate inspection + # The markup in the output is a GitHub Actions logging command + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions + shell: bash + run: | + find "artifacts/$LOGS_ARTIFACT_NAME" -type f -name "*.log" -exec sh -c 'if tail -20 "{}" 2>/dev/null | grep "^Error" >/dev/null; then echo :":"error file={}:":" ==== LOG FILE {} CONTAINS AN ERROR ====; cat {} ; fi' \; + if: always() + - name: Prepare sage-local artifact + # We specifically use the cygwin tar so that symlinks are saved/restored correctly on Windows. + # We remove the $SAGE_LOCAL/lib64 link, which will be recreated by the next stage. + run: | + C:\\tools\\cygwin\\bin\\bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && rm -f "${{ env.SAGE_LOCAL }}"/lib64; tar -cf /tmp/sage-local-${{ env.STAGE }}.tar --listed-incremental=/tmp/sage-local.snar "${{ env.SAGE_LOCAL }}"' + if: always() + - uses: actions/upload-artifact@v2 + with: + path: C:\\tools\\cygwin\\tmp\\sage-local-${{ env.STAGE }}.tar + name: ${{ env.LOCAL_ARTIFACT_NAME }} + if: always() + + cygwin-stage-v-b: + env: + STAGE: v-b + PREVIOUS_STAGES: iv + TARGETS: 4ti2 pynormaliz topcom lrslib latte_int cryptominisat + LOCAL_ARTIFACT_NAME: sage-local-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + + needs: [cygwin-stage-iv] + + runs-on: windows-latest + + strategy: + fail-fast: false + matrix: + pkgs: [minimal] + steps: + - run: | + git config --global core.autocrlf false + git config --global core.symlinks true + - uses: actions/checkout@v1 + - name: install cygwin and test prerequisites with choco + shell: bash {0} + run: | + choco --version + PACKAGES="python39 python39-pip" + choco install $PACKAGES --source cygwin + - uses: actions/download-artifact@v2 + with: + name: ${{ env.LOCAL_ARTIFACT_NAME }} + path: C:\\tools\\cygwin\\tmp + - name: Extract sage-local artifact + run: | + C:\\tools\\cygwin\\bin\\dash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && .github/workflows/extract-sage-local.sh /tmp/sage-local-*.tar && tar --create --listed-incremental=/tmp/sage-local.snar --file /dev/null "${{ env.SAGE_LOCAL }}"' + - name: tox + run: | + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cat /proc/cpuinfo' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'python3.8 -m pip install tox' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && PREFIX="${{ env.SAGE_LOCAL }}" tox -e local-cygwin-choco-${{ matrix.pkgs }} -- $TARGETS' + - name: Prepare logs artifact + shell: bash + run: | + mkdir -p "artifacts/$LOGS_ARTIFACT_NAME"; for a in "${{ env.SAGE_LOCAL }}"/var/tmp/sage/build/*; do if [ -d "$a" ]; then tar -c --remove-files -f "artifacts/$LOGS_ARTIFACT_NAME/$(basename "$a").tar" "$a"; fi; done; cp -r logs/* "artifacts/$LOGS_ARTIFACT_NAME" + if: always() + - uses: actions/upload-artifact@v2 + with: + path: artifacts + name: ${{ env.LOGS_ARTIFACT_NAME }} + if: always() + - name: Print out logs for immediate inspection + # The markup in the output is a GitHub Actions logging command + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions + shell: bash + run: | + find "artifacts/$LOGS_ARTIFACT_NAME" -type f -name "*.log" -exec sh -c 'if tail -20 "{}" 2>/dev/null | grep "^Error" >/dev/null; then echo :":"error file={}:":" ==== LOG FILE {} CONTAINS AN ERROR ====; cat {} ; fi' \; + if: always() + - name: Prepare sage-local artifact + # We specifically use the cygwin tar so that symlinks are saved/restored correctly on Windows. + # We remove the $SAGE_LOCAL/lib64 link, which will be recreated by the next stage. + run: | + C:\\tools\\cygwin\\bin\\bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && rm -f "${{ env.SAGE_LOCAL }}"/lib64; tar -cf /tmp/sage-local-${{ env.STAGE }}.tar --listed-incremental=/tmp/sage-local.snar "${{ env.SAGE_LOCAL }}"' + if: always() + - uses: actions/upload-artifact@v2 + with: + path: C:\\tools\\cygwin\\tmp\\sage-local-${{ env.STAGE }}.tar + name: ${{ env.LOCAL_ARTIFACT_NAME }} + if: always() + + cygwin-stage-v-c: + env: + STAGE: v-c + PREVIOUS_STAGES: iv + TARGETS: sage_numerical_backends_coin + LOCAL_ARTIFACT_NAME: sage-local-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + + needs: [cygwin-stage-iv] + + runs-on: windows-latest + + strategy: + fail-fast: false + matrix: + pkgs: [minimal] + steps: + - run: | + git config --global core.autocrlf false + git config --global core.symlinks true + - uses: actions/checkout@v1 + - name: install cygwin and test prerequisites with choco + shell: bash {0} + run: | + choco --version + PACKAGES="python39 python39-pip" + choco install $PACKAGES --source cygwin + - uses: actions/download-artifact@v2 + with: + name: ${{ env.LOCAL_ARTIFACT_NAME }} + path: C:\\tools\\cygwin\\tmp + - name: Extract sage-local artifact + run: | + C:\\tools\\cygwin\\bin\\dash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && .github/workflows/extract-sage-local.sh /tmp/sage-local-*.tar && tar --create --listed-incremental=/tmp/sage-local.snar --file /dev/null "${{ env.SAGE_LOCAL }}"' + - name: tox + run: | + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cat /proc/cpuinfo' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'python3.8 -m pip install tox' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && PREFIX="${{ env.SAGE_LOCAL }}" tox -e local-cygwin-choco-${{ matrix.pkgs }} -- $TARGETS' + - name: Prepare logs artifact + shell: bash + run: | + mkdir -p "artifacts/$LOGS_ARTIFACT_NAME"; for a in "${{ env.SAGE_LOCAL }}"/var/tmp/sage/build/*; do if [ -d "$a" ]; then tar -c --remove-files -f "artifacts/$LOGS_ARTIFACT_NAME/$(basename "$a").tar" "$a"; fi; done; cp -r logs/* "artifacts/$LOGS_ARTIFACT_NAME" + if: always() + - uses: actions/upload-artifact@v2 + with: + path: artifacts + name: ${{ env.LOGS_ARTIFACT_NAME }} + if: always() + - name: Print out logs for immediate inspection + # The markup in the output is a GitHub Actions logging command + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions + shell: bash + run: | + find "artifacts/$LOGS_ARTIFACT_NAME" -type f -name "*.log" -exec sh -c 'if tail -20 "{}" 2>/dev/null | grep "^Error" >/dev/null; then echo :":"error file={}:":" ==== LOG FILE {} CONTAINS AN ERROR ====; cat {} ; fi' \; + if: always() + - name: Prepare sage-local artifact + # We specifically use the cygwin tar so that symlinks are saved/restored correctly on Windows. + # We remove the $SAGE_LOCAL/lib64 link, which will be recreated by the next stage. + run: | + C:\\tools\\cygwin\\bin\\bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && rm -f "${{ env.SAGE_LOCAL }}"/lib64; tar -cf /tmp/sage-local-${{ env.STAGE }}.tar --listed-incremental=/tmp/sage-local.snar "${{ env.SAGE_LOCAL }}"' + if: always() + - uses: actions/upload-artifact@v2 + with: + path: C:\\tools\\cygwin\\tmp\\sage-local-${{ env.STAGE }}.tar + name: ${{ env.LOCAL_ARTIFACT_NAME }} + if: always() + + cygwin-stage-v-d: + env: + STAGE: v-d + PREVIOUS_STAGES: iv + TARGETS: qepcad barvinok isl qhull primecount plantri kenzo libsemigroups mcqd meataxe mpfrcx openssl p_group_cohomology rst2ipynb sirocco tdlib tides + LOCAL_ARTIFACT_NAME: sage-local-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + + needs: [cygwin-stage-iv] + + runs-on: windows-latest + + strategy: + fail-fast: false + matrix: + pkgs: [minimal] + steps: + - run: | + git config --global core.autocrlf false + git config --global core.symlinks true + - uses: actions/checkout@v1 + - name: install cygwin and test prerequisites with choco + shell: bash {0} + run: | + choco --version + PACKAGES="python39 python39-pip" + choco install $PACKAGES --source cygwin + - uses: actions/download-artifact@v2 + with: + name: ${{ env.LOCAL_ARTIFACT_NAME }} + path: C:\\tools\\cygwin\\tmp + - name: Extract sage-local artifact + run: | + C:\\tools\\cygwin\\bin\\dash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && .github/workflows/extract-sage-local.sh /tmp/sage-local-*.tar && tar --create --listed-incremental=/tmp/sage-local.snar --file /dev/null "${{ env.SAGE_LOCAL }}"' + - name: tox + run: | + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cat /proc/cpuinfo' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'python3.8 -m pip install tox' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && PREFIX="${{ env.SAGE_LOCAL }}" tox -e local-cygwin-choco-${{ matrix.pkgs }} -- $TARGETS' + - name: Prepare logs artifact + shell: bash + run: | + mkdir -p "artifacts/$LOGS_ARTIFACT_NAME"; for a in "${{ env.SAGE_LOCAL }}"/var/tmp/sage/build/*; do if [ -d "$a" ]; then tar -c --remove-files -f "artifacts/$LOGS_ARTIFACT_NAME/$(basename "$a").tar" "$a"; fi; done; cp -r logs/* "artifacts/$LOGS_ARTIFACT_NAME" + if: always() + - uses: actions/upload-artifact@v2 + with: + path: artifacts + name: ${{ env.LOGS_ARTIFACT_NAME }} + if: always() + - name: Print out logs for immediate inspection + # The markup in the output is a GitHub Actions logging command + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions + shell: bash + run: | + find "artifacts/$LOGS_ARTIFACT_NAME" -type f -name "*.log" -exec sh -c 'if tail -20 "{}" 2>/dev/null | grep "^Error" >/dev/null; then echo :":"error file={}:":" ==== LOG FILE {} CONTAINS AN ERROR ====; cat {} ; fi' \; + if: always() + - name: Prepare sage-local artifact + # We specifically use the cygwin tar so that symlinks are saved/restored correctly on Windows. + # We remove the local/lib64 link, which will be recreated by the next stage. + run: | + C:\\tools\\cygwin\\bin\\bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && rm -f "${{ env.SAGE_LOCAL }}"/lib64; tar -cf /tmp/sage-local-${{ env.STAGE }}.tar --listed-incremental=/tmp/sage-local.snar "${{ env.SAGE_LOCAL }}"' + if: always() + - uses: actions/upload-artifact@v2 + with: + path: C:\\tools\\cygwin\\tmp\\sage-local-${{ env.STAGE }}.tar + name: ${{ env.LOCAL_ARTIFACT_NAME }} + if: always() + + cygwin-stage-v-e: + env: + STAGE: v-e + PREVIOUS_STAGES: iv + TARGETS: doc-html + LOCAL_ARTIFACT_NAME: sage-local-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + + needs: [cygwin-stage-iv] + + runs-on: windows-latest + + strategy: + fail-fast: false + matrix: + pkgs: [minimal] + steps: + - run: | + git config --global core.autocrlf false + git config --global core.symlinks true + - uses: actions/checkout@v1 + - name: install cygwin and test prerequisites with choco + shell: bash {0} + run: | + choco --version + PACKAGES="python39 python39-pip" + choco install $PACKAGES --source cygwin + - uses: actions/download-artifact@v2 + with: + name: ${{ env.LOCAL_ARTIFACT_NAME }} + path: C:\\tools\\cygwin\\tmp + - name: Extract sage-local artifact + run: | + C:\\tools\\cygwin\\bin\\dash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && .github/workflows/extract-sage-local.sh /tmp/sage-local-*.tar && tar --create --listed-incremental=/tmp/sage-local.snar --file /dev/null "${{ env.SAGE_LOCAL }}"' + - name: tox + run: | + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cat /proc/cpuinfo' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'python3.8 -m pip install tox' + C:\\tools\\cygwin\\bin\\bash -l -x -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && PREFIX="${{ env.SAGE_LOCAL }}" tox -e local-cygwin-choco-${{ matrix.pkgs }} -- $TARGETS' + - name: Prepare logs artifact + shell: bash + run: | + mkdir -p "artifacts/$LOGS_ARTIFACT_NAME"; for a in "${{ env.SAGE_LOCAL }}"/var/tmp/sage/build/*; do if [ -d "$a" ]; then tar -c --remove-files -f "artifacts/$LOGS_ARTIFACT_NAME/$(basename "$a").tar" "$a"; fi; done; cp -r logs/* "artifacts/$LOGS_ARTIFACT_NAME" + if: always() + - uses: actions/upload-artifact@v2 + with: + path: artifacts + name: ${{ env.LOGS_ARTIFACT_NAME }} + if: always() + - name: Print out logs for immediate inspection + # The markup in the output is a GitHub Actions logging command + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions + shell: bash + run: | + find "artifacts/$LOGS_ARTIFACT_NAME" -type f -name "*.log" -exec sh -c 'if tail -20 "{}" 2>/dev/null | grep "^Error" >/dev/null; then echo :":"error file={}:":" ==== LOG FILE {} CONTAINS AN ERROR ====; cat {} ; fi' \; + if: always() + - name: Prepare sage-local artifact + # We specifically use the cygwin tar so that symlinks are saved/restored correctly on Windows. + # We remove the local/lib64 link, which will be recreated by the next stage. + run: | + C:\\tools\\cygwin\\bin\\bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && rm -f "${{ env.SAGE_LOCAL }}"/lib64; tar -cf /tmp/sage-local-${{ env.STAGE }}.tar --listed-incremental=/tmp/sage-local.snar "${{ env.SAGE_LOCAL }}"' + if: always() + - uses: actions/upload-artifact@v2 + with: + path: C:\\tools\\cygwin\\tmp\\sage-local-${{ env.STAGE }}.tar + name: ${{ env.LOCAL_ARTIFACT_NAME }} + if: always() diff --git a/.github/workflows/ci-cygwin-standard.yml b/.github/workflows/ci-cygwin-standard.yml index b1655e7696f..e35637f9da1 100644 --- a/.github/workflows/ci-cygwin-standard.yml +++ b/.github/workflows/ci-cygwin-standard.yml @@ -61,11 +61,13 @@ jobs: needs: [cygwin-stage-i-a, cygwin-stage-i-b] cygwin-stage-ii-e: - uses: ./.github/workflows/cygwin.yml - with: - stage: ii-e - previous_stages: i-* - targets: threejs tachyon pillow jmol m4rie sympy lrcalc lcalc symmetrica cliquer libbraiding planarity rw elliptic_curves combinatorial_designs zn_poly sympow + env: + STAGE: ii-e + PREVIOUS_STAGES: i-* + TARGETS: threejs tachyon pillow jmol m4rie sympy lrcalc lcalc symmetrica cliquer libbraiding planarity rw elliptic_curves combinatorial_designs sympow + LOCAL_ARTIFACT_NAME: sage-local-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-cygwin-${{ matrix.pkgs }} + needs: [cygwin-stage-i-a, cygwin-stage-i-b] ############################################## stage-iii ########################################## diff --git a/.github/workflows/dist.yml b/.github/workflows/dist.yml index c64ae55bad7..96aae8fbc1a 100644 --- a/.github/workflows/dist.yml +++ b/.github/workflows/dist.yml @@ -18,8 +18,9 @@ jobs: release_dist: - # This job, in contrast to "dist" in tox.yml, - # does not use "configure --enable-download-from-upstream-url". + # This job, in contrast to "dist" in ci-macos.yml, + # does not use "configure --enable-download-from-upstream-url" + # (the default since #32390). # # In this way, we check that all necessary package tarballs # have already been uploaded to the Sage server at the time @@ -38,7 +39,7 @@ jobs: sudo DEBIAN_FRONTEND=noninteractive apt-get install $(build/bin/sage-get-system-packages debian _bootstrap) - name: make dist run: | - ./bootstrap -D && ./configure && make dist + ./bootstrap -D && ./configure --disable-download-from-upstream-url && make dist - uses: actions/upload-artifact@v3 with: path: "dist/*.tar.gz" diff --git a/.gitignore b/.gitignore index d598d2e633f..e62fa805ecd 100644 --- a/.gitignore +++ b/.gitignore @@ -157,7 +157,6 @@ __pycache__/ !/src/sage/rings/polynomial/weil/power_sums.c !/src/sage/schemes/hyperelliptic_curves/hypellfrob/hypellfrob.cpp !/src/sage/schemes/hyperelliptic_curves/hypellfrob/recurrences_ntl.cpp -!/src/sage/schemes/hyperelliptic_curves/hypellfrob/recurrences_zn_poly.cpp !/src/sage/stats/distributions/dgs_bern.c !/src/sage/stats/distributions/dgs_gauss_dp.c !/src/sage/stats/distributions/dgs_gauss_mp.c diff --git a/.vscode/settings.json b/.vscode/settings.json index e414fb65d7f..58c9bc7af2b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -27,7 +27,7 @@ "python.linting.enabled": true, // The following pycodestyle arguments are the same as the pycodestyle-minimal // tox environnment, see the file SAGE_ROOT/src/tox.ini - "python.linting.pycodestyleArgs": ["--select=E111,E306,E401,E701,E702,E703,W391,W605,E711,E712,E713,E721,E722"], + "python.linting.pycodestyleArgs": ["--select=E111,E306,E401,E701,E702,E703,W291,W391,W605,E711,E712,E713,E721,E722"], "cSpell.words": [ "furo", "Conda", diff --git a/.zenodo.json b/.zenodo.json index 2768b09b8ed..9ec77c66b2e 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,10 +1,10 @@ { "description": "Mirror of the Sage https://sagemath.org/ source tree", "license": "other-open", - "title": "sagemath/sage: 9.8.beta5", - "version": "9.8.beta5", + "title": "sagemath/sage: 9.8.beta6", + "version": "9.8.beta6", "upload_type": "software", - "publication_date": "2022-12-11", + "publication_date": "2022-12-21", "creators": [ { "affiliation": "SageMath.org", @@ -15,7 +15,7 @@ "related_identifiers": [ { "scheme": "url", - "identifier": "https://github.com/sagemath/sage/tree/9.8.beta5", + "identifier": "https://github.com/sagemath/sage/tree/9.8.beta6", "relation": "isSupplementTo" }, { diff --git a/COPYING.txt b/COPYING.txt index a3e9cc66458..a785477fb4f 100644 --- a/COPYING.txt +++ b/COPYING.txt @@ -130,7 +130,6 @@ tachyon Modified BSD threejs MIT License tornado Apache License zlib Custom (Modified BSD) -zn_poly GPLv2 or GPLv3 (no later versions, see below) CONTACT INFO: William Stein; wstein@gmail.com; @@ -1346,53 +1345,4 @@ Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler Jean-loup Gailly jloup@gzip.org Mark Adler madler@alumni.caltech.edu - -================================================================================ - -zn_poly: a library for polynomial arithmetic (version 0.9) - -Copyright (C) 2007, 2008, David Harvey - -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) version 3 of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License, -along with this program (see gpl-2.0.txt and gpl-3.0.txt). If not, -see . - -Licensing notes: - -(1) -zn_poly is NOT released under the "GPL v2 or later" or "GPL v3 or later". -Both v2 and v3 are fine, but for now I am excluding later versions. If you -need zn_poly under a different license, ask me and I'll consider it. - -(2) -zn_poly incorporates small amounts of code from other projects: - - (2a) - The file "wide_arith.h" includes some assembly macros from the file - "longlong.h" in GMP 4.2.1; see http://gmplib.org/. The copyright to this - code is held by the Free Software Foundation, and it was released under - "LGPL v2.1 or later". - - (2b) - The file "wide_arith.h" also includes assembly macros from the file - "SPMM_ASM.h" in NTL 5.4.1; see http://www.shoup.net/ntl/. The copyright - to this code is held by Victor Shoup, and it was released under "GPL v2 or - later". - - (2c) - The filer "profiler.h" contains x86 cycle counting code from the file - "profiler.h" in FLINT 1.0; see http://www.flintlib.org/. The copyright - to this code is held by William Hart, and it was released under "GPL v2 or - later". - =============================================================================== diff --git a/README.md b/README.md index dc4139a8172..e18b17adda5 100644 --- a/README.md +++ b/README.md @@ -409,7 +409,7 @@ SAGE_ROOT Root directory (sage-x.y in Sage tarball) │ └── pkgs Every package is a subdirectory here │ ├── 4ti2/ │ … -│ └── zn_poly/ +│ └── zlib/ ├── configure Top-level configure script ├── COPYING.txt Copyright information ├── pkgs Source trees of Python distribution packages @@ -456,7 +456,7 @@ SAGE_ROOT Root directory (sage-x.y in Sage tarball) │ └── pkgs Build logs of individual packages │ ├── alabaster-0.7.12.log │ … -│ └── zn_poly-0.9.2.log +│ └── zlib-1.2.11.log ├── m4 M4 macros for generating the configure script │ └── *.m4 ├── Makefile Running "make" uses this file @@ -470,7 +470,7 @@ SAGE_ROOT Root directory (sage-x.y in Sage tarball) ├── upstream Source tarballs of packages │ ├── Babel-2.9.1.tar.gz │ … -│ └── zn_poly-0.9.2.tar.gz +│ └── zlib-1.2.11.tar.gz ├── venv -> SAGE_VENV Convenience symlink to the virtual environment └── VERSION.txt ``` diff --git a/VERSION.txt b/VERSION.txt index 801642460d4..d56e58910a3 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -SageMath version 9.8.beta5, Release Date: 2022-12-11 +SageMath version 9.8.beta6, Release Date: 2022-12-21 diff --git a/build/bin/sage-package b/build/bin/sage-package index eeebbcd2c2e..ccb3ad194a7 100755 --- a/build/bin/sage-package +++ b/build/bin/sage-package @@ -18,7 +18,7 @@ # arb # autotools # [...] -# zn_poly +# zlib # # * Find the package name given a tarball filename # diff --git a/build/pkgs/argon2_cffi/checksums.ini b/build/pkgs/argon2_cffi/checksums.ini index 11705963d15..fa87877c2e6 100644 --- a/build/pkgs/argon2_cffi/checksums.ini +++ b/build/pkgs/argon2_cffi/checksums.ini @@ -1,5 +1,5 @@ tarball=argon2-cffi-VERSION.tar.gz -sha1=c79943104960db3024346731d5153392c187c0d7 -md5=e49ccb29351387fd853f31bf19b67f59 -cksum=3765128778 +sha1=c16c1506de0211bdfa23d4d51e780fb4aaff5222 +md5=b7843e8690c790f8e743d37bb75c25a8 +cksum=3700408796 upstream_url=https://pypi.io/packages/source/a/argon2_cffi/argon2-cffi-VERSION.tar.gz diff --git a/build/pkgs/argon2_cffi/package-version.txt b/build/pkgs/argon2_cffi/package-version.txt index e43bba47d76..54d3ad73646 100644 --- a/build/pkgs/argon2_cffi/package-version.txt +++ b/build/pkgs/argon2_cffi/package-version.txt @@ -1 +1 @@ -20.1.0 +21.3.0 diff --git a/build/pkgs/attrs/checksums.ini b/build/pkgs/attrs/checksums.ini index f329e28cb08..291539baec1 100644 --- a/build/pkgs/attrs/checksums.ini +++ b/build/pkgs/attrs/checksums.ini @@ -1,5 +1,5 @@ tarball=attrs-VERSION.tar.gz -sha1=693de5a8890c6f7bad4edd6ade6971ab3eaf416b -md5=5a9b5e9ceebc380a13fb93235b11bbda -cksum=2935089723 +sha1=16d99f8e6f84309a4e399babc2e237da87b445ad +md5=0487081b7ead8753fc46cf7c6d1e28e3 +cksum=3993993002 upstream_url=https://pypi.io/packages/source/a/attrs/attrs-VERSION.tar.gz diff --git a/build/pkgs/attrs/package-version.txt b/build/pkgs/attrs/package-version.txt index 8bd85214a48..ee5c2446981 100644 --- a/build/pkgs/attrs/package-version.txt +++ b/build/pkgs/attrs/package-version.txt @@ -1 +1 @@ -21.4.0 +22.1.0 diff --git a/build/pkgs/configure/checksums.ini b/build/pkgs/configure/checksums.ini index 74e443193ab..67aef802c69 100644 --- a/build/pkgs/configure/checksums.ini +++ b/build/pkgs/configure/checksums.ini @@ -1,4 +1,4 @@ tarball=configure-VERSION.tar.gz -sha1=cd10867f6ee013a5f7fcfa6c9c69b1aed1939399 -md5=dbbcb33cd3ea96259a902cdffad84ab9 -cksum=423684136 +sha1=03fa7a341ddf380aa4fe54a85b0c41debd2ffe7e +md5=6fdfcb62364de0e8c8d57f5d3a38c909 +cksum=3919137984 diff --git a/build/pkgs/configure/package-version.txt b/build/pkgs/configure/package-version.txt index 16688549047..8bf4ba4a67a 100644 --- a/build/pkgs/configure/package-version.txt +++ b/build/pkgs/configure/package-version.txt @@ -1 +1 @@ -325b7c119c0cf14948e6052709a814bcd6e3f477 +7819a59980b78950a0eb4aa18c529efa380d687b diff --git a/build/pkgs/cppy/checksums.ini b/build/pkgs/cppy/checksums.ini index 5c781671d43..613b3b3f5b8 100644 --- a/build/pkgs/cppy/checksums.ini +++ b/build/pkgs/cppy/checksums.ini @@ -1,5 +1,5 @@ tarball=cppy-VERSION.tar.gz -sha1=3af4f5f14ef1f9b49d7457e2fa5c241c721db29c -md5=2110891d75aa12551deebba1603428c6 -cksum=793876648 +sha1=c82ee7a4f38e302bfe4de2a695d2bdfefb69951f +md5=7c1f825c43dd66454440932a35b9969c +cksum=1879136901 upstream_url=https://files.pythonhosted.org/packages/source/c/cppy/cppy-VERSION.tar.gz diff --git a/build/pkgs/cppy/package-version.txt b/build/pkgs/cppy/package-version.txt index 9084fa2f716..6085e946503 100644 --- a/build/pkgs/cppy/package-version.txt +++ b/build/pkgs/cppy/package-version.txt @@ -1 +1 @@ -1.1.0 +1.2.1 diff --git a/build/pkgs/docutils/checksums.ini b/build/pkgs/docutils/checksums.ini index 7eb275b5d93..7ba721d2c06 100644 --- a/build/pkgs/docutils/checksums.ini +++ b/build/pkgs/docutils/checksums.ini @@ -1,5 +1,5 @@ tarball=docutils-VERSION.tar.gz -sha1=f423535c12fcd2a68d4fc52525fbe36020a58ab5 -md5=ed810564c25063e9dac10dd0893ead47 -cksum=3160620183 +sha1=c38c6ccd1547b4d651e39b64dd6be676be5f14d5 +md5=0afa992a6e93db892107c3f087d0d9df +cksum=658477137 upstream_url=https://pypi.io/packages/source/d/docutils/docutils-VERSION.tar.gz diff --git a/build/pkgs/docutils/package-version.txt b/build/pkgs/docutils/package-version.txt index 7cca7711a0d..caa4836d8e0 100644 --- a/build/pkgs/docutils/package-version.txt +++ b/build/pkgs/docutils/package-version.txt @@ -1 +1 @@ -0.17.1 +0.19 diff --git a/build/pkgs/gmpy2/checksums.ini b/build/pkgs/gmpy2/checksums.ini index d17df675312..70ecbe7244d 100644 --- a/build/pkgs/gmpy2/checksums.ini +++ b/build/pkgs/gmpy2/checksums.ini @@ -1,5 +1,5 @@ tarball=gmpy2-VERSION.tar.gz -sha1=fcb929ab9a44d96bfb47b7ed411cc2f048b484b2 -md5=877d324e676b162053772affda5c0de7 -cksum=2408333571 +sha1=8280f6c68c57dd4a2fce149162c080c1dac86eb0 +md5=bb21846e99800e04d5b330b76c23ba10 +cksum=3835762323 upstream_url=https://pypi.io/packages/source/g/gmpy2/gmpy2-VERSION.tar.gz diff --git a/build/pkgs/gmpy2/package-version.txt b/build/pkgs/gmpy2/package-version.txt index 3e3c2f1e5ed..eca07e4c1a8 100644 --- a/build/pkgs/gmpy2/package-version.txt +++ b/build/pkgs/gmpy2/package-version.txt @@ -1 +1 @@ -2.1.1 +2.1.2 diff --git a/build/pkgs/hatch_nodejs_version/checksums.ini b/build/pkgs/hatch_nodejs_version/checksums.ini index d5210b7eab0..bb5f28d0e24 100644 --- a/build/pkgs/hatch_nodejs_version/checksums.ini +++ b/build/pkgs/hatch_nodejs_version/checksums.ini @@ -1,5 +1,5 @@ tarball=hatch_nodejs_version-VERSION.tar.gz -sha1=27420a3bae3f787640b2c8ad522d75fa32526294 -md5=644c2aea7558de91bbd66217fec6a1b9 -cksum=4058013444 +sha1=ce77992d461d5108c481e985250cfb401b4ee5df +md5=6e5f9d5cfa442572637478cacaa8ea81 +cksum=1271494344 upstream_url=https://pypi.io/packages/source/h/hatch_nodejs_version/hatch_nodejs_version-VERSION.tar.gz diff --git a/build/pkgs/hatch_nodejs_version/package-version.txt b/build/pkgs/hatch_nodejs_version/package-version.txt index 0d91a54c7d4..9e11b32fcaa 100644 --- a/build/pkgs/hatch_nodejs_version/package-version.txt +++ b/build/pkgs/hatch_nodejs_version/package-version.txt @@ -1 +1 @@ -0.3.0 +0.3.1 diff --git a/build/pkgs/importlib_metadata/checksums.ini b/build/pkgs/importlib_metadata/checksums.ini index c6d66d9ee23..4d326297be6 100644 --- a/build/pkgs/importlib_metadata/checksums.ini +++ b/build/pkgs/importlib_metadata/checksums.ini @@ -1,5 +1,5 @@ tarball=importlib_metadata-VERSION.tar.gz -sha1=38794db2afb90ed0be04bd8b5996a5b5fd45acc2 -md5=ccd58a387cc2bab6cf72fdf21e403749 -cksum=758044022 +sha1=4a49e8c6d8e2eb02e9ea821444b5ba153d8c34a6 +md5=56d34f2e854bb0f318baa9e47aba3439 +cksum=3438247256 upstream_url=https://pypi.io/packages/source/i/importlib_metadata/importlib_metadata-VERSION.tar.gz diff --git a/build/pkgs/importlib_metadata/package-version.txt b/build/pkgs/importlib_metadata/package-version.txt index 0062ac97180..831446cbd27 100644 --- a/build/pkgs/importlib_metadata/package-version.txt +++ b/build/pkgs/importlib_metadata/package-version.txt @@ -1 +1 @@ -5.0.0 +5.1.0 diff --git a/build/pkgs/jsonschema/checksums.ini b/build/pkgs/jsonschema/checksums.ini index b25e78e04fa..5a214ae38fc 100644 --- a/build/pkgs/jsonschema/checksums.ini +++ b/build/pkgs/jsonschema/checksums.ini @@ -1,5 +1,5 @@ tarball=jsonschema-VERSION.tar.gz -sha1=912d562c1394408dca582e14843e3245df2f3827 -md5=3bc1f63a74fc61bf2847f22cadb0dfff -cksum=2200261176 +sha1=ccea159a8a0c453e6fbbcfd7bb681b1bc766500e +md5=527bc4d51d31e8d0b8a0d833b6a50002 +cksum=1885537635 upstream_url=https://pypi.io/packages/source/j/jsonschema/jsonschema-VERSION.tar.gz diff --git a/build/pkgs/jsonschema/package-version.txt b/build/pkgs/jsonschema/package-version.txt index ecbc3b03079..1b0a87fdfc9 100644 --- a/build/pkgs/jsonschema/package-version.txt +++ b/build/pkgs/jsonschema/package-version.txt @@ -1 +1 @@ -4.16.0 +4.17.1 diff --git a/build/pkgs/openblas/dependencies b/build/pkgs/openblas/dependencies index a475340050b..57ddf74f36e 100644 --- a/build/pkgs/openblas/dependencies +++ b/build/pkgs/openblas/dependencies @@ -1,4 +1,4 @@ -gfortran | $(PYTHON) +gfortran ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pathspec/checksums.ini b/build/pkgs/pathspec/checksums.ini index 2db40ded285..a98c270d6e1 100644 --- a/build/pkgs/pathspec/checksums.ini +++ b/build/pkgs/pathspec/checksums.ini @@ -1,5 +1,5 @@ tarball=pathspec-VERSION.tar.gz -sha1=ef0f4b07097506575ca8052256b56f137a7b170d -md5=6f4fde5e701d328a2846d206edb63aa9 -cksum=2376511942 +sha1=418ae4112af18af995c0f20a22e5a903b8ce50ae +md5=28c87c3581b10152c4581d10fe33f765 +cksum=2161527634 upstream_url=https://pypi.io/packages/source/p/pathspec/pathspec-VERSION.tar.gz diff --git a/build/pkgs/pathspec/package-version.txt b/build/pkgs/pathspec/package-version.txt index 571215736a6..5eef0f10e8c 100644 --- a/build/pkgs/pathspec/package-version.txt +++ b/build/pkgs/pathspec/package-version.txt @@ -1 +1 @@ -0.10.1 +0.10.2 diff --git a/build/pkgs/pint/checksums.ini b/build/pkgs/pint/checksums.ini index 9be8323d338..b852d25efe6 100644 --- a/build/pkgs/pint/checksums.ini +++ b/build/pkgs/pint/checksums.ini @@ -1,5 +1,5 @@ tarball=Pint-VERSION.tar.gz -sha1=98496b31efc63adfbf640953351aafc51cb46584 -md5=b14aa24f4a4bcbc2c2fae797b25d0b3e -cksum=3392069525 +sha1=c14ac08ca2d5a68d79ea7cd2252dc7e2a572c56a +md5=522a8e633e487e92ba54ccbec395947a +cksum=2139030399 upstream_url=https://pypi.io/packages/source/p/pint/Pint-VERSION.tar.gz diff --git a/build/pkgs/pint/package-version.txt b/build/pkgs/pint/package-version.txt index 50653ad0a6e..847e9aef6d1 100644 --- a/build/pkgs/pint/package-version.txt +++ b/build/pkgs/pint/package-version.txt @@ -1 +1 @@ -0.17 +0.20.1 diff --git a/build/pkgs/pip/checksums.ini b/build/pkgs/pip/checksums.ini index cc58418441f..1ae66fbc20a 100644 --- a/build/pkgs/pip/checksums.ini +++ b/build/pkgs/pip/checksums.ini @@ -1,5 +1,5 @@ tarball=pip-VERSION.tar.gz -sha1=a6d9d6b04f17acb11f214db9835f4b66e12a1fe2 -md5=f0dd02265e7ccd2f8758c840fba64810 -cksum=1176625017 +sha1=29167fffe19874a74247fe92f4fdba1bb1221c61 +md5=996f58a94fe0b8b82b6795c42bd171ba +cksum=537001443 upstream_url=https://pypi.io/packages/source/p/pip/pip-VERSION.tar.gz diff --git a/build/pkgs/pip/package-version.txt b/build/pkgs/pip/package-version.txt index 937387f33bb..4c3dad97552 100644 --- a/build/pkgs/pip/package-version.txt +++ b/build/pkgs/pip/package-version.txt @@ -1 +1 @@ -22.3 +22.3.1 diff --git a/build/pkgs/platformdirs/checksums.ini b/build/pkgs/platformdirs/checksums.ini index 8dc4a85a66d..604aa7f6c99 100644 --- a/build/pkgs/platformdirs/checksums.ini +++ b/build/pkgs/platformdirs/checksums.ini @@ -1,5 +1,5 @@ tarball=platformdirs-VERSION.tar.gz -sha1=344841a3cd4eb5b1a1b8adb8a57e845e5a06b236 -md5=2301a8a29c3082a49ee293073d893887 -cksum=1100125935 +sha1=082974f7d3ea03adfa147f4ab5be76079c2a116f +md5=f449b7f3767577fa2a57465a4523e92e +cksum=2966639810 upstream_url=https://pypi.io/packages/source/p/platformdirs/platformdirs-VERSION.tar.gz diff --git a/build/pkgs/platformdirs/package-version.txt b/build/pkgs/platformdirs/package-version.txt index f225a78adf0..fe16b348d97 100644 --- a/build/pkgs/platformdirs/package-version.txt +++ b/build/pkgs/platformdirs/package-version.txt @@ -1 +1 @@ -2.5.2 +2.5.4 diff --git a/build/pkgs/pybind11/checksums.ini b/build/pkgs/pybind11/checksums.ini index 1a6fb10c749..1cc6d36c174 100644 --- a/build/pkgs/pybind11/checksums.ini +++ b/build/pkgs/pybind11/checksums.ini @@ -1,5 +1,5 @@ tarball=pybind11-VERSION.tar.gz -sha1=cee2f3c7879783bb5f021c7db332f8a290fe3763 -md5=c232928479f398693bface2731387691 -cksum=3770559962 +sha1=d0e6e22c2ce36fad4bb60dbac4d6d498ceb464df +md5=0b181dbb44c3cc632e724cef5081cae1 +cksum=4287838207 upstream_url=https://pypi.io/packages/source/p/pybind11/pybind11-VERSION.tar.gz diff --git a/build/pkgs/pybind11/package-version.txt b/build/pkgs/pybind11/package-version.txt index 5d9ade10c60..8bbb6e406a7 100644 --- a/build/pkgs/pybind11/package-version.txt +++ b/build/pkgs/pybind11/package-version.txt @@ -1 +1 @@ -2.9.2 +2.10.1 diff --git a/build/pkgs/pyrsistent/checksums.ini b/build/pkgs/pyrsistent/checksums.ini index 7ea885d3db7..7d537e43e37 100644 --- a/build/pkgs/pyrsistent/checksums.ini +++ b/build/pkgs/pyrsistent/checksums.ini @@ -1,5 +1,5 @@ tarball=pyrsistent-VERSION.tar.gz -sha1=58f9efc4800acb6f7a083688e988187cccee2266 -md5=cef3da08455664bf917dcf8cd00d49a4 -cksum=350737156 +sha1=a2c5cc517a33dcfd3918d3eabf4859b8901d3913 +md5=23da81256b8817e123568a858bf78997 +cksum=1165148669 upstream_url=https://pypi.io/packages/source/p/pyrsistent/pyrsistent-VERSION.tar.gz diff --git a/build/pkgs/pyrsistent/package-version.txt b/build/pkgs/pyrsistent/package-version.txt index 249afd517d9..61e6e92d914 100644 --- a/build/pkgs/pyrsistent/package-version.txt +++ b/build/pkgs/pyrsistent/package-version.txt @@ -1 +1 @@ -0.18.1 +0.19.2 diff --git a/build/pkgs/pyzmq/checksums.ini b/build/pkgs/pyzmq/checksums.ini index cd83e8c1a2d..d9abd25d464 100644 --- a/build/pkgs/pyzmq/checksums.ini +++ b/build/pkgs/pyzmq/checksums.ini @@ -1,5 +1,5 @@ tarball=pyzmq-VERSION.tar.gz -sha1=b31a94f504ef3104a28e64d88b7c1feafb124982 -md5=7de9c7bb05cc89d21e4105ec1ac7c270 -cksum=936855776 +sha1=1a2e7220d7d1b6167c14ae2cc001dfc5d9a28dde +md5=f10b7c3dee2c03557e2c5d00b73dfc7f +cksum=1163982926 upstream_url=https://pypi.io/packages/source/p/pyzmq/pyzmq-VERSION.tar.gz diff --git a/build/pkgs/pyzmq/package-version.txt b/build/pkgs/pyzmq/package-version.txt index 11ebcd0e4f9..1b3e74f84e7 100644 --- a/build/pkgs/pyzmq/package-version.txt +++ b/build/pkgs/pyzmq/package-version.txt @@ -1 +1 @@ -23.2.0 +24.0.1 diff --git a/build/pkgs/sage_conf/install-requires.txt b/build/pkgs/sage_conf/install-requires.txt index 3a857a04842..9c4fd579311 100644 --- a/build/pkgs/sage_conf/install-requires.txt +++ b/build/pkgs/sage_conf/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sage-conf ~= 9.8b5 +sage-conf ~= 9.8b6 diff --git a/build/pkgs/sage_docbuild/install-requires.txt b/build/pkgs/sage_docbuild/install-requires.txt index 8cf6b33c657..eaa09529ac8 100644 --- a/build/pkgs/sage_docbuild/install-requires.txt +++ b/build/pkgs/sage_docbuild/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sage-docbuild ~= 9.8b5 +sage-docbuild ~= 9.8b6 diff --git a/build/pkgs/sage_setup/install-requires.txt b/build/pkgs/sage_setup/install-requires.txt index 59c19f3b157..28f2d3022d3 100644 --- a/build/pkgs/sage_setup/install-requires.txt +++ b/build/pkgs/sage_setup/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sage-setup ~= 9.8b5 +sage-setup ~= 9.8b6 diff --git a/build/pkgs/sage_sws2rst/install-requires.txt b/build/pkgs/sage_sws2rst/install-requires.txt index 0519af13e68..06400496e54 100644 --- a/build/pkgs/sage_sws2rst/install-requires.txt +++ b/build/pkgs/sage_sws2rst/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sage-sws2rst ~= 9.8b5 +sage-sws2rst ~= 9.8b6 diff --git a/build/pkgs/sagelib/dependencies b/build/pkgs/sagelib/dependencies index 810713712ed..abf21122c87 100644 --- a/build/pkgs/sagelib/dependencies +++ b/build/pkgs/sagelib/dependencies @@ -1,4 +1,4 @@ -FORCE $(SCRIPTS) arb boost_cropped $(BLAS) brial cliquer cypari cysignals cython ecl eclib ecm flint libgd gap giac givaro glpk gmpy2 gsl iml jinja2 jupyter_core lcalc lrcalc_python libbraiding libhomfly libpng linbox m4ri m4rie memory_allocator mpc mpfi mpfr $(MP_LIBRARY) ntl numpy pari pip pkgconfig planarity ppl pplpy primesieve primecount primecountpy pycygwin $(PYTHON) requests rw sage_conf singular symmetrica zn_poly $(PCFILES) | $(PYTHON_TOOLCHAIN) sage_setup +FORCE $(SCRIPTS) arb boost_cropped $(BLAS) brial cliquer cypari cysignals cython ecl eclib ecm flint libgd gap giac givaro glpk gmpy2 gsl iml jinja2 jupyter_core lcalc lrcalc_python libbraiding libhomfly libpng linbox m4ri m4rie memory_allocator mpc mpfi mpfr $(MP_LIBRARY) ntl numpy pari pip pkgconfig planarity ppl pplpy primesieve primecount primecountpy pycygwin $(PYTHON) requests rw sage_conf singular symmetrica $(PCFILES) | $(PYTHON_TOOLCHAIN) sage_setup ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/sagelib/install-requires.txt b/build/pkgs/sagelib/install-requires.txt index 8f36ec274c2..ad8a88b331e 100644 --- a/build/pkgs/sagelib/install-requires.txt +++ b/build/pkgs/sagelib/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagelib ~= 9.8b5 +sagelib ~= 9.8b6 diff --git a/build/pkgs/sagemath_categories/install-requires.txt b/build/pkgs/sagemath_categories/install-requires.txt index 80e1acdaab9..6fbc27bd0c1 100644 --- a/build/pkgs/sagemath_categories/install-requires.txt +++ b/build/pkgs/sagemath_categories/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-categories ~= 9.8b5 +sagemath-categories ~= 9.8b6 diff --git a/build/pkgs/sagemath_environment/install-requires.txt b/build/pkgs/sagemath_environment/install-requires.txt index 9f6db871278..43c5019c37f 100644 --- a/build/pkgs/sagemath_environment/install-requires.txt +++ b/build/pkgs/sagemath_environment/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-environment ~= 9.8b5 +sagemath-environment ~= 9.8b6 diff --git a/build/pkgs/sagemath_objects/install-requires.txt b/build/pkgs/sagemath_objects/install-requires.txt index 0b7fff7433d..f949c43e074 100644 --- a/build/pkgs/sagemath_objects/install-requires.txt +++ b/build/pkgs/sagemath_objects/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-objects ~= 9.8b5 +sagemath-objects ~= 9.8b6 diff --git a/build/pkgs/sagemath_repl/install-requires.txt b/build/pkgs/sagemath_repl/install-requires.txt index 0849e6ab28d..39e13274171 100644 --- a/build/pkgs/sagemath_repl/install-requires.txt +++ b/build/pkgs/sagemath_repl/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-repl ~= 9.8b5 +sagemath-repl ~= 9.8b6 diff --git a/build/pkgs/setuptools_wheel/checksums.ini b/build/pkgs/setuptools_wheel/checksums.ini index 2da328e1726..8db0d8c3016 100644 --- a/build/pkgs/setuptools_wheel/checksums.ini +++ b/build/pkgs/setuptools_wheel/checksums.ini @@ -1,5 +1,5 @@ tarball=setuptools-VERSION.tar.gz -sha1=e5f9797d85db9bb2ce39b401c1b7aca38de616b5 -md5=ec88a6545351e72ca73fcec7a6bff6ad -cksum=1981709060 +sha1=2875e8f9a12d8a971461b36e2d1bd64a3497e0f2 +md5=1fd8bd04b0bed95ad6c81f03b1c080bc +cksum=1462078737 upstream_url=https://pypi.io/packages/source/s/setuptools/setuptools-VERSION.tar.gz diff --git a/build/pkgs/setuptools_wheel/package-version.txt b/build/pkgs/setuptools_wheel/package-version.txt index ba0d20023a1..c1a8c8394ad 100644 --- a/build/pkgs/setuptools_wheel/package-version.txt +++ b/build/pkgs/setuptools_wheel/package-version.txt @@ -1 +1 @@ -65.4.0 +65.6.3 diff --git a/build/pkgs/stack_data/checksums.ini b/build/pkgs/stack_data/checksums.ini index 13d92e56bd8..625aaf0578f 100644 --- a/build/pkgs/stack_data/checksums.ini +++ b/build/pkgs/stack_data/checksums.ini @@ -1,5 +1,5 @@ tarball=stack_data-VERSION.tar.gz -sha1=5e69d397ae31e6dcd995765d4ab51cb6b897fb11 -md5=eedee8944e6e08ddb3195f968553e861 -cksum=64651866 +sha1=58ed9cb32a42e07dbc18356d06f8db96475bc0f2 +md5=05c8c6c58c02280bc87b6851e40d38e6 +cksum=1485401259 upstream_url=https://pypi.io/packages/source/s/stack_data/stack_data-VERSION.tar.gz diff --git a/build/pkgs/stack_data/package-version.txt b/build/pkgs/stack_data/package-version.txt index a918a2aa18d..ee6cdce3c29 100644 --- a/build/pkgs/stack_data/package-version.txt +++ b/build/pkgs/stack_data/package-version.txt @@ -1 +1 @@ -0.6.0 +0.6.1 diff --git a/build/pkgs/texttable/checksums.ini b/build/pkgs/texttable/checksums.ini index 9f7f062fc11..380a205bdd3 100644 --- a/build/pkgs/texttable/checksums.ini +++ b/build/pkgs/texttable/checksums.ini @@ -1,5 +1,5 @@ tarball=texttable-VERSION.tar.gz -sha1=f818f1ea121513b54a417ffa6fe8bb26821913d7 -md5=15faadc07ba44d337cc1675ea6092a02 -cksum=4013109377 +sha1=25e1b92e02c8e919dc0da053efbe8c4874418a8d +md5=83eb15fb541dd857ff051a8d0c979b9c +cksum=3183998721 upstream_url=https://pypi.io/packages/source/t/texttable/texttable-VERSION.tar.gz diff --git a/build/pkgs/texttable/package-version.txt b/build/pkgs/texttable/package-version.txt index 9edc58bb1dd..400084b1bf2 100644 --- a/build/pkgs/texttable/package-version.txt +++ b/build/pkgs/texttable/package-version.txt @@ -1 +1 @@ -1.6.4 +1.6.7 diff --git a/build/pkgs/wheel/checksums.ini b/build/pkgs/wheel/checksums.ini index 5872bf109ab..b01f275c477 100644 --- a/build/pkgs/wheel/checksums.ini +++ b/build/pkgs/wheel/checksums.ini @@ -1,5 +1,5 @@ tarball=wheel-VERSION.tar.gz -sha1=f9f3d980579b88baaacdb6c4a3cc4466b9353030 -md5=f490f1399e5903706cb1d4fbed9ecb28 -cksum=984523375 +sha1=ff9a5efeabf8e73e8b1a8646eaa829154f834726 +md5=83bb4e7bd4d687d398733f341a64ab91 +cksum=518943238 upstream_url=https://pypi.io/packages/source/w/wheel/wheel-VERSION.tar.gz diff --git a/build/pkgs/wheel/package-version.txt b/build/pkgs/wheel/package-version.txt index 9b1bb851239..87f0b954e35 100644 --- a/build/pkgs/wheel/package-version.txt +++ b/build/pkgs/wheel/package-version.txt @@ -1 +1 @@ -0.37.1 +0.38.4 diff --git a/build/pkgs/zipp/checksums.ini b/build/pkgs/zipp/checksums.ini index 5876b93b924..53d559563f8 100644 --- a/build/pkgs/zipp/checksums.ini +++ b/build/pkgs/zipp/checksums.ini @@ -1,5 +1,5 @@ tarball=zipp-VERSION.tar.gz -sha1=017268ef95e7da55ca11e695b63cda797d7a64be -md5=f75b65d022528a44877626641f0f95c3 -cksum=1239244009 +sha1=3f6c57b68f3b9165586ea7cce96fc2540b0078ec +md5=1fbff3bca7294a3a7f09fa3f0652c3da +cksum=1128680850 upstream_url=https://pypi.io/packages/source/z/zipp/zipp-VERSION.tar.gz diff --git a/build/pkgs/zipp/package-version.txt b/build/pkgs/zipp/package-version.txt index 30291cba223..afad818663d 100644 --- a/build/pkgs/zipp/package-version.txt +++ b/build/pkgs/zipp/package-version.txt @@ -1 +1 @@ -3.10.0 +3.11.0 diff --git a/build/pkgs/zn_poly/SPKG.rst b/build/pkgs/zn_poly/SPKG.rst deleted file mode 100644 index b04ca2b274d..00000000000 --- a/build/pkgs/zn_poly/SPKG.rst +++ /dev/null @@ -1,96 +0,0 @@ -zn_poly: C library for polynomial arithmetic in Z/nZ[x] -======================================================= - -Description ------------ - -zn_poly is a C library for polynomial arithmetic in Z/nZ[x], where n is -any modulus that fits into an unsigned long. - -Website: https://gitlab.com/sagemath/zn_poly - -Note: Original website is at https://web.maths.unsw.edu.au/~davidharvey/code/zn_poly/ but is -no longer maintained. Sage maintains an "official" continuation of the -project at the above link. - -License -------- - -GPL V2 or V3. Some of the code has been copied from other projects - see -the file src/COPYING for details. - - -Upstream Contact ----------------- - -- David Harvey -- \E. M. Bray - -Dependencies ------------- - -- GMP/MPIR -- (some) Python (to create the Makefile) -- GNU patch -- NTL apparently only if we configured zn_poly differently (same for - FLINT) - - -Special Update/Build Instructions ---------------------------------- - -- Make sure the patches still apply. - - Especially changes in ``makemakefile.py`` may also require changes to - ``spkg-install`` (and perhaps also ``spkg-check``). - -- There's also a ``--use-flint`` option to ``configure``; no idea what - it does, - and we currently don't use it either. - -- TODO: -- Use ``make install`` instead of manually "installing" (copying and - symlinking) the [shared] libraries and header files. This requires - further - tweaking of ``makemakefile.py``, since it currently only installs a - static - library and the headers. - -- If everything's fine, i.e., no problems arise, some comments and - especially some code I currently just commented out can certainly be removed. - (-leif, 04/2012) - -- The version number "0.9.p11" is used as a doctest in the function - package_versions in sage/misc/packages.py, so if this package gets - upgraded, that doctest needs to be changed. - -Patches -~~~~~~~ - -- All patches from Sage have been merged into upstream. These include: -- makemakefile.py.patch: - - Improves the Python script creating the Makeefile for better use at - least within Sage; see patch for details. (Last modified at #12433, - which added and changed a lot.) - -- profiler.c.patch, zn_poly.h.patch: - - Fix potential redefinition of ``ulong`` (in combination with other - headers). - -- mpn_mulmid-tune.c.patch, mulmid-tune.c.patch, mul-tune.c.patch: - - Fix "jump into scope of identifier with variably modified type" - errors. (See #8771). - -- mpn_mulmid-test.c.patch: - - Fix a potential problem when the value of ZNP_mpn_smp_kara_thresh is - SIZE_MAX, this is usually irrealistic but can happen at least on - linux on power7 with gcc-4.7.1 (see #14098). - -- fix_fudge_factor_in_nuss-test.c.patch: - - As the name says; fix provided by upstream (David Harvey); see - #13947. diff --git a/build/pkgs/zn_poly/checksums.ini b/build/pkgs/zn_poly/checksums.ini deleted file mode 100644 index 25cdb79c3b3..00000000000 --- a/build/pkgs/zn_poly/checksums.ini +++ /dev/null @@ -1,4 +0,0 @@ -tarball=zn_poly-VERSION.tar.gz -sha1=ac13121e8ba03f12edd22b0a2e0ae3b3a79fc26e -md5=81f09badfe4f941159df70805681d9eb -cksum=2478176718 diff --git a/build/pkgs/zn_poly/dependencies b/build/pkgs/zn_poly/dependencies deleted file mode 100644 index 42dc0e9c107..00000000000 --- a/build/pkgs/zn_poly/dependencies +++ /dev/null @@ -1,4 +0,0 @@ -$(MP_LIBRARY) - ----------- -All lines of this file are ignored except the first. diff --git a/build/pkgs/zn_poly/distros/arch.txt b/build/pkgs/zn_poly/distros/arch.txt deleted file mode 100644 index 5ff8997d672..00000000000 --- a/build/pkgs/zn_poly/distros/arch.txt +++ /dev/null @@ -1 +0,0 @@ -zn_poly diff --git a/build/pkgs/zn_poly/distros/conda.txt b/build/pkgs/zn_poly/distros/conda.txt deleted file mode 100644 index 5ff8997d672..00000000000 --- a/build/pkgs/zn_poly/distros/conda.txt +++ /dev/null @@ -1 +0,0 @@ -zn_poly diff --git a/build/pkgs/zn_poly/distros/debian.txt b/build/pkgs/zn_poly/distros/debian.txt deleted file mode 100644 index f155e4856dd..00000000000 --- a/build/pkgs/zn_poly/distros/debian.txt +++ /dev/null @@ -1 +0,0 @@ -libzn-poly-dev diff --git a/build/pkgs/zn_poly/distros/fedora.txt b/build/pkgs/zn_poly/distros/fedora.txt deleted file mode 100644 index 631dd81dfe1..00000000000 --- a/build/pkgs/zn_poly/distros/fedora.txt +++ /dev/null @@ -1 +0,0 @@ -zn_poly zn_poly-devel diff --git a/build/pkgs/zn_poly/distros/freebsd.txt b/build/pkgs/zn_poly/distros/freebsd.txt deleted file mode 100644 index 8231d562435..00000000000 --- a/build/pkgs/zn_poly/distros/freebsd.txt +++ /dev/null @@ -1 +0,0 @@ -math/zn_poly diff --git a/build/pkgs/zn_poly/distros/nix.txt b/build/pkgs/zn_poly/distros/nix.txt deleted file mode 100644 index 5ff8997d672..00000000000 --- a/build/pkgs/zn_poly/distros/nix.txt +++ /dev/null @@ -1 +0,0 @@ -zn_poly diff --git a/build/pkgs/zn_poly/distros/opensuse.txt b/build/pkgs/zn_poly/distros/opensuse.txt deleted file mode 100644 index 4bbe6043915..00000000000 --- a/build/pkgs/zn_poly/distros/opensuse.txt +++ /dev/null @@ -1 +0,0 @@ -zn_poly-devel diff --git a/build/pkgs/zn_poly/distros/repology.txt b/build/pkgs/zn_poly/distros/repology.txt deleted file mode 100644 index 597d1f28efa..00000000000 --- a/build/pkgs/zn_poly/distros/repology.txt +++ /dev/null @@ -1,2 +0,0 @@ -zn-poly -libzn-poly diff --git a/build/pkgs/zn_poly/distros/void.txt b/build/pkgs/zn_poly/distros/void.txt deleted file mode 100644 index 5ff8997d672..00000000000 --- a/build/pkgs/zn_poly/distros/void.txt +++ /dev/null @@ -1 +0,0 @@ -zn_poly diff --git a/build/pkgs/zn_poly/package-version.txt b/build/pkgs/zn_poly/package-version.txt deleted file mode 100644 index 2003b639c40..00000000000 --- a/build/pkgs/zn_poly/package-version.txt +++ /dev/null @@ -1 +0,0 @@ -0.9.2 diff --git a/build/pkgs/zn_poly/spkg-check.in b/build/pkgs/zn_poly/spkg-check.in deleted file mode 100644 index c7831aed276..00000000000 --- a/build/pkgs/zn_poly/spkg-check.in +++ /dev/null @@ -1,90 +0,0 @@ -############################################################################### -# -# zn_poly Sage check script -# -############################################################################### - -############################################################################### -# Set up environment variables: -############################################################################### - -CFLAGS="$CFLAGS_O3 -fPIC" -CXXFLAGS="$CXXFLAGS_O3 -fPIC" - -# Work around a bug in GCC 4.7.0 which breaks the build on Itanium CPUs with -# '-O3', '-O2' and '-O1' (cf. #12765, #12751, and the bug URL below.) -if [ "`uname -m`" = ia64 ] && [ "`testcc.sh $CC`" = GCC ]; then - gcc_version=`$CC -dumpversion` - case "$gcc_version" in - 4.7.*) - CFLAGS="$CFLAGS -O0 -finline-functions -fschedule-insns" - CXXFLAGS="$CXXFLAGS -O0 -finline-functions -fschedule-insns" - echo >&2 "Warning: Disabling almost all optimization due to a bug in (at least)" - echo >&2 " GCC 4.7.0 on Itanium, which otherwise would break the build." - echo >&2 " See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48496" - echo >&2 " for current status and further details." - echo >&2 " (And please report to e.g. sage-devel in case you feel this bug" - echo >&2 " should already be fixed in GCC $gcc_version.)" - esac -fi - -export CFLAGS CPPFLAGS CXXFLAGS LDFLAGS # Partially redundant, but safe. - -# Actually, these flags have been written to the Makefile during 'configure'. -# Only CC, CPP and CXX settings from the environment currently override the -# ones in the Makefile (which was generated from a patched 'makemakefile.py'). -# -leif 04/2012 - -case "$UNAME" in - SunOS) - if ! (ld --version 2>&1 | grep GNU >/dev/null); then - # Assume it's the Sun linker; change '-soname' to '-h': - # The following is only supported by the Makefile generated by our - # patched 'makemakefile.py': - export SONAME_FLAG=-h - fi;; - *) unset SONAME_FLAG # Leave the Makefile default; for safety. -esac - -unset SHARED_FLAG # Currently leave the Makefile default ('-shared'); for safety. - -############################################################################### -# Build the 'test' program (if it's not already built) and run it: -############################################################################### - -cd src/ - -# The methods for testing zn_poly are more complex than those of most other -# packages. A 'make check' does some quick tests. These are run from -# 'spkg-install' to check zn_poly is not obviously disfunctional. -# -# However, a more comprehensive set of tests can be run by first building a -# test program, then running that test program, which we do here. -# -# To quote from the file src/README: -# -# make check -# Runs some quick tests to make sure that everything appears to be working. -# -# make test -# Builds a test program. Running "test/test all" runs the whole zn_poly test -# suite, which tests zn_poly much more thoroughly than "make check". - -echo -echo "Now building zn_poly's extensive test suite (if not already built)..." -# $MAKE test CC="$CC" CXX="$CXX" # See comment above. We don't have to pass these. -$MAKE test # Make sure the test program is built. -if [ $? -ne 0 ] || [ ! -x test/test ]; then - echo >&2 "Error: zn_poly failed to build its 'test' program," - echo >&2 " so zn_poly's extensive test suite cannot be run." - exit 1 -fi - -echo -echo "Now running zn_poly's extensive test suite..." -test/test all # Run the extensive test suite. -if [ $? -ne 0 ]; then - echo >&2 "Error: zn_poly failed to pass its extensive test suite." - exit 1 -fi -echo "zn_poly has passed its extensive test suite." diff --git a/build/pkgs/zn_poly/spkg-configure.m4 b/build/pkgs/zn_poly/spkg-configure.m4 deleted file mode 100644 index c3e47c7621b..00000000000 --- a/build/pkgs/zn_poly/spkg-configure.m4 +++ /dev/null @@ -1,8 +0,0 @@ -SAGE_SPKG_CONFIGURE([zn_poly], [ - SAGE_SPKG_DEPCHECK([gmp], [ - AC_CHECK_HEADER([zn_poly/zn_poly.h], [ - AC_SEARCH_LIBS([zn_mod_init], [zn_poly], [ - ], [sage_spkg_install_zn_poly=yes]) - ], [sage_spkg_install_zn_poly=yes]) - ]) -]) diff --git a/build/pkgs/zn_poly/spkg-install.in b/build/pkgs/zn_poly/spkg-install.in deleted file mode 100644 index 6215a2416e0..00000000000 --- a/build/pkgs/zn_poly/spkg-install.in +++ /dev/null @@ -1,92 +0,0 @@ -############################################################################### -# Set up environment variables: -############################################################################### - -CFLAGS="$CFLAGS_O3 -fPIC" -CXXFLAGS="$CXXFLAGS_O3 -fPIC" - -export CFLAGS CPPFLAGS CXXFLAGS LDFLAGS # Partially redundant, but safe. - -# (Actually the currently generated Makefile won't use any of the above from the -# environment; instead we have to pass them with special options to 'configure', -# which we do below. Furthermore, CPPFLAGS and CXXFLAGS are only supported by -# our patched 'makemakefile.py', which is called by 'configure'.) - -case "$UNAME" in - SunOS) - if ! (ld --version 2>&1 | grep GNU >/dev/null); then - # Assume it's the Sun linker; change '-soname' to '-h': - # The following is only supported by the Makefile generated by our - # patched 'makemakefile.py': - export SONAME_FLAG=-h - fi;; - *) unset SONAME_FLAG # Leave the Makefile default; for safety. -esac - -unset SHARED_FLAG # Currently leave the Makefile default ('-shared'); for safety. - -cd src/ - -############################################################################### -# Configure, tune, build and test zn_poly: -############################################################################### - -echo "Now generating Makefile for zn_poly..." -# Note: The '--cppflags' and '--cxxflags' options are added by our patch to -# 'makemakefile.py', and aren't available with vanilla upstream. -# Moreover, the generated Makefile now takes CC, CXX and CPP from the -# environment, so no need to pass them later explicitly to 'make'. -sage-bootstrap-python makemakefile.py >Makefile \ - --prefix="$SAGE_LOCAL" --cflags="$CFLAGS" --ldflags="$LDFLAGS" \ - --cppflags="$CPPFLAGS" --cxxflags="$CXXFLAGS" \ - --gmp-prefix="$SAGE_LOCAL" || sdh_die "Error generating Makefile." - -echo "Now building zn_poly with its tuning parameters..." -sdh_make - -# Run the brief test suite: -echo -echo "Now building and running zn_poly's quick self-test..." -sdh_make check - -echo -echo "zn_poly's *quick* test suite passed." -if [ "$SAGE_CHECK" != yes ]; then - echo "A more comprehensive test suite can be run if SAGE_CHECK is" - echo "exported to \"yes\", but it takes about 10x as long to run." -fi - -############################################################################### -# Build and manually install the shared library: -############################################################################### - -echo -echo "Now building and installing zn_poly's shared library..." - -case "$UNAME" in -"Darwin") - sdh_make libzn_poly.dylib - sdh_install libzn_poly.dylib "$SAGE_LOCAL/lib" - install_name_tool -id ${SAGE_LOCAL}/lib/libzn_poly.dylib \ - "$SAGE_DESTDIR_LOCAL/lib/libzn_poly.dylib" - ;; -"CYGWIN") - sdh_make libzn_poly.dll.a - sdh_install cygzn_poly.dll "$SAGE_LOCAL/bin" - sdh_install libzn_poly*.dll.a "$SAGE_LOCAL/lib" - ;; -*) - # Linux, SunOS/Solaris, etc.: - sdh_make libzn_poly.so - sdh_install libzn_poly*.so "$SAGE_LOCAL/lib" - ;; -esac - -############################################################################### -# Manually install the header files: -############################################################################### - -echo -echo "Now installing zn_poly's header files..." -sdh_install include/{zn_poly,wide_arith}.h "$SAGE_LOCAL/include/zn_poly" -echo "Finished installing zn_poly." diff --git a/build/pkgs/zn_poly/type b/build/pkgs/zn_poly/type deleted file mode 100644 index a6a7b9cd726..00000000000 --- a/build/pkgs/zn_poly/type +++ /dev/null @@ -1 +0,0 @@ -standard diff --git a/build/sage_bootstrap/app.py b/build/sage_bootstrap/app.py index 66da2665e84..c9523e8cdc7 100644 --- a/build/sage_bootstrap/app.py +++ b/build/sage_bootstrap/app.py @@ -58,7 +58,7 @@ def list_cls(self, *package_classes, **filters): arb autotools [...] - zn_poly + zlib $ sage -package list --has-file=spkg-configure.m4 :experimental: perl_term_readline_gnu @@ -68,7 +68,7 @@ def list_cls(self, *package_classes, **filters): boost_cropped brial [...] - zn_poly + zlib """ log.debug('Listing packages') pc = PackageClass(*package_classes, **filters) diff --git a/build/sage_bootstrap/cmdline.py b/build/sage_bootstrap/cmdline.py index aea51cb48f0..ca89b4fedac 100644 --- a/build/sage_bootstrap/cmdline.py +++ b/build/sage_bootstrap/cmdline.py @@ -73,13 +73,13 @@ arb autotools [...] - zn_poly + zlib $ sage --package list :standard: | sort arb backports_ssl_match_hostname [...] - zn_poly + zlib """ diff --git a/configure.ac b/configure.ac index 1070ac424ab..0edf830c05d 100644 --- a/configure.ac +++ b/configure.ac @@ -441,8 +441,9 @@ AC_ARG_ENABLE([experimental-packages], [AS_HELP_STRING([--enable-experimental-packages], [allow installing experimental packages (default: no = ask for user confirmation for each package)])]) AC_ARG_ENABLE([download-from-upstream-url], - [AS_HELP_STRING([--enable-download-from-upstream-url], - [allow downloading packages from their upstream URL if they cannot be found on the Sage mirrors])]) + [AS_HELP_STRING([--disable-download-from-upstream-url], + [disallow downloading packages from their upstream URL if they cannot be found on the Sage mirrors])], [], + [AS_VAR_SET([enable_download_from_upstream_url], [yes])]) SAGE_SPKG_OPTIONS="" AS_IF([test "x$enable_experimental_packages" = "xyes"], [ diff --git a/pkgs/sage-conf/VERSION.txt b/pkgs/sage-conf/VERSION.txt index 4980863c2f9..d0fa47d29f0 100644 --- a/pkgs/sage-conf/VERSION.txt +++ b/pkgs/sage-conf/VERSION.txt @@ -1 +1 @@ -9.8.beta5 +9.8.beta6 diff --git a/pkgs/sage-conf_pypi/VERSION.txt b/pkgs/sage-conf_pypi/VERSION.txt index 4980863c2f9..d0fa47d29f0 100644 --- a/pkgs/sage-conf_pypi/VERSION.txt +++ b/pkgs/sage-conf_pypi/VERSION.txt @@ -1 +1 @@ -9.8.beta5 +9.8.beta6 diff --git a/pkgs/sage-docbuild/VERSION.txt b/pkgs/sage-docbuild/VERSION.txt index 4980863c2f9..d0fa47d29f0 100644 --- a/pkgs/sage-docbuild/VERSION.txt +++ b/pkgs/sage-docbuild/VERSION.txt @@ -1 +1 @@ -9.8.beta5 +9.8.beta6 diff --git a/pkgs/sage-setup/VERSION.txt b/pkgs/sage-setup/VERSION.txt index 4980863c2f9..d0fa47d29f0 100644 --- a/pkgs/sage-setup/VERSION.txt +++ b/pkgs/sage-setup/VERSION.txt @@ -1 +1 @@ -9.8.beta5 +9.8.beta6 diff --git a/pkgs/sage-sws2rst/VERSION.txt b/pkgs/sage-sws2rst/VERSION.txt index 4980863c2f9..d0fa47d29f0 100644 --- a/pkgs/sage-sws2rst/VERSION.txt +++ b/pkgs/sage-sws2rst/VERSION.txt @@ -1 +1 @@ -9.8.beta5 +9.8.beta6 diff --git a/pkgs/sagemath-categories/VERSION.txt b/pkgs/sagemath-categories/VERSION.txt index 4980863c2f9..d0fa47d29f0 100644 --- a/pkgs/sagemath-categories/VERSION.txt +++ b/pkgs/sagemath-categories/VERSION.txt @@ -1 +1 @@ -9.8.beta5 +9.8.beta6 diff --git a/pkgs/sagemath-environment/VERSION.txt b/pkgs/sagemath-environment/VERSION.txt index 4980863c2f9..d0fa47d29f0 100644 --- a/pkgs/sagemath-environment/VERSION.txt +++ b/pkgs/sagemath-environment/VERSION.txt @@ -1 +1 @@ -9.8.beta5 +9.8.beta6 diff --git a/pkgs/sagemath-objects/VERSION.txt b/pkgs/sagemath-objects/VERSION.txt index 4980863c2f9..d0fa47d29f0 100644 --- a/pkgs/sagemath-objects/VERSION.txt +++ b/pkgs/sagemath-objects/VERSION.txt @@ -1 +1 @@ -9.8.beta5 +9.8.beta6 diff --git a/pkgs/sagemath-repl/VERSION.txt b/pkgs/sagemath-repl/VERSION.txt index 4980863c2f9..d0fa47d29f0 100644 --- a/pkgs/sagemath-repl/VERSION.txt +++ b/pkgs/sagemath-repl/VERSION.txt @@ -1 +1 @@ -9.8.beta5 +9.8.beta6 diff --git a/src/MANIFEST.in b/src/MANIFEST.in index 3a63d07fc32..2e7d8a2d05a 100644 --- a/src/MANIFEST.in +++ b/src/MANIFEST.in @@ -31,7 +31,6 @@ include sage/rings/padics/transcendantal.c include sage/rings/polynomial/weil/power_sums.c include sage/schemes/hyperelliptic_curves/hypellfrob/hypellfrob.cpp include sage/schemes/hyperelliptic_curves/hypellfrob/recurrences_ntl.cpp -include sage/schemes/hyperelliptic_curves/hypellfrob/recurrences_zn_poly.cpp include sage/stats/distributions/dgs_bern.c include sage/stats/distributions/dgs_gauss_dp.c include sage/stats/distributions/dgs_gauss_mp.c diff --git a/src/VERSION.txt b/src/VERSION.txt index 4980863c2f9..d0fa47d29f0 100644 --- a/src/VERSION.txt +++ b/src/VERSION.txt @@ -1 +1 @@ -9.8.beta5 +9.8.beta6 diff --git a/src/bin/sage-version.sh b/src/bin/sage-version.sh index e0f5723d009..98d88e4e5b5 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='9.8.beta5' -SAGE_RELEASE_DATE='2022-12-11' -SAGE_VERSION_BANNER='SageMath version 9.8.beta5, Release Date: 2022-12-11' +SAGE_VERSION='9.8.beta6' +SAGE_RELEASE_DATE='2022-12-21' +SAGE_VERSION_BANNER='SageMath version 9.8.beta6, Release Date: 2022-12-21' diff --git a/src/conftest_inputtest.py b/src/conftest_inputtest.py index d3f5d5cdfb2..aeca6276691 100644 --- a/src/conftest_inputtest.py +++ b/src/conftest_inputtest.py @@ -1,6 +1,6 @@ def something(): """ a doctest in a docstring - + EXAMPLES:: sage: something() diff --git a/src/doc/en/installation/source.rst b/src/doc/en/installation/source.rst index 2840b839973..bd4b406baf1 100644 --- a/src/doc/en/installation/source.rst +++ b/src/doc/en/installation/source.rst @@ -453,7 +453,7 @@ Additional software ------------------- Recommended programs -~~~~~~~~~~~~~~~~~~~~ +^^^^^^^^^^^^^^^^^^^^ The following programs are recommended. They are not strictly required at build time or at run time, @@ -506,7 +506,7 @@ On Debian/Ubuntu, the following system packages are recommended. - ``libavdevice-dev`` (to produce animations) Tcl/Tk -~~~~~~ +^^^^^^ If you want to use `Tcl/Tk `_ libraries in Sage, you need to install the Tcl/Tk and its development headers before building @@ -546,7 +546,7 @@ Step-by-step installation procedure ----------------------------------- General procedure -~~~~~~~~~~~~~~~~~ +^^^^^^^^^^^^^^^^^ #. Follow the procedure in the file `README.md `_ in ``SAGE_ROOT``. diff --git a/src/doc/en/reference/noncommutative_polynomial_rings/index.rst b/src/doc/en/reference/noncommutative_polynomial_rings/index.rst index dca4c3fe931..1915006f832 100644 --- a/src/doc/en/reference/noncommutative_polynomial_rings/index.rst +++ b/src/doc/en/reference/noncommutative_polynomial_rings/index.rst @@ -1,8 +1,8 @@ Noncommutative Polynomials ========================== -Univariate Ore polynomial rings -------------------------------- +Univariate Ore Polynomials +-------------------------- .. toctree:: :maxdepth: 1 @@ -13,13 +13,6 @@ Univariate Ore polynomial rings sage/rings/polynomial/skew_polynomial_element sage/rings/polynomial/skew_polynomial_finite_order sage/rings/polynomial/skew_polynomial_finite_field - -Fraction field of Ore polynomial rings --------------------------------------- - -.. toctree:: - :maxdepth: 1 - sage/rings/polynomial/ore_function_field sage/rings/polynomial/ore_function_element diff --git a/src/doc/en/thematic_tutorials/explicit_methods_in_number_theory/birds_other.rst b/src/doc/en/thematic_tutorials/explicit_methods_in_number_theory/birds_other.rst index 09e8bce9a95..bdd5cc1d360 100644 --- a/src/doc/en/thematic_tutorials/explicit_methods_in_number_theory/birds_other.rst +++ b/src/doc/en/thematic_tutorials/explicit_methods_in_number_theory/birds_other.rst @@ -5,8 +5,8 @@ The Matrix of Frobenius on Hyperelliptic Curves Sage has a highly optimized implementation of the Harvey-Kedlaya algorithm for computing the matrix of Frobenius associated to a curve over a finite field. This is an implementation by David Harvey, which -is GPL'd and depends only on NTL and zn_poly (a C library in Sage for -fast arithmetic in :math:`(\ZZ/n\ZZ)[x]`). +is GPL'd and depends only on NTL (a C library in Sage for fast +arithmetic in :math:`(\ZZ/n\ZZ)[x]`). We import the hypellfrob function and call it on a polynomial over :math:`\ZZ`. diff --git a/src/sage/algebras/affine_nil_temperley_lieb.py b/src/sage/algebras/affine_nil_temperley_lieb.py index 492043ddf7d..8aff4321abb 100644 --- a/src/sage/algebras/affine_nil_temperley_lieb.py +++ b/src/sage/algebras/affine_nil_temperley_lieb.py @@ -85,12 +85,11 @@ def _element_constructor_(self, w): a2*a1 """ W = self.weyl_group() - assert(w in W) + assert w in W word = w.reduced_word() - if all( self.has_no_braid_relation(W.from_reduced_word(word[:i]), word[i]) for i in range(len(word)) ): + if all(self.has_no_braid_relation(W.from_reduced_word(word[:i]), word[i]) for i in range(len(word))): return self.monomial(w) - else: - return self.zero() + return self.zero() @cached_method def one_basis(self): @@ -203,7 +202,7 @@ def product_on_basis(self, w, w1): ... AssertionError """ - assert(self(w) != self.zero()) + assert self(w) != self.zero() for i in w1.reduced_word(): if self.has_no_braid_relation(w, i): w = w.apply_simple_reflection(i) diff --git a/src/sage/algebras/all.py b/src/sage/algebras/all.py index cd71ece02d8..ac06fa76ab8 100644 --- a/src/sage/algebras/all.py +++ b/src/sage/algebras/all.py @@ -65,4 +65,3 @@ lazy_import('sage.algebras.cluster_algebra', 'ClusterAlgebra') lazy_import('sage.algebras.yangian', 'Yangian') - diff --git a/src/sage/algebras/commutative_dga.py b/src/sage/algebras/commutative_dga.py index 0cac2ee3ebb..76b2cd7181e 100644 --- a/src/sage/algebras/commutative_dga.py +++ b/src/sage/algebras/commutative_dga.py @@ -958,22 +958,15 @@ def __classcall__(cls, base, names=None, degrees=None, R=None, I=None, category= # Deal with multigrading: convert lists and tuples to elements # of an additive abelian group. if degrees: - multigrade = False try: rank = len(list(degrees[0])) G = AdditiveAbelianGroup([0] * rank) degrees = [G(vector(d)) for d in degrees] - multigrade = True except TypeError: # The entries of degrees are not iterables, so # treat as singly-graded. pass - if multigrade: - if sorted(map(sum, degrees)) != list(map(sum, degrees)): - raise ValueError("the generators should be ordered in increased total degree") - else: - if sorted(degrees) != list(degrees): - raise ValueError("the generators should be ordered in increasing degree") + degrees = tuple(degrees) if not R or not I: if n > 1: @@ -2013,6 +2006,49 @@ def __init__(self, A, differential): self._minimalmodels = {} self._numerical_invariants = {} + def cdg_algebra(self, differential): + r""" + Construct a differential graded commutative algebra from the underlying + graded commutative algebra by specifying a differential. This may be used + to get a new differential over the same algebra structure. + + INPUT: + + - ``differential`` -- a dictionary defining a differential or + a map defining a valid differential + + The keys of the dictionary are generators of the algebra, and + the associated values are their targets under the + differential. Any generators which are not specified are + assumed to have zero differential. Alternatively, the + differential can be defined using the :meth:`differential` + method; see below for an example. + + .. SEEALSO:: + + :meth:`differential` + + EXAMPLES:: + + sage: A. = GradedCommutativeAlgebra(GF(5), degrees=(2, 3, 2, 4)) + sage: B = A.quotient(A.ideal(x^3-z*t)) + sage: C = B.cdg_algebra({y:t}) + sage: C + Commutative Differential Graded Algebra with generators ('x', 'y', 'z', 't') in degrees (2, 3, 2, 4) with relations [x^3 - z*t] over Finite Field of size 5 with differential: + x --> 0 + y --> t + z --> 0 + t --> 0 + sage: C.cdg_algebra({}) + Commutative Differential Graded Algebra with generators ('x', 'y', 'z', 't') in degrees (2, 3, 2, 4) with relations [x^3 - z*t] over Finite Field of size 5 with differential: + x --> 0 + y --> 0 + z --> 0 + t --> 0 + + """ + return self.graded_commutative_algebra().cdg_algebra(differential) + def graded_commutative_algebra(self): """ Return the base graded commutative algebra of ``self``. diff --git a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py index 1b466d157b7..9c8090c8929 100644 --- a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py +++ b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py @@ -756,8 +756,8 @@ def maximal_ideal(self): """ if self.degree() == 0: raise ValueError("the zero algebra is not local") - if not(self.is_unitary() and self.is_commutative() - and (self._assume_associative or self.is_associative())): + if not (self.is_unitary() and self.is_commutative() + and (self._assume_associative or self.is_associative())): raise TypeError("algebra must be unitary, commutative and associative") gens = [] for x in self.gens(): diff --git a/src/sage/algebras/fusion_rings/all.py b/src/sage/algebras/fusion_rings/all.py index 4a7b2196938..9c375f15440 100644 --- a/src/sage/algebras/fusion_rings/all.py +++ b/src/sage/algebras/fusion_rings/all.py @@ -1,7 +1,6 @@ """ Fusion Rings """ - # **************************************************************************** # Copyright (C) 2022 Guillermo Aboumrad # @@ -17,4 +16,3 @@ lazy_import('sage.algebras.fusion_rings.fusion_ring', ['FusionRing']) del lazy_import - diff --git a/src/sage/algebras/fusion_rings/f_matrix.py b/src/sage/algebras/fusion_rings/f_matrix.py index 47f04a5e125..82b5d764fa6 100644 --- a/src/sage/algebras/fusion_rings/f_matrix.py +++ b/src/sage/algebras/fusion_rings/f_matrix.py @@ -2457,4 +2457,3 @@ def certify_pentagons(self, use_mp=True, verbose=False): print("Something went wrong. Pentagons remain.") self._fvars = fvars_copy return pe - diff --git a/src/sage/algebras/fusion_rings/fast_parallel_fmats_methods.pyx b/src/sage/algebras/fusion_rings/fast_parallel_fmats_methods.pyx index 64b8254f13a..a482c0c4fc1 100644 --- a/src/sage/algebras/fusion_rings/fast_parallel_fmats_methods.pyx +++ b/src/sage/algebras/fusion_rings/fast_parallel_fmats_methods.pyx @@ -169,32 +169,24 @@ cpdef _backward_subs(factory, bint flatten=True): res = _flatten_coeffs(res) fvars[sextuple] = res + cdef _fmat(fvars, _Nk_ij, id_anyon, a, b, c, d, x, y): - """ - Cython version of fmat class method. Using cdef for fastest dispatch - """ - if _Nk_ij(a, b, x) == 0 or _Nk_ij(x, c, d) == 0 or _Nk_ij(b, c, y) == 0 or _Nk_ij(a, y, d) == 0: - return 0 - # Some known F-symbols - if a == id_anyon: - if x == b and y == d: - return 1 - else: - return 0 - if b == id_anyon: - if x == a and y == c: - return 1 - else: - return 0 - if c == id_anyon: - if x == d and y == b: - return 1 - else: - return 0 - return fvars[a, b, c, d, x, y] + """ + Cython version of fmat class method. Using cdef for fastest dispatch + """ + if _Nk_ij(a, b, x) == 0 or _Nk_ij(x, c, d) == 0 or _Nk_ij(b, c, y) == 0 or _Nk_ij(a, y, d) == 0: + return 0 + # Some known F-symbols + if a == id_anyon: + return int(x == b and y == d) + if b == id_anyon: + return int(x == a and y == c) + if c == id_anyon: + return int(x == d and y == b) + return fvars[a, b, c, d, x, y] ###################################### -### Fast fusion coefficients cache ### +# Fast fusion coefficients cache # ###################################### # from sage.misc.cachefunc import cached_function @@ -232,7 +224,7 @@ cdef req_cy(tuple basis, r_matrix, dict fvars, Nk_ij, id_anyon, tuple sextuple): lhs = r_matrix(a, c, e, base_coercion=False) * _fmat(fvars, Nk_ij, id_anyon, a, c, b, d, e, g) * r_matrix(b, c, g, base_coercion=False) rhs = 0 for f in basis: - rhs += _fmat(fvars, Nk_ij, id_anyon, c, a, b, d, e, f) * r_matrix(f, c, d, base_coercion=False) * _fmat(fvars, Nk_ij, id_anyon, a, b, c, d, f, g) + rhs += _fmat(fvars, Nk_ij, id_anyon, c, a, b, d, e, f) * r_matrix(f, c, d, base_coercion=False) * _fmat(fvars, Nk_ij, id_anyon, a, b, c, d, f, g) return lhs-rhs @cython.wraparound(False) @@ -299,7 +291,7 @@ cdef MPolynomial_libsingular feq_cy(tuple basis, fvars, Nk_ij, id_anyon, zero, t return zero rhs = zero for h in basis: - rhs += _fmat(fvars, Nk_ij, id_anyon, a, b, c, g, f, h)*_fmat(fvars, Nk_ij, id_anyon, a, h, d, e, g, k)*_fmat(fvars, Nk_ij, id_anyon, b, c, d, k, h, l) + rhs += _fmat(fvars, Nk_ij, id_anyon, a, b, c, g, f, h)*_fmat(fvars, Nk_ij, id_anyon, a, h, d, e, g, k)*_fmat(fvars, Nk_ij, id_anyon, b, c, d, k, h, l) return lhs - rhs @cython.wraparound(False) @@ -511,10 +503,10 @@ cdef feq_verif(factory, worker_results, fvars, Nk_ij, id_anyon, tuple nonuple, f lhs = _fmat(fvars, Nk_ij, id_anyon, f, c, d, e, g, l)*_fmat(fvars, Nk_ij, id_anyon, a, b, l, e, f, k) rhs = 0.0 for h in factory._FR.basis(): - rhs += _fmat(fvars, Nk_ij, id_anyon, a, b, c, g, f, h)*_fmat(fvars, Nk_ij, id_anyon, a, h, d, e, g, k)*_fmat(fvars, Nk_ij, id_anyon, b, c, d, k, h, l) + rhs += _fmat(fvars, Nk_ij, id_anyon, a, b, c, g, f, h)*_fmat(fvars, Nk_ij, id_anyon, a, h, d, e, g, k)*_fmat(fvars, Nk_ij, id_anyon, b, c, d, k, h, l) diff = lhs - rhs if diff > tol or diff < -tol: - worker_results.append(diff) + worker_results.append(diff) @cython.wraparound(False) @cython.nonecheck(False) diff --git a/src/sage/algebras/fusion_rings/fusion_ring.py b/src/sage/algebras/fusion_rings/fusion_ring.py index d96afeaaee3..d36faae2b34 100644 --- a/src/sage/algebras/fusion_rings/fusion_ring.py +++ b/src/sage/algebras/fusion_rings/fusion_ring.py @@ -28,6 +28,7 @@ from sage.rings.number_field.number_field import CyclotomicField from sage.rings.qqbar import QQbar + class FusionRing(WeylCharacterRing): r""" Return the Fusion Ring (Verlinde Algebra) of level ``k``. @@ -334,12 +335,12 @@ def __classcall__(cls, ct, k, base_ring=ZZ, prefix=None, style="coroots", conjug sage: E81 = FusionRing('E8', 1) sage: TestSuite(E81).run() """ - return super(FusionRing, cls).__classcall__(cls, ct, base_ring=base_ring, - prefix=prefix, style=style, k=k, - conjugate=conjugate, - cyclotomic_order=cyclotomic_order, - fusion_labels=fusion_labels, - inject_variables=inject_variables) + return super().__classcall__(cls, ct, base_ring=base_ring, + prefix=prefix, style=style, k=k, + conjugate=conjugate, + cyclotomic_order=cyclotomic_order, + fusion_labels=fusion_labels, + inject_variables=inject_variables) def _test_verlinde(self, **options): """ @@ -1572,4 +1573,3 @@ def q_dimension(self, base_coercion=True): if (not base_coercion) or (self.parent()._basecoer is None): return ret return self.parent()._basecoer(ret) - diff --git a/src/sage/algebras/fusion_rings/poly_tup_engine.pyx b/src/sage/algebras/fusion_rings/poly_tup_engine.pyx index 47e403c6d2c..ac465e14a77 100644 --- a/src/sage/algebras/fusion_rings/poly_tup_engine.pyx +++ b/src/sage/algebras/fusion_rings/poly_tup_engine.pyx @@ -316,7 +316,7 @@ cpdef tuple apply_coeff_map(tuple eq_tup, coeff_map): cdef ETuple exp cdef list new_tup = [] for exp, coeff in eq_tup: - new_tup.append((exp, coeff_map(coeff))) + new_tup.append((exp, coeff_map(coeff))) return tuple(new_tup) # cpdef inline bint tup_fixes_sq(tuple eq_tup): @@ -368,7 +368,7 @@ cdef dict subs_squares(dict eq_dict, KSHandler known_sq): coeff *= pow(known_sq.get(idx), power // 2) # New power is 1 if power is odd if power & True: - new_e[idx] = 1 + new_e[idx] = 1 else: new_e[idx] = power exp = ETuple(new_e, len(exp)) @@ -567,13 +567,13 @@ cpdef tuple poly_tup_sortkey(tuple eq_tup): cdef int i, l, nnz cdef list key = [] for exp, c in eq_tup: - # Compare by term degree - key.append(exp.unweighted_degree()) - # Next compare by term w.r.t. lex order - for i in range(exp._nonzero): - # key.append(exp._length-1-exp._data[2*(nnz-i-1)]) - # key.append(-exp._data[2*(nnz-i-1)+1]) - key.append(-exp._data[2*i]) - key.append(exp._data[2*i+1]) + # Compare by term degree + key.append(exp.unweighted_degree()) + # Next compare by term w.r.t. lex order + for i in range(exp._nonzero): + # key.append(exp._length-1-exp._data[2*(nnz-i-1)]) + # key.append(-exp._data[2*(nnz-i-1)+1]) + key.append(-exp._data[2*i]) + key.append(exp._data[2*i+1]) return tuple(key) diff --git a/src/sage/algebras/fusion_rings/shm_managers.pyx b/src/sage/algebras/fusion_rings/shm_managers.pyx index 5d7ec652613..91aba7ba59f 100644 --- a/src/sage/algebras/fusion_rings/shm_managers.pyx +++ b/src/sage/algebras/fusion_rings/shm_managers.pyx @@ -559,7 +559,7 @@ cdef class FvarsHandler: cache, so each process must update its cache before retrieving a modified entry, tagged via its ``modified`` property. """ - if not sextuple in self.sext_to_idx: + if sextuple not in self.sext_to_idx: raise KeyError('invalid sextuple {}'.format(sextuple)) cdef Py_ssize_t idx = self.sext_to_idx[sextuple] # Each process builds its own cache, so each process must know diff --git a/src/sage/algebras/iwahori_hecke_algebra.py b/src/sage/algebras/iwahori_hecke_algebra.py index 671cd52fecf..900039c7909 100644 --- a/src/sage/algebras/iwahori_hecke_algebra.py +++ b/src/sage/algebras/iwahori_hecke_algebra.py @@ -2282,9 +2282,14 @@ def _decompose_into_generators(self, u): {(1,): -1, (1, 2, 1): 1} sage: Cp._decompose_into_generators(W([1,2,3,1,2])) # optional - coxeter3 {(1,): 1, (1, 2, 1): -1, (1, 2, 1, 3, 2): 1, (1, 3, 2): -1} + + TESTS:: + + sage: Cp._decompose_into_generators(W([])) # optional - coxeter3 + {(): 1} """ # l(y) = 0 or 1 - if not u: + if not len(u): return {(): 1} if len(u) == 1: return {(u[0],): 1} diff --git a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py index b11c912f36d..c40e654e157 100644 --- a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py +++ b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py @@ -14,7 +14,6 @@ # (at your option) any later version. # https://www.gnu.org/licenses/ # **************************************************************************** - from sage.arith.all import factorial from sage.misc.misc_c import prod from sage.misc.repr import repr_lincomb @@ -27,7 +26,7 @@ class LCAWithGeneratorsElement(IndexedFreeModuleElement): The element class of a Lie conformal algebra with a preferred set of generators. """ - def T(self,n=1): + def T(self, n=1): r""" The n-th derivative of this element. @@ -135,7 +134,7 @@ def _bracket_(self, right): /factorial(m+k+j-l)/factorial(l-k-j)/factorial(j)*\ mbr[j].T(m+k+j-l) for j in mbr if j >= l-m-k and\ j <= l-k) for l in range(m+k+pole+1)} - return {k:v for k,v in ret.items() if v} + return {k: v for k, v in ret.items() if v} diclist = [i._bracket_(j) for i in self.terms() for j in right.terms()] @@ -143,8 +142,8 @@ def _bracket_(self, right): pz = p.zero() for d in diclist: for k in d: - ret[k] = ret.get(k,pz) + d[k] - return {k:v for k,v in ret.items() if v} + ret[k] = ret.get(k, pz) + d[k] + return {k: v for k, v in ret.items() if v} def _repr_(self): r""" @@ -172,17 +171,15 @@ def _repr_(self): return "0" p = self.parent() if p._names: - terms = [("T^({0}){1}".format(k[1], - p._names[p._index_to_pos[k[0]]]),v) if k[1] > 1 \ - else("T{}".format(p._names[p._index_to_pos[k[0]]]),v) \ - if k[1] == 1 \ - else ("{}".format(p._names[p._index_to_pos[k[0]]]),v)\ - for k,v in self.monomial_coefficients().items()] + terms = [("T^({}){}".format(k1, p._names[p._index_to_pos[k0]]), v) if k1 > 1 + else ("T{}".format(p._names[p._index_to_pos[k0]]), v) if k1 == 1 + else ("{}".format(p._names[p._index_to_pos[k0]]), v) + for (k0, k1), v in self.monomial_coefficients().items()] else: - terms = [("T^({0}){1}".format(k[1], p._repr_generator(k[0])),v)\ - if k[1] > 1 else("T{}".format(p._repr_generator(k[0])),v)\ - if k[1] == 1 else ("{}".format(p._repr_generator(k[0])), - v) for k,v in self.monomial_coefficients().items()] + terms = [("T^({}){}".format(k1, p._repr_generator(k0)), v) if k1 > 1 + else ("T{}".format(p._repr_generator(k0)), v) if k1 == 1 + else ("{}".format(p._repr_generator(k0)), v) + for (k0, k1), v in self.monomial_coefficients().items()] return repr_lincomb(terms, strip_one=True) @@ -222,16 +219,14 @@ def _latex_(self): except ValueError: names = None if names: - terms = [("T^{{({0})}}{1}".format(k[1], - names[p._index_to_pos[k[0]]]),v) if k[1] > 1 \ - else("T{}".format(names[p._index_to_pos[k[0]]]),v)\ - if k[1] == 1\ - else ("{}".format(names[p._index_to_pos[k[0]]]),v)\ - for k, v in self.monomial_coefficients().items()] + terms = [("T^{{({0})}}{1}".format(k1, names[p._index_to_pos[k0]]), v) if k1 > 1 + else ("T{}".format(names[p._index_to_pos[k0]]), v) if k1 == 1 + else ("{}".format(names[p._index_to_pos[k0]]), v) + for (k0, k1), v in self.monomial_coefficients().items()] else: - terms = [("T^{{({0})}}{1}".format(k[1], latex(k[0])),v) if k[1] > 1 \ - else("T{}".format(latex(k[0])),v) if k[1] == 1 \ - else ("{}".format(latex(k[0])),v)\ - for k, v in self.monomial_coefficients().items()] + terms = [("T^{{({0})}}{1}".format(k1, latex(k0)), v) if k1 > 1 + else ("T{}".format(latex(k0)), v) if k1 == 1 + else ("{}".format(latex(k0)), v) + for (k0, k1), v in self.monomial_coefficients().items()] return repr_lincomb(terms, is_latex=True, strip_one=True) diff --git a/src/sage/algebras/steenrod/steenrod_algebra.py b/src/sage/algebras/steenrod/steenrod_algebra.py index ea2fb868c52..49b281d9a49 100644 --- a/src/sage/algebras/steenrod/steenrod_algebra.py +++ b/src/sage/algebras/steenrod/steenrod_algebra.py @@ -505,7 +505,7 @@ def __classcall__(self, p=2, basis='milnor', **kwds): std_generic = generic if p != 2: std_generic = True - if not(std_generic is True or std_generic is False): + if not (std_generic is True or std_generic is False): raise ValueError("option 'generic' is not a boolean") std_basis = get_basis_name(basis, p, generic=std_generic) diff --git a/src/sage/categories/category.py b/src/sage/categories/category.py index 02f4b292f42..f70455cf1a0 100644 --- a/src/sage/categories/category.py +++ b/src/sage/categories/category.py @@ -1886,11 +1886,10 @@ def _is_subclass(self, c): sage: Algebras(QQ)._is_subclass(ModulesWithBasis) False """ - assert( isinstance(c, Category) or (issubclass(c.__class__, type) and issubclass(c, Category)) ) + assert (isinstance(c, Category) or (issubclass(c.__class__, type) and issubclass(c, Category))) if isinstance(c, Category): return self.is_subcategory(c) - else: - return any(isinstance(cat, c) for cat in self._all_super_categories) + return any(isinstance(cat, c) for cat in self._all_super_categories) @cached_method def _meet_(self, other): @@ -2954,8 +2953,8 @@ def __init__(self, super_categories, **kwds): sage: TestSuite(C).run() """ - assert(len(super_categories) >= 2) - assert(all(not isinstance(category, JoinCategory) for category in super_categories)) + assert len(super_categories) >= 2 + assert all(not isinstance(category, JoinCategory) for category in super_categories) # Use __super_categories to not overwrite the lazy attribute Category._super_categories # Maybe this would not be needed if the flattening/sorting is does consistently? self.__super_categories = list(super_categories) diff --git a/src/sage/categories/covariant_functorial_construction.py b/src/sage/categories/covariant_functorial_construction.py index 813b66e8afd..40d661945e8 100644 --- a/src/sage/categories/covariant_functorial_construction.py +++ b/src/sage/categories/covariant_functorial_construction.py @@ -139,7 +139,7 @@ def category_from_parents(self, parents): Category of tensor products of finite dimensional vector spaces with basis over Rational Field """ from sage.structure.parent import Parent - assert(all(isinstance(parent, Parent) for parent in parents)) + assert all(isinstance(parent, Parent) for parent in parents) # Should we pass a set of categories to reduce the cache size? # But then this would impose that, for any constructor, the # category of the result does not depend on the order/repetition @@ -169,7 +169,7 @@ def category_from_categories(self, categories): sage: cartesian_product.category_from_categories((Cat1, Cat2)) Category of Cartesian products of monoids """ - assert(len(categories) > 0) + assert len(categories) > 0 return self.category_from_category(Category.meet(categories)) def category_from_category(self, category): @@ -217,11 +217,12 @@ def __call__(self, args, **kwargs): sage: tensor((E, E, E)) E # E # E """ - args = tuple(args) # a bit brute force; let's see if this becomes a bottleneck later - assert(all( hasattr(arg, self._functor_name) for arg in args)) - assert(len(args) > 0) + args = tuple(args) # a bit brute force; let's see if this becomes a bottleneck later + assert all(hasattr(arg, self._functor_name) for arg in args) + assert len(args) > 0 return getattr(args[0], self._functor_name)(*args[1:], **kwargs) + class FunctorialConstructionCategory(Category): # Should this be CategoryWithBase? """ Abstract class for categories `F_{Cat}` obtained through a diff --git a/src/sage/categories/coxeter_groups.py b/src/sage/categories/coxeter_groups.py index b7ee2ac9fe9..0b353313517 100644 --- a/src/sage/categories/coxeter_groups.py +++ b/src/sage/categories/coxeter_groups.py @@ -1235,6 +1235,15 @@ def _test_has_descent(self, **options): sage: W = CoxeterGroups().example() sage: W._test_has_descent() + + sage: W = Permutations(4) + sage: W._test_has_descent() + sage: sage.combinat.permutation.Permutations.options.mult = "r2l" + sage: W._test_has_descent() + sage: sage.combinat.permutation.Permutations.options._reset() + + sage: W = SignedPermutations(3) + sage: W._test_has_descent() """ tester = self._tester(**options) s = self.simple_reflections() @@ -1254,12 +1263,12 @@ def _test_has_descent(self, **options): tester.assertEqual(s[i].has_descent(j, positive=True), i != j) if i == j: continue - u = s[i] * s[j] - v = s[j] * s[i] - tester.assertTrue((s[i] * s[j]).has_descent(i, side='left')) - tester.assertTrue((s[i] * s[j]).has_descent(j, side='right')) - tester.assertEqual((s[i] * s[j]).has_descent(j, side='left'), u == v) - tester.assertEqual((s[i] * s[j]).has_descent(i, side='right'), u == v) + u = s[i].apply_simple_reflection_right(j) + v = s[j].apply_simple_reflection_right(i) + tester.assertTrue(u.has_descent(i, side='left')) + tester.assertTrue(u.has_descent(j, side='right')) + tester.assertEqual(u.has_descent(j, side='left'), u == v) + tester.assertEqual(u.has_descent(i, side='right'), u == v) def _test_descents(self, **options): """ @@ -1297,6 +1306,15 @@ def _test_coxeter_relations(self, **options): sage: cm = CartanMatrix([[2,-5,0],[-2,2,-1],[0,-1,2]]) sage: W = WeylGroup(cm) sage: W._test_coxeter_relations() + + sage: W = Permutations(4) + sage: W._test_coxeter_relations() + sage: sage.combinat.permutation.Permutations.options.mult = "r2l" + sage: W._test_coxeter_relations() + sage: sage.combinat.permutation.Permutations.options._reset() + + sage: W = SignedPermutations(3) + sage: W._test_coxeter_relations() """ tester = self._tester(**options) s = self.simple_reflections() @@ -1868,6 +1886,31 @@ def absolute_le(self, other): False sage: w1.absolute_le(w1) True + + TESTS: + + Check that this is independent of the implementation of the group, see :trac:`34799`:: + + sage: W1 = WeylGroup(['A',2]) + sage: W2 = Permutations(3) + sage: P = lambda pi: W2(list(pi.to_permutation())) + sage: d1 = set((P(w1), P(w2)) for w1 in W1 for w2 in W1 if w1.absolute_le(w2)) + sage: d2 = set((w1, w2) for w1 in W2 for w2 in W2 if w1.absolute_le(w2)) + sage: d1 == d2 + True + sage: sage.combinat.permutation.Permutations.options.mult = "r2l" + sage: d3 = set((w1, w2) for w1 in W2 for w2 in W2 if w1.absolute_le(w2)) + sage: d1 == d3 + True + sage: sage.combinat.permutation.Permutations.options._reset() + + sage: W1 = WeylGroup(['B',2]) + sage: W2 = SignedPermutations(2) + sage: P = lambda pi: W2(list(pi.to_permutation())) + sage: d1 = set((P(w1), P(w2)) for w1 in W1 for w2 in W1 if w1.absolute_le(w2)) + sage: d2 = set((w1, w2) for w1 in W2 for w2 in W2 if w1.absolute_le(w2)) + sage: d1 == d2 + True """ if self == other: return True @@ -2055,6 +2098,21 @@ def binary_factorizations(self, predicate=ConstantFunction(True)): sage: w0.binary_factorizations().category() Category of finite enumerated sets + + Check that this is independent of the implementation of the group, see :trac:`34799`:: + + sage: W1 = WeylGroup(['A',3]) + sage: W2 = Permutations(4) + sage: P = lambda pi: W2(list(pi.to_permutation())) + sage: d1 = {P(pi): set((P(w[0]), P(w[1])) for w in pi.binary_factorizations()) for pi in W1} + sage: d2 = {pi: set(pi.binary_factorizations()) for pi in W2} + sage: d1 == d2 + True + sage: sage.combinat.permutation.Permutations.options.mult = "r2l" + sage: d3 = {pi: set(pi.binary_factorizations()) for pi in W2} + sage: d1 == d3 + True + sage: sage.combinat.permutation.Permutations.options._reset() """ from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet_forest W = self.parent() @@ -2064,11 +2122,11 @@ def binary_factorizations(self, predicate=ConstantFunction(True)): s = W.simple_reflections() def succ(u_v): - (u, v) = u_v + u, v = u_v for i in v.descents(side='left'): - u1 = u * s[i] + u1 = u.apply_simple_reflection_right(i) if i == u1.first_descent() and predicate(u1): - yield (u1, s[i] * v) + yield u1, v.apply_simple_reflection_left(i) return RecursivelyEnumeratedSet_forest(((W.one(), self),), succ, category=FiniteEnumeratedSets()) @@ -2214,7 +2272,6 @@ def lower_cover_reflections(self, side='right'): [s2*s3*s2, s3, s1] """ - if side == 'left': self = self.inverse() return [x[1] for x in self.bruhat_lower_covers_reflections()] @@ -2261,7 +2318,6 @@ def cover_reflections(self, side='right'): [s4, s2, s1*s2*s1, s3*s4*s3] """ - if side == 'left': self = self.inverse() return [x[1] for x in self.bruhat_upper_covers_reflections()] @@ -2596,7 +2652,6 @@ def apply_demazure_product(self, element, side='right', s2*s3*s4*s1*s2*s3*s4*s2*s3*s2*s1 """ - # if self and element have the same parent if self.parent().is_parent_of(element): the_word = element.reduced_word() @@ -2639,7 +2694,6 @@ def min_demazure_product_greater(self, element): s4*s2 """ - # if self and element have the same parent if self.parent().is_parent_of(element): the_word = element.reduced_word() @@ -2772,7 +2826,6 @@ def deodhar_lift_down(self, w, index_set): s2*s3*s2 """ - vmin = self.coset_representative(index_set) wmin = w.coset_representative(index_set) if not wmin.bruhat_le(vmin): diff --git a/src/sage/categories/examples/sets_cat.py b/src/sage/categories/examples/sets_cat.py index eee40b1bfbe..93cc264580d 100644 --- a/src/sage/categories/examples/sets_cat.py +++ b/src/sage/categories/examples/sets_cat.py @@ -249,7 +249,7 @@ def next(self, i): sage: x.parent() Set of prime numbers """ - assert(i in self) + assert i in self return self._from_integer_((Integer(i) + 1).next_prime()) def some_elements(self): diff --git a/src/sage/categories/examples/with_realizations.py b/src/sage/categories/examples/with_realizations.py index e72b2f5b3d0..06e060f8925 100644 --- a/src/sage/categories/examples/with_realizations.py +++ b/src/sage/categories/examples/with_realizations.py @@ -166,8 +166,8 @@ def __init__(self, R, S): From: The subset algebra of {1, 2, 3} over Rational Field in the Fundamental basis To: The subset algebra of {1, 2, 3} over Rational Field in the Out basis """ - assert(R in Rings()) - self._base = R # Won't be needed when CategoryObject won't override anymore base_ring + assert R in Rings() + self._base = R # Won't be needed when CategoryObject won't override anymore base_ring self._S = S Parent.__init__(self, category=Algebras(R).Commutative().WithRealizations()) diff --git a/src/sage/categories/function_fields.py b/src/sage/categories/function_fields.py index 3141500a511..6c30067e53f 100644 --- a/src/sage/categories/function_fields.py +++ b/src/sage/categories/function_fields.py @@ -42,7 +42,7 @@ def super_categories(self): sage: FunctionFields().super_categories() [Category of fields] """ - return[Fields()] + return [Fields()] def _call_(self, x): r""" diff --git a/src/sage/categories/magmas.py b/src/sage/categories/magmas.py index 936ada2a40e..975ea0491b3 100644 --- a/src/sage/categories/magmas.py +++ b/src/sage/categories/magmas.py @@ -1128,8 +1128,8 @@ def product(self, x, y): sage: B[3] * B[2] 4*B[2] + 6*B[3] + 5*B[6] """ - assert(x in self) - assert(y in self) + assert x in self + assert y in self return self.retract(self.lift(x) * self.lift(y)) class Realizations(RealizationsCategory): diff --git a/src/sage/categories/modules_with_basis.py b/src/sage/categories/modules_with_basis.py index 26b51ef4b87..99b57ff8c8e 100644 --- a/src/sage/categories/modules_with_basis.py +++ b/src/sage/categories/modules_with_basis.py @@ -2126,9 +2126,9 @@ def tensor(*elements): FIXME: is this a policy that we want to enforce on all parents? """ - assert(all(isinstance(element, Element) for element in elements)) + assert all(isinstance(element, Element) for element in elements) parents = [parent(element) for element in elements] - return tensor(parents)._tensor_of_elements(elements) # good name??? + return tensor(parents)._tensor_of_elements(elements) # good name ? class Homsets(HomsetsCategory): class ParentMethods: diff --git a/src/sage/categories/pushout.py b/src/sage/categories/pushout.py index 760f97a3c4f..b0945a4642b 100644 --- a/src/sage/categories/pushout.py +++ b/src/sage/categories/pushout.py @@ -1349,7 +1349,7 @@ def __ne__(self, other): sage: F != sage.categories.pushout.InfinitePolynomialFunctor(['a','b','x'],'deglex','sparse') True """ - return not(self == other) + return not (self == other) __hash__ = ConstructionFunctor.__hash__ diff --git a/src/sage/combinat/diagram.py b/src/sage/combinat/diagram.py index a4a4169848a..be1bc9b3b66 100644 --- a/src/sage/combinat/diagram.py +++ b/src/sage/combinat/diagram.py @@ -856,7 +856,7 @@ def peelable_tableaux(self): For a fixed northwest diagram `D`, we say that a Young tableau `T` is `D`-peelable if: - + 1. the row indices of the cells in the first column of `D` are the entries in an initial segment in the first column of `T` and 2. the tableau `Q` obtained by removing those cells from `T` and playing @@ -1465,7 +1465,6 @@ def RotheDiagram(w): winv = w.inverse() from sage.misc.mrange import cartesian_product_iterator cells = [c for c in cartesian_product_iterator((range(N), range(N))) - if c[0]+1 < winv(c[1]+1) and c[1]+1 < w(c[0]+1)] + if c[0] + 1 < winv(c[1] + 1) and c[1] + 1 < w(c[0] + 1)] return NorthwestDiagram(cells, n_rows=N, n_cols=N, check=False) - diff --git a/src/sage/combinat/dyck_word.py b/src/sage/combinat/dyck_word.py index 85fe966f70e..78fc75dda53 100644 --- a/src/sage/combinat/dyck_word.py +++ b/src/sage/combinat/dyck_word.py @@ -895,6 +895,61 @@ def _latex_(self) -> str: res += "\\end{tikzpicture}$}}" return res + def _repr_svg_(self) -> str: + """ + Return the svg picture of ``self``. + + This can be displayed by Jupyter. + + EXAMPLES:: + + sage: PP = DyckWords(6).random_element() + sage: PP._repr_svg_() + '' + """ + N = self.length() + width = 0.1 if N < 20 else N / 200 + resu = '' + resu += '' + resu += '" + hori_lines = [] + path = ['') + path.append('') + resu1 += " ".join(path) + hori_lines.append('') + resu3 += "".join(hori_lines) + + margin = 2 * width + resu += '\"{} {} {} {} \">'.format(-margin, -max_y - margin, + N + 2 * margin, max_y + 2 * margin) + + return resu + resu1 + resu3 + def plot(self, **kwds): """ Plot a Dyck word as a continuous path. diff --git a/src/sage/combinat/root_system/ambient_space.py b/src/sage/combinat/root_system/ambient_space.py index b1499f4eb4d..4b88f44ad9e 100644 --- a/src/sage/combinat/root_system/ambient_space.py +++ b/src/sage/combinat/root_system/ambient_space.py @@ -1,13 +1,13 @@ r""" Ambient lattices and ambient spaces """ -#***************************************************************************** +# *************************************************************************** # Copyright (C) 2008-2009 Daniel Bump # Copyright (C) 2008-2013 Nicolas M. Thiery # # Distributed under the terms of the GNU General Public License (GPL) -# http://www.gnu.org/licenses/ -#***************************************************************************** +# https://www.gnu.org/licenses/ +# *************************************************************************** from sage.misc.cachefunc import cached_method from sage.combinat.free_module import CombinatorialFreeModule from .weight_lattice_realizations import WeightLatticeRealizations diff --git a/src/sage/combinat/root_system/associahedron.py b/src/sage/combinat/root_system/associahedron.py index c6765e71eb9..5b4fae15bcb 100644 --- a/src/sage/combinat/root_system/associahedron.py +++ b/src/sage/combinat/root_system/associahedron.py @@ -11,14 +11,14 @@ - Christian Stump """ -#***************************************************************************** +# *************************************************************************** # Copyright (C) 2011-2012 Christian Stump # # Distributed under the terms of the GNU General Public License (GPL) # The full text of the GPL is available at: # -# http://www.gnu.org/licenses/ -#***************************************************************************** +# https://www.gnu.org/licenses/ +# *************************************************************************** from sage.geometry.polyhedron.backend_ppl import Polyhedron_QQ_ppl from sage.geometry.polyhedron.backend_normaliz import Polyhedron_QQ_normaliz from sage.geometry.polyhedron.backend_cdd import Polyhedron_QQ_cdd diff --git a/src/sage/combinat/root_system/cartan_type.py b/src/sage/combinat/root_system/cartan_type.py index d1ae95e0586..9dc3937930d 100644 --- a/src/sage/combinat/root_system/cartan_type.py +++ b/src/sage/combinat/root_system/cartan_type.py @@ -465,7 +465,7 @@ .. TODO:: Should those indexes come before the introduction? """ -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2007 Mike Hansen , # Copyright (C) 2008-2009 Nicolas M. Thiery , # @@ -473,8 +473,8 @@ # 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. -# http://www.gnu.org/licenses/ -#***************************************************************************** +# https://www.gnu.org/licenses/ +# **************************************************************************** from sage.misc.cachefunc import cached_method from sage.misc.abstract_method import abstract_method @@ -1875,7 +1875,7 @@ def _ascii_art_node(self, label): if (label == self.special_node() and self.options('mark_special_node') in ['printing', 'both']): return self.options('special_node_str') - return super(CartanType_affine, self)._ascii_art_node(label) + return super()._ascii_art_node(label) def _latex_draw_node(self, x, y, label, position="below=4pt"): r""" @@ -1896,7 +1896,7 @@ def _latex_draw_node(self, x, y, label, position="below=4pt"): fill = 'black' else: fill = 'white' - return super(CartanType_affine, self)._latex_draw_node(x, y, label, position, fill) + return super()._latex_draw_node(x, y, label, position, fill) def is_finite(self): """ diff --git a/src/sage/combinat/root_system/coxeter_group.py b/src/sage/combinat/root_system/coxeter_group.py index 7ca11e52a14..67962feafff 100644 --- a/src/sage/combinat/root_system/coxeter_group.py +++ b/src/sage/combinat/root_system/coxeter_group.py @@ -1,18 +1,19 @@ """ Coxeter Groups """ -#***************************************************************************** +# *************************************************************************** # Copyright (C) 2010 Nicolas Thiery # # Distributed under the terms of the GNU General Public License (GPL) # -# http://www.gnu.org/licenses/ -#***************************************************************************** +# https://www.gnu.org/licenses/ +# *************************************************************************** from sage.combinat.root_system.weyl_group import WeylGroup from sage.combinat.root_system.reflection_group_real import ReflectionGroup from sage.combinat.root_system.cartan_type import CartanType + def CoxeterGroup(data, implementation="reflection", base_ring=None, index_set=None): """ Return an implementation of the Coxeter group given by ``data``. diff --git a/src/sage/combinat/root_system/coxeter_matrix.py b/src/sage/combinat/root_system/coxeter_matrix.py index 8eb2f743fa5..9ae647552e2 100644 --- a/src/sage/combinat/root_system/coxeter_matrix.py +++ b/src/sage/combinat/root_system/coxeter_matrix.py @@ -205,7 +205,7 @@ def __classcall_private__(cls, data=None, index_set=None, coxeter_type=None, else: index_set = tuple(range(1, n + 1)) if len(set(index_set)) != n: - raise ValueError("the given index set is not valid") + raise ValueError("the given index set is not valid") return cls._from_matrix(data, coxeter_type, index_set, coxeter_type_check) @@ -653,7 +653,7 @@ def _repr_option(self, key): """ if key == 'ascii_art' or key == 'element_ascii_art': return self._matrix.nrows() > 1 - return super(CoxeterMatrix, self)._repr_option(key) + return super()._repr_option(key) def _latex_(self): r""" diff --git a/src/sage/combinat/root_system/coxeter_type.py b/src/sage/combinat/root_system/coxeter_type.py index 9507858663a..9c10c3c04db 100644 --- a/src/sage/combinat/root_system/coxeter_type.py +++ b/src/sage/combinat/root_system/coxeter_type.py @@ -1,7 +1,7 @@ """ Coxeter Types """ -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2015 Travis Scrimshaw , # 2015 Jean-Philippe Labbe , # @@ -14,8 +14,8 @@ # # The full text of the GPL is available at: # -# http://www.gnu.org/licenses/ -#***************************************************************************** +# https://www.gnu.org/licenses/ +# **************************************************************************** from sage.misc.abstract_method import abstract_method from sage.misc.cachefunc import cached_method @@ -54,7 +54,7 @@ def __classcall_private__(cls, *x): except (ValueError, TypeError): pass - if len(x) == 1: # In case the input is similar to CoxeterType([['A',2]]) + if len(x) == 1: # In case the input is similar to CoxeterType([['A',2]]) return CoxeterType(x[0]) raise NotImplementedError("Coxeter types not from Cartan types not yet implemented") @@ -173,12 +173,12 @@ def _samples(self): Coxeter type of ['F', 4, 1], Coxeter type of ['G', 2, 1], Coxeter type of ['A', 1, 1]] """ - finite = [CoxeterType(t) for t in [['A', 1], ['A', 5], ['B', 1], ['B', 5], - ['C', 1], ['C', 5], ['D', 4], ['D', 5], - ['E', 6], ['E', 7], ['E', 8], ['F', 4], - ['H', 3], ['H', 4], ['I', 10]]] + finite = [CoxeterType(t) for t in [['A', 1], ['A', 5], ['B', 1], ['B', 5], + ['C', 1], ['C', 5], ['D', 4], ['D', 5], + ['E', 6], ['E', 7], ['E', 8], ['F', 4], + ['H', 3], ['H', 4], ['I', 10]]] - affine = [CoxeterType(t) for t in [['A', 2, 1], ['B', 5, 1], + affine = [CoxeterType(t) for t in [['A', 2, 1], ['B', 5, 1], ['C', 5, 1], ['D', 5, 1], ['E', 6, 1], ['E', 7, 1], ['E', 8, 1], ['F', 4, 1], ['G', 2, 1], ['A', 1, 1]]] @@ -433,8 +433,7 @@ def __classcall_private__(cls, cartan_type): sage: C1 is C2 True """ - return super(CoxeterTypeFromCartanType, cls).__classcall__(cls, - CartanType(cartan_type)) + return super().__classcall__(cls, CartanType(cartan_type)) def __init__(self, cartan_type): """ diff --git a/src/sage/combinat/root_system/extended_affine_weyl_group.py b/src/sage/combinat/root_system/extended_affine_weyl_group.py index bd02024afc6..3edde88317d 100644 --- a/src/sage/combinat/root_system/extended_affine_weyl_group.py +++ b/src/sage/combinat/root_system/extended_affine_weyl_group.py @@ -10,7 +10,7 @@ - Nicolas M. Thiery (2012): initial version - Mark Shimozono (2013): twisted affine root systems, multiple realizations, GL_n """ -#***************************************************************************** +# *************************************************************************** # Copyright (C) 2012 Daniel Bump , # 2012 Daniel Orr # 2012 Anne Schilling @@ -23,8 +23,8 @@ # 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. -# http://www.gnu.org/licenses/ -#***************************************************************************** +# https://www.gnu.org/licenses/ +# *************************************************************************** from sage.combinat.root_system.cartan_type import CartanType from sage.combinat.root_system.weyl_group import WeylGroup from sage.categories.groups import Groups diff --git a/src/sage/combinat/root_system/hecke_algebra_representation.py b/src/sage/combinat/root_system/hecke_algebra_representation.py index bde28234214..20d8d293337 100644 --- a/src/sage/combinat/root_system/hecke_algebra_representation.py +++ b/src/sage/combinat/root_system/hecke_algebra_representation.py @@ -1,13 +1,13 @@ r""" Hecke algebra representations """ -#***************************************************************************** +# *************************************************************************** # Copyright (C) 2013 Nicolas M. Thiery # Anne Schilling # # Distributed under the terms of the GNU General Public License (GPL) -# http://www.gnu.org/licenses/ -#***************************************************************************** +# https://www.gnu.org/licenses/ +# *************************************************************************** import functools from sage.misc.abstract_method import abstract_method from sage.misc.cachefunc import cached_method @@ -19,6 +19,7 @@ from sage.rings.infinity import infinity from sage.rings.integer_ring import ZZ + class HeckeAlgebraRepresentation(WithEqualityById, SageObject): r""" A representation of an (affine) Hecke algebra given by the action of the `T` generators diff --git a/src/sage/combinat/root_system/integrable_representations.py b/src/sage/combinat/root_system/integrable_representations.py index 6aedd4aefb2..d96f34963f8 100644 --- a/src/sage/combinat/root_system/integrable_representations.py +++ b/src/sage/combinat/root_system/integrable_representations.py @@ -1,16 +1,14 @@ """ Integrable Representations of Affine Lie Algebras """ - -#***************************************************************************** +# *************************************************************************** # Copyright (C) 2014, 2105 Daniel Bump # Travis Scrimshaw # Valentin Buciumas # # Distributed under the terms of the GNU General Public License (GPL) -# http://www.gnu.org/licenses/ -#***************************************************************************** - +# https://www.gnu.org/licenses/ +# *************************************************************************** from sage.structure.unique_representation import UniqueRepresentation from sage.structure.category_object import CategoryObject from sage.categories.modules import Modules @@ -20,6 +18,7 @@ from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet from sage.combinat.root_system.weyl_characters import WeylCharacterRing + # TODO: Make this a proper parent and implement actions class IntegrableRepresentation(UniqueRepresentation, CategoryObject): r""" diff --git a/src/sage/combinat/root_system/non_symmetric_macdonald_polynomials.py b/src/sage/combinat/root_system/non_symmetric_macdonald_polynomials.py index 2e52b7fd7ee..74b5ff34eec 100644 --- a/src/sage/combinat/root_system/non_symmetric_macdonald_polynomials.py +++ b/src/sage/combinat/root_system/non_symmetric_macdonald_polynomials.py @@ -1203,7 +1203,7 @@ def __classcall__(cls, KL, q='q', q1='q1', q2='q2', normalized=True): q = K(q) q1 = K(q1) q2 = K(q2) - return super(NonSymmetricMacdonaldPolynomials, cls).__classcall__(cls, KL, q, q1, q2, normalized) + return super().__classcall__(cls, KL, q, q1, q2, normalized) def __init__(self, KL, q, q1, q2, normalized): r""" @@ -1581,12 +1581,11 @@ def __getitem__(self, mu): """ muaff = self._L.embed_at_level(mu, 0) if not all(muaff.scalar(coroot) in ZZ for coroot in self._L.simple_coroots()): - raise ValueError("%s does not lift to a level 0 element of the affine weight lattice"%muaff) - return super(NonSymmetricMacdonaldPolynomials, self).__getitem__(mu) - + raise ValueError("%s does not lift to a level 0 element of the affine weight lattice" % muaff) + return super().__getitem__(mu) @cached_method - def rho_prime(self): # Should be rho_prime_check + def rho_prime(self): # Should be rho_prime_check r""" Return the level 0 sum of the classical fundamental weights in `L'`. diff --git a/src/sage/combinat/root_system/pieri_factors.py b/src/sage/combinat/root_system/pieri_factors.py index c2e098af316..e91fc9b0948 100644 --- a/src/sage/combinat/root_system/pieri_factors.py +++ b/src/sage/combinat/root_system/pieri_factors.py @@ -7,8 +7,8 @@ # Nicolas M. Thiery # # Distributed under the terms of the GNU General Public License (GPL) -# http://www.gnu.org/licenses/ -#****************************************************************************** +# https://www.gnu.org/licenses/ +# ***************************************************************************** from sage.misc.cachefunc import cached_method from sage.misc.constant_function import ConstantFunction @@ -325,7 +325,7 @@ def maximal_elements(self): ct_aff = ct.dual().affine() - max_elts_affine = WeylGroup(ct_aff).pieri_factors().maximal_elements() + max_elts_affine = WeylGroup(ct_aff).pieri_factors().maximal_elements() for w in max_elts_affine: if 0 not in w.reduced_word(): @@ -542,7 +542,7 @@ def __classcall__(cls, W, min_length=0, max_length=infinity, max_support = frozenset(max_support) min_length = max(min_length, len(min_support)) max_length = min(len(max_support), max_length, len(W.index_set()) - 1) - return super(PieriFactors_type_A_affine, cls).__classcall__(cls, W, min_length, max_length, min_support, max_support) + return super().__classcall__(cls, W, min_length, max_length, min_support, max_support) def __init__(self, W, min_length, max_length, min_support, max_support): r""" @@ -656,7 +656,7 @@ def _test_maximal_elements(self, **options): if self._min_length > 0 or self._max_length < len(self.W.index_set())-1 or self._max_support != frozenset(index_set): tester.info("\n Strict subset of the Pieri factors; skipping test") return - return super(PieriFactors_type_A_affine, self)._test_maximal_elements(**options) + return super()._test_maximal_elements(**options) def __contains__(self, w): r""" diff --git a/src/sage/combinat/root_system/reflection_group_complex.py b/src/sage/combinat/root_system/reflection_group_complex.py index 8ae19776db4..bebb3dc9f04 100644 --- a/src/sage/combinat/root_system/reflection_group_complex.py +++ b/src/sage/combinat/root_system/reflection_group_complex.py @@ -185,15 +185,15 @@ - Christian Stump (2015): initial version """ -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2011-2016 Christian Stump # # 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. -# http://www.gnu.org/licenses/ -#***************************************************************************** +# https://www.gnu.org/licenses/ +# **************************************************************************** from sage.misc.cachefunc import cached_method, cached_function from sage.misc.misc_c import prod @@ -236,26 +236,26 @@ def __init__(self, W_types, index_set=None, hyperplane_index_set=None, reflectio W_components = [] reflection_type = [] for W_type in W_types: - if W_type == (1,1,1): + if W_type == (1, 1, 1): raise ValueError("the one element group is not considered a reflection group") elif W_type in ZZ: - call_str = 'ComplexReflectionGroup(%s)'%W_type - elif isinstance(W_type,CartanMatrix): - call_str = 'PermRootGroup(IdentityMat(%s),%s)'%(W_type._rank,str(W_type._M._gap_())) + call_str = 'ComplexReflectionGroup(%s)' % W_type + elif isinstance(W_type, CartanMatrix): + call_str = 'PermRootGroup(IdentityMat(%s),%s)' % (W_type._rank, str(W_type._M._gap_())) elif is_Matrix(W_type): - call_str = 'PermRootGroup(IdentityMat(%s),%s)'%(W_type._rank,str(W_type._gap_())) - elif W_type in ZZ or ( isinstance(W_type, tuple) and len(W_type) == 3 ): - call_str = 'ComplexReflectionGroup%s'%str(W_type) + call_str = 'PermRootGroup(IdentityMat(%s),%s)' % (W_type._rank, str(W_type._gap_())) + elif W_type in ZZ or (isinstance(W_type, tuple) and len(W_type) == 3): + call_str = 'ComplexReflectionGroup%s' % str(W_type) else: if W_type[0] == "I": - call_str = 'CoxeterGroup("I",2,%s)'%W_type[1] + call_str = 'CoxeterGroup("I",2,%s)' % W_type[1] else: - call_str = 'CoxeterGroup("%s",%s)'%W_type + call_str = 'CoxeterGroup("%s",%s)' % W_type W_components.append(gap3(call_str)) X = list(W_components[-1].ReflectionType()) if len(X) > 1: - raise ValueError("input data %s is invalid"%W_type) + raise ValueError("input data %s is invalid" % W_type) X = X[0] type_dict = {} type_dict["series"] = X.series.sage() @@ -1389,7 +1389,7 @@ def braid_relations(self): [[[1, 2, 1], [2, 1, 2]], [[1, 3], [3, 1]], [[2, 3, 2], [3, 2, 3]]] """ if self.is_real(): - return super(ComplexReflectionGroup,self).braid_relations() + return super().braid_relations() else: return self._gap_group.BraidRelations().sage() @@ -1910,7 +1910,7 @@ def coxeter_number(self, chi=None): 24 """ if chi is None: - return super(ComplexReflectionGroup, self).coxeter_number() + return super().coxeter_number() G = self.gens() cox_chi = 0 diff --git a/src/sage/combinat/root_system/reflection_group_element.pyx b/src/sage/combinat/root_system/reflection_group_element.pyx index c08a6001524..b724132637b 100644 --- a/src/sage/combinat/root_system/reflection_group_element.pyx +++ b/src/sage/combinat/root_system/reflection_group_element.pyx @@ -11,7 +11,7 @@ AUTHORS: - Christian Stump (initial version 2011--2015) - Travis Scrimshaw (14-03-2017): moved element code """ -#***************************************************************************** +# *************************************************************************** # Copyright (C) 2011-2016 Christian Stump # Copyright (C) 2017 Travis Scrimshaw # @@ -19,8 +19,8 @@ AUTHORS: # 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. -# http://www.gnu.org/licenses/ -#***************************************************************************** +# https://www.gnu.org/licenses/ +# *************************************************************************** from sage.misc.cachefunc import cached_method from sage.misc.lazy_attribute import lazy_attribute diff --git a/src/sage/combinat/root_system/root_space.py b/src/sage/combinat/root_system/root_space.py index d52b5d7a8f0..d4e6f8746d2 100644 --- a/src/sage/combinat/root_system/root_space.py +++ b/src/sage/combinat/root_system/root_space.py @@ -1,13 +1,12 @@ """ Root lattices and root spaces """ -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2008-2009 Nicolas M. Thiery # # Distributed under the terms of the GNU General Public License (GPL) -# http://www.gnu.org/licenses/ -#***************************************************************************** - +# https://www.gnu.org/licenses/ +# **************************************************************************** from sage.misc.cachefunc import cached_method, cached_in_parent_method from sage.rings.integer_ring import ZZ from sage.combinat.free_module import CombinatorialFreeModule @@ -183,9 +182,9 @@ def _to_root_lattice(self, x): .. TODO:: generalize diagonal module morphisms to implement this """ try: - return self.root_system.root_lattice().sum_of_terms( (i, ZZ(c)) for (i,c) in x) + return self.root_system.root_lattice().sum_of_terms((i, ZZ(c)) for i, c in x) except TypeError: - raise ValueError("%s does not have integral coefficients"%x) + raise ValueError("%s does not have integral coefficients" % x) @cached_method def _to_classical_on_basis(self, i): @@ -231,6 +230,7 @@ def basis_value(basis, i): return basis[i] return self.module_morphism(on_basis = functools.partial(basis_value, basis) , codomain=L) + class RootSpaceElement(CombinatorialFreeModule.Element): def scalar(self, lambdacheck): """ @@ -461,4 +461,5 @@ def to_ambient(self): """ return self.parent().to_ambient_space_morphism()(self) + RootSpace.Element = RootSpaceElement diff --git a/src/sage/combinat/root_system/root_system.py b/src/sage/combinat/root_system/root_system.py index 9f4764f9d23..4112165885e 100644 --- a/src/sage/combinat/root_system/root_system.py +++ b/src/sage/combinat/root_system/root_system.py @@ -4,7 +4,7 @@ See :ref:`sage.combinat.root_system.all` for an overview. """ -#***************************************************************************** +# *************************************************************************** # Copyright (C) 2007 Mike Hansen , # Justin Walker # 2008-2009 Nicolas M. Thiery @@ -12,8 +12,8 @@ # Distributed under the terms of the GNU General Public License (GPL) # The full text of the GPL is available at: # -# http://www.gnu.org/licenses/ -#***************************************************************************** +# https://www.gnu.org/licenses/ +# *************************************************************************** # Design largely inspired from MuPAD-Combinat from sage.structure.sage_object import SageObject from sage.structure.unique_representation import UniqueRepresentation @@ -311,7 +311,7 @@ def __classcall__(cls, cartan_type, as_dual_of=None): sage: RootSystem(["B",3], as_dual_of=None) is RootSystem("B3") True """ - return super(RootSystem, cls).__classcall__(cls, CartanType(cartan_type), as_dual_of) + return super().__classcall__(cls, CartanType(cartan_type), as_dual_of) def __init__(self, cartan_type, as_dual_of=None): """ @@ -338,7 +338,6 @@ def __init__(self, cartan_type, as_dual_of=None): self.dual_side = True self.dual = as_dual_of - def _test_root_lattice_realizations(self, **options): """ Runs tests on all the root lattice realizations of this root @@ -507,7 +506,7 @@ def root_poset(self, restricted=False, facade=False): sage: Phi.cover_relations() [[alpha[2], alpha[1] + alpha[2]], [alpha[1], alpha[1] + alpha[2]], [alpha[1] + alpha[2], alpha[1] + 2*alpha[2]]] """ - return self.root_lattice().root_poset(restricted=restricted,facade=facade) + return self.root_lattice().root_poset(restricted=restricted, facade=facade) def coroot_lattice(self): """ diff --git a/src/sage/combinat/root_system/type_A_infinity.py b/src/sage/combinat/root_system/type_A_infinity.py index 21237bc48c8..ddd0b352d1f 100644 --- a/src/sage/combinat/root_system/type_A_infinity.py +++ b/src/sage/combinat/root_system/type_A_infinity.py @@ -1,15 +1,12 @@ """ Root system data for type A infinity """ - -#***************************************************************************** +# *************************************************************************** # Copyright (C) 2016 Andrew Mathas # # Distributed under the terms of the GNU General Public License (GPL) -# http://www.gnu.org/licenses/ -#***************************************************************************** - - +# https://www.gnu.org/licenses/ +# *************************************************************************** from .cartan_type import CartanType_standard, CartanType_simple from sage.rings.integer_ring import ZZ @@ -57,7 +54,7 @@ def __init__(self, index_set): sage: TestSuite(ct).run() """ - super(CartanType, self).__init__() + super().__init__() self.letter = 'A' self.n = index_set @@ -106,11 +103,11 @@ def ascii_art(self, label=lambda i: i, node=None): node = self._ascii_art_node if self.n == ZZ: - ret = '..---'+'---'.join(node(label(i)) for i in range(7))+'---..\n' - ret += ' '+''.join("{:4}".format(label(i)) for i in range(-3,4)) + ret = '..---' + '---'.join(node(label(i)) for i in range(7)) + '---..\n' + ret += ' ' + ''.join("{:4}".format(label(i)) for i in range(-3, 4)) else: - ret = '---'.join(node(label(i)) for i in range(7))+'---..\n' - ret += '0'+''.join("{:4}".format(label(i)) for i in range(1,7)) + ret = '---'.join(node(label(i)) for i in range(7)) + '---..\n' + ret += '0' + ''.join("{:4}".format(label(i)) for i in range(1, 7)) return ret diff --git a/src/sage/combinat/root_system/type_dual.py b/src/sage/combinat/root_system/type_dual.py index 3c9e48397fe..ff5c6bd5a3e 100644 --- a/src/sage/combinat/root_system/type_dual.py +++ b/src/sage/combinat/root_system/type_dual.py @@ -675,20 +675,20 @@ def _default_folded_cartan_type(self): """ from sage.combinat.root_system.type_folded import CartanTypeFolded letter = self._type.type() - if letter == 'BC': # A_{2n}^{(2)\dagger} + if letter == 'BC': # A_{2n}^{(2)\dagger} n = self._type.classical().rank() return CartanTypeFolded(self, ['A', 2*n - 1, 1], [[0]] + [[i, 2*n-i] for i in range(1, n)] + [[n]]) - if letter == 'B': # A_{2n-1}^{(2)} + if letter == 'B': # A_{2n-1}^{(2)} n = self._type.classical().rank() return CartanTypeFolded(self, ['D', n + 1, 1], [[i] for i in range(n)] + [[n, n+1]]) - if letter == 'C': # D_{n+1}^{(2)} + if letter == 'C': # D_{n+1}^{(2)} n = self._type.classical().rank() return CartanTypeFolded(self, ['A', 2*n-1, 1], [[0]] + [[i, 2*n-i] for i in range(1, n)] + [[n]]) - if letter == 'F': # E_6^{(2)} + if letter == 'F': # E_6^{(2)} return CartanTypeFolded(self, ['E', 6, 1], [[0], [2], [4], [3, 5], [1, 6]]) - if letter == 'G': # D_4^{(3)} + if letter == 'G': # D_4^{(3)} return CartanTypeFolded(self, ['D', 4, 1], [[0], [1, 3, 4], [2]]) - return super(CartanType, self)._default_folded_cartan_type() + return super()._default_folded_cartan_type() diff --git a/src/sage/combinat/root_system/type_folded.py b/src/sage/combinat/root_system/type_folded.py index b8ef07d88e2..bfb0d1513c6 100644 --- a/src/sage/combinat/root_system/type_folded.py +++ b/src/sage/combinat/root_system/type_folded.py @@ -178,13 +178,13 @@ def __classcall_private__(cls, cartan_type, virtual, orbit): virtual = CartanType(virtual) if isinstance(orbit, dict): i_set = cartan_type.index_set() - orb = [None]*len(i_set) - for k,v in orbit.items(): + orb = [None] * len(i_set) + for k, v in orbit.items(): orb[i_set.index(k)] = tuple(v) orbit = tuple(orb) else: orbit = tuple(map(tuple, orbit)) - return super(CartanTypeFolded, cls).__classcall__(cls, cartan_type, virtual, orbit) + return super().__classcall__(cls, cartan_type, virtual, orbit) def __init__(self, cartan_type, folding_of, orbit): """ diff --git a/src/sage/combinat/root_system/type_marked.py b/src/sage/combinat/root_system/type_marked.py index 0a506de4165..bb18256dbc6 100644 --- a/src/sage/combinat/root_system/type_marked.py +++ b/src/sage/combinat/root_system/type_marked.py @@ -82,7 +82,7 @@ def __classcall__(cls, ct, marked_nodes): if any(node not in ct.index_set() for node in marked_nodes): raise ValueError("invalid marked node") marked_nodes = tuple(sorted(marked_nodes)) - return super(CartanType, cls).__classcall__(cls, ct, marked_nodes) + return super().__classcall__(cls, ct, marked_nodes) def __init__(self, ct, marked_nodes): """ diff --git a/src/sage/combinat/root_system/weight_space.py b/src/sage/combinat/root_system/weight_space.py index 03409e334f9..ab59db061fe 100644 --- a/src/sage/combinat/root_system/weight_space.py +++ b/src/sage/combinat/root_system/weight_space.py @@ -1,12 +1,12 @@ """ Weight lattices and weight spaces """ -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2008-2009 Nicolas M. Thiery # # Distributed under the terms of the GNU General Public License (GPL) -# http://www.gnu.org/licenses/ -#***************************************************************************** +# https://www.gnu.org/licenses/ +# **************************************************************************** from sage.misc.cachefunc import cached_method from sage.sets.family import Family @@ -14,6 +14,7 @@ from .weight_lattice_realizations import WeightLatticeRealizations import functools + class WeightSpace(CombinatorialFreeModule): r""" INPUT: @@ -152,8 +153,7 @@ def __classcall_private__(cls, root_system, base_ring, extended=False): sage: WeightSpace(R, QQ) is WeightSpace(R, QQ, False) True """ - return super(WeightSpace, cls).__classcall__(cls, root_system, base_ring, extended) - + return super().__classcall__(cls, root_system, base_ring, extended) def __init__(self, root_system, base_ring, extended): """ @@ -383,8 +383,7 @@ def _repr_term(self, m): """ if m == "delta": return "deltacheck" if self.root_system.dual_side else "delta" - else: - return super(WeightSpace, self)._repr_term(m) + return super()._repr_term(m) def _latex_term(self, m): r""" @@ -402,8 +401,7 @@ def _latex_term(self, m): """ if m == "delta": return "\\delta^\\vee" if self.root_system.dual_side else "\\delta" - else: - return super(WeightSpace, self)._latex_term(m) + return super()._latex_term(m) @cached_method def _to_classical_on_basis(self, i): diff --git a/src/sage/combinat/root_system/weyl_characters.py b/src/sage/combinat/root_system/weyl_characters.py index 036f8a58614..17c84dfb8ce 100644 --- a/src/sage/combinat/root_system/weyl_characters.py +++ b/src/sage/combinat/root_system/weyl_characters.py @@ -103,10 +103,10 @@ def __classcall__(cls, ct, base_ring=ZZ, prefix=None, style="lattice", k=None, c ct = CartanType(ct) if prefix is None: if ct.is_atomic(): - prefix = ct[0]+str(ct[1]) + prefix = ct[0] + str(ct[1]) else: prefix = repr(ct) - return super(WeylCharacterRing, cls).__classcall__(cls, ct, base_ring=base_ring, prefix=prefix, style=style, k=k, conjugate=conjugate, cyclotomic_order=cyclotomic_order, fusion_labels=fusion_labels, inject_variables=inject_variables) + return super().__classcall__(cls, ct, base_ring=base_ring, prefix=prefix, style=style, k=k, conjugate=conjugate, cyclotomic_order=cyclotomic_order, fusion_labels=fusion_labels, inject_variables=inject_variables) def __init__(self, ct, base_ring=ZZ, prefix=None, style="lattice", k=None, conjugate=False, cyclotomic_order=None, fusion_labels=None, inject_variables=False): """ @@ -174,7 +174,7 @@ def next_level(wt): self._m_g = 2 else: self._m_g = 3 - if ct[0] in ['B','F']: + if ct[0] in ['B', 'F']: self._nf = 2 else: self._nf = 1 @@ -455,7 +455,7 @@ def __call__(self, *args): # object which can't be coerced into self if len(args) > 1: args = (args,) - return super(WeylCharacterRing, self).__call__(*args) + return super().__call__(*args) def _element_constructor_(self, weight): """ @@ -1740,7 +1740,7 @@ def __classcall__(cls, parent, prefix=None): sage: a3.cartan_type(), a3.base_ring(), a3.parent() (['A', 3], Integer Ring, The Weyl Character Ring of Type A3 with Integer Ring coefficients) """ - return super(WeightRing, cls).__classcall__(cls, parent, prefix=prefix) + return super().__classcall__(cls, parent, prefix=prefix) def __init__(self, parent, prefix): """ @@ -1825,7 +1825,7 @@ def __call__(self, *args): # object which can't be coerced into self if len(args) > 1: args = (args,) - return super(WeightRing, self).__call__(*args) + return super().__call__(*args) def _element_constructor_(self, weight): """ diff --git a/src/sage/combinat/root_system/weyl_group.py b/src/sage/combinat/root_system/weyl_group.py index efcdce97384..a8c13419c4b 100644 --- a/src/sage/combinat/root_system/weyl_group.py +++ b/src/sage/combinat/root_system/weyl_group.py @@ -217,7 +217,7 @@ class WeylGroup_gens(UniqueRepresentation, @staticmethod def __classcall__(cls, domain, prefix=None): - return super(WeylGroup_gens, cls).__classcall__(cls, domain, prefix) + return super().__classcall__(cls, domain, prefix) def __init__(self, domain, prefix): """ @@ -1016,7 +1016,7 @@ def __classcall__(cls, cartan_type, prefix=None): sage: W1 is W2 True """ - return super(WeylGroup_permutation, cls).__classcall__(cls, CartanType(cartan_type), prefix) + return super().__classcall__(cls, CartanType(cartan_type), prefix) def __init__(self, cartan_type, prefix): """ diff --git a/src/sage/combinat/sf/monomial.py b/src/sage/combinat/sf/monomial.py index f833be60c3b..c36716cfa3c 100644 --- a/src/sage/combinat/sf/monomial.py +++ b/src/sage/combinat/sf/monomial.py @@ -22,7 +22,7 @@ import sage.libs.symmetrica.all as symmetrica from sage.rings.integer import Integer from sage.rings.infinity import infinity -from sage.combinat.partition import Partition, _Partitions +from sage.combinat.partition import _Partitions from sage.arith.misc import multinomial, factorial, binomial @@ -189,7 +189,7 @@ def from_polynomial_exp(self, p): INPUT: - ``self`` -- a monomial symmetric function basis - - ``p`` -- a multivariate polynomial over the same base ring as ``self`` + - ``p`` -- a polynomial over the same base ring as ``self`` OUTPUT: @@ -228,8 +228,8 @@ def from_polynomial_exp(self, p): :func:`Partition`, :meth:`Partition.to_exp` """ assert self.base_ring() == p.parent().base_ring() - return self.sum_of_terms((Partition(exp=monomial), coeff) - for monomial, coeff in p.dict().items()) + from sage.combinat.sf.sfa import _from_polynomial + return _from_polynomial(p, self) def antipode_by_coercion(self, element): r""" diff --git a/src/sage/combinat/sf/sf.py b/src/sage/combinat/sf/sf.py index a686dfef513..96cea735c65 100644 --- a/src/sage/combinat/sf/sf.py +++ b/src/sage/combinat/sf/sf.py @@ -22,6 +22,8 @@ from sage.structure.parent import Parent from sage.structure.unique_representation import UniqueRepresentation from sage.categories.graded_hopf_algebras import GradedHopfAlgebras +from sage.categories.principal_ideal_domains import PrincipalIdealDomains +from sage.categories.unique_factorization_domains import UniqueFactorizationDomains from sage.categories.fields import Fields from sage.categories.rings import Rings from sage.combinat.partition import Partitions @@ -70,6 +72,7 @@ class SymmetricFunctions(UniqueRepresentation, Parent): sage: Sym.category() Join of Category of hopf algebras over Rational Field + and Category of unique factorization domains and Category of graded algebras over Rational Field and Category of commutative algebras over Rational Field and Category of monoids with realizations @@ -864,6 +867,8 @@ def __init__(self, R): assert(R in Fields() or R in Rings()) # side effect of this statement assures MRO exists for R self._base = R # Won't be needed when CategoryObject won't override anymore base_ring cat = GradedHopfAlgebras(R).Commutative().Cocommutative() + if R in PrincipalIdealDomains(): + cat &= UniqueFactorizationDomains() Parent.__init__(self, category=cat.WithRealizations()) def a_realization(self): diff --git a/src/sage/combinat/sf/sfa.py b/src/sage/combinat/sf/sfa.py index 6643a77dca3..040dd78f4d3 100644 --- a/src/sage/combinat/sf/sfa.py +++ b/src/sage/combinat/sf/sfa.py @@ -222,9 +222,13 @@ from sage.combinat.partition import _Partitions, Partitions, Partitions_n, Partition from sage.categories.hopf_algebras import HopfAlgebras from sage.categories.hopf_algebras_with_basis import HopfAlgebrasWithBasis +from sage.categories.principal_ideal_domains import PrincipalIdealDomains +from sage.categories.unique_factorization_domains import UniqueFactorizationDomains from sage.categories.tensor import tensor from sage.combinat.free_module import CombinatorialFreeModule from sage.matrix.constructor import matrix +from sage.structure.factorization import Factorization +from sage.structure.element import coerce_binop from sage.misc.misc_c import prod from sage.data_structures.blas_dict import convert_remove_zeroes, linear_combination from copy import copy @@ -355,14 +359,29 @@ def super_categories(self): Category of commutative hopf algebras with basis over Rational Field, Join of Category of realizations of hopf algebras over Rational Field and Category of graded algebras over Rational Field - and Category of graded coalgebras over Rational Field] + and Category of graded coalgebras over Rational Field, + Category of unique factorization domains] + + sage: Sym = SymmetricFunctions(ZZ["x"]) + sage: bases = SymmetricFunctionsBases(Sym) + sage: bases.super_categories() + [Category of realizations of Symmetric Functions over Univariate Polynomial Ring in x over Integer Ring, + Category of commutative hopf algebras with basis over Univariate Polynomial Ring in x over Integer Ring, + Join of Category of realizations of hopf algebras over Univariate Polynomial Ring in x over Integer Ring + and Category of graded algebras over Univariate Polynomial Ring in x over Integer Ring + and Category of graded coalgebras over Univariate Polynomial Ring in x over Integer Ring] """ # FIXME: The last one should also be commutative, but this triggers a # KeyError when doing the C3 algorithm!!! - cat = HopfAlgebras(self.base().base_ring()) - return [self.base().Realizations(), - cat.Commutative().WithBasis(), - cat.Graded().Realizations()] + R = self.base().base_ring() + cat = HopfAlgebras(R) + categories = [self.base().Realizations(), + cat.Commutative().WithBasis(), + cat.Graded().Realizations()] + if R in PrincipalIdealDomains: + categories.append(UniqueFactorizationDomains()) + return categories + class ParentMethods: @@ -3010,6 +3029,160 @@ class SymmetricFunctionAlgebra_generic_Element(CombinatorialFreeModule.Element): m[1, 1, 1] + m[2, 1] + m[3] sage: m.set_print_style('lex') """ + def factor(self): + """ + Return the factorization of this symmetric function. + + EXAMPLES:: + + sage: e = SymmetricFunctions(QQ).e() + sage: factor((5*e[3] + e[2,1] + e[1])*(7*e[2] + e[5,1])) + (e[1] + e[2, 1] + 5*e[3]) * (7*e[2] + e[5, 1]) + + sage: R. = QQ[] + sage: s = SymmetricFunctions(R.fraction_field()).s() + sage: factor((s[3] + x*s[2,1] + 1)*(3*y*s[2] + s[4,1] + x*y)) + (-s[] + (-x)*s[2, 1] - s[3]) * ((-x*y)*s[] + (-3*y)*s[2] - s[4, 1]) + + TESTS:: + + sage: p = SymmetricFunctions(QQ).p() + sage: factor((p[3] + p[2,1])*(p[2] + p[4,1])) + (p[2, 1] + p[3]) * (p[2] + p[4, 1]) + + sage: s = SymmetricFunctions(QQ).s() + sage: factor((s[3] + s[2,1])*(s[2] + s[4,1])) + (-1) * s[1] * s[2] * (-s[2] - s[4, 1]) + + sage: s = SymmetricFunctions(ZZ).s() + sage: factor((s[3] + s[2,1])*(s[2] + s[4,1])) + (-1) * s[1] * s[2] * (-s[2] - s[4, 1]) + + sage: R. = QQ[] + sage: JP = SymmetricFunctions(FractionField(R)).jack(t).P() + sage: f = (JP[2,1]*t + JP[1,1,1])^2 + sage: f.factor() + (1/(t^2 + 4*t + 4)) * ((-t-2)*JackP[1, 1, 1] + (-t^2-2*t)*JackP[2, 1])^2 + + Some corner cases:: + + sage: s = SymmetricFunctions(ZZ).s() + sage: factor(s(6)) + 2 * 3 + + sage: factor(6*s[1]) + 2*s[] * 3*s[] * s[1] + + """ + from sage.combinat.sf.multiplicative import SymmetricFunctionAlgebra_multiplicative + L = self.parent() + if isinstance(L, SymmetricFunctionAlgebra_multiplicative): + M = L + else: + M = L.realization_of().h() + self = M(self) + + poly = _to_polynomials([self], self.base_ring())[0] + factors = poly.factor() + unit = factors.unit() + if factors.universe() == self.base_ring(): + return Factorization(factors, unit=unit) + factors = [(_from_polynomial(factor, M), exponent) + for factor, exponent in factors] + + if not isinstance(L, SymmetricFunctionAlgebra_multiplicative): + factors = [(L(factor), exponent) for factor, exponent in factors] + return Factorization(factors, unit=unit) + + def _floordiv_(self, other): + """ + Perform division with remainder and return the quotient. + + INPUT: + + - ``right`` - something coercible to a symmetric function in + ``self.parent()`` + + EXAMPLES:: + + sage: e = SymmetricFunctions(ZZ).e() + sage: h = SymmetricFunctions(ZZ).h() + sage: e[3,2,1] // h[2] + -e[3, 1] + + TESTS:: + + sage: s = SymmetricFunctions(ZZ).s() + sage: s(0) // s[1] + 0 + + sage: s(6) // s(2) + 3*s[] + + """ + from sage.combinat.sf.multiplicative import SymmetricFunctionAlgebra_multiplicative + # we can assume that the parents of self and other are the same + L = self.parent() + if isinstance(L, SymmetricFunctionAlgebra_multiplicative): + M = L + else: + M = L.realization_of().h() + self = M(self) + other = M(other) + + p1, p2 = _to_polynomials([self, other], self.base_ring()) + g = p1 // p2 + return L(_from_polynomial(g, M)) + + @coerce_binop + def gcd(self, other): + """ + Return the greatest common divisor with ``other``. + + INPUT: + + - ``other`` -- the other symmetric function + + EXAMPLES:: + + sage: e = SymmetricFunctions(ZZ).e() + sage: A = 5*e[3] + e[2,1] + e[1] + sage: B = 7*e[2] + e[5,1] + sage: C = 3*e[1,1] + e[2] + sage: gcd(A*B^2, B*C) + 7*e[2] + e[5, 1] + + sage: p = SymmetricFunctions(ZZ).p() + sage: gcd(e[2,1], p[1,1]-p[2]) + e[2] + sage: gcd(p[2,1], p[3,2]-p[2,1]) + p[2] + + TESTS:: + + sage: s = SymmetricFunctions(ZZ).s() + sage: gcd(s(0), s[1]) + s[1] + + sage: gcd(s(0), s(1)) + s[] + + sage: gcd(s(9), s(6)) + 3*s[] + + """ + from sage.combinat.sf.multiplicative import SymmetricFunctionAlgebra_multiplicative + L = self.parent() + if isinstance(L, SymmetricFunctionAlgebra_multiplicative): + M = L + else: + M = L.realization_of().h() + self = M(self) + other = M(other) + + p1, p2 = _to_polynomials([self, other], self.base_ring()) + g = p1.gcd(p2) + return L(_from_polynomial(g, M)) def plethysm(self, x, include=None, exclude=None): r""" @@ -3118,6 +3291,7 @@ def plethysm(self, x, include=None, exclude=None): Sage can also do the plethysm with an element in the completion:: + sage: s = SymmetricFunctions(QQ).s() sage: L = LazySymmetricFunctions(s) sage: f = s[2,1] sage: g = L(s[1]) / (1 - L(s[1])); g @@ -6235,6 +6409,7 @@ def _nonnegative_coefficients(x): else: return x >= 0 + def _variables_recursive(R, include=None, exclude=None): r""" Return all variables appearing in the ring ``R``. @@ -6291,6 +6466,7 @@ def _variables_recursive(R, include=None, exclude=None): return [g for g in degree_one if g != R.one()] + def _raise_variables(c, n, variables): r""" Replace the given variables in the ring element ``c`` with their @@ -6315,3 +6491,74 @@ def _raise_variables(c, n, variables): except AttributeError: return c + +def _to_polynomials(lf, R): + """ + Return the symmetric functions as polynomials, where each + part of a partition corresponds to a variable. + + The result makes sense only if the symmetric functions are all + given in the same basis, which is multiplicative, but we do not + check this. + + INPUT: + + - ``lf`` -- a list of symmetric functions + - ``R`` -- the base ring + + .. SEEALSO:: + + :func:`_from_polynomial` + + EXAMPLES:: + + sage: from sage.combinat.sf.sfa import _to_polynomials + sage: e = SymmetricFunctions(QQ).e() + sage: _to_polynomials([5*e[3] + e[2,1] + e[1]], QQ) + [v1*v2 + v1 + 5*v3] + """ + n = max(max((part[0] for part in f.support() if part), default=0) + for f in lf) + # the polynomial ring with no variables is not well supported, + # eg., gcd does not work + n = max(n, 1) + P = PolynomialRing(R, ["v%s" % a for a in range(1, n + 1)]) + if n == 1: + return [P({part.to_exp(n)[0]: c for part, c in f}) + for f in lf] + return [P({tuple(part.to_exp(n)): c for part, c in f}) + for f in lf] + + +def _from_polynomial(p, f): + """ + Return the polynomial as a symmetric function in the given + basis , where the `n`th variable corresponds to the symmetric + function`f[n]`. + + INPUT: + + - ``p`` -- a polynomial + - ``f`` -- a basis of the ring of symmetric functions + + .. SEEALSO:: + + :func:`_to_polynomials` + + EXAMPLES:: + + sage: from sage.combinat.sf.sfa import _to_polynomials, _from_polynomial + sage: e = SymmetricFunctions(QQ).e() + sage: p = _to_polynomials([5*e[3] + e[2,1] + e[1]], ZZ)[0]; p + v1*v2 + v1 + 5*v3 + sage: _from_polynomial(p, e) + e[1] + e[2, 1] + 5*e[3] + """ + n = p.parent().ngens() + if n == 1: + d = {_Partitions.from_exp([e]): c + for e, c in p.dict().items()} + else: + d = {_Partitions.from_exp(e): c + for e, c in p.iterator_exp_coeff(False)} + return f.element_class(f, d) diff --git a/src/sage/combinat/skew_partition.py b/src/sage/combinat/skew_partition.py index 33457e5ea5a..b9fd9b2792f 100644 --- a/src/sage/combinat/skew_partition.py +++ b/src/sage/combinat/skew_partition.py @@ -1989,4 +1989,3 @@ def __iter__(self): from sage.misc.persist import register_unpickle_override register_unpickle_override('sage.combinat.skew_partition', 'SkewPartition_class', SkewPartition) - diff --git a/src/sage/databases/findstat.py b/src/sage/databases/findstat.py index 5401cffb508..510ab2daf1c 100644 --- a/src/sage/databases/findstat.py +++ b/src/sage/databases/findstat.py @@ -2521,6 +2521,21 @@ def __iter__(self): for st in self._identifiers: yield FindStatStatistic(st) + def _an_element_(self): + """ + Return a FindStat statistic. + + EXAMPLES:: + + sage: findstat(domain="Permutations").an_element() # optional -- internet + St000001: The number of reduced words for a permutation. + """ + try: + return next(iter(self)) + except StopIteration: + from sage.categories.sets_cat import EmptySetError + raise EmptySetError + Element = FindStatStatistic @@ -3454,6 +3469,21 @@ def __iter__(self): for mp in self._identifiers: yield FindStatMap(mp) + def _an_element_(self): + """ + Return a FindStat map. + + EXAMPLES:: + + sage: findmap(domain="Dyck paths", codomain="Posets").an_element() # optional -- internet + Mp00232: parallelogram poset + """ + try: + return next(iter(self)) + except StopIteration: + from sage.categories.sets_cat import EmptySetError + raise EmptySetError + Element = FindStatMap diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py index 79a4b06ebd6..0e045aa323b 100644 --- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py @@ -5192,7 +5192,7 @@ def multiplier_spectra(self, n, formal=False, type='point', use_algebraic_closur number_field = True if K in FiniteFields(): finite_field = True - if not(number_field or finite_field): + if not (number_field or finite_field): raise NotImplementedError('Only implemented for number fields, QQbar, finite fields, and algebraic closures of finite fields') Kbar = K.algebraic_closure() if Kbar.has_coerce_map_from(K): diff --git a/src/sage/geometry/hyperplane_arrangement/plot.py b/src/sage/geometry/hyperplane_arrangement/plot.py index 9f89585578e..dc407a40ad3 100644 --- a/src/sage/geometry/hyperplane_arrangement/plot.py +++ b/src/sage/geometry/hyperplane_arrangement/plot.py @@ -103,9 +103,9 @@ sage: a.plot(hyperplane_labels=True,label_colors=['red','green','black']) # optional - sage.plot Graphics3d Object """ - from copy import copy from colorsys import hsv_to_rgb + from sage.misc.lazy_import import lazy_import lazy_import("sage.plot.plot3d.parametric_plot3d", "parametric_plot3d") lazy_import("sage.plot.plot3d.shapes2", "text3d") @@ -119,7 +119,7 @@ def plot(hyperplane_arrangement, **kwds): r""" - Return a plot of the hyperplane arrangement. + Return a plot of the hyperplane arrangement. If the arrangement is in 4 dimensions but inessential, a plot of the essentialization is returned. diff --git a/src/sage/geometry/newton_polygon.py b/src/sage/geometry/newton_polygon.py index dd3d58f58b5..4f253741ab7 100644 --- a/src/sage/geometry/newton_polygon.py +++ b/src/sage/geometry/newton_polygon.py @@ -272,7 +272,7 @@ def __pow__(self, exp, ignored=None): This Newton polygon scaled by a factor ``exp``. - NOTE:: + .. NOTE:: If ``self`` is the Newton polygon of a polynomial `f`, then ``self^exp`` is the Newton polygon of `f^{exp}`. diff --git a/src/sage/geometry/ribbon_graph.py b/src/sage/geometry/ribbon_graph.py index d2a8d7de63a..6cc269c6b99 100644 --- a/src/sage/geometry/ribbon_graph.py +++ b/src/sage/geometry/ribbon_graph.py @@ -1,9 +1,9 @@ r""" Ribbon Graphs -This file implements objects called *ribbon graphs*. These are graphs -together with a cyclic ordering of the darts adjacent to each -vertex. This data allows us to unambiguously "thicken" the ribbon +This file implements objects called *ribbon graphs*. These are graphs +together with a cyclic ordering of the darts adjacent to each +vertex. This data allows us to unambiguously "thicken" the ribbon graph to an orientable surface with boundary. Also, every orientable surface with non-empty boundary is the thickening of a ribbon graph. @@ -103,10 +103,10 @@ class RibbonGraph(SageObject, UniqueRepresentation): **Brief introduction** - Let `\Sigma` be an orientable surface with non-empty boundary and let - `\Gamma` be the topological realization of a graph that is embedded in + Let `\Sigma` be an orientable surface with non-empty boundary and let + `\Gamma` be the topological realization of a graph that is embedded in `\Sigma` in such a way that the graph is a strong deformation retract of - the surface. + the surface. Let `v(\Gamma)` be the set of vertices of `\Gamma`, suppose that these are white vertices. Now we mark black vertices in an interior point @@ -121,7 +121,7 @@ class RibbonGraph(SageObject, UniqueRepresentation): `\Gamma` and suppose that we enumerate the set `D(\Gamma)` and that it has `n` elements. - With the orientation of the surface and the embedding of the graph in + With the orientation of the surface and the embedding of the graph in the surface we can produce two permutations: - A permutation that we denote by `\sigma`. This permutation is a @@ -139,13 +139,13 @@ class RibbonGraph(SageObject, UniqueRepresentation): .. RUBRIC:: Abstract definition - Consider a graph `\Gamma` (not a priori embedded in any surface). - Now we can again consider one vertex in the interior of each edge + Consider a graph `\Gamma` (not a priori embedded in any surface). + Now we can again consider one vertex in the interior of each edge splitting each edge in two darts. We label the darts with numbers. - We say that a ribbon structure on `\Gamma` is a set of two + We say that a ribbon structure on `\Gamma` is a set of two permutations `(\sigma, \rho)`. Where `\sigma` is formed by as many - disjoint cycles as vertices had `\Gamma`. And each cycle is a + disjoint cycles as vertices had `\Gamma`. And each cycle is a cyclic ordering of the darts adjacent to a vertex. The permutation `\rho` just tell us which two darts belong to the same edge. @@ -210,7 +210,7 @@ class RibbonGraph(SageObject, UniqueRepresentation): sage: R2.sigma() (1,3,5,8)(2,4,6) - This example is constructed by taking the bipartite graph of + This example is constructed by taking the bipartite graph of type `(3,3)`:: sage: s3 = PermutationGroupElement('(1,2,3)(4,5,6)(7,8,9)(10,11,12)(13,14,15)(16,17,18)') @@ -384,7 +384,7 @@ def number_boundaries(self): sage: R1.number_boundaries() 1 - This example is constructed by taking the bipartite graph of + This example is constructed by taking the bipartite graph of type `(3,3)`:: sage: s2 = PermutationGroupElement('(1,2,3)(4,5,6)(7,8,9)(10,11,12)(13,14,15)(16,17,18)') @@ -409,7 +409,7 @@ def contract_edge(self, k): INPUT: - - ``k`` -- non-negative integer; the position in `\rho` of the + - ``k`` -- non-negative integer; the position in `\rho` of the transposition that is going to be contracted OUTPUT: @@ -441,7 +441,7 @@ def contract_edge(self, k): ValueError: the edge is a loop and cannot be contracted In this example, we consider a graph that has one edge ``(19,20)`` - such that one of its ends is a vertex of valency 1. This is + such that one of its ends is a vertex of valency 1. This is the vertex ``(20)`` that is not specified when defining `\sigma`. We contract precisely this edge and get a ribbon graph with no vertices of valency 1:: @@ -514,7 +514,7 @@ def extrude_edge(self, vertex, dart1, dart2): OUTPUT: - A ribbon graph resulting from extruding a new edge that + A ribbon graph resulting from extruding a new edge that pulls from ``vertex`` a new vertex that is, now, adjacent to all the darts from ``dart1``to ``dart2`` (not including ``dart2``) in the cyclic ordering given by the cycle corresponding @@ -553,7 +553,7 @@ def extrude_edge(self, vertex, dart1, dart2): (1,2)(3,4)(5,6)(7,8) In the following example we first extrude one edge from a vertex - of valency 3 generating a new vertex of valency 2. Then we + of valency 3 generating a new vertex of valency 2. Then we extrude a new edge from this vertex of valency 2:: sage: s1 = PermutationGroupElement('(1,3,5)(2,4,6)') @@ -674,7 +674,7 @@ def boundary(self): OUTPUT: - A list of lists. The number of inner lists is the number of + A list of lists. The number of inner lists is the number of boundary components of the surface. Each list in the list consists of an ordered tuple of numbers, each number comes from the number assigned to the corresponding dart before @@ -878,7 +878,7 @@ def make_generic(self): def homology_basis(self): r""" - Return an oriented basis of the first homology group of the + Return an oriented basis of the first homology group of the graph. OUTPUT: @@ -1098,8 +1098,8 @@ def make_ribbon(g, r): OUTPUT: - - a ribbon graph that has 2 vertices (two non-trivial cycles - in its sigma permutation) of valency `2g + r` and it has + - a ribbon graph that has 2 vertices (two non-trivial cycles + in its sigma permutation) of valency `2g + r` and it has `2g + r` edges (and hence `4g + 2r` darts) EXAMPLES:: diff --git a/src/sage/geometry/triangulation/point_configuration.py b/src/sage/geometry/triangulation/point_configuration.py index 1bf933700c9..f970a5faf4a 100644 --- a/src/sage/geometry/triangulation/point_configuration.py +++ b/src/sage/geometry/triangulation/point_configuration.py @@ -1865,7 +1865,7 @@ def contained_simplex(self, large=True, initial_point=None, point_order=None): sage: pc.contained_simplex() (P(-1, -1), P(1, 1), P(0, 1)) sage: pc.contained_simplex(point_order = [pc[1],pc[3],pc[4],pc[2],pc[0]]) - (P(0, 1), P(1, 1), P(-1, -1)) + (P(0, 1), P(1, 1), P(-1, -1)) Lower-dimensional example:: diff --git a/src/sage/interfaces/abc.py b/src/sage/interfaces/abc.py new file mode 100644 index 00000000000..ab10a01f819 --- /dev/null +++ b/src/sage/interfaces/abc.py @@ -0,0 +1,3 @@ +class GapElement: + + pass diff --git a/src/sage/interfaces/gap.py b/src/sage/interfaces/gap.py index c80a847d7e9..7ae1792e9de 100644 --- a/src/sage/interfaces/gap.py +++ b/src/sage/interfaces/gap.py @@ -202,6 +202,8 @@ from sage.interfaces.tab_completion import ExtraTabCompletion from sage.structure.element import ModuleElement +import sage.interfaces.abc + import re import os import io @@ -1524,7 +1526,7 @@ def gap_reset_workspace(max_workspace_size=None, verbose=False): @instancedoc -class GapElement(GapElement_generic): +class GapElement(GapElement_generic, sage.interfaces.abc.GapElement): def __getitem__(self, n): """ EXAMPLES:: @@ -1633,18 +1635,26 @@ def _instancedoc_(self): def is_GapElement(x): """ - Returns True if x is a GapElement. + Return True if ``x`` is a :class:`GapElement` + + This function is deprecated; use :func:`isinstance` + (of :class:`sage.interfaces.abc.GapElement`) instead. EXAMPLES:: sage: from sage.interfaces.gap import is_GapElement sage: is_GapElement(gap(2)) + doctest:...: DeprecationWarning: the function is_GapElement is deprecated; use isinstance(x, sage.interfaces.abc.GapElement) instead + See https://trac.sagemath.org/34823 for details. True sage: is_GapElement(2) False """ + from sage.misc.superseded import deprecation + deprecation(34823, "the function is_GapElement is deprecated; use isinstance(x, sage.interfaces.abc.GapElement) instead") return isinstance(x, GapElement) + def gfq_gap_to_sage(x, F): """ INPUT: diff --git a/src/sage/libs/ecl.pyx b/src/sage/libs/ecl.pyx index 2cfac57f544..8f46570313d 100644 --- a/src/sage/libs/ecl.pyx +++ b/src/sage/libs/ecl.pyx @@ -429,16 +429,14 @@ cdef cl_object python_to_ecl(pyobj, bint read_strings) except NULL: return ECL_NIL elif pyobj is None: return ECL_NIL - elif isinstance(pyobj,long): - if pyobj >= MOST_NEGATIVE_FIXNUM and pyobj <= MOST_POSITIVE_FIXNUM: + elif isinstance(pyobj, int): + if MOST_NEGATIVE_FIXNUM <= pyobj <= MOST_POSITIVE_FIXNUM: return ecl_make_integer(pyobj) else: return python_to_ecl(Integer(pyobj), read_strings) - elif isinstance(pyobj,int): - return ecl_make_integer(pyobj) - elif isinstance(pyobj,float): + elif isinstance(pyobj, float): return ecl_make_doublefloat(pyobj) - elif isinstance(pyobj,unicode): + elif isinstance(pyobj, unicode): try: s = str_to_bytes(pyobj, 'ascii') except UnicodeEncodeError: @@ -452,22 +450,22 @@ cdef cl_object python_to_ecl(pyobj, bint read_strings) except NULL: return ecl_safe_funcall(read_from_string_clobj, o) else: return o - elif isinstance(pyobj,bytes): + elif isinstance(pyobj, bytes): s=pyobj if read_strings: return ecl_safe_read_string(s) else: return ecl_cstring_to_base_string_or_nil(s) - elif isinstance(pyobj,Integer): + elif isinstance(pyobj, Integer): if pyobj >= MOST_NEGATIVE_FIXNUM and pyobj <= MOST_POSITIVE_FIXNUM: return ecl_make_integer(pyobj) else: return ecl_bignum_from_mpz( (pyobj).value ) - elif isinstance(pyobj,Rational): + elif isinstance(pyobj, Rational): return ecl_make_ratio( python_to_ecl( (pyobj).numerator(), read_strings ), python_to_ecl( (pyobj).denominator(), read_strings )) - elif isinstance(pyobj,EclObject): + elif isinstance(pyobj, EclObject): return (pyobj).obj elif isinstance(pyobj, list): L = ECL_NIL diff --git a/src/sage/libs/eclib/interface.py b/src/sage/libs/eclib/interface.py index 119a68ba34d..0faee97661e 100644 --- a/src/sage/libs/eclib/interface.py +++ b/src/sage/libs/eclib/interface.py @@ -731,9 +731,9 @@ class mwrank_MordellWeil(SageObject): Reducing saturation bound from given value 20 to computed index bound 3 Tamagawa index primes are [ 2 ] Checking saturation at [ 2 3 ] - Checking 2-saturation + Checking 2-saturation Points were proved 2-saturated (max q used = 7) - Checking 3-saturation + Checking 3-saturation Points were proved 3-saturated (max q used = 7) done P2 = [-2:3:1] is generator number 2 @@ -741,10 +741,10 @@ class mwrank_MordellWeil(SageObject): Reducing saturation bound from given value 20 to computed index bound 4 Tamagawa index primes are [ 2 ] Checking saturation at [ 2 3 ] - Checking 2-saturation + Checking 2-saturation possible kernel vector = [1,1] This point may be in 2E(Q): [14:-52:1] - ...and it is! + ...and it is! Replacing old generator #1 with new generator [1:-1:1] Reducing index bound from 4 to 2 Points have successfully been 2-saturated (max q used = 7) @@ -756,9 +756,9 @@ class mwrank_MordellWeil(SageObject): Reducing saturation bound from given value 20 to computed index bound 3 Tamagawa index primes are [ 2 ] Checking saturation at [ 2 3 ] - Checking 2-saturation + Checking 2-saturation Points were proved 2-saturated (max q used = 11) - Checking 3-saturation + Checking 3-saturation Points were proved 3-saturated (max q used = 13) done, index = 1. P4 = [-1:3:1] = -1*P1 + -1*P2 + -1*P3 (mod torsion) @@ -911,10 +911,10 @@ def process(self, v, saturation_bound=0): The resulting points may not be p-saturated for p between this and the computed index bound 93 Tamagawa index primes are [ 2 ] Checking saturation at [ 2 ] - Checking 2-saturation + Checking 2-saturation possible kernel vector = [1,0,0] This point may be in 2E(Q): [1547:-2967:343] - ...and it is! + ...and it is! Replacing old generator #1 with new generator [-2:3:1] Reducing index bound from 93 to 46 Points have successfully been 2-saturated (max q used = 11) @@ -933,12 +933,12 @@ def process(self, v, saturation_bound=0): The resulting points may not be p-saturated for p between this and the computed index bound 46 Tamagawa index primes are [ 2 ] Checking saturation at [ 2 3 ] - Checking 2-saturation + Checking 2-saturation Points were proved 2-saturated (max q used = 11) - Checking 3-saturation + Checking 3-saturation possible kernel vector = [0,1,0] This point may be in 3E(Q): [2707496766203306:864581029138191:2969715140223272] - ...and it is! + ...and it is! Replacing old generator #2 with new generator [-14:25:8] Reducing index bound from 46 to 15 Points have successfully been 3-saturated (max q used = 13) @@ -957,14 +957,14 @@ def process(self, v, saturation_bound=0): The resulting points may not be p-saturated for p between this and the computed index bound 15 Tamagawa index primes are [ 2 ] Checking saturation at [ 2 3 5 ] - Checking 2-saturation + Checking 2-saturation Points were proved 2-saturated (max q used = 11) - Checking 3-saturation + Checking 3-saturation Points were proved 3-saturated (max q used = 13) - Checking 5-saturation + Checking 5-saturation possible kernel vector = [0,0,1] This point may be in 5E(Q): [-13422227300:-49322830557:12167000000] - ...and it is! + ...and it is! Replacing old generator #3 with new generator [1:-1:1] Reducing index bound from 15 to 3 Points have successfully been 5-saturated (max q used = 71) @@ -981,9 +981,9 @@ def process(self, v, saturation_bound=0): saturating basis...Saturation index bound (for points of good reduction) = 3 Tamagawa index primes are [ 2 ] Checking saturation at [ 2 3 ] - Checking 2-saturation + Checking 2-saturation Points were proved 2-saturated (max q used = 11) - Checking 3-saturation + Checking 3-saturation Points were proved 3-saturated (max q used = 13) done (True, 1, '[ ]') @@ -1329,6 +1329,5 @@ def points(self): P4 = [12:35:27] = 1*P1 + -1*P2 + -1*P3 (mod torsion) sage: EQ.points() [[1, -1, 1], [-2, 3, 1], [-14, 25, 8]] - """ return self.__mw.getbasis() diff --git a/src/sage/libs/flint/flint_ntl_wrap.h b/src/sage/libs/flint/flint_ntl_wrap.h index 841d990817d..c0ac48af7aa 100644 --- a/src/sage/libs/flint/flint_ntl_wrap.h +++ b/src/sage/libs/flint/flint_ntl_wrap.h @@ -8,7 +8,7 @@ #include -/* Save previous definition of ulong if any, as zn_poly and pari also use it */ +/* Save previous definition of ulong if any, as pari also uses it */ #pragma push_macro("ulong") #undef ulong diff --git a/src/sage/libs/flint/flint_wrap.h b/src/sage/libs/flint/flint_wrap.h index ae02e473a95..1bfb23d0182 100644 --- a/src/sage/libs/flint/flint_wrap.h +++ b/src/sage/libs/flint/flint_wrap.h @@ -1,8 +1,8 @@ #ifndef SAGE_FLINT_WRAP_H #define SAGE_FLINT_WRAP_H -/* Using flint headers together in the same module as headers from some other - * libraries (zn_poly, pari, possibly others) as it defines the macros ulong - * and slong all over the place. +/* Using flint headers together in the same module as headers from + * some other libraries (pari, possibly others) as it defines the + * macros ulong and slong all over the place. * * What's worse is they are defined to types from GMP (mp_limb_t and * mp_limb_signed_t respectively) which themselves can have system-dependent @@ -16,7 +16,7 @@ #include -/* Save previous definition of ulong if any, as zn_poly and pari also use it */ +/* Save previous definition of ulong if any, as pari also uses it */ /* Should work on GCC, clang, MSVC */ #pragma push_macro("ulong") #undef ulong diff --git a/src/sage/libs/linkages/padics/relaxed/flint.pxi b/src/sage/libs/linkages/padics/relaxed/flint.pxi index 3422f3ff328..5955ea23e18 100644 --- a/src/sage/libs/linkages/padics/relaxed/flint.pxi +++ b/src/sage/libs/linkages/padics/relaxed/flint.pxi @@ -259,7 +259,7 @@ cdef inline void digit_smallest(cdigit res, cdigit carry, cdigit a, PowComputer_ - ``a`` -- a ``cdigit``, the digit to reduce - ``prime_pow`` -- the PowComputer for the ring - NOTE:: + .. NOTE:: This function assumes that ``a`` is always reduced in the usual sense, that is belongs to the range `[0, p-1]`. @@ -383,7 +383,7 @@ cdef inline void element_get_slice(fmpz_poly_t res, fmpz_poly_t x, slong start, - ``start`` -- an integer, the start position of the slice - ``length`` -- an integer, the length of the slice - NOTE:: + .. NOTE:: The function only sets up a pointer to the requested slice (the slice is not copied). Hence any future modification diff --git a/src/sage/libs/mpmath/ext_impl.pyx b/src/sage/libs/mpmath/ext_impl.pyx index f9b0ff2d42c..15557561806 100644 --- a/src/sage/libs/mpmath/ext_impl.pyx +++ b/src/sage/libs/mpmath/ext_impl.pyx @@ -44,10 +44,8 @@ from sage.rings.integer cimport Integer from sage.libs.gmp.pylong cimport * cdef mpz_set_integer(mpz_t v, x): - if isinstance(x, long): + if isinstance(x, int): mpz_set_pylong(v, x) - elif isinstance(x, int): - mpz_set_si(v, PyInt_AS_LONG(x)) elif isinstance(x, Integer): mpz_set(v, (x).value) else: diff --git a/src/sage/libs/ntl/ntl_ZZ.pyx b/src/sage/libs/ntl/ntl_ZZ.pyx index 783bceb4121..48a329f3055 100644 --- a/src/sage/libs/ntl/ntl_ZZ.pyx +++ b/src/sage/libs/ntl/ntl_ZZ.pyx @@ -85,11 +85,8 @@ cdef class ntl_ZZ(): """ if isinstance(v, ntl_ZZ): self.x = (v).x - elif isinstance(v, long): - # Note: This case should be first since on Python 3 long is int - PyLong_to_ZZ(&self.x, v) elif isinstance(v, int): - ZZ_conv_from_int(self.x, PyInt_AS_LONG(v)) + PyLong_to_ZZ(&self.x, v) elif isinstance(v, Integer): self.set_from_sage_int(v) elif v is not None: diff --git a/src/sage/libs/ntl/ntl_ZZ_p.pyx b/src/sage/libs/ntl/ntl_ZZ_p.pyx index 469d62f2812..b5511abb891 100644 --- a/src/sage/libs/ntl/ntl_ZZ_p.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_p.pyx @@ -117,11 +117,9 @@ cdef class ntl_ZZ_p(): if v is not None: if isinstance(v, ntl_ZZ_p): self.x = (v).x - elif isinstance(v, long): + elif isinstance(v, int): PyLong_to_ZZ(&temp, v) self.x = ZZ_to_ZZ_p(temp) - elif isinstance(v, int): - self.x = int_to_ZZ_p(v) elif isinstance(v, Integer): mpz_to_ZZ(&temp, (v).value) self.x = ZZ_to_ZZ_p(temp) diff --git a/src/sage/libs/ntl/ntl_ZZ_pE.pyx b/src/sage/libs/ntl/ntl_ZZ_pE.pyx index 9e2d06bb58e..ed45e34f0be 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pE.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_pE.pyx @@ -117,11 +117,9 @@ cdef class ntl_ZZ_pE(): tmp_zzpx = ntl_ZZ_pX(v, self.c.pc) self.c.restore_c() # allocating tmp_zzpx can change the current modulus trac #25790 self.x = ZZ_pX_to_ZZ_pE(tmp_zzpx.x) - elif isinstance(v, long): + elif isinstance(v, int): PyLong_to_ZZ(&temp, v) self.x = ZZ_to_ZZ_pE(temp) - elif isinstance(v, int): - self.x = long_to_ZZ_pE(v) elif isinstance(v, ntl_ZZ_p): self.x = ZZ_p_to_ZZ_pE((v).x) elif isinstance(v, ntl_ZZ): diff --git a/src/sage/libs/ntl/ntl_lzz_p.pyx b/src/sage/libs/ntl/ntl_lzz_p.pyx index 26575dd99ec..983e3056404 100644 --- a/src/sage/libs/ntl/ntl_lzz_p.pyx +++ b/src/sage/libs/ntl/ntl_lzz_p.pyx @@ -139,7 +139,7 @@ cdef class ntl_zz_p(): self.c = modulus elif isinstance(modulus, Integer): self.c = ntl_zz_pContext(modulus) - elif isinstance(modulus, long): + elif isinstance(modulus, int): self.c = ntl_zz_pContext(modulus) else: try: diff --git a/src/sage/libs/ntl/ntl_lzz_pX.pyx b/src/sage/libs/ntl/ntl_lzz_pX.pyx index 50d9447b295..98bd0d58658 100644 --- a/src/sage/libs/ntl/ntl_lzz_pX.pyx +++ b/src/sage/libs/ntl/ntl_lzz_pX.pyx @@ -155,7 +155,7 @@ cdef class ntl_zz_pX(): self.c = modulus elif isinstance(modulus, Integer): self.c = ntl_zz_pContext(modulus) - elif isinstance(modulus, long): + elif isinstance(modulus, int): self.c = ntl_zz_pContext(modulus) else: try: diff --git a/src/sage/libs/pari/tests.py b/src/sage/libs/pari/tests.py index e5a2aa25172..472b1c2f66e 100644 --- a/src/sage/libs/pari/tests.py +++ b/src/sage/libs/pari/tests.py @@ -1767,7 +1767,7 @@ sage: eta1 = e.elleta(precision=150)[0] sage: eta1.sage() 3.605463601432652085915820564207726774810268996598024745444380641429820491740 # 64-bit - 3.60546360143265208591582056420772677481026899659802474544 # 32-bit + 3.60546360143265208591582056420772677481026899659802474544 # 32-bit sage: from cypari2 import Pari sage: pari = Pari() diff --git a/src/sage/logic/logic.py b/src/sage/logic/logic.py index 769fae29289..13a45b337ff 100644 --- a/src/sage/logic/logic.py +++ b/src/sage/logic/logic.py @@ -318,7 +318,7 @@ def combine(self, statement1, statement2): 'CPAREN', 'CPAREN'], {'a': 'False', 'b': 'False'}, - ['a', 'b', 'b']] + ['a', 'b', 'b']] """ toks = ['OPAREN'] + statement1[0] + ['OR'] + statement2[0] + ['CPAREN'] variables = dict(statement1[1]) diff --git a/src/sage/manifolds/catalog.py b/src/sage/manifolds/catalog.py index e71faca3072..bb09ed8885d 100644 --- a/src/sage/manifolds/catalog.py +++ b/src/sage/manifolds/catalog.py @@ -262,11 +262,12 @@ def Torus(R=2, r=1, names=None): M.induced_metric() return M + def RealProjectiveSpace(dim=2): r""" Generate projective space of dimension ``dim`` over the reals. - This is the topological space of lines through the origin in + This is the topological space of lines through the origin in `\RR^{d+1}`. The standard atlas consists of `d+2` charts, which sends the set `U_i = \{[x_1, x_2, \ldots, x_{d+1}] : x_i \neq 0 \}` to `k^{d}` by dividing by `x_i` and omitting the `i`th coordinate diff --git a/src/sage/manifolds/differentiable/manifold.py b/src/sage/manifolds/differentiable/manifold.py index d650d4eb712..e674ad8db05 100644 --- a/src/sage/manifolds/differentiable/manifold.py +++ b/src/sage/manifolds/differentiable/manifold.py @@ -3957,7 +3957,7 @@ def affine_connection(self, name, latex_name=None): AffineConnection return AffineConnection(self, name, latex_name) - def metric(self, name: str, signature: Optional[int] = None, + def metric(self, name: str, signature: Optional[int] = None, latex_name: Optional[str] = None, dest_map: Optional[DiffMap] = None) -> PseudoRiemannianMetric: r""" diff --git a/src/sage/manifolds/differentiable/symplectic_form.py b/src/sage/manifolds/differentiable/symplectic_form.py index 482f9527ba0..c72f50b70fa 100644 --- a/src/sage/manifolds/differentiable/symplectic_form.py +++ b/src/sage/manifolds/differentiable/symplectic_form.py @@ -498,7 +498,7 @@ def poisson_bracket( def volume_form(self, contra: int = 0) -> TensorField: r""" - Liouville volume form `\frac{1}{n!}\omega^n` associated with the + Liouville volume form `\frac{1}{n!}\omega^n` associated with the symplectic form `\omega`, where `2n` is the dimension of the manifold. INPUT: diff --git a/src/sage/matrix/matrix_integer_dense_saturation.py b/src/sage/matrix/matrix_integer_dense_saturation.py index 01621f6844f..a7ce81fc86a 100644 --- a/src/sage/matrix/matrix_integer_dense_saturation.py +++ b/src/sage/matrix/matrix_integer_dense_saturation.py @@ -103,12 +103,12 @@ def random_sublist_of_size(k, n): w = random_sublist_of_size(k, k - n) m = set(w) w = [z for z in range(k) if z not in m] - assert(len(w) == n) + assert len(w) == n return w randrange = current_randstate().python_random().randrange - w = set([]) + w = set() while len(w) < n: z = randrange(k) if z not in w: diff --git a/src/sage/matrix/matrix_space.py b/src/sage/matrix/matrix_space.py index cfb8ce85931..e889cee7905 100644 --- a/src/sage/matrix/matrix_space.py +++ b/src/sage/matrix/matrix_space.py @@ -2467,39 +2467,39 @@ def _test_trivial_matrices_inverse(ring, sparse=True, implementation=None, check # Check that the empty 0x0 matrix is it's own inverse with det=1. ms00 = MatrixSpace(ring, 0, 0, sparse=sparse) m00 = ms00(0) - assert(m00.determinant() == ring(1)) - assert(m00.is_invertible()) - assert(m00.inverse() == m00) + assert m00.determinant() == ring(1) + assert m00.is_invertible() + assert m00.inverse() == m00 if checkrank: - assert(m00.rank() == 0) + assert m00.rank() == 0 # Check that the empty 0x3 and 3x0 matrices are not invertible and that # computing the determinant raise the proper exception. for ms0 in [MatrixSpace(ring, 0, 3, sparse=sparse), MatrixSpace(ring, 3, 0, sparse=sparse)]: mn0 = ms0(0) - assert(not mn0.is_invertible()) + assert not mn0.is_invertible() try: d = mn0.determinant() print(d) res = False except ValueError: res = True - assert(res) + assert res try: mn0.inverse() res = False except ArithmeticError: res = True - assert(res) + assert res if checkrank: - assert(mn0.rank() == 0) + assert mn0.rank() == 0 # Check that the null 1x1 matrix is not invertible and that det=0 ms1 = MatrixSpace(ring, 1, 1, sparse=sparse) m0 = ms1(0) - assert(not m0.is_invertible()) - assert(m0.determinant() == ring(0)) + assert not m0.is_invertible() + assert m0.determinant() == ring(0) try: m0.inverse() res = False @@ -2507,18 +2507,18 @@ def _test_trivial_matrices_inverse(ring, sparse=True, implementation=None, check # FIXME: Make pynac throw a ZeroDivisionError on division by # zero instead of a runtime Error res = True - assert(res) + assert res if checkrank: - assert(m0.rank() == 0) + assert m0.rank() == 0 # Check that the identity 1x1 matrix is its own inverse with det=1 m1 = ms1(1) - assert(m1.is_invertible()) - assert(m1.determinant() == ring(1)) + assert m1.is_invertible() + assert m1.determinant() == ring(1) inv = m1.inverse() - assert(inv == m1) + assert inv == m1 if checkrank: - assert(m1.rank() == 1) + assert m1.rank() == 1 test_trivial_matrices_inverse = deprecated_function_alias(33612, _test_trivial_matrices_inverse) diff --git a/src/sage/matrix/operation_table.py b/src/sage/matrix/operation_table.py index 13f0a88822a..ea2c3aec203 100644 --- a/src/sage/matrix/operation_table.py +++ b/src/sage/matrix/operation_table.py @@ -397,7 +397,7 @@ def __init__(self, S, operation, names='letters', elements=None): # Note: there exist listable infinite objects (like ZZ) if (elements is None): if hasattr(S, 'is_finite'): - if not(S.is_finite()): + if not S.is_finite(): raise ValueError('%s is infinite' % S) try: try: @@ -411,7 +411,7 @@ def __init__(self, S, operation, names='letters', elements=None): try: for e in elements: coerced = S(e) - if not(coerced in elems): + if coerced not in elems: elems.append(coerced) except Exception: raise TypeError('unable to coerce %s into %s' % (e, S)) diff --git a/src/sage/misc/latex_standalone.py b/src/sage/misc/latex_standalone.py index cdfdd6b6cbb..2e6874dde77 100644 --- a/src/sage/misc/latex_standalone.py +++ b/src/sage/misc/latex_standalone.py @@ -346,7 +346,7 @@ def _repr_(self): It contains the first few and last few lines of the content. - NOTE:: + .. NOTE:: Use ``print(t)`` or ``str(t)`` to show or get the full content. diff --git a/src/sage/misc/package.py b/src/sage/misc/package.py index 849ee71f3fb..975ddc50766 100644 --- a/src/sage/misc/package.py +++ b/src/sage/misc/package.py @@ -26,8 +26,7 @@ 'alabaster', 'arb', ... - 'zlib', - 'zn_poly'] + 'zlib'] Functions --------- @@ -265,7 +264,7 @@ def list_packages(*pkg_types: str, pkg_sources: List[str] = ['normal', 'pip', 's 'arb', 'babel', ... - 'zn_poly'] + 'zlib'] sage: sage_conf_info = L['sage_conf'] # optional - sage_spkg sage: sage_conf_info.type # optional - sage_spkg 'standard' @@ -498,8 +497,8 @@ def package_versions(package_type, local=False): sage: std = package_versions('standard', local=True) # optional - sage_spkg sage: 'gap' in std # optional - sage_spkg True - sage: std['zn_poly'] # optional - sage_spkg, random - ('0.9.p12', '0.9.p12') + sage: std['zlib'] # optional - sage_spkg, random + ('1.2.11.p0', '1.2.11.p0') """ return {pkg.name: (pkg.installed_version, pkg.remote_version) for pkg in list_packages(package_type, local=local).values()} diff --git a/src/sage/modular/abvar/homspace.py b/src/sage/modular/abvar/homspace.py index 4698e509f86..adf9889bebe 100644 --- a/src/sage/modular/abvar/homspace.py +++ b/src/sage/modular/abvar/homspace.py @@ -350,7 +350,7 @@ def __call__(self, M, **kwds): elif M.domain() == self.domain() and M.codomain() == self.codomain(): M = M.matrix() else: - raise ValueError("cannot convert %s into %s" % (M, self)) + raise ValueError("cannot convert %s into %s" % (M, self)) elif is_Matrix(M): if M.base_ring() != ZZ: M = M.change_ring(ZZ) diff --git a/src/sage/modular/modsym/p1list.pyx b/src/sage/modular/modsym/p1list.pyx index 880462748cf..c5da10a234a 100644 --- a/src/sage/modular/modsym/p1list.pyx +++ b/src/sage/modular/modsym/p1list.pyx @@ -1,4 +1,4 @@ -# distutils: libraries = gmp zn_poly +# distutils: libraries = gmp # distutils: extra_compile_args = -D_XPG6 r""" diff --git a/src/sage/modular/pollack_stevens/dist.pyx b/src/sage/modular/pollack_stevens/dist.pyx index c52b9db5f0a..3261d09d2c2 100644 --- a/src/sage/modular/pollack_stevens/dist.pyx +++ b/src/sage/modular/pollack_stevens/dist.pyx @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# distutils: libraries = gmp zn_poly +# distutils: libraries = gmp # distutils: extra_compile_args = -D_XPG6 """ `p`-adic distributions spaces diff --git a/src/sage/monoids/free_monoid_element.py b/src/sage/monoids/free_monoid_element.py index f23dba93b45..23d2a8abc66 100644 --- a/src/sage/monoids/free_monoid_element.py +++ b/src/sage/monoids/free_monoid_element.py @@ -149,7 +149,7 @@ def _latex_(self): \alpha b sage: latex(b*alpha) b \alpha - sage: "%s"%latex(alpha*b) + sage: "%s" % latex(alpha*b) '\\alpha b' """ s = "" @@ -159,10 +159,10 @@ def _latex_(self): g = x[int(v[i][0])] e = v[i][1] if e == 1: - s += "%s "%(g,) + s += "%s " % (g,) else: - s += "%s^{%s}"%(g,e) - s = s.rstrip(" ") # strip the trailing whitespace caused by adding a space after each element name + s += "%s^{%s}" % (g, e) + s = s.rstrip(" ") # strip the trailing whitespace caused by adding a space after each element name if len(s) == 0: s = "1" return s diff --git a/src/sage/numerical/backends/cvxopt_backend_test.py b/src/sage/numerical/backends/cvxopt_backend_test.py index 0e7227940c1..6029221fda2 100644 --- a/src/sage/numerical/backends/cvxopt_backend_test.py +++ b/src/sage/numerical/backends/cvxopt_backend_test.py @@ -1,14 +1,16 @@ import pytest + from sage.structure.sage_object import SageObject from sage.numerical.backends.generic_backend_test import GenericBackendTests from sage.numerical.backends.generic_backend import GenericBackend from sage.numerical.mip import MixedIntegerLinearProgram + class TestCVXOPTBackend(GenericBackendTests): @pytest.fixture def backend(self) -> GenericBackend: - return MixedIntegerLinearProgram(solver="CVXOPT").get_backend() + return MixedIntegerLinearProgram(solver="CVXOPT").get_backend() def test_sage_unittest_testsuite(self, sage_object: SageObject): # TODO: Remove this test as soon as all old test methods are migrated diff --git a/src/sage/numerical/backends/glpk_backend_test.py b/src/sage/numerical/backends/glpk_backend_test.py index ec37cd25f36..b41b1ae80c8 100644 --- a/src/sage/numerical/backends/glpk_backend_test.py +++ b/src/sage/numerical/backends/glpk_backend_test.py @@ -1,10 +1,12 @@ import pytest + from sage.numerical.backends.generic_backend_test import GenericBackendTests from sage.numerical.backends.generic_backend import GenericBackend from sage.numerical.mip import MixedIntegerLinearProgram + class TestGLPKBackend(GenericBackendTests): @pytest.fixture def backend(self) -> GenericBackend: - return MixedIntegerLinearProgram(solver="GLPK").get_backend() + return MixedIntegerLinearProgram(solver="GLPK").get_backend() diff --git a/src/sage/numerical/backends/ppl_backend_test.py b/src/sage/numerical/backends/ppl_backend_test.py index ac241275ee2..852c3be82c1 100644 --- a/src/sage/numerical/backends/ppl_backend_test.py +++ b/src/sage/numerical/backends/ppl_backend_test.py @@ -1,10 +1,12 @@ import pytest + from sage.numerical.backends.generic_backend_test import GenericBackendTests from sage.numerical.backends.generic_backend import GenericBackend from sage.numerical.mip import MixedIntegerLinearProgram + class TestPPLBackend(GenericBackendTests): @pytest.fixture def backend(self) -> GenericBackend: - return MixedIntegerLinearProgram(solver="PPL").get_backend() + return MixedIntegerLinearProgram(solver="PPL").get_backend() diff --git a/src/sage/numerical/linear_tensor_constraints.py b/src/sage/numerical/linear_tensor_constraints.py index 6535867f8c8..24f94f3b3d6 100644 --- a/src/sage/numerical/linear_tensor_constraints.py +++ b/src/sage/numerical/linear_tensor_constraints.py @@ -97,7 +97,7 @@ def LinearTensorConstraintsParent(linear_functions_parent): sage: LF = LinearFunctionsParent(QQ) sage: LT = LinearTensorParent(QQ^2, LF) sage: LinearTensorConstraintsParent(LT) - Linear constraints in the tensor product of Vector space of dimension 2 + Linear constraints in the tensor product of Vector space of dimension 2 over Rational Field and Linear functions over Rational Field """ return LinearTensorConstraintsParent_class(linear_functions_parent) @@ -215,7 +215,7 @@ def lhs(self): sage: mip. = MixedIntegerLinearProgram() sage: (x[0] * vector([1,2]) == 0).lhs() - (1.0, 2.0)*x_0 + (1.0, 2.0)*x_0 """ return self._lhs @@ -250,7 +250,7 @@ def _ascii_art_(self): sage: mip. = MixedIntegerLinearProgram() sage: ascii_art(x[0] * vector([1,2]) >= 0) (0.0, 0.0) <= (1.0, 2.0)*x_0 - sage: ascii_art(x[0] * matrix([[1,2],[3,4]]) >= 0) + sage: ascii_art(x[0] * matrix([[1,2],[3,4]]) >= 0) [0 0] <= [x_0 2*x_0] [0 0] [3*x_0 4*x_0] """ @@ -313,7 +313,7 @@ class LinearTensorConstraintsParent_class(Parent): sage: p = MixedIntegerLinearProgram() sage: LT = p.linear_functions_parent().tensor(RDF^2); LT - Tensor product of Vector space of dimension 2 over Real Double + Tensor product of Vector space of dimension 2 over Real Double Field and Linear functions over Real Double Field sage: from sage.numerical.linear_tensor_constraints import LinearTensorConstraintsParent sage: LTC = LinearTensorConstraintsParent(LT); LTC @@ -342,7 +342,7 @@ def __init__(self, linear_tensor_parent): sage: LT = LinearTensorParent(RDF^2, LF) sage: from sage.numerical.linear_tensor_constraints import LinearTensorConstraintsParent sage: LinearTensorConstraintsParent(LT) - Linear constraints in the tensor product of Vector space of + Linear constraints in the tensor product of Vector space of dimension 2 over Real Double Field and Linear functions over Real Double Field """ @@ -399,7 +399,7 @@ def _repr_(self): sage: ieq = (x[0] * vector([1,2]) >= 0) sage: ieq.parent() # indirect doctests Linear constraints in the tensor product of Vector space of - dimension 2 over Real Double Field and Linear functions over + dimension 2 over Real Double Field and Linear functions over Real Double Field """ return 'Linear constraints in the tensor product of {0} and {1}'.format( diff --git a/src/sage/parallel/decorate.py b/src/sage/parallel/decorate.py index c14518af570..34cb4860d36 100644 --- a/src/sage/parallel/decorate.py +++ b/src/sage/parallel/decorate.py @@ -23,12 +23,12 @@ def normalize_input(a): INPUT: - - ``a`` -- object + - ``a`` -- object OUTPUT: - - ``args`` -- tuple - - ``kwds`` -- dictionary + - ``args`` -- tuple + - ``kwds`` -- dictionary EXAMPLES:: @@ -41,7 +41,7 @@ def normalize_input(a): sage: sage.parallel.decorate.normalize_input( 5 ) ((5,), {}) """ - if isinstance(a, tuple) and len(a) == 2 and isinstance(a[0],tuple) and isinstance(a[1],dict): + if isinstance(a, tuple) and len(a) == 2 and isinstance(a[0], tuple) and isinstance(a[1], dict): return a elif isinstance(a, tuple): return (a, {}) @@ -97,11 +97,11 @@ def __call__(self, f): INPUT: - - ``f`` -- Python callable object or function + - ``f`` -- Python callable object or function OUTPUT: - - Decorated version of ``f`` + - Decorated version of ``f`` EXAMPLES:: @@ -131,8 +131,8 @@ def __init__(self, parallel, func): """ .. note:: - This is typically accessed indirectly through - :meth:`Parallel.__call__`. + This is typically accessed indirectly through + :meth:`Parallel.__call__`. INPUT: @@ -159,13 +159,11 @@ def __call__(self, *args, **kwds): 4 sage: sorted(pf([2,3])) [(((2,), {}), 4), (((3,), {}), 9)] - """ - if len(args) > 0 and isinstance(args[0], (list, -types.GeneratorType)): + """ + if len(args) > 0 and isinstance(args[0], (list, types.GeneratorType)): return self.parallel.p_iter(self.func, (normalize_input(a) -for a in args[0])) - else: - return self.func(*args, **kwds) + for a in args[0])) + return self.func(*args, **kwds) def __get__(self, instance, owner): """ @@ -174,7 +172,7 @@ def __get__(self, instance, owner): .. note:: - This is the key to fixing :trac:`11461`. + This is the key to fixing :trac:`11461`. EXAMPLES: @@ -217,14 +215,14 @@ def __get__(self, instance, owner): [(((2,), {}), 4), (((3,), {}), 9)] """ try: - #If this ParallelFunction object is accessed as an - #attribute of a class or instance, the underlying function - #should be "accessed" in the same way. + # If this ParallelFunction object is accessed as an + # attribute of a class or instance, the underlying function + # should be "accessed" in the same way. new_func = self.func.__get__(instance, owner) except AttributeError: - #This will happen if a non-function attribute is - #decorated. For example, an expression that's an - #attribute of a class. + # This will happen if a non-function attribute is + # decorated. For example, an expression that's an + # attribute of a class. new_func = self.func return ParallelFunction(self.parallel, new_func) @@ -413,8 +411,6 @@ def parallel(p_iter='fork', ncpus=None, **kwds): return Parallel(p_iter, ncpus, **kwds) - - ################################################################### # The @fork decorator -- evaluate a function with no side effects # in memory, so the only side effects (if any) are on disk. @@ -437,10 +433,10 @@ def __init__(self, timeout=0, verbose=False): """ INPUT: - - ``timeout`` -- (default: 0) kill the subprocess after it has run this - many seconds (wall time), or if ``timeout`` is zero, do not kill it. - - ``verbose`` -- (default: ``False``) whether to print anything about - what the decorator does (e.g., killing the subprocess) + - ``timeout`` -- (default: 0) kill the subprocess after it has run this + many seconds (wall time), or if ``timeout`` is zero, do not kill it. + - ``verbose`` -- (default: ``False``) whether to print anything about + what the decorator does (e.g., killing the subprocess) EXAMPLES:: @@ -456,11 +452,11 @@ def __call__(self, f): """ INPUT: - - ``f`` -- a function + - ``f`` -- a function OUTPUT: - - A decorated function. + - A decorated function. EXAMPLES:: @@ -481,18 +477,18 @@ def h(*args, **kwds): def fork(f=None, timeout=0, verbose=False): """ - Decorate a function so that when called it runs in a forked - subprocess. This means that it won't have any in-memory - side effects on the parent Sage process. The pexpect interfaces - are all reset. + Decorate a function so that when called it runs in a forked subprocess. + + This means that it will not have any in-memory side effects on the + parent Sage process. The pexpect interfaces are all reset. INPUT: - - ``f`` -- a function - - ``timeout`` -- (default: 0) if positive, kill the subprocess after - this many seconds (wall time) - - ``verbose`` -- (default: ``False``) whether to print anything - about what the decorator does (e.g., killing the subprocess) + - ``f`` -- a function + - ``timeout`` -- (default: 0) if positive, kill the subprocess after + this many seconds (wall time) + - ``verbose`` -- (default: ``False``) whether to print anything + about what the decorator does (e.g., killing the subprocess) .. warning:: diff --git a/src/sage/parallel/map_reduce.py b/src/sage/parallel/map_reduce.py index 8881d7a01ac..7307a68dd44 100644 --- a/src/sage/parallel/map_reduce.py +++ b/src/sage/parallel/map_reduce.py @@ -410,7 +410,7 @@ - ``worker._request`` -- a :class:`~multiprocessing.queues.SimpleQueue` storing steal request submitted to ``worker``. - ``worker._read_task``, ``worker._write_task`` -- a - :class:`~multiprocessing.queues.Pipe` used to transfert node during steal. + :class:`~multiprocessing.queues.Pipe` used to transfer node during steal. - ``worker._thief`` -- a :class:`~threading.Thread` which is in charge of stealing from ``worker._todo``. @@ -1196,9 +1196,9 @@ def get_results(self, timeout=None): active_proc = self._nprocess while active_proc > 0: try: - logger.debug('Waiting on results; active_proc: %s, ' - 'timeout: %s, aborted: %s' % - (active_proc, timeout, self._aborted.value)) + logger.debug('Waiting on results; active_proc: {}, ' + 'timeout: {}, aborted: {}'.format( + active_proc, timeout, self._aborted.value)) newres = self._results.get(timeout=timeout) except queue.Empty: logger.debug('Timed out waiting for results; aborting') @@ -1249,13 +1249,13 @@ def finish(self): if not self._aborted.value: logger.debug("Joining worker processes...") for worker in self._workers: - logger.debug("Joining %s" % worker.name) + logger.debug(f"Joining {worker.name}") worker.join() logger.debug("Joining done") else: logger.debug("Killing worker processes...") for worker in self._workers: - logger.debug("Terminating %s" % worker.name) + logger.debug(f"Terminating {worker.name}") worker.terminate() logger.debug("Killing done") @@ -1527,9 +1527,9 @@ def print_communication_statistics(self, blocksize=16): # local function (see e.g: # https://stackoverflow.com/questions/2609518/python-nested-function-scopes). - def pstat(name, start, end, ist): + def pstat(name, start, end, istat): res[0] += ("\n" + name + " ".join( - "%4i" % (self._stats[i][ist]) for i in range(start, end))) + "%4i" % (self._stats[i][istat]) for i in range(start, end))) for start in range(0, self._nprocess, blocksize): end = min(start + blocksize, self._nprocess) res[0] = ("#proc: " + @@ -1613,17 +1613,17 @@ def _thief(self): for ireq in iter(self._request.get, AbortError): reqs += 1 target = self._mapred._workers[ireq] - logger.debug("Got a Steal request from %s" % target.name) + logger.debug(f"Got a Steal request from {target.name}") self._mapred._signal_task_start() try: work = self._todo.popleft() except IndexError: target._write_task.send(None) - logger.debug("Failed Steal %s" % target.name) + logger.debug(f"Failed Steal {target.name}") self._mapred._signal_task_done() else: target._write_task.send(work) - logger.debug("Succesful Steal %s" % target.name) + logger.debug(f"Successful Steal {target.name}") thefts += 1 except AbortError: logger.debug("Thief aborted") @@ -1668,10 +1668,10 @@ def steal(self): while node is None: victim = self._mapred.random_worker() if victim is not self: - logger.debug("Trying to steal from %s" % victim.name) + logger.debug(f"Trying to steal from {victim.name}") victim._request.put(self._iproc) self._stats[0] += 1 - logger.debug("waiting for steal answer from %s" % victim.name) + logger.debug(f"waiting for steal answer from {victim.name}") node = self._read_task.recv() # logger.debug("Request answer: %s" % (node,)) if node is AbortError: @@ -1713,7 +1713,7 @@ def run(self): PROFILER.runcall(self.run_myself) output = profile + str(self._iproc) - logger.warn("Profiling in %s ..." % output) + logger.warn(f"Profiling in {output} ...") PROFILER.dump_stats(output) else: self.run_myself() diff --git a/src/sage/parallel/multiprocessing_sage.py b/src/sage/parallel/multiprocessing_sage.py index 0cd628a6d3b..be9b980aba9 100644 --- a/src/sage/parallel/multiprocessing_sage.py +++ b/src/sage/parallel/multiprocessing_sage.py @@ -8,7 +8,7 @@ # Distributed under the terms of (any version of) the GNU # General Public License (GPL). The full text of the GPL is available at: # -# http://www.gnu.org/licenses/ +# https://www.gnu.org/licenses/ ################################################################################ from multiprocessing import Pool @@ -16,6 +16,7 @@ from sage.misc.fpickle import pickle_function, call_pickled_function from . import ncpus + def pyprocessing(processes=0): """ Return a parallel iterator using a given number of processes diff --git a/src/sage/parallel/ncpus.py b/src/sage/parallel/ncpus.py index 0dcdd16fe17..dfb6c3c6734 100644 --- a/src/sage/parallel/ncpus.py +++ b/src/sage/parallel/ncpus.py @@ -33,6 +33,7 @@ import os import subprocess + def ncpus(): """ Detects the number of effective CPUs in the system. @@ -52,22 +53,25 @@ def ncpus(): else: return int(n) - #for Linux, Unix and MacOS + # for Linux, Unix and MacOS if hasattr(os, "sysconf"): if "SC_NPROCESSORS_ONLN" in os.sysconf_names: - #Linux and Unix + # Linux and Unix ncpus = os.sysconf("SC_NPROCESSORS_ONLN") if isinstance(ncpus, int) and ncpus > 0: return ncpus else: - #MacOS X - #deprecated: return int(os.popen2("sysctl -n hw.ncpu")[1].read()) - process = subprocess.Popen("sysctl -n hw.ncpu", shell=True, stdin=subprocess.PIPE, stdout = subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True) + # MacOS X + # deprecated: return int(os.popen2("sysctl -n hw.ncpu")[1].read()) + process = subprocess.Popen("sysctl -n hw.ncpu", shell=True, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, close_fds=True) return int(process.stdout.read()) - #for Windows + # for Windows if "NUMBER_OF_PROCESSORS" in os.environ: ncpus = int(os.environ["NUMBER_OF_PROCESSORS"]) if ncpus > 0: return ncpus - #return the default value + # return the default value return 1 diff --git a/src/sage/parallel/parallelism.py b/src/sage/parallel/parallelism.py index b974616a784..8aafe232fee 100644 --- a/src/sage/parallel/parallelism.py +++ b/src/sage/parallel/parallelism.py @@ -28,6 +28,7 @@ from sage.parallel.ncpus import ncpus from sage.rings.integer import Integer + class Parallelism(Singleton, SageObject): r""" Singleton class for managing the number of processes used in parallel @@ -106,9 +107,12 @@ def __init__(self): sage: TestSuite(par).run() """ - self._default = ncpus() # default number of proc. used in parallelizations - self._nproc = {'tensor' : 1, 'linbox' : 1} # dict. of number of processes to be used - # (keys: computational field) + self._default = ncpus() + # default number of proc. used in parallelizations + + self._nproc = {'tensor': 1, 'linbox': 1} + # dict. of number of processes to be used + # (keys: computational field) def _repr_(self): r""" @@ -242,7 +246,7 @@ def set(self, field=None, nproc=None): if nproc is None: self._nproc[field] = self._default else: - if not isinstance(nproc, (int,Integer)): + if not isinstance(nproc, (int, Integer)): raise TypeError("nproc must be integer") self._nproc[field] = nproc @@ -281,7 +285,6 @@ def get(self, field): "implemented in Parallelism()") return self._nproc[field] - def get_all(self): r""" Return the number of processes which will be used in parallel @@ -307,7 +310,6 @@ def get_all(self): """ return self._nproc - def set_default(self, nproc=None): r""" Set the default number of processes to be launched in parallel @@ -343,7 +345,7 @@ def set_default(self, nproc=None): if nproc is None: self._default = ncpus() else: - if not isinstance(nproc,(int,Integer)): + if not isinstance(nproc, (int, Integer)): raise TypeError("nproc must be integer") self._default = nproc diff --git a/src/sage/parallel/use_fork.py b/src/sage/parallel/use_fork.py index 758a572a2c2..69f2ede8420 100644 --- a/src/sage/parallel/use_fork.py +++ b/src/sage/parallel/use_fork.py @@ -2,15 +2,15 @@ Parallel iterator built using the ``fork()`` system call """ -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2010 William Stein # # 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. -# http://www.gnu.org/licenses/ -#***************************************************************************** +# https://www.gnu.org/licenses/ +# **************************************************************************** from shutil import rmtree @@ -41,7 +41,7 @@ class WorkerData(): sage: W.starttime # random 1499330252.463206 """ - def __init__(self, input, starttime=None, failure=""): + def __init__(self, input_value, starttime=None, failure=""): r""" See the class documentation for description of the inputs. @@ -50,7 +50,7 @@ def __init__(self, input, starttime=None, failure=""): sage: from sage.parallel.use_fork import WorkerData sage: W = WorkerData(42) """ - self.input = input + self.input = input_value self.starttime = starttime or walltime() self.failure = failure @@ -197,8 +197,7 @@ def __call__(self, f, inputs): if T - W.starttime > timeout: if self.verbose: print( - "Killing subprocess %s with input %s which took too long" - % (pid, W.input) ) + "Killing subprocess %s with input %s which took too long" % (pid, W.input)) os.kill(pid, signal.SIGKILL) W.failure = " (timed out)" except KeyError: @@ -206,7 +205,7 @@ def __call__(self, f, inputs): pass else: # collect data from process that successfully terminated - sobj = os.path.join(dir, '%s.sobj'%pid) + sobj = os.path.join(dir, '%s.sobj' % pid) try: with open(sobj, "rb") as file: data = file.read() @@ -219,7 +218,7 @@ def __call__(self, f, inputs): except Exception as E: answer = "INVALID DATA {}".format(E) - out = os.path.join(dir, '%s.out'%pid) + out = os.path.join(dir, '%s.out' % pid) try: with open(out) as file: sys.stdout.write(file.read()) diff --git a/src/sage/rings/asymptotic/asymptotic_expansion_generators.py b/src/sage/rings/asymptotic/asymptotic_expansion_generators.py index 3100ed5356f..4f4c506bc40 100644 --- a/src/sage/rings/asymptotic/asymptotic_expansion_generators.py +++ b/src/sage/rings/asymptotic/asymptotic_expansion_generators.py @@ -173,7 +173,7 @@ def Stirling(var, precision=None, skip_constant_factor=False): sage: set_series_precision(5) sage: asymptotic_expansions.Stirling('n') - sqrt(2)*sqrt(pi)*e^(n*log(n))*(e^n)^(-1)*n^(1/2) + + sqrt(2)*sqrt(pi)*e^(n*log(n))*(e^n)^(-1)*n^(1/2) + ... + O(e^(n*log(n))*(e^n)^(-1)*n^(-5/2)) sage: set_series_precision(20) # restore series precision default """ diff --git a/src/sage/rings/finite_rings/element_givaro.pyx b/src/sage/rings/finite_rings/element_givaro.pyx index e296dfbe4f4..bdb42614592 100644 --- a/src/sage/rings/finite_rings/element_givaro.pyx +++ b/src/sage/rings/finite_rings/element_givaro.pyx @@ -66,13 +66,15 @@ import operator import sage.arith.all import sage.rings.finite_rings.finite_field_constructor as finite_field -import sage.interfaces.gap from sage.libs.pari.all import pari from cypari2.gen cimport Gen from cypari2.stack cimport clear_stack from sage.structure.parent cimport Parent + +from sage.interfaces.abc import GapElement + cdef object is_IntegerMod cdef object Integer cdef object Rational @@ -431,9 +433,12 @@ cdef class Cache_givaro(Cache_base): # Reduce to pari e = e.__pari__() - elif sage.interfaces.gap.is_GapElement(e): - from sage.interfaces.gap import gfq_gap_to_sage - return gfq_gap_to_sage(e, self.parent) + elif isinstance(e, sage.libs.gap.element.GapElement_FiniteField): + return e.sage(ring=self.parent) + + elif isinstance(e, GapElement): + from sage.libs.gap.libgap import libgap + return libgap(e).sage(ring=self.parent) elif isinstance(e, list): if len(e) > self.exponent(): @@ -1641,6 +1646,8 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): 'Z(25)^3' sage: S(gap('Z(25)^3')) 4*b + 3 + sage: S(libgap.Z(25)^3) + 4*b + 3 """ cdef Cache_givaro cache = self._cache if self == 0: diff --git a/src/sage/rings/finite_rings/element_ntl_gf2e.pyx b/src/sage/rings/finite_rings/element_ntl_gf2e.pyx index 477c830f867..109ce513b61 100644 --- a/src/sage/rings/finite_rings/element_ntl_gf2e.pyx +++ b/src/sage/rings/finite_rings/element_ntl_gf2e.pyx @@ -46,8 +46,6 @@ from sage.libs.pari.all import pari from cypari2.gen cimport Gen from cypari2.stack cimport clear_stack -from sage.interfaces.gap import is_GapElement - from sage.misc.randstate import current_randstate from sage.arith.long cimport pyobject_to_long @@ -56,6 +54,9 @@ from .finite_field_ntl_gf2e import FiniteField_ntl_gf2e from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing +from sage.interfaces.abc import GapElement + + cdef object is_IntegerMod cdef object IntegerModRing_generic cdef object Integer @@ -305,6 +306,7 @@ cdef class Cache_ntl_gf2e(Cache_base): cdef FiniteField_ntl_gf2eElement x cdef FiniteField_ntl_gf2eElement g cdef Py_ssize_t i + from sage.libs.gap.element import GapElement_FiniteField if is_IntegerMod(e): e = e.lift() @@ -364,9 +366,13 @@ cdef class Cache_ntl_gf2e(Cache_base): # Reduce to pari e = e.__pari__() - elif is_GapElement(e): - from sage.interfaces.gap import gfq_gap_to_sage - return gfq_gap_to_sage(e, self._parent) + elif isinstance(e, GapElement_FiniteField): + return e.sage(ring=self._parent) + + elif isinstance(e, GapElement): + from sage.libs.gap.libgap import libgap + return libgap(e).sage(ring=self._parent) + else: raise TypeError("unable to coerce %r" % type(e)) @@ -1178,6 +1184,10 @@ cdef class FiniteField_ntl_gf2eElement(FinitePolyExtElement): sage: k. = GF(2^16) sage: b._gap_init_() 'Z(65536)^1' + sage: k(gap('Z(2^16)^3+Z(2^16)^5')) + b^5 + b^3 + sage: k(libgap.Z(2^16)^3+libgap.Z(2^16)^5) + b^5 + b^3 """ F = self._parent if not F.is_conway(): diff --git a/src/sage/rings/finite_rings/element_pari_ffelt.pyx b/src/sage/rings/finite_rings/element_pari_ffelt.pyx index 3bf5c62ff32..be70aa56d39 100644 --- a/src/sage/rings/finite_rings/element_pari_ffelt.pyx +++ b/src/sage/rings/finite_rings/element_pari_ffelt.pyx @@ -29,7 +29,6 @@ from .element_base cimport FinitePolyExtElement from .integer_mod import IntegerMod_abstract import sage.rings.integer -from sage.interfaces.gap import is_GapElement from sage.modules.free_module_element import FreeModuleElement from sage.rings.integer cimport Integer from sage.rings.polynomial.polynomial_element import Polynomial @@ -39,6 +38,8 @@ from sage.structure.element cimport Element, ModuleElement, RingElement from sage.structure.richcmp cimport rich_to_bool +from sage.interfaces.abc import GapElement + cdef GEN _INT_to_FFELT(GEN g, GEN x) except NULL: """ Convert the t_INT `x` to an element of the field of definition of @@ -504,10 +505,16 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): elif isinstance(x, str): self.construct_from(self._parent.polynomial_ring()(x)) - elif is_GapElement(x): - from sage.interfaces.gap import gfq_gap_to_sage + elif isinstance(x, GapElement): + try: + from sage.libs.gap.libgap import libgap + self.construct_from(libgap(x).sage(ring=self._parent)) + except (ValueError, IndexError, TypeError): + raise TypeError("no coercion defined") + + elif isinstance(x, sage.libs.gap.element.GapElement_FiniteField): try: - self.construct_from(gfq_gap_to_sage(x, self._parent)) + self.construct_from(x.sage(ring=self._parent)) except (ValueError, IndexError, TypeError): raise TypeError("no coercion defined") @@ -1258,9 +1265,9 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): EXAMPLES:: - sage: F = FiniteField(2^3, 'a', impl='pari_ffelt') - sage: a = F.multiplicative_generator() - sage: gap(a) # indirect doctest + sage: F = FiniteField(2^3, 'aa', impl='pari_ffelt') + sage: aa = F.multiplicative_generator() + sage: gap(aa) # indirect doctest Z(2^3) sage: b = F.multiplicative_generator() sage: a = b^3 @@ -1268,6 +1275,10 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): Z(2^3)^3 sage: gap(a^3) Z(2^3)^2 + sage: F(gap('Z(8)^3')) + aa + 1 + sage: F(libgap.Z(8)^3) + aa + 1 You can specify the instance of the Gap interpreter that is used:: diff --git a/src/sage/rings/finite_rings/integer_mod.pyx b/src/sage/rings/finite_rings/integer_mod.pyx index 58218d9a193..d268ff97c9a 100644 --- a/src/sage/rings/finite_rings/integer_mod.pyx +++ b/src/sage/rings/finite_rings/integer_mod.pyx @@ -98,7 +98,7 @@ cimport sage.rings.integer from sage.rings.integer cimport Integer from sage.structure.coerce cimport py_scalar_to_element -from sage.structure.richcmp import rich_to_bool_sgn, rich_to_bool +from sage.structure.richcmp cimport rich_to_bool_sgn, rich_to_bool import sage.structure.element cimport sage.structure.element coerce_binop = sage.structure.element.coerce_binop diff --git a/src/sage/rings/finite_rings/integer_mod_ring.py b/src/sage/rings/finite_rings/integer_mod_ring.py index 12c3c71c5ba..54b7840e488 100644 --- a/src/sage/rings/finite_rings/integer_mod_ring.py +++ b/src/sage/rings/finite_rings/integer_mod_ring.py @@ -72,12 +72,12 @@ from sage.libs.pari.all import pari, PariError -import sage.interfaces.all from sage.misc.cachefunc import cached_method from sage.structure.factory import UniqueFactory from sage.structure.richcmp import richcmp, richcmp_method +from sage.interfaces.abc import GapElement class IntegerModFactory(UniqueFactory): r""" @@ -1180,16 +1180,21 @@ def _element_constructor_(self, x): 4 sage: libgap(a.sage()) == a True + + better syntax for libgap interface:: + + sage: a = libgap.Z(13)^2 + sage: libgap(a.sage()) == a + True """ try: return integer_mod.IntegerMod(self, x) except (NotImplementedError, PariError): raise TypeError("error coercing to finite field") except TypeError: - if sage.interfaces.gap.is_GapElement(x): - from sage.interfaces.gap import intmod_gap_to_sage - y = intmod_gap_to_sage(x) - return integer_mod.IntegerMod(self, y) + if isinstance(x, GapElement): + from sage.libs.gap.libgap import libgap + return libgap(x).sage() raise # Continue up with the original TypeError def __iter__(self): diff --git a/src/sage/rings/fraction_field_FpT.pyx b/src/sage/rings/fraction_field_FpT.pyx index 58ee9bf3050..710aa930ca3 100644 --- a/src/sage/rings/fraction_field_FpT.pyx +++ b/src/sage/rings/fraction_field_FpT.pyx @@ -1,4 +1,4 @@ -# distutils: libraries = gmp NTL_LIBRARIES zn_poly +# distutils: libraries = gmp NTL_LIBRARIES # distutils: extra_compile_args = NTL_CFLAGS # distutils: include_dirs = NTL_INCDIR # distutils: library_dirs = NTL_LIBDIR diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx index be8d08412fd..7cac3687e87 100644 --- a/src/sage/rings/integer.pyx +++ b/src/sage/rings/integer.pyx @@ -632,11 +632,8 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): if isinstance(x, Integer): set_from_Integer(self, x) - elif isinstance(x, long): - mpz_set_pylong(self.value, x) - elif isinstance(x, int): - mpz_set_si(self.value, PyInt_AS_LONG(x)) + mpz_set_pylong(self.value, x) elif isinstance(x, float): n = long(x) @@ -683,7 +680,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): if b == 2: # we use a faster method for j from 0 <= j < len(x): otmp = x[j] - if isinstance(otmp, (int, long)): + if isinstance(otmp, int): if ( otmp) == 1: mpz_setbit(self.value, j) if ( otmp) != 0: @@ -707,7 +704,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): elif is_numpy_type(type(x)): import numpy if isinstance(x, numpy.integer): - mpz_set_pylong(self.value, long(x)) + mpz_set_pylong(self.value, int(x)) return elif type(x) is gmpy2.mpz: diff --git a/src/sage/rings/lazy_series.py b/src/sage/rings/lazy_series.py index 795d38edb58..e77b1a7cd2e 100644 --- a/src/sage/rings/lazy_series.py +++ b/src/sage/rings/lazy_series.py @@ -3048,6 +3048,7 @@ def _div_(self, other): R = P._internal_poly_ring if (isinstance(left, Stream_exact) and isinstance(right, Stream_exact) + and hasattr(R.base_ring(), "fraction_field") and hasattr(R, "_gcd_univariate_polynomial")): z = R.gen() num = left._polynomial_part(R) * (1-z) + left._constant * z**left._degree @@ -3068,12 +3069,12 @@ def _div_(self, other): # dividing by z^k d = den[exponents[0]] v = num.valuation() - initial_coefficients = [num[i] / d for i in range(v, num.degree() + 1)] + initial_coefficients = [num[i] / d + for i in range(v, num.degree() + 1)] order = v - den.valuation() return P.element_class(P, Stream_exact(initial_coefficients, order=order, constant=0)) - if (len(exponents) == 2 and exponents[0] + 1 == exponents[1] and den[exponents[0]] == -den[exponents[1]]): diff --git a/src/sage/rings/lazy_series_ring.py b/src/sage/rings/lazy_series_ring.py index 974cced9341..b8613ba2b9c 100644 --- a/src/sage/rings/lazy_series_ring.py +++ b/src/sage/rings/lazy_series_ring.py @@ -1543,6 +1543,7 @@ def q_pochhammer(self, q=None): from sage.arith.misc import binomial qP = q.parent() one = qP.one() + def coeff(n): return (-1)**n * q**binomial(n, 2) / qP.prod(one - q**i for i in range(1, n+1)) return self(coefficients=coeff, valuation=0) diff --git a/src/sage/rings/number_field/number_field.py b/src/sage/rings/number_field/number_field.py index 617bbf5aa69..fbdd43dfabb 100644 --- a/src/sage/rings/number_field/number_field.py +++ b/src/sage/rings/number_field/number_field.py @@ -159,6 +159,8 @@ from sage.modules.free_module_element import vector from sage.rings.real_mpfr import RR +from sage.interfaces.abc import GapElement + _NumberFields = NumberFields() @@ -1819,7 +1821,7 @@ def _element_constructor_(self, x, check=True): raise TypeError("%s has unsupported PARI type %s" % (x, x.type())) x = self.absolute_polynomial().parent()(x) return self._element_class(self, x) - elif sage.interfaces.gap.is_GapElement(x): + elif isinstance(x, GapElement): s = x._sage_repr() if self.variable_name() in s: return self._convert_from_str(s) @@ -11153,8 +11155,7 @@ def _element_constructor_(self, x, check=True): return NumberField_absolute._element_constructor_(self, x) elif isinstance(x, pari_gen): return NumberField_absolute._element_constructor_(self, x, check=check) - elif (sage.interfaces.gap.is_GapElement(x) or - isinstance(x, sage.libs.gap.element.GapElement)): + elif isinstance(x, (sage.libs.gap.element.GapElement, GapElement)): return self._coerce_from_gap(x) elif isinstance(x, str): return self._convert_from_str(x) diff --git a/src/sage/rings/padics/eisenstein_extension_generic.py b/src/sage/rings/padics/eisenstein_extension_generic.py index 6473ba4d2ca..4f68e63ffae 100644 --- a/src/sage/rings/padics/eisenstein_extension_generic.py +++ b/src/sage/rings/padics/eisenstein_extension_generic.py @@ -39,7 +39,7 @@ def __init__(self, poly, prec, print_mode, names, element_class): def _extension_type(self): """ - Return the type (``Unramified``, ``Eisenstein``) of this + Return the type (``Unramified``, ``Eisenstein``) of this extension as a string, if any. Used for printing. diff --git a/src/sage/rings/padics/factory.py b/src/sage/rings/padics/factory.py index 72506764209..044dcae0bed 100644 --- a/src/sage/rings/padics/factory.py +++ b/src/sage/rings/padics/factory.py @@ -2949,12 +2949,12 @@ def ZpLF(p, prec=None, *args, **kwds): See documentation for :func:`Zp` for a description of the input parameters. - NOTE: + .. NOTE:: - The precision is tracked using automatic differentiation - techniques (see [CRV2018]_ and [CRV2014]_). - Floating point `p`-adic numbers are used for the computation - of the differential (which is then not exact). + The precision is tracked using automatic differentiation + techniques (see [CRV2018]_ and [CRV2014]_). + Floating point `p`-adic numbers are used for the computation + of the differential (which is then not exact). EXAMPLES:: diff --git a/src/sage/rings/padics/local_generic_element.pyx b/src/sage/rings/padics/local_generic_element.pyx index 0733e0a483f..0571aa5cf4c 100644 --- a/src/sage/rings/padics/local_generic_element.pyx +++ b/src/sage/rings/padics/local_generic_element.pyx @@ -737,10 +737,10 @@ cdef class LocalGenericElement(CommutativeRingElement): The square root or the list of all square roots of this element. - NOTE: + .. NOTE:: - The square root is chosen (resp. the square roots are ordered) in - a deterministic way, which is compatible with change of precision. + The square root is chosen (resp. the square roots are ordered) in + a deterministic way, which is compatible with change of precision. EXAMPLES:: diff --git a/src/sage/rings/padics/padic_capped_absolute_element.pyx b/src/sage/rings/padics/padic_capped_absolute_element.pyx index e48abd895ae..69d5b474f20 100644 --- a/src/sage/rings/padics/padic_capped_absolute_element.pyx +++ b/src/sage/rings/padics/padic_capped_absolute_element.pyx @@ -320,7 +320,7 @@ cdef class pAdicCappedAbsoluteElement(CAElement): this valuation (and beyond) to see if they can contribute to the series. - NOTE:: + .. NOTE:: The function does not check that its argument ``self`` is 1 in the residue field. If this assumption is not fulfilled diff --git a/src/sage/rings/padics/padic_fixed_mod_element.pyx b/src/sage/rings/padics/padic_fixed_mod_element.pyx index de14a7c7cb0..2e9e9a1ed3b 100644 --- a/src/sage/rings/padics/padic_fixed_mod_element.pyx +++ b/src/sage/rings/padics/padic_fixed_mod_element.pyx @@ -389,7 +389,7 @@ cdef class pAdicFixedModElement(FMElement): this valuation (and beyond) to see if they can contribute to the series. - NOTE:: + .. NOTE:: The function does not check that its argument ``self`` is 1 in the residue field. If this assumption is not fulfilled @@ -459,7 +459,7 @@ cdef class pAdicFixedModElement(FMElement): - ``aprec`` -- an integer, the precision to which to compute the exponential - NOTE:: + .. NOTE:: The function does not check that its argument ``self`` is the disk of convergence of ``exp``. If this assumption is not @@ -523,7 +523,7 @@ cdef class pAdicFixedModElement(FMElement): method. See :meth:`log` for more details about the possible algorithms. - NOTE:: + .. NOTE:: The function does not check that its argument ``self`` is the disk of convergence of ``exp``. If this assumption is not diff --git a/src/sage/rings/padics/padic_generic_element.pyx b/src/sage/rings/padics/padic_generic_element.pyx index 4248994b88e..44fb57e0178 100644 --- a/src/sage/rings/padics/padic_generic_element.pyx +++ b/src/sage/rings/padics/padic_generic_element.pyx @@ -2004,7 +2004,10 @@ cdef class pAdicGenericElement(LocalGenericElement): - ``self`` -- a p-adic element - ``p`` -- a prime (default: None). If specified, will make sure that p==self.parent().prime() - NOTE: The optional argument p is used for consistency with the valuation methods on integer and rational. + .. NOTE:: + + The optional argument p is used for consistency with the valuation + methods on integer and rational. OUTPUT: @@ -2126,8 +2129,10 @@ cdef class pAdicGenericElement(LocalGenericElement): - ``self`` -- a p-adic element - ``p`` -- a prime (default: ``None``). If specified, will make sure that ``p == self.parent().prime()`` - NOTE: The optional argument p is used for consistency with the valuation methods on integer and rational. + .. NOTE:: + The optional argument p is used for consistency with the valuation + methods on integer and rational. OUTPUT: @@ -2456,7 +2461,7 @@ cdef class pAdicGenericElement(LocalGenericElement): this valuation (and beyond) to see if they can contribute to the series. - NOTE:: + .. NOTE:: The function does not check that its argument ``self`` is 1 in the residue field. If this assumption is not fulfilled diff --git a/src/sage/rings/padics/pow_computer_relative.pyx b/src/sage/rings/padics/pow_computer_relative.pyx index f28a46f03b7..29cee93968c 100644 --- a/src/sage/rings/padics/pow_computer_relative.pyx +++ b/src/sage/rings/padics/pow_computer_relative.pyx @@ -34,7 +34,6 @@ from cysignals.signals cimport sig_on, sig_off from sage.libs.gmp.mpz cimport mpz_init, mpz_clear, mpz_pow_ui from cpython.object cimport Py_EQ, Py_NE -from sage.structure.richcmp cimport richcmp_not_equal from sage.rings.integer cimport Integer from sage.rings.integer_ring import ZZ from sage.misc.cachefunc import cached_method diff --git a/src/sage/rings/padics/unramified_extension_generic.py b/src/sage/rings/padics/unramified_extension_generic.py index d8eecc36f02..7973ed814c3 100644 --- a/src/sage/rings/padics/unramified_extension_generic.py +++ b/src/sage/rings/padics/unramified_extension_generic.py @@ -56,7 +56,7 @@ def __init__(self, poly, prec, print_mode, names, element_class): def _extension_type(self): """ - Return the type (``Unramified``, ``Eisenstein``) of this + Return the type (``Unramified``, ``Eisenstein``) of this extension as a string, if any. Used for printing. diff --git a/src/sage/rings/polynomial/multi_polynomial_ideal.py b/src/sage/rings/polynomial/multi_polynomial_ideal.py index 4d70e01c8a7..7dc058a22f0 100644 --- a/src/sage/rings/polynomial/multi_polynomial_ideal.py +++ b/src/sage/rings/polynomial/multi_polynomial_ideal.py @@ -546,6 +546,55 @@ def _groebner_basis_libsingular(self, algorithm="groebner", *args, **kwds): raise NameError("Algorithm '%s' unknown"%algorithm) return S + @libsingular_gb_standard_options + def _groebner_cover(self): + r""" + Compute the Gröbner cover of the ideal. + + The Gröbner cover is a partition of the space of parameters, + such that the Gröbner basis is constant for each of the parts. + + OUTPUT: + + A list of parts. Each element of this list contains: + + - The leading monomials of the Gröbner basis in the part + - The Gröbner basis in the part + - A list of components of the part. Each component is + two lists of equations. The parameters in the + part are those that satisfy the first list of + equations, but do not satisfy the second one. + + EXAMPLES:: + + sage: from sage.libs.singular.function import singular_function, lib + sage: F = PolynomialRing(QQ,'a').fraction_field() + sage: F.inject_variables() + Defining a + sage: R. = F[] + sage: I = R.ideal([-x+3*y+z-5,2*x+a*z+4,4*x-3*z-a-1]) + sage: I._groebner_cover() + [[[z, y, x], + [(2*a + 3)*z + (a + 9), (12*a + 18)*y + (-a^2 - 23*a - 36), (4*a + 6)*x + (-a^2 - a + 12)], + [[[0], [[(2*a + 3)]]]]], + [[1], [1], [[[(2*a + 3)], [[1]]]]]] + """ + from sage.rings.fraction_field import FractionField_generic + from sage.rings.polynomial.multi_polynomial_ring_base import is_MPolynomialRing + from sage.rings.polynomial.polynomial_ring import is_PolynomialRing + F = self.base_ring() + if (not isinstance(F, FractionField_generic) or + (not is_MPolynomialRing(F.ring()) and not is_PolynomialRing(F.ring()))): + raise TypeError("the base ring must be a field with parameters") + from sage.libs.singular.function import singular_function, lib + from sage.arith.functions import lcm + lib("grobcov.lib") + grobcov = singular_function("grobcov") + polynomials = [] + for f in self.gens(): + polynomials.append(f * lcm([c.denominator() for c in f.coefficients()])) + return grobcov(self.ring().ideal(polynomials)) + class MPolynomialIdeal_singular_repr( MPolynomialIdeal_singular_base_repr): @@ -4563,6 +4612,50 @@ def groebner_basis(self, algorithm='', deg_bound=None, mult_bound=None, prot=Fal gb = PolynomialSequence(self.ring(), gb, immutable=True) return gb + def groebner_cover(self): + r""" + Compute the Gröbner cover of the ideal, over a field with parameters. + + The Groebner cover is a partition of the space of parameters, + such that the Groebner basis in each part is given by the same + expression. + + EXAMPLES:: + + sage: F = PolynomialRing(QQ,'a').fraction_field() + sage: F.inject_variables() + Defining a + sage: R. = F[] + sage: I = R.ideal([-x+3*y+z-5,2*x+a*z+4,4*x-3*z-1/a]) + sage: I.groebner_cover() + {Quasi-affine subscheme X - Y of Affine Space of dimension 1 over Rational Field, where X is defined by: + 0 + and Y is defined by: + 2*a^2 + 3*a: [(2*a^2 + 3*a)*z + (8*a + 1), (12*a^2 + 18*a)*y + (-20*a^2 - 35*a - 2), (4*a + 6)*x + 11], + Quasi-affine subscheme X - Y of Affine Space of dimension 1 over Rational Field, where X is defined by: + ... + and Y is defined by: + 1: [1], + Quasi-affine subscheme X - Y of Affine Space of dimension 1 over Rational Field, where X is defined by: + ... + and Y is defined by: + 1: [1]} + """ + from sage.schemes.affine.affine_space import AffineSpace + gc = self._groebner_cover() + F = self.base_ring() + A = AffineSpace(F.base_ring(), F.ngens(), list(F.gens_dict())) + result = {} + ring = F.ring() + for segment in gc: + for piece in segment[2]: + X = A.subscheme([ring(c) for c in piece[0]]) + Y = A.subscheme([ring(c) for c in piece[1][0]]) + for pol in piece[1][1:]: + Y = Y.union(A.subscheme([ring(c) for c in pol])) + result[Y.complement(X)] = segment[1] + return result + def change_ring(self, P): r""" Return the ideal ``I`` in ``P`` spanned by diff --git a/src/sage/rings/polynomial/ore_function_element.py b/src/sage/rings/polynomial/ore_function_element.py index 69f394a3e74..d21ed8d1ed4 100644 --- a/src/sage/rings/polynomial/ore_function_element.py +++ b/src/sage/rings/polynomial/ore_function_element.py @@ -1,12 +1,11 @@ r""" -An element in the fraction field of a Ore polynomial ring. +Fraction field elements of Ore polynomial rings AUTHOR: - Xavier Caruso (2020-05) """ - # *************************************************************************** # Copyright (C) 2020 Xavier Caruso # @@ -17,7 +16,6 @@ # https://www.gnu.org/licenses/ # *************************************************************************** - from sage.structure.richcmp import richcmp, op_EQ, op_NE from sage.misc.cachefunc import cached_method from sage.misc.latex import latex diff --git a/src/sage/rings/polynomial/ore_function_field.py b/src/sage/rings/polynomial/ore_function_field.py index 5cdaa302990..f223f9799dd 100644 --- a/src/sage/rings/polynomial/ore_function_field.py +++ b/src/sage/rings/polynomial/ore_function_field.py @@ -1,5 +1,5 @@ r""" -Fraction fields of Ore polynomial rings. +Fraction fields of Ore polynomial rings Sage provides support for building the fraction field of any Ore polynomial ring and performing basic operations in it. diff --git a/src/sage/rings/polynomial/ore_polynomial_element.pyx b/src/sage/rings/polynomial/ore_polynomial_element.pyx index a5cade9325f..674c93c8d99 100644 --- a/src/sage/rings/polynomial/ore_polynomial_element.pyx +++ b/src/sage/rings/polynomial/ore_polynomial_element.pyx @@ -1,5 +1,5 @@ r""" -Univariate Ore Polynomials +Univariate Ore polynomials This module provides the :class:`~sage.rings.polynomial.skew_polynomial_element.OrePolynomial`, diff --git a/src/sage/rings/polynomial/ore_polynomial_ring.py b/src/sage/rings/polynomial/ore_polynomial_ring.py index 0914fcb822b..f7eacf3112a 100644 --- a/src/sage/rings/polynomial/ore_polynomial_ring.py +++ b/src/sage/rings/polynomial/ore_polynomial_ring.py @@ -1,5 +1,5 @@ r""" -Univariate Ore Polynomial Rings +Univariate Ore polynomial rings This module provides the :class:`~sage.rings.polynomial.ore_polynomial_ring.OrePolynomialRing`, diff --git a/src/sage/rings/polynomial/plural.pyx b/src/sage/rings/polynomial/plural.pyx index 3209824ec88..1c9f35e56ba 100644 --- a/src/sage/rings/polynomial/plural.pyx +++ b/src/sage/rings/polynomial/plural.pyx @@ -1,5 +1,5 @@ r""" -Noncommutative Polynomials via libSINGULAR/Plural +Noncommutative polynomials via libSINGULAR/Plural This module provides specialized and optimized implementations for noncommutative multivariate polynomials over many coefficient rings, via the diff --git a/src/sage/rings/polynomial/polynomial_zmod_flint.pyx b/src/sage/rings/polynomial/polynomial_zmod_flint.pyx index fd92a626555..15958758d18 100644 --- a/src/sage/rings/polynomial/polynomial_zmod_flint.pyx +++ b/src/sage/rings/polynomial/polynomial_zmod_flint.pyx @@ -1,4 +1,4 @@ -# distutils: libraries = gmp NTL_LIBRARIES zn_poly +# distutils: libraries = gmp NTL_LIBRARIES # distutils: extra_compile_args = NTL_CFLAGS # distutils: include_dirs = NTL_INCDIR # distutils: library_dirs = NTL_LIBDIR @@ -63,13 +63,6 @@ include "sage/libs/flint/nmod_poly_linkage.pxi" # and then the interface include "polynomial_template.pxi" -cdef extern from "zn_poly/zn_poly.h": - ctypedef struct zn_mod_struct: - pass - cdef void zn_mod_init(zn_mod_struct *mod, unsigned long m) - cdef void zn_mod_clear(zn_mod_struct *mod) - cdef void zn_array_mul(unsigned long* res, unsigned long* op1, size_t n1, unsigned long* op2, size_t n2, zn_mod_struct *mod) - from sage.libs.flint.fmpz_poly cimport * from sage.libs.flint.nmod_poly cimport * @@ -420,66 +413,6 @@ cdef class Polynomial_zmod_flint(Polynomial_template): else: raise IndexError("Polynomial coefficient index must be nonnegative.") - def _mul_zn_poly(self, other): - r""" - Returns the product of two polynomials using the zn_poly library. - - See http://www.math.harvard.edu/~dmharvey/zn_poly/ for details - on zn_poly. - - INPUT: - - - self: Polynomial - - right: Polynomial (over same base ring as self) - - OUTPUT: (Polynomial) the product self*right. - - - EXAMPLES:: - - sage: P. = PolynomialRing(GF(next_prime(2^30))) - sage: f = P.random_element(1000) - sage: g = P.random_element(1000) - sage: f*g == f._mul_zn_poly(g) - True - - sage: P. = PolynomialRing(Integers(100)) - sage: P - Univariate Polynomial Ring in x over Ring of integers modulo 100 - sage: r = (10*x)._mul_zn_poly(10*x); r - 0 - sage: r.degree() - -1 - - ALGORITHM: - - uses David Harvey's zn_poly library. - - NOTE: This function is a technology preview. It might - disappear or be replaced without a deprecation warning. - """ - cdef Polynomial_zmod_flint _other = self._parent.coerce(other) - - cdef type t = type(self) - cdef Polynomial_zmod_flint r = t.__new__(t) - r._parent = (self)._parent - r._cparent = (self)._cparent - - cdef unsigned long p = self._parent.modulus() - cdef unsigned long n1 = self.x.length - cdef unsigned long n2 = _other.x.length - - cdef zn_mod_struct zn_mod - - nmod_poly_init2(&r.x, p, n1 + n2 -1 ) - - zn_mod_init(&zn_mod, p) - zn_array_mul( r.x.coeffs, self.x.coeffs, n1, _other.x.coeffs, n2, &zn_mod) - r.x.length = n1 + n2 -1 - _nmod_poly_normalise(&r.x) - zn_mod_clear(&zn_mod) - return r - cpdef Polynomial _mul_trunc_(self, Polynomial right, long n): """ Return the product of this polynomial and other truncated to the diff --git a/src/sage/rings/polynomial/skew_polynomial_element.pyx b/src/sage/rings/polynomial/skew_polynomial_element.pyx index 2c0d42ff511..215db4e78c7 100644 --- a/src/sage/rings/polynomial/skew_polynomial_element.pyx +++ b/src/sage/rings/polynomial/skew_polynomial_element.pyx @@ -1,5 +1,5 @@ r""" -Univariate Skew Polynomials +Univariate skew polynomials This module provides the :class:`~sage.rings.polynomial.skew_polynomial_element.SkewPolynomial`. diff --git a/src/sage/rings/polynomial/skew_polynomial_finite_field.pyx b/src/sage/rings/polynomial/skew_polynomial_finite_field.pyx index 289784b94b3..107077623d6 100644 --- a/src/sage/rings/polynomial/skew_polynomial_finite_field.pyx +++ b/src/sage/rings/polynomial/skew_polynomial_finite_field.pyx @@ -1,7 +1,7 @@ r""" -Univariate Dense Skew Polynomials over Finite Fields +Univariate dense skew polynomials over finite fields -This module provides the +This module provides the class:`~sage.rings.polynomial.skew_polynomial_finite_field.SkewPolynomial_finite_field_dense`, which constructs a single univariate skew polynomial over a finite field equipped with the Frobenius endomorphism. Among other things, it implements @@ -336,7 +336,7 @@ cdef class SkewPolynomial_finite_field_dense(SkewPolynomial_finite_order_dense): ....: N = R._reduced_norm_factor_uniform() ....: counts[N] += 1 sage: counts # random - {z + 1: 969, z + 2: 31} + {z + 1: 969, z + 2: 31} """ skew_ring = self._parent F = self._reduced_norm_factored() @@ -390,7 +390,7 @@ cdef class SkewPolynomial_finite_field_dense(SkewPolynomial_finite_order_dense): sage: for D in rightdiv: ....: assert P.is_right_divisible_by(D), "not right divisible" ....: assert D.is_irreducible(), "not irreducible" - + sage: P = S.random_element(degree=10) sage: leftdiv = [ f for f in P.left_irreducible_divisors() ] # indirect doctest sage: len(leftdiv) == P.count_irreducible_divisors() @@ -401,7 +401,7 @@ cdef class SkewPolynomial_finite_field_dense(SkewPolynomial_finite_order_dense): ....: assert P.is_left_divisible_by(D), "not left divisible" ....: assert D.is_irreducible(), "not irreducible" """ - cdef SkewPolynomial_finite_field_dense NS, P, Q, R, P1, Q1, L, V, g, d + cdef SkewPolynomial_finite_field_dense NS, P, Q, R, P1, Q1, L, V, g, d cdef Py_ssize_t i, m, degrandom if not self: return @@ -697,8 +697,8 @@ cdef class SkewPolynomial_finite_field_dense(SkewPolynomial_finite_order_dense): .. NOTE:: - One can prove that there are always as many left - irreducible monic divisors as right irreducible + One can prove that there are always as many left + irreducible monic divisors as right irreducible monic divisors. EXAMPLES:: @@ -936,7 +936,7 @@ cdef class SkewPolynomial_finite_field_dense(SkewPolynomial_finite_order_dense): INPUT: - - ``uniform`` -- a boolean (default: ``False``); whether the + - ``uniform`` -- a boolean (default: ``False``); whether the output irreducible divisor should be uniformly distributed among all possibilities @@ -966,7 +966,7 @@ cdef class SkewPolynomial_finite_field_dense(SkewPolynomial_finite_order_dense): sage: F.value() == a True - There is a priori no guarantee on the distribution of the + There is a priori no guarantee on the distribution of the factorizations we get. Passing in the keyword ``uniform=True`` ensures the output is uniformly distributed among all factorizations:: @@ -1077,9 +1077,9 @@ cdef class SkewPolynomial_finite_field_dense(SkewPolynomial_finite_order_dense): ....: assert F.value() == a, "factorization has a different value" ....: for d,_ in F: ....: assert d.is_irreducible(), "a factor is not irreducible" - - Note that the algorithm used in this method is probabilistic. - As a consequence, if we call it two times with the same input, + + Note that the algorithm used in this method is probabilistic. + As a consequence, if we call it two times with the same input, we can get different orderings:: sage: factorizations2 = [ F for F in a.factorizations() ] diff --git a/src/sage/rings/polynomial/skew_polynomial_finite_order.pyx b/src/sage/rings/polynomial/skew_polynomial_finite_order.pyx index 3dd313aad05..0d5db570385 100644 --- a/src/sage/rings/polynomial/skew_polynomial_finite_order.pyx +++ b/src/sage/rings/polynomial/skew_polynomial_finite_order.pyx @@ -1,5 +1,5 @@ r""" -Univariate Dense Skew Polynomials over a field equipped with a finite order automorphism +Univariate dense skew polynomials over a field with a finite order automorphism AUTHOR:: @@ -190,13 +190,13 @@ cdef class SkewPolynomial_finite_order_dense(SkewPolynomial_generic_dense): By default, the name of the central variable is usually ``z`` (see :meth:`~sage.rings.polynomial.skew_polynomial_ring.SkewPolynomialRing_finite_order.center` - for more details about this). - However, the user can specify a different variable name if desired:: + for more details about this). + However, the user can specify a different variable name if desired:: sage: a.reduced_trace(var='u') 3*u + 4 - When passing in ``var=False``, a tuple of coefficients (instead of + When passing in ``var=False``, a tuple of coefficients (instead of an actual polynomial) is returned:: sage: a.reduced_trace(var=False) @@ -265,20 +265,20 @@ cdef class SkewPolynomial_finite_order_dense(SkewPolynomial_generic_dense): By default, the name of the central variable is usually ``z`` (see :meth:`~sage.rings.polynomial.skew_polynomial_ring.SkewPolynomialRing_finite_order.center` - for more details about this). + for more details about this). However, the user can specify a different variable name if desired:: sage: a.reduced_norm(var='u') u^3 + 4*u^2 + 4 - When passing in ``var=False``, a tuple of coefficients (instead of + When passing in ``var=False``, a tuple of coefficients (instead of an actual polynomial) is returned:: sage: a.reduced_norm(var=False) (4, 0, 4, 1) TESTS: - + We check that `N` is a multiple of `a`:: sage: S(N).is_right_divisible_by(a) @@ -320,7 +320,7 @@ cdef class SkewPolynomial_finite_order_dense(SkewPolynomial_generic_dense): """ if self._norm is None: if self.is_zero(): - self._norm = 0 + self._norm = 0 else: parent = self._parent section = parent._embed_constants.section() @@ -387,7 +387,7 @@ cdef class SkewPolynomial_finite_order_dense(SkewPolynomial_generic_dense): By default, the name of the variable of the reduced characteristic polynomial is ``x`` and the name of central variable is usually ``z`` (see :meth:`~sage.rings.polynomial.skew_polynomial_ring.SkewPolynomialRing_finite_order.center` - for more details about this). + for more details about this). The user can speciify different names if desired:: sage: a.reduced_charpoly(var='T') # variable name for the caracteristic polynomial diff --git a/src/sage/rings/polynomial/skew_polynomial_ring.py b/src/sage/rings/polynomial/skew_polynomial_ring.py index c31a386c226..7d0c12538dc 100644 --- a/src/sage/rings/polynomial/skew_polynomial_ring.py +++ b/src/sage/rings/polynomial/skew_polynomial_ring.py @@ -1,5 +1,5 @@ r""" -Skew Univariate Polynomial Rings +Univariate skew polynomial rings This module provides the :class:`~sage.rings.polynomial.skew_polynomial_ring.SkewPolynomialRing`. diff --git a/src/sage/rings/rational.pyx b/src/sage/rings/rational.pyx index f215dff7e67..6964d3a17d1 100644 --- a/src/sage/rings/rational.pyx +++ b/src/sage/rings/rational.pyx @@ -576,12 +576,8 @@ cdef class Rational(sage.structure.element.FieldElement): if isinstance(x, Rational): set_from_Rational(self, x) - elif isinstance(x, long): - mpz_set_pylong(mpq_numref(self.value), x) - elif isinstance(x, int): - i = x - mpq_set_si(self.value, i, 1) + mpz_set_pylong(mpq_numref(self.value), x) elif isinstance(x, integer.Integer): set_from_Integer(self, x) @@ -629,19 +625,15 @@ cdef class Rational(sage.structure.element.FieldElement): num = x[0] denom = x[1] - if isinstance(num, long): + if isinstance(num, int): mpz_set_pylong(mpq_numref(self.value), num) - elif isinstance(num, int): # Python 2 only - mpz_set_si(mpq_numref(self.value), num) else: if not isinstance(num, integer.Integer): num = integer.Integer(num, base) mpz_set(mpq_numref(self.value), (num).value) - if isinstance(denom, long): + if isinstance(denom, int): mpz_set_pylong(mpq_denref(self.value), denom) - elif isinstance(denom, int): # Python 2 only - mpz_set_si(mpq_denref(self.value), denom) else: if not isinstance(denom, integer.Integer): denom = integer.Integer(denom, base) @@ -3695,7 +3687,7 @@ cdef class Rational(sage.structure.element.FieldElement): 32/3 """ if isinstance(x, Rational): - if isinstance(y, (int, long, integer.Integer)): + if isinstance(y, (int, integer.Integer)): return (x)._lshift(y) if isinstance(y, Rational): if mpz_cmp_si(mpq_denref((y).value), 1) != 0: @@ -3743,7 +3735,7 @@ cdef class Rational(sage.structure.element.FieldElement): 1/8 """ if isinstance(x, Rational): - if isinstance(y, (int, long, integer.Integer)): + if isinstance(y, (int, integer.Integer)): return (x)._rshift(y) if isinstance(y, Rational): if mpz_cmp_si(mpq_denref((y).value), 1) != 0: diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx index 09ace5ec1eb..096cba738c6 100644 --- a/src/sage/rings/real_mpfr.pyx +++ b/src/sage/rings/real_mpfr.pyx @@ -1472,11 +1472,9 @@ cdef class RealNumber(sage.structure.element.RingElement): elif isinstance(x, Gen) and typ((x).g) == t_REAL: _gen = x self._set_from_GEN_REAL(_gen.g) - elif isinstance(x, long): + elif isinstance(x, int): x = Integer(x) mpfr_set_z(self.value, (x).value, parent.rnd) - elif isinstance(x, int): - mpfr_set_si(self.value, x, parent.rnd) elif isinstance(x, float): mpfr_set_d(self.value, x, parent.rnd) elif isinstance(x, complex) and x.imag == 0: @@ -5678,11 +5676,13 @@ cdef class RealLiteral(RealNumber): 1.3000000000000000000000000000000000000000000000000000000000 sage: 1.3 + 1.2 2.50000000000000 + sage: RR(1_0000.000000000000000000000000000000000000) + 10000.0000000000 """ RealNumber.__init__(self, parent, x, base) if isinstance(x, str): self.base = base - self.literal = x + self.literal = x.replace('_', '') def __neg__(self): """ diff --git a/src/sage/rings/tate_algebra.py b/src/sage/rings/tate_algebra.py index 701278b2eb1..877f2a2703e 100644 --- a/src/sage/rings/tate_algebra.py +++ b/src/sage/rings/tate_algebra.py @@ -239,7 +239,6 @@ class TateAlgebraFactory(UniqueFactory): AUTHORS: - Xavier Caruso, Thibaut Verron (2018-09) - """ def create_key(self, base, prec=None, log_radii=ZZ(0), names=None, order='degrevlex'): """ @@ -251,7 +250,7 @@ def create_key(self, base, prec=None, log_radii=ZZ(0), names=None, order='degrev - ``prec`` -- an integer or ``None`` (default: ``None``) - - ``log_radii`` -- an integer or a list or a tuple of integers + - ``log_radii`` -- an integer or a list or a tuple of integers (default: ``0``) - ``names`` -- names of the indeterminates @@ -1148,7 +1147,7 @@ def precision_cap(self): """ Return the precision cap of this Tate algebra. - NOTE:: + .. NOTE:: The precision cap is the truncation precision used for arithmetic operations computed by diff --git a/src/sage/rings/tate_algebra_element.pyx b/src/sage/rings/tate_algebra_element.pyx index 02b8305cd17..0ef1f8d86fe 100644 --- a/src/sage/rings/tate_algebra_element.pyx +++ b/src/sage/rings/tate_algebra_element.pyx @@ -1715,9 +1715,9 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): the precision at which the result is computed, if ``None``, the result is truncated according to the cap of the parent - NOTE: + .. NOTE:: - The ``n``-th root is computed as `\exp(\frac 1 n \log(f))`. + The ``n``-th root is computed as `\exp(\frac 1 n \log(f))`. EXAMPLES:: @@ -3318,7 +3318,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): - ``divisors`` -- a series, or a list of series - NOTE:: + NOTE: The condition on the remainder is that it has diff --git a/src/sage/rings/tate_algebra_ideal.pyx b/src/sage/rings/tate_algebra_ideal.pyx index ca4907a5994..58025c6069d 100644 --- a/src/sage/rings/tate_algebra_ideal.pyx +++ b/src/sage/rings/tate_algebra_ideal.pyx @@ -116,9 +116,9 @@ class TateAlgebraIdeal(Ideal_generic): - it is sorted, in the sense that the leading term of `g_i` is greater than the leading of `g_{i+1}` for all `i`. - NOTE: + .. NOTE:: - The result of this method is cached. + The result of this method is cached. EXAMPLES:: @@ -422,10 +422,10 @@ def groebner_basis_buchberger(I, prec, py_integral): Grobner basis of the ideal generated by the same generators over the ring over the ring of integers - NOTE:: + .. NOTE:: - This function is not meant to be called directly, but through the - ``groebner_basis`` method of Tate algebra ideals. + This function is not meant to be called directly, but through the + ``groebner_basis`` method of Tate algebra ideals. EXAMPLES:: diff --git a/src/sage/schemes/affine/affine_point.py b/src/sage/schemes/affine/affine_point.py index fb902a5596d..d7d50b2d064 100644 --- a/src/sage/schemes/affine/affine_point.py +++ b/src/sage/schemes/affine/affine_point.py @@ -105,7 +105,7 @@ def _matrix_times_point_(self, mat, dom): - ``mat`` -- a matrix - - ``dom`` -- (unused) needed for consistent function call with projective + - ``dom`` -- (unused) needed for consistent function call with projective OUTPUT: a scheme point given by ``mat*self`` diff --git a/src/sage/schemes/berkovich/berkovich_cp_element.py b/src/sage/schemes/berkovich/berkovich_cp_element.py index 9587901c476..b8cc1887957 100644 --- a/src/sage/schemes/berkovich/berkovich_cp_element.py +++ b/src/sage/schemes/berkovich/berkovich_cp_element.py @@ -314,7 +314,7 @@ def __init__(self, parent, center, radius=None, power=None, prec=20, space_type= center = (self._base_space)(center) except (TypeError, ValueError): raise ValueError('could not convert %s to %s' % (center, self._base_space)) - if not(center.scheme().ambient_space() is center.scheme()): + if center.scheme().ambient_space() is not center.scheme(): raise ValueError("the center of a point of projective Berkovich space cannot be " + "a point of %s" % (center.scheme())) # since we are over a field, we normalize coordinates @@ -334,7 +334,7 @@ def __init__(self, parent, center, radius=None, power=None, prec=20, space_type= raise ValueError("center in %s, should be in %s") % (center.parent(), self._base_space) else: # make sure the center is in the appropriate number field - if not(center.parent() == self._base_space): + if not (center.parent() == self._base_space): try: center = (self._base_space)(center) except (TypeError, ValueError): diff --git a/src/sage/schemes/berkovich/berkovich_space.py b/src/sage/schemes/berkovich/berkovich_space.py index 73369fda8d4..e1e6d87cea5 100644 --- a/src/sage/schemes/berkovich/berkovich_space.py +++ b/src/sage/schemes/berkovich/berkovich_space.py @@ -258,7 +258,7 @@ def __ne__(self,right): sage: B != C False """ - return not(self == right) + return not (self == right) def __hash__(self): """ diff --git a/src/sage/schemes/curves/projective_curve.py b/src/sage/schemes/curves/projective_curve.py index f9ff5944a90..e5a6ba01be1 100644 --- a/src/sage/schemes/curves/projective_curve.py +++ b/src/sage/schemes/curves/projective_curve.py @@ -434,9 +434,9 @@ def projection(self, P=None, PS=None): l = list(PP.gens()) for i in range(n + 1): l[i] = 0 - while(F(l) == 0): - l[i] = l[i] + 1 - Q = PP(l) # will be a point not on the curve + while F(l) == 0: + l[i] += 1 + Q = PP(l) # will be a point not on the curve else: # if the base ring is a finite field, iterate over all points in the ambient space and check which # are on this curve @@ -1893,20 +1893,20 @@ def rational_points_iterator(self): g10 = R(g(X,one,zero)) if g10.is_zero(): for x in K: - yield(self.point([x,one,zero])) + yield self.point([x, one, zero]) else: for x in g10.roots(multiplicities=False): - yield(self.point([x,one,zero])) + yield self.point([x, one, zero]) # points with Z = 1 for y in K: gy1 = R(g(X,y,one)) if gy1.is_zero(): for x in K: - yield(self.point([x,y,one])) + yield self.point([x, y, one]) else: for x in gy1.roots(multiplicities=False): - yield(self.point([x,y,one])) + yield self.point([x, y, one]) def _points_via_singular(self, sort=True): r""" diff --git a/src/sage/schemes/elliptic_curves/ell_finite_field.py b/src/sage/schemes/elliptic_curves/ell_finite_field.py index 6676a1964c2..3b5d11ef2e7 100644 --- a/src/sage/schemes/elliptic_curves/ell_finite_field.py +++ b/src/sage/schemes/elliptic_curves/ell_finite_field.py @@ -955,25 +955,27 @@ def abelian_group(self): if len(gens) == 2: P, Q = gens - n = self.cardinality() # cached - n1 = P.order() # cached + n = self.cardinality() # cached + n1 = P.order() # cached n2 = n//n1 - assert not n1 * Q # PARI should guarantee this + assert not n1 * Q # PARI should guarantee this k = n1.prime_to_m_part(n2) - Q *= k # don't need; kill that part + Q *= k # don't need; kill that part nQ = n2 * generic.order_from_multiple(n2*Q, n1//k//n2) S = n//nQ * P T = n2 * Q - S.set_order(nQ//n2) # for .discrete_log() + S.set_order(nQ//n2, check=False) # for .discrete_log() x = S.discrete_log(T) Q -= x * n1//nQ * P - Q.set_order(n2) # verifies n2*Q == 0 + assert not n2 * Q # by construction + Q.set_order(n2, check=False) + gens = P, Q - orders = [T.order() for T in gens] # cached + orders = [T.order() for T in gens] # cached self.gens.set_cache(gens) return AdditiveAbelianGroupWrapper(self.point_homset(), gens, orders) @@ -1155,7 +1157,7 @@ def is_ordinary(self, proof=True): """ return not is_j_supersingular(self.j_invariant(), proof=proof) - def set_order(self, value, num_checks=8): + def set_order(self, value, *, check=True, num_checks=8): r""" Set the value of self._order to value. @@ -1167,9 +1169,12 @@ def set_order(self, value, num_checks=8): - ``value`` -- integer in the Hasse-Weil range for this curve. - - ``num_checks`` (integer, default: 8) -- number of times to - check whether value*(a random point on this curve) is - equal to the identity. + - ``check`` (boolean, default: ``True``) -- whether or + not to run sanity checks on the input. + + - ``num_checks`` (integer, default: 8) -- if ``check`` is + ``True``, the number of times to check whether ``value`` + times a random point on this curve equals the identity. OUTPUT: @@ -1267,16 +1272,17 @@ def set_order(self, value, num_checks=8): """ value = Integer(value) - # Is value in the Hasse range? - q = self.base_field().order() - a,b = Hasse_bounds(q,1) - if not a <= value <= b: - raise ValueError('Value %s illegal (not an integer in the Hasse range)' % value) - # Is value*random == identity? - for i in range(num_checks): - G = self.random_point() - if value * G != self(0): - raise ValueError('Value %s illegal (multiple of random point not the identity)' % value) + if check: + # Is value in the Hasse range? + q = self.base_field().order() + a,b = Hasse_bounds(q,1) + if not a <= value <= b: + raise ValueError('Value %s illegal (not an integer in the Hasse range)' % value) + # Is value*random == identity? + for i in range(num_checks): + G = self.random_point() + if value * G != self(0): + raise ValueError('Value %s illegal (multiple of random point not the identity)' % value) # TODO: It might help some of PARI's algorithms if we # could copy this over to the .pari_curve() as well. diff --git a/src/sage/schemes/elliptic_curves/ell_modular_symbols.py b/src/sage/schemes/elliptic_curves/ell_modular_symbols.py index 72489b121f9..2b23f6c7555 100644 --- a/src/sage/schemes/elliptic_curves/ell_modular_symbols.py +++ b/src/sage/schemes/elliptic_curves/ell_modular_symbols.py @@ -8,7 +8,7 @@ subspace on which complex conjugation acts as multiplication by `+1` and one on which it acts by `-1`. -There are three implementations of modular symbols, two within +There are three implementations of modular symbols, two within ``Sage`` and one in Cremona's ``eclib`` library. One can choose here which one is used. diff --git a/src/sage/schemes/elliptic_curves/ell_point.py b/src/sage/schemes/elliptic_curves/ell_point.py index d53762dc675..23eb16a1c1a 100644 --- a/src/sage/schemes/elliptic_curves/ell_point.py +++ b/src/sage/schemes/elliptic_curves/ell_point.py @@ -484,8 +484,13 @@ def order(self): sage: E(0).order() == 1 True """ + try: + return self._order + except AttributeError: + pass if self.is_zero(): - return Integer(1) + self._order = Integer(1) + return self._order raise NotImplementedError("Computation of order of a point " "not implemented over general fields.") @@ -1173,7 +1178,7 @@ def _divide_out(self, p): pts = Q.division_points(p) return (Q, k) - def set_order(self, value): + def set_order(self, value, *, check=True): r""" Set the value of self._order to value. @@ -1194,7 +1199,7 @@ def set_order(self, value): :: - sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 6 + sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 12 sage: G = E(5, 0) sage: G.set_order(2) sage: 2*G @@ -1222,7 +1227,7 @@ def set_order(self, value): It is an error to pass a `value` equal to `0`:: - sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 6 + sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 12 sage: G = E.random_point() sage: G.set_order(0) Traceback (most recent call last): @@ -1237,7 +1242,7 @@ def set_order(self, value): order of this point. How unlikely is determined by the factorization of the actual order, and the actual group structure:: - sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 6 + sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 12 sage: G = E(5, 0) # G has order 2 sage: G.set_order(11) Traceback (most recent call last): @@ -1248,7 +1253,7 @@ def set_order(self, value): of interest". For instance, the order can be set to a multiple the actual order:: - sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 6 + sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 12 sage: G = E(5, 0) # G has order 2 sage: G.set_order(8) sage: G.order() @@ -1260,15 +1265,16 @@ def set_order(self, value): """ value = Integer(value) - E = self.curve() - q = E.base_ring().order() - if value <= 0: - raise ValueError('Value %s illegal for point order' % value) - low, hi = Hasse_bounds(q) - if value > hi: - raise ValueError('Value %s illegal: outside max Hasse bound' % value) - if value * self != E(0): - raise ValueError('Value %s illegal: %s * %s is not the identity' % (value, value, self)) + if check: + if value <= 0: + raise ValueError('Value %s illegal for point order' % value) + E = self.curve() + q = E.base_ring().cardinality() + low, hi = Hasse_bounds(q) + if value > hi: + raise ValueError('Value %s illegal: outside max Hasse bound' % value) + if value * self != E(0): + raise ValueError('Value %s illegal: %s * %s is not the identity' % (value, value, self)) self._order = value # ############################# end ################################ @@ -3560,7 +3566,7 @@ def discrete_log(self, Q, ord=None): - Otherwise (if this test is inconclusive), check that the Weil pairing of `P` and `Q` is trivial. - For anomalous curves with `\#E = p`, the + For anomalous curves with `\#E = p`, the :meth:`padic_elliptic_logarithm` function is called. INPUT: diff --git a/src/sage/schemes/generic/divisor.py b/src/sage/schemes/generic/divisor.py index 0d0079dbc28..336fee8304f 100644 --- a/src/sage/schemes/generic/divisor.py +++ b/src/sage/schemes/generic/divisor.py @@ -433,11 +433,11 @@ def coefficient(self, P): -1 """ P = self.parent().scheme()(P) - if not(P in self.support()): + if P not in self.support(): return self.base_ring().zero() t, i = search(self.support(), P) assert t try: return self._points[i][0] except AttributeError: - raise NotImplementedError + raise NotImplementedError diff --git a/src/sage/schemes/hyperelliptic_curves/hypellfrob.pyx b/src/sage/schemes/hyperelliptic_curves/hypellfrob.pyx index 18ad918ac62..c08bb3cfb53 100644 --- a/src/sage/schemes/hyperelliptic_curves/hypellfrob.pyx +++ b/src/sage/schemes/hyperelliptic_curves/hypellfrob.pyx @@ -1,8 +1,8 @@ # distutils: language = c++ -# distutils: sources = sage/schemes/hyperelliptic_curves/hypellfrob/hypellfrob.cpp sage/schemes/hyperelliptic_curves/hypellfrob/recurrences_ntl.cpp sage/schemes/hyperelliptic_curves/hypellfrob/recurrences_zn_poly.cpp -# distutils: depends = sage/schemes/hyperelliptic_curves/hypellfrob/hypellfrob.h sage/schemes/hyperelliptic_curves/hypellfrob/recurrences_ntl.h sage/schemes/hyperelliptic_curves/hypellfrob/recurrences_zn_poly.h +# distutils: sources = sage/schemes/hyperelliptic_curves/hypellfrob/hypellfrob.cpp sage/schemes/hyperelliptic_curves/hypellfrob/recurrences_ntl.cpp +# distutils: depends = sage/schemes/hyperelliptic_curves/hypellfrob/hypellfrob.h sage/schemes/hyperelliptic_curves/hypellfrob/recurrences_ntl.h # distutils: include_dirs = sage/libs/ntl/ sage/schemes/hyperelliptic_curves/hypellfrob/ NTL_INCDIR -# distutils: libraries = gmp NTL_LIBRARIES zn_poly +# distutils: libraries = gmp NTL_LIBRARIES # distutils: extra_compile_args = NTL_CFLAGS # distutils: library_dirs = NTL_LIBDIR # distutils: extra_link_args = NTL_LIBEXTRA @@ -59,7 +59,7 @@ cdef extern from "hypellfrob.h": void interval_products_wrapper \ "hypellfrob::hypellfrob_interval_products_wrapper" \ (mat_ZZ_p_c &output, const mat_ZZ_p_c &M0, const mat_ZZ_p_c &M1, - const vector[ZZ_c] target, int force_ntl) + const vector[ZZ_c] target) def interval_products(M0, M1, target): @@ -146,7 +146,7 @@ def interval_products(M0, M1, target): numintervals = len(target)/2 out.SetDims(dim, dim*numintervals) - interval_products_wrapper(out, mm0, mm1, targ, 1) + interval_products_wrapper(out, mm0, mm1, targ) sig_off() R = M0.matrix_space() diff --git a/src/sage/schemes/hyperelliptic_curves/hypellfrob/hypellfrob.cpp b/src/sage/schemes/hyperelliptic_curves/hypellfrob/hypellfrob.cpp index 7af598473ab..ee55e41e919 100644 --- a/src/sage/schemes/hyperelliptic_curves/hypellfrob/hypellfrob.cpp +++ b/src/sage/schemes/hyperelliptic_curves/hypellfrob/hypellfrob.cpp @@ -26,8 +26,8 @@ #include "hypellfrob.h" #include "recurrences_ntl.h" -#include "recurrences_zn_poly.h" +#include NTL_CLIENT @@ -74,17 +74,10 @@ The intervals are supplied in "target", simply as the list There are three possible underlying implementations: * ntl_interval_products (ZZ_p version), * ntl_interval_products (zz_p version), - * zn_poly_interval_products. -This function is a wrapper which takes ZZ_p input, calls one of the three +This function is a wrapper which takes ZZ_p input, calls one of the two above implementations depending on the size of the current ZZ_p modulus, and produces output in ZZ_p format. -If the force_ntl flag is set, it will never use the zn_poly version. - -Note that the zn_poly version occasionally fails; this happens more frequently -for smaller p, but is extremely rare for larger p. This wrapper detects this -and falls back on the zz_p/ZZ_p versions, which should never fail. - PRECONDITIONS: Let d = b[n-1] - a[0]. Then 2, 3, ... 1 + floor(sqrt(d)) must all be invertible. @@ -92,58 +85,10 @@ and falls back on the zz_p/ZZ_p versions, which should never fail. */ void interval_products_wrapper(vector& output, const mat_ZZ_p& M0, const mat_ZZ_p& M1, - const vector& target, - int force_ntl = 0) + const vector& target) { const ZZ& modulus = ZZ_p::modulus(); - if (!force_ntl && modulus <= (1UL << (ULONG_BITS - 1)) - 1) - { - // Small modulus; let's try using zn_poly if we're allowed. - // (we don't allow the full ULONG_BITS bits, because I'm worried I - // sometimes use NTL code which requires longs rather than ulongs.) - zn_mod_t mod; - zn_mod_init(mod, to_ulong(modulus)); - - int r = M0.NumRows(); - - // convert to zn_mod format - vector > M0_temp(r, vector(r)); - vector > M1_temp(r, vector(r)); - vector > > output_temp(target.size()/2, M0_temp); - - for (int x = 0; x < r; x++) - for (int y = 0; y < r; y++) - { - M0_temp[y][x] = to_ulong(rep(M0[y][x])); - M1_temp[y][x] = to_ulong(rep(M1[y][x])); - } - - int success = zn_poly_interval_products(output_temp, M0_temp, M1_temp, - target, mod); - zn_mod_clear(mod); - - // note: if we failed, we fall back on the ZZ_p or zz_p versions below - if (success) - { - // convert back to ZZ_p format - output.clear(); - mat_ZZ_p temp; - temp.SetDims(r, r); - for (size_t i = 0; i < target.size()/2; i++) - { - for (int x = 0; x < r; x++) - for (int y = 0; y < r; y++) - temp[y][x] = output_temp[i][y][x]; - output.push_back(temp); - } - - return; - } - - // failed - } - if (!modulus.SinglePrecision()) { // Large modulus.... go straight to the ZZ_p version @@ -182,11 +127,10 @@ void interval_products_wrapper(vector& output, void hypellfrob_interval_products_wrapper(mat_ZZ_p& output, const mat_ZZ_p& M0, const mat_ZZ_p& M1, - const vector& target, - int force_ntl = 0) + const vector& target) { vector mat_vector; - interval_products_wrapper(mat_vector, M0, M1, target, force_ntl); + interval_products_wrapper(mat_vector, M0, M1, target); int r = M0.NumRows(); output.SetDims(r, r * mat_vector.size()); @@ -327,7 +271,7 @@ void padic_invert_matrix(mat_ZZ_p& B, const mat_ZZ_p& A, const ZZ& p, int N) /* The main function exported from this module. See hypellfrob.h for information. */ -int matrix(mat_ZZ& output, const ZZ& p, int N, const ZZX& Q, int force_ntl) +int matrix(mat_ZZ& output, const ZZ& p, int N, const ZZX& Q) { // check input conditions if (N < 1 || p < 3) @@ -521,8 +465,8 @@ int matrix(mat_ZZ& output, const ZZ& p, int N, const ZZX& Q, int force_ntl) vector MH, DH; MH.reserve(L); DH.reserve(L); - interval_products_wrapper(MH, MH0[j], MH1[j], s, force_ntl); - interval_products_wrapper(DH, DH0[j], DH1[j], s, force_ntl); + interval_products_wrapper(MH, MH0[j], MH1[j], s); + interval_products_wrapper(DH, DH0[j], DH1[j], s); // Use the vandermonde matrix to extend all the way up to L if necessary. if (L > N) @@ -709,8 +653,8 @@ int matrix(mat_ZZ& output, const ZZ& p, int N, const ZZX& Q, int force_ntl) } modulusV.restore(); vector MV, DV; - interval_products_wrapper(MV, MV0, MV1, s, force_ntl); - interval_products_wrapper(DV, DV0, DV1, s, force_ntl); + interval_products_wrapper(MV, MV0, MV1, s); + interval_products_wrapper(DV, DV0, DV1, s); // Divide out each MV[j] by DV[j]. Note that for 1 <= j < N, both of them // should be divisible by p too, so we take that into account here. diff --git a/src/sage/schemes/hyperelliptic_curves/hypellfrob/hypellfrob.h b/src/sage/schemes/hyperelliptic_curves/hypellfrob/hypellfrob.h index e25629ced56..23a57464c48 100644 --- a/src/sage/schemes/hyperelliptic_curves/hypellfrob/hypellfrob.h +++ b/src/sage/schemes/hyperelliptic_curves/hypellfrob/hypellfrob.h @@ -44,18 +44,11 @@ The intervals are supplied in "target", simply as the list There are three possible underlying implementations: * ntl_interval_products (ZZ_p version), - * ntl_interval_products (zz_p version), - * zn_poly_interval_products. -This function is a wrapper which takes ZZ_p input, calls one of the three + * ntl_interval_products (zz_p version) +This function is a wrapper which takes ZZ_p input, calls one of the two above implementations depending on the size of the current ZZ_p modulus, and produces output in ZZ_p format. -If the force_ntl flag is set, it will never use the zn_poly version. - -Note that the zn_poly version occasionally fails; this happens more frequently -for smaller p, but is extremely rare for larger p. This wrapper detects this -and falls back on the zz_p/ZZ_p versions, which should never fail. - PRECONDITIONS: Let d = b[n-1] - a[0]. Then 2, 3, ... 1 + floor(sqrt(d)) must all be invertible. @@ -63,8 +56,7 @@ and falls back on the zz_p/ZZ_p versions, which should never fail. */ void hypellfrob_interval_products_wrapper(NTL::mat_ZZ_p& output, const NTL::mat_ZZ_p& M0, const NTL::mat_ZZ_p& M1, - const std::vector& target, - int force_ntl); + const std::vector& target); /* Computes frobenius matrix for given p, to precision p^N, for the @@ -82,8 +74,7 @@ RETURN VALUE: will not check that p is prime. That's up to you.) */ -int matrix(NTL::mat_ZZ& output, const NTL::ZZ& p, int N, const NTL::ZZX& Q, - int force_ntl = 0); +int matrix(NTL::mat_ZZ& output, const NTL::ZZ& p, int N, const NTL::ZZX& Q); }; diff --git a/src/sage/schemes/hyperelliptic_curves/hypellfrob/recurrences_zn_poly.cpp b/src/sage/schemes/hyperelliptic_curves/hypellfrob/recurrences_zn_poly.cpp deleted file mode 100644 index b9023adb489..00000000000 --- a/src/sage/schemes/hyperelliptic_curves/hypellfrob/recurrences_zn_poly.cpp +++ /dev/null @@ -1,552 +0,0 @@ -/* ============================================================================ - - recurrences_zn_poly.cpp: recurrences solved via zn_poly arithmetic - - This file is part of hypellfrob (version 2.1.1). - - Copyright (C) 2007, 2008, David Harvey - - 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. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -============================================================================ */ - - -#include "recurrences_zn_poly.h" - - -NTL_CLIENT - - -namespace hypellfrob { - - -Shifter::~Shifter() -{ - zn_array_mulmid_precomp1_clear(kernel_precomp); - free(input_twist); -} - - -Shifter::Shifter(ulong d, ulong a, ulong b, const zn_mod_t mod) -{ - this->d = d; - this->mod = mod; - - input_twist = (ulong*) malloc(sizeof(ulong) * (3*d + 3)); - output_twist = input_twist + d + 1; - scratch = output_twist + d + 1; - - ZZ modulus; - modulus = zn_mod_get (mod); - - // ------------------------ compute input_twist ------------------------- - - // prod = (d!)^(-1) - ulong prod = 1; - for (ulong i = 2; i <= d; i++) - prod = zn_mod_mul(prod, i, mod); - prod = to_ulong(InvMod(to_ZZ(prod), modulus)); - - // input_twist[i] = ((d-i)!)^(-1) - input_twist[0] = prod; - for (ulong i = 1; i <= d; i++) - input_twist[i] = zn_mod_mul(input_twist[i-1], d - (i-1), mod); - - // input_twist[i] = ((d-i)!*i!)^(-1) - for (ulong i = 0; i <= d/2; i++) - { - input_twist[i] = zn_mod_mul(input_twist[i], input_twist[d-i], mod); - input_twist[d-i] = input_twist[i]; - } - - // input_twist[i] = \prod_{0 <= j <= d, j != i} (i-j)^(-1) - // = (-1)^(d-i) ((d-i)!*i!)^(-1) - for (long i = d - 1; i >= 0; i -= 2) - input_twist[i] = zn_mod_neg(input_twist[i], mod); - - // ----------------- compute output_twist and kernel -------------------- - - // need some temp space: - // c, accum, accum_inv each of length 2d+1 - ulong* c = (ulong*) malloc(sizeof(ulong) * (6*d+3)); - ulong* accum = c + 2*d + 1; - ulong* accum_inv = accum + 2*d + 1; - ulong* kernel = c; // overwrites c - - // c[i] = c_i = a + (i-d)*b for 0 <= i <= 2d - c[0] = zn_mod_sub(a, zn_mod_mul(zn_mod_reduce(d, mod), b, mod), mod); - for (ulong i = 1; i <= 2*d; i++) - c[i] = zn_mod_add(c[i-1], b, mod); - - // accum[i] = c_0 * c_1 * ... * c_i for 0 <= i <= 2d - accum[0] = c[0]; - for (ulong i = 1; i <= 2*d; i++) - accum[i] = zn_mod_mul(accum[i-1], c[i], mod); - - // accum_inv[i] = (c_0 * c_1 * ... * c_i)^(-1) for 0 <= i <= 2d - accum_inv[2*d] = to_ulong(InvMod(to_ZZ(accum[2*d]), modulus)); - - for (long i = 2*d - 1; i >= 0; i--) - accum_inv[i] = zn_mod_mul(accum_inv[i+1], c[i+1], mod); - - // output_twist[i] = b^{-d} * c_i * c_{i+1} * ... * c_{i+d} - // for 0 <= i <= d - ulong factor = to_long(PowerMod(to_ZZ(b), -((long)d), modulus)); - output_twist[0] = zn_mod_mul(factor, accum[d], mod); - for (ulong i = 1; i <= d; i++) - output_twist[i] = zn_mod_mul(zn_mod_mul(factor, accum[i+d], mod), - accum_inv[i-1], mod); - - // kernel[i] = (c_i)^(-1) for 0 <= i <= 2d - kernel[0] = accum_inv[0]; - for (ulong i = 1; i <= 2*d; i++) - kernel[i] = zn_mod_mul(accum_inv[i], accum[i-1], mod); - - // precompute FFT of kernel - zn_array_mulmid_precomp1_init(kernel_precomp, kernel, 2*d+1, d+1, mod); - - free(c); -} - - -void Shifter::shift(ulong* output, const ulong* input) -{ - // multiply inputs pointwise by input_twist - for (ulong i = 0; i <= d; i++) - scratch[i] = zn_mod_mul(input[i], input_twist[i], mod); - - // do middle product - zn_array_mulmid_precomp1_execute(output, scratch, kernel_precomp); - - // multiply outputs pointwise by output_twist - for (ulong i = 0; i <= d; i++) - output[i] = zn_mod_mul(output[i], output_twist[i], mod); -} - - -/* - Checks whether large_evaluate() will succeed for these choices of k and u. - Returns 1 if okay, otherwise 0. -*/ -int check_params(ulong k, ulong u, const zn_mod_t mod) -{ - ulong n = zn_mod_get (mod); - - if (k >= n || u >= n) - return 0; - - if (k <= 1) - return 1; - - if (k == n - 1) - return 0; - - ulong k2 = k / 2; - - // need the following elements to be invertible: - // u - // 1, 2, ..., k + 1 - // k2 + i*u for -k2 <= i <= k2 - ulong prod = u; - for (ulong i = 2; i <= k; i++) - prod = zn_mod_mul(prod, i, mod); - ulong temp = zn_mod_mul(k2, zn_mod_sub(1, u, mod), mod); - for (ulong i = 0; i <= 2*k2; i++) - { - prod = zn_mod_mul(prod, temp, mod); - temp = zn_mod_add(temp, u, mod); - } - - ZZ x, y; - x = prod; - y = n; - if (GCD(x, y) != 1) - return 0; - - // check recursively below - return check_params(k2, u, mod); -} - - - -/* - Let M0 and M1 be square matrices of size r*r. Let M(x) = M0 + x*M1; this - is a matrix of linear polys in x. The matrices M0 and M1 are passed in - row-major order. - - Let P(x) = M(x+1) M(x+2) ... M(x+k); this is a matrix of polynomials of - degree k. - - This class attempts to compute the matrices - P(0), P(u), P(2u), ..., P(ku). - - Usage: - - * Call the constructor. - - * Call evaluate() with half == 0. This computes the first half of the - outputs, specifically P(mu) for 0 <= m <= k2, where k2 = floor(k/2). - The (i, j) entry of P(mu) is stored in output[i*r+j][m+offset]. Each array - output[i*r+j] must be preallocated to length k2 + 3. (The extra two matrices - at the end are used for scratch space.) - - * Call evaluate() with half == 1. This computes the second half, namely - P(mu) for k2 + 1 <= m <= k. The (i, j) entry of P(mu) is stored in - output[i*r+j][m-(k2+1)+offset]. Each array output[i*r+j] must be - preallocated to length k2 + 3. It's okay for this second half to overwrite - the first half generated earlier (in fact this property is used by - zn_poly_interval_products to conserve memory). - - The computation may fail for certain bad choices of k and u. Let p = residue - characteristic (i.e. assume mod is p^m for some m). Typically this function - gets called for k ~ u and k*u ~ M*p, for some M much smaller than p. In this - situation, I expect most choices of (k, u) are not bad. Failure is very - bad: the program will crash. Luckily, you can call check_params() to test - whether (k, u) is bad. If it's bad, you probably should just increment u - until you find one that's not bad. (Sorry, I haven't done a proper analysis - of the situation yet.) The main routines fall back on the zz_pX version if - they can't find a good parameter choice. - - Must have 0 <= k < n and 0 < u < n. - -*/ -LargeEvaluator::LargeEvaluator(int r, ulong k, ulong u, - const vector >& M0, - const vector >& M1, - const zn_mod_t& mod) : M0(M0), M1(M1), mod(mod) -{ - assert(k < zn_mod_get(mod)); - assert(u < zn_mod_get(mod)); - assert(r >= 1); - assert(k >= 1); - - this->r = r; - this->k = k; - this->k2 = k / 2; - this->odd = k & 1; - this->u = u; - this->shifter = NULL; -} - - -LargeEvaluator::~LargeEvaluator() -{ - if (this->shifter) - delete shifter; -} - - -void LargeEvaluator::evaluate(int half, vector& output, - ulong offset) -{ - // base cases - - if (k == 0) - { - // identity matrix - for (int x = 0; x < r; x++) - for (int y = 0; y < r; y++) - output[y*r + x].data[offset] = (x == y); - return; - } - - if (k == 1) - { - // evaluate M(1) (for half == 0) or M(u+1) (for half == 1) - for (int x = 0; x < r; x++) - for (int y = 0; y < r; y++) - { - ulong temp = zn_mod_add(M0[y][x], M1[y][x], mod); - output[y*r + x].data[offset] = half ? - zn_mod_add(temp, zn_mod_mul(u, M1[y][x], mod), mod) : temp; - } - return; - } - - // recursive case - - // Let Q(x) = M(x+1) ... M(x+k2), where k2 = floor(k/2). - // Then we have either - // P(x) = Q(x) Q(x+k2) if k is even - // P(x) = Q(x) Q(x+k2) M(x+k) if k is odd - - if (half == 0) - { - // This is the first time through this function. - // Allocate scratch space. - scratch.resize(r*r); - for (int i = 0; i < r*r; i++) - scratch[i].resize(k2 + 3); - - { - // Recursively compute Q(0), Q(u), ..., Q(k2*u). - // These are stored in scratch. - LargeEvaluator recurse(r, k2, u, M0, M1, mod); - recurse.evaluate_all(scratch); - } - - // Precomputations for value-shifting - shifter = new Shifter(k2, k2, u, mod); - } - else // half == 1 - { - // Shift original sequence by (k2+1)*u to obtain - // Q((k2+1)*u), Q((k2+2)*u), ..., Q((2*k2+1)*u) - Shifter big_shifter(k2, zn_mod_mul(k2+1, u, mod), u, mod); - for (int i = 0; i < r*r; i++) - big_shifter.shift(scratch[i].data, scratch[i].data); - } - - // Let H = (k2+1)*u*half, so now scratch contains - // Q(H), Q(H + u), ..., Q(H + k2*u). - - // Shift by k2 to obtain Q(H + k2), Q(H + u + k2), ..., Q(H + k2*u + k2). - // Results are stored directly in output array. We put them one slot - // to the right, to make room for inplace matrix multiplies later on. - // (If k is odd, they're shifted right by yet another slot, to make room - // for another round of multiplies.) - for (int i = 0; i < r*r; i++) - shifter->shift(output[i].data + offset + odd + 1, scratch[i].data); - - // If k is odd, right-multiply each Q(H + i*u + k2) by M(H + i*u + k) - // (results are stored in output array, shifted one entry to the left) - if (odd) - { - ulong_array cruft(r*r); // for storing M(H + i*u + k) - ulong point = k; // evaluation point - if (half) - point = zn_mod_add(point, zn_mod_mul(k2 + 1, u, mod), mod); - - for (ulong i = 0; i <= k2; i++, point = zn_mod_add(point, u, mod)) - { - // compute M(H + i*u + k) = M0 + M1*point - for (int x = 0; x < r; x++) - for (int y = 0; y < r; y++) - cruft.data[y*r + x] = zn_mod_add(M0[y][x], - zn_mod_mul(M1[y][x], point, mod), mod); - - // multiply - for (int x = 0; x < r; x++) - for (int y = 0; y < r; y++) - { - ulong accum = 0; - for (int z = 0; z < r; z++) - accum = zn_mod_add(accum, - zn_mod_mul(output[y*r + z].data[offset + i + 2], - cruft.data[z*r + x], mod), mod); - output[y*r + x].data[offset + i + 1] = accum; - } - } - } - - ulong n = zn_mod_get(mod); - - // Multiply to obtain P(H), P(H + u), ..., P(H + k2*u) - // (except for the last one, in the second half, if k is even) - // Store results directly in output array. - for (ulong i = 0; i + (half && !odd) <= k2; i++) - for (int x = 0; x < r; x++) - for (int y = 0; y < r; y++) - { - ulong sum_hi = 0; - ulong sum_lo = 0; - for (int z = 0; z < r; z++) - { - ulong hi, lo; - ZNP_MUL_WIDE(hi, lo, scratch[y*r + z].data[i], - output[z*r + x].data[offset + i + 1]); - ZNP_ADD_WIDE(sum_hi, sum_lo, sum_hi, sum_lo, hi, lo); - if (sum_hi >= n) - sum_hi -= n; - } - output[y*r + x].data[offset + i] = - zn_mod_reduce_wide(sum_hi, sum_lo, mod); - } -} - - -/* - Evaluates both halves, storing results in output array. -*/ -void LargeEvaluator::evaluate_all(vector& output) -{ - evaluate(0, output, 0); - evaluate(1, output, k/2 + 1); -} - - - -/* -See interval_products_wrapper(). - -NOTE 1: - I haven't proved that the algorithm here always succeeds, although I expect - that it almost always will, especially when p is very large. If it - succeeds, it returns 1. If it fails, it returns 0 (practically instantly). - In the latter case, at least the caller can fall back on - ntl_interval_products(). - -NOTE 2: - The algorithm here is similar to ntl_interval_products(). However, it - doesn't do the "refining step" -- it just handles the smaller intervals - in the naive fashion. Also, instead of breaking intervals into power-of-four - lengths, it just does the whole thing in one chunk. The performance ends up - being smoother, but it's harder to prove anything about avoiding - non-invertible elements. Hence the caveat in Note 1. - -*/ -int zn_poly_interval_products(vector > >& output, - const vector >& M0, - const vector >& M1, - const vector& target, const zn_mod_t& mod) -{ - output.resize(target.size() / 2); - - // select k such that k*(k+1) >= total length of intervals - ulong k; - { - ZZ len = target.back() - target.front(); - ZZ kk = SqrRoot(len); - k = to_ulong(kk); - if (kk * (kk + 1) < len) - k++; - } - - int r = M0.size(); - - // try to find good parameters u and k - ulong u = k; - for (int trial = 0; ; trial++, u++) - { - if (check_params(k, u, mod)) - break; // found some good parameters - if (trial == 5) - return 0; // too many failures, give up - } - - ulong n = zn_mod_get(mod); - - // shift M0 over to account for starting index - vector > M0_shifted = M0; - ulong shift = target.front() % n; - for (int x = 0; x < r; x++) - for (int y = 0; y < r; y++) - M0_shifted[y][x] = zn_mod_add(M0[y][x], - zn_mod_mul(shift, M1[y][x], mod), mod); - - // prepare for evaluating products over the big intervals - // [0, k), [u, u+k), ..., [ku, ku+k) - LargeEvaluator evaluator(r, k, u, M0_shifted, M1, mod); - - vector big(r*r); - for (int i = 0; i < r*r; i++) - big[i].resize(k/2 + 3); // space for half the products, plus two more - - // evaluate the first half of the products - evaluator.evaluate(0, big, 0); - // flag indicating which half we currently have stored in the "big" array - int half = 0; - - vector > accum(r, vector(r)); - vector > temp1(r, vector(r)); - vector > temp2(r, vector(r)); - - // for each target interval.... - for (size_t i = 0; i < target.size()/2; i++) - { - // doing interval [s0, s1) - ZZ s0 = target[2*i]; - ZZ s1 = target[2*i+1]; - - // product accumulated so far is [t0, t1). - ZZ t0 = s0; - ZZ t1 = s0; - for (int x = 0; x < r; x++) - for (int y = 0; y < r; y++) - accum[x][y] = (x == y); // identity matrix - - while (t1 < s1) - { - // if we are exactly on the left end of a big interval, and the - // big interval fits inside the target interval, then roll it in - if ((t1 - target[0]) % u == 0 && t1 + k <= s1) - { - // compute which "big" interval we are rolling in - size_t index = to_ulong((t1 - target[0]) / u); - - if (index >= k/2 + 1) - { - // if the "big" interval is in the second half, and we haven't - // computed the second half of the intervals yet, then go and - // compute them (overwriting the first half) - if (half == 0) - { - evaluator.evaluate(1, big, 0); - half = 1; - } - index -= (k/2 + 1); - } - - for (int x = 0; x < r; x++) - for (int y = 0; y < r; y++) - temp1[y][x] = big[y*r + x].data[index]; - - t1 += k; - } - else - { - // otherwise just multiply by the single matrix M(t1 + 1) - ulong e = (t1 + 1) % n; - - for (int x = 0; x < r; x++) - for (int y = 0; y < r; y++) - temp1[y][x] = zn_mod_add(M0[y][x], - zn_mod_mul(M1[y][x], e, mod), mod); - - t1++; - } - - // multiply by whichever matrix we picked up above - for (int x = 0; x < r; x++) - for (int y = 0; y < r; y++) - { - ulong sum_hi = 0; - ulong sum_lo = 0; - for (int z = 0; z < r; z++) - { - ulong hi, lo; - ZNP_MUL_WIDE(hi, lo, accum[y][z], temp1[z][x]); - ZNP_ADD_WIDE(sum_hi, sum_lo, sum_hi, sum_lo, hi, lo); - if (sum_hi >= n) - sum_hi -= n; - } - temp2[y][x] = zn_mod_reduce_wide(sum_hi, sum_lo, mod); - } - - accum.swap(temp2); - } - - // store result in output array - output[i] = accum; - } - - return 1; -} - - -}; // namespace hypellfrob - - -// ----------------------- end of file diff --git a/src/sage/schemes/hyperelliptic_curves/hypellfrob/recurrences_zn_poly.h b/src/sage/schemes/hyperelliptic_curves/hypellfrob/recurrences_zn_poly.h deleted file mode 100644 index c5e936036c4..00000000000 --- a/src/sage/schemes/hyperelliptic_curves/hypellfrob/recurrences_zn_poly.h +++ /dev/null @@ -1,158 +0,0 @@ -/* ============================================================================ - - recurrences_zn_poly.h: header for recurrences_zn_poly.cpp - - This file is part of hypellfrob (version 2.1.1). - - Copyright (C) 2007, 2008, David Harvey - - 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. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -============================================================================ */ - - -#include -#include -#include - - - -namespace hypellfrob { - - -/* -This struct stores precomputed information that can then be used to shift -evaluation values of a polynomial F(x) of degree d. - -Specifically, given the values - F(0), F(b), F(2*b), ..., F(d*b), -the shift() method computes - F(a), F(a + b), F(a + 2*b), ..., F(a + d*b). - -PRECONDITIONS: - d >= 0 - 1, 2, ..., d + 1 are invertible - a + i*b are invertible for -d <= i <= d - -*/ -struct Shifter -{ - ulong d; - - // input_twist is a vector of length d + 1. - // The i-th entry is \prod_{0 <= j <= d, j != i} (i-j)^(-1). - // todo: this is symmetric, so can make it d/2 + 1, but need to - // deal with even/odd cases separately? - ulong* input_twist; - - // output_twist is a vector of length d + 1. - // The i-th entry is b^(-d) \prod_{0 <= j <= d} (a + (i-j)*b). - ulong* output_twist; - - // precomputed info for performing middle product against a "kernel" - // polynomial of degree 2d. The coefficients of "kernel" are - // (a + k*b)^(-1) for -d <= k <= d. - zn_array_mulmid_precomp1_t kernel_precomp; - - // Scratch space for shift(), length d + 1 - ulong* scratch; - - // zn_poly modulus object - const zn_mod_struct* mod; - - ~Shifter(); - - // Constructor (performs various precomputations) - Shifter(ulong d, ulong a, ulong b, const zn_mod_t mod); - - // Shifts evaluation values as described above. - // Assumes both output and input have length d + 1. - void shift(ulong* output, const ulong* input); -}; - - -/* - Grrr..... I would rather use vector, but then strictly speaking - I can't be guaranteed that the data is stored in a simple array format, - so here I go rolling my own.... -*/ -struct ulong_array -{ - ulong* data; - - ulong_array() - { - data = NULL; - } - - ulong_array(ulong amount) - { - data = (ulong*) malloc(sizeof(ulong) * amount); - } - - ~ulong_array() - { - if (data) - free(data); - } - - void resize(ulong amount) - { - if (data) - data = (ulong*) realloc(data, sizeof(ulong) * amount); - else - data = (ulong*) malloc(sizeof(ulong) * amount); - } -}; - - - -int check_params(ulong k, ulong u, const zn_mod_t mod); - - - -struct LargeEvaluator -{ - int r; - ulong k, u, k2, odd; - const std::vector >& M0; - const std::vector >& M1; - const zn_mod_t& mod; - Shifter* shifter; - std::vector scratch; - - LargeEvaluator(int r, ulong k, ulong u, - const std::vector >& M0, - const std::vector >& M1, - const zn_mod_t& mod); - - ~LargeEvaluator(); - - void evaluate(int half, std::vector& output, ulong offset); - void evaluate_all(std::vector& output); -}; - - - -int zn_poly_interval_products( - std::vector > >& output, - const std::vector >& M0, - const std::vector >& M1, - const std::vector& target, const zn_mod_t& mod); - - -}; - -// ----------------------- end of file diff --git a/src/sage/schemes/plane_quartics/quartic_constructor.py b/src/sage/schemes/plane_quartics/quartic_constructor.py index 4b459b3c718..a0b5ce3c93a 100644 --- a/src/sage/schemes/plane_quartics/quartic_constructor.py +++ b/src/sage/schemes/plane_quartics/quartic_constructor.py @@ -51,12 +51,12 @@ def QuarticCurve(F, PP=None, check=False): """ if not is_MPolynomial(F): - raise ValueError("Argument F (=%s) must be a multivariate polynomial"%F) + raise ValueError(f"Argument F (={F}) must be a multivariate polynomial") P = F.parent() if not P.ngens() == 3: - raise ValueError("Argument F (=%s) must be a polynomial in 3 variables"%F) - if not(F.is_homogeneous() and F.degree()==4): - raise ValueError("Argument F (=%s) must be a homogeneous polynomial of degree 4"%F) + raise ValueError("Argument F (=%s) must be a polynomial in 3 variables" % F) + if not (F.is_homogeneous() and F.degree() == 4): + raise ValueError("Argument F (=%s) must be a homogeneous polynomial of degree 4" % F) if PP is not None: if not is_ProjectiveSpace(PP) and PP.dimension == 2: diff --git a/src/sage/schemes/product_projective/homset.py b/src/sage/schemes/product_projective/homset.py index 7f4e1de0773..28aa566bb73 100644 --- a/src/sage/schemes/product_projective/homset.py +++ b/src/sage/schemes/product_projective/homset.py @@ -146,7 +146,7 @@ def points(self, **kwds): (1 : 0 : 0 , 0 : 1), (1 : 0 : 0 , 1 : 0), (1 : 0 : 0 , 1 : 1), (1 : 0 : 0 , 2 : 1), (1 : 0 : 1 , 0 : 1), (1 : 0 : 1 , 1 : 0), (1 : 0 : 1 , 1 : 1), (1 : 0 : 1 , 2 : 1), (1 : 1 : 0 , 0 : 1), (1 : 1 : 0 , 1 : 0), (1 : 1 : 0 , 1 : 1), (1 : 1 : 0 , 2 : 1), - (1 : 1 : 1 , 0 : 1), (1 : 1 : 1 , 1 : 0), (1 : 1 : 1 , 1 : 1), (1 : 1 : 1 , 2 : 1), + (1 : 1 : 1 , 0 : 1), (1 : 1 : 1 , 1 : 0), (1 : 1 : 1 , 1 : 1), (1 : 1 : 1 , 2 : 1), (1 : 2 : 1 , 0 : 1), (1 : 2 : 1 , 1 : 0), (1 : 2 : 1 , 1 : 1), (1 : 2 : 1 , 2 : 1), (2 : 0 : 1 , 0 : 1), (2 : 0 : 1 , 1 : 0), (2 : 0 : 1 , 1 : 1), (2 : 0 : 1 , 2 : 1), (2 : 1 : 0 , 0 : 1), (2 : 1 : 0 , 1 : 0), (2 : 1 : 0 , 1 : 1), (2 : 1 : 0 , 2 : 1), diff --git a/src/sage/schemes/product_projective/rational_point.py b/src/sage/schemes/product_projective/rational_point.py index 3bd717ee39e..53e08bcc171 100644 --- a/src/sage/schemes/product_projective/rational_point.py +++ b/src/sage/schemes/product_projective/rational_point.py @@ -122,7 +122,7 @@ def enum_product_projective_rational_field(X, B): (0 : 0 : 1 , 0 : 1), (0 : 0 : 1 , 1 : 1), (0 : 1 : 0 , 0 : 1), (0 : 1 : 0 , 1 : 1), (1 : -1/2 : 1 , 0 : 1), (1 : -1/2 : 1 , 1 : 1)] """ - if(is_Scheme(X)): + if is_Scheme(X): if (not is_ProductProjectiveSpaces(X.ambient_space())): raise TypeError("ambient space must be product of projective space over the rational field") X = X(X.base_ring()) @@ -225,7 +225,7 @@ def enum_product_projective_number_field(X, **kwds): tol = kwds.pop('tolerance', 1e-2) prec = kwds.pop('precision', 53) - if(is_Scheme(X)): + if is_Scheme(X): if (not is_ProductProjectiveSpaces(X.ambient_space())): raise TypeError("ambient space must be product of projective space over the rational field") X = X(X.base_ring()) @@ -281,7 +281,7 @@ def enum_product_projective_finite_field(X): sage: len(enum_product_projective_finite_field(X)) 36 """ - if(is_Scheme(X)): + if is_Scheme(X): if (not is_ProductProjectiveSpaces(X.ambient_space())): raise TypeError("ambient space must be product of projective space over the rational field") X = X(X.base_ring()) diff --git a/src/sage/schemes/product_projective/space.py b/src/sage/schemes/product_projective/space.py index 79bd69f671e..604adcc8a41 100644 --- a/src/sage/schemes/product_projective/space.py +++ b/src/sage/schemes/product_projective/space.py @@ -1259,19 +1259,19 @@ def __iter__(self): (1 : 0 : 0 , 1 : 0)] """ iters = [iter(T) for T in self._components] - L=[] + L = [] for x in iters: - L.append(next(x)) # put at zero - yield(self(L)) + L.append(next(x)) # put at zero + yield self(L) j = 0 while j < self.num_components(): try: L[j] = next(iters[j]) - yield(self(L)) + yield self(L) j = 0 except StopIteration: iters[j] = iter(self[j]) # reset - L[j] = next(iters[j]) # put at zero + L[j] = next(iters[j]) # put at zero j += 1 def rational_points(self, F=None): diff --git a/src/sage/schemes/projective/projective_subscheme.py b/src/sage/schemes/projective/projective_subscheme.py index 3c0faa498a6..c491edebea4 100644 --- a/src/sage/schemes/projective/projective_subscheme.py +++ b/src/sage/schemes/projective/projective_subscheme.py @@ -982,7 +982,7 @@ def dual(self): from sage.libs.singular.function_factory import ff K = self.base_ring() - if not(is_RationalField(K) or is_FiniteField(K)): + if not (is_RationalField(K) or is_FiniteField(K)): raise NotImplementedError("base ring must be QQ or a finite field") I = self.defining_ideal() m = I.ngens() @@ -1163,19 +1163,19 @@ def multiplicity(self, P): sage: C.multiplicity(Q) 8 """ - if not self.base_ring() in Fields(): + if self.base_ring() not in Fields(): raise TypeError("subscheme must be defined over a field") # check whether P is a point on this subscheme try: P = self(P) except TypeError: - raise TypeError("(=%s) is not a point on (=%s)"%(P,self)) + raise TypeError("(=%s) is not a point on (=%s)" % (P,self)) # find an affine chart of the ambient space of self that contains P i = 0 - while(P[i] == 0): - i = i + 1 + while P[i] == 0: + i += 1 X = self.affine_patch(i) return X.multiplicity(X(P.dehomogenize(i))) diff --git a/src/sage/schemes/toric/divisor.py b/src/sage/schemes/toric/divisor.py index f028b1d10af..8647225c77b 100644 --- a/src/sage/schemes/toric/divisor.py +++ b/src/sage/schemes/toric/divisor.py @@ -1402,7 +1402,7 @@ def _sheaf_cohomology(self, cplx): degree = h[0] + 1 cohomology_dim = h[1].dimension() if degree > d or degree < 0: - assert(cohomology_dim == 0) + assert cohomology_dim == 0 continue HH_list[degree] = cohomology_dim diff --git a/src/sage/schemes/toric/library.py b/src/sage/schemes/toric/library.py index 984243c8934..c8ecbf6a587 100644 --- a/src/sage/schemes/toric/library.py +++ b/src/sage/schemes/toric/library.py @@ -1391,7 +1391,7 @@ def WP(self, *q, **kw): Closed subscheme of 2-d toric variety covered by 3 affine patches defined by: -x^6 + z^6 + y^2 """ - if len(q)==1: + if len(q) == 1: # tuples and lists of weights are acceptable input if isinstance(q[0], (list, tuple)): q = q[0] @@ -1403,7 +1403,7 @@ def WP(self, *q, **kw): for i in range(m): try: q[i] = ZZ(q[i]) - except(TypeError): + except TypeError: raise TypeError("the weights (=%s) must be integers" % q) if q[i] <= 0: raise ValueError("the weights (=%s) must be positive integers" % q) diff --git a/src/sage/structure/parent.pyx b/src/sage/structure/parent.pyx index 585ec9e559e..21447d96b1a 100644 --- a/src/sage/structure/parent.pyx +++ b/src/sage/structure/parent.pyx @@ -114,7 +114,6 @@ from sage.cpython.type cimport can_assign_class cimport sage.categories.morphism as morphism cimport sage.categories.map as map from sage.structure.debug_options cimport debug -from sage.structure.richcmp cimport rich_to_bool from sage.structure.sage_object cimport SageObject from sage.misc.cachefunc import cached_method from sage.misc.lazy_attribute import lazy_attribute diff --git a/src/sage/tests/books/judson-abstract-algebra/boolean-sage.py b/src/sage/tests/books/judson-abstract-algebra/boolean-sage.py index 460403b3efb..2d7b13c00f7 100644 --- a/src/sage/tests/books/judson-abstract-algebra/boolean-sage.py +++ b/src/sage/tests/books/judson-abstract-algebra/boolean-sage.py @@ -152,7 +152,7 @@ ~~~~~~~~~~~~~~~~~~~~~~ :: sage: linear = P.linear_extension(); linear - [18, 9, 11, 6, 10, 0, 2, 1, 8, 3, 15, + [18, 9, 11, 6, 10, 0, 2, 1, 8, 3, 15, 7, 4, 14, 5, 19, 16, 13, 17, 12] ~~~~~~~~~~~~~~~~~~~~~~ :: diff --git a/src/sage/tests/cmdline.py b/src/sage/tests/cmdline.py index 1570b9c9b6a..12e73393206 100644 --- a/src/sage/tests/cmdline.py +++ b/src/sage/tests/cmdline.py @@ -725,7 +725,7 @@ def test_executable(args, input="", timeout=100.0, pydebug_ignore_warnings=False except KeyError: pass - __with_pydebug = hasattr(sys, 'gettotalrefcount') # This is a Python debug build (--with-pydebug) + __with_pydebug = hasattr(sys, 'gettotalrefcount') # This is a Python debug build (--with-pydebug) if __with_pydebug and pydebug_ignore_warnings: pexpect_env['PYTHONWARNINGS'] = ','.join([ 'ignore::DeprecationWarning', diff --git a/src/sage/version.py b/src/sage/version.py index dda1b246d28..a772cb6fbc4 100644 --- a/src/sage/version.py +++ b/src/sage/version.py @@ -1,5 +1,5 @@ # Sage version information for Python scripts # This file is auto-generated by the sage-update-version script, do not edit! -version = '9.8.beta5' -date = '2022-12-11' -banner = 'SageMath version 9.8.beta5, Release Date: 2022-12-11' +version = '9.8.beta6' +date = '2022-12-21' +banner = 'SageMath version 9.8.beta6, Release Date: 2022-12-21' diff --git a/src/sage_setup/autogen/giacpy-mkkeywords.py b/src/sage_setup/autogen/giacpy-mkkeywords.py index 1e103848f6b..8c5c1653b88 100644 --- a/src/sage_setup/autogen/giacpy-mkkeywords.py +++ b/src/sage_setup/autogen/giacpy-mkkeywords.py @@ -1,16 +1,15 @@ -# see the discussion in trac #29171 about where to store this file. +#see the discussion in trac #29171 about where to store this file. """ This file is to help the maintainer to upgrade the giac keywords in giacpy or giacpy_sage or sage.libs.giac -It creates auto-methods.pxi, keywords.pxi, newkeyword.pxi -It needs: +it creates auto-methods.pxi, keywords.pxi, newkeyword.pxi +it needs: the cas_help program from a giac installation + the aide_cas.txt file that you can built yourself like this: -- the ``cas_help`` program from a giac installation -- the ``aide_cas.txt`` file that you can built yourself like this:: +grep -E '^#' share/giac/doc/aide_cas |sed -e 's/^# //' >aide_cas.txt - grep -E '^#' share/giac/doc/aide_cas |sed -e 's/^# //' >aide_cas.txt It should not be used on the fly for an automatic installation script, because auto-methods.pxi is quite long to be built and adding new giac keywords often break the built of giacpy @@ -24,9 +23,9 @@ """ from subprocess import PIPE, Popen -blacklist = ['eval', 'cas_setup', 'i', 'list', 'input', 'in', 'sto', 'string', 'and', 'break', 'continue', 'else', 'for', 'from', 'if', 'not', 'or', 'pow', 'print', 'return', 'set[]', 'try', 'while', 'open', 'output', 'do', 'of', 'Request', 'i[]', '[]', 'ffunction', 'sleep', '[..]'] +blacklist=['eval', 'cas_setup', 'i', 'list', 'input', 'in', 'sto', 'string', 'and', 'break', 'continue', 'else', 'for', 'from', 'if', 'not', 'or', 'pow', 'print', 'return', 'set[]', 'try', 'while', 'open', 'output', 'do', 'of', 'Request','i[]', '[]', 'ffunction', 'sleep', '[..]'] -toremove = ['!', '!=', '#', '$', '%', '/%', '%/', '%{%}', '&&', '&*', '&^', "'", '()', '*', '*=', '+', '-', '+&', '+=', '+infinity', '-<', '-=', '->', '-infinity', '.*', '.+', '.-', './', '.^', '/=', ':=', '<', '<=', '=', '=<', '==', '=>', '>', '>=', '?', '@', '@@', 'ACOSH', 'ACOT', 'ACSC', 'ASEC', 'ASIN', 'ASINH', 'ATAN', 'ATANH', 'COND', 'COS', 'COSH', 'COT', 'CSC', 'CST', 'Celsius2Fahrenheit', 'ClrDraw', 'ClrGraph', 'ClrIO', 'CyclePic', 'DIGITS', 'DOM_COMPLEX', 'DOM_FLOAT', 'DOM_FUNC', 'DOM_IDENT', 'DOM_INT', 'DOM_LIST', 'DOM_RAT', 'DOM_STRING', 'DOM_SYMBOLIC', 'DOM_int', 'DelFold', 'DelVar', 'Det', 'Dialog', 'Digits', 'Disp', 'DispG', 'DispHome', 'DrawFunc', 'DrawInv', 'DrawParm', 'DrawPol', 'DrawSlp', 'DropDown', 'DrwCtour', 'ERROR', 'EXP', 'EndDlog', 'FALSE', 'False', 'Fahrenheit2Celsius', 'Fill', 'Gcd', 'GetFold', 'Graph', 'IFTE', 'Input', 'InputStr', 'Int', 'Inverse', 'LN', 'LQ', 'LSQ', 'NORMALD', 'NewFold', 'NewPic', 'Nullspace', 'Output', 'Ox_2d_unit_vector', 'Ox_3d_unit_vector', 'Oy_2d_unit_vector', 'Oy_3d_unit_vector', 'Oz_3d_unit_vector', 'Pause', 'PopUp', 'Quo', 'REDIM', 'REPLACE', 'RclPic', 'Rem', 'Resultant', 'RplcPic', 'Rref', 'SCALE', 'SCALEADD', 'SCHUR', 'SIN', 'SVD', 'SVL', 'SWAPCOL', 'SWAPROW', 'SetFold', 'Si', 'StoPic', 'Store', 'TAN', 'TRUE', 'True', 'TeX', 'Text', 'Title', 'Unarchiv', 'WAIT', '^', '_(cm/s)', '_(ft/s)', '_(ft*lb)', '_(m/s)', '_(m/s^2)', '_(rad/s)', '_(rad/s^2)', '_(tr/min)', '_(tr/s)', '_A', '_Angstrom', '_Bq', '_Btu', '_Ci', '_F', '_F_', '_Fdy', '_G_', '_Gal', '_Gy', '_H', '_Hz', '_I0_', '_J', '_K', '_Kcal', '_MHz', '_MW', '_MeV', '_N', '_NA_', '_Ohm', '_P', '_PSun_', '_Pa', '_R', '_REarth_', '_RSun_', '_R_', '_Rankine', '_Rinfinity_', '_S', '_St', '_StdP_', '_StdT_', '_Sv', '_T', '_V', '_Vm_', '_W', '_Wb', '_Wh', '_a', '_a0_', '_acre', '_alpha_', '_angl_', '_arcmin', '_arcs', '_atm', '_au', '_b', '_bar', '_bbl', '_bblep', '_bu', '_buUS', '_c3_', '_c_', '_cal', '_cd', '_chain', '_cm', '_cm^2', '_cm^3', '_ct', '_cu', '_d', '_dB', '_deg', '_degreeF', '_dyn', '_eV', '_epsilon0_', '_epsilon0q_', '_epsilonox_', '_epsilonsi_', '_erg', '_f0_', '_fath', '_fbm', '_fc', '_fermi', '_flam', '_fm', '_ft', '_ft*lb', '_ftUS', '_ft^2', '_ft^3', '_g', '_g_', '_ga', '_galC', '_galUK', '_galUS', '_gf', '_gmol', '_gon', '_grad', '_grain', '_h', '_h_', '_ha', '_hbar_', '_hp', '_in', '_inH20', '_inHg', '_in^2', '_in^3', '_j', '_kWh', '_k_', '_kg', '_kip', '_km', '_km^2', '_knot', '_kph', '_kq_', '_l', '_lam', '_lambda0_', '_lambdac_', '_lb', '_lbf', '_lbmol', '_lbt', '_lep', '_liqpt', '_lm', '_lx', '_lyr', '_m', '_mEarth_', '_m^2', '_m^3', '_me_', '_mho', '_miUS', '_miUS^2', '_mi^2', '_mil', '_mile', '_mille', '_ml', '_mm', '_mmHg', '_mn', '_mol', '_mp_', '_mph', '_mpme_', '_mu0_', '_muB_', '_muN_', '_oz', '_ozUK', '_ozfl', '_ozt', '_pc', '_pdl', '_ph', '_phi_', '_pk', '_psi', '_ptUK', '_q_', '_qe_', '_qepsilon0_', '_qme_', '_qt', '_rad', '_rad_', '_rd', '_rem', '_rod', '_rpm', '_s', '_sb', '_sd_', '_sigma_', '_slug', '_sr', '_st', '_syr_', '_t', '_tbsp', '_tec', '_tep', '_tex', '_therm', '_ton', '_tonUK', '_torr', '_tr', '_tsp', '_twopi_', '_u', '_yd', '_yd^2', '_yd^3', '_yr', '_\xc2\xb5', '_µ', 'assert', 'affichage', 'alors', 'animate', 'animate3d', 'animation', 'approx_mode', 'archive', 'args', 'as_function_of', 'asc', 'asec', 'assign', 'backquote', 'begin', 'black', 'blanc', 'bleu', 'bloc', 'blue', 'breakpoint', 'by', 'c1oc2', 'c1op2', 'cache_tortue', 'cap', 'cap_flat_line', 'cap_round_line', 'cap_square_line', 'case', 'cat', 'catch', 'cd', 'choosebox', 'click', 'close', 'complex_mode', 'de', 'del', 'debug', 'default', 'div', 'double', 'ecris', 'efface', 'elif', 'end', 'end_for', 'end_if', 'end_while', 'epaisseur', 'epaisseur_ligne_1', 'epaisseur_ligne_2', 'epaisseur_ligne_3', 'epaisseur_ligne_4', 'epaisseur_ligne_5', 'epaisseur_ligne_6', 'epaisseur_ligne_7', 'epaisseur_point_1', 'epaisseur_point_2', 'epaisseur_point_3', 'epaisseur_point_4', 'epaisseur_point_5', 'epaisseur_point_6', 'epaisseur_point_7', 'erase', 'erase3d', 'est_cocyclique', 'est_inclus', 'et', 'faire', 'faux', 'feuille', 'ffaire', 'ffonction', 'fi', 'filled', 'fin_enregistrement', 'float', 'fonction', 'fopen', 'format', 'fpour', 'frame_3d', 'frames', 'fsi', 'ftantque', 'func', 'function', 'gauche', 'gl_ortho', 'gl_quaternion', 'gl_rotation', 'gl_shownames', 'gl_texture', 'gl_x', 'gl_x_axis_color', 'gl_x_axis_name', 'gl_x_axis_unit', 'gl_xtick', 'gl_y', 'gl_y_axis_color', 'gl_y_axis_name', 'gl_y_axis_unit', 'gl_ytick', 'gl_z', 'gl_z_axis_color', 'gl_z_axis_name', 'gl_z_axis_unit', 'gl_ztick', 'gnuplot', 'goto', 'graph2tex', 'graph3d2tex', 'graphe', 'graphe3d', 'graphe_probabiliste', 'graphe_suite', 'green', 'grid_paper', 'hidden_name', 'identifier', 'ifft', 'ifte', 'inputform', 'intersect', 'is_included', 'jusqu_a', 'jusqua', 'jusque', 'keep_algext', 'kill', 'label', 'labels', 'len', 'leve_crayon', 'line_width_1', 'line_width_2', 'line_width_3', 'line_width_4', 'line_width_5', 'line_width_6', 'line_width_7', 'lis', 'local', 'minus', 'mod', 'noir', 'nom_cache', 'non', 'od', 'option', 'otherwise', 'ou', 'pas', 'point_arret', 'point_carre', 'point_croix', 'point_div', 'point_etoile', 'point_invisible', 'point_losange', 'point_milieu', 'point_plus', 'point_point', 'point_polaire', 'point_triangle', 'point_width_1', 'point_width_2', 'point_width_3', 'point_width_4', 'point_width_5', 'point_width_6', 'point_width_7', 'pour', 'proc', 'program', 'quadrant1', 'quadrant2', 'quadrant3', 'quadrant4', 'range', 'redim', 'repeat', 'repete', 'repeter', 'replace', 'restart', 'rouge', 'saisir', 'saisir_chaine', 'sauve', 'save_history', 'scale', 'scaleadd', 'si', 'sinon', 'size', 'stack', 'step', 'switch', 'tantque', 'test', 'textinput', 'then', 'thiele', 'time', 'to', 'union', 'until', 'var', 'vector', 'vers', 'vert', 'vrai', 'watch', 'when', 'white', 'with_sqrt', 'write', 'wz_certificate', 'xor', 'yellow', '{}', '|', '||','expression'] +toremove=['!', '!=', '#', '$', '%', '/%', '%/', '%{%}', '&&', '&*', '&^', "'", '()', '*', '*=', '+', '-', '+&', '+=', '+infinity', '-<', '-=', '->', '-infinity', '.*', '.+', '.-', './', '.^', '/=', ':=', '<', '<=', '=', '=<', '==', '=>', '>', '>=', '?', '@', '@@', 'ACOSH', 'ACOT', 'ACSC', 'ASEC', 'ASIN', 'ASINH', 'ATAN', 'ATANH', 'COND', 'COS', 'COSH', 'COT', 'CSC', 'CST', 'Celsius2Fahrenheit', 'ClrDraw', 'ClrGraph', 'ClrIO', 'CyclePic', 'DIGITS', 'DOM_COMPLEX', 'DOM_FLOAT', 'DOM_FUNC', 'DOM_IDENT', 'DOM_INT', 'DOM_LIST', 'DOM_RAT', 'DOM_STRING', 'DOM_SYMBOLIC', 'DOM_int', 'DelFold', 'DelVar', 'Det', 'Dialog', 'Digits', 'Disp', 'DispG', 'DispHome', 'DrawFunc', 'DrawInv', 'DrawParm', 'DrawPol', 'DrawSlp', 'DropDown', 'DrwCtour', 'ERROR', 'EXP', 'EndDlog', 'FALSE', 'False', 'Fahrenheit2Celsius', 'Fill', 'Gcd', 'GetFold', 'Graph', 'IFTE', 'Input', 'InputStr', 'Int', 'Inverse', 'LN', 'LQ', 'LSQ', 'NORMALD', 'NewFold', 'NewPic', 'Nullspace', 'Output', 'Ox_2d_unit_vector', 'Ox_3d_unit_vector', 'Oy_2d_unit_vector', 'Oy_3d_unit_vector', 'Oz_3d_unit_vector', 'Pause', 'PopUp', 'Quo', 'REDIM', 'REPLACE', 'RclPic', 'Rem', 'Resultant', 'RplcPic', 'Rref', 'SCALE', 'SCALEADD', 'SCHUR', 'SIN', 'SVD', 'SVL', 'SWAPCOL', 'SWAPROW', 'SetFold', 'Si', 'StoPic', 'Store', 'TAN', 'TRUE', 'True', 'TeX', 'Text', 'Title', 'Unarchiv', 'WAIT', '^', '_(cm/s)', '_(ft/s)', '_(ft*lb)', '_(m/s)', '_(m/s^2)', '_(rad/s)', '_(rad/s^2)', '_(tr/min)', '_(tr/s)', '_A', '_Angstrom', '_Bq', '_Btu', '_Ci', '_F', '_F_', '_Fdy', '_G_', '_Gal', '_Gy', '_H', '_Hz', '_I0_', '_J', '_K', '_Kcal', '_MHz', '_MW', '_MeV', '_N', '_NA_', '_Ohm', '_P', '_PSun_', '_Pa', '_R', '_REarth_', '_RSun_', '_R_', '_Rankine', '_Rinfinity_', '_S', '_St', '_StdP_', '_StdT_', '_Sv', '_T', '_V', '_Vm_', '_W', '_Wb', '_Wh', '_a', '_a0_', '_acre', '_alpha_', '_angl_', '_arcmin', '_arcs', '_atm', '_au', '_b', '_bar', '_bbl', '_bblep', '_bu', '_buUS', '_c3_', '_c_', '_cal', '_cd', '_chain', '_cm', '_cm^2', '_cm^3', '_ct', '_cu', '_d', '_dB', '_deg', '_degreeF', '_dyn', '_eV', '_epsilon0_', '_epsilon0q_', '_epsilonox_', '_epsilonsi_', '_erg', '_f0_', '_fath', '_fbm', '_fc', '_fermi', '_flam', '_fm', '_ft', '_ft*lb', '_ftUS', '_ft^2', '_ft^3', '_g', '_g_', '_ga', '_galC', '_galUK', '_galUS', '_gf', '_gmol', '_gon', '_grad', '_grain', '_h', '_h_', '_ha', '_hbar_', '_hp', '_in', '_inH20', '_inHg', '_in^2', '_in^3', '_j', '_kWh', '_k_', '_kg', '_kip', '_km', '_km^2', '_knot', '_kph', '_kq_', '_l', '_lam', '_lambda0_', '_lambdac_', '_lb', '_lbf', '_lbmol', '_lbt', '_lep', '_liqpt', '_lm', '_lx', '_lyr', '_m', '_mEarth_', '_m^2', '_m^3', '_me_', '_mho', '_miUS', '_miUS^2', '_mi^2', '_mil', '_mile', '_mille', '_ml', '_mm', '_mmHg', '_mn', '_mol', '_mp_', '_mph', '_mpme_', '_mu0_', '_muB_', '_muN_', '_oz', '_ozUK', '_ozfl', '_ozt', '_pc', '_pdl', '_ph', '_phi_', '_pk', '_psi', '_ptUK', '_q_', '_qe_', '_qepsilon0_', '_qme_', '_qt', '_rad', '_rad_', '_rd', '_rem', '_rod', '_rpm', '_s', '_sb', '_sd_', '_sigma_', '_slug', '_sr', '_st', '_syr_', '_t', '_tbsp', '_tec', '_tep', '_tex', '_therm', '_ton', '_tonUK', '_torr', '_tr', '_tsp', '_twopi_', '_u', '_yd', '_yd^2', '_yd^3', '_yr', '_\xc2\xb5', '_µ', 'assert', 'affichage', 'alors', 'animate', 'animate3d', 'animation', 'approx_mode', 'archive', 'args', 'as_function_of', 'asc', 'asec', 'assign', 'backquote', 'begin', 'black', 'blanc', 'bleu', 'bloc', 'blue', 'breakpoint', 'by', 'c1oc2', 'c1op2', 'cache_tortue', 'cap', 'cap_flat_line', 'cap_round_line', 'cap_square_line', 'case', 'cat', 'catch', 'cd', 'choosebox', 'click', 'close', 'complex_mode', 'de', 'del', 'debug', 'default', 'div', 'double', 'ecris', 'efface', 'elif', 'end', 'end_for', 'end_if', 'end_while', 'epaisseur', 'epaisseur_ligne_1', 'epaisseur_ligne_2', 'epaisseur_ligne_3', 'epaisseur_ligne_4', 'epaisseur_ligne_5', 'epaisseur_ligne_6', 'epaisseur_ligne_7', 'epaisseur_point_1', 'epaisseur_point_2', 'epaisseur_point_3', 'epaisseur_point_4', 'epaisseur_point_5', 'epaisseur_point_6', 'epaisseur_point_7', 'erase', 'erase3d', 'est_cocyclique', 'est_inclus', 'et', 'faire', 'faux', 'feuille', 'ffaire', 'ffonction', 'fi', 'filled', 'fin_enregistrement', 'float', 'fonction', 'fopen', 'format', 'fpour', 'frame_3d', 'frames', 'fsi', 'ftantque', 'func', 'function', 'gauche', 'gl_ortho', 'gl_quaternion', 'gl_rotation', 'gl_shownames', 'gl_texture', 'gl_x', 'gl_x_axis_color', 'gl_x_axis_name', 'gl_x_axis_unit', 'gl_xtick', 'gl_y', 'gl_y_axis_color', 'gl_y_axis_name', 'gl_y_axis_unit', 'gl_ytick', 'gl_z', 'gl_z_axis_color', 'gl_z_axis_name', 'gl_z_axis_unit', 'gl_ztick', 'gnuplot', 'goto', 'graph2tex', 'graph3d2tex', 'graphe', 'graphe3d', 'graphe_probabiliste', 'graphe_suite', 'green', 'grid_paper', 'hidden_name', 'identifier', 'ifft', 'ifte', 'inputform', 'intersect', 'is_included', 'jusqu_a', 'jusqua', 'jusque', 'keep_algext', 'kill', 'label', 'labels', 'len', 'leve_crayon', 'line_width_1', 'line_width_2', 'line_width_3', 'line_width_4', 'line_width_5', 'line_width_6', 'line_width_7', 'lis', 'local', 'minus', 'mod', 'noir', 'nom_cache', 'non', 'od', 'option', 'otherwise', 'ou', 'pas', 'point_arret', 'point_carre', 'point_croix', 'point_div', 'point_etoile', 'point_invisible', 'point_losange', 'point_milieu', 'point_plus', 'point_point', 'point_polaire', 'point_triangle', 'point_width_1', 'point_width_2', 'point_width_3', 'point_width_4', 'point_width_5', 'point_width_6', 'point_width_7', 'pour', 'proc', 'program', 'quadrant1', 'quadrant2', 'quadrant3', 'quadrant4', 'range', 'redim', 'repeat', 'repete', 'repeter', 'replace', 'restart', 'rouge', 'saisir', 'saisir_chaine', 'sauve', 'save_history', 'scale', 'scaleadd', 'si', 'sinon', 'size', 'stack', 'step', 'switch', 'tantque', 'test', 'textinput', 'then', 'thiele', 'time', 'to', 'union', 'until', 'var', 'vector', 'vers', 'vert', 'vrai', 'watch', 'when', 'white', 'with_sqrt', 'write', 'wz_certificate', 'xor', 'yellow', '{}', '|', '||','expression'] @@ -90,7 +89,7 @@ Mi.write(s) Mi.close() - + # building keywords.pxi with open("keywords.pxi", "w") as Fi: Fi.write("# file auto generated by mkkeywords.py\n") diff --git a/src/sage_setup/library_order.py b/src/sage_setup/library_order.py index 0b450b37239..f40690f8d22 100644 --- a/src/sage_setup/library_order.py +++ b/src/sage_setup/library_order.py @@ -32,7 +32,7 @@ "brial_groebner", "m4rie", ] + aliases.get("M4RI_LIBRARIES", []) + [ - "zn_poly", "gap", + "gap", ] + aliases.get("GDLIB_LIBRARIES", []) + aliases.get("LIBPNG_LIBRARIES", []) + [ "m", "readline", "Lfunction", ] + aliases.get("CBLAS_LIBRARIES", []) + aliases.get("ZLIB_LIBRARIES", []) diff --git a/src/tox.ini b/src/tox.ini index 891fec1f337..11439fbdb2c 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -114,14 +114,15 @@ description = # E703: statement ends with a semicolon # E711: comparison to None should be ‘if cond is None:’ # E712: comparison to True should be ‘if cond is True:’ or ‘if cond:’ - # E713 test for membership should be 'not in' + # E713 test for membership should be ’not in’ # E721: do not compare types, use isinstance() # E722: do not use bare except, specify exception instead + # W291: trailing whitespace # W391: blank line at end of file # W605: invalid escape sequence ‘x’ # See https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes deps = pycodestyle -commands = pycodestyle --select E111,E306,E401,E701,E702,E703,W391,W605,E711,E712,E713,E721,E722 {posargs:{toxinidir}/sage/} +commands = pycodestyle --select E111,E306,E401,E701,E702,E703,W291,W391,W605,E711,E712,E713,E721,E722 {posargs:{toxinidir}/sage/} pycodestyle --select E111,E306,E401,E703,W605,E712,E713,E721,E722 --filename *.pyx {posargs:{toxinidir}/sage/} [pycodestyle]