Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Jerry James
2e91b0f00c Rebuild for multithreaded pari.
Bring back (modified) cocoalib patch, still needed for cocoalib support.
2020-11-12 16:20:42 -07:00
2 changed files with 131 additions and 1 deletions

123
giac-cocoalib.patch Normal file
View file

@ -0,0 +1,123 @@
--- configure.ac.orig 2020-04-30 01:52:40.000000000 -0600
+++ configure.ac 2020-10-27 17:05:31.732729921 -0600
@@ -272,7 +272,7 @@ AC_ARG_ENABLE([cocoa],
[if test "$enableval" = "no"; then CONFIG_COCOA="no"; fi], [])
if test "$CONFIG_COCOA" = "yes"; then
- AC_CHECK_HEADER(CoCoA/io.H, [], [CONFIG_COCOA="no"])
+ AC_CHECK_HEADER(CoCoA/BigInt.H, [], [CONFIG_COCOA="no"])
fi
if test "$CONFIG_COCOA" = "yes"; then
save_LIBS="$LIBS"
--- configure.orig 2020-04-30 01:52:40.000000000 -0600
+++ configure 2020-10-27 17:06:22.817658796 -0600
@@ -16662,8 +16662,8 @@ fi
if test "$CONFIG_COCOA" = "yes"; then
- ac_fn_cxx_check_header_mongrel "$LINENO" "CoCoA/io.H" "ac_cv_header_CoCoA_io_H" "$ac_includes_default"
-if test "x$ac_cv_header_CoCoA_io_H" = xyes; then :
+ ac_fn_cxx_check_header_mongrel "$LINENO" "CoCoA/BigInt.H" "ac_cv_header_CoCoA_BigInt_H" "$ac_includes_default"
+if test "x$ac_cv_header_CoCoA_BigInt_H" = xyes; then :
else
CONFIG_COCOA="no"
--- src/TmpLESystemSolver.C.orig 2019-11-03 11:20:03.000000000 -0700
+++ src/TmpLESystemSolver.C 2020-11-12 16:15:52.906906533 -0700
@@ -29,6 +29,7 @@
#include "CoCoA/matrix.H"
#include "CoCoA/ring.H"
#include "CoCoA/error.H"
+#include "CoCoA/MachineInt.H"
// #include <vector> // Included by DenseMatrix.H
using std::vector;
@@ -50,7 +51,11 @@ namespace CoCoADortmund
for (size_t row = 0; row < NumRowsMSource; ++row)
for (size_t col = 0; col < NumColsMSource; ++col)
- SetEntry(MTarget, row, col, MSource(row, col));
+ {
+ const MachineInt rowInt(static_cast<unsigned long>(row));
+ const MachineInt colInt(static_cast<unsigned long>(col));
+ SetEntry(MTarget, row, col, MSource(rowInt, colInt));
+ }
}
// Solve the linear system M*x = b by using Gauss' algorithm
@@ -60,6 +65,7 @@ namespace CoCoADortmund
const size_t NumColsM = NumCols(M);
const size_t NumRowsb = NumRows(b);
const size_t NumColsb = NumCols(b);
+ const MachineInt zInt(0);
// Dimension check
if (NumRowsM != NumRowsb)
@@ -91,13 +97,17 @@ namespace CoCoADortmund
size_t row = 0;
for (size_t col = 0; col < NumColsM && row < NumRowsM; ++col)
{
+ const MachineInt rowInt(static_cast<unsigned long>(row));
+ const MachineInt colInt(static_cast<unsigned long>(col));
+
// Check if current column contains an element != 0
- if (IsZero(MCopy(row, col)))
+ if (IsZero(MCopy(rowInt, colInt)))
{
size_t i = row+1;
for ( ; i < NumRowsM; ++i)
{
- if (!IsZero(MCopy(i, col)))
+ const MachineInt iInt(static_cast<unsigned long>(i));
+ if (!IsZero(MCopy(iInt, colInt)))
{
// Switch MCopy and bCopy rows
MCopy->mySwapRows(i, row);
@@ -113,13 +123,14 @@ namespace CoCoADortmund
positions.push_back(make_pair(row, col));
// Found an element != 0 in current column; apply elemination
- c = MCopy(row, col);
+ c = MCopy(rowInt, colInt);
for (size_t i = row+1; i < NumRowsM; ++i)
{
// Transform MCopy and bCopy
- bCopy->myAddRowMul(i, row, -MCopy(i, col)/c);
- MCopy->myAddRowMul(i, row, -MCopy(i, col)/c);
+ const MachineInt iInt(static_cast<unsigned long>(i));
+ bCopy->myAddRowMul(i, row, -MCopy(iInt, colInt)/c);
+ MCopy->myAddRowMul(i, row, -MCopy(iInt, colInt)/c);
}
++row;
@@ -128,7 +139,8 @@ namespace CoCoADortmund
// row = rank(MCopy); check if a solution for the equation system exists
for (size_t i = row; i < NumRowsb; ++i)
{
- if (!IsZero(bCopy(i, 0)))
+ const MachineInt iInt(static_cast<unsigned long>(i));
+ if (!IsZero(bCopy(iInt, zInt)))
return false;
}
@@ -138,13 +150,16 @@ namespace CoCoADortmund
while (!positions.empty())
{
const size_t i = positions.back().first, j = positions.back().second;
+ const MachineInt iInt(static_cast<unsigned long>(i));
+ const MachineInt jInt(static_cast<unsigned long>(j));
- RingElem x(bCopy(i, 0));
+ RingElem x(bCopy(iInt, zInt));
for (size_t k = j + 1; k < NumColsM; ++k)
{
- x -= MCopy(i, k) * x0Tmp(k, 0);
+ const MachineInt kInt(static_cast<unsigned long>(k));
+ x -= MCopy(iInt, kInt) * x0Tmp(kInt, zInt);
}
- SetEntry(x0Tmp, j, 0, x/MCopy(i, j));
+ SetEntry(x0Tmp, j, 0, x/MCopy(iInt, jInt));
positions.pop_back();
}

View file

@ -14,7 +14,7 @@
Name: giac
Summary: Computer Algebra System, Symbolic calculus, Geometry
Version: 1.6.0%{subversion}
Release: 1%{?dist}
Release: 2%{?dist}
# LGPLv3+: src/Fl_GDI_Printer.cxx, src/Flv_List.cc, src/Flv_Table.cc
# BSD: src/tinymt32*
# MIT: libmicropython.a
@ -36,6 +36,9 @@ Patch1: %{name}-config.patch
# Use Fedora compiler flags
Patch2: %{name}-1.6.0-fix_micropy_compiler_flags.patch
# Adapt to cocoalib 0.99700
Patch3: %{name}-cocoalib.patch
BuildRequires: autoconf, libtool
BuildRequires: python3-devel
BuildRequires: readline-devel
@ -429,6 +432,10 @@ make -C check check
%{_datadir}/giac/examples/
%changelog
* Thu Nov 12 2020 Jerry James <loganjerry@gmail.com> - 1.6.0.25-2
- Rebuild for multithreaded pari
- Bring back (modified) cocoalib patch, still needed for cocoalib support
* Wed Oct 21 2020 Antonio Trande <sagitter@fedoraproject.org> 1.6.0.25-1
- Update to 1.6.0 sub-25
- Patch configure.ac instead of configure.in