Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to zip two DenseVectors in Scala Breeze?

Tags:

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.

like image 655
Iulian Dragos Avatar asked Oct 20 '22 22:10

Iulian Dragos


1 Answers

I should probably just make a method on DenseVector, but

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

should do it.

like image 176
dlwh Avatar answered Jan 04 '23 05:01

dlwh