Tensors in GeometricMachineLearning
We typically store training data as tensors with three axes in GeometricMachineLearning. This allows for a parallel computation of matrix products, also for the special arrays such as LowerTriangular, UpperTriangular, SymmetricMatrix and SkewSymMatrix and objects of Manifold type such as the StiefelManifold.
Library Functions
GeometricMachineLearning.tensor_mat_mul — Methodtensor_mat_mul(A::AbstractArray{<:Number, 3}, B::AbstractMatrix)Multipliy the matrix B onto the tensor A from the right.
Internally this calls the inplace version tensor_mat_mul!.
Examples
using GeometricMachineLearning: tensor_mat_mul
A = [1 1 1; 1 1 1; 1 1 1;;; 2 2 2; 2 2 2; 2 2 2]
B = [3 0 0; 0 2 0; 0 0 1]
tensor_mat_mul(A, B)
# output
3×3×2 Array{Int64, 3}:
[:, :, 1] =
3 2 1
3 2 1
3 2 1
[:, :, 2] =
6 4 2
6 4 2
6 4 2GeometricMachineLearning.tensor_mat_mul! — Methodtensor_mat_mul!(C, A, B)Multiply the matrix B onto the tensor A from the right and store the result in C.
The function tensor_mat_mul calls tensor_mat_mul! internally.
GeometricMachineLearning.tensor_mat_mul! — Methodmat_tensor_mul!(C::AbstractArray{<:Number, 3}, B::AbstractArray{<:Number, 3}, A::SymmetricMatrix)Multiply the symmetric matrix A onto the tensor B from the right and store the result in C.
This performs an efficient multiplication based on the special structure of the symmetric matrix A.
GeometricMachineLearning.mat_tensor_mul — Methodmat_tensor_mul(A, B)Multipliy the matrix A onto the tensor B from the left.
Internally this calls the inplace version mat_tensor_mul!.
Examples
using GeometricMachineLearning: mat_tensor_mul
B = [1 1 1; 1 1 1; 1 1 1;;; 2 2 2; 2 2 2; 2 2 2]
A = [3 0 0; 0 2 0; 0 0 1]
mat_tensor_mul(A, B)
# output
3×3×2 Array{Int64, 3}:
[:, :, 1] =
3 3 3
2 2 2
1 1 1
[:, :, 2] =
6 6 6
4 4 4
2 2 2GeometricMachineLearning.mat_tensor_mul! — Methodmat_tensor_mul!(C, A, B)Multiply the matrix A onto the tensor B from the left and store the result in C.
The function mat_tensor_mul calls mat_tensor_mul! internally.
GeometricMachineLearning.mat_tensor_mul! — Methodmat_tensor_mul!(C, A::LowerTriangular, B)Multiply the lower-triangular matrix A onto the tensor B from the left and store the result in C.
This performs an efficient multiplication based on the special structure of the lower-triangular matrix A.
GeometricMachineLearning.mat_tensor_mul! — Methodmat_tensor_mul!(C, A::UpperTriangular, B)Multiply the upper-triangular matrix A onto the tensor B from the left and store the result in C.
This performs an efficient multiplication based on the special structure of the upper-triangular matrix A.
GeometricMachineLearning.mat_tensor_mul! — Methodmat_tensor_mul!(C, A::SkewSymMatrix, B)Multiply skew-symmetric the matrix A onto the tensor B from the left and store the result in C.
This performs an efficient multiplication based on the special structure of the skew-symmetric matrix A.
GeometricMachineLearning.mat_tensor_mul! — Methodmat_tensor_mul!(C, A::SymmetricMatrix, B)Multiply the symmetric matrix A onto the tensor B from the left and store the result in C.
This performs an efficient multiplication based on the special structure of the symmetric matrix A.