Function File: s = blksparse (i, j, sv)
Function File: s = blksparse (i, j, sv, m, n)
Function File: s = blksparse (…, mode)

Construct a block sparse matrix. The meaning of arguments is analogous to the built-in sparse function, except that i, j are indices of blocks rather than elements, and sv is a 3-dimensional array, the first two dimensions determining the block size. Optionally, m and n can be specified as the true block dimensions; if not, the maximum values of i, j are taken instead. The resulting sparse matrix has the size

  [m*p, n*q]

where

  p = size (sv, 1)
  q = size (sv, 2)

The blocks are located so that

s(i(k):i(k)+p-1, j(k):j(K)+q-1) = sv(:,:,k)

Multiple blocks corresponding to the same pair of indices are summed, unless mode is "unique", in which case the last of them is used.

Package: linear-algebra