Difference between revisions of "Ttclass/sum.m"

From Spinach Documentation Wiki
Jump to: navigation, search
(Normalise sequential blank lines)
m (Spot-update function page against current Spinach source)
Line 3: Line 3:
 
     answer=sum(ttrain,dim)
 
     answer=sum(ttrain,dim)
  
−
The sum is taken along the specified dimension (dim=1 or dim=2).
+
The sum is taken along the specified dimension (dim=1 or dim=2). If dim is omitted, the first non-singleton dimension is used, matching Matlab behaviour.
  
 
==See also==
 
==See also==
 
[[ttclass.m]], [[ttclass/mean.m]], [[ttclass/trace.m]], [[Tensor_train_module#Tensor_train_functions|Tensor train functions]]
 
[[ttclass.m]], [[ttclass/mean.m]], [[ttclass/trace.m]], [[Tensor_train_module#Tensor_train_functions|Tensor train functions]]

Revision as of 15:08, 5 June 2026

Sum of elements of a tensor train representation of a matrix. Syntax:

    answer=sum(ttrain,dim)

The sum is taken along the specified dimension (dim=1 or dim=2). If dim is omitted, the first non-singleton dimension is used, matching Matlab behaviour.

See also

ttclass.m, ttclass/mean.m, ttclass/trace.m, Tensor train functions