scalanlp / breeze

Breeze is/was a numerical processing library for Scala.
https://www.scalanlp.org
Apache License 2.0
3.45k stars 693 forks source link

fix issue #731 #732

Closed BoleynSu closed 5 years ago

BoleynSu commented 5 years ago

fix issue #731

dlwh commented 5 years ago

could you add a test case please

BoleynSu commented 5 years ago

@dlwh sure, I will add a test file later.

dlwh commented 5 years ago

ideally we'd benchmark it, but i think that's a good idea.

Thanks, David

On Thu, Nov 29, 2018 at 10:18 PM Boleyn Su notifications@github.com wrote:

@BoleynSu commented on this pull request.

In math/src/main/java/breeze/linalg/operators/DenseVectorSupportMethods.java https://github.com/scalanlp/breeze/pull/732#discussion_r237756740:

  * @param a
  • @param b
  • @param length
  • @return */ public static double smallDotProduct_Double(double[] a, double[] b, int length) {
  • double sumA = 0.0;
  • double sumB = 0.0;
  • double sum = 0.0;

I removed sumA and sumB to make smallDotProduct for both double and float the same. If I revert this, should I use the same optimization for float?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/scalanlp/breeze/pull/732#discussion_r237756740, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAlocF5A20AVA_zD62s4tSN_kry9DcLks5u0M3HgaJpZM4YWPP9 .

BoleynSu commented 5 years ago

@dlwh I have added tests and reverted sum back to sumA and sumB.

dlwh commented 5 years ago

Thanks!