@@ -28,22 +28,15 @@ module Data.Semimodule.Vector (
2828) where
2929
3030import safe Control.Applicative
31- import safe Control.Category (Category , (>>>) )
3231import safe Data.Algebra
3332import safe Data.Bool
3433import safe Data.Distributive
35- import safe Data.Foldable as Foldable (fold , foldl' )
3634import safe Data.Functor.Rep
37-
38- import safe Data.Profunctor
3935import safe Data.Semifield
4036import safe Data.Semigroup.Foldable as Foldable1
4137import safe Data.Semimodule
4238import safe Data.Semiring
4339import safe Prelude hiding (Num (.. ), Fractional (.. ), negate , sum , product )
44- import safe qualified Prelude as P
45-
46-
4740
4841-------------------------------------------------------------------------------
4942-- V2
@@ -167,9 +160,9 @@ instance Semiring r => Algebra r I2 where
167160instance Semiring r => Composition r I2 where
168161 conjugateWith = id
169162
170- normWith f = flip multiplyWith I21 $ \ i1 i2 ->
171- flip multiplyWith I22 $ \ j1 j2 ->
172- f i1 * f i2 + f j1 * f j2
163+ normWith f = flip multiplyWith I21 $ \ ix1 ix2 ->
164+ flip multiplyWith I22 $ \ jx1 jx2 ->
165+ f ix1 * f ix2 + f jx1 * f jx2
173166
174167-------------------------------------------------------------------------------
175168-- V3
@@ -300,19 +293,19 @@ instance Ring r => Algebra r I3 where
300293instance Ring r => Composition r I3 where
301294 conjugateWith = id
302295
303- normWith f = flip multiplyWith' I31 $ \ i1 i2 ->
304- flip multiplyWith' I32 $ \ j1 j2 ->
305- flip multiplyWith' I33 $ \ k1 k2 ->
306- f i1 * f i2 + f j1 * f j2 + f k1 * f k2
296+ normWith f = flip multiplyWith' I31 $ \ ix1 ix2 ->
297+ flip multiplyWith' I32 $ \ jx1 jx2 ->
298+ flip multiplyWith' I33 $ \ kx1 kx2 ->
299+ f ix1 * f ix2 + f jx1 * f jx2 + f kx1 * f kx2
307300
308301 where
309- multiplyWith' f = f ' where
310- i31 = f I31 I31
311- i32 = f I32 I32
312- i33 = f I33 I33
313- f ' I31 = i31
314- f ' I32 = i32
315- f ' I33 = i33
302+ multiplyWith' f1 = f1 ' where
303+ i31 = f1 I31 I31
304+ i32 = f1 I32 I32
305+ i33 = f1 I33 I33
306+ f1 ' I31 = i31
307+ f1 ' I32 = i32
308+ f1 ' I33 = i33
316309
317310
318311-------------------------------------------------------------------------------
@@ -346,7 +339,7 @@ instance Ring r => Composition r QuaternionBasis where
346339 f' I32 = negate . f $ Just I32
347340 f' I33 = negate . f $ Just I33
348341
349- normWith f = flip multiplyWith zero $ \ i1 i2 -> f i1 * conjugateWith f i2
342+ normWith f = flip multiplyWith zero $ \ ix1 ix2 -> f ix1 * conjugateWith f ix2
350343
351344instance Field r => Division r QuaternionBasis where
352345 reciprocalWith f i = conjugateWith f i / normWith f
0 commit comments