diff options
Diffstat (limited to 'lib/Numeric/Matrix.hs')
-rw-r--r-- | lib/Numeric/Matrix.hs | 75 |
1 files changed, 2 insertions, 73 deletions
diff --git a/lib/Numeric/Matrix.hs b/lib/Numeric/Matrix.hs index 3d1ac94..f78e0c2 100644 --- a/lib/Numeric/Matrix.hs +++ b/lib/Numeric/Matrix.hs | |||
@@ -31,10 +31,7 @@ module Numeric.Matrix ( | |||
31 | --module Numeric.Container, | 31 | --module Numeric.Container, |
32 | optimiseMult, | 32 | optimiseMult, |
33 | -- * Operators | 33 | -- * Operators |
34 | (<>), (<\>), | 34 | (<>), (<\>) |
35 | -- * Deprecated | ||
36 | (.*),(*/),(<|>),(<->), | ||
37 | vectorMax,vectorMin | ||
38 | ) where | 35 | ) where |
39 | 36 | ||
40 | ------------------------------------------------------------------- | 37 | ------------------------------------------------------------------- |
@@ -101,77 +98,9 @@ instance Mul Matrix Vector Vector where | |||
101 | instance Mul Vector Matrix Vector where | 98 | instance Mul Vector Matrix Vector where |
102 | (<>) v m = flatten $ (asRow v) <> m | 99 | (<>) v m = flatten $ (asRow v) <> m |
103 | 100 | ||
104 | ---------------------------------------------------- | 101 | -------------------------------------------------------- |
105 | |||
106 | {-# DEPRECATED (.*) "use scale a x or scalar a * x" #-} | ||
107 | |||
108 | -- -- | @x .* a = scale x a@ | ||
109 | -- (.*) :: (Linear c a) => a -> c a -> c a | ||
110 | infixl 7 .* | ||
111 | a .* x = scale a x | ||
112 | |||
113 | ---------------------------------------------------- | ||
114 | |||
115 | {-# DEPRECATED (*/) "use scale (recip a) x or x / scalar a" #-} | ||
116 | |||
117 | -- -- | @a *\/ x = scale (recip x) a@ | ||
118 | -- (*/) :: (Linear c a) => c a -> a -> c a | ||
119 | infixl 7 */ | ||
120 | v */ x = scale (recip x) v | ||
121 | 102 | ||
122 | -- | least squares solution of a linear system, similar to the \\ operator of Matlab\/Octave (based on linearSolveSVD). | 103 | -- | least squares solution of a linear system, similar to the \\ operator of Matlab\/Octave (based on linearSolveSVD). |
123 | (<\>) :: (Field a) => Matrix a -> Vector a -> Vector a | 104 | (<\>) :: (Field a) => Matrix a -> Vector a -> Vector a |
124 | infixl 7 <\> | 105 | infixl 7 <\> |
125 | m <\> v = flatten (linearSolveSVD m (reshape 1 v)) | 106 | m <\> v = flatten (linearSolveSVD m (reshape 1 v)) |
126 | |||
127 | ------------------------------------------------ | ||
128 | |||
129 | {-# DEPRECATED (<|>) "define operator a & b = fromBlocks[[a,b]] and use asRow/asColumn to join vectors" #-} | ||
130 | {-# DEPRECATED (<->) "define operator a // b = fromBlocks[[a],[b]] and use asRow/asColumn to join vectors" #-} | ||
131 | |||
132 | class Joinable a b where | ||
133 | joinH :: Element t => a t -> b t -> Matrix t | ||
134 | joinV :: Element t => a t -> b t -> Matrix t | ||
135 | |||
136 | instance Joinable Matrix Matrix where | ||
137 | joinH m1 m2 = fromBlocks [[m1,m2]] | ||
138 | joinV m1 m2 = fromBlocks [[m1],[m2]] | ||
139 | |||
140 | instance Joinable Matrix Vector where | ||
141 | joinH m v = joinH m (asColumn v) | ||
142 | joinV m v = joinV m (asRow v) | ||
143 | |||
144 | instance Joinable Vector Matrix where | ||
145 | joinH v m = joinH (asColumn v) m | ||
146 | joinV v m = joinV (asRow v) m | ||
147 | |||
148 | infixl 4 <|> | ||
149 | infixl 3 <-> | ||
150 | |||
151 | {-- - | Horizontal concatenation of matrices and vectors: | ||
152 | |||
153 | @> (ident 3 \<-\> 3 * ident 3) \<|\> fromList [1..6.0] | ||
154 | (6><4) | ||
155 | [ 1.0, 0.0, 0.0, 1.0 | ||
156 | , 0.0, 1.0, 0.0, 2.0 | ||
157 | , 0.0, 0.0, 1.0, 3.0 | ||
158 | , 3.0, 0.0, 0.0, 4.0 | ||
159 | , 0.0, 3.0, 0.0, 5.0 | ||
160 | , 0.0, 0.0, 3.0, 6.0 ]@ | ||
161 | -} | ||
162 | -- (<|>) :: (Element t, Joinable a b) => a t -> b t -> Matrix t | ||
163 | a <|> b = joinH a b | ||
164 | |||
165 | -- -- | Vertical concatenation of matrices and vectors. | ||
166 | -- (<->) :: (Element t, Joinable a b) => a t -> b t -> Matrix t | ||
167 | a <-> b = joinV a b | ||
168 | |||
169 | ------------------------------------------------------------------- | ||
170 | |||
171 | {-# DEPRECATED vectorMin "use minElement" #-} | ||
172 | vectorMin :: (Container Vector t, Element t) => Vector t -> t | ||
173 | vectorMin = minElement | ||
174 | |||
175 | {-# DEPRECATED vectorMax "use maxElement" #-} | ||
176 | vectorMax :: (Container Vector t, Element t) => Vector t -> t | ||
177 | vectorMax = maxElement | ||