uqbar-math Build Status

This library extends Scala in order to provide better abstractions to support complex algebraic expressions.

Setup

To include this library in your SBT project, just add the following line to your build.sbt file:

libraryDependencies += "org.uqbar" %% "uqbar-math" % "latest.integration"

Features

###Vector

Vectors are basic 2D structures which can be used to represent positions, translations or forces.

Two Vector implementations are provided:

  • Vector: Exposes all basic operations.
  • MutableVector: Extends Vector with mutable operations.

Note that Vector does NOT guarantee to be immutable, just doesn't expose the messages to be mutated. This is so to provide a more flexible approach, and allow mutable vector owners to expose them in a secure way. You can find out more about it here.

Implicit conversions to ease code writing are defined in org.uqbar.math.versors package.

import org.uqbar.math.vector._

val here: Vector = (1,5)                        // Vector converted from tuple
val there = here + (2.5,10)                     // Also a vector
val distance = here manhattanDistanceTo there

Contributions

Yes, please! Pull requests are always welcome, just try to keep it small and clean.

Version History

1.1

  • Added bidirectional AWT Point and Tuple implicit conversions.
  • Added Vector.random().
  • SBT refactor.
  • Fixed some vector bugs.

License

This code is open source software licensed under the LGPL v3 License by The Uqbar Foundation. Feel free to use it accordingly.