simple-vec3: Three-dimensional vectors of doubles with basic operations

[ bsd3, library, math, numerical ] [ Propose Tags ] [ Report a vulnerability ]

Simple three-dimensional vectors of doubles with basic vector and matrix operations, supporting Data.Vector.Unboxed and Data.Vector.Storable.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.0.1, 0.2, 0.3, 0.3.1, 0.4, 0.4.0.1, 0.4.0.2, 0.4.0.3, 0.4.0.4, 0.4.0.5, 0.4.0.6, 0.4.0.7, 0.4.0.8, 0.4.0.9, 0.4.0.10, 0.5, 0.6, 0.6.0.1
Change log CHANGELOG.md
Dependencies base (<5), QuickCheck, vector [details]
License BSD-3-Clause
Author Dmitry Dzhus
Maintainer dima@dzhus.org
Category Math, Numerical
Home page https://github.com/dzhus/simple-vec3#readme
Bug tracker https://github.com/dzhus/simple-vec3/issues
Source repo head: git clone https://github.com/dzhus/simple-vec3
Uploaded by DmitryDzhus at 2020-06-04T10:51:24Z
Distributions LTSHaskell:0.6.0.1, NixOS:0.6.0.1, Stackage:0.6.0.1
Reverse Dependencies 2 direct, 0 indirect [details]
Downloads 9747 total (72 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2020-06-04 [all 1 reports]

Readme for simple-vec3-0.6.0.1

[back to package description]

simple-vec3

Build & test Hackage Hackage deps

Simple three-dimensional vectors of doubles with basic vector and matrix operations, supporting Data.Vector.Unboxed and Data.Vector.Storable.

>>> let v1 = (-1, 0.0,  0.2) :: TVec3
>>> let v2 = ( 1, 2.3,  5.0) :: TVec3
>>> let v3 = ( 1,   1, -0.2) :: TVec3

-- Add two vectors:
>>> v1 <+> v2
(0.0, 2.3, 5.2)

-- Dot product:
>>> v1 .* v2
0.0

-- Multiply by a scalar:
>>> v1 .^ 5
(-5.0, 0.0, 1.0)

-- Cross product:
>>> v1 >< v3
(-0.2, 0.0, -1.0)

-- Matrix-vector product:
>>> diag 2 `mxv` v2
(2.0, 4.6, 10.0)

Please consult the Hackage page for simple-vec3 for full documentation.

The package provides two different implementations for Vec3 type class, which differ in storage scheme. Benchmarks are included for both. You most likely want to use CVec3 which is based on contiguous storage scheme and offers the best performance.

simple-vec3 benchmarks

Alternatives

This package was written to explore and benchmark different array storage schemes in Haskell, as supported by vector library. Several alternatives with more extensive APIs exist: