scalanlp / breeze

Breeze is a numerical processing library for Scala.
www.scalanlp.org
Apache License 2.0
3.44k stars 691 forks source link

cosineDistance w/ Float #818

Closed eggie5 closed 3 years ago

eggie5 commented 3 years ago

cosineDistance doesn't seem to work on DenseVector[Float]. If I change to Double it works.

  val v1 = DenseVector(1.0f, 2.0f)
  val v2 = DenseVector(3.0f, 4.0f)
  println(cosineDistance(v1, v2))
diverging implicit expansion for type breeze.generic.UFunc.UImpl2[breeze.linalg.functions.cosineDistance.type,breeze.linalg.Vector[Float],breeze.linalg.Vector[Float],VR]
starting with method collapseUred in object UFunc
  println(cosineDistance(v1, v2))

Is this expected?

dlwh commented 3 years ago

this is the kind of thing that should work. I'll try to fix it for the next 2.0 RC

On Mon, Aug 16, 2021 at 11:25 AM Alex Egg @.***> wrote:

cosineDistance doesn't seem to work on DenseVector[Float]. If I change to Double it works.

val v1 = DenseVector(1.0f, 2.0f) val v2 = DenseVector(3.0f, 4.0f) println(cosineDistance(v1, v2))

diverging implicit expansion for type breeze.generic.UFunc.UImpl2[breeze.linalg.functions.cosineDistance.type,breeze.linalg.Vector[Float],breeze.linalg.Vector[Float],VR] starting with method collapseUred in object UFunc println(cosineDistance(v1, v2))

Is this expected?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/scalanlp/breeze/issues/818, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAACLINF4UKLKDW33TQ6UMTT5FJYDANCNFSM5CIIFXJQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

dlwh commented 3 years ago

fixed in 5828a7c584887bada9dc4a809b085059ec4b06b8