Skip to content

Commit

Permalink
fixes the valgrind error, #89
Browse files Browse the repository at this point in the history
  • Loading branch information
edzer committed Jan 19, 2018
1 parent 96ae9bb commit 44faf0c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 68 deletions.
3 changes: 0 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Generated by roxygen2: do not edit by hand

S3method("%*%",default)
S3method("%*%",units)
S3method("[",units)
S3method("units<-",logical)
S3method("units<-",numeric)
Expand Down Expand Up @@ -40,7 +38,6 @@ S3method(summary,units)
S3method(units,symbolic_units)
S3method(units,units)
S3method(weighted.mean,units)
export("%*%")
export(as.units)
export(as_cf)
export(as_difftime)
Expand Down
58 changes: 29 additions & 29 deletions R/arith.R
Original file line number Diff line number Diff line change
Expand Up @@ -131,34 +131,34 @@ Ops.units <- function(e1, e2) {
.as.units(NextMethod(), u)
}

#' matrix multiplication
#' @name matmult
#' @param x numeric matrix or vector
#' @param y numeric matrix or vector
#' @export
#' @details see \code{"\link[base]{\%*\%}"} for the base function, reimplemented
#' as default method
`%*%` = function(x, y) UseMethod("%*%")
##' matrix multiplication
##' @name matmult
##' @param x numeric matrix or vector
##' @param y numeric matrix or vector
##' @export
##' @details see \code{"\link[base]{\%*\%}"} for the base function, reimplemented
##' as default method
#`%*%` = function(x, y) UseMethod("%*%")

#' @name matmult
#' @export
`%*%.default` = function(x, y) {
if (inherits(y, "units"))
`%*%.units`(x, y)
else
base::`%*%`(x, y)
}
##' @name matmult
##' @export
#`%*%.default` = function(x, y) {
# if (inherits(y, "units"))
# `%*%.units`(x, y)
# else
# base::`%*%`(x, y)
#}

#' @name matmult
#' @export
#' @examples
#' a = set_units(1:5, m)
#' a %*% a
#' a %*% t(a)
#' a %*% set_units(1:5, 1)
#' set_units(1:5, 1) %*% a
`%*%.units` = function(x, y) {
ret = `%*%.default`(unclass(x), unclass(y))
units(ret) = .multiply_symbolic_units(1, units(x), units(y))
ret
}
##' @name matmult
##' @export
##' @examples
##' a = set_units(1:5, m)
##' a %*% a
##' a %*% t(a)
##' a %*% set_units(1:5, 1)
##' set_units(1:5, 1) %*% a
#`%*%.units` = function(x, y) {
# ret = `%*%.default`(unclass(x), unclass(y))
# units(ret) = .multiply_symbolic_units(1, units(x), units(y))
# ret
#}
36 changes: 0 additions & 36 deletions man/matmult.Rd

This file was deleted.

0 comments on commit 44faf0c

Please sign in to comment.