bcm      !"#$%&'()*+,-. / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l  portable provisionalEdward Kmett <ekmett@gmail.com>None mnopqrstuvw mnopqrstuvwportable provisionalEdward Kmett <ekmett@gmail.com>None 9A vector is an additive group with additional structure. The zero vector Compute the sum of two vectors V2 1 2 ^+^ V2 3 4V2 4 6+Compute the difference between two vectors V2 4 5 - V2 3 1V2 1 4*Linearly interpolate between two vectors. !Compute the negation of a vector negated (V2 2 4) V2 (-2) (-4) Compute the left scalar product  2 *^ V2 3 4V2 6 8!Compute the right scalar product  V2 3 4 ^* 2V2 6 8+Compute division by a scalar on the right. BProduce a default basis for a vector space. If the dimensionality 2 of the vector space is not statically known, see  . :Produce a default basis for a vector space from which the  argument is drawn. x yz{|}~   x yz{|}~portable provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred EProvides a fairly subjective test to see if a quantity is near zero. nearZero (1e-11 :: Double)FalsenearZero (1e-17 :: Double)TruenearZero (1e-5 :: Float)FalsenearZero (1e-7 :: Float)True &Determine if a quantity is near zero.   a  1e-12  a  1e-6      non-portable experimentalEdward Kmett <ekmett@gmail.com>None Free and sparse inner product/metric spaces. ;Compute the inner product of two vectors or (equivalently)  convert a vector f a into a covector f a -> a. V2 1 2 `dot` V2 3 4119Compute the squared norm. The name quadrance arises from  Norman J. Wildberger's rational trigonometry. (Compute the quadrance of the difference ;Compute the distance between two vectors in a metric space /Compute the norm of a vector in a metric space *Convert a non-zero vector to unit vector.  Normalize a   functor to have unit . This function $ does not change the functor if its  is 0 or 1.      non-portable experimentalEdward Kmett <ekmett@gmail.com> Safe-InferredA  f+ is corepresentable if it is isomorphic to (x -> a) E for some x. Nearly all such functors can be represented by choosing x to be ? the set of lenses that are polymorphic in the contents of the ,  that is to say x = Rep f is a valid choice of x for (nearly) every   Representable .  non-portable experimentalEdward Kmett <ekmett@gmail.com>NoneA 0-dimensional vector pure 1 :: V0 IntV0V0 + V0V0 non-portable experimentalEdward Kmett <ekmett@gmail.com>None6A space that distinguishes 2 orthogonal basis vectors  and , but may have more.  V2 1 2 ^._x1V2 1 2 & _x .~ 3V2 3 2    :: Lens' (t a) a  V2 1 2 ^._y2V2 1 2 & _y .~ 3V2 1 3    :: Lens' (t a) a     :: Lens' (t a) ( a) A 2-dimensional vector pure 1 :: V2 IntV2 1 1V2 1 2 + V2 3 4V2 4 6V2 1 2 * V2 3 4V2 3 8 sum (V2 1 2)3+the counter-clockwise perpendicular vector perp $ V2 10 20 V2 (-20) 10 non-portable experimentalEdward Kmett <ekmett@gmail.com>None 7A space that distinguishes 3 orthogonal basis vectors: , , and !. (It may have more) !   ! :: Lens' (t a) a "   " :: Lens' (t a) (# a) #A 3-dimensional vector %cross product &scalar triple product  !"#$%&  !"#$%& #$%& !" !"#$%& non-portable experimentalEdward Kmett <ekmett@gmail.com>None'4A space that distinguishes orthogonal basis vectors , , !, (. (It may have more.) (   ( :: Lens' (t a) a )   ) :: Lens' (t a) (* a) *A 4-dimensional vector. ,OConvert a 3-dimensional affine vector into a 4-dimensional homogeneous vector. -NConvert a 3-dimensional affine point into a 4-dimensional homogeneous vector. '()*+,- !"'()*+,-*+,- !"'()'()*+,-  non-portable experimentalEdward Kmett <ekmett@gmail.com>None.8Plcker coordinates for lines in a 3-dimensional space. 0[Given a pair of points represented by homogeneous coordinates generate Plcker coordinates  for the line through them. 1OThese elements form a basis for the Plcker space, or the Grassmanian manifold Gr(2,V4).   1 :: Lens' (. a) a  2 :: Lens' (. a) a  3 :: Lens' (. a) a  4 :: Lens' (. a) a  5 :: Lens' (. a) a  6 :: Lens' (. a) a 2OThese elements form a basis for the Plcker space, or the Grassmanian manifold Gr(2,V4).   1 :: Lens' (. a) a  2 :: Lens' (. a) a  3 :: Lens' (. a) a  4 :: Lens' (. a) a  5 :: Lens' (. a) a  6 :: Lens' (. a) a 3OThese elements form a basis for the Plcker space, or the Grassmanian manifold Gr(2,V4).   1 :: Lens' (. a) a  2 :: Lens' (. a) a  3 :: Lens' (. a) a  4 :: Lens' (. a) a  5 :: Lens' (. a) a  6 :: Lens' (. a) a 4OThese elements form a basis for the Plcker space, or the Grassmanian manifold Gr(2,V4).   1 :: Lens' (. a) a  2 :: Lens' (. a) a  3 :: Lens' (. a) a  4 :: Lens' (. a) a  5 :: Lens' (. a) a  6 :: Lens' (. a) a 5OThese elements form a basis for the Plcker space, or the Grassmanian manifold Gr(2,V4).   1 :: Lens' (. a) a  2 :: Lens' (. a) a  3 :: Lens' (. a) a  4 :: Lens' (. a) a  5 :: Lens' (. a) a  6 :: Lens' (. a) a 6OThese elements form a basis for the Plcker space, or the Grassmanian manifold Gr(2,V4).   1 :: Lens' (. a) a  2 :: Lens' (. a) a  3 :: Lens' (. a) a  4 :: Lens' (. a) a  5 :: Lens' (. a) a  6 :: Lens' (. a) a 7ZThese elements form an alternate basis for the Plcker space, or the Grassmanian manifold Gr(2,V4).   7 ::  a => Lens' (. a) a  8 ::  a => Lens' (. a) a  9 ::  a => Lens' (. a) a  : ::  a => Lens' (. a) a  ; ::  a => Lens' (. a) a  < ::  a => Lens' (. a) a 8ZThese elements form an alternate basis for the Plcker space, or the Grassmanian manifold Gr(2,V4).   7 ::  a => Lens' (. a) a  8 ::  a => Lens' (. a) a  9 ::  a => Lens' (. a) a  : ::  a => Lens' (. a) a  ; ::  a => Lens' (. a) a  < ::  a => Lens' (. a) a 9ZThese elements form an alternate basis for the Plcker space, or the Grassmanian manifold Gr(2,V4).   7 ::  a => Lens' (. a) a  8 ::  a => Lens' (. a) a  9 ::  a => Lens' (. a) a  : ::  a => Lens' (. a) a  ; ::  a => Lens' (. a) a  < ::  a => Lens' (. a) a :ZThese elements form an alternate basis for the Plcker space, or the Grassmanian manifold Gr(2,V4).   7 ::  a => Lens' (. a) a  8 ::  a => Lens' (. a) a  9 ::  a => Lens' (. a) a  : ::  a => Lens' (. a) a  ; ::  a => Lens' (. a) a  < ::  a => Lens' (. a) a ;ZThese elements form an alternate basis for the Plcker space, or the Grassmanian manifold Gr(2,V4).   7 ::  a => Lens' (. a) a  8 ::  a => Lens' (. a) a  9 ::  a => Lens' (. a) a  : ::  a => Lens' (. a) a  ; ::  a => Lens' (. a) a  < ::  a => Lens' (. a) a <ZThese elements form an alternate basis for the Plcker space, or the Grassmanian manifold Gr(2,V4).   7 ::  a => Lens' (. a) a  8 ::  a => Lens' (. a) a  9 ::  a => Lens' (. a) a  : ::  a => Lens' (. a) a  ; ::  a => Lens' (. a) a  < ::  a => Lens' (. a) a =Valid Plcker coordinates p will have = p  0 PThat said, floating point makes a mockery of this claim, so you may want to use  . >This isn'Yt th actual metric because this bilinear form gives rise to an isotropic quadratic space ?rChecks if the line is near-isotropic (isotropic vectors in this quadratic space represent lines in real 3d space) @:Checks if the two vectors intersect (or nearly intersect) &./0123456789:;<=>?@./0123456789:;<=>?@./=?>0@12376;8<495:%./0123456789:;<=>?@  non-portable experimentalEdward Kmett <ekmett@gmail.com> Safe-InferredAAn involutive ring B<Conjugate a value. This defaults to the trivial involution. conjugate (1 :+ 2) 1.0 :+ (-2.0) conjugate 11ABABABAB  non-portable experimentalEdward Kmett <ekmett@gmail.com>NoneC0A vector space that includes the basis elements H, I, D and E D   D :: Lens' (t a) a E   E :: Lens' (t a) a F   F :: Lens' (t a) (V3 a) G0A vector space that includes the basis elements H and I H   H :: Lens' (t a) a I   I :: Lens' (t a) a J Quaternions %quadrance of the imaginary component L norm of the imaginary component Mraise a J to a scalar power 1Helper for calculating with specific branch cuts 1Helper for calculating with specific branch cuts N with a specified branch cut. O with a specified branch cut. P with a specified branch cut. Q with a specified branch cut. R with a specified branch cut. S with a specified branch cut. T8Spherical linear interpolation between two quaternions. UApply a rotation to a vector. VV axis theta builds a J representing a  rotation of theta radians about axis. .CDEFGHIJKLMNOPQRSTUV     CDEFGHIJKLMNOPQRSTUVJKGHICDEFTNOPQRSLMUV(CDEFGHIJKLMNOPQRSTUV       non-portable experimentalEdward Kmett <ekmett@gmail.com>NoneW+A 4x3 matrix with row-major representation X+A 4x4 matrix with row-major representation Y+A 3x3 matrix with row-major representation Z+A 2x2 matrix with row-major representation [dMatrix product. This can compute mixed dense-dense, sparse-dense and sparse-sparse matrix products. :V2 (V3 1 2 3) (V3 4 5 6) !*! V3 (V2 1 2) (V2 3 4) (V2 4 5)V2 (V2 19 25) (V2 43 58)SV2 (fromList [(1,2)]) (fromList [(2,3)]) !*! fromList [(1,V3 0 0 1), (2, V3 0 0 5)]V2 (V3 0 0 2) (V3 0 0 15)\Matrix * column vector $V2 (V3 1 2 3) (V3 4 5 6) !* V3 7 8 9 V2 50 122]Row vector * matrix "V2 1 2 *! V2 (V3 3 4 5) (V3 6 7 8) V3 15 18 21^Scalar-matrix product 5 *!! V2 (V2 1 2) (V2 3 4)V2 (V2 5 10) (V2 15 20)_Matrix-scalar product V2 (V2 1 2) (V2 3 4) !!* 5V2 (V2 5 10) (V2 15 20)`+Hermitian conjugate or conjugate transpose :adjoint (V2 (V2 (1 :+ 2) (3 :+ 4)) (V2 (5 :+ 6) (7 :+ 8)))LV2 (V2 (1.0 :+ (-2.0)) (5.0 :+ (-6.0))) (V2 (3.0 :+ (-4.0)) (7.0 :+ (-8.0)))aCompute the trace of a matrix trace (V2 (V2 a b) (V2 c d))a + db$Build a rotation matrix from a unit J. c=Build a transformation matrix from a rotation expressed as a  J and a translation vector. dAConvert from a 4x3 matrix to a 4x4 matrix, extending it with the  [ 0 0 0 1 ] column vector e8Convert a 3x3 matrix to a 4x4 matrix extending it with 0's in the new row and column. f3x3 identity matrix. eye3#V3 (V3 1 0 0) (V3 0 1 0) (V3 0 0 1)g4x4 identity matrix. eye46V4 (V4 1 0 0 0) (V4 0 1 0 0) (V4 0 0 1 0) (V4 0 0 0 1)h@Extract the translation vector (first three entries of the last " column) from a 3x4 or 4x4 matrix i2x2 matrix determinant. det22 (V2 (V2 a b) (V2 c d)) a * d - b * cj3x3 matrix determinant. +det33 (V3 (V3 a b c) (V3 d e f) (V3 g h i))?a * (e * i - f * h) - d * (b * i - c * h) + g * (b * f - c * e)k2x2 matrix inverse. inv22 $ V2 (V2 1 2) (V2 3 4))Just (V2 (V2 (-2.0) 1.0) (V2 1.5 (-0.5)))l3x3 matrix inverse. +inv33 $ V3 (V3 1 2 4) (V3 4 2 2) (V3 1 1 1)JJust (V3 (V3 0.0 0.5 (-1.0)) (V3 (-0.5) (-0.75) 3.5) (V3 0.5 0.25 (-1.5)))WXYZ[\]^_`abcdefghijklWXYZ[\]^_`abcdefghijkl[\]_^`ZYXWedijklfgahbcWXYZ[\]^_`abcdefghijkl non-portable experimentalEdward Kmett <ekmett@gmail.com>Nonem  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijkl !"#$%&&'()*++,-./00123456678 9 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                             !" linear-0.9.1 Linear.VectorLinear.Epsilon Linear.Metric Linear.Core Linear.V0 Linear.V2 Linear.V3 Linear.V4Linear.PluckerLinear.ConjugateLinear.Quaternion Linear.MatrixLinear.InstancesLinearAdditivezero^+^^-^lerpnegated*^^*^/basisbasisForEpsilonnearZeroMetricdot quadranceqddistancenormsignorm normalizeCorecoreV0R2_x_y_xyV2perpR3_z_xyzV3crosstripleR4_w_xyzwV4vectorpointPluckerpluckerp01p02p03p23p31p12p10p20p30p32p13p21 squaredError>< isotropic intersects Conjugate conjugate Hamiltonian_j_k_ijk Complicated_e_i Quaternionabsipowasinqacosqatanqasinhqacoshqatanhqslerprotate axisAngleM43M44M33M22!*!!**!*!!!!*adjointtracefromQuaternionmkTransformation m43_to_m44 m33_to_m44eye3eye4 translationdet22det33inv22inv33$fTraversable1Complex$fFoldable1Complex$fTraversableComplex$fFoldableComplex$fMonadComplex $fBindComplex$fApplicativeComplex$fApplyComplex$fFunctorComplex $fBindHashMap$fApplyHashMap setElement$fAdditiveIdentity$fAdditiveComplex$fAdditive(->)$fAdditiveHashMap $fAdditiveMap$fAdditiveIntMap$fEpsilonDoublebaseGHC.Numabsghc-prim GHC.Classes<=$fEpsilonFloatGHC.BaseFunctor $fStorableV0 $fEpsilonV0$fDistributiveV0$fCoreV0 $fMetricV0$fFractionalV0$fNumV0 $fMonadV0$fBindV0 $fAdditiveV0$fApplicativeV0 $fApplyV0$fTraversableV0 $fFoldableV0 $fFunctorV0$fIxV2 $fStorableV2 $fEpsilonV2$fDistributiveV2$fCoreV2$fR2V2 $fMetricV2$fFractionalV2$fNumV2 $fMonadV2$fBindV2 $fAdditiveV2$fApplicativeV2 $fApplyV2$fTraversable1V2 $fFoldable1V2$fTraversableV2 $fFoldableV2 $fFunctorV2$fIxV3 $fEpsilonV3 $fStorableV3$fCoreV3$fR3V3$fR2V3$fDistributiveV3 $fMetricV3$fFractionalV3$fNumV3 $fMonadV3$fBindV3 $fAdditiveV3$fApplicativeV3 $fApplyV3$fTraversable1V3 $fFoldable1V3$fTraversableV3 $fFoldableV3 $fFunctorV3$fIxV4 $fEpsilonV4 $fStorableV4$fCoreV4$fR4V4$fR3V4$fR2V4$fDistributiveV4 $fMetricV4$fFractionalV4$fNumV4 $fMonadV4$fBindV4 $fAdditiveV4 $fApplyV4$fApplicativeV4$fTraversable1V4 $fFoldable1V4$fTraversableV4 $fFoldableV4 $fFunctorV4Num==anti$fEpsilonPlucker$fMetricPlucker$fStorablePlucker$fFractionalPlucker $fNumPlucker $fIxPlucker$fTraversable1Plucker$fFoldable1Plucker$fTraversablePlucker$fFoldablePlucker $fCorePlucker$fDistributivePlucker$fMonadPlucker $fBindPlucker$fAdditivePlucker$fApplicativePlucker$fApplyPlucker$fFunctorPlucker$fConjugateComplex$fConjugateFloat$fConjugateDouble$fConjugateWord8$fConjugateWord16$fConjugateWord32$fConjugateWord64$fConjugateWord$fConjugateInt8$fConjugateInt16$fConjugateInt32$fConjugateInt64$fConjugateInt$fConjugateIntegerqicutcutWith GHC.FloatasinacosatanasinhacoshatanhqNaN reimagine$fEpsilonQuaternion$fFloatingQuaternion$fConjugateQuaternion$fDistributiveQuaternion$fHamiltonianQuaternion$fComplicatedQuaternion$fComplicatedComplex$fMetricQuaternion$fFractionalQuaternion$fNumQuaternion$fStorableQuaternion$fTraversableQuaternion$fFoldableQuaternion$fCoreQuaternion$fIxQuaternion$fMonadQuaternion$fBindQuaternion$fAdditiveQuaternion$fApplicativeQuaternion$fApplyQuaternion$fFunctorQuaternionmkTransformationMat