scala-breeze

How to zip two DenseVectors in Scala Breeze?


I'd like to zip two DenseVectors and perform an operation on each pair, and obtain a new vector as result. What is the best way to achieve this using scala-breeze?

I can work around it by using their data field, but I'd need to construct a new DenseVector from the resulting array.


Solution

  • I should probably just make a method on DenseVector, but

    breeze.linalg.zipValues(dv1, dv2){(v1, v2) => ??? }
    

    should do it.