kigubkur.construct.blocking
Construct a block from a kigubkur© matrix or its inverse (unblock).
block
unblock
Examples
=> (def M [[1 2 3 4 5 6 7 8 9 10][11 12 13 14 15 16 17 18 19 20][21 22 23 24 35 26 27 28 29 30]])
=> (view M)
[1 2 3 4 5 6 7 8 9 10]
[11 12 13 14 15 16 17 18 19 20]
[21 22 23 24 35 26 27 28 29 30]
Order -> 3 x 10
Then, to create blocks of 5 x 5
=> (def B (block M 5))
=> B
[[{:A13 [[7 8 9] [17 18 19] [27 28 29]], :A11 [[1 2 3] [11 12 13] [21 22 23]], :A12 [[4 5 6] [14 15 16] [24 35 26]], :A14 [[10] [20] [30]]}]]
=> (view-block :A11 B)
[1 2 3]
[11 12 13]
[21 22 23]
Order -> 3 x 3
=> (view (unblock B))
[1 2 3 4 5 6 7 8 9 10]
[11 12 13 14 15 16 17 18 19 20]
[21 22 23 24 35 26 27 28 29 30]
Order -> 3 x 10
Note that
(block M 1)
and(block M 0)
are not allowed.
block
(block M sz)
Given that the parameter sz
is less than the number of rows or columns of the parentm×n, creates a blockM×N which is a column matrix where each row has one element, a map such that the column has
∙ multiple rows each with a map having ≥1 keys (:Aij
) if the parent is a matrix
∙ multiple rows each with a map having =1 key (:Ai1
) if the parent is a column matrix, and
∙ one row with a map having ≥1 keys (:A1j
) if the parent is a row matrix
Syntax: (block M sz)
s.t sz
∈ ℤ+ and sz
≤ m if m ≤ n or sz
≤ n if m ≥ n.
unblock
(unblock B)
Unblocks a given blocked matrix (to its mother matrix).
Syntax: (unblock B)