Skip to content

Commit fc58222

Browse files
committed
Split library and tests
1 parent 9cc9efe commit fc58222

File tree

7 files changed

+469
-419
lines changed

7 files changed

+469
-419
lines changed

geometric-algebra.cabal

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
-- documentation, see http://haskell.org/cabal/users-guide/
33

44
name: geometric-algebra
5-
version: 0.3.0.0
5+
version: 0.3.1
66
synopsis: Geometric algebra calculations in Haskell
7-
-- description:
7+
description:
8+
Library for (hopefully) elegant computations using geometric algebra. Built for understanding, not speed.
89
license: MIT
910
license-file: LICENSE
1011
author: Pontus Granström
@@ -16,9 +17,33 @@ extra-source-files: README.md
1617
cabal-version: >=1.10
1718

1819
library
19-
exposed-modules: Numeric.GeometricAlgebra
20-
other-modules: Numeric.BasisBlade
21-
other-extensions: TemplateHaskell
22-
build-depends: base >=4.6 && <4.7, digits >=0.2 && <0.3, QuickCheck >=2.6 && <2.7, ieee754 >=0.7 && <0.8
23-
hs-source-dirs: src
24-
default-language: Haskell2010
20+
exposed-modules: Numeric.GeometricAlgebra
21+
other-modules: Numeric.BasisBlade, Numeric.Multivector
22+
other-extensions: TemplateHaskell
23+
hs-source-dirs: src
24+
default-language: Haskell2010
25+
build-depends: base == 4.6.*,
26+
digits == 0.2.*,
27+
ieee754 == 0.7.*
28+
29+
test-suite tests
30+
type: exitcode-stdio-1.0
31+
main-is: MainTests.hs
32+
hs-source-dirs: tests, src
33+
default-language: Haskell2010
34+
build-depends: base == 4.6.*,
35+
QuickCheck == 2.6.*,
36+
test-framework,
37+
test-framework-th,
38+
test-framework-quickcheck2,
39+
digits == 0.2.*,
40+
ieee754 == 0.7.*
41+
source-repository head
42+
type: git
43+
location: [email protected]:pnutus/geometric-algebra.git
44+
-- git://github.com/pnutus/geometric-algebra.git
45+
46+
source-repository this
47+
type: git
48+
location: [email protected]:pnutus/geometric-algebra.git
49+
tag: v0.3.1

src/Numeric/BasisBlade.hs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import Data.Word
66
import Data.Bits
77
import Data.List (intercalate)
88
import Data.Digits (digitsRev)
9-
import Test.QuickCheck hiding ((.&.))
10-
import Test.QuickCheck.All
119
import Data.AEq
1210
import Prelude hiding (negate, reverse)
1311

@@ -108,32 +106,3 @@ bitFilter bits = maskFilter (bitsToBool $ digitsRev 2 bits)
108106
where bitsToBool = map (== 1)
109107

110108
maskFilter mask xs = map snd $ filter fst (zip mask xs)
111-
112-
-- Tests/Properties
113-
114-
runTests = $quickCheckAll
115-
116-
prop_outerAntisymmetry x y =
117-
isVector x && isVector y && (basis x /= basis y) ==>
118-
x `out` y ~== (-1) *> y `out` x
119-
120-
prop_geoOuterEquiv bl1@(BasisBlade b1 s1) bl2@(BasisBlade b2 s2) =
121-
(b1.&.b2 == 0) ==>
122-
bl1 `geo` bl2 == bl1 `out` bl2
123-
124-
prop_outerGrade x y =
125-
(outProd /= scalar 0) ==>
126-
grade (outProd) == grade x + grade y
127-
where outProd = x `out` y
128-
129-
prop_geoGrade x y =
130-
grade (x `geo` y) == grade x + grade y - 2*common
131-
where common = popCount $ basis x .&. basis y
132-
133-
134-
135-
instance Arbitrary BasisBlade where
136-
arbitrary = do
137-
scalar <- arbitrary
138-
bits <- arbitrary
139-
return (BasisBlade scalar bits)

0 commit comments

Comments
 (0)