Operators and hypercubes

BBTools is rooted in the idea that any linear transformation can be represented as an operator that acts on a column-vector. While this may sound innocent, it implies a mental model that may be unfamiliar to many.

In most cases we do not think much about the meaning of a "matrix". To work efficiently with BBTools, it is advantageous to distinguish between operators (linear trabsforms) and hypercubes (data arrays).

Those who prefer to read about it when the problem surfaces may go directly to the section explaining how to combine black-box operators. The remaining part of this section attempts to discern the different class of matrices.

In a nutshell

The most immediate consequence of the policy is that any matrix/array must be converted to a column-vector before an operation can be applied.

Assume that IMG is an 100-by-100 image. Traditionally you might want to do something like the following:

IMG2=5*IMG(1:50,20:90);
IMG2=convn(IMG2,K);

In BBTools, however, you would instead do something like this:

[A1,dim1]=bbredim([100,100],[1,20;50,90]);
[A2,dim]=bbconvn(dim1,K);
A=A2*5*A1;
IMG2=reshape(A*IMG(:),dim);

This may look unnecessarily complex, but it has the advantage that the steps are captured in A. This allows us to pass it as an argument to a function, which can be blissfully ignorant that IMG represents an image.

Perhaps the most compelling reason for using BBTools is that we can compute the adjoint A'*y directly. A number of iterative routines, including those found in BBTools, require this ability.