diff --git a/build/pkgs/configure/checksums.ini b/build/pkgs/configure/checksums.ini index 3f4c1eecd6d..a8995f6d75e 100644 --- a/build/pkgs/configure/checksums.ini +++ b/build/pkgs/configure/checksums.ini @@ -1,3 +1,3 @@ tarball=configure-VERSION.tar.gz -sha1=d2f8c0bc6c40a0e3e8f7cb0deebee5e7bc7da501 -sha256=cde422cec1dc104f4f4b1369167a17cc77519186180bfc14322d078881581c50 +sha1=340a651757a7ddca66bb75748de129b53ed78b60 +sha256=95ce520780fe2a19a3cb7b2e4c10028f766545ddd672b9f0226c889a994d97b6 diff --git a/build/pkgs/configure/package-version.txt b/build/pkgs/configure/package-version.txt index d3929445739..6a4c5e98bed 100644 --- a/build/pkgs/configure/package-version.txt +++ b/build/pkgs/configure/package-version.txt @@ -1 +1 @@ -27fce1faa78ef19b8c43287016f0acbdf0fa169a +796a63b643b81da540aec10df2e22395561047f1 diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx index 62abb4a0863..1001cbda600 100644 --- a/src/sage/symbolic/expression.pyx +++ b/src/sage/symbolic/expression.pyx @@ -1,4 +1,4 @@ -# distutils: sources = sage/symbolic/ginac/add.cpp sage/symbolic/ginac/archive.cpp sage/symbolic/ginac/assume.cpp sage/symbolic/ginac/basic.cpp sage/symbolic/ginac/cmatcher.cpp sage/symbolic/ginac/constant.cpp sage/symbolic/ginac/context.cpp sage/symbolic/ginac/ex.cpp sage/symbolic/ginac/expair.cpp sage/symbolic/ginac/expairseq.cpp sage/symbolic/ginac/exprseq.cpp sage/symbolic/ginac/fderivative.cpp sage/symbolic/ginac/function.cpp sage/symbolic/ginac/function_info.cpp sage/symbolic/ginac/infinity.cpp sage/symbolic/ginac/infoflagbase.cpp sage/symbolic/ginac/inifcns.cpp sage/symbolic/ginac/inifcns_comb.cpp sage/symbolic/ginac/inifcns_gamma.cpp sage/symbolic/ginac/inifcns_hyperb.cpp sage/symbolic/ginac/inifcns_hyperg.cpp sage/symbolic/ginac/inifcns_nstdsums.cpp sage/symbolic/ginac/inifcns_orthopoly.cpp sage/symbolic/ginac/inifcns_trans.cpp sage/symbolic/ginac/inifcns_trig.cpp sage/symbolic/ginac/inifcns_zeta.cpp sage/symbolic/ginac/lst.cpp sage/symbolic/ginac/matrix.cpp sage/symbolic/ginac/mpoly-giac.cpp sage/symbolic/ginac/mpoly-ginac.cpp sage/symbolic/ginac/mpoly-singular.cpp sage/symbolic/ginac/mpoly.cpp sage/symbolic/ginac/mul.cpp sage/symbolic/ginac/normal.cpp sage/symbolic/ginac/numeric.cpp sage/symbolic/ginac/operators.cpp sage/symbolic/ginac/order.cpp sage/symbolic/ginac/power.cpp sage/symbolic/ginac/print.cpp sage/symbolic/ginac/pseries.cpp sage/symbolic/ginac/py_funcs.cpp sage/symbolic/ginac/registrar.cpp sage/symbolic/ginac/relational.cpp sage/symbolic/ginac/remember.cpp sage/symbolic/ginac/sum.cpp sage/symbolic/ginac/symbol.cpp sage/symbolic/ginac/templates.cpp sage/symbolic/ginac/upoly-ginac.cpp sage/symbolic/ginac/useries.cpp sage/symbolic/ginac/utils.cpp sage/symbolic/ginac/wildcard.cpp +# distutils: sources = sage/symbolic/ginac/add.cpp sage/symbolic/ginac/archive.cpp sage/symbolic/ginac/assume.cpp sage/symbolic/ginac/basic.cpp sage/symbolic/ginac/cmatcher.cpp sage/symbolic/ginac/constant.cpp sage/symbolic/ginac/context.cpp sage/symbolic/ginac/ex.cpp sage/symbolic/ginac/expair.cpp sage/symbolic/ginac/expairseq.cpp sage/symbolic/ginac/exprseq.cpp sage/symbolic/ginac/fderivative.cpp sage/symbolic/ginac/function.cpp sage/symbolic/ginac/function_info.cpp sage/symbolic/ginac/infinity.cpp sage/symbolic/ginac/infoflagbase.cpp sage/symbolic/ginac/inifcns.cpp sage/symbolic/ginac/inifcns_comb.cpp sage/symbolic/ginac/inifcns_gamma.cpp sage/symbolic/ginac/inifcns_hyperb.cpp sage/symbolic/ginac/inifcns_hyperg.cpp sage/symbolic/ginac/inifcns_nstdsums.cpp sage/symbolic/ginac/inifcns_orthopoly.cpp sage/symbolic/ginac/inifcns_trans.cpp sage/symbolic/ginac/inifcns_trig.cpp sage/symbolic/ginac/inifcns_zeta.cpp sage/symbolic/ginac/lst.cpp sage/symbolic/ginac/matrix.cpp sage/symbolic/ginac/mpoly-ginac.cpp sage/symbolic/ginac/mpoly-singular.cpp sage/symbolic/ginac/mpoly.cpp sage/symbolic/ginac/mul.cpp sage/symbolic/ginac/normal.cpp sage/symbolic/ginac/numeric.cpp sage/symbolic/ginac/operators.cpp sage/symbolic/ginac/order.cpp sage/symbolic/ginac/power.cpp sage/symbolic/ginac/print.cpp sage/symbolic/ginac/pseries.cpp sage/symbolic/ginac/py_funcs.cpp sage/symbolic/ginac/registrar.cpp sage/symbolic/ginac/relational.cpp sage/symbolic/ginac/remember.cpp sage/symbolic/ginac/sum.cpp sage/symbolic/ginac/symbol.cpp sage/symbolic/ginac/templates.cpp sage/symbolic/ginac/upoly-ginac.cpp sage/symbolic/ginac/useries.cpp sage/symbolic/ginac/utils.cpp sage/symbolic/ginac/wildcard.cpp # distutils: language = c++ # distutils: libraries = flint gmp SINGULAR_LIBRARIES # distutils: extra_compile_args = -std=c++11 SINGULAR_CFLAGS diff --git a/src/sage/symbolic/ginac/basic.h b/src/sage/symbolic/ginac/basic.h index b4d572e5c52..d7adf245b33 100644 --- a/src/sage/symbolic/ginac/basic.h +++ b/src/sage/symbolic/ginac/basic.h @@ -43,19 +43,6 @@ struct _object; typedef _object PyObject; #endif -#ifdef PYNAC_HAVE_LIBGIAC -namespace giac -{ - class gen; - template class tensor; - typedef class tensor polynome; -} -namespace GiNaC -{ -struct ex_is_less; -} -#endif - namespace GiNaC { class ex; @@ -315,9 +302,6 @@ class basic : public refcounted const basic & clearflag(unsigned f) const {flags &= ~f; return *this;} void ensure_if_modifiable() const; -#ifdef PYNAC_HAVE_LIBGIAC - const giac::polynome to_polynome(ex_int_map& map, exvector& revmap); -#endif // member variables tinfo_t tinfo_key; ///< type info diff --git a/src/sage/symbolic/ginac/ex.h b/src/sage/symbolic/ginac/ex.h index 6a164af270f..7b53b283b49 100644 --- a/src/sage/symbolic/ginac/ex.h +++ b/src/sage/symbolic/ginac/ex.h @@ -230,9 +230,6 @@ class ex { ex to_rational(lst & repl_lst) const; ex to_polynomial(exmap & repl) const; ex to_polynomial(lst & repl_lst) const; -#ifdef PYNAC_HAVE_LIBGIAC - const giac::polynome to_polynome(ex_int_map& map, exvector& revmap) const; -#endif const CanonicalForm to_canonical(ex_int_umap& map, power_ocvector_map& pomap, exvector& revmap) const; void collect_powers(power_ocvector_map& pomap) const; diff --git a/src/sage/symbolic/ginac/mpoly-giac.cpp b/src/sage/symbolic/ginac/mpoly-giac.cpp deleted file mode 100644 index e980d542c65..00000000000 --- a/src/sage/symbolic/ginac/mpoly-giac.cpp +++ /dev/null @@ -1,533 +0,0 @@ -/** @file mpoly-giac.cpp - * - * GiNaC Copyright (C) 1999-2008 Johannes Gutenberg University Mainz, Germany - * Copyright (C) 2016 Ralf Stephan - * - * 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 "pynac-config.h" - -#ifdef PYNAC_HAVE_LIBGIAC - -#include -#include -#include -#undef _POSIX_C_SOURCE -#undef _XOPEN_SOURCE - -#include "upoly.h" -#include "basic.h" -#include "ex.h" -#include "add.h" -#include "constant.h" -#include "expairseq.h" -#include "mul.h" -#include "numeric.h" -#include "power.h" -#include "operators.h" -#include "pseries.h" -#include "relational.h" -#include "symbol.h" -#include "function.h" -#include "utils.h" - -#include -#include - -namespace GiNaC { - -static unsigned int the_dimension = 7; - -static giac::context * context_ptr=nullptr; -static giac::gen giac_zero; -static giac::gen giac_one; - - -inline giac::polynome gen2pol(const giac::gen& g) { - return giac::polynome(giac::monomial(g, the_dimension)); -} - -inline giac::gen num2gen(const numeric& n) { - auto gp = n.to_giacgen(context_ptr); - if (gp != nullptr) - return std::move(*gp); - else { - std::stringstream ss; - ss << n; - return giac::gen(std::string(ss.str()), context_ptr); - } -} - -static giac::polynome replace_with_symbol(const ex& e, ex_int_map& map, exvector& revmap) -{ - // Expression already replaced? Then return the assigned symbol - auto it = map.find(e); - if (it != map.end()) { - const int index = it->second; - giac::monomial mon(giac_one, index, the_dimension); - return giac::polynome(mon); - } - - // Otherwise create new symbol and add to dict - const int index = revmap.size() + 1; - map.insert(std::make_pair(e, index)); - revmap.push_back(e); - giac::monomial mon(giac_one, index, the_dimension); - return giac::polynome(mon); -} - -const giac::polynome basic::to_polynome(ex_int_map& map, exvector& revmap) -{ - std::cerr << *this << std::endl; - throw std::runtime_error("basic::to_polynome: can't happen"); -} - -const giac::polynome num_to_polynome(const numeric& num, - ex_int_map& map, exvector& revmap) -{ - if (num.is_real()) { - if (num.is_integer() or num.is_rational()) - return gen2pol(num2gen(num)); - else - return replace_with_symbol(num, map, revmap); - } else { // complex - numeric re = num.real(); - numeric im = num.imag(); - giac::polynome re_p(the_dimension); - giac::polynome im_p(the_dimension); - if (re.is_integer() or re.is_rational()) - re_p = gen2pol(num2gen(re)); - else - re_p = replace_with_symbol(re, map, revmap); - if (im.is_integer() or im.is_rational()) - im_p = gen2pol(num2gen(im)); - else - im_p = replace_with_symbol(im, map, revmap); - giac::polynome r = re_p + im_p * replace_with_symbol(I, map, revmap); - return r; - } -} - -// Convert to giac polynomial over QQ, filling replacement dicts -// TODO: special case numeric mpz_t, int instead of string interface -const giac::polynome ex::to_polynome(ex_int_map& map, exvector& revmap) const -{ - if (is_exactly_a(*this)) - { - const add& a = ex_to(*this); - giac::polynome p = gen2pol(giac_zero); - for (const auto& termex : a.seq) { - p = p + a.recombine_pair_to_ex(termex).to_polynome(map, revmap); - } - p = p + num_to_polynome(a.overall_coeff, map, revmap); - return p; - } - else if (is_exactly_a(*this)) - { - return num_to_polynome(ex_to(*this), map, revmap); - } - else if (is_exactly_a(*this)) - { - const mul& m = ex_to(*this); - giac::polynome p = gen2pol(giac_one); - for (const auto& termex : m.seq) { - p *= m.recombine_pair_to_ex(termex).to_polynome(map, revmap); - } - p *= num_to_polynome(m.overall_coeff, map, revmap); - return p; - } - else if (is_exactly_a(*this)) - { - const power& pow = ex_to(*this); - if (is_exactly_a(pow.exponent)) { - numeric expo = ex_to(pow.exponent); - if (pow.exponent.info(info_flags::posint)) - return std::move(giac::pow(pow.basis.to_polynome(map, revmap), expo.to_int())); - } - return replace_with_symbol(*this, map, revmap); - } - - return replace_with_symbol(*this, map, revmap); -} - -static ex gen2ex(const giac::gen& gen) -{ - // we need to handle giac types _INT_, _ZINT, and _CPLX - switch (gen.type) { - case giac::_INT_: - return numeric(gen.val); - case giac::_ZINT: - mpz_t bigint; - mpz_init_set(bigint, *(gen.ref_ZINTptr())); - return numeric(bigint); - case giac::_CPLX: - return (gen2ex(gen.ref_CPLXptr()[0]) - + I * gen2ex(gen.ref_CPLXptr()[1])); - case giac::_FRAC: - return (gen2ex(gen.ref_FRACptr()->num) - / gen2ex(gen.ref_FRACptr()->den)); - default: - std::ostringstream os; - os << "gen2ex: can't happen: " << int(gen.type) << std::flush; - throw std::runtime_error(os.str()); - } -} - -static ex polynome_to_ex(const giac::polynome& p, const exvector& revmap) -{ - ex e = _ex0; - for (const auto& mon : p.coord) { - ex prod = _ex1; - for (unsigned int varno=0; varno(a) && is_exactly_a(b)) { - numeric g = gcd(ex_to(a), ex_to(b)); - if ((ca != nullptr) || (cb != nullptr)) { - if (g.is_zero()) { - if (ca != nullptr) - *ca = _ex0; - if (cb != nullptr) - *cb = _ex0; - } else { - if (ca != nullptr) - *ca = ex_to(a) / g; - if (cb != nullptr) - *cb = ex_to(b) / g; - } - } - return g; - } - - // Partially factored cases (to avoid expanding large expressions) - if (is_exactly_a(a)) { - if (is_exactly_a(b) && b.nops() > a.nops()) - goto factored_b; -factored_a: - size_t num = a.nops(); - exvector g; g.reserve(num); - exvector acc_ca; acc_ca.reserve(num); - ex part_b = b; - for (size_t i=0; isetflag(status_flags::dynallocated); - if (cb != nullptr) - *cb = part_b; - return (new mul(g))->setflag(status_flags::dynallocated); - } else if (is_exactly_a(b)) { - if (is_exactly_a(a) && a.nops() > b.nops()) - goto factored_a; -factored_b: - size_t num = b.nops(); - exvector g; g.reserve(num); - exvector acc_cb; acc_cb.reserve(num); - ex part_a = a; - for (size_t i=0; isetflag(status_flags::dynallocated); - return (new mul(g))->setflag(status_flags::dynallocated); - } - - // Input polynomials of the form poly^n are sometimes also trivial - if (is_exactly_a(a)) { - ex p = a.op(0); - const ex& exp_a = a.op(1); - if (is_exactly_a(b)) { - ex pb = b.op(0); - const ex& exp_b = b.op(1); - if (p.is_equal(pb)) { - // a = p^n, b = p^m, gcd = p^min(n, m) - if (exp_a < exp_b) { - if (ca != nullptr) - *ca = _ex1; - if (cb != nullptr) - *cb = power(p, exp_b - exp_a); - return power(p, exp_a); - } else { - if (ca != nullptr) - *ca = power(p, exp_a - exp_b); - if (cb != nullptr) - *cb = _ex1; - return power(p, exp_b); - } - } else { - ex p_co, pb_co; - ex p_gcd = gcdpoly(p, pb, &p_co, &pb_co, check_args); - if (p_gcd.is_one()) { - // a(x) = p(x)^n, b(x) = p_b(x)^m, gcd (p, p_b) = 1 ==> - // gcd(a,b) = 1 - if (ca != nullptr) - *ca = a; - if (cb != nullptr) - *cb = b; - return _ex1; - // XXX: do I need to check for p_gcd = -1? - } else { - // there are common factors: - // a(x) = g(x)^n A(x)^n, b(x) = g(x)^m B(x)^m ==> - // gcd(a, b) = g(x)^n gcd(A(x)^n, g(x)^(n-m) B(x)^m - if (exp_a < exp_b) { - return power(p_gcd, exp_a)* - gcdpoly(power(p_co, exp_a), power(p_gcd, exp_b-exp_a)*power(pb_co, exp_b), ca, cb, false); - } else { - return power(p_gcd, exp_b)* - gcdpoly(power(p_gcd, exp_a - exp_b)*power(p_co, exp_a), power(pb_co, exp_b), ca, cb, false); - } - } // p_gcd.is_equal(_ex1) - } // p.is_equal(pb) - - } else { - if (p.is_equal(b)) { - // a = p^n, b = p, gcd = p - if (ca != nullptr) - *ca = power(p, a.op(1) - 1); - if (cb != nullptr) - *cb = _ex1; - return p; - } - - ex p_co, bpart_co; - ex p_gcd = gcdpoly(p, b, &p_co, &bpart_co, false); - - if (p_gcd.is_one()) { - // a(x) = p(x)^n, gcd(p, b) = 1 ==> gcd(a, b) = 1 - if (ca != nullptr) - *ca = a; - if (cb != nullptr) - *cb = b; - return _ex1; - } else { - // a(x) = g(x)^n A(x)^n, b(x) = g(x) B(x) ==> gcd(a, b) = g(x) gcd(g(x)^(n-1) A(x)^n, B(x)) - return p_gcd*gcdpoly(power(p_gcd, exp_a-1)*power(p_co, exp_a), bpart_co, ca, cb, false); - } - } // is_exactly_a(b) - - } else if (is_exactly_a(b)) { - ex p = b.op(0); - if (p.is_equal(a)) { - // a = p, b = p^n, gcd = p - if (ca != nullptr) - *ca = _ex1; - if (cb != nullptr) - *cb = power(p, b.op(1) - 1); - return p; - } - - ex p_co, apart_co; - const ex& exp_b(b.op(1)); - ex p_gcd = gcdpoly(a, p, &apart_co, &p_co, false); - if (p_gcd.is_one()) { - // b=p(x)^n, gcd(a, p) = 1 ==> gcd(a, b) == 1 - if (ca != nullptr) - *ca = a; - if (cb != nullptr) - *cb = b; - return _ex1; - } else { - // there are common factors: - // a(x) = g(x) A(x), b(x) = g(x)^n B(x)^n ==> gcd = g(x) gcd(g(x)^(n-1) A(x)^n, B(x)) - - return p_gcd*gcdpoly(apart_co, power(p_gcd, exp_b-1)*power(p_co, exp_b), ca, cb, false); - } // p_gcd.is_equal(_ex1) - } - - // Conversion necessary to count needed symbols beforehand - exmap repl; - ex poly_a = a.to_rational(repl); - ex poly_b = b.to_rational(repl); - - symbolset s1 = poly_a.symbols(); - const symbolset& s2 = poly_b.symbols(); - s1.insert(s2.begin(), s2.end()); - the_dimension = s1.size(); - - ex_int_map map; - exvector revmap; - - giac::polynome p = poly_a.to_polynome(map, revmap); - giac::polynome q = poly_b.to_polynome(map, revmap); - giac::polynome d(the_dimension); - giac::gcd(p, q, d); - - if (ca != nullptr) { - giac::polynome quo(the_dimension); - if (giac::exactquotient(p, d, quo)) - *ca = polynome_to_ex(quo, revmap).subs(repl, subs_options::no_pattern); - else - throw(std::runtime_error("can't happen in gcdpoly")); - } - if (cb != nullptr) { - giac::polynome quo(the_dimension); - if (giac::exactquotient(q, d, quo)) - *cb = polynome_to_ex(quo, revmap).subs(repl, subs_options::no_pattern); - else - throw(std::runtime_error("can't happen in gcdpoly")); - } - return polynome_to_ex(d, revmap).subs(repl, subs_options::no_pattern); -} - -#if 0 -ex resultantpoly(const ex & ee1, const ex & ee2, const ex & s) -{ - // Conversion necessary to count needed symbols beforehand - exmap repl; - ex poly_a = ee1.to_rational(repl); - ex poly_b = ee2.to_rational(repl); - - symbolset s1 = poly_a.symbols(); - const symbolset& s2 = poly_b.symbols(); - s1.insert(s2.begin(), s2.end()); - s1.insert(ex_to(s)); - the_dimension = s1.size(); - - ex_int_map map; - exvector revmap; - - giac::polynome p = poly_a.to_polynome(map, revmap); - giac::polynome q = poly_b.to_polynome(map, revmap); - giac::polynome d = giac::resultant(p, q); - return polynome_to_ex(d, revmap).subs(repl, subs_options::no_pattern); -} -#endif - -bool factorpoly(const ex& the_ex, ex& res_prod) -{ - if (is_exactly_a(the_ex) - or is_exactly_a(the_ex) - or is_exactly_a(the_ex) - or is_exactly_a(the_ex)) - return false; - - if (is_exactly_a(the_ex)) { - const mul& m = ex_to(the_ex); - exvector ev; - bool mchanged = false; - for (size_t i=0; i(the_ex)) { - const power& pow = ex_to(the_ex); - ex prod; - bool res = factorpoly(pow.op(0), prod); - if (not res) - return false; - res_prod = power(prod, pow.op(1)); - return true; - } - - if (not is_exactly_a(the_ex)) - throw(std::runtime_error("can't happen in factor")); - - if (context_ptr == nullptr) { - context_ptr=new giac::context(); - giac_zero = giac::gen(std::string("0"), context_ptr); - giac_one = giac::gen(std::string("1"), context_ptr); - } - - exmap repl; - ex poly = the_ex.to_rational(repl); - symbolset s1 = poly.symbols(); - the_dimension = s1.size(); - - ex_int_map map; - exvector revmap; - giac::polynome p = the_ex.to_polynome(map, revmap); - giac::polynome p_content(the_dimension); - giac::factorization f; - bool res = factor(p, p_content, f, - false, false, false, giac_one, giac_one); - if (not res) - return false; - res_prod = polynome_to_ex(p_content, revmap).subs(repl, subs_options::no_pattern); - for (auto fpair : f) - res_prod = mul(res_prod, - power(polynome_to_ex(fpair.fact, revmap).subs(repl, subs_options::no_pattern), - fpair.mult)); - return true; -} - -ex poly_mul_expand(const ex& a, const ex& b) -{ - exmap repl; - ex poly_a = a.to_rational(repl); - ex poly_b = b.to_rational(repl); - - symbolset s1 = poly_a.symbols(); - const symbolset& s2 = poly_b.symbols(); - s1.insert(s2.begin(), s2.end()); - the_dimension = s1.size(); - - ex_int_map map; - exvector revmap; - - giac::polynome p = poly_a.to_polynome(map, revmap); - giac::polynome q = poly_b.to_polynome(map, revmap); - giac::polynome d(the_dimension); - d = p * q; - - return polynome_to_ex(d, revmap).subs(repl, subs_options::no_pattern); -} - -} // namespace GiNaC - -#endif // HAVE_LIBGIAC diff --git a/src/sage/symbolic/ginac/mpoly-ginac.cpp b/src/sage/symbolic/ginac/mpoly-ginac.cpp index 608e0f6f207..02a07504a73 100644 --- a/src/sage/symbolic/ginac/mpoly-ginac.cpp +++ b/src/sage/symbolic/ginac/mpoly-ginac.cpp @@ -51,8 +51,6 @@ namespace GiNaC { -#ifndef PYNAC_HAVE_LIBGIAC - // If comparing expressions (ex::compare()) is fast, you can set this to 1. // Some routines like quo(), rem() and gcd() will then return a quick answer // when they are called with two identical arguments. @@ -547,7 +545,5 @@ ex sqrfree(const ex &a, const lst &l) #endif -#endif // HAVE_LIBGIAC - } // namespace GiNaC diff --git a/src/sage/symbolic/ginac/mpoly-singular.cpp b/src/sage/symbolic/ginac/mpoly-singular.cpp index 3050a96bac6..e66694ec1e0 100644 --- a/src/sage/symbolic/ginac/mpoly-singular.cpp +++ b/src/sage/symbolic/ginac/mpoly-singular.cpp @@ -344,8 +344,6 @@ static ex canonical_to_ex(const CanonicalForm& f, const exvector& revmap) } // GCD of two exes which are in polynomial form -// If giac is requested we stand back -#ifndef PYNAC_HAVE_LIBGIAC ex gcdpoly(const ex &a, const ex &b, ex *ca=nullptr, ex *cb=nullptr, bool check_args=true) { if (a.is_zero()) @@ -648,8 +646,6 @@ ex poly_mul_expand(const ex& a, const ex& b) return res; } -#endif //PYNAC_HAVE_LIBGIAC - ex resultantpoly(const ex & ee1, const ex & ee2, const ex & s) { ex_int_umap map; diff --git a/src/sage/symbolic/ginac/normal.cpp b/src/sage/symbolic/ginac/normal.cpp index d2c9e7be637..303f12d1aa7 100644 --- a/src/sage/symbolic/ginac/normal.cpp +++ b/src/sage/symbolic/ginac/normal.cpp @@ -1093,13 +1093,6 @@ static ex find_common_factor(const ex & e, ex & factor, exmap & repl) if (gc.is_one()) return e; -#ifdef PYNAC_HAVE_LIBGIAC - else { - ex f = 1; - gc = find_common_factor(gc, f, repl); - gc *= f; - } -#endif // The GCD is the factor we pull out factor *= gc; diff --git a/src/sage/symbolic/ginac/numeric.cpp b/src/sage/symbolic/ginac/numeric.cpp index 4bcf45e8793..a9bbfba9e15 100644 --- a/src/sage/symbolic/ginac/numeric.cpp +++ b/src/sage/symbolic/ginac/numeric.cpp @@ -74,15 +74,6 @@ #include "factory/factory.h" #pragma clang diagnostic pop -#ifdef PYNAC_HAVE_LIBGIAC -#undef _POSIX_C_SOURCE -#undef _XOPEN_SOURCE - -#include -#include -#include -#endif - //#define Logging_refctr #if defined(Logging_refctr) #undef Py_INCREF @@ -3258,33 +3249,6 @@ void numeric::canonicalize() } } -#ifdef PYNAC_HAVE_LIBGIAC -giac::gen* numeric::to_giacgen(giac::context* cptr) const -{ - if (t == LONG) - return new giac::gen(v._long); - if (t == MPZ) { - mpz_t bigint; - mpz_init_set(bigint, v._bigint); - auto ret = new giac::gen(bigint); - mpz_clear(bigint); - return ret; - } - if (t == MPQ) { - mpz_t bigint; - mpz_init_set(bigint, mpq_numref(v._bigrat)); - giac::gen gn(bigint); - mpz_set(bigint, mpq_denref(v._bigrat)); - giac::gen gd(bigint); - giac::Tfraction frac(gn, gd); - mpz_clear(bigint); - return new giac::gen(frac); - } - else - return nullptr; -} -#endif - CanonicalForm numeric::to_canonical() const { if (t == LONG) diff --git a/src/sage/symbolic/ginac/numeric.h b/src/sage/symbolic/ginac/numeric.h index 50b2b3d5e31..03697b2a474 100644 --- a/src/sage/symbolic/ginac/numeric.h +++ b/src/sage/symbolic/ginac/numeric.h @@ -64,12 +64,6 @@ PyObject* CC_get(); class CanonicalForm; -#ifdef PYNAC_HAVE_LIBGIAC -namespace giac { - class context; -} -#endif - namespace GiNaC { enum Type { @@ -246,9 +240,6 @@ class numeric : public basic { const numeric try_py_method(const std::string& s, const numeric& x2) const; const numeric to_dict_parent(PyObject* dict) const; -#ifdef PYNAC_HAVE_LIBGIAC - giac::gen* to_giacgen(giac::context*) const; -#endif CanonicalForm to_canonical() const; const numeric real() const; diff --git a/src/sage/symbolic/ginac/pynac-config.h b/src/sage/symbolic/ginac/pynac-config.h index 4d686828c7f..00d7445049a 100644 --- a/src/sage/symbolic/ginac/pynac-config.h +++ b/src/sage/symbolic/ginac/pynac-config.h @@ -7,8 +7,5 @@ /* Current GiNaC archive file version number */ #define PYNAC_ARCHIVE_VERSION 3 -/* Define if you have libgiac */ -/* #undef PYNAC_HAVE_LIBGIAC */ - /* once: _PYNAC_CONFIG_H */ #endif