oseledets / TT-Toolbox

The git repository for the TT-Toolbox
Other
193 stars 73 forks source link

Update sum() to include options that compute sums of entries along a … #52

Closed distone closed 4 years ago

distone commented 4 years ago

…specific dimension, or sums of entries in specified sub-tensor.

There are three possible ways of calling the function sum():

[V] = SUM(TT) [V] = SUM(TT, dim) [V] = SUM(TT, chunk_start, chunk_end) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% [V] = SUM(TT) Computes the sum of all entries of a TT-tensor

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% [V] = SUM(TT, dim) dim: integer, 1 <= dim <= tt.d Computes the sums of entries along the dimension indicated by "dim", similar to Matlab built-in function SUM(tensor, dim); return a TT tensor of order (tt.d-1).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% [V] = SUM(TT, chunk_start,chunk_end)

chunk_start: integer, 1 <= chunk_start <= tt.d chunk_end: integer, chunk_start <= chunk_end <= tt.d

Computes the sums of entries of the sub-tensors indicated by chunk_start and chunk_end. The sub-tensor taken is the same as in chunk(tt, chunk_start,chunk_end). return a TT tensor of order (tt.d- (chunk_end -chunk_start +1) ).