From 77ba6cd39fec50ad28155e6b4071aea4afc026a5 Mon Sep 17 00:00:00 2001 From: Avraham Adler Date: Tue, 5 Sep 2023 14:49:52 -0400 Subject: [PATCH] Reduce tailtol tolerance in expecatation of CRAN note regarding OpenBLAS test, EVEN THOUGH THIS PLATFORM HAS BEEN USING OPENBLAS FOR > 10 YEARS AND PASSED THE TESTS! --- DESCRIPTION | 4 ++-- R/MiniMaxApprox.R | 10 +++++----- README.md | 4 ++-- inst/CITATION | 2 +- inst/NEWS.Rd | 16 ++++++++++++++-- inst/tinytest/test_MiniMaxApprox.R | 2 +- man/MiniMaxApprox.Rd | 9 +++++---- 7 files changed, 30 insertions(+), 17 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 550262c..cfbf2e8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,8 +2,8 @@ Package: minimaxApprox Type: Package Title: Implementation of Remez Algorithm for Polynomial and Rational Function Approximation -Version: 0.2.1 -Date: 2023-09-04 +Version: 0.2.1.9000 +Date: 2023-09-05 Authors@R: person(given="Avraham", family="Adler",role=c("aut", "cre", "cph"), email="Avraham.Adler@gmail.com", comment = c(ORCID = "0000-0002-3039-0703")) Description: Implements the algorithm of Remez (1962) for polynomial minimax diff --git a/R/MiniMaxApprox.R b/R/MiniMaxApprox.R index 638e21c..8b7875b 100644 --- a/R/MiniMaxApprox.R +++ b/R/MiniMaxApprox.R @@ -38,7 +38,7 @@ minimaxApprox <- function(fn, lower, upper, degree, relErr = FALSE, xi = NULL, # Used for cases where we check polynomial degree n + 1. # See issue 2 https://github.com/aadler/minimaxApprox/issues/2 if (!("tailtol" %in% names(opts))) { - opts$tailtol <- min(1e-10, (upper - lower) / 1e6) + opts$tailtol <- min(sqrt(.Machine$double.eps), (upper - lower) / 1e6) } if (!("ztol" %in% names(opts))) { @@ -99,10 +99,10 @@ minimaxApprox <- function(fn, lower, upper, degree, relErr = FALSE, xi = NULL, "of degree", degree, "but successfully completed", "when looking for a polynomial of degree", degree + 1L, "with the largest coefficient's", - "contribution to the approximation <=", - paste0(opts$tailtol, ":"), "the tailtol option. The", - "result is a polynomial of length", degree, "as the", - "uppermost coefficient is effectively 0.") + "contribution to the approximation <= the tailtol", + "option. The result is a polynomial of length", + degree, "as the uppermost coefficient is effectively", + "0.") mmA$a <- mmA$a[-length(mmA$a)] message(mess) } else { diff --git a/README.md b/README.md index 2060b05..1ca5452 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you use the package, please cite it as: Adler A (2023). minimaxApprox: Implementation of Remez Algorithm for Polynomial and Rational Function Approximation. [doi: 10.5281/zenodo.8158855](https://doi.org/10.5281/zenodo.8158855), - R package version 0.2.0, https://CRAN.R-project.org/package=minimaxApprox + R package version 0.2.1.9000, https://CRAN.R-project.org/package=minimaxApprox A BibTeX entry for LaTeX users is: @@ -30,7 +30,7 @@ A BibTeX entry for LaTeX users is: year = {2023}, url = {https://CRAN.R-project.org/package=minimaxApprox}, doi = {10.5281/zenodo.8158855}, - note = {R package version 0.2.0}, + note = {R package version 0.2.1.9000}, } ``` diff --git a/inst/CITATION b/inst/CITATION index 1c23ecc..0cd43e3 100644 --- a/inst/CITATION +++ b/inst/CITATION @@ -10,5 +10,5 @@ bibentry(bibtype = "Manual", year = "2023", url = "https://CRAN.R-project.org/package=minimaxApprox", doi = "10.5281/zenodo.8158855", - note = "R package version 0.2.1" + note = "R package version 0.2.1.9000" ) diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index be2eb9d..072519e 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -15,12 +15,24 @@ } } +\section{Version 0.2.1.9000 (2023-09-05)}{ + \subsection{Changed}{ + \itemize{ + \item \strong{Breaking:} Reduced \code{tailtol} tolerance to + \code{sqrt(.Machine$double.eps)} as one of the myriad \acronym{CRAN} + testbeds also had issues with convergence. Different \acronym{BLAS} + implementations seem to display different levels of precision. + } + } +} + \section{Version 0.2.1 (2023-09-04)}{ \subsection{Changed}{ \itemize{ \item Test for calculating polynomial of degree \code{n + 1} when one of - degree \code{n} fails, while passing both R Mac Builder and Github's Mac - platform, failed on CRAN's testbed. So test is not run for Mac. + degree \code{n} fails, while passing both R \acronym{Mac} Builder and + Github's \acronym{Mac} platform, failed on \acronym{CRAN}'s testbed. + So test is no longer run for \acronym{Mac} on \acronym{CRAN}. } } } diff --git a/inst/tinytest/test_MiniMaxApprox.R b/inst/tinytest/test_MiniMaxApprox.R index 51e85f7..ac69205 100644 --- a/inst/tinytest/test_MiniMaxApprox.R +++ b/inst/tinytest/test_MiniMaxApprox.R @@ -171,7 +171,7 @@ if (!("darwin" %in% tolower(Sys.info()[["sysname"]]))) { mess <- paste("The algorithm failed while looking for a polynomial of degree", "10 but successfully completed when looking for a polynomial of", "degree 11 with the largest coefficient's contribution to the", - "approximation <= 1e-10: the tailtol option. The result is a", + "approximation <= the tailtol option. The result is a", "polynomial of length 10 as the uppermost coefficient is", "effectively 0.") fn <- function(x) 1 / (1 + (5 * x) ^ 2) diff --git a/man/MiniMaxApprox.Rd b/man/MiniMaxApprox.Rd index 8acefe8..28fc0cb 100644 --- a/man/MiniMaxApprox.Rd +++ b/man/MiniMaxApprox.Rd @@ -57,10 +57,11 @@ minimaxApprox(fn, lower, upper, degree, relErr = FALSE, xi = NULL, \item \code{tailtol}: numeric; The tolerance of the coefficient of the largest power of \code{x} to be ignored when performing the polynomial approximation a second time. Defaults to the smaller of - \eqn{1\times 10^{-10}}{1e-10} or \eqn{\frac{\code{upper} - - \code{lower}}{10^6}}{(\code{upper} - \code{upper}) / 1e6}. Set to - \code{NULL} to skip the \code{degree + 1} check completely. See - \strong{Details}. + \eqn{\sqrt{\text{.Machine\$double.eps}} \approx 1.49\times + 10^{-8}}{\code{sqrt(.Machine$double.eps)}} or + \eqn{\frac{\code{upper} - \code{lower}}{10^6}}{(\code{upper} - + \code{upper}) / 1e6}. Set to \code{NULL} to skip the + \code{degree + 1} check completely. See \strong{Details}. \item \code{ztol}: numeric; The tolerance for each polynomial or rational numerator or denominator coefficient's contribution to \strong{not} to be set to 0. Similar to polynomial \code{tailtol}