chebfun/chebfun — pull request #1279 by aaustin141 (2014-11-21 10:19:31+00:00)
Title: Fix dimension-related bugs in chebfun.mtimes().

It seems that we made a couple of errors in how dimensions are checked throughout `chebfun.mtimes()`. Ticket #1215 (which this commit resolves) points out one of them, but while fixing it, we found more. This commit addresses these issues by rewriting `mtimes()` to ensure that (1) we don't inappropriately swap the order of the inputs (the problem in #1215) and (2) that the dimension checks are handled correctly. Several tests have been added to guard against similar mistakes in the future.

While we were at it, we noticed that `chebfun2.outerProduct()` was failing for quasimatrix (array-of-chebfuns) inputs. We fix this by replacing two accesses to the `.domain` property of a chebfun with calls to the `domain()` function. In reality, this is not very useful, since if you build a chebfun2 this way, any operations with it (including `display()`) will result in crashes, but it at least removes a potential source of asymmetry between array-valued chebfuns and quasimatrices in `chebfun.mtimes()`. Perhaps it would be better to try to coerce quasimatrices into array-valued chebfuns whenever an outer product needs
to be computed and fail if the conversion is not successful. Nevertheless, this is a side issue and should be handled separately.

Finally, these changes flushed out a handful of places where matrices were being multiplied in a dimension-mismatched manner but the result was still OK due to the error made in #1215. These occurred in the following files:

- `@chebfun2/lu.m`
- `@chebfun2/volt.m`
- `tests/misc/quantumstates.m`

This commit fixes these issues as well.