diff options
Diffstat (limited to 'packages/base/src')
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra/HMatrix/Util.hs | 2 | ||||
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra/Util.hs | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/packages/base/src/Numeric/LinearAlgebra/HMatrix/Util.hs b/packages/base/src/Numeric/LinearAlgebra/HMatrix/Util.hs index 078a748..818b226 100644 --- a/packages/base/src/Numeric/LinearAlgebra/HMatrix/Util.hs +++ b/packages/base/src/Numeric/LinearAlgebra/HMatrix/Util.hs | |||
@@ -10,6 +10,8 @@ Stability : provisional | |||
10 | ----------------------------------------------------------------------------- | 10 | ----------------------------------------------------------------------------- |
11 | 11 | ||
12 | module Numeric.LinearAlgebra.HMatrix.Util( | 12 | module Numeric.LinearAlgebra.HMatrix.Util( |
13 | unitary, | ||
14 | pairwiseD2, | ||
13 | -- * Tools for the Kronecker product | 15 | -- * Tools for the Kronecker product |
14 | -- | 16 | -- |
15 | -- | (see A. Fusiello, A matter of notation: Several uses of the Kronecker product in | 17 | -- | (see A. Fusiello, A matter of notation: Several uses of the Kronecker product in |
diff --git a/packages/base/src/Numeric/LinearAlgebra/Util.hs b/packages/base/src/Numeric/LinearAlgebra/Util.hs index 043aa21..89202d3 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Util.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Util.hs | |||
@@ -227,10 +227,11 @@ infixl 9 ¿ | |||
227 | (¿)= flip extractColumns | 227 | (¿)= flip extractColumns |
228 | 228 | ||
229 | 229 | ||
230 | cross :: Vector Double -> Vector Double -> Vector Double | 230 | cross :: Product t => Vector t -> Vector t -> Vector t |
231 | -- ^ cross product (for three-element real vectors) | 231 | -- ^ cross product (for three-element vectors) |
232 | cross x y | dim x == 3 && dim y == 3 = fromList [z1,z2,z3] | 232 | cross x y | dim x == 3 && dim y == 3 = fromList [z1,z2,z3] |
233 | | otherwise = error $ "cross ("++show x++") ("++show y++")" | 233 | | otherwise = error $ "the cross product requires 3-element vectors (sizes given: " |
234 | ++show (dim x)++" and "++show (dim y)++")" | ||
234 | where | 235 | where |
235 | [x1,x2,x3] = toList x | 236 | [x1,x2,x3] = toList x |
236 | [y1,y2,y3] = toList y | 237 | [y1,y2,y3] = toList y |
@@ -238,6 +239,9 @@ cross x y | dim x == 3 && dim y == 3 = fromList [z1,z2,z3] | |||
238 | z2 = x3*y1-x1*y3 | 239 | z2 = x3*y1-x1*y3 |
239 | z3 = x1*y2-x2*y1 | 240 | z3 = x1*y2-x2*y1 |
240 | 241 | ||
242 | {-# SPECIALIZE cross :: Vector Double -> Vector Double -> Vector Double #-} | ||
243 | {-# SPECIALIZE cross :: Vector (Complex Double) -> Vector (Complex Double) -> Vector (Complex Double) #-} | ||
244 | |||
241 | norm :: Vector Double -> Double | 245 | norm :: Vector Double -> Double |
242 | -- ^ 2-norm of real vector | 246 | -- ^ 2-norm of real vector |
243 | norm = pnorm PNorm2 | 247 | norm = pnorm PNorm2 |