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

breeze.numerics.Conversions.scala Maven / Gradle / Ivy

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

import breeze.generic.{MappingUFunc, UFunc}

/**Package for common unit conversions.
 * @author ktakagaki
 * @date 1/31/14.
 */
object Conversions {

  // 

  /** Converts Fahrenheit temperature to Celsius
    * @see http://en.wikipedia.org/wiki/Fahrenheit
    */
  object fahrenheitToCelsius extends UFunc with MappingUFunc {
    implicit object fahrenheitToCelsiusDImpl extends Impl[Double, Double] { def apply(f: Double) = (f - 32d) * 5d/9d }
    implicit object fahrenheitToCelsiusFImpl extends Impl[Float, Float] { def apply(f: Float) = (f - 32f) * 5f/9f }
  }

  /** Converts Celsius temperature to Fahrenheit
    * @see http://en.wikipedia.org/wiki/Fahrenheit
    */
  object celsiusToFahrenheit extends UFunc with MappingUFunc {
    implicit object celsiusToFahrenheitDImpl extends Impl[Double, Double] { def apply(c: Double) = c /5d * 9d + 32d }
    implicit object celsiusToFahrenheitFImpl extends Impl[Float, Float] { def apply(c: Float) = c / 5f * 9f + 32f }
  }

  // 

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy