simple-vec3

Three-dimensional vectors of doubles with basic operations

https://github.com/dzhus/simple-vec3#readme

Version on this page:0.4.0.10
LTS Haskell 22.43:0.6.0.1
Stackage Nightly 2024-12-04:0.6.0.1
Latest on Hackage:0.6.0.1

See all snapshots simple-vec3 appears in

BSD-3-Clause licensed by Dmitry Dzhus
Maintained by [email protected]
This version can be pinned in stack with:simple-vec3-0.4.0.10@sha256:383b5b9e8acd1c9314b95893471d40050cedf5f6e7c1b15d558fb26dce3962fe,1983

Module documentation for 0.4.0.10

simple-vec3

Travis CI build status 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:

Changes

Changelog

0.4.0.10 - 2018-01-18

Changed

  • Test suite dependencies bump

0.4.0.9 - 2018-10-29

Changed

  • GHC 8.6.x support

0.4.0.8 - 2018-07-21

Changed

  • Benchmark dependencies bump

0.4.0.7 - 2018-06-30

Changed

  • Test suite dependencies bump

0.4.0.6 - 2018-05-12

Changed

  • Test suite dependencies bump

0.4.0.5 - 2018-05-11

Changed

  • Test suite dependencies bump

0.4.0.4 - 2018-05-11

Changed

  • Test suite dependencies bump

0.4.0.3 - 2018-05-10

Changed

  • Library dependencies bump

0.4.0.2 - 2018-04-25

Changed

  • Use doctest-driver-gen to run doctests

0.4.0.1 - 2018-03-17

Changed

  • GHC 8.4.x support

0.4 - 2018-02-20

Added

  • Doctests

Changed

  • TVec3 is now just a type synonym for (Double, Double, Double)

0.3.1 - 2018-02-18

Added

  • Eq and Show instances for Matrix CVec3

0.3 - 2018-02-18

Added

  • GHC 8.2.x support

Changed

  • Data.Vec3.Unboxed.Contiguous is now again Data.Vec3.Unboxed. UVec3 was merged with SVec3 and renamed to CVec3.

  • Data.Vec3.Unboxed is now Data.Vec3.Tupled and renamed to TVec3.

  • Benchmarks were reorganized to work well with Criterion group coloring

Removed

  • SVec3 (merged into CVec3)

0.2 - 2016-10-14

Added

  • Tests

Changed

  • Data.Vec3.Unboxed is now Data.Vec3.Unboxed.Contiguous

  • Data.Vec3.TUnboxed is now Data.Vec3.Unboxed and uses vector-th-unbox to generate Unbox instance

0.1.0.1 - 2012-12-13

Changed

  • Benchmark is now an actual Cabal-friendly benchmark

0.1.0.0 - 2012-12-05