title: simple matrix multiplication in Spark
body: <p>I am struggling with some very basic spark code.  I would like to define a matrix <code>x</code> with 2 columns. This is what I have tried:</p>
  
  <pre><code>scala&gt; val s = breeze.linalg.linspace(-3,3,5)
  s: breeze.linalg.DenseVector[Double] = DenseVector(-3.0, -1.5, 0.0, 1.5, 3.0) // in this case I want s to be both column 1 and column 2 of x
  
  scala&gt; val ss = s.toArray ++ s.toArray
  ss: Array[Double] = Array(-3.0, -1.5, 0.0, 1.5, 3.0, -3.0, -1.5, 0.0, 1.5, 3.0)
  
  scala&gt; import org.apache.spark.mllib.linalg.distributed.RowMatrix
  import org.apache.spark.mllib.linalg.distributed.RowMatrix
  
  scala&gt; val mat = new RowMatrix(ss, 5, 2)
  &lt;console&gt;:17: error: type mismatch;
   found   : Array[Double]
   required: org.apache.spark.rdd.RDD[org.apache.spark.mllib.linalg.Vector]
         val mat = new RowMatrix(ss, 5, 2)
  </code></pre>
  
  <p>I do not understand how I can get the right transformation in order to pass the values to the distributed matrix                   ^</p>
  
  <p>EDIT:
  Maybe I have been able to solve:</p>
  
  <pre><code>scala&gt; val s = breeze.linalg.linspace(-3,3,5)
  s: breeze.linalg.DenseVector[Double] = DenseVector(-3.0, -1.5, 0.0, 1.5, 3.0)
  
  scala&gt; val ss = s.to
  toArray         toDenseMatrix   toDenseVector   toScalaVector   toString        
  toVector        
  
  scala&gt; val ss = s.toArray ++ s.toArray
  ss: Array[Double] = Array(-3.0, -1.5, 0.0, 1.5, 3.0, -3.0, -1.5, 0.0, 1.5, 3.0)
  
  scala&gt; val x = new breeze.linalg.Dense
  DenseMatrix   DenseVector   
  
  scala&gt; val x = new breeze.linalg.DenseMatrix(5, 2, ss)
  x: breeze.linalg.DenseMatrix[Double] = 
  -3.0  -3.0  
  -1.5  -1.5  
  0.0   0.0   
  1.5   1.5   
  3.0   3.0   
  
  scala&gt; val xDist = sc.parallelize(x.toArray)
  xDist: org.apache.spark.rdd.RDD[Double] = ParallelCollectionRDD[0] at parallelize at &lt;console&gt;:18
  </code></pre>