module BLAS.Matrix.Base (
Matrix(..),
isSquare,
isFat,
isTall,
) where
import BLAS.Elem.Base ( Elem )
import BLAS.Tensor.Base
class Matrix a where
numRows :: a (m,n) e -> Int
numCols :: a (m,n) e -> Int
herm :: Elem e => a (m,n) e -> a (n,m) e
isSquare :: (Matrix a) => a (m,n) e -> Bool
isSquare a = numRows a == numCols a
isFat :: (Matrix a) => a (m,n) e -> Bool
isFat a = numRows a <= numCols a
isTall :: (Matrix a) => a (m,n) e -> Bool
isTall a = numRows a >= numCols a
instance (Matrix a) => Tensor (a (m,n)) (Int,Int) e where
shape a = (numRows a, numCols a)
bounds a = ((0,0), (m1,n1))
where (m,n) = shape a