spBlkDiag

PURPOSE ^

Creates a sparse block diagonal matrix from a 3D array.

SYNOPSIS ^

function [B,inds] = spBlkDiag( A, inds )

DESCRIPTION ^

 Creates a sparse block diagonal matrix from a 3D array.

 Given an [mxnxk] matrix A, construct a sparse block diagonal matrix B of
 dims [m*k x n*k], containing k blocks of size mxn each, where each block
 i is taken from A(:,:,i).

 When computing B, a time consuming step is to compute a series of
 indices. These indices are fixed for given dims of A and can be re-used.
 spBlkDiag's additional input/output can be used to cache these indices.

 USAGE
  [B, inds] = spBlkDiag( A, [inds] )

 INPUTS
  A       - [m x n x k] input matrix of k mxn blocks
  inds    - cached indices for faster computation

 OUTPUT
  B       - [m*k x n*k] sparse block diagonal matrix with k mxn blocks
  inds    - cached indices for faster computation

 EXAMPLE
  A=rand(3,4,2); B=spBlkDiag(A); full(B)

 See also SPARSE, BLKDIAG

 Piotr's Computer Vision Matlab Toolbox      Version 2.35
 Copyright 2014 Piotr Dollar.  [pdollar-at-gmail.com]
 Licensed under the Simplified BSD License [see external/bsd.txt]

Generated by m2html © 2003