Search code examples
scalascala-breeze

Is there a mechanism in Scala Breeze where I can add to DenseVectors without having to code it myself?


For example, if I have two dense vectors:

val a = DenseVector(1.0, 2.0) -and- val b = DenseVector(3.0, 4.0)

and I wish to add them, is there something like a add function I can pass them two within the breeze library that would make my life easier by adding them for me...or am I going to have to code an addition operation out myself ?

Thanks in advance !!!


Solution

  • The + operator works on DenseVectors. See https://github.com/scalanlp/breeze/wiki/Linear-Algebra-Cheat-Sheet for many of the operations supported on DenseVectors.