{-# LANGUAGE CPP, TemplateHaskell #-}
-----------------------------------------------------------------------------
--
-- Module      :  Main
-- Copyright   :
-- License     :  AllRightsReserved
--
-- Maintainer  :
-- Stability   :
-- Portability :
--
-- |
--
-----------------------------------------------------------------------------

module Main (
    main
) where

import System.Environment
import System.Time
import Handy
import Data.Array.Parallel.PArray


main::IO()
main = do
    (n::Int) <- (read . head) `fmap` getArgs
    let (parrID :: PArray (PArray Double)) = fromList [fromList [(if y == z then 1 else 0) | y <- [1..n]] | z <- [1..n]]
    time $ printResult parrID

printResult :: PArray (PArray Double) -> IO ()
printResult arr = print $ maxEltDiagMMult arr arr

time :: forall a. IO a -> IO ()
time act = do
    t0 <- getClockTime
    _ <- act
    t1 <- getClockTime
    print $ diffClockTimes t1 t0

