Skip to content

Commit 62d38c4

Browse files
author
DB Tsai
committed
formating
1 parent 0316cef commit 62d38c4

File tree

1 file changed

+13
-13
lines changed
  • mllib/src/main/scala/org/apache/spark/mllib/linalg

1 file changed

+13
-13
lines changed

mllib/src/main/scala/org/apache/spark/mllib/linalg/BLAS.scala

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ private[spark] object BLAS extends Serializable with Logging {
376376
}
377377
} else {
378378
// Scale matrix first if `beta` is not equal to 0.0
379-
if (beta != 0.0){
379+
if (beta != 0.0) {
380380
f2jBLAS.dscal(C.values.length, beta, C.values, 1)
381381
}
382382
// Perform matrix multiplication and add to C. The rows of A are multiplied by the columns of
@@ -391,7 +391,7 @@ private[spark] object BLAS extends Serializable with Logging {
391391
var i = Acols(colCounterForA)
392392
val indEnd = Acols(colCounterForA + 1)
393393
val Bval = Bvals(Bstart + colCounterForA) * alpha
394-
while (i < indEnd){
394+
while (i < indEnd) {
395395
Cvals(Cstart + Arows(i)) += Avals(i) * Bval
396396
i += 1
397397
}
@@ -403,11 +403,11 @@ private[spark] object BLAS extends Serializable with Logging {
403403
while (colCounterForB < nB) {
404404
var colCounterForA = 0 // The column of A to multiply with the row of B
405405
val Cstart = colCounterForB * mA
406-
while (colCounterForA < kA){
406+
while (colCounterForA < kA) {
407407
var i = Acols(colCounterForA)
408408
val indEnd = Acols(colCounterForA + 1)
409409
val Bval = B(colCounterForB, colCounterForA) * alpha
410-
while (i < indEnd){
410+
while (i < indEnd) {
411411
Cvals(Cstart + Arows(i)) += Avals(i) * Bval
412412
i += 1
413413
}
@@ -506,38 +506,38 @@ private[spark] object BLAS extends Serializable with Logging {
506506
val xValues = x.values
507507
val yValues = y.values
508508

509-
val mA: Int = if(!trans) A.numRows else A.numCols
510-
val nA: Int = if(!trans) A.numCols else A.numRows
509+
val mA: Int = if (!trans) A.numRows else A.numCols
510+
val nA: Int = if (!trans) A.numCols else A.numRows
511511

512512
val Avals = A.values
513513
val Arows = if (!trans) A.rowIndices else A.colPtrs
514514
val Acols = if (!trans) A.colPtrs else A.rowIndices
515515
// Slicing is easy in this case. This is the optimal multiplication setting for sparse matrices
516-
if (trans){
516+
if (trans) {
517517
var rowCounter = 0
518-
while (rowCounter < mA){
518+
while (rowCounter < mA) {
519519
var i = Arows(rowCounter)
520520
val indEnd = Arows(rowCounter + 1)
521521
var sum = 0.0
522-
while(i < indEnd){
522+
while (i < indEnd) {
523523
sum += Avals(i) * xValues(Acols(i))
524524
i += 1
525525
}
526-
yValues(rowCounter) = beta * yValues(rowCounter) + sum * alpha
526+
yValues(rowCounter) = beta * yValues(rowCounter) + sum * alpha
527527
rowCounter += 1
528528
}
529529
} else {
530530
// Scale vector first if `beta` is not equal to 0.0
531-
if (beta != 0.0){
531+
if (beta != 0.0) {
532532
scal(beta, y)
533533
}
534534
// Perform matrix-vector multiplication and add to y
535535
var colCounterForA = 0
536-
while (colCounterForA < nA){
536+
while (colCounterForA < nA) {
537537
var i = Acols(colCounterForA)
538538
val indEnd = Acols(colCounterForA + 1)
539539
val xVal = xValues(colCounterForA) * alpha
540-
while (i < indEnd){
540+
while (i < indEnd) {
541541
val rowIndex = Arows(i)
542542
yValues(rowIndex) += Avals(i) * xVal
543543
i += 1

0 commit comments

Comments
 (0)