diff options
Diffstat (limited to 'packages/base/src')
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra/Static.hs | 14 |
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 | ||
216 | infixr 8 <·> | 216 | infixr 8 <·> |
217 | (<·>) :: R n -> R n -> ℝ | 217 | (<·>) :: KnownNat n => R n -> R n -> ℝ |
218 | (<·>) = dotR | 218 | (<·>) = dotR |
219 | 219 | ||
220 | infixr 8 <.> | 220 | infixr 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) | |||
601 | appR m v = mkR (extract m LA.#> extract v) | 601 | appR m v = mkR (extract m LA.#> extract v) |
602 | 602 | ||
603 | 603 | ||
604 | dotR :: R n -> R n -> ℝ | 604 | dotR :: KnownNat n => R n -> R n -> ℝ |
605 | dotR (ud1 -> u) (ud1 -> v) | 605 | dotR (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 | ||
610 | crossR :: R 3 -> R 3 -> R 3 | 608 | crossR :: R 3 -> R 3 -> R 3 |
@@ -667,9 +665,7 @@ appC m v = mkC (extract m LA.#> extract v) | |||
667 | 665 | ||
668 | 666 | ||
669 | dotC :: KnownNat n => C n -> C n -> ℂ | 667 | dotC :: KnownNat n => C n -> C n -> ℂ |
670 | dotC (unwrap -> u) (unwrap -> v) | 668 | dotC (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 | ||
675 | crossC :: C 3 -> C 3 -> C 3 | 671 | crossC :: C 3 -> C 3 -> C 3 |