Skip to content

Commit cec797b

Browse files
committed
remove unnecessary qr
1 parent 0fb1012 commit cec797b

File tree

1 file changed

+5
-6
lines changed
  • mllib/src/main/scala/org/apache/spark/mllib/linalg/distributed

1 file changed

+5
-6
lines changed

mllib/src/main/scala/org/apache/spark/mllib/linalg/distributed/RowMatrix.scala

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ class RowMatrix(
504504
* Paul G. Constantine, David F. Gleich. "Tall and skinny QR factorizations in MapReduce
505505
* architectures" ([[http://dx.doi.org/10.1145/1996092.1996103]])
506506
*
507-
* @param computeQ: whether to computeQ
507+
* @param computeQ whether to computeQ
508508
* @return QRDecomposition(Q, R), Q = null if computeQ = false.
509509
*/
510510
def tallSkinnyQR(computeQ: Boolean = false): QRDecomposition[RowMatrix, Matrix] = {
@@ -522,14 +522,13 @@ class RowMatrix(
522522

523523
// combine the R part from previous results vertically into a tall matrix
524524
val combinedR = blockQRs.treeReduce{ (r1, r2) =>
525-
val partialR = BDM.vertcat(r1, r2)
526-
breeze.linalg.qr.reduced(partialR).r
525+
val stackedR = BDM.vertcat(r1, r2)
526+
breeze.linalg.qr.reduced(stackedR).r
527527
}
528-
val breezeR = breeze.linalg.qr.reduced(combinedR).r.toDenseMatrix
529-
val finalR = Matrices.fromBreeze(breezeR)
528+
val finalR = Matrices.fromBreeze(combinedR.toDenseMatrix)
530529
val finalQ = if (computeQ) {
531530
try {
532-
val invR = inv(breezeR)
531+
val invR = inv(combinedR)
533532
this.multiply(Matrices.fromBreeze(invR))
534533
} catch {
535534
case err: MatrixSingularException =>

0 commit comments

Comments
 (0)