Github user srowen commented on the pull request: https://github.com/apache/spark/pull/12299#issuecomment-208873482 So if the input is vector A, then instead of computing A'A we're computing, for some mean vector M, (A-M)'(A-M) = A'A - A'M - M'A + M'M. A'A remains efficient to calculate and M'M can be precomputed by the caller and passed in. A'M and M'A are transposes and can be computed once, and that can be done somewhat efficiently since A is sparse. It's more complex for sure; I wasn't sure whether for the sizes we're contemplating, whether just pushing one dense vector to BLAS would still be faster.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org