magico 0.0.2.1 → 0.0.2.2
raw patch · 2 files changed
+14/−12 lines, 2 filesdep ~comfort-arraydep ~lapack
Dependency ranges changed: comfort-array, lapack
Files
- magico.cabal +8/−8
- src/Main.hs +6/−4
magico.cabal view
@@ -1,10 +1,10 @@ Name: magico-Version: 0.0.2.1+Version: 0.0.2.2 Synopsis: Compute solutions for Magico puzzle Description: Compute solutions for Magico puzzle:- <http://www.spectra-verlag.de/oesterreich/SID=0/shopneu/lernspiel/lern7.php3>-Homepage: http://hub.darcs.net/thielema/magico+ <https://www.westermann.de/reihe/SPC_A224/Magico-Fuer-Strategie-und-Problemloesungen>+Homepage: https://hub.darcs.net/thielema/magico License: BSD3 License-File: LICENSE Author: Henning Thielemann@@ -14,19 +14,19 @@ Cabal-Version: >=1.10 Source-Repository this- Tag: 0.0.2.1+ Tag: 0.0.2.2 Type: darcs- Location: http://hub.darcs.net/thielema/magico+ Location: https://hub.darcs.net/thielema/magico Source-Repository head Type: darcs- Location: http://hub.darcs.net/thielema/magico+ Location: https://hub.darcs.net/thielema/magico Executable magico Main-is: Main.hs Build-Depends:- lapack >=0.3 && <0.4,- comfort-array >=0.4 && <0.5,+ lapack >=0.4 && <0.5,+ comfort-array >=0.5 && <0.6, transformers >=0.3 && <0.6, utility-ht >=0.0.11 && <0.1, base >=4.5 && <5
src/Main.hs view
@@ -8,6 +8,7 @@ import qualified Numeric.LAPACK.Singular as Singular import qualified Numeric.LAPACK.Matrix.Shape as MatrixShape import qualified Numeric.LAPACK.Matrix.Square as Square+import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix import qualified Numeric.LAPACK.Matrix as Matrix import qualified Numeric.LAPACK.Vector as Vector import Numeric.LAPACK.Matrix ((===))@@ -18,7 +19,7 @@ import qualified Data.Array.Comfort.Storable as Array import qualified Data.Array.Comfort.Shape as Shape import Data.Array.Comfort.Storable ((!))-import Data.Array.Comfort.Shape ((:+:))+import Data.Array.Comfort.Shape ((::+)) import Foreign.Storable (Storable) @@ -33,7 +34,7 @@ type Board = BoxedArray.Array SquareShape type Matrix height width = Matrix.General height width-type ExtMatrix = Matrix (SumsShape:+:()) SquareShape+type ExtMatrix = Matrix (SumsShape::+()) SquareShape type SumsVector = Vector SumsShape type Solution = Vector SquareShape type SquareShape = (Shape.Enumeration Index, Shape.Enumeration Index)@@ -47,7 +48,7 @@ type SumsShape =- (():+:()) :+: (Shape.Enumeration Index :+: Shape.Enumeration Index)+ (()::+()) ::+ (Shape.Enumeration Index ::+ Shape.Enumeration Index) sumsShape :: SumsShape sumsShape = Shape.static@@ -119,7 +120,8 @@ ExtMatrix Double -> Matrix.General Matrix.ShapeInt SquareShape Double nullspace mat = let (_vr,sigma,vl) = Singular.decompose mat- rnk = length $ takeWhile (>1e-7) $ Vector.toList sigma+ rnk =+ length $ takeWhile (>1e-7) $ Vector.toList $ ArrMatrix.toVector sigma in Matrix.dropRows rnk $ Matrix.mapHeight (Shape.ZeroBased . Shape.size) $ Matrix.fromFull vl