All Downloads are FREE. Search and download functionalities are using the official Maven repository.

breeze.signal.support.package.scala Maven / Gradle / Ivy

There is a newer version: 1.0
Show newest version
package breeze.signal

import breeze.numerics.{log, ceil, pow}

/**
 * @author ktakagaki
 * @date 2/3/14.
 */
package object support {

  /** Gives the next largest power of base. nextPower(x, 2) is equivalent to MATLAB nextPow2(x).
    */
  def nextPower(x: Double, base: Int): Double = pow( 2d, ceil( log(x) / log(base.toDouble) ))

  def nextPower2(x: Double): Double = nextPower(x, 2)

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy