Commit 60ca9127 authored by Chris Jewell's avatar Chris Jewell
Browse files

Added array class to tensor returned from sliceTensor hack.

parent 4a5f45e8
...@@ -23,6 +23,10 @@ isFinitePositiveInteger = function(x) ...@@ -23,6 +23,10 @@ isFinitePositiveInteger = function(x)
{ {
isFiniteInteger(x) & isFinitePositive(x) isFiniteInteger(x) & isFinitePositive(x)
} }
isProb = function(x)
{
is.finite(x) & x >= 0 & x <= 1
}
arrayextend = function(x, along, size, newdimnames) arrayextend = function(x, along, size, newdimnames)
{ {
...@@ -45,7 +49,9 @@ arrayextend = function(x, along, size, newdimnames) ...@@ -45,7 +49,9 @@ arrayextend = function(x, along, size, newdimnames)
#' [.tensor as of tensorA v0.36. #' [.tensor as of tensorA v0.36.
sliceTensor <- function(x,...) { sliceTensor <- function(x,...) {
class(x) <- 'array' class(x) <- 'array'
as.tensor.default(x[...]) x = as.tensor.default(x[...])
class(x) = append(class(x),'array')
x
} }
Supports Markdown
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