Download haskell/test_exact_fixed.hs from Snapkitty/sov-kernel-monster: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/Snapkitty/sov-kernel-monster/resolve/main/haskell/test_exact_fixed.hs
- Command line
-
hf download hf://Snapkitty/sov-kernel-monster/haskell/test_exact_fixed.hs
-
curl -L -o test_exact_fixed.hs https://huggingface.co/Snapkitty/sov-kernel-monster/resolve/main/haskell/test_exact_fixed.hs
1.03 kB
| module Main where | |
| data Complex = Complex Double Double deriving (Show) | |
| data Vector = Vector [Double] deriving (Show) | |
| data QuantumBranch = QuantumBranch | |
| { branchId :: Int | |
| , branchLabel :: String | |
| , amplitude :: Complex | |
| , stateVector :: Vector | |
| , probability :: Double | |
| , decoherenceTime :: Double | |
| } deriving (Show) | |
| vectorAdd :: Vector -> Vector -> Vector | |
| vectorAdd (Vector a) (Vector b) = Vector (zipWith (+) a b) | |
| initializeSuperposition :: String -> Int -> Vector -> [QuantumBranch] | |
| initializeSuperposition regionId numBranches center = | |
| let initialBranches = [ QuantumBranch | |
| { branchId = i | |
| , branchLabel = "branch-" ++ show i | |
| , amplitude = Complex (1.0 / sqrt (fromIntegral numBranches)) 0.0 | |
| , stateVector = vectorAdd center (Vector [sin (fromIntegral i), cos (fromIntegral i), 0]) | |
| , probability = 1.0 / fromIntegral numBranches | |
| , decoherenceTime = 1.0 / fromIntegral (i + 1) | |
| } | |
| | i <- [0..numBranches-1] | |
| ] | |
| in initialBranches | |
| main = return () | |