Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Macaulay2 v1.23-rc1 #204

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 3 additions & 69 deletions Formula/macaulay2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,12 @@ class Macaulay2 < Formula
@name = "M2"
desc "Software system for algebraic geometry research"
homepage "http://macaulay2.com"
url "https://github.com/Macaulay2/M2/archive/refs/tags/release-1.23-rc1.tar.gz"
sha256 "855ee4453e5c6f346e0f248d2ebee8d0b35d806caeeab34584d21c4bc9046f32"
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, arm64_sonoma: "05e825ec9f41cc9d686c2b5518831ca69c9d1956f80e518e02e34ab807f6819e"
sha256 cellar: :any, ventura: "6f520730827d921b2f05719c43f5d260968490ab73b2240d99cc79f0a8d408b9"
sha256 cellar: :any, monterey: "76b58eacb443edb17bada3e108a8e42f568130ffe06d662ee11c4a1d767c6507"
sha256 x86_64_linux: "3e64bb7cf1677029e5374c172c81b6a8b556e762d6d3f2c3465a4c9706414f02"
end

depends_on "bison" => :build
depends_on "cmake" => :build
depends_on "ninja" => :build
Expand All @@ -39,7 +23,6 @@ class Macaulay2 < Formula
depends_on "gdbm"
depends_on "givaro"
depends_on "gmp"
depends_on "libatomic_ops"
depends_on "libxml2" unless OS.mac?
depends_on "libffi"
depends_on "mpfi"
Expand All @@ -59,7 +42,7 @@ class Macaulay2 < Formula
depends_on "lrs" => :recommended
depends_on "nauty" => :recommended
depends_on "normaliz" => :recommended
depends_on "python@3.10" => :recommended
depends_on "python" => :recommended
depends_on "topcom" => :recommended

patch :DATA
Expand Down Expand Up @@ -176,52 +159,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<double,Eigen::Dynamic,Eigen::Dynamic>;
using MatrixXmpCC = Eigen::Matrix<std::complex<double>,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<Real> 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<Real> 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
Loading