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

algebra.CommutativeGroup.scala Maven / Gradle / Ivy

There is a newer version: 0.4.2
Show newest version
package algebra

import scala.{ specialized => sp }

/**
 * An abelian group is a group whose operation is commutative.
 */
trait CommutativeGroup[@sp(Int, Long, Float, Double) A] extends Any with Group[A] with CommutativeMonoid[A]

object CommutativeGroup extends GroupFunctions {

  /**
   * Access an implicit `CommutativeGroup[A]`.
   */
  @inline final def apply[A](implicit ev: CommutativeGroup[A]): CommutativeGroup[A] = ev

  /**
   * This method converts an additive instance into a generic
   * instance.
   * 
   * Given an implicit `AdditiveCommutativeGroup[A]`, this method
   * returns a `CommutativeGroup[A]`.
   */
  @inline final def additive[A](implicit ev: ring.AdditiveCommutativeGroup[A]): CommutativeGroup[A] =
    ev.additive

  /**
   * This method converts a multiplicative instance into a generic
   * instance.
   * 
   * Given an implicit `MultiplicativeCommutativeGroup[A]`, this
   * method returns a `CommutativeGroup[A]`.
   */
  @inline final def multiplicative[A](implicit ev: ring.MultiplicativeCommutativeGroup[A]): CommutativeGroup[A] =
    ev.multiplicative
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy