Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Sylvain Jasson
gmp
Commits
7e7448c2
Commit
7e7448c2
authored
Jun 11, 2020
by
Martin Maechler
Browse files
Provide NA_bigz_ & NA_bigq_
parent
6bc955dc
Changes
4
Hide whitespace changes
Inline
Side-by-side
NAMESPACE
View file @
7e7448c2
...
...
@@ -43,6 +43,7 @@ export(
"mod.bigz",
"modulus", "modulus<-", # "modulus<-.bigz", "modulus.bigz",
"mul.bigq", "mul.bigz",
NA_bigz_, NA_bigq_,
"ncol.bigq", "ncol.bigz", "nrow.bigq", "nrow.bigz",
"nextprime",
"numerator", "numerator<-",
...
...
R/zzz.R
View file @
7e7448c2
...
...
@@ -11,5 +11,12 @@ gmpVersion <- function()
.onLoad
<-
function
(
libname
,
pkgname
)
{
options
(
"gmp:warnModMismatch"
=
TRUE
,
## see ../man/biginteger.Rd
"gmp:warnNoInv"
=
TRUE
)
## ../man/add.biginteger.Rd | ../src/bigmod.cc
## as.big[zq]() need package dynloaded :
gmpEnv
<-
parent.env
(
environment
())
gmpEnv
$
NA_bigz_
<-
as.bigz
(
NA
)
gmpEnv
$
NA_bigq_
<-
as.bigq
(
NA
)
invisible
()
}
man/biginteger.Rd
View file @
7e7448c2
...
...
@@ -8,6 +8,7 @@
\alias{as.double.bigz}
\alias{print.bigz}
\alias{is.na.bigz}
\alias{NA_bigz_}
% these two are C symbols, will be removed eventually:
\alias{biginteger_as}
\alias{biginteger_as_character}
...
...
@@ -18,6 +19,7 @@
}
\usage{
as.bigz(a, mod = NA)
NA_bigz_
\S3method{as.character}{bigz}(x, b = 10, \dots)
% \S3method{as.double}{bigz}(x,\dots)
is.bigz(x)
...
...
@@ -60,6 +62,8 @@ is.bigz(x)
Comparison are supported, i.e., \code{"=="}, \code{"!="},
\code{"<"}, \code{"<="}, \code{">"}, and \code{">="}.
\code{NA_bigz_} is computed on package load time as \code{as.bigz(NA)}.
Objects of class \code{"bigz"} may have a \dQuote{modulus}, accessible
via \code{\link{modulus}()}, currently as an attribute \code{mod}.
When the object has such a modulus \eqn{m}, arithmetic is performed
...
...
@@ -121,6 +125,7 @@ two <- as.bigz(2)
p1 <- two^107 -1 ; isprime(p1); p1
p2 <- two^127 -1 ; isprime(p2); p2
stopifnot( is.na(NA_bigz_) )
## Calculate c = x^e mod n
## --------------------------------------------------------------------
...
...
man/bigrational.Rd
View file @
7e7448c2
\name{bigq}
\title{Large sized rationals}
\alias{bigq}
\alias{bigq-class}
\alias{as.bigq}
...
...
@@ -7,18 +8,17 @@
\alias{as.double.bigq}
\alias{print.bigq}
\alias{is.na.bigq}
\alias{NA_bigq_}
\alias{as.bigz.bigq}
\alias{denominator}
\alias{denominator<-}
\alias{numerator}
\alias{numerator<-}
\title{Large sized rationals}
\description{
Class \code{"bigq"} encodes rationals encoded as ratios of arbitrary
large integers (via GMP).
A simple S3 class (internally a \code{\link{raw}} vector), it has been
registered as formal (S4) class (via \code{\link{setOldClass}}), too.
}
\usage{
as.bigq(n, d = 1)
...
...
@@ -30,6 +30,7 @@ is.bigq(x)
\S3method{print}{bigq}(x, quote=FALSE, initLine = TRUE, ...)
denominator(x)
numerator(x)
NA_bigq_
}
\arguments{
...
...
@@ -60,6 +61,8 @@ numerator(x)
\details{
\code{as.bigz.bigq()} returns the smallest integers not less than the
corresponding rationals bigq.
\code{NA_bigq_} is computed on package load time as \code{as.bigq(NA)}.
}
\author{Antoine Lucas}
...
...
@@ -87,6 +90,8 @@ stopifnot(is.bigq(x), is.bigq(x + y),
as.character(x)
as.double(x)
stopifnot( is.na(NA_bigq_) )
# Depict the "S4-class" bigq, i.e., the formal (S4) methods:
if(require("Rmpfr")) # mostly interesting there
showMethods(class="bigq")
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment