Skip to content

Commit

Permalink
added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
JesperLH committed Feb 21, 2019
1 parent b35fa94 commit d588736
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion generateTensorTrain.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
function [X, G, S, V] = generateTensorTrain(N, D)
%% GENERATETENSORTRAIN generates a tensor train with
% GENERATETENSORTRAIN generates a tensor with length(N) modes, where there
% are N(i) observations in the i^th mode. The underlying tensor train has
% latent dimension D, with D(1)=D(end)=1.
% INPUT:
% N vector with observations in each mode
% D vector specifying the size of the latent dimension,
% D(1)=D(end)=1 and length(D) = length(N)+1
%
% OUTPUT:
% X A tensor with size N generated by the tensor train
% G A cell array with the tensor train carts size(G{i}) =
% [D(i),N(i),D(i+1)]. Note G{end} = S*V'.
% S A diagonal matrix (D(end-1) x D(end-1)) with the scale of each
% of the D(end-1) components.
% V An orthogonal matrix (N(end) x D(end-1)) for the last train cart
%
%

G=cell(length(N),1);
for d = 1:length(N)-1
G{d} = randn(D(d),N(d),D(d+1));
Expand Down

0 comments on commit d588736

Please sign in to comment.