Skip to content

Commit

Permalink
sagemathgh-36930: build/pkgs/normaliz: Add patch for FLINT 3
Browse files Browse the repository at this point in the history
    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [ ] The title is concise, informative, and self-explanatory.
- [ ] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->
- Depends on sagemath#36901

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36930
Reported by: Matthias Köppe
Reviewer(s): Travis Scrimshaw
  • Loading branch information
Release Manager committed Dec 21, 2023
2 parents 007399f + 6115c96 commit 8c14983
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build/pkgs/normaliz/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.10.1
3.10.1.p0
55 changes: 55 additions & 0 deletions build/pkgs/normaliz/patches/flint3_d-torrance.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
--- a/source/libnormaliz/vector_operations.h
+++ b/source/libnormaliz/vector_operations.h
@@ -547,7 +547,10 @@

fmpq_poly_fit_length(flp, n);
for (size_t i = 0; i < poly_vector.size(); ++i) {
- fmpq_poly_set_coeff_mpq(flp, (slong)i, poly_vector[i].get_mpq_t());
+ fmpq_t fcurrent_coeff;
+ fmpq_init(fcurrent_coeff);
+ fmpq_set_mpq(fcurrent_coeff, poly_vector[i].get_mpq_t());
+ fmpq_poly_set_coeff_fmpq(flp, (slong)i, fcurrent_coeff);
}
}

@@ -560,8 +563,11 @@
poly_vector.resize(length);
for (slong i = 0; i < length; i++) {
mpq_t current_coeff;
+ fmpq_t fcurrent_coeff;
mpq_init(current_coeff);
- fmpq_poly_get_coeff_mpq(current_coeff, flp, (slong)i);
+ fmpq_init(fcurrent_coeff);
+ fmpq_poly_get_coeff_fmpq(fcurrent_coeff, flp, (slong)i);
+ fmpq_get_mpq(current_coeff, fcurrent_coeff);
poly_vector[i] = mpq_class(current_coeff);
}
}
--- a/source/libnormaliz/HilbertSeries.cpp
+++ b/source/libnormaliz/HilbertSeries.cpp
@@ -72,7 +72,10 @@
slong n = (slong)nmzp.size();
fmpz_poly_fit_length(flp, n);
for (size_t i = 0; i < nmzp.size(); ++i) {
- fmpz_poly_set_coeff_mpz(flp, (slong)i, nmzp[i].get_mpz_t());
+ fmpz_t fc;
+ fmpz_init(fc);
+ fmpz_set_mpz(fc, nmzp[i].get_mpz_t());
+ fmpz_poly_set_coeff_fmpz(flp, (slong)i, fc);
}
}

@@ -80,9 +83,12 @@
size_t n = (size_t)fmpz_poly_length(flp);
nmzp.resize(n);
mpz_t c;
+ fmpz_t fc;
mpz_init(c);
+ fmpz_init(fc);
for (size_t i = 0; i < nmzp.size(); ++i) {
- fmpz_poly_get_coeff_mpz(c, flp, i);
+ fmpz_poly_get_coeff_fmpz(fc, flp, i);
+ fmpz_get_mpz(c, fc);
nmzp[i] = mpz_class(c);
}
mpz_clear(c);
2 changes: 2 additions & 0 deletions build/pkgs/normaliz/spkg-install.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ cd src
# that an error will be signalled if FLINT or E-ANTIC cannot be found, rather
# than building normaliz without it.

export ac_cv_lib_flint_fmpz_poly_set_coeff_mpz=yes

sdh_configure --with-flint --with-e-antic --with-nauty
sdh_make
sdh_make_install
2 changes: 1 addition & 1 deletion build/pkgs/pynormaliz/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.18
2.18.p0

0 comments on commit 8c14983

Please sign in to comment.