-><p>The function <tt>cp_als</tt> computes an estimate of the best rank-R CP model of a tensor X using the well-known alternating least-squares algorithm (see, e.g., Kolda and Bader, SIAM Review, 2009, for more information).  The input X can be almost any type of tensor inclusing a <tt>tensor</tt>, <tt>sptensor</tt>, <tt>ktensor</tt>, or <tt>ttensor</tt>. The output CP model is a <tt>ktensor</tt>.</p><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#1">Load some data</a></li><li><a href="#2">Basic