{-# LANGUAGE TypeFamilies #-}
module Numeric.LAPACK.Matrix.Shape.Box where

import qualified Data.Array.Comfort.Shape as Shape


class (Shape.C shape) => Box shape where
   type HeightOf shape
   type WidthOf shape
   height :: shape -> HeightOf shape
   width :: shape -> WidthOf shape

indices ::
   (Box shape,
    HeightOf shape ~ height, Shape.Indexed height,
    WidthOf shape ~ width, Shape.Indexed width) =>
   shape -> [(Shape.Index height, Shape.Index width)]
indices :: shape -> [(Index height, Index width)]
indices shape
sh = (height, width) -> [Index (height, width)]
forall sh. Indexed sh => sh -> [Index sh]
Shape.indices (shape -> HeightOf shape
forall shape. Box shape => shape -> HeightOf shape
height shape
sh, shape -> WidthOf shape
forall shape. Box shape => shape -> WidthOf shape
width shape
sh)