Takes the inner product of a variable array and a numeric array.

dot(a, b)

# S4 method for numeric,ramlArray
dot(a, b)

# S4 method for ramlArray,numeric
dot(a, b)

Arguments

a

An array of class "numeric".

b

An array of variables.

Examples

m <- Model()
#> Found more than one class "RAMLModel" in cache; using the first, from namespace 'raml'
#> Also defined by ‘.GlobalEnv’
#> Found more than one class "RAMLModel" in cache; using the first, from namespace 'raml'
#> Also defined by ‘.GlobalEnv’
m$var(x[1:3] >= 0)
#> Found more than one class "ramlArray" in cache; using the first, from namespace 'raml'
#> Also defined by ‘.GlobalEnv’
#> Found more than one class "ramlVariable" in cache; using the first, from namespace 'raml'
#> Also defined by ‘.GlobalEnv’
m$constraint(dot(x, c(1,1,1)) >= 1)
#> Error in (function (classes, fdef, mtable) { methods <- .findInheritedMethods(classes, fdef, mtable) if (length(methods) == 1L) return(methods[[1L]]) else if (length(methods) == 0L) { cnames <- paste0("\"", vapply(classes, as.character, ""), "\"", collapse = ", ") stop(gettextf("unable to find an inherited method for function %s for signature %s", sQuote(fdef@generic), sQuote(cnames)), domain = NA) } else stop("Internal error in finding inherited methods; didn't return a unique method", domain = NA)})(list(structure("ramlArray", package = "raml"), "numeric"), structure(function (a, b) standardGeneric("dot"), generic = structure("dot", package = ".GlobalEnv"), package = ".GlobalEnv", group = list(), valueClass = character(0), signature = c("a", "b"), default = `\001NULL\001`, skeleton = (function (a, b) stop("invalid call in method dispatch to 'dot' (no default method)", domain = NA))(a, b), class = structure("standardGeneric", package = "methods")), <environment>): unable to find an inherited method for function ‘dot’ for signature ‘"ramlArray", "numeric"’
m$objective(dot(c(1,2,3), x))
#> Error in (function (classes, fdef, mtable) { methods <- .findInheritedMethods(classes, fdef, mtable) if (length(methods) == 1L) return(methods[[1L]]) else if (length(methods) == 0L) { cnames <- paste0("\"", vapply(classes, as.character, ""), "\"", collapse = ", ") stop(gettextf("unable to find an inherited method for function %s for signature %s", sQuote(fdef@generic), sQuote(cnames)), domain = NA) } else stop("Internal error in finding inherited methods; didn't return a unique method", domain = NA)})(list("numeric", structure("ramlArray", package = "raml")), structure(function (a, b) standardGeneric("dot"), generic = structure("dot", package = ".GlobalEnv"), package = ".GlobalEnv", group = list(), valueClass = character(0), signature = c("a", "b"), default = `\001NULL\001`, skeleton = (function (a, b) stop("invalid call in method dispatch to 'dot' (no default method)", domain = NA))(a, b), class = structure("standardGeneric", package = "methods")), <environment>): unable to find an inherited method for function ‘dot’ for signature ‘"numeric", "ramlArray"’
show(m)
#> Found more than one class "RAMLModel" in cache; using the first, from namespace 'raml'
#> Also defined by ‘.GlobalEnv’
#> Minimize: (Undefined objective function) #> Subject to: #> (No defined constraints)