Search code examples
scalascala-breeze

Breeze Linalg - efficiently map all existing values to constant


I have a breeze.linalg.SparseVector. And I want to create a new SparseVector as an output where all values are 1 (or some other constant).

How can I do it?


Solution

  • breeze SparseVector can only default to 0, sorry. It's a TODO I've had open for a long time, but it's unlikely to be any time soon.