title: Scala vector scalar multiplication
body: <p>I'm implementing some machine learning algorithm in Apache Spark MLlib and I would like to multiply vector with scalar:</p>
  
  <p><a href="https://i.stack.imgur.com/zoayi.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zoayi.gif" alt="enter image description here"></a></p>
  
  <p>Where u_i_j_m is a Double and x_i is a vector</p>
  
  <p>I've tried the following:</p>
  
  <pre><code>import breeze.linalg.{ DenseVector =&gt; BDV, Vector =&gt; BV}
  import org.apache.spark.mllib.linalg.{DenseVector, Vectors, Vector}
  ...
  
  private def runAlgorithm(data: RDD[VectorWithNorm]): = {
      ...
      data.mapPartitions { data_ponts =&gt;
          c = Array.fill(clustersNum)(BDV.zeros[Double](dim).asInstanceOf[BV[Double]])
          ...
          data_ponts.foreach { data_point =&gt;
              ...
              u_i_j_m : Double = ....
              val temp= data_point.vector * u_i_j_m)
              // c(j) = temp
          }
      }
  }
  </code></pre>
  
  <p>Where VectorWithNorm is defined as following:</p>
  
  <pre><code>class VectorWithNorm(val vector: Vector, val norm: Double) extends Serializable {
  
      def this(vector: Vector) = this(vector, Vectors.norm(vector, 2.0))
      def this(array: Array[Double]) = this(Vectors.dense(array))
      def toDense: VectorWithNorm = new  VectorWithNorm(Vectors.dense(vector.toArray), norm)
  }
  </code></pre>
  
  <p>But when I build the project I get the following error:</p>
  
  <blockquote>
    <p>Error: value * is not a member of org.apache.spark.mllib.linalg.Vector
                  val temp = (data_point.vector * u_i_j_m)</p>
  </blockquote>
  
  <p>How can I do this multiplication correctly?                           </p>