ntroduction--><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#1">Alternating least squares for PARAFAC/CANDECOMP</a></li><li><a href="#6">Alternating least squares for Tucker model</a></li></ul></div><h2>Alternating least squares for PARAFAC/CANDECOMP<a name="1"></a></h2><p>The function <tt>parafac_als</tt> computes an estimate of the best rank-R PARAFAC model of a tensor X using an alternating least-squares algorithm.  The input X can be a tensor, sptensor, ktensor, or ttensor. The result P is 