Mentions légales du service

Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • sfilip/rminimax
1 result
Show changes
Commits on Source (2)
......@@ -15,20 +15,19 @@ elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11
support. Please use a C++11-supporting compiler.")
support. Please use a C++11-compatible compiler.")
endif()
# Check that the prerequisite libraries are installed and visible
message(STATUS "Starting dependency check...")
set (INCLUDE_DEPS gmp mpfr mpreal fplll qsopt_ex eigen3 flint2 arb)
set (LIB_DEPS gmp mpfr fplll qsopt_ex flint2 arb)
set (INCLUDE_DEPS gmp mpfr mpreal fplll qsopt_ex eigen3 flint3)
set (LIB_DEPS gmp mpfr fplll qsopt_ex flint3)
set (gmp_lib gmp)
set (mpfr_lib mpfr)
set (fplll_lib fplll)
set (qsopt_ex_lib qsopt_ex)
set (flint2_lib flint)
set (arb_lib arb)
set (flint3_lib flint)
set (gmp_header gmp.h)
set (mpfr_header mpfr.h)
......@@ -36,8 +35,7 @@ set (mpreal_header mpreal.h)
set (fplll_header fplll.h)
set (qsopt_ex_header qsopt_ex/QSopt_ex.h)
set (eigen3_header eigen3/Eigen)
set (flint2_header flint/flint.h)
set (arb_header arb.h)
set (flint3_header flint/flint.h)
foreach (LIB ${LIB_DEPS})
string (TOUPPER ${LIB} LIB_UPPER)
......@@ -62,6 +60,10 @@ foreach (LIB ${INCLUDE_DEPS})
set (DEP_INCLUDE_DIRS ${DEP_INCLUDE_DIRS} ${${HEADER_PKG}_INCLUDE_DIR})
endforeach ()
if (FLINT3_VERSION_MAJOR LESS 3)
message(FATAL_ERROR "\t rminimax requires at least Flint version 3.0")
endif()
message (STATUS "Finished dependency check.")
add_subdirectory(${PROJECT_SOURCE_DIR}/src)
......@@ -75,4 +77,6 @@ target_link_libraries(ratapprox ${LIB_DEPS} rminimax)
# generate test executables
add_executable(test_atan tests/test_atan.cpp)
add_executable(test_lyon tests/test_lyon.cpp)
target_link_libraries(test_atan ${LIB_DEPS} rminimax)
target_link_libraries(test_lyon ${LIB_DEPS} rminimax)
......@@ -15,7 +15,6 @@ This tool requires the following tools and/or libraries be installed and discove
* [fplll](https://github.com/fplll/fplll) - C++ library implementing several lattice algorithms
* [QSopt Exact](https://github.com/jonls/qsopt-ex) - an exact linear programming solver, written in C
* [flint](https://flintlib.org/) - C library for doing number theory
* [Arb](https://fredrikj.net/arb/) - C library for arbitrary-precision floating-point ball arithmetic
## Compilation
This is a CMake-based project, hence building the tool can be as simple as
......
#include "fpminimax.h"
#include "cheby.h"
#include "minimax.h"
#include <acb.h>
#include <arb.h>
#include <arb_fmpz_poly.h>
#include <cstdlib>
#include <flint/acb.h>
#include <flint/arb.h>
#include <flint/arb_fmpz_poly.h>
#include <flint/arith.h>
#include <flint/fmpz_poly_factor.h>
#include <fplll.h>
#include <fstream>
#include <sstream>
......@@ -175,20 +176,25 @@ void factorize(
fmpz_poly_t p;
fmpz_poly_factor_t fac;
acb_ptr roots;
mpz_t ibuff;
fmpz_t ibuff, decomp_fmpz;
mpz_t ibuff_mpz;
fmpz_poly_init(p);
fmpz_poly_factor_init(fac);
mpz_init(ibuff);
fmpz_init(ibuff);
fmpz_init(decomp_fmpz);
mpz_init(ibuff_mpz);
for (std::size_t i{0u}; i < coeffs.size(); ++i) {
decomp = mpfr_decomp(coeffs[i]);
decomp.second -= scale_exp;
mpz_ui_pow_ui(ibuff, 2u, (unsigned int)decomp.second);
mpz_mul(ibuff, ibuff, decomp.first.get_mpz_t());
fmpz_poly_set_coeff_mpz(p, i, ibuff);
fmpz_ui_pow_ui(ibuff, 2u, (unsigned int)decomp.second);
fmpz_set_mpz(decomp_fmpz, decomp.first.get_mpz_t());
fmpz_mul(ibuff, ibuff, decomp_fmpz);
fmpz_poly_set_coeff_fmpz(p, i, ibuff);
}
scale = mpreal(ibuff);
fmpz_get_mpz(ibuff_mpz, ibuff);
scale = mpreal(ibuff_mpz);
scale <<= scale_exp;
fmpz_poly_factor_squarefree(fac, p);
......@@ -225,7 +231,9 @@ void factorize(
fmpz_poly_factor_clear(fac);
fmpz_poly_clear(p);
mpz_clear(ibuff);
fmpz_clear(ibuff);
fmpz_clear(decomp_fmpz);
mpz_clear(ibuff_mpz);
mpreal::set_default_prec(prev);
}
......