Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Square arrays, where the number of rows and columns are equal.
Synopsis
- type Square t = [[t]]
- sq_map :: (t -> t) -> Square t -> Square t
- sq_scale :: Num t => t -> Square t -> Square t
- sq_zip :: (t -> t -> t) -> Square t -> Square t -> Square t
- sq_mul :: Num t => Square t -> Square t -> Square t
- sq_add :: Num t => Square t -> Square t -> Square t
- sq_sum :: Num t => [Square t] -> Square t
- sq_is_square :: Square t -> Bool
- type Square_Linear t = [t]
- sq_from_list :: Int -> Square_Linear t -> Square t
- sq_is_linear_square :: Square_Linear t -> Bool
- sq_linear_degree :: Square_Linear t -> Int
- sq_transpose :: Square t -> Square t
- sq_diagonals_ul_lr :: Square t -> Square t
- sq_diagonals_ll_ur :: Square t -> Square t
- sq_undiagonals_ul_lr :: Square t -> Square t
- sq_undiagonals_ll_ur :: Square t -> Square t
- sq_diagonal_ul_lr :: Square t -> [t]
- sq_diagonal_ll_ur :: Square t -> [t]
- sq_h_reflection :: Square t -> Square t
- sq_is_normal :: Integral n => Square n -> Bool
- sq_sums :: Num n => Square n -> ([n], [n], [n], [n])
- sq_opt :: Text_Table_Opt
- sq_pp :: Show t => Square t -> String
- sq_wr :: Show t => Square t -> IO ()
- sq_pp_m :: Show t => String -> Square (Maybe t) -> String
- sq_wr_m :: Show t => String -> Square (Maybe t) -> IO ()
- type Square_Ix = Ix Int
- type Square_Map t = Map Square_Ix t
- sq_to_map :: Square t -> Square_Map t
- sqm_ix :: Square_Map t -> Square_Ix -> t
- sqm_ix_seq :: Square_Map t -> [Square_Ix] -> [t]
- sqm_to_partial_sq :: Int -> Square_Map t -> [Square_Ix] -> Square (Maybe t)
- sq_trs_op :: [(String, Square t -> Square t)]
- sq_trs_seq :: Square t -> [(String, Square t)]
Documentation
sq_zip :: (t -> t -> t) -> Square t -> Square t -> Square t Source #
f pointwise at two squares (of equal size, un-checked)
type Square_Linear t = [t] Source #
Square as row order list
sq_from_list :: Int -> Square_Linear t -> Square t Source #
Given degree of square, form Square
from Square_Linear
.
sq_is_linear_square :: Square_Linear t -> Bool Source #
True if list can form a square, ie. if length
is a square.
sq_is_linear_square T.a126710 == True
sq_linear_degree :: Square_Linear t -> Int Source #
Calculate degree of linear square, ie. square root of length
.
sq_linear_degree T.a126710 == 4
sq_diagonals_ul_lr :: Square t -> Square t Source #
Full upper-left (ul) to lower-right (lr) diagonals of a square.
sq = sq_from_list 4 T.a126710 sq_wr $ sq sq_wr $ sq_diagonals_ul_lr sq sq_wr $ sq_diagonals_ll_ur sq sq_undiagonals_ul_lr (sq_diagonals_ul_lr sq) == sq sq_undiagonals_ll_ur (sq_diagonals_ll_ur sq) == sq
sq_diagonal_ul_lr sq == sq_diagonals_ul_lr sq !! 0 sq_diagonal_ll_ur sq == sq_diagonals_ll_ur sq !! 0
sq_diagonals_ll_ur :: Square t -> Square t Source #
Full lower-left (ll) to upper-right (ur) diagonals of a square.
sq_undiagonals_ul_lr :: Square t -> Square t Source #
Inverse of diagonals_ul_lr
sq_undiagonals_ll_ur :: Square t -> Square t Source #
Inverse of diagonals_ll_ur
sq_diagonal_ul_lr :: Square t -> [t] Source #
Main diagonal (upper-left -> lower-right)
sq_diagonal_ll_ur :: Square t -> [t] Source #
Main diagonal (lower-left -> upper-right)
sq_h_reflection :: Square t -> Square t Source #
Horizontal reflection (ie. map reverse).
sq = sq_from_list 4 T.a126710 sq_wr $ sq sq_wr $ sq_h_reflection sq
sq_is_normal :: Integral n => Square n -> Bool Source #
An n×n square is normal if it has the elements (1 .. n×n).
sq_sums :: Num n => Square n -> ([n], [n], [n], [n]) Source #
Sums of (rows, columns, left-right-diagonals, right-left-diagonals)
PP
Square Map
type Square_Map t = Map Square_Ix t Source #
Map from Square_Ix to value.
sq_to_map :: Square t -> Square_Map t Source #
Square
to Square_Map
.
sqm_ix_seq :: Square_Map t -> [Square_Ix] -> [t] Source #
sqm_to_partial_sq :: Int -> Square_Map t -> [Square_Ix] -> Square (Maybe t) Source #