Browse files

Sn Functions Implemented

  • Loading branch information...
1 parent 4662c24 commit 9c40aea1b6ad8944c4c5ca772ab7e4662f735599 Grant Rotskoff committed May 7, 2012
Showing with 22 additions and 12 deletions.
  1. +7 −4 fft.hs
  2. +12 −1 matrix.hs
  3. +0 −1 sn.hs
  4. +3 −6 tableau.hs
View
11 fft.hs
@@ -14,12 +14,15 @@ import Partitions
import Tableau
import Matrix
import Functions
+import qualified Data.Map as Map
--- Untyped for the moment
+-- Untyped for the moment:
-- Sum i = 1 .. n
-fft f l = sum
- prefactor = map (\i -> yor l [[1..i]]) [1..n]
- fft adapt f l
+-- Data Structures!
+
+fft f _ (Part [1]) = eval f (Perm $ Map.fromList [(1,1)])
+fft f tau l = sum $ fftFactors where
+ fftFactors = [ (yor (i..n) l) (fft f' (adapt tau) l) | i <-[f1..n]]
View
13 matrix.hs
@@ -32,9 +32,20 @@ toVec a = V $ Map.fromList $ zip [0..((fi $ length a) - 1)] a
fromVec :: Vector a -> [a]
fromVec (V a) = snd $ unzip $ Map.toList a
-
(?) :: (Vector a) -> Integer -> a
(?) (V m) i = m Map.! i
makeSparseVec :: (Num a) => [(Integer,a)] -> Integer -> Vector a
makeSparseVec kvs n = V $ Map.fromList $ kvs ++ [(i,0)|i<-[0..n-1], not $ i `elem` (fst $ unzip kvs)]
+
+dot :: (Num a) => [a] -> [a] -> a
+dot a b = sum $ zipWith (*) a b
+
+-- Column vectors, as in Young's Orthogonal Representation
+multColumnMatrix :: (Num a) => [[a]] -> [[a]] -> [[a]]
+multColumnMatrix m0 m1 = fromRows $ [row i|i<-[0..length(m1)-1]] where
+ row i = [dot (m0row i) c1 | c1 <- m1]
+ m0row i = map (!! i) m0
+
+fromRows :: [[a]] -> [[a]]
+fromRows m = map (\i -> m !! i) [0..length(m)-1]
View
1 sn.hs
@@ -124,7 +124,6 @@ toAdjacent = (concatMap transToAdj) . toTrans . toCycles
at = (Map.!)
-
adapt :: Permutation -> (Permutation,[[Int]])
adapt (Perm p) = (inv(fromCycles o' n)&(Perm p'),o') where
o' = [[(p `at` n)..n]]
View
9 tableau.hs
@@ -56,10 +56,10 @@ dist i j t = (content t j) - (content t i)
--TODO
-- Young's Orthogonal Representation
--- List of Matrices... multiply them
-yor :: Permutation -> Partition -> [[[Double]]] --Irrep
-yor tau p = map (\i -> yorSimple i p) (map head $ toAdjacent tau)
+-- List of Matrices... multiply them
+yor :: Permutation -> Partition -> [[Double]] --Irrep
+yor tau p = foldr1 multColumnMatrix $ map (\i -> yorSimple i p) (map head $ toAdjacent tau)
yorSimple :: Int -> Partition -> [[Double]]
yorSimple i (Part p) = [fromVec $ yorColumn [i,i+1] (fromIntegral ci) t |
@@ -85,9 +85,6 @@ adjImage i (YT t) = actBy perm (YT t) where
order = sum $ map length t
-- Given a partition, return the list of standard tableau of the same shape
--- TODO: Hard code certain shapes, so the search terminates
--- Length of list is equal to the dimension of the rep! Terminate if hookLength is reached!
--- Write as a list comprehension
standard :: Partition -> [YoungTableau]
standard (Part a) = take (fromIntegral $ dim $ Part a) $ filter isStandard $ map (\i -> actBy (s n !! (i-1)) (standardTableau (Part a))) ([1..order]) where
n = sum a

0 comments on commit 9c40aea

Please sign in to comment.