scalanlp / breeze

Breeze is a numerical processing library for Scala.
www.scalanlp.org
Apache License 2.0
3.44k stars 691 forks source link

Feature request: Add `digitize`, `geomspace`, `logspace` functions from numpy. #836

Open Swoorup opened 2 years ago

Swoorup commented 2 years ago

Add:

========================= I only could find linspace in this library. The above would be great to have, working with data binning and histograms.

dlwh commented 2 years ago

digitize is in breeze.stats fwiw:

      val x = DenseVector[Double](-0.5, 0.5, 1.5, 2, 0, 2.5)
      val bins = DenseVector[Double](0.0, 1.0, 2.0)
      val result = digitize(x, bins)
      val desiredResult = DenseVector[Int](0, 1, 2, 2, 0, 3)
      assert(result == desiredResult)