summaryrefslogtreecommitdiff
path: root/packages/base/src
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2017-09-30 13:23:28 +0200
committerAlberto Ruiz <aruiz@um.es>2017-09-30 13:23:28 +0200
commit87c7682bbfd17308749d5e9568f1ffa25390ce79 (patch)
treef8e835baea2db1ec1ace1ff4c8ee61a16b9178c4 /packages/base/src
parentd4a9e39ba919ec2c0c04f02d4cc511c9dd900ca7 (diff)
fix bug in static dot product
Diffstat (limited to 'packages/base/src')
-rw-r--r--packages/base/src/Numeric/LinearAlgebra/Static.hs14
1 files changed, 5 insertions, 9 deletions
diff --git a/packages/base/src/Numeric/LinearAlgebra/Static.hs b/packages/base/src/Numeric/LinearAlgebra/Static.hs
index 8175ff5..3000dcb 100644
--- a/packages/base/src/Numeric/LinearAlgebra/Static.hs
+++ b/packages/base/src/Numeric/LinearAlgebra/Static.hs
@@ -214,11 +214,11 @@ infixr 8 #>
214 214
215 215
216infixr 8 <·> 216infixr 8 <·>
217(<·>) :: R n -> R n -> ℝ 217(<·>) :: KnownNat n => R n -> R n -> ℝ
218(<·>) = dotR 218(<·>) = dotR
219 219
220infixr 8 <.> 220infixr 8 <.>
221(<.>) :: R n -> R n -> ℝ 221(<.>) :: KnownNat n => R n -> R n -> ℝ
222(<.>) = dotR 222(<.>) = dotR
223 223
224-------------------------------------------------------------------------------- 224--------------------------------------------------------------------------------
@@ -601,10 +601,8 @@ appR (isDiag -> Just (0, w, _)) v = mkR (w * subVector 0 (LA.size w) (extract v)
601appR m v = mkR (extract m LA.#> extract v) 601appR m v = mkR (extract m LA.#> extract v)
602 602
603 603
604dotR :: R n -> R n -> ℝ 604dotR :: KnownNat n => R n -> R n -> ℝ
605dotR (ud1 -> u) (ud1 -> v) 605dotR (extract -> u) (extract -> v) = LA.dot u v
606 | singleV u || singleV v = sumElements (u * v)
607 | otherwise = udot u v
608 606
609 607
610crossR :: R 3 -> R 3 -> R 3 608crossR :: R 3 -> R 3 -> R 3
@@ -667,9 +665,7 @@ appC m v = mkC (extract m LA.#> extract v)
667 665
668 666
669dotC :: KnownNat n => C n -> C n -> ℂ 667dotC :: KnownNat n => C n -> C n -> ℂ
670dotC (unwrap -> u) (unwrap -> v) 668dotC (extract -> u) (extract -> v) = LA.dot u v
671 | singleV u || singleV v = sumElements (conj u * v)
672 | otherwise = u LA.<.> v
673 669
674 670
675crossC :: C 3 -> C 3 -> C 3 671crossC :: C 3 -> C 3 -> C 3