calcCovariance :: Vector Double -> 
                  Vector Double -> 
                  (Vector Double -> (Double,Vector Double)) ->
                  (Vector Double -> Double) -> 
                  Either (Vector Double) (Matrix Double, Matrix Double, Matrix Double)
calcCovariance vinit vnear postgrad posterior = finalcov where
   ndim = dim vinit
   finalcov 
     | ndim > 0 -- > 20000 --FIXME 
        = Left $ calcFDindepVars vinit vnear posterior --Left $ iCov vinit -- 
     | otherwise 
        = hessToCov (calcFDhess vinit vnear postgrad) Nothing
calcCovariance :: Vector Double -> 
                  Vector Double -> 
                  (Vector Double -> (Double,Vector Double)) ->
                  (Vector Double -> Double) -> 
                  Either (Vector Double) (Matrix Double, Matrix Double, Matrix Double)
calcCovariance vinit vnear postgrad posterior = finalcov where
   ndim = dim vinit
   finalcov 
     | ndim > 0 -- > 20000 --FIXME 
        = Left $ calcFDindepVars vinit vnear posterior --Left $ iCov vinit -- 
     | otherwise 
        = hessToCov (calcFDhess vinit vnear postgrad) Nothing
calcCovariance vinit vnear postgrad posterior = finalcov where
   ndim = dim vinit
   finalcov 
     | ndim > 0 -- > 20000 --FIXME 
        = Left $ calcFDindepVars vinit vnear posterior --Left $ iCov vinit -- 
     | otherwise 
        = hessToCov (calcFDhess vinit vnear postgrad) Nothing