Package 'TensorTools'

Title: Multilinear Algebra
Description: A set of tools for basic tensor operators. A tensor in the context of data analysis in a multidimensional array. The tools in this package rely on using any discrete transformation (e.g. Fast Fourier Transform (FFT)). Standard tools included are the Eigenvalue decomposition of a tensor, the QR decomposition and LU decomposition. Other functionality includes the inverse of a tensor and the transpose of a symmetric tensor. Functionality in the package is outlined in Kernfeld, E., Kilmer, M., and Aeron, S. (2015) <doi:10.1016/j.laa.2015.07.021>.
Authors: Kyle Caudle [aut, cre], Randy Hoover [ctb], Jackson Cates [ctb], Evertt Sandbo [ctb]
Maintainer: Kyle Caudle <[email protected]>
License: GPL-3
Version: 1.0.0
Built: 2024-10-18 12:34:09 UTC
Source: CRAN

Help Index


Converts an array to an S3 tensor

Description

This will converts array to S3 object tensor. Vectors and matrices must first be converted to an array before applying as.Tensor.

Usage

as.Tensor(t)

Arguments

t

Numeric, array of numbers

Value

S3 class tensor

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

Examples

indices <- c(2,3,4)
arr <- array(runif(prod(indices)), dim = indices)
arrT <- as.Tensor(arr); arrT

The Frobenius Norm

Description

The Frobenius norm of an array is the square root of the sum of its squared elements. This function works for vector and matrix arguments as well.

Usage

fnorm(tnsr)

Arguments

tnsr

a 3-mode tensor S3 class object

Value

The Frobenius norm

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

Friedland, S., & Aliabadi, M. (2018). Linear algebra and matrices. Society for Industrial and Applied Mathematics.

Examples

T <- t_rand(modes=c(2,2,4))
fnorm(T$data)

LU Decomposition of a Complex Matrix

Description

Decomposes a a matrix into the product of a lower triangular matrix and an upper triangular matrix.

Usage

LU(A)

Arguments

A

Complex, square matrix of complex numbers

Value

A lower triangular matrix L and an upper triangular matrix U so that A=LU

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

Stewart, G. W. (1998). Matrix algorithms: volume 1: basic decompositions. Society for Industrial and Applied Mathematics.

Examples

indices <- c(2,3,4)
z <- complex(real = rnorm(16), imag = rnorm(16))
A <- matrix(z,nrow=4)
LU(A)

Subset of MNIST training and testing data.

Description

10000 MNIST training images (1000 of every digit), reformatted into a tensor: 28 x 10000 x 28. 1000 MNIST test images (100 of every digit), reformatted into a tensor: 28 x 1000 x 28

Usage

data("Mnist")

Format

The format is:

Mnist$train$images, Mnist$train$labels

Mnist$test$images, Mnist$test$labels

References

Deng L (2012). “The mnist database of handwritten digit images for machine learning research.” IEEE Signal Processing Magazine, 29(6), 141–142

Examples

data("Mnist")

Polar/Jordan form of matrices P and D

Description

Converts the complex matrices P and D into matrices of eigenvectors and eigenvalues with real entries.

Usage

polar(P,D)

Arguments

P

the eigenvectors from an eigenvalue decomposition.

D

the eigenvalues from an eigenvalue decomposition.

Value

P the polar form (real-valued) matrix of eigenvectors. D the polar form (real-valued) matrix of eigenvalues.

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

Bhatia, R. (2013). Matrix analysis (Vol. 169). Springer Science & Business Media.

Examples

z <- complex(real = rnorm(16), imag = rnorm(16))
M <- matrix(z,nrow=4)
decomp <- eigen(M)
polar(decomp$vectors,decomp$values)

QR Decomposition of a Complex Matrix without pivoting.

Description

Decomposes a complex matrix into the product of an upper triangular matrix and a lower triangular matrix.

Usage

QR(A)

Arguments

A

square matrix with complex entries

Value

an orthogonal matrix Q and an upper triangular matrix R so that A = QR.

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

Stewart, G. W. (1998). Matrix algorithms: volume 1: basic decompositions. Society for Industrial and Applied Mathematics.

Examples

z <- complex(real = rnorm(16), imag = rnorm(16))
A <- matrix(z,nrow=4)
QR(A)

Subset of raytrace data

Description

4 tensors (128 x 128 x 128) for 4 different gray scale images. boat, flashlight, keyboard, scooter.

Usage

data("raytrace")

Format

The format is:

raytrace$boat

raytrace$flashlight

raytrace$keyboard

raytrace$scooter

References

Hoover RC, Braman KS, Hao N (2011b). “Pose estimation from a single image using tensor decomposition and an algebra of circulants.” In 2011 IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 2928–2934. IEEE.

Examples

data(raytrace)

Create a random tensor

Description

Generate a Tensor with specified modes whose entries are iid normal(0,1).

Usage

t_rand(modes = c(3, 4, 5))

Arguments

modes

the 3 modes of the output Tensor

Value

an S3 Tensor object

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

Imported from rTensor2 package version 2.0.0.

Examples

t_rand(c(4,4,4))

Tensor transpose

Description

Performs the transpose of a symmetric 3-mode tensor using any discrete transform.

Usage

t_tpose(tnsr, tform)

Arguments

tnsr

a 3-mode tensor

tform

Any discrete transform.

fft: Fast Fourier Transorm

dwt: Discrete Wavelet Transform (Haar Wavelet)

dct: Discrete Cosine transform

dst: Discrete Sine transform

dht: Discrete Hadley transform

dwht: Discrete Walsh-Hadamard transform

Value

S3 class tensor

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

Brachat, J., Comon, P., Mourrain, B., & Tsigaridas, E. (2010). Symmetric tensor decomposition. Linear Algebra and its Applications, 433(11-12), 1851-1872.

Examples

T <- t_rand(modes=c(2,3,4))
print(t_tpose(T,"dct"))

Discrete Wavelet Transform

Description

Performs the Discrete Wavelet Transform of a 3-mode Tensor.

Usage

tDWT(tnsr)

Arguments

tnsr

A 3-mode Tensor

Value

S3 class tensor

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

G. Strang and T. Nguyen, Wavelets and filter banks. SIAM, 1996. A. Haar, "Zur theorie der orthogonalen funktionensysteme", Mathematische annalen, vol. 69, no. 3, pp. 331-371, 1910.

Jensen, A., & la Cour-Harbo, A. (2011). Ripples in mathematics: the discrete wavelet transform. Springer Science & Business Media.

Examples

T <- t_rand(modes=c(2,3,4))
print(tDWT(T))

Tensor Eigenvalue Decomposition Using any Discrete Transform

Description

The Eigenvalue decomposition of a tensor T (nn x nn x kk) decomposes the tensor into a tensor of eigenvectors (P) and a diagonal tensor of eigenvalues (D) so that T = P D inv(P).

Usage

tEIG(tnsr, tform)

Arguments

tnsr

a 3-mode S3 tensor class object (nn x nn x kk)

tform

Any discrete transform.

fft: Fast Fourier Transorm

dwt: Discrete Wavelet Transform (Haar Wavelet)

dct: Discrete Cosine transform

dst: Discrete Sine transform

dht: Discrete Hadley transform

dwht: Discrete Walsh-Hadamard transform

Value

P, a tensor of Eigenvectors (nn x nn x kk)

D, a diagonal tensor of Eigenvalues (nn x nn x kk)

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
tEIG(T,"dst")

Eigenvalue decomposition of 3-mode tensor using the discrete cosine transform.

Description

Eigenvalue decomposition of 3-mode tensor using the discrete cosine transform.

Usage

tEIGdct(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object (nn x nn x kk)

Value

P, tensor of Eigenvectors (nn x nn x kk)

D, diagonal tensor of Eigenvalues (nn x nn x kk)

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
print(tEIGdct(T))

Eigenvalue decomposition of 3-mode tensor using the discrete Hadley transform.

Description

Eigenvalue decomposition of 3-mode tensor using the discrete Hadley transform.

Usage

tEIGdht(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object (nn x nn x kk)

Value

P, tensor of Eigenvectors (nn x nn x kk)

D, diagonal tensor of Eigenvalues (nn x nn x kk)

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
print(tEIGdht(T))

Eigenvalue decomposition of 3-mode tensor using the discrete sine transform.

Description

Eigenvalue decomposition of 3-mode tensor using the discrete sine transform.

Usage

tEIGdst(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object (nn x nn x kk)

Value

P, tensor of Eigenvectors (nn x nn x kk)

D, diagonal tensor of Eigenvalues (nn x nn x kk)

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
print(tEIGdst(T))

Eigenvalue decomposition of 3-mode tensor using the discrete Walsh Hadley transform.

Description

Eigenvalue decomposition of 3-mode tensor using the discrete Walsh Hadley transform.

Usage

tEIGdwht(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object (nn x nn x kk)

Value

P, tensor of Eigenvectors (nn x nn x kk)

D, diagonal tensor of Eigenvalues (nn x nn x kk)

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
print(tEIGdwht(T))

Eigenvalue decomposition of 3-mode tensor using the discrete wavelet transform.

Description

Eigenvalue decomposition of 3-mode tensor using the discrete wavelet transform.

Usage

tEIGdwt(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object (nn x nn x kk)

Value

P, tensor of Eigenvectors (nn x nn x kk)

D, diagonal tensor of Eigenvalues (nn x nn x kk)

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
print(tEIGdwt(T))

Eigenvalue decomposition of 3-mode tensor using the discrete fast fourier transform.

Description

Eigenvalue decomposition of 3-mode tensor using the discrete fast fourier transform.

Usage

tEIGfft(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object (nn x nn x kk)

Value

P, tensor of Eigenvectors (nn x nn x kk)

D, diagonal tensor of Eigenvalues (nn x nn x kk)

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
print(tEIGfft(T))

Creates an S3 class for a tensor

Description

Creates an S3 class for a tensor

Usage

Tensor(data, x, y, z)

Arguments

data

Numeric numbers in the tensor

x

mode 1 dimension

y

mode 2 dimension

z

mode 3 dimension

Value

S3 class tensor


Inverse Wavelet Transform

Description

Performs inverse of 3-mode tensor using any discrete wavelet transform.

Usage

tIDWT(tnsr)

Arguments

tnsr

a 3-mode tensor S3 class object

Value

S3 class tensor

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

Examples

T <- t_rand(modes=c(2,3,4))
print(tIDWT(T))

Performs inverse of 3-mode tensor using any discrete transform.

Description

Performs inverse of 3-mode tensor using any discrete transform.

Usage

tINV(tnsr, tform)

Arguments

tnsr

a 3-mode tensor S3 class object

tform

Any discrete transform. fft: Fast Fourier Transorm dwt: Discrete Wavelet Transform (Haar Wavelet) dct: Discrete Cosine transform dst: Discrete Sine transform dht: Discrete Hadley transform dwht: Discrete Walsh-Hadamard transform

Value

S3 class tensor

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

Examples

T <- t_rand(modes=c(2,2,4))
print(tINV(T,"dst"))

Performs inverse of 3-mode tensor using the discrete cosine transform.

Description

Performs inverse of 3-mode tensor using the discrete cosine transform.

Usage

tINVdct(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object

Value

S3 class tensor #' @examples T <- t_rand(modes=c(2,2,4)) print(tINVdct(T))

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo


Performs inverse of 3-mode tensor using the discrete Hadley transform.

Description

Performs inverse of 3-mode tensor using the discrete Hadley transform.

Usage

tINVdht(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object

Value

S3 class tensor

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

Examples

T <- t_rand(modes=c(2,2,4))
print(tINVdht(T))

Performs inverse of 3-mode tensor using the discrete sine transform.

Description

Performs inverse of 3-mode tensor using the discrete sine transform.

Usage

tINVdst(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object

Value

S3 class tensor

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

Examples

T <- t_rand(modes=c(2,2,4))
print(tINVdst(T))

Performs inverse of 3-mode tensor using the discrete Walsh Hadley transform.

Description

Performs inverse of 3-mode tensor using the discrete Walsh Hadley transform.

Usage

tINVdwht(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object

Value

S3 class tensor

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

Examples

T <- t_rand(modes=c(2,2,4))
print(tINVdwht(T))

Performs inverse of 3-mode tensor using the discrete wavelet transform.

Description

Performs inverse of 3-mode tensor using the discrete wavelet transform.

Usage

tINVdwt(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object

Value

S3 class tensor

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

Examples

tnsr <- t_rand(modes=c(2,2,4))
print(tINVdwt(tnsr))

Performs inverse of 3-mode tensor using the discrete fast fourier transform.

Description

Performs inverse of 3-mode tensor using the discrete fast fourier transform.

Usage

tINVfft(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object

Value

S3 class tensor

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

Examples

T <- t_rand(modes=c(2,2,4))
print(tINVfft(T))

Linear discriminate analysis (LDA) on a 3D tensor

Description

Linear discriminate analysis (LDA) on a 3D tensor

Usage

tLDA(tnsr, nClass, nSamplesPerClass, tform)

Arguments

tnsr

a 3-mode tensor S3 class object

nClass

Number of classes

nSamplesPerClass

Samples in each class

tform

Any discrete transform. fft: Fast Fourier Transorm

dwt: Discrete Wavelet Transform (Haar Wavelet)

dct: Discrete Cosine transform

dst: Discrete Sine transform

dht: Discrete Hadley transform

dwht: Discrete Walsh-Hadamard transform

Value

S3 class tensor

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

Xanthopoulos, P., Pardalos, P. M., Trafalis, T. B., Xanthopoulos, P., Pardalos, P. M., & Trafalis, T. B. (2013). Linear discriminant analysis. Robust data mining, 27-33.

Examples

data("Mnist")
T <- Mnist$train$images
myorder <- order(Mnist$train$labels)
# tLDA need to be sorted by classes
T_sorted <- T$data[,myorder,]
# Using small tensor, 2 images for each class for demonstration
T <- T_sorted[,c(1:2,1001:1002,2001:2002,3001:3002,4001:4002,
5001:5002,6001:6002,7001:7002,8001:8002,9001:9002),]
tLDA(as.Tensor(T),10,2,"dct")

LU decomposition of a 3D tensor

Description

Decomposes a 3 model tensor into a lower triangular tensor and an upper triangular tensor.

Usage

tLU(tnsr, tform)

Arguments

tnsr

a 3-mode tensor S3 class object

tform

Any discrete transform.

fft: Fast Fourier Transform

dwt: Discrete Wavelet Transform (Haar Wavelet)

dct: Discrete Cosine transform

dst: Discrete Sine transform

dht: Discrete Hadley transform

dwht: Discrete Walsh-Hadamard transform

Value

L, The lower triangular tensor object

U, The upper triangular tensor object a Tensor3-class object

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

M. E. Kilmer, C. D. Martin, and L. Perrone, “A third-order generalization of the matrix svd as a product of third-order tensors,” Tufts University, Department of Computer Science, Tech. Rep. TR-2008-4, 2008

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
tLU(T,"dst")

LU decomposition of a 3D tensor using the discrete cosine transform

Description

LU decomposition of a 3D tensor using the discrete cosine transform

Usage

tLUdct(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object

Value

L, The lower triangular S3 tensor object

U, The upper triangular S3 tensor object

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

M. E. Kilmer, C. D. Martin, and L. Perrone, “A third-order generalization of the matrix svd as a product of third-order tensors,” Tufts University, Department of Computer Science, Tech. Rep. TR-2008-4, 2008

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
tLUdct(T)

LU decomposition of a 3D tensor using the discrete Hadley transform

Description

LU decomposition of a 3D tensor using the discrete Hadley transform

Usage

tLUdht(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object

Value

L, The lower triangular S3 tensor object

U, The upper triangular S3 tensor object

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

M. E. Kilmer, C. D. Martin, and L. Perrone, “A third-order generalization of the matrix svd as a product of third-order tensors,” Tufts University, Department of Computer Science, Tech. Rep. TR-2008-4, 2008

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
tLUdht(T)

LU decomposition of a 3D tensor using the discrete sine transform

Description

LU decomposition of a 3D tensor using the discrete sine transform

Usage

tLUdst(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object

Value

L, The lower triangular S3 tensor object

U, The upper triangular S3 tensor object

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

M. E. Kilmer, C. D. Martin, and L. Perrone, “A third-order generalization of the matrix svd as a product of third-order tensors,” Tufts University, Department of Computer Science, Tech. Rep. TR-2008-4, 2008

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
tLUdst(T)

LU decomposition of a 3D tensor using the discrete Walsh Hadley transform

Description

LU decomposition of a 3D tensor using the discrete Walsh Hadley transform

Usage

tLUdwht(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object

Value

L, The lower triangular S3 tensor object

U, The upper triangular S3 tensor object

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

M. E. Kilmer, C. D. Martin, and L. Perrone, “A third-order generalization of the matrix svd as a product of third-order tensors,” Tufts University, Department of Computer Science, Tech. Rep. TR-2008-4, 2008

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
tLUdwht(T)

LU decomposition of a 3D tensor using the discrete wavelet transform

Description

LU decomposition of a 3D tensor using the discrete wavelet transform

Usage

tLUdwt(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object

Value

L, The lower triangular S3 tensor object

U, The upper triangular S3 tensor object

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

M. E. Kilmer, C. D. Martin, and L. Perrone, “A third-order generalization of the matrix svd as a product of third-order tensors,” Tufts University, Department of Computer Science, Tech. Rep. TR-2008-4, 2008

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
tLUdwt(T)

LU decomposition of a 3D tensor using the discrete fast fourier transform

Description

LU decomposition of a 3D tensor using the discrete fast fourier transform

Usage

tLUfft(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object

Value

L, The lower triangular S3 tensor object

U, The upper triangular S3 tensor object

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

M. E. Kilmer, C. D. Martin, and L. Perrone, “A third-order generalization of the matrix svd as a product of third-order tensors,” Tufts University, Department of Computer Science, Tech. Rep. TR-2008-4, 2008

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
tLUfft(T)

Determines the mean of a 3D tensor along mode 2

Description

Determines the mean of a 3D tensor along mode 2

Usage

tmean(tnsr)

Arguments

tnsr

a 3D tensor of dimensions n1,n2,n3

Value

S3 tensor class object

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

M. E. Kilmer, C. D. Martin, and L. Perrone, “A third-order generalization of the matrix svd as a product of third-order tensors,” Tufts University, Department of Computer Science, Tech. Rep. TR-2008-4, 2008

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

tnsr <- t_rand(modes=c(3,4,5))
tmean(tnsr)

Tensor multiplication

Description

Performs the tensor product of two 3D tensors using any discrete transform

Usage

tmult(x, y, tform)

Arguments

x

a 3-mode S3 tensor class object

y

a 3-mode S3 tensor class object

tform

Any discrete transform.

fft: Fast Fourier Transform

dwt: Discrete Wavelet Transform (Haar Wavelet)

dct: Discrete Cosine transform

dst: Discrete Sine transform

dht: Discrete Hadley transform

dwht: Discrete Walsh-Hadamard transform

Value

S3 tensor object

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

M. E. Kilmer, C. D. Martin, and L. Perrone, “A third-order generalization of the matrix svd as a product of third-order tensors,” Tufts University, Department of Computer Science, Tech. Rep. TR-2008-4, 2008

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T1 <- t_rand(modes=c(2,2,4))
T2 <- t_rand(modes=c(2,3,4))
print(tmult(T1,T2,"dst"))

QR decomposition of a 3D tensor

Description

Decomposes a 3 mode tensor T into the product of The left singular value tensor object and a right singular value tensor object so that T = QR.

Usage

tQR(tnsr, tform)

Arguments

tnsr

a 3-mode tensor S3 class object

tform

Any discrete transform.

fft: Fast Fourier Transorm

dwt: Discrete Wavelet Transform (Haar Wavelet)

dct: Discrete Cosine transform

dst: Discrete Sine transform

dht: Discrete Hadley transform

dwht: Discrete Walsh-Hadamard transform

Value

Q, The left singular value tensor object (n×n×kn \times n \times k)

R, The right singular value tensor object (n×n×kn \times n \times k)

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

M. E. Kilmer, C. D. Martin, and L. Perrone, “A third-order generalization of the matrix svd as a product of third-order tensors,” Tufts University, Department of Computer Science, Tech. Rep. TR-2008-4, 2008

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
tQR(T,"dst")

QR decomposition of a 3D tensor using the discrete cosine transform

Description

QR decomposition of a 3D tensor using the discrete cosine transform

Usage

tQRdct(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object

Value

Q, The left singular value S3 tensor class object (n×n×kn \times n \times k)

R, The right singular value Se tensor class object (n×n×kn \times n \times k)

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

M. E. Kilmer, C. D. Martin, and L. Perrone, “A third-order generalization of the matrix svd as a product of third-order tensors,” Tufts University, Department of Computer Science, Tech. Rep. TR-2008-4, 2008

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
tQRdct(T)

QR decomposition of a 3D tensor using the discrete Hadley transform

Description

QR decomposition of a 3D tensor using the discrete Hadley transform

Usage

tQRdht(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object

Value

Q, The left singular value S3 tensor class object (n×n×kn \times n \times k)

R, The right singular value Se tensor class object (n×n×kn \times n \times k)

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

M. E. Kilmer, C. D. Martin, and L. Perrone, “A third-order generalization of the matrix svd as a product of third-order tensors,” Tufts University, Department of Computer Science, Tech. Rep. TR-2008-4, 2008

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
tQRdht(T)

QR decomposition of a 3D tensor using the discrete sine transform

Description

QR decomposition of a 3D tensor using the discrete sine transform

Usage

tQRdst(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object

Value

Q, The left singular value S3 tensor class object (n×n×kn \times n \times k)

R, The right singular value Se tensor class object (n×n×kn \times n \times k)

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

M. E. Kilmer, C. D. Martin, and L. Perrone, “A third-order generalization of the matrix svd as a product of third-order tensors,” Tufts University, Department of Computer Science, Tech. Rep. TR-2008-4, 2008

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
tQRdst(T)

QR decomposition of a 3D tensor using the discrete Walsh Hadley transform

Description

QR decomposition of a 3D tensor using the discrete Walsh Hadley transform

Usage

tQRdwht(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object

Value

Q, The left singular value S3 tensor class object (n×n×kn \times n \times k)

R, The right singular value Se tensor class object (n×n×kn \times n \times k)

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

M. E. Kilmer, C. D. Martin, and L. Perrone, “A third-order generalization of the matrix svd as a product of third-order tensors,” Tufts University, Department of Computer Science, Tech. Rep. TR-2008-4, 2008

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
tQRdwht(T)

QR decomposition of a 3D tensor using the discrete wavelet transform

Description

QR decomposition of a 3D tensor using the discrete wavelet transform

Usage

tQRdwt(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object

Value

Q, The left singular value S3 tensor class object (n×n×kn \times n \times k)

R, The right singular value Se tensor class object (n×n×kn \times n \times k)

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

M. E. Kilmer, C. D. Martin, and L. Perrone, “A third-order generalization of the matrix svd as a product of third-order tensors,” Tufts University, Department of Computer Science, Tech. Rep. TR-2008-4, 2008

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
tQRdwt(T)

QR decomposition of a 3D tensor using the fast fourier transform

Description

QR decomposition of a 3D tensor using the fast fourier transform

Usage

tQRfft(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object

Value

Q, The left singular value S3 tensor class object (n×n×kn \times n \times k)

R, The right singular value Se tensor class object (n×n×kn \times n \times k)

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

M. E. Kilmer, C. D. Martin, and L. Perrone, “A third-order generalization of the matrix svd as a product of third-order tensors,” Tufts University, Department of Computer Science, Tech. Rep. TR-2008-4, 2008

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
tQRfft(T)

Singular value decomposition (SVD)

Description

Performs a Singular Value Decomposition of 3 mode tensor T using any discrete transform. The result is a left singular value tensor object U, a right singular value tensor object V, and a diagonal tensor S so that T = USV^t

Usage

tSVD(tnsr, tform)

Arguments

tnsr

a 3-mode tensor S3 class object

tform

Any discrete transform.

fft: Fast Fourier Transorm

dwt: Discrete Wavelet Transform (Haar Wavelet)

dct: Discrete Cosine transform

dst: Discrete Sine transform

dht: Discrete Hadley transform

dwht: Discrete Walsh-Hadamard transform

Value

If the SVD is performed on a mm x nn x kk tensor, the components in the returned value are:

U, the left singular value tensor object (mm x mm x kk)

V, The right singular value tensor object (nn x nn x kk)

S: A diagonal tensor (mm x nn x kk)#' @examples

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

M. E. Kilmer, C. D. Martin, and L. Perrone, “A third-order generalization of the matrix svd as a product of third-order tensors,” Tufts University, Department of Computer Science, Tech. Rep. TR-2008-4, 2008

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,3,4))
print(tSVD(T,"dst"))

Singular value decomposition (SVD) of a 3D tensor using the discrete cosine transform

Description

Singular value decomposition (SVD) of a 3D tensor using the discrete cosine transform

Usage

tSVDdct(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object

Value

U, the left singular value tensor object (mm x mm x kk)

V, The right singular value tensor object (nn x nn x kk)

S: A diagonal tensor (mm x nn x kk)#' @examples V: The right singular value tensor object (nn x nn x kk) S: A diagonal tensor (mm x nn x kk)

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

M. E. Kilmer, C. D. Martin, and L. Perrone, “A third-order generalization of the matrix svd as a product of third-order tensors,” Tufts University, Department of Computer Science, Tech. Rep. TR-2008-4, 2008

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
tSVDdct(T)

Singular value decomposition (SVD) of a 3D tensor using the discrete Hadley transform

Description

Singular value decomposition (SVD) of a 3D tensor using the discrete Hadley transform

Usage

tSVDdht(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object

Value

U, the left singular value tensor object (mm x mm x kk)

V, The right singular value tensor object (nn x nn x kk)

S: A diagonal tensor (mm x nn x kk)#' @examples V: The right singular value tensor object (nn x nn x kk) S: A diagonal tensor (mm x nn x kk)

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

M. E. Kilmer, C. D. Martin, and L. Perrone, “A third-order generalization of the matrix svd as a product of third-order tensors,” Tufts University, Department of Computer Science, Tech. Rep. TR-2008-4, 2008

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
tSVDdht(T)

Singular value decomposition (SVD) of a 3D tensor using the discrete sine transform

Description

Singular value decomposition (SVD) of a 3D tensor using the discrete sine transform

Usage

tSVDdst(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object

Value

U, the left singular value tensor object (mm x mm x kk)

V, The right singular value tensor object (nn x nn x kk)

S: A diagonal tensor (mm x nn x kk)#' @examples V: The right singular value tensor object (nn x nn x kk) S: A diagonal tensor (mm x nn x kk)

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

M. E. Kilmer, C. D. Martin, and L. Perrone, “A third-order generalization of the matrix svd as a product of third-order tensors,” Tufts University, Department of Computer Science, Tech. Rep. TR-2008-4, 2008

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
tSVDdst(T)

Singular value decomposition (SVD) of a 3D tensor using the discrete Walsh Hadley transform

Description

Singular value decomposition (SVD) of a 3D tensor using the discrete Walsh Hadley transform

Usage

tSVDdwht(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object

Value

U, the left singular value tensor object (mm x mm x kk)

V, The right singular value tensor object (nn x nn x kk)

S: A diagonal tensor (mm x nn x kk)#' @examples V: The right singular value tensor object (nn x nn x kk) S: A diagonal tensor (mm x nn x kk)

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

M. E. Kilmer, C. D. Martin, and L. Perrone, “A third-order generalization of the matrix svd as a product of third-order tensors,” Tufts University, Department of Computer Science, Tech. Rep. TR-2008-4, 2008

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
tSVDdwht(T)

Singular value decomposition (SVD) of a 3D tensor using the discrete wavelet transform

Description

Singular value decomposition (SVD) of a 3D tensor using the discrete wavelet transform

Usage

tSVDdwt(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object

Value

U, the left singular value tensor object (mm x mm x kk)

V, The right singular value tensor object (nn x nn x kk)

S: A diagonal tensor (mm x nn x kk)#' @examples V: The right singular value tensor object (nn x nn x kk) S: A diagonal tensor (mm x nn x kk)

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

M. E. Kilmer, C. D. Martin, and L. Perrone, “A third-order generalization of the matrix svd as a product of third-order tensors,” Tufts University, Department of Computer Science, Tech. Rep. TR-2008-4, 2008

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
tSVDdwt(T)

Singular value decomposition (SVD) of a 3D tensor using the fast fourier transform

Description

Singular value decomposition (SVD) of a 3D tensor using the fast fourier transform

Usage

tSVDfft(tnsr)

Arguments

tnsr

a 3-mode S3 tensor class object

Value

U, the left singular value tensor object (mm x mm x kk)

V, The right singular value tensor object (nn x nn x kk)

S: A diagonal tensor (mm x nn x kk)#' @examples V: The right singular value tensor object (nn x nn x kk) S: A diagonal tensor (mm x nn x kk)

Author(s)

Kyle Caudle

Randy Hoover

Jackson Cates

Everett Sandbo

References

M. E. Kilmer, C. D. Martin, and L. Perrone, “A third-order generalization of the matrix svd as a product of third-order tensors,” Tufts University, Department of Computer Science, Tech. Rep. TR-2008-4, 2008

K. Braman, "Third-order tensors as linear operators on a space of matrices", Linear Algebra and its Applications, vol. 433, no. 7, pp. 1241-1253, 2010.

Examples

T <- t_rand(modes=c(2,2,4))
tSVDfft(T)