File tree Expand file tree Collapse file tree 1 file changed +5
-14
lines changed
mllib/src/main/scala/org/apache/spark/mllib/linalg/distributed Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Original file line number Diff line number Diff line change @@ -202,32 +202,23 @@ class RowMatrix(
202
202
}
203
203
204
204
/**
205
- * Multiply the Gramian matrix `A^T A` by a DenseVector on the right.
205
+ * Multiplies the Gramian matrix `A^T A` by a dense vector on the right without computing `A^T A` .
206
206
*
207
- * @param v a local DenseVector whose length must match the number of columns of this matrix.
208
- * @return a local DenseVector representing the product.
207
+ @param v a dense vector whose length must match the number of columns of this matrix
208
+ * @return a dense vector representing the product
209
209
*/
210
210
private [mllib] def multiplyGramianMatrixBy (v : BDV [Double ]): BDV [Double ] = {
211
211
val n = numCols().toInt
212
212
val vbr = rows.context.broadcast(v)
213
-
214
- val bv = rows.aggregate(BDV .zeros[Double ](n))(
213
+ rows.aggregate(BDV .zeros[Double ](n))(
215
214
seqOp = (U , r) => {
216
215
val rBrz = r.toBreeze
217
216
val a = rBrz.dot(vbr.value)
218
- rBrz match {
219
- case _ : BDV [_] => brzAxpy(a, rBrz.asInstanceOf [BDV [Double ]], U )
220
- case _ : BSV [_] => brzAxpy(a, rBrz.asInstanceOf [BSV [Double ]], U )
221
- case _ =>
222
- throw new UnsupportedOperationException (
223
- s " Do not support vector operation from type ${rBrz.getClass.getName}. " )
224
- }
217
+ brzAxpy(a, rBrz, U .asInstanceOf [BV [Double ]])
225
218
U
226
219
},
227
220
combOp = (U1 , U2 ) => U1 += U2
228
221
)
229
-
230
- bv
231
222
}
232
223
233
224
/**
You can’t perform that action at this time.
0 commit comments