From f59c47c26c29f5f818b57e151acf46fff555cd4c Mon Sep 17 00:00:00 2001 From: Mahrud Sayrafi Date: Mon, 15 Jan 2024 03:57:04 -0600 Subject: [PATCH] Macaulay2 v1.23-rc1 --- Formula/macaulay2.rb | 65 ++++---------------------------------------- 1 file changed, 6 insertions(+), 59 deletions(-) diff --git a/Formula/macaulay2.rb b/Formula/macaulay2.rb index 9d07439..4042a88 100644 --- a/Formula/macaulay2.rb +++ b/Formula/macaulay2.rb @@ -2,20 +2,13 @@ class Macaulay2 < Formula @name = "M2" desc "Software system for algebraic geometry research" homepage "http://macaulay2.com" + url "https://github.com/Macaulay2/M2/archive/refs/heads/master.tar.gz" + version "1.23-rc1" + sha256 "e39a1941ed3eb93becc7a592dc50a273ac872ae8b42be13def40ec5f02f45243" license any_of: ["GPL-2.0-only", "GPL-3.0-only"] - revision 2 head "https://github.com/Macaulay2/M2/archive/refs/heads/development.tar.gz" - stable do - url "https://github.com/Macaulay2/M2/archive/refs/tags/release-1.22.tar.gz" - sha256 "fededb82203d93f3f6db22db97350407fc6e55e90285cc8fa89713ff21d5c0fc" - patch do - url "https://github.com/Macaulay2/M2/commit/84c7b9f67bfdb6b821e24546ab2dd4e2455dfdbf.patch?full_index=1" - sha256 "135100251be6c1217948c74c46761d7550ed30e4dc27cce6a76a45d34a362f78" - end - end - bottle do root_url "https://github.com/Macaulay2/homebrew-tap/releases/download/macaulay2-1.22_2" sha256 cellar: :any, ventura: "6f520730827d921b2f05719c43f5d260968490ab73b2240d99cc79f0a8d408b9" @@ -64,6 +57,9 @@ class Macaulay2 < Formula patch :DATA def install + # Only for release candidate + inreplace "M2/VERSION", "1.22", "1.23" + # Don't print the shims prefix path inreplace "M2/Macaulay2/packages/Macaulay2Doc/functions/findProgram-doc.m2", "Verbose => true", "Verbose => false" @@ -175,52 +171,3 @@ def install -Wno-cast-qual # FIXME -- 2.40.1 - -diff --git a/M2/Macaulay2/e/eigen.cpp b/M2/Macaulay2/e/eigen.cpp -index 26cf19de66..77748d5a8c 100644 ---- a/M2/Macaulay2/e/eigen.cpp -+++ b/M2/Macaulay2/e/eigen.cpp -@@ -29,6 +29,41 @@ using MatrixXmpRR = Eigen::Matrix; - using MatrixXmpCC = Eigen::Matrix,Eigen::Dynamic,Eigen::Dynamic>; - #endif - -+#ifdef _LIBCPP_VERSION -+/* workaround incompatibility between libc++'s implementation of complex and -+ * mpreal -+ */ -+namespace eigen_mpfr { -+inline Real abs(const Complex &x) { return hypot(x.real(), x.imag()); } -+inline Complex sqrt(const Complex &x) -+{ -+ Real a = abs(x); -+ const Real &xr = x.real(); -+ const Real &xi = x.imag(); -+ if (xi >= 0) { return Complex(sqrt((a + xr) / 2), sqrt((a - xr) / 2)); } -+ else { return Complex(sqrt((a + xr) / 2), -sqrt((a - xr) / 2)); } -+} -+inline std::complex operator/(const Complex &lhs, const Complex &rhs) -+{ -+ const Real &lhsr = lhs.real(); -+ const Real &lhsi = lhs.imag(); -+ const Real &rhsr = rhs.real(); -+ const Real &rhsi = rhs.imag(); -+ Real normrhs = rhsr*rhsr+rhsi*rhsi; -+ return Complex((lhsr * rhsr + lhsi * rhsi) / normrhs, -+ (lhsi * rhsr - lhsr * rhsi) / normrhs); -+} -+inline std::complex operator*(const Complex &lhs, const Complex &rhs) -+{ -+ const Real &lhsr = lhs.real(); -+ const Real &lhsi = lhs.imag(); -+ const Real &rhsr = rhs.real(); -+ const Real &rhsi = rhs.imag(); -+ return Complex(lhsr * rhsr - lhsi * rhsi, lhsi * rhsr + lhsr * rhsi); -+} -+}; // namespace eigen_mpfr -+#endif -+ - namespace EigenM2 { - - #ifdef NO_LAPACK --- -2.40.1