linear
Linear Algebra
http://github.com/ekmett/linear/
| LTS Haskell 24.16: | 1.23.2 |
| Stackage Nightly 2025-10-24: | 1.23.2 |
| Latest on Hackage: | 1.23.2 |
BSD-3-Clause licensed by Edward A. Kmett
Maintained by Edward A. Kmett
This version can be pinned in stack with:
linear-1.23.2@sha256:6d4c5e5917a275305f6e9430f6d8e0a5299b877647c12deacb1f7e9863b4d9b2,4264Module documentation for 1.23.2
Depends on 23 packages(full list with versions):
Used by 16 packages in nightly-2025-10-24(full list with versions):
Changes
1.23.2 [2025.06.17]
- Replace
test-frameworkwithtastyin the test suite.
1.23.1 [2025.03.03]
- Add
UniformandUniformRangeinstances forPlucker,Quaternion,V, andV{0,1,2,3,4}.
1.23 [2024.04.15]
- The direction of interpolation of
lerphas been reversed; nowlerp 0 a b == aandlerp 1 a b == b. This bringslerpin line not only with its implementation in other languages and frameworks, but also withslerpin this package.
1.22 [2022.11.30]
-
The types of
_PointandlensPhave been generalized:-_Point :: Iso' (Point f a) (f a) +_Point :: Iso (Point f a) (Point g b) (f a) (g b) -lensP :: Lens' (Point g a) (g a) +lensP :: Lens (Point f a) (Point g b) (f a) (g b)There is a chance that existing uses of
_PointorlensPwill fail to typecheck due to their more general types. You can use_Point.simpleorlensP.simpleto restore their old, more restricted types (wheresimplecomes fromControl.Lensin thelenslibrary).
1.21.10 [2022.06.21]
- Allow building with
vector-0.13.*.
1.21.9 [2022.05.18]
- Allow building with
transformers-0.6.*.
1.21.8 [2021.11.15]
- Allow building with
hashable-1.4.*. - Drop support for pre-8.0 versions of GHC.
1.21.7 [2021.09.20]
- Fix a build error when using
random-1.2.1or later.
1.21.6 [2021.07.05]
- Fix a build error when configured with
-template-haskell.
1.21.5 [2021.02.18]
- Allow building with
lens-5.*.
1.21.4 [2021.01.29]
- Allow building with
vector-0.12.2or later. - The build-type has been changed from
CustomtoSimple. To achieve this, thedocteststest suite has been removed in favor of usingcabal-docspecto run the doctests.
1.21.3 [2020.10.03]
- Allow building with GHC 9.0.
1.21.2 [2020.09.30]
- Use
base-orphans-0.8.3or later. This means that theLinear.Instancesmodule no longer defines any orphan instances of its own, and the module is now a simple shim on top ofData.Orphansfrombase-orphans.
1.21.1 [2020.06.25]
- Allow building with
random-1.2.*.
1.21 [2020.02.03]
- Add instances for direct sums (
Product) and tensor products (Compose) of other vector spaces. This makes is much more convenient to do things like treat a matrix temporarily as a vector through Compose, or to consider things like Gauss-Jordan elimination, which wants augmented structures. - Add
frobeniusfor computing the Frobenius norm of a matrix. - Added
Randominstances forSystem.Random. We had an indirect dependency throughvectoranyways. - Add “obvious” zipping
SemigroupandMonoidinstances to all the representable vector spaces. - Add
R1..R4instances toQuaternion._wis the scalar component so that_x,_y,_zcan be directional. - Add more solvers to
Linear.Matrix, available withbase-4.8or later. - Add
unanglefunction toLinear.V2.
1.20.9 [2019.05.02]
- Derive
Liftinstances forPlucker,Quaternion, andV{0,1,2,3,4}.
1.20.8 [2018.07.03]
- Add instances of the
Fieldclasses fromlens. - Add
Epsiloninstance forComplex. - Use specialized implementations of the
nullandlengthmethods inFoldableinstances. - Add
Hashable1instances for data types inlinear. Also add aHashableinstance forV. - Fix a bug in which
Quaternions were incorrectly exponentiated.
1.20.7
- Support
semigroupoids-5.2.1anddoctest-0.12
1.20.6
- Revamp
Setup.hsto usecabal-doctest. This makes it build withCabal-2.0, and makes thedoctests work withcabal new-buildand sandboxes. - Make
(1 / x)andrecip xagree in theFractionalinstance forQuaternion - Use newtype instances for
Pointvectors inLinear.Affine - Enable
PolyKindsinLinear.Trace. Also enablePolyKindswhen GHC 7.6 or later is used (previously, it was GHC 7.8 or later). - Fix a segfault arising from the
MVectorinstance forV - Add
Finiteclass for conversion betweenVand fixed-size vector types
1.20.5
- GHC 8 compatibility
- Fixed the
perspectivecalculation.
1.20.4
- Compatibility with
base-orphans0.5
1.20.3
- Support
vector0.11.0.0. - Support
cereal0.5 - You can now unboxed vectors of
V nvectors.
1.20.2
- Modified the
doctestmachinery to work withstackand builds to non-standard locations. - Removed the local
.ghcifile. - Various numerical stability improvements were made to the quaternion and projection functions.
1.20.1
- Fixed doctests broken by the previous change.
- Unboxed vector instances for various linear data types now use unpacked integers even on older GHCs.
1.20
inv22,inv33andinv44no longer attempt an epsilon check. They no longer return aMayberesult as a consequence. You should filter for the 0 determinant case yourself.
1.19.1.3
vector0.11.0.0 support
1.19.1.2
- Fix GHC 7.4.
1.19.1.1
- Proper
reflection2 support
1.19.1
reflection2 support
1.19
- Change the Ixed instance for
Linear.Vto useIntas the index type. This makesV na lot easier to use.
1.18.3
- Compile warning-free on GHC 7.10.
1.18.2
- Added
NFDatainstance forPoint
1.18.1
- Added an
-f-template-haskelloption to allow disablingtemplate-haskellsupport. This is an unsupported configuration but may be useful for expert users in sandbox configurations. - Added lenses for extracting corner various sub-matrices e.g.
_m22,_m33
1.18.0.2
- Fixed builds on even older GHCs.
1.18.0.1
- Fixed the test suite.
- Fixed builds on older GHCs.
1.18
- Consolidated
eye2..eye4into a singleidentitycombinator. - Fixed the
DatainstanceV n afor GHC 7.10-RC3.
1.17.1.1
filepath1.4 support
1.17.1
- Added support for
Data.Functor.Classesfromtransformers0.5 viatransformers-compat. - Added missing support for
binary,bytesandcerealforPoint
1.17
- Better support for
binary. Added support forbytesandcereal
1.16.4
orthoandinverseOrthonow only require aFractionalconstraint.- Added missing
Floatinginstances.
1.16.3
- Improve the performance of
fromQuaternion,mkTransformation,mkTransformationMat,basisFor,scaledby using implementations that inline well for functions that were previously reference implementations.
1.16.2
- Added
NFDatainstances for the various vector types. - Added
!!/operator for matrix division by scalar.
1.16.1
- Added
Traceinstance forV1.
1.16
- Renamed
kroneckertoscaled.
1.15.5
- Added
Metricinstances for[],ZipList,Maybe - Added
det44andinv44toLinear.Matrix - Added
Datainstance forPoint
1.15.4
- Added Typeable and Data instances for V
1.15.3
- Added missing
FunctorWithIndex,FoldableWithIndexandTraversableWithIndex Int (V n)instances forV
1.15.2
- Added
frustum, analogous to the oldglFrustumcall. - Added
inverseInfinitePerspective,inverseOrtho,inverseFrustum.
1.15.1
- Added
inversePerspective. It is much more accurate to compute it directly than to compute an inverse.
1.15.0.1
- Fixed build failures caused by
Linearre-exporting the old name.
1.15
- Renamed
Linear.PerspectivetoLinear.Projection. - Fixed a build issue with GHC HEAD.
1.14.0.1
- Fixed test failures caused by 1.14
1.14
- Moved
CoincidestoLinear.Plucker.Coincides. The constructorsLineandRayoft collided with user code.
1.13
- Switched ‘ortho’ to follow the OpenGL handedness.
1.12.1
- Added “swizzle” lenses e.g.
_yzx, which are useful for working with libraries likegl.
1.12
- Added ‘transpose’
- Added missing ‘Mxy’ matrices up to 4 dimensions – they were commonly reimplemented by users.
1.11.3
- Fixed an issue with
UndecidableInstanceson GHC 7.6.3
1.11.2
- Added
Linear.Perspective.
1.11.1
- Added
_Point,relativeand a few instances forPoint.
1.11
- Changed the ‘representation’ of
V nfromE (V n), which was hard to use, toInt, which is a bit too permissive, but is easy to use.
1.10.1
- Added
Linear.V2.angle.
1.10
- Added
Hashableinstances.
1.9.1
- Added a role annotation to
V n ato prevent users from using GHC 7.8’sCoerciblemachinery to violate invariants.
1.9.0.1
- Fixed a broken build
1.9
- Added
MonadZipinstances. - Added
MonadFixinstances. - Added
Control.Lens.Each.Eachinstances
1.8.1
- Bugfixed
slerp
1.8
- Added missing
Unboxinstances for working with unboxed vectors oflineardata types.
1.7
- Fixed
axisAngle unitnow has a rank 1 type.
1.5
lens4 compatibility
1.4
- Renamed
incoretocolumnand added an example.
1.3.1.1
- Build bugfix
1.3.1
- Better implementations of
basisandbasisFor. - Derived Generic instances.
1.2
- Improved matrix multiplication to properly support the sparse/sparse case.
1.1.4
- Marked modules
Trustworthyas necessary.
1.1.2
- Dependency bump for
reflectioncompatibility
1.1.1
- Fixed an infinite loop in the default definition of
liftI2.
1.1
- Added
Additiveinstances for[],MaybeandVector.
1.0
- Strict vectors
- Exported
mkTransformationMat - Bumped dependency bounds
0.9.1 [bug fix]
- Exported
Linear.V0!
0.9
- Added sparse vector support.
0.8
- Added
Linear.V0
0.7
- Added
Linear.Instances - More documentation
0.6
- Removed the direct dependency on
lens. - Added
Linear.Coreto cover vector spaces as corepresentable functors.
0.5
- Added
Ixinstances forV2,V3, andV4
0.4.2.2
- Removed the upper bound on
distributive
0.2
- Initial hackage release