{{ message }}
Repository navigation
InnerProductSpace working example #1308
Answered
by
armanbilge
MohammadForouhesh
asked this question in
Q&A
Replies: 1 comment 1 reply
|
Are you familiar with implicits/givens/typeclasses? Are you using Scala 2 or Scala 3? You want to define an instance of Here's an example for Scala 3. object Person {
given InnerProductSpace[Person, Int] with {
def dot(x: Person, y: Person): Int = ...
}
}Then to get the dot syntax you would do something like |
1 reply
Answer selected by
MohammadForouhesh
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Are you familiar with implicits/givens/typeclasses? Are you using Scala 2 or Scala 3? You want to define an instance of
InnerProductSpaceand place inside the companionobject Person.Here's an example for Scala 3.
Then to get the dot syntax you would do something like
import spire.syntax.all._