Two matrices side by side

I'm trying to typeset two matrices side by side, somewhat like:

A = (matrix)    B = (matrix)


I tried to next the matrices inside an align environment:

\begin{align*}
A &= \begin{pmatrix} ... \end{pmatrix} &
B &= \begin{pmatrix} ... \end{pmatrix}
\end{align*}


but I get when compiling:

Package amsmath Error: Erroneous nesting of equation structures

Presumably the way I'm trying to do it isn't the right way; how should I be doing this?

-
I tried something presumably just like this and did not get an error. Could you post a complete, minimal example that has this problem? –  Ryan Reich Dec 4 '10 at 22:53
Your code compiles for me. Perhaps you omitted something from your example? –  TH. Dec 4 '10 at 22:54
Oh, excuse me! I accidentally put the align* environment inside equation mode, when it should stand alone. Thanks for checking that for me (and sorry for my stupidity!). –  Ben Alpert Dec 4 '10 at 23:09
it would be nice if you would put that solution into an answer and mark this answer as accepted. In this way the question does not appear to be unsolved any more. –  Stefan Kottwitz Dec 4 '10 at 23:29

The error has been caused by accidentally nesting align* and equation, as Ben informed.
Displayed math environments cannot be nested. However, there are environments such as aligned and split which work inside an equation environment.