Reputation: 645
I am doing some Machine Learning code in Scala. I want to vectorize the operations like vector dot product, vector - scalar multiplication, vector vector addition. For example,
val x = u . v
val x = 2 * v
Basically I have experince in Matlab and would love to have similar operators on vectors. Which is the way to proceed? Thanks
Upvotes: 4
Views: 243
Reputation: 4614
You may want to have a look at the VectorSpace
trait, provided by Spire.
Since it supports generic numeric programming, you can easily switch between different vector types. See this example of a k-means clustering algorithm.
Upvotes: 4