tensorprod | R Documentation |
Consistent with tensor()
function in tensor
package, or
ttl()
in rTensor
package.
tensorprod( A, B, alongA = integer(0), alongB = integer(0), path = tempfile(), meta_name = "farray.meta" )
A, B |
an |
alongA, alongB |
integers; margins in |
path, meta_name |
where to store the results; see |
It is highly recommended that A
is a small array and B
is a
large array. The performance if highly related to how alongB
is assigned.
If all the fast margins (see is_fast_margin
) are contained within
alongB
, then there is no memory optimization, and the whole calculation
occurs in the memory. If at least one fast margin is not in alongB
, then
the calculation is memory optimized.
A farray
object.
Zhengjia Wang
x <- matrix(1:12, ncol = 4) y <- array(rnorm(120), c(4,5,6)) # Equivalent to tensor::tensor(x, y, alongA = 2, alongB = 1) # or rTensor::ttm(rTensor::as.tensor(y), x, m = 1) tensorprod(x, y, alongA = 2, alongB = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.