basis.math

FN

trait FN extends VectorSpace

An abstract N-dimensional vector space over a ring. Vector addition associates and commutes, and scalar multiplication associates, commutes, and distributes over vector addition and scalar addition. Vector addition and scalar multiplication both have an identity element, and every vector has an additive inverse. Every vector space is an affine space over itself. To the extent practicable, the following axioms should hold.

Axioms for vector addition:

Axioms for scalar multiplication:

Distributive laws:

Self Type
FN
Source
FN.scala
Example:
  1. // You can abstract over vector spaces by parameterizing a class or
    // function with a subtype of FN with Singleton. Type elements with
    // the #Vector and #Scalar type projections of your FN type parameter.
    def testVectorSpaceOperations[V <: FN[S] with Singleton, S <: Ring with Singleton]
        (a: V#Scalar, b: V#Scalar, u: V#Vector, v: V#Vector, w: V#Vector): Unit = {
      assert(u + v == v + u, "commutativity of vector addition")
      assert((u + v) + w == u + (v + w), "associativity of vector addition")
      assert((a * b) *: v == a *: (b *: v), "associativity of scalar multiplication with ring multiplication")
      assert(a *: (u + v) == (a *: u) + (a *: v), "distributivity of scalar multiplication over vector addition")
      assert((a + b) *: v == (a *: v) + (b *: v), "distributivity of scalar multiplication over ring addition")
    }
    
    // Alternatively, functions can use path-dependent types of a FN parameter.
    def testVectorSpaceIdentities(V: FN[_])(a: V.Scalar, v: V.Vector): Unit = {
      import V._
      assert(zero + v == v, "existence of additive identity vector")
      assert(v + (-v) == zero, "existence of additive inverse vector")
      assert(Scalar.unit *: v == v, "existence of multiplicative identity scalar")
    }
Version

0.1

Since

0.0

Linear Supertypes
VectorSpace, AnyRef, Any
Known Subclasses
F2, F3, F4, Integer, R2, R3, R4, RI2, RI3, RIN, RN, Real, Z2, Z3, ZI2, ZI3, ZIN, ZN
Type Hierarchy Learn more about scaladoc diagrams
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. FN
  2. VectorSpace
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. type Scalar = Element

    The type of scalars in this vector space.

    The type of scalars in this vector space.

    Definition Classes
    VectorSpace
  2. abstract type Vector <: VectorFN

    The type of vectors in this vector space.

    The type of vectors in this vector space.

    Definition Classes
    FNVectorSpace
  3. trait VectorElement extends Any

    A vector in this vector space.

    A vector in this vector space.

    Definition Classes
    VectorSpace
  4. trait VectorFN extends VectorElement

Abstract Value Members

  1. abstract val Scalar: Ring

    Returns the scalar set of this vector space.

    Returns the scalar set of this vector space.

    Definition Classes
    VectorSpace
  2. implicit abstract def ScalarTag: ClassTag[Scalar]

  3. abstract def apply(coords: Array[Scalar]): Vector

    Returns a new vector with the given coordinates.

  4. abstract def dim: Int

    Returns the dimension of this vector space.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  5. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  10. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  11. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  13. final def notify(): Unit

    Definition Classes
    AnyRef
  14. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  15. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  16. def toString(): String

    Definition Classes
    AnyRef → Any
  17. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. def zero: Vector

    Returns the additive identity of this vector space.

    Returns the additive identity of this vector space.

    Definition Classes
    FNVectorSpace

Inherited from VectorSpace

Inherited from AnyRef

Inherited from Any

Ungrouped