Commit bd32b752 authored by Martin Maechler's avatar Martin Maechler
Browse files

The crossprod() / tcrossprod() need `...` argument: urgent for Rmpfr

parent cc86575c
2020-03-30 Martin Maechler <maechler@stat.math.ethz.ch>
* R/matrix-prods.R: must crossprod() / tcrossprod() generics with
the `...` extra argument, compatibly with "R base" `implicitGeneric("crossprod")`
2020-03-02 Martin Mächler <maechler@stat.math.ethz.ch>
* DESCRIPTION (Version): 0.5-14
......
......@@ -62,10 +62,10 @@ if(FALSE) {## a nice idea --- but not working: setOldClass() is fine,
`%*%.bigz` <- function(x,y) .Call(matrix_mul_z, x, y, 0L)
`%*%.bigq` <- function(x,y) .Call(matrix_mul_q, x, y, 0L)
crossprod <- function(x,y=NULL) UseMethod("crossprod")
tcrossprod <- function(x,y=NULL) UseMethod("tcrossprod")
crossprod <- function(x,y=NULL, ...) UseMethod("crossprod")
tcrossprod <- function(x,y=NULL, ...) UseMethod("tcrossprod")
crossprod.default <- function(x,y=NULL) {
crossprod.default <- function(x,y=NULL, ...) {
if(is.null(y))
return(base::crossprod(x))
if(inherits(y, "bigz"))
......@@ -75,7 +75,7 @@ if(FALSE) {## a nice idea --- but not working: setOldClass() is fine,
else base::crossprod(x,y)
}
crossprod.bigz <- function(x,y=NULL) {
crossprod.bigz <- function(x,y=NULL, ...) {
if(is.null(y))
.Call(matrix_crossp_z, x, FALSE)
else if(inherits(y, "bigq"))
......@@ -84,7 +84,7 @@ if(FALSE) {## a nice idea --- but not working: setOldClass() is fine,
.Call(matrix_mul_z, x, y, 1L)
}
crossprod.bigq <- function(x,y=NULL)
crossprod.bigq <- function(x,y=NULL, ...)
{
if(is.null(y))
.Call(matrix_crossp_q, x, FALSE)
......@@ -94,7 +94,7 @@ if(FALSE) {## a nice idea --- but not working: setOldClass() is fine,
##-----------------------------------------------
tcrossprod.default <- function(x,y=NULL) {
tcrossprod.default <- function(x,y=NULL, ...) {
if(is.null(y))
return(base::tcrossprod(x))
if(inherits(y, "bigz"))
......@@ -104,7 +104,7 @@ if(FALSE) {## a nice idea --- but not working: setOldClass() is fine,
else base::tcrossprod(x,y)
}
tcrossprod.bigz <- function(x,y=NULL) {
tcrossprod.bigz <- function(x,y=NULL, ...) {
if(is.null(y))
.Call(matrix_crossp_z, x, TRUE)
else if(inherits(y, "bigq"))
......@@ -113,7 +113,7 @@ if(FALSE) {## a nice idea --- but not working: setOldClass() is fine,
.Call(matrix_mul_z, x, y, 2L)
}
tcrossprod.bigq <- function(x,y=NULL) {
tcrossprod.bigq <- function(x,y=NULL, ...) {
if(is.null(y))
.Call(matrix_crossp_q, x, TRUE)
else
......
......@@ -2,6 +2,7 @@
* Remove full path in configure script, with example of Rmpfr configure. -*-org-*-
* Bug Fixes
** TODO Not working column assignment : A[,j] <- vec does nothing, not warn, nothing -- but A[i,] <- val works ??
** TODO m <- matrix(1:6, 2); Z <- as.bigz(m); str(Z) fails because e.g. Z[5] fails, contrary m[5]
** TODO asNumeric(x) : the generic must get a "..." argument, so can use "rounding mode" in Rmpfr
** DONE URGENT / BAD : Segfaults, Wrong Results, etc
** TODO completely *wrong* pmin() and pmax(<bigq>, <number>): uses Numerator in comparison ???
......@@ -9,7 +10,6 @@
** TODO Not working Arithmetic
*** DONE as.bigz(1:4) + as.bigq(7) failed, so do '*', '/', ... Fixed, using the +.bigz, etc _S3_ methods
*** TODO bigq %% and %/% are not even defined (but are for 'numeric')!
*** DONE more checking: q <- 2.3; Fn <- gmp:::`^.bigq`; Fn(q,q) silently gave wrong result; now a good error message
*** DONE <bigz> %*% <bigq> silently gave wrong result; now works, as does crossprod(), tcrossprod()
*** DONE bigz %% and %/% should be R compatible, notably fulfilling
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment