Github user MechCoder commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4459#discussion_r24439928
  
    --- Diff: mllib/src/main/scala/org/apache/spark/mllib/linalg/BLAS.scala ---
    @@ -235,12 +235,23 @@ private[spark] object BLAS extends Serializable with 
Logging {
        * @param x the vector x that contains the n elements.
        * @param A the symmetric matrix A. Size of n x n.
        */
    -  def syr(alpha: Double, x: DenseVector, A: DenseMatrix) {
    +
    +  // Wrapper around the dense and sparse methods.
    +  def syr(alpha: Double, x: Vector, A: DenseMatrix) {
         val mA = A.numRows
         val nA = A.numCols
    -    require(mA == nA, s"A is not a symmetric matrix. A: $mA x $nA")
    +    require(mA == nA, s"A is not a square matrix (and hence is not 
symmetric). A: $mA x $nA")
         require(mA == x.size, s"The size of x doesn't match the rank of A. A: 
$mA x $nA, x: ${x.size}")
     
    +    x match {
    +      case dv: DenseVector => syr(alpha, dv, A, mA, nA)
    +      case sv: SparseVector => syr(alpha, sv, A, nA)
    +      case _ =>
    +        throw new IllegalArgumentException(s"syr doesn't support vector 
type ${x.getClass}.")
    +    }
    +  }
    +
    +  private def syr(alpha: Double, x: DenseVector, A: DenseMatrix, mA: Int, 
nA: Int) {
    --- End diff --
    
    Do you mean to extract the `mA` , internally in both methods?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to