resistor-cube 0.0.1.1 → 0.0.1.2
raw patch · 2 files changed
+8/−8 lines, 2 filesdep ~lapack
Dependency ranges changed: lapack
Files
- resistor-cube.cabal +3/−3
- src/Main.hs +5/−5
resistor-cube.cabal view
@@ -1,5 +1,5 @@ Name: resistor-cube-Version: 0.0.1.1+Version: 0.0.1.2 Synopsis: Compute total resistance of a cube of resistors Description: This is an example of how to compute the total resistance@@ -21,7 +21,7 @@ Cabal-Version: >=1.10 Source-Repository this- Tag: 0.0.1.1+ Tag: 0.0.1.2 Type: darcs Location: http://hub.darcs.net/thielema/resistor-cube @@ -32,7 +32,7 @@ Executable resistor-cube Main-is: Main.hs Build-Depends:- lapack >=0.3 && <0.4,+ lapack >=0.3.1 && <0.4, comfort-array >=0.4 && <0.5, base >=4.5 && <5 Hs-Source-Dirs: src
src/Main.hs view
@@ -6,10 +6,10 @@ module Main where import qualified Numeric.LAPACK.Matrix.Shape as MatrixShape-import qualified Numeric.LAPACK.Matrix.Triangular as Triangular+import qualified Numeric.LAPACK.Matrix.Symmetric as Symmetric import qualified Numeric.LAPACK.Matrix as Matrix import qualified Numeric.LAPACK.Vector as Vector-import Numeric.LAPACK.Matrix.Triangular ((#%%%#))+import Numeric.LAPACK.Matrix.Symmetric ((#%%%#)) import Numeric.LAPACK.Matrix ((#\|)) import Numeric.LAPACK.Format ((##)) @@ -68,14 +68,14 @@ resistances = Vector.one edgeShape -fullMatrix :: Triangular.Symmetric (():+:(EdgeShape:+:CornerShape)) Double+fullMatrix :: Matrix.Symmetric (():+:(EdgeShape:+:CornerShape)) Double fullMatrix = let order = MatrixShape.RowMajor symmetricZero sh = Matrix.zero $ MatrixShape.symmetric order sh unit = Vector.unit (edgeShape:+:cornerShape) (Right sourceCorner) in (symmetricZero (), Matrix.singleRow order unit) #%%%#- (Triangular.diagonal order resistances, voltageMatrix)+ (Symmetric.diagonal order resistances, voltageMatrix) #%%%# symmetricZero cornerShape @@ -84,7 +84,7 @@ main = do fullMatrix ## "%2.f" let ix = Right (Right destCorner)- let solutionVec = fullMatrix #\| Vector.unit (Triangular.size fullMatrix) ix+ let solutionVec = fullMatrix #\| Vector.unit (Symmetric.size fullMatrix) ix print $ - solutionVec ! ix {-