| |||||

| |||||

Description | |||||

Vec : a library for fixed-length lists and low-dimensional linear algebra Scott E. Dillard sedillard@gmail.com darcs : http://graphics.cs.ucdavis.edu/~sdillard/Vec
Vectors are represented by lists with type-encoded lengths. The constructor is
- Simplicity : Beyond the initial complexities of type-level lists and numbers, I've tried to keep the API simple. There is no vector-space class, nor a complicated hierarchy of linear/affine/projective transformations. These can be added on top of the library easily.
- Purity : The library is written in the functional style. For most functions this does not hinder performance at all, but some I am still working on (Gaussian elimination) so if this library is a bottleneck you can easily drop down to C.
- Low Dimension : Although the dimensionality is limited only by what GHC will handle, the library is meant for 2,3 and 4 dimensions. For general linear algebra, check out the excellent hmatrix library and blas bindings.
To the point of simplicity, vectors and matrices are instances of Num and
Fractional. All arithmetic is done component-wise and literals construct
uniform vectors and matrices. There are many interesting projects aiming to
overhaul Haskell's number classes, but for now the type of The rule is simple : If the method is unary, it's a map. If it's binary, it's a zipWith.
and pack convert between packed and
unpacked types. When vector operations are bracketed by unpackpack and unpack,
GHC can unfold them into very efficient code. The Storable instances for
vectors also generate fast code. Without optimizations, the code falls back
into linked-list mode. The optimizations depend on inlining, so you may need
to increase your unfolding threshold in certain situations.
This library makes heavy use of functional dependencies. I have tried to tweak things so that they "just work." However, every now and then you will get incomprehensible error messages, usually about how this isn't an instance of that. These are how type errors typically manifest, so first double check to make sure you aren't trying to mix vectors of different dimension or component types. If you still get these errors, manual type annotations usually make them go away.
See previous work by David Menendez, http://haskell.org/pipermail/haskell/2005-May/015815.html and of course Oleg Kiselyov, http://okmij.org/ftp/papers/number-parameterized-types.pdf Other vector and linear algebra packages : vector-space, by Conal Elliott : http://hackage.haskell.org/package/vector-space hmatrix, by Alberto Ruiz : http://hackage.haskell.org/package/hmatrix blas bindings, by Patrick Perry : http://hackage.haskell.org/package/blas templatized geometry library (C++), by Oliver Kreylos : http://graphics.cs.ucdavis.edu/~okreylos/ResDev/Geometry/index.html | |||||

Documentation | |||||

module Data.Vec.Base | |||||

module Data.Vec.LinAlg | |||||

module Data.Vec.Packed | |||||

module Data.Vec.Nat | |||||

Produced by Haddock version 2.3.0 |